First round build-system sanity infusion
[platform/upstream/libvorbis.git] / configure.in
1 # $Id: configure.in,v 1.2 1999/07/13 07:48:13 mwhitson 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
28 dnl Set some target options
29 if test -z "$GCC"; then
30         case $host in 
31         *-*-irix*)
32                 DEBUG="-g" 
33                 OPT="-O2 -w"
34                 PROFILE="-p -g3 -O2" ;;
35         sparc-sun-solaris*)
36                 DEBUG="-v -g"
37                 OPT="-xO4 -fast -w -fsingle -fsimple -native -xcg92"
38                 PROFILE="-v -xpg -g -xO4 -fast -fsingle -native -fsimple -xcg92 -Dsuncc" ;;
39         *)
40                 DEBUG="-g"
41                 OPT="-O"
42                 PROFILE="-g -p" ;;
43         esac
44 else
45         case $host in 
46         i?86-*-linux*)
47                 DEBUG="-g -Wall -fsigned-char"
48                 OPT="-O20 -ffast-math -fsigned-char"
49                 PROFILE="-pg -g -O20 -fsigned-char";;
50         sparc-sun-*)
51                 DEBUG="-g -Wall -fsigned-char -mv8"
52                 OPT="-O20 -ffast-math -fsigned-char -mv8"
53                 PROFILE="-pg -g -O20 -fsigned-char -mv8" ;;
54         *)
55                 DEBUG="-g -Wall -fsigned-char"
56                 OPT="-O20 -fsigned-char"
57                 PROFILE="-O20 -g -pg -fsigned-char" ;;
58         esac
59 fi
60
61 AC_HEADER_STDC
62
63 CFLAGS=""
64
65 dnl AC_PATH_X
66 dnl AC_PATH_XTRA
67
68 AC_CHECK_LIB(pthread, pthread_create, 
69         pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
70
71 dnl Linuxthreads require you to define _REENTRANT in all threaded
72 dnl code.  Bogus, bogus...
73
74 if test -n "$pthread_lib"; then
75         case $host in 
76         i?86-*-linux*)
77                 AC_DEFINE(_REENTRANT)
78                 ;;
79         esac
80 fi
81
82 #if test -n "$x_libraries"; then
83 #       XOGG="yes"
84 #
85 #       dnl If we find libgtk installed, great; otherwise assume we have
86 #       dnl to build it ourselves.
87 #
88 #       AC_CHECK_LIB(gtk, gtk_main, :, LIBGTKDIR="libgtk", $X_LIBS -lglib -lgdk -lX11 -lXext -lm)
89 #
90 #       dnl libpthread is required for xogg.
91 #
92 #       if test -z "$pthread_lib"; then XOGG=""; fi
93 #
94 #       dnl If we don't have libgtk installed, and we don't have a libgtk 
95 #       dnl  subdirectory to build the library ourself, we can't build xogg.
96 #
97 #       if test -n "$LIBGTKDIR" -a ! -d "$LIBGTKDIR"; then
98 #               XOGG=""
99 #               LIBGTKDIR=""
100 #       fi
101 #fi
102
103 dnl This seems to be the only way to make autoconf only *sometimes* configure
104 dnl a subdirectory with AC_CONFIG_SUBDIRS.  "__noconf" is assumed to not 
105 dnl exist as a directory, so configure won't try to recursively enter it, unless
106 dnl the shell variable $dummy is reset to an existing directory inside the
107 dnl if clause.
108
109 dummy="__noconf"
110
111 #if test -d "$LIBGTKDIR"; then
112 #       enable_shared="no"; export enable_shared
113 #       dummy="libgtk"
114 #       AC_CONFIG_SUBDIRS("$dummy")
115 #       X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS"
116 #fi
117
118 TYPESIZES="" 
119
120 AC_CHECK_SIZEOF(short)
121 AC_CHECK_SIZEOF(int)
122 AC_CHECK_SIZEOF(long)
123 AC_CHECK_SIZEOF(long long)
124
125 case 2 in
126         $ac_cv_sizeof_short) TYPESIZES="$TYPESIZES -Dsize16='short'"
127                 SIZE16=TRUE;;
128         $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize16='int'"
129                 SIZE16=TRUE;;
130 esac
131
132 case 4 in
133         $ac_cv_sizeof_short) TYPESIZES="$TYPESIZES -Dsize32='short'"
134                 SIZE32=TRUE;;
135         $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize32='int'"
136                 SIZE32=TRUE;;
137         $ac_cv_sizeof_long) TYPESIZES="$TYPESIZES -Dsize32='long'"
138                 SIZE32=TRUE;;
139 esac
140
141 case 8 in
142         $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize64='int'"
143                 SIZE64=TRUE;;
144         $ac_cv_sizeof_long) TYPESIZES="$TYPESIZES -Dsize64='long'"
145                 SIZE64=TRUE;;
146         $ac_cv_sizeof_long_long) TYPESIZES="$TYPESIZES -Dsize64='long long'"
147                 SIZE64=TRUE;;
148 esac
149
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(TYPESIZES)
174 AC_SUBST(OPT)
175 AC_SUBST(DEBUG)
176 AC_SUBST(PROFILE)
177 AC_SUBST(CC)
178 AC_SUBST(RANLIB)
179 #AC_SUBST(XOGG)
180 #AC_SUBST(LIBGTKDIR)
181 AC_SUBST(pthread_lib)
182
183 AC_OUTPUT(Makefile lib/Makefile cmdline/Makefile)