# Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([src/libannodex/annodex.c]) AC_PREREQ(2.53) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(libannodex, 0.7.4) AM_CONFIG_HEADER(config.h) SHARED_VERSION_INFO="5:0:0" SHLIB_VERSION_ARG="" # Setup libltdl -- this must come before AC_PROG_LIBTOOL AC_LIBLTDL_CONVENIENCE AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) AC_LIBTOOL_DLOPEN # Checks for programs. AC_PROG_CC AC_PROG_LIBTOOL AC_PROG_INSTALL AC_PROG_MAKE_SET AC_C_CONST AC_C_BIGENDIAN dnl Add parameters for aclocal AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") # Checks for doxygen AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) if test $HAVE_DOXYGEN = "false"; then AC_MSG_WARN([*** doxygen not found, docs will not be built]) fi # Check for docbook AC_CHECK_PROGS(DOCBOOKTOMAN, docbook-to-man docbook2man, false) AM_CONDITIONAL(HAVE_DOCBOOKTOMAN, test "x$DOCBOOKTOMAN" != "xfalse") AC_CHECK_PROG(HAVE_DOCBOOK2HTML, docbook2html, true, false) AM_CONDITIONAL(HAVE_DOCBOOK2HTML,$HAVE_DOCBOOK2HTML) # 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="Test suite will be run under: ${VALGRIND_ENVIRONMENT}" else TESTS_INFO="(Valgrind not found)" fi else TESTS_INFO="(Valgrind testing not enabled)" fi dnl Overall configuration success flag anx_config_ok=yes anx_importers="annodex speex vorbis theora" anx_read_programs="" anx_write_programs="" dnl dnl Configuration option for building of experimental code. dnl ac_enable_experimental=no AC_ARG_ENABLE(experimental, [ --enable-experimental enable building of experimental code ], [ ac_enable_experimental=yes ]) if test "x${ac_enable_experimental}" = xyes ; then AC_DEFINE(ANX_CONFIG_EXPERIMENTAL, [], [Define to build experimental code]) fi dnl dnl Configuration option for building of reading support. dnl ac_enable_read=yes AC_ARG_ENABLE(read, [ --disable-read disable building of reading support ], [ ac_enable_read=no ], [ ac_enable_read=yes] ) if test "x${ac_enable_read}" = xyes ; then AC_DEFINE(ANX_CONFIG_READ, [1], [Build reading support]) anx_read_programs="anxinfo anxrip anxgrep anxcheck" else AC_DEFINE(ANX_CONFIG_READ, [0], [Do not build reading support]) fi AM_CONDITIONAL(ANX_CONFIG_READ, test "x${ac_enable_read}" = xyes) dnl dnl Configuration option for building of writing support. dnl ac_enable_write=yes AC_ARG_ENABLE(write, [ --disable-write disable building of writing support ], [ ac_enable_write=no ], [ ac_enable_write=yes] ) if test "x${ac_enable_write}" = xyes ; then AC_DEFINE(ANX_CONFIG_WRITE, [1], [Build writing support]) anx_write_programs="anxenc anxed" else AC_DEFINE(ANX_CONFIG_WRITE, [0], [Do not build writing support]) fi AM_CONDITIONAL(ANX_CONFIG_WRITE, test "x${ac_enable_write}" = xyes) dnl dnl Check read/write option sanity dnl if test "x${ac_enable_read}" = xno && test "x${ac_enable_write}" = xno ; then AC_MSG_ERROR([ *** *** You have attempted to explicitly disable both writing and reading. *** ]) fi # Checks for header files. # Checks for typedefs, structures, and compiler characteristics. dnl Add some useful warnings if we have gcc. dnl changequote(,)dnl if test "x$ac_cv_prog_gcc" = xyes ; then CFLAGS="$CFLAGS -Wall -Wextra -g -std=gnu99 -Wdeclaration-after-statement -Wno-unused" fi dnl changequote([,])dnl 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 Check for types AC_MSG_CHECKING(for int64_t) AC_CACHE_VAL(has_int64_t, [AC_TRY_RUN([ #ifdef __BEOS__ #include #endif #include int64_t foo; int main() {return 0;} ], has_int64_t=yes, has_int64_t=no, has_int64_t=no )]) AC_MSG_RESULT($has_int64_t) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) if test x$has_int64_t = "xyes" ; then SIZE64="int64_t" else case 8 in $ac_cv_sizeof_int) SIZE64="int";; $ac_cv_sizeof_long) SIZE64="long";; $ac_cv_sizeof_long_long) SIZE64="long long";; esac fi if test -z "$SIZE64"; then AC_MSG_WARN(No 64 bit type found on this platform!) fi AC_SUBST(SIZE64) # Configures libltdl AC_CONFIG_SUBDIRS(libltdl) dnl dnl Detect oggz dnl HAVE_OGGZ="no" PKG_CHECK_MODULES(OGGZ, oggz >= 0.9.1, HAVE_OGGZ="yes", anx_config_ok="no") if test "x$HAVE_OGGZ" = "xyes" ; then AC_DEFINE(HAVE_OGGZ, [], [Define if have liboggz]) AC_SUBST(OGGZ_LIBS) else AC_CHECK_LIB(oggz, oggz_open, OGGZ_LIBS="maybe") if test "x$OGGZ_LIBS" = "xmaybe" ; then AC_MSG_ERROR([ *** *** liboggz or greater seems to exist on your system, however *** the pkg-config tool cannot find its build information. *** *** Please set your PKG_CONFIG_PATH environment variable to include the *** directory in which oggz.pc was installed. For example, oggz.pc *** is installed in /usr/local/lib/pkgconfig by default; if that is the *** case do: *** *** export PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" *** *** then run this ./configure again. If you configured liboggz with a *** different --prefix option, replace /usr/local above with that prefix. *** ]) fi fi AM_CONDITIONAL(HAVE_OGGZ, [test "x$HAVE_OGGZ" = "xyes"]) # # Detect libcmml # HAVE_LIBCMML=no PKG_CHECK_MODULES(CMML, cmml >= 0.9.2, HAVE_LIBCMML="yes", HAVE_LIBCMML="no") if test "x$HAVE_LIBCMML" = "xyes" ; then AC_DEFINE(HAVE_LIBCMML, [], [Define if have libcmml]) AC_SUBST(CMML_CFLAGS) AC_SUBST(CMML_LIBS) anx_importers="$anx_importers cmml" else AC_CHECK_LIB(cmml, cmml_open, HAVE_LIBCMML="maybe") if test "x$HAVE_LIBCMML" = "xmaybe" ; then AC_MSG_ERROR([ *** *** libcmml-0.9.2 or greater seems to exist on your system, however *** the pkg-config tool cannot find its build information. *** *** Please set your PKG_CONFIG_PATH environment variable to include the *** directory in which cmml.pc was installed. For example, cmml.pc *** is installed in /usr/local/lib/pkgconfig by default; if that is the *** case do: *** *** export PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" *** *** then run this ./configure again. If you configured libcmml with a *** different --prefix option, replace /usr/local above with that prefix. *** ]) fi fi AM_CONDITIONAL(HAVE_LIBCMML, [test "x$HAVE_LIBCMML" = "xyes"]) dnl dnl Detect libsndfile 1.0 dnl PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.0, HAVE_LIBSNDFILE1="yes", HAVE_LIBSNDFILE1="no") if test "x$HAVE_LIBSNDFILE1" = "xyes" ; then AC_DEFINE(HAVE_LIBSNDFILE1, [], [Define if have libsndfile1]) AC_SUBST(SNDFILE_CFLAGS) AC_SUBST(SNDFILE_LIBS) anx_importers="$anx_importers sndfile" else AC_CHECK_LIB(sndfile, sf_open, HAVE_LIBSNDFILE1="maybe") if test "x$HAVE_LIBSNDFILE1" = "xmaybe" ; then AC_MSG_ERROR([ *** *** libsndfile-1.0.0 or greater seems to exist on your system, however *** the pkg-config tool cannot find its build information. *** *** Please set your PKG_CONFIG_PATH environment variable to include the *** directory in which sndfile.pc was installed. For example, sndfile.pc *** is installed in /usr/local/lib/pkgconfig by default; if that is the *** case do: *** *** export PKG_CONFIG_PATH="\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" *** *** then run this ./configure again. If you configured libsndfile with a *** different --prefix option, replace /usr/local above with that prefix. *** ]) fi fi AM_CONDITIONAL(HAVE_LIBSNDFILE1, [test "x$HAVE_LIBSNDFILE1" = "xyes"]) dnl dnl Set IMPORTERS_DIR dnl AS_AC_EXPAND(IMPORTERS_DIR, ${libdir}/annodex/importers) AC_DEFINE_UNQUOTED(IMPORTERS_DIR, "$IMPORTERS_DIR", [Directory in which importer plugins are installed]) dnl uninstalled importers dir AC_DEFINE_UNQUOTED(UNINSTALLED_IMPORTERS_DIR,"`pwd`/src/importers", [path to uninstalled importers dir]) AC_SUBST(UNINSTALLED_IMPORTERS_DIR) dnl dnl Configuration tests complete -- provide summary of results. dnl if test $anx_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/software/oggz/]) fi if test "x$HAVE_OGGZ" = xmaybe ; then AC_MSG_RESULT( [ Development files missing: The liboggz library binary seems to be installed, but building of a test program failed. ]) 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 doc/Makefile doc/Doxyfile include/Makefile include/annodex/Makefile include/annodex/anx_int64.h src/Makefile src/libannodex/Version_script src/libannodex/Makefile src/importers/Makefile src/tools/Makefile src/tests/Makefile src/examples/Makefile annodex.pc ]) AS_AC_EXPAND(LIBDIR, ${libdir}) AS_AC_EXPAND(INCLUDEDIR, ${includedir}) AS_AC_EXPAND(BINDIR, ${bindir}) AS_AC_EXPAND(DOCDIR, ${datadir}/doc) AC_MSG_RESULT([ ------------------------------------------------------------------------ $PACKAGE $VERSION: Automatic configuration OK. General configuration: Experimental code: ........... ${ac_enable_experimental} Reading support: ............. ${ac_enable_read} Writing support: ............. ${ac_enable_write} Importers: ${anx_importers} Tools: ${anx_read_programs} ${anx_write_programs} Installation paths: libannodex: .................. ${LIBDIR} Importers: ................... ${IMPORTERS_DIR} Tools: ....................... ${BINDIR} C header files: .............. ${INCLUDEDIR}/$PACKAGE Documentation: ............... ${DOCDIR}/$PACKAGE Building: Type 'make' to compile $PACKAGE. Type 'make install' to install $PACKAGE. Type 'make check' to test $PACKAGE using the unit tests contained in the src/tests directory. ${TESTS_INFO} Example programs will be built but not installed. ------------------------------------------------------------------------ ]) fi