blob: c7bfe6ae9195281a139a6d7b51a8116232f769cf [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 Rossum6db412b2001-04-18 04:37:57 +00009VERSION=2.2
Guido van Rossum642b6781997-07-19 19:35:41 +000010
Neil Schemenauer4edbc2a2001-03-22 00:34:03 +000011# Arguments passed to configure.
12AC_SUBST(CONFIG_ARGS)
13CONFIG_ARGS="$ac_configure_args"
14
Guido van Rossum3dc0a512000-10-05 18:00:06 +000015# NEXTSTEP|MacOSX|Darwin stuff
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000016if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000017
18 AC_MSG_CHECKING(for --with-next-archs)
19 AC_ARG_WITH(next-archs,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000020 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
Guido van Rossum4b6b5791996-09-09 20:09:34 +000021 if test -n "$withval"; then
Guido van Rossum2bb4f551996-09-10 18:19:59 +000022 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
23 # GCC does not currently support multi archs on the NeXT
24 with_gcc=no
Guido van Rossum4b6b5791996-09-09 20:09:34 +000025 fi
26 AC_MSG_RESULT($with_next_archs)
27 ], [AC_MSG_RESULT(none: using `arch`)])
28
29 if test -z "$MACHDEP"
30 then
Guido van Rossum3dc0a512000-10-05 18:00:06 +000031 ac_sys_system=`uname -s`
32 if test "$ac_sys_system" = "Darwin" ; then
33 ac_sys_release=`uname -r`
34 else
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000035 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
Guido van Rossum3dc0a512000-10-05 18:00:06 +000036 sed -e 's/://' -e 's/\./_/'` && \
37 ac_sys_system=next && ac_sys_release=$4
38 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000039
Guido van Rossum3dc0a512000-10-05 18:00:06 +000040 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000041 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000042fi
Guido van Rossumb418f891996-07-30 18:06:02 +000043
Guido van Rossum54ecc3d1999-01-27 17:53:11 +000044AC_ARG_WITH(next-framework,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000045[ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000046AC_ARG_WITH(dyld,
Guido van Rossum3dc0a512000-10-05 18:00:06 +000047[ --with-dyld Use (OpenStep|Rhapsody|MacOSX|Darwin) dynamic linker],,)
Guido van Rossum91922671997-10-09 20:24:13 +000048
Guido van Rossumb418f891996-07-30 18:06:02 +000049# Set name for machine-dependent library files
50AC_SUBST(MACHDEP)
51AC_MSG_CHECKING(MACHDEP)
52if test -z "$MACHDEP"
53then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000054 ac_sys_system=`uname -s`
Guido van Rossum2242f2f2001-04-11 20:58:20 +000055 if test "$ac_sys_system" = "AIX" -o \
56 "$ac_sys_system" = "Monterey64" -o \
57 "$ac_sys_system" = "UnixWare"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000058 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000059 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000060 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000061 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000062 ac_md_system=`echo $ac_sys_system |
63 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
64 ac_md_release=`echo $ac_sys_release |
65 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000066 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000067
Guido van Rossumbcd91e01997-03-20 20:46:29 +000068 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000069 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000070 esac
71fi
Guido van Rossum91922671997-10-09 20:24:13 +000072
73#
74# SGI compilers allow the specification of the both the ABI and the
75# ISA on the command line. Depending on the values of these switches,
76# different and often incompatable code will be generated.
77#
78# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
79# thus supply support for various ABI/ISA combinations. The MACHDEP
80# variable is also adjusted.
81#
82AC_SUBST(SGI_ABI)
83if test ! -z "$SGI_ABI"
84then
85 CC="cc $SGI_ABI"
86 LDFLAGS="$SGI_ABI $LDFLAGS"
87 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
88fi
Guido van Rossumb418f891996-07-30 18:06:02 +000089AC_MSG_RESULT($MACHDEP)
90
Guido van Rossum627b2d71993-12-24 10:39:16 +000091# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000092AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000093AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000094 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000095 no) CC=cc
96 without_gcc=yes;;
97 yes) CC=gcc
98 without_gcc=no;;
99 *) CC=$withval
100 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000101 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000102 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000103 OSF1) CC=cc
104 without_gcc=;;
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000105 AIX*) CC=cc_r
106 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000107 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000108 case $BE_HOST_CPU in
109 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000110 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000111 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000112 OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000113 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000114 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000115 ;;
116 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000117 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000118 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000119 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000120 ;;
121 *)
Fred Drake5790be12000-10-09 17:06:13 +0000122 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000123 ;;
124 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000125 AR="\$(srcdir)/Modules/ar_beos"
126 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000127 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000128 Monterey*)
129 RANLIB=:
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000130 without_gcc=
131 ;;
132 UnixWare*)
133 RANLIB=:
134 without_gcc=
135 ;;
136 *)
137 without_gcc=no
138 ;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000139 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000140AC_MSG_RESULT($without_gcc)
141
Guido van Rossum27552902001-01-23 01:52:26 +0000142AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000143AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000144MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000145AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000146AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000147 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000148 case $withval in
149 no) CXX=
150 with_cxx=no;;
151 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000152 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000153 with_cxx=$withval;;
154 esac], [
155 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000156 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000157])
158AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000159
160dnl The following fragment works similar to AC_PROG_CXX.
161dnl It does not fail if CXX is not found, and it is not executed if
162dnl --with-cxx was given.
163dnl Finally, it does not test whether CXX is g++.
164
165if test "$check_cxx" = "yes"
166then
167 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
168 if test "$CXX" = "notfound"
169 then
170 CXX=
171 else
172 AC_PROG_CXX_WORKS
173 fi
174fi
175
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000176# If the user switches compilers, we can't believe the cache
177if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
178then
179 AC_ERROR(cached CC is different -- throw away $cache_file
180(it is also a good idea to do 'make clean' before compiling))
181fi
182
Guido van Rossum627b2d71993-12-24 10:39:16 +0000183AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000184AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000185AC_MSG_CHECKING(for --with-suffix)
186AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
187 case $withval in
188 no) EXEEXT=;;
189 yes) EXEEXT=.exe;;
190 *) EXEEXT=$withval;;
191 esac])
192AC_MSG_RESULT($EXEEXT)
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
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000204 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000205 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000206Monterey*)
207 case $CC in
208 cc) CC="$CC -Wl,-Bexport";;
209 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000210SunOS*)
211 # Some functions have a prototype only with that define, e.g. confstr
212 AC_DEFINE(__EXTENSIONS__)
213 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000214esac
215
Martin v. Löwise8964d42001-03-06 12:09:07 +0000216
Neil Schemenauer61c51152001-01-26 16:18:16 +0000217AC_SUBST(LIBRARY)
218AC_MSG_CHECKING(LIBRARY)
219if test -z "$LIBRARY"
220then
221 LIBRARY='libpython$(VERSION).a'
222fi
223AC_MSG_RESULT($LIBRARY)
224
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000225# LDLIBRARY is the name of the library to link against (as opposed to the
226# name of the library into which to insert object files). On systems
227# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000228# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
229# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000230AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000231AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000232LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000233DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000234
Guido van Rossumfb842551997-08-06 23:42:07 +0000235# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000236# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000237# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000238AC_SUBST(LINKCC)
239AC_MSG_CHECKING(LINKCC)
240if test -z "$LINKCC"
241then
242 case $ac_sys_system in
243 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000244 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000245 dgux*)
246 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000247 Monterey64*)
248 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000249 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000250 esac
251fi
252AC_MSG_RESULT($LINKCC)
253
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000254AC_MSG_CHECKING(LDLIBRARY)
255
256# NeXT framework builds require that the 'ar' library be converted into
257# a bundle using libtool.
258if test "$with_next_framework"
259then
260 LDLIBRARY='libpython$(VERSION).dylib'
261fi
262
263# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000264case $MACHDEP in
265dguxR4)
266 LDLIBRARY='libpython$(VERSION).so'
267 OPT="$OPT -pic"
268 ;;
269beos*)
270 LDLIBRARY='libpython$(VERSION).so'
271 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000272cygwin*)
273 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000274 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000275 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000276unixware*)
277 LDLIBRARY='libpython$(VERSION).so'
278 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000279esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000280AC_MSG_RESULT($LDLIBRARY)
281
Guido van Rossum627b2d71993-12-24 10:39:16 +0000282AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000283AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000284AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000285
286case $MACHDEP in
287bsdos*)
288 # install -d does not work on BSDI
289 if test -z "$INSTALL"
290 then
291 INSTALL="${srcdir}/install-sh -c"
292 fi
293esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000294AC_PROG_INSTALL
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";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000301 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000302 *) LN=ln;;
303 esac
304fi
305
Fred Drake9f715822001-07-11 06:27:00 +0000306# Check for --with-pydebug
307AC_MSG_CHECKING(for --with-pydebug)
308AC_ARG_WITH(pydebug,
309[ --with-pydebug build with Py_DEBUG defined], [
310if test "$withval" != no
311then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
312else AC_MSG_RESULT(no); Py_DEBUG='false'
313fi],
314[AC_MSG_RESULT(no)])
315
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000316# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000317AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000318if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000319then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000320 case $GCC in
321 yes)
322 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000323 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000324 if test "$Py_DEBUG" = 'true' ; then
325 # Optimization messes up debuggers, so turn it off for
326 # debug builds.
327 OPT="-g -Wall -Wstrict-prototypes"
328 else
329 OPT="-g -O3 -Wall -Wstrict-prototypes"
330 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000331 *)
Fred Drake9f715822001-07-11 06:27:00 +0000332 OPT="-O3 -Wall -Wstrict-prototypes";;
333 esac
334 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000335 *)
336 case $ac_sys_system in
337 UnixWare*)
338 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
339 *)
340 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000341 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000342 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000343fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000344
Trent Mick635f6fb2000-08-23 21:33:05 +0000345# The current (beta) Monterey compiler dies with optimizations
346case $ac_sys_system in
347Monterey*) OPT="";;
348esac
349
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000350if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000351then
352 OPT="$OPT $ac_arch_flags"
353fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000354# checks for UNIX variants that set C preprocessor variables
355AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000356AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000357
Guido van Rossum91922671997-10-09 20:24:13 +0000358AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
359AC_CACHE_VAL(ac_cv_opt_olimit_ok,
360[ac_save_cc="$CC"
361CC="$CC -OPT:Olimit=0"
362AC_TRY_RUN([int main() { return 0; }],
363 ac_cv_opt_olimit_ok=yes,
364 ac_cv_opt_olimit_ok=no)
365CC="$ac_save_cc"])
366AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000367if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000368 case $ac_sys_system in
369 Darwin*) OPT="$OPT" ;;
370 *) OPT="$OPT -OPT:Olimit=0";;
371 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000372else
373 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
374 AC_CACHE_VAL(ac_cv_olimit_ok,
375 [ac_save_cc="$CC"
376 CC="$CC -Olimit 1500"
377 AC_TRY_RUN([int main() { return 0; }],
378 ac_cv_olimit_ok=yes,
379 ac_cv_olimit_ok=no)
380 CC="$ac_save_cc"])
381 AC_MSG_RESULT($ac_cv_olimit_ok)
382 if test $ac_cv_olimit_ok = yes; then
383 OPT="$OPT -Olimit 1500"
384 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000385fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000386
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000387# Check for enable-ipv6
388OPT="$OPT -Dss_family=__ss_family -Dss_len=__ss_len"
389AC_MSG_CHECKING([whether to enable ipv6])
390AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000391[ --enable-ipv6 Enable ipv6 (with ipv4) support
392 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000393[ case "$enableval" in
394 no)
395 AC_MSG_RESULT(no)
396 ipv6=no
397 ;;
398 *) AC_MSG_RESULT(yes)
399 AC_DEFINE(ENABLE_IPV6)
400 ipv6=yes
401 ;;
402 esac ],
403
Fred Drake9f715822001-07-11 06:27:00 +0000404 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000405#include <sys/types.h>
406#include <sys/socket.h>
407main()
408{
409 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
410 exit(1);
411 else
412 exit(0);
413}
414],
415 AC_MSG_RESULT(yes)
416 AC_DEFINE(ENABLE_IPV6)
417 ipv6=yes,
418 AC_MSG_RESULT(no)
419 ipv6=no,
420 AC_MSG_RESULT(no)
421 ipv6=no
422))
423
424ipv6type=unknown
425ipv6lib=none
426ipv6trylibc=no
427
428if test "$ipv6" = "yes"; then
429 AC_MSG_CHECKING([ipv6 stack type])
430 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
431 case $i in
432 inria)
433 dnl http://www.kame.net/
434 AC_EGREP_CPP(yes, [dnl
435#include <netinet/in.h>
436#ifdef IPV6_INRIA_VERSION
437yes
438#endif],
439 [ipv6type=$i;
440 OPT="-DINET6 $OPT"])
441 ;;
442 kame)
443 dnl http://www.kame.net/
444 AC_EGREP_CPP(yes, [dnl
445#include <netinet/in.h>
446#ifdef __KAME__
447yes
448#endif],
449 [ipv6type=$i;
450 ipv6lib=inet6
451 ipv6libdir=/usr/local/v6/lib
452 ipv6trylibc=yes
453 OPT="-DINET6 $OPT"])
454 ;;
455 linux-glibc)
456 dnl http://www.v6.linux.or.jp/
457 AC_EGREP_CPP(yes, [dnl
458#include <features.h>
459#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
460yes
461#endif],
462 [ipv6type=$i;
463 ipv6trylibc=yes
464 OPT="-DINET6 $OPT"])
465 ;;
466 linux-inet6)
467 dnl http://www.v6.linux.or.jp/
468 if test -d /usr/inet6; then
469 ipv6type=$i
470 ipv6lib=inet6
471 ipv6libdir=/usr/inet6/lib
472 OPT="-DINET6 -I/usr/inet6/include $OPT"
473 fi
474 ;;
475 toshiba)
476 AC_EGREP_CPP(yes, [dnl
477#include <sys/param.h>
478#ifdef _TOSHIBA_INET6
479yes
480#endif],
481 [ipv6type=$i;
482 ipv6lib=inet6;
483 ipv6libdir=/usr/local/v6/lib;
484 OPT="-DINET6 $OPT"])
485 ;;
486 v6d)
487 AC_EGREP_CPP(yes, [dnl
488#include </usr/local/v6/include/sys/v6config.h>
489#ifdef __V6D__
490yes
491#endif],
492 [ipv6type=$i;
493 ipv6lib=v6;
494 ipv6libdir=/usr/local/v6/lib;
495 OPT="-I/usr/local/v6/include $OPT"])
496 ;;
497 zeta)
498 AC_EGREP_CPP(yes, [dnl
499#include <sys/param.h>
500#ifdef _ZETA_MINAMI_INET6
501yes
502#endif],
503 [ipv6type=$i;
504 ipv6lib=inet6;
505 ipv6libdir=/usr/local/v6/lib;
506 OPT="-DINET6 $OPT"])
507 ;;
508 esac
509 if test "$ipv6type" != "unknown"; then
510 break
511 fi
512 done
513 AC_MSG_RESULT($ipv6type)
514fi
515
516if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
517 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
518 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
519 echo "using lib$ipv6lib"
520 else
521 if test $ipv6trylibc = "yes"; then
522 echo "using libc"
523 else
524 echo 'Fatal: no $ipv6lib library found. cannot continue.'
525 echo "You need to fetch lib$ipv6lib.a from appropriate"
526 echo 'ipv6 kit and compile beforehand.'
527 exit 1
528 fi
529 fi
530fi
531
Fred Drakece81d592000-07-09 14:39:29 +0000532dnl # check for ANSI or K&R ("traditional") preprocessor
533dnl AC_MSG_CHECKING(for C preprocessor type)
534dnl AC_TRY_COMPILE([
535dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
536dnl int foo;
537dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
538dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
539dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000540
Guido van Rossum627b2d71993-12-24 10:39:16 +0000541# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000542AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000543AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000544signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000545sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Guido van Rossum95713eb2000-05-18 20:53:31 +0000546sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000547sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
548ndbm.h db1/ndbm.h gdbm/ndbm.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000549AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000550
551# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000552was_it_defined=no
553AC_MSG_CHECKING(for clock_t in time.h)
554AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
555AC_MSG_RESULT($was_it_defined)
556
Guido van Rossum300fda71996-08-19 21:58:16 +0000557# Add some code to confdefs.h so that the test for off_t works on SCO
558cat >> confdefs.h <<\EOF
559#if defined(SCO_DS)
560#undef _OFF_T
561#endif
562EOF
563
Guido van Rossumef2255b2000-03-10 22:30:29 +0000564# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000565AC_TYPE_MODE_T
566AC_TYPE_OFF_T
567AC_TYPE_PID_T
568AC_TYPE_SIGNAL
569AC_TYPE_SIZE_T
570AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000571
Guido van Rossumef2255b2000-03-10 22:30:29 +0000572# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000573AC_CHECK_SIZEOF(int)
574AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000575AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000576AC_CHECK_SIZEOF(char)
577AC_CHECK_SIZEOF(short)
578AC_CHECK_SIZEOF(float)
579AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000580AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000581
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000582AC_MSG_CHECKING(for long long support)
583have_long_long=no
584AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
585AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000586if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000587AC_CHECK_SIZEOF(long long)
588fi
589
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000590AC_MSG_CHECKING(for uintptr_t support)
591have_uintptr_t=no
592AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
593AC_MSG_RESULT($have_uintptr_t)
594if test "$have_uintptr_t" = yes ; then
595AC_CHECK_SIZEOF(uintptr_t)
596fi
597
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000598# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
599AC_MSG_CHECKING(size of off_t)
600AC_CACHE_VAL(ac_cv_sizeof_off_t,
601[AC_TRY_RUN([#include <stdio.h>
602#include <sys/types.h>
603main()
604{
605 FILE *f=fopen("conftestval", "w");
606 if (!f) exit(1);
607 fprintf(f, "%d\n", sizeof(off_t));
608 exit(0);
609}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
610])
611AC_MSG_RESULT($ac_cv_sizeof_off_t)
612AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
613
614AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000615if test "$have_long_long" = yes -a \
616 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
617 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000618 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
619 AC_MSG_RESULT(yes)
620else
621 AC_MSG_RESULT(no)
622fi
623
Fred Drakea3f6e912000-06-29 20:44:47 +0000624# AC_CHECK_SIZEOF() doesn't include <time.h>.
625AC_MSG_CHECKING(size of time_t)
626AC_CACHE_VAL(ac_cv_sizeof_time_t,
627[AC_TRY_RUN([#include <stdio.h>
628#include <time.h>
629main()
630{
631 FILE *f=fopen("conftestval", "w");
632 if (!f) exit(1);
633 fprintf(f, "%d\n", sizeof(time_t));
634 exit(0);
635}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
636])
637AC_MSG_RESULT($ac_cv_sizeof_time_t)
638AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
639
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000640
Trent Mick635f6fb2000-08-23 21:33:05 +0000641# if have pthread_t then define SIZEOF_PTHREAD_T
642AC_MSG_CHECKING(for pthread_t)
643have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000644AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000645AC_MSG_RESULT($have_pthread_t)
646if test "$have_pthread_t" = yes ; then
647 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
648 AC_MSG_CHECKING(size of pthread_t)
649 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
650 [AC_TRY_RUN([#include <stdio.h>
651 #include <pthread.h>
652 main()
653 {
654 FILE *f=fopen("conftestval", "w");
655 if (!f) exit(1);
656 fprintf(f, "%d\n", sizeof(pthread_t));
657 exit(0);
658 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
659 ])
660 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
661 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
662fi
663
664
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000665# Minor variations in building a framework between NextStep versions 4 and 5
666AC_SUBST(LIBTOOL_CRUFT)
667case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000668 Darwin/*)
669 ns_undef_sym='_environ'
670 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000671 next/4*)
672 ns_undef_sym='__environ'
673 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
674 next/5*)
675 ns_undef_sym='_environ'
676 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
677esac
678
679AC_MSG_CHECKING(for --with-next-framework)
680if test "$with_next_framework"
681then
682 OPT="$OPT -fno-common"
683 # -U __environ is needed since bundles don't have access
684 # to crt0 when built but will always be linked against it
685 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
686 AC_DEFINE(WITH_NEXT_FRAMEWORK)
687 AC_MSG_RESULT(yes)
688else
689 AC_MSG_RESULT(no)
690fi
691
692AC_MSG_CHECKING(for --with-dyld)
693if test "$with_next_framework" -o "$with_dyld"
694then
695 if test "$with_dyld"
696 then
697 AC_MSG_RESULT(yes)
698 else
699 AC_MSG_RESULT(required for framework build)
700 fi
701 AC_DEFINE(WITH_DYLD)
702 ns_dyld='set'
703else
704 AC_MSG_RESULT(no)
705fi
706
Guido van Rossumac405f61994-09-12 10:56:06 +0000707# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000708AC_SUBST(SO)
709AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000710AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000711AC_SUBST(CCSHARED)
712AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000713# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000714# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000715AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000716if test -z "$SO"
717then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000718 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000719 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000720 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000721 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000722 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000723fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000724AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000725# LDSHARED is the ld *command* used to create shared library
726# -- "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 +0000727# (Shared libraries in this instance are shared modules to be loaded into
728# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000729AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000730if test -z "$LDSHARED"
731then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000732 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000733 AIX*)
734 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
735 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
736 ;;
737 BeOS*)
738 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
739 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
740 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000741 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000742 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000743 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000744 SunOS/5*)
745 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000746 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000747 else LDSHARED="ld -G";
748 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000749 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000750 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000751 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000752 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000753 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000754 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000755 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
756 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000757 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000758 LDSHARED="$LDSHARED \$(LDLIBRARY)"
759 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000760 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000761 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000762 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000763 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000764 NetBSD*)
765 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
766 then
767 LDSHARED="cc -shared"
768 else
769 LDSHARED="ld -Bshareable"
770 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000771 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000772 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000773 then
774 LDSHARED="cc -shared ${LDFLAGS}"
775 else
776 LDSHARED="ld -Bshareable ${LDFLAGS}"
777 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000778 UnixWare*)
779 if test "$GCC" = "yes"
780 then LDSHARED="$(CC) -shared"
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000781 else LDSHARED="ld -G -dy -Bdynamic"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000782 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000783 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000784 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000785 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000786 *) LDSHARED="ld";;
787 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000788fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000789AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000790BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000791# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000792# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000793AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000794if test -z "$CCSHARED"
795then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000796 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000797 SunOS*) if test "$GCC" = yes;
798 then CCSHARED="-fPIC";
799 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000800 hp*|HP*) if test "$GCC" = yes;
801 then CCSHARED="-fpic";
802 else CCSHARED="+z";
803 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000804 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000805 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000806 OpenBSD*) CCSHARED="-fpic";;
807 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000808 UnixWare*)
809 if test "$GCC" = "yes"
810 then CCSHARED="-fPIC"
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000811 else CCSHARED="-KPIC -G -dy -Bdynamic"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000812 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000813 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000814 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000815 IRIX*/6*) case $CC in
816 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000817 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000818 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000819 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000820 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000821fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000822AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000823# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000824# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000825AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000826if test -z "$LINKFORSHARED"
827then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000828 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000829 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000830 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000831 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000832 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000833 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000834 # -u libsys_s pulls in all symbols in libsys
835 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
836 # -u __dummy makes the linker aware of the objc runtime
837 # in System.framework; otherwise, __objcInit (referenced in
838 # crt1.o) gets erroneously defined as common, which breaks dynamic
839 # loading of any modules which reference it in System.framework
840 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000841 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000842 UnixWare*) LINKFORSHARED="-dy -Bdynamic -Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000843 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000844 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000845 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000846 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
847 then
848 LINKFORSHARED="-Wl,--export-dynamic"
849 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000850 SunOS/5*) case $CC in
851 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000852 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000853 then
854 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000855 fi;;
856 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000857 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000858fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000859AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000860
Neil Schemenauer61c51152001-01-26 16:18:16 +0000861AC_SUBST(CFLAGSFORSHARED)
862AC_MSG_CHECKING(CFLAGSFORSHARED)
863if test ! "$LIBRARY" = "$LDLIBRARY"
864then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000865 case $ac_sys_system in
866 CYGWIN*)
867 # Cygwin needs CCSHARED when building extension DLLs
868 # but not when building the interpreter DLL.
869 CFLAGSFORSHARED='';;
870 *)
871 CFLAGSFORSHARED='$(CCSHARED)'
872 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000873fi
874AC_MSG_RESULT($CFLAGSFORSHARED)
875
Guido van Rossum627b2d71993-12-24 10:39:16 +0000876# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000877AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
878AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000879
880# checks for system dependent C++ extensions support
881case "$ac_sys_system" in
882 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
883 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
884 [loadAndInit("", 0, "")],
885 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
886 AC_MSG_RESULT(yes)],
887 [AC_MSG_RESULT(no)]);;
888 *) ;;
889esac
890
Guido van Rossum70c7f481998-03-26 18:44:10 +0000891# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
892# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000893# BeOS' sockets are stashed in libnet.
894case "$ac_sys_system" in
895IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000896*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000897AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000898AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000899;;
900esac
901case "$ac_sys_system" in
902BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000903AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
904;;
905esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000906
Guido van Rossumc5a39031996-07-31 17:35:03 +0000907AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000908AC_ARG_WITH(libs,
909[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000910AC_MSG_RESULT($withval)
911LIBS="$withval $LIBS"
912], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000913
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000914# Determine if signalmodule should be used.
915AC_SUBST(USE_SIGNAL_MODULE)
916AC_SUBST(SIGNAL_OBJS)
917AC_MSG_CHECKING(for --with-signal-module)
918AC_ARG_WITH(signal-module,
919[ --with-signal-module disable/enable signal module])
920
921if test -z "$with_signal_module"
922then with_signal_module="yes"
923fi
924AC_MSG_RESULT($with_signal_module)
925
926if test "${with_signal_module}" = "yes"; then
927 USE_SIGNAL_MODULE=""
928 SIGNAL_OBJS=""
929else
930 USE_SIGNAL_MODULE="#"
931 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
932fi
933
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000934# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000935AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000936USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000937
Guido van Rossum54d93d41997-01-22 20:51:58 +0000938AC_MSG_CHECKING(for --with-dec-threads)
939AC_SUBST(LDLAST)
940AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000941[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
942AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000943LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000944if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000945 with_thread="$withval";
946fi],
947AC_MSG_RESULT(no))
948
949AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000950AC_ARG_WITH(threads,
951[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000952
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000953# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000954AC_ARG_WITH(thread,
955[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
956with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000957
958if test -z "$with_threads"
959then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000960fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000961AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000962
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000963if test "$with_threads" = "no"
964then
965 USE_THREAD_MODULE="#"
966else
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000967 if test "$ac_sys_system" = "UnixWare"
968 then
969 CC="${CC} -Kthread"
970 LIBOBJS="$LIBOBJS thread.o"
971 AC_DEFINE(WITH_THREAD)
972 AC_DEFINE(_POSIX_THREADS)
973 USE_THREAD_MODULE=""
974 else
975 if test ! -z "$with_threads" -a -d "$with_threads"
976 then LDFLAGS="$LDFLAGS -L$with_threads"
977 fi
978 if test ! -z "$withval" -a -d "$withval"
979 then LDFLAGS="$LDFLAGS -L$withval"
980 fi
981 AC_DEFINE(_REENTRANT)
982 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
983 AC_DEFINE(C_THREADS)
984 LIBOBJS="$LIBOBJS thread.o"],[
985 AC_MSG_CHECKING(for --with-pth)
986 AC_ARG_WITH(pth,
987 [ --with-pth use GNU pth threading libraries], [
988 AC_MSG_RESULT($withval)
989 AC_DEFINE(WITH_THREAD)
990 AC_DEFINE(HAVE_PTH)
991 LIBS="-lpth $LIBS"
992 LIBOBJS="$LIBOBJS thread.o"],[
993 AC_MSG_RESULT(no)
994 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
995 AC_DEFINE(_POSIX_THREADS)
996 LIBS="-lpthread $LIBS"
997 LIBOBJS="$LIBOBJS thread.o"],[
998 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
999 case $ac_sys_system in
1000 Darwin*) ;;
1001 *) AC_DEFINE(_POSIX_THREADS);;
1002 esac
1003 LIBOBJS="$LIBOBJS thread.o"],[
1004 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1005 AC_DEFINE(BEOS_THREADS)
1006 LIBOBJS="$LIBOBJS thread.o"],[
1007 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1008 AC_DEFINE(_POSIX_THREADS)
1009 LIBS="$LIBS -lpthreads"
1010 LIBOBJS="$LIBOBJS thread.o"], [
1011 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1012 AC_DEFINE(_POSIX_THREADS)
1013 LIBS="$LIBS -lc_r"
1014 LIBOBJS="$LIBOBJS thread.o"], [
1015 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1016 AC_DEFINE(_POSIX_THREADS)
1017 LIBS="$LIBS -lthread"
1018 LIBOBJS="$LIBOBJS thread.o"], [
1019 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1020 AC_DEFINE(_POSIX_THREADS)
1021 LIBS="$LIBS -lpthread"
1022 LIBOBJS="$LIBOBJS thread.o"], [
1023 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1024 AC_DEFINE(_POSIX_THREADS)
1025 LIBS="$LIBS -lcma"
1026 LIBOBJS="$LIBOBJS thread.o"],[
1027 USE_THREAD_MODULE="#"])
1028 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001029
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001030 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1031 LIBS="$LIBS -lmpc"
1032 LIBOBJS="$LIBOBJS thread.o"
1033 USE_THREAD_MODULE=""])
1034 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1035 LIBS="$LIBS -lthread"
1036 LIBOBJS="$LIBOBJS thread.o"
1037 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001038
Guido van Rossum2242f2f2001-04-11 20:58:20 +00001039 if test "$USE_THREAD_MODULE" != "#"
1040 then
1041 # If the above checks didn't disable threads, (at least) OSF1
1042 # needs this '-threads' argument during linking.
1043 case $ac_sys_system in
1044 OSF1) LDLAST=-threads;;
1045 esac
1046 fi
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001047 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001048fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001049
Barry Warsawef82cd72000-06-30 16:21:01 +00001050# Check for GC support
1051AC_SUBST(USE_GC_MODULE)
1052USE_GC_MODULE=""
1053AC_MSG_CHECKING(for --with-cycle-gc)
1054AC_ARG_WITH(cycle-gc,
1055[ --with(out)-cycle-gc disable/enable garbage collection])
1056
1057if test -z "$with_cycle_gc"
1058then with_cycle_gc="yes"
1059fi
1060if test "$with_cycle_gc" = "no"
1061then
1062 USE_GC_MODULE="#"
1063else
1064 AC_DEFINE(WITH_CYCLE_GC)
1065fi
1066AC_MSG_RESULT($with_cycle_gc)
1067
Neil Schemenauera35c6882001-02-27 04:45:05 +00001068# Check for Python-specific malloc support
1069AC_MSG_CHECKING(for --with-pymalloc)
1070AC_ARG_WITH(pymalloc,
1071[ --with(out)-pymalloc disable/enable specialized mallocs], [
1072if test "$withval" != no
1073then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1074else AC_MSG_RESULT(no)
1075fi],
1076[AC_MSG_RESULT(no)])
1077
Barry Warsawef82cd72000-06-30 16:21:01 +00001078# Check for --with-wctype-functions
1079AC_MSG_CHECKING(for --with-wctype-functions)
1080AC_ARG_WITH(wctype-functions,
1081[ --with-wctype-functions use wctype.h functions], [
1082if test "$withval" != no
1083then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1084else AC_MSG_RESULT(no)
1085fi],
1086[AC_MSG_RESULT(no)])
1087
Guido van Rossum68242b51996-05-28 22:53:03 +00001088# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001089AC_SUBST(DLINCLDIR)
1090DLINCLDIR=/
1091
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001092AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001093AC_ARG_WITH(sgi-dl,
1094[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001095AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001096AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001097DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001098dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001099if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001100then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001101else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1102fi
1103DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001104LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001105
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001106AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001107AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001108AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001109AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001110DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001111dldir=`echo "$withval" | sed 's/,.*//'`
1112dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001113if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001114then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001115else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1116fi
1117DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001118LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001119
Guido van Rossume97ee181999-12-20 21:27:22 +00001120# the dlopen() function means we might want to use dynload_shlib.o. some
1121# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001122AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001123
1124# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1125# loading of modules.
1126AC_SUBST(DYNLOADFILE)
1127AC_MSG_CHECKING(DYNLOADFILE)
1128if test -z "$DYNLOADFILE"
1129then
1130 case $ac_sys_system/$ac_sys_release in
1131 AIX*) DYNLOADFILE="dynload_aix.o";;
1132 BeOS*) DYNLOADFILE="dynload_beos.o";;
1133 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001134 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001135 *)
1136 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1137 # out any dynamic loading
1138 if test "$ac_cv_func_dlopen" = yes
1139 then DYNLOADFILE="dynload_shlib.o"
1140 else DYNLOADFILE="dynload_stub.o"
1141 fi
1142 ;;
1143 esac
1144fi
1145AC_MSG_RESULT($DYNLOADFILE)
1146if test "$DYNLOADFILE" != "dynload_stub.o"
1147then
1148 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1149fi
1150
Jack Jansenc49e5b72001-06-19 15:00:23 +00001151# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1152
1153AC_SUBST(MACHDEP_OBJS)
1154AC_MSG_CHECKING(MACHDEP_OBJS)
1155if test -z "$MACHDEP_OBJS"
1156then
1157 case $ac_sys_system/$ac_sys_release in
1158 Darwin/*)
1159 MACHDEP_OBJS="Mac/Python/macglue.o"
1160 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1161 ;;
1162 *) MACHDEP_OBJS="";;
1163 esac
1164fi
1165AC_MSG_RESULT($DYNLOADFILE)
1166
Guido van Rossum627b2d71993-12-24 10:39:16 +00001167# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001168AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001169 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001170 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb9ab1592001-06-24 21:18:26 +00001171 inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001172 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001173 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001174 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +00001175 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +00001176 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001177 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Wouters70c21a12000-07-14 14:28:33 +00001178 truncate uname waitpid _getpty)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001179
Fred Drake8cef4cf2000-06-28 16:40:38 +00001180# check for openpty and forkpty
1181
1182AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1183AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1184
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001185# check for long file support functions
1186AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1187
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001188AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001189AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1190AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1191AC_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 +00001192
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001193AC_CHECK_FUNCS(getaddrinfo, [dnl
1194AC_MSG_CHECKING(getaddrinfo bug)
1195AC_TRY_RUN([
1196#include <sys/types.h>
1197#include <netdb.h>
1198#include <string.h>
1199#include <sys/socket.h>
1200#include <netinet/in.h>
1201
1202main()
1203{
1204 int passive, gaierr, inet4 = 0, inet6 = 0;
1205 struct addrinfo hints, *ai, *aitop;
1206 char straddr[INET6_ADDRSTRLEN], strport[16];
1207
1208 for (passive = 0; passive <= 1; passive++) {
1209 memset(&hints, 0, sizeof(hints));
1210 hints.ai_family = AF_UNSPEC;
1211 hints.ai_flags = passive ? AI_PASSIVE : 0;
1212 hints.ai_socktype = SOCK_STREAM;
1213 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1214 (void)gai_strerror(gaierr);
1215 goto bad;
1216 }
1217 for (ai = aitop; ai; ai = ai->ai_next) {
1218 if (ai->ai_addr == NULL ||
1219 ai->ai_addrlen == 0 ||
1220 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1221 straddr, sizeof(straddr), strport, sizeof(strport),
1222 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1223 goto bad;
1224 }
1225 switch (ai->ai_family) {
1226 case AF_INET:
1227 if (strcmp(strport, "54321") != 0) {
1228 goto bad;
1229 }
1230 if (passive) {
1231 if (strcmp(straddr, "0.0.0.0") != 0) {
1232 goto bad;
1233 }
1234 } else {
1235 if (strcmp(straddr, "127.0.0.1") != 0) {
1236 goto bad;
1237 }
1238 }
1239 inet4++;
1240 break;
1241 case AF_INET6:
1242 if (strcmp(strport, "54321") != 0) {
1243 goto bad;
1244 }
1245 if (passive) {
1246 if (strcmp(straddr, "::") != 0) {
1247 goto bad;
1248 }
1249 } else {
1250 if (strcmp(straddr, "::1") != 0) {
1251 goto bad;
1252 }
1253 }
1254 inet6++;
1255 break;
1256 case AF_UNSPEC:
1257 goto bad;
1258 break;
1259 default:
1260 /* another family support? */
1261 break;
1262 }
1263 }
1264 }
1265
1266 if (!(inet4 == 0 || inet4 == 2))
1267 goto bad;
1268 if (!(inet6 == 0 || inet6 == 2))
1269 goto bad;
1270
1271 if (aitop)
1272 freeaddrinfo(aitop);
1273 exit(0);
1274
1275 bad:
1276 if (aitop)
1277 freeaddrinfo(aitop);
1278 exit(1);
1279}
1280],
1281AC_MSG_RESULT(good)
1282buggygetaddrinfo=no,
1283AC_MSG_RESULT(buggy)
1284buggygetaddrinfo=yes,
1285AC_MSG_RESULT(buggy)
1286buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1287
1288if test "$buggygetaddrinfo" = "yes"; then
1289 if test "$ipv6" = "yes"; then
1290 echo 'Fatal: You must get working getaddrinfo() function.'
1291 echo ' or you can specify "--disable-ipv6"'.
1292 exit 1
1293 fi
1294fi
1295AC_CHECK_FUNCS(getaddrinfo getnameinfo)
1296
Guido van Rossum627b2d71993-12-24 10:39:16 +00001297# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001298AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001299AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001300AC_STRUCT_TIMEZONE
1301
1302AC_MSG_CHECKING(for time.h that defines altzone)
1303AC_CACHE_VAL(ac_cv_header_time_altzone,
1304[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1305 ac_cv_header_time_altzone=yes,
1306 ac_cv_header_time_altzone=no)])
1307AC_MSG_RESULT($ac_cv_header_time_altzone)
1308if test $ac_cv_header_time_altzone = yes; then
1309 AC_DEFINE(HAVE_ALTZONE)
1310fi
1311
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001312was_it_defined=no
1313AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001314AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001315#include <sys/types.h>
1316#include <sys/select.h>
1317#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001318], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1319AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001320
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001321AC_MSG_CHECKING(for addrinfo)
1322AC_CACHE_VAL(ac_cv_struct_addrinfo,
1323AC_TRY_COMPILE([
1324# include <netdb.h>],
1325 [struct addrinfo a],
1326 ac_cv_struct_addrinfo=yes,
1327 ac_cv_struct_addrinfo=no))
1328AC_MSG_RESULT($ac_cv_struct_addrinfo)
1329if test $ac_cv_struct_addrinfo = yes; then
1330 AC_DEFINE(HAVE_ADDRINFO)
1331fi
1332
1333AC_MSG_CHECKING(for sockaddr_storage)
1334AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1335AC_TRY_COMPILE([
1336# include <sys/types.h>
1337# include <sys/socket.h>],
1338 [struct sockaddr_storage s],
1339 ac_cv_struct_sockaddr_storage=yes,
1340 ac_cv_struct_sockaddr_storage=no))
1341AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1342if test $ac_cv_struct_sockaddr_storage = yes; then
1343 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1344fi
1345
Guido van Rossum627b2d71993-12-24 10:39:16 +00001346# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001347
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001348AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001349AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001350
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001351works=no
1352AC_MSG_CHECKING(for working volatile)
1353AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1354AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001355
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001356works=no
1357AC_MSG_CHECKING(for working signed char)
1358AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1359AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001360
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001361have_prototypes=no
1362AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001363AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1364AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001365AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001366
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001367works=no
1368AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001369AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001370#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001371int foo(int x, ...) {
1372 va_list va;
1373 va_start(va, x);
1374 va_arg(va, int);
1375 va_arg(va, char *);
1376 va_arg(va, double);
1377 return 0;
1378}
1379], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001380AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1381AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001382
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001383if test "$have_prototypes" = yes; then
1384bad_prototypes=no
1385AC_MSG_CHECKING(for bad exec* prototypes)
1386AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1387 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1388AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001389fi
1390
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001391# check if sockaddr has sa_len member
1392AC_MSG_CHECKING(if sockaddr has sa_len member)
1393AC_TRY_COMPILE([#include <sys/types.h>
1394#include <sys/socket.h>],
1395[struct sockaddr x;
1396x.sa_len = 0;],
1397 AC_MSG_RESULT(yes)
1398 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1399 AC_MSG_RESULT(no))
1400
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001401bad_forward=no
1402AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001403AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001404struct s { int a; int b; };
1405static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001406int foobar() {
1407 static int random;
1408 random = (int) &foo;
1409 return random;
1410}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001411static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001412main() {
1413 exit(!((int)&foo == foobar()));
1414}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001415], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1416AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001417
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001418va_list_is_array=no
1419AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001420AC_TRY_COMPILE([
1421#ifdef HAVE_STDARG_PROTOTYPES
1422#include <stdarg.h>
1423#else
1424#include <varargs.h>
1425#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001426], [va_list list1, list2; list1 = list2;], ,
1427AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1428AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001429
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001430# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1431AC_CHECK_FUNC(gethostbyname_r, [
1432 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1433 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1434 OLD_CFLAGS=$CFLAGS
1435 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1436 AC_TRY_COMPILE([
1437# include <netdb.h>
1438 ], [
1439 char *name;
1440 struct hostent *he, *res;
1441 char buffer[2048];
1442 int buflen = 2048;
1443 int h_errnop;
1444
1445 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1446 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001447 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001448 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1449 AC_MSG_RESULT(yes)
1450 ], [
1451 AC_MSG_RESULT(no)
1452 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1453 AC_TRY_COMPILE([
1454# include <netdb.h>
1455 ], [
1456 char *name;
1457 struct hostent *he;
1458 char buffer[2048];
1459 int buflen = 2048;
1460 int h_errnop;
1461
1462 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1463 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001464 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001465 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1466 AC_MSG_RESULT(yes)
1467 ], [
1468 AC_MSG_RESULT(no)
1469 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1470 AC_TRY_COMPILE([
1471# include <netdb.h>
1472 ], [
1473 char *name;
1474 struct hostent *he;
1475 struct hostent_data data;
1476
1477 (void) gethostbyname_r(name, he, &data);
1478 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001479 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001480 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1481 AC_MSG_RESULT(yes)
1482 ], [
1483 AC_MSG_RESULT(no)
1484 ])
1485 ])
1486 ])
1487 CFLAGS=$OLD_CFLAGS
1488], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001489 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001490])
1491AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1492AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1493AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001494AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001495AC_SUBST(HAVE_GETHOSTBYNAME)
1496
Guido van Rossum627b2d71993-12-24 10:39:16 +00001497# checks for system services
1498# (none yet)
1499
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001500# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001501AC_CHECK_FUNC(__fpu_control,
1502 [],
1503 [AC_CHECK_LIB(ieee, __fpu_control)
1504])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001505
Guido van Rossum93274221997-05-09 02:42:00 +00001506# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001507AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001508AC_ARG_WITH(fpectl,
1509[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001510if test "$withval" != no
1511then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1512else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001513fi],
1514[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001515
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001516# check for --with-libm=...
1517AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001518case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001519Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001520next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001521BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001522*) LIBM=-lm
1523esac
Guido van Rossum93274221997-05-09 02:42:00 +00001524AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001525AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001526if test "$withval" = no
1527then LIBM=
1528 AC_MSG_RESULT(force LIBM empty)
1529elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001530then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001531 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001532else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001533fi],
1534[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001535
1536# check for --with-libc=...
1537AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001538AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001539AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001540if test "$withval" = no
1541then LIBC=
1542 AC_MSG_RESULT(force LIBC empty)
1543elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001544then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001545 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001546else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001547fi],
1548[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001549
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001550# check for hypot() in math library
1551LIBS_SAVE=$LIBS
1552LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001553AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001554LIBS=$LIBS_SAVE
1555
Guido van Rossumad713701997-07-10 22:42:38 +00001556# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001557AC_MSG_CHECKING(what malloc(0) returns)
1558AC_CACHE_VAL(ac_cv_malloc_zero,
1559[AC_TRY_RUN([#include <stdio.h>
1560#ifdef HAVE_STDLIB
1561#include <stdlib.h>
1562#else
1563char *malloc(), *realloc();
1564int *free();
1565#endif
1566main() {
1567 char *p;
1568 p = malloc(0);
1569 if (p == NULL) exit(1);
1570 p = realloc(p, 0);
1571 if (p == NULL) exit(1);
1572 free(p);
1573 exit(0);
1574}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1575AC_MSG_RESULT($ac_cv_malloc_zero)
1576if test "$ac_cv_malloc_zero" = null
1577then
1578 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1579fi
1580
Guido van Rossumef2255b2000-03-10 22:30:29 +00001581# check for wchar.h
1582AC_CHECK_HEADER(wchar.h,
1583AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1584wchar_h="no"
1585)
1586
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001587# determine wchar_t size
1588if test "$wchar_h" = yes
1589then
1590 AC_CHECK_SIZEOF(wchar_t)
1591fi
1592
1593AC_MSG_CHECKING(what type to use for unicode)
1594AC_ARG_ENABLE(unicode,
1595[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1596
1597if test $enable_unicode = yes
1598then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001599 # Without any arguments, Py_UNICODE defaults to two-byte mode
1600 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001601fi
1602
1603case "$enable_unicode" in
1604ucs2) unicode_size="2"
1605 AC_DEFINE(Py_UNICODE_SIZE,2)
1606 ;;
1607ucs4) unicode_size="4"
1608 AC_DEFINE(Py_UNICODE_SIZE,4)
1609 ;;
1610esac
1611
1612if test "$enable_unicode" = "no"
1613then
1614 AC_MSG_RESULT(not used)
1615else
1616 AC_DEFINE(Py_USING_UNICODE)
1617 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1618 then
1619 PY_UNICODE_TYPE="wchar_t"
1620 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1621 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1622 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1623 then
1624 PY_UNICODE_TYPE="unsigned short"
1625 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1626 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1627 then
1628 PY_UNICODE_TYPE="unsigned long"
1629 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1630 else
1631 PY_UNICODE_TYPE="no type found"
1632 fi
1633 AC_MSG_RESULT($PY_UNICODE_TYPE)
1634fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001635
1636# check for endianness
1637AC_C_BIGENDIAN
1638
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001639# Check whether right shifting a negative integer extends the sign bit
1640# or fills with zeros (like the Cray J90, according to Tim Peters).
1641AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001642AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001643AC_TRY_RUN([
1644int main()
1645{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001646 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001647}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001648], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1649AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1650if test "$ac_cv_rshift_extends_sign" = no
1651then
1652 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1653fi
1654
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001655# check for getc_unlocked and related locking functions
1656AC_MSG_CHECKING(for getc_unlocked() and friends)
1657AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1658AC_TRY_LINK([#include <stdio.h>],[
1659 FILE *f = fopen("/dev/null", "r");
1660 flockfile(f);
1661 getc_unlocked(f);
1662 funlockfile(f);
1663], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1664AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1665if test "$ac_cv_have_getc_unlocked" = yes
1666then
1667 AC_DEFINE(HAVE_GETC_UNLOCKED)
1668fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001669
Guido van Rossum353ae582001-07-10 16:45:32 +00001670# check for readline 4.2
1671AC_CHECK_LIB(readline, rl_completion_matches,
1672 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1673
Guido van Rossum95713eb2000-05-18 20:53:31 +00001674# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1675# Add sys/socket.h to confdefs.h
1676cat >> confdefs.h <<\EOF
1677#ifdef HAVE_SYS_SOCKET_H
1678#include <sys/socket.h>
1679#endif
1680EOF
1681AC_CHECK_TYPE(socklen_t, int)
1682
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001683# Add Python/ prefix to LIBOBJS
1684libobjs=$LIBOBJS
1685LIBOBJS=
1686for obj in $libobjs; do
1687 LIBOBJS="$LIBOBJS Python/$obj"
1688done
1689
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001690#AC_MSG_CHECKING(for Modules/Setup)
1691#if test ! -f Modules/Setup ; then
1692# if test ! -d Modules ; then
1693# mkdir Modules
1694# fi
1695# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1696# AC_MSG_RESULT(creating)
1697#else
1698# AC_MSG_RESULT(already exists)
1699#fi
1700
1701AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001702SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001703AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001704for dir in $SRCDIRS; do
1705 if test ! -d $dir; then
1706 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001707 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001708done
1709AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001710
Guido van Rossum627b2d71993-12-24 10:39:16 +00001711# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001712AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001713
1714echo "creating Setup"
1715if test ! -f Modules/Setup
1716then
1717 cp $srcdir/Modules/Setup.dist Modules/Setup
1718fi
1719
1720echo "creating Setup.local"
1721if test ! -f Modules/Setup.local
1722then
1723 echo "# Edit this file for local setup changes" >Modules/Setup.local
1724fi
1725
1726echo "creating Makefile"
1727$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1728 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001729 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001730mv config.c Modules