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