Build changes for BeOS (no -lm), Solaris (eliminate need for u_int or
[platform/upstream/libvorbis.git] / configure.in
1 # $Id: configure.in,v 1.15 2000/06/19 15:14:15 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 LIBS="-lm"
11
12 dnl If we're on IRIX, we wanna use cc even if gcc is there (unless the user
13 dnl has overriden us)...
14 case $host in 
15         *-*-irix*)
16                 if test -z "$CC"; then
17                         CC=cc
18                 fi
19                 AC_CHECK_LIB(audio, ALwritesamps)
20         ;;
21 # BeOS does not use -lm
22         *-*-beos)
23                 LIBS=""
24         ;;
25
26 esac
27
28 if test -z "$CC"; then
29         AC_PROG_CC      
30 fi
31 AC_PROG_RANLIB
32 AC_CHECK_PROG(AR,ar,ar)
33 AC_CHECK_PROG(INSTALL,install,install)
34
35 dnl Set some target options
36 if test -z "$GCC"; then
37         case $host in 
38         *-*-irix*)
39                 DEBUG="-g" 
40                 OPT="-O2 -w"
41                 PROFILE="-p -g3 -O2" ;;
42         sparc-sun-solaris*)
43                 DEBUG="-v -g"
44                 OPT="-xO4 -fast -w -fsingle -fsimple -native -xcg92"
45                 PROFILE="-v -xpg -g -xO4 -fast -fsingle -native -fsimple -xcg92 -Dsuncc" ;;
46         *)
47                 DEBUG="-g"
48                 OPT="-O"
49                 PROFILE="-g -p" ;;
50         esac
51 else
52
53 # -D__NO_MATH_INLINES avoids some serious FP assembly related bugs in
54 # glibc 2.0/2.1
55
56         case $host in 
57         *-*-linux*)
58                 DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
59                 OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
60                 PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";;
61         sparc-sun-*)
62                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -mv8"
63                 OPT="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8"
64                 PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;;
65         *)
66                 DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
67                 OPT="-O20 -D__NO_MATH_INLINES -fsigned-char"
68                 PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;;
69         esac
70 fi
71
72 AC_HEADER_STDC
73
74 CFLAGS=""
75
76 dnl AC_PATH_X
77 dnl AC_PATH_XTRA
78
79 AC_CHECK_LIB(pthread, pthread_create, 
80         pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
81
82 dnl Linuxthreads require you to define _REENTRANT in all threaded
83 dnl code.  Bogus, bogus...
84
85 if test -n "$pthread_lib"; then
86         case $host in 
87         i?86-*-linux*)
88                 AC_DEFINE(_REENTRANT)
89                 ;;
90         esac
91 fi
92
93 #if test -n "$x_libraries"; then
94 #       XOGG="yes"
95 #
96 #       dnl If we find libgtk installed, great; otherwise assume we have
97 #       dnl to build it ourselves.
98 #
99 #       AC_CHECK_LIB(gtk, gtk_main, :, LIBGTKDIR="libgtk", $X_LIBS -lglib -lgdk -lX11 -lXext -lm)
100 #
101 #       dnl libpthread is required for xogg.
102 #
103 #       if test -z "$pthread_lib"; then XOGG=""; fi
104 #
105 #       dnl If we don't have libgtk installed, and we don't have a libgtk 
106 #       dnl  subdirectory to build the library ourself, we can't build xogg.
107 #
108 #       if test -n "$LIBGTKDIR" -a ! -d "$LIBGTKDIR"; then
109 #               XOGG=""
110 #               LIBGTKDIR=""
111 #       fi
112 #fi
113
114 dnl This seems to be the only way to make autoconf only *sometimes* configure
115 dnl a subdirectory with AC_CONFIG_SUBDIRS.  "__noconf" is assumed to not 
116 dnl exist as a directory, so configure won't try to recursively enter it, unless
117 dnl the shell variable $dummy is reset to an existing directory inside the
118 dnl if clause.
119
120 dummy="__noconf"
121
122 #if test -d "$LIBGTKDIR"; then
123 #       enable_shared="no"; export enable_shared
124 #       dummy="libgtk"
125 #       AC_CONFIG_SUBDIRS("$dummy")
126 #       X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
127 #fi
128
129 AC_CHECK_SIZEOF(short)
130 AC_CHECK_SIZEOF(int)
131 AC_CHECK_SIZEOF(long)
132 AC_CHECK_SIZEOF(long long)
133
134 case 2 in
135         $ac_cv_sizeof_short) SIZE16="short";;
136         $ac_cv_sizeof_int) SIZE16="int";;
137 esac
138
139 case 4 in
140         $ac_cv_sizeof_short) SIZE32="short";;
141         $ac_cv_sizeof_int) SIZE32="int";;
142         $ac_cv_sizeof_long) SIZE32="long";;
143 esac
144
145 case 8 in
146         $ac_cv_sizeof_int) SIZE64="int";;
147         $ac_cv_sizeof_long) SIZE64="long";;
148         $ac_cv_sizeof_long_long) SIZE64="long long";;
149 esac
150
151 if test -z "$SIZE16"; then
152         AC_MSG_ERROR(No 16 bit type found on this platform!)
153 fi
154 if test -z "$SIZE32"; then
155         AC_MSG_ERROR(No 32 bit type found on this platform!)
156 fi
157 if test -z "$SIZE64"; then
158         AC_MSG_WARN(No 64 bit type found on this platform!)
159 fi
160         
161 AC_HEADER_SYS_WAIT
162 AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h)
163
164 AC_C_CONST
165 AC_HEADER_TIME
166 AC_STRUCT_TM
167
168 AC_PROG_MAKE_SET
169 AC_FUNC_MEMCMP
170 AC_TYPE_SIGNAL
171 AC_CHECK_FUNCS(gettimeofday select strcspn strerror strspn sigaction)
172
173 AC_SUBST(SIZE16)
174 AC_SUBST(SIZE32)
175 AC_SUBST(SIZE64)
176 AC_SUBST(OPT)
177 AC_SUBST(LIBS)
178 AC_SUBST(DEBUG)
179 AC_SUBST(PROFILE)
180 AC_SUBST(CC)
181 AC_SUBST(RANLIB)
182 #AC_SUBST(XOGG)
183 #AC_SUBST(LIBGTKDIR)
184 AC_SUBST(pthread_lib)
185
186 AC_OUTPUT(Makefile lib/Makefile examples/Makefile vorbis-tools/Makefile\
187         vq/Makefile huff/Makefile cmdline/Makefile xmms/Makefile kmpg/Makefile)
188