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