1 dnl Process this file with autoconf to produce a configure script
3 dnl ------------------------------------------------
4 dnl Initialization and Versioning
5 dnl ------------------------------------------------
8 AM_INIT_AUTOMAKE(libvorbis,1.0.0)
10 dnl Library versioning
18 AC_SUBST(V_LIB_CURRENT)
19 AC_SUBST(V_LIB_REVISION)
21 AC_SUBST(VF_LIB_CURRENT)
22 AC_SUBST(VF_LIB_REVISION)
25 dnl --------------------------------------------------
26 dnl Check for programs
27 dnl --------------------------------------------------
29 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
30 dnl if $CFLAGS is blank
37 dnl --------------------------------------------------
38 dnl Additional arguments
39 dnl --------------------------------------------------
41 AC_ARG_WITH(ogg, [ --with-ogg=DIR Set where the Ogg library is located])
43 dnl --------------------------------------------------
44 dnl Set build flags based on environment
45 dnl --------------------------------------------------
49 dnl Set some target options
50 if test -z "$GCC"; then
53 dnl If we're on IRIX, we wanna use cc even if gcc
54 dnl is there (unless the user has overriden us)...
55 if test -z "$CC"; then
59 CFLAGS="-O2 -w -signed"
60 PROFILE="-p -g3 -O2 -signed" ;;
63 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
64 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
74 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
75 CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
76 # PROFILE="-Wall -W -pg -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
77 PROFILE="-Wall -W -pg -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
79 # glibc < 2.1.3 has a serious FP bug in the math inline header
80 # that will cripple Vorbis. Look to see if the magic FP stack
81 # clobber is missing in the mathinline header, thus indicating
84 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
85 #define __LIBC_INTERNAL_MATH_INLINES 1
89 if test ${bad} = "maybe" ;then
90 AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
92 #define __LIBC_INTERNAL_MATH_INLINES 1
97 if test ${bad} = "yes" ;then
99 AC_MSG_WARN([********************************************************])
100 AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
101 AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *])
102 AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
103 AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *])
104 AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *])
105 AC_MSG_WARN([* will not fix any previously built programs; this is *])
106 AC_MSG_WARN([* a compile-time time bug. *])
107 AC_MSG_WARN([* To work around the problem for this build of Ogg, *])
108 AC_MSG_WARN([* autoconf is disabling all math inlining. This will *])
109 AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
110 AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *])
111 AC_MSG_WARN([* configure and make to build with inlining. *])
112 AC_MSG_WARN([********************************************************])
115 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
116 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
119 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
120 CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
121 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
123 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
124 CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
125 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
127 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
128 CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
129 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
135 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread")
137 dnl This seems to be the only way to make autoconf only *sometimes* configure
138 dnl a subdirectory with AC_CONFIG_SUBDIRS. "__noconf" is assumed to not
139 dnl exist as a directory, so configure won't try to recursively enter it, unless
140 dnl the shell variable $dummy is reset to an existing directory inside the
145 # check macro modified from Jon Shiring's to compensate for autoconf's lagging
146 # behind the times on type madness
148 AC_MSG_CHECKING(for int16_t)
149 AC_CACHE_VAL(has_int16_t,
152 #include <inttypes.h>
154 #include <sys/types.h>
156 int main() {return 0;}
162 AC_MSG_RESULT($has_int16_t)
164 AC_MSG_CHECKING(for int32_t)
165 AC_CACHE_VAL(has_int32_t,
168 #include <inttypes.h>
170 #include <sys/types.h>
172 int main() {return 0;}
178 AC_MSG_RESULT($has_int32_t)
180 AC_MSG_CHECKING(for uint32_t)
181 AC_CACHE_VAL(has_uint32_t,
184 #include <inttypes.h>
186 #include <sys/types.h>
188 int main() {return 0;}
194 AC_MSG_RESULT($has_uint32_t)
196 AC_MSG_CHECKING(for u_int32_t)
197 AC_CACHE_VAL(has_u_int32_t,
200 #include <inttypes.h>
202 #include <sys/types.h>
204 int main() {return 0;}
210 AC_MSG_RESULT($has_u_int32_t)
212 AC_MSG_CHECKING(for int64_t)
213 AC_CACHE_VAL(has_int64_t,
216 #include <inttypes.h>
218 #include <sys/types.h>
220 int main() {return 0;}
226 AC_MSG_RESULT($has_int64_t)
228 AC_CHECK_SIZEOF(short)
230 AC_CHECK_SIZEOF(long)
231 AC_CHECK_SIZEOF(long long)
234 if test x$has_int16_t = "xyes" ; then
238 $ac_cv_sizeof_short) SIZE16="short";;
239 $ac_cv_sizeof_int) SIZE16="int";;
243 dnl --------------------------------------------------
244 dnl Check for headers
245 dnl --------------------------------------------------
247 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
249 dnl --------------------------------------------------
250 dnl Check for typedefs, structures, etc
251 dnl --------------------------------------------------
255 dnl --------------------------------------------------
256 dnl Check for libraries
257 dnl --------------------------------------------------
259 AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
260 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
263 if test -n $with_ogg; then
264 CFLAGS="$CFLAGS -I$with_ogg/include -L$with_ogg/lib"
266 AC_CHECK_LIB(ogg, oggpack_read, LIBS="$LIBS -logg", AC_MSG_ERROR([You must have libogg to compile vorbis!!!]))
268 dnl --------------------------------------------------
269 dnl Check for library functions
270 dnl --------------------------------------------------
275 dnl --------------------------------------------------
277 dnl --------------------------------------------------
281 AC_SUBST(pthread_lib)
283 AC_OUTPUT(Makefile lib/Makefile doc/Makefile include/Makefile include/vorbis/Makefile include/vorbis/book/Makefile examples/Makefile)