[69b442]: configure.in Maximize Restore History

Download this file

configure.in    591 lines (491 with data), 14.7 kB

dnl
dnl Configure.in for xine
dnl

AC_INIT(src/xitk/main.c)

dnl
dnl Require autoconf version 2.13
dnl
AC_PREREQ(2.13)

dnl
dnl Require libtool minimum version 1.4.0
dnl
dnl AC_PREREQ_LIBTOOL(1.4.0,,AC_MSG_ERROR(*** You should have libtool >= 1.4 installed ***))

XINE_MAJOR=0
XINE_MINOR=9
XINE_SUB=7
XINE_PRE="cvs"

TAR_NAME="xine-ui-"$XINE_MAJOR.$XINE_MINOR.$XINE_SUB$XINE_PRE
SPEC_VERSION=$XINE_MAJOR.$XINE_MINOR.$XINE_SUB$XINE_PRE
AC_SUBST(XINE_MAJOR)
AC_SUBST(XINE_MINOR)
AC_SUBST(XINE_SUB)
AC_SUBST(TAR_NAME)
AC_SUBST(SPEC_VERSION)

AM_INIT_AUTOMAKE("xine-ui", $XINE_MAJOR.$XINE_MINOR.$XINE_SUB$XINE_PRE)

dnl
dnl Made possible to build for another arch.
dnl
if test x$XINE_BUILD != "x"; then
  AC_MSG_RESULT(*** build forced to $XINE_BUILD ***)
  build=$XINE_BUILD
  host=$XINE_BUILD
else
  check_athlon=yes
fi

AC_CANONICAL_HOST
AM_CONFIG_HEADER(config.h)

dnl
dnl Check for programs.
dnl
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AC_PROG_MAKE_SET
AC_PROG_INSTALL
dnl obsolete AC_PROG_RANLIB
AC_PROG_LN_S

dnl
dnl Libtool
dnl
AC_LIBTOOL_DLOPEN
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
  STATIC="-static"
else
  STATIC=
fi
AC_SUBST(STATIC)


dnl
dnl Build all libs as static
dnl
BUILD_LIB_STATIC="-static"
BUILD_LIB_STATIC=""
AC_SUBST(BUILD_LIB_STATIC)


dnl
dnl NLS Support
dnl
dnl AM_WITH_NLS(use-libtool,,)
dnl ALL_LINGUAS="cs da de el en@quot en@boldquot es et fr gl id it ja ko nl nn no pl pt pt_BR ru sl sv tr zh"
ALL_LINGUAS="fr es pt_BR"
AM_GNU_GETTEXT dnl (use-libtool)
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
if test x"$USE_INCLUDED_LIBINTL" = x"yes"; then
   INTLDIR="-I\$(top_builddir)/intl -I\$(top_srcdir)/intl"
fi
AC_SUBST(INTLDIR)


dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AM_TYPE_PTRDIFF_T
dnl AC_C_BIGENDIAN

AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(GLOBAL_CFLAGS)
dnl AC_SUBST(ROOT_CFLAGS)
dnl AC_SUBST(TOOLS_CFLAGS)


dnl
dnl Check for xine-lib
dnl
AM_PATH_XINE(0.9.4,, AC_MSG_ERROR(*** You should install xine-lib first ***))


dnl
dnl threads: xine-config tell us what should be used, but
dnl          xitk need to be linked to thread lib, so the follow AC_SUBST() 
dnl          are only used in src/xitk/xine-toolkit/Makefile.am
dnl
case "$host" in
  *-*-freebsd*)
    THREAD_LIBS="-L/usr/local/lib -pthread"
    THREAD_CFLAGS="-I/usr/local/include -D_THREAD_SAFE"
    CFLAGS="$CFLAGS -L/usr/local/lib $THREAD_CFLAGS"
    CPPFLAGS="$CPPFLAGS -I/usr/local/include -L/usr/local/lib"
    ;;
  *)
    AC_CHECK_LIB(pthread, pthread_create,
  	     THREAD_LIBS="-lpthread",
 	     AC_MSG_ERROR(pthread needed))
    ;;
