# Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([src/liboggplay/oggplay.c]) AC_PREREQ(2.53) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(liboggplay, 0.0.1) AM_CONFIG_HEADER(config.h) SHARED_VERSION_INFO="1:0:0" SHLIB_VERSION_ARG="" # Checks for programs AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_INSTALL AC_PROG_MAKE_SET AC_C_CONST AC_C_BIGENDIAN AM_PROG_CC_C_O dnl Add parameters for aclocal AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") dnl Checks for library functions AC_CHECK_FUNCS([assert]) # Check for valgrind VALGRIND_ENVIRONMENT="" ac_enable_valgrind=no AC_ARG_ENABLE(valgrind-testing, [ --enable-valgrind-testing enable running of tests inside Valgrind ], [ ac_enable_valgrind=yes ], [ ac_enable_valgrind=no] ) if test "x${ac_enable_valgrind}" = xyes ; then if test "x${enable_shared}" = xyes ; then VALGRIND_ENVIRONMENT="libtool --mode=execute " fi AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no) if test "x$HAVE_VALGRIND" = xyes ; then VALGRIND_ENVIRONMENT="$VALGRIND_ENVIRONMENT valgrind -q --leak-check=yes --show-reachable=yes --num-callers=100" AC_SUBST(VALGRIND_ENVIRONMENT) TESTS_INFO="Type 'make check' to run test suite. Tests will be run under: ${VALGRIND_ENVIRONMENT}" else TESTS_INFO="Type 'make check' to run test suite (Valgrind not found)" fi else TESTS_INFO="Type 'make check' to run test suite (Valgrind testing not enabled)" fi dnl Overall configuration success flag oggplay_config_ok=yes oggplay_tools="oggplay-info" oggplay_examples="get-stream-info" oggplay_glut="" dnl dnl Configuration option to add -Werror to all Makefiles dnl AC_ARG_ENABLE(gcc-werror, AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]), [ ac_enable_gcc_werror=yes ], [ ac_enable_gcc_werror=no] ) if test "x${ac_enable_gcc_werror}" = xyes ; then CFLAGS="-Werror $CFLAGS" fi dnl dnl Configure for target platform dnl case "$target_os" in darwin* | rhapsody*) dnl Disable -Wall and -pedantic for Apple Darwin/Rhapsody. dnl System headers on these systems are broken. temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//"` CFLAGS=$temp_CFLAGS dnl add extra mac-specific directories to include path CFLAGS="$CFLAGS -I/Developer/Headers/FlatCarbon/" HAVE_FRAMEWORKS="yes" AC_SUBST(PLATFORM,"mac") ;; linux* | solaris*) SHLIB_VERSION_ARG="-Wl,--version-script=Version_script" AC_SUBST(PLATFORM,"linux") ;; *) ;; esac dnl Define MACOSX for the benefit of altering link likes dnl in the build for that platform AM_CONDITIONAL(MACOS, test "x$HAVE_FRAMEWORKS" = "xyes") dnl dnl Detect oggz dnl dnl Minimum required version of liboggz oggplay_OGGZ="0.9.8" PKG_CHECK_MODULES(OGGZ, oggz >= "$oggplay_OGGZ", HAVE_OGGZ="yes", HAVE_OGGZ="no") if test "$HAVE_OGGZ" = "yes" ; then AC_DEFINE(HAVE_OGGZ, [], [Define if have liboggz]) AC_SUBST(OGGZ_CFLAGS) AC_SUBST(OGGZ_LIBS) else PKG_CHECK_MODULES(OGGZ, oggz, HAVE_OGGZ="old") if test "$HAVE_OGGZ" = "old" ; then AC_MSG_ERROR([ *** The version of liboggz installed on your system is too old. You need *** liboggz version greater than $oggplay_OGGZ to build liboggplay. ]) else AC_MSG_ERROR([ *** liboggz-$oggplay_OGGZ or greater does not seem to exist on your system. *** Please install it and run this ./configure again. ]) fi fi dnl dnl Detect libfishsound dnl dnl Minimum required version of libfishsound oggplay_FISHSOUND="0.8.0" PKG_CHECK_MODULES(FISHSOUND, fishsound >= "$oggplay_FISHSOUND", HAVE_FISHSOUND="yes", HAVE_FISHSOUND="no") if test "$HAVE_FISHSOUND" = "yes" ; then AC_DEFINE(HAVE_FISHSOUND, [], [Define if have libfishsound]) AC_SUBST(FISHSOUND_CFLAGS) AC_SUBST(FISHSOUND_LIBS) else PKG_CHECK_MODULES(FISHSOUND, fishsound, HAVE_FISHSOUND="old") if test "$HAVE_FISHSOUND" = "old" ; then AC_MSG_ERROR([ *** The version of libfishsound installed on your system is too old. You need *** at least libfishsound version $oggplay_FISHSOUND to build liboggplay. ]) else AC_MSG_ERROR([ *** libfishsound-$oggplay_FISHSOUND or greater does not seem to exist on your system. *** Please install it and run this ./configure again. ]) fi fi dnl dnl Detect libtheora dnl PKG_CHECK_MODULES(THEORA, theora) AC_SUBST(THEORA_CFLAGS) AC_SUBST(THEORA_LIBS) dnl dnl Detect libkate dnl PKG_CHECK_MODULES(KATE, kate, HAVE_KATE="yes", HAVE_KATE="no") if test "x$HAVE_KATE" = "xyes" ; then AC_DEFINE(HAVE_KATE, [], [Define if have libkate]) AC_SUBST(KATE_CFLAGS) AC_SUBST(KATE_LIBS) else AC_MSG_RESULT($HAVE_KATE) fi dnl dnl Detect libtiger dnl AC_ARG_WITH( tiger, AS_HELP_STRING( [--with-tiger], [Enable rendering of Kate streams with the Tiger rendering library, using Pango and Cairo (default autodetect)] ), [use_tiger="$withval"] ) if test "x$use_tiger" != "xno"; then PKG_CHECK_MODULES(TIGER, tiger >= 0.3.1, HAVE_TIGER="yes", HAVE_TIGER="no") if test "x$HAVE_TIGER" = "xyes" ; then AC_DEFINE(HAVE_TIGER, [], [Define if have libtiger]) AC_SUBST(TIGER_CFLAGS) AC_SUBST(TIGER_LIBS) else AC_MSG_RESULT($HAVE_TIGER) if test "x$use_tiger" = "xyes"; then AC_MSG_ERROR([libtiger could not be found and was explicitely requested]) fi fi else HAVE_TIGER=no fi dnl dnl Detect Imlib2 (used by dump-all-streams example) dnl PKG_CHECK_MODULES(IMLIB2, imlib2, HAVE_IMLIB2="yes", HAVE_IMLIB2="no") if test "x$HAVE_IMLIB2" = "xyes" ; then oggplay_tools="$oggplay_tools oggplay-dump-first-frame" AC_DEFINE(HAVE_IMLIB2, [], [Define if have Imlib2]) AC_SUBST(IMLIB2_LIBS) AC_SUBST(IMLIB2_CFLAGS) else AC_MSG_RESULT($HAVE_IMLIB2) fi AM_CONDITIONAL(HAVE_IMLIB2, [test "x$HAVE_IMLIB2" = "xyes"]) dnl dnl dnl Detect libsndfile1 (used by dump-all-streams example) dnl PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.0, HAVE_LIBSNDFILE1="yes", HAVE_LIBSNDFILE1="no") if test "x$HAVE_LIBSNDFILE1" = xyes ; then oggplay_examples="$oggplay_examples dump-all-streams" AC_DEFINE(HAVE_LIBSNDFILE1, [], [Define if have libsndfile]) AC_SUBST(SNDFILE_CFLAGS) AC_SUBST(SNDFILE_LIBS) fi AM_CONDITIONAL(HAVE_LIBSNDFILE1, [test "x$HAVE_LIBSNDFILE1" = "xyes"]) dnl dnl Detect pthreads libraries dnl PTHREAD_LIBS=error AC_CHECK_LIB(pthread, pthread_attr_init, PTHREAD_LIBS="-lpthread") 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 AC_SUBST(PTHREAD_LIBS) dnl dnl Detect GLUT dnl HAVE_GLUT=no ac_enable_glut=yes AC_ARG_ENABLE(glut, [ --disable-glut disable building of GLUT player], [ ac_enable_glut=no ], [ ac_enable_glut=yes ]) if test "x${ac_enable_glut}" != xno ; then dnl XXX: On MacOSX, assume we have GLUT and OpenGL frameworks if test "x$HAVE_FRAMEWORKS" = "xyes" ; then HAVE_GLUT=yes GLUT_LIBS="-lm" GLUT_FRAMEWORKS="-framework GLUT -framework OpenGL" AC_SUBST(GLUT_LIBS) AC_SUBST(GLUT_FRAMEWORKS) else AC_CHECK_LIB(glut, glutInit, HAVE_GLUT="maybe", , [-lGL -lm "$PTHREAD_LIBS"]) if test "x$HAVE_GLUT" = "xmaybe" ; then AC_CHECK_HEADER([GL/glut.h], HAVE_GLUT="yes", HAVE_GLUT="no") fi if test "x$HAVE_GLUT" = xyes ; then GLUT_LIBS="-lglut -lGL -lm $PTHREAD_LIBS" AC_SUBST(GLUT_LIBS) fi fi if test "x$HAVE_GLUT" = xyes ; then oggplay_glut="glut-player" AC_DEFINE([HAVE_GLUT], [], [Define if we have GLUT.]) else oggplay_glut=" *** glut-player will NOT be built. GLUT could not be found." fi else HAVE_GLUT="disabled" oggplay_glut=" (glut-player will NOT be built, disabled by './configure --disable-glut')" fi AM_CONDITIONAL(HAVE_GLUT, [test "x$HAVE_GLUT" = "xyes"]) SEMAPHORE_LIBS="-lpthread" AC_SUBST(SEMAPHORE_LIBS) dnl Use -Wall if we have gcc. dnl changequote(,)dnl if test "x$ac_cv_prog_gcc" = xyes ; then CFLAGS="$CFLAGS -Wall -g" fi dnl changequote([,])dnl dnl Checks for __attribute__(aligned()) directive AC_CACHE_CHECK([__attribute__ ((aligned ())) support], [ac_cv_c_attribute_aligned], [ac_cv_c_attribute_aligned=0 CFLAGS_save="${CFLAGS}" CFLAGS="${CFLAGS} -Werror" for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do AC_TRY_COMPILE([], [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;], [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"]) done CFLAGS="${CFLAGS_save}"]) if test "${ac_cv_c_attribute_aligned}" != "0"; then AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment]) fi dnl dnl Configuration tests complete -- provide summary of results. dnl if test $oggplay_config_ok = no ; then AC_MSG_RESULT([ ************************************************************** *** $PACKAGE $VERSION: Automatic configuration FAILED. *** The file config.log has full details. *** The following required libraries are missing or *** misconfigured on your system: ]) if test "x$HAVE_OGGZ" != xyes ; then AC_MSG_RESULT( [*** liboggz, available from http://www.annodex.net/]) fi if test "x$HAVE_FISHSOUND" != xyes ; then AC_MSG_RESULT( [*** libfishsound, available from http://www.annodex.net/]) fi AC_MSG_RESULT( [*** If you install the required libraries from source, you *** need to inform the dynamic linker of their location. If *** you install them in a system-wide directory such as *** /usr/local (the default), you must ensure that *** /usr/local/lib is listed in /etc/ld.so.conf, then run *** ldconfig to update the dynamic linking system. *** Alternatively, you can set your LD_LIBRARY_PATH environment *** variable to include the library installation directory. ]) AC_MSG_RESULT( [************************************************************** ]) AC_MSG_ERROR([ *** *** After fixing the above problems, you must run ./configure again. *** ]) else AC_SUBST(SHLIB_VERSION_ARG) AC_SUBST(SHARED_VERSION_INFO) AC_OUTPUT([ Makefile include/Makefile include/oggplay/Makefile src/Makefile src/liboggplay/Makefile src/liboggplay/Version_script src/examples/Makefile src/tools/Makefile src/tests/Makefile oggplay.pc oggplay-uninstalled.pc ]) AS_AC_EXPAND(LIBDIR, ${libdir}) AS_AC_EXPAND(INCLUDEDIR, ${includedir}) AS_AC_EXPAND(BINDIR, ${bindir}) AC_MSG_RESULT([ ------------------------------------------------------------------------ $PACKAGE $VERSION: Automatic configuration OK. Tools (./src/tools): $oggplay_tools Examples (./src/examples): $oggplay_examples $oggplay_glut Installation paths: liboggplay: .................. ${LIBDIR} C header files: .............. ${INCLUDEDIR}/oggplay Building: Type 'make' to compile $PACKAGE. Type 'make install' to install $PACKAGE. ${TESTS_INFO} Example programs will be built but not installed. Kate support: .................. ${HAVE_KATE} Tiger support: ................. ${HAVE_TIGER} ------------------------------------------------------------------------ ]) fi