blob: 6ca1f5a3db0fa9206234478d86f1ec5311705945 [file] [log] [blame]
Guido van Rossumac405f61994-09-12 10:56:06 +00001dnl Process this file with autoconf 1.8 or later to make a configure script.
Guido van Rossum433c8ad1994-08-01 12:07:07 +00002AC_REVISION($Revision$)dnl
Guido van Rossume1f17b51994-10-06 15:51:22 +00003AC_PREREQ(1.8)dnl
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00005AC_CONFIG_HEADER(config.h)dnl
6# Don't suppress compiler output when --verbose is specified
7test -n "$verbose" &&
8 ac_compile=`echo "$ac_compile" | sed "s|>/dev/null 2>&1||"`
9AC_VERBOSE(setting ac_compile to '$ac_compile')
Guido van Rossum627b2d71993-12-24 10:39:16 +000010
11# checks for alternative programs
Guido van Rossum433c8ad1994-08-01 12:07:07 +000012AC_CHECKING(for --with(out)-gcc)
13AC_WITH(gcc, [
14 case $withval in
15 no) withval=cc;;
16 yes) withval=gcc;;
17 esac
18 CC=$withval])
Guido van Rossum627b2d71993-12-24 10:39:16 +000019AC_PROG_CC
20AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000021AC_SUBST(AR)
22AC_PROGRAMS_CHECK(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +000023AC_SUBST(INSTALL)
24# Install just never works :-(
25if test -z "$INSTALL"
26then INSTALL=cp
27fi
28AC_SUBST(OPT)
29# Optimizer/debugger flags passed between Makefiles
30if test -z "$OPT"
31then OPT=-O
32fi
Guido van Rossum627b2d71993-12-24 10:39:16 +000033
34# checks for UNIX variants that set C preprocessor variables
35AC_AIX
36AC_ISC_POSIX
37AC_MINIX
38dnl DYNIX test runs compile so must be last
39AC_DYNIX_SEQ
Guido van Rossum433c8ad1994-08-01 12:07:07 +000040AC_CHECKING(for NeXT)
41AC_TEST_PROGRAM([
42#ifdef _NEXT_SOURCE
43main() { exit(0); }
44#endif
45], AC_DEFINE(_POSIX_SOURCE))
Guido van Rossum627b2d71993-12-24 10:39:16 +000046
47# checks for header files
48AC_STDC_HEADERS
Guido van Rossum433c8ad1994-08-01 12:07:07 +000049AC_HAVE_HEADERS(dlfcn.h fcntl.h limits.h signal.h stdarg.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)
Guido van Rossum627b2d71993-12-24 10:39:16 +000050AC_DIR_HEADER
51
52# checks for typedefs
Guido van Rossum433c8ad1994-08-01 12:07:07 +000053AC_CHECKING(for clock_t in time.h)
54AC_HEADER_EGREP(clock_t, time.h, , AC_DEFINE(clock_t, long))
Guido van Rossum627b2d71993-12-24 10:39:16 +000055AC_MODE_T
56AC_OFF_T
57AC_PID_T
58AC_RETSIGTYPE
59AC_SIZE_T
60AC_UID_T
61
Guido van Rossumac405f61994-09-12 10:56:06 +000062# Set name for machine-dependent library files
63AC_SUBST(MACHDEP)
64if test -z "$MACHDEP"
65then
66 ac_system=`uname -s | tr '[[A-Z]]' '[[a-z]]'`
67 ac_release=`uname -r | sed 's/\..*//'`
68 MACHDEP="$ac_system$ac_release"
69 case MACHDEP in
70 '') MACHDEP=unknown;;
71 esac
72 AC_VERBOSE(setting MACHDEP to '$MACHDEP')
73fi
74
75# Set info about shared libraries.
76# XXX This should try things out instead of testing uname!
77AC_SUBST(SO)
78AC_SUBST(LDSHARED)
79AC_SUBST(CCSHARED)
80AC_SUBST(LINKFORSHARED)
81ac_system=`uname -s`
82ac_release=`uname -r`
83# SO is the extension of shared libraries `(including the dot!)
84# -- usually .so, .sl on HP-UX
85if test -z "$SO"
86then
87 case $ac_system in
88 hp*|HP*) SO=.sl;;
89 *) SO=.so;;
90 esac
91 AC_VERBOSE(setting SO to '$SO')
92fi
93# LDSHARED is the ld *command* used to create shared library
94# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
95if test -z "$LDSHARED"
96then
97 case $ac_system/$ac_release in
98 IRIX*) LDSHARED="ld -shared";;
99 SunOS/4*) LDSHARED="ld";;
100 SunOS/5*) LDSHARED="ld -G";;
101 hp*|HP*) LDSHARED="ld -b";;
102 *) LDSHARED="ld";;
103 esac
104 AC_VERBOSE(setting LDSHARED= to '$LDSHARED')
105fi
106# CCSHARED are the C *flags* used to create objects to go into a shared
107# library -- this is only needed for HP-UX
108if test -z "$CCSHARED"
109then
110 case $ac_system in
111 hp*|HP*) CCSHARED="+z";;
112 esac
113 AC_VERBOSE(setting CCSHARED= to '$CCSHARED')
114fi
115# LINKFORSHARED are the flags passed to the $(CC) command that links
116# the python executable -- this is only needed for HP-UX
117if test -z "$LINKFORSHARED"
118then
119 case $ac_system in
120 hp*|HP*) LINKFORSHARED="-Wl,-E";;
121 esac
122 AC_VERBOSE(setting LINKFORSHARED to '$LINKFORSHARED')
123fi
124
Guido van Rossum627b2d71993-12-24 10:39:16 +0000125# checks for libraries
126AC_HAVE_LIBRARY(dl)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000127
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000128AC_CHECKING(for --with-svr4)
129AC_WITH(svr4, [
130AC_HAVE_LIBRARY(socket)
131AC_HAVE_LIBRARY(inet)
132AC_HAVE_LIBRARY(nsl)
133])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000134
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000135AC_CHECKING(for --with-readline)
136AC_WITH(readline, [AC_DEFINE(WITH_READLINE)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000137if test ! -d "$withval"
138then AC_ERROR(proper usage is --with-readline=DIRECTORY)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000139fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000140termcap=
141AC_HAVE_LIBRARY(termcap, [termcap=termcap], [AC_HAVE_LIBRARY(termlib, [termcap=termlib])])
142if test ! -z "$termcap"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000143then LIBS="$LIBS $withval/libreadline.a"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000144 # Avoid possible conflict between shared libraries termcap and gl
145 # on IRIX 5: both contain a routine called clear.
146 if test -f /usr/lib/lib$termcap.a
147 then LIBS="$LIBS /usr/lib/lib$termcap.a"
148 else LIBS="$LIBS -l$termcap"
149 fi
150else AC_ERROR(no working termcap/termlib, do not use --with-readline)
151fi])
152
153AC_CHECKING(for --with-thread)
154AC_WITH(thread, [
155if test -d "$withval"
156then LIBS="$LIBS -L$withval"
157fi
158AC_HAVE_LIBRARY(pthreads, [AC_DEFINE(WITH_THREAD)
159AC_DEFINE(_POSIX_THREADS)
160LIBS="$LIBS -lpthreads"
161LIBOBJS="$LIBOBJS thread.o"])
162AC_HAVE_LIBRARY(mpc, [AC_DEFINE(WITH_THREAD)
163LIBS="$LIBS -lmpc"
164LIBOBJS="$LIBOBJS thread.o"])
165AC_HAVE_LIBRARY(thread, [AC_DEFINE(WITH_THREAD)
166LIBS="$LIBS -lthread"
167LIBOBJS="$LIBOBJS thread.o"])
168])
169
170# -I${DLINCLDIR} is added to the compile rule for import.o
171AC_SUBST(DLINCLDIR)
172DLINCLDIR=/
173
174AC_CHECKING(for --with-sgi-dl)
175AC_WITH(sgi-dl, [AC_DEFINE(WITH_SGI_DL)
176dldir=$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)
185AC_WITH(dl-dld, [AC_DEFINE(WITH_DL_DLD)
186dldir=`echo "$withval" | sed 's/,.*//'`
187dlddir=`echo "$withval" | sed 's/.*,//'`
188if test -d "$dldir" -a -d "$dlddir"
189then LIBS="$LIBS -L$dldir -L$dlddir"
190else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
191fi
192DLINCLDIR=${dldir}
193LIBS="$LIBS -ldl -ldld"])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000194
195# checks for library functions
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000196AC_HAVE_FUNCS(chown clock dlopen ftime gettimeofday getpeername getpgrp getpid getwd link lstat nice readlink select setgid setuid setsid setpgid setpgrp setvbuf siginterrupt symlink tcgetpgrp tcsetpgrp times uname waitpid)
197AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000198AC_FUNC_CHECK(getpgrp, AC_COMPILE_CHECK([argument to getpgrp], [#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
199
200# checks for structures
201AC_TIME_WITH_SYS_TIME
202AC_STRUCT_TM
203AC_TIMEZONE
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000204AC_COMPILE_CHECK([whether we have altzone], [#include <time.h>], [return altzone;], AC_DEFINE(HAVE_ALTZONE))
205AC_COMPILE_CHECK([whether sys/select.h and sys/time.h may both be included], [
206#include <sys/types.h>
207#include <sys/select.h>
208#include <sys/time.h>
209], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME)])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000210
211# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000212
213AC_CHAR_UNSIGNED
214
Guido van Rossum627b2d71993-12-24 10:39:16 +0000215AC_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000216
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000217AC_COMPILE_CHECK([lack of working volatile],[],[volatile int x; x = 0;],,AC_DEFINE(volatile,))
218
219AC_COMPILE_CHECK([lack of working signed char], [], [signed char c;],,AC_DEFINE(signed, []))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000220
221AC_CHECKING(for prototypes)
222AC_TEST_PROGRAM([
223int foo(int x) { return 0; }
224int main() { return foo(10); }
225], AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=1)
226
227AC_CHECKING(for variable length prototypes and stdarg.h)
228AC_TEST_PROGRAM([
229#include <stdarg.h>
230int foo(int x, ...) { return 0; }
231int main() { return foo(10, 11, 12); }
232], AC_DEFINE(HAVE_STDARG_PROTOTYPES) have_prototypes=1)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000233if test "$have_prototypes"; then
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000234AC_COMPILE_CHECK(["bad exec* prototypes"], [#include <unistd.h>], [char **t;execve("@",t,t);], , AC_DEFINE(BAD_EXEC_PROTOTYPES))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000235fi
236
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000237AC_CHECKING(for bad static forward)
238AC_TEST_PROGRAM([
239struct s { int a; int b; };
240static struct s foo;
241int foobar() { return !foo.a; }
242static struct s foo = { 1, 2 };
243main() { exit(foobar()); }
244], , AC_DEFINE(BAD_STATIC_FORWARD))
245
Guido van Rossum627b2d71993-12-24 10:39:16 +0000246# checks for system services
247# (none yet)
248
249# other checks for UNIX variants
250AC_IRIX_SUN
251AC_XENIX_DIR
252
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000253# check for --with-libm=...
254AC_SUBST(LIBM)
255LIBM=-lm
256AC_WITH(libm, [if test "$withval" != yes
257then LIBM=$withval
258else AC_ERROR(proper usage is --with-libm=STRING)
259fi])
260
261# check for --with-libc=...
262AC_SUBST(LIBC)
263AC_WITH(libc, [if test "$withval" != yes
264then LIBC=$withval
265else AC_ERROR(proper usage is --with-libc=STRING)
266fi])
267
Guido van Rossum627b2d71993-12-24 10:39:16 +0000268# generate output files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000269AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)