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