K2.6 patches and update.
[tomato.git] / release / src / router / libvorbis / configure.ac
bloba04ed38a4f62b76b0fafca8a479e507c31de13c8
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.2.3],[vorbis-dev@xiph.org])
10 AC_CONFIG_SRCDIR([lib/mdct.c])
12 AC_CANONICAL_TARGET([])
14 AM_INIT_AUTOMAKE($PACKAGE_NAME,$PACKAGE_VERSION)
15 AM_CONFIG_HEADER([config.h])
17 dnl Add parameters for aclocal
18 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
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
26 V_LIB_CURRENT=4
27 V_LIB_REVISION=3
28 V_LIB_AGE=4
30 VF_LIB_CURRENT=6
31 VF_LIB_REVISION=2
32 VF_LIB_AGE=3
34 VE_LIB_CURRENT=2
35 VE_LIB_REVISION=6
36 VE_LIB_AGE=0
38 AC_SUBST(V_LIB_CURRENT)
39 AC_SUBST(V_LIB_REVISION)
40 AC_SUBST(V_LIB_AGE)
41 AC_SUBST(VF_LIB_CURRENT)
42 AC_SUBST(VF_LIB_REVISION)
43 AC_SUBST(VF_LIB_AGE)
44 AC_SUBST(VE_LIB_CURRENT)
45 AC_SUBST(VE_LIB_REVISION)
46 AC_SUBST(VE_LIB_AGE)
48 dnl --------------------------------------------------  
49 dnl Check for programs
50 dnl --------------------------------------------------  
52 dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2"
53 dnl if $CFLAGS is blank
54 cflags_save="$CFLAGS"
55 AC_PROG_CC
56 AC_PROG_CPP
57 CFLAGS="$cflags_save"
59 AC_C_INLINE
61 AC_LIBTOOL_WIN32_DLL
62 AC_PROG_LIBTOOL
63 AM_PROG_CC_C_O
65 dnl latex tools for the specification document
66 AC_ARG_ENABLE(docs,
67         AC_HELP_STRING([--enable-docs], [build the documentation]))
69 if test "x$enable_docs" = xyes; then
70   AC_CHECK_PROGS([PDFLATEX], pdflatex, [/bin/false])
71   AC_CHECK_PROGS([HTLATEX], htlatex, [/bin/false])
72   if test "x$PDFLATEX" = x/bin/false || test "x$HTLATEX" = x/bin/false; then
73     enable_docs=no
74     AC_MSG_WARN([Documentation will not be built!])
75   fi
78 AM_CONDITIONAL(BUILD_DOCS, [test "x$enable_docs" = xyes])
80 dnl --------------------------------------------------
81 dnl Set build flags based on environment
82 dnl --------------------------------------------------
84 dnl Set some target options
86 cflags_save="$CFLAGS"
87 if test -z "$GCC"; then
88         case $host in 
89         *-*-irix*)
90                 dnl If we're on IRIX, we wanna use cc even if gcc 
91                 dnl is there (unless the user has overriden us)...
92                 if test -z "$CC"; then
93                         CC=cc
94                 fi
95                 DEBUG="-g -signed" 
96                 CFLAGS="-O2 -w -signed"
97                 PROFILE="-p -g3 -O2 -signed" ;;
98         sparc-sun-solaris*)
99                 DEBUG="-v -g"
100                 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
101                 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
102         *)
103                 DEBUG="-g"
104                 CFLAGS="-O"
105                 PROFILE="-g -p" ;;
106         esac
107 else
109         AC_MSG_CHECKING([GCC version])
110         GCC_VERSION=`$CC -dumpversion`
111         AC_MSG_RESULT([$GCC_VERSION])
112         case $host in 
113         *86-*-linux*)
114                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
115                 CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
116 #               PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
117                 PROFILE="-Wall -Wextra -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline"
119                 # glibc < 2.1.3 has a serious FP bug in the math inline header
120                 # that will cripple Vorbis.  Look to see if the magic FP stack
121                 # clobber is missing in the mathinline header, thus indicating
122                 # the buggy version
124                 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
125                                 #define __LIBC_INTERNAL_MATH_INLINES 1
126                                 #define __OPTIMIZE__
127                                 #include <math.h>
128                                 ],bad=maybe,bad=no)
129                 if test ${bad} = "maybe" ;then
130                       AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
131                                         [
132                                         #define __LIBC_INTERNAL_MATH_INLINES 1
133                                         #define __OPTIMIZE__
134                                         #include <math.h>
135                                         ],bad=no,bad=yes)
136                 fi
137                 if test ${bad} = "yes" ;then
138  AC_MSG_WARN([                                                        ])
139  AC_MSG_WARN([********************************************************])
140  AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
141  AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
142  AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
143  AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
144  AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
145  AC_MSG_WARN([* will not fix any previously built programs; this is  *])
146  AC_MSG_WARN([* a compile-time time bug.                             *])
147  AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
148  AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
149  AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
150  AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
151  AC_MSG_WARN([* configure and make to build with inlining.           *])
152  AC_MSG_WARN([********************************************************])
153  AC_MSG_WARN([                                                        ])
155                 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
156                 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
157                 fi;;
158         powerpc-*-linux*)
159                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES"
160                 CFLAGS="-O3 -Wall -Wextra -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT"
161                 PROFILE="-pg -g -O3 -ffast-math -mfused-madd -mcpu=750 -D_REENTRANT";;
162         *-*-linux*)
163                 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
164                 CFLAGS="-O20 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char"
165                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
166         sparc-sun-*)
167                 sparc_cpu=""
168                 AC_MSG_CHECKING([if gcc supports -mv8])
169                 old_cflags="$CFLAGS"
170                 CFLAGS="$CFLAGS -mv8"
171                 AC_TRY_COMPILE(, [return 0;], [
172                         AC_MSG_RESULT([yes])
173                         sparc_cpu="-mv8"
174                 ])
175                 CFLAGS="$old_cflags"
176                 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
177                 CFLAGS="-O20 -Wall -Wextra -ffast-math -D__NO_MATH_INLINES -fsigned-char $sparc_cpu"
178                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char $sparc_cpu" ;;
179         *-*-darwin*)
180                 DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
181                 CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
182                 PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
183         *-*-os2*)
184                 # Use -W instead of -Wextra because gcc on OS/2 is an old version.
185                 DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
186                 CFLAGS="-O20 -Wall -W -ffast-math -D_REENTRANT -fsigned-char"
187                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
188         *)
189                 DEBUG="-g -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
190                 CFLAGS="-O20 -Wall -Wextra -D__NO_MATH_INLINES -fsigned-char"
191                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
192         esac
194         AC_ADD_CFLAGS([-Wdeclaration-after-statement])
196 CFLAGS="$CFLAGS $cflags_save"
198 dnl --------------------------------------------------
199 dnl Check for headers
200 dnl --------------------------------------------------
202 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
204 dnl --------------------------------------------------
205 dnl Check for typedefs, structures, etc
206 dnl --------------------------------------------------
208 dnl none
210 dnl --------------------------------------------------
211 dnl Check for libraries
212 dnl --------------------------------------------------
214 AC_CHECK_LIB(m, cos, VORBIS_LIBS="-lm", VORBIS_LIBS="")
215 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
217 PKG_PROG_PKG_CONFIG
219 HAVE_OGG=no
220 if test "x$PKG_CONFIG" != "x"
221 then
222   PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
224 if test "x$HAVE_OGG" = "xno"
225 then
226   dnl fall back to the old school test
227   XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
228   libs_save=$LIBS
229   LIBS="$OGG_LIBS $VORBIS_LIBS"
230   AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
231   LIBS=$libs_save
234 dnl --------------------------------------------------
235 dnl Check for library functions
236 dnl --------------------------------------------------
238 AC_FUNC_ALLOCA
239 AC_FUNC_MEMCMP
241 dnl --------------------------------------------------
242 dnl Do substitutions
243 dnl --------------------------------------------------
245 AC_SUBST(VORBIS_LIBS)
246 AC_SUBST(DEBUG)
247 AC_SUBST(PROFILE)
248 AC_SUBST(pthread_lib)
250 dnl The following line causes the libtool distributed with the source
251 dnl to be replaced if the build system has a more recent version.
252 AC_SUBST(LIBTOOL_DEPS)
254 AC_OUTPUT([
255 Makefile
256 m4/Makefile
257 lib/Makefile
258 lib/modes/Makefile
259 lib/books/Makefile
260 lib/books/coupled/Makefile
261 lib/books/uncoupled/Makefile
262 lib/books/floor/Makefile
263 doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile
264 include/Makefile include/vorbis/Makefile
265 examples/Makefile
266 test/Makefile
267 vq/Makefile
268 libvorbis.spec
269 vorbis.pc
270 vorbisenc.pc
271 vorbisfile.pc
272 vorbis-uninstalled.pc
273 vorbisenc-uninstalled.pc
274 vorbisfile-uninstalled.pc