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.5],[vorbis-dev@xiph.org])
10 AC_CONFIG_MACRO_DIR([m4])
12 AC_CONFIG_SRCDIR([lib/mdct.c])
14 AC_CANONICAL_TARGET([])
19 dnl Add parameters for aclocal
20 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
22 dnl enable silent rules on automake 1.11 and later
23 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
25 dnl Library versioning
26 dnl - library source changed -> increment REVISION
27 dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
28 dnl - interfaces added -> increment AGE
29 dnl - interfaces removed -> AGE = 0
43 AC_SUBST(V_LIB_CURRENT)
44 AC_SUBST(V_LIB_REVISION)
46 AC_SUBST(VF_LIB_CURRENT)
47 AC_SUBST(VF_LIB_REVISION)
49 AC_SUBST(VE_LIB_CURRENT)
50 AC_SUBST(VE_LIB_REVISION)
53 dnl --------------------------------------------------
54 dnl Check for programs
55 dnl --------------------------------------------------
57 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
58 dnl if $CFLAGS is blank
71 if test "x$enable_docs" = xyes; then
72 AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, true, false)
73 if test $HAVE_DOXYGEN = "false"; then
74 AC_MSG_WARN([*** doxygen not found, API documentation will not be built])
79 AM_CONDITIONAL(HAVE_DOXYGEN,$HAVE_DOXYGEN)
81 dnl latex tools for the specification document
83 AC_HELP_STRING([--enable-docs], [build the documentation]))
85 if test "x$enable_docs" = xyes; then
86 AC_CHECK_PROGS([PDFLATEX], pdflatex, [/bin/false])
87 AC_CHECK_PROGS([HTLATEX], htlatex, [/bin/false])
88 if test "x$PDFLATEX" = x/bin/false || test "x$HTLATEX" = x/bin/false; then
90 AC_MSG_WARN([Documentation will not be built!])
94 AM_CONDITIONAL(BUILD_DOCS, [test "x$enable_docs" = xyes])
96 AC_ARG_ENABLE(examples,
97 AS_HELP_STRING([--enable-examples], [build the examples]))
99 AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes])
101 dnl --------------------------------------------------
102 dnl Set build flags based on environment
103 dnl --------------------------------------------------
105 dnl Set some target options
107 cflags_save="$CFLAGS"
108 if test -z "$GCC"; then
111 dnl If we're on IRIX, we wanna use cc even if gcc
112 dnl is there (unless the user has overriden us)...
113 if test -z "$CC"; then
117 CFLAGS="-O2 -w -signed"
118 PROFILE="-p -g3 -O2 -signed" ;;
121 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
122 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
130 AC_MSG_CHECKING([GCC version])
131 GCC_VERSION=`$CC -dumpversion`
132 AC_MSG_RESULT([$GCC_VERSION])
135 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
136 CFLAGS="-O3 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
137 # PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
138 PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
140 # glibc < 2.1.3 has a serious FP bug in the math inline header
141 # that will cripple Vorbis. Look to see if the magic FP stack
142 # clobber is missing in the mathinline header, thus indicating
145 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
146 #define __LIBC_INTERNAL_MATH_INLINES 1
150 if test ${bad} = "maybe" ;then
151 AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
153 #define __LIBC_INTERNAL_MATH_INLINES 1
158 if test ${bad} = "yes" ;then
160 AC_MSG_WARN([********************************************************])
161 AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
162 AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
163 AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
164 AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
165 AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
166 AC_MSG_WARN([* will not fix any previously built programs; this is *])
167 AC_MSG_WARN([* a compile-time bug. *])
168 AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
169 AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
170 AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
171 AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
172 AC_MSG_WARN([* configure and make to build with inlining. *])
173 AC_MSG_WARN([********************************************************])
176 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
177 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
180 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
181 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -D_REENTRANT"
182 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";;
184 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
185 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
186 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
188 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
189 CFLAGS="-O3 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
190 PROFILE="-pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char";;
193 AC_MSG_CHECKING([if gcc supports -mv8])
195 CFLAGS="$CFLAGS -mv8"
196 AC_TRY_COMPILE(, [return 0;], [
201 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
202 CFLAGS="-O3 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
203 PROFILE="-pg -g -O3 -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" ;;
205 DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
206 CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O3 -ffast-math -fsigned-char"
207 PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O3 -ffast-math -fsigned-char";;
209 # Use -W instead of -Wextra because gcc on OS/2 is an old version.
210 DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
211 CFLAGS="-O3 -Wall -W -ffast-math -D_REENTRANT -fsigned-char"
212 PROFILE="-pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char";;
214 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
215 CFLAGS="-O3 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
216 PROFILE="-O3 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
219 AC_ADD_CFLAGS([-Wdeclaration-after-statement])
221 CFLAGS="$CFLAGS $cflags_save"
223 dnl --------------------------------------------------
224 dnl Check for headers
225 dnl --------------------------------------------------
227 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
229 dnl --------------------------------------------------
230 dnl Check for typedefs, structures, etc
231 dnl --------------------------------------------------
235 dnl --------------------------------------------------
236 dnl Check for libraries
237 dnl --------------------------------------------------
239 AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
240 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
245 if test "x$PKG_CONFIG" != "x"
247 PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
249 if test "x$HAVE_OGG" = "xno"
251 dnl fall back to the old school test
252 XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
254 LIBS="$OGG_LIBS $VORBIS_LIBS"
255 AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
259 dnl --------------------------------------------------
260 dnl Check for library functions
261 dnl --------------------------------------------------
266 dnl --------------------------------------------------
268 dnl --------------------------------------------------
270 AC_SUBST(VORBIS_LIBS)
273 AC_SUBST(pthread_lib)
275 dnl The following line causes the libtool distributed with the source
276 dnl to be replaced if the build system has a more recent version.
277 AC_SUBST(LIBTOOL_DEPS)
285 lib/books/coupled/Makefile
286 lib/books/uncoupled/Makefile
287 lib/books/floor/Makefile
288 doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile doc/libvorbis/Makefile
290 include/Makefile include/vorbis/Makefile
298 vorbis-uninstalled.pc
299 vorbisenc-uninstalled.pc
300 vorbisfile-uninstalled.pc
302 AC_CONFIG_HEADERS([config.h])