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