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 | 6a6a77c | 2000-03-31 15:15:17 +0000 | [diff] [blame] | 9 | VERSION=1.6 |
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, |
| 16 | [--with-next-archs='arch1 arch2 ..' build MAB binary], [ |
| 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, |
| 36 | [--with-next-framework Build (OpenStep|Rhapsody|MacOS10) framework],,) |
| 37 | AC_ARG_WITH(dyld, |
| 38 | [--with-dyld Use (OpenStep|Rhapsody|MacOS10) 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` |
| 46 | if test "$ac_sys_system" = "AIX" ; then |
| 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) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +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 |
| 138 | OPT="-DUSE_DL_EXPORT -O3 -mpentiumpro" |
| 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 | ;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 151 | *) without_gcc=no;; |
| 152 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 153 | AC_MSG_RESULT($without_gcc) |
| 154 | |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 155 | AC_SUBST(SET_CXX) |
| 156 | AC_SUBST(MAINOBJ) |
| 157 | MAINOBJ=python.o |
| 158 | AC_MSG_CHECKING(for --with-cxx=<compiler>) |
| 159 | AC_ARG_WITH(cxx, [--with-cxx=<compiler> enable C++ support],[ |
| 160 | case $withval in |
| 161 | no) CXX= |
| 162 | with_cxx=no;; |
| 163 | *) CXX=$withval |
| 164 | MAINOBJ=ccpython.o |
| 165 | with_cxx=$withval;; |
| 166 | esac], [ |
| 167 | with_cxx=no |
| 168 | ]) |
| 169 | AC_MSG_RESULT($with_cxx) |
| 170 | SET_CXX="CXX = $CXX" |
| 171 | |
| 172 | #AC_MSG_CHECKING(CCC) |
| 173 | #if test -z "$CCC" |
| 174 | #then |
| 175 | # case $ac_sys_system in |
| 176 | # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; |
| 177 | # Linux*) SET_CCC="CCC= g++";; |
| 178 | # *) SET_CCC="" |
| 179 | # esac |
| 180 | #else |
| 181 | # SET_CCC="CCC= ${CCC}" |
| 182 | #fi |
| 183 | #AC_MSG_RESULT($SET_CCC) |
| 184 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 185 | # If the user switches compilers, we can't believe the cache |
| 186 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 187 | then |
| 188 | AC_ERROR(cached CC is different -- throw away $cache_file |
| 189 | (it is also a good idea to do 'make clean' before compiling)) |
| 190 | fi |
| 191 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 192 | AC_PROG_CC |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 193 | |
Guido van Rossum | dd997f7 | 1998-10-07 19:58:26 +0000 | [diff] [blame] | 194 | case $MACHDEP in |
| 195 | bsdos*) |
| 196 | case $CC in |
| 197 | gcc) CC="$CC -D_HAVE_BSDI";; |
| 198 | esac;; |
| 199 | esac |
| 200 | |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 201 | case $ac_sys_system in |
| 202 | hp*|HP*) |
| 203 | case $CC in |
| 204 | cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";; |
| 205 | esac;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 206 | BeOS*) |
| 207 | case $CC in |
| 208 | cc) CC=cc;; |
| 209 | esac;; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 210 | esac |
| 211 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 212 | # LDLIBRARY is the name of the library to link against (as opposed to the |
| 213 | # name of the library into which to insert object files). On systems |
| 214 | # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in |
| 215 | # the Makefiles). |
| 216 | AC_SUBST(MAKE_LDLIBRARY) |
| 217 | AC_SUBST(LDLIBRARY) |
| 218 | LDLIBRARY='' |
| 219 | |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 220 | # 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] | 221 | # This is altered for AIX and BeOS in order to build the export list before |
| 222 | # linking. |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 223 | AC_SUBST(LINKCC) |
| 224 | AC_MSG_CHECKING(LINKCC) |
Guido van Rossum | 9501219 | 1999-12-16 17:50:52 +0000 | [diff] [blame] | 225 | if test -z "$LINKCC" -a ! -z "$CXX" |
| 226 | then |
| 227 | LINKCC="$CXX" |
| 228 | fi |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 229 | if test -z "$LINKCC" |
| 230 | then |
| 231 | case $ac_sys_system in |
| 232 | AIX*) |
Guido van Rossum | 45140f9 | 1997-08-29 18:44:06 +0000 | [diff] [blame] | 233 | LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 234 | BeOS*) |
Guido van Rossum | 2666a15 | 1998-12-17 18:07:35 +0000 | [diff] [blame] | 235 | LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)" |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 236 | LDLIBRARY='libpython$(VERSION).so';; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 237 | dgux*) |
| 238 | LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; |
Guido van Rossum | 25f9303 | 1997-08-18 16:00:04 +0000 | [diff] [blame] | 239 | *) LINKCC="\$(PURIFY) \$(CC)";; |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 240 | esac |
| 241 | fi |
| 242 | AC_MSG_RESULT($LINKCC) |
| 243 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 244 | AC_MSG_CHECKING(LDLIBRARY) |
| 245 | |
| 246 | # NeXT framework builds require that the 'ar' library be converted into |
| 247 | # a bundle using libtool. |
| 248 | if test "$with_next_framework" |
| 249 | then |
| 250 | LDLIBRARY='libpython$(VERSION).dylib' |
| 251 | fi |
| 252 | |
| 253 | # DG/UX requires some fancy ld contortions to produce a .so from an .a |
| 254 | if test "$MACHDEP" = "dguxR4" |
| 255 | then |
| 256 | LDLIBRARY='libpython$(VERSION).so' |
| 257 | OPT="$OPT -pic" |
| 258 | fi |
| 259 | AC_MSG_RESULT($LDLIBRARY) |
| 260 | |
| 261 | # If LDLIBRARY is different from LIBRARY, emit a rule to build it. |
| 262 | if test -z "$LDLIBRARY" |
| 263 | then |
| 264 | LDLIBRARY='libpython$(VERSION).a' |
| 265 | MAKE_LDLIBRARY="true" |
| 266 | else |
| 267 | MAKE_LDLIBRARY='$(MAKE) $(LDLIBRARY)' |
| 268 | fi |
| 269 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 270 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 271 | AC_SUBST(AR) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 272 | AC_CHECK_PROGS(AR, ar aal, ar) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 273 | AC_SUBST(INSTALL) |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 274 | AC_SUBST(INSTALL_PROGRAM) |
| 275 | AC_SUBST(INSTALL_DATA) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 276 | # Install just never works :-( |
| 277 | if test -z "$INSTALL" |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 278 | then |
| 279 | INSTALL=cp |
| 280 | INSTALL_PROGRAM=cp |
| 281 | INSTALL_DATA=cp |
| 282 | else |
| 283 | INSTALL_PROGRAM="$INSTALL" |
| 284 | INSTALL_DATA="$INSTALL -m 644" |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 285 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 286 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 287 | # Not every filesystem supports hard links |
| 288 | AC_SUBST(LN) |
| 289 | if test -z "$LN" ; then |
| 290 | case $ac_sys_system in |
| 291 | BeOS*) LN="ln -s";; |
| 292 | *) LN=ln;; |
| 293 | esac |
| 294 | fi |
| 295 | |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 296 | # Optimizer/debugger flags passed between Makefiles |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 297 | AC_SUBST(OPT) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 298 | if test -z "$OPT" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 299 | then |
Guido van Rossum | b5875b6 | 1997-07-18 23:29:09 +0000 | [diff] [blame] | 300 | case $GCC in |
| 301 | yes) |
| 302 | case $ac_cv_prog_cc_g in |
| 303 | yes) OPT="-g -O2";; |
| 304 | *) OPT="-O2";; |
| 305 | esac |
| 306 | ;; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 307 | *) OPT="-O";; |
| 308 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 309 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 310 | |
Guido van Rossum | 6f2260e | 1996-09-09 16:21:03 +0000 | [diff] [blame] | 311 | if test "$ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 312 | then |
| 313 | OPT="$OPT $ac_arch_flags" |
| 314 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 315 | # checks for UNIX variants that set C preprocessor variables |
| 316 | AC_AIX |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 317 | AC_MINIX |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 318 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 319 | AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) |
| 320 | AC_CACHE_VAL(ac_cv_opt_olimit_ok, |
| 321 | [ac_save_cc="$CC" |
| 322 | CC="$CC -OPT:Olimit=0" |
| 323 | AC_TRY_RUN([int main() { return 0; }], |
| 324 | ac_cv_opt_olimit_ok=yes, |
| 325 | ac_cv_opt_olimit_ok=no) |
| 326 | CC="$ac_save_cc"]) |
| 327 | AC_MSG_RESULT($ac_cv_opt_olimit_ok) |
Guido van Rossum | 2efa34b | 1997-10-23 17:43:11 +0000 | [diff] [blame] | 328 | if test $ac_cv_opt_olimit_ok = yes; then |
Guido van Rossum | 304dd2d | 1997-10-20 23:10:56 +0000 | [diff] [blame] | 329 | OPT="$OPT -OPT:Olimit=0" |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 330 | else |
| 331 | AC_MSG_CHECKING(whether $CC accepts -Olimit 1500) |
| 332 | AC_CACHE_VAL(ac_cv_olimit_ok, |
| 333 | [ac_save_cc="$CC" |
| 334 | CC="$CC -Olimit 1500" |
| 335 | AC_TRY_RUN([int main() { return 0; }], |
| 336 | ac_cv_olimit_ok=yes, |
| 337 | ac_cv_olimit_ok=no) |
| 338 | CC="$ac_save_cc"]) |
| 339 | AC_MSG_RESULT($ac_cv_olimit_ok) |
| 340 | if test $ac_cv_olimit_ok = yes; then |
| 341 | OPT="$OPT -Olimit 1500" |
| 342 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 343 | fi |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 344 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 345 | # check for ANSI or K&R ("traditional") preprocessor |
| 346 | AC_MSG_CHECKING(for C preprocessor type) |
| 347 | AC_TRY_COMPILE([ |
| 348 | #define spam(name, doc) {#name, &name, #name "() -- " doc} |
| 349 | int foo; |
| 350 | struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); |
| 351 | ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional) |
| 352 | AC_MSG_RESULT($cpp_type) |
| 353 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 354 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 355 | AC_HEADER_STDC |
Guido van Rossum | 9601315 | 1997-10-08 22:47:52 +0000 | [diff] [blame] | 356 | AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h pthread.h \ |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 357 | signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \ |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 358 | sys/audioio.h sys/file.h sys/lock.h \ |
| 359 | sys/param.h sys/select.h sys/time.h sys/times.h \ |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 360 | sys/un.h sys/utsname.h sys/wait.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 361 | AC_HEADER_DIRENT |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 362 | |
| 363 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 364 | was_it_defined=no |
| 365 | AC_MSG_CHECKING(for clock_t in time.h) |
| 366 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long)) |
| 367 | AC_MSG_RESULT($was_it_defined) |
| 368 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 369 | # Add some code to confdefs.h so that the test for off_t works on SCO |
| 370 | cat >> confdefs.h <<\EOF |
| 371 | #if defined(SCO_DS) |
| 372 | #undef _OFF_T |
| 373 | #endif |
| 374 | EOF |
| 375 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 376 | # Type availability checks |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 377 | AC_TYPE_MODE_T |
| 378 | AC_TYPE_OFF_T |
| 379 | AC_TYPE_PID_T |
| 380 | AC_TYPE_SIGNAL |
| 381 | AC_TYPE_SIZE_T |
| 382 | AC_TYPE_UID_T |
Guido van Rossum | 59903fe | 2000-04-24 15:12:04 +0000 | [diff] [blame] | 383 | AC_CHECK_TYPE(socklen_t, int) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 384 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 385 | # Sizes of various common basic types |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 386 | AC_CHECK_SIZEOF(int) |
| 387 | AC_CHECK_SIZEOF(long) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 388 | AC_CHECK_SIZEOF(void *) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 389 | AC_CHECK_SIZEOF(char) |
| 390 | AC_CHECK_SIZEOF(short) |
| 391 | AC_CHECK_SIZEOF(float) |
| 392 | AC_CHECK_SIZEOF(double) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 393 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 394 | AC_MSG_CHECKING(for long long support) |
| 395 | have_long_long=no |
| 396 | AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes) |
| 397 | AC_MSG_RESULT($have_long_long) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 398 | if test "$have_long_long" = yes ; then |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 399 | AC_CHECK_SIZEOF(long long) |
| 400 | fi |
| 401 | |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 402 | # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>. |
| 403 | AC_MSG_CHECKING(size of off_t) |
| 404 | AC_CACHE_VAL(ac_cv_sizeof_off_t, |
| 405 | [AC_TRY_RUN([#include <stdio.h> |
| 406 | #include <sys/types.h> |
| 407 | main() |
| 408 | { |
| 409 | FILE *f=fopen("conftestval", "w"); |
| 410 | if (!f) exit(1); |
| 411 | fprintf(f, "%d\n", sizeof(off_t)); |
| 412 | exit(0); |
| 413 | }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0) |
| 414 | ]) |
| 415 | AC_MSG_RESULT($ac_cv_sizeof_off_t) |
| 416 | AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t) |
| 417 | |
| 418 | AC_MSG_CHECKING(whether to enable large file support) |
Guido van Rossum | 8bc1dfd | 1999-04-10 16:01:48 +0000 | [diff] [blame] | 419 | if test "$have_long_long" = yes -a \ |
| 420 | "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ |
| 421 | "$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] | 422 | AC_DEFINE(HAVE_LARGEFILE_SUPPORT) |
| 423 | AC_MSG_RESULT(yes) |
| 424 | else |
| 425 | AC_MSG_RESULT(no) |
| 426 | fi |
| 427 | |
| 428 | |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 429 | # Minor variations in building a framework between NextStep versions 4 and 5 |
| 430 | AC_SUBST(LIBTOOL_CRUFT) |
| 431 | case $ac_sys_system/$ac_sys_release in |
| 432 | next/4*) |
| 433 | ns_undef_sym='__environ' |
| 434 | LIBTOOL_CRUFT="-U $ns_undef_sym" ;; |
| 435 | next/5*) |
| 436 | ns_undef_sym='_environ' |
| 437 | LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;; |
| 438 | esac |
| 439 | |
| 440 | AC_MSG_CHECKING(for --with-next-framework) |
| 441 | if test "$with_next_framework" |
| 442 | then |
| 443 | OPT="$OPT -fno-common" |
| 444 | # -U __environ is needed since bundles don't have access |
| 445 | # to crt0 when built but will always be linked against it |
| 446 | LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym" |
| 447 | AC_DEFINE(WITH_NEXT_FRAMEWORK) |
| 448 | AC_MSG_RESULT(yes) |
| 449 | else |
| 450 | AC_MSG_RESULT(no) |
| 451 | fi |
| 452 | |
| 453 | AC_MSG_CHECKING(for --with-dyld) |
| 454 | if test "$with_next_framework" -o "$with_dyld" |
| 455 | then |
| 456 | if test "$with_dyld" |
| 457 | then |
| 458 | AC_MSG_RESULT(yes) |
| 459 | else |
| 460 | AC_MSG_RESULT(required for framework build) |
| 461 | fi |
| 462 | AC_DEFINE(WITH_DYLD) |
| 463 | ns_dyld='set' |
| 464 | else |
| 465 | AC_MSG_RESULT(no) |
| 466 | fi |
| 467 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 468 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 469 | AC_SUBST(SO) |
| 470 | AC_SUBST(LDSHARED) |
| 471 | AC_SUBST(CCSHARED) |
| 472 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 473 | # SO is the extension of shared libraries `(including the dot!) |
| 474 | # -- usually .so, .sl on HP-UX |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 475 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 476 | if test -z "$SO" |
| 477 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 478 | case $ac_sys_system in |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 479 | hp*|HP*) SO=.sl;; |
| 480 | *) SO=.so;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 481 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 482 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 483 | AC_MSG_RESULT($SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 484 | # LDSHARED is the ld *command* used to create shared library |
| 485 | # -- "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] | 486 | # (Shared libraries in this instance are shared modules to be loaded into |
| 487 | # Python, as opposed to building Python itself as a shared library.) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 488 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 489 | if test -z "$LDSHARED" |
| 490 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 491 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 45140f9 | 1997-08-29 18:44:06 +0000 | [diff] [blame] | 492 | AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 493 | BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";; |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 494 | IRIX/5*) LDSHARED="ld -shared";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 495 | IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 496 | SunOS/4*) LDSHARED="ld";; |
| 497 | SunOS/5*) LDSHARED="ld -G";; |
| 498 | hp*|HP*) LDSHARED="ld -b";; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 499 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 500 | DYNIX/ptx*) LDSHARED="ld -G";; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 501 | next/*) |
| 502 | if test "$ns_dyld" |
| 503 | then LDSHARED='$(CC) $(LDFLAGS) -bundle -prebind' |
| 504 | else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r'; |
| 505 | fi |
| 506 | if test "$with_next_framework" ; then |
| 507 | LDSHARED="$LDSHARED \$(LDLIBRARY)" |
| 508 | fi ;; |
Guido van Rossum | 81652ab | 1996-07-21 02:53:27 +0000 | [diff] [blame] | 509 | Linux*) LDSHARED="gcc -shared";; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 510 | dgux*) LDSHARED="ld -G";; |
Guido van Rossum | 458e7fa | 1999-09-17 15:40:40 +0000 | [diff] [blame] | 511 | BSD/OS*/4*) LDSHARED="gcc -shared";; |
Guido van Rossum | a8acf72 | 1999-04-27 22:06:08 +0000 | [diff] [blame] | 512 | FreeBSD*/[[34]]*) LDSHARED="gcc -shared";; |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 513 | FreeBSD*|OpenBSD*) LDSHARED="ld -Bshareable";; |
| 514 | NetBSD*) |
| 515 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 516 | then |
| 517 | LDSHARED="cc -shared" |
| 518 | else |
| 519 | LDSHARED="ld -Bshareable" |
| 520 | fi;; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 521 | SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 522 | *) LDSHARED="ld";; |
| 523 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 524 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 525 | AC_MSG_RESULT($LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 526 | # 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] | 527 | # library (module) -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 528 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 529 | if test -z "$CCSHARED" |
| 530 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 531 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 532 | hp*|HP*) if test "$GCC" = yes; |
| 533 | then CCSHARED="-fpic"; |
| 534 | else CCSHARED="+z"; |
| 535 | fi;; |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 536 | Linux*) CCSHARED="-fpic";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 537 | BSD/OS*/4*) CCSHARED="-fpic";; |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 538 | FreeBSD*|OpenBSD*) CCSHARED="-fpic";; |
| 539 | NetBSD*) CCSHARED="-fPIC";; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 540 | SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 541 | IRIX*/6*) case $CC in |
| 542 | *gcc*) CCSHARED="-shared";; |
Guido van Rossum | ee21f41 | 1998-04-20 18:51:54 +0000 | [diff] [blame] | 543 | *) CCSHARED="";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 544 | esac;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 545 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 546 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 547 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 548 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 549 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 550 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 551 | if test -z "$LINKFORSHARED" |
| 552 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 553 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 69f6580 | 1998-03-03 21:47:00 +0000 | [diff] [blame] | 554 | AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';; |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 555 | hp*|HP*) |
Guido van Rossum | 304dd2d | 1997-10-20 23:10:56 +0000 | [diff] [blame] | 556 | LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
Guido van Rossum | f5957ea | 1999-10-05 21:59:33 +0000 | [diff] [blame] | 557 | BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | a8acf72 | 1999-04-27 22:06:08 +0000 | [diff] [blame] | 558 | FreeBSD/[[34]]*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 2d9feed | 1997-11-24 17:36:21 +0000 | [diff] [blame] | 559 | Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 54ecc3d | 1999-01-27 17:53:11 +0000 | [diff] [blame] | 560 | # -u libsys_s pulls in all symbols in libsys |
| 561 | next/2*|next/3*) LINKFORSHARED="-u libsys_s";; |
| 562 | # -u __dummy makes the linker aware of the objc runtime |
| 563 | # in System.framework; otherwise, __objcInit (referenced in |
| 564 | # crt1.o) gets erroneously defined as common, which breaks dynamic |
| 565 | # loading of any modules which reference it in System.framework |
| 566 | next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 567 | SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; |
Guido van Rossum | df69365 | 1999-01-07 21:50:41 +0000 | [diff] [blame] | 568 | NetBSD*) |
| 569 | if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]] |
| 570 | then |
| 571 | LINKFORSHARED="-Wl,--export-dynamic" |
| 572 | fi;; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 573 | SunOS/5*) case $CC in |
| 574 | *gcc*) |
Guido van Rossum | 9c6ba9b | 2000-02-03 13:42:50 +0000 | [diff] [blame] | 575 | if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 576 | then |
| 577 | LINKFORSHARED="-Xlinker --export-dynamic" |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 578 | fi;; |
| 579 | esac;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 580 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 581 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 582 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 583 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 584 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 585 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 586 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX |
Guido van Rossum | 0eefa3f | 1999-11-16 15:57:37 +0000 | [diff] [blame] | 587 | |
| 588 | # checks for system dependent C++ extensions support |
| 589 | case "$ac_sys_system" in |
| 590 | AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support) |
| 591 | AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"], |
| 592 | [loadAndInit("", 0, "")], |
| 593 | [AC_DEFINE(AIX_GENUINE_CPLUSPLUS) |
| 594 | AC_MSG_RESULT(yes)], |
| 595 | [AC_MSG_RESULT(no)]);; |
| 596 | *) ;; |
| 597 | esac |
| 598 | |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 599 | # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. |
| 600 | # However on SGI IRIX, these exist but are broken. |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 601 | # BeOS' sockets are stashed in libnet. |
| 602 | case "$ac_sys_system" in |
| 603 | IRIX*) ;; |
Guido van Rossum | 2cb5660 | 1998-05-07 13:25:56 +0000 | [diff] [blame] | 604 | *) |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 605 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 606 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 607 | AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS |
| 608 | ;; |
| 609 | esac |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 610 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 611 | AC_MSG_CHECKING(for --with-libs) |
| 612 | AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [ |
| 613 | AC_MSG_RESULT($withval) |
| 614 | LIBS="$withval $LIBS" |
| 615 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 616 | |
Guido van Rossum | 8c4ed9a | 1996-12-31 22:34:17 +0000 | [diff] [blame] | 617 | AC_MSG_CHECKING(for --with(out)-readline) |
Guido van Rossum | 8c4ed9a | 1996-12-31 22:34:17 +0000 | [diff] [blame] | 618 | AC_ARG_WITH(readline, |
Guido van Rossum | 3c7c678 | 1997-08-05 21:47:42 +0000 | [diff] [blame] | 619 | [--with(out)-readline obsolete, edit Modules/Setup instead], |
| 620 | [AC_MSG_RESULT($withval) |
| 621 | AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)], |
| 622 | [AC_MSG_RESULT(not specified.)]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 623 | |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 624 | AC_SUBST(USE_THREAD_MODULE) |
| 625 | USE_THREAD_MODULE="#" |
| 626 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 627 | AC_MSG_CHECKING(for --with-dec-threads) |
| 628 | AC_SUBST(LDLAST) |
| 629 | AC_ARG_WITH(dec-threads, |
| 630 | [--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], |
| 631 | [AC_MSG_RESULT($withval) |
| 632 | LDLAST=-threads |
Guido van Rossum | f78abae | 1997-01-21 22:02:36 +0000 | [diff] [blame] | 633 | if test "${with_thread+set}" != set; then |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 634 | with_thread="$withval"; |
| 635 | fi], |
| 636 | AC_MSG_RESULT(no)) |
| 637 | |
| 638 | AC_MSG_CHECKING(for --with-threads) |
| 639 | AC_ARG_WITH(threads, [--with-threads alias for --with-thread], |
| 640 | [AC_MSG_RESULT($withval) |
| 641 | if test "${with_thread+set}" != set; then |
| 642 | with_thread="$withval"; |
| 643 | fi], |
| 644 | AC_MSG_RESULT(no)) |
| 645 | |
| 646 | AC_MSG_CHECKING(for --with-thread) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 647 | AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [ |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 648 | USE_THREAD_MODULE= |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 649 | AC_MSG_RESULT($withval) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 650 | if test -d "$withval" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 651 | then LDFLAGS="$LDFLAGS -L$withval" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 652 | fi |
Guido van Rossum | 9caf77a | 1996-08-01 00:52:26 +0000 | [diff] [blame] | 653 | AC_DEFINE(_REENTRANT) |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 654 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 655 | AC_DEFINE(C_THREADS) |
| 656 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 07bd90e | 2000-05-08 13:41:38 +0000 | [diff] [blame^] | 657 | AC_CHECK_LIB(pth, pth_init, [AC_DEFINE(WITH_THREAD) |
| 658 | AC_DEFINE(_GNU_PTH) |
| 659 | LIBS="-lpth $LIBS" |
| 660 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 02a1c40 | 2000-02-25 19:26:31 +0000 | [diff] [blame] | 661 | AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 662 | AC_DEFINE(_POSIX_THREADS) |
| 663 | LIBS="-lpthread $LIBS" |
| 664 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 2666a15 | 1998-12-17 18:07:35 +0000 | [diff] [blame] | 665 | AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 666 | AC_DEFINE(_POSIX_THREADS) |
| 667 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 668 | AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) |
| 669 | AC_DEFINE(BEOS_THREADS) |
| 670 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 671 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 672 | AC_DEFINE(_POSIX_THREADS) |
| 673 | LIBS="$LIBS -lpthreads" |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 674 | LIBOBJS="$LIBOBJS thread.o"], [ |
Guido van Rossum | 4954595 | 1997-12-02 19:28:29 +0000 | [diff] [blame] | 675 | AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 676 | AC_DEFINE(_POSIX_THREADS) |
| 677 | LIBS="$LIBS -lc_r" |
| 678 | LIBOBJS="$LIBOBJS thread.o"], [ |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 679 | AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) |
| 680 | AC_DEFINE(_POSIX_THREADS) |
| 681 | LIBS="$LIBS -lthread" |
Guido van Rossum | b93a862 | 1998-05-07 13:27:32 +0000 | [diff] [blame] | 682 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 683 | AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 684 | AC_DEFINE(_POSIX_THREADS) |
| 685 | LIBS="$LIBS -lcma" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 686 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 07bd90e | 2000-05-08 13:41:38 +0000 | [diff] [blame^] | 687 | ])])])])])])])]) |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 688 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 689 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 690 | LIBS="$LIBS -lmpc" |
| 691 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 692 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 693 | LIBS="$LIBS -lthread" |
| 694 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 695 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 696 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 697 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 698 | AC_SUBST(DLINCLDIR) |
| 699 | DLINCLDIR=/ |
| 700 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 701 | AC_MSG_CHECKING(for --with-sgi-dl) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 702 | AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [ |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 703 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 704 | AC_DEFINE(WITH_SGI_DL) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 705 | DYNLOADFILE="dynload_dl.o" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 706 | dldir=$withval |
| 707 | if test -d "$dldir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 708 | then LDFLAGS="$LDFLAGS -L$dldir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 709 | else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY) |
| 710 | fi |
| 711 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 712 | LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 713 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 714 | AC_MSG_CHECKING(for --with-dl-dld) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 715 | 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] | 716 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 717 | AC_DEFINE(WITH_DL_DLD) |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 718 | DYNLOADFILE="dynload_dl.o" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 719 | dldir=`echo "$withval" | sed 's/,.*//'` |
| 720 | dlddir=`echo "$withval" | sed 's/.*,//'` |
| 721 | if test -d "$dldir" -a -d "$dlddir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 722 | then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 723 | else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY) |
| 724 | fi |
| 725 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 726 | LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 727 | |
Guido van Rossum | e97ee18 | 1999-12-20 21:27:22 +0000 | [diff] [blame] | 728 | # the dlopen() function means we might want to use dynload_shlib.o. some |
| 729 | # platforms, such as AIX, have dlopen(), but don't want to use it. |
| 730 | AC_CHECK_FUNC(dlopen) |
| 731 | |
| 732 | # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic |
| 733 | # loading of modules. |
| 734 | AC_SUBST(DYNLOADFILE) |
| 735 | AC_MSG_CHECKING(DYNLOADFILE) |
| 736 | if test -z "$DYNLOADFILE" |
| 737 | then |
| 738 | case $ac_sys_system/$ac_sys_release in |
| 739 | AIX*) DYNLOADFILE="dynload_aix.o";; |
| 740 | BeOS*) DYNLOADFILE="dynload_beos.o";; |
| 741 | hp*|HP*) DYNLOADFILE="dynload_hpux.o";; |
| 742 | next/*) DYNLOADFILE="dynload_next.o";; |
| 743 | *) |
| 744 | # use dynload_shlib.c and dlopen() if we have it; otherwise stub |
| 745 | # out any dynamic loading |
| 746 | if test "$ac_cv_func_dlopen" = yes |
| 747 | then DYNLOADFILE="dynload_shlib.o" |
| 748 | else DYNLOADFILE="dynload_stub.o" |
| 749 | fi |
| 750 | ;; |
| 751 | esac |
| 752 | fi |
| 753 | AC_MSG_RESULT($DYNLOADFILE) |
| 754 | if test "$DYNLOADFILE" != "dynload_stub.o" |
| 755 | then |
| 756 | AC_DEFINE(HAVE_DYNAMIC_LOADING) |
| 757 | fi |
| 758 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 759 | # checks for library functions |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 760 | AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ |
| 761 | flock fork fsync fdatasync fpathconf ftime ftruncate \ |
Fred Drake | f581db1 | 1999-12-14 21:11:47 +0000 | [diff] [blame] | 762 | getgroups getlogin getpeername getpgrp getpid getpwent gettimeofday getwd \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 763 | kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ |
| 764 | putenv readlink \ |
Guido van Rossum | 9601315 | 1997-10-08 22:47:52 +0000 | [diff] [blame] | 765 | select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ |
Fred Drake | 35a092f | 1999-12-13 16:23:35 +0000 | [diff] [blame] | 766 | sigaction siginterrupt sigrelse strftime strptime symlink sysconf \ |
Fred Drake | 89143df | 1999-12-09 22:03:25 +0000 | [diff] [blame] | 767 | tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ |
| 768 | truncate uname waitpid) |
Guido van Rossum | 00f0f6e | 1999-01-06 18:52:29 +0000 | [diff] [blame] | 769 | |
| 770 | # check for long file support functions |
| 771 | AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs) |
| 772 | |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 773 | AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 774 | AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) |
| 775 | AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG))) |
| 776 | AC_CHECK_FUNC(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] | 777 | |
| 778 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 779 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 780 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 781 | AC_STRUCT_TIMEZONE |
| 782 | |
| 783 | AC_MSG_CHECKING(for time.h that defines altzone) |
| 784 | AC_CACHE_VAL(ac_cv_header_time_altzone, |
| 785 | [AC_TRY_COMPILE([#include <time.h>], [return altzone;], |
| 786 | ac_cv_header_time_altzone=yes, |
| 787 | ac_cv_header_time_altzone=no)]) |
| 788 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 789 | if test $ac_cv_header_time_altzone = yes; then |
| 790 | AC_DEFINE(HAVE_ALTZONE) |
| 791 | fi |
| 792 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 793 | was_it_defined=no |
| 794 | 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] | 795 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 796 | #include <sys/types.h> |
| 797 | #include <sys/select.h> |
| 798 | #include <sys/time.h> |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 799 | ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes]) |
| 800 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 801 | |
| 802 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 803 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 804 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 805 | AC_C_CONST |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 806 | AC_C_INLINE |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 807 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 808 | works=no |
| 809 | AC_MSG_CHECKING(for working volatile) |
| 810 | AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, [])) |
| 811 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 812 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 813 | works=no |
| 814 | AC_MSG_CHECKING(for working signed char) |
| 815 | AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, [])) |
| 816 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 817 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 818 | have_prototypes=no |
| 819 | AC_MSG_CHECKING(for prototypes) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 820 | AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], |
| 821 | AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 822 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 823 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 824 | works=no |
| 825 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 826 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 827 | #include <stdarg.h> |
Guido van Rossum | 3f13e48 | 1996-08-30 20:58:11 +0000 | [diff] [blame] | 828 | int foo(int x, ...) { |
| 829 | va_list va; |
| 830 | va_start(va, x); |
| 831 | va_arg(va, int); |
| 832 | va_arg(va, char *); |
| 833 | va_arg(va, double); |
| 834 | return 0; |
| 835 | } |
| 836 | ], [return foo(10, "", 3.14);], |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 837 | AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes) |
| 838 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 839 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 840 | if test "$have_prototypes" = yes; then |
| 841 | bad_prototypes=no |
| 842 | AC_MSG_CHECKING(for bad exec* prototypes) |
| 843 | AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], , |
| 844 | AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes) |
| 845 | AC_MSG_RESULT($bad_prototypes) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 846 | fi |
| 847 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 848 | bad_forward=no |
| 849 | AC_MSG_CHECKING(for bad static forward) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 850 | AC_TRY_RUN([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 851 | struct s { int a; int b; }; |
| 852 | static struct s foo; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 853 | int foobar() { |
| 854 | static int random; |
| 855 | random = (int) &foo; |
| 856 | return random; |
| 857 | } |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 858 | static struct s foo = { 1, 2 }; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 859 | main() { |
| 860 | exit(!((int)&foo == foobar())); |
| 861 | } |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 862 | ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes) |
| 863 | AC_MSG_RESULT($bad_forward) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 864 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 865 | va_list_is_array=no |
| 866 | AC_MSG_CHECKING(whether va_list is an array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 867 | AC_TRY_COMPILE([ |
| 868 | #ifdef HAVE_STDARG_PROTOTYPES |
| 869 | #include <stdarg.h> |
| 870 | #else |
| 871 | #include <varargs.h> |
| 872 | #endif |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 873 | ], [va_list list1, list2; list1 = list2;], , |
| 874 | AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes) |
| 875 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 876 | |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 877 | # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( |
| 878 | AC_CHECK_FUNC(gethostbyname_r, [ |
| 879 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
| 880 | AC_MSG_CHECKING([gethostbyname_r with 6 args]) |
| 881 | OLD_CFLAGS=$CFLAGS |
| 882 | CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" |
| 883 | AC_TRY_COMPILE([ |
| 884 | # include <netdb.h> |
| 885 | ], [ |
| 886 | char *name; |
| 887 | struct hostent *he, *res; |
| 888 | char buffer[2048]; |
| 889 | int buflen = 2048; |
| 890 | int h_errnop; |
| 891 | |
| 892 | (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop) |
| 893 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 894 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 895 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 896 | AC_MSG_RESULT(yes) |
| 897 | ], [ |
| 898 | AC_MSG_RESULT(no) |
| 899 | AC_MSG_CHECKING([gethostbyname_r with 5 args]) |
| 900 | AC_TRY_COMPILE([ |
| 901 | # include <netdb.h> |
| 902 | ], [ |
| 903 | char *name; |
| 904 | struct hostent *he; |
| 905 | char buffer[2048]; |
| 906 | int buflen = 2048; |
| 907 | int h_errnop; |
| 908 | |
| 909 | (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop) |
| 910 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 911 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 912 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 913 | AC_MSG_RESULT(yes) |
| 914 | ], [ |
| 915 | AC_MSG_RESULT(no) |
| 916 | AC_MSG_CHECKING([gethostbyname_r with 3 args]) |
| 917 | AC_TRY_COMPILE([ |
| 918 | # include <netdb.h> |
| 919 | ], [ |
| 920 | char *name; |
| 921 | struct hostent *he; |
| 922 | struct hostent_data data; |
| 923 | |
| 924 | (void) gethostbyname_r(name, he, &data); |
| 925 | ], [ |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 926 | AC_DEFINE(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 927 | AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG) |
| 928 | AC_MSG_RESULT(yes) |
| 929 | ], [ |
| 930 | AC_MSG_RESULT(no) |
| 931 | ]) |
| 932 | ]) |
| 933 | ]) |
| 934 | CFLAGS=$OLD_CFLAGS |
| 935 | ], [ |
| 936 | AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME)) |
| 937 | ]) |
| 938 | AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG) |
| 939 | AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG) |
| 940 | AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG) |
Guido van Rossum | 8db7d8b | 1999-03-23 16:40:33 +0000 | [diff] [blame] | 941 | AC_SUBST(HAVE_GETHOSTBYNAME_R) |
Guido van Rossum | a96f0ba | 1999-03-22 21:49:51 +0000 | [diff] [blame] | 942 | AC_SUBST(HAVE_GETHOSTBYNAME) |
| 943 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 944 | # checks for system services |
| 945 | # (none yet) |
| 946 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 947 | # Linux requires this for correct f.p. operations |
| 948 | AC_CHECK_LIB(ieee, __fpu_control) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 949 | |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 950 | # Check for --with-fpectl |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 951 | AC_MSG_CHECKING(for --with-fpectl) |
| 952 | AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [ |
| 953 | if test "$withval" != no |
| 954 | then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) |
| 955 | else AC_MSG_RESULT(no) |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 956 | fi], |
| 957 | [AC_MSG_RESULT(no)]) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 958 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 959 | # check for --with-libm=... |
| 960 | AC_SUBST(LIBM) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 961 | case $ac_sys_system in |
| 962 | next) ;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 963 | BeOS) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 964 | *) LIBM=-lm |
| 965 | esac |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 966 | AC_MSG_CHECKING(for --with-libm=STRING) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 967 | AC_ARG_WITH(libm, [--with-libm=STRING math library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 968 | if test "$withval" = no |
| 969 | then LIBM= |
| 970 | AC_MSG_RESULT(force LIBM empty) |
| 971 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 972 | then LIBM=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 973 | AC_MSG_RESULT(set LIBM=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 974 | else AC_ERROR(proper usage is --with-libm=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 975 | fi], |
| 976 | [AC_MSG_RESULT(default LIBM=\"$LIBM\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 977 | |
| 978 | # check for --with-libc=... |
| 979 | AC_SUBST(LIBC) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 980 | AC_MSG_CHECKING(for --with-libc=STRING) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 981 | AC_ARG_WITH(libc, [--with-libc=STRING C library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 982 | if test "$withval" = no |
| 983 | then LIBC= |
| 984 | AC_MSG_RESULT(force LIBC empty) |
| 985 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 986 | then LIBC=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 987 | AC_MSG_RESULT(set LIBC=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 988 | else AC_ERROR(proper usage is --with-libc=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 989 | fi], |
| 990 | [AC_MSG_RESULT(default LIBC=\"$LIBC\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 991 | |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 992 | # check for hypot() in math library |
| 993 | LIBS_SAVE=$LIBS |
| 994 | LIBS="$LIBS $LIBM" |
| 995 | AC_CHECK_FUNCS(hypot) |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 996 | AC_REPLACE_FUNCS(hypot) |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 997 | LIBS=$LIBS_SAVE |
| 998 | |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 999 | # check for getopt |
| 1000 | AC_MSG_CHECKING(for genuine getopt) |
| 1001 | AC_CACHE_VAL(ac_cv_func_getopt, |
| 1002 | [AC_TRY_RUN([#include <stdio.h> |
| 1003 | extern int optind, opterr, getopt(); |
| 1004 | extern char* optarg; |
| 1005 | int main() { |
| 1006 | char* av[] = { "testprog", "parameter", "-fFlag", NULL }; |
| 1007 | opterr = 0; |
| 1008 | if (getopt(3, av, "f:") == 'f') { exit(1); } |
| 1009 | exit(0); |
| 1010 | }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl |
| 1011 | AC_MSG_RESULT($ac_cv_func_getopt) |
| 1012 | test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o" |
| 1013 | AC_SUBST(LIBOBJS)dnl |
| 1014 | |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 1015 | # check whether malloc(0) returns NULL or not |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 1016 | AC_MSG_CHECKING(what malloc(0) returns) |
| 1017 | AC_CACHE_VAL(ac_cv_malloc_zero, |
| 1018 | [AC_TRY_RUN([#include <stdio.h> |
| 1019 | #ifdef HAVE_STDLIB |
| 1020 | #include <stdlib.h> |
| 1021 | #else |
| 1022 | char *malloc(), *realloc(); |
| 1023 | int *free(); |
| 1024 | #endif |
| 1025 | main() { |
| 1026 | char *p; |
| 1027 | p = malloc(0); |
| 1028 | if (p == NULL) exit(1); |
| 1029 | p = realloc(p, 0); |
| 1030 | if (p == NULL) exit(1); |
| 1031 | free(p); |
| 1032 | exit(0); |
| 1033 | }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)]) |
| 1034 | AC_MSG_RESULT($ac_cv_malloc_zero) |
| 1035 | if test "$ac_cv_malloc_zero" = null |
| 1036 | then |
| 1037 | AC_DEFINE(MALLOC_ZERO_RETURNS_NULL) |
| 1038 | fi |
| 1039 | |
Guido van Rossum | ef2255b | 2000-03-10 22:30:29 +0000 | [diff] [blame] | 1040 | # check for wchar.h |
| 1041 | AC_CHECK_HEADER(wchar.h, |
| 1042 | AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes", |
| 1043 | wchar_h="no" |
| 1044 | ) |
| 1045 | |
| 1046 | # check for usable wchar_t |
| 1047 | usable_wchar_t="unkown" |
| 1048 | AC_MSG_CHECKING(for usable wchar_t) |
| 1049 | AC_TRY_RUN([ |
| 1050 | #include "wchar.h" |
| 1051 | #include "wctype.h" |
| 1052 | main() { |
| 1053 | wchar_t s; |
| 1054 | if (sizeof(s) == 2) |
| 1055 | exit(0); |
| 1056 | else |
| 1057 | exit(1); |
| 1058 | } |
| 1059 | ], |
| 1060 | AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes", |
| 1061 | usable_wchar_t="no") |
| 1062 | AC_MSG_RESULT($usable_wchar_t) |
| 1063 | |
| 1064 | # check for endianness |
| 1065 | AC_C_BIGENDIAN |
| 1066 | |
| 1067 | # Check for --with-wctype-functions |
| 1068 | AC_MSG_CHECKING(for --with-wctype-functions) |
| 1069 | AC_ARG_WITH(wctype-functions, |
| 1070 | [--with-wctype-functions use wctype.h functions], [ |
| 1071 | if test "$withval" != no |
| 1072 | then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes) |
| 1073 | else AC_MSG_RESULT(no) |
| 1074 | fi], |
| 1075 | [AC_MSG_RESULT(no)]) |
| 1076 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 1077 | # generate output files |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 1078 | AC_OUTPUT(Makefile \ |
| 1079 | Objects/Makefile \ |
| 1080 | Parser/Makefile \ |
| 1081 | Python/Makefile \ |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 1082 | Modules/Makefile.pre \ |
| 1083 | Modules/Setup.thread) |