blob: 73c8b7a3023d2aa36ab55398007473b823503416 [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 Rossumb9a22a12000-06-30 02:48:53 +00009VERSION=2.0
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,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000016 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
Guido van Rossum4b6b5791996-09-09 20:09:34 +000017 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,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000036[ --with-next-framework Build (OpenStep|Rhapsody|MacOSX) framework],,)
37AC_ARG_WITH(dyld,
38[ --with-dyld Use (OpenStep|Rhapsody|MacOSX) 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`
Trent Mick635f6fb2000-08-23 21:33:05 +000046 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000047 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)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +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
Guido van Rossum32000e82000-05-22 21:31:50 +0000138 OPT="-DUSE_DL_EXPORT -O"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000139 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 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000151 Monterey*)
152 RANLIB=:
153 without_gcc=;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000154 *) without_gcc=no;;
155 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000156AC_MSG_RESULT($without_gcc)
157
Guido van Rossum95012191999-12-16 17:50:52 +0000158AC_SUBST(SET_CXX)
159AC_SUBST(MAINOBJ)
160MAINOBJ=python.o
161AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000162AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Guido van Rossum95012191999-12-16 17:50:52 +0000163 case $withval in
164 no) CXX=
165 with_cxx=no;;
166 *) CXX=$withval
167 MAINOBJ=ccpython.o
168 with_cxx=$withval;;
169 esac], [
170 with_cxx=no
171])
172AC_MSG_RESULT($with_cxx)
173SET_CXX="CXX = $CXX"
174
175#AC_MSG_CHECKING(CCC)
176#if test -z "$CCC"
177#then
178# case $ac_sys_system in
179# IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";;
180# Linux*) SET_CCC="CCC= g++";;
181# *) SET_CCC=""
182# esac
183#else
184# SET_CCC="CCC= ${CCC}"
185#fi
186#AC_MSG_RESULT($SET_CCC)
187
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000188# If the user switches compilers, we can't believe the cache
189if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
190then
191 AC_ERROR(cached CC is different -- throw away $cache_file
192(it is also a good idea to do 'make clean' before compiling))
193fi
194
Guido van Rossum627b2d71993-12-24 10:39:16 +0000195AC_PROG_CC
Guido van Rossumfb842551997-08-06 23:42:07 +0000196
Guido van Rossumdd997f71998-10-07 19:58:26 +0000197case $MACHDEP in
198bsdos*)
199 case $CC in
200 gcc) CC="$CC -D_HAVE_BSDI";;
201 esac;;
202esac
203
Guido van Rossum84561611997-08-21 00:08:11 +0000204case $ac_sys_system in
205hp*|HP*)
206 case $CC in
207 cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";;
208 esac;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000209BeOS*)
210 case $CC in
211 cc) CC=cc;;
212 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000213Monterey*)
214 case $CC in
215 cc) CC="$CC -Wl,-Bexport";;
216 esac;;
Guido van Rossum84561611997-08-21 00:08:11 +0000217esac
218
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000219# LDLIBRARY is the name of the library to link against (as opposed to the
220# name of the library into which to insert object files). On systems
221# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
222# the Makefiles).
223AC_SUBST(MAKE_LDLIBRARY)
224AC_SUBST(LDLIBRARY)
225LDLIBRARY=''
226
Guido van Rossumfb842551997-08-06 23:42:07 +0000227# LINKCC is the command that links the python executable -- default is $(CC).
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000228# This is altered for AIX and BeOS in order to build the export list before
229# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000230AC_SUBST(LINKCC)
231AC_MSG_CHECKING(LINKCC)
Guido van Rossum95012191999-12-16 17:50:52 +0000232if test -z "$LINKCC" -a ! -z "$CXX"
233then
234 LINKCC="$CXX"
235fi
Guido van Rossumfb842551997-08-06 23:42:07 +0000236if test -z "$LINKCC"
237then
238 case $ac_sys_system in
239 AIX*)
Guido van Rossum45140f91997-08-29 18:44:06 +0000240 LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000241 BeOS*)
Guido van Rossum2666a151998-12-17 18:07:35 +0000242 LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)"
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000243 LDLIBRARY='libpython$(VERSION).so';;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000244 dgux*)
245 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000246 Monterey64*)
247 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000248 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000249 esac
250fi
251AC_MSG_RESULT($LINKCC)
252
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000253AC_MSG_CHECKING(LDLIBRARY)
254
255# NeXT framework builds require that the 'ar' library be converted into
256# a bundle using libtool.
257if test "$with_next_framework"
258then
259 LDLIBRARY='libpython$(VERSION).dylib'
260fi
261
262# DG/UX requires some fancy ld contortions to produce a .so from an .a
263if test "$MACHDEP" = "dguxR4"
264then
265 LDLIBRARY='libpython$(VERSION).so'
266 OPT="$OPT -pic"
267fi
268AC_MSG_RESULT($LDLIBRARY)
269
270# If LDLIBRARY is different from LIBRARY, emit a rule to build it.
271if test -z "$LDLIBRARY"
272then
273 LDLIBRARY='libpython$(VERSION).a'
274 MAKE_LDLIBRARY="true"
275else
276 MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)'
277fi
278
Guido van Rossum627b2d71993-12-24 10:39:16 +0000279AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000280AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000281AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000282AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +0000283AC_SUBST(INSTALL_PROGRAM)
284AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000285# Install just never works :-(
286if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +0000287then
288 INSTALL=cp
289 INSTALL_PROGRAM=cp
290 INSTALL_DATA=cp
291else
292 INSTALL_PROGRAM="$INSTALL"
293 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +0000294fi
Guido van Rossumb418f891996-07-30 18:06:02 +0000295
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000296# Not every filesystem supports hard links
297AC_SUBST(LN)
298if test -z "$LN" ; then
299 case $ac_sys_system in
300 BeOS*) LN="ln -s";;
301 *) LN=ln;;
302 esac
303fi
304
Guido van Rossum4e8af441994-08-19 15:33:54 +0000305# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +0000306AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000307if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000308then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000309 case $GCC in
310 yes)
311 case $ac_cv_prog_cc_g in
312 yes) OPT="-g -O2";;
313 *) OPT="-O2";;
314 esac
315 ;;
Guido van Rossumb418f891996-07-30 18:06:02 +0000316 *) OPT="-O";;
317 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000318fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000319
Trent Mick635f6fb2000-08-23 21:33:05 +0000320# The current (beta) Monterey compiler dies with optimizations
321case $ac_sys_system in
322Monterey*) OPT="";;
323esac
324
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000325if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000326then
327 OPT="$OPT $ac_arch_flags"
328fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000329# checks for UNIX variants that set C preprocessor variables
330AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000331AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000332
Guido van Rossum91922671997-10-09 20:24:13 +0000333AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
334AC_CACHE_VAL(ac_cv_opt_olimit_ok,
335[ac_save_cc="$CC"
336CC="$CC -OPT:Olimit=0"
337AC_TRY_RUN([int main() { return 0; }],
338 ac_cv_opt_olimit_ok=yes,
339 ac_cv_opt_olimit_ok=no)
340CC="$ac_save_cc"])
341AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000342if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000343 OPT="$OPT -OPT:Olimit=0"
Guido van Rossumf8678121998-07-07 21:05:09 +0000344else
345 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
346 AC_CACHE_VAL(ac_cv_olimit_ok,
347 [ac_save_cc="$CC"
348 CC="$CC -Olimit 1500"
349 AC_TRY_RUN([int main() { return 0; }],
350 ac_cv_olimit_ok=yes,
351 ac_cv_olimit_ok=no)
352 CC="$ac_save_cc"])
353 AC_MSG_RESULT($ac_cv_olimit_ok)
354 if test $ac_cv_olimit_ok = yes; then
355 OPT="$OPT -Olimit 1500"
356 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000357fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000358
Fred Drakece81d592000-07-09 14:39:29 +0000359dnl # check for ANSI or K&R ("traditional") preprocessor
360dnl AC_MSG_CHECKING(for C preprocessor type)
361dnl AC_TRY_COMPILE([
362dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
363dnl int foo;
364dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
365dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
366dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000367
Guido van Rossum627b2d71993-12-24 10:39:16 +0000368# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000369AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000370AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000371signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000372sys/audioio.h sys/file.h sys/lock.h \
Guido van Rossum95713eb2000-05-18 20:53:31 +0000373sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drake8cef4cf2000-06-28 16:40:38 +0000374sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000375AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000376
377# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000378was_it_defined=no
379AC_MSG_CHECKING(for clock_t in time.h)
380AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
381AC_MSG_RESULT($was_it_defined)
382
Guido van Rossum300fda71996-08-19 21:58:16 +0000383# Add some code to confdefs.h so that the test for off_t works on SCO
384cat >> confdefs.h <<\EOF
385#if defined(SCO_DS)
386#undef _OFF_T
387#endif
388EOF
389
Guido van Rossumef2255b2000-03-10 22:30:29 +0000390# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000391AC_TYPE_MODE_T
392AC_TYPE_OFF_T
393AC_TYPE_PID_T
394AC_TYPE_SIGNAL
395AC_TYPE_SIZE_T
396AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000397
Guido van Rossumef2255b2000-03-10 22:30:29 +0000398# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000399AC_CHECK_SIZEOF(int)
400AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000401AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000402AC_CHECK_SIZEOF(char)
403AC_CHECK_SIZEOF(short)
404AC_CHECK_SIZEOF(float)
405AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000406AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000407
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000408AC_MSG_CHECKING(for long long support)
409have_long_long=no
410AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
411AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000412if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000413AC_CHECK_SIZEOF(long long)
414fi
415
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000416AC_MSG_CHECKING(for uintptr_t support)
417have_uintptr_t=no
418AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
419AC_MSG_RESULT($have_uintptr_t)
420if test "$have_uintptr_t" = yes ; then
421AC_CHECK_SIZEOF(uintptr_t)
422fi
423
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000424# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
425AC_MSG_CHECKING(size of off_t)
426AC_CACHE_VAL(ac_cv_sizeof_off_t,
427[AC_TRY_RUN([#include <stdio.h>
428#include <sys/types.h>
429main()
430{
431 FILE *f=fopen("conftestval", "w");
432 if (!f) exit(1);
433 fprintf(f, "%d\n", sizeof(off_t));
434 exit(0);
435}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
436])
437AC_MSG_RESULT($ac_cv_sizeof_off_t)
438AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
439
440AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000441if test "$have_long_long" = yes -a \
442 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
443 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000444 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
445 AC_MSG_RESULT(yes)
446else
447 AC_MSG_RESULT(no)
448fi
449
Fred Drakea3f6e912000-06-29 20:44:47 +0000450# AC_CHECK_SIZEOF() doesn't include <time.h>.
451AC_MSG_CHECKING(size of time_t)
452AC_CACHE_VAL(ac_cv_sizeof_time_t,
453[AC_TRY_RUN([#include <stdio.h>
454#include <time.h>
455main()
456{
457 FILE *f=fopen("conftestval", "w");
458 if (!f) exit(1);
459 fprintf(f, "%d\n", sizeof(time_t));
460 exit(0);
461}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
462])
463AC_MSG_RESULT($ac_cv_sizeof_time_t)
464AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
465
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000466
Trent Mick635f6fb2000-08-23 21:33:05 +0000467# if have pthread_t then define SIZEOF_PTHREAD_T
468AC_MSG_CHECKING(for pthread_t)
469have_pthread_t=no
470AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = (pthread_t)0;], have_pthread_t=yes)
471AC_MSG_RESULT($have_pthread_t)
472if test "$have_pthread_t" = yes ; then
473 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
474 AC_MSG_CHECKING(size of pthread_t)
475 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
476 [AC_TRY_RUN([#include <stdio.h>
477 #include <pthread.h>
478 main()
479 {
480 FILE *f=fopen("conftestval", "w");
481 if (!f) exit(1);
482 fprintf(f, "%d\n", sizeof(pthread_t));
483 exit(0);
484 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
485 ])
486 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
487 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
488fi
489
490
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000491# Minor variations in building a framework between NextStep versions 4 and 5
492AC_SUBST(LIBTOOL_CRUFT)
493case $ac_sys_system/$ac_sys_release in
494 next/4*)
495 ns_undef_sym='__environ'
496 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
497 next/5*)
498 ns_undef_sym='_environ'
499 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
500esac
501
502AC_MSG_CHECKING(for --with-next-framework)
503if test "$with_next_framework"
504then
505 OPT="$OPT -fno-common"
506 # -U __environ is needed since bundles don't have access
507 # to crt0 when built but will always be linked against it
508 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
509 AC_DEFINE(WITH_NEXT_FRAMEWORK)
510 AC_MSG_RESULT(yes)
511else
512 AC_MSG_RESULT(no)
513fi
514
515AC_MSG_CHECKING(for --with-dyld)
516if test "$with_next_framework" -o "$with_dyld"
517then
518 if test "$with_dyld"
519 then
520 AC_MSG_RESULT(yes)
521 else
522 AC_MSG_RESULT(required for framework build)
523 fi
524 AC_DEFINE(WITH_DYLD)
525 ns_dyld='set'
526else
527 AC_MSG_RESULT(no)
528fi
529
Guido van Rossumac405f61994-09-12 10:56:06 +0000530# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000531AC_SUBST(SO)
532AC_SUBST(LDSHARED)
533AC_SUBST(CCSHARED)
534AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000535# SO is the extension of shared libraries `(including the dot!)
536# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000537AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000538if test -z "$SO"
539then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000540 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000541 hp*|HP*) SO=.sl;;
542 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000543 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000544fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000545AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000546# LDSHARED is the ld *command* used to create shared library
547# -- "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 +0000548# (Shared libraries in this instance are shared modules to be loaded into
549# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000550AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000551if test -z "$LDSHARED"
552then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000553 case $ac_sys_system/$ac_sys_release in
Guido van Rossum45140f91997-08-29 18:44:06 +0000554 AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000555 BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000556 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000557 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000558 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000559 SunOS/5*)
560 if test "$GCC" = "yes"
561 then LDSHARED='$(CC) -G'
562 else LDSHARED="ld -G";
563 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000564 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000565 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000566 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000567 next/*)
568 if test "$ns_dyld"
569 then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind'
570 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
571 fi
572 if test "$with_next_framework" ; then
573 LDSHARED="$LDSHARED \$(LDLIBRARY)"
574 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000575 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000576 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000577 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000578 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000579 NetBSD*)
580 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
581 then
582 LDSHARED="cc -shared"
583 else
584 LDSHARED="ld -Bshareable"
585 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000586 FreeBSD*)
587 if [ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]
588 then
589 LDSHARED="cc -shared ${LDFLAGS}"
590 else
591 LDSHARED="ld -Bshareable ${LDFLAGS}"
592 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000593 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000594 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000595 *) LDSHARED="ld";;
596 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000597fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000598AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000599# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000600# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000601AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000602if test -z "$CCSHARED"
603then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000604 case $ac_sys_system/$ac_sys_release in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000605 hp*|HP*) if test "$GCC" = yes;
606 then CCSHARED="-fpic";
607 else CCSHARED="+z";
608 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000609 Linux*) CCSHARED="-fpic";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000610 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000611 OpenBSD*) CCSHARED="-fpic";;
612 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000613 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000614 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000615 IRIX*/6*) case $CC in
616 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000617 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000618 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000619 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000620fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000621AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000622# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000623# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000624AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000625if test -z "$LINKFORSHARED"
626then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000627 case $ac_sys_system/$ac_sys_release in
Guido van Rossum69f65801998-03-03 21:47:00 +0000628 AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000629 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000630 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000631 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000632 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000633 # -u libsys_s pulls in all symbols in libsys
634 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
635 # -u __dummy makes the linker aware of the objc runtime
636 # in System.framework; otherwise, __objcInit (referenced in
637 # crt1.o) gets erroneously defined as common, which breaks dynamic
638 # loading of any modules which reference it in System.framework
639 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000640 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000641 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000642 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
643 then
644 LINKFORSHARED="-Wl,--export-dynamic"
645 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000646 SunOS/5*) case $CC in
647 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000648 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000649 then
650 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000651 fi;;
652 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000653 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000654fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000655AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000656
Guido van Rossum627b2d71993-12-24 10:39:16 +0000657# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000658AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
659AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000660
661# checks for system dependent C++ extensions support
662case "$ac_sys_system" in
663 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
664 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
665 [loadAndInit("", 0, "")],
666 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
667 AC_MSG_RESULT(yes)],
668 [AC_MSG_RESULT(no)]);;
669 *) ;;
670esac
671
Guido van Rossum70c7f481998-03-26 18:44:10 +0000672# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
673# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000674# BeOS' sockets are stashed in libnet.
675case "$ac_sys_system" in
676IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000677*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000678AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000679AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000680;;
681esac
682case "$ac_sys_system" in
683BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000684AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
685;;
686esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000687
Guido van Rossumc5a39031996-07-31 17:35:03 +0000688AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000689AC_ARG_WITH(libs,
690[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000691AC_MSG_RESULT($withval)
692LIBS="$withval $LIBS"
693], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000694
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000695AC_MSG_CHECKING(for --with(out)-readline)
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000696AC_ARG_WITH(readline,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000697[ --with(out)-readline obsolete, edit Modules/Setup instead],
Guido van Rossum3c7c6781997-08-05 21:47:42 +0000698[AC_MSG_RESULT($withval)
699AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)],
700[AC_MSG_RESULT(not specified.)])
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000701
Guido van Rossum009f7871997-12-04 00:51:42 +0000702AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000703USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000704
Guido van Rossum54d93d41997-01-22 20:51:58 +0000705AC_MSG_CHECKING(for --with-dec-threads)
706AC_SUBST(LDLAST)
707AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000708[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
709AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000710LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000711if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000712 with_thread="$withval";
713fi],
714AC_MSG_RESULT(no))
715
716AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000717AC_ARG_WITH(threads,
718[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000719
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000720# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000721AC_ARG_WITH(thread,
722[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
723with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000724
725if test -z "$with_threads"
726then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000727fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000728AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000729
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000730if test "$with_threads" = "no"
731then
732 USE_THREAD_MODULE="#"
733else
734 if test -d "$with_threads"
735 then LDFLAGS="$LDFLAGS -L$with_threads"
736 fi
737 if test -d "$withval"
738 then LDFLAGS="$LDFLAGS -L$withval"
739 fi
740 AC_DEFINE(_REENTRANT)
741 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
742 AC_DEFINE(C_THREADS)
743 LIBOBJS="$LIBOBJS thread.o"],[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000744 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
745 AC_DEFINE(_POSIX_THREADS)
746 LIBS="-lpthread $LIBS"
747 LIBOBJS="$LIBOBJS thread.o"],[
748 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
749 AC_DEFINE(_POSIX_THREADS)
750 LIBOBJS="$LIBOBJS thread.o"],[
751 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
752 AC_DEFINE(BEOS_THREADS)
753 LIBOBJS="$LIBOBJS thread.o"],[
754 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
755 AC_DEFINE(_POSIX_THREADS)
756 LIBS="$LIBS -lpthreads"
757 LIBOBJS="$LIBOBJS thread.o"], [
758 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
759 AC_DEFINE(_POSIX_THREADS)
760 LIBS="$LIBS -lc_r"
761 LIBOBJS="$LIBOBJS thread.o"], [
762 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
763 AC_DEFINE(_POSIX_THREADS)
764 LIBS="$LIBS -lthread"
765 LIBOBJS="$LIBOBJS thread.o"], [
Greg Steinadf63d62000-07-05 10:38:09 +0000766 AC_CHECK_LIB(pth, pth_init, [AC_DEFINE(WITH_THREAD)
767 AC_DEFINE(_GNU_PTH)
768 LIBS="-lpth $LIBS"
769 LIBOBJS="$LIBOBJS thread.o"],[
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000770 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
771 AC_DEFINE(_POSIX_THREADS)
772 LIBS="$LIBS -lcma"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000773 LIBOBJS="$LIBOBJS thread.o"],[
774 USE_THREAD_MODULE="#"])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000775 ])])])])])])])])
776
777 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
778 LIBS="$LIBS -lmpc"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000779 LIBOBJS="$LIBOBJS thread.o"
780 USE_THREAD_MODULE=""])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000781 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
782 LIBS="$LIBS -lthread"
Thomas Wouters0db2b2b2000-08-26 11:33:43 +0000783 LIBOBJS="$LIBOBJS thread.o"
784 USE_THREAD_MODULE=""])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000785fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000786
Barry Warsawef82cd72000-06-30 16:21:01 +0000787# Check for GC support
788AC_SUBST(USE_GC_MODULE)
789USE_GC_MODULE=""
790AC_MSG_CHECKING(for --with-cycle-gc)
791AC_ARG_WITH(cycle-gc,
792[ --with(out)-cycle-gc disable/enable garbage collection])
793
794if test -z "$with_cycle_gc"
795then with_cycle_gc="yes"
796fi
797if test "$with_cycle_gc" = "no"
798then
799 USE_GC_MODULE="#"
800else
801 AC_DEFINE(WITH_CYCLE_GC)
802fi
803AC_MSG_RESULT($with_cycle_gc)
804
805# Check for --with-wctype-functions
806AC_MSG_CHECKING(for --with-wctype-functions)
807AC_ARG_WITH(wctype-functions,
808[ --with-wctype-functions use wctype.h functions], [
809if test "$withval" != no
810then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
811else AC_MSG_RESULT(no)
812fi],
813[AC_MSG_RESULT(no)])
814
Guido van Rossum68242b51996-05-28 22:53:03 +0000815# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000816AC_SUBST(DLINCLDIR)
817DLINCLDIR=/
818
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000819AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000820AC_ARG_WITH(sgi-dl,
821[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000822AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000823AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +0000824DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000825dldir=$withval
826if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000827then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000828else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
829fi
830DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000831LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000832
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000833AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000834AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000835AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000836AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +0000837DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000838dldir=`echo "$withval" | sed 's/,.*//'`
839dlddir=`echo "$withval" | sed 's/.*,//'`
840if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000841then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000842else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
843fi
844DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000845LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000846
Guido van Rossume97ee181999-12-20 21:27:22 +0000847# the dlopen() function means we might want to use dynload_shlib.o. some
848# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +0000849AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +0000850
851# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
852# loading of modules.
853AC_SUBST(DYNLOADFILE)
854AC_MSG_CHECKING(DYNLOADFILE)
855if test -z "$DYNLOADFILE"
856then
857 case $ac_sys_system/$ac_sys_release in
858 AIX*) DYNLOADFILE="dynload_aix.o";;
859 BeOS*) DYNLOADFILE="dynload_beos.o";;
860 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
861 next/*) DYNLOADFILE="dynload_next.o";;
862 *)
863 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
864 # out any dynamic loading
865 if test "$ac_cv_func_dlopen" = yes
866 then DYNLOADFILE="dynload_shlib.o"
867 else DYNLOADFILE="dynload_stub.o"
868 fi
869 ;;
870 esac
871fi
872AC_MSG_RESULT($DYNLOADFILE)
873if test "$DYNLOADFILE" != "dynload_stub.o"
874then
875 AC_DEFINE(HAVE_DYNAMIC_LOADING)
876fi
877
Guido van Rossum627b2d71993-12-24 10:39:16 +0000878# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +0000879AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +0000880 flock fork fsync fdatasync fpathconf ftime ftruncate \
Thomas Wouters3a584202000-08-05 23:28:51 +0000881 getgroups getlogin getpeername getpid getpwent getwd \
Andrew M. Kuchling898527b2000-06-18 14:54:13 +0000882 kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000883 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +0000884 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +0000885 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +0000886 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +0000887 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +0000888 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Wouters70c21a12000-07-14 14:28:33 +0000889 truncate uname waitpid _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000890
Fred Drake8cef4cf2000-06-28 16:40:38 +0000891# check for openpty and forkpty
892
893AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
894AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
895
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000896# check for long file support functions
897AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
898
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000899AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +0000900AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
901AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
902AC_CHECK_FUNCS(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 +0000903
904# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000905AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000906AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000907AC_STRUCT_TIMEZONE
908
909AC_MSG_CHECKING(for time.h that defines altzone)
910AC_CACHE_VAL(ac_cv_header_time_altzone,
911[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
912 ac_cv_header_time_altzone=yes,
913 ac_cv_header_time_altzone=no)])
914AC_MSG_RESULT($ac_cv_header_time_altzone)
915if test $ac_cv_header_time_altzone = yes; then
916 AC_DEFINE(HAVE_ALTZONE)
917fi
918
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000919was_it_defined=no
920AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000921AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000922#include <sys/types.h>
923#include <sys/select.h>
924#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000925], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
926AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000927
928# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000929
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000930AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000931AC_C_CONST
Guido van Rossumef2255b2000-03-10 22:30:29 +0000932AC_C_INLINE
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000933
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000934works=no
935AC_MSG_CHECKING(for working volatile)
936AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
937AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000938
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000939works=no
940AC_MSG_CHECKING(for working signed char)
941AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
942AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000943
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000944have_prototypes=no
945AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000946AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
947AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000948AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000949
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000950works=no
951AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000952AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000953#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000954int foo(int x, ...) {
955 va_list va;
956 va_start(va, x);
957 va_arg(va, int);
958 va_arg(va, char *);
959 va_arg(va, double);
960 return 0;
961}
962], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000963AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
964AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000965
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000966if test "$have_prototypes" = yes; then
967bad_prototypes=no
968AC_MSG_CHECKING(for bad exec* prototypes)
969AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
970 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
971AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000972fi
973
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000974bad_forward=no
975AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000976AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000977struct s { int a; int b; };
978static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000979int foobar() {
980 static int random;
981 random = (int) &foo;
982 return random;
983}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000984static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000985main() {
986 exit(!((int)&foo == foobar()));
987}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000988], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
989AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000990
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000991va_list_is_array=no
992AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000993AC_TRY_COMPILE([
994#ifdef HAVE_STDARG_PROTOTYPES
995#include <stdarg.h>
996#else
997#include <varargs.h>
998#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000999], [va_list list1, list2; list1 = list2;], ,
1000AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1001AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001002
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001003# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1004AC_CHECK_FUNC(gethostbyname_r, [
1005 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1006 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1007 OLD_CFLAGS=$CFLAGS
1008 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1009 AC_TRY_COMPILE([
1010# include <netdb.h>
1011 ], [
1012 char *name;
1013 struct hostent *he, *res;
1014 char buffer[2048];
1015 int buflen = 2048;
1016 int h_errnop;
1017
1018 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1019 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001020 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001021 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1022 AC_MSG_RESULT(yes)
1023 ], [
1024 AC_MSG_RESULT(no)
1025 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1026 AC_TRY_COMPILE([
1027# include <netdb.h>
1028 ], [
1029 char *name;
1030 struct hostent *he;
1031 char buffer[2048];
1032 int buflen = 2048;
1033 int h_errnop;
1034
1035 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1036 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001037 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001038 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1039 AC_MSG_RESULT(yes)
1040 ], [
1041 AC_MSG_RESULT(no)
1042 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1043 AC_TRY_COMPILE([
1044# include <netdb.h>
1045 ], [
1046 char *name;
1047 struct hostent *he;
1048 struct hostent_data data;
1049
1050 (void) gethostbyname_r(name, he, &data);
1051 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001052 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001053 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1054 AC_MSG_RESULT(yes)
1055 ], [
1056 AC_MSG_RESULT(no)
1057 ])
1058 ])
1059 ])
1060 CFLAGS=$OLD_CFLAGS
1061], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001062 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001063])
1064AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1065AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1066AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001067AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001068AC_SUBST(HAVE_GETHOSTBYNAME)
1069
Guido van Rossum627b2d71993-12-24 10:39:16 +00001070# checks for system services
1071# (none yet)
1072
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001073# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001074AC_CHECK_FUNC(__fpu_control,
1075 [],
1076 [AC_CHECK_LIB(ieee, __fpu_control)
1077])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001078
Guido van Rossum93274221997-05-09 02:42:00 +00001079# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001080AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001081AC_ARG_WITH(fpectl,
1082[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001083if test "$withval" != no
1084then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1085else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001086fi],
1087[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001088
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001089# check for --with-libm=...
1090AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001091case $ac_sys_system in
1092next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001093BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001094*) LIBM=-lm
1095esac
Guido van Rossum93274221997-05-09 02:42:00 +00001096AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001097AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001098if test "$withval" = no
1099then LIBM=
1100 AC_MSG_RESULT(force LIBM empty)
1101elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001102then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001103 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001104else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001105fi],
1106[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001107
1108# check for --with-libc=...
1109AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001110AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001111AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001112if test "$withval" = no
1113then LIBC=
1114 AC_MSG_RESULT(force LIBC empty)
1115elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001116then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001117 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001118else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001119fi],
1120[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001121
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001122# check for hypot() in math library
1123LIBS_SAVE=$LIBS
1124LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001125AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001126LIBS=$LIBS_SAVE
1127
Guido van Rossum7d473291995-01-20 14:12:16 +00001128# check for getopt
1129AC_MSG_CHECKING(for genuine getopt)
1130AC_CACHE_VAL(ac_cv_func_getopt,
1131[AC_TRY_RUN([#include <stdio.h>
1132extern int optind, opterr, getopt();
1133extern char* optarg;
1134int main() {
1135 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
1136 opterr = 0;
1137 if (getopt(3, av, "f:") == 'f') { exit(1); }
1138 exit(0);
1139}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
1140AC_MSG_RESULT($ac_cv_func_getopt)
1141test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
1142AC_SUBST(LIBOBJS)dnl
1143
Guido van Rossumad713701997-07-10 22:42:38 +00001144# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001145AC_MSG_CHECKING(what malloc(0) returns)
1146AC_CACHE_VAL(ac_cv_malloc_zero,
1147[AC_TRY_RUN([#include <stdio.h>
1148#ifdef HAVE_STDLIB
1149#include <stdlib.h>
1150#else
1151char *malloc(), *realloc();
1152int *free();
1153#endif
1154main() {
1155 char *p;
1156 p = malloc(0);
1157 if (p == NULL) exit(1);
1158 p = realloc(p, 0);
1159 if (p == NULL) exit(1);
1160 free(p);
1161 exit(0);
1162}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1163AC_MSG_RESULT($ac_cv_malloc_zero)
1164if test "$ac_cv_malloc_zero" = null
1165then
1166 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1167fi
1168
Guido van Rossumef2255b2000-03-10 22:30:29 +00001169# check for wchar.h
1170AC_CHECK_HEADER(wchar.h,
1171AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1172wchar_h="no"
1173)
1174
1175# check for usable wchar_t
1176usable_wchar_t="unkown"
1177AC_MSG_CHECKING(for usable wchar_t)
1178AC_TRY_RUN([
1179#include "wchar.h"
1180#include "wctype.h"
1181main() {
1182 wchar_t s;
1183 if (sizeof(s) == 2)
1184 exit(0);
1185 else
1186 exit(1);
1187}
1188],
1189AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
1190usable_wchar_t="no")
1191AC_MSG_RESULT($usable_wchar_t)
1192
1193# check for endianness
1194AC_C_BIGENDIAN
1195
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001196# Check whether right shifting a negative integer extends the sign bit
1197# or fills with zeros (like the Cray J90, according to Tim Peters).
1198AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001199AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001200AC_TRY_RUN([
1201int main()
1202{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001203 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001204}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001205], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1206AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1207if test "$ac_cv_rshift_extends_sign" = no
1208then
1209 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1210fi
1211
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001212
Guido van Rossum95713eb2000-05-18 20:53:31 +00001213# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1214# Add sys/socket.h to confdefs.h
1215cat >> confdefs.h <<\EOF
1216#ifdef HAVE_SYS_SOCKET_H
1217#include <sys/socket.h>
1218#endif
1219EOF
1220AC_CHECK_TYPE(socklen_t, int)
1221
Guido van Rossum627b2d71993-12-24 10:39:16 +00001222# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +00001223AC_OUTPUT(Makefile \
1224 Objects/Makefile \
1225 Parser/Makefile \
Sjoerd Mullender59bb0802000-08-17 11:38:18 +00001226 Grammar/Makefile \
Guido van Rossumb418f891996-07-30 18:06:02 +00001227 Python/Makefile \
Guido van Rossum009f7871997-12-04 00:51:42 +00001228 Modules/Makefile.pre \
Barry Warsawef82cd72000-06-30 16:21:01 +00001229 Modules/Setup.config)