wrong defines for win in os_types.h.in (typo)
[platform/upstream/libvorbis.git] / configure.in
1 # $Id: configure.in,v 1.21 2000/08/30 06:09:21 xiphmont Exp $
2
3 AC_INIT(lib/mdct.c)
4 #AC_CONFIG_HEADER(config.h)
5
6 cp configure.guess config.guess
7 cp configure.sub config.sub
8
9 AC_CANONICAL_HOST
10
11 dnl If we're on IRIX, we wanna use cc even if gcc is there (unless the user
12 dnl has overriden us)...
13 case $host in 
14         *-*-irix*)
15                 if test -z "$CC"; then
16                         CC=cc
17                 fi
18                 AC_CHECK_LIB(audio, ALwritesamps)
19         ;;
20 # BeOS does not use -lm
21 #       *-*-beos)
22 #               LIBS=""
23 #       ;;
24 # added better check below
25
26 esac
27
28 if test -z "$CC"; then
29         AC_PROG_CC      
30 fi
31 AC_PROG_CPP
32 AC_PROG_RANLIB
33 AC_CHECK_PROG(AR,ar,ar)
34 AC_CHECK_PROG(INSTALL,install,install)
35
36 #not everyone uses libm (eg, BeOS)
37 #AC_CHECK_LIB(m, cos, LIBS="-lm"; AC_DEFINE(HAVE_LIBM), LIBS="")
38 # We no longer use config.h
39 AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="")
40
41 dnl Set some target options
42 if test -z "$GCC"; then
43         case $host in 
44         *-*-irix*)
45                 DEBUG="-g -signed" 
46                 OPT="-O2 -w -signed"
47                 PROFILE="-p -g3 -O2 -signed" ;;
48         sparc-sun-solaris*)
49                 DEBUG="-v -g"
50                 OPT="-xO4 -fast -w -fsimple -native -xcg92"
51                 PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;;
52         *)
53                 DEBUG="-g"
54                 OPT="-O"
55                 PROFILE="-g -p" ;;
56         esac
57 else
58
59         case $host in 
60         *86-*-linux*)
61                 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
62                 OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
63                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char"
64                 
65                 # glibc < 2.1.3 has a serious FP bug in the math inline header
66                 # that will cripple Vorbis.  Look to see if the magic FP stack
67                 # clobber is missing in the mathinline header, thus indicating
68                 # the buggy version
69
70                 AC_EGREP_CPP(log10.*fldlg2.*fxch,[
71                                 #define __LIBC_INTERNAL_MATH_INLINES 1
72                                 #define __OPTIMIZE__
73                                 #include <math.h>
74                                 ],bad=maybe,bad=no)
75                 if test ${bad} = "maybe" ;then
76                       AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
77                                         [
78                                         #define __LIBC_INTERNAL_MATH_INLINES 1
79                                         #define __OPTIMIZE__
80                                         #include <math.h>
81                                         ],bad=no,bad=yes)
82                 fi
83                 if test ${bad} = "yes" ;then
84  AC_MSG_WARN([                                                        ])
85  AC_MSG_WARN([********************************************************])
86  AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
87  AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
88  AC_MSG_WARN([* all floating point code, not just Ogg, built on this *])
89  AC_MSG_WARN([* machine.  Upgrading to glibc 2.1.3 is strongly urged *])
90  AC_MSG_WARN([* to correct the problem.  Note that upgrading glibc   *])
91  AC_MSG_WARN([* will not fix any previously built programs; this is  *])
92  AC_MSG_WARN([* a compile-time time bug.                             *])
93  AC_MSG_WARN([* To work around the problem for this build of Ogg,    *])
94  AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
95  AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *])
96  AC_MSG_WARN([* will actually work.  Once glibc is upgraded, rerun   *])
97  AC_MSG_WARN([* configure and make to build with inlining.           *])
98  AC_MSG_WARN([********************************************************])
99  AC_MSG_WARN([                                                        ])
100
101                 OPT=${OPT}" -D__NO_MATH_INLINES"
102                 PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
103                 fi;;
104         *-*-linux*)
105                 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
106                 OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
107                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
108         sparc-sun-*)
109                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
110                 OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
111                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
112         *)
113                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
114                 OPT="-O20 -D__NO_MATH_INLINES -fsigned-char"
115                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
116         esac
117 fi
118
119 AC_HEADER_STDC
120
121 CFLAGS=""
122
123 dnl AC_PATH_X
124 dnl AC_PATH_XTRA
125
126 #AC_CHECK_LIB(pthread, pthread_create, 
127 #       pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
128 # We no longer use config.h
129 AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :)
130
131 #dnl Linuxthreads require you to define _REENTRANT in all threaded
132 #dnl code.  Bogus, bogus...
133 #
134 #if test -n "$pthread_lib"; then
135 #       case $host in 
136 #       i?86-*-linux*)
137 #               AC_DEFINE(_REENTRANT)
138 #               ;;
139 #       esac
140 #fi
141 # We no longer use config.h
142
143 #if test -n "$x_libraries"; then
144 #       XOGG="yes"
145 #
146 #       dnl If we find libgtk installed, great; otherwise assume we have
147 #       dnl to build it ourselves.
148 #
149 #       AC_CHECK_LIB(gtk, gtk_main, :, LIBGTKDIR="libgtk", $X_LIBS -lglib -lgdk -lX11 -lXext -lm)
150 #
151 #       dnl libpthread is required for xogg.
152 #
153 #       if test -z "$pthread_lib"; then XOGG=""; fi
154 #
155 #       dnl If we don't have libgtk installed, and we don't have a libgtk 
156 #       dnl  subdirectory to build the library ourself, we can't build xogg.
157 #
158 #       if test -n "$LIBGTKDIR" -a ! -d "$LIBGTKDIR"; then
159 #               XOGG=""
160 #               LIBGTKDIR=""
161 #       fi
162 #fi
163
164 dnl This seems to be the only way to make autoconf only *sometimes* configure
165 dnl a subdirectory with AC_CONFIG_SUBDIRS.  "__noconf" is assumed to not 
166 dnl exist as a directory, so configure won't try to recursively enter it, unless
167 dnl the shell variable $dummy is reset to an existing directory inside the
168 dnl if clause.
169
170 dummy="__noconf"
171
172 #if test -d "$LIBGTKDIR"; then
173 #       enable_shared="no"; export enable_shared
174 #       dummy="libgtk"
175 #       AC_CONFIG_SUBDIRS("$dummy")
176 #       X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
177 #fi
178
179 # check macro modified from Jon Shiring's to compensate for autoconf's lagging
180 # behind the times on type madness
181
182 AC_MSG_CHECKING(for int16_t)
183 AC_CACHE_VAL(has_int16_t,
184 [AC_TRY_RUN([
185 #ifdef __BEOS__
186 #include <inttypes.h>
187 #else
188 #include <sys/types.h>
189 #endif
190 int16_t foo;
191 int main() {return 0;}
192 ],
193 has_int16_t=yes,
194 has_int16_t=no,
195 has_int16_t=no
196 )])
197 AC_MSG_RESULT($has_int16_t)
198
199 AC_MSG_CHECKING(for int32_t)
200 AC_CACHE_VAL(has_int32_t,
201 [AC_TRY_RUN([
202 #ifdef __BEOS__
203 #include <inttypes.h>
204 #else
205 #include <sys/types.h>
206 #endif
207 int32_t foo;
208 int main() {return 0;}
209 ],
210 has_int32_t=yes,
211 has_int32_t=no,
212 has_int32_t=no
213 )])
214 AC_MSG_RESULT($has_int32_t)
215
216 AC_MSG_CHECKING(for uint32_t)
217 AC_CACHE_VAL(has_uint32_t,
218 [AC_TRY_RUN([
219 #ifdef __BEOS__
220 #include <inttypes.h>
221 #else
222 #include <sys/types.h>
223 #endif
224 uint32_t foo;
225 int main() {return 0;}
226 ],
227 has_uint32_t=yes,
228 has_uint32_t=no,
229 has_uint32_t=no
230 )])
231 AC_MSG_RESULT($has_uint32_t)
232
233 AC_MSG_CHECKING(for u_int32_t)
234 AC_CACHE_VAL(has_u_int32_t,
235 [AC_TRY_RUN([
236 #ifdef __BEOS__
237 #include <inttypes.h>
238 #else
239 #include <sys/types.h>
240 #endif
241 u_int32_t foo;
242 int main() {return 0;}
243 ],
244 has_u_int32_t=yes,
245 has_u_int32_t=no,
246 has_u_int32_t=no
247 )])
248 AC_MSG_RESULT($has_u_int32_t)
249
250 AC_MSG_CHECKING(for int64_t)
251 AC_CACHE_VAL(has_int64_t,
252 [AC_TRY_RUN([
253 #ifdef __BEOS__
254 #include <inttypes.h>
255 #else
256 #include <sys/types.h>
257 #endif
258 int64_t foo;
259 int main() {return 0;}
260 ],
261 has_int64_t=yes,
262 has_int64_t=no,
263 has_int64_t=no
264 )])
265 AC_MSG_RESULT($has_int64_t)
266
267 AC_CHECK_SIZEOF(short)
268 AC_CHECK_SIZEOF(int)
269 AC_CHECK_SIZEOF(long)
270 AC_CHECK_SIZEOF(long long)
271
272
273 if test x$has_int16_t = "xyes" ; then
274         SIZE16="int16_t"
275 else
276         case 2 in
277                 $ac_cv_sizeof_short) SIZE16="short";;
278                 $ac_cv_sizeof_int) SIZE16="int";;
279         esac
280 fi
281
282 if test x$has_int32_t = "xyes" ; then
283         SIZE32="int32_t"
284 else
285         case 4 in
286                 $ac_cv_sizeof_short) SIZE32="short";;
287                 $ac_cv_sizeof_int) SIZE32="int";;
288                 $ac_cv_sizeof_long) SIZE32="long";;
289         esac
290 fi
291
292 if test x$has_uint32_t = "xyes" ; then
293         USIZE32="uint32_t"
294 else
295         if test x$has_u_int32_t = "xyes" ; then
296                 USIZE32="u_int32_t"
297         else
298                 case 4 in
299                         $ac_cv_sizeof_short) USIZE32="unsigned short";;
300                         $ac_cv_sizeof_int) USIZE32="unsigned int";;
301                         $ac_cv_sizeof_long) USIZE32="unsigned long";;
302                 esac
303         fi
304 fi
305
306 if test x$has_int64_t = "xyes" ; then
307         SIZE64="int64_t"
308 else
309 case 8 in
310         $ac_cv_sizeof_int) SIZE64="int";;
311         $ac_cv_sizeof_long) SIZE64="long";;
312         $ac_cv_sizeof_long_long) SIZE64="long long";;
313 esac
314 fi
315
316 if test -z "$SIZE16"; then
317         AC_MSG_ERROR(No 16 bit type found on this platform!)
318 fi
319 if test -z "$SIZE32"; then
320         AC_MSG_ERROR(No 32 bit type found on this platform!)
321 fi
322 if test -z "$USIZE32"; then
323         AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
324 fi
325 if test -z "$SIZE64"; then
326         AC_MSG_WARN(No 64 bit type found on this platform!)
327 fi
328         
329 #AC_CHECK_HEADER(alloca.h,AC_DEFINE(USE_ALLOCA_H),:)
330 #AC_CHECK_HEADER(memory.h,AC_DEFINE(USE_MEMORY_H),:)
331 # We no longer use config.h
332 AC_CHECK_HEADER(alloca.h,CFLAGS="$CFLAGS -DUSE_ALLOCA_H",:)
333 AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:)
334
335 AC_C_CONST
336 AC_HEADER_TIME
337 AC_STRUCT_TM
338
339 AC_PROG_MAKE_SET
340 AC_FUNC_MEMCMP
341 AC_TYPE_SIGNAL
342 AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction)
343
344 AC_SUBST(SIZE16)
345 AC_SUBST(SIZE32)
346 AC_SUBST(USIZE32)
347 AC_SUBST(SIZE64)
348 AC_SUBST(OPT)
349 AC_SUBST(LIBS)
350 AC_SUBST(DEBUG)
351 AC_SUBST(PROFILE)
352 AC_SUBST(CC)
353 AC_SUBST(RANLIB)
354 #AC_SUBST(XOGG)
355 #AC_SUBST(LIBGTKDIR)
356 AC_SUBST(pthread_lib)
357
358 AC_CONFIG_SUBDIRS(vorbis-tools/libao)
359
360 AC_OUTPUT(Makefile lib/Makefile examples/Makefile include/vorbis/os_types.h\
361         vorbis-tools/Makefile\
362         vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile)
363