blob: de62598d6c7219cde2aad3247b1995db1943ee0a [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 Rossumbcd91e01997-03-20 20:46:29 +000048 case $MACHDEP in
Guido van Rossumb418f891996-07-30 18:06:02 +000049 '') 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 Rossum54d93d41997-01-22 20:51:58 +0000308AC_MSG_CHECKING(for --with-dec-threads)
309AC_SUBST(LDLAST)
310AC_ARG_WITH(dec-threads,
311[--with-dec-threads use DEC Alpha/OSF1 thread-safe libraries],
312[AC_MSG_RESULT($withval)
313LDLAST=-threads
Guido van Rossumf78abae1997-01-21 22:02:36 +0000314if test "${with_thread+set}" != set; then
Guido van Rossum54d93d41997-01-22 20:51:58 +0000315 with_thread="$withval";
316fi],
317AC_MSG_RESULT(no))
318
319AC_MSG_CHECKING(for --with-threads)
320AC_ARG_WITH(threads, [--with-threads alias for --with-thread],
321[AC_MSG_RESULT($withval)
322if test "${with_thread+set}" != set; then
323 with_thread="$withval";
324fi],
325AC_MSG_RESULT(no))
326
327AC_MSG_CHECKING(for --with-thread)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000328AC_ARG_WITH(thread, [--with-thread[=DIRECTORY] make interpreter thread-safe], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000329AC_MSG_RESULT($withval)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000330if test -d "$withval"
Guido van Rossum300fda71996-08-19 21:58:16 +0000331then LDFLAGS="$LDFLAGS -L$withval"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000332fi
Guido van Rossum9caf77a1996-08-01 00:52:26 +0000333AC_DEFINE(_REENTRANT)
Guido van Rossumb418f891996-07-30 18:06:02 +0000334AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
335AC_DEFINE(C_THREADS)
336LIBOBJS="$LIBOBJS thread.o"],[
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000337AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000338AC_DEFINE(_POSIX_THREADS)
339LIBS="$LIBS -lpthreads"
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000340LIBOBJS="$LIBOBJS thread.o"], [
341AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
342AC_DEFINE(_POSIX_THREADS)
343LIBS="$LIBS -lpthread"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000344LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossumb418f891996-07-30 18:06:02 +0000345])])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000346AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000347LIBS="$LIBS -lmpc"
348LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000349AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000350LIBS="$LIBS -lthread"
351LIBOBJS="$LIBOBJS thread.o"])
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000352], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000353
Guido van Rossum68242b51996-05-28 22:53:03 +0000354# -I${DLINCLDIR} is added to the compile rule for importdl.o
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000355AC_SUBST(DLINCLDIR)
356DLINCLDIR=/
357
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000358AC_MSG_CHECKING(for --with-sgi-dl)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000359AC_ARG_WITH(sgi-dl, [--with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000360AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000361AC_DEFINE(WITH_SGI_DL)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000362dldir=$withval
363if test -d "$dldir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000364then LDFLAGS="$LDFLAGS -L$dldir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000365else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
366fi
367DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000368LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000369
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000370AC_MSG_CHECKING(for --with-dl-dld)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000371AC_ARG_WITH(dl-dld, [--with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000372AC_MSG_RESULT($withval)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000373AC_DEFINE(WITH_DL_DLD)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000374dldir=`echo "$withval" | sed 's/,.*//'`
375dlddir=`echo "$withval" | sed 's/.*,//'`
376if test -d "$dldir" -a -d "$dlddir"
Guido van Rossum300fda71996-08-19 21:58:16 +0000377then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000378else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
379fi
380DLINCLDIR=${dldir}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000381LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
Guido van Rossum627b2d71993-12-24 10:39:16 +0000382
383# checks for library functions
Guido van Rossuma2ef3831996-06-26 19:45:23 +0000384AC_CHECK_FUNCS(chown clock dlopen flock ftime ftruncate \
Guido van Rossum68242b51996-05-28 22:53:03 +0000385 gethostname_r getpeername getpgrp getpid gettimeofday getwd \
Guido van Rossumdde43171996-07-24 02:41:31 +0000386 link lstat mkfifo nice plock putenv readlink \
Guido van Rossum68242b51996-05-28 22:53:03 +0000387 select setgid setuid setsid setpgid setpgrp setvbuf \
388 sigaction siginterrupt sigrelse strftime symlink \
Guido van Rossumb418f891996-07-30 18:06:02 +0000389 tcgetpgrp tcsetpgrp times truncate uname waitpid)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000390AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000391AC_CHECK_FUNC(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
392AC_CHECK_FUNC(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
393AC_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 +0000394
395# checks for structures
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000396AC_HEADER_TIME
Guido van Rossum627b2d71993-12-24 10:39:16 +0000397AC_STRUCT_TM
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000398AC_STRUCT_TIMEZONE
399
400AC_MSG_CHECKING(for time.h that defines altzone)
401AC_CACHE_VAL(ac_cv_header_time_altzone,
402[AC_TRY_COMPILE([#include <time.h>], [return altzone;],
403 ac_cv_header_time_altzone=yes,
404 ac_cv_header_time_altzone=no)])
405AC_MSG_RESULT($ac_cv_header_time_altzone)
406if test $ac_cv_header_time_altzone = yes; then
407 AC_DEFINE(HAVE_ALTZONE)
408fi
409
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000410was_it_defined=no
411AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000412AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000413#include <sys/types.h>
414#include <sys/select.h>
415#include <sys/time.h>
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000416], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
417AC_MSG_RESULT($was_it_defined)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000418
419# checks for compiler characteristics
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000420
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000421AC_C_CHAR_UNSIGNED
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000422
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000423AC_C_CONST
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000424
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000425works=no
426AC_MSG_CHECKING(for working volatile)
427AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
428AC_MSG_RESULT($works)
Guido van Rossumdabb11b1994-10-11 15:04:27 +0000429
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000430works=no
431AC_MSG_CHECKING(for working signed char)
432AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
433AC_MSG_RESULT($works)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000434
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000435have_prototypes=no
436AC_MSG_CHECKING(for prototypes)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000437AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
438AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000439AC_MSG_RESULT($have_prototypes)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000440
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000441works=no
442AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000443AC_TRY_COMPILE([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000444#include <stdarg.h>
Guido van Rossum3f13e481996-08-30 20:58:11 +0000445int foo(int x, ...) {
446 va_list va;
447 va_start(va, x);
448 va_arg(va, int);
449 va_arg(va, char *);
450 va_arg(va, double);
451 return 0;
452}
453], [return foo(10, "", 3.14);],
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000454AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
455AC_MSG_RESULT($works)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000456
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000457if test "$have_prototypes" = yes; then
458bad_prototypes=no
459AC_MSG_CHECKING(for bad exec* prototypes)
460AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
461 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
462AC_MSG_RESULT($bad_prototypes)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000463fi
464
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000465bad_forward=no
466AC_MSG_CHECKING(for bad static forward)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000467AC_TRY_RUN([
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000468struct s { int a; int b; };
469static struct s foo;
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000470int foobar() {
471 static int random;
472 random = (int) &foo;
473 return random;
474}
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000475static struct s foo = { 1, 2 };
Guido van Rossum5dee5e71994-11-10 23:06:54 +0000476main() {
477 exit(!((int)&foo == foobar()));
478}
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000479], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
480AC_MSG_RESULT($bad_forward)
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000481
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000482va_list_is_array=no
483AC_MSG_CHECKING(whether va_list is an array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000484AC_TRY_COMPILE([
485#ifdef HAVE_STDARG_PROTOTYPES
486#include <stdarg.h>
487#else
488#include <varargs.h>
489#endif
Guido van Rossum5739e7e1995-01-20 16:50:53 +0000490], [va_list list1, list2; list1 = list2;], ,
491AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
492AC_MSG_RESULT($va_list_is_array)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000493
Guido van Rossum627b2d71993-12-24 10:39:16 +0000494# checks for system services
495# (none yet)
496
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000497# Linux requires this for correct f.p. operations
498AC_CHECK_LIB(ieee, __fpu_control)
Guido van Rossum627b2d71993-12-24 10:39:16 +0000499
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000500# check for --with-libm=...
501AC_SUBST(LIBM)
Guido van Rossum4b6b5791996-09-09 20:09:34 +0000502case $ac_sys_system in
503next) ;;
504*) LIBM=-lm
505esac
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000506AC_ARG_WITH(libm, [--with-libm=STRING math library], [
507if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000508then LIBM=$withval
509else AC_ERROR(proper usage is --with-libm=STRING)
510fi])
511
512# check for --with-libc=...
513AC_SUBST(LIBC)
Guido van Rossum76be6ed1995-01-02 18:33:54 +0000514AC_ARG_WITH(libc, [--with-libc=STRING C library], [
515if test "$withval" != yes
Guido van Rossum433c8ad1994-08-01 12:07:07 +0000516then LIBC=$withval
517else AC_ERROR(proper usage is --with-libc=STRING)
518fi])
519
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000520# check for hypot() in math library
521LIBS_SAVE=$LIBS
522LIBS="$LIBS $LIBM"
523AC_CHECK_FUNCS(hypot)
Guido van Rossumf2f7eb31996-08-30 15:18:00 +0000524AC_REPLACE_FUNCS(hypot)
Guido van Rossumaf5b83e1995-01-04 19:02:35 +0000525LIBS=$LIBS_SAVE
526
Guido van Rossum7d473291995-01-20 14:12:16 +0000527# check for getopt
528AC_MSG_CHECKING(for genuine getopt)
529AC_CACHE_VAL(ac_cv_func_getopt,
530[AC_TRY_RUN([#include <stdio.h>
531extern int optind, opterr, getopt();
532extern char* optarg;
533int main() {
534 char* av[] = { "testprog", "parameter", "-fFlag", NULL };
535 opterr = 0;
536 if (getopt(3, av, "f:") == 'f') { exit(1); }
537 exit(0);
538}], ac_cv_func_getopt=yes, ac_cv_func_getopt=no, ac_cv_func_getopt=no)])dnl
539AC_MSG_RESULT($ac_cv_func_getopt)
540test $ac_cv_func_getopt = no && LIBOBJS="$LIBOBJS getopt.o"
541AC_SUBST(LIBOBJS)dnl
542
Guido van Rossum627b2d71993-12-24 10:39:16 +0000543# generate output files
Guido van Rossumb418f891996-07-30 18:06:02 +0000544AC_OUTPUT(Makefile \
545 Objects/Makefile \
546 Parser/Makefile \
547 Python/Makefile \
548 Modules/Makefile.pre)