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