esac
AC_SUBST(THREAD_LIBS)
AC_SUBST(THREAD_CFLAGS)


dnl
dnl dynamic linker
dnl
AC_CHECK_LIB(c, dlopen,
	     DYNAMIC_LD_LIBS="",
	     AC_CHECK_LIB(dl, dlopen,
             	          DYNAMIC_LD_LIBS="-ldl",
	                  AC_MSG_ERROR(dynamic linker needed)))
AC_SUBST(DYNAMIC_LD_LIBS)


dnl
dnl Checks for X11
dnl
AC_PATH_XTRA
if test x"$no_x" != x"yes"; then
    AC_DEFINE(HAVE_X11)
fi


dnl
dnl Checks for Xinerama extension
dnl

AC_CHECK_LIB(Xinerama, XineramaQueryExtension, 
             X_PRE_LIBS="$X_PRE_LIBS -lXinerama"
             AC_DEFINE(HAVE_XINERAMA)
             ac_have_xinerama="yes",,
             $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
AM_CONDITIONAL(HAVE_XINERAMA, test x$ac_have_xinerama = "xyes")

dnl
dnl Checks for XF86VidMode extension
dnl

AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, 
             X_PRE_LIBS="$X_PRE_LIBS -lXxf86vm"
             AC_DEFINE(HAVE_XF86VIDMODE)
             ac_have_xf86vidmode="yes",,
             $X_LIBS $X_PRE_LIBS -lXext $X_EXTRA_LIBS)
AM_CONDITIONAL(HAVE_XF86VIDMODE, test x$ac_have_xf86vidmode = "xyes")


dnl
dnl Check for DPMS location
dnl
AC_CHECK_LIB(Xext, DPMSQueryExtension,
	     DPMS_LIBS=""
	     AC_DEFINE(HAVE_DPMS),
             AC_CHECK_LIB(Xdpms, DPMSQueryExtension, 
                          DPMS_LIBS="-lXdpms"
			  AC_DEFINE(HAVE_DPMS),, $X_LIBS), 
             $X_LIBS)
AC_SUBST(DPMS_LIBS)
 

dnl
dnl check for ascii-art library
dnl
AM_PATH_AALIB(1.2,,)
AM_CONDITIONAL(HAVE_AA, test x$no_aalib != "xyes")


dnl
dnl check for libpng
dnl
AC_ARG_WITH(png-prefix,
    [  --with-png-prefix=PFX   Prefix where PNG library is installed (optional)], png_prefix="$withval", png_prefix="")

if test x"$png_prefix" != "x"; then
    PNG_LIB="-L$png_prefix/lib"
    PNG_CFLAGS="-I$png_prefix/include"
    old_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $PNG_CFLAGS"
fi

dnl
dnl First, add -L and -R options for png and X11 to LDFLAGS.
dnl LDFLAGS are passed to the compiler before LIBS; this is important for
dnl some non-gcc compilers, which need a -L{dir} option before a -l{lib}
dnl to see the library we are looking for in directory "dir"
dnl
dnl BTW: Do we really need the X11 library path ($X_LIBS) for a libpng check?
dnl
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$X_LIBS $PNG_LIB $LDFLAGS"


dnl
dnl Look for a -lpng library, that provides a png_read_info routine
dnl If we find such a library,  check that the png.h header is available, too.
dnl
AC_CHECK_LIB(png, png_read_info,
  [AC_CHECK_HEADER(png.h, png_ok=yes, png_ok=no)],
  [AC_MSG_ERROR([*** libpng is needed (PNG library not found) - try to use --with-png-prefix option ***])], [-lz -lm])

if test x"$png_prefix" != "x"; then
    CPPFLAGS="$old_CPPFLAGS"
fi
LDFLAGS="$old_LDFLAGS"

