blob: 6eb0ec80904a8409026988d25d378bad98aef63d [file] [log] [blame]
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001dnl Process this file with autoconf 1.8 or later to produce a configure script.
2AC_REVISION($Revision$)dnl
3AC_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
Guido van Rossum433c8ad1994-08-01 12:07:07 +000020AC_PROG_INSTALL
Guido van Rossum627b2d71993-12-24 10:39:16 +000021AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000022AC_SUBST(AR)
23AC_PROGRAMS_CHECK(AR, ar aal, ar)
Guido van Rossum627b2d71993-12-24 10:39:16 +000024
25# checks for UNIX variants that set C preprocessor variables
26AC_AIX
27AC_ISC_POSIX
28AC_MINIX
29dnl DYNIX test runs compile so must be last
30AC_DYNIX_SEQ
Guido van Rossum433c8ad1994-08-01 12:07:07 +000031AC_CHECKING(for NeXT)
32AC_TEST_PROGRAM([
33#ifdef _NEXT_SOURCE
34main() { exit(0); }
35#endif
36], AC_DEFINE(_POSIX_SOURCE))
Guido van Rossum627b2d71993-12-24 10:39:16 +000037
38# checks for header files
39AC_STDC_HEADERS
Guido van Rossum433c8ad1994-08-01 12:07:07 +000040AC_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 +000041AC_DIR_HEADER
42
43# checks for typedefs
Guido van Rossum433c8ad1994-08-01 12:07:07 +000044AC_CHECKING(for clock_t in time.h)
45AC_HEADER_EGREP(clock_t, time.h, , AC_DEFINE(clock_t, long))
Guido van Rossum627b2d71993-12-24 10:39:16 +000046AC_MODE_T
47AC_OFF_T
48AC_PID_T
49AC_RETSIGTYPE
50AC_SIZE_T
51AC_UID_T
52
53# checks for libraries
54AC_HAVE_LIBRARY(dl)
Guido van Rossum627b2d71993-12-24 10:39:16 +000055
Guido van Rossum433c8ad1994-08-01 12:07:07 +000056AC_CHECKING(for --with-svr4)
57AC_WITH(svr4, [
58AC_HAVE_LIBRARY(socket)
59AC_HAVE_LIBRARY(inet)
60AC_HAVE_LIBRARY(nsl)
61])
Guido van Rossum627b2d71993-12-24 10:39:16 +000062
Guido van Rossum433c8ad1994-08-01 12:07:07 +000063AC_CHECKING(for --with-readline)
64AC_WITH(readline, [AC_DEFINE(WITH_READLINE)
65if test -d "$withval"
66then LIBS="$LIBS -L$withval"
67else AC_ERROR(proper usage is --with-readline=DIRECTORY)
Guido van Rossum627b2d71993-12-24 10:39:16 +000068fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +000069termcap=
70AC_HAVE_LIBRARY(termcap, [termcap=termcap], [AC_HAVE_LIBRARY(termlib, [termcap=termlib])])
71if test ! -z "$termcap"
72then LIBS="$LIBS -lreadline"
73 # Avoid possible conflict between shared libraries termcap and gl
74 # on IRIX 5: both contain a routine called clear.
75 if test -f /usr/lib/lib$termcap.a
76 then LIBS="$LIBS /usr/lib/lib$termcap.a"
77 else LIBS="$LIBS -l$termcap"
78 fi
79else AC_ERROR(no working termcap/termlib, do not use --with-readline)
80fi])
81
82AC_CHECKING(for --with-thread)
83AC_WITH(thread, [
84if test -d "$withval"
85then LIBS="$LIBS -L$withval"
86fi
87AC_HAVE_LIBRARY(pthreads, [AC_DEFINE(WITH_THREAD)
88AC_DEFINE(_POSIX_THREADS)
89LIBS="$LIBS -lpthreads"
90LIBOBJS="$LIBOBJS thread.o"])
91AC_HAVE_LIBRARY(mpc, [AC_DEFINE(WITH_THREAD)
92LIBS="$LIBS -lmpc"
93LIBOBJS="$LIBOBJS thread.o"])
94AC_HAVE_LIBRARY(thread, [AC_DEFINE(WITH_THREAD)
95LIBS="$LIBS -lthread"
96LIBOBJS="$LIBOBJS thread.o"])
97])
98
99# -I${DLINCLDIR} is added to the compile rule for import.o
100AC_SUBST(DLINCLDIR)
101DLINCLDIR=/
102
103AC_CHECKING(for --with-sgi-dl)
104AC_WITH(sgi-dl, [AC_DEFINE(WITH_SGI_DL)
105dldir=$withval
106if test -d "$dldir"
107then LIBS="$LIBS -L$dldir"
108else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
109fi
110DLINCLDIR=${dldir}
111LIBS="$LIBS -ldl -lmld"])
112
113AC_CHECKING(for --with-dl-dld)
114AC_WITH(dl-dld, [AC_DEFINE(WITH_DL_DLD)
115dldir=`echo "$withval" | sed 's/,.*//'`
116dlddir=`echo "$withval" | sed 's/.*,//'`
117if test -d "$dldir" -a -d "$dlddir"
118then LIBS="$LIBS -L$dldir -L$dlddir"
119else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
120fi
121DLINCLDIR=${dldir}
122LIBS="$LIBS -ldl -ldld"])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000123
124# checks for library functions
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000125AC_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)
126AC_REPLACE_FUNCS(dup2 getcwd strerror memmove)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000127AC_FUNC_CHECK(getpgrp, AC_COMPILE_CHECK([argument to getpgrp], [#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
128
129# checks for structures
130AC_TIME_WITH_SYS_TIME
131AC_STRUCT_TM
132AC_TIMEZONE
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000133AC_COMPILE_CHECK([whether we have altzone], [#include <time.h>], [return altzone;], AC_DEFINE(HAVE_ALTZONE))
134AC_COMPILE_CHECK([whether sys/select.h and sys/time.h may both be included], [
135#include <sys/types.h>
136#include <sys/select.h>
137#include <sys/time.h>
138], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME)])
Guido van Rossum627b2d71993-12-24 10:39:16 +0000139
140# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000141
142AC_CHAR_UNSIGNED
143
Guido van Rossum627b2d71993-12-24 10:39:16 +0000144AC_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000145
146AC_COMPILE_CHECK([wheter we have signed char], [], [signed char c;], [], AC_DEFINE(signed, []))
147
148AC_CHECKING(for prototypes)
149AC_TEST_PROGRAM([
150int foo(int x) { return 0; }
151int main() { return foo(10); }
152], AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=1)
153
154AC_CHECKING(for variable length prototypes and stdarg.h)
155AC_TEST_PROGRAM([
156#include <stdarg.h>
157int foo(int x, ...) { return 0; }
158int main() { return foo(10, 11, 12); }
159], AC_DEFINE(HAVE_STDARG_PROTOTYPES) have_prototypes=1)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000160if test "$have_prototypes"; then
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000161AC_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 +0000162fi
163
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000164AC_CHECKING(for bad static forward)
165AC_TEST_PROGRAM([
166struct s { int a; int b; };
167static struct s foo;
168int foobar() { return !foo.a; }
169static struct s foo = { 1, 2 };
170main() { exit(foobar()); }
171], , AC_DEFINE(BAD_STATIC_FORWARD))
172
Guido van Rossum627b2d71993-12-24 10:39:16 +0000173# checks for system services
174# (none yet)
175
176# other checks for UNIX variants
177AC_IRIX_SUN
178AC_XENIX_DIR
179
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000180# check for --with-libm=...
181AC_SUBST(LIBM)
182LIBM=-lm
183AC_WITH(libm, [if test "$withval" != yes
184then LIBM=$withval
185else AC_ERROR(proper usage is --with-libm=STRING)
186fi])
187
188# check for --with-libc=...
189AC_SUBST(LIBC)
190AC_WITH(libc, [if test "$withval" != yes
191then LIBC=$withval
192else AC_ERROR(proper usage is --with-libc=STRING)
193fi])
194
Guido van Rossum627b2d71993-12-24 10:39:16 +0000195# generate output files
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000196AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre)