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 | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 7 | # NEXTSTEP stuff |
| 8 | AC_MSG_CHECKING(for --with-next-archs) |
| 9 | AC_ARG_WITH(next-archs, |
| 10 | [--with-next-archs='arch1 arch2 ..' build MAB binary], [ |
| 11 | if test -n "$withval"; then |
| 12 | ac_sys_cpu=_`/usr/lib/arch_tool -choose_obj_dir $withval` |
| 13 | ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval` |
| 14 | else |
| 15 | ac_sys_cpu=_`arch` |
| 16 | fi |
| 17 | ], []) |
| 18 | AC_MSG_RESULT($with_next_archs) |
| 19 | |
| 20 | # Set name for machine-dependent library files |
| 21 | AC_SUBST(MACHDEP) |
| 22 | AC_MSG_CHECKING(MACHDEP) |
| 23 | if test -z "$MACHDEP" |
| 24 | then |
| 25 | if test -f /usr/lib/NextStep/software_version; then |
| 26 | set X `hostinfo | grep 'NeXT Mach.*:' | \ |
| 27 | sed -e 's/://' -e 's/\./_/'` && \ |
| 28 | ac_sys_system=next && ac_sys_release=$4 |
| 29 | MACHDEP="$ac_sys_system$ac_sys_release$ac_sys_cpu" |
| 30 | else |
| 31 | ac_sys_system=`uname -s` |
Guido van Rossum | 8a2574e | 1996-07-31 22:45:54 +0000 | [diff] [blame] | 32 | if test "$ac_sys_system" = "AIX" ; then |
| 33 | ac_sys_release=`uname -v` |
| 34 | else |
| 35 | ac_sys_release=`uname -r` |
| 36 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 37 | ac_md_system=`echo $ac_sys_system | |
| 38 | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` |
| 39 | ac_md_release=`echo $ac_sys_release | |
| 40 | tr -d '[/ ]' | sed 's/\..*//'` |
| 41 | MACHDEP="$ac_md_system$ac_md_release" |
| 42 | fi |
| 43 | case MACHDEP in |
| 44 | '') MACHDEP=unknown;; |
| 45 | esac |
| 46 | fi |
| 47 | AC_MSG_RESULT($MACHDEP) |
| 48 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 49 | # checks for alternative programs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 50 | AC_MSG_CHECKING(for --without-gcc) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 51 | AC_ARG_WITH(gcc, [--without-gcc never use gcc], [ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 52 | case $withval in |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 53 | no) CC=cc |
| 54 | without_gcc=yes;; |
| 55 | yes) CC=gcc |
| 56 | without_gcc=no;; |
| 57 | *) CC=$withval |
| 58 | without_gcc=$withval;; |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 59 | esac], [ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 60 | case $ac_sys_system in |
Guido van Rossum | 55a214e | 1995-09-13 17:48:09 +0000 | [diff] [blame] | 61 | OSF1) CC=cc |
| 62 | without_gcc=;; |
| 63 | *) without_gcc=no;; |
| 64 | esac]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 65 | AC_MSG_RESULT($without_gcc) |
| 66 | |
Guido van Rossum | 03ad99f | 1995-03-09 14:09:54 +0000 | [diff] [blame] | 67 | # If the user switches compilers, we can't believe the cache |
| 68 | if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" |
| 69 | then |
| 70 | AC_ERROR(cached CC is different -- throw away $cache_file |
| 71 | (it is also a good idea to do 'make clean' before compiling)) |
| 72 | fi |
| 73 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 74 | AC_PROG_CC |
| 75 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 76 | AC_SUBST(AR) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 77 | AC_CHECK_PROGS(AR, ar aal, ar) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 78 | AC_SUBST(INSTALL) |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 79 | AC_SUBST(INSTALL_PROGRAM) |
| 80 | AC_SUBST(INSTALL_DATA) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 81 | # Install just never works :-( |
| 82 | if test -z "$INSTALL" |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 83 | then |
| 84 | INSTALL=cp |
| 85 | INSTALL_PROGRAM=cp |
| 86 | INSTALL_DATA=cp |
| 87 | else |
| 88 | INSTALL_PROGRAM="$INSTALL" |
| 89 | INSTALL_DATA="$INSTALL -m 644" |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 90 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 91 | |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 92 | # Optimizer/debugger flags passed between Makefiles |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 93 | AC_SUBST(OPT) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 94 | if test -z "$OPT" |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 95 | then |
| 96 | case $ac_sys_system in |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 97 | NeXT|next) OPT="-g -Wall -O3 -fomit-frame-pointer";; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 98 | *) OPT="-O";; |
| 99 | esac |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 100 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 101 | |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 102 | if test -z "$ac_arch_flags" |
| 103 | then |
| 104 | OPT="$OPT $ac_arch_flags" |
| 105 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 106 | # checks for UNIX variants that set C preprocessor variables |
| 107 | AC_AIX |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 108 | AC_MINIX |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 109 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 110 | # checks for header files |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 111 | AC_HEADER_STDC |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 112 | AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h ncurses.h \ |
| 113 | signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \ |
Guido van Rossum | 22b6db6 | 1996-06-28 20:18:10 +0000 | [diff] [blame] | 114 | sys/audioio.h sys/lock.h 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] | 115 | sys/un.h sys/utsname.h sys/wait.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 116 | AC_HEADER_DIRENT |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 117 | |
| 118 | # checks for typedefs |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 119 | was_it_defined=no |
| 120 | AC_MSG_CHECKING(for clock_t in time.h) |
| 121 | AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long)) |
| 122 | AC_MSG_RESULT($was_it_defined) |
| 123 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 124 | AC_TYPE_MODE_T |
| 125 | AC_TYPE_OFF_T |
| 126 | AC_TYPE_PID_T |
| 127 | AC_TYPE_SIGNAL |
| 128 | AC_TYPE_SIZE_T |
| 129 | AC_TYPE_UID_T |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 130 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 131 | |
| 132 | # Set info about shared libraries. |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 133 | AC_SUBST(SO) |
| 134 | AC_SUBST(LDSHARED) |
| 135 | AC_SUBST(CCSHARED) |
| 136 | AC_SUBST(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 137 | # SO is the extension of shared libraries `(including the dot!) |
| 138 | # -- usually .so, .sl on HP-UX |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 139 | AC_MSG_CHECKING(SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 140 | if test -z "$SO" |
| 141 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 142 | case $ac_sys_system in |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 143 | hp*|HP*) SO=.sl;; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 144 | NeXT|next) SO=.a;; # no shared libs on NeXT 3.3 and less |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 145 | *) SO=.so;; |
| 146 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 147 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 148 | AC_MSG_RESULT($SO) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 149 | # LDSHARED is the ld *command* used to create shared library |
| 150 | # -- "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] | 151 | AC_MSG_CHECKING(LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 152 | if test -z "$LDSHARED" |
| 153 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 154 | case $ac_sys_system/$ac_sys_release in |
Guido van Rossum | 8a2574e | 1996-07-31 22:45:54 +0000 | [diff] [blame] | 155 | AIX*) LDSHARED="ld_so_aix";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 156 | IRIX*) LDSHARED="ld -shared";; |
| 157 | SunOS/4*) LDSHARED="ld";; |
| 158 | SunOS/5*) LDSHARED="ld -G";; |
| 159 | hp*|HP*) LDSHARED="ld -b";; |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 160 | OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";; |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 161 | DYNIX/ptx*) LDSHARED="ld -G";; |
Guido van Rossum | 81652ab | 1996-07-21 02:53:27 +0000 | [diff] [blame] | 162 | Linux*) LDSHARED="gcc -shared";; |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 163 | FreeBSD*) LDSHARED="ld -Bshareable";; |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 164 | NeXT|next/3*) LDSHARED="ld -u libsys_s";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 165 | *) LDSHARED="ld";; |
| 166 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 167 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 168 | AC_MSG_RESULT($LDSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 169 | # 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] | 170 | # library -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 171 | AC_MSG_CHECKING(CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 172 | if test -z "$CCSHARED" |
| 173 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 174 | case $ac_sys_system in |
Guido van Rossum | af07a44 | 1995-02-13 19:45:27 +0000 | [diff] [blame] | 175 | hp*|HP*) if test "$GCC" = yes; |
| 176 | then CCSHARED="-fpic"; |
| 177 | else CCSHARED="+z"; |
| 178 | fi;; |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 179 | Linux*) CCSHARED="-fpic";; |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 180 | FreeBSD*) CCSHARED="-fpic";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 181 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 182 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 183 | AC_MSG_RESULT($CCSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 184 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 185 | # the python executable -- this is only needed for a few systems |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 186 | AC_MSG_CHECKING(LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 187 | if test -z "$LINKFORSHARED" |
| 188 | then |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 189 | case $ac_sys_system in |
Guido van Rossum | 8a2574e | 1996-07-31 22:45:54 +0000 | [diff] [blame] | 190 | AIX*) LINKFORSHARED="-Wl,-bE:python.exp";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 191 | hp*|HP*) LINKFORSHARED="-Wl,-E";; |
Guido van Rossum | b65a48e | 1995-06-14 18:21:23 +0000 | [diff] [blame] | 192 | Linux*) LINKFORSHARED="-rdynamic";; |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 193 | esac |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 194 | fi |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 195 | AC_MSG_RESULT($LINKFORSHARED) |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 196 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 197 | # checks for libraries |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 198 | AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV |
| 199 | AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX |
| 200 | AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4 |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 201 | # The following three (nsl,inet,socket) are needed on Sequent; |
| 202 | # the order of checking must be this. Most SVR4 platforms will |
| 203 | # need -lsocket and -lnsl. However on SGI IRIX 5, these exist but |
| 204 | # broken. I see no elegant solution (probably CHECK_LIB should be |
| 205 | # fixed to only add the library if the given entry point is not |
| 206 | # satisfied without it). |
| 207 | if test "`uname -s`" != IRIX |
| 208 | then |
Guido van Rossum | f618d2c | 1995-01-17 16:36:13 +0000 | [diff] [blame] | 209 | AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4 |
| 210 | AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent |
| 211 | AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets |
Guido van Rossum | 71001e4 | 1995-01-26 00:44:03 +0000 | [diff] [blame] | 212 | fi |
Guido van Rossum | c5a3903 | 1996-07-31 17:35:03 +0000 | [diff] [blame] | 213 | AC_MSG_CHECKING(for --with-libs) |
| 214 | AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [ |
| 215 | AC_MSG_RESULT($withval) |
| 216 | LIBS="$withval $LIBS" |
| 217 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 218 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 219 | # XXX need to check whether libreadline.a actually exists there! |
| 220 | # XXX Also, on some systems, it's libreadline.so... |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 221 | AC_MSG_CHECKING(for --with-readline) |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 222 | AC_ARG_WITH(readline, [--with-readline[=DIRECTORY] use GNU readline library], [ |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 223 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 224 | AC_DEFINE(WITH_READLINE) |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 225 | if test -d "$withval" |
| 226 | then LIBS="$LIBS -L$withval" |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 227 | fi |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 228 | termcap= |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 229 | AC_CHECK_LIB(termcap, tgetent, [termcap=termcap], [ |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 230 | AC_CHECK_LIB(termlib, tgetent, [termcap=termlib], [ |
| 231 | AC_ERROR(no working termcap/termlib -- do not use --with-readline)])]) |
| 232 | AC_CHECK_LIB(readline, readline, [ |
| 233 | LIBS="$LIBS -lreadline" |
| 234 | # Avoid possible conflict between shared libraries termcap and gl |
| 235 | # on IRIX 5: both contain a routine called clear. |
| 236 | if test -f /usr/lib/lib$termcap.a |
| 237 | then LIBS="$LIBS /usr/lib/lib$termcap.a" |
| 238 | else LIBS="$LIBS -l$termcap" |
| 239 | fi |
| 240 | ], [AC_ERROR(no working GNU readline -- do not use --with-readline)], |
| 241 | -l$termcap)], |
| 242 | AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 243 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 244 | AC_MSG_CHECKING(for --with-thread) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 245 | AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [ |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 246 | AC_MSG_RESULT($withval) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 247 | if test -d "$withval" |
| 248 | then LIBS="$LIBS -L$withval" |
| 249 | fi |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 250 | AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD) |
| 251 | AC_DEFINE(C_THREADS) |
| 252 | LIBOBJS="$LIBOBJS thread.o"],[ |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 253 | AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 254 | AC_DEFINE(_POSIX_THREADS) |
| 255 | LIBS="$LIBS -lpthreads" |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 256 | LIBOBJS="$LIBOBJS thread.o"], [ |
| 257 | AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD) |
| 258 | AC_DEFINE(_POSIX_THREADS) |
| 259 | LIBS="$LIBS -lpthread" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 260 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 261 | ])]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 262 | AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 263 | LIBS="$LIBS -lmpc" |
| 264 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 265 | AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 266 | LIBS="$LIBS -lthread" |
| 267 | LIBOBJS="$LIBOBJS thread.o"]) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 268 | ], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 269 | |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 270 | # -I${DLINCLDIR} is added to the compile rule for importdl.o |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 271 | AC_SUBST(DLINCLDIR) |
| 272 | DLINCLDIR=/ |
| 273 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 274 | AC_MSG_CHECKING(for --with-sgi-dl) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 275 | 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] | 276 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 277 | AC_DEFINE(WITH_SGI_DL) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 278 | dldir=$withval |
| 279 | if test -d "$dldir" |
| 280 | then LIBS="$LIBS -L$dldir" |
| 281 | else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY) |
| 282 | fi |
| 283 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 284 | LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 285 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 286 | AC_MSG_CHECKING(for --with-dl-dld) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 287 | 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] | 288 | AC_MSG_RESULT($withval) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 289 | AC_DEFINE(WITH_DL_DLD) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 290 | dldir=`echo "$withval" | sed 's/,.*//'` |
| 291 | dlddir=`echo "$withval" | sed 's/.*,//'` |
| 292 | if test -d "$dldir" -a -d "$dlddir" |
| 293 | then LIBS="$LIBS -L$dldir -L$dlddir" |
| 294 | else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY) |
| 295 | fi |
| 296 | DLINCLDIR=${dldir} |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 297 | LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 298 | |
| 299 | # checks for library functions |
Guido van Rossum | a2ef383 | 1996-06-26 19:45:23 +0000 | [diff] [blame] | 300 | AC_CHECK_FUNCS(chown clock dlopen flock ftime ftruncate \ |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 301 | gethostname_r getpeername getpgrp getpid gettimeofday getwd \ |
Guido van Rossum | dde4317 | 1996-07-24 02:41:31 +0000 | [diff] [blame] | 302 | link lstat mkfifo nice plock putenv readlink \ |
Guido van Rossum | 68242b5 | 1996-05-28 22:53:03 +0000 | [diff] [blame] | 303 | select setgid setuid setsid setpgid setpgrp setvbuf \ |
| 304 | sigaction siginterrupt sigrelse strftime symlink \ |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 305 | tcgetpgrp tcsetpgrp times truncate uname waitpid) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 306 | AC_REPLACE_FUNCS(dup2 getcwd strerror memmove) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 307 | AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) |
| 308 | AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG))) |
| 309 | 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] | 310 | |
| 311 | # checks for structures |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 312 | AC_HEADER_TIME |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 313 | AC_STRUCT_TM |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 314 | AC_STRUCT_TIMEZONE |
| 315 | |
| 316 | AC_MSG_CHECKING(for time.h that defines altzone) |
| 317 | AC_CACHE_VAL(ac_cv_header_time_altzone, |
| 318 | [AC_TRY_COMPILE([#include <time.h>], [return altzone;], |
| 319 | ac_cv_header_time_altzone=yes, |
| 320 | ac_cv_header_time_altzone=no)]) |
| 321 | AC_MSG_RESULT($ac_cv_header_time_altzone) |
| 322 | if test $ac_cv_header_time_altzone = yes; then |
| 323 | AC_DEFINE(HAVE_ALTZONE) |
| 324 | fi |
| 325 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 326 | was_it_defined=no |
| 327 | 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] | 328 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 329 | #include <sys/types.h> |
| 330 | #include <sys/select.h> |
| 331 | #include <sys/time.h> |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 332 | ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes]) |
| 333 | AC_MSG_RESULT($was_it_defined) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 334 | |
| 335 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 336 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 337 | AC_C_CHAR_UNSIGNED |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 338 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 339 | AC_C_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 340 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 341 | works=no |
| 342 | AC_MSG_CHECKING(for working volatile) |
| 343 | AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, [])) |
| 344 | AC_MSG_RESULT($works) |
Guido van Rossum | dabb11b | 1994-10-11 15:04:27 +0000 | [diff] [blame] | 345 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 346 | works=no |
| 347 | AC_MSG_CHECKING(for working signed char) |
| 348 | AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, [])) |
| 349 | AC_MSG_RESULT($works) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 350 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 351 | have_prototypes=no |
| 352 | AC_MSG_CHECKING(for prototypes) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 353 | AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);], |
| 354 | AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes) |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 355 | AC_MSG_RESULT($have_prototypes) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 356 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 357 | works=no |
| 358 | AC_MSG_CHECKING(for variable length prototypes and stdarg.h) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 359 | AC_TRY_COMPILE([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 360 | #include <stdarg.h> |
| 361 | int foo(int x, ...) { return 0; } |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 362 | ], [return foo(10, 11, 12);], |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 363 | AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes) |
| 364 | AC_MSG_RESULT($works) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 365 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 366 | if test "$have_prototypes" = yes; then |
| 367 | bad_prototypes=no |
| 368 | AC_MSG_CHECKING(for bad exec* prototypes) |
| 369 | AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], , |
| 370 | AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes) |
| 371 | AC_MSG_RESULT($bad_prototypes) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 372 | fi |
| 373 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 374 | bad_forward=no |
| 375 | AC_MSG_CHECKING(for bad static forward) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 376 | AC_TRY_RUN([ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 377 | struct s { int a; int b; }; |
| 378 | static struct s foo; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 379 | int foobar() { |
| 380 | static int random; |
| 381 | random = (int) &foo; |
| 382 | return random; |
| 383 | } |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 384 | static struct s foo = { 1, 2 }; |
Guido van Rossum | 5dee5e7 | 1994-11-10 23:06:54 +0000 | [diff] [blame] | 385 | main() { |
| 386 | exit(!((int)&foo == foobar())); |
| 387 | } |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 388 | ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes) |
| 389 | AC_MSG_RESULT($bad_forward) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 390 | |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 391 | va_list_is_array=no |
| 392 | AC_MSG_CHECKING(whether va_list is an array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 393 | AC_TRY_COMPILE([ |
| 394 | #ifdef HAVE_STDARG_PROTOTYPES |
| 395 | #include <stdarg.h> |
| 396 | #else |
| 397 | #include <varargs.h> |
| 398 | #endif |
Guido van Rossum | 5739e7e | 1995-01-20 16:50:53 +0000 | [diff] [blame] | 399 | ], [va_list list1, list2; list1 = list2;], , |
| 400 | AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes) |
| 401 | AC_MSG_RESULT($va_list_is_array) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 402 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 403 | # checks for system services |
| 404 | # (none yet) |
| 405 | |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 406 | # Linux requires this for correct f.p. operations |
| 407 | AC_CHECK_LIB(ieee, __fpu_control) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 408 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 409 | # check for --with-libm=... |
| 410 | AC_SUBST(LIBM) |
| 411 | LIBM=-lm |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 412 | AC_ARG_WITH(libm, [--with-libm=STRING math library], [ |
| 413 | if test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 414 | then LIBM=$withval |
| 415 | else AC_ERROR(proper usage is --with-libm=STRING) |
| 416 | fi]) |
| 417 | |
| 418 | # check for --with-libc=... |
| 419 | AC_SUBST(LIBC) |
Guido van Rossum | 76be6ed | 1995-01-02 18:33:54 +0000 | [diff] [blame] | 420 | AC_ARG_WITH(libc, [--with-libc=STRING C library], [ |
| 421 | if test "$withval" != yes |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 422 | then LIBC=$withval |
| 423 | else AC_ERROR(proper usage is --with-libc=STRING) |
| 424 | fi]) |
| 425 | |
Guido van Rossum | af5b83e | 1995-01-04 19:02:35 +0000 | [diff] [blame] | 426 | # check for hypot() in math library |
| 427 | LIBS_SAVE=$LIBS |
| 428 | LIBS="$LIBS $LIBM" |
| 429 | AC_CHECK_FUNCS(hypot) |
| 430 | LIBS=$LIBS_SAVE |
| 431 | |
Guido van Rossum | 7d47329 | 1995-01-20 14:12:16 +0000 | [diff] [blame] | 432 | # check for getopt |
| 433 | AC_MSG_CHECKING(for genuine getopt) |
| 434 | AC_CACHE_VAL(ac_cv_func_getopt, |
| 435 | [AC_TRY_RUN([#include <stdio.h> |
| 436 | extern int optind, opterr, getopt(); |
| 437 | extern char* optarg; |
| 438 | int main() { |
| 439 | char* av[] = { "testprog", "parameter", "-fFlag", NULL }; |
| 440 | opterr = 0; |
| 441 | if (getopt(3, av, "f:") == 'f') { exit(1); } |
| 442 | exit(0); |
| 443 | }], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl |
| 444 | AC_MSG_RESULT($ac_cv_func_getopt) |
| 445 | test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o" |
| 446 | AC_SUBST(LIBOBJS)dnl |
| 447 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 448 | # generate output files |
Guido van Rossum | b418f89 | 1996-07-30 18:06:02 +0000 | [diff] [blame] | 449 | AC_OUTPUT(Makefile \ |
| 450 | Objects/Makefile \ |
| 451 | Parser/Makefile \ |
| 452 | Python/Makefile \ |
| 453 | Modules/Makefile.pre) |