Wrap itemizedlist tags in a para container. Docbook doesn't require
[platform/upstream/libvorbis.git] / configure.in
index 00f9cb9..acae916 100644 (file)
-# $Id: configure.in,v 1.12 2000/06/14 23:07:47 xiphmont Exp $
+dnl Process this file with autoconf to produce a configure script
 
-AC_INIT(lib/mdct.c)
-#AC_CONFIG_HEADER(config.h)
+dnl ------------------------------------------------
+dnl Initialization and Versioning
+dnl ------------------------------------------------
 
-cp configure.guess config.guess
-cp configure.sub config.sub
+AC_INIT(lib/mdct.c)
 
 AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_CONFIG_HEADER([config.h])
+
+AM_INIT_AUTOMAKE(libvorbis,1.1.1)
+AM_MAINTAINER_MODE
+
+dnl Library versioning
+
+V_LIB_CURRENT=3
+V_LIB_REVISION=0
+V_LIB_AGE=3
+VF_LIB_CURRENT=4
+VF_LIB_REVISION=0
+VF_LIB_AGE=1
+VE_LIB_CURRENT=2
+VE_LIB_REVISION=1
+VE_LIB_AGE=0
+AC_SUBST(V_LIB_CURRENT)
+AC_SUBST(V_LIB_REVISION)
+AC_SUBST(V_LIB_AGE)
+AC_SUBST(VF_LIB_CURRENT)
+AC_SUBST(VF_LIB_REVISION)
+AC_SUBST(VF_LIB_AGE)
+AC_SUBST(VE_LIB_CURRENT)
+AC_SUBST(VE_LIB_REVISION)
+AC_SUBST(VE_LIB_AGE)
+
+dnl --------------------------------------------------  
+dnl Check for programs
+dnl --------------------------------------------------  
+
+dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
+dnl if $CFLAGS is blank
+cflags_save="$CFLAGS"
+AC_PROG_CC
+AC_PROG_CPP
+CFLAGS="$cflags_save"
+
+AM_PROG_LIBTOOL
+
+dnl docbook xml transform and processing tools
+AC_ARG_ENABLE(docs,
+  [  --enable-docs           build the documentation],
+  [case "${enableval}" in
+    yes) build_docs=true;;
+    no)  build_docs=false;;
+    *)   AC_MSG_ERROR(unknown value ${enableval} for --enable-docs);;
+  esac],[build_docs=false])
+
+dnl ideally we'd look for other tools and support them
+if test x$build_docs = xtrue; then
+  AC_CHECK_PROGS([XSLTPROC], xsltproc, [/bin/false])
+  AC_CHECK_PROGS([PDFXMLTEX], pdfxmltex, [/bin/false])
+  if test "x$XSLTPROC" = "x/bin/false" || test "x$PDFXMLTEX" = "x/bin/false"; then
+    build_docs=false
+    AC_MSG_WARN([Documentation will not be built!])
+  fi
+fi
 
-dnl If we're on IRIX, we wanna use cc even if gcc is there (unless the user
-dnl has overriden us)...
-case $host 
-       in *-*-irix*)
-               if test -z "$CC"; then
-                       CC=cc
-               fi
-               AC_CHECK_LIB(audio, ALwritesamps)
-       ;;
-esac
+AM_CONDITIONAL(BUILD_DOCS, [test x$build_docs = xtrue])
 
-if test -z "$CC"; then
-       AC_PROG_CC      
-fi
-AC_PROG_RANLIB
-AC_CHECK_PROG(AR,ar,ar)
+dnl --------------------------------------------------
+dnl Set build flags based on environment
+dnl --------------------------------------------------
 
 dnl Set some target options
+
+cflags_save="$CFLAGS"
 if test -z "$GCC"; then
        case $host in 
        *-*-irix*)
-               DEBUG="-g" 
-               OPT="-O2 -w"
-               PROFILE="-p -g3 -O2" ;;
+               dnl If we're on IRIX, we wanna use cc even if gcc 
+               dnl is there (unless the user has overriden us)...
+               if test -z "$CC"; then
+                       CC=cc
+               fi
+               DEBUG="-g -signed" 
+               CFLAGS="-O2 -w -signed"
+               PROFILE="-p -g3 -O2 -signed" ;;
        sparc-sun-solaris*)
                DEBUG="-v -g"
