Don't leave the silly debugging malloc enabled
[platform/upstream/libvorbis.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script
2
3 dnl ------------------------------------------------
4 dnl Initialization and Versioning
5 dnl ------------------------------------------------
6
7 AC_INIT(lib/mdct.c)
8
9 AC_CANONICAL_HOST
10 AC_CANONICAL_TARGET
11
12 AM_CONFIG_HEADER([config.h])
13
14 AM_INIT_AUTOMAKE(libvorbis,1.2.1svn)
15 AM_MAINTAINER_MODE
16
17 dnl Add parameters for aclocal
18 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
19
20 dnl Library versioning
21
22 V_LIB_CURRENT=4
23 V_LIB_REVISION=0
24 V_LIB_AGE=4
25 VF_LIB_CURRENT=5
26 VF_LIB_REVISION=0
27 VF_LIB_AGE=2
28 VE_LIB_CURRENT=2
29 VE_LIB_REVISION=3
30 VE_LIB_AGE=0
31 AC_SUBST(V_LIB_CURRENT)
32 AC_SUBST(V_LIB_REVISION)
33 AC_SUBST(V_LIB_AGE)
34 AC_SUBST(VF_LIB_CURRENT)
35 AC_SUBST(VF_LIB_REVISION)
36 AC_SUBST(VF_LIB_AGE)
37 AC_SUBST(VE_LIB_CURRENT)
38 AC_SUBST(VE_LIB_REVISION)
39 AC_SUBST(VE_LIB_AGE)
40
41 dnl --------------------------------------------------  
42 dnl Check for programs
43 dnl --------------------------------------------------  
44
45 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
46 dnl if $CFLAGS is blank
47 cflags_save="$CFLAGS"
48 AC_PROG_CC
49 AC_PROG_CPP
50 CFLAGS="$cflags_save"
51
52 AC_C_INLINE
53
54 AM_PROG_LIBTOOL
55 AM_PROG_CC_C_O
56
57 dnl docbook xml transform and processing tools
58 AC_ARG_ENABLE(docs,
59   [  --enable-docs           build the documentation],
60   [case "${enableval}" in
61     yes) build_docs=true;;
62     no)  build_docs=false;;
63     *)   AC_MSG_ERROR(unknown value ${enableval} for --enable-docs);;
64   esac],[build_docs=false])
65
66 dnl ideally we'd look for other tools and support them
67 if test x$build_docs = xtrue; then
68   AC_CHECK_PROGS([XSLTPROC], xsltproc, [/bin/false])
69   AC_CHECK_PROGS([PDFXMLTEX], pdfxmltex, [/bin/false])
70   if test "x$XSLTPROC" = "x/bin/false" || test "x$PDFXMLTEX" = "x/bin/false"; then
71     build_docs=false
72     AC_MSG_WARN([Documentation will not be built!])
73   fi
74 fi
75
76 AM_CONDITIONAL(BUILD_DOCS, [test x$build_docs = xtrue])
77
78 dnl --------------------------------------------------
79 dnl Set build flags based on environment
80 dnl --------------------------------------------------
81
82 dnl Set some target options
83
84 cflags_save="$CFLAGS"
85 if test -z "$GCC"; then
86         case $host in 
87         *-*-irix*)
88                 dnl If we're on IRIX, we wanna use cc even if gcc 
89                 dnl is there (unless the user has overriden us)...
90                 if test -z "$CC"; then
91                         CC=cc
92                 fi
93                 DEBUG="-g -signed" 
94                 CFLAGS="-O2 -w -signed"
95                 PROFILE="-p -g3 -O2 -signed" ;;
96         sparc-sun-solaris*)
97                 DEBUG="-v -g"
98                 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
99                 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
100         *)
101                 DEBUG="-g"
102                 CFLAGS="-O"
103                 PROFILE="-g -p" ;;
104         esac
105 else
106
107         AC_MSG_CHECKING([GCC version])
108         GCC_VERSION=`$CC -dumpversion`
109         AC_MSG_RESULT([$GCC_VERSION])
110         case $host in 
111         *86-*-linux*)
112                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
113                 CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
114 #               PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
115                 PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
116
117                 # glibc < 2.1.3 has a serious FP bug in the math inline header
118                 # that will cripple Vorbis.  Look to see if the magic FP stack
119                 # clobber is missing in the mathinline header, thus indicating
120                 # the buggy version
121
122                 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
123                                 #define __LIBC_INTERNAL_MATH_INLINES 1
124                                 #define __OPTIMIZE__
125                                 #include <math.h>
126                                 ],bad=maybe,bad=no)
127                 if test ${bad} = "maybe" ;then
128                       AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
129                                         [
130                                         #define __LIBC_INTERNAL_MATH_INLINES 1
131                                         #define __OPTIMIZE__
132                                         #include <math.h>
133                                         ],bad=no,bad=yes)
134                 fi
135                 if test ${bad} = "yes" ;then
136  AC_MSG_WARN([                                                        ])
137  AC_MSG_WARN([********************************************************])
138  AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
139  AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
140  AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
141  AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
142  AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
143  AC_MSG_WARN([* will not fix any previously built programs; this is  *])
144  AC_MSG_WARN([* a compile-time time bug.                             *])
145  AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
146  AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
147  AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
148  AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
149  AC_MSG_WARN([* configure and make to build with inlining.           *])
150  AC_MSG_WARN([********************************************************])
151  AC_MSG_WARN([                                                        ])
152
153                 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
154                 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
155                 fi;;
156         powerpc-*-linux*)
157                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
158                 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
159                 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
160         *-*-linux*)
161                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
162                 CFLAGS="-O20 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
163                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
164         sparc-sun-*)
165                 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char -mv8"
166                 CFLAGS="-O20 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
167                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
168         *-*-darwin*)
169                 DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
170                 CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
171                 PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
172         *)
173                 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
174                 CFLAGS="-O20 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
175                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
176         esac
177
178         AC_ADD_CFLAGS([-Wdeclaration-after-statement])
179 fi
180 CFLAGS="$CFLAGS $cflags_save"
181
182 dnl --------------------------------------------------
183 dnl Check for headers
184 dnl --------------------------------------------------
185
186 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
187
188 dnl --------------------------------------------------
189 dnl Check for typedefs, structures, etc
190 dnl --------------------------------------------------
191
192 dnl none
193
194 dnl --------------------------------------------------
195 dnl Check for libraries
196 dnl --------------------------------------------------
197
198 AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
199 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
200
201 HAVE_OGG=no
202 dnl first check through pkg-config
203 dnl check for pkg-config itself so we don't try the m4 macro without pkg-config
204 AC_CHECK_PROG(HAVE_PKG_CONFIG, pkg-config, yes)
205 if test "x$HAVE_PKG_CONFIG" = "xyes"
206 then
207   PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
208 fi
209 if test "x$HAVE_OGG" = "xno"
210 then
211   dnl fall back to the old school test
212   XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
213   libs_save=$LIBS
214   LIBS="$OGG_LIBS $VORBIS_LIBS"
215   AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
216   LIBS=$libs_save
217 fi
218
219 dnl --------------------------------------------------
220 dnl Check for library functions
221 dnl --------------------------------------------------
222
223 AC_FUNC_ALLOCA
224 AC_FUNC_MEMCMP
225
226 dnl --------------------------------------------------
227 dnl Do substitutions
228 dnl --------------------------------------------------
229
230 AC_SUBST(VORBIS_LIBS)
231 AC_SUBST(DEBUG)
232 AC_SUBST(PROFILE)
233 AC_SUBST(pthread_lib)
234
235 AC_OUTPUT([
236 Makefile
237 m4/Makefile
238 lib/Makefile
239 lib/modes/Makefile
240 lib/books/Makefile
241 lib/books/coupled/Makefile
242 lib/books/uncoupled/Makefile
243 lib/books/floor/Makefile
244 doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile
245 include/Makefile include/vorbis/Makefile
246 examples/Makefile
247 test/Makefile
248 vq/Makefile
249 libvorbis.spec
250 vorbis.pc
251 vorbisenc.pc
252 vorbisfile.pc
253 vorbis-uninstalled.pc
254 vorbisenc-uninstalled.pc
255 vorbisfile-uninstalled.pc
256 ])