blob: 5d60834a67f813f2d6ce771f19ddd5b729931f57 [file] [log] [blame]
Guido van Rossum76be6ed1995-01-02 18:33:54 +00001dnl Process this file with autoconf 2.0 or later to make a configure script.
2AC_REVISION($Revision$)
3AC_PREREQ(2.0)
Guido van Rossum6085e321993-12-26 18:24:40 +00004AC_INIT(Include/object.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +00005AC_CONFIG_HEADER(config.h)
Guido van Rossum627b2d71993-12-24 10:39:16 +00006
Guido van Rossumb418f891996-07-30 18:06:02 +00007# NEXTSTEP stuff
Guido van Rossum4b6b5791996-09-09 20:09:34 +00008if test -f /usr/lib/NextStep/software_version; then
9
10 AC_MSG_CHECKING(for --with-next-archs)
11 AC_ARG_WITH(next-archs,
12 [--with-next-archs='arch1 arch2 ..' build MAB binary], [
13 if test -n "$withval"; then
Guido van Rossum2bb4f551996-09-10 18:19:59 +000014 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
15 # GCC does not currently support multi archs on the NeXT
16 with_gcc=no
Guido van Rossum4b6b5791996-09-09 20:09:34 +000017 fi
18 AC_MSG_RESULT($with_next_archs)
19 ], [AC_MSG_RESULT(none: using `arch`)])
20
21 if test -z "$MACHDEP"
22 then
23 set X `hostinfo | grep 'NeXT Mach.*:' | \
24 sed -e 's/://' -e 's/\./_/'` && \
25 ac_sys_system=next && ac_sys_release=$4
26
27 MACHDEP="$ac_sys_system$ac_sys_release"
Guido van Rossumb418f891996-07-30 18:06:02 +000028 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000029fi
Guido van Rossumb418f891996-07-30 18:06:02 +000030
31# Set name for machine-dependent library files
32AC_SUBST(MACHDEP)
33AC_MSG_CHECKING(MACHDEP)
34if test -z "$MACHDEP"
35then
Guido van Rossum4b6b5791996-09-09 20:09:34 +000036 ac_sys_system=`uname -s`
37 if test "$ac_sys_system" = "AIX" ; then
38 ac_sys_release=`uname -v`
Guido van Rossumb418f891996-07-30 18:06:02 +000039 else
Guido van Rossum4b6b5791996-09-09 20:09:34 +000040 ac_sys_release=`uname -r`
Guido van Rossumb418f891996-07-30 18:06:02 +000041 fi
Guido van Rossum4b6b5791996-09-09 20:09:34 +000042 ac_md_system=`echo $ac_sys_system |
43 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
44 ac_md_release=`echo $ac_sys_release |
45 tr -d '[/ ]' | sed 's/\..*//'`
46 MACHDEP="$ac_md_system$ac_md_release"
47
Guido van Rossumb418f891996-07-30 18:06:02 +000048 case MACHDEP in
49 '') MACHDEP=unknown;;
50 esac
51fi
52AC_MSG_RESULT($MACHDEP)
53
Guido van Rossum627b2d71993-12-24 10:39:16 +000054# checks for alternative programs
Guido van Rossum5739e7e1995-01-20 16:50:53 +000055AC_MSG_CHECKING(for --without-gcc)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000056AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
Guido van Rossum433c8ad1994-08-01 12:07:07 +000057 case $withval in
Guido van Rossum5739e7e1995-01-20 16:50:53 +000058 no) CC=cc
59 without_gcc=yes;;
60 yes) CC=gcc
61 without_gcc=no;;
62 *) CC=$withval
63 without_gcc=$withval;;
Guido van Rossum55a214e1995-09-13 17:48:09 +000064 esac], [
Guido van Rossumb418f891996-07-30 18:06:02 +000065 case $ac_sys_system in
Guido van Rossum55a214e1995-09-13 17:48:09 +000066 OSF1) CC=cc
67 without_gcc=;;
68 *) without_gcc=no;;
69 esac])
Guido van Rossum5739e7e1995-01-20 16:50:53 +000070AC_MSG_RESULT($without_gcc)
71
Guido van Rossum03ad99f1995-03-09 14:09:54 +000072# If the user switches compilers, we can't believe the cache
73if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
74then
75 AC_ERROR(cached CC is different -- throw away $cache_file
76(it is also a good idea to do 'make clean' before compiling))
77fi
78
Guido van Rossum627b2d71993-12-24 10:39:16 +000079AC_PROG_CC
80AC_PROG_RANLIB
Guido van Rossum433c8ad1994-08-01 12:07:07 +000081AC_SUBST(AR)
Guido van Rossum76be6ed1995-01-02 18:33:54 +000082AC_CHECK_PROGS(AR, ar aal, ar)
Guido van Rossum4e8af441994-08-19 15:33:54 +000083AC_SUBST(INSTALL)
Guido van Rossum7d473291995-01-20 14:12:16 +000084AC_SUBST(INSTALL_PROGRAM)
85AC_SUBST(INSTALL_DATA)
Guido van Rossum4e8af441994-08-19 15:33:54 +000086# Install just never works :-(
87if test -z "$INSTALL"
Guido van Rossum7d473291995-01-20 14:12:16 +000088then
89 INSTALL=cp
90 INSTALL_PROGRAM=cp
91 INSTALL_DATA=cp
92else
93 INSTALL_PROGRAM="$INSTALL"
94 INSTALL_DATA="$INSTALL -m 644"
Guido van Rossum4e8af441994-08-19 15:33:54 +000095fi
Guido van Rossumb418f891996-07-30 18:06:02 +000096
Guido van Rossum4e8af441994-08-19 15:33:54 +000097# Optimizer/debugger flags passed between Makefiles
Guido van Rossumb418f891996-07-30 18:06:02 +000098AC_SUBST(OPT)
Guido van Rossum4e8af441994-08-19 15:33:54 +000099if test -z "$OPT"
Guido van Rossumb418f891996-07-30 18:06:02 +0000100then
101 case $ac_sys_system in
Guido van Rossumb418f891996-07-30 18:06:02 +0000102 *) OPT="-O";;
103 esac
Guido van Rossum4e8af441994-08-19 15:33:54 +0000104fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000105
Guido van Rossum6f2260e1996-09-09 16:21:03 +0000106if test "$ac_arch_flags"
Guido van Rossumc5a39031996-07-31 17:35:03 +0000107then
108 OPT="$OPT $ac_arch_flags"
109fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000110# checks for UNIX variants that set C preprocessor variables
111AC_AIX
Guido van Rossum627b2d71993-12-24 10:39:16 +0000112AC_MINIX
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000113
Guido van Rossum300fda71996-08-19 21:58:16 +0000114# check for ANSI or K&R ("traditional") preprocessor
115AC_MSG_CHECKING(for C preprocessor type)
116AC_TRY_COMPILE([
117#define spam(name, doc) {#name, &name, #name "() -- " doc}
118int foo;
119struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
120], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
121AC_MSG_RESULT($cpp_type)
122
Guido van Rossum627b2d71993-12-24 10:39:16 +0000123# checks for header files
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000124AC_HEADER_STDC
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000125AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h ncurses.h \
126signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000127sys/audioio.h sys/file.h sys/lock.h \
128sys/param.h sys/select.h sys/time.h sys/times.h \
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000129sys/un.h sys/utsname.h sys/wait.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000130AC_HEADER_DIRENT
Guido van Rossum627b2d71993-12-24 10:39:16 +0000131
132# checks for typedefs
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000133was_it_defined=no
134AC_MSG_CHECKING(for clock_t in time.h)
135AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
136AC_MSG_RESULT($was_it_defined)
137
Guido van Rossum300fda71996-08-19 21:58:16 +0000138# Add some code to confdefs.h so that the test for off_t works on SCO
139cat >> confdefs.h <<\EOF
140#if defined(SCO_DS)
141#undef _OFF_T
142#endif
143EOF
144
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000145AC_TYPE_MODE_T
146AC_TYPE_OFF_T
147AC_TYPE_PID_T
148AC_TYPE_SIGNAL
149AC_TYPE_SIZE_T
150AC_TYPE_UID_T
Guido van Rossum627b2d71993-12-24 10:39:16 +0000151
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000152AC_CHECK_SIZEOF(int)
153AC_CHECK_SIZEOF(long)
Guido van Rossumac405f61994-09-12 10:56:06 +0000154
155# Set info about shared libraries.
Guido van Rossumac405f61994-09-12 10:56:06 +0000156AC_SUBST(SO)
157AC_SUBST(LDSHARED)
158AC_SUBST(CCSHARED)
159AC_SUBST(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000160# SO is the extension of shared libraries `(including the dot!)
161# -- usually .so, .sl on HP-UX
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000162AC_MSG_CHECKING(SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000163if test -z "$SO"
164then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000165 case $ac_sys_system in
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000166 hp*|HP*) SO=.sl;;
167 *) SO=.so;;
Guido van Rossumac405f61994-09-12 10:56:06 +0000168 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000169fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000170AC_MSG_RESULT($SO)
Guido van Rossumac405f61994-09-12 10:56:06 +0000171# LDSHARED is the ld *command* used to create shared library
172# -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000173AC_MSG_CHECKING(LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000174if test -z "$LDSHARED"
175then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000176 case $ac_sys_system/$ac_sys_release in
Guido van Rossum300fda71996-08-19 21:58:16 +0000177 AIX*) LDSHARED="ld_so_aix \$(CC)";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000178 IRIX*) LDSHARED="ld -shared";;
179 SunOS/4*) LDSHARED="ld";;
180 SunOS/5*) LDSHARED="ld -G";;
181 hp*|HP*) LDSHARED="ld -b";;
Guido van Rossum71001e41995-01-26 00:44:03 +0000182 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
Guido van Rossum7d473291995-01-20 14:12:16 +0000183 DYNIX/ptx*) LDSHARED="ld -G";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000184 next/*) LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';;
Guido van Rossum81652ab1996-07-21 02:53:27 +0000185 Linux*) LDSHARED="gcc -shared";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000186 FreeBSD*) LDSHARED="ld -Bshareable";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000187 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000188 *) LDSHARED="ld";;
189 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000190fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000191AC_MSG_RESULT($LDSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000192# CCSHARED are the C *flags* used to create objects to go into a shared
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000193# library -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000194AC_MSG_CHECKING(CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000195if test -z "$CCSHARED"
196then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000197 case $ac_sys_system in
Guido van Rossumaf07a441995-02-13 19:45:27 +0000198 hp*|HP*) if test "$GCC" = yes;
199 then CCSHARED="-fpic";
200 else CCSHARED="+z";
201 fi;;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000202 Linux*) CCSHARED="-fpic";;
Guido van Rossum68242b51996-05-28 22:53:03 +0000203 FreeBSD*) CCSHARED="-fpic";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000204 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000205 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000206fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000207AC_MSG_RESULT($CCSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000208# LINKFORSHARED are the flags passed to the $(CC) command that links
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000209# the python executable -- this is only needed for a few systems
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000210AC_MSG_CHECKING(LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000211if test -z "$LINKFORSHARED"
212then
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000213 case $ac_sys_system in
Guido van Rossumce458511996-12-10 17:18:38 +0000214 AIX*) LINKFORSHARED="-Wl,-bE:python.exp -lld";;
Guido van Rossum5dab3d81996-12-06 21:18:18 +0000215 hp*|HP*)
216 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/sharedmodules";;
Guido van Rossumb65a48e1995-06-14 18:21:23 +0000217 Linux*) LINKFORSHARED="-rdynamic";;
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000218 next) LINKFORSHARED="-u libsys_s";;
Guido van Rossum300fda71996-08-19 21:58:16 +0000219 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
Guido van Rossumac405f61994-09-12 10:56:06 +0000220 esac
Guido van Rossumac405f61994-09-12 10:56:06 +0000221fi
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000222AC_MSG_RESULT($LINKFORSHARED)
Guido van Rossumac405f61994-09-12 10:56:06 +0000223
Guido van Rossum627b2d71993-12-24 10:39:16 +0000224# checks for libraries
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000225AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
226AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
227AC_CHECK_LIB(sun, getpwnam) # NIS (== YP) interface for IRIX 4
Guido van Rossum71001e41995-01-26 00:44:03 +0000228# The following three (nsl,inet,socket) are needed on Sequent;
229# the order of checking must be this. Most SVR4 platforms will
230# need -lsocket and -lnsl. However on SGI IRIX 5, these exist but
231# broken. I see no elegant solution (probably CHECK_LIB should be
232# fixed to only add the library if the given entry point is not
233# satisfied without it).
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000234if test "$ac_sys_system" != IRIX
Guido van Rossum71001e41995-01-26 00:44:03 +0000235then
Guido van Rossumf618d2c1995-01-17 16:36:13 +0000236AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
237AC_CHECK_LIB(inet, gethostbyname, [LIBS="-linet $LIBS"], [], -lnsl) # Sequent
238AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
Guido van Rossum71001e41995-01-26 00:44:03 +0000239fi
Guido van Rossumc5a39031996-07-31 17:35:03 +0000240AC_MSG_CHECKING(for --with-libs)
241AC_ARG_WITH(libs, [--with-libs='lib1 ...' link against additional libs], [
242AC_MSG_RESULT($withval)
243LIBS="$withval $LIBS"
244], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000245
Guido van Rossum8c4ed9a1996-12-31 22:34:17 +0000246AC_MSG_CHECKING(for --with(out)-readline)
247use_readline="yes"
248AC_ARG_WITH(readline,
249[--with-readline=DIRECTORY search GNU readline library in DIRECTORY
250--without-readline do not use GNU readline library],
251[AC_MSG_RESULT($withval); use_readline="$withval"],
252[AC_MSG_RESULT((default) yes)])
253if test "$use_readline" != "no"
254then
255 if test "$use_readline" != "yes"
256 then add_ldflags="-L$use_readline"
257 else add_ldflags=""
258 fi
259 # See where the termcap interface could be hiding...
260 AC_MSG_CHECKING(for readline and termcap libraries)
261 AC_CACHE_VAL(ac_cv_readline_termcap,
262 [
263 AC_MSG_RESULT(have to find out)
264 save_libs="$LIBS"
265 save_ldflags="$LDFLAGS"
266 LDFLAGS="$save_ldflags $add_ldflags"
267 rl="-lreadline"
268 first=""
269 # Hack for SGI IRIX 5.x.
270 # Both termcap and gl have an entry point clear().
271 # When linking with both shared libraries, we're in trouble.
272 # We don't need the one in termcap.
273 # By forcing a static link for termcap, we avoid
274 # linking its clear() entry point.
275 if test -f /usr/lib/libgl.so -a -f /usr/lib/libtermcap.a
276 then first="/usr/lib/libtermcap.a"
277 fi
278 for add_lib in \
279 "$first" "-ltermcap" "-ltermlib" "-lcurses" "-lncurses"
280 do
281 AC_MSG_CHECKING(for $rl $add_lib)
282 LIBS="$save_libs $rl $add_lib"
283 AC_TRY_LINK([extern char *readline();],
284 [char *line=readline();],
285 [AC_MSG_RESULT(yes);
286 ac_cv_readline_termcap="$rl $add_lib"],
287 [AC_MSG_RESULT(no)])
288 if test "$ac_cv_readline_termcap" != ""
289 then break
290 fi
291 done
292 LIBS="$save_libs"
293 LDFLAGS="$save_ldflags"
294 AC_MSG_CHECKING(result from check for readline and termcap)
295 ])
296 if test "$ac_cv_readline_termcap" = ""
297 then
298 AC_MSG_RESULT(no)
299 AC_MSG_WARN(cannot link with GNU readline -- see config.log)
300 else
301 AC_MSG_RESULT($ac_cv_readline_termcap)
302 LIBS="$LIBS $ac_cv_readline_termcap"
303 LDFLAGS="$LDFLAGS $add_ldflags"
304 AC_DEFINE(WITH_READLINE)
305 fi
Guido van Rossum627b2d71993-12-24 10:39:16 +0000306fi
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000307
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000308AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000309AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000310AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000311if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000312then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000313fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000314AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000315AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
316AC_DEFINE(C_THREADS)
317LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000318AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000319AC_DEFINE(_POSIX_THREADS)
320LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000321LIBOBJS="$LIBOBJS thread.o"], [
322AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
323AC_DEFINE(_POSIX_THREADS)
324LIBS="$LIBS -lpthread"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000325LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumb418f891996-07-30 18:06:02 +0000326])])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000327AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000328LIBS="$LIBS -lmpc"
329LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000330AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000331LIBS="$LIBS -lthread"
332LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000333], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000334
Guido van Rossum68242b51996-05-28 22:53:03 +0000335# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000336AC_SUBST(DLINCLDIR)
337DLINCLDIR=/
338
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000339AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000340AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000341AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000342AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000343dldir=$withval
344if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000345then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000346else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
347fi
348DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000349LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000350
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000351AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000352AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000353AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000354AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000355dldir=`echo "$withval" | sed 's/,.*//'`
356dlddir=`echo "$withval" | sed 's/.*,//'`
357if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000358then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000359else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
360fi
361DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000362LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000363
364# checks for library functions
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000365AC_CHECK_FUNCS(chown clock dlopen flock ftime ftruncate \
Guido van Rossum68242b51996-05-28 22:53:03 +0000366 gethostname_r getpeername getpgrp getpid gettimeofday getwd \
Guido van Rossumdde43171996-07-24 02:41:31 +0000367 link lstat mkfifo nice plock putenv readlink \
Guido van Rossum68242b51996-05-28 22:53:03 +0000368 select setgid setuid setsid setpgid setpgrp setvbuf \
369 sigaction siginterrupt sigrelse strftime symlink \
Guido van Rossumb418f891996-07-30 18:06:02 +0000370 tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000371AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000372AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
373AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
374AC_CHECK_FUNC(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000375
376# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000377AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000378AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000379AC_STRUCT_TIMEZONE
380
381AC_MSG_CHECKING(for time.h that defines altzone)
382AC_CACHE_VAL(ac_cv_header_time_altzone,
383[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
384 ac_cv_header_time_altzone=yes,
385 ac_cv_header_time_altzone=no)])
386AC_MSG_RESULT($ac_cv_header_time_altzone)
387if test $ac_cv_header_time_altzone = yes; then
388 AC_DEFINE(HAVE_ALTZONE)
389fi
390
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000391was_it_defined=no
392AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000393AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000394#include <sys/types.h>
395#include <sys/select.h>
396#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000397], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
398AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000399
400# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000401
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000402AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000403
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000404AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000405
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000406works=no
407AC_MSG_CHECKING(for working volatile)
408AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
409AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000410
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000411works=no
412AC_MSG_CHECKING(for working signed char)
413AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
414AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000415
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000416have_prototypes=no
417AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000418AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
419AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000420AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000421
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000422works=no
423AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000424AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000425#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000426int foo(int x, ...) {
427 va_list va;
428 va_start(va, x);
429 va_arg(va, int);
430 va_arg(va, char *);
431 va_arg(va, double);
432 return 0;
433}
434], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000435AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
436AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000437
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000438if test "$have_prototypes" = yes; then
439bad_prototypes=no
440AC_MSG_CHECKING(for bad exec* prototypes)
441AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
442 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
443AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000444fi
445
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000446bad_forward=no
447AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000448AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000449struct s { int a; int b; };
450static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000451int foobar() {
452 static int random;
453 random = (int) &foo;
454 return random;
455}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000456static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000457main() {
458 exit(!((int)&foo == foobar()));
459}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000460], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
461AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000462
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000463va_list_is_array=no
464AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000465AC_TRY_COMPILE([
466#ifdef HAVE_STDARG_PROTOTYPES
467#include <stdarg.h>
468#else
469#include <varargs.h>
470#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000471], [va_list list1, list2; list1 = list2;], ,
472AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
473AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000474
Guido van Rossum627b2d71993-12-24 10:39:16 +0000475# checks for system services
476# (none yet)
477
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000478# Linux requires this for correct f.p. operations
479AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000480
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000481# check for --with-libm=...
482AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000483case $ac_sys_system in
484next) ;;
485*) LIBM=-lm
486esac
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000487AC_ARG_WITH(libm, [--with-libm=STRING math library], [
488if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000489then LIBM=$withval
490else AC_ERROR(proper usage is --with-libm=STRING)
491fi])
492
493# check for --with-libc=...
494AC_SUBST(LIBC)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000495AC_ARG_WITH(libc, [--with-libc=STRING C library], [
496if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000497then LIBC=$withval
498else AC_ERROR(proper usage is --with-libc=STRING)
499fi])
500
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000501# check for hypot() in math library
502LIBS_SAVE=$LIBS
503LIBS="$LIBS $LIBM"
504AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000505AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000506LIBS=$LIBS_SAVE
507
Guido van Rossum7d473291995-01-20 14:12:16 +0000508# check for getopt
509AC_MSG_CHECKING(for genuine getopt)
510AC_CACHE_VAL(ac_cv_func_getopt,
511[AC_TRY_RUN([#include <stdio.h>
512extern int optind, opterr, getopt();
513extern char* optarg;
514int main() {
515 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
516 opterr = 0;
517 if (getopt(3, av, "f:") == 'f') { exit(1); }
518 exit(0);
519}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
520AC_MSG_RESULT($ac_cv_func_getopt)
521test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
522AC_SUBST(LIBOBJS)dnl
523
Guido van Rossum627b2d71993-12-24 10:39:16 +0000524# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000525AC_OUTPUT(Makefile \
526 Objects/Makefile \
527 Parser/Makefile \
528 Python/Makefile \
529 Modules/Makefile.pre)