-               OPT="-xO4 -fast -w -fsingle -fsimple -native -xcg92"
-               PROFILE="-v -xpg -g -xO4 -fast -fsingle -native -fsimple -xcg92 -Dsuncc" ;;
+               CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
+               PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
        *)
                DEBUG="-g"
-               OPT="-O"
+               CFLAGS="-O"
                PROFILE="-g -p" ;;
         esac
 else
 
-# -D__NO_MATH_INLINES avoids some serious FP assembly related bugs in
-# glibc 2.0/2.1
-
+       AC_MSG_CHECKING([GCC version])
+       GCC_VERSION=`$CC -dumpversion`
+       AC_MSG_RESULT([$GCC_VERSION])
        case $host in 
+       *86-*-linux*)
+               DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+               CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
+#                      PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
+               PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
+
+               # glibc < 2.1.3 has a serious FP bug in the math inline header
+               # that will cripple Vorbis.  Look to see if the magic FP stack
+               # clobber is missing in the mathinline header, thus indicating
+               # the buggy version
+
+               AC_EGREP_CPP(log10.*fldlg2.*fxch,[
+                               #define __LIBC_INTERNAL_MATH_INLINES 1
+                               #define __OPTIMIZE__
+                               #include <math.h>
+                               ],bad=maybe,bad=no)
+               if test ${bad} = "maybe" ;then
+                     AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
+                                       [
+                                       #define __LIBC_INTERNAL_MATH_INLINES 1
+                                       #define __OPTIMIZE__
+                                       #include <math.h>
+                                       ],bad=no,bad=yes)
+               fi
+               if test ${bad} = "yes" ;then
+ AC_MSG_WARN([                                                        ])
+ AC_MSG_WARN([********************************************************])
+ AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
+ AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
+ AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
+ AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
+ AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
+ AC_MSG_WARN([* will not fix any previously built programs; this is  *])
+ AC_MSG_WARN([* a compile-time time bug.                             *])
+ AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
+ AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
+ AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
+ AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
+ AC_MSG_WARN([* configure and make to build with inlining.           *])
+ AC_MSG_WARN([********************************************************])
+ AC_MSG_WARN([                                                        ])
+
+               CFLAGS=${OPT}" -D__NO_MATH_INLINES"
+               PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
+               fi;;
+       powerpc-*-linux*)
+               DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES"
+               CFLAGS="-O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
+               PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
        *-*-linux*)
-               DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
-               OPT="-O20 -ffast-math -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
-               PROFILE="-pg -g -O20 -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char";;
+               DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+               CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
+               PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
        sparc-sun-*)
-               DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
-               OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
+               DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char -mv8"
+               CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
                PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
+       *-*-darwin*)
+               DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
+               CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
+               PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
        *)
-               DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
-               OPT="-O20 -D__NO_MATH_INLINES -fsigned-char"
+               DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char"
+               CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
                PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
         esac
 fi
+CFLAGS="$CFLAGS $cflags_save"
 
-AC_HEADER_STDC
+dnl --------------------------------------------------
+dnl Check for headers
+dnl --------------------------------------------------
 
-CFLAGS=""
+AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
 
-dnl AC_PATH_X
-dnl AC_PATH_XTRA
+dnl --------------------------------------------------
+dnl Check for typedefs, structures, etc
+dnl --------------------------------------------------
 
-AC_CHECK_LIB(pthread, pthread_create, 
-       pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
+dnl none
 
-dnl Linuxthreads require you to define _REENTRANT in all threaded
-dnl code.  Bogus, bogus...
+dnl --------------------------------------------------
+dnl Check for libraries
+dnl --------------------------------------------------
 
-if test -n "$pthread_lib"; then
-       case $host in 
-       i?86-*-linux*)
-               AC_DEFINE(_REENTRANT)
-               ;;
-       esac
-fi
+AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
+AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
 
