blob: 09e3a65f8ced5e9416f378bb8fd52e5bbdc1cf2c [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
Guido van Rossum642b6781997-07-19 19:35:41 +00007# Set VERSION so we only need to edit in one place (i.e., here)
8AC_SUBST(VERSION)
9VERSION=1.5
10
Guido van Rossumb418f891996-07-30 18:06:02 +000011# NEXTSTEP stuff
Guido van Rossum4b6b5791996-09-09 20:09:34 +000012if test -f /usr/lib/NextStep/software_version; then
13
14 AC_MSG_CHECKING(for --with-next-archs)
15 AC_ARG_WITH(next-archs,
16 [--with-next-archs='arch1 arch2 ..' build MAB binary], [
17 if test -n "$withval"; then
Guido van Rossum2bb4f551996-09-10 18:19:59 +000018 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
19 # GCC does not currently support multi archs on the NeXT
20 with_gcc=no
Guido van Rossum4b6b5791996-09-09 20:09:34 +000021 fi
22 AC_MSG_RESULT($with_next_archs)
23 ], [AC_MSG_RESULT(none: using `arch`)])
24
25 if test -z "$MACHDEP"
26 then
27 set X `hostinfo | grep 'NeXT Mach.*:' | \
28 sed -e 's/://' -e 's/\./_/'` && \
29 ac_sys_system=next && ac_sys_release=$4
30
Guido van Rossumb97ef171997-09-28 05:44:03 +000031 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000032 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000033fi
Guido van Rossumb418f891996-07-30 18:06:02 +000034
Guido van Rossum91922671997-10-09 20:24:13 +000035
Guido van Rossumb418f891996-07-30 18:06:02 +000036# Set name for machine-dependent library files
37AC_SUBST(MACHDEP)
38AC_MSG_CHECKING(MACHDEP)
39if test -z "$MACHDEP"
40then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000041 ac_sys_system=`uname -s`
42 if test "$ac_sys_system" = "AIX" ; then
43 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000044 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000045 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000046 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000047 ac_md_system=`echo $ac_sys_system |
48 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
49 ac_md_release=`echo $ac_sys_release |
50 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000051 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000052
Guido van Rossumbcd91e01997-03-20 20:46:29 +000053 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000054 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000055 esac
56fi
Guido van Rossum91922671997-10-09 20:24:13 +000057
58#
59# SGI compilers allow the specification of the both the ABI and the
60# ISA on the command line. Depending on the values of these switches,
61# different and often incompatable code will be generated.
62#
63# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
64# thus supply support for various ABI/ISA combinations. The MACHDEP
65# variable is also adjusted.
66#
67AC_SUBST(SGI_ABI)
68if test ! -z "$SGI_ABI"
69then
70 CC="cc $SGI_ABI"
71 LDFLAGS="$SGI_ABI $LDFLAGS"
72 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
73fi
Guido van Rossumb418f891996-07-30 18:06:02 +000074AC_MSG_RESULT($MACHDEP)
75
Guido van Rossum91922671997-10-09 20:24:13 +000076#
77# CCC is the command that compiles C++ programs
78#
79# Not all make programs have this predefined.
80#
81AC_SUBST(SET_CCC)
82AC_MSG_CHECKING(CCC)
83if test -z "$CCC"
84then
85 case $ac_sys_system in
86 IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
87 *) SET_CCC=""
88 esac
89else
90 SET_CCC="CCC= ${CCC}"
91fi
92AC_MSG_RESULT($SET_CCC)
93
94
Guido van Rossum627b2d71993-12-24 10:39:16 +000095# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000096AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000097AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000098 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000099 no) CC=cc
100 without_gcc=yes;;
101 yes) CC=gcc
102 without_gcc=no;;
103 *) CC=$withval
104 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000105 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000106 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000107 OSF1) CC=cc
108 without_gcc=;;
109 *) without_gcc=no;;
110 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000111AC_MSG_RESULT($without_gcc)
112
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000113# If the user switches compilers, we can't believe the cache
114if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
115then
116 AC_ERROR(cached CC is different -- throw away $cache_file
117(it is also a good idea to do 'make clean' before compiling))
118fi
119
Guido van Rossum627b2d71993-12-24 10:39:16 +0000120AC_PROG_CC
Guido van Rossumfb842551997-08-06 23:42:07 +0000121
Guido van Rossum84561611997-08-21 00:08:11 +0000122case $ac_sys_system in
123hp*|HP*)
124 case $CC in
125 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
126 esac;;
127esac
128
Guido van Rossumfb842551997-08-06 23:42:07 +0000129# LINKCC is the command that links the python executable -- default is $(CC).
130# This is altered for AIX in order to build the export list before linking.
131AC_SUBST(LINKCC)
132AC_MSG_CHECKING(LINKCC)
133if test -z "$LINKCC"
134then
135 case $ac_sys_system in
136 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000137 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000138 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000139 esac
140fi
141AC_MSG_RESULT($LINKCC)
142
Guido van Rossum627b2d71993-12-24 10:39:16 +0000143AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000144AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000145AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000146AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000147AC_SUBST(INSTALL_PROGRAM)
148AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000149# Install just never works :-(
150if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000151then
152 INSTALL=cp
153 INSTALL_PROGRAM=cp
154 INSTALL_DATA=cp
155else
156 INSTALL_PROGRAM="$INSTALL"
157 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000158fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000159
Guido van Rossum4e8af441994-08-19 15:33:54 +0000160# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000161AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000162if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000163then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000164 case $GCC in
165 yes)
166 case $ac_cv_prog_cc_g in
167 yes) OPT="-g -O2";;
168 *) OPT="-O2";;
169 esac
170 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000171 *) OPT="-O";;
172 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000173fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000174
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000175if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000176then
177 OPT="$OPT $ac_arch_flags"
178fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000179# checks for UNIX variants that set C preprocessor variables
180AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000181AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000182
Guido van Rossum201afe51997-05-14 21:14:44 +0000183AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
184AC_CACHE_VAL(ac_cv_olimit_ok,
185[ac_save_cc="$CC"
186CC="$CC -Olimit 1500"
Guido van Rossum7f059ad1997-05-30 14:22:30 +0000187AC_TRY_RUN([int main() { return 0; }],
Guido van Rossum201afe51997-05-14 21:14:44 +0000188 ac_cv_olimit_ok=yes,
189 ac_cv_olimit_ok=no)
190CC="$ac_save_cc"])
191AC_MSG_RESULT($ac_cv_olimit_ok)
192if test $ac_cv_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000193 OPT="$OPT -Olimit 1500"
Guido van Rossum91922671997-10-09 20:24:13 +0000194fi
195
196AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
197AC_CACHE_VAL(ac_cv_opt_olimit_ok,
198[ac_save_cc="$CC"
199CC="$CC -OPT:Olimit=0"
200AC_TRY_RUN([int main() { return 0; }],
201 ac_cv_opt_olimit_ok=yes,
202 ac_cv_opt_olimit_ok=no)
203CC="$ac_save_cc"])
204AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000205if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000206 OPT="$OPT -OPT:Olimit=0"
Guido van Rossum201afe51997-05-14 21:14:44 +0000207fi
208
Guido van Rossum300fda71996-08-19 21:58:16 +0000209# check for ANSI or K&R ("traditional") preprocessor
210AC_MSG_CHECKING(for C preprocessor type)
211AC_TRY_COMPILE([
212#define spam(name, doc) {#name, &name, #name "() -- " doc}
213int foo;
214struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
215], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
216AC_MSG_RESULT($cpp_type)
217
Guido van Rossum627b2d71993-12-24 10:39:16 +0000218# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000219AC_HEADER_STDC
Guido van Rossum96013151997-10-08 22:47:52 +0000220AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000221signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000222sys/audioio.h sys/file.h sys/lock.h \
223sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000224sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000225AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000226
227# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000228was_it_defined=no
229AC_MSG_CHECKING(for clock_t in time.h)
230AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
231AC_MSG_RESULT($was_it_defined)
232
Guido van Rossum300fda71996-08-19 21:58:16 +0000233# Add some code to confdefs.h so that the test for off_t works on SCO
234cat >> confdefs.h <<\EOF
235#if defined(SCO_DS)
236#undef _OFF_T
237#endif
238EOF
239
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000240AC_TYPE_MODE_T
241AC_TYPE_OFF_T
242AC_TYPE_PID_T
243AC_TYPE_SIGNAL
244AC_TYPE_SIZE_T
245AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000246
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000247AC_CHECK_SIZEOF(int)
248AC_CHECK_SIZEOF(long)
Guido van Rossumac405f61994-09-12 10:56:06 +0000249
250# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000251AC_SUBST(SO)
252AC_SUBST(LDSHARED)
253AC_SUBST(CCSHARED)
254AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000255# SO is the extension of shared libraries `(including the dot!)
256# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000257AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000258if test -z "$SO"
259then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000260 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000261 hp*|HP*) SO=.sl;;
262 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000263 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000264fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000265AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000266# LDSHARED is the ld *command* used to create shared library
267# -- "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 +0000268AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000269if test -z "$LDSHARED"
270then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000271 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000272 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000273 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000274 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000275 SunOS/4*) LDSHARED="ld";;
276 SunOS/5*) LDSHARED="ld -G";;
277 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000278 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000279 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000280 next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000281 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000282 FreeBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000283 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000284 *) LDSHARED="ld";;
285 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000286fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000287AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000288# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000289# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000290AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000291if test -z "$CCSHARED"
292then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000293 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000294 hp*|HP*) if test "$GCC" = yes;
295 then CCSHARED="-fpic";
296 else CCSHARED="+z";
297 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000298 Linux*) CCSHARED="-fpic";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000299 FreeBSD*) CCSHARED="-fpic";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000300 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossum91922671997-10-09 20:24:13 +0000301 IRIX*/6*) CCSHARED="-all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000302 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000303fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000304AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000305# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000306# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000307AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000308if test -z "$LINKFORSHARED"
309then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000310 case $ac_sys_system/$ac_sys_release in
Guido van Rossumc5d14a61997-05-13 17:59:29 +0000311 AIX*) LINKFORSHARED='-Wl,-bE:$(srcdir)/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000312 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000313 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000314 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum79c970c1997-08-16 14:35:26 +0000315 next/*) LINKFORSHARED="-u libsys_s";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000316 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossum91922671997-10-09 20:24:13 +0000317 IRIX*/6*) LINKFORSHARED="-all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000318 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000319fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000320AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000321
Guido van Rossum627b2d71993-12-24 10:39:16 +0000322# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000323AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
324AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
325AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossum71001e41995-01-26 00:44:03 +0000326# The following three (nsl,inet,socket) are needed on Sequent;
327# the order of checking must be this. Most SVR4 platforms will
328# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
329# broken. I see no elegant solution (probably CHECK_LIB should be
330# fixed to only add the library if the given entry point is not
331# satisfied without it).
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000332if test "$ac_sys_system" != IRIX
Guido van Rossum71001e41995-01-26 00:44:03 +0000333then
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000334AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
335AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
336AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum71001e41995-01-26 00:44:03 +0000337fi
Guido van Rossumc5a39031996-07-31 17:35:03 +0000338AC_MSG_CHECKING(for --with-libs)
339AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
340AC_MSG_RESULT($withval)
341LIBS="$withval $LIBS"
342], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000343
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000344AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000345AC_ARG_WITH(readline,
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000346[--with(out)-readline obsolete, edit Modules/Setup instead],
347[AC_MSG_RESULT($withval)
348AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
349[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000350
Guido van Rossum54d93d41997-01-22 20:51:58 +0000351AC_MSG_CHECKING(for --with-dec-threads)
352AC_SUBST(LDLAST)
353AC_ARG_WITH(dec-threads,
354[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
355[AC_MSG_RESULT($withval)
356LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000357if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000358 with_thread="$withval";
359fi],
360AC_MSG_RESULT(no))
361
362AC_MSG_CHECKING(for --with-threads)
363AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
364[AC_MSG_RESULT($withval)
365if test "${with_thread+set}" != set; then
366 with_thread="$withval";
367fi],
368AC_MSG_RESULT(no))
369
370AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000371AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000372AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000373if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000374then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000375fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000376AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000377AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
378AC_DEFINE(C_THREADS)
379LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000380AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000381AC_DEFINE(_POSIX_THREADS)
382LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000383LIBOBJS="$LIBOBJS thread.o"], [
384AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
385AC_DEFINE(_POSIX_THREADS)
386LIBS="$LIBS -lpthread"
Guido van Rossum6400c261997-05-22 20:34:27 +0000387LIBOBJS="$LIBOBJS thread.o"], [
388AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
389AC_DEFINE(_POSIX_THREADS)
390LIBS="$LIBS -lthread"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000391LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum6400c261997-05-22 20:34:27 +0000392])])])
393
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000394AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000395LIBS="$LIBS -lmpc"
396LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000397AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000398LIBS="$LIBS -lthread"
399LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000400], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000401
Guido van Rossum68242b51996-05-28 22:53:03 +0000402# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000403AC_SUBST(DLINCLDIR)
404DLINCLDIR=/
405
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000406AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000407AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000408AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000409AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000410dldir=$withval
411if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000412then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000413else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
414fi
415DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000416LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000417
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000418AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000419AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000420AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000421AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000422dldir=`echo "$withval" | sed 's/,.*//'`
423dlddir=`echo "$withval" | sed 's/.*,//'`
424if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000425then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000426else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
427fi
428DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000429LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000430
431# checks for library functions
Guido van Rossum1171ee61997-08-22 20:42:00 +0000432AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork ftime ftruncate \
433 gethostname_r getpeername getpgrp getpid getpwent gettimeofday getwd \
434 kill link lstat mkfifo nice pause plock putenv readlink \
Guido van Rossum96013151997-10-08 22:47:52 +0000435 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
Guido van Rossum68242b51996-05-28 22:53:03 +0000436 sigaction siginterrupt sigrelse strftime symlink \
Guido van Rossumb418f891996-07-30 18:06:02 +0000437 tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000438AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000439AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
440AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
441AC_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 +0000442
443# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000444AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000445AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000446AC_STRUCT_TIMEZONE
447
448AC_MSG_CHECKING(for time.h that defines altzone)
449AC_CACHE_VAL(ac_cv_header_time_altzone,
450[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
451 ac_cv_header_time_altzone=yes,
452 ac_cv_header_time_altzone=no)])
453AC_MSG_RESULT($ac_cv_header_time_altzone)
454if test $ac_cv_header_time_altzone = yes; then
455 AC_DEFINE(HAVE_ALTZONE)
456fi
457
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000458was_it_defined=no
459AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000460AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000461#include <sys/types.h>
462#include <sys/select.h>
463#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000464], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
465AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000466
467# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000468
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000469AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000470
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000471AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000472
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000473works=no
474AC_MSG_CHECKING(for working volatile)
475AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
476AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000477
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000478works=no
479AC_MSG_CHECKING(for working signed char)
480AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
481AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000482
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000483have_prototypes=no
484AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000485AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
486AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000487AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000488
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000489works=no
490AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000491AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000492#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000493int foo(int x, ...) {
494 va_list va;
495 va_start(va, x);
496 va_arg(va, int);
497 va_arg(va, char *);
498 va_arg(va, double);
499 return 0;
500}
501], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000502AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
503AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000504
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000505if test "$have_prototypes" = yes; then
506bad_prototypes=no
507AC_MSG_CHECKING(for bad exec* prototypes)
508AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
509 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
510AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000511fi
512
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000513bad_forward=no
514AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000515AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000516struct s { int a; int b; };
517static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000518int foobar() {
519 static int random;
520 random = (int) &foo;
521 return random;
522}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000523static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000524main() {
525 exit(!((int)&foo == foobar()));
526}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000527], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
528AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000529
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000530va_list_is_array=no
531AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000532AC_TRY_COMPILE([
533#ifdef HAVE_STDARG_PROTOTYPES
534#include <stdarg.h>
535#else
536#include <varargs.h>
537#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000538], [va_list list1, list2; list1 = list2;], ,
539AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
540AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000541
Guido van Rossum627b2d71993-12-24 10:39:16 +0000542# checks for system services
543# (none yet)
544
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000545# Linux requires this for correct f.p. operations
546AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000547
Guido van Rossum93274221997-05-09 02:42:00 +0000548# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +0000549AC_MSG_CHECKING(for --with-fpectl)
550AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
551if test "$withval" != no
552then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
553else AC_MSG_RESULT(no)
554fi])
555
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000556# check for --with-libm=...
557AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000558case $ac_sys_system in
559next) ;;
560*) LIBM=-lm
561esac
Guido van Rossum93274221997-05-09 02:42:00 +0000562AC_MSG_CHECKING(for --with-libm=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000563AC_ARG_WITH(libm, [--with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000564if test "$withval" = no
565then LIBM=
566 AC_MSG_RESULT(force LIBM empty)
567elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000568then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000569 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000570else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000571fi],
572[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000573
574# check for --with-libc=...
575AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +0000576AC_MSG_CHECKING(for --with-libc=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000577AC_ARG_WITH(libc, [--with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000578if test "$withval" = no
579then LIBC=
580 AC_MSG_RESULT(force LIBC empty)
581elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000582then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000583 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000584else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000585fi],
586[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000587
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000588# check for hypot() in math library
589LIBS_SAVE=$LIBS
590LIBS="$LIBS $LIBM"
591AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000592AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000593LIBS=$LIBS_SAVE
594
Guido van Rossum7d473291995-01-20 14:12:16 +0000595# check for getopt
596AC_MSG_CHECKING(for genuine getopt)
597AC_CACHE_VAL(ac_cv_func_getopt,
598[AC_TRY_RUN([#include <stdio.h>
599extern int optind, opterr, getopt();
600extern char* optarg;
601int main() {
602 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
603 opterr = 0;
604 if (getopt(3, av, "f:") == 'f') { exit(1); }
605 exit(0);
606}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
607AC_MSG_RESULT($ac_cv_func_getopt)
608test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
609AC_SUBST(LIBOBJS)dnl
610
Guido van Rossumad713701997-07-10 22:42:38 +0000611# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +0000612AC_MSG_CHECKING(what malloc(0) returns)
613AC_CACHE_VAL(ac_cv_malloc_zero,
614[AC_TRY_RUN([#include <stdio.h>
615#ifdef HAVE_STDLIB
616#include <stdlib.h>
617#else
618char *malloc(), *realloc();
619int *free();
620#endif
621main() {
622 char *p;
623 p = malloc(0);
624 if (p == NULL) exit(1);
625 p = realloc(p, 0);
626 if (p == NULL) exit(1);
627 free(p);
628 exit(0);
629}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
630AC_MSG_RESULT($ac_cv_malloc_zero)
631if test "$ac_cv_malloc_zero" = null
632then
633 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
634fi
635
Guido van Rossum627b2d71993-12-24 10:39:16 +0000636# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000637AC_OUTPUT(Makefile \
638 Objects/Makefile \
639 Parser/Makefile \
640 Python/Makefile \
641 Modules/Makefile.pre)