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