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