blob: 2bc2f88001a66cfdc3b28b2a6bafc5be99403cc8 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
3AC_PREREQ(2.0)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00005AC_CONFIG_HEADER(config.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
7# checks for alternative programs
Guido van Rossum433c8ad1994-08-01 12:07:07 +00008AC_CHECKING(for --with(out)-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00009AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000010 case $withval in
11 no) withval=cc;;
12 yes) withval=gcc;;
13 esac
14 CC=$withval])
Guido van Rossum627b2d71993-12-24 10:39:16 +000015AC_PROG_CC
16AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000017AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000018AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +000019AC_SUBST(INSTALL)
20# Install just never works :-(
21if test -z "$INSTALL"
22then INSTALL=cp
23fi
24AC_SUBST(OPT)
25# Optimizer/debugger flags passed between Makefiles
26if test -z "$OPT"
27then OPT=-O
28fi
Guido van Rossum627b2d71993-12-24 10:39:16 +000029
30# checks for UNIX variants that set C preprocessor variables
31AC_AIX
32AC_ISC_POSIX
33AC_MINIX
Guido van Rossum433c8ad1994-08-01 12:07:07 +000034AC_CHECKING(for NeXT)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000035AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +000036#ifdef _NEXT_SOURCE
37main() { exit(0); }
38#endif
39], AC_DEFINE(_POSIX_SOURCE))
Guido van Rossum627b2d71993-12-24 10:39:16 +000040
41# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +000042AC_HEADER_STDC
43AC_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)
44AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +000045
46# checks for typedefs
Guido van Rossum433c8ad1994-08-01 12:07:07 +000047AC_CHECKING(for clock_t in time.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000048AC_EGREP_HEADER(clock_t, time.h, , AC_DEFINE(clock_t, long))
49AC_TYPE_MODE_T
50AC_TYPE_OFF_T
51AC_TYPE_PID_T
52AC_TYPE_SIGNAL
53AC_TYPE_SIZE_T
54AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +000055
Guido van Rossumac405f61994-09-12 10:56:06 +000056# Set name for machine-dependent library files
57AC_SUBST(MACHDEP)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000058AC_MSG_CHECKING(MACHDEP)
Guido van Rossumac405f61994-09-12 10:56:06 +000059if test -z "$MACHDEP"
60then
Guido van Rossum76be6ed1995-01-02 18:33:54 +000061 ac_sys_system=`uname -s | tr -d ' ' | tr '[[A-Z]]' '[[a-z]]'`
62 ac_sys_release=`uname -r | tr -d ' ' | sed 's/\..*//'`
63 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumac405f61994-09-12 10:56:06 +000064 case MACHDEP in
65 '') MACHDEP=unknown;;
66 esac
Guido van Rossumac405f61994-09-12 10:56:06 +000067fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +000068AC_MSG_RESULT($MACHDEP)
Guido van Rossumac405f61994-09-12 10:56:06 +000069
70# Set info about shared libraries.
71# XXX This should try things out instead of testing uname!
72AC_SUBST(SO)
73AC_SUBST(LDSHARED)
74AC_SUBST(CCSHARED)
75AC_SUBST(LINKFORSHARED)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000076ac_sys_system=`uname -s`
77ac_sys_release=`uname -r`
Guido van Rossumac405f61994-09-12 10:56:06 +000078# SO is the extension of shared libraries `(including the dot!)
79# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +000080AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +000081if test -z "$SO"
82then
Guido van Rossum76be6ed1995-01-02 18:33:54 +000083 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +000084 hp*|HP*) SO=.sl;;
85 *) SO=.so;;
86 esac
Guido van Rossumac405f61994-09-12 10:56:06 +000087fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +000088AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +000089# LDSHARED is the ld *command* used to create shared library
90# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum76be6ed1995-01-02 18:33:54 +000091AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +000092if test -z "$LDSHARED"
93then
Guido van Rossum76be6ed1995-01-02 18:33:54 +000094 case $ac_sys_system/$ac_sys_release in
Guido van Rossumac405f61994-09-12 10:56:06 +000095 IRIX*) LDSHARED="ld -shared";;
96 SunOS/4*) LDSHARED="ld";;
97 SunOS/5*) LDSHARED="ld -G";;
98 hp*|HP*) LDSHARED="ld -b";;
99 *) LDSHARED="ld";;
100 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000101fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000102AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000103# CCSHARED are the C *flags* used to create objects to go into a shared
104# library -- this is only needed for HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000105AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000106if test -z "$CCSHARED"
107then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000108 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000109 hp*|HP*) CCSHARED="+z";;
110 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000111fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000112AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000113# LINKFORSHARED are the flags passed to the $(CC) command that links
114# the python executable -- this is only needed for HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000115AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000116if test -z "$LINKFORSHARED"
117then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000118 case $ac_sys_system in
Guido van Rossumac405f61994-09-12 10:56:06 +0000119 hp*|HP*) LINKFORSHARED="-Wl,-E";;
120 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000121fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000122AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000123
Guido van Rossum627b2d71993-12-24 10:39:16 +0000124# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000125AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
126AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
127AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000128AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
129AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
130AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum627b2d71993-12-24 10:39:16 +0000131
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000132AC_CHECKING(for --with-readline)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000133AC_ARG_WITH(readline, [--with-readline=DIRECTORY GNU readline], [
134AC_DEFINE(WITH_READLINE)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000135if test ! -d "$withval"
136then AC_ERROR(proper usage is --with-readline=DIRECTORY)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000137fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000138termcap=
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000139AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [
140AC_CHECK_LIB(termlib, tgetent, [termcap=termlib])])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000141if test ! -z "$termcap"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000142then LIBS="$LIBS $withval/libreadline.a"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000143 # Avoid possible conflict between shared libraries termcap and gl
144 # on IRIX 5: both contain a routine called clear.
145 if test -f /usr/lib/lib$termcap.a
146 then LIBS="$LIBS /usr/lib/lib$termcap.a"
147 else LIBS="$LIBS -l$termcap"
148 fi
149else AC_ERROR(no working termcap/termlib, do not use --with-readline)
150fi])
151
152AC_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000153AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000154if test -d "$withval"
155then LIBS="$LIBS -L$withval"
156fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000157AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000158AC_DEFINE(_POSIX_THREADS)
159LIBS="$LIBS -lpthreads"
160LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000161AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000162LIBS="$LIBS -lmpc"
163LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000164AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000165LIBS="$LIBS -lthread"
166LIBOBJS="$LIBOBJS thread.o"])
167])
168
169# -I${DLINCLDIR} is added to the compile rule for import.o
170AC_SUBST(DLINCLDIR)
171DLINCLDIR=/
172
173AC_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000174AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
175AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000176dldir=$withval
177if test -d "$dldir"
178then LIBS="$LIBS -L$dldir"
179else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
180fi
181DLINCLDIR=${dldir}
182LIBS="$LIBS -ldl -lmld"])
183
184AC_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000185AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
186AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000187dldir=`echo "$withval" | sed 's/,.*//'`
188dlddir=`echo "$withval" | sed 's/.*,//'`
189if test -d "$dldir" -a -d "$dlddir"
190then LIBS="$LIBS -L$dldir -L$dlddir"
191else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
192fi
193DLINCLDIR=${dldir}
194LIBS="$LIBS -ldl -ldld"])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000195
196# checks for library functions
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000197AC_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)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000198AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000199AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
200AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
201AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000202
203# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000204AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000205AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000206AC_STRUCT_TIMEZONE
207
208AC_MSG_CHECKING(for time.h that defines altzone)
209AC_CACHE_VAL(ac_cv_header_time_altzone,
210[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
211 ac_cv_header_time_altzone=yes,
212 ac_cv_header_time_altzone=no)])
213AC_MSG_RESULT($ac_cv_header_time_altzone)
214if test $ac_cv_header_time_altzone = yes; then
215 AC_DEFINE(HAVE_ALTZONE)
216fi
217
218AC_CHECKING(whether sys/select.h and sys/time.h may both be included)
219AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000220#include <sys/types.h>
221#include <sys/select.h>
222#include <sys/time.h>
223], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME)])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000224
225# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000226
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000227AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000228
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000229AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000230
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000231AC_CHECKING(for working volatile)
232AC_TRY_COMPILE([],[volatile int x; x = 0;],,AC_DEFINE(volatile, []))
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000233
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000234AC_CHECKING(for working signed char)
235AC_TRY_COMPILE([], [signed char c;],,AC_DEFINE(signed, []))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000236
237AC_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000238AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
239AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000240
241AC_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000242AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000243#include <stdarg.h>
244int foo(int x, ...) { return 0; }
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000245], [return foo(10, 11, 12);],
246AC_DEFINE(HAVE_STDARG_PROTOTYPES))
247
Guido van Rossum627b2d71993-12-24 10:39:16 +0000248if test "$have_prototypes"; then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000249AC_CHECKING(for bad exec* prototypes)
250AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], , AC_DEFINE(BAD_EXEC_PROTOTYPES))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000251fi
252
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000253AC_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000254AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000255struct s { int a; int b; };
256static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000257int foobar() {
258 static int random;
259 random = (int) &foo;
260 return random;
261}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000262static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000263main() {
264 exit(!((int)&foo == foobar()));
265}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000266], , AC_DEFINE(BAD_STATIC_FORWARD))
267
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000268AC_CHECKING(whether va_list is an array)
269AC_TRY_COMPILE([
270#ifdef HAVE_STDARG_PROTOTYPES
271#include <stdarg.h>
272#else
273#include <varargs.h>
274#endif
275], [va_list list1, list2; list1 = list2;], , AC_DEFINE(VA_LIST_IS_ARRAY))
276
Guido van Rossum627b2d71993-12-24 10:39:16 +0000277# checks for system services
278# (none yet)
279
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000280# Linux requires this for correct f.p. operations
281AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000282
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000283# check for --with-libm=...
284AC_SUBST(LIBM)
285LIBM=-lm
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000286AC_ARG_WITH(libm, [--with-libm=STRING math library], [
287if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000288then LIBM=$withval
289else AC_ERROR(proper usage is --with-libm=STRING)
290fi])
291
292# check for --with-libc=...
293AC_SUBST(LIBC)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000294AC_ARG_WITH(libc, [--with-libc=STRING C library], [
295if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000296then LIBC=$withval
297else AC_ERROR(proper usage is --with-libc=STRING)
298fi])
299
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000300# check for hypot() in math library
301LIBS_SAVE=$LIBS
302LIBS="$LIBS $LIBM"
303AC_CHECK_FUNCS(hypot)
304LIBS=$LIBS_SAVE
305
Guido van Rossum627b2d71993-12-24 10:39:16 +0000306# generate output files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000307AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)