Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf 2.0 or later to make a configure script. |
| 2 | AC_REVISION($Revision$) |
| 3 | AC_PREREQ(2.0) |
Guido van Rossum | 6085e32 | 1993-12-26 18:24:40 +0000 | [diff] [blame] | 4 | AC_INIT(Include/object.h) |
Martin v. Löwis | 4f1cd8b | 2001-07-26 13:41:06 +0000 | [diff] [blame] | 5 | AC_CONFIG_HEADER(pyconfig.h) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 6 | |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 7 | # Set VERSION so we only need to edit in one place (i.e., here) |
| 8 | AC_SUBST(VERSION) |
Guido van Rossum | 6db412b | 2001-04-18 04:37:57 +0000 | [diff] [blame] | 9 | VERSION=2.2 |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 10 | |
Neil Schemenauer | 4edbc2a | 2001-03-22 00:34:03 +0000 | [diff] [blame] | 11 | # Arguments passed to configure. |
| 12 | AC_SUBST(CONFIG_ARGS) |
| 13 | CONFIG_ARGS="$ac_configure_args" |
| 14 | |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 15 | # NEXTSTEP|MacOSX|Darwin stuff |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 16 | if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 17 | |
| 18 | AC_MSG_CHECKING(for --with-next-archs) |
| 19 | AC_ARG_WITH(next-archs, |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 20 | [ --with-next-archs='arch1 arch2 ..' build MAB binary], [ |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 21 | if test -n "$withval"; then |
Guido van Rossum | 2bb4f55 | 1996-09-10 18:19:59 +0000 | [diff] [blame] | 22 | 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 Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 25 | 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 Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 31 | ac_sys_system=`uname -s` |
| 32 | if test "$ac_sys_system" = "Darwin" ; then |
| 33 | ac_sys_release=`uname -r` |
| 34 | else |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 35 | set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \ |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 36 | sed -e 's/://' -e 's/\./_/'` && \ |
| 37 | ac_sys_system=next && ac_sys_release=$4 |
| 38 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 39 | |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 40 | MACHDEP="$ac_sys_system$ac_sys_release" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 41 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 42 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 43 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 44 | AC_ARG_WITH(next-framework, |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 45 | [ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 46 | AC_ARG_WITH(dyld, |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 47 | [ --with-dyld Use (OpenStep|Rhapsody|MacOSX|Darwin) dynamic linker],,) |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 48 | |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 49 | # Set name for machine-dependent library files |
| 50 | AC_SUBST(MACHDEP) |
| 51 | AC_MSG_CHECKING(MACHDEP) |
| 52 | if test -z "$MACHDEP" |
| 53 | then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 54 | ac_sys_system=`uname -s` |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 55 | if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 56 | ac_sys_release=`uname -v` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 57 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 58 | ac_sys_release=`uname -r` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 59 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 60 | 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 Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 64 | MACHDEP="$ac_md_system$ac_md_release" |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 65 | |
Guido van Rossum | bcd91e0 | 1997-03-20 20:46:29 +0000 | [diff] [blame] | 66 | case $MACHDEP in |
Andrew M. Kuchling | 5a3e4cb | 2001-07-20 19:29:04 +0000 | [diff] [blame] | 67 | cygwin*) MACHDEP="cygwin";; |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 68 | '') MACHDEP="unknown";; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 69 | esac |
| 70 | fi |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 71 | |
| 72 | # |
| 73 | # SGI compilers allow the specification of the both the ABI and the |
| 74 | # ISA on the command line. Depending on the values of these switches, |
| 75 | # different and often incompatable code will be generated. |
| 76 | # |
| 77 | # The SGI_ABI variable can be used to modify the CC and LDFLAGS and |
| 78 | # thus supply support for various ABI/ISA combinations. The MACHDEP |
| 79 | # variable is also adjusted. |
| 80 | # |
| 81 | AC_SUBST(SGI_ABI) |
| 82 | if test ! -z "$SGI_ABI" |
| 83 | then |
| 84 | CC="cc $SGI_ABI" |
| 85 | LDFLAGS="$SGI_ABI $LDFLAGS" |
| 86 | MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` |
| 87 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 88 | AC_MSG_RESULT($MACHDEP) |
| 89 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 90 | # checks for alternative programs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 91 | AC_MSG_CHECKING(for --without-gcc) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 92 | AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 93 | case $withval in |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 94 | no) CC=cc |
| 95 | without_gcc=yes;; |
| 96 | yes) CC=gcc |
| 97 | without_gcc=no;; |
| 98 | *) CC=$withval |
| 99 | without_gcc=$withval;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 100 | esac], [ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 101 | case $ac_sys_system in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 102 | AIX*) CC=cc_r |
| 103 | without_gcc=;; |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 104 | BeOS*) |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 105 | case $BE_HOST_CPU in |
| 106 | ppc) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 107 | CC=mwcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 108 | without_gcc=yes |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 109 | OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma" |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 110 | CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 111 | LDFLAGS="$LDFLAGS -nodup" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 112 | ;; |
| 113 | x86) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 114 | CC=gcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 115 | without_gcc=no |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 116 | OPT=-O |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 117 | ;; |
| 118 | *) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 119 | AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\") |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 120 | ;; |
| 121 | esac |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 122 | AR="\$(srcdir)/Modules/ar_beos" |
| 123 | RANLIB=: |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 124 | ;; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 125 | Monterey*) |
| 126 | RANLIB=: |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 127 | without_gcc=;; |
| 128 | *) without_gcc=no;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 129 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 130 | AC_MSG_RESULT($without_gcc) |
| 131 | |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 132 | AC_SUBST(CXX) |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 133 | AC_SUBST(MAINOBJ) |
Fred Drake | a1a84e7 | 2001-03-06 05:52:16 +0000 | [diff] [blame] | 134 | MAINOBJ=python.o |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 135 | AC_MSG_CHECKING(for --with-cxx=<compiler>) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 136 | AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[ |
Martin v. Löwis | 537970f | 2000-12-13 17:37:02 +0000 | [diff] [blame] | 137 | check_cxx=no |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 138 | case $withval in |
| 139 | no) CXX= |
| 140 | with_cxx=no;; |
| 141 | *) CXX=$withval |
Fred Drake | a1a84e7 | 2001-03-06 05:52:16 +0000 | [diff] [blame] | 142 | MAINOBJ=ccpython.o |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 143 | with_cxx=$withval;; |
| 144 | esac], [ |
| 145 | with_cxx=no |
Martin v. Löwis | 537970f | 2000-12-13 17:37:02 +0000 | [diff] [blame] | 146 | check_cxx=yes |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 147 | ]) |
| 148 | AC_MSG_RESULT($with_cxx) |
Martin v. Löwis | 537970f | 2000-12-13 17:37:02 +0000 | [diff] [blame] | 149 | |
| 150 | dnl The following fragment works similar to AC_PROG_CXX. |
| 151 | dnl It does not fail if CXX is not found, and it is not executed if |
| 152 | dnl --with-cxx was given. |
| 153 | dnl Finally, it does not test whether CXX is g++. |
| 154 | |
| 155 | if test "$check_cxx" = "yes" |
| 156 | then |
| 157 | AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound) |
| 158 | if test "$CXX" = "notfound" |
| 159 | then |
| 160 | CXX= |
| 161 | else |
| 162 | AC_PROG_CXX_WORKS |
| 163 | fi |
| 164 | fi |
| 165 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 166 | # If the user switches compilers, we can't believe the cache |
| 167 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 168 | then |
| 169 | AC_ERROR(cached CC is different -- throw away $cache_file |
| 170 | (it is also a good idea to do 'make clean' before compiling)) |
| 171 | fi |
| 172 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 173 | AC_PROG_CC |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 174 | AC_EXEEXT |
Neil Schemenauer | 3ae1d0a | 2001-01-27 06:54:42 +0000 | [diff] [blame] | 175 | AC_MSG_CHECKING(for --with-suffix) |
| 176 | AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[ |
| 177 | case $withval in |
| 178 | no) EXEEXT=;; |
| 179 | yes) EXEEXT=.exe;; |
| 180 | *) EXEEXT=$withval;; |
| 181 | esac]) |
| 182 | AC_MSG_RESULT($EXEEXT) |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 183 | |
Guido van Rossum | dd997f7 | 1998-10-07 19:58:26 +0000 | [diff] [blame] | 184 | case $MACHDEP in |
| 185 | bsdos*) |
| 186 | case $CC in |
| 187 | gcc) CC="$CC -D_HAVE_BSDI";; |
| 188 | esac;; |
| 189 | esac |
| 190 | |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 191 | case $ac_sys_system in |
| 192 | hp*|HP*) |
| 193 | case $CC in |
Guido van Rossum | cd5ff9f | 2000-09-22 16:15:54 +0000 | [diff] [blame] | 194 | cc|*/cc) CC="$CC -Ae";; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 195 | esac;; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 196 | Monterey*) |
| 197 | case $CC in |
| 198 | cc) CC="$CC -Wl,-Bexport";; |
| 199 | esac;; |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 200 | SunOS*) |
| 201 | # Some functions have a prototype only with that define, e.g. confstr |
| 202 | AC_DEFINE(__EXTENSIONS__) |
| 203 | ;; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 204 | esac |
| 205 | |
Martin v. Löwis | e8964d4 | 2001-03-06 12:09:07 +0000 | [diff] [blame] | 206 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 207 | AC_SUBST(LIBRARY) |
| 208 | AC_MSG_CHECKING(LIBRARY) |
| 209 | if test -z "$LIBRARY" |
| 210 | then |
| 211 | LIBRARY='libpython$(VERSION).a' |
| 212 | fi |
| 213 | AC_MSG_RESULT($LIBRARY) |
| 214 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 215 | # LDLIBRARY is the name of the library to link against (as opposed to the |
| 216 | # name of the library into which to insert object files). On systems |
| 217 | # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 218 | # the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the |
| 219 | # shared (i.e., DLL) library. |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 220 | AC_SUBST(LDLIBRARY) |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 221 | AC_SUBST(DLLLIBRARY) |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 222 | LDLIBRARY="$LIBRARY" |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 223 | DLLLIBRARY='' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 224 | |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 225 | # LINKCC is the command that links the python executable -- default is $(CC). |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 226 | # This is altered for AIX in order to build the export list before |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 227 | # linking. |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 228 | AC_SUBST(LINKCC) |
| 229 | AC_MSG_CHECKING(LINKCC) |
| 230 | if test -z "$LINKCC" |
| 231 | then |
| 232 | case $ac_sys_system in |
| 233 | AIX*) |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 234 | LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 235 | dgux*) |
| 236 | LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 237 | Monterey64*) |
| 238 | LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";; |
Guido van Rossum | 25f9303 | 1997-08-18 16:00:04 +0000 | [diff] [blame] | 239 | *) LINKCC="\$(PURIFY) \$(CC)";; |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 240 | esac |
| 241 | fi |
| 242 | AC_MSG_RESULT($LINKCC) |
| 243 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 244 | AC_MSG_CHECKING(LDLIBRARY) |
| 245 | |
| 246 | # NeXT framework builds require that the 'ar' library be converted into |
| 247 | # a bundle using libtool. |
| 248 | if test "$with_next_framework" |
| 249 | then |
| 250 | LDLIBRARY='libpython$(VERSION).dylib' |
| 251 | fi |
| 252 | |
| 253 | # DG/UX requires some fancy ld contortions to produce a .so from an .a |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 254 | case $MACHDEP in |
| 255 | dguxR4) |
| 256 | LDLIBRARY='libpython$(VERSION).so' |
| 257 | OPT="$OPT -pic" |
| 258 | ;; |
| 259 | beos*) |
| 260 | LDLIBRARY='libpython$(VERSION).so' |
| 261 | ;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 262 | cygwin*) |
| 263 | LDLIBRARY='libpython$(VERSION).dll.a' |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 264 | DLLLIBRARY='libpython$(VERSION).dll' |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 265 | ;; |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 266 | esac |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 267 | AC_MSG_RESULT($LDLIBRARY) |
| 268 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 269 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 270 | AC_SUBST(AR) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 271 | AC_CHECK_PROGS(AR, ar aal, ar) |
Neil Schemenauer | a42c827 | 2001-03-31 00:01:55 +0000 | [diff] [blame] | 272 | |
| 273 | case $MACHDEP in |
| 274 | bsdos*) |
| 275 | # install -d does not work on BSDI |
| 276 | if test -z "$INSTALL" |
| 277 | then |
| 278 | INSTALL="${srcdir}/install-sh -c" |
| 279 | fi |
| 280 | esac |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 281 | AC_PROG_INSTALL |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 282 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 283 | # Not every filesystem supports hard links |
| 284 | AC_SUBST(LN) |
| 285 | if test -z "$LN" ; then |
| 286 | case $ac_sys_system in |
| 287 | BeOS*) LN="ln -s";; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 288 | CYGWIN*) LN="ln -s";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 289 | *) LN=ln;; |
| 290 | esac |
| 291 | fi |
| 292 | |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 293 | # Check for --with-pydebug |
| 294 | AC_MSG_CHECKING(for --with-pydebug) |
| 295 | AC_ARG_WITH(pydebug, |
| 296 | [ --with-pydebug build with Py_DEBUG defined], [ |
| 297 | if test "$withval" != no |
| 298 | then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true' |
| 299 | else AC_MSG_RESULT(no); Py_DEBUG='false' |
| 300 | fi], |
| 301 | [AC_MSG_RESULT(no)]) |
| 302 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 303 | # Optimizer/debugger flags |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 304 | AC_SUBST(OPT) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 305 | if test -z "$OPT" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 306 | then |
Guido van Rossum | b5875b6 | 1997-07-18 23:29:09 +0000 | [diff] [blame] | 307 | case $GCC in |
| 308 | yes) |
| 309 | case $ac_cv_prog_cc_g in |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 310 | yes) |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 311 | if test "$Py_DEBUG" = 'true' ; then |
| 312 | # Optimization messes up debuggers, so turn it off for |
| 313 | # debug builds. |
| 314 | OPT="-g -Wall -Wstrict-prototypes" |
| 315 | else |
| 316 | OPT="-g -O3 -Wall -Wstrict-prototypes" |
| 317 | fi;; |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 318 | *) |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 319 | OPT="-O3 -Wall -Wstrict-prototypes";; |
| 320 | esac |
| 321 | ;; |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 322 | *) |
| 323 | case $ac_sys_system in |
| 324 | UnixWare*) |
| 325 | OPT="-O -K pentium,host,inline,loop_unroll,alloca ";; |
| 326 | *) |
| 327 | OPT="-O";; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 328 | esac |
Guido van Rossum | 2242f2f | 2001-04-11 20:58:20 +0000 | [diff] [blame] | 329 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 330 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 331 | |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 332 | # The current (beta) Monterey compiler dies with optimizations |
| 333 | case $ac_sys_system in |
| 334 | Monterey*) OPT="";; |
| 335 | esac |
| 336 | |
Guido van Rossum | 6f2260e | 1996-09-09 16:21:03 +0000 | [diff] [blame] | 337 | if test "$ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 338 | then |
| 339 | OPT="$OPT $ac_arch_flags" |
| 340 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 341 | # checks for UNIX variants that set C preprocessor variables |
| 342 | AC_AIX |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 343 | AC_MINIX |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 344 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 345 | AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) |
| 346 | AC_CACHE_VAL(ac_cv_opt_olimit_ok, |
| 347 | [ac_save_cc="$CC" |
| 348 | CC="$CC -OPT:Olimit=0" |
| 349 | AC_TRY_RUN([int main() { return 0; }], |
| 350 | ac_cv_opt_olimit_ok=yes, |
| 351 | ac_cv_opt_olimit_ok=no) |
| 352 | CC="$ac_save_cc"]) |
| 353 | AC_MSG_RESULT($ac_cv_opt_olimit_ok) |
Guido van Rossum | 2efa34b | 1997-10-23 17:43:11 +0000 | [diff] [blame] | 354 | if test $ac_cv_opt_olimit_ok = yes; then |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 355 | case $ac_sys_system in |
| 356 | Darwin*) OPT="$OPT" ;; |
| 357 | *) OPT="$OPT -OPT:Olimit=0";; |
| 358 | esac |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 359 | else |
| 360 | AC_MSG_CHECKING(whether $CC accepts -Olimit 1500) |
| 361 | AC_CACHE_VAL(ac_cv_olimit_ok, |
| 362 | [ac_save_cc="$CC" |
| 363 | CC="$CC -Olimit 1500" |
| 364 | AC_TRY_RUN([int main() { return 0; }], |
| 365 | ac_cv_olimit_ok=yes, |
| 366 | ac_cv_olimit_ok=no) |
| 367 | CC="$ac_save_cc"]) |
| 368 | AC_MSG_RESULT($ac_cv_olimit_ok) |
| 369 | if test $ac_cv_olimit_ok = yes; then |
| 370 | OPT="$OPT -Olimit 1500" |
| 371 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 372 | fi |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 373 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 374 | # Check for enable-ipv6 |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 375 | AC_MSG_CHECKING([whether to enable ipv6]) |
| 376 | AC_ARG_ENABLE(ipv6, |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 377 | [ --enable-ipv6 Enable ipv6 (with ipv4) support |
| 378 | --disable-ipv6 Disable ipv6 support], |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 379 | [ case "$enableval" in |
| 380 | no) |
| 381 | AC_MSG_RESULT(no) |
| 382 | ipv6=no |
| 383 | ;; |
| 384 | *) AC_MSG_RESULT(yes) |
| 385 | AC_DEFINE(ENABLE_IPV6) |
| 386 | ipv6=yes |
| 387 | ;; |
| 388 | esac ], |
| 389 | |
Fred Drake | 9f71582 | 2001-07-11 06:27:00 +0000 | [diff] [blame] | 390 | AC_TRY_RUN([ /* AF_INET6 available check */ |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 391 | #include <sys/types.h> |
| 392 | #include <sys/socket.h> |
| 393 | main() |
| 394 | { |
| 395 | if (socket(AF_INET6, SOCK_STREAM, 0) < 0) |
| 396 | exit(1); |
| 397 | else |
| 398 | exit(0); |
| 399 | } |
| 400 | ], |
| 401 | AC_MSG_RESULT(yes) |
| 402 | AC_DEFINE(ENABLE_IPV6) |
| 403 | ipv6=yes, |
| 404 | AC_MSG_RESULT(no) |
| 405 | ipv6=no, |
| 406 | AC_MSG_RESULT(no) |
| 407 | ipv6=no |
| 408 | )) |
| 409 | |
| 410 | ipv6type=unknown |
| 411 | ipv6lib=none |
| 412 | ipv6trylibc=no |
| 413 | |
| 414 | if test "$ipv6" = "yes"; then |
| 415 | AC_MSG_CHECKING([ipv6 stack type]) |
| 416 | for i in inria kame linux-glibc linux-inet6 toshiba v6d zeta; do |
| 417 | case $i in |
| 418 | inria) |
| 419 | dnl http://www.kame.net/ |
| 420 | AC_EGREP_CPP(yes, [dnl |
| 421 | #include <netinet/in.h> |
| 422 | #ifdef IPV6_INRIA_VERSION |
| 423 | yes |
| 424 | #endif], |
| 425 | [ipv6type=$i; |
| 426 | OPT="-DINET6 $OPT"]) |
| 427 | ;; |
| 428 | kame) |
| 429 | dnl http://www.kame.net/ |
| 430 | AC_EGREP_CPP(yes, [dnl |
| 431 | #include <netinet/in.h> |
| 432 | #ifdef __KAME__ |
| 433 | yes |
| 434 | #endif], |
| 435 | [ipv6type=$i; |
| 436 | ipv6lib=inet6 |
| 437 | ipv6libdir=/usr/local/v6/lib |
| 438 | ipv6trylibc=yes |
| 439 | OPT="-DINET6 $OPT"]) |
| 440 | ;; |
| 441 | linux-glibc) |
| 442 | dnl http://www.v6.linux.or.jp/ |
| 443 | AC_EGREP_CPP(yes, [dnl |
| 444 | #include <features.h> |
| 445 | #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)) |
| 446 | yes |
| 447 | #endif], |
| 448 | [ipv6type=$i; |
| 449 | ipv6trylibc=yes |
| 450 | OPT="-DINET6 $OPT"]) |
| 451 | ;; |
| 452 | linux-inet6) |
| 453 | dnl http://www.v6.linux.or.jp/ |
| 454 | if test -d /usr/inet6; then |
| 455 | ipv6type=$i |
| 456 | ipv6lib=inet6 |
| 457 | ipv6libdir=/usr/inet6/lib |
| 458 | OPT="-DINET6 -I/usr/inet6/include $OPT" |
| 459 | fi |
| 460 | ;; |
| 461 | toshiba) |
| 462 | AC_EGREP_CPP(yes, [dnl |
| 463 | #include <sys/param.h> |
| 464 | #ifdef _TOSHIBA_INET6 |
| 465 | yes |
| 466 | #endif], |
| 467 | [ipv6type=$i; |
| 468 | ipv6lib=inet6; |
| 469 | ipv6libdir=/usr/local/v6/lib; |
| 470 | OPT="-DINET6 $OPT"]) |
| 471 | ;; |
| 472 | v6d) |
| 473 | AC_EGREP_CPP(yes, [dnl |
| 474 | #include </usr/local/v6/include/sys/v6config.h> |
| 475 | #ifdef __V6D__ |
| 476 | yes |
| 477 | #endif], |
| 478 | [ipv6type=$i; |
| 479 | ipv6lib=v6; |
| 480 | ipv6libdir=/usr/local/v6/lib; |
| 481 | OPT="-I/usr/local/v6/include $OPT"]) |
| 482 | ;; |
| 483 | zeta) |
| 484 | AC_EGREP_CPP(yes, [dnl |
| 485 | #include <sys/param.h> |
| 486 | #ifdef _ZETA_MINAMI_INET6 |
| 487 | yes |
| 488 | #endif], |
| 489 | [ipv6type=$i; |
| 490 | ipv6lib=inet6; |
| 491 | ipv6libdir=/usr/local/v6/lib; |
| 492 | OPT="-DINET6 $OPT"]) |
| 493 | ;; |
| 494 | esac |
| 495 | if test "$ipv6type" != "unknown"; then |
| 496 | break |
| 497 | fi |
| 498 | done |
| 499 | AC_MSG_RESULT($ipv6type) |
| 500 | fi |
| 501 | |
| 502 | if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then |
| 503 | if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then |
| 504 | LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" |
| 505 | echo "using lib$ipv6lib" |
| 506 | else |
| 507 | if test $ipv6trylibc = "yes"; then |
| 508 | echo "using libc" |
| 509 | else |
| 510 | echo 'Fatal: no $ipv6lib library found. cannot continue.' |
| 511 | echo "You need to fetch lib$ipv6lib.a from appropriate" |
| 512 | echo 'ipv6 kit and compile beforehand.' |
| 513 | exit 1 |
| 514 | fi |
| 515 | fi |
| 516 | fi |
| 517 | |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 518 | # -Kpthread, if available, provides the right #defines |
| 519 | # and linker options to make pthread_create available |
| 520 | AC_MSG_CHECKING(whether $CC accepts -Kpthread) |
| 521 | AC_CACHE_VAL(ac_cv_kpthread, |
| 522 | [ac_save_cc="$CC" |
| 523 | CC="$CC -Kpthread" |
| 524 | AC_TRY_LINK([#include <pthread.h>],[pthread_create(0,0,0,0)], |
| 525 | ac_cv_kpthread=yes, |
| 526 | ac_cv_kpthread=no) |
| 527 | CC="$ac_save_cc"]) |
| 528 | |
| 529 | # GCC does not reject -Kpthread as an illegal option, it merely complains that |
| 530 | # it is unrecognized |
| 531 | if test "$GCC" = "yes" |
| 532 | then ac_cv_kpthread="no, we have gcc" |
| 533 | fi |
| 534 | AC_MSG_RESULT($ac_cv_kpthread) |
| 535 | |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 536 | dnl # check for ANSI or K&R ("traditional") preprocessor |
| 537 | dnl AC_MSG_CHECKING(for C preprocessor type) |
| 538 | dnl AC_TRY_COMPILE([ |
| 539 | dnl #define spam(name, doc) {#name, &name, #name "() -- " doc} |
| 540 | dnl int foo; |
| 541 | dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); |
| 542 | dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional) |
| 543 | dnl AC_MSG_RESULT($cpp_type) |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 544 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 545 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 546 | AC_HEADER_STDC |
Andrew M. Kuchling | 5821b77 | 2000-08-25 01:14:08 +0000 | [diff] [blame] | 547 | AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ |
Eric S. Raymond | 1360359 | 2001-01-16 15:01:26 +0000 | [diff] [blame] | 548 | signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ |
Fred Drake | 2ca5f3b | 2001-05-11 16:10:56 +0000 | [diff] [blame] | 549 | sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ |
Andrew M. Kuchling | 881fd90 | 2001-07-14 20:55:52 +0000 | [diff] [blame] | 550 | sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ |
Fred Drake | ae90f8d | 2000-09-15 03:38:12 +0000 | [diff] [blame] | 551 | sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 552 | ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 553 | AC_HEADER_DIRENT |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 554 | |
| 555 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 556 | was_it_defined=no |
| 557 | AC_MSG_CHECKING(for clock_t in time.h) |
| 558 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long)) |
| 559 | AC_MSG_RESULT($was_it_defined) |
| 560 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 561 | # Add some code to confdefs.h so that the test for off_t works on SCO |
| 562 | cat >> confdefs.h <<\EOF |
| 563 | #if defined(SCO_DS) |
| 564 | #undef _OFF_T |
| 565 | #endif |
| 566 | EOF |
| 567 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 568 | # Type availability checks |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 569 | AC_TYPE_MODE_T |
| 570 | AC_TYPE_OFF_T |
| 571 | AC_TYPE_PID_T |
| 572 | AC_TYPE_SIGNAL |
| 573 | AC_TYPE_SIZE_T |
| 574 | AC_TYPE_UID_T |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 575 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 576 | # Sizes of various common basic types |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 577 | AC_CHECK_SIZEOF(int) |
| 578 | AC_CHECK_SIZEOF(long) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 579 | AC_CHECK_SIZEOF(void *) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 580 | AC_CHECK_SIZEOF(char) |
| 581 | AC_CHECK_SIZEOF(short) |
| 582 | AC_CHECK_SIZEOF(float) |
| 583 | AC_CHECK_SIZEOF(double) |
Fred Drake | a3f6e91 | 2000-06-29 20:44:47 +0000 | [diff] [blame] | 584 | AC_CHECK_SIZEOF(fpos_t) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 585 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 586 | AC_MSG_CHECKING(for long long support) |
| 587 | have_long_long=no |
| 588 | AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes) |
| 589 | AC_MSG_RESULT($have_long_long) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 590 | if test "$have_long_long" = yes ; then |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 591 | AC_CHECK_SIZEOF(long long) |
| 592 | fi |
| 593 | |
Barry Warsaw | bc7c7f9 | 2000-08-18 04:53:33 +0000 | [diff] [blame] | 594 | AC_MSG_CHECKING(for uintptr_t support) |
| 595 | have_uintptr_t=no |
| 596 | AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes) |
| 597 | AC_MSG_RESULT($have_uintptr_t) |
| 598 | if test "$have_uintptr_t" = yes ; then |
| 599 | AC_CHECK_SIZEOF(uintptr_t) |
| 600 | fi |
| 601 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 602 | # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>. |
| 603 | AC_MSG_CHECKING(size of off_t) |
| 604 | AC_CACHE_VAL(ac_cv_sizeof_off_t, |
| 605 | [AC_TRY_RUN([#include <stdio.h> |
| 606 | #include <sys/types.h> |
| 607 | main() |
| 608 | { |
| 609 | FILE *f=fopen("conftestval", "w"); |
| 610 | if (!f) exit(1); |
| 611 | fprintf(f, "%d\n", sizeof(off_t)); |
| 612 | exit(0); |
| 613 | }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0) |
| 614 | ]) |
| 615 | AC_MSG_RESULT($ac_cv_sizeof_off_t) |
| 616 | AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t) |
| 617 | |
| 618 | AC_MSG_CHECKING(whether to enable large file support) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 619 | if test "$have_long_long" = yes -a \ |
| 620 | "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ |
| 621 | "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 622 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT) |
| 623 | AC_MSG_RESULT(yes) |
| 624 | else |
| 625 | AC_MSG_RESULT(no) |
| 626 | fi |
| 627 | |
Fred Drake | a3f6e91 | 2000-06-29 20:44:47 +0000 | [diff] [blame] | 628 | # AC_CHECK_SIZEOF() doesn't include <time.h>. |
| 629 | AC_MSG_CHECKING(size of time_t) |
| 630 | AC_CACHE_VAL(ac_cv_sizeof_time_t, |
| 631 | [AC_TRY_RUN([#include <stdio.h> |
| 632 | #include <time.h> |
| 633 | main() |
| 634 | { |
| 635 | FILE *f=fopen("conftestval", "w"); |
| 636 | if (!f) exit(1); |
| 637 | fprintf(f, "%d\n", sizeof(time_t)); |
| 638 | exit(0); |
| 639 | }], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0) |
| 640 | ]) |
| 641 | AC_MSG_RESULT($ac_cv_sizeof_time_t) |
| 642 | AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t) |
| 643 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 644 | |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 645 | # if have pthread_t then define SIZEOF_PTHREAD_T |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 646 | ac_save_cc="$CC" |
| 647 | if test "$ac_cv_kpthread" = "yes" |
| 648 | then CC="$CC -Kpthread" |
| 649 | fi |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 650 | AC_MSG_CHECKING(for pthread_t) |
| 651 | have_pthread_t=no |
Guido van Rossum | 1258049 | 2000-09-24 16:47:19 +0000 | [diff] [blame] | 652 | AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes) |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 653 | AC_MSG_RESULT($have_pthread_t) |
| 654 | if test "$have_pthread_t" = yes ; then |
| 655 | # AC_CHECK_SIZEOF() doesn't include <pthread.h>. |
| 656 | AC_MSG_CHECKING(size of pthread_t) |
| 657 | AC_CACHE_VAL(ac_cv_sizeof_pthread_t, |
| 658 | [AC_TRY_RUN([#include <stdio.h> |
| 659 | #include <pthread.h> |
| 660 | main() |
| 661 | { |
| 662 | FILE *f=fopen("conftestval", "w"); |
| 663 | if (!f) exit(1); |
| 664 | fprintf(f, "%d\n", sizeof(pthread_t)); |
| 665 | exit(0); |
| 666 | }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0) |
| 667 | ]) |
| 668 | AC_MSG_RESULT($ac_cv_sizeof_pthread_t) |
| 669 | AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t) |
| 670 | fi |
Martin v. Löwis | 123cbd2 | 2001-07-19 14:21:10 +0000 | [diff] [blame] | 671 | CC="$ac_save_cc" |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 672 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 673 | # Minor variations in building a framework between NextStep versions 4 and 5 |
| 674 | AC_SUBST(LIBTOOL_CRUFT) |
| 675 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 676 | Darwin/*) |
| 677 | ns_undef_sym='_environ' |
| 678 | LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 679 | next/4*) |
| 680 | ns_undef_sym='__environ' |
| 681 | LIBTOOL_CRUFT="-U $ns_undef_sym" ;; |
| 682 | next/5*) |
| 683 | ns_undef_sym='_environ' |
| 684 | LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;; |
| 685 | esac |
| 686 | |
| 687 | AC_MSG_CHECKING(for --with-next-framework) |
| 688 | if test "$with_next_framework" |
| 689 | then |
| 690 | OPT="$OPT -fno-common" |
| 691 | # -U __environ is needed since bundles don't have access |
| 692 | # to crt0 when built but will always be linked against it |
| 693 | LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym" |
| 694 | AC_DEFINE(WITH_NEXT_FRAMEWORK) |
| 695 | AC_MSG_RESULT(yes) |
| 696 | else |
| 697 | AC_MSG_RESULT(no) |
| 698 | fi |
| 699 | |
| 700 | AC_MSG_CHECKING(for --with-dyld) |
| 701 | if test "$with_next_framework" -o "$with_dyld" |
| 702 | then |
| 703 | if test "$with_dyld" |
| 704 | then |
| 705 | AC_MSG_RESULT(yes) |
| 706 | else |
| 707 | AC_MSG_RESULT(required for framework build) |
| 708 | fi |
| 709 | AC_DEFINE(WITH_DYLD) |
| 710 | ns_dyld='set' |
| 711 | else |
| 712 | AC_MSG_RESULT(no) |
| 713 | fi |
| 714 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 715 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 716 | AC_SUBST(SO) |
| 717 | AC_SUBST(LDSHARED) |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 718 | AC_SUBST(BLDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 719 | AC_SUBST(CCSHARED) |
| 720 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 721 | # SO is the extension of shared libraries `(including the dot!) |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 722 | # -- usually .so, .sl on HP-UX, .dll on Cygwin |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 723 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 724 | if test -z "$SO" |
| 725 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 726 | case $ac_sys_system in |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 727 | hp*|HP*) SO=.sl;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 728 | CYGWIN*) SO=.dll;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 729 | *) SO=.so;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 730 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 731 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 732 | AC_MSG_RESULT($SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 733 | # LDSHARED is the ld *command* used to create shared library |
| 734 | # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 735 | # (Shared libraries in this instance are shared modules to be loaded into |
| 736 | # Python, as opposed to building Python itself as a shared library.) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 737 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 738 | if test -z "$LDSHARED" |
| 739 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 740 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 741 | AIX*) |
| 742 | BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp" |
| 743 | LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp" |
| 744 | ;; |
| 745 | BeOS*) |
| 746 | BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY" |
| 747 | LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY" |
| 748 | ;; |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 749 | IRIX/5*) LDSHARED="ld -shared";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 750 | IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 751 | SunOS/4*) LDSHARED="ld";; |
Greg Ward | 57c9a663 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 752 | SunOS/5*) |
| 753 | if test "$GCC" = "yes" |
Neil Schemenauer | 9505272 | 2001-02-19 18:17:33 +0000 | [diff] [blame] | 754 | then LDSHARED='$(CC) -shared' |
Greg Ward | 57c9a663 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 755 | else LDSHARED="ld -G"; |
| 756 | fi ;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 757 | hp*|HP*) LDSHARED="ld -b";; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 758 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 759 | DYNIX/ptx*) LDSHARED="ld -G";; |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 760 | Darwin/*|next/*) |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 761 | if test "$ns_dyld" |
Guido van Rossum | acb14c7 | 2001-01-10 21:41:16 +0000 | [diff] [blame] | 762 | then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 763 | else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; |
| 764 | fi |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 765 | if test "$with_next_framework" ; then |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 766 | LDSHARED="$LDSHARED \$(LDLIBRARY)" |
| 767 | fi ;; |
Guido van Rossum | 81652ab | 1996-07-21 02:53:27 +0000 | [diff] [blame] | 768 | Linux*) LDSHARED="gcc -shared";; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 769 | dgux*) LDSHARED="ld -G";; |
Guido van Rossum | 458e7fa | 1999-09-17 15:40:40 +0000 | [diff] [blame] | 770 | BSD/OS*/4*) LDSHARED="gcc -shared";; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 771 | OpenBSD*) LDSHARED="ld -Bshareable";; |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 772 | NetBSD*) |
| 773 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 774 | then |
| 775 | LDSHARED="cc -shared" |
| 776 | else |
| 777 | LDSHARED="ld -Bshareable" |
| 778 | fi;; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 779 | FreeBSD*) |
Jeremy Hylton | 4bcc7c5 | 2000-08-31 17:45:35 +0000 | [diff] [blame] | 780 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 781 | then |
| 782 | LDSHARED="cc -shared ${LDFLAGS}" |
| 783 | else |
| 784 | LDSHARED="ld -Bshareable ${LDFLAGS}" |
| 785 | fi;; |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 786 | UnixWare*) |
| 787 | if test "$GCC" = "yes" |
| 788 | then LDSHARED="$(CC) -shared" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 789 | else LDSHARED="$(CC) -G" |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 790 | fi;; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 791 | SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 792 | Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 793 | CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 794 | *) LDSHARED="ld";; |
| 795 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 796 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 797 | AC_MSG_RESULT($LDSHARED) |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 798 | BLDSHARED=${BLDSHARED-$LDSHARED} |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 799 | # CCSHARED are the C *flags* used to create objects to go into a shared |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 800 | # library (module) -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 801 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 802 | if test -z "$CCSHARED" |
| 803 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 804 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | 6625216 | 2001-02-19 04:47:42 +0000 | [diff] [blame] | 805 | SunOS*) if test "$GCC" = yes; |
| 806 | then CCSHARED="-fPIC"; |
| 807 | fi;; |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 808 | hp*|HP*) if test "$GCC" = yes; |
| 809 | then CCSHARED="-fpic"; |
| 810 | else CCSHARED="+z"; |
| 811 | fi;; |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 812 | Linux*) CCSHARED="-fPIC";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 813 | BSD/OS*/4*) CCSHARED="-fpic";; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 814 | OpenBSD*) CCSHARED="-fpic";; |
| 815 | FreeBSD*|NetBSD*) CCSHARED="-fPIC";; |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 816 | UnixWare*) |
| 817 | if test "$GCC" = "yes" |
| 818 | then CCSHARED="-fPIC" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 819 | else CCSHARED="-KPIC" |
Martin v. Löwis | bec1958 | 2001-03-21 15:57:54 +0000 | [diff] [blame] | 820 | fi;; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 821 | SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 822 | Monterey*) CCSHARED="-G";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 823 | IRIX*/6*) case $CC in |
| 824 | *gcc*) CCSHARED="-shared";; |
Guido van Rossum | ee21f41 | 1998-04-20 18:51:54 +0000 | [diff] [blame] | 825 | *) CCSHARED="";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 826 | esac;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 827 | CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 828 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 829 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 830 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 831 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 832 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 833 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 834 | if test -z "$LINKFORSHARED" |
| 835 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 836 | case $ac_sys_system/$ac_sys_release in |
Neil Schemenauer | b3531b8 | 2001-02-16 04:09:05 +0000 | [diff] [blame] | 837 | AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';; |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 838 | hp*|HP*) |
Guido van Rossum | 304dd2d | 1997-10-20 23:10:56 +0000 | [diff] [blame] | 839 | LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 840 | BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 2d9feed | 1997-11-24 17:36:21 +0000 | [diff] [blame] | 841 | Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 842 | # -u libsys_s pulls in all symbols in libsys |
| 843 | next/2*|next/3*) LINKFORSHARED="-u libsys_s";; |
| 844 | # -u __dummy makes the linker aware of the objc runtime |
| 845 | # in System.framework; otherwise, __objcInit (referenced in |
| 846 | # crt1.o) gets erroneously defined as common, which breaks dynamic |
| 847 | # loading of any modules which reference it in System.framework |
| 848 | next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;; |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 849 | Darwin/*) LINKFORSHARED="-u __dummy -u _PyMac_Error -framework System -framework Foundation -framework Carbon" ;; |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 850 | UnixWare*) LINKFORSHARED="-Wl,-Bexport";; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 851 | SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; |
Fred Drake | 02706f5 | 2000-09-25 15:08:46 +0000 | [diff] [blame] | 852 | ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 853 | FreeBSD*|NetBSD*) |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 854 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 855 | then |
| 856 | LINKFORSHARED="-Wl,--export-dynamic" |
| 857 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 858 | SunOS/5*) case $CC in |
| 859 | *gcc*) |
Guido van Rossum | 9c6ba9b | 2000-02-03 13:42:50 +0000 | [diff] [blame] | 860 | if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 861 | then |
| 862 | LINKFORSHARED="-Xlinker --export-dynamic" |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 863 | fi;; |
| 864 | esac;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 865 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 866 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 867 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 868 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 869 | AC_SUBST(CFLAGSFORSHARED) |
| 870 | AC_MSG_CHECKING(CFLAGSFORSHARED) |
| 871 | if test ! "$LIBRARY" = "$LDLIBRARY" |
| 872 | then |
Neil Schemenauer | d9cf41c | 2001-01-27 21:39:17 +0000 | [diff] [blame] | 873 | case $ac_sys_system in |
| 874 | CYGWIN*) |
| 875 | # Cygwin needs CCSHARED when building extension DLLs |
| 876 | # but not when building the interpreter DLL. |
| 877 | CFLAGSFORSHARED='';; |
| 878 | *) |
| 879 | CFLAGSFORSHARED='$(CCSHARED)' |
| 880 | esac |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 881 | fi |
| 882 | AC_MSG_RESULT($CFLAGSFORSHARED) |
| 883 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 884 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 885 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 886 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 887 | |
| 888 | # checks for system dependent C++ extensions support |
| 889 | case "$ac_sys_system" in |
| 890 | AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support) |
| 891 | AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"], |
| 892 | [loadAndInit("", 0, "")], |
| 893 | [AC_DEFINE(AIX_GENUINE_CPLUSPLUS) |
| 894 | AC_MSG_RESULT(yes)], |
| 895 | [AC_MSG_RESULT(no)]);; |
| 896 | *) ;; |
| 897 | esac |
| 898 | |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 899 | # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. |
| 900 | # However on SGI IRIX, these exist but are broken. |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 901 | # BeOS' sockets are stashed in libnet. |
| 902 | case "$ac_sys_system" in |
| 903 | IRIX*) ;; |
Guido van Rossum | 2cb5660 | 1998-05-07 13:25:56 +0000 | [diff] [blame] | 904 | *) |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 905 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 906 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Jeremy Hylton | cb25d5e | 2000-07-27 21:23:28 +0000 | [diff] [blame] | 907 | ;; |
| 908 | esac |
| 909 | case "$ac_sys_system" in |
| 910 | BeOS*) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 911 | AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS |
| 912 | ;; |
| 913 | esac |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 914 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 915 | AC_MSG_CHECKING(for --with-libs) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 916 | AC_ARG_WITH(libs, |
| 917 | [ --with-libs='lib1 ...' link against additional libs], [ |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 918 | AC_MSG_RESULT($withval) |
| 919 | LIBS="$withval $LIBS" |
| 920 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 921 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 922 | # Determine if signalmodule should be used. |
| 923 | AC_SUBST(USE_SIGNAL_MODULE) |
| 924 | AC_SUBST(SIGNAL_OBJS) |
| 925 | AC_MSG_CHECKING(for --with-signal-module) |
| 926 | AC_ARG_WITH(signal-module, |
| 927 | [ --with-signal-module disable/enable signal module]) |
| 928 | |
| 929 | if test -z "$with_signal_module" |
| 930 | then with_signal_module="yes" |
| 931 | fi |
| 932 | AC_MSG_RESULT($with_signal_module) |
| 933 | |
| 934 | if test "${with_signal_module}" = "yes"; then |
| 935 | USE_SIGNAL_MODULE="" |
| 936 | SIGNAL_OBJS="" |
| 937 | else |
| 938 | USE_SIGNAL_MODULE="#" |
| 939 | SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o" |
| 940 | fi |
| 941 | |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 942 | # This is used to generate Setup.config |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 943 | AC_SUBST(USE_THREAD_MODULE) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 944 | USE_THREAD_MODULE="" |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 945 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 946 | AC_MSG_CHECKING(for --with-dec-threads) |
| 947 | AC_SUBST(LDLAST) |
| 948 | AC_ARG_WITH(dec-threads, |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 949 | [ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [ |
| 950 | AC_MSG_RESULT($withval) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 951 | LDLAST=-threads |
Guido van Rossum | f78abae | 1997-01-21 22:02:36 +0000 | [diff] [blame] | 952 | if test "${with_thread+set}" != set; then |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 953 | with_thread="$withval"; |
| 954 | fi], |
| 955 | AC_MSG_RESULT(no)) |
| 956 | |
| 957 | AC_MSG_CHECKING(for --with-threads) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 958 | AC_ARG_WITH(threads, |
| 959 | [ --with(out)-threads[=DIRECTORY] disable/enable thread support]) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 960 | |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 961 | # --with-thread is deprecated, but check for it anyway |
Barry Warsaw | a0f3c5c | 2000-06-30 16:39:35 +0000 | [diff] [blame] | 962 | AC_ARG_WITH(thread, |
| 963 | [ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[ |
| 964 | with_threads=$with_thread]) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 965 | |
| 966 | if test -z "$with_threads" |
| 967 | then with_threads="yes" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 968 | fi |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 969 | AC_MSG_RESULT($with_threads) |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 970 | |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 971 | if test "$with_threads" = "no" |
| 972 | then |
| 973 | USE_THREAD_MODULE="#" |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 974 | elif test "$ac_cv_kpthread" = "yes" |
| 975 | then |
| 976 | CC="$CC -Kpthread" |
| 977 | AC_DEFINE(WITH_THREAD) |
| 978 | AC_DEFINE(_POSIX_THREADS) |
| 979 | LIBOBJS="$LIBOBJS thread.o" |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 980 | else |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 981 | if test ! -z "$with_threads" -a -d "$with_threads" |
| 982 | then LDFLAGS="$LDFLAGS -L$with_threads" |
| 983 | fi |
| 984 | if test ! -z "$withval" -a -d "$withval" |
| 985 | then LDFLAGS="$LDFLAGS -L$withval" |
| 986 | fi |
| 987 | AC_DEFINE(_REENTRANT) |
| 988 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 989 | AC_DEFINE(C_THREADS) |
| 990 | LIBOBJS="$LIBOBJS thread.o"],[ |
| 991 | AC_MSG_CHECKING(for --with-pth) |
| 992 | AC_ARG_WITH(pth, |
| 993 | [ --with-pth use GNU pth threading libraries], [ |
| 994 | AC_MSG_RESULT($withval) |
| 995 | AC_DEFINE(WITH_THREAD) |
| 996 | AC_DEFINE(HAVE_PTH) |
| 997 | LIBS="-lpth $LIBS" |
| 998 | LIBOBJS="$LIBOBJS thread.o"],[ |
| 999 | AC_MSG_RESULT(no) |
| 1000 | AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 1001 | AC_DEFINE(_POSIX_THREADS) |
| 1002 | LIBS="-lpthread $LIBS" |
| 1003 | LIBOBJS="$LIBOBJS thread.o"],[ |
| 1004 | AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) |
| 1005 | case $ac_sys_system in |
| 1006 | Darwin*) ;; |
| 1007 | *) AC_DEFINE(_POSIX_THREADS);; |
| 1008 | esac |
| 1009 | LIBOBJS="$LIBOBJS thread.o"],[ |
| 1010 | AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) |
| 1011 | AC_DEFINE(BEOS_THREADS) |
| 1012 | LIBOBJS="$LIBOBJS thread.o"],[ |
| 1013 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 1014 | AC_DEFINE(_POSIX_THREADS) |
| 1015 | LIBS="$LIBS -lpthreads" |
| 1016 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 1017 | AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 1018 | AC_DEFINE(_POSIX_THREADS) |
| 1019 | LIBS="$LIBS -lc_r" |
| 1020 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 1021 | AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) |
| 1022 | AC_DEFINE(_POSIX_THREADS) |
| 1023 | LIBS="$LIBS -lthread" |
| 1024 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 1025 | AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) |
| 1026 | AC_DEFINE(_POSIX_THREADS) |
| 1027 | LIBS="$LIBS -lpthread" |
| 1028 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 1029 | AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 1030 | AC_DEFINE(_POSIX_THREADS) |
| 1031 | LIBS="$LIBS -lcma" |
| 1032 | LIBOBJS="$LIBOBJS thread.o"],[ |
| 1033 | USE_THREAD_MODULE="#"]) |
| 1034 | ])])])])])])])])]) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1035 | |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1036 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
| 1037 | LIBS="$LIBS -lmpc" |
| 1038 | LIBOBJS="$LIBOBJS thread.o" |
| 1039 | USE_THREAD_MODULE=""]) |
| 1040 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
| 1041 | LIBS="$LIBS -lthread" |
| 1042 | LIBOBJS="$LIBOBJS thread.o" |
| 1043 | USE_THREAD_MODULE=""]) |
Jeremy Hylton | 1a2ca86 | 2000-10-16 16:59:12 +0000 | [diff] [blame] | 1044 | |
Martin v. Löwis | 130fb17 | 2001-07-19 11:00:41 +0000 | [diff] [blame] | 1045 | if test "$USE_THREAD_MODULE" != "#" |
| 1046 | then |
| 1047 | # If the above checks didn't disable threads, (at least) OSF1 |
| 1048 | # needs this '-threads' argument during linking. |
| 1049 | case $ac_sys_system in |
| 1050 | OSF1) LDLAST=-threads;; |
| 1051 | esac |
Jeremy Hylton | 1a2ca86 | 2000-10-16 16:59:12 +0000 | [diff] [blame] | 1052 | fi |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1053 | fi |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1054 | |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 1055 | # Check for GC support |
| 1056 | AC_SUBST(USE_GC_MODULE) |
| 1057 | USE_GC_MODULE="" |
| 1058 | AC_MSG_CHECKING(for --with-cycle-gc) |
| 1059 | AC_ARG_WITH(cycle-gc, |
| 1060 | [ --with(out)-cycle-gc disable/enable garbage collection]) |
| 1061 | |
| 1062 | if test -z "$with_cycle_gc" |
| 1063 | then with_cycle_gc="yes" |
| 1064 | fi |
| 1065 | if test "$with_cycle_gc" = "no" |
| 1066 | then |
| 1067 | USE_GC_MODULE="#" |
| 1068 | else |
| 1069 | AC_DEFINE(WITH_CYCLE_GC) |
| 1070 | fi |
| 1071 | AC_MSG_RESULT($with_cycle_gc) |
| 1072 | |
Neil Schemenauer | a35c688 | 2001-02-27 04:45:05 +0000 | [diff] [blame] | 1073 | # Check for Python-specific malloc support |
| 1074 | AC_MSG_CHECKING(for --with-pymalloc) |
| 1075 | AC_ARG_WITH(pymalloc, |
| 1076 | [ --with(out)-pymalloc disable/enable specialized mallocs], [ |
| 1077 | if test "$withval" != no |
| 1078 | then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes) |
| 1079 | else AC_MSG_RESULT(no) |
| 1080 | fi], |
| 1081 | [AC_MSG_RESULT(no)]) |
| 1082 | |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 1083 | # Check for --with-wctype-functions |
| 1084 | AC_MSG_CHECKING(for --with-wctype-functions) |
| 1085 | AC_ARG_WITH(wctype-functions, |
| 1086 | [ --with-wctype-functions use wctype.h functions], [ |
| 1087 | if test "$withval" != no |
| 1088 | then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes) |
| 1089 | else AC_MSG_RESULT(no) |
| 1090 | fi], |
| 1091 | [AC_MSG_RESULT(no)]) |
| 1092 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 1093 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1094 | AC_SUBST(DLINCLDIR) |
| 1095 | DLINCLDIR=/ |
| 1096 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1097 | AC_MSG_CHECKING(for --with-sgi-dl) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1098 | AC_ARG_WITH(sgi-dl, |
| 1099 | [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [ |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1100 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1101 | AC_DEFINE(WITH_SGI_DL) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1102 | DYNLOADFILE="dynload_dl.o" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1103 | dldir=$withval |
Guido van Rossum | 4095101 | 2000-10-07 16:21:27 +0000 | [diff] [blame] | 1104 | if test ! -z "$dldir" -a -d "$dldir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 1105 | then LDFLAGS="$LDFLAGS -L$dldir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1106 | else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY) |
| 1107 | fi |
| 1108 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1109 | LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1110 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1111 | AC_MSG_CHECKING(for --with-dl-dld) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1112 | AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [ |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1113 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1114 | AC_DEFINE(WITH_DL_DLD) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1115 | DYNLOADFILE="dynload_dl.o" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1116 | dldir=`echo "$withval" | sed 's/,.*//'` |
| 1117 | dlddir=`echo "$withval" | sed 's/.*,//'` |
Barry Warsaw | 7d1219d | 2000-10-05 18:45:53 +0000 | [diff] [blame] | 1118 | if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 1119 | then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1120 | else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY) |
| 1121 | fi |
| 1122 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1123 | LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1124 | |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1125 | # the dlopen() function means we might want to use dynload_shlib.o. some |
| 1126 | # platforms, such as AIX, have dlopen(), but don't want to use it. |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1127 | AC_CHECK_FUNCS(dlopen) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1128 | |
| 1129 | # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic |
| 1130 | # loading of modules. |
| 1131 | AC_SUBST(DYNLOADFILE) |
| 1132 | AC_MSG_CHECKING(DYNLOADFILE) |
| 1133 | if test -z "$DYNLOADFILE" |
| 1134 | then |
| 1135 | case $ac_sys_system/$ac_sys_release in |
| 1136 | AIX*) DYNLOADFILE="dynload_aix.o";; |
| 1137 | BeOS*) DYNLOADFILE="dynload_beos.o";; |
| 1138 | hp*|HP*) DYNLOADFILE="dynload_hpux.o";; |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1139 | Darwin/*|next/*) DYNLOADFILE="dynload_next.o";; |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1140 | *) |
| 1141 | # use dynload_shlib.c and dlopen() if we have it; otherwise stub |
| 1142 | # out any dynamic loading |
| 1143 | if test "$ac_cv_func_dlopen" = yes |
| 1144 | then DYNLOADFILE="dynload_shlib.o" |
| 1145 | else DYNLOADFILE="dynload_stub.o" |
| 1146 | fi |
| 1147 | ;; |
| 1148 | esac |
| 1149 | fi |
| 1150 | AC_MSG_RESULT($DYNLOADFILE) |
| 1151 | if test "$DYNLOADFILE" != "dynload_stub.o" |
| 1152 | then |
| 1153 | AC_DEFINE(HAVE_DYNAMIC_LOADING) |
| 1154 | fi |
| 1155 | |
Jack Jansen | c49e5b7 | 2001-06-19 15:00:23 +0000 | [diff] [blame] | 1156 | # MACHDEP_OBJS can be set to platform-specific object files needed by Python |
| 1157 | |
| 1158 | AC_SUBST(MACHDEP_OBJS) |
| 1159 | AC_MSG_CHECKING(MACHDEP_OBJS) |
| 1160 | if test -z "$MACHDEP_OBJS" |
| 1161 | then |
| 1162 | case $ac_sys_system/$ac_sys_release in |
| 1163 | Darwin/*) |
| 1164 | MACHDEP_OBJS="Mac/Python/macglue.o" |
| 1165 | AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE) |
| 1166 | ;; |
| 1167 | *) MACHDEP_OBJS="";; |
| 1168 | esac |
| 1169 | fi |
| 1170 | AC_MSG_RESULT($DYNLOADFILE) |
| 1171 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1172 | # checks for library functions |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1173 | AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 1174 | flock fork fsync fdatasync fpathconf ftime ftruncate \ |
Andrew M. Kuchling | a9586c7 | 2001-01-08 17:58:56 +0000 | [diff] [blame] | 1175 | getgroups getlogin getpeername getpid getpwent getwd \ |
Martin v. Löwis | b9ab159 | 2001-06-24 21:18:26 +0000 | [diff] [blame] | 1176 | inet_pton kill link lstat mkfifo mktime mremap \ |
Andrew M. Kuchling | 5821b77 | 2000-08-25 01:14:08 +0000 | [diff] [blame] | 1177 | nice pathconf pause plock poll pthread_init \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 1178 | putenv readlink \ |
Andrew M. Kuchling | 8d2f2b2 | 2000-07-13 01:26:58 +0000 | [diff] [blame] | 1179 | select setegid seteuid setgid \ |
Martin v. Löwis | 791bfda | 2001-07-24 06:33:08 +0000 | [diff] [blame] | 1180 | setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 1181 | sigaction siginterrupt sigrelse strftime strptime symlink sysconf \ |
Fred Drake | 89143df | 1999-12-09 22:03:25 +0000 | [diff] [blame] | 1182 | tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ |
Thomas Wouters | c2c12dc | 2001-07-11 14:45:34 +0000 | [diff] [blame] | 1183 | truncate uname waitpid _getpty getpriority) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1184 | |
Fred Drake | 8cef4cf | 2000-06-28 16:40:38 +0000 | [diff] [blame] | 1185 | # check for openpty and forkpty |
| 1186 | |
| 1187 | AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])) |
| 1188 | AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"])) |
| 1189 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1190 | # check for long file support functions |
| 1191 | AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) |
| 1192 | |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 1193 | AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove) |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1194 | AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) |
| 1195 | AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG))) |
| 1196 | AC_CHECK_FUNCS(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ))) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1197 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 1198 | AC_CHECK_FUNCS(getaddrinfo, [dnl |
| 1199 | AC_MSG_CHECKING(getaddrinfo bug) |
| 1200 | AC_TRY_RUN([ |
| 1201 | #include <sys/types.h> |
| 1202 | #include <netdb.h> |
| 1203 | #include <string.h> |
| 1204 | #include <sys/socket.h> |
| 1205 | #include <netinet/in.h> |
| 1206 | |
| 1207 | main() |
| 1208 | { |
| 1209 | int passive, gaierr, inet4 = 0, inet6 = 0; |
| 1210 | struct addrinfo hints, *ai, *aitop; |
| 1211 | char straddr[INET6_ADDRSTRLEN], strport[16]; |
| 1212 | |
| 1213 | for (passive = 0; passive <= 1; passive++) { |
| 1214 | memset(&hints, 0, sizeof(hints)); |
| 1215 | hints.ai_family = AF_UNSPEC; |
| 1216 | hints.ai_flags = passive ? AI_PASSIVE : 0; |
| 1217 | hints.ai_socktype = SOCK_STREAM; |
| 1218 | if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) { |
| 1219 | (void)gai_strerror(gaierr); |
| 1220 | goto bad; |
| 1221 | } |
| 1222 | for (ai = aitop; ai; ai = ai->ai_next) { |
| 1223 | if (ai->ai_addr == NULL || |
| 1224 | ai->ai_addrlen == 0 || |
| 1225 | getnameinfo(ai->ai_addr, ai->ai_addrlen, |
| 1226 | straddr, sizeof(straddr), strport, sizeof(strport), |
| 1227 | NI_NUMERICHOST|NI_NUMERICSERV) != 0) { |
| 1228 | goto bad; |
| 1229 | } |
| 1230 | switch (ai->ai_family) { |
| 1231 | case AF_INET: |
| 1232 | if (strcmp(strport, "54321") != 0) { |
| 1233 | goto bad; |
| 1234 | } |
| 1235 | if (passive) { |
| 1236 | if (strcmp(straddr, "0.0.0.0") != 0) { |
| 1237 | goto bad; |
| 1238 | } |
| 1239 | } else { |
| 1240 | if (strcmp(straddr, "127.0.0.1") != 0) { |
| 1241 | goto bad; |
| 1242 | } |
| 1243 | } |
| 1244 | inet4++; |
| 1245 | break; |
| 1246 | case AF_INET6: |
| 1247 | if (strcmp(strport, "54321") != 0) { |
| 1248 | goto bad; |
| 1249 | } |
| 1250 | if (passive) { |
| 1251 | if (strcmp(straddr, "::") != 0) { |
| 1252 | goto bad; |
| 1253 | } |
| 1254 | } else { |
| 1255 | if (strcmp(straddr, "::1") != 0) { |
| 1256 | goto bad; |
| 1257 | } |
| 1258 | } |
| 1259 | inet6++; |
| 1260 | break; |
| 1261 | case AF_UNSPEC: |
| 1262 | goto bad; |
| 1263 | break; |
| 1264 | default: |
| 1265 | /* another family support? */ |
| 1266 | break; |
| 1267 | } |
| 1268 | } |
| 1269 | } |
| 1270 | |
| 1271 | if (!(inet4 == 0 || inet4 == 2)) |
| 1272 | goto bad; |
| 1273 | if (!(inet6 == 0 || inet6 == 2)) |
| 1274 | goto bad; |
| 1275 | |
| 1276 | if (aitop) |
| 1277 | freeaddrinfo(aitop); |
| 1278 | exit(0); |
| 1279 | |
| 1280 | bad: |
| 1281 | if (aitop) |
| 1282 | freeaddrinfo(aitop); |
| 1283 | exit(1); |
| 1284 | } |
| 1285 | ], |
| 1286 | AC_MSG_RESULT(good) |
| 1287 | buggygetaddrinfo=no, |
| 1288 | AC_MSG_RESULT(buggy) |
| 1289 | buggygetaddrinfo=yes, |
| 1290 | AC_MSG_RESULT(buggy) |
| 1291 | buggygetaddrinfo=yes)], [buggygetaddrinfo=yes]) |
| 1292 | |
| 1293 | if test "$buggygetaddrinfo" = "yes"; then |
| 1294 | if test "$ipv6" = "yes"; then |
| 1295 | echo 'Fatal: You must get working getaddrinfo() function.' |
| 1296 | echo ' or you can specify "--disable-ipv6"'. |
| 1297 | exit 1 |
| 1298 | fi |
| 1299 | fi |
| 1300 | AC_CHECK_FUNCS(getaddrinfo getnameinfo) |
| 1301 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1302 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1303 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1304 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1305 | AC_STRUCT_TIMEZONE |
| 1306 | |
| 1307 | AC_MSG_CHECKING(for time.h that defines altzone) |
| 1308 | AC_CACHE_VAL(ac_cv_header_time_altzone, |
| 1309 | [AC_TRY_COMPILE([#include <time.h>], [return altzone;], |
| 1310 | ac_cv_header_time_altzone=yes, |
| 1311 | ac_cv_header_time_altzone=no)]) |
| 1312 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 1313 | if test $ac_cv_header_time_altzone = yes; then |
| 1314 | AC_DEFINE(HAVE_ALTZONE) |
| 1315 | fi |
| 1316 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1317 | was_it_defined=no |
| 1318 | AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1319 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1320 | #include <sys/types.h> |
| 1321 | #include <sys/select.h> |
| 1322 | #include <sys/time.h> |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1323 | ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes]) |
| 1324 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1325 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 1326 | AC_MSG_CHECKING(for addrinfo) |
| 1327 | AC_CACHE_VAL(ac_cv_struct_addrinfo, |
| 1328 | AC_TRY_COMPILE([ |
| 1329 | # include <netdb.h>], |
| 1330 | [struct addrinfo a], |
| 1331 | ac_cv_struct_addrinfo=yes, |
| 1332 | ac_cv_struct_addrinfo=no)) |
| 1333 | AC_MSG_RESULT($ac_cv_struct_addrinfo) |
| 1334 | if test $ac_cv_struct_addrinfo = yes; then |
| 1335 | AC_DEFINE(HAVE_ADDRINFO) |
| 1336 | fi |
| 1337 | |
| 1338 | AC_MSG_CHECKING(for sockaddr_storage) |
| 1339 | AC_CACHE_VAL(ac_cv_struct_sockaddr_storage, |
| 1340 | AC_TRY_COMPILE([ |
| 1341 | # include <sys/types.h> |
| 1342 | # include <sys/socket.h>], |
| 1343 | [struct sockaddr_storage s], |
| 1344 | ac_cv_struct_sockaddr_storage=yes, |
| 1345 | ac_cv_struct_sockaddr_storage=no)) |
| 1346 | AC_MSG_RESULT($ac_cv_struct_sockaddr_storage) |
| 1347 | if test $ac_cv_struct_sockaddr_storage = yes; then |
| 1348 | AC_DEFINE(HAVE_SOCKADDR_STORAGE) |
| 1349 | fi |
| 1350 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1351 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1352 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1353 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1354 | AC_C_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1355 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1356 | works=no |
| 1357 | AC_MSG_CHECKING(for working volatile) |
| 1358 | AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, [])) |
| 1359 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 1360 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1361 | works=no |
| 1362 | AC_MSG_CHECKING(for working signed char) |
| 1363 | AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, [])) |
| 1364 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1365 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1366 | have_prototypes=no |
| 1367 | AC_MSG_CHECKING(for prototypes) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1368 | AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], |
| 1369 | AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1370 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1371 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1372 | works=no |
| 1373 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1374 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1375 | #include <stdarg.h> |
Guido van Rossum | 3f13e48 | 1996-08-30 20:58:11 +0000 | [diff] [blame] | 1376 | int foo(int x, ...) { |
| 1377 | va_list va; |
| 1378 | va_start(va, x); |
| 1379 | va_arg(va, int); |
| 1380 | va_arg(va, char *); |
| 1381 | va_arg(va, double); |
| 1382 | return 0; |
| 1383 | } |
| 1384 | ], [return foo(10, "", 3.14);], |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1385 | AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes) |
| 1386 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1387 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1388 | if test "$have_prototypes" = yes; then |
| 1389 | bad_prototypes=no |
| 1390 | AC_MSG_CHECKING(for bad exec* prototypes) |
| 1391 | AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], , |
| 1392 | AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes) |
| 1393 | AC_MSG_RESULT($bad_prototypes) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1394 | fi |
| 1395 | |
Martin v. Löwis | 01dfdb3 | 2001-06-23 16:30:13 +0000 | [diff] [blame] | 1396 | # check if sockaddr has sa_len member |
| 1397 | AC_MSG_CHECKING(if sockaddr has sa_len member) |
| 1398 | AC_TRY_COMPILE([#include <sys/types.h> |
| 1399 | #include <sys/socket.h>], |
| 1400 | [struct sockaddr x; |
| 1401 | x.sa_len = 0;], |
| 1402 | AC_MSG_RESULT(yes) |
| 1403 | AC_DEFINE(HAVE_SOCKADDR_SA_LEN), |
| 1404 | AC_MSG_RESULT(no)) |
| 1405 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1406 | bad_forward=no |
| 1407 | AC_MSG_CHECKING(for bad static forward) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1408 | AC_TRY_RUN([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1409 | struct s { int a; int b; }; |
| 1410 | static struct s foo; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 1411 | int foobar() { |
| 1412 | static int random; |
| 1413 | random = (int) &foo; |
| 1414 | return random; |
| 1415 | } |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1416 | static struct s foo = { 1, 2 }; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 1417 | main() { |
| 1418 | exit(!((int)&foo == foobar())); |
| 1419 | } |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1420 | ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes) |
| 1421 | AC_MSG_RESULT($bad_forward) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1422 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1423 | va_list_is_array=no |
| 1424 | AC_MSG_CHECKING(whether va_list is an array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1425 | AC_TRY_COMPILE([ |
| 1426 | #ifdef HAVE_STDARG_PROTOTYPES |
| 1427 | #include <stdarg.h> |
| 1428 | #else |
| 1429 | #include <varargs.h> |
| 1430 | #endif |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1431 | ], [va_list list1, list2; list1 = list2;], , |
| 1432 | AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes) |
| 1433 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1434 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1435 | # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( |
| 1436 | AC_CHECK_FUNC(gethostbyname_r, [ |
| 1437 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 1438 | AC_MSG_CHECKING([gethostbyname_r with 6 args]) |
| 1439 | OLD_CFLAGS=$CFLAGS |
| 1440 | CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" |
| 1441 | AC_TRY_COMPILE([ |
| 1442 | # include <netdb.h> |
| 1443 | ], [ |
| 1444 | char *name; |
| 1445 | struct hostent *he, *res; |
| 1446 | char buffer[2048]; |
| 1447 | int buflen = 2048; |
| 1448 | int h_errnop; |
| 1449 | |
| 1450 | (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) |
| 1451 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1452 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1453 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 1454 | AC_MSG_RESULT(yes) |
| 1455 | ], [ |
| 1456 | AC_MSG_RESULT(no) |
| 1457 | AC_MSG_CHECKING([gethostbyname_r with 5 args]) |
| 1458 | AC_TRY_COMPILE([ |
| 1459 | # include <netdb.h> |
| 1460 | ], [ |
| 1461 | char *name; |
| 1462 | struct hostent *he; |
| 1463 | char buffer[2048]; |
| 1464 | int buflen = 2048; |
| 1465 | int h_errnop; |
| 1466 | |
| 1467 | (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) |
| 1468 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1469 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1470 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 1471 | AC_MSG_RESULT(yes) |
| 1472 | ], [ |
| 1473 | AC_MSG_RESULT(no) |
| 1474 | AC_MSG_CHECKING([gethostbyname_r with 3 args]) |
| 1475 | AC_TRY_COMPILE([ |
| 1476 | # include <netdb.h> |
| 1477 | ], [ |
| 1478 | char *name; |
| 1479 | struct hostent *he; |
| 1480 | struct hostent_data data; |
| 1481 | |
| 1482 | (void) gethostbyname_r(name, he, &data); |
| 1483 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1484 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1485 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG) |
| 1486 | AC_MSG_RESULT(yes) |
| 1487 | ], [ |
| 1488 | AC_MSG_RESULT(no) |
| 1489 | ]) |
| 1490 | ]) |
| 1491 | ]) |
| 1492 | CFLAGS=$OLD_CFLAGS |
| 1493 | ], [ |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1494 | AC_CHECK_FUNCS(gethostbyname) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1495 | ]) |
| 1496 | AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 1497 | AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 1498 | AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG) |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1499 | AC_SUBST(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1500 | AC_SUBST(HAVE_GETHOSTBYNAME) |
| 1501 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1502 | # checks for system services |
| 1503 | # (none yet) |
| 1504 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1505 | # Linux requires this for correct f.p. operations |
Jeremy Hylton | be28f5b | 2000-07-27 21:03:04 +0000 | [diff] [blame] | 1506 | AC_CHECK_FUNC(__fpu_control, |
| 1507 | [], |
| 1508 | [AC_CHECK_LIB(ieee, __fpu_control) |
| 1509 | ]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1510 | |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1511 | # Check for --with-fpectl |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1512 | AC_MSG_CHECKING(for --with-fpectl) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1513 | AC_ARG_WITH(fpectl, |
| 1514 | [ --with-fpectl enable SIGFPE catching], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1515 | if test "$withval" != no |
| 1516 | then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) |
| 1517 | else AC_MSG_RESULT(no) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1518 | fi], |
| 1519 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1520 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1521 | # check for --with-libm=... |
| 1522 | AC_SUBST(LIBM) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 1523 | case $ac_sys_system in |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 1524 | Darwin) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 1525 | next) ;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1526 | BeOS) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 1527 | *) LIBM=-lm |
| 1528 | esac |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1529 | AC_MSG_CHECKING(for --with-libm=STRING) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1530 | AC_ARG_WITH(libm, [ --with-libm=STRING math library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1531 | if test "$withval" = no |
| 1532 | then LIBM= |
| 1533 | AC_MSG_RESULT(force LIBM empty) |
| 1534 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1535 | then LIBM=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1536 | AC_MSG_RESULT(set LIBM=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1537 | else AC_ERROR(proper usage is --with-libm=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1538 | fi], |
| 1539 | [AC_MSG_RESULT(default LIBM=\"$LIBM\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1540 | |
| 1541 | # check for --with-libc=... |
| 1542 | AC_SUBST(LIBC) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1543 | AC_MSG_CHECKING(for --with-libc=STRING) |
Barry Warsaw | c0d24d8b | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1544 | AC_ARG_WITH(libc, [ --with-libc=STRING C library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1545 | if test "$withval" = no |
| 1546 | then LIBC= |
| 1547 | AC_MSG_RESULT(force LIBC empty) |
| 1548 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1549 | then LIBC=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1550 | AC_MSG_RESULT(set LIBC=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1551 | else AC_ERROR(proper usage is --with-libc=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1552 | fi], |
| 1553 | [AC_MSG_RESULT(default LIBC=\"$LIBC\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1554 | |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 1555 | # check for hypot() in math library |
| 1556 | LIBS_SAVE=$LIBS |
| 1557 | LIBS="$LIBS $LIBM" |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 1558 | AC_REPLACE_FUNCS(hypot) |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 1559 | LIBS=$LIBS_SAVE |
| 1560 | |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 1561 | # check whether malloc(0) returns NULL or not |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 1562 | AC_MSG_CHECKING(what malloc(0) returns) |
| 1563 | AC_CACHE_VAL(ac_cv_malloc_zero, |
| 1564 | [AC_TRY_RUN([#include <stdio.h> |
| 1565 | #ifdef HAVE_STDLIB |
| 1566 | #include <stdlib.h> |
| 1567 | #else |
| 1568 | char *malloc(), *realloc(); |
| 1569 | int *free(); |
| 1570 | #endif |
| 1571 | main() { |
| 1572 | char *p; |
| 1573 | p = malloc(0); |
| 1574 | if (p == NULL) exit(1); |
| 1575 | p = realloc(p, 0); |
| 1576 | if (p == NULL) exit(1); |
| 1577 | free(p); |
| 1578 | exit(0); |
| 1579 | }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)]) |
| 1580 | AC_MSG_RESULT($ac_cv_malloc_zero) |
| 1581 | if test "$ac_cv_malloc_zero" = null |
| 1582 | then |
| 1583 | AC_DEFINE(MALLOC_ZERO_RETURNS_NULL) |
| 1584 | fi |
| 1585 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1586 | # check for wchar.h |
| 1587 | AC_CHECK_HEADER(wchar.h, |
| 1588 | AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes", |
| 1589 | wchar_h="no" |
| 1590 | ) |
| 1591 | |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 1592 | # determine wchar_t size |
| 1593 | if test "$wchar_h" = yes |
| 1594 | then |
| 1595 | AC_CHECK_SIZEOF(wchar_t) |
| 1596 | fi |
| 1597 | |
| 1598 | AC_MSG_CHECKING(what type to use for unicode) |
| 1599 | AC_ARG_ENABLE(unicode, |
| 1600 | [ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes) |
| 1601 | |
| 1602 | if test $enable_unicode = yes |
| 1603 | then |
Martin v. Löwis | fd91779 | 2001-06-27 20:22:04 +0000 | [diff] [blame] | 1604 | # Without any arguments, Py_UNICODE defaults to two-byte mode |
| 1605 | enable_unicode="ucs2" |
Martin v. Löwis | 0ba70cc | 2001-06-26 22:22:37 +0000 | [diff] [blame] | 1606 | fi |
| 1607 | |
| 1608 | case "$enable_unicode" in |
| 1609 | ucs2) unicode_size="2" |
| 1610 | AC_DEFINE(Py_UNICODE_SIZE,2) |
| 1611 | ;; |
| 1612 | ucs4) unicode_size="4" |
| 1613 | AC_DEFINE(Py_UNICODE_SIZE,4) |
| 1614 | ;; |
| 1615 | esac |
| 1616 | |
| 1617 | if test "$enable_unicode" = "no" |
| 1618 | then |
| 1619 | AC_MSG_RESULT(not used) |
| 1620 | else |
| 1621 | AC_DEFINE(Py_USING_UNICODE) |
| 1622 | if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" |
| 1623 | then |
| 1624 | PY_UNICODE_TYPE="wchar_t" |
| 1625 | AC_DEFINE(HAVE_USABLE_WCHAR_T) |
| 1626 | AC_DEFINE(PY_UNICODE_TYPE,wchar_t) |
| 1627 | elif test "$ac_cv_sizeof_short" = "$unicode_size" |
| 1628 | then |
| 1629 | PY_UNICODE_TYPE="unsigned short" |
| 1630 | AC_DEFINE(PY_UNICODE_TYPE,unsigned short) |
| 1631 | elif test "$ac_cv_sizeof_long" = "$unicode_size" |
| 1632 | then |
| 1633 | PY_UNICODE_TYPE="unsigned long" |
| 1634 | AC_DEFINE(PY_UNICODE_TYPE,unsigned long) |
| 1635 | else |
| 1636 | PY_UNICODE_TYPE="no type found" |
| 1637 | fi |
| 1638 | AC_MSG_RESULT($PY_UNICODE_TYPE) |
| 1639 | fi |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1640 | |
| 1641 | # check for endianness |
| 1642 | AC_C_BIGENDIAN |
| 1643 | |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1644 | # Check whether right shifting a negative integer extends the sign bit |
| 1645 | # or fills with zeros (like the Cray J90, according to Tim Peters). |
| 1646 | AC_MSG_CHECKING(whether right shift extends the sign bit) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 1647 | AC_CACHE_VAL(ac_cv_rshift_extends_sign, [ |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1648 | AC_TRY_RUN([ |
| 1649 | int main() |
| 1650 | { |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 1651 | exit(((-1)>>3 == -1) ? 0 : 1); |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1652 | } |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 1653 | ], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)]) |
| 1654 | AC_MSG_RESULT($ac_cv_rshift_extends_sign) |
| 1655 | if test "$ac_cv_rshift_extends_sign" = no |
| 1656 | then |
| 1657 | AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS) |
| 1658 | fi |
| 1659 | |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 1660 | # check for getc_unlocked and related locking functions |
| 1661 | AC_MSG_CHECKING(for getc_unlocked() and friends) |
| 1662 | AC_CACHE_VAL(ac_cv_have_getc_unlocked, [ |
| 1663 | AC_TRY_LINK([#include <stdio.h>],[ |
| 1664 | FILE *f = fopen("/dev/null", "r"); |
| 1665 | flockfile(f); |
| 1666 | getc_unlocked(f); |
| 1667 | funlockfile(f); |
| 1668 | ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)]) |
| 1669 | AC_MSG_RESULT($ac_cv_have_getc_unlocked) |
| 1670 | if test "$ac_cv_have_getc_unlocked" = yes |
| 1671 | then |
| 1672 | AC_DEFINE(HAVE_GETC_UNLOCKED) |
| 1673 | fi |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1674 | |
Guido van Rossum | 353ae58 | 2001-07-10 16:45:32 +0000 | [diff] [blame] | 1675 | # check for readline 4.2 |
| 1676 | AC_CHECK_LIB(readline, rl_completion_matches, |
| 1677 | AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap) |
| 1678 | |
Thomas Wouters | e38b2f1 | 2001-07-11 22:35:31 +0000 | [diff] [blame] | 1679 | AC_MSG_CHECKING(for broken nice()) |
| 1680 | AC_CACHE_VAL(ac_cv_broken_nice, [ |
| 1681 | AC_TRY_RUN([ |
| 1682 | int main() |
| 1683 | { |
| 1684 | int val1 = nice(1); |
| 1685 | if (val1 != -1 && val1 == nice(2)) |
| 1686 | exit(0); |
| 1687 | exit(1); |
| 1688 | } |
| 1689 | ],ac_cv_broken_nice=yes, ac_cv_broken_nice=no)]) |
| 1690 | AC_MSG_RESULT($ac_cv_broken_nice) |
| 1691 | if test "$ac_cv_broken_nice" = yes |
| 1692 | then |
| 1693 | AC_DEFINE(HAVE_BROKEN_NICE) |
| 1694 | fi |
| 1695 | |
Guido van Rossum | 95713eb | 2000-05-18 20:53:31 +0000 | [diff] [blame] | 1696 | # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS! |
| 1697 | # Add sys/socket.h to confdefs.h |
| 1698 | cat >> confdefs.h <<\EOF |
| 1699 | #ifdef HAVE_SYS_SOCKET_H |
| 1700 | #include <sys/socket.h> |
| 1701 | #endif |
| 1702 | EOF |
| 1703 | AC_CHECK_TYPE(socklen_t, int) |
| 1704 | |
Neil Schemenauer | f25cf6c | 2001-03-04 06:39:33 +0000 | [diff] [blame] | 1705 | # Add Python/ prefix to LIBOBJS |
| 1706 | libobjs=$LIBOBJS |
| 1707 | LIBOBJS= |
| 1708 | for obj in $libobjs; do |
| 1709 | LIBOBJS="$LIBOBJS Python/$obj" |
| 1710 | done |
| 1711 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1712 | #AC_MSG_CHECKING(for Modules/Setup) |
| 1713 | #if test ! -f Modules/Setup ; then |
| 1714 | # if test ! -d Modules ; then |
| 1715 | # mkdir Modules |
| 1716 | # fi |
| 1717 | # cp "$srcdir/Modules/Setup.dist" Modules/Setup |
| 1718 | # AC_MSG_RESULT(creating) |
| 1719 | #else |
| 1720 | # AC_MSG_RESULT(already exists) |
| 1721 | #fi |
| 1722 | |
| 1723 | AC_SUBST(SRCDIRS) |
Neil Schemenauer | acbf9ef | 2001-02-27 02:15:14 +0000 | [diff] [blame] | 1724 | SRCDIRS="Parser Grammar Objects Python Modules" |
Andrew M. Kuchling | 8abedde | 2001-01-26 22:55:24 +0000 | [diff] [blame] | 1725 | AC_MSG_CHECKING(for build directories) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1726 | for dir in $SRCDIRS; do |
| 1727 | if test ! -d $dir; then |
| 1728 | mkdir $dir |
Fred Drake | 884d3ba | 2000-11-02 17:52:56 +0000 | [diff] [blame] | 1729 | fi |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1730 | done |
| 1731 | AC_MSG_RESULT(done) |
Fred Drake | 036144d | 2000-10-26 17:09:35 +0000 | [diff] [blame] | 1732 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1733 | # generate output files |
Andrew M. Kuchling | 8abedde | 2001-01-26 22:55:24 +0000 | [diff] [blame] | 1734 | AC_OUTPUT(Makefile.pre Modules/Setup.config) |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 1735 | |
| 1736 | echo "creating Setup" |
| 1737 | if test ! -f Modules/Setup |
| 1738 | then |
| 1739 | cp $srcdir/Modules/Setup.dist Modules/Setup |
| 1740 | fi |
| 1741 | |
| 1742 | echo "creating Setup.local" |
| 1743 | if test ! -f Modules/Setup.local |
| 1744 | then |
| 1745 | echo "# Edit this file for local setup changes" >Modules/Setup.local |
| 1746 | fi |
| 1747 | |
| 1748 | echo "creating Makefile" |
| 1749 | $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ |
| 1750 | -s Modules Modules/Setup.config \ |
Neil Schemenauer | f8b71c5 | 2001-04-21 17:41:16 +0000 | [diff] [blame] | 1751 | Modules/Setup.local Modules/Setup |
Neil Schemenauer | 6625216 | 2001-02-19 04:47:42 +0000 | [diff] [blame] | 1752 | mv config.c Modules |