#changed all email address to go through python.org
[python/dscho.git] / configure.in
blob3c55a4d801ed9db108c278a909782e6d3bb10ae6
1 dnl Process this file with autoconf 2.0 or later to make a configure script.
2 AC_REVISION($Revision$)
3 AC_PREREQ(2.0)
4 AC_INIT(Include/object.h)
5 AC_CONFIG_HEADER(config.h)
7 # checks for alternative programs
8 AC_MSG_CHECKING(for --without-gcc)
9 AC_ARG_WITH(gcc, [--without-gcc             never use gcc], [
10         case $withval in
11         no)     CC=cc
12                 without_gcc=yes;;
13         yes)    CC=gcc
14                 without_gcc=no;;
15         *)      CC=$withval
16                 without_gcc=$withval;;
17         esac], [without_gcc=no])
18 AC_MSG_RESULT($without_gcc)
20 # If the user switches compilers, we can't believe the cache
21 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
22 then
23   AC_ERROR(cached CC is different -- throw away $cache_file
24 (it is also a good idea to do 'make clean' before compiling))
27 AC_PROG_CC
28 AC_PROG_RANLIB
29 AC_SUBST(AR)
30 AC_CHECK_PROGS(AR, ar aal, ar)
31 AC_SUBST(INSTALL)
32 AC_SUBST(INSTALL_PROGRAM)
33 AC_SUBST(INSTALL_DATA)
34 # Install just never works :-(
35 if test -z "$INSTALL"
36 then
37         INSTALL=cp
38         INSTALL_PROGRAM=cp
39         INSTALL_DATA=cp
40 else
41         INSTALL_PROGRAM="$INSTALL"
42         INSTALL_DATA="$INSTALL -m 644"
44 AC_SUBST(OPT)
45 # Optimizer/debugger flags passed between Makefiles
46 if test -z "$OPT"
47 then OPT=-O
50 # checks for UNIX variants that set C preprocessor variables
51 AC_AIX
52 AC_MINIX
54 # checks for header files
55 AC_HEADER_STDC
56 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h sys/audioio.h sys/param.h sys/select.h sys/time.h sys/times.h sys/un.h sys/utsname.h sys/wait.h)
57 AC_HEADER_DIRENT
59 # checks for typedefs
60 was_it_defined=no
61 AC_MSG_CHECKING(for clock_t in time.h)
62 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
63 AC_MSG_RESULT($was_it_defined)
65 AC_TYPE_MODE_T
66 AC_TYPE_OFF_T
67 AC_TYPE_PID_T
68 AC_TYPE_SIGNAL
69 AC_TYPE_SIZE_T
70 AC_TYPE_UID_T
72 # Set name for machine-dependent library files
73 AC_SUBST(MACHDEP)
74 AC_MSG_CHECKING(MACHDEP)
75 if test -z "$MACHDEP"
76 then
77         ac_sys_system=`uname -s | tr -d ' ' | tr '[[A-Z]]' '[[a-z]]'`
78         ac_sys_release=`uname -r | tr -d ' ' | sed 's/\..*//'`
79         MACHDEP="$ac_sys_system$ac_sys_release"
80         case MACHDEP in
81         '')     MACHDEP=unknown;;
82         esac
84 AC_MSG_RESULT($MACHDEP)
86 # Set info about shared libraries.
87 # XXX This should try things out instead of testing uname!
88 AC_SUBST(SO)
89 AC_SUBST(LDSHARED)
90 AC_SUBST(CCSHARED)
91 AC_SUBST(LINKFORSHARED)
92 ac_sys_system=`uname -s`
93 ac_sys_release=`uname -r`
94 # SO is the extension of shared libraries `(including the dot!)
95 # -- usually .so, .sl on HP-UX
96 AC_MSG_CHECKING(SO)
97 if test -z "$SO"
98 then
99         case $ac_sys_system in
100         hp*|HP*) SO=.sl;;
101         *)      SO=.so;;
102         esac
104 AC_MSG_RESULT($SO)
105 # LDSHARED is the ld *command* used to create shared library
106 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
107 AC_MSG_CHECKING(LDSHARED)
108 if test -z "$LDSHARED"
109 then
110         case $ac_sys_system/$ac_sys_release in
111         IRIX*) LDSHARED="ld -shared";;
112         SunOS/4*) LDSHARED="ld";;
113         SunOS/5*) LDSHARED="ld -G";;
114         hp*|HP*) LDSHARED="ld -b";;
115         OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
116         DYNIX/ptx*) LDSHARED="ld -G";;
117         Linux*) LDSHARED="gcc-elf -shared";;
118         *)      LDSHARED="ld";;
119         esac
121 AC_MSG_RESULT($LDSHARED)
122 # CCSHARED are the C *flags* used to create objects to go into a shared
123 # library -- this is only needed for a few systems
124 AC_MSG_CHECKING(CCSHARED)
125 if test -z "$CCSHARED"
126 then
127         case $ac_sys_system in
128         hp*|HP*) if test "$GCC" = yes;
129                  then CCSHARED="-fpic";
130                  else CCSHARED="+z";
131                  fi;;
132         Linux*) CCSHARED="-fpic";;
133         esac
135 AC_MSG_RESULT($CCSHARED)
136 # LINKFORSHARED are the flags passed to the $(CC) command that links
137 # the python executable -- this is only needed for a few systems
138 AC_MSG_CHECKING(LINKFORSHARED)
139 if test -z "$LINKFORSHARED"
140 then
141         case $ac_sys_system in
142         hp*|HP*) LINKFORSHARED="-Wl,-E";;
143         Linux*) LINKFORSHARED="-rdynamic";;
144         esac
146 AC_MSG_RESULT($LINKFORSHARED)
148 # checks for libraries
149 AC_CHECK_LIB(dl, dlopen)        # Dynamic linking for SunOS/Solaris and SYSV
150 AC_CHECK_LIB(dld, shl_load)     # Dynamic linking for HP-UX
151 AC_CHECK_LIB(sun, getpwnam)     # NIS (== YP) interface for IRIX 4
152 # The following three (nsl,inet,socket) are needed on Sequent;
153 # the order of checking must be this.  Most SVR4 platforms will
154 # need -lsocket and -lnsl.  However on SGI IRIX 5, these exist but
155 # broken.  I see no elegant solution (probably CHECK_LIB should be
156 # fixed to only add the library if the given entry point is not
157 # satisfied without it).
158 if test "`uname -s`" != IRIX
159 then
160 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
161 AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
162 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
165 AC_MSG_CHECKING(for --with-readline)
166 AC_ARG_WITH(readline, [--with-readline=DIRECTORY GNU readline], [
167 AC_MSG_RESULT($withval)
168 AC_DEFINE(WITH_READLINE)
169 if test ! -d "$withval"
170 then AC_ERROR(proper usage is --with-readline=DIRECTORY)
172 termcap=
173 AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
174 AC_CHECK_LIB(termlib, tgetent, [termcap=termlib])])
175 if test ! -z "$termcap"
176 then LIBS="$LIBS $withval/libreadline.a"
177      # Avoid possible conflict between shared libraries termcap and gl
178      # on IRIX 5: both contain a routine called clear.
179      if test -f /usr/lib/lib$termcap.a
180      then LIBS="$LIBS /usr/lib/lib$termcap.a"
181      else LIBS="$LIBS -l$termcap"
182      fi
183 else AC_ERROR(no working termcap/termlib, do not use --with-readline)
184 fi], AC_MSG_RESULT(no))
186 AC_MSG_CHECKING(for --with-thread)
187 AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
188 AC_MSG_RESULT($withval)
189 if test -d "$withval"
190 then LIBS="$LIBS -L$withval"
192 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
193 AC_DEFINE(_POSIX_THREADS)
194 LIBS="$LIBS -lpthreads"
195 LIBOBJS="$LIBOBJS thread.o"])
196 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
197 LIBS="$LIBS -lmpc"
198 LIBOBJS="$LIBOBJS thread.o"])
199 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
200 LIBS="$LIBS -lthread"
201 LIBOBJS="$LIBOBJS thread.o"])
202 ], AC_MSG_RESULT(no))
204 # -I${DLINCLDIR} is added to the compile rule for import.o
205 AC_SUBST(DLINCLDIR)
206 DLINCLDIR=/
208 AC_MSG_CHECKING(for --with-sgi-dl)
209 AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY   IRIX 4 dynamic linking], [
210 AC_MSG_RESULT($withval)
211 AC_DEFINE(WITH_SGI_DL)
212 dldir=$withval
213 if test -d "$dldir"
214 then LIBS="$LIBS -L$dldir"
215 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
217 DLINCLDIR=${dldir}
218 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
220 AC_MSG_CHECKING(for --with-dl-dld)
221 AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR  GNU dynamic linking], [
222 AC_MSG_RESULT($withval)
223 AC_DEFINE(WITH_DL_DLD)
224 dldir=`echo "$withval" | sed 's/,.*//'`
225 dlddir=`echo "$withval" | sed 's/.*,//'`
226 if test -d "$dldir" -a -d "$dlddir"
227 then LIBS="$LIBS -L$dldir -L$dlddir"
228 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
230 DLINCLDIR=${dldir}
231 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
233 # checks for library functions
234 AC_CHECK_FUNCS(chown clock dlopen ftime ftruncate gethostname_r gettimeofday getpeername getpgrp getpid getwd link lstat nice readlink select setgid setuid setsid setpgid setpgrp setvbuf siginterrupt symlink tcgetpgrp tcsetpgrp times truncate uname waitpid)
235 AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
236 AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
237 AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
238 AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
240 # checks for structures
241 AC_HEADER_TIME
242 AC_STRUCT_TM
243 AC_STRUCT_TIMEZONE
245 AC_MSG_CHECKING(for time.h that defines altzone)
246 AC_CACHE_VAL(ac_cv_header_time_altzone,
247 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
248   ac_cv_header_time_altzone=yes,
249   ac_cv_header_time_altzone=no)])
250 AC_MSG_RESULT($ac_cv_header_time_altzone)
251 if test $ac_cv_header_time_altzone = yes; then
252   AC_DEFINE(HAVE_ALTZONE)
255 was_it_defined=no
256 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
257 AC_TRY_COMPILE([
258 #include <sys/types.h>
259 #include <sys/select.h>
260 #include <sys/time.h>
261 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
262 AC_MSG_RESULT($was_it_defined)
264 # checks for compiler characteristics
266 AC_C_CHAR_UNSIGNED
268 AC_C_CONST
270 works=no
271 AC_MSG_CHECKING(for working volatile)
272 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
273 AC_MSG_RESULT($works)
275 works=no
276 AC_MSG_CHECKING(for working signed char)
277 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
278 AC_MSG_RESULT($works)
280 have_prototypes=no
281 AC_MSG_CHECKING(for prototypes)
282 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
283 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
284 AC_MSG_RESULT($have_prototypes)
286 works=no
287 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
288 AC_TRY_COMPILE([
289 #include <stdarg.h>
290 int foo(int x, ...) { return 0; }
291 ], [return foo(10, 11, 12);],
292 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
293 AC_MSG_RESULT($works)
295 if test "$have_prototypes" = yes; then
296 bad_prototypes=no
297 AC_MSG_CHECKING(for bad exec* prototypes)
298 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
299         AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
300 AC_MSG_RESULT($bad_prototypes)
303 bad_forward=no
304 AC_MSG_CHECKING(for bad static forward)
305 AC_TRY_RUN([
306 struct s { int a; int b; };
307 static struct s foo;
308 int foobar() {
309  static int random;
310  random = (int) &foo;
311  return random;
313 static struct s foo = { 1, 2 };
314 main() {
315  exit(!((int)&foo == foobar()));
317 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
318 AC_MSG_RESULT($bad_forward)
320 va_list_is_array=no
321 AC_MSG_CHECKING(whether va_list is an array)
322 AC_TRY_COMPILE([
323 #ifdef HAVE_STDARG_PROTOTYPES
324 #include <stdarg.h>
325 #else
326 #include <varargs.h>
327 #endif
328 ], [va_list list1, list2; list1 = list2;], , 
329 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
330 AC_MSG_RESULT($va_list_is_array)
332 # checks for system services
333 # (none yet)
335 # Linux requires this for correct f.p. operations
336 AC_CHECK_LIB(ieee, __fpu_control)
338 # check for --with-libm=...
339 AC_SUBST(LIBM)
340 LIBM=-lm
341 AC_ARG_WITH(libm, [--with-libm=STRING        math library], [
342 if test "$withval" != yes
343 then LIBM=$withval
344 else AC_ERROR(proper usage is --with-libm=STRING)
345 fi])
347 # check for --with-libc=...
348 AC_SUBST(LIBC)
349 AC_ARG_WITH(libc, [--with-libc=STRING        C library], [
350 if test "$withval" != yes
351 then LIBC=$withval
352 else AC_ERROR(proper usage is --with-libc=STRING)
353 fi])
355 # check for hypot() in math library
356 LIBS_SAVE=$LIBS
357 LIBS="$LIBS $LIBM"
358 AC_CHECK_FUNCS(hypot)
359 LIBS=$LIBS_SAVE
361 # check for getopt
362 AC_MSG_CHECKING(for genuine getopt)
363 AC_CACHE_VAL(ac_cv_func_getopt,
364 [AC_TRY_RUN([#include <stdio.h>
365 extern int optind, opterr, getopt();
366 extern char* optarg;
367 int main() {
368         char* av[] = { "testprog", "parameter", "-fFlag", NULL };
369         opterr = 0;
370         if (getopt(3, av, "f:") == 'f') { exit(1); }
371         exit(0);
372 }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
373 AC_MSG_RESULT($ac_cv_func_getopt)
374 test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
375 AC_SUBST(LIBOBJS)dnl
377 # generate output files
378 AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)