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