if test x"$png_ok" = xyes; then

    dnl OK, -lpng library and <png.h> header found.
    dnl Check if this png is an old png version.

    saved_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $PNG_CFLAGS"

    AC_MSG_CHECKING([for png_structp in png.h])
    AC_TRY_COMPILE([#include <png.h>],
	[
	png_structp pp; 
	png_infop info; 
	png_colorp cmap; 

	png_create_read_struct; 
	png_set_IHDR;
	], png_ok=yes, png_ok=no)

    AC_MSG_RESULT($png_ok)
    if test x"$png_ok" = xno; then
    	AC_MSG_ERROR([*** libpng is needed (PNG library is too old) ***])
    fi
    CFLAGS="$saved_CFLAGS"
else
    AC_MSG_ERROR([*** libpng is needed (PNG header file not found) - try to use --with-png-prefix option ***])
fi


if test x"$png_ok" = xyes; then
    X_PRE_LIBS="$X_PRE_LIBS $PNG_LIB -lpng -lz -lm"
    X_CFLAGS="$X_CFLAGS $PNG_CFLAGS"
fi

dnl
dnl
dnl
AC_CHECK_LIB(posix4, nanosleep)
AC_CHECK_FUNCS(vsnprintf snprintf strsep nanosleep)
AC_CHECK_HEADER(stdarg.h, AC_DEFINE(HAVE_STDARGS))
AC_CHECK_HEADERS(string.h strings.h alloca.h)


dnl
dnl Check for LIRC client support
dnl
AC_CHECK_LIRC


dnl
dnl CORBA support
dnl
AC_ARG_ENABLE(orbit,[  --enable-orbit          build orbit dependant parts of xine [default=no]], , enable_orbit=no)

if test "x$enable_orbit" = "xyes"; then
  AM_PATH_ORBIT(0.4.0, [
    AC_DEFINE(HAVE_ORBIT)
    ORBIT_LIBS="$ORBIT_LIBS -lORBitCosNaming"
  ], [
    AC_MSG_RESULT(*** All of ORBit dependent parts will be disabled ***)
    enable_orbit=no])
fi

AM_CONDITIONAL(HAVE_ORBIT, test x"$enable_orbit" = "xyes")
if test x"$enable_orbit" = "xyes"; then
   CORBA_DEP=""
else 
   CORBA_DEP="#"
fi
AC_SUBST(CORBA_DEP)


if test "$GCC" = yes; then
    dnl
    dnl check cflags not supported by all gcc versions
    dnl eg: -mpreferred-stack-boundary=2 and 2.91.66,
    dnl and gcc-2.7.2.3 support a bit less options
    dnl
    AC_TRY_CFLAGS("-mpreferred-stack-boundary=2", 
	m_psb="-mpreferred-stack-boundary=2", m_psb="")
    AC_TRY_CFLAGS("-fno-strict-aliasing", f_nsa="-fno-strict-aliasing", f_nsa="")
    AC_TRY_CFLAGS("-fschedule-insns2", f_si="-fschedule-insns2", f_si="")
    AC_TRY_CFLAGS("-mwide-multiply", m_wm="-mwide-multiply", m_wm="")
fi

dnl Flags not supported by all *cc* variants
AC_TRY_CFLAGS("-Wall", wall="-Wall", wall="")

dnl Common cflags for all platforms
COMMON_CFLAGS="$wall -D_FILE_OFFSET_BITS=64"


host_or_hostalias="$host"
if test "$host_or_hostalias" = ""; then
    dnl user has called ./configure with a host parameter unknown to
    dnl config.sub
    dnl
    dnl Try the following switch with user's original host-alias
    dnl input instead.
    dnl
    host_or_hostalias="$host_alias"
fi

case "$host_or_hostalias" in
  i386-*-freebsd*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -pipe -fomit-frame-pointer -malign-functions=4 -malign-loops=4 -malign-jumps=4 -malign-functions=4 $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -finline-functions"
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS $CFLAGS -D_REENTRANT"
    DEBUG_CFLAGS="$X_CFLAGS $DEBUG_CFLAGS -D_REENTRANT -DDEBUG"
    AC_DEFINE(__i386__)
    AC_DEFINE([ARCH_X86],,[x86 architecture])
    ;;

  i?86*-*-linux* | i386-*-solaris* | i?86-* | k?-* | athlon-*)
    if test "$GCC" = yes; then

	dnl Check for gcc cpu optimization support
	AC_TRY_CFLAGS("-mcpu=i386", 
	    sarchopt="-mcpu",
	    AC_TRY_CFLAGS("-march=i386", 
		sarchopt="-march",
	        [ AC_MSG_RESULT(** no cpu optimization supports **)
	          sarchopt=no ]))

	dnl special check for k7 cpu CC support
        AC_TRY_CFLAGS("$sarchopt=athlon", k7cpu="athlon", k7cpu="i686")

	dnl add x86 specific CFLAGS
	GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -pipe -fomit-frame-pointer -malign-functions=4 -malign-loops=4 -malign-jumps=4 -malign-functions=4 $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -funroll-all-loops -finline-functions"
	DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
	
	dnl enable x86 specific parts of the code

	if test x"$sarchopt" != "xno"; then
	[
	    archopt_val=

	    case "$host_alias" in
	    i386-*) # *BSD return this even on a P III #-))
		archopt_val=i386 ;;
	    i486-*) # oh dear!
		archopt_val=i486 ;;
	    i586-*)
		archopt_val=pentium ;;
	    i686-*)
		archopt_val=pentiumpro
		if test x"$check_athlon" = "xyes"; then
		    if test -f /proc/cpuinfo; then
			modelname=`cat /proc/cpuinfo | grep "model\ name\	:" | sed -e 's/ //g' | cut -d':' -f2`
			case "$modelname" in
			*Athlon* | *Duron* | *K7*)
			    archopt_val="$k7cpu" ;;
			esac
		    fi 
		fi
		;;
	    k6-*)
		archopt_val=k6 ;;
	    k7-*)
		archopt_val=k7 ;;
	    athlon-*)
		archopt_val=athlon ;;
	    esac

	    if test x"$archopt_val" != x; then
		GLOBAL_CFLAGS="$GLOBAL_CFLAGS $sarchopt=$archopt_val"
		DEBUG_CFLAGS="$DEBUG_CFLAGS $sarchopt=$archopt_val"
	    fi
	]
	fi

    else
	dnl add x86 specific cc CFLAGS
	GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O"
	DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
    fi

    AC_DEFINE(__i386__)
    AC_DEFINE([ARCH_X86],,[x86 architecture])
    ;;

  alphaev56-*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -mcpu=ev56 -mieee"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O3 -mcpu=ev56 -mieee"
    ;;

  alpha*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -mieee"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O3 -mieee"
    ;;

  ppc-*-linux-* | powerpc-*) 
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3 -pipe -fomit-frame-pointer $m_wm $m_psb -fexpensive-optimizations $f_si $f_nsa -ffast-math -funroll-loops -funroll-all-loops -finline-functions"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
    ;;

  sparc64-*-linux-* | sparc-*)
    if test "$GCC" = yes; then
	GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3"
	DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
    else
	GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O"
	DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
    fi
    ;;

  mips-*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
    ;;

  m68k-*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O2"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O"
    ;;

  ia64-*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
    ;;

  s390-*)
    GLOBAL_CFLAGS="$GLOBAL_CFLAGS -O3"
    DEBUG_CFLAGS="$DEBUG_CFLAGS -O3"
    ;;

  *)
    echo "Host type '$host' ($host_alias) is currently not supported by xine"
    exit 1
    ;;
