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