dnl dnl Process this file with autoconf to produce a configure script. dnl Used the configure.in from xmms-crossfade plugin as template AC_INIT(src/iir.c) AM_INIT_AUTOMAKE(eq-xmms, 0.7) # AM_CONFIG_HEADER(config.h) dnl Save environment settings that could get modified by the tests dnl To avoid the automatic -g in the CFLAGS by AC_PROG_CC SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" CFLAGS="" dnl libtool stuff AM_DISABLE_STATIC AC_LIBTOOL_DLOPEN AC_PROG_CC AC_PROG_LIBTOOL AM_PROG_AS AC_PREFIX_PROGRAM(xmms) AC_CHECK_HEADER(pthread.h,,AC_MSG_ERROR([*** POSIX thread support not installed - please install first ***])) PTHREAD_LIBS=error AC_MSG_CHECKING(for old style FreeBSD -pthread flag) AC_EGREP_CPP(yes, [#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version <= 500001 yes #endif ], AC_MSG_RESULT(yes) XF_CFLAGS="-D_THREAD_SAFE" PTHREAD_LIBS="-pthread", AC_MSG_RESULT(no)) if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_LIB(pthread, pthread_attr_init, PTHREAD_LIBS="-lpthread") fi if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_LIB(pthreads, pthread_attr_init, PTHREAD_LIBS="-lpthreads") fi if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_LIB(c_r, pthread_attr_init, PTHREAD_LIBS="-lc_r") fi if test "x$PTHREAD_LIBS" = xerror; then AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="") fi if test "x$PTHREAD_LIBS" = xerror; then AC_MSG_ERROR(*** Unable to locate working posix thread library ***) fi AC_SUBST(PTHREAD_LIBS) dnl Checks for programs. AC_PROG_INSTALL AC_PATH_PROG(XMMS,xmms,no) if test "x$XMMS" = xno; then AC_MSG_ERROR([*** xmms not found - please install first ***)]) fi AC_PATH_PROG(XMMS_CONFIG,xmms-config,no) if test "x$XMMS_CONFIG" = xno; then AC_MSG_ERROR([*** xmms-config not found - please install first (comes with XMMS > 1.0.0) *** NOTE: If you installed XMMS as a RPM and still get this error, 'xmms-config' might be included in a sperate development RPM instead of the base XMMS package. This depends on the distribution you are using. Look for a RPM called 'libxmms1-devel' or 'xmms-devel'. ]) fi dnl Checks for libraries. AM_PATH_GLIB(1.2.7,,AC_MSG_ERROR([*** GLIB >= 1.2.7 not installed - please install first *** NOTE: You may need to install the GLIB development package. Look for a RPM called 'libglib1.2-devel' or 'glibdev'. (It should contain a shell script called 'glib-config') ])) AM_PATH_GTK(1.2.7,,AC_MSG_ERROR([*** GTK+ >= 1.2.7 not installed - please install first *** NOTE: You may need to install the GTK development package. Look for a RPM called 'libgtk1.2-devel' or 'gtkdev'. (It should contain a shell script called 'gtk-config') ]),gthread) dnl Checks for header files. AC_HEADER_STDC dnl Arguments AC_ARG_ENABLE(debug, [ --enable-debug enable -g flag for GCC [[default=no]]], debug=$enableval, debug=no) AC_ARG_ENABLE(benchmark, [ --enable-benchmark enable counting the number of cycles that the IIR implementation uses (only available for i586 and newer) [[default=no]]], benchmark=$enableval, benchmark=no) AC_ARG_ENABLE(autodetect, [ --enable-autodetect enable auto detection of CPU features and set compiler flags accordingly [[default=yes (no for non-Linux boxen]]], autodetect=$enableval, autodetect=yes) AC_ARG_ENABLE(mmx, [ --enable-mmx force MMX instruction generation [[default=auto]]], mmx=$enableval, mmx=no) AC_ARG_ENABLE(sse, [ --enable-sse force SSE instruction generation [[default=auto]]], sse=$enableval, sse=no) AC_ARG_ENABLE(sse2, [ --enable-sse2 force SSE2 instruction generation [[default=auto]]], sse2=$enableval, sse2=no) AC_ARG_ENABLE(sse-filters, [ --enable-sse-filters Use faster SSE filter implementation [[default=auto]]], ssefilters=$enableval) ARCH_DEFINES="" dnl set some compiler flags if using GCC if test -n "$GCC"; then case "$host" in i386-*-freebsd*) ARCH_DEFINES="-DARCH_X86" ;; i386-*-openbsd* | i386-*-netbsd*) ARCH_DEFINES="-DARCH_X86" AC_DEFINE(SYMBOL_PREFIX, "_", [Define to symbol prefix, if any]) ;; *-*-openbsd* | *-*-netbsd* | *-*darwin*) AC_DEFINE(SYMBOL_PREFIX, "_", [Define to symbol prefix, if any]) ;; *-*-linux*) case "$host" in i386-*-* | i86pc-*-*) autodetect=no ARCH_DEFINES="-DARCH_X86" ;; i486-*-*) autodetect=no ARCH_DEFINES="-DARCH_X86 -march=i486" ;; i586-*-*) ARCH_DEFINES="-DARCH_X86 -march=i586" if test "x$benchmark" = xyes; then XF_CFLAGS="$XF_CFLAGS -DBENCHMARK" fi ;; i686-*-*) ARCH_DEFINES="-DARCH_X86 -march=i686" if test "x$benchmark" = xyes; then XF_CFLAGS="$XF_CFLAGS -DBENCHMARK" fi ;; esac ;; *) XF_CFLAGS="$XF_CFLAGS -funroll-all-loops" ;; esac dnl Set debug flags if test "x$debug" = xyes; then XF_CFLAGS="-Wall -g -O2 -DDEBUG $XF_CFLAGS" else XF_CFLAGS="-Wall -O3 $XF_CFLAGS -fomit-frame-pointer -Wpointer-arith -finline-functions -ffast-math -fno-strict-aliasing " fi fi dnl MMX/SSE/SSE2 stuff SSE_RES="" SSE2_RES="" MMX_RES="" if test "x$mmx" = xyes; then autodetect=no sse=no sse2=no ssefilters=no fi if test "x$sse" = xyes; then autodetect=no sse2=no fi if test "x$sse2" = xyes; then autodetect=no fi case "$host" in i386-*-freebsd*) SSE_RES=`grep 'Features=.*[<,]SSE[>,]' /var/run/dmesg.boot` SSE2_RES=`grep 'Features=.*[<,]SSE2[>,]' /var/run/dmesg.boot` MMX_RES=`grep 'Features=.*[<,]MMX[>,]' /var/run/dmesg.boot` ;; i386-*-openbsd* | i386-*-netbsd*) autodetect=no ;; *-*-openbsd* | *-*-netbsd* | *-*darwin*) autodetect=no ;; *-*-linux*) case "$host" in i386-*-* | i86pc-*-*) autodetect=no ;; i486-*-*) autodetect=no ;; i586-*-* | i686-*-*) if test -e /proc/cpuinfo; then SSE_RES=`cat /proc/cpuinfo|grep sse` SSE2_RES=`cat /proc/cpuinfo|grep sse2` MMX_RES=`cat /proc/cpuinfo|grep mmx` else autodetect=no fi ;; esac ;; powerpc-*-*) autodetect=no ARCH_DEFINES="-DARCH_PPC" arch_type=powerpc ;; *) autodetect=no ;; esac dnl If autodetect on, set the compilation flags if test "x$autodetect" = xyes; then case "$host" in i586-*-* | i686-*-* | i386-*-freebsd*) # Note that these are 'priority encoded' # SSE2 overrides SSE and SSE overrides MMX if test "x$SSE2_RES" != x; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_MATH -mfpmath=sse -msse2" if test "x$ssefilters" = xyes -o "x$ssefilters" = x; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_FILTERS" ssefilters=yes else ssefilters=no fi sse2=yes else if test "x$SSE_RES" != x; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_MATH -mfpmath=sse -msse" if test "x$ssefilters" = xyes -o "x$ssefilters" = x; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_FILTERS" ssefilters=yes else ssefilters=no fi sse=yes else if test "x$MMX_RES" != x; then ARCH_DEFINES="$ARCH_DEFINES -m3dnow -mmmx" mmx=yes ssefilters=no fi fi fi ;; *) ssefilters=no echo "Autodetect not supported for arch $host" ;; esac else dnl Assume the user knows what he's doing by specifying MMX/SSE/SSE2 builds dnl therefore no checks will be made for support for these instruction sets if test "x$sse2" = xyes; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_MATH -mfpmath=sse -msse2" if test "x$ssefilters" = xyes -o "x$ssefilters" = x; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_FILTERS" ssefilters=yes else ssefilters=no fi elif test "x$sse" = xyes; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_MATH -mfpmath=sse -msse" if test "x$ssefilters" = xyes -o "x$ssefilters" = x; then ARCH_DEFINES="$ARCH_DEFINES -DSSE_FILTERS" ssefilters=yes else ssefilters=no fi elif test "x$mmx" = xyes; then ARCH_DEFINES="$ARCH_DEFINES -m3dnow -mmmx" ssefilters=no else ssefilters=no fi fi AM_CONDITIONAL(BENCHMARK, test "x$benchmark" = "xyes") AM_CONDITIONAL(ARCH_PPC, test "x$arch_type" = "xpowerpc") AM_CONDITIONAL(SSE_FILTERS, test "x$ssefilters" = "xyes") dnl Get CFLAGS / LIBS XMMS_CFLAGS="`$XMMS_CONFIG --cflags` -DLOCALEDIR=\\\"$localedir\\\"" XMMS_LIBS=`$XMMS_CONFIG --libs` XF_CFLAGS="$GTK_CFLAGS $XMMS_CFLAGS $ARCH_DEFINES $XF_CFLAGS" XF_LIBS="$GTK_LIBS $XMMS_LIBS" dnl Clean up XF_CFLAGS & XF_LIBS (remove duplicate words) dnl -> taken from the configure.in of 'xchat' by Peter Zelezny dnl v0.2.7: Avoiding `tr` due to some compatibility problems AC_PATH_PROG(sortpath, sort) AC_PATH_PROG(uniqpath, uniq) if test "_$sortpath" != _; then if test "_$uniqpath" != _; then echo $XF_CFLAGS > cflags rm -f cflags2 for item in $XF_CFLAGS; do echo $item >>cflags2; done sort cflags2 > cflags uniq cflags > cflags2 cat cflags2 | xargs >cflags XF_CFLAGS=`cat cflags` echo $XF_LIBS > cflags rm -f cflags2 for item in $XF_LIBS; do echo $item >>cflags2; done sort cflags2 > cflags uniq cflags > cflags2 cat cflags2 | xargs >cflags XF_LIBS=`cat cflags` rm -f cflags cflags2 fi fi dnl Global skin path SKIN_BASE_PATH=`$XMMS_CONFIG --plugin-dir` XF_CFLAGS="$XF_CFLAGS -DSKIN_BASE_PATH=\\\"$SKIN_BASE_PATH\\\"" dnl Finally append saved custom CFLAGS/LIBS XF_CFLAGS="$XF_CFLAGS $SAVE_CFLAGS" XF_LIBS="$XF_LIBS $SAVE_LIBS" dnl Make variables visible to the Makefile AC_SUBST(XF_CFLAGS) AC_SUBST(XF_LIBS) dnl Check for effect plugin dir if test ! -d "$libdir" ;then AC_MSG_CHECKING(for Effect plugin dir) libdir=`$XMMS_CONFIG --effect-plugin-dir` AC_MSG_RESULT($libdir) fi if test ! -d "$libdir" ;then AC_CHECK_DIRS("${prefix}/lib/xmms/Effect" "${prefix}/lib/xmms/Plugins", [libdir=${ac_dir}]) fi if test ! -d "$libdir" ;then AC_MSG_ERROR([*** No suitable plugin directory found. Use --libdir to specify. ***]) fi dnl Output files AC_OUTPUT(Makefile) AC_OUTPUT(src/Makefile) dnl Print configuration echo " Configuration: Install path : $libdir Debug compilation flags : $debug Benchmark code : $benchmark CPU features detection : $autodetect 3DNow/MMX code : $mmx SSE code : $sse SSE2 code : $sse2 SSE filter implementation : $ssefilters" echo ""