blob: a2e05cf438cd7f193005ad17468f4ba9be8defb9 [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`
Martin v. Löwis130fb172001-07-19 11:00:41 +000055 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000056 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000057 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000058 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000059 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000060 ac_md_system=`echo $ac_sys_system |
61 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
62 ac_md_release=`echo $ac_sys_release |
63 tr -d '[/ ]' | sed 's/\..*//'`
Guido van Rossumb97ef171997-09-28 05:44:03 +000064 MACHDEP="$ac_md_system$ac_md_release"
Guido van Rossum4b6b5791996-09-09 20:09:34 +000065
Guido van Rossumbcd91e01997-03-20 20:46:29 +000066 case $MACHDEP in
Guido van Rossumb97ef171997-09-28 05:44:03 +000067 '') MACHDEP="unknown";;
Guido van Rossumb418f891996-07-30 18:06:02 +000068 esac
69fi
Guido van Rossum91922671997-10-09 20:24:13 +000070
71#
72# SGI compilers allow the specification of the both the ABI and the
73# ISA on the command line. Depending on the values of these switches,
74# different and often incompatable code will be generated.
75#
76# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
77# thus supply support for various ABI/ISA combinations. The MACHDEP
78# variable is also adjusted.
79#
80AC_SUBST(SGI_ABI)
81if test ! -z "$SGI_ABI"
82then
83 CC="cc $SGI_ABI"
84 LDFLAGS="$SGI_ABI $LDFLAGS"
85 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
86fi
Guido van Rossumb418f891996-07-30 18:06:02 +000087AC_MSG_RESULT($MACHDEP)
88
Guido van Rossum627b2d71993-12-24 10:39:16 +000089# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000090AC_MSG_CHECKING(for --without-gcc)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +000091AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000092 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000093 no) CC=cc
94 without_gcc=yes;;
95 yes) CC=gcc
96 without_gcc=no;;
97 *) CC=$withval
98 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000099 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +0000100 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +0000101 OSF1) CC=cc
102 without_gcc=;;
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000103 AIX*) CC=cc_r
104 without_gcc=;;
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000105 BeOS*)
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000106 case $BE_HOST_CPU in
107 ppc)
Fred Drake5790be12000-10-09 17:06:13 +0000108 CC=mwcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000109 without_gcc=yes
Fred Drake5790be12000-10-09 17:06:13 +0000110 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 +0000111 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000112 LDFLAGS="$LDFLAGS -nodup"
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000113 ;;
114 x86)
Fred Drake5790be12000-10-09 17:06:13 +0000115 CC=gcc
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000116 without_gcc=no
Fred Drake5790be12000-10-09 17:06:13 +0000117 OPT=-O
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000118 ;;
119 *)
Fred Drake5790be12000-10-09 17:06:13 +0000120 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000121 ;;
122 esac
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000123 AR="\$(srcdir)/Modules/ar_beos"
124 RANLIB=:
Guido van Rossum7a5f4201999-01-12 20:30:23 +0000125 ;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000126 Monterey*)
127 RANLIB=:
Martin v. Löwis130fb172001-07-19 11:00:41 +0000128 without_gcc=;;
129 *) without_gcc=no;;
Guido van Rossum55a214e1995-09-13 17:48:09 +0000130 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000131AC_MSG_RESULT($without_gcc)
132
Guido van Rossum27552902001-01-23 01:52:26 +0000133AC_SUBST(CXX)
Guido van Rossum95012191999-12-16 17:50:52 +0000134AC_SUBST(MAINOBJ)
Fred Drakea1a84e72001-03-06 05:52:16 +0000135MAINOBJ=python.o
Guido van Rossum95012191999-12-16 17:50:52 +0000136AC_MSG_CHECKING(for --with-cxx=<compiler>)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000137AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
Martin v. Löwis537970f2000-12-13 17:37:02 +0000138 check_cxx=no
Guido van Rossum95012191999-12-16 17:50:52 +0000139 case $withval in
140 no) CXX=
141 with_cxx=no;;
142 *) CXX=$withval
Fred Drakea1a84e72001-03-06 05:52:16 +0000143 MAINOBJ=ccpython.o
Guido van Rossum95012191999-12-16 17:50:52 +0000144 with_cxx=$withval;;
145 esac], [
146 with_cxx=no
Martin v. Löwis537970f2000-12-13 17:37:02 +0000147 check_cxx=yes
Guido van Rossum95012191999-12-16 17:50:52 +0000148])
149AC_MSG_RESULT($with_cxx)
Martin v. Löwis537970f2000-12-13 17:37:02 +0000150
151dnl The following fragment works similar to AC_PROG_CXX.
152dnl It does not fail if CXX is not found, and it is not executed if
153dnl --with-cxx was given.
154dnl Finally, it does not test whether CXX is g++.
155
156if test "$check_cxx" = "yes"
157then
158 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
159 if test "$CXX" = "notfound"
160 then
161 CXX=
162 else
163 AC_PROG_CXX_WORKS
164 fi
165fi
166
Guido van Rossum03ad99f1995-03-09 14:09:54 +0000167# If the user switches compilers, we can't believe the cache
168if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
169then
170 AC_ERROR(cached CC is different -- throw away $cache_file
171(it is also a good idea to do 'make clean' before compiling))
172fi
173
Guido van Rossum627b2d71993-12-24 10:39:16 +0000174AC_PROG_CC
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000175AC_EXEEXT
Neil Schemenauer3ae1d0a2001-01-27 06:54:42 +0000176AC_MSG_CHECKING(for --with-suffix)
177AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
178 case $withval in
179 no) EXEEXT=;;
180 yes) EXEEXT=.exe;;
181 *) EXEEXT=$withval;;
182 esac])
183AC_MSG_RESULT($EXEEXT)
Guido van Rossumfb842551997-08-06 23:42:07 +0000184
Guido van Rossumdd997f71998-10-07 19:58:26 +0000185case $MACHDEP in
186bsdos*)
187 case $CC in
188 gcc) CC="$CC -D_HAVE_BSDI";;
189 esac;;
190esac
191
Guido van Rossum84561611997-08-21 00:08:11 +0000192case $ac_sys_system in
193hp*|HP*)
194 case $CC in
Guido van Rossumcd5ff9f2000-09-22 16:15:54 +0000195 cc|*/cc) CC="$CC -Ae";;
Guido van Rossum84561611997-08-21 00:08:11 +0000196 esac;;
Trent Mick635f6fb2000-08-23 21:33:05 +0000197Monterey*)
198 case $CC in
199 cc) CC="$CC -Wl,-Bexport";;
200 esac;;
Martin v. Löwise8964d42001-03-06 12:09:07 +0000201SunOS*)
202 # Some functions have a prototype only with that define, e.g. confstr
203 AC_DEFINE(__EXTENSIONS__)
204 ;;
Guido van Rossum84561611997-08-21 00:08:11 +0000205esac
206
Martin v. Löwise8964d42001-03-06 12:09:07 +0000207
Neil Schemenauer61c51152001-01-26 16:18:16 +0000208AC_SUBST(LIBRARY)
209AC_MSG_CHECKING(LIBRARY)
210if test -z "$LIBRARY"
211then
212 LIBRARY='libpython$(VERSION).a'
213fi
214AC_MSG_RESULT($LIBRARY)
215
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000216# LDLIBRARY is the name of the library to link against (as opposed to the
217# name of the library into which to insert object files). On systems
218# without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
Guido van Rossumaef734b2001-01-10 21:09:12 +0000219# the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
220# shared (i.e., DLL) library.
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000221AC_SUBST(LDLIBRARY)
Guido van Rossum27552902001-01-23 01:52:26 +0000222AC_SUBST(DLLLIBRARY)
Neil Schemenauer61c51152001-01-26 16:18:16 +0000223LDLIBRARY="$LIBRARY"
Guido van Rossum27552902001-01-23 01:52:26 +0000224DLLLIBRARY=''
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000225
Guido van Rossumfb842551997-08-06 23:42:07 +0000226# LINKCC is the command that links the python executable -- default is $(CC).
Fred Drake5790be12000-10-09 17:06:13 +0000227# This is altered for AIX in order to build the export list before
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000228# linking.
Guido van Rossumfb842551997-08-06 23:42:07 +0000229AC_SUBST(LINKCC)
230AC_MSG_CHECKING(LINKCC)
231if test -z "$LINKCC"
232then
233 case $ac_sys_system in
234 AIX*)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000235 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000236 dgux*)
237 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000238 Monterey64*)
239 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
Guido van Rossum25f93031997-08-18 16:00:04 +0000240 *) LINKCC="\$(PURIFY) \$(CC)";;
Guido van Rossumfb842551997-08-06 23:42:07 +0000241 esac
242fi
243AC_MSG_RESULT($LINKCC)
244
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000245AC_MSG_CHECKING(LDLIBRARY)
246
247# NeXT framework builds require that the 'ar' library be converted into
248# a bundle using libtool.
249if test "$with_next_framework"
250then
251 LDLIBRARY='libpython$(VERSION).dylib'
252fi
253
254# DG/UX requires some fancy ld contortions to produce a .so from an .a
Fred Drake5790be12000-10-09 17:06:13 +0000255case $MACHDEP in
256dguxR4)
257 LDLIBRARY='libpython$(VERSION).so'
258 OPT="$OPT -pic"
259 ;;
260beos*)
261 LDLIBRARY='libpython$(VERSION).so'
262 ;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000263cygwin*)
264 LDLIBRARY='libpython$(VERSION).dll.a'
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000265 DLLLIBRARY='libpython$(VERSION).dll'
Guido van Rossumaef734b2001-01-10 21:09:12 +0000266 ;;
Fred Drake5790be12000-10-09 17:06:13 +0000267esac
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000268AC_MSG_RESULT($LDLIBRARY)
269
Guido van Rossum627b2d71993-12-24 10:39:16 +0000270AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000271AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000272AC_CHECK_PROGS(AR, ar aal, ar)
Neil Schemenauera42c8272001-03-31 00:01:55 +0000273
274case $MACHDEP in
275bsdos*)
276 # install -d does not work on BSDI
277 if test -z "$INSTALL"
278 then
279 INSTALL="${srcdir}/install-sh -c"
280 fi
281esac
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000282AC_PROG_INSTALL
Guido van Rossumb418f891996-07-30 18:06:02 +0000283
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000284# Not every filesystem supports hard links
285AC_SUBST(LN)
286if test -z "$LN" ; then
287 case $ac_sys_system in
288 BeOS*) LN="ln -s";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000289 CYGWIN*) LN="ln -s";;
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000290 *) LN=ln;;
291 esac
292fi
293
Fred Drake9f715822001-07-11 06:27:00 +0000294# Check for --with-pydebug
295AC_MSG_CHECKING(for --with-pydebug)
296AC_ARG_WITH(pydebug,
297[ --with-pydebug build with Py_DEBUG defined], [
298if test "$withval" != no
299then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
300else AC_MSG_RESULT(no); Py_DEBUG='false'
301fi],
302[AC_MSG_RESULT(no)])
303
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000304# Optimizer/debugger flags
Guido van Rossumb418f891996-07-30 18:06:02 +0000305AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +0000306if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000307then
Guido van Rossumb5875b61997-07-18 23:29:09 +0000308 case $GCC in
309 yes)
310 case $ac_cv_prog_cc_g in
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000311 yes)
Fred Drake9f715822001-07-11 06:27:00 +0000312 if test "$Py_DEBUG" = 'true' ; then
313 # Optimization messes up debuggers, so turn it off for
314 # debug builds.
315 OPT="-g -Wall -Wstrict-prototypes"
316 else
317 OPT="-g -O3 -Wall -Wstrict-prototypes"
318 fi;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000319 *)
Fred Drake9f715822001-07-11 06:27:00 +0000320 OPT="-O3 -Wall -Wstrict-prototypes";;
321 esac
322 ;;
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000323 *)
324 case $ac_sys_system in
325 UnixWare*)
326 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
327 *)
328 OPT="-O";;
Guido van Rossumb418f891996-07-30 18:06:02 +0000329 esac
Guido van Rossum2242f2f2001-04-11 20:58:20 +0000330 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000331fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000332
Trent Mick635f6fb2000-08-23 21:33:05 +0000333# The current (beta) Monterey compiler dies with optimizations
334case $ac_sys_system in
335Monterey*) OPT="";;
336esac
337
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000338if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000339then
340 OPT="$OPT $ac_arch_flags"
341fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000342# checks for UNIX variants that set C preprocessor variables
343AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000344AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000345
Guido van Rossum91922671997-10-09 20:24:13 +0000346AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
347AC_CACHE_VAL(ac_cv_opt_olimit_ok,
348[ac_save_cc="$CC"
349CC="$CC -OPT:Olimit=0"
350AC_TRY_RUN([int main() { return 0; }],
351 ac_cv_opt_olimit_ok=yes,
352 ac_cv_opt_olimit_ok=no)
353CC="$ac_save_cc"])
354AC_MSG_RESULT($ac_cv_opt_olimit_ok)
Guido van Rossum2efa34b1997-10-23 17:43:11 +0000355if test $ac_cv_opt_olimit_ok = yes; then
Guido van Rossum5839e582000-10-09 19:52:35 +0000356 case $ac_sys_system in
357 Darwin*) OPT="$OPT" ;;
358 *) OPT="$OPT -OPT:Olimit=0";;
359 esac
Guido van Rossumf8678121998-07-07 21:05:09 +0000360else
361 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
362 AC_CACHE_VAL(ac_cv_olimit_ok,
363 [ac_save_cc="$CC"
364 CC="$CC -Olimit 1500"
365 AC_TRY_RUN([int main() { return 0; }],
366 ac_cv_olimit_ok=yes,
367 ac_cv_olimit_ok=no)
368 CC="$ac_save_cc"])
369 AC_MSG_RESULT($ac_cv_olimit_ok)
370 if test $ac_cv_olimit_ok = yes; then
371 OPT="$OPT -Olimit 1500"
372 fi
Guido van Rossum201afe51997-05-14 21:14:44 +0000373fi
Guido van Rossumf8678121998-07-07 21:05:09 +0000374
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000375# Check for enable-ipv6
Martin v. Löwisb9268662001-07-18 16:24:30 +0000376# XXX definition of ss_family disabled until author clarifies rationale.
377# DEFS="$DEFS -Dss_family=__ss_family -Dss_len=__ss_len"
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000378AC_MSG_CHECKING([whether to enable ipv6])
379AC_ARG_ENABLE(ipv6,
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +0000380[ --enable-ipv6 Enable ipv6 (with ipv4) support
381 --disable-ipv6 Disable ipv6 support],
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000382[ case "$enableval" in
383 no)
384 AC_MSG_RESULT(no)
385 ipv6=no
386 ;;
387 *) AC_MSG_RESULT(yes)
388 AC_DEFINE(ENABLE_IPV6)
389 ipv6=yes
390 ;;
391 esac ],
392
Fred Drake9f715822001-07-11 06:27:00 +0000393 AC_TRY_RUN([ /* AF_INET6 available check */
Martin v. Löwis01dfdb32001-06-23 16:30:13 +0000394#include <sys/types.h>
395#include <sys/socket.h>
396main()
397{
398 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
399 exit(1);
400 else
401 exit(0);
402}
403],
404 AC_MSG_RESULT(yes)
405 AC_DEFINE(ENABLE_IPV6)
406 ipv6=yes,
407 AC_MSG_RESULT(no)
408 ipv6=no,
409 AC_MSG_RESULT(no)
410 ipv6=no
411))
412
413ipv6type=unknown
414ipv6lib=none
415ipv6trylibc=no
416
417if test "$ipv6" = "yes"; then
418 AC_MSG_CHECKING([ipv6 stack type])
419 for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do
420 case $i in
421 inria)
422 dnl http://www.kame.net/
423 AC_EGREP_CPP(yes, [dnl
424#include <netinet/in.h>
425#ifdef IPV6_INRIA_VERSION
426yes
427#endif],
428 [ipv6type=$i;
429 OPT="-DINET6 $OPT"])
430 ;;
431 kame)
432 dnl http://www.kame.net/
433 AC_EGREP_CPP(yes, [dnl
434#include <netinet/in.h>
435#ifdef __KAME__
436yes
437#endif],
438 [ipv6type=$i;
439 ipv6lib=inet6
440 ipv6libdir=/usr/local/v6/lib
441 ipv6trylibc=yes
442 OPT="-DINET6 $OPT"])
443 ;;
444 linux-glibc)
445 dnl http://www.v6.linux.or.jp/
446 AC_EGREP_CPP(yes, [dnl
447#include <features.h>
448#if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
449yes
450#endif],
451 [ipv6type=$i;
452 ipv6trylibc=yes
453 OPT="-DINET6 $OPT"])
454 ;;
455 linux-inet6)
456 dnl http://www.v6.linux.or.jp/
457 if test -d /usr/inet6; then
458 ipv6type=$i
459 ipv6lib=inet6
460 ipv6libdir=/usr/inet6/lib
461 OPT="-DINET6 -I/usr/inet6/include $OPT"
462 fi
463 ;;
464 toshiba)
465 AC_EGREP_CPP(yes, [dnl
466#include <sys/param.h>
467#ifdef _TOSHIBA_INET6
468yes
469#endif],
470 [ipv6type=$i;
471 ipv6lib=inet6;
472 ipv6libdir=/usr/local/v6/lib;
473 OPT="-DINET6 $OPT"])
474 ;;
475 v6d)
476 AC_EGREP_CPP(yes, [dnl
477#include </usr/local/v6/include/sys/v6config.h>
478#ifdef __V6D__
479yes
480#endif],
481 [ipv6type=$i;
482 ipv6lib=v6;
483 ipv6libdir=/usr/local/v6/lib;
484 OPT="-I/usr/local/v6/include $OPT"])
485 ;;
486 zeta)
487 AC_EGREP_CPP(yes, [dnl
488#include <sys/param.h>
489#ifdef _ZETA_MINAMI_INET6
490yes
491#endif],
492 [ipv6type=$i;
493 ipv6lib=inet6;
494 ipv6libdir=/usr/local/v6/lib;
495 OPT="-DINET6 $OPT"])
496 ;;
497 esac
498 if test "$ipv6type" != "unknown"; then
499 break
500 fi
501 done
502 AC_MSG_RESULT($ipv6type)
503fi
504
505if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
506 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
507 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
508 echo "using lib$ipv6lib"
509 else
510 if test $ipv6trylibc = "yes"; then
511 echo "using libc"
512 else
513 echo 'Fatal: no $ipv6lib library found. cannot continue.'
514 echo "You need to fetch lib$ipv6lib.a from appropriate"
515 echo 'ipv6 kit and compile beforehand.'
516 exit 1
517 fi
518 fi
519fi
520
Martin v. Löwis130fb172001-07-19 11:00:41 +0000521# -Kpthread, if available, provides the right #defines
522# and linker options to make pthread_create available
523AC_MSG_CHECKING(whether $CC accepts -Kpthread)
524AC_CACHE_VAL(ac_cv_kpthread,
525[ac_save_cc="$CC"
526CC="$CC -Kpthread"
527AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)],
528 ac_cv_kpthread=yes,
529 ac_cv_kpthread=no)
530CC="$ac_save_cc"])
531
532# GCC does not reject -Kpthread as an illegal option, it merely complains that
533# it is unrecognized
534if test "$GCC" = "yes"
535then ac_cv_kpthread="no, we have gcc"
536fi
537AC_MSG_RESULT($ac_cv_kpthread)
538
Fred Drakece81d592000-07-09 14:39:29 +0000539dnl # check for ANSI or K&R ("traditional") preprocessor
540dnl AC_MSG_CHECKING(for C preprocessor type)
541dnl AC_TRY_COMPILE([
542dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
543dnl int foo;
544dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
545dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
546dnl AC_MSG_RESULT($cpp_type)
Guido van Rossum300fda71996-08-19 21:58:16 +0000547
Guido van Rossum627b2d71993-12-24 10:39:16 +0000548# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000549AC_HEADER_STDC
Andrew M. Kuchling5821b772000-08-25 01:14:08 +0000550AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
Eric S. Raymond13603592001-01-16 15:01:26 +0000551signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
Fred Drake2ca5f3b2001-05-11 16:10:56 +0000552sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
Andrew M. Kuchling881fd902001-07-14 20:55:52 +0000553sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
Fred Drakeae90f8d2000-09-15 03:38:12 +0000554sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
Thomas Wouterse38b2f12001-07-11 22:35:31 +0000555ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000556AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000557
558# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000559was_it_defined=no
560AC_MSG_CHECKING(for clock_t in time.h)
561AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
562AC_MSG_RESULT($was_it_defined)
563
Guido van Rossum300fda71996-08-19 21:58:16 +0000564# Add some code to confdefs.h so that the test for off_t works on SCO
565cat >> confdefs.h <<\EOF
566#if defined(SCO_DS)
567#undef _OFF_T
568#endif
569EOF
570
Guido van Rossumef2255b2000-03-10 22:30:29 +0000571# Type availability checks
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000572AC_TYPE_MODE_T
573AC_TYPE_OFF_T
574AC_TYPE_PID_T
575AC_TYPE_SIGNAL
576AC_TYPE_SIZE_T
577AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000578
Guido van Rossumef2255b2000-03-10 22:30:29 +0000579# Sizes of various common basic types
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000580AC_CHECK_SIZEOF(int)
581AC_CHECK_SIZEOF(long)
Guido van Rossumfb4533c1998-10-02 14:39:42 +0000582AC_CHECK_SIZEOF(void *)
Guido van Rossumef2255b2000-03-10 22:30:29 +0000583AC_CHECK_SIZEOF(char)
584AC_CHECK_SIZEOF(short)
585AC_CHECK_SIZEOF(float)
586AC_CHECK_SIZEOF(double)
Fred Drakea3f6e912000-06-29 20:44:47 +0000587AC_CHECK_SIZEOF(fpos_t)
Guido van Rossumac405f61994-09-12 10:56:06 +0000588
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000589AC_MSG_CHECKING(for long long support)
590have_long_long=no
591AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
592AC_MSG_RESULT($have_long_long)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000593if test "$have_long_long" = yes ; then
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000594AC_CHECK_SIZEOF(long long)
595fi
596
Barry Warsawbc7c7f92000-08-18 04:53:33 +0000597AC_MSG_CHECKING(for uintptr_t support)
598have_uintptr_t=no
599AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
600AC_MSG_RESULT($have_uintptr_t)
601if test "$have_uintptr_t" = yes ; then
602AC_CHECK_SIZEOF(uintptr_t)
603fi
604
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000605# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
606AC_MSG_CHECKING(size of off_t)
607AC_CACHE_VAL(ac_cv_sizeof_off_t,
608[AC_TRY_RUN([#include <stdio.h>
609#include <sys/types.h>
610main()
611{
612 FILE *f=fopen("conftestval", "w");
613 if (!f) exit(1);
614 fprintf(f, "%d\n", sizeof(off_t));
615 exit(0);
616}], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
617])
618AC_MSG_RESULT($ac_cv_sizeof_off_t)
619AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
620
621AC_MSG_CHECKING(whether to enable large file support)
Guido van Rossum8bc1dfd1999-04-10 16:01:48 +0000622if test "$have_long_long" = yes -a \
623 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
624 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000625 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
626 AC_MSG_RESULT(yes)
627else
628 AC_MSG_RESULT(no)
629fi
630
Fred Drakea3f6e912000-06-29 20:44:47 +0000631# AC_CHECK_SIZEOF() doesn't include <time.h>.
632AC_MSG_CHECKING(size of time_t)
633AC_CACHE_VAL(ac_cv_sizeof_time_t,
634[AC_TRY_RUN([#include <stdio.h>
635#include <time.h>
636main()
637{
638 FILE *f=fopen("conftestval", "w");
639 if (!f) exit(1);
640 fprintf(f, "%d\n", sizeof(time_t));
641 exit(0);
642}], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
643])
644AC_MSG_RESULT($ac_cv_sizeof_time_t)
645AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
646
Guido van Rossum00f0f6e1999-01-06 18:52:29 +0000647
Trent Mick635f6fb2000-08-23 21:33:05 +0000648# if have pthread_t then define SIZEOF_PTHREAD_T
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000649ac_save_cc="$CC"
650if test "$ac_cv_kpthread" = "yes"
651then CC="$CC -Kpthread"
652fi
Trent Mick635f6fb2000-08-23 21:33:05 +0000653AC_MSG_CHECKING(for pthread_t)
654have_pthread_t=no
Guido van Rossum12580492000-09-24 16:47:19 +0000655AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
Trent Mick635f6fb2000-08-23 21:33:05 +0000656AC_MSG_RESULT($have_pthread_t)
657if test "$have_pthread_t" = yes ; then
658 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
659 AC_MSG_CHECKING(size of pthread_t)
660 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
661 [AC_TRY_RUN([#include <stdio.h>
662 #include <pthread.h>
663 main()
664 {
665 FILE *f=fopen("conftestval", "w");
666 if (!f) exit(1);
667 fprintf(f, "%d\n", sizeof(pthread_t));
668 exit(0);
669 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
670 ])
671 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
672 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
673fi
Martin v. Löwis123cbd22001-07-19 14:21:10 +0000674CC="$ac_save_cc"
Trent Mick635f6fb2000-08-23 21:33:05 +0000675
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000676# Minor variations in building a framework between NextStep versions 4 and 5
677AC_SUBST(LIBTOOL_CRUFT)
678case $ac_sys_system/$ac_sys_release in
Guido van Rossum5839e582000-10-09 19:52:35 +0000679 Darwin/*)
680 ns_undef_sym='_environ'
681 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000682 next/4*)
683 ns_undef_sym='__environ'
684 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
685 next/5*)
686 ns_undef_sym='_environ'
687 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
688esac
689
690AC_MSG_CHECKING(for --with-next-framework)
691if test "$with_next_framework"
692then
693 OPT="$OPT -fno-common"
694 # -U __environ is needed since bundles don't have access
695 # to crt0 when built but will always be linked against it
696 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
697 AC_DEFINE(WITH_NEXT_FRAMEWORK)
698 AC_MSG_RESULT(yes)
699else
700 AC_MSG_RESULT(no)
701fi
702
703AC_MSG_CHECKING(for --with-dyld)
704if test "$with_next_framework" -o "$with_dyld"
705then
706 if test "$with_dyld"
707 then
708 AC_MSG_RESULT(yes)
709 else
710 AC_MSG_RESULT(required for framework build)
711 fi
712 AC_DEFINE(WITH_DYLD)
713 ns_dyld='set'
714else
715 AC_MSG_RESULT(no)
716fi
717
Guido van Rossumac405f61994-09-12 10:56:06 +0000718# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000719AC_SUBST(SO)
720AC_SUBST(LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000721AC_SUBST(BLDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000722AC_SUBST(CCSHARED)
723AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000724# SO is the extension of shared libraries `(including the dot!)
Guido van Rossumaef734b2001-01-10 21:09:12 +0000725# -- usually .so, .sl on HP-UX, .dll on Cygwin
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000726AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000727if test -z "$SO"
728then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000729 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000730 hp*|HP*) SO=.sl;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000731 CYGWIN*) SO=.dll;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000732 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000733 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000734fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000735AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000736# LDSHARED is the ld *command* used to create shared library
737# -- "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 +0000738# (Shared libraries in this instance are shared modules to be loaded into
739# Python, as opposed to building Python itself as a shared library.)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000740AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000741if test -z "$LDSHARED"
742then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000743 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000744 AIX*)
745 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
746 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
747 ;;
748 BeOS*)
749 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
750 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
751 ;;
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000752 IRIX/5*) LDSHARED="ld -shared";;
Guido van Rossum91922671997-10-09 20:24:13 +0000753 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000754 SunOS/4*) LDSHARED="ld";;
Greg Ward57c9a6632000-05-26 12:22:54 +0000755 SunOS/5*)
756 if test "$GCC" = "yes"
Neil Schemenauer95052722001-02-19 18:17:33 +0000757 then LDSHARED='$(CC) -shared'
Greg Ward57c9a6632000-05-26 12:22:54 +0000758 else LDSHARED="ld -G";
759 fi ;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000760 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000761 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000762 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000763 Darwin/*|next/*)
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000764 if test "$ns_dyld"
Guido van Rossumacb14c72001-01-10 21:41:16 +0000765 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000766 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
767 fi
Guido van Rossum3dc0a512000-10-05 18:00:06 +0000768 if test "$with_next_framework" ; then
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000769 LDSHARED="$LDSHARED \$(LDLIBRARY)"
770 fi ;;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000771 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum3c4bb801997-12-18 23:55:32 +0000772 dgux*) LDSHARED="ld -G";;
Guido van Rossum458e7fa1999-09-17 15:40:40 +0000773 BSD/OS*/4*) LDSHARED="gcc -shared";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000774 OpenBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossumdf693651999-01-07 21:50:41 +0000775 NetBSD*)
776 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
777 then
778 LDSHARED="cc -shared"
779 else
780 LDSHARED="ld -Bshareable"
781 fi;;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000782 FreeBSD*)
Jeremy Hylton4bcc7c52000-08-31 17:45:35 +0000783 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
Guido van Rossum0286ae82000-08-29 15:06:49 +0000784 then
785 LDSHARED="cc -shared ${LDFLAGS}"
786 else
787 LDSHARED="ld -Bshareable ${LDFLAGS}"
788 fi;;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000789 UnixWare*)
790 if test "$GCC" = "yes"
791 then LDSHARED="$(CC) -shared"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000792 else LDSHARED="$(CC) -G"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000793 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000794 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000795 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000796 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000797 *) LDSHARED="ld";;
798 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000799fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000800AC_MSG_RESULT($LDSHARED)
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000801BLDSHARED=${BLDSHARED-$LDSHARED}
Guido van Rossumac405f61994-09-12 10:56:06 +0000802# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000803# library (module) -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000804AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000805if test -z "$CCSHARED"
806then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000807 case $ac_sys_system/$ac_sys_release in
Neil Schemenauer66252162001-02-19 04:47:42 +0000808 SunOS*) if test "$GCC" = yes;
809 then CCSHARED="-fPIC";
810 fi;;
Guido van Rossumaf07a441995-02-13 19:45:27 +0000811 hp*|HP*) if test "$GCC" = yes;
812 then CCSHARED="-fpic";
813 else CCSHARED="+z";
814 fi;;
Neil Schemenauer61c51152001-01-26 16:18:16 +0000815 Linux*) CCSHARED="-fPIC";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000816 BSD/OS*/4*) CCSHARED="-fpic";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000817 OpenBSD*) CCSHARED="-fpic";;
818 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
Martin v. Löwisbec19582001-03-21 15:57:54 +0000819 UnixWare*)
820 if test "$GCC" = "yes"
821 then CCSHARED="-fPIC"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000822 else CCSHARED="-KPIC"
Martin v. Löwisbec19582001-03-21 15:57:54 +0000823 fi;;
Guido van Rossum300fda71996-08-19 21:58:16 +0000824 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Trent Mick635f6fb2000-08-23 21:33:05 +0000825 Monterey*) CCSHARED="-G";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000826 IRIX*/6*) case $CC in
827 *gcc*) CCSHARED="-shared";;
Guido van Rossumee21f411998-04-20 18:51:54 +0000828 *) CCSHARED="";;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000829 esac;;
Guido van Rossumaef734b2001-01-10 21:09:12 +0000830 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000831 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000832fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000833AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000834# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000835# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000836AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000837if test -z "$LINKFORSHARED"
838then
Guido van Rossum6100aaf1997-04-29 21:48:51 +0000839 case $ac_sys_system/$ac_sys_release in
Neil Schemenauerb3531b82001-02-16 04:09:05 +0000840 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000841 hp*|HP*)
Guido van Rossum304dd2d1997-10-20 23:10:56 +0000842 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
Guido van Rossumf5957ea1999-10-05 21:59:33 +0000843 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum2d9feed1997-11-24 17:36:21 +0000844 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
Guido van Rossum54ecc3d1999-01-27 17:53:11 +0000845 # -u libsys_s pulls in all symbols in libsys
846 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
847 # -u __dummy makes the linker aware of the objc runtime
848 # in System.framework; otherwise, __objcInit (referenced in
849 # crt1.o) gets erroneously defined as common, which breaks dynamic
850 # loading of any modules which reference it in System.framework
851 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
Jack Jansenc49e5b72001-06-19 15:00:23 +0000852 Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;;
Martin v. Löwis130fb172001-07-19 11:00:41 +0000853 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000854 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Fred Drake02706f52000-09-25 15:08:46 +0000855 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
Guido van Rossum0286ae82000-08-29 15:06:49 +0000856 FreeBSD*|NetBSD*)
Guido van Rossumdf693651999-01-07 21:50:41 +0000857 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
858 then
859 LINKFORSHARED="-Wl,--export-dynamic"
860 fi;;
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000861 SunOS/5*) case $CC in
862 *gcc*)
Guido van Rossum9c6ba9b2000-02-03 13:42:50 +0000863 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
Guido van Rossum8f4ceb11997-12-18 23:42:19 +0000864 then
865 LINKFORSHARED="-Xlinker --export-dynamic"
Guido van Rossum2b5ca001998-03-05 15:41:09 +0000866 fi;;
867 esac;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000868 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000869fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000870AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000871
Neil Schemenauer61c51152001-01-26 16:18:16 +0000872AC_SUBST(CFLAGSFORSHARED)
873AC_MSG_CHECKING(CFLAGSFORSHARED)
874if test ! "$LIBRARY" = "$LDLIBRARY"
875then
Neil Schemenauerd9cf41c2001-01-27 21:39:17 +0000876 case $ac_sys_system in
877 CYGWIN*)
878 # Cygwin needs CCSHARED when building extension DLLs
879 # but not when building the interpreter DLL.
880 CFLAGSFORSHARED='';;
881 *)
882 CFLAGSFORSHARED='$(CCSHARED)'
883 esac
Neil Schemenauer61c51152001-01-26 16:18:16 +0000884fi
885AC_MSG_RESULT($CFLAGSFORSHARED)
886
Guido van Rossum627b2d71993-12-24 10:39:16 +0000887# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000888AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
889AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
Guido van Rossum0eefa3f1999-11-16 15:57:37 +0000890
891# checks for system dependent C++ extensions support
892case "$ac_sys_system" in
893 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
894 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
895 [loadAndInit("", 0, "")],
896 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
897 AC_MSG_RESULT(yes)],
898 [AC_MSG_RESULT(no)]);;
899 *) ;;
900esac
901
Guido van Rossum70c7f481998-03-26 18:44:10 +0000902# Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
903# However on SGI IRIX, these exist but are broken.
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000904# BeOS' sockets are stashed in libnet.
905case "$ac_sys_system" in
906IRIX*) ;;
Guido van Rossum2cb56601998-05-07 13:25:56 +0000907*)
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000908AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000909AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Jeremy Hyltoncb25d5e2000-07-27 21:23:28 +0000910;;
911esac
912case "$ac_sys_system" in
913BeOS*)
Guido van Rossumec95c7b1998-08-04 17:59:56 +0000914AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
915;;
916esac
Guido van Rossum70c7f481998-03-26 18:44:10 +0000917
Guido van Rossumc5a39031996-07-31 17:35:03 +0000918AC_MSG_CHECKING(for --with-libs)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000919AC_ARG_WITH(libs,
920[ --with-libs='lib1 ...' link against additional libs], [
Guido van Rossumc5a39031996-07-31 17:35:03 +0000921AC_MSG_RESULT($withval)
922LIBS="$withval $LIBS"
923], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000924
Neil Schemenauer55f0cf32001-01-24 17:24:33 +0000925# Determine if signalmodule should be used.
926AC_SUBST(USE_SIGNAL_MODULE)
927AC_SUBST(SIGNAL_OBJS)
928AC_MSG_CHECKING(for --with-signal-module)
929AC_ARG_WITH(signal-module,
930[ --with-signal-module disable/enable signal module])
931
932if test -z "$with_signal_module"
933then with_signal_module="yes"
934fi
935AC_MSG_RESULT($with_signal_module)
936
937if test "${with_signal_module}" = "yes"; then
938 USE_SIGNAL_MODULE=""
939 SIGNAL_OBJS=""
940else
941 USE_SIGNAL_MODULE="#"
942 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
943fi
944
Guido van Rossum3d15bd82001-01-10 18:53:48 +0000945# This is used to generate Setup.config
Guido van Rossum009f7871997-12-04 00:51:42 +0000946AC_SUBST(USE_THREAD_MODULE)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000947USE_THREAD_MODULE=""
Guido van Rossum009f7871997-12-04 00:51:42 +0000948
Guido van Rossum54d93d41997-01-22 20:51:58 +0000949AC_MSG_CHECKING(for --with-dec-threads)
950AC_SUBST(LDLAST)
951AC_ARG_WITH(dec-threads,
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000952[ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
953AC_MSG_RESULT($withval)
Guido van Rossum54d93d41997-01-22 20:51:58 +0000954LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000955if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000956 with_thread="$withval";
957fi],
958AC_MSG_RESULT(no))
959
960AC_MSG_CHECKING(for --with-threads)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000961AC_ARG_WITH(threads,
962[ --with(out)-threads[=DIRECTORY] disable/enable thread support])
Guido van Rossum54d93d41997-01-22 20:51:58 +0000963
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000964# --with-thread is deprecated, but check for it anyway
Barry Warsawa0f3c5c2000-06-30 16:39:35 +0000965AC_ARG_WITH(thread,
966[ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
967with_threads=$with_thread])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000968
969if test -z "$with_threads"
970then with_threads="yes"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000971fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000972AC_MSG_RESULT($with_threads)
Guido van Rossum6400c261997-05-22 20:34:27 +0000973
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000974if test "$with_threads" = "no"
975then
976 USE_THREAD_MODULE="#"
Martin v. Löwis130fb172001-07-19 11:00:41 +0000977elif test "$ac_cv_kpthread" = "yes"
978then
979 CC="$CC -Kpthread"
980 AC_DEFINE(WITH_THREAD)
981 AC_DEFINE(_POSIX_THREADS)
982 LIBOBJS="$LIBOBJS thread.o"
Barry Warsawc0d24d8b2000-06-29 16:12:00 +0000983else
Martin v. Löwis130fb172001-07-19 11:00:41 +0000984 if test ! -z "$with_threads" -a -d "$with_threads"
985 then LDFLAGS="$LDFLAGS -L$with_threads"
986 fi
987 if test ! -z "$withval" -a -d "$withval"
988 then LDFLAGS="$LDFLAGS -L$withval"
989 fi
990 AC_DEFINE(_REENTRANT)
991 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
992 AC_DEFINE(C_THREADS)
993 LIBOBJS="$LIBOBJS thread.o"],[
994 AC_MSG_CHECKING(for --with-pth)
995 AC_ARG_WITH(pth,
996 [ --with-pth use GNU pth threading libraries], [
997 AC_MSG_RESULT($withval)
998 AC_DEFINE(WITH_THREAD)
999 AC_DEFINE(HAVE_PTH)
1000 LIBS="-lpth $LIBS"
1001 LIBOBJS="$LIBOBJS thread.o"],[
1002 AC_MSG_RESULT(no)
1003 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
1004 AC_DEFINE(_POSIX_THREADS)
1005 LIBS="-lpthread $LIBS"
1006 LIBOBJS="$LIBOBJS thread.o"],[
1007 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1008 case $ac_sys_system in
1009 Darwin*) ;;
1010 *) AC_DEFINE(_POSIX_THREADS);;
1011 esac
1012 LIBOBJS="$LIBOBJS thread.o"],[
1013 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1014 AC_DEFINE(BEOS_THREADS)
1015 LIBOBJS="$LIBOBJS thread.o"],[
1016 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1017 AC_DEFINE(_POSIX_THREADS)
1018 LIBS="$LIBS -lpthreads"
1019 LIBOBJS="$LIBOBJS thread.o"], [
1020 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1021 AC_DEFINE(_POSIX_THREADS)
1022 LIBS="$LIBS -lc_r"
1023 LIBOBJS="$LIBOBJS thread.o"], [
1024 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1025 AC_DEFINE(_POSIX_THREADS)
1026 LIBS="$LIBS -lthread"
1027 LIBOBJS="$LIBOBJS thread.o"], [
1028 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1029 AC_DEFINE(_POSIX_THREADS)
1030 LIBS="$LIBS -lpthread"
1031 LIBOBJS="$LIBOBJS thread.o"], [
1032 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1033 AC_DEFINE(_POSIX_THREADS)
1034 LIBS="$LIBS -lcma"
1035 LIBOBJS="$LIBOBJS thread.o"],[
1036 USE_THREAD_MODULE="#"])
1037 ])])])])])])])])])
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001038
Martin v. Löwis130fb172001-07-19 11:00:41 +00001039 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1040 LIBS="$LIBS -lmpc"
1041 LIBOBJS="$LIBOBJS thread.o"
1042 USE_THREAD_MODULE=""])
1043 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1044 LIBS="$LIBS -lthread"
1045 LIBOBJS="$LIBOBJS thread.o"
1046 USE_THREAD_MODULE=""])
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001047
Martin v. Löwis130fb172001-07-19 11:00:41 +00001048 if test "$USE_THREAD_MODULE" != "#"
1049 then
1050 # If the above checks didn't disable threads, (at least) OSF1
1051 # needs this '-threads' argument during linking.
1052 case $ac_sys_system in
1053 OSF1) LDLAST=-threads;;
1054 esac
Jeremy Hylton1a2ca862000-10-16 16:59:12 +00001055 fi
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001056fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001057
Barry Warsawef82cd72000-06-30 16:21:01 +00001058# Check for GC support
1059AC_SUBST(USE_GC_MODULE)
1060USE_GC_MODULE=""
1061AC_MSG_CHECKING(for --with-cycle-gc)
1062AC_ARG_WITH(cycle-gc,
1063[ --with(out)-cycle-gc disable/enable garbage collection])
1064
1065if test -z "$with_cycle_gc"
1066then with_cycle_gc="yes"
1067fi
1068if test "$with_cycle_gc" = "no"
1069then
1070 USE_GC_MODULE="#"
1071else
1072 AC_DEFINE(WITH_CYCLE_GC)
1073fi
1074AC_MSG_RESULT($with_cycle_gc)
1075
Neil Schemenauera35c6882001-02-27 04:45:05 +00001076# Check for Python-specific malloc support
1077AC_MSG_CHECKING(for --with-pymalloc)
1078AC_ARG_WITH(pymalloc,
1079[ --with(out)-pymalloc disable/enable specialized mallocs], [
1080if test "$withval" != no
1081then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1082else AC_MSG_RESULT(no)
1083fi],
1084[AC_MSG_RESULT(no)])
1085
Barry Warsawef82cd72000-06-30 16:21:01 +00001086# Check for --with-wctype-functions
1087AC_MSG_CHECKING(for --with-wctype-functions)
1088AC_ARG_WITH(wctype-functions,
1089[ --with-wctype-functions use wctype.h functions], [
1090if test "$withval" != no
1091then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1092else AC_MSG_RESULT(no)
1093fi],
1094[AC_MSG_RESULT(no)])
1095
Guido van Rossum68242b51996-05-28 22:53:03 +00001096# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001097AC_SUBST(DLINCLDIR)
1098DLINCLDIR=/
1099
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001100AC_MSG_CHECKING(for --with-sgi-dl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001101AC_ARG_WITH(sgi-dl,
1102[ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001103AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001104AC_DEFINE(WITH_SGI_DL)
Guido van Rossume97ee181999-12-20 21:27:22 +00001105DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001106dldir=$withval
Guido van Rossum40951012000-10-07 16:21:27 +00001107if test ! -z "$dldir" -a -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001108then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001109else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1110fi
1111DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001112LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001113
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001114AC_MSG_CHECKING(for --with-dl-dld)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001115AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001116AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001117AC_DEFINE(WITH_DL_DLD)
Guido van Rossume97ee181999-12-20 21:27:22 +00001118DYNLOADFILE="dynload_dl.o"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001119dldir=`echo "$withval" | sed 's/,.*//'`
1120dlddir=`echo "$withval" | sed 's/.*,//'`
Barry Warsaw7d1219d2000-10-05 18:45:53 +00001121if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +00001122then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001123else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1124fi
1125DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001126LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +00001127
Guido van Rossume97ee181999-12-20 21:27:22 +00001128# the dlopen() function means we might want to use dynload_shlib.o. some
1129# platforms, such as AIX, have dlopen(), but don't want to use it.
Thomas Wouters3a584202000-08-05 23:28:51 +00001130AC_CHECK_FUNCS(dlopen)
Guido van Rossume97ee181999-12-20 21:27:22 +00001131
1132# DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1133# loading of modules.
1134AC_SUBST(DYNLOADFILE)
1135AC_MSG_CHECKING(DYNLOADFILE)
1136if test -z "$DYNLOADFILE"
1137then
1138 case $ac_sys_system/$ac_sys_release in
1139 AIX*) DYNLOADFILE="dynload_aix.o";;
1140 BeOS*) DYNLOADFILE="dynload_beos.o";;
1141 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
Guido van Rossum5839e582000-10-09 19:52:35 +00001142 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
Guido van Rossume97ee181999-12-20 21:27:22 +00001143 *)
1144 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1145 # out any dynamic loading
1146 if test "$ac_cv_func_dlopen" = yes
1147 then DYNLOADFILE="dynload_shlib.o"
1148 else DYNLOADFILE="dynload_stub.o"
1149 fi
1150 ;;
1151 esac
1152fi
1153AC_MSG_RESULT($DYNLOADFILE)
1154if test "$DYNLOADFILE" != "dynload_stub.o"
1155then
1156 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1157fi
1158
Jack Jansenc49e5b72001-06-19 15:00:23 +00001159# MACHDEP_OBJS can be set to platform-specific object files needed by Python
1160
1161AC_SUBST(MACHDEP_OBJS)
1162AC_MSG_CHECKING(MACHDEP_OBJS)
1163if test -z "$MACHDEP_OBJS"
1164then
1165 case $ac_sys_system/$ac_sys_release in
1166 Darwin/*)
1167 MACHDEP_OBJS="Mac/Python/macglue.o"
1168 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
1169 ;;
1170 *) MACHDEP_OBJS="";;
1171 esac
1172fi
1173AC_MSG_RESULT($DYNLOADFILE)
1174
Guido van Rossum627b2d71993-12-24 10:39:16 +00001175# checks for library functions
Thomas Wouters3a584202000-08-05 23:28:51 +00001176AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
Fred Drake35a092f1999-12-13 16:23:35 +00001177 flock fork fsync fdatasync fpathconf ftime ftruncate \
Andrew M. Kuchlinga9586c72001-01-08 17:58:56 +00001178 getgroups getlogin getpeername getpid getpwent getwd \
Martin v. Löwisb9ab1592001-06-24 21:18:26 +00001179 inet_pton kill link lstat mkfifo mktime mremap \
Andrew M. Kuchling5821b772000-08-25 01:14:08 +00001180 nice pathconf pause plock poll pthread_init \
Fred Drake35a092f1999-12-13 16:23:35 +00001181 putenv readlink \
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +00001182 select setegid seteuid setgid \
Thomas Wouters3a584202000-08-05 23:28:51 +00001183 setlocale setregid setreuid setsid setpgid setuid setvbuf \
Fred Drake35a092f1999-12-13 16:23:35 +00001184 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
Fred Drake89143df1999-12-09 22:03:25 +00001185 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
Thomas Woutersc2c12dc2001-07-11 14:45:34 +00001186 truncate uname waitpid _getpty getpriority)
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001187
Fred Drake8cef4cf2000-06-28 16:40:38 +00001188# check for openpty and forkpty
1189
1190AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1191AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1192
Guido van Rossum00f0f6e1999-01-06 18:52:29 +00001193# check for long file support functions
1194AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1195
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001196AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Thomas Wouters3a584202000-08-05 23:28:51 +00001197AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1198AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1199AC_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 +00001200
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001201AC_CHECK_FUNCS(getaddrinfo, [dnl
1202AC_MSG_CHECKING(getaddrinfo bug)
1203AC_TRY_RUN([
1204#include <sys/types.h>
1205#include <netdb.h>
1206#include <string.h>
1207#include <sys/socket.h>
1208#include <netinet/in.h>
1209
1210main()
1211{
1212 int passive, gaierr, inet4 = 0, inet6 = 0;
1213 struct addrinfo hints, *ai, *aitop;
1214 char straddr[INET6_ADDRSTRLEN], strport[16];
1215
1216 for (passive = 0; passive <= 1; passive++) {
1217 memset(&hints, 0, sizeof(hints));
1218 hints.ai_family = AF_UNSPEC;
1219 hints.ai_flags = passive ? AI_PASSIVE : 0;
1220 hints.ai_socktype = SOCK_STREAM;
1221 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1222 (void)gai_strerror(gaierr);
1223 goto bad;
1224 }
1225 for (ai = aitop; ai; ai = ai->ai_next) {
1226 if (ai->ai_addr == NULL ||
1227 ai->ai_addrlen == 0 ||
1228 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1229 straddr, sizeof(straddr), strport, sizeof(strport),
1230 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1231 goto bad;
1232 }
1233 switch (ai->ai_family) {
1234 case AF_INET:
1235 if (strcmp(strport, "54321") != 0) {
1236 goto bad;
1237 }
1238 if (passive) {
1239 if (strcmp(straddr, "0.0.0.0") != 0) {
1240 goto bad;
1241 }
1242 } else {
1243 if (strcmp(straddr, "127.0.0.1") != 0) {
1244 goto bad;
1245 }
1246 }
1247 inet4++;
1248 break;
1249 case AF_INET6:
1250 if (strcmp(strport, "54321") != 0) {
1251 goto bad;
1252 }
1253 if (passive) {
1254 if (strcmp(straddr, "::") != 0) {
1255 goto bad;
1256 }
1257 } else {
1258 if (strcmp(straddr, "::1") != 0) {
1259 goto bad;
1260 }
1261 }
1262 inet6++;
1263 break;
1264 case AF_UNSPEC:
1265 goto bad;
1266 break;
1267 default:
1268 /* another family support? */
1269 break;
1270 }
1271 }
1272 }
1273
1274 if (!(inet4 == 0 || inet4 == 2))
1275 goto bad;
1276 if (!(inet6 == 0 || inet6 == 2))
1277 goto bad;
1278
1279 if (aitop)
1280 freeaddrinfo(aitop);
1281 exit(0);
1282
1283 bad:
1284 if (aitop)
1285 freeaddrinfo(aitop);
1286 exit(1);
1287}
1288],
1289AC_MSG_RESULT(good)
1290buggygetaddrinfo=no,
1291AC_MSG_RESULT(buggy)
1292buggygetaddrinfo=yes,
1293AC_MSG_RESULT(buggy)
1294buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
1295
1296if test "$buggygetaddrinfo" = "yes"; then
1297 if test "$ipv6" = "yes"; then
1298 echo 'Fatal: You must get working getaddrinfo() function.'
1299 echo ' or you can specify "--disable-ipv6"'.
1300 exit 1
1301 fi
1302fi
1303AC_CHECK_FUNCS(getaddrinfo getnameinfo)
1304
Guido van Rossum627b2d71993-12-24 10:39:16 +00001305# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001306AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +00001307AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001308AC_STRUCT_TIMEZONE
1309
1310AC_MSG_CHECKING(for time.h that defines altzone)
1311AC_CACHE_VAL(ac_cv_header_time_altzone,
1312[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1313 ac_cv_header_time_altzone=yes,
1314 ac_cv_header_time_altzone=no)])
1315AC_MSG_RESULT($ac_cv_header_time_altzone)
1316if test $ac_cv_header_time_altzone = yes; then
1317 AC_DEFINE(HAVE_ALTZONE)
1318fi
1319
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001320was_it_defined=no
1321AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001322AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001323#include <sys/types.h>
1324#include <sys/select.h>
1325#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001326], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1327AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001328
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001329AC_MSG_CHECKING(for addrinfo)
1330AC_CACHE_VAL(ac_cv_struct_addrinfo,
1331AC_TRY_COMPILE([
1332# include <netdb.h>],
1333 [struct addrinfo a],
1334 ac_cv_struct_addrinfo=yes,
1335 ac_cv_struct_addrinfo=no))
1336AC_MSG_RESULT($ac_cv_struct_addrinfo)
1337if test $ac_cv_struct_addrinfo = yes; then
1338 AC_DEFINE(HAVE_ADDRINFO)
1339fi
1340
1341AC_MSG_CHECKING(for sockaddr_storage)
1342AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1343AC_TRY_COMPILE([
1344# include <sys/types.h>
1345# include <sys/socket.h>],
1346 [struct sockaddr_storage s],
1347 ac_cv_struct_sockaddr_storage=yes,
1348 ac_cv_struct_sockaddr_storage=no))
1349AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1350if test $ac_cv_struct_sockaddr_storage = yes; then
1351 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1352fi
1353
Guido van Rossum627b2d71993-12-24 10:39:16 +00001354# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001355
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001356AC_C_CHAR_UNSIGNED
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001357AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001358
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001359works=no
1360AC_MSG_CHECKING(for working volatile)
1361AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1362AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +00001363
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001364works=no
1365AC_MSG_CHECKING(for working signed char)
1366AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1367AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001368
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001369have_prototypes=no
1370AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001371AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1372AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001373AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001374
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001375works=no
1376AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001377AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001378#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +00001379int foo(int x, ...) {
1380 va_list va;
1381 va_start(va, x);
1382 va_arg(va, int);
1383 va_arg(va, char *);
1384 va_arg(va, double);
1385 return 0;
1386}
1387], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001388AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1389AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001390
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001391if test "$have_prototypes" = yes; then
1392bad_prototypes=no
1393AC_MSG_CHECKING(for bad exec* prototypes)
1394AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1395 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1396AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +00001397fi
1398
Martin v. Löwis01dfdb32001-06-23 16:30:13 +00001399# check if sockaddr has sa_len member
1400AC_MSG_CHECKING(if sockaddr has sa_len member)
1401AC_TRY_COMPILE([#include <sys/types.h>
1402#include <sys/socket.h>],
1403[struct sockaddr x;
1404x.sa_len = 0;],
1405 AC_MSG_RESULT(yes)
1406 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1407 AC_MSG_RESULT(no))
1408
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001409bad_forward=no
1410AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001411AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001412struct s { int a; int b; };
1413static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001414int foobar() {
1415 static int random;
1416 random = (int) &foo;
1417 return random;
1418}
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001419static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +00001420main() {
1421 exit(!((int)&foo == foobar()));
1422}
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001423], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1424AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001425
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001426va_list_is_array=no
1427AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001428AC_TRY_COMPILE([
1429#ifdef HAVE_STDARG_PROTOTYPES
1430#include <stdarg.h>
1431#else
1432#include <varargs.h>
1433#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +00001434], [va_list list1, list2; list1 = list2;], ,
1435AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1436AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001437
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001438# sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1439AC_CHECK_FUNC(gethostbyname_r, [
1440 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1441 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1442 OLD_CFLAGS=$CFLAGS
1443 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1444 AC_TRY_COMPILE([
1445# include <netdb.h>
1446 ], [
1447 char *name;
1448 struct hostent *he, *res;
1449 char buffer[2048];
1450 int buflen = 2048;
1451 int h_errnop;
1452
1453 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1454 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001455 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001456 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1457 AC_MSG_RESULT(yes)
1458 ], [
1459 AC_MSG_RESULT(no)
1460 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1461 AC_TRY_COMPILE([
1462# include <netdb.h>
1463 ], [
1464 char *name;
1465 struct hostent *he;
1466 char buffer[2048];
1467 int buflen = 2048;
1468 int h_errnop;
1469
1470 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1471 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001472 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001473 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1474 AC_MSG_RESULT(yes)
1475 ], [
1476 AC_MSG_RESULT(no)
1477 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1478 AC_TRY_COMPILE([
1479# include <netdb.h>
1480 ], [
1481 char *name;
1482 struct hostent *he;
1483 struct hostent_data data;
1484
1485 (void) gethostbyname_r(name, he, &data);
1486 ], [
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001487 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001488 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1489 AC_MSG_RESULT(yes)
1490 ], [
1491 AC_MSG_RESULT(no)
1492 ])
1493 ])
1494 ])
1495 CFLAGS=$OLD_CFLAGS
1496], [
Thomas Wouters3a584202000-08-05 23:28:51 +00001497 AC_CHECK_FUNCS(gethostbyname)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001498])
1499AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1500AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1501AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
Guido van Rossum8db7d8b1999-03-23 16:40:33 +00001502AC_SUBST(HAVE_GETHOSTBYNAME_R)
Guido van Rossuma96f0ba1999-03-22 21:49:51 +00001503AC_SUBST(HAVE_GETHOSTBYNAME)
1504
Guido van Rossum627b2d71993-12-24 10:39:16 +00001505# checks for system services
1506# (none yet)
1507
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001508# Linux requires this for correct f.p. operations
Jeremy Hyltonbe28f5b2000-07-27 21:03:04 +00001509AC_CHECK_FUNC(__fpu_control,
1510 [],
1511 [AC_CHECK_LIB(ieee, __fpu_control)
1512])
Guido van Rossum627b2d71993-12-24 10:39:16 +00001513
Guido van Rossum93274221997-05-09 02:42:00 +00001514# Check for --with-fpectl
Guido van Rossum93274221997-05-09 02:42:00 +00001515AC_MSG_CHECKING(for --with-fpectl)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001516AC_ARG_WITH(fpectl,
1517[ --with-fpectl enable SIGFPE catching], [
Guido van Rossum93274221997-05-09 02:42:00 +00001518if test "$withval" != no
1519then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1520else AC_MSG_RESULT(no)
Guido van Rossumef2255b2000-03-10 22:30:29 +00001521fi],
1522[AC_MSG_RESULT(no)])
Guido van Rossum93274221997-05-09 02:42:00 +00001523
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001524# check for --with-libm=...
1525AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001526case $ac_sys_system in
Guido van Rossum3dc0a512000-10-05 18:00:06 +00001527Darwin) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001528next) ;;
Guido van Rossumec95c7b1998-08-04 17:59:56 +00001529BeOS) ;;
Guido van Rossum4b6b5791996-09-09 20:09:34 +00001530*) LIBM=-lm
1531esac
Guido van Rossum93274221997-05-09 02:42:00 +00001532AC_MSG_CHECKING(for --with-libm=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001533AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001534if test "$withval" = no
1535then LIBM=
1536 AC_MSG_RESULT(force LIBM empty)
1537elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001538then LIBM=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001539 AC_MSG_RESULT(set LIBM=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001540else AC_ERROR(proper usage is --with-libm=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001541fi],
1542[AC_MSG_RESULT(default LIBM=\"$LIBM\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001543
1544# check for --with-libc=...
1545AC_SUBST(LIBC)
Guido van Rossum93274221997-05-09 02:42:00 +00001546AC_MSG_CHECKING(for --with-libc=STRING)
Barry Warsawc0d24d8b2000-06-29 16:12:00 +00001547AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
Guido van Rossum93274221997-05-09 02:42:00 +00001548if test "$withval" = no
1549then LIBC=
1550 AC_MSG_RESULT(force LIBC empty)
1551elif test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001552then LIBC=$withval
Guido van Rossum93274221997-05-09 02:42:00 +00001553 AC_MSG_RESULT(set LIBC=\"$withval\")
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001554else AC_ERROR(proper usage is --with-libc=STRING)
Guido van Rossum93274221997-05-09 02:42:00 +00001555fi],
1556[AC_MSG_RESULT(default LIBC=\"$LIBC\")])
Guido van Rossum433c8ad1994-08-01 12:07:07 +00001557
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001558# check for hypot() in math library
1559LIBS_SAVE=$LIBS
1560LIBS="$LIBS $LIBM"
Guido van Rossumf2f7eb31996-08-30 15:18:00 +00001561AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +00001562LIBS=$LIBS_SAVE
1563
Guido van Rossumad713701997-07-10 22:42:38 +00001564# check whether malloc(0) returns NULL or not
Guido van Rossumad713701997-07-10 22:42:38 +00001565AC_MSG_CHECKING(what malloc(0) returns)
1566AC_CACHE_VAL(ac_cv_malloc_zero,
1567[AC_TRY_RUN([#include <stdio.h>
1568#ifdef HAVE_STDLIB
1569#include <stdlib.h>
1570#else
1571char *malloc(), *realloc();
1572int *free();
1573#endif
1574main() {
1575 char *p;
1576 p = malloc(0);
1577 if (p == NULL) exit(1);
1578 p = realloc(p, 0);
1579 if (p == NULL) exit(1);
1580 free(p);
1581 exit(0);
1582}], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1583AC_MSG_RESULT($ac_cv_malloc_zero)
1584if test "$ac_cv_malloc_zero" = null
1585then
1586 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1587fi
1588
Guido van Rossumef2255b2000-03-10 22:30:29 +00001589# check for wchar.h
1590AC_CHECK_HEADER(wchar.h,
1591AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1592wchar_h="no"
1593)
1594
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001595# determine wchar_t size
1596if test "$wchar_h" = yes
1597then
1598 AC_CHECK_SIZEOF(wchar_t)
1599fi
1600
1601AC_MSG_CHECKING(what type to use for unicode)
1602AC_ARG_ENABLE(unicode,
1603[ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1604
1605if test $enable_unicode = yes
1606then
Martin v. Löwisfd917792001-06-27 20:22:04 +00001607 # Without any arguments, Py_UNICODE defaults to two-byte mode
1608 enable_unicode="ucs2"
Martin v. Löwis0ba70cc2001-06-26 22:22:37 +00001609fi
1610
1611case "$enable_unicode" in
1612ucs2) unicode_size="2"
1613 AC_DEFINE(Py_UNICODE_SIZE,2)
1614 ;;
1615ucs4) unicode_size="4"
1616 AC_DEFINE(Py_UNICODE_SIZE,4)
1617 ;;
1618esac
1619
1620if test "$enable_unicode" = "no"
1621then
1622 AC_MSG_RESULT(not used)
1623else
1624 AC_DEFINE(Py_USING_UNICODE)
1625 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1626 then
1627 PY_UNICODE_TYPE="wchar_t"
1628 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1629 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1630 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1631 then
1632 PY_UNICODE_TYPE="unsigned short"
1633 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1634 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1635 then
1636 PY_UNICODE_TYPE="unsigned long"
1637 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1638 else
1639 PY_UNICODE_TYPE="no type found"
1640 fi
1641 AC_MSG_RESULT($PY_UNICODE_TYPE)
1642fi
Guido van Rossumef2255b2000-03-10 22:30:29 +00001643
1644# check for endianness
1645AC_C_BIGENDIAN
1646
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001647# Check whether right shifting a negative integer extends the sign bit
1648# or fills with zeros (like the Cray J90, according to Tim Peters).
1649AC_MSG_CHECKING(whether right shift extends the sign bit)
Vladimir Marangozova6180282000-07-12 05:05:06 +00001650AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001651AC_TRY_RUN([
1652int main()
1653{
Vladimir Marangozova6180282000-07-12 05:05:06 +00001654 exit(((-1)>>3 == -1) ? 0 : 1);
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001655}
Vladimir Marangozova6180282000-07-12 05:05:06 +00001656], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1657AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1658if test "$ac_cv_rshift_extends_sign" = no
1659then
1660 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1661fi
1662
Guido van Rossumcadfaec2001-01-05 14:45:49 +00001663# check for getc_unlocked and related locking functions
1664AC_MSG_CHECKING(for getc_unlocked() and friends)
1665AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1666AC_TRY_LINK([#include <stdio.h>],[
1667 FILE *f = fopen("/dev/null", "r");
1668 flockfile(f);
1669 getc_unlocked(f);
1670 funlockfile(f);
1671], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1672AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1673if test "$ac_cv_have_getc_unlocked" = yes
1674then
1675 AC_DEFINE(HAVE_GETC_UNLOCKED)
1676fi
Vladimir Marangozov9a5a5d12000-07-12 03:02:16 +00001677
Guido van Rossum353ae582001-07-10 16:45:32 +00001678# check for readline 4.2
1679AC_CHECK_LIB(readline, rl_completion_matches,
1680 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1681
Thomas Wouterse38b2f12001-07-11 22:35:31 +00001682AC_MSG_CHECKING(for broken nice())
1683AC_CACHE_VAL(ac_cv_broken_nice, [
1684AC_TRY_RUN([
1685int main()
1686{
1687 int val1 = nice(1);
1688 if (val1 != -1 && val1 == nice(2))
1689 exit(0);
1690 exit(1);
1691}
1692],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)])
1693AC_MSG_RESULT($ac_cv_broken_nice)
1694if test "$ac_cv_broken_nice" = yes
1695then
1696 AC_DEFINE(HAVE_BROKEN_NICE)
1697fi
1698
Guido van Rossum95713eb2000-05-18 20:53:31 +00001699# THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1700# Add sys/socket.h to confdefs.h
1701cat >> confdefs.h <<\EOF
1702#ifdef HAVE_SYS_SOCKET_H
1703#include <sys/socket.h>
1704#endif
1705EOF
1706AC_CHECK_TYPE(socklen_t, int)
1707
Neil Schemenauerf25cf6c2001-03-04 06:39:33 +00001708# Add Python/ prefix to LIBOBJS
1709libobjs=$LIBOBJS
1710LIBOBJS=
1711for obj in $libobjs; do
1712 LIBOBJS="$LIBOBJS Python/$obj"
1713done
1714
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001715#AC_MSG_CHECKING(for Modules/Setup)
1716#if test ! -f Modules/Setup ; then
1717# if test ! -d Modules ; then
1718# mkdir Modules
1719# fi
1720# cp "$srcdir/Modules/Setup.dist" Modules/Setup
1721# AC_MSG_RESULT(creating)
1722#else
1723# AC_MSG_RESULT(already exists)
1724#fi
1725
1726AC_SUBST(SRCDIRS)
Neil Schemenaueracbf9ef2001-02-27 02:15:14 +00001727SRCDIRS="Parser Grammar Objects Python Modules"
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001728AC_MSG_CHECKING(for build directories)
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001729for dir in $SRCDIRS; do
1730 if test ! -d $dir; then
1731 mkdir $dir
Fred Drake884d3ba2000-11-02 17:52:56 +00001732 fi
Neil Schemenauer55f0cf32001-01-24 17:24:33 +00001733done
1734AC_MSG_RESULT(done)
Fred Drake036144d2000-10-26 17:09:35 +00001735
Guido van Rossum627b2d71993-12-24 10:39:16 +00001736# generate output files
Andrew M. Kuchling8abedde2001-01-26 22:55:24 +00001737AC_OUTPUT(Makefile.pre Modules/Setup.config)
Neil Schemenauer61c51152001-01-26 16:18:16 +00001738
1739echo "creating Setup"
1740if test ! -f Modules/Setup
1741then
1742 cp $srcdir/Modules/Setup.dist Modules/Setup
1743fi
1744
1745echo "creating Setup.local"
1746if test ! -f Modules/Setup.local
1747then
1748 echo "# Edit this file for local setup changes" >Modules/Setup.local
1749fi
1750
1751echo "creating Makefile"
1752$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1753 -s Modules Modules/Setup.config \
Neil Schemenauerf8b71c52001-04-21 17:41:16 +00001754 Modules/Setup.local Modules/Setup
Neil Schemenauer66252162001-02-19 04:47:42 +00001755mv config.c Modules