Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 1 | dnl Process this file with autoconf 1.8 or later to make a configure script. |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 2 | AC_REVISION($Revision$)dnl |
Guido van Rossum | e1f17b5 | 1994-10-06 15:51:22 +0000 | [diff] [blame] | 3 | AC_PREREQ(1.8)dnl |
Guido van Rossum | 6085e32 | 1993-12-26 18:24:40 +0000 | [diff] [blame] | 4 | AC_INIT(Include/object.h) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 5 | AC_CONFIG_HEADER(config.h)dnl |
| 6 | # Don't suppress compiler output when --verbose is specified |
| 7 | test -n "$verbose" && |
| 8 | ac_compile=`echo "$ac_compile" | sed "s|>/dev/null 2>&1||"` |
| 9 | AC_VERBOSE(setting ac_compile to '$ac_compile') |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 10 | |
| 11 | # checks for alternative programs |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 12 | AC_CHECKING(for --with(out)-gcc) |
| 13 | AC_WITH(gcc, [ |
| 14 | case $withval in |
| 15 | no) withval=cc;; |
| 16 | yes) withval=gcc;; |
| 17 | esac |
| 18 | CC=$withval]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 19 | AC_PROG_CC |
| 20 | AC_PROG_RANLIB |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 21 | AC_SUBST(AR) |
| 22 | AC_PROGRAMS_CHECK(AR, ar aal, ar) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 23 | AC_SUBST(INSTALL) |
| 24 | # Install just never works :-( |
| 25 | if test -z "$INSTALL" |
| 26 | then INSTALL=cp |
| 27 | fi |
| 28 | AC_SUBST(OPT) |
| 29 | # Optimizer/debugger flags passed between Makefiles |
| 30 | if test -z "$OPT" |
| 31 | then OPT=-O |
| 32 | fi |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 33 | |
| 34 | # checks for UNIX variants that set C preprocessor variables |
| 35 | AC_AIX |
| 36 | AC_ISC_POSIX |
| 37 | AC_MINIX |
| 38 | dnl DYNIX test runs compile so must be last |
| 39 | AC_DYNIX_SEQ |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 40 | AC_CHECKING(for NeXT) |
| 41 | AC_TEST_PROGRAM([ |
| 42 | #ifdef _NEXT_SOURCE |
| 43 | main() { exit(0); } |
| 44 | #endif |
| 45 | ], AC_DEFINE(_POSIX_SOURCE)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 46 | |
| 47 | # checks for header files |
| 48 | AC_STDC_HEADERS |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 49 | AC_HAVE_HEADERS(dlfcn.h fcntl.h limits.h signal.h stdarg.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) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 50 | AC_DIR_HEADER |
| 51 | |
| 52 | # checks for typedefs |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 53 | AC_CHECKING(for clock_t in time.h) |
| 54 | AC_HEADER_EGREP(clock_t, time.h, , AC_DEFINE(clock_t, long)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 55 | AC_MODE_T |
| 56 | AC_OFF_T |
| 57 | AC_PID_T |
| 58 | AC_RETSIGTYPE |
| 59 | AC_SIZE_T |
| 60 | AC_UID_T |
| 61 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 62 | # Set name for machine-dependent library files |
| 63 | AC_SUBST(MACHDEP) |
| 64 | if test -z "$MACHDEP" |
| 65 | then |
| 66 | ac_system=`uname -s | tr '[[A-Z]]' '[[a-z]]'` |
| 67 | ac_release=`uname -r | sed 's/\..*//'` |
| 68 | MACHDEP="$ac_system$ac_release" |
| 69 | case MACHDEP in |
| 70 | '') MACHDEP=unknown;; |
| 71 | esac |
| 72 | AC_VERBOSE(setting MACHDEP to '$MACHDEP') |
| 73 | fi |
| 74 | |
| 75 | # Set info about shared libraries. |
| 76 | # XXX This should try things out instead of testing uname! |
| 77 | AC_SUBST(SO) |
| 78 | AC_SUBST(LDSHARED) |
| 79 | AC_SUBST(CCSHARED) |
| 80 | AC_SUBST(LINKFORSHARED) |
| 81 | ac_system=`uname -s` |
| 82 | ac_release=`uname -r` |
| 83 | # SO is the extension of shared libraries `(including the dot!) |
| 84 | # -- usually .so, .sl on HP-UX |
| 85 | if test -z "$SO" |
| 86 | then |
| 87 | case $ac_system in |
| 88 | hp*|HP*) SO=.sl;; |
| 89 | *) SO=.so;; |
| 90 | esac |
| 91 | AC_VERBOSE(setting SO to '$SO') |
| 92 | fi |
| 93 | # LDSHARED is the ld *command* used to create shared library |
| 94 | # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5 |
| 95 | if test -z "$LDSHARED" |
| 96 | then |
| 97 | case $ac_system/$ac_release in |
| 98 | IRIX*) LDSHARED="ld -shared";; |
| 99 | SunOS/4*) LDSHARED="ld";; |
| 100 | SunOS/5*) LDSHARED="ld -G";; |
| 101 | hp*|HP*) LDSHARED="ld -b";; |
| 102 | *) LDSHARED="ld";; |
| 103 | esac |
| 104 | AC_VERBOSE(setting LDSHARED= to '$LDSHARED') |
| 105 | fi |
| 106 | # CCSHARED are the C *flags* used to create objects to go into a shared |
| 107 | # library -- this is only needed for HP-UX |
| 108 | if test -z "$CCSHARED" |
| 109 | then |
| 110 | case $ac_system in |
| 111 | hp*|HP*) CCSHARED="+z";; |
| 112 | esac |
| 113 | AC_VERBOSE(setting CCSHARED= to '$CCSHARED') |
| 114 | fi |
| 115 | # LINKFORSHARED are the flags passed to the $(CC) command that links |
| 116 | # the python executable -- this is only needed for HP-UX |
| 117 | if test -z "$LINKFORSHARED" |
| 118 | then |
| 119 | case $ac_system in |
| 120 | hp*|HP*) LINKFORSHARED="-Wl,-E";; |
| 121 | esac |
| 122 | AC_VERBOSE(setting LINKFORSHARED to '$LINKFORSHARED') |
| 123 | fi |
| 124 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 125 | # checks for libraries |
| 126 | AC_HAVE_LIBRARY(dl) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 127 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 128 | AC_CHECKING(for --with-svr4) |
| 129 | AC_WITH(svr4, [ |
| 130 | AC_HAVE_LIBRARY(socket) |
| 131 | AC_HAVE_LIBRARY(inet) |
| 132 | AC_HAVE_LIBRARY(nsl) |
| 133 | ]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 134 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 135 | AC_CHECKING(for --with-readline) |
| 136 | AC_WITH(readline, [AC_DEFINE(WITH_READLINE) |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 137 | if test ! -d "$withval" |
| 138 | then AC_ERROR(proper usage is --with-readline=DIRECTORY) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 139 | fi |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 140 | termcap= |
| 141 | AC_HAVE_LIBRARY(termcap, [termcap=termcap], [AC_HAVE_LIBRARY(termlib, [termcap=termlib])]) |
| 142 | if test ! -z "$termcap" |
Guido van Rossum | 4e8af44 | 1994-08-19 15:33:54 +0000 | [diff] [blame] | 143 | then LIBS="$LIBS $withval/libreadline.a" |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 144 | # Avoid possible conflict between shared libraries termcap and gl |
| 145 | # on IRIX 5: both contain a routine called clear. |
| 146 | if test -f /usr/lib/lib$termcap.a |
| 147 | then LIBS="$LIBS /usr/lib/lib$termcap.a" |
| 148 | else LIBS="$LIBS -l$termcap" |
| 149 | fi |
| 150 | else AC_ERROR(no working termcap/termlib, do not use --with-readline) |
| 151 | fi]) |
| 152 | |
| 153 | AC_CHECKING(for --with-thread) |
| 154 | AC_WITH(thread, [ |
| 155 | if test -d "$withval" |
| 156 | then LIBS="$LIBS -L$withval" |
| 157 | fi |
| 158 | AC_HAVE_LIBRARY(pthreads, [AC_DEFINE(WITH_THREAD) |
| 159 | AC_DEFINE(_POSIX_THREADS) |
| 160 | LIBS="$LIBS -lpthreads" |
| 161 | LIBOBJS="$LIBOBJS thread.o"]) |
| 162 | AC_HAVE_LIBRARY(mpc, [AC_DEFINE(WITH_THREAD) |
| 163 | LIBS="$LIBS -lmpc" |
| 164 | LIBOBJS="$LIBOBJS thread.o"]) |
| 165 | AC_HAVE_LIBRARY(thread, [AC_DEFINE(WITH_THREAD) |
| 166 | LIBS="$LIBS -lthread" |
| 167 | LIBOBJS="$LIBOBJS thread.o"]) |
| 168 | ]) |
| 169 | |
| 170 | # -I${DLINCLDIR} is added to the compile rule for import.o |
| 171 | AC_SUBST(DLINCLDIR) |
| 172 | DLINCLDIR=/ |
| 173 | |
| 174 | AC_CHECKING(for --with-sgi-dl) |
| 175 | AC_WITH(sgi-dl, [AC_DEFINE(WITH_SGI_DL) |
| 176 | dldir=$withval |
| 177 | if test -d "$dldir" |
| 178 | then LIBS="$LIBS -L$dldir" |
| 179 | else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY) |
| 180 | fi |
| 181 | DLINCLDIR=${dldir} |
| 182 | LIBS="$LIBS -ldl -lmld"]) |
| 183 | |
| 184 | AC_CHECKING(for --with-dl-dld) |
| 185 | AC_WITH(dl-dld, [AC_DEFINE(WITH_DL_DLD) |
| 186 | dldir=`echo "$withval" | sed 's/,.*//'` |
| 187 | dlddir=`echo "$withval" | sed 's/.*,//'` |
| 188 | if test -d "$dldir" -a -d "$dlddir" |
| 189 | then LIBS="$LIBS -L$dldir -L$dlddir" |
| 190 | else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY) |
| 191 | fi |
| 192 | DLINCLDIR=${dldir} |
| 193 | LIBS="$LIBS -ldl -ldld"]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 194 | |
| 195 | # checks for library functions |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 196 | AC_HAVE_FUNCS(chown clock dlopen ftime gettimeofday getpeername getpgrp getpid getwd link lstat nice readlink select setgid setuid setsid setpgid setpgrp setvbuf siginterrupt symlink tcgetpgrp tcsetpgrp times uname waitpid) |
| 197 | AC_REPLACE_FUNCS(dup2 getcwd strerror memmove) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 198 | AC_FUNC_CHECK(getpgrp, AC_COMPILE_CHECK([argument to getpgrp], [#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG))) |
| 199 | |
| 200 | # checks for structures |
| 201 | AC_TIME_WITH_SYS_TIME |
| 202 | AC_STRUCT_TM |
| 203 | AC_TIMEZONE |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 204 | AC_COMPILE_CHECK([whether we have altzone], [#include <time.h>], [return altzone;], AC_DEFINE(HAVE_ALTZONE)) |
| 205 | AC_COMPILE_CHECK([whether sys/select.h and sys/time.h may both be included], [ |
| 206 | #include <sys/types.h> |
| 207 | #include <sys/select.h> |
| 208 | #include <sys/time.h> |
| 209 | ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME)]) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 210 | |
| 211 | # checks for compiler characteristics |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 212 | |
| 213 | AC_CHAR_UNSIGNED |
| 214 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 215 | AC_CONST |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 216 | |
Guido van Rossum | ac405f6 | 1994-09-12 10:56:06 +0000 | [diff] [blame] | 217 | AC_COMPILE_CHECK([signed char], [], [signed char c;], [], AC_DEFINE(signed, [])) |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 218 | |
| 219 | AC_CHECKING(for prototypes) |
| 220 | AC_TEST_PROGRAM([ |
| 221 | int foo(int x) { return 0; } |
| 222 | int main() { return foo(10); } |
| 223 | ], AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=1) |
| 224 | |
| 225 | AC_CHECKING(for variable length prototypes and stdarg.h) |
| 226 | AC_TEST_PROGRAM([ |
| 227 | #include <stdarg.h> |
| 228 | int foo(int x, ...) { return 0; } |
| 229 | int main() { return foo(10, 11, 12); } |
| 230 | ], AC_DEFINE(HAVE_STDARG_PROTOTYPES) have_prototypes=1) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 231 | if test "$have_prototypes"; then |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 232 | AC_COMPILE_CHECK(["bad exec* prototypes"], [#include <unistd.h>], [char **t;execve("@",t,t);], , AC_DEFINE(BAD_EXEC_PROTOTYPES)) |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 233 | fi |
| 234 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 235 | AC_CHECKING(for bad static forward) |
| 236 | AC_TEST_PROGRAM([ |
| 237 | struct s { int a; int b; }; |
| 238 | static struct s foo; |
| 239 | int foobar() { return !foo.a; } |
| 240 | static struct s foo = { 1, 2 }; |
| 241 | main() { exit(foobar()); } |
| 242 | ], , AC_DEFINE(BAD_STATIC_FORWARD)) |
| 243 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 244 | # checks for system services |
| 245 | # (none yet) |
| 246 | |
| 247 | # other checks for UNIX variants |
| 248 | AC_IRIX_SUN |
| 249 | AC_XENIX_DIR |
| 250 | |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 251 | # check for --with-libm=... |
| 252 | AC_SUBST(LIBM) |
| 253 | LIBM=-lm |
| 254 | AC_WITH(libm, [if test "$withval" != yes |
| 255 | then LIBM=$withval |
| 256 | else AC_ERROR(proper usage is --with-libm=STRING) |
| 257 | fi]) |
| 258 | |
| 259 | # check for --with-libc=... |
| 260 | AC_SUBST(LIBC) |
| 261 | AC_WITH(libc, [if test "$withval" != yes |
| 262 | then LIBC=$withval |
| 263 | else AC_ERROR(proper usage is --with-libc=STRING) |
| 264 | fi]) |
| 265 | |
Guido van Rossum | 627b2d7 | 1993-12-24 10:39:16 +0000 | [diff] [blame] | 266 | # generate output files |
Guido van Rossum | 433c8ad | 1994-08-01 12:07:07 +0000 | [diff] [blame] | 267 | AC_OUTPUT(Makefile Objects/Makefile Parser/Makefile Python/Makefile Modules/Makefile.pre) |