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