1 dnl Process this file with autoconf to produce a configure script
3 dnl ------------------------------------------------
4 dnl Initialization and Versioning
5 dnl ------------------------------------------------
8 AC_INIT([libvorbis],[1.3.1],[vorbis-dev@xiph.org])
10 AC_CONFIG_SRCDIR([lib/mdct.c])
12 AC_CANONICAL_TARGET([])
14 AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
16 AM_CONFIG_HEADER([config.h])
18 dnl Add parameters for aclocal
19 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
21 dnl Library versioning
22 dnl - library source changed -> increment REVISION
23 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
24 dnl - interfaces added -> increment AGE
25 dnl - interfaces removed -> AGE = 0
39 AC_SUBST(V_LIB_CURRENT)
40 AC_SUBST(V_LIB_REVISION)
42 AC_SUBST(VF_LIB_CURRENT)
43 AC_SUBST(VF_LIB_REVISION)
45 AC_SUBST(VE_LIB_CURRENT)
46 AC_SUBST(VE_LIB_REVISION)
49 dnl --------------------------------------------------
50 dnl Check for programs
51 dnl --------------------------------------------------
53 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
54 dnl if $CFLAGS is blank
67 if test "x$enable_docs" = xyes; then
68 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
69 if test $HAVE_DOXYGEN = "false"; then
70 AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
75 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
77 dnl latex tools for the specification document
79 AC_HELP_STRING([--enable-docs], [build the documentation]))
81 if test "x$enable_docs" = xyes; then
82 AC_CHECK_PROGS([PDFLATEX], pdflatex, [/bin/false])
83 AC_CHECK_PROGS([HTLATEX], htlatex, [/bin/false])
84 if test "x$PDFLATEX" = x/bin/false || test "x$HTLATEX" = x/bin/false; then
86 AC_MSG_WARN([Documentation will not be built!])
90 AM_CONDITIONAL(BUILD_DOCS, [test "x$enable_docs" = xyes])
92 AC_ARG_ENABLE(examples,
93 AS_HELP_STRING([--enable-examples], [build the examples]))
95 AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes])
97 dnl --------------------------------------------------
98 dnl Set build flags based on environment
99 dnl --------------------------------------------------
101 dnl Set some target options
103 cflags_save="$CFLAGS"
104 if test -z "$GCC"; then
107 dnl If we're on IRIX, we wanna use cc even if gcc
108 dnl is there (unless the user has overriden us)...
109 if test -z "$CC"; then
113 CFLAGS="-O2 -w -signed"
114 PROFILE="-p -g3 -O2 -signed" ;;
117 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
118 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
126 AC_MSG_CHECKING([GCC version])
127 GCC_VERSION=`$CC -dumpversion`
128 AC_MSG_RESULT([$GCC_VERSION])
131 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
132 CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
133 # PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
134 PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
136 # glibc < 2.1.3 has a serious FP bug in the math inline header
137 # that will cripple Vorbis. Look to see if the magic FP stack
138 # clobber is missing in the mathinline header, thus indicating
141 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
142 #define __LIBC_INTERNAL_MATH_INLINES 1
146 if test ${bad} = "maybe" ;then
147 AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
149 #define __LIBC_INTERNAL_MATH_INLINES 1
154 if test ${bad} = "yes" ;then
156 AC_MSG_WARN([********************************************************])
157 AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
158 AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
159 AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
160 AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
161 AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
162 AC_MSG_WARN([* will not fix any previously built programs; this is *])
163 AC_MSG_WARN([* a compile-time time bug. *])
164 AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
165 AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
166 AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
167 AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
168 AC_MSG_WARN([* configure and make to build with inlining. *])
169 AC_MSG_WARN([********************************************************])
172 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
173 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
176 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
177 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -D_REENTRANT"
178 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";;
180 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
181 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
182 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
184 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
185 CFLAGS="-O20 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
186 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
189 AC_MSG_CHECKING([if gcc supports -mv8])
191 CFLAGS="$CFLAGS -mv8"
192 AC_TRY_COMPILE(, [return 0;], [
197 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
198 CFLAGS="-O20 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
199 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" ;;
201 DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
202 CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
203 PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
205 # Use -W instead of -Wextra because gcc on OS/2 is an old version.
206 DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
207 CFLAGS="-O20 -Wall -W -ffast-math -D_REENTRANT -fsigned-char"
208 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
210 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
211 CFLAGS="-O20 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
212 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
215 AC_ADD_CFLAGS([-Wdeclaration-after-statement])
217 CFLAGS="$CFLAGS $cflags_save"
219 dnl --------------------------------------------------
220 dnl Check for headers
221 dnl --------------------------------------------------
223 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
225 dnl --------------------------------------------------
226 dnl Check for typedefs, structures, etc
227 dnl --------------------------------------------------
231 dnl --------------------------------------------------
232 dnl Check for libraries
233 dnl --------------------------------------------------
235 AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
236 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
241 if test "x$PKG_CONFIG" != "x"
243 PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
245 if test "x$HAVE_OGG" = "xno"
247 dnl fall back to the old school test
248 XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
250 LIBS="$OGG_LIBS $VORBIS_LIBS"
251 AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
255 dnl --------------------------------------------------
256 dnl Check for library functions
257 dnl --------------------------------------------------
262 dnl --------------------------------------------------
264 dnl --------------------------------------------------
266 AC_SUBST(VORBIS_LIBS)
269 AC_SUBST(pthread_lib)
271 dnl The following line causes the libtool distributed with the source
272 dnl to be replaced if the build system has a more recent version.
273 AC_SUBST(LIBTOOL_DEPS)
281 lib/books/coupled/Makefile
282 lib/books/uncoupled/Makefile
283 lib/books/floor/Makefile
284 doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile
286 include/Makefile include/vorbis/Makefile
294 vorbis-uninstalled.pc
295 vorbisenc-uninstalled.pc
296 vorbisfile-uninstalled.pc