-#if test -n "$x_libraries"; then
-#      XOGG="yes"
-#
-#      dnl If we find libgtk installed, great; otherwise assume we have
-#      dnl to build it ourselves.
-#
-#      AC_CHECK_LIB(gtk, gtk_main, :, LIBGTKDIR="libgtk", $X_LIBS -lglib -lgdk -lX11 -lXext -lm)
-#
-#      dnl libpthread is required for xogg.
-#
-#      if test -z "$pthread_lib"; then XOGG=""; fi
-#
-#      dnl If we don't have libgtk installed, and we don't have a libgtk 
-#      dnl  subdirectory to build the library ourself, we can't build xogg.
-#
-#      if test -n "$LIBGTKDIR" -a ! -d "$LIBGTKDIR"; then
-#              XOGG=""
-#              LIBGTKDIR=""
-#      fi
-#fi
-
-dnl This seems to be the only way to make autoconf only *sometimes* configure
-dnl a subdirectory with AC_CONFIG_SUBDIRS.  "__noconf" is assumed to not 
-dnl exist as a directory, so configure won't try to recursively enter it, unless
-dnl the shell variable $dummy is reset to an existing directory inside the
-dnl if clause.
-
-dummy="__noconf"
-
-#if test -d "$LIBGTKDIR"; then
-#      enable_shared="no"; export enable_shared
-#      dummy="libgtk"
-#      AC_CONFIG_SUBDIRS("$dummy")
-#      X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
-#fi
-
-AC_CHECK_SIZEOF(short)
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-
-case 2 in
-       $ac_cv_sizeof_short) SIZE16="short";;
-       $ac_cv_sizeof_int) SIZE16="int";;
-esac
-
-case 4 in
-       $ac_cv_sizeof_short) SIZE32="short";;
-       $ac_cv_sizeof_int) SIZE32="int";;
-       $ac_cv_sizeof_long) SIZE32="long";;
-esac
-
-case 8 in
-       $ac_cv_sizeof_int) SIZE64="int";;
-       $ac_cv_sizeof_long) SIZE64="long";;
-       $ac_cv_sizeof_long_long) SIZE64="long long";;
-esac
-
-AC_CHECK_TYPE(int16_t,$SIZE16)
-AC_CHECK_TYPE(int32_t,$SIZE32)
-AC_CHECK_TYPE(int64_t,$SIZE64)
-AC_CHECK_TYPE(u_int16_t,unsigned $SIZE16)
-AC_CHECK_TYPE(u_int32_t,unsigned $SIZE32)
-AC_CHECK_TYPE(u_int64_t,unsigned $SIZE64)
-
-if test -z "$SIZE16"; then
-       AC_MSG_ERROR(No 16 bit type found on this platform!)
+HAVE_OGG=no
+dnl first check through pkg-config
+dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
+AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
+if test "x$HAVE_PKG_CONFIG" = "xyes"
+then
+  PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
 fi
-if test -z "$SIZE32"; then
-       AC_MSG_ERROR(No 32 bit type found on this platform!)
+if test "x$HAVE_OGG" = "xno"
+then
+  dnl fall back to the old school test
+  XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
+  libs_save=$LIBS
+  LIBS="$OGG_LIBS $VORBIS_LIBS"
+  AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
+  LIBS=$libs_save
 fi
-if test -z "$SIZE64"; then
-       AC_MSG_WARN(No 64 bit type found on this platform!)
-fi
-       
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h)
 
-AC_C_CONST
-AC_HEADER_TIME
-AC_STRUCT_TM
+dnl --------------------------------------------------
+dnl Check for library functions
+dnl --------------------------------------------------
 
-AC_PROG_MAKE_SET
+AC_FUNC_ALLOCA
 AC_FUNC_MEMCMP
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction)
 
-AC_SUBST(TYPESIZES)
-AC_SUBST(OPT)
+dnl --------------------------------------------------
+dnl Do substitutions
+dnl --------------------------------------------------
+
+AC_SUBST(VORBIS_LIBS)
 AC_SUBST(DEBUG)
 AC_SUBST(PROFILE)
-AC_SUBST(CC)
-AC_SUBST(RANLIB)
-#AC_SUBST(XOGG)
-#AC_SUBST(LIBGTKDIR)
 AC_SUBST(pthread_lib)
 
-AC_OUTPUT(Makefile lib/Makefile examples/Makefile vorbis-tools/Makefile\
-       vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile)
+AC_OUTPUT([
+Makefile
+lib/Makefile
+lib/modes/Makefile
+lib/books/Makefile
+lib/books/coupled/Makefile
+lib/books/uncoupled/Makefile
+lib/books/floor/Makefile
+doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile
+include/Makefile include/vorbis/Makefile
+examples/Makefile
+win32/Makefile
+vq/Makefile
+libvorbis.spec
+vorbis.pc
+vorbisenc.pc
+vorbisfile.pc
+vorbis-uninstalled.pc
+vorbisenc-uninstalled.pc
+vorbisfile-uninstalled.pc
+])