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