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) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 5 | AC_CONFIG_HEADER(config.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) |
Neil Schemenauer | 7d64577 | 2001-01-17 21:59:33 +0000 | [diff] [blame] | 9 | VERSION=2.1 |
Guido van Rossum | 642b678 | 1997-07-19 19:35:41 +0000 | [diff] [blame] | 10 | |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 11 | # NEXTSTEP|MacOSX|Darwin stuff |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 12 | 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] | 13 | |
| 14 | AC_MSG_CHECKING(for --with-next-archs) |
| 15 | AC_ARG_WITH(next-archs, |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 16 | [ --with-next-archs='arch1 arch2 ..' build MAB binary], [ |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 17 | if test -n "$withval"; then |
Guido van Rossum | 2bb4f55 | 1996-09-10 18:19:59 +0000 | [diff] [blame] | 18 | ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval` |
| 19 | # GCC does not currently support multi archs on the NeXT |
| 20 | with_gcc=no |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 21 | fi |
| 22 | AC_MSG_RESULT($with_next_archs) |
| 23 | ], [AC_MSG_RESULT(none: using `arch`)]) |
| 24 | |
| 25 | if test -z "$MACHDEP" |
| 26 | then |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 27 | ac_sys_system=`uname -s` |
| 28 | if test "$ac_sys_system" = "Darwin" ; then |
| 29 | ac_sys_release=`uname -r` |
| 30 | else |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 31 | set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \ |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 32 | sed -e 's/://' -e 's/\./_/'` && \ |
| 33 | ac_sys_system=next && ac_sys_release=$4 |
| 34 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 35 | |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 36 | MACHDEP="$ac_sys_system$ac_sys_release" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 37 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 38 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 39 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 40 | AC_ARG_WITH(next-framework, |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 41 | [ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 42 | AC_ARG_WITH(dyld, |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 43 | [ --with-dyld Use (OpenStep|Rhapsody|MacOSX|Darwin) dynamic linker],,) |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 44 | |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 45 | # Set name for machine-dependent library files |
| 46 | AC_SUBST(MACHDEP) |
| 47 | AC_MSG_CHECKING(MACHDEP) |
| 48 | if test -z "$MACHDEP" |
| 49 | then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 50 | ac_sys_system=`uname -s` |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 51 | 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] | 52 | ac_sys_release=`uname -v` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 53 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 54 | ac_sys_release=`uname -r` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 55 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 56 | ac_md_system=`echo $ac_sys_system | |
| 57 | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` |
| 58 | ac_md_release=`echo $ac_sys_release | |
| 59 | tr -d '[/ ]' | sed 's/\..*//'` |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 60 | MACHDEP="$ac_md_system$ac_md_release" |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 61 | |
Guido van Rossum | bcd91e0 | 1997-03-20 20:46:29 +0000 | [diff] [blame] | 62 | case $MACHDEP in |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 63 | '') MACHDEP="unknown";; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 64 | esac |
| 65 | fi |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 66 | |
| 67 | # |
| 68 | # SGI compilers allow the specification of the both the ABI and the |
| 69 | # ISA on the command line. Depending on the values of these switches, |
| 70 | # different and often incompatable code will be generated. |
| 71 | # |
| 72 | # The SGI_ABI variable can be used to modify the CC and LDFLAGS and |
| 73 | # thus supply support for various ABI/ISA combinations. The MACHDEP |
| 74 | # variable is also adjusted. |
| 75 | # |
| 76 | AC_SUBST(SGI_ABI) |
| 77 | if test ! -z "$SGI_ABI" |
| 78 | then |
| 79 | CC="cc $SGI_ABI" |
| 80 | LDFLAGS="$SGI_ABI $LDFLAGS" |
| 81 | MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` |
| 82 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 83 | AC_MSG_RESULT($MACHDEP) |
| 84 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 85 | # checks for alternative programs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 86 | AC_MSG_CHECKING(for --without-gcc) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 87 | AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 88 | case $withval in |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 89 | no) CC=cc |
| 90 | without_gcc=yes;; |
| 91 | yes) CC=gcc |
| 92 | without_gcc=no;; |
| 93 | *) CC=$withval |
| 94 | without_gcc=$withval;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 95 | esac], [ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 96 | case $ac_sys_system in |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 97 | OSF1) CC=cc |
| 98 | without_gcc=;; |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 99 | BeOS*) |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 100 | case $BE_HOST_CPU in |
| 101 | ppc) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 102 | CC=mwcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 103 | without_gcc=yes |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 104 | OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma" |
| 105 | CCSHARED="UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'" |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 106 | LDFLAGS="$LDFLAGS -nodup" |
| 107 | |
| 108 | AR="$PWD/BeOS/ar-fake" |
| 109 | RANLIB=: |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 110 | ;; |
| 111 | x86) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 112 | CC=gcc |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 113 | without_gcc=no |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 114 | OPT=-O |
| 115 | # Really should use srcdir instead of PWD |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 116 | AR="$PWD/BeOS/ar-fake" |
| 117 | RANLIB=: |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 118 | ;; |
| 119 | *) |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 120 | AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\") |
Guido van Rossum | 7a5f420 | 1999-01-12 20:30:23 +0000 | [diff] [blame] | 121 | ;; |
| 122 | esac |
| 123 | ;; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 124 | Monterey*) |
| 125 | RANLIB=: |
| 126 | without_gcc=;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 127 | *) without_gcc=no;; |
| 128 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 129 | AC_MSG_RESULT($without_gcc) |
| 130 | |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 131 | AC_SUBST(CXX) |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 132 | AC_SUBST(MAINOBJ) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 133 | MAINOBJ=Modules/python.o |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 134 | AC_MSG_CHECKING(for --with-cxx=<compiler>) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 135 | AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[ |
Martin v. Löwis | 537970f | 2000-12-13 17:37:02 +0000 | [diff] [blame] | 136 | check_cxx=no |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 137 | case $withval in |
| 138 | no) CXX= |
| 139 | with_cxx=no;; |
| 140 | *) CXX=$withval |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 141 | MAINOBJ=Modules/ccpython.o |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 142 | with_cxx=$withval;; |
| 143 | esac], [ |
| 144 | with_cxx=no |
Martin v. Löwis | 537970f | 2000-12-13 17:37:02 +0000 | [diff] [blame] | 145 | check_cxx=yes |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 146 | ]) |
| 147 | AC_MSG_RESULT($with_cxx) |
Martin v. Löwis | 537970f | 2000-12-13 17:37:02 +0000 | [diff] [blame] | 148 | |
| 149 | dnl The following fragment works similar to AC_PROG_CXX. |
| 150 | dnl It does not fail if CXX is not found, and it is not executed if |
| 151 | dnl --with-cxx was given. |
| 152 | dnl Finally, it does not test whether CXX is g++. |
| 153 | |
| 154 | if test "$check_cxx" = "yes" |
| 155 | then |
| 156 | AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound) |
| 157 | if test "$CXX" = "notfound" |
| 158 | then |
| 159 | CXX= |
| 160 | else |
| 161 | AC_PROG_CXX_WORKS |
| 162 | fi |
| 163 | fi |
| 164 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 165 | # If the user switches compilers, we can't believe the cache |
| 166 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 167 | then |
| 168 | AC_ERROR(cached CC is different -- throw away $cache_file |
| 169 | (it is also a good idea to do 'make clean' before compiling)) |
| 170 | fi |
| 171 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 172 | AC_PROG_CC |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 173 | AC_EXEEXT |
Neil Schemenauer | 3ae1d0a | 2001-01-27 06:54:42 +0000 | [diff] [blame] | 174 | AC_MSG_CHECKING(for --with-suffix) |
| 175 | AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[ |
| 176 | case $withval in |
| 177 | no) EXEEXT=;; |
| 178 | yes) EXEEXT=.exe;; |
| 179 | *) EXEEXT=$withval;; |
| 180 | esac]) |
| 181 | AC_MSG_RESULT($EXEEXT) |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 182 | |
Guido van Rossum | dd997f7 | 1998-10-07 19:58:26 +0000 | [diff] [blame] | 183 | case $MACHDEP in |
| 184 | bsdos*) |
| 185 | case $CC in |
| 186 | gcc) CC="$CC -D_HAVE_BSDI";; |
| 187 | esac;; |
| 188 | esac |
| 189 | |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 190 | case $ac_sys_system in |
| 191 | hp*|HP*) |
| 192 | case $CC in |
Guido van Rossum | cd5ff9f | 2000-09-22 16:15:54 +0000 | [diff] [blame] | 193 | cc|*/cc) CC="$CC -Ae";; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 194 | esac;; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 195 | Monterey*) |
| 196 | case $CC in |
| 197 | cc) CC="$CC -Wl,-Bexport";; |
| 198 | esac;; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 199 | esac |
| 200 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 201 | AC_SUBST(LIBRARY) |
| 202 | AC_MSG_CHECKING(LIBRARY) |
| 203 | if test -z "$LIBRARY" |
| 204 | then |
| 205 | LIBRARY='libpython$(VERSION).a' |
| 206 | fi |
| 207 | AC_MSG_RESULT($LIBRARY) |
| 208 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 209 | # LDLIBRARY is the name of the library to link against (as opposed to the |
| 210 | # name of the library into which to insert object files). On systems |
| 211 | # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 212 | # the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the |
| 213 | # shared (i.e., DLL) library. |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 214 | AC_SUBST(LDLIBRARY) |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 215 | AC_SUBST(DLLLIBRARY) |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 216 | LDLIBRARY="$LIBRARY" |
Guido van Rossum | 2755290 | 2001-01-23 01:52:26 +0000 | [diff] [blame] | 217 | DLLLIBRARY='' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 218 | |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 219 | # LINKCC is the command that links the python executable -- default is $(CC). |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 220 | # 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] | 221 | # linking. |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 222 | AC_SUBST(LINKCC) |
| 223 | AC_MSG_CHECKING(LINKCC) |
| 224 | if test -z "$LINKCC" |
| 225 | then |
| 226 | case $ac_sys_system in |
| 227 | AIX*) |
Marc-André Lemburg | 9f8cdf5 | 2001-02-09 09:59:06 +0000 | [diff] [blame] | 228 | LINKCC="\$(srcdir)/Modules/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 229 | dgux*) |
| 230 | LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 231 | Monterey64*) |
| 232 | LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";; |
Guido van Rossum | 25f9303 | 1997-08-18 16:00:04 +0000 | [diff] [blame] | 233 | *) LINKCC="\$(PURIFY) \$(CC)";; |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 234 | esac |
| 235 | fi |
| 236 | AC_MSG_RESULT($LINKCC) |
| 237 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 238 | AC_MSG_CHECKING(LDLIBRARY) |
| 239 | |
| 240 | # NeXT framework builds require that the 'ar' library be converted into |
| 241 | # a bundle using libtool. |
| 242 | if test "$with_next_framework" |
| 243 | then |
| 244 | LDLIBRARY='libpython$(VERSION).dylib' |
| 245 | fi |
| 246 | |
| 247 | # 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] | 248 | case $MACHDEP in |
| 249 | dguxR4) |
| 250 | LDLIBRARY='libpython$(VERSION).so' |
| 251 | OPT="$OPT -pic" |
| 252 | ;; |
| 253 | beos*) |
| 254 | LDLIBRARY='libpython$(VERSION).so' |
| 255 | ;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 256 | cygwin*) |
| 257 | LDLIBRARY='libpython$(VERSION).dll.a' |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 258 | DLLLIBRARY='libpython$(VERSION).dll' |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 259 | ;; |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 260 | esac |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 261 | AC_MSG_RESULT($LDLIBRARY) |
| 262 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 263 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 264 | AC_SUBST(AR) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 265 | AC_CHECK_PROGS(AR, ar aal, ar) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 266 | AC_PROG_INSTALL |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 267 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 268 | # Not every filesystem supports hard links |
| 269 | AC_SUBST(LN) |
| 270 | if test -z "$LN" ; then |
| 271 | case $ac_sys_system in |
| 272 | BeOS*) LN="ln -s";; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 273 | CYGWIN*) LN="ln -s";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 274 | *) LN=ln;; |
| 275 | esac |
| 276 | fi |
| 277 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 278 | # Optimizer/debugger flags |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 279 | AC_SUBST(OPT) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 280 | if test -z "$OPT" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 281 | then |
Guido van Rossum | b5875b6 | 1997-07-18 23:29:09 +0000 | [diff] [blame] | 282 | case $GCC in |
| 283 | yes) |
| 284 | case $ac_cv_prog_cc_g in |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 285 | yes) OPT="-g -O2 -Wall -Wstrict-prototypes";; |
| 286 | *) OPT="-O2 -Wall -Wstrict-prototypes";; |
Guido van Rossum | b5875b6 | 1997-07-18 23:29:09 +0000 | [diff] [blame] | 287 | esac |
| 288 | ;; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 289 | *) OPT="-O";; |
| 290 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 291 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 292 | |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 293 | # The current (beta) Monterey compiler dies with optimizations |
| 294 | case $ac_sys_system in |
| 295 | Monterey*) OPT="";; |
| 296 | esac |
| 297 | |
Guido van Rossum | 6f2260e | 1996-09-09 16:21:03 +0000 | [diff] [blame] | 298 | if test "$ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 299 | then |
| 300 | OPT="$OPT $ac_arch_flags" |
| 301 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 302 | # checks for UNIX variants that set C preprocessor variables |
| 303 | AC_AIX |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 304 | AC_MINIX |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 305 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 306 | AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) |
| 307 | AC_CACHE_VAL(ac_cv_opt_olimit_ok, |
| 308 | [ac_save_cc="$CC" |
| 309 | CC="$CC -OPT:Olimit=0" |
| 310 | AC_TRY_RUN([int main() { return 0; }], |
| 311 | ac_cv_opt_olimit_ok=yes, |
| 312 | ac_cv_opt_olimit_ok=no) |
| 313 | CC="$ac_save_cc"]) |
| 314 | AC_MSG_RESULT($ac_cv_opt_olimit_ok) |
Guido van Rossum | 2efa34b | 1997-10-23 17:43:11 +0000 | [diff] [blame] | 315 | if test $ac_cv_opt_olimit_ok = yes; then |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 316 | case $ac_sys_system in |
| 317 | Darwin*) OPT="$OPT" ;; |
| 318 | *) OPT="$OPT -OPT:Olimit=0";; |
| 319 | esac |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 320 | else |
| 321 | AC_MSG_CHECKING(whether $CC accepts -Olimit 1500) |
| 322 | AC_CACHE_VAL(ac_cv_olimit_ok, |
| 323 | [ac_save_cc="$CC" |
| 324 | CC="$CC -Olimit 1500" |
| 325 | AC_TRY_RUN([int main() { return 0; }], |
| 326 | ac_cv_olimit_ok=yes, |
| 327 | ac_cv_olimit_ok=no) |
| 328 | CC="$ac_save_cc"]) |
| 329 | AC_MSG_RESULT($ac_cv_olimit_ok) |
| 330 | if test $ac_cv_olimit_ok = yes; then |
| 331 | OPT="$OPT -Olimit 1500" |
| 332 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 333 | fi |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 334 | |
Fred Drake | ce81d59 | 2000-07-09 14:39:29 +0000 | [diff] [blame] | 335 | dnl # check for ANSI or K&R ("traditional") preprocessor |
| 336 | dnl AC_MSG_CHECKING(for C preprocessor type) |
| 337 | dnl AC_TRY_COMPILE([ |
| 338 | dnl #define spam(name, doc) {#name, &name, #name "() -- " doc} |
| 339 | dnl int foo; |
| 340 | dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); |
| 341 | dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional) |
| 342 | dnl AC_MSG_RESULT($cpp_type) |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 343 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 344 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 345 | AC_HEADER_STDC |
Andrew M. Kuchling | 5821b77 | 2000-08-25 01:14:08 +0000 | [diff] [blame] | 346 | 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] | 347 | signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ |
Fred Drake | c9cb847 | 2000-08-31 16:11:07 +0000 | [diff] [blame] | 348 | sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \ |
Guido van Rossum | 95713eb | 2000-05-18 20:53:31 +0000 | [diff] [blame] | 349 | sys/param.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] | 350 | sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ |
| 351 | ndbm.h db1/ndbm.h gdbm/ndbm.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 352 | AC_HEADER_DIRENT |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 353 | |
| 354 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 355 | was_it_defined=no |
| 356 | AC_MSG_CHECKING(for clock_t in time.h) |
| 357 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long)) |
| 358 | AC_MSG_RESULT($was_it_defined) |
| 359 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 360 | # Add some code to confdefs.h so that the test for off_t works on SCO |
| 361 | cat >> confdefs.h <<\EOF |
| 362 | #if defined(SCO_DS) |
| 363 | #undef _OFF_T |
| 364 | #endif |
| 365 | EOF |
| 366 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 367 | # Type availability checks |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 368 | AC_TYPE_MODE_T |
| 369 | AC_TYPE_OFF_T |
| 370 | AC_TYPE_PID_T |
| 371 | AC_TYPE_SIGNAL |
| 372 | AC_TYPE_SIZE_T |
| 373 | AC_TYPE_UID_T |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 374 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 375 | # Sizes of various common basic types |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 376 | AC_CHECK_SIZEOF(int) |
| 377 | AC_CHECK_SIZEOF(long) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 378 | AC_CHECK_SIZEOF(void *) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 379 | AC_CHECK_SIZEOF(char) |
| 380 | AC_CHECK_SIZEOF(short) |
| 381 | AC_CHECK_SIZEOF(float) |
| 382 | AC_CHECK_SIZEOF(double) |
Fred Drake | a3f6e91 | 2000-06-29 20:44:47 +0000 | [diff] [blame] | 383 | AC_CHECK_SIZEOF(fpos_t) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 384 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 385 | AC_MSG_CHECKING(for long long support) |
| 386 | have_long_long=no |
| 387 | AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes) |
| 388 | AC_MSG_RESULT($have_long_long) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 389 | if test "$have_long_long" = yes ; then |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 390 | AC_CHECK_SIZEOF(long long) |
| 391 | fi |
| 392 | |
Barry Warsaw | bc7c7f9 | 2000-08-18 04:53:33 +0000 | [diff] [blame] | 393 | AC_MSG_CHECKING(for uintptr_t support) |
| 394 | have_uintptr_t=no |
| 395 | AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes) |
| 396 | AC_MSG_RESULT($have_uintptr_t) |
| 397 | if test "$have_uintptr_t" = yes ; then |
| 398 | AC_CHECK_SIZEOF(uintptr_t) |
| 399 | fi |
| 400 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 401 | # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>. |
| 402 | AC_MSG_CHECKING(size of off_t) |
| 403 | AC_CACHE_VAL(ac_cv_sizeof_off_t, |
| 404 | [AC_TRY_RUN([#include <stdio.h> |
| 405 | #include <sys/types.h> |
| 406 | main() |
| 407 | { |
| 408 | FILE *f=fopen("conftestval", "w"); |
| 409 | if (!f) exit(1); |
| 410 | fprintf(f, "%d\n", sizeof(off_t)); |
| 411 | exit(0); |
| 412 | }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0) |
| 413 | ]) |
| 414 | AC_MSG_RESULT($ac_cv_sizeof_off_t) |
| 415 | AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t) |
| 416 | |
| 417 | AC_MSG_CHECKING(whether to enable large file support) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 418 | if test "$have_long_long" = yes -a \ |
| 419 | "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ |
| 420 | "$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] | 421 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT) |
| 422 | AC_MSG_RESULT(yes) |
| 423 | else |
| 424 | AC_MSG_RESULT(no) |
| 425 | fi |
| 426 | |
Fred Drake | a3f6e91 | 2000-06-29 20:44:47 +0000 | [diff] [blame] | 427 | # AC_CHECK_SIZEOF() doesn't include <time.h>. |
| 428 | AC_MSG_CHECKING(size of time_t) |
| 429 | AC_CACHE_VAL(ac_cv_sizeof_time_t, |
| 430 | [AC_TRY_RUN([#include <stdio.h> |
| 431 | #include <time.h> |
| 432 | main() |
| 433 | { |
| 434 | FILE *f=fopen("conftestval", "w"); |
| 435 | if (!f) exit(1); |
| 436 | fprintf(f, "%d\n", sizeof(time_t)); |
| 437 | exit(0); |
| 438 | }], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0) |
| 439 | ]) |
| 440 | AC_MSG_RESULT($ac_cv_sizeof_time_t) |
| 441 | AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t) |
| 442 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 443 | |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 444 | # if have pthread_t then define SIZEOF_PTHREAD_T |
| 445 | AC_MSG_CHECKING(for pthread_t) |
| 446 | have_pthread_t=no |
Guido van Rossum | 1258049 | 2000-09-24 16:47:19 +0000 | [diff] [blame] | 447 | 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] | 448 | AC_MSG_RESULT($have_pthread_t) |
| 449 | if test "$have_pthread_t" = yes ; then |
| 450 | # AC_CHECK_SIZEOF() doesn't include <pthread.h>. |
| 451 | AC_MSG_CHECKING(size of pthread_t) |
| 452 | AC_CACHE_VAL(ac_cv_sizeof_pthread_t, |
| 453 | [AC_TRY_RUN([#include <stdio.h> |
| 454 | #include <pthread.h> |
| 455 | main() |
| 456 | { |
| 457 | FILE *f=fopen("conftestval", "w"); |
| 458 | if (!f) exit(1); |
| 459 | fprintf(f, "%d\n", sizeof(pthread_t)); |
| 460 | exit(0); |
| 461 | }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0) |
| 462 | ]) |
| 463 | AC_MSG_RESULT($ac_cv_sizeof_pthread_t) |
| 464 | AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t) |
| 465 | fi |
| 466 | |
| 467 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 468 | # Minor variations in building a framework between NextStep versions 4 and 5 |
| 469 | AC_SUBST(LIBTOOL_CRUFT) |
| 470 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 471 | Darwin/*) |
| 472 | ns_undef_sym='_environ' |
| 473 | LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 474 | next/4*) |
| 475 | ns_undef_sym='__environ' |
| 476 | LIBTOOL_CRUFT="-U $ns_undef_sym" ;; |
| 477 | next/5*) |
| 478 | ns_undef_sym='_environ' |
| 479 | LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;; |
| 480 | esac |
| 481 | |
| 482 | AC_MSG_CHECKING(for --with-next-framework) |
| 483 | if test "$with_next_framework" |
| 484 | then |
| 485 | OPT="$OPT -fno-common" |
| 486 | # -U __environ is needed since bundles don't have access |
| 487 | # to crt0 when built but will always be linked against it |
| 488 | LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym" |
| 489 | AC_DEFINE(WITH_NEXT_FRAMEWORK) |
| 490 | AC_MSG_RESULT(yes) |
| 491 | else |
| 492 | AC_MSG_RESULT(no) |
| 493 | fi |
| 494 | |
| 495 | AC_MSG_CHECKING(for --with-dyld) |
| 496 | if test "$with_next_framework" -o "$with_dyld" |
| 497 | then |
| 498 | if test "$with_dyld" |
| 499 | then |
| 500 | AC_MSG_RESULT(yes) |
| 501 | else |
| 502 | AC_MSG_RESULT(required for framework build) |
| 503 | fi |
| 504 | AC_DEFINE(WITH_DYLD) |
| 505 | ns_dyld='set' |
| 506 | else |
| 507 | AC_MSG_RESULT(no) |
| 508 | fi |
| 509 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 510 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 511 | AC_SUBST(SO) |
| 512 | AC_SUBST(LDSHARED) |
| 513 | AC_SUBST(CCSHARED) |
| 514 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 515 | # SO is the extension of shared libraries `(including the dot!) |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 516 | # -- usually .so, .sl on HP-UX, .dll on Cygwin |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 517 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 518 | if test -z "$SO" |
| 519 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 520 | case $ac_sys_system in |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 521 | hp*|HP*) SO=.sl;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 522 | CYGWIN*) SO=.dll;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 523 | *) SO=.so;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 524 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 525 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 526 | AC_MSG_RESULT($SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 527 | # LDSHARED is the ld *command* used to create shared library |
| 528 | # -- "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] | 529 | # (Shared libraries in this instance are shared modules to be loaded into |
| 530 | # Python, as opposed to building Python itself as a shared library.) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 531 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 532 | if test -z "$LDSHARED" |
| 533 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 534 | case $ac_sys_system/$ac_sys_release in |
Marc-André Lemburg | 9f8cdf5 | 2001-02-09 09:59:06 +0000 | [diff] [blame] | 535 | AIX*) LDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC)";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 536 | BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";; |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 537 | IRIX/5*) LDSHARED="ld -shared";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 538 | IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 539 | SunOS/4*) LDSHARED="ld";; |
Greg Ward | 57c9a66 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 540 | SunOS/5*) |
| 541 | if test "$GCC" = "yes" |
Greg Ward | a1c4da2 | 2000-11-07 15:44:21 +0000 | [diff] [blame] | 542 | then LDSHARED='$(CC) -shared' |
Greg Ward | 57c9a66 | 2000-05-26 12:22:54 +0000 | [diff] [blame] | 543 | else LDSHARED="ld -G"; |
| 544 | fi ;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 545 | hp*|HP*) LDSHARED="ld -b";; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 546 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 547 | DYNIX/ptx*) LDSHARED="ld -G";; |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 548 | Darwin/*|next/*) |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 549 | if test "$ns_dyld" |
Guido van Rossum | acb14c7 | 2001-01-10 21:41:16 +0000 | [diff] [blame] | 550 | then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress' |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 551 | else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; |
| 552 | fi |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 553 | if test "$with_next_framework" ; then |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 554 | LDSHARED="$LDSHARED \$(LDLIBRARY)" |
| 555 | fi ;; |
Guido van Rossum | 81652ab | 1996-07-21 02:53:27 +0000 | [diff] [blame] | 556 | Linux*) LDSHARED="gcc -shared";; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 557 | dgux*) LDSHARED="ld -G";; |
Guido van Rossum | 458e7fa | 1999-09-17 15:40:40 +0000 | [diff] [blame] | 558 | BSD/OS*/4*) LDSHARED="gcc -shared";; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 559 | OpenBSD*) LDSHARED="ld -Bshareable";; |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 560 | NetBSD*) |
| 561 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 562 | then |
| 563 | LDSHARED="cc -shared" |
| 564 | else |
| 565 | LDSHARED="ld -Bshareable" |
| 566 | fi;; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 567 | FreeBSD*) |
Jeremy Hylton | 4bcc7c5 | 2000-08-31 17:45:35 +0000 | [diff] [blame] | 568 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 569 | then |
| 570 | LDSHARED="cc -shared ${LDFLAGS}" |
| 571 | else |
| 572 | LDSHARED="ld -Bshareable ${LDFLAGS}" |
| 573 | fi;; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 574 | SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 575 | Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 576 | CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 577 | *) LDSHARED="ld";; |
| 578 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 579 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 580 | AC_MSG_RESULT($LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 581 | # 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] | 582 | # library (module) -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 583 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 584 | if test -z "$CCSHARED" |
| 585 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 586 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 587 | hp*|HP*) if test "$GCC" = yes; |
| 588 | then CCSHARED="-fpic"; |
| 589 | else CCSHARED="+z"; |
| 590 | fi;; |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 591 | Linux*) CCSHARED="-fPIC";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 592 | BSD/OS*/4*) CCSHARED="-fpic";; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 593 | OpenBSD*) CCSHARED="-fpic";; |
| 594 | FreeBSD*|NetBSD*) CCSHARED="-fPIC";; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 595 | SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; |
Trent Mick | 635f6fb | 2000-08-23 21:33:05 +0000 | [diff] [blame] | 596 | Monterey*) CCSHARED="-G";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 597 | IRIX*/6*) case $CC in |
| 598 | *gcc*) CCSHARED="-shared";; |
Guido van Rossum | ee21f41 | 1998-04-20 18:51:54 +0000 | [diff] [blame] | 599 | *) CCSHARED="";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 600 | esac;; |
Guido van Rossum | aef734b | 2001-01-10 21:09:12 +0000 | [diff] [blame] | 601 | CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 602 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 603 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 604 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 605 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 606 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 607 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 608 | if test -z "$LINKFORSHARED" |
| 609 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 610 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 69f6580 | 1998-03-03 21:47:00 +0000 | [diff] [blame] | 611 | AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';; |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 612 | hp*|HP*) |
Guido van Rossum | 304dd2d | 1997-10-20 23:10:56 +0000 | [diff] [blame] | 613 | LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 614 | BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 2d9feed | 1997-11-24 17:36:21 +0000 | [diff] [blame] | 615 | Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 616 | # -u libsys_s pulls in all symbols in libsys |
| 617 | next/2*|next/3*) LINKFORSHARED="-u libsys_s";; |
| 618 | # -u __dummy makes the linker aware of the objc runtime |
| 619 | # in System.framework; otherwise, __objcInit (referenced in |
| 620 | # crt1.o) gets erroneously defined as common, which breaks dynamic |
| 621 | # loading of any modules which reference it in System.framework |
| 622 | next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;; |
Guido van Rossum | acb14c7 | 2001-01-10 21:41:16 +0000 | [diff] [blame] | 623 | Darwin/*) LINKFORSHARED="-u __dummy -framework System -framework Foundation" ;; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 624 | SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; |
Fred Drake | 02706f5 | 2000-09-25 15:08:46 +0000 | [diff] [blame] | 625 | ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";; |
Guido van Rossum | 0286ae8 | 2000-08-29 15:06:49 +0000 | [diff] [blame] | 626 | FreeBSD*|NetBSD*) |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 627 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 628 | then |
| 629 | LINKFORSHARED="-Wl,--export-dynamic" |
| 630 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 631 | SunOS/5*) case $CC in |
| 632 | *gcc*) |
Guido van Rossum | 9c6ba9b | 2000-02-03 13:42:50 +0000 | [diff] [blame] | 633 | if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 634 | then |
| 635 | LINKFORSHARED="-Xlinker --export-dynamic" |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 636 | fi;; |
| 637 | esac;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 638 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 639 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 640 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 641 | |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 642 | AC_SUBST(CFLAGSFORSHARED) |
| 643 | AC_MSG_CHECKING(CFLAGSFORSHARED) |
| 644 | if test ! "$LIBRARY" = "$LDLIBRARY" |
| 645 | then |
Neil Schemenauer | d9cf41c | 2001-01-27 21:39:17 +0000 | [diff] [blame] | 646 | case $ac_sys_system in |
| 647 | CYGWIN*) |
| 648 | # Cygwin needs CCSHARED when building extension DLLs |
| 649 | # but not when building the interpreter DLL. |
| 650 | CFLAGSFORSHARED='';; |
| 651 | *) |
| 652 | CFLAGSFORSHARED='$(CCSHARED)' |
| 653 | esac |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 654 | fi |
| 655 | AC_MSG_RESULT($CFLAGSFORSHARED) |
| 656 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 657 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 658 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 659 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 660 | |
Skip Montanaro | cb85326 | 2000-08-30 22:29:48 +0000 | [diff] [blame] | 661 | # Check for --with-pydebug |
| 662 | AC_MSG_CHECKING(for --with-pydebug) |
| 663 | AC_ARG_WITH(pydebug, |
| 664 | [ --with-pydebug build with Py_DEBUG defined], [ |
| 665 | if test "$withval" != no |
| 666 | then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes) |
| 667 | else AC_MSG_RESULT(no) |
| 668 | fi], |
| 669 | [AC_MSG_RESULT(no)]) |
| 670 | |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 671 | # checks for system dependent C++ extensions support |
| 672 | case "$ac_sys_system" in |
| 673 | AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support) |
| 674 | AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"], |
| 675 | [loadAndInit("", 0, "")], |
| 676 | [AC_DEFINE(AIX_GENUINE_CPLUSPLUS) |
| 677 | AC_MSG_RESULT(yes)], |
| 678 | [AC_MSG_RESULT(no)]);; |
| 679 | *) ;; |
| 680 | esac |
| 681 | |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 682 | # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. |
| 683 | # However on SGI IRIX, these exist but are broken. |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 684 | # BeOS' sockets are stashed in libnet. |
| 685 | case "$ac_sys_system" in |
| 686 | IRIX*) ;; |
Guido van Rossum | 2cb5660 | 1998-05-07 13:25:56 +0000 | [diff] [blame] | 687 | *) |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 688 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 689 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Jeremy Hylton | cb25d5e | 2000-07-27 21:23:28 +0000 | [diff] [blame] | 690 | ;; |
| 691 | esac |
| 692 | case "$ac_sys_system" in |
| 693 | BeOS*) |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 694 | AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS |
| 695 | ;; |
| 696 | esac |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 697 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 698 | AC_MSG_CHECKING(for --with-libs) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 699 | AC_ARG_WITH(libs, |
| 700 | [ --with-libs='lib1 ...' link against additional libs], [ |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 701 | AC_MSG_RESULT($withval) |
| 702 | LIBS="$withval $LIBS" |
| 703 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 704 | |
Eric S. Raymond | a888540 | 2001-01-17 08:25:11 +0000 | [diff] [blame] | 705 | # |
| 706 | # These are used to generate Setup.config. They autoconfigure several |
| 707 | # features that are otherwise severe pains in the butt. |
| 708 | # |
| 709 | # ncurses |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 710 | AC_SUBST(USE_NCURSES_MODULE) |
| 711 | AC_CHECK_LIB(ncurses, initscr, |
| 712 | [USE_NCURSES_MODULE=""], |
| 713 | [USE_NCURSES_MODULE="#"], |
| 714 | -ltermcap) |
Eric S. Raymond | a888540 | 2001-01-17 08:25:11 +0000 | [diff] [blame] | 715 | # GNU readline |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 716 | AC_SUBST(USE_READLINE_MODULE) |
| 717 | AC_CHECK_LIB(readline, readline, |
| 718 | [USE_READLINE_MODULE=""], |
| 719 | [USE_READLINE_MODULE="#"], |
| 720 | -ltermcap) |
Eric S. Raymond | a888540 | 2001-01-17 08:25:11 +0000 | [diff] [blame] | 721 | # gdbm(3) |
| 722 | AC_SUBST(USE_GDBM_MODULE) |
| 723 | AC_SUBST(HAVE_LIBGDBM) |
| 724 | AC_CHECK_LIB(gdbm, gdbm_open, |
| 725 | [USE_GDBM_MODULE="" |
| 726 | HAVE_LIBGDBM=-lgdbm], |
| 727 | [USE_GDBM_MODULE="#" |
| 728 | HAVE_LIBGDBM=""]) |
| 729 | # ndbm(3) |
| 730 | AC_SUBST(USE_NDBM_MODULE) |
| 731 | AC_SUBST(HAVE_LIBNDBM) |
| 732 | AC_CHECK_LIB(ndbm, ndbm_open, |
| 733 | [USE_NDBM_MODULE="" |
| 734 | HAVE_LIBNDBM=-lndbm], |
| 735 | [USE_NDBM_MODULE="#" |
| 736 | HAVE_LIBNDBM=""]) |
| 737 | # crypt(3) |
| 738 | AC_SUBST(USE_CRYPT_MODULE) |
| 739 | AC_SUBST(HAVE_LIBCRYPT) |
| 740 | AC_CHECK_LIB(crypt, crypt, |
| 741 | [USE_CRYPT_MODULE="" |
| 742 | HAVE_LIBCRYPT=-lcrypt], |
| 743 | [USE_CRYPT_MODULE="#" |
| 744 | HAVE_LIBCRYPT=""]) |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 745 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 746 | |
| 747 | # Determine if signalmodule should be used. |
| 748 | AC_SUBST(USE_SIGNAL_MODULE) |
| 749 | AC_SUBST(SIGNAL_OBJS) |
| 750 | AC_MSG_CHECKING(for --with-signal-module) |
| 751 | AC_ARG_WITH(signal-module, |
| 752 | [ --with-signal-module disable/enable signal module]) |
| 753 | |
| 754 | if test -z "$with_signal_module" |
| 755 | then with_signal_module="yes" |
| 756 | fi |
| 757 | AC_MSG_RESULT($with_signal_module) |
| 758 | |
| 759 | if test "${with_signal_module}" = "yes"; then |
| 760 | USE_SIGNAL_MODULE="" |
| 761 | SIGNAL_OBJS="" |
| 762 | else |
| 763 | USE_SIGNAL_MODULE="#" |
| 764 | SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o" |
| 765 | fi |
| 766 | |
Guido van Rossum | 3d15bd8 | 2001-01-10 18:53:48 +0000 | [diff] [blame] | 767 | # This is used to generate Setup.config |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 768 | AC_SUBST(USE_THREAD_MODULE) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 769 | USE_THREAD_MODULE="" |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 770 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 771 | AC_MSG_CHECKING(for --with-dec-threads) |
| 772 | AC_SUBST(LDLAST) |
| 773 | AC_ARG_WITH(dec-threads, |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 774 | [ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [ |
| 775 | AC_MSG_RESULT($withval) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 776 | LDLAST=-threads |
Guido van Rossum | f78abae | 1997-01-21 22:02:36 +0000 | [diff] [blame] | 777 | if test "${with_thread+set}" != set; then |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 778 | with_thread="$withval"; |
| 779 | fi], |
| 780 | AC_MSG_RESULT(no)) |
| 781 | |
| 782 | AC_MSG_CHECKING(for --with-threads) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 783 | AC_ARG_WITH(threads, |
| 784 | [ --with(out)-threads[=DIRECTORY] disable/enable thread support]) |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 785 | |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 786 | # --with-thread is deprecated, but check for it anyway |
Barry Warsaw | a0f3c5c | 2000-06-30 16:39:35 +0000 | [diff] [blame] | 787 | AC_ARG_WITH(thread, |
| 788 | [ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[ |
| 789 | with_threads=$with_thread]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 790 | |
| 791 | if test -z "$with_threads" |
| 792 | then with_threads="yes" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 793 | fi |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 794 | AC_MSG_RESULT($with_threads) |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 795 | |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 796 | if test "$with_threads" = "no" |
| 797 | then |
| 798 | USE_THREAD_MODULE="#" |
| 799 | else |
Guido van Rossum | 4095101 | 2000-10-07 16:21:27 +0000 | [diff] [blame] | 800 | if test ! -z "$with_threads" -a -d "$with_threads" |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 801 | then LDFLAGS="$LDFLAGS -L$with_threads" |
| 802 | fi |
Guido van Rossum | 4095101 | 2000-10-07 16:21:27 +0000 | [diff] [blame] | 803 | if test ! -z "$withval" -a -d "$withval" |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 804 | then LDFLAGS="$LDFLAGS -L$withval" |
| 805 | fi |
| 806 | AC_DEFINE(_REENTRANT) |
| 807 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 808 | AC_DEFINE(C_THREADS) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 809 | LIBOBJS="$LIBOBJS Python/thread.o"],[ |
Guido van Rossum | 9e8181b | 2000-09-19 00:46:46 +0000 | [diff] [blame] | 810 | AC_MSG_CHECKING(for --with-pth) |
| 811 | AC_ARG_WITH(pth, |
| 812 | [ --with-pth use GNU pth threading libraries], [ |
| 813 | AC_MSG_RESULT($withval) |
| 814 | AC_DEFINE(WITH_THREAD) |
| 815 | AC_DEFINE(HAVE_PTH) |
| 816 | LIBS="-lpth $LIBS" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 817 | LIBOBJS="$LIBOBJS Python/thread.o"],[ |
Guido van Rossum | 9e8181b | 2000-09-19 00:46:46 +0000 | [diff] [blame] | 818 | AC_MSG_RESULT(no) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 819 | AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 820 | AC_DEFINE(_POSIX_THREADS) |
| 821 | LIBS="-lpthread $LIBS" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 822 | LIBOBJS="$LIBOBJS Python/thread.o"],[ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 823 | AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 824 | case $ac_sys_system in |
| 825 | Darwin*) ;; |
| 826 | *) AC_DEFINE(_POSIX_THREADS);; |
| 827 | esac |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 828 | LIBOBJS="$LIBOBJS Python/thread.o"],[ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 829 | AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) |
| 830 | AC_DEFINE(BEOS_THREADS) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 831 | LIBOBJS="$LIBOBJS Python/thread.o"],[ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 832 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 833 | AC_DEFINE(_POSIX_THREADS) |
| 834 | LIBS="$LIBS -lpthreads" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 835 | LIBOBJS="$LIBOBJS Python/thread.o"], [ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 836 | AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 837 | AC_DEFINE(_POSIX_THREADS) |
| 838 | LIBS="$LIBS -lc_r" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 839 | LIBOBJS="$LIBOBJS Python/thread.o"], [ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 840 | AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) |
| 841 | AC_DEFINE(_POSIX_THREADS) |
| 842 | LIBS="$LIBS -lthread" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 843 | LIBOBJS="$LIBOBJS Python/thread.o"], [ |
Guido van Rossum | 8d6e8af | 2000-10-30 17:45:07 +0000 | [diff] [blame] | 844 | AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD) |
| 845 | AC_DEFINE(_POSIX_THREADS) |
| 846 | LIBS="$LIBS -lpthread" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 847 | LIBOBJS="$LIBOBJS Python/thread.o"], [ |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 848 | AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 849 | AC_DEFINE(_POSIX_THREADS) |
| 850 | LIBS="$LIBS -lcma" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 851 | LIBOBJS="$LIBOBJS Python/thread.o"],[ |
Thomas Wouters | 0db2b2b | 2000-08-26 11:33:43 +0000 | [diff] [blame] | 852 | USE_THREAD_MODULE="#"]) |
Guido van Rossum | 8d6e8af | 2000-10-30 17:45:07 +0000 | [diff] [blame] | 853 | ])])])])])])])])]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 854 | |
| 855 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
| 856 | LIBS="$LIBS -lmpc" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 857 | LIBOBJS="$LIBOBJS Python/thread.o" |
Thomas Wouters | 0db2b2b | 2000-08-26 11:33:43 +0000 | [diff] [blame] | 858 | USE_THREAD_MODULE=""]) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 859 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
| 860 | LIBS="$LIBS -lthread" |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 861 | LIBOBJS="$LIBOBJS Python/thread.o" |
Thomas Wouters | 0db2b2b | 2000-08-26 11:33:43 +0000 | [diff] [blame] | 862 | USE_THREAD_MODULE=""]) |
Jeremy Hylton | 1a2ca86 | 2000-10-16 16:59:12 +0000 | [diff] [blame] | 863 | |
| 864 | if test "$USE_THREAD_MODULE" != "#" |
| 865 | then |
| 866 | # If the above checks didn't disable threads, (at least) OSF1 |
| 867 | # needs this '-threads' argument during linking. |
| 868 | case $ac_sys_system in |
| 869 | OSF1) LDLAST=-threads;; |
| 870 | esac |
| 871 | fi |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 872 | fi |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 873 | |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 874 | # Check for GC support |
| 875 | AC_SUBST(USE_GC_MODULE) |
| 876 | USE_GC_MODULE="" |
| 877 | AC_MSG_CHECKING(for --with-cycle-gc) |
| 878 | AC_ARG_WITH(cycle-gc, |
| 879 | [ --with(out)-cycle-gc disable/enable garbage collection]) |
| 880 | |
| 881 | if test -z "$with_cycle_gc" |
| 882 | then with_cycle_gc="yes" |
| 883 | fi |
| 884 | if test "$with_cycle_gc" = "no" |
| 885 | then |
| 886 | USE_GC_MODULE="#" |
| 887 | else |
| 888 | AC_DEFINE(WITH_CYCLE_GC) |
| 889 | fi |
| 890 | AC_MSG_RESULT($with_cycle_gc) |
| 891 | |
Barry Warsaw | a57b89b | 2001-01-15 17:07:21 +0000 | [diff] [blame] | 892 | # Check for DBM support |
| 893 | AC_SUBST(USE_DBM_MODULE) |
| 894 | USE_DBM_MODULE="" |
| 895 | AC_MSG_CHECKING(for --with-dbm) |
| 896 | AC_ARG_WITH(dbm, |
| 897 | [ --with(out)-dbm disable/enable dbm module]) |
| 898 | |
| 899 | # enabled by default but one of the dbm.h files must be found |
Sjoerd Mullender | 124698c | 2001-01-17 09:42:21 +0000 | [diff] [blame] | 900 | if test "$ac_cv_header_ndbm_h" = "yes" -o "$ac_cv_header_db1_ndbm_h" = "yes" -o "$ac_cv_header_gdbm_ndbm_h" = "yes" |
Barry Warsaw | a57b89b | 2001-01-15 17:07:21 +0000 | [diff] [blame] | 901 | then |
| 902 | if test "$with_dbm" != "no" |
| 903 | then with_dbm="yes" |
| 904 | fi |
| 905 | else |
| 906 | # make sure user knows why dbm support wasn't enabled even though |
| 907 | # s/he requested it |
| 908 | if test "$with_dbm" = "yes" |
Eric S. Raymond | a888540 | 2001-01-17 08:25:11 +0000 | [diff] [blame] | 909 | then echo $ac_n "(requested but no ndbm.h was found) $ac_c" |
Barry Warsaw | a57b89b | 2001-01-15 17:07:21 +0000 | [diff] [blame] | 910 | fi |
| 911 | with_dbm="no" |
| 912 | fi |
| 913 | |
| 914 | if test "$with_dbm" = "no" |
| 915 | then |
| 916 | USE_DBM_MODULE="#" |
| 917 | else |
| 918 | AC_DEFINE(WITH_LIBNDBM) |
| 919 | fi |
| 920 | AC_MSG_RESULT($with_dbm) |
| 921 | |
| 922 | if test "$with_dbm" = "yes" |
| 923 | then |
| 924 | # check for libndbm |
| 925 | AC_SUBST(HAVE_LIBNDBM) |
| 926 | AC_CHECK_FUNC(dbmopen, [HAVE_LIBNDBM=], [HAVE_LIBNDBM=-lndbm]) |
| 927 | fi |
| 928 | |
Fred Drake | c9cb847 | 2000-08-31 16:11:07 +0000 | [diff] [blame] | 929 | # Check for LIBDB support |
| 930 | # either --with-libdb or, in its absence, the presence of db.h |
| 931 | AC_SUBST(USE_BSDDB_MODULE) |
| 932 | USE_BSDDB_MODULE="" |
| 933 | AC_MSG_CHECKING(for --with-libdb) |
| 934 | AC_ARG_WITH(libdb, |
| 935 | [ --with(out)-libdb disable/enable bsddb module]) |
| 936 | |
Skip Montanaro | b89f41e | 2000-09-04 04:06:05 +0000 | [diff] [blame] | 937 | # enabled by default, but db.h must be found |
| 938 | if test "$ac_cv_header_db_h" = "yes" |
| 939 | then |
| 940 | if test "$with_libdb" != "no" |
| 941 | then with_libdb="yes" |
| 942 | fi |
| 943 | else |
Fred Drake | 5790be1 | 2000-10-09 17:06:13 +0000 | [diff] [blame] | 944 | # make sure user knows why bsddb support wasn't enabled even |
Skip Montanaro | b89f41e | 2000-09-04 04:06:05 +0000 | [diff] [blame] | 945 | # though s/he requested it |
| 946 | if test "$with_libdb" = "yes" |
| 947 | then echo $ac_n "(requested, but db.h was not found) $ac_c" |
| 948 | fi |
| 949 | with_libdb="no" |
Fred Drake | c9cb847 | 2000-08-31 16:11:07 +0000 | [diff] [blame] | 950 | fi |
Skip Montanaro | b89f41e | 2000-09-04 04:06:05 +0000 | [diff] [blame] | 951 | |
Fred Drake | c9cb847 | 2000-08-31 16:11:07 +0000 | [diff] [blame] | 952 | if test "$with_libdb" = "no" |
| 953 | then |
| 954 | USE_BSDDB_MODULE="#" |
| 955 | else |
| 956 | AC_DEFINE(WITH_LIBDB) |
| 957 | fi |
| 958 | AC_MSG_RESULT($with_libdb) |
| 959 | |
Skip Montanaro | ed33c9a | 2000-09-08 02:17:15 +0000 | [diff] [blame] | 960 | if test "$with_libdb" = "yes" |
| 961 | then |
| 962 | # check for libdb; BSD systems have the DB routines in libc --tg |
| 963 | AC_SUBST(HAVE_LIBDB) |
Martin v. Löwis | 05a65d6 | 2000-09-24 19:40:25 +0000 | [diff] [blame] | 964 | # If dbopen is not in libc, then checking whether it is in libdb |
| 965 | # is difficult: db_185.h may #define it as __db185_open |
| 966 | # Instead, we just trust it is in libdb; linking will fail if it |
| 967 | # is not. |
| 968 | AC_CHECK_FUNC(dbopen, [HAVE_LIBDB=], [HAVE_LIBDB=-ldb]) |
Skip Montanaro | ed33c9a | 2000-09-08 02:17:15 +0000 | [diff] [blame] | 969 | fi |
| 970 | |
Barry Warsaw | ef82cd7 | 2000-06-30 16:21:01 +0000 | [diff] [blame] | 971 | # Check for --with-wctype-functions |
| 972 | AC_MSG_CHECKING(for --with-wctype-functions) |
| 973 | AC_ARG_WITH(wctype-functions, |
| 974 | [ --with-wctype-functions use wctype.h functions], [ |
| 975 | if test "$withval" != no |
| 976 | then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes) |
| 977 | else AC_MSG_RESULT(no) |
| 978 | fi], |
| 979 | [AC_MSG_RESULT(no)]) |
| 980 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 981 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 982 | AC_SUBST(DLINCLDIR) |
| 983 | DLINCLDIR=/ |
| 984 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 985 | AC_MSG_CHECKING(for --with-sgi-dl) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 986 | AC_ARG_WITH(sgi-dl, |
| 987 | [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [ |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 988 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 989 | AC_DEFINE(WITH_SGI_DL) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 990 | DYNLOADFILE="dynload_dl.o" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 991 | dldir=$withval |
Guido van Rossum | 4095101 | 2000-10-07 16:21:27 +0000 | [diff] [blame] | 992 | if test ! -z "$dldir" -a -d "$dldir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 993 | then LDFLAGS="$LDFLAGS -L$dldir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 994 | else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY) |
| 995 | fi |
| 996 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 997 | LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 998 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 999 | AC_MSG_CHECKING(for --with-dl-dld) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1000 | 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] | 1001 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1002 | AC_DEFINE(WITH_DL_DLD) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1003 | DYNLOADFILE="dynload_dl.o" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1004 | dldir=`echo "$withval" | sed 's/,.*//'` |
| 1005 | dlddir=`echo "$withval" | sed 's/.*,//'` |
Barry Warsaw | 7d1219d | 2000-10-05 18:45:53 +0000 | [diff] [blame] | 1006 | 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] | 1007 | then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1008 | else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY) |
| 1009 | fi |
| 1010 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1011 | LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1012 | |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1013 | # the dlopen() function means we might want to use dynload_shlib.o. some |
| 1014 | # 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] | 1015 | AC_CHECK_FUNCS(dlopen) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1016 | |
| 1017 | # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic |
| 1018 | # loading of modules. |
| 1019 | AC_SUBST(DYNLOADFILE) |
| 1020 | AC_MSG_CHECKING(DYNLOADFILE) |
| 1021 | if test -z "$DYNLOADFILE" |
| 1022 | then |
| 1023 | case $ac_sys_system/$ac_sys_release in |
| 1024 | AIX*) DYNLOADFILE="dynload_aix.o";; |
| 1025 | BeOS*) DYNLOADFILE="dynload_beos.o";; |
| 1026 | hp*|HP*) DYNLOADFILE="dynload_hpux.o";; |
Guido van Rossum | 5839e58 | 2000-10-09 19:52:35 +0000 | [diff] [blame] | 1027 | Darwin/*|next/*) DYNLOADFILE="dynload_next.o";; |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 1028 | *) |
| 1029 | # use dynload_shlib.c and dlopen() if we have it; otherwise stub |
| 1030 | # out any dynamic loading |
| 1031 | if test "$ac_cv_func_dlopen" = yes |
| 1032 | then DYNLOADFILE="dynload_shlib.o" |
| 1033 | else DYNLOADFILE="dynload_stub.o" |
| 1034 | fi |
| 1035 | ;; |
| 1036 | esac |
| 1037 | fi |
| 1038 | AC_MSG_RESULT($DYNLOADFILE) |
| 1039 | if test "$DYNLOADFILE" != "dynload_stub.o" |
| 1040 | then |
| 1041 | AC_DEFINE(HAVE_DYNAMIC_LOADING) |
| 1042 | fi |
| 1043 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1044 | # checks for library functions |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1045 | AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 1046 | flock fork fsync fdatasync fpathconf ftime ftruncate \ |
Andrew M. Kuchling | a9586c7 | 2001-01-08 17:58:56 +0000 | [diff] [blame] | 1047 | getgroups getlogin getpeername getpid getpwent getwd \ |
Andrew M. Kuchling | 898527b | 2000-06-18 14:54:13 +0000 | [diff] [blame] | 1048 | kill link lstat mkfifo mktime mremap \ |
Andrew M. Kuchling | 5821b77 | 2000-08-25 01:14:08 +0000 | [diff] [blame] | 1049 | nice pathconf pause plock poll pthread_init \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 1050 | putenv readlink \ |
Andrew M. Kuchling | 8d2f2b2 | 2000-07-13 01:26:58 +0000 | [diff] [blame] | 1051 | select setegid seteuid setgid \ |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1052 | setlocale setregid setreuid setsid setpgid setuid setvbuf \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 1053 | sigaction siginterrupt sigrelse strftime strptime symlink sysconf \ |
Fred Drake | 89143df | 1999-12-09 22:03:25 +0000 | [diff] [blame] | 1054 | tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ |
Thomas Wouters | 70c21a1 | 2000-07-14 14:28:33 +0000 | [diff] [blame] | 1055 | truncate uname waitpid _getpty) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1056 | |
Fred Drake | 8cef4cf | 2000-06-28 16:40:38 +0000 | [diff] [blame] | 1057 | # check for openpty and forkpty |
| 1058 | |
| 1059 | AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"])) |
| 1060 | AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"])) |
| 1061 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 1062 | # check for long file support functions |
| 1063 | AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) |
| 1064 | |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 1065 | AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove) |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1066 | AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) |
| 1067 | AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG))) |
| 1068 | 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] | 1069 | |
| 1070 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1071 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1072 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1073 | AC_STRUCT_TIMEZONE |
| 1074 | |
| 1075 | AC_MSG_CHECKING(for time.h that defines altzone) |
| 1076 | AC_CACHE_VAL(ac_cv_header_time_altzone, |
| 1077 | [AC_TRY_COMPILE([#include <time.h>], [return altzone;], |
| 1078 | ac_cv_header_time_altzone=yes, |
| 1079 | ac_cv_header_time_altzone=no)]) |
| 1080 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 1081 | if test $ac_cv_header_time_altzone = yes; then |
| 1082 | AC_DEFINE(HAVE_ALTZONE) |
| 1083 | fi |
| 1084 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1085 | was_it_defined=no |
| 1086 | 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] | 1087 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1088 | #include <sys/types.h> |
| 1089 | #include <sys/select.h> |
| 1090 | #include <sys/time.h> |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1091 | ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes]) |
| 1092 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1093 | |
| 1094 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1095 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1096 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1097 | AC_C_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1098 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1099 | works=no |
| 1100 | AC_MSG_CHECKING(for working volatile) |
| 1101 | AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, [])) |
| 1102 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 1103 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1104 | works=no |
| 1105 | AC_MSG_CHECKING(for working signed char) |
| 1106 | AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, [])) |
| 1107 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1108 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1109 | have_prototypes=no |
| 1110 | AC_MSG_CHECKING(for prototypes) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1111 | AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], |
| 1112 | AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1113 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1114 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1115 | works=no |
| 1116 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1117 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1118 | #include <stdarg.h> |
Guido van Rossum | 3f13e48 | 1996-08-30 20:58:11 +0000 | [diff] [blame] | 1119 | int foo(int x, ...) { |
| 1120 | va_list va; |
| 1121 | va_start(va, x); |
| 1122 | va_arg(va, int); |
| 1123 | va_arg(va, char *); |
| 1124 | va_arg(va, double); |
| 1125 | return 0; |
| 1126 | } |
| 1127 | ], [return foo(10, "", 3.14);], |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1128 | AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes) |
| 1129 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1130 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1131 | if test "$have_prototypes" = yes; then |
| 1132 | bad_prototypes=no |
| 1133 | AC_MSG_CHECKING(for bad exec* prototypes) |
| 1134 | AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], , |
| 1135 | AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes) |
| 1136 | AC_MSG_RESULT($bad_prototypes) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1137 | fi |
| 1138 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1139 | bad_forward=no |
| 1140 | AC_MSG_CHECKING(for bad static forward) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1141 | AC_TRY_RUN([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1142 | struct s { int a; int b; }; |
| 1143 | static struct s foo; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 1144 | int foobar() { |
| 1145 | static int random; |
| 1146 | random = (int) &foo; |
| 1147 | return random; |
| 1148 | } |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1149 | static struct s foo = { 1, 2 }; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 1150 | main() { |
| 1151 | exit(!((int)&foo == foobar())); |
| 1152 | } |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1153 | ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes) |
| 1154 | AC_MSG_RESULT($bad_forward) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1155 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1156 | va_list_is_array=no |
| 1157 | AC_MSG_CHECKING(whether va_list is an array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1158 | AC_TRY_COMPILE([ |
| 1159 | #ifdef HAVE_STDARG_PROTOTYPES |
| 1160 | #include <stdarg.h> |
| 1161 | #else |
| 1162 | #include <varargs.h> |
| 1163 | #endif |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 1164 | ], [va_list list1, list2; list1 = list2;], , |
| 1165 | AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes) |
| 1166 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1167 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1168 | # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( |
| 1169 | AC_CHECK_FUNC(gethostbyname_r, [ |
| 1170 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 1171 | AC_MSG_CHECKING([gethostbyname_r with 6 args]) |
| 1172 | OLD_CFLAGS=$CFLAGS |
| 1173 | CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" |
| 1174 | AC_TRY_COMPILE([ |
| 1175 | # include <netdb.h> |
| 1176 | ], [ |
| 1177 | char *name; |
| 1178 | struct hostent *he, *res; |
| 1179 | char buffer[2048]; |
| 1180 | int buflen = 2048; |
| 1181 | int h_errnop; |
| 1182 | |
| 1183 | (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) |
| 1184 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1185 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1186 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 1187 | AC_MSG_RESULT(yes) |
| 1188 | ], [ |
| 1189 | AC_MSG_RESULT(no) |
| 1190 | AC_MSG_CHECKING([gethostbyname_r with 5 args]) |
| 1191 | AC_TRY_COMPILE([ |
| 1192 | # include <netdb.h> |
| 1193 | ], [ |
| 1194 | char *name; |
| 1195 | struct hostent *he; |
| 1196 | char buffer[2048]; |
| 1197 | int buflen = 2048; |
| 1198 | int h_errnop; |
| 1199 | |
| 1200 | (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) |
| 1201 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1202 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1203 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 1204 | AC_MSG_RESULT(yes) |
| 1205 | ], [ |
| 1206 | AC_MSG_RESULT(no) |
| 1207 | AC_MSG_CHECKING([gethostbyname_r with 3 args]) |
| 1208 | AC_TRY_COMPILE([ |
| 1209 | # include <netdb.h> |
| 1210 | ], [ |
| 1211 | char *name; |
| 1212 | struct hostent *he; |
| 1213 | struct hostent_data data; |
| 1214 | |
| 1215 | (void) gethostbyname_r(name, he, &data); |
| 1216 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1217 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1218 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG) |
| 1219 | AC_MSG_RESULT(yes) |
| 1220 | ], [ |
| 1221 | AC_MSG_RESULT(no) |
| 1222 | ]) |
| 1223 | ]) |
| 1224 | ]) |
| 1225 | CFLAGS=$OLD_CFLAGS |
| 1226 | ], [ |
Thomas Wouters | 3a58420 | 2000-08-05 23:28:51 +0000 | [diff] [blame] | 1227 | AC_CHECK_FUNCS(gethostbyname) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1228 | ]) |
| 1229 | AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 1230 | AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 1231 | AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG) |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 1232 | AC_SUBST(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 1233 | AC_SUBST(HAVE_GETHOSTBYNAME) |
| 1234 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1235 | # checks for system services |
| 1236 | # (none yet) |
| 1237 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 1238 | # Linux requires this for correct f.p. operations |
Jeremy Hylton | be28f5b | 2000-07-27 21:03:04 +0000 | [diff] [blame] | 1239 | AC_CHECK_FUNC(__fpu_control, |
| 1240 | [], |
| 1241 | [AC_CHECK_LIB(ieee, __fpu_control) |
| 1242 | ]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1243 | |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1244 | # Check for --with-fpectl |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1245 | AC_MSG_CHECKING(for --with-fpectl) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1246 | AC_ARG_WITH(fpectl, |
| 1247 | [ --with-fpectl enable SIGFPE catching], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1248 | if test "$withval" != no |
| 1249 | then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) |
| 1250 | else AC_MSG_RESULT(no) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1251 | fi], |
| 1252 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1253 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1254 | # check for --with-libm=... |
| 1255 | AC_SUBST(LIBM) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 1256 | case $ac_sys_system in |
Guido van Rossum | 3dc0a51 | 2000-10-05 18:00:06 +0000 | [diff] [blame] | 1257 | Darwin) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 1258 | next) ;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 1259 | BeOS) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 1260 | *) LIBM=-lm |
| 1261 | esac |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1262 | AC_MSG_CHECKING(for --with-libm=STRING) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1263 | AC_ARG_WITH(libm, [ --with-libm=STRING math library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1264 | if test "$withval" = no |
| 1265 | then LIBM= |
| 1266 | AC_MSG_RESULT(force LIBM empty) |
| 1267 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1268 | then LIBM=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1269 | AC_MSG_RESULT(set LIBM=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1270 | else AC_ERROR(proper usage is --with-libm=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1271 | fi], |
| 1272 | [AC_MSG_RESULT(default LIBM=\"$LIBM\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1273 | |
| 1274 | # check for --with-libc=... |
| 1275 | AC_SUBST(LIBC) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1276 | AC_MSG_CHECKING(for --with-libc=STRING) |
Barry Warsaw | c0d24d8 | 2000-06-29 16:12:00 +0000 | [diff] [blame] | 1277 | AC_ARG_WITH(libc, [ --with-libc=STRING C library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1278 | if test "$withval" = no |
| 1279 | then LIBC= |
| 1280 | AC_MSG_RESULT(force LIBC empty) |
| 1281 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1282 | then LIBC=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1283 | AC_MSG_RESULT(set LIBC=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1284 | else AC_ERROR(proper usage is --with-libc=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 1285 | fi], |
| 1286 | [AC_MSG_RESULT(default LIBC=\"$LIBC\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 1287 | |
Guido van Rossum | 4c3f57c | 2001-01-10 20:40:46 +0000 | [diff] [blame] | 1288 | # check for --with-check-import-case |
| 1289 | AC_ARG_WITH(check-import-case, |
| 1290 | [ --with-check-import-case enable imported module name case checking],,) |
| 1291 | AC_MSG_CHECKING(for --with-check-import-case) |
| 1292 | if test "$with_check_import_case" |
| 1293 | then |
| 1294 | AC_DEFINE(CHECK_IMPORT_CASE) |
| 1295 | AC_MSG_RESULT(yes) |
| 1296 | else |
| 1297 | AC_MSG_RESULT(no) |
| 1298 | fi |
| 1299 | |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 1300 | # check for hypot() in math library |
| 1301 | LIBS_SAVE=$LIBS |
| 1302 | LIBS="$LIBS $LIBM" |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 1303 | AC_REPLACE_FUNCS(hypot) |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 1304 | LIBS=$LIBS_SAVE |
| 1305 | |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 1306 | # check whether malloc(0) returns NULL or not |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 1307 | AC_MSG_CHECKING(what malloc(0) returns) |
| 1308 | AC_CACHE_VAL(ac_cv_malloc_zero, |
| 1309 | [AC_TRY_RUN([#include <stdio.h> |
| 1310 | #ifdef HAVE_STDLIB |
| 1311 | #include <stdlib.h> |
| 1312 | #else |
| 1313 | char *malloc(), *realloc(); |
| 1314 | int *free(); |
| 1315 | #endif |
| 1316 | main() { |
| 1317 | char *p; |
| 1318 | p = malloc(0); |
| 1319 | if (p == NULL) exit(1); |
| 1320 | p = realloc(p, 0); |
| 1321 | if (p == NULL) exit(1); |
| 1322 | free(p); |
| 1323 | exit(0); |
| 1324 | }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)]) |
| 1325 | AC_MSG_RESULT($ac_cv_malloc_zero) |
| 1326 | if test "$ac_cv_malloc_zero" = null |
| 1327 | then |
| 1328 | AC_DEFINE(MALLOC_ZERO_RETURNS_NULL) |
| 1329 | fi |
| 1330 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1331 | # check for wchar.h |
| 1332 | AC_CHECK_HEADER(wchar.h, |
| 1333 | AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes", |
| 1334 | wchar_h="no" |
| 1335 | ) |
| 1336 | |
| 1337 | # check for usable wchar_t |
| 1338 | usable_wchar_t="unkown" |
| 1339 | AC_MSG_CHECKING(for usable wchar_t) |
| 1340 | AC_TRY_RUN([ |
| 1341 | #include "wchar.h" |
| 1342 | #include "wctype.h" |
| 1343 | main() { |
| 1344 | wchar_t s; |
| 1345 | if (sizeof(s) == 2) |
| 1346 | exit(0); |
| 1347 | else |
| 1348 | exit(1); |
| 1349 | } |
| 1350 | ], |
| 1351 | AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes", |
| 1352 | usable_wchar_t="no") |
| 1353 | AC_MSG_RESULT($usable_wchar_t) |
| 1354 | |
| 1355 | # check for endianness |
| 1356 | AC_C_BIGENDIAN |
| 1357 | |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1358 | # Check whether right shifting a negative integer extends the sign bit |
| 1359 | # or fills with zeros (like the Cray J90, according to Tim Peters). |
| 1360 | AC_MSG_CHECKING(whether right shift extends the sign bit) |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 1361 | AC_CACHE_VAL(ac_cv_rshift_extends_sign, [ |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1362 | AC_TRY_RUN([ |
| 1363 | int main() |
| 1364 | { |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 1365 | exit(((-1)>>3 == -1) ? 0 : 1); |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1366 | } |
Vladimir Marangozov | a618028 | 2000-07-12 05:05:06 +0000 | [diff] [blame] | 1367 | ], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)]) |
| 1368 | AC_MSG_RESULT($ac_cv_rshift_extends_sign) |
| 1369 | if test "$ac_cv_rshift_extends_sign" = no |
| 1370 | then |
| 1371 | AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS) |
| 1372 | fi |
| 1373 | |
Guido van Rossum | cadfaec | 2001-01-05 14:45:49 +0000 | [diff] [blame] | 1374 | # check for getc_unlocked and related locking functions |
| 1375 | AC_MSG_CHECKING(for getc_unlocked() and friends) |
| 1376 | AC_CACHE_VAL(ac_cv_have_getc_unlocked, [ |
| 1377 | AC_TRY_LINK([#include <stdio.h>],[ |
| 1378 | FILE *f = fopen("/dev/null", "r"); |
| 1379 | flockfile(f); |
| 1380 | getc_unlocked(f); |
| 1381 | funlockfile(f); |
| 1382 | ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)]) |
| 1383 | AC_MSG_RESULT($ac_cv_have_getc_unlocked) |
| 1384 | if test "$ac_cv_have_getc_unlocked" = yes |
| 1385 | then |
| 1386 | AC_DEFINE(HAVE_GETC_UNLOCKED) |
| 1387 | fi |
Vladimir Marangozov | 9a5a5d1 | 2000-07-12 03:02:16 +0000 | [diff] [blame] | 1388 | |
Guido van Rossum | 95713eb | 2000-05-18 20:53:31 +0000 | [diff] [blame] | 1389 | # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS! |
| 1390 | # Add sys/socket.h to confdefs.h |
| 1391 | cat >> confdefs.h <<\EOF |
| 1392 | #ifdef HAVE_SYS_SOCKET_H |
| 1393 | #include <sys/socket.h> |
| 1394 | #endif |
| 1395 | EOF |
| 1396 | AC_CHECK_TYPE(socklen_t, int) |
| 1397 | |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1398 | #AC_MSG_CHECKING(for Modules/Setup) |
| 1399 | #if test ! -f Modules/Setup ; then |
| 1400 | # if test ! -d Modules ; then |
| 1401 | # mkdir Modules |
| 1402 | # fi |
| 1403 | # cp "$srcdir/Modules/Setup.dist" Modules/Setup |
| 1404 | # AC_MSG_RESULT(creating) |
| 1405 | #else |
| 1406 | # AC_MSG_RESULT(already exists) |
| 1407 | #fi |
| 1408 | |
| 1409 | AC_SUBST(SRCDIRS) |
| 1410 | SRCDIRS="Parser Grammar Objects Python Modules" |
Andrew M. Kuchling | 8abedde | 2001-01-26 22:55:24 +0000 | [diff] [blame] | 1411 | AC_MSG_CHECKING(for build directories) |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1412 | for dir in $SRCDIRS; do |
| 1413 | if test ! -d $dir; then |
| 1414 | mkdir $dir |
Fred Drake | 884d3ba | 2000-11-02 17:52:56 +0000 | [diff] [blame] | 1415 | fi |
Neil Schemenauer | 55f0cf3 | 2001-01-24 17:24:33 +0000 | [diff] [blame] | 1416 | done |
| 1417 | AC_MSG_RESULT(done) |
Fred Drake | 036144d | 2000-10-26 17:09:35 +0000 | [diff] [blame] | 1418 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1419 | # generate output files |
Andrew M. Kuchling | 8abedde | 2001-01-26 22:55:24 +0000 | [diff] [blame] | 1420 | AC_OUTPUT(Makefile.pre Modules/Setup.config) |
Neil Schemenauer | 61c5115 | 2001-01-26 16:18:16 +0000 | [diff] [blame] | 1421 | |
| 1422 | echo "creating Setup" |
| 1423 | if test ! -f Modules/Setup |
| 1424 | then |
| 1425 | cp $srcdir/Modules/Setup.dist Modules/Setup |
| 1426 | fi |
| 1427 | |
| 1428 | echo "creating Setup.local" |
| 1429 | if test ! -f Modules/Setup.local |
| 1430 | then |
| 1431 | echo "# Edit this file for local setup changes" >Modules/Setup.local |
| 1432 | fi |
| 1433 | |
| 1434 | echo "creating Makefile" |
| 1435 | $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ |
| 1436 | -s Modules Modules/Setup.config \ |
| 1437 | Modules/Setup Modules/Setup.local |