Chris@1: dnl Process this file with autoconf to produce a configure script Chris@1: Chris@1: dnl ------------------------------------------------ Chris@1: dnl Initialization and Versioning Chris@1: dnl ------------------------------------------------ Chris@1: Chris@1: Chris@1: AC_INIT([libvorbis],[1.3.3],[vorbis-dev@xiph.org]) Chris@1: Chris@1: AC_CONFIG_SRCDIR([lib/mdct.c]) Chris@1: Chris@1: AC_CANONICAL_TARGET([]) Chris@1: Chris@1: AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION) Chris@1: AM_MAINTAINER_MODE Chris@1: AM_CONFIG_HEADER([config.h]) Chris@1: Chris@1: dnl Add parameters for aclocal Chris@1: AC_SUBST(ACLOCAL_AMFLAGS, "-I m4") Chris@1: Chris@1: dnl Library versioning Chris@1: dnl - library source changed -> increment REVISION Chris@1: dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 Chris@1: dnl - interfaces added -> increment AGE Chris@1: dnl - interfaces removed -> AGE = 0 Chris@1: Chris@1: V_LIB_CURRENT=4 Chris@1: V_LIB_REVISION=6 Chris@1: V_LIB_AGE=4 Chris@1: Chris@1: VF_LIB_CURRENT=6 Chris@1: VF_LIB_REVISION=5 Chris@1: VF_LIB_AGE=3 Chris@1: Chris@1: VE_LIB_CURRENT=2 Chris@1: VE_LIB_REVISION=9 Chris@1: VE_LIB_AGE=0 Chris@1: Chris@1: AC_SUBST(V_LIB_CURRENT) Chris@1: AC_SUBST(V_LIB_REVISION) Chris@1: AC_SUBST(V_LIB_AGE) Chris@1: AC_SUBST(VF_LIB_CURRENT) Chris@1: AC_SUBST(VF_LIB_REVISION) Chris@1: AC_SUBST(VF_LIB_AGE) Chris@1: AC_SUBST(VE_LIB_CURRENT) Chris@1: AC_SUBST(VE_LIB_REVISION) Chris@1: AC_SUBST(VE_LIB_AGE) Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Check for programs Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2" Chris@1: dnl if $CFLAGS is blank Chris@1: cflags_save="$CFLAGS" Chris@1: AC_PROG_CC Chris@1: AC_PROG_CPP Chris@1: CFLAGS="$cflags_save" Chris@1: Chris@1: AC_C_INLINE Chris@1: Chris@1: AC_LIBTOOL_WIN32_DLL Chris@1: AC_PROG_LIBTOOL Chris@1: AM_PROG_CC_C_O Chris@1: Chris@1: dnl Check for doxygen Chris@1: if test "x$enable_docs" = xyes; then Chris@1: AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false) Chris@1: if test $HAVE_DOXYGEN = "false"; then Chris@1: AC_MSG_WARN([*** doxygen not found, API documentation will not be built]) Chris@1: fi Chris@1: else Chris@1: HAVE_DOXYGEN=false Chris@1: fi Chris@1: AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN) Chris@1: Chris@1: dnl latex tools for the specification document Chris@1: AC_ARG_ENABLE(docs, Chris@1: AC_HELP_STRING([--enable-docs], [build the documentation])) Chris@1: Chris@1: if test "x$enable_docs" = xyes; then Chris@1: AC_CHECK_PROGS([PDFLATEX], pdflatex, [/bin/false]) Chris@1: AC_CHECK_PROGS([HTLATEX], htlatex, [/bin/false]) Chris@1: if test "x$PDFLATEX" = x/bin/false || test "x$HTLATEX" = x/bin/false; then Chris@1: enable_docs=no Chris@1: AC_MSG_WARN([Documentation will not be built!]) Chris@1: fi Chris@1: fi Chris@1: Chris@1: AM_CONDITIONAL(BUILD_DOCS, [test "x$enable_docs" = xyes]) Chris@1: Chris@1: AC_ARG_ENABLE(examples, Chris@1: AS_HELP_STRING([--enable-examples], [build the examples])) Chris@1: Chris@1: AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes]) Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Set build flags based on environment Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: dnl Set some target options Chris@1: Chris@1: cflags_save="$CFLAGS" Chris@1: if test -z "$GCC"; then Chris@1: case $host in Chris@1: *-*-irix*) Chris@1: dnl If we're on IRIX, we wanna use cc even if gcc Chris@1: dnl is there (unless the user has overriden us)... Chris@1: if test -z "$CC"; then Chris@1: CC=cc Chris@1: fi Chris@1: DEBUG="-g -signed" Chris@1: CFLAGS="-O2 -w -signed" Chris@1: PROFILE="-p -g3 -O2 -signed" ;; Chris@1: sparc-sun-solaris*) Chris@1: DEBUG="-v -g" Chris@1: CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" Chris@1: PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; Chris@1: *) Chris@1: DEBUG="-g" Chris@1: CFLAGS="-O" Chris@1: PROFILE="-g -p" ;; Chris@1: esac Chris@1: else Chris@1: Chris@1: AC_MSG_CHECKING([GCC version]) Chris@1: GCC_VERSION=`$CC -dumpversion` Chris@1: AC_MSG_RESULT([$GCC_VERSION]) Chris@1: case $host in Chris@1: *86-*-linux*) Chris@1: DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" Chris@1: CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char" Chris@1: # PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static" Chris@1: PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline" Chris@1: Chris@1: # glibc < 2.1.3 has a serious FP bug in the math inline header Chris@1: # that will cripple Vorbis. Look to see if the magic FP stack Chris@1: # clobber is missing in the mathinline header, thus indicating Chris@1: # the buggy version Chris@1: Chris@1: AC_EGREP_CPP(log10.*fldlg2.*fxch,[ Chris@1: #define __LIBC_INTERNAL_MATH_INLINES 1 Chris@1: #define __OPTIMIZE__ Chris@1: #include Chris@1: ],bad=maybe,bad=no) Chris@1: if test ${bad} = "maybe" ;then Chris@1: AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\), Chris@1: [ Chris@1: #define __LIBC_INTERNAL_MATH_INLINES 1 Chris@1: #define __OPTIMIZE__ Chris@1: #include Chris@1: ],bad=no,bad=yes) Chris@1: fi Chris@1: if test ${bad} = "yes" ;then Chris@1: AC_MSG_WARN([ ]) Chris@1: AC_MSG_WARN([********************************************************]) Chris@1: AC_MSG_WARN([* The glibc headers on this machine have a serious bug *]) Chris@1: AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *]) Chris@1: AC_MSG_WARN([* all floating point code, not just Ogg, built on this *]) Chris@1: AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *]) Chris@1: AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *]) Chris@1: AC_MSG_WARN([* will not fix any previously built programs; this is *]) Chris@1: AC_MSG_WARN([* a compile-time time bug. *]) Chris@1: AC_MSG_WARN([* To work around the problem for this build of Ogg, *]) Chris@1: AC_MSG_WARN([* autoconf is disabling all math inlining. This will *]) Chris@1: AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *]) Chris@1: AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *]) Chris@1: AC_MSG_WARN([* configure and make to build with inlining. *]) Chris@1: AC_MSG_WARN([********************************************************]) Chris@1: AC_MSG_WARN([ ]) Chris@1: Chris@1: CFLAGS=${OPT}" -D__NO_MATH_INLINES" Chris@1: PROFILE=${PROFILE}" -D__NO_MATH_INLINES" Chris@1: fi;; Chris@1: powerpc-*-linux*spe) Chris@1: DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES" Chris@1: CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -D_REENTRANT" Chris@1: PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";; Chris@1: powerpc-*-linux*) Chris@1: DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES" Chris@1: CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT" Chris@1: PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";; Chris@1: *-*-linux*) Chris@1: DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" Chris@1: CFLAGS="-O20 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char" Chris@1: PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";; Chris@1: sparc-sun-*) Chris@1: sparc_cpu="" Chris@1: AC_MSG_CHECKING([if gcc supports -mv8]) Chris@1: old_cflags="$CFLAGS" Chris@1: CFLAGS="$CFLAGS -mv8" Chris@1: AC_TRY_COMPILE(, [return 0;], [ Chris@1: AC_MSG_RESULT([yes]) Chris@1: sparc_cpu="-mv8" Chris@1: ]) Chris@1: CFLAGS="$old_cflags" Chris@1: DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" Chris@1: CFLAGS="-O20 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" Chris@1: PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" ;; Chris@1: *-*-darwin*) Chris@1: DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char" Chris@1: CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char" Chris@1: PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";; Chris@1: *-*-os2*) Chris@1: # Use -W instead of -Wextra because gcc on OS/2 is an old version. Chris@1: DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" Chris@1: CFLAGS="-O20 -Wall -W -ffast-math -D_REENTRANT -fsigned-char" Chris@1: PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";; Chris@1: *) Chris@1: DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char" Chris@1: CFLAGS="-O20 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char" Chris@1: PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; Chris@1: esac Chris@1: Chris@1: AC_ADD_CFLAGS([-Wdeclaration-after-statement]) Chris@1: fi Chris@1: CFLAGS="$CFLAGS $cflags_save" Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Check for headers Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:) Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Check for typedefs, structures, etc Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: dnl none Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Check for libraries Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="") Chris@1: AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :) Chris@1: Chris@1: PKG_PROG_PKG_CONFIG Chris@1: Chris@1: HAVE_OGG=no Chris@1: if test "x$PKG_CONFIG" != "x" Chris@1: then Chris@1: PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no) Chris@1: fi Chris@1: if test "x$HAVE_OGG" = "xno" Chris@1: then Chris@1: dnl fall back to the old school test Chris@1: XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!)) Chris@1: libs_save=$LIBS Chris@1: LIBS="$OGG_LIBS $VORBIS_LIBS" Chris@1: AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !)) Chris@1: LIBS=$libs_save Chris@1: fi Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Check for library functions Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: AC_FUNC_ALLOCA Chris@1: AC_FUNC_MEMCMP Chris@1: Chris@1: dnl -------------------------------------------------- Chris@1: dnl Do substitutions Chris@1: dnl -------------------------------------------------- Chris@1: Chris@1: AC_SUBST(VORBIS_LIBS) Chris@1: AC_SUBST(DEBUG) Chris@1: AC_SUBST(PROFILE) Chris@1: AC_SUBST(pthread_lib) Chris@1: Chris@1: dnl The following line causes the libtool distributed with the source Chris@1: dnl to be replaced if the build system has a more recent version. Chris@1: AC_SUBST(LIBTOOL_DEPS) Chris@1: Chris@1: AC_OUTPUT([ Chris@1: Makefile Chris@1: m4/Makefile Chris@1: lib/Makefile Chris@1: lib/modes/Makefile Chris@1: lib/books/Makefile Chris@1: lib/books/coupled/Makefile Chris@1: lib/books/uncoupled/Makefile Chris@1: lib/books/floor/Makefile Chris@1: doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile doc/libvorbis/Makefile Chris@1: doc/Doxyfile Chris@1: include/Makefile include/vorbis/Makefile Chris@1: examples/Makefile Chris@1: test/Makefile Chris@1: vq/Makefile Chris@1: libvorbis.spec Chris@1: vorbis.pc Chris@1: vorbisenc.pc Chris@1: vorbisfile.pc Chris@1: vorbis-uninstalled.pc Chris@1: vorbisenc-uninstalled.pc Chris@1: vorbisfile-uninstalled.pc Chris@1: ])