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