blob: ff43618336dab236f64b8039e9ee7c126cfb16a2 [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)
Guido van Rossum6a6a77c2000-03-31 15:15:17 +00009VERSION=1.6
Guido van Rossum642b6781997-07-19 19:35:41 +000010
Guido van Rossumb418f891996-07-30 18:06:02 +000011# NEXTSTEP stuff
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000012if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000013
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
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000027 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
Guido van Rossum4b6b5791996-09-09 20:09:34 +000028 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 Rossum54ecc3d1999-01-27 17:53:11 +000035AC_ARG_WITH(next-framework,
36[--with-next-framework Build (OpenStep|Rhapsody|MacOS10) framework],,)
37AC_ARG_WITH(dyld,
38[--with-dyld Use (OpenStep|Rhapsody|MacOS10) dynamic linker],,)
Guido van Rossum91922671997-10-09 20:24:13 +000039
Guido van Rossumb418f891996-07-30 18:06:02 +000040# Set name for machine-dependent library files
41AC_SUBST(MACHDEP)
42AC_MSG_CHECKING(MACHDEP)
43if test -z "$MACHDEP"
44then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000045 ac_sys_system=`uname -s`
46 if test "$ac_sys_system" = "AIX" ; then
47 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000048 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000049 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000050 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000051 ac_md_system=`echo $ac_sys_system |
52 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
53 ac_md_release=`echo $ac_sys_release |
54 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000055 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000056
Guido van Rossumbcd91e01997-03-20 20:46:29 +000057 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000058 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000059 esac
60fi
Guido van Rossum91922671997-10-09 20:24:13 +000061
62#
63# SGI compilers allow the specification of the both the ABI and the
64# ISA on the command line. Depending on the values of these switches,
65# different and often incompatable code will be generated.
66#
67# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
68# thus supply support for various ABI/ISA combinations. The MACHDEP
69# variable is also adjusted.
70#
71AC_SUBST(SGI_ABI)
72if test ! -z "$SGI_ABI"
73then
74 CC="cc $SGI_ABI"
75 LDFLAGS="$SGI_ABI $LDFLAGS"
76 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
77fi
Guido van Rossumb418f891996-07-30 18:06:02 +000078AC_MSG_RESULT($MACHDEP)
79
Guido van Rossum91922671997-10-09 20:24:13 +000080#
81# CCC is the command that compiles C++ programs
82#
83# Not all make programs have this predefined.
84#
Guido van Rossum95012191999-12-16 17:50:52 +000085#AC_SUBST(SET_CCC)
86#AC_MSG_CHECKING(CCC)
87#if test -z "$CCC"
88#then
89# case $ac_sys_system in
90# IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
91# Linux*) SET_CCC="CCC= g++";;
92# *) SET_CCC=""
93# esac
94#else
95# SET_CCC="CCC= ${CCC}"
96#fi
97#AC_MSG_RESULT($SET_CCC)
Guido van Rossum91922671997-10-09 20:24:13 +000098
99
Guido van Rossum627b2d71993-12-24 10:39:16 +0000100# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000101AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000102AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000103 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000104 no) CC=cc
105 without_gcc=yes;;
106 yes) CC=gcc
107 without_gcc=no;;
108 *) CC=$withval
109 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000110 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000111 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000112 OSF1) CC=cc
113 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000114 BeOS*)
115 # Dunno if it's a good idea to get this over with all at once, or
116 # to handle it in with the other goodies.
117 MACHDEP=beos
118
119 case $BE_HOST_CPU in
120 ppc)
Guido van Rossum81376801999-04-06 15:50:51 +0000121 CC="mwcc -I$PWD/BeOS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000122 without_gcc=yes
Guido van Rossum6b9da451999-03-24 17:48:12 +0000123 case `uname -r` in
124 4.0*) OPT="-DUSE_DL_EXPORT -O7 -opt schedule604 -export pragma" ;;
125 *) OPT="-DUSE_DL_EXPORT -O2 -proc 604e -export pragma" ;;
126 esac
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000127 CCSHARED=-UUSE_DL_EXPORT
128 LDFLAGS="$LDFLAGS -nodup"
129
130 AR="$PWD/BeOS/ar-fake"
131 RANLIB=:
132
133 AC_DEFINE(DL_EXPORT_HEADER,"dl_export.h")
134 ;;
135 x86)
136 CC="gcc -I$PWD/BeOS"
137 without_gcc=no
138 OPT="-DUSE_DL_EXPORT -O3 -mpentiumpro"
139 CCSHARED=-UUSE_DL_EXPORT
140
141 AR="$PWD/BeOS/ar-fake"
142 RANLIB=:
143
144 AC_DEFINE(DL_EXPORT_HEADER,"dl_export.h")
145 ;;
146 *)
147 AC_ERROR(Your BeOS system isn't PowerPC or x86... neat, but this won't work...)
148 ;;
149 esac
150 ;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000151 *) without_gcc=no;;
152 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000153AC_MSG_RESULT($without_gcc)
154
Guido van Rossum95012191999-12-16 17:50:52 +0000155AC_SUBST(SET_CXX)
156AC_SUBST(MAINOBJ)
157MAINOBJ=python.o
158AC_MSG_CHECKING(for --with-cxx=<compiler>)
159AC_ARG_WITH(cxx, [--with-cxx=<compiler> enable C++ support],[
160 case $withval in
161 no) CXX=
162 with_cxx=no;;
163 *) CXX=$withval
164 MAINOBJ=ccpython.o
165 with_cxx=$withval;;
166 esac], [
167 with_cxx=no
168])
169AC_MSG_RESULT($with_cxx)
170SET_CXX="CXX = $CXX"
171
172#AC_MSG_CHECKING(CCC)
173#if test -z "$CCC"
174#then
175# case $ac_sys_system in
176# IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
177# Linux*) SET_CCC="CCC= g++";;
178# *) SET_CCC=""
179# esac
180#else
181# SET_CCC="CCC= ${CCC}"
182#fi
183#AC_MSG_RESULT($SET_CCC)
184
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000185# If the user switches compilers, we can't believe the cache
186if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
187then
188 AC_ERROR(cached CC is different -- throw away $cache_file
189(it is also a good idea to do 'make clean' before compiling))
190fi
191
Guido van Rossum627b2d71993-12-24 10:39:16 +0000192AC_PROG_CC
Guido van Rossumfb842551997-08-06 23:42:07 +0000193
Guido van Rossumdd997f71998-10-07 19:58:26 +0000194case $MACHDEP in
195bsdos*)
196 case $CC in
197 gcc) CC="$CC -D_HAVE_BSDI";;
198 esac;;
199esac
200
Guido van Rossum84561611997-08-21 00:08:11 +0000201case $ac_sys_system in
202hp*|HP*)
203 case $CC in
204 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
205 esac;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000206BeOS*)
207 case $CC in
208 cc) CC=cc;;
209 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000210esac
211
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000212# LDLIBRARY is the name of the library to link against (as opposed to the
213# name of the library into which to insert object files). On systems
214# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
215# the Makefiles).
216AC_SUBST(MAKE_LDLIBRARY)
217AC_SUBST(LDLIBRARY)
218LDLIBRARY=''
219
Guido van Rossumfb842551997-08-06 23:42:07 +0000220# LINKCC is the command that links the python executable -- default is $(CC).
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000221# This is altered for AIX and BeOS in order to build the export list before
222# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000223AC_SUBST(LINKCC)
224AC_MSG_CHECKING(LINKCC)
Guido van Rossum95012191999-12-16 17:50:52 +0000225if test -z "$LINKCC" -a ! -z "$CXX"
226then
227 LINKCC="$CXX"
228fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000229if test -z "$LINKCC"
230then
231 case $ac_sys_system in
232 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000233 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000234 BeOS*)
Guido van Rossum2666a151998-12-17 18:07:35 +0000235 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000236 LDLIBRARY='libpython$(VERSION).so';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000237 dgux*)
238 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000239 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000240 esac
241fi
242AC_MSG_RESULT($LINKCC)
243
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000244AC_MSG_CHECKING(LDLIBRARY)
245
246# NeXT framework builds require that the 'ar' library be converted into
247# a bundle using libtool.
248if test "$with_next_framework"
249then
250 LDLIBRARY='libpython$(VERSION).dylib'
251fi
252
253# DG/UX requires some fancy ld contortions to produce a .so from an .a
254if test "$MACHDEP" = "dguxR4"
255then
256 LDLIBRARY='libpython$(VERSION).so'
257 OPT="$OPT -pic"
258fi
259AC_MSG_RESULT($LDLIBRARY)
260
261# If LDLIBRARY is different from LIBRARY, emit a rule to build it.
262if test -z "$LDLIBRARY"
263then
264 LDLIBRARY='libpython$(VERSION).a'
265 MAKE_LDLIBRARY="true"
266else
267 MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
268fi
269
Guido van Rossum627b2d71993-12-24 10:39:16 +0000270AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000271AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000272AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000273AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000274AC_SUBST(INSTALL_PROGRAM)
275AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000276# Install just never works :-(
277if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000278then
279 INSTALL=cp
280 INSTALL_PROGRAM=cp
281 INSTALL_DATA=cp
282else
283 INSTALL_PROGRAM="$INSTALL"
284 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000285fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000286
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000287# Not every filesystem supports hard links
288AC_SUBST(LN)
289if test -z "$LN" ; then
290 case $ac_sys_system in
291 BeOS*) LN="ln -s";;
292 *) LN=ln;;
293 esac
294fi
295
Guido van Rossum4e8af441994-08-19 15:33:54 +0000296# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000297AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000298if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000299then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000300 case $GCC in
301 yes)
302 case $ac_cv_prog_cc_g in
303 yes) OPT="-g -O2";;
304 *) OPT="-O2";;
305 esac
306 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000307 *) OPT="-O";;
308 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000309fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000310
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000311if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000312then
313 OPT="$OPT $ac_arch_flags"
314fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000315# checks for UNIX variants that set C preprocessor variables
316AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000317AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000318
Guido van Rossum91922671997-10-09 20:24:13 +0000319AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
320AC_CACHE_VAL(ac_cv_opt_olimit_ok,
321[ac_save_cc="$CC"
322CC="$CC -OPT:Olimit=0"
323AC_TRY_RUN([int main() { return 0; }],
324 ac_cv_opt_olimit_ok=yes,
325 ac_cv_opt_olimit_ok=no)
326CC="$ac_save_cc"])
327AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000328if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000329 OPT="$OPT -OPT:Olimit=0"
Guido van Rossumf8678121998-07-07 21:05:09 +0000330else
331 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
332 AC_CACHE_VAL(ac_cv_olimit_ok,
333 [ac_save_cc="$CC"
334 CC="$CC -Olimit 1500"
335 AC_TRY_RUN([int main() { return 0; }],
336 ac_cv_olimit_ok=yes,
337 ac_cv_olimit_ok=no)
338 CC="$ac_save_cc"])
339 AC_MSG_RESULT($ac_cv_olimit_ok)
340 if test $ac_cv_olimit_ok = yes; then
341 OPT="$OPT -Olimit 1500"
342 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000343fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000344
Guido van Rossum300fda71996-08-19 21:58:16 +0000345# check for ANSI or K&R ("traditional") preprocessor
346AC_MSG_CHECKING(for C preprocessor type)
347AC_TRY_COMPILE([
348#define spam(name, doc) {#name, &name, #name "() -- " doc}
349int foo;
350struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
351], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
352AC_MSG_RESULT($cpp_type)
353
Guido van Rossum627b2d71993-12-24 10:39:16 +0000354# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000355AC_HEADER_STDC
Guido van Rossum96013151997-10-08 22:47:52 +0000356AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000357signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000358sys/audioio.h sys/file.h sys/lock.h \
359sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000360sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000361AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000362
363# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000364was_it_defined=no
365AC_MSG_CHECKING(for clock_t in time.h)
366AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
367AC_MSG_RESULT($was_it_defined)
368
Guido van Rossum300fda71996-08-19 21:58:16 +0000369# Add some code to confdefs.h so that the test for off_t works on SCO
370cat >> confdefs.h <<\EOF
371#if defined(SCO_DS)
372#undef _OFF_T
373#endif
374EOF
375
Guido van Rossumef2255b2000-03-10 22:30:29 +0000376# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000377AC_TYPE_MODE_T
378AC_TYPE_OFF_T
379AC_TYPE_PID_T
380AC_TYPE_SIGNAL
381AC_TYPE_SIZE_T
382AC_TYPE_UID_T
Guido van Rossum59903fe2000-04-24 15:12:04 +0000383AC_CHECK_TYPE(socklen_t, int)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000384
Guido van Rossumef2255b2000-03-10 22:30:29 +0000385# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000386AC_CHECK_SIZEOF(int)
387AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000388AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000389AC_CHECK_SIZEOF(char)
390AC_CHECK_SIZEOF(short)
391AC_CHECK_SIZEOF(float)
392AC_CHECK_SIZEOF(double)
Guido van Rossumac405f61994-09-12 10:56:06 +0000393
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000394AC_MSG_CHECKING(for long long support)
395have_long_long=no
396AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
397AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000398if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000399AC_CHECK_SIZEOF(long long)
400fi
401
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000402# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
403AC_MSG_CHECKING(size of off_t)
404AC_CACHE_VAL(ac_cv_sizeof_off_t,
405[AC_TRY_RUN([#include <stdio.h>
406#include <sys/types.h>
407main()
408{
409 FILE *f=fopen("conftestval", "w");
410 if (!f) exit(1);
411 fprintf(f, "%d\n", sizeof(off_t));
412 exit(0);
413}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
414])
415AC_MSG_RESULT($ac_cv_sizeof_off_t)
416AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
417
418AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000419if test "$have_long_long" = yes -a \
420 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
421 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000422 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
423 AC_MSG_RESULT(yes)
424else
425 AC_MSG_RESULT(no)
426fi
427
428
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000429# Minor variations in building a framework between NextStep versions 4 and 5
430AC_SUBST(LIBTOOL_CRUFT)
431case $ac_sys_system/$ac_sys_release in
432 next/4*)
433 ns_undef_sym='__environ'
434 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
435 next/5*)
436 ns_undef_sym='_environ'
437 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
438esac
439
440AC_MSG_CHECKING(for --with-next-framework)
441if test "$with_next_framework"
442then
443 OPT="$OPT -fno-common"
444 # -U __environ is needed since bundles don't have access
445 # to crt0 when built but will always be linked against it
446 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
447 AC_DEFINE(WITH_NEXT_FRAMEWORK)
448 AC_MSG_RESULT(yes)
449else
450 AC_MSG_RESULT(no)
451fi
452
453AC_MSG_CHECKING(for --with-dyld)
454if test "$with_next_framework" -o "$with_dyld"
455then
456 if test "$with_dyld"
457 then
458 AC_MSG_RESULT(yes)
459 else
460 AC_MSG_RESULT(required for framework build)
461 fi
462 AC_DEFINE(WITH_DYLD)
463 ns_dyld='set'
464else
465 AC_MSG_RESULT(no)
466fi
467
Guido van Rossumac405f61994-09-12 10:56:06 +0000468# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000469AC_SUBST(SO)
470AC_SUBST(LDSHARED)
471AC_SUBST(CCSHARED)
472AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000473# SO is the extension of shared libraries `(including the dot!)
474# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000475AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000476if test -z "$SO"
477then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000478 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000479 hp*|HP*) SO=.sl;;
480 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000481 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000482fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000483AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000484# LDSHARED is the ld *command* used to create shared library
485# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000486# (Shared libraries in this instance are shared modules to be loaded into
487# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000488AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000489if test -z "$LDSHARED"
490then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000491 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000492 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000493 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000494 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000495 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000496 SunOS/4*) LDSHARED="ld";;
497 SunOS/5*) LDSHARED="ld -G";;
498 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000499 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000500 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000501 next/*)
502 if test "$ns_dyld"
503 then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
504 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
505 fi
506 if test "$with_next_framework" ; then
507 LDSHARED="$LDSHARED \$(LDLIBRARY)"
508 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000509 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000510 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000511 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossuma8acf721999-04-27 22:06:08 +0000512 FreeBSD*/[[34]]*) LDSHARED="gcc -shared";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000513 FreeBSD*|OpenBSD*) LDSHARED="ld -Bshareable";;
514 NetBSD*)
515 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
516 then
517 LDSHARED="cc -shared"
518 else
519 LDSHARED="ld -Bshareable"
520 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000521 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000522 *) LDSHARED="ld";;
523 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000524fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000525AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000526# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000527# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000528AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000529if test -z "$CCSHARED"
530then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000531 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000532 hp*|HP*) if test "$GCC" = yes;
533 then CCSHARED="-fpic";
534 else CCSHARED="+z";
535 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000536 Linux*) CCSHARED="-fpic";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000537 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000538 FreeBSD*|OpenBSD*) CCSHARED="-fpic";;
539 NetBSD*) CCSHARED="-fPIC";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000540 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000541 IRIX*/6*) case $CC in
542 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000543 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000544 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000545 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000546fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000547AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000548# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000549# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000550AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000551if test -z "$LINKFORSHARED"
552then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000553 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000554 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000555 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000556 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000557 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossuma8acf721999-04-27 22:06:08 +0000558 FreeBSD/[[34]]*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000559 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000560 # -u libsys_s pulls in all symbols in libsys
561 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
562 # -u __dummy makes the linker aware of the objc runtime
563 # in System.framework; otherwise, __objcInit (referenced in
564 # crt1.o) gets erroneously defined as common, which breaks dynamic
565 # loading of any modules which reference it in System.framework
566 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000567 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000568 NetBSD*)
569 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
570 then
571 LINKFORSHARED="-Wl,--export-dynamic"
572 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000573 SunOS/5*) case $CC in
574 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000575 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000576 then
577 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000578 fi;;
579 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000580 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000581fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000582AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000583
Guido van Rossum627b2d71993-12-24 10:39:16 +0000584# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000585AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
586AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000587
588# checks for system dependent C++ extensions support
589case "$ac_sys_system" in
590 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
591 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
592 [loadAndInit("", 0, "")],
593 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
594 AC_MSG_RESULT(yes)],
595 [AC_MSG_RESULT(no)]);;
596 *) ;;
597esac
598
Guido van Rossum70c7f481998-03-26 18:44:10 +0000599# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
600# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000601# BeOS' sockets are stashed in libnet.
602case "$ac_sys_system" in
603IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000604*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000605AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000606AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000607AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
608;;
609esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000610
Guido van Rossumc5a39031996-07-31 17:35:03 +0000611AC_MSG_CHECKING(for --with-libs)
612AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
613AC_MSG_RESULT($withval)
614LIBS="$withval $LIBS"
615], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000616
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000617AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000618AC_ARG_WITH(readline,
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000619[--with(out)-readline obsolete, edit Modules/Setup instead],
620[AC_MSG_RESULT($withval)
621AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
622[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000623
Guido van Rossum009f7871997-12-04 00:51:42 +0000624AC_SUBST(USE_THREAD_MODULE)
625USE_THREAD_MODULE="#"
626
Guido van Rossum54d93d41997-01-22 20:51:58 +0000627AC_MSG_CHECKING(for --with-dec-threads)
628AC_SUBST(LDLAST)
629AC_ARG_WITH(dec-threads,
630[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
631[AC_MSG_RESULT($withval)
632LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000633if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000634 with_thread="$withval";
635fi],
636AC_MSG_RESULT(no))
637
638AC_MSG_CHECKING(for --with-threads)
639AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
640[AC_MSG_RESULT($withval)
641if test "${with_thread+set}" != set; then
642 with_thread="$withval";
643fi],
644AC_MSG_RESULT(no))
645
646AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000647AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum009f7871997-12-04 00:51:42 +0000648USE_THREAD_MODULE=
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000649AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000650if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000651then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000652fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000653AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000654AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
655AC_DEFINE(C_THREADS)
656LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum02a1c402000-02-25 19:26:31 +0000657AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
658AC_DEFINE(_POSIX_THREADS)
659LIBS="-lpthread $LIBS"
660LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum2666a151998-12-17 18:07:35 +0000661AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000662AC_DEFINE(_POSIX_THREADS)
663LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000664AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
665AC_DEFINE(BEOS_THREADS)
666LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000667AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000668AC_DEFINE(_POSIX_THREADS)
669LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000670LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum49545951997-12-02 19:28:29 +0000671AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
672AC_DEFINE(_POSIX_THREADS)
673LIBS="$LIBS -lc_r"
674LIBOBJS="$LIBOBJS thread.o"], [
Guido van Rossum6400c261997-05-22 20:34:27 +0000675AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
676AC_DEFINE(_POSIX_THREADS)
677LIBS="$LIBS -lthread"
Guido van Rossumb93a8621998-05-07 13:27:32 +0000678LIBOBJS="$LIBOBJS thread.o"], [
679AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
680AC_DEFINE(_POSIX_THREADS)
681LIBS="$LIBS -lcma"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000682LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000683])])])])])])])
Guido van Rossum6400c261997-05-22 20:34:27 +0000684
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000685AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000686LIBS="$LIBS -lmpc"
687LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000688AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000689LIBS="$LIBS -lthread"
690LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000691], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000692
Guido van Rossum68242b51996-05-28 22:53:03 +0000693# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000694AC_SUBST(DLINCLDIR)
695DLINCLDIR=/
696
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000697AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000698AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000699AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000700AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +0000701DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000702dldir=$withval
703if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000704then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000705else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
706fi
707DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000708LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000709
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000710AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000711AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000712AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000713AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +0000714DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000715dldir=`echo "$withval" | sed 's/,.*//'`
716dlddir=`echo "$withval" | sed 's/.*,//'`
717if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000718then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000719else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
720fi
721DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000722LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000723
Guido van Rossume97ee181999-12-20 21:27:22 +0000724# the dlopen() function means we might want to use dynload_shlib.o. some
725# platforms, such as AIX, have dlopen(), but don't want to use it.
726AC_CHECK_FUNC(dlopen)
727
728# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
729# loading of modules.
730AC_SUBST(DYNLOADFILE)
731AC_MSG_CHECKING(DYNLOADFILE)
732if test -z "$DYNLOADFILE"
733then
734 case $ac_sys_system/$ac_sys_release in
735 AIX*) DYNLOADFILE="dynload_aix.o";;
736 BeOS*) DYNLOADFILE="dynload_beos.o";;
737 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
738 next/*) DYNLOADFILE="dynload_next.o";;
739 *)
740 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
741 # out any dynamic loading
742 if test "$ac_cv_func_dlopen" = yes
743 then DYNLOADFILE="dynload_shlib.o"
744 else DYNLOADFILE="dynload_stub.o"
745 fi
746 ;;
747 esac
748fi
749AC_MSG_RESULT($DYNLOADFILE)
750if test "$DYNLOADFILE" != "dynload_stub.o"
751then
752 AC_DEFINE(HAVE_DYNAMIC_LOADING)
753fi
754
Guido van Rossum627b2d71993-12-24 10:39:16 +0000755# checks for library functions
Fred Drake35a092f1999-12-13 16:23:35 +0000756AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \
757 flock fork fsync fdatasync fpathconf ftime ftruncate \
Fred Drakef581db11999-12-14 21:11:47 +0000758 getgroups getlogin getpeername getpgrp getpid getpwent gettimeofday getwd \
Fred Drake35a092f1999-12-13 16:23:35 +0000759 kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \
760 putenv readlink \
Guido van Rossum96013151997-10-08 22:47:52 +0000761 select setgid setlocale setuid setsid setpgid setpgrp setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +0000762 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +0000763 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
764 truncate uname waitpid)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000765
766# check for long file support functions
767AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
768
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000769AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000770AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
771AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
772AC_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 +0000773
774# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000775AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000776AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000777AC_STRUCT_TIMEZONE
778
779AC_MSG_CHECKING(for time.h that defines altzone)
780AC_CACHE_VAL(ac_cv_header_time_altzone,
781[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
782 ac_cv_header_time_altzone=yes,
783 ac_cv_header_time_altzone=no)])
784AC_MSG_RESULT($ac_cv_header_time_altzone)
785if test $ac_cv_header_time_altzone = yes; then
786 AC_DEFINE(HAVE_ALTZONE)
787fi
788
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000789was_it_defined=no
790AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000791AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000792#include <sys/types.h>
793#include <sys/select.h>
794#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000795], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
796AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000797
798# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000799
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000800AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000801AC_C_CONST
Guido van Rossumef2255b2000-03-10 22:30:29 +0000802AC_C_INLINE
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000803
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000804works=no
805AC_MSG_CHECKING(for working volatile)
806AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
807AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000808
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000809works=no
810AC_MSG_CHECKING(for working signed char)
811AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
812AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000813
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000814have_prototypes=no
815AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000816AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
817AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000818AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000819
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000820works=no
821AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000822AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000823#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000824int foo(int x, ...) {
825 va_list va;
826 va_start(va, x);
827 va_arg(va, int);
828 va_arg(va, char *);
829 va_arg(va, double);
830 return 0;
831}
832], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000833AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
834AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000835
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000836if test "$have_prototypes" = yes; then
837bad_prototypes=no
838AC_MSG_CHECKING(for bad exec* prototypes)
839AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
840 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
841AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000842fi
843
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000844bad_forward=no
845AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000846AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000847struct s { int a; int b; };
848static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000849int foobar() {
850 static int random;
851 random = (int) &foo;
852 return random;
853}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000854static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000855main() {
856 exit(!((int)&foo == foobar()));
857}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000858], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
859AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000860
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000861va_list_is_array=no
862AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000863AC_TRY_COMPILE([
864#ifdef HAVE_STDARG_PROTOTYPES
865#include <stdarg.h>
866#else
867#include <varargs.h>
868#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000869], [va_list list1, list2; list1 = list2;], ,
870AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
871AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000872
Guido van Rossuma96f0ba1999-03-22 21:49:51 +0000873# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
874AC_CHECK_FUNC(gethostbyname_r, [
875 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
876 AC_MSG_CHECKING([gethostbyname_r with 6 args])
877 OLD_CFLAGS=$CFLAGS
878 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
879 AC_TRY_COMPILE([
880# include <netdb.h>
881 ], [
882 char *name;
883 struct hostent *he, *res;
884 char buffer[2048];
885 int buflen = 2048;
886 int h_errnop;
887
888 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
889 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +0000890 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +0000891 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
892 AC_MSG_RESULT(yes)
893 ], [
894 AC_MSG_RESULT(no)
895 AC_MSG_CHECKING([gethostbyname_r with 5 args])
896 AC_TRY_COMPILE([
897# include <netdb.h>
898 ], [
899 char *name;
900 struct hostent *he;
901 char buffer[2048];
902 int buflen = 2048;
903 int h_errnop;
904
905 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
906 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +0000907 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +0000908 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
909 AC_MSG_RESULT(yes)
910 ], [
911 AC_MSG_RESULT(no)
912 AC_MSG_CHECKING([gethostbyname_r with 3 args])
913 AC_TRY_COMPILE([
914# include <netdb.h>
915 ], [
916 char *name;
917 struct hostent *he;
918 struct hostent_data data;
919
920 (void) gethostbyname_r(name, he, &data);
921 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +0000922 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +0000923 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
924 AC_MSG_RESULT(yes)
925 ], [
926 AC_MSG_RESULT(no)
927 ])
928 ])
929 ])
930 CFLAGS=$OLD_CFLAGS
931], [
932 AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME))
933])
934AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
935AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
936AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +0000937AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +0000938AC_SUBST(HAVE_GETHOSTBYNAME)
939
Guido van Rossum627b2d71993-12-24 10:39:16 +0000940# checks for system services
941# (none yet)
942
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000943# Linux requires this for correct f.p. operations
944AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000945
Guido van Rossum93274221997-05-09 02:42:00 +0000946# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +0000947AC_MSG_CHECKING(for --with-fpectl)
948AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [
949if test "$withval" != no
950then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
951else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000952fi],
953[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +0000954
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000955# check for --with-libm=...
956AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000957case $ac_sys_system in
958next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000959BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000960*) LIBM=-lm
961esac
Guido van Rossum93274221997-05-09 02:42:00 +0000962AC_MSG_CHECKING(for --with-libm=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000963AC_ARG_WITH(libm, [--with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000964if test "$withval" = no
965then LIBM=
966 AC_MSG_RESULT(force LIBM empty)
967elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000968then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000969 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000970else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000971fi],
972[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000973
974# check for --with-libc=...
975AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +0000976AC_MSG_CHECKING(for --with-libc=STRING)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000977AC_ARG_WITH(libc, [--with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +0000978if test "$withval" = no
979then LIBC=
980 AC_MSG_RESULT(force LIBC empty)
981elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000982then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +0000983 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000984else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +0000985fi],
986[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000987
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000988# check for hypot() in math library
989LIBS_SAVE=$LIBS
990LIBS="$LIBS $LIBM"
991AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000992AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000993LIBS=$LIBS_SAVE
994
Guido van Rossum7d473291995-01-20 14:12:16 +0000995# check for getopt
996AC_MSG_CHECKING(for genuine getopt)
997AC_CACHE_VAL(ac_cv_func_getopt,
998[AC_TRY_RUN([#include <stdio.h>
999extern int optind, opterr, getopt();
1000extern char* optarg;
1001int main() {
1002 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
1003 opterr = 0;
1004 if (getopt(3, av, "f:") == 'f') { exit(1); }
1005 exit(0);
1006}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
1007AC_MSG_RESULT($ac_cv_func_getopt)
1008test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
1009AC_SUBST(LIBOBJS)dnl
1010
Guido van Rossumad713701997-07-10 22:42:38 +00001011# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001012AC_MSG_CHECKING(what malloc(0) returns)
1013AC_CACHE_VAL(ac_cv_malloc_zero,
1014[AC_TRY_RUN([#include <stdio.h>
1015#ifdef HAVE_STDLIB
1016#include <stdlib.h>
1017#else
1018char *malloc(), *realloc();
1019int *free();
1020#endif
1021main() {
1022 char *p;
1023 p = malloc(0);
1024 if (p == NULL) exit(1);
1025 p = realloc(p, 0);
1026 if (p == NULL) exit(1);
1027 free(p);
1028 exit(0);
1029}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1030AC_MSG_RESULT($ac_cv_malloc_zero)
1031if test "$ac_cv_malloc_zero" = null
1032then
1033 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1034fi
1035
Guido van Rossumef2255b2000-03-10 22:30:29 +00001036# check for wchar.h
1037AC_CHECK_HEADER(wchar.h,
1038AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1039wchar_h="no"
1040)
1041
1042# check for usable wchar_t
1043usable_wchar_t="unkown"
1044AC_MSG_CHECKING(for usable wchar_t)
1045AC_TRY_RUN([
1046#include "wchar.h"
1047#include "wctype.h"
1048main() {
1049 wchar_t s;
1050 if (sizeof(s) == 2)
1051 exit(0);
1052 else
1053 exit(1);
1054}
1055],
1056AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
1057usable_wchar_t="no")
1058AC_MSG_RESULT($usable_wchar_t)
1059
1060# check for endianness
1061AC_C_BIGENDIAN
1062
1063# Check for --with-wctype-functions
1064AC_MSG_CHECKING(for --with-wctype-functions)
1065AC_ARG_WITH(wctype-functions,
1066[--with-wctype-functions use wctype.h functions], [
1067if test "$withval" != no
1068then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1069else AC_MSG_RESULT(no)
1070fi],
1071[AC_MSG_RESULT(no)])
1072
Guido van Rossum627b2d71993-12-24 10:39:16 +00001073# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +00001074AC_OUTPUT(Makefile \
1075 Objects/Makefile \
1076 Parser/Makefile \
1077 Python/Makefile \
Guido van Rossum009f7871997-12-04 00:51:42 +00001078 Modules/Makefile.pre \
1079 Modules/Setup.thread)