final beta 4 commit
[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.0beta4)
9
10 dnl Library versioning
11
12 V_LIB_CURRENT=0
13 V_LIB_REVISION=1
14 V_LIB_AGE=0
15 VF_LIB_CURRENT=0
16 VF_LIB_REVISION=1
17 VF_LIB_AGE=0
18 VE_LIB_CURRENT=0
19 VE_LIB_REVISION=1
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 --------------------------------------------------
45 dnl Set build flags based on environment
46 dnl --------------------------------------------------
47
48 AC_CANONICAL_HOST
49
50 dnl Set some target options
51 if test -z "$GCC"; then
52         case $host in 
53         *-*-irix*)
54                 dnl If we're on IRIX, we wanna use cc even if gcc 
55                 dnl is there (unless the user has overriden us)...
56                 if test -z "$CC"; then
57                         CC=cc
58                 fi
59                 DEBUG="-g -signed" 
60                 CFLAGS="-O2 -w -signed"
61                 PROFILE="-p -g3 -O2 -signed" ;;
62         sparc-sun-solaris*)
63                 DEBUG="-v -g"
64                 CFLAGS="-xO4 -fast -w -fsimple -native -xcg92"
65                 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
66         *)
67                 DEBUG="-g"
68                 CFLAGS="-O"
69                 PROFILE="-g -p" ;;
70         esac
71 else
72
73         case $host in 
74         *86-*-linux*)
75                 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
76                 CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
77 #               PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
78                 PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
79
80                 # glibc < 2.1.3 has a serious FP bug in the math inline header
81                 # that will cripple Vorbis.  Look to see if the magic FP stack
82                 # clobber is missing in the mathinline header, thus indicating
83                 # the buggy version
84
85                 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
86                                 #define __LIBC_INTERNAL_MATH_INLINES 1
87                                 #define __OPTIMIZE__
88                                 #include <math.h>
89                                 ],bad=maybe,bad=no)
90                 if test ${bad} = "maybe" ;then
91                       AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
92                                         [
93                                         #define __LIBC_INTERNAL_MATH_INLINES 1
94                                         #define __OPTIMIZE__
95                                         #include <math.h>
96                                         ],bad=no,bad=yes)
97                 fi
98                 if test ${bad} = "yes" ;then
99  AC_MSG_WARN([                                                        ])
100  AC_MSG_WARN([********************************************************])
101  AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
102  AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
103  AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
104  AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
105  AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
106  AC_MSG_WARN([* will not fix any previously built programs; this is  *])
107  AC_MSG_WARN([* a compile-time time bug.                             *])
108  AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
109  AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
110  AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
111  AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
112  AC_MSG_WARN([* configure and make to build with inlining.           *])
113  AC_MSG_WARN([********************************************************])
114  AC_MSG_WARN([                                                        ])
115
116                 CFLAGS=${OPT}" -D__NO_MATH_INLINES"
117                 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
118                 fi;;
119         *-*-linux*)
120                 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
121                 CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char"
122                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
123         sparc-sun-*)
124                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
125                 CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
126                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
127         *-*-darwin*)
128                 DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char"
129                 CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char"
130                 PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";;
131         *)
132                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
133                 CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char"
134                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
135         esac
136 fi
137
138 dnl --------------------------------------------------
139 dnl Check for headers
140 dnl --------------------------------------------------
141
142 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
143
144 dnl --------------------------------------------------
145 dnl Check for typedefs, structures, etc
146 dnl --------------------------------------------------
147
148 dnl none
149
150 dnl --------------------------------------------------
151 dnl Check for libraries
152 dnl --------------------------------------------------
153
154 AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
155 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
156
157 AM_PATH_OGG(LIBS="$LIBS $OGG_LIBS", AC_MSG_ERROR(must have Ogg installed!))
158
159 dnl --------------------------------------------------
160 dnl Check for library functions
161 dnl --------------------------------------------------
162
163 AC_FUNC_ALLOCA
164 AC_FUNC_MEMCMP
165
166 dnl --------------------------------------------------
167 dnl Do substitutions
168 dnl --------------------------------------------------
169
170 AC_SUBST(DEBUG)
171 AC_SUBST(PROFILE)
172 AC_SUBST(pthread_lib)
173
174 AC_OUTPUT(Makefile lib/Makefile lib/modes/Makefile lib/books/Makefile doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile include/Makefile include/vorbis/Makefile examples/Makefile win32/Makefile debian/Makefile vq/Makefile)