AC_INIT(Makefile.dist) AM_INIT_AUTOMAKE(dc-qt, 0.1.2) AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL dnl dnl FIND_QT() dnl AC_DEFUN(FIND_MOC,[ AC_MSG_CHECKING(for Qt moc) for dir in $1 do if test -f $dir/moc then QTMOCDIR=$dir AC_MSG_RESULT("found in $QTMOCDIR") break else if test -f $dir/bin/moc then QTMOCDIR=$dir/bin AC_MSG_RESULT("found in $QTMOCDIR") break fi fi done ]) AC_DEFUN(FIND_QT_LIBS,[ AC_MSG_CHECKING(for Qt libraries) QTLIBS="qt qt-mt" for dir in $1 do for i in $QTLIBS do if test -f $dir/lib$i.so then QTLIBDIR=$dir AC_MSG_RESULT("found in $QTLIBDIR") QTMT=$i break 2 else if test -f $dir/lib/lib$i.so then QTLIBDIR=$dir/lib AC_MSG_RESULT("found in $QTLIBDIR") QTMT=$i break 2 fi fi done done ]) AC_DEFUN(FIND_QT_INCLUDES,[ AC_MSG_CHECKING(for Qt include files) for dir in $1 do if test -f $dir/qwidget.h then QTINCDIR=$dir AC_MSG_RESULT("found in $QTINCDIR") break else if test -f $dir/include/qwidget.h then QTINCDIR=$dir/include AC_MSG_RESULT("found in $QTINCDIR") break fi fi done ]) AC_DEFUN(FIND_PTHREAD_LIBS,[ AC_MSG_CHECKING(for pthread library) for dir in $1 do if test -f $dir/libpthread.so then PTHREADLIBDIR=$dir AC_MSG_RESULT("found in $dir") break fi done ]) AC_CHECK_PROG(SYSTEM_TYPE,uname,`uname -s`,"FALSE") if test "x${SYSTEM_TYPE}" = "xFALSE"; then UNAME_DEFS="" else case $SYSTEM_TYPE in Linux) AC_DEFINE(OSSTRING, "Linux", OS Check) ;; FreeBSD) AC_DEFINE(OSSTRING, "FreeBSD", OS Check) ;; NetBSD) AC_DEFINE(OSSTRING, "NetBSD", OS Check) ;; BSD/OS) AC_DEFINE(OSSTRING, "BSD_OS", OS Check) ;; OpenBSD) AC_DEFINE(OSSTRING, "OpenBSD", OS Check) ;; SunOS) AC_DEFINE(OSSTRING, "SunOS", OS Check) ;; QNX) AC_DEFINE(OSSTRING, "QNX", OS Check) ;; Darwin) AC_DEFINE(OSSTRING, "Darwin", OS Check) ;; IRIX*) AC_DEFINE(OSSTRING, "IRIX", OS Check) ;; HP-UX*) AC_DEFINE(OSSTRING, "HP-UX", OS Check) ;; [cC][yY][gG][wW][iI][nN]*) AC_DEFINE(OSSTRING, "Cygwin", OS Check) ;; *) AC_DEFINE(OSSTRING, "Unknown", OS Check) ;; esac fi AC_ARG_WITH(qt-dir, [ --with-qt-dir=DIR qt-dir in DIR]) AC_ARG_WITH(qt-moc, [ --with-qt-moc=DIR qt-moc in DIR]) AC_ARG_WITH(qt-includes, [ --with-qt-includes=DIR qt-includes in DIR]) AC_ARG_WITH(qt-libs, [ --with-qt-libs=DIR qt-libs in DIR]) AC_ARG_WITH(pthread-libs, [ --with-pthread-libs=DIR bz2-pthread in DIR]) AC_ARG_WITH(xine-prefix, [ --with-xine-prefix=DIR xine installed in DIR], xine_cfg_prefix="$withval", xine_cfg_prefix="") AC_ARG_WITH(xine-exec-prefix, [ --with-xine-exec-prefix=DIR exec prefix where xine is installed is DIR], xine_cfg_exec_prefix="$withval", xine_cfg_exec_prefix="") AC_ARG_ENABLE(preview, [ --disable-preview disable media file preview (uses xine)], enable_preview="", enable_preview="yes") AC_ARG_ENABLE(debug, [ --enable-debug compile with debug information]) AC_ARG_ENABLE(static, [ --enable-static create a static binary]) dnl dnl find moc dnl FIND_MOC($with_qt_moc $with_qt_dir $QTDIR /usr/local/qt /usr/lib/qt /usr/bin /bin /usr/local /usr/X11R6) if test "X$QTMOCDIR" = "X" then echo "" echo "Qt's moc not found! If you have installed Qt in an" echo "unusual place, please use the \"--with-qt-moc=\"" option echo "" exit fi dnl dnl find qt libraries dnl FIND_QT_LIBS($with_qt_libs $with_qt_dir $QTDIR/lib /usr/local/qt /usr/lib/qt /usr/lib /usr/local/lib /usr/X11R6/lib) if test "X$QTLIBDIR" = "X" then echo "" echo "Qt libs not found! If you have installed Qt in an" echo "unusual place, please use the \"--with-qt-libs=\"" option echo "" exit else QTLIBDIR="-L$QTLIBDIR -l$QTMT" fi dnl dnl find qt headers dnl FIND_QT_INCLUDES($with_qt_includes $with_qt_dir $QTDIR/include /usr/local/qt /usr/lib/qt /usr/include /usr/include/qt /usr/local/include) if test "X$QTINCDIR" = "X" then echo "" echo "Qt headers not found! If you have installed Qt in an" echo "unusual place, please use the \"--with-qt-includes=\"" option echo "" exit else QTINCDIR="-I$QTINCDIR" fi FIND_PTHREAD_LIBS($with_pthread_libs /usr/lib /usr/local/lib) if test "X$PTHREADLIBDIR" = "X" then echo "" echo "pthreads not found, continuing anyway." echo "Use \"--with-pthread-libs=\" parameter to specify the location of libpthread." echo "" dnl dnl Disable preview if pthreads not found dnl enable_preview="" echo "" echo "Warning: media-file preview function requires pthreads to operate." echo "Preview function is force-disabled." echo "" else LIBS="-I$PTHREADLIBDIR -lpthread" fi dnl dnl Use xine-config (if available) to find xine include and library paths dnl if test "x$enable_preview" != "x" ; then if test x$xine_cfg_exec_prefix != x ; then xine_cfg_args="$xine_config_args --exec-prefix=$xine_config_exec_prefix" if test x${XINE_CONFIG+set} != xset ; then XINE_CONFIG=$xine_config_exec_prefix/bin/xine-config fi fi if test x$xine_config_prefix != x ; then xine_cfg_args="$xine_cfg_args --prefix=$xine_cfg_prefix" if test x${XINE_CONFIG+set} != xset ; then XINE_CONFIG=$xine_config_prefix/bin/xine-config fi fi min_xine_version="1.0.0" dnl ifelse([$1], ,0.5.0, $1) AC_PATH_PROG(XINE_CONFIG, xine-config, no) AC_MSG_CHECKING([for XINE-LIB version >= $min_xine_version]) no_xine="" if test "$XINE_CONFIG" = "no" ; then no_xine=yes else XINE_CFLAGS=`$XINE_CONFIG $xine_config_args --cflags` XINE_LIBS=`$XINE_CONFIG $xine_config_args --libs` XINE_ACFLAGS=`$XINE_CONFIG $xine_config_args --acflags` xine_config_major_version=`$XINE_CONFIG $xine_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` xine_config_minor_version=`$XINE_CONFIG $xine_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` xine_config_sub_version=`$XINE_CONFIG $xine_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` xine_data_dir=`$XINE_CONFIG $xine_config_args --datadir` xine_script_dir=`$XINE_CONFIG $xine_config_args --scriptdir` xine_plugin_dir=`$XINE_CONFIG $xine_config_args --plugindir` xine_locale_dir=`$XINE_CONFIG $xine_config_args --localedir` dnl if test "x$enable_xinetest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $XINE_CFLAGS" LIBS="$XINE_LIBS $LIBS" dnl dnl Now check if the installed XINE is sufficiently new. (Also sanity dnl checks the results of xine-config to some extent dnl AC_LANG_SAVE() AC_LANG_C() rm -f conf.xinetest dnl dnl TRY RUN xine version test program, BEGIN HERE dnl --------------------------------------------------------------------- AC_TRY_RUN([ #include #include #include #include int main () { int major, minor, sub; char *tmp_version; system ("touch conf.xinetest"); /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = (char *) strdup("$min_xine_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &sub) != 3) { printf("%s, bad version string\n", "$min_xine_version"); exit(1); } if ((XINE_MAJOR_VERSION != $xine_config_major_version) || (XINE_MINOR_VERSION != $xine_config_minor_version) || (XINE_SUB_VERSION != $xine_config_sub_version)) { printf("\n*** 'xine-config --version' returned %d.%d.%d, but XINE (%d.%d.%d)\n", $xine_config_major_version, $xine_config_minor_version, $xine_config_sub_version, XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION); printf ("*** was found! If xine-config was correct, then it is best\n"); printf ("*** to remove the old version of XINE. You may also be able to fix the error\n"); printf ("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); printf ("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf ("*** required on your system.\n"); printf ("*** If xine-config was wrong, set the environment variable XINE_CONFIG\n"); printf ("*** to point to the correct copy of xine-config, and remove the file config.cache\n"); printf ("*** before re-running configure\n"); } else { if ((XINE_MAJOR_VERSION > major) || ((XINE_MAJOR_VERSION == major) && (XINE_MINOR_VERSION > minor)) || ((XINE_MAJOR_VERSION == major) && (XINE_MINOR_VERSION == minor) && (XINE_SUB_VERSION >= sub))) { return 0; } else { printf("\n*** An old version of XINE (%d.%d.%d) was found.\n", XINE_MAJOR_VERSION, XINE_MINOR_VERSION, XINE_SUB_VERSION); printf("*** You need a version of XINE newer than %d.%d.%d. The latest version of\n", major, minor, sub); printf("*** XINE is always available from:\n"); printf("*** http://xine.sourceforge.net\n"); printf("***\n"); printf("*** If you have already installed a sufficiently new version, this error\n"); printf("*** probably means that the wrong copy of the xine-config shell script is\n"); printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of XINE, but you can also set the XINE_CONFIG environment to point to the\n"); printf("*** correct copy of xine-config. (In this case, you will have to\n"); printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } return 1; } ],, no_xine=yes, [echo $ac_n "cross compiling; assumed OK... $ac_c"]) dnl --------------------------------------------------------------------- dnl TRY RUN xine version test program, ENDS HERE dnl CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi dnl dnl Here ends else part of the /if XINE_CONFIG not empty/ dnl dnl Now see what we can report. Did we find xine-config? Could we run the test? if test "x$no_xine" = x ; then dnl Success! AC_MSG_RESULT(yes) dnl ifelse([$2], , :, [$2]) else dnl We failed for some reason. Find out why. AC_MSG_RESULT(no) if test "$XINE_CONFIG" = "no" ; then echo "*** The xine-config script installed by XINE could not be found" echo "*** If XINE was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the XINE_CONFIG environment variable to the" echo "*** full path to xine-config." else if test -f conf.xinetest ; then : else echo "*** Could not run XINE test program, checking why..." CFLAGS="$CFLAGS $XINE_CFLAGS" LIBS="$LIBS $XINE_LIBS" AC_TRY_LINK([ #include #include ], [ return ((XINE_MAJOR_VERSION) || (XINE_MINOR_VERSION) || (XINE_SUB_VERSION)); ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding XINE or finding the wrong" echo "*** version of XINE. If it is not finding XINE, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "***"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means XINE was incorrectly installed" echo "*** or that you have moved XINE since it was installed. In the latter case, you" echo "*** may want to edit the xine-config script: $XINE_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" LIBS="$ac_save_LIBS" fi fi dnl dnl Here we have failed to find xine, so we have nothing to deliver dnl XINE_LIBS="" XINE_CFLAGS="" fi dnl AC_SUBST(XINE_CFLAGS) dnl AC_SUBST(XINE_LIBS) dnl AC_SUBST(XINE_ACFLAGS) AC_LANG_RESTORE() rm -f conf.xinetest fi dnl dnl End of /if enable_preview/ dnl dnl dnl debug option dnl if test "$prefix" = "NONE" then prefix="/usr/local" fi CXXFLAGS="" if test "x$enable_debug" = "xyes" then CXXFLAGS="-Wall -g3 -D_DEBUG -DPREFIX=$prefix" else CXXFLAGS="-O2 -DPREFIX=$prefix" fi if test "x$enable_preview" = x ; then CXXFLAGS="-DDISABLE_PREVIEW $CXXFLAGS" else if test "x$no_xine" = x ; then CXXFLAGS="$CXXFLAGS $XINE_CFLAGS" LIBS="$LIBS $XINE_LIBS" else CXXFLAGS="-DDISABLE_PREVIEW $CXXFLAGS" fi fi AC_CHECK_FUNCS(atoll strtoll) AC_LANG_SAVE AC_LANG_C AC_C_BIGENDIAN AC_LANG_RESTORE AC_CHECK_HEADERS(stdint.h sys/int_types.h) AC_SUBST(QTMT) AC_SUBST(QTLIBDIR) AC_SUBST(QTINCDIR) AC_SUBST(BZ2LIBDIR) AC_SUBST(BZ2INCDIR) AC_SUBST(LIBS) AC_SUBST(QTMOCDIR) AC_SUBST(QTUICDIR) AC_SUBST(DESKTOPFLAG) AM_CONFIG_HEADER(config.h) AC_OUTPUT(Makefile src/Makefile src/doc/Makefile)