esac

GLOBAL_CFLAGS="$GLOBAL_CFLAGS $COMMON_CFLAGS $ALSA_CFLAGS $ESD_CFLAGS"
DEBUG_CFLAGS="$DEBUG_CFLAGS $COMMON_CFLAGS $ALSA_CFLAGS $ESD_CFLAGS -g -DDEBUG"

dnl gcc __attribute__ ((aligned ()))
AC_C_ATTRIBUTE_ALIGNED


dnl
dnl Check for GNU getopt_long()
dnl
AC_MSG_CHECKING(for GNU getopt_long)
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>

static struct option long_options[] = {
  {"help"    , no_argument, 0, 1 },
  {"version" , no_argument, 0, 2 },
  {0         , no_argument, 0, 0 }
};

int main(int argc, char **argv) {
  int option_index = 0;
  int c;

  opterr = 0;
  while((c = getopt_long(argc, argv, "?hv", 
			 long_options, &option_index)) != EOF) {
  }
  return 0;
}
], [AC_MSG_RESULT(yes); ac_getopt_long=yes; AC_DEFINE(HAVE_GETOPT_LONG)], 
   [AC_MSG_RESULT(no); ac_getopt_long=no],
   [AC_MSG_RESULT(no); ac_getopt_long=no])
AM_CONDITIONAL(HAVE_GETOPT_LONG, test x"$ac_getopt_long" = "xyes")


