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 | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 12 | if test -f /usr/lib/NextStep/software_version; then |
| 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 |
| 27 | set X `hostinfo | grep 'NeXT Mach.*:' | \ |
| 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 | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 35 | |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 36 | # Set name for machine-dependent library files |
| 37 | AC_SUBST(MACHDEP) |
| 38 | AC_MSG_CHECKING(MACHDEP) |
| 39 | if test -z "$MACHDEP" |
| 40 | then |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 41 | ac_sys_system=`uname -s` |
| 42 | if test "$ac_sys_system" = "AIX" ; then |
| 43 | ac_sys_release=`uname -v` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 44 | else |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 45 | ac_sys_release=`uname -r` |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 46 | fi |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 47 | ac_md_system=`echo $ac_sys_system | |
| 48 | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` |
| 49 | ac_md_release=`echo $ac_sys_release | |
| 50 | tr -d '[/ ]' | sed 's/\..*//'` |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 51 | MACHDEP="$ac_md_system$ac_md_release" |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 52 | |
Guido van Rossum | bcd91e0 | 1997-03-20 20:46:29 +0000 | [diff] [blame] | 53 | case $MACHDEP in |
Guido van Rossum | b97ef17 | 1997-09-28 05:44:03 +0000 | [diff] [blame] | 54 | '') MACHDEP="unknown";; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 55 | esac |
| 56 | fi |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 57 | |
| 58 | # |
| 59 | # SGI compilers allow the specification of the both the ABI and the |
| 60 | # ISA on the command line. Depending on the values of these switches, |
| 61 | # different and often incompatable code will be generated. |
| 62 | # |
| 63 | # The SGI_ABI variable can be used to modify the CC and LDFLAGS and |
| 64 | # thus supply support for various ABI/ISA combinations. The MACHDEP |
| 65 | # variable is also adjusted. |
| 66 | # |
| 67 | AC_SUBST(SGI_ABI) |
| 68 | if test ! -z "$SGI_ABI" |
| 69 | then |
| 70 | CC="cc $SGI_ABI" |
| 71 | LDFLAGS="$SGI_ABI $LDFLAGS" |
| 72 | MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` |
| 73 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 74 | AC_MSG_RESULT($MACHDEP) |
| 75 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 76 | # |
| 77 | # CCC is the command that compiles C++ programs |
| 78 | # |
| 79 | # Not all make programs have this predefined. |
| 80 | # |
| 81 | AC_SUBST(SET_CCC) |
| 82 | AC_MSG_CHECKING(CCC) |
| 83 | if test -z "$CCC" |
| 84 | then |
| 85 | case $ac_sys_system in |
| 86 | IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 87 | Linux*) SET_CCC="CCC= g++";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 88 | *) SET_CCC="" |
| 89 | esac |
| 90 | else |
| 91 | SET_CCC="CCC= ${CCC}" |
| 92 | fi |
| 93 | AC_MSG_RESULT($SET_CCC) |
| 94 | |
| 95 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 96 | # checks for alternative programs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 97 | AC_MSG_CHECKING(for --without-gcc) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 98 | AC_ARG_WITH(gcc, [--without-gcc never use gcc], [ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 99 | case $withval in |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 100 | no) CC=cc |
| 101 | without_gcc=yes;; |
| 102 | yes) CC=gcc |
| 103 | without_gcc=no;; |
| 104 | *) CC=$withval |
| 105 | without_gcc=$withval;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 106 | esac], [ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 107 | case $ac_sys_system in |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 108 | OSF1) CC=cc |
| 109 | without_gcc=;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 110 | BeOS*) CC=cc |
| 111 | without_gcc=;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 112 | *) without_gcc=no;; |
| 113 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 114 | AC_MSG_RESULT($without_gcc) |
| 115 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 116 | # If the user switches compilers, we can't believe the cache |
| 117 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 118 | then |
| 119 | AC_ERROR(cached CC is different -- throw away $cache_file |
| 120 | (it is also a good idea to do 'make clean' before compiling)) |
| 121 | fi |
| 122 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 123 | AC_PROG_CC |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 124 | |
Guido van Rossum | dd997f7 | 1998-10-07 19:58:26 +0000 | [diff] [blame] | 125 | case $MACHDEP in |
| 126 | bsdos*) |
| 127 | case $CC in |
| 128 | gcc) CC="$CC -D_HAVE_BSDI";; |
| 129 | esac;; |
| 130 | esac |
| 131 | |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 132 | case $ac_sys_system in |
| 133 | hp*|HP*) |
| 134 | case $CC in |
| 135 | cc|*/cc) CC="$CC -Aa -D_HPUX_SOURCE";; |
| 136 | esac;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 137 | BeOS*) |
| 138 | case $CC in |
| 139 | cc) CC=cc;; |
| 140 | esac;; |
Guido van Rossum | 8456161 | 1997-08-21 00:08:11 +0000 | [diff] [blame] | 141 | esac |
| 142 | |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 143 | # 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] | 144 | # This is altered for AIX and BeOS in order to build the export list before |
| 145 | # linking. |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 146 | AC_SUBST(LINKCC) |
| 147 | AC_MSG_CHECKING(LINKCC) |
| 148 | if test -z "$LINKCC" |
| 149 | then |
| 150 | case $ac_sys_system in |
| 151 | AIX*) |
Guido van Rossum | 45140f9 | 1997-08-29 18:44:06 +0000 | [diff] [blame] | 152 | LINKCC="\$(srcdir)/makexp_aix python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 153 | BeOS*) |
Guido van Rossum | 2666a15 | 1998-12-17 18:07:35 +0000 | [diff] [blame^] | 154 | LINKCC="\$(srcdir)/../BeOS/linkcc \$(LIBRARY) \$(PURIFY) \$(CC) \$(OPT)" |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 155 | REALLIBRARY='libpython$(VERSION).so';; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 156 | dgux*) |
| 157 | LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";; |
Guido van Rossum | 25f9303 | 1997-08-18 16:00:04 +0000 | [diff] [blame] | 158 | *) LINKCC="\$(PURIFY) \$(CC)";; |
Guido van Rossum | fb84255 | 1997-08-06 23:42:07 +0000 | [diff] [blame] | 159 | esac |
| 160 | fi |
| 161 | AC_MSG_RESULT($LINKCC) |
| 162 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 163 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 164 | AC_SUBST(AR) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 165 | AC_CHECK_PROGS(AR, ar aal, ar) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 166 | AC_SUBST(INSTALL) |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 167 | AC_SUBST(INSTALL_PROGRAM) |
| 168 | AC_SUBST(INSTALL_DATA) |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 169 | AC_SUBST(REALLIBRARY) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 170 | # Install just never works :-( |
| 171 | if test -z "$INSTALL" |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 172 | then |
| 173 | INSTALL=cp |
| 174 | INSTALL_PROGRAM=cp |
| 175 | INSTALL_DATA=cp |
| 176 | else |
| 177 | INSTALL_PROGRAM="$INSTALL" |
| 178 | INSTALL_DATA="$INSTALL -m 644" |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 179 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 180 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 181 | # Not every filesystem supports hard links |
| 182 | AC_SUBST(LN) |
| 183 | if test -z "$LN" ; then |
| 184 | case $ac_sys_system in |
| 185 | BeOS*) LN="ln -s";; |
| 186 | *) LN=ln;; |
| 187 | esac |
| 188 | fi |
| 189 | |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 190 | # Optimizer/debugger flags passed between Makefiles |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 191 | AC_SUBST(OPT) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 192 | if test -z "$OPT" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 193 | then |
Guido van Rossum | b5875b6 | 1997-07-18 23:29:09 +0000 | [diff] [blame] | 194 | case $GCC in |
| 195 | yes) |
| 196 | case $ac_cv_prog_cc_g in |
| 197 | yes) OPT="-g -O2";; |
| 198 | *) OPT="-O2";; |
| 199 | esac |
| 200 | ;; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 201 | *) OPT="-O";; |
| 202 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 203 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 204 | |
Guido van Rossum | 6f2260e | 1996-09-09 16:21:03 +0000 | [diff] [blame] | 205 | if test "$ac_arch_flags" |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 206 | then |
| 207 | OPT="$OPT $ac_arch_flags" |
| 208 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 209 | # checks for UNIX variants that set C preprocessor variables |
| 210 | AC_AIX |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 211 | AC_MINIX |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 212 | |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 213 | AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0) |
| 214 | AC_CACHE_VAL(ac_cv_opt_olimit_ok, |
| 215 | [ac_save_cc="$CC" |
| 216 | CC="$CC -OPT:Olimit=0" |
| 217 | AC_TRY_RUN([int main() { return 0; }], |
| 218 | ac_cv_opt_olimit_ok=yes, |
| 219 | ac_cv_opt_olimit_ok=no) |
| 220 | CC="$ac_save_cc"]) |
| 221 | AC_MSG_RESULT($ac_cv_opt_olimit_ok) |
Guido van Rossum | 2efa34b | 1997-10-23 17:43:11 +0000 | [diff] [blame] | 222 | if test $ac_cv_opt_olimit_ok = yes; then |
Guido van Rossum | 304dd2d | 1997-10-20 23:10:56 +0000 | [diff] [blame] | 223 | OPT="$OPT -OPT:Olimit=0" |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 224 | else |
| 225 | AC_MSG_CHECKING(whether $CC accepts -Olimit 1500) |
| 226 | AC_CACHE_VAL(ac_cv_olimit_ok, |
| 227 | [ac_save_cc="$CC" |
| 228 | CC="$CC -Olimit 1500" |
| 229 | AC_TRY_RUN([int main() { return 0; }], |
| 230 | ac_cv_olimit_ok=yes, |
| 231 | ac_cv_olimit_ok=no) |
| 232 | CC="$ac_save_cc"]) |
| 233 | AC_MSG_RESULT($ac_cv_olimit_ok) |
| 234 | if test $ac_cv_olimit_ok = yes; then |
| 235 | OPT="$OPT -Olimit 1500" |
| 236 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 237 | fi |
Guido van Rossum | f867812 | 1998-07-07 21:05:09 +0000 | [diff] [blame] | 238 | |
| 239 | AC_SUBST(DGUX_IS_BROKEN) |
| 240 | if test "$MACHDEP" != "dguxR4" |
| 241 | then |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 242 | REALLIBRARY='libpython$(VERSION).a' |
Guido van Rossum | 3574285 | 1998-02-19 21:32:40 +0000 | [diff] [blame] | 243 | DGUX_IS_BROKEN="true" |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 244 | else |
| 245 | REALLIBRARY='libpython$(VERSION).so' |
| 246 | OPT="$OPT -pic" |
Guido van Rossum | 3574285 | 1998-02-19 21:32:40 +0000 | [diff] [blame] | 247 | DGUX_IS_BROKEN="make $REALLIBRARY" |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 248 | fi |
Guido van Rossum | 201afe5 | 1997-05-14 21:14:44 +0000 | [diff] [blame] | 249 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 250 | # check for ANSI or K&R ("traditional") preprocessor |
| 251 | AC_MSG_CHECKING(for C preprocessor type) |
| 252 | AC_TRY_COMPILE([ |
| 253 | #define spam(name, doc) {#name, &name, #name "() -- " doc} |
| 254 | int foo; |
| 255 | struct {char *name; int *addr; char *doc;} desc = spam(foo, "something"); |
| 256 | ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional) |
| 257 | AC_MSG_RESULT($cpp_type) |
| 258 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 259 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 260 | AC_HEADER_STDC |
Guido van Rossum | 9601315 | 1997-10-08 22:47:52 +0000 | [diff] [blame] | 261 | 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] | 262 | 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] | 263 | sys/audioio.h sys/file.h sys/lock.h \ |
| 264 | 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] | 265 | sys/un.h sys/utsname.h sys/wait.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 266 | AC_HEADER_DIRENT |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 267 | |
| 268 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 269 | was_it_defined=no |
| 270 | AC_MSG_CHECKING(for clock_t in time.h) |
| 271 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long)) |
| 272 | AC_MSG_RESULT($was_it_defined) |
| 273 | |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 274 | # Add some code to confdefs.h so that the test for off_t works on SCO |
| 275 | cat >> confdefs.h <<\EOF |
| 276 | #if defined(SCO_DS) |
| 277 | #undef _OFF_T |
| 278 | #endif |
| 279 | EOF |
| 280 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 281 | AC_TYPE_MODE_T |
| 282 | AC_TYPE_OFF_T |
| 283 | AC_TYPE_PID_T |
| 284 | AC_TYPE_SIGNAL |
| 285 | AC_TYPE_SIZE_T |
| 286 | AC_TYPE_UID_T |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 287 | |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 288 | AC_CHECK_SIZEOF(int) |
| 289 | AC_CHECK_SIZEOF(long) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 290 | AC_CHECK_SIZEOF(void *) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 291 | |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 292 | AC_MSG_CHECKING(for long long support) |
| 293 | have_long_long=no |
| 294 | AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes) |
| 295 | AC_MSG_RESULT($have_long_long) |
| 296 | if test $have_long_long = yes ; then |
| 297 | AC_CHECK_SIZEOF(long long) |
| 298 | fi |
| 299 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 300 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 301 | AC_SUBST(SO) |
| 302 | AC_SUBST(LDSHARED) |
| 303 | AC_SUBST(CCSHARED) |
| 304 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 305 | # SO is the extension of shared libraries `(including the dot!) |
| 306 | # -- usually .so, .sl on HP-UX |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 307 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 308 | if test -z "$SO" |
| 309 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 310 | case $ac_sys_system in |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 311 | hp*|HP*) SO=.sl;; |
| 312 | *) SO=.so;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 313 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 314 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 315 | AC_MSG_RESULT($SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 316 | # LDSHARED is the ld *command* used to create shared library |
| 317 | # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 318 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 319 | if test -z "$LDSHARED" |
| 320 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 321 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 45140f9 | 1997-08-29 18:44:06 +0000 | [diff] [blame] | 322 | AIX*) LDSHARED="\$(srcdir)/ld_so_aix \$(CC)";; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 323 | BeOS*) LDSHARED="\$(srcdir)/../BeOS/linkmodule -L.. -lpython\$(VERSION)";; |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 324 | IRIX/5*) LDSHARED="ld -shared";; |
Guido van Rossum | 9192267 | 1997-10-09 20:24:13 +0000 | [diff] [blame] | 325 | IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 326 | SunOS/4*) LDSHARED="ld";; |
| 327 | SunOS/5*) LDSHARED="ld -G";; |
| 328 | hp*|HP*) LDSHARED="ld -b";; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 329 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 330 | DYNIX/ptx*) LDSHARED="ld -G";; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 331 | next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';; |
Guido van Rossum | 81652ab | 1996-07-21 02:53:27 +0000 | [diff] [blame] | 332 | Linux*) LDSHARED="gcc -shared";; |
Guido van Rossum | 3c4bb80 | 1997-12-18 23:55:32 +0000 | [diff] [blame] | 333 | dgux*) LDSHARED="ld -G";; |
Guido van Rossum | 2666a15 | 1998-12-17 18:07:35 +0000 | [diff] [blame^] | 334 | FreeBSD*/3*) LDSHARED="gcc -shared";; |
Guido van Rossum | 1f74016 | 1998-04-13 15:27:21 +0000 | [diff] [blame] | 335 | FreeBSD*|NetBSD*|OpenBSD*) LDSHARED="ld -Bshareable";; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 336 | SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 337 | *) LDSHARED="ld";; |
| 338 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 339 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 340 | AC_MSG_RESULT($LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 341 | # CCSHARED are the C *flags* used to create objects to go into a shared |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 342 | # library -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 343 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 344 | if test -z "$CCSHARED" |
| 345 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 346 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 347 | hp*|HP*) if test "$GCC" = yes; |
| 348 | then CCSHARED="-fpic"; |
| 349 | else CCSHARED="+z"; |
| 350 | fi;; |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 351 | Linux*) CCSHARED="-fpic";; |
Guido van Rossum | 1f74016 | 1998-04-13 15:27:21 +0000 | [diff] [blame] | 352 | FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fpic";; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 353 | SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 354 | IRIX*/6*) case $CC in |
| 355 | *gcc*) CCSHARED="-shared";; |
Guido van Rossum | ee21f41 | 1998-04-20 18:51:54 +0000 | [diff] [blame] | 356 | *) CCSHARED="";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 357 | esac;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 358 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 359 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 360 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 361 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 362 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 363 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 364 | if test -z "$LINKFORSHARED" |
| 365 | then |
Guido van Rossum | 6100aaf | 1997-04-29 21:48:51 +0000 | [diff] [blame] | 366 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 69f6580 | 1998-03-03 21:47:00 +0000 | [diff] [blame] | 367 | AIX*) LINKFORSHARED='-Wl,-bE:python.exp -lld';; |
Guido van Rossum | 5dab3d8 | 1996-12-06 21:18:18 +0000 | [diff] [blame] | 368 | hp*|HP*) |
Guido van Rossum | 304dd2d | 1997-10-20 23:10:56 +0000 | [diff] [blame] | 369 | LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";; |
Guido van Rossum | 2666a15 | 1998-12-17 18:07:35 +0000 | [diff] [blame^] | 370 | FreeBSD/3*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 2d9feed | 1997-11-24 17:36:21 +0000 | [diff] [blame] | 371 | Linux*) LINKFORSHARED="-Xlinker -export-dynamic";; |
Guido van Rossum | 79c970c | 1997-08-16 14:35:26 +0000 | [diff] [blame] | 372 | next/*) LINKFORSHARED="-u libsys_s";; |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 373 | SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";; |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 374 | SunOS/5*) case $CC in |
| 375 | *gcc*) |
| 376 | if $CC -Xlinker -V 2>/dev/null | grep BFD >/dev/null |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 377 | then |
| 378 | LINKFORSHARED="-Xlinker --export-dynamic" |
Guido van Rossum | 2b5ca00 | 1998-03-05 15:41:09 +0000 | [diff] [blame] | 379 | fi;; |
| 380 | esac;; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 381 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 382 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 383 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 384 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 385 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 386 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 387 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX |
Guido van Rossum | 2cb5660 | 1998-05-07 13:25:56 +0000 | [diff] [blame] | 388 | AC_CHECK_LIB(m, pow) # Std math lib -- assume needed if it exists |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 389 | # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. |
| 390 | # However on SGI IRIX, these exist but are broken. |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 391 | # BeOS' sockets are stashed in libnet. |
| 392 | case "$ac_sys_system" in |
| 393 | IRIX*) ;; |
Guido van Rossum | 2cb5660 | 1998-05-07 13:25:56 +0000 | [diff] [blame] | 394 | *) |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 395 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 396 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 397 | AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS |
| 398 | ;; |
| 399 | esac |
Guido van Rossum | 70c7f48 | 1998-03-26 18:44:10 +0000 | [diff] [blame] | 400 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 401 | AC_MSG_CHECKING(for --with-libs) |
| 402 | AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [ |
| 403 | AC_MSG_RESULT($withval) |
| 404 | LIBS="$withval $LIBS" |
| 405 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 406 | |
Guido van Rossum | 8c4ed9a | 1996-12-31 22:34:17 +0000 | [diff] [blame] | 407 | AC_MSG_CHECKING(for --with(out)-readline) |
Guido van Rossum | 8c4ed9a | 1996-12-31 22:34:17 +0000 | [diff] [blame] | 408 | AC_ARG_WITH(readline, |
Guido van Rossum | 3c7c678 | 1997-08-05 21:47:42 +0000 | [diff] [blame] | 409 | [--with(out)-readline obsolete, edit Modules/Setup instead], |
| 410 | [AC_MSG_RESULT($withval) |
| 411 | AC_ERROR(--with(out)-readline is obsolete, edit Modules/Setup instead)], |
| 412 | [AC_MSG_RESULT(not specified.)]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 413 | |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 414 | AC_SUBST(USE_THREAD_MODULE) |
| 415 | USE_THREAD_MODULE="#" |
| 416 | |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 417 | AC_MSG_CHECKING(for --with-dec-threads) |
| 418 | AC_SUBST(LDLAST) |
| 419 | AC_ARG_WITH(dec-threads, |
| 420 | [--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], |
| 421 | [AC_MSG_RESULT($withval) |
| 422 | LDLAST=-threads |
Guido van Rossum | f78abae | 1997-01-21 22:02:36 +0000 | [diff] [blame] | 423 | if test "${with_thread+set}" != set; then |
Guido van Rossum | 54d93d4 | 1997-01-22 20:51:58 +0000 | [diff] [blame] | 424 | with_thread="$withval"; |
| 425 | fi], |
| 426 | AC_MSG_RESULT(no)) |
| 427 | |
| 428 | AC_MSG_CHECKING(for --with-threads) |
| 429 | AC_ARG_WITH(threads, [--with-threads alias for --with-thread], |
| 430 | [AC_MSG_RESULT($withval) |
| 431 | if test "${with_thread+set}" != set; then |
| 432 | with_thread="$withval"; |
| 433 | fi], |
| 434 | AC_MSG_RESULT(no)) |
| 435 | |
| 436 | AC_MSG_CHECKING(for --with-thread) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 437 | AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [ |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 438 | USE_THREAD_MODULE= |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 439 | AC_MSG_RESULT($withval) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 440 | if test -d "$withval" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 441 | then LDFLAGS="$LDFLAGS -L$withval" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 442 | fi |
Guido van Rossum | 9caf77a | 1996-08-01 00:52:26 +0000 | [diff] [blame] | 443 | AC_DEFINE(_REENTRANT) |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 444 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 445 | AC_DEFINE(C_THREADS) |
| 446 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 2666a15 | 1998-12-17 18:07:35 +0000 | [diff] [blame^] | 447 | AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 448 | AC_DEFINE(_POSIX_THREADS) |
| 449 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 450 | AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD) |
| 451 | AC_DEFINE(BEOS_THREADS) |
| 452 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 453 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 454 | AC_DEFINE(_POSIX_THREADS) |
| 455 | LIBS="$LIBS -lpthreads" |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 456 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 457 | AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 458 | AC_DEFINE(_POSIX_THREADS) |
| 459 | LIBS="$LIBS -lpthread" |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 460 | LIBOBJS="$LIBOBJS thread.o"], [ |
Guido van Rossum | 4954595 | 1997-12-02 19:28:29 +0000 | [diff] [blame] | 461 | AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 462 | AC_DEFINE(_POSIX_THREADS) |
| 463 | LIBS="$LIBS -lc_r" |
| 464 | LIBOBJS="$LIBOBJS thread.o"], [ |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 465 | AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD) |
| 466 | AC_DEFINE(_POSIX_THREADS) |
| 467 | LIBS="$LIBS -lthread" |
Guido van Rossum | b93a862 | 1998-05-07 13:27:32 +0000 | [diff] [blame] | 468 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 469 | AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 470 | AC_DEFINE(_POSIX_THREADS) |
| 471 | LIBS="$LIBS -lcma" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 472 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 473 | ])])])])])])]) |
Guido van Rossum | 6400c26 | 1997-05-22 20:34:27 +0000 | [diff] [blame] | 474 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 475 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 476 | LIBS="$LIBS -lmpc" |
| 477 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 478 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 479 | LIBS="$LIBS -lthread" |
| 480 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 481 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 482 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 483 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 484 | AC_SUBST(DLINCLDIR) |
| 485 | DLINCLDIR=/ |
| 486 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 487 | AC_MSG_CHECKING(for --with-sgi-dl) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 488 | 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] | 489 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 490 | AC_DEFINE(WITH_SGI_DL) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 491 | dldir=$withval |
| 492 | if test -d "$dldir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 493 | then LDFLAGS="$LDFLAGS -L$dldir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 494 | else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY) |
| 495 | fi |
| 496 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 497 | LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 498 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 499 | AC_MSG_CHECKING(for --with-dl-dld) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 500 | 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] | 501 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 502 | AC_DEFINE(WITH_DL_DLD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 503 | dldir=`echo "$withval" | sed 's/,.*//'` |
| 504 | dlddir=`echo "$withval" | sed 's/.*,//'` |
| 505 | if test -d "$dldir" -a -d "$dlddir" |
Guido van Rossum | 300fda7 | 1996-08-19 21:58:16 +0000 | [diff] [blame] | 506 | then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 507 | else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY) |
| 508 | fi |
| 509 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 510 | LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 511 | |
| 512 | # checks for library functions |
Guido van Rossum | 1171ee6 | 1997-08-22 20:42:00 +0000 | [diff] [blame] | 513 | AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork ftime ftruncate \ |
| 514 | gethostname_r getpeername getpgrp getpid getpwent gettimeofday getwd \ |
Guido van Rossum | fb4533c | 1998-10-02 14:39:42 +0000 | [diff] [blame] | 515 | 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] | 516 | select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ |
Guido van Rossum | 8f4ceb1 | 1997-12-18 23:42:19 +0000 | [diff] [blame] | 517 | sigaction siginterrupt sigrelse strftime strptime symlink \ |
Guido van Rossum | 08d6be4 | 1998-06-11 15:19:05 +0000 | [diff] [blame] | 518 | tcgetpgrp tcsetpgrp timegm times truncate uname waitpid) |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 519 | AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 520 | AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) |
| 521 | AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG))) |
| 522 | 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] | 523 | |
| 524 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 525 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 526 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 527 | AC_STRUCT_TIMEZONE |
| 528 | |
| 529 | AC_MSG_CHECKING(for time.h that defines altzone) |
| 530 | AC_CACHE_VAL(ac_cv_header_time_altzone, |
| 531 | [AC_TRY_COMPILE([#include <time.h>], [return altzone;], |
| 532 | ac_cv_header_time_altzone=yes, |
| 533 | ac_cv_header_time_altzone=no)]) |
| 534 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 535 | if test $ac_cv_header_time_altzone = yes; then |
| 536 | AC_DEFINE(HAVE_ALTZONE) |
| 537 | fi |
| 538 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 539 | was_it_defined=no |
| 540 | 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] | 541 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 542 | #include <sys/types.h> |
| 543 | #include <sys/select.h> |
| 544 | #include <sys/time.h> |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 545 | ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes]) |
| 546 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 547 | |
| 548 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 549 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 550 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 551 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 552 | AC_C_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 553 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 554 | works=no |
| 555 | AC_MSG_CHECKING(for working volatile) |
| 556 | AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, [])) |
| 557 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 558 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 559 | works=no |
| 560 | AC_MSG_CHECKING(for working signed char) |
| 561 | AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, [])) |
| 562 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 563 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 564 | have_prototypes=no |
| 565 | AC_MSG_CHECKING(for prototypes) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 566 | AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], |
| 567 | AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 568 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 569 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 570 | works=no |
| 571 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 572 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 573 | #include <stdarg.h> |
Guido van Rossum | 3f13e48 | 1996-08-30 20:58:11 +0000 | [diff] [blame] | 574 | int foo(int x, ...) { |
| 575 | va_list va; |
| 576 | va_start(va, x); |
| 577 | va_arg(va, int); |
| 578 | va_arg(va, char *); |
| 579 | va_arg(va, double); |
| 580 | return 0; |
| 581 | } |
| 582 | ], [return foo(10, "", 3.14);], |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 583 | AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes) |
| 584 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 585 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 586 | if test "$have_prototypes" = yes; then |
| 587 | bad_prototypes=no |
| 588 | AC_MSG_CHECKING(for bad exec* prototypes) |
| 589 | AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], , |
| 590 | AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes) |
| 591 | AC_MSG_RESULT($bad_prototypes) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 592 | fi |
| 593 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 594 | bad_forward=no |
| 595 | AC_MSG_CHECKING(for bad static forward) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 596 | AC_TRY_RUN([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 597 | struct s { int a; int b; }; |
| 598 | static struct s foo; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 599 | int foobar() { |
| 600 | static int random; |
| 601 | random = (int) &foo; |
| 602 | return random; |
| 603 | } |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 604 | static struct s foo = { 1, 2 }; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 605 | main() { |
| 606 | exit(!((int)&foo == foobar())); |
| 607 | } |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 608 | ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes) |
| 609 | AC_MSG_RESULT($bad_forward) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 610 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 611 | va_list_is_array=no |
| 612 | AC_MSG_CHECKING(whether va_list is an array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 613 | AC_TRY_COMPILE([ |
| 614 | #ifdef HAVE_STDARG_PROTOTYPES |
| 615 | #include <stdarg.h> |
| 616 | #else |
| 617 | #include <varargs.h> |
| 618 | #endif |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 619 | ], [va_list list1, list2; list1 = list2;], , |
| 620 | AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes) |
| 621 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 622 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 623 | # checks for system services |
| 624 | # (none yet) |
| 625 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 626 | # Linux requires this for correct f.p. operations |
| 627 | AC_CHECK_LIB(ieee, __fpu_control) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 628 | |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 629 | # Check for --with-fpectl |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 630 | AC_MSG_CHECKING(for --with-fpectl) |
| 631 | AC_ARG_WITH(fpectl, [--with-fpectl enable SIGFPE catching], [ |
| 632 | if test "$withval" != no |
| 633 | then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes) |
| 634 | else AC_MSG_RESULT(no) |
| 635 | fi]) |
| 636 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 637 | # check for --with-libm=... |
| 638 | AC_SUBST(LIBM) |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 639 | case $ac_sys_system in |
| 640 | next) ;; |
Guido van Rossum | ec95c7b | 1998-08-04 17:59:56 +0000 | [diff] [blame] | 641 | BeOS) ;; |
Guido van Rossum | 4b6b579 | 1996-09-09 20:09:34 +0000 | [diff] [blame] | 642 | *) LIBM=-lm |
| 643 | esac |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 644 | AC_MSG_CHECKING(for --with-libm=STRING) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 645 | AC_ARG_WITH(libm, [--with-libm=STRING math library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 646 | if test "$withval" = no |
| 647 | then LIBM= |
| 648 | AC_MSG_RESULT(force LIBM empty) |
| 649 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 650 | then LIBM=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 651 | AC_MSG_RESULT(set LIBM=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 652 | else AC_ERROR(proper usage is --with-libm=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 653 | fi], |
| 654 | [AC_MSG_RESULT(default LIBM=\"$LIBM\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 655 | |
| 656 | # check for --with-libc=... |
| 657 | AC_SUBST(LIBC) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 658 | AC_MSG_CHECKING(for --with-libc=STRING) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 659 | AC_ARG_WITH(libc, [--with-libc=STRING C library], [ |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 660 | if test "$withval" = no |
| 661 | then LIBC= |
| 662 | AC_MSG_RESULT(force LIBC empty) |
| 663 | elif test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 664 | then LIBC=$withval |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 665 | AC_MSG_RESULT(set LIBC=\"$withval\") |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 666 | else AC_ERROR(proper usage is --with-libc=STRING) |
Guido van Rossum | 9327422 | 1997-05-09 02:42:00 +0000 | [diff] [blame] | 667 | fi], |
| 668 | [AC_MSG_RESULT(default LIBC=\"$LIBC\")]) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 669 | |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 670 | # check for hypot() in math library |
| 671 | LIBS_SAVE=$LIBS |
| 672 | LIBS="$LIBS $LIBM" |
| 673 | AC_CHECK_FUNCS(hypot) |
Guido van Rossum | f2f7eb3 | 1996-08-30 15:18:00 +0000 | [diff] [blame] | 674 | AC_REPLACE_FUNCS(hypot) |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 675 | LIBS=$LIBS_SAVE |
| 676 | |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 677 | # check for getopt |
| 678 | AC_MSG_CHECKING(for genuine getopt) |
| 679 | AC_CACHE_VAL(ac_cv_func_getopt, |
| 680 | [AC_TRY_RUN([#include <stdio.h> |
| 681 | extern int optind, opterr, getopt(); |
| 682 | extern char* optarg; |
| 683 | int main() { |
| 684 | char* av[] = { "testprog", "parameter", "-fFlag", NULL }; |
| 685 | opterr = 0; |
| 686 | if (getopt(3, av, "f:") == 'f') { exit(1); } |
| 687 | exit(0); |
| 688 | }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl |
| 689 | AC_MSG_RESULT($ac_cv_func_getopt) |
| 690 | test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o" |
| 691 | AC_SUBST(LIBOBJS)dnl |
| 692 | |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 693 | # check whether malloc(0) returns NULL or not |
Guido van Rossum | ad71370 | 1997-07-10 22:42:38 +0000 | [diff] [blame] | 694 | AC_MSG_CHECKING(what malloc(0) returns) |
| 695 | AC_CACHE_VAL(ac_cv_malloc_zero, |
| 696 | [AC_TRY_RUN([#include <stdio.h> |
| 697 | #ifdef HAVE_STDLIB |
| 698 | #include <stdlib.h> |
| 699 | #else |
| 700 | char *malloc(), *realloc(); |
| 701 | int *free(); |
| 702 | #endif |
| 703 | main() { |
| 704 | char *p; |
| 705 | p = malloc(0); |
| 706 | if (p == NULL) exit(1); |
| 707 | p = realloc(p, 0); |
| 708 | if (p == NULL) exit(1); |
| 709 | free(p); |
| 710 | exit(0); |
| 711 | }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)]) |
| 712 | AC_MSG_RESULT($ac_cv_malloc_zero) |
| 713 | if test "$ac_cv_malloc_zero" = null |
| 714 | then |
| 715 | AC_DEFINE(MALLOC_ZERO_RETURNS_NULL) |
| 716 | fi |
| 717 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 718 | # generate output files |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 719 | AC_OUTPUT(Makefile \ |
| 720 | Objects/Makefile \ |
| 721 | Parser/Makefile \ |
| 722 | Python/Makefile \ |
Guido van Rossum | 009f787 | 1997-12-04 00:51:42 +0000 | [diff] [blame] | 723 | Modules/Makefile.pre \ |
| 724 | Modules/Setup.thread) |