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