dnl
dnl skins dir location, xine-config told us about this.
dnl
XINE_SKINDIR="$xine_skin_dir"
AC_SUBST(XINE_SKINDIR)
dnl
dnl desktop dir location, xine-config told us about this.
dnl
escapedprefix="`echo $prefix | sed -e 's/\\//\\\\\//g'`"
XINE_SCRIPTDIR="`echo $xine_script_dir|sed -e 's/\^'$escapedprefix/'\${prefix}'/`"
AC_SUBST(XINE_SCRIPTDIR)
AC_DEFINE_UNQUOTED(XINE_SCRIPTDIR, "$XINE_SCRIPTDIR")
XINE_DESKTOPDIR="`echo $xine_desktop_dir|sed -e 's/\^'$escapedprefix/'\${prefix}'/`"
AC_SUBST(XINE_DESKTOPDIR)


dnl
dnl NLS, part II
dnl
if test "x$prefix" = xNONE; then
   prefix="${ac_default_prefix}"
fi
if test "x$exec_prefix" = xNONE; then
   exec_prefix='${prefix}'
fi
XITK_LOCALEDIR="${datadir}/locale"
eval XITK_LOCALE=`eval echo "$XITK_LOCALEDIR"`
AC_SUBST(XITK_LOCALE)
AC_DEFINE_UNQUOTED(XITK_LOCALE, "$XITK_LOCALE")

XINE_DOCPATH="${datadir}/doc/xine-ui"
eval XINE_DOCDIR=`eval echo "$XINE_DOCPATH"`
AC_SUBST(XINE_DOCDIR)
AC_DEFINE_UNQUOTED(XINE_DOCDIR, "$XINE_DOCDIR")


dnl
dnl Some include paths ( !!! DO NOT REMOVE !!! )
dnl
INCLUDES='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/src -I$(top_builddir)/src -I$(top_srcdir)/src/common -I$(top_builddir)/src/common -I$(top_srcdir)/src/xitk/xine-toolkit -I$(top_builddir)/src/xitk/xine-toolkit -I$(prefix)/include $(INTLDIR)'
AC_SUBST(INCLUDES)

AC_DEFINE(NEED_MRLBROWSER)

dnl
dnl Output configuration files
dnl

AC_OUTPUT([
Makefile
m4/Makefile
intl/Makefile
src/Makefile
src/common/Makefile
src/corba/Makefile
src/Imlib-light/Makefile
src/xitk/Makefile
src/xitk/xine-toolkit/Makefile
src/xitk/xine-toolkit/po/Makefile.in
src/xitk/skins/Makefile
src/xitk/skins/lcd/Makefile
src/xitk/skins/pitt/Makefile
src/xitk/skins/xinetic/Makefile
src/aaui/Makefile
doc/Makefile
doc/man/Makefile
doc/man/en/Makefile
doc/man/en/xine.1
doc/man/en/aaxine.1
doc/man/fr/Makefile
doc/man/fr/xine.1
doc/man/es/Makefile
doc/man/es/xine.1
doc/man/pl/Makefile
doc/man/pl/xine.1
doc/man/pl/aaxine.1
misc/Makefile
misc/build_rpms.sh
misc/SlackBuild
misc/xine-ui.spec
misc/desktops/Makefile
po/Makefile.in
],[chmod +x ./misc/SlackBuild ./misc/build_rpms.sh])