1 dnl Process this file with autoconf 2.0 or later to make a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(Include/object.h)
5 AC_CONFIG_HEADER(config.h)
7 # Set VERSION so we only need to edit in one place (i.e., here)
11 # Arguments passed to configure.
13 CONFIG_ARGS="$ac_configure_args"
15 # NEXTSTEP|MacOSX|Darwin stuff
16 if test -f /usr/lib/NextStep/software_version -o -f /System/Library/CoreServices/software_version ; then
18 AC_MSG_CHECKING(for --with-next-archs)
19 AC_ARG_WITH(next-archs,
20 [ --with-next-archs='arch1 arch2 ..' build MAB binary], [
21 if test -n "$withval"; then
22 ac_arch_flags=`/usr/lib/arch_tool -archify_list $withval`
23 # GCC does not currently support multi archs on the NeXT
26 AC_MSG_RESULT($with_next_archs)
27 ], [AC_MSG_RESULT(none: using `arch`)])
31 ac_sys_system=`uname -s`
32 if test "$ac_sys_system" = "Darwin" ; then
33 ac_sys_release=`uname -r`
35 set X `hostinfo | egrep '(NeXT Mach|Kernel Release).*:' | \
36 sed -e 's/://' -e 's/\./_/'` && \
37 ac_sys_system=next && ac_sys_release=$4
40 MACHDEP="$ac_sys_system$ac_sys_release"
44 AC_ARG_WITH(next-framework,
45 [ --with-next-framework Build (OpenStep|Rhapsody|MacOSX|Darwin) framework],,)
47 [ --with-dyld Use (OpenStep|Rhapsody|MacOSX|Darwin) dynamic linker],,)
49 # Set name for machine-dependent library files
51 AC_MSG_CHECKING(MACHDEP)
54 ac_sys_system=`uname -s`
55 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
56 ac_sys_release=`uname -v`
58 ac_sys_release=`uname -r`
60 ac_md_system=`echo $ac_sys_system |
61 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
62 ac_md_release=`echo $ac_sys_release |
63 tr -d '[/ ]' | sed 's/\..*//'`
64 MACHDEP="$ac_md_system$ac_md_release"
67 '') MACHDEP="unknown";;
72 # SGI compilers allow the specification of the both the ABI and the
73 # ISA on the command line. Depending on the values of these switches,
74 # different and often incompatable code will be generated.
76 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
77 # thus supply support for various ABI/ISA combinations. The MACHDEP
78 # variable is also adjusted.
81 if test ! -z "$SGI_ABI"
84 LDFLAGS="$SGI_ABI $LDFLAGS"
85 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
87 AC_MSG_RESULT($MACHDEP)
89 # checks for alternative programs
90 AC_MSG_CHECKING(for --without-gcc)
91 AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
98 without_gcc=$withval;;
100 case $ac_sys_system in
110 OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
111 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
112 LDFLAGS="$LDFLAGS -nodup"
120 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
123 AR="\$(srcdir)/Modules/ar_beos"
131 AC_MSG_RESULT($without_gcc)
136 AC_MSG_CHECKING(for --with-cxx=<compiler>)
137 AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
149 AC_MSG_RESULT($with_cxx)
151 dnl The following fragment works similar to AC_PROG_CXX.
152 dnl It does not fail if CXX is not found, and it is not executed if
153 dnl --with-cxx was given.
154 dnl Finally, it does not test whether CXX is g++.
156 if test "$check_cxx" = "yes"
158 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
159 if test "$CXX" = "notfound"
167 # If the user switches compilers, we can't believe the cache
168 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
170 AC_ERROR(cached CC is different -- throw away $cache_file
171 (it is also a good idea to do 'make clean' before compiling))
176 AC_MSG_CHECKING(for --with-suffix)
177 AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
183 AC_MSG_RESULT($EXEEXT)
188 gcc) CC="$CC -D_HAVE_BSDI";;
192 case $ac_sys_system in
195 cc|*/cc) CC="$CC -Ae";;
199 cc) CC="$CC -Wl,-Bexport";;
202 # Some functions have a prototype only with that define, e.g. confstr
203 AC_DEFINE(__EXTENSIONS__)
209 AC_MSG_CHECKING(LIBRARY)
210 if test -z "$LIBRARY"
212 LIBRARY='libpython$(VERSION).a'
214 AC_MSG_RESULT($LIBRARY)
216 # LDLIBRARY is the name of the library to link against (as opposed to the
217 # name of the library into which to insert object files). On systems
218 # without shared libraries, LDLIBRARY is the same as LIBRARY (defined in
219 # the Makefiles). On Cygwin LDLIBRARY is the import library, DLLLIBRARY is the
220 # shared (i.e., DLL) library.
226 # LINKCC is the command that links the python executable -- default is $(CC).
227 # This is altered for AIX in order to build the export list before
230 AC_MSG_CHECKING(LINKCC)
233 case $ac_sys_system in
235 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); \$(PURIFY) \$(CC)";;
237 LINKCC="LD_RUN_PATH=$libdir \$(PURIFY) \$(CC)";;
239 LINKCC="\$(PURIFY) \$(CC) -L/usr/lib/ia64l64";;
240 *) LINKCC="\$(PURIFY) \$(CC)";;
243 AC_MSG_RESULT($LINKCC)
245 AC_MSG_CHECKING(LDLIBRARY)
247 # NeXT framework builds require that the 'ar' library be converted into
248 # a bundle using libtool.
249 if test "$with_next_framework"
251 LDLIBRARY='libpython$(VERSION).dylib'
254 # DG/UX requires some fancy ld contortions to produce a .so from an .a
257 LDLIBRARY='libpython$(VERSION).so'
261 LDLIBRARY='libpython$(VERSION).so'
264 LDLIBRARY='libpython$(VERSION).dll.a'
265 DLLLIBRARY='libpython$(VERSION).dll'
268 AC_MSG_RESULT($LDLIBRARY)
272 AC_CHECK_PROGS(AR, ar aal, ar)
275 # Not every filesystem supports hard links
277 if test -z "$LN" ; then
278 case $ac_sys_system in
280 CYGWIN*) LN="ln -s";;
285 # Optimizer/debugger flags
291 case $ac_cv_prog_cc_g in
292 yes) OPT="-g -O2 -Wall -Wstrict-prototypes";;
293 *) OPT="-O2 -Wall -Wstrict-prototypes";;
300 # The current (beta) Monterey compiler dies with optimizations
301 case $ac_sys_system in
305 if test "$ac_arch_flags"
307 OPT="$OPT $ac_arch_flags"
309 # checks for UNIX variants that set C preprocessor variables
313 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
314 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
316 CC="$CC -OPT:Olimit=0"
317 AC_TRY_RUN([int main() { return 0; }],
318 ac_cv_opt_olimit_ok=yes,
319 ac_cv_opt_olimit_ok=no)
321 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
322 if test $ac_cv_opt_olimit_ok = yes; then
323 case $ac_sys_system in
324 Darwin*) OPT="$OPT" ;;
325 *) OPT="$OPT -OPT:Olimit=0";;
328 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
329 AC_CACHE_VAL(ac_cv_olimit_ok,
331 CC="$CC -Olimit 1500"
332 AC_TRY_RUN([int main() { return 0; }],
336 AC_MSG_RESULT($ac_cv_olimit_ok)
337 if test $ac_cv_olimit_ok = yes; then
338 OPT="$OPT -Olimit 1500"
342 dnl # check for ANSI or K&R ("traditional") preprocessor
343 dnl AC_MSG_CHECKING(for C preprocessor type)
345 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
347 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
348 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
349 dnl AC_MSG_RESULT($cpp_type)
351 # checks for header files
353 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
354 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
355 sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \
356 sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
357 sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
358 ndbm.h db1/ndbm.h gdbm/ndbm.h)
361 # checks for typedefs
363 AC_MSG_CHECKING(for clock_t in time.h)
364 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
365 AC_MSG_RESULT($was_it_defined)
367 # Add some code to confdefs.h so that the test for off_t works on SCO
368 cat >> confdefs.h <<\EOF
374 # Type availability checks
382 # Sizes of various common basic types
384 AC_CHECK_SIZEOF(long)
385 AC_CHECK_SIZEOF(void *)
386 AC_CHECK_SIZEOF(char)
387 AC_CHECK_SIZEOF(short)
388 AC_CHECK_SIZEOF(float)
389 AC_CHECK_SIZEOF(double)
390 AC_CHECK_SIZEOF(fpos_t)
392 AC_MSG_CHECKING(for long long support)
394 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
395 AC_MSG_RESULT($have_long_long)
396 if test "$have_long_long" = yes ; then
397 AC_CHECK_SIZEOF(long long)
400 AC_MSG_CHECKING(for uintptr_t support)
402 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
403 AC_MSG_RESULT($have_uintptr_t)
404 if test "$have_uintptr_t" = yes ; then
405 AC_CHECK_SIZEOF(uintptr_t)
408 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
409 AC_MSG_CHECKING(size of off_t)
410 AC_CACHE_VAL(ac_cv_sizeof_off_t,
411 [AC_TRY_RUN([#include <stdio.h>
412 #include <sys/types.h>
415 FILE *f=fopen("conftestval", "w");
417 fprintf(f, "%d\n", sizeof(off_t));
419 }], ac_cv_sizeof_off_t=`cat conftestval`, ac_cv_sizeof_off_t=0)
421 AC_MSG_RESULT($ac_cv_sizeof_off_t)
422 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
424 AC_MSG_CHECKING(whether to enable large file support)
425 if test "$have_long_long" = yes -a \
426 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
427 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
428 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
434 # AC_CHECK_SIZEOF() doesn't include <time.h>.
435 AC_MSG_CHECKING(size of time_t)
436 AC_CACHE_VAL(ac_cv_sizeof_time_t,
437 [AC_TRY_RUN([#include <stdio.h>
441 FILE *f=fopen("conftestval", "w");
443 fprintf(f, "%d\n", sizeof(time_t));
445 }], ac_cv_sizeof_time_t=`cat conftestval`, ac_cv_sizeof_time_t=0)
447 AC_MSG_RESULT($ac_cv_sizeof_time_t)
448 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
451 # if have pthread_t then define SIZEOF_PTHREAD_T
452 AC_MSG_CHECKING(for pthread_t)
454 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
455 AC_MSG_RESULT($have_pthread_t)
456 if test "$have_pthread_t" = yes ; then
457 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
458 AC_MSG_CHECKING(size of pthread_t)
459 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
460 [AC_TRY_RUN([#include <stdio.h>
464 FILE *f=fopen("conftestval", "w");
466 fprintf(f, "%d\n", sizeof(pthread_t));
468 }], ac_cv_sizeof_pthread_t=`cat conftestval`, ac_cv_sizeof_pthread_t=0)
470 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
471 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
475 # Minor variations in building a framework between NextStep versions 4 and 5
476 AC_SUBST(LIBTOOL_CRUFT)
477 case $ac_sys_system/$ac_sys_release in
479 ns_undef_sym='_environ'
480 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym" ;;
482 ns_undef_sym='__environ'
483 LIBTOOL_CRUFT="-U $ns_undef_sym" ;;
485 ns_undef_sym='_environ'
486 LIBTOOL_CRUFT="-lcc_dynamic -U $ns_undef_sym" ;;
489 AC_MSG_CHECKING(for --with-next-framework)
490 if test "$with_next_framework"
492 OPT="$OPT -fno-common"
493 # -U __environ is needed since bundles don't have access
494 # to crt0 when built but will always be linked against it
495 LDFLAGS="$LDFLAGS -Wl,-U,$ns_undef_sym"
496 AC_DEFINE(WITH_NEXT_FRAMEWORK)
502 AC_MSG_CHECKING(for --with-dyld)
503 if test "$with_next_framework" -o "$with_dyld"
509 AC_MSG_RESULT(required for framework build)
517 # Set info about shared libraries.
522 AC_SUBST(LINKFORSHARED)
523 # SO is the extension of shared libraries `(including the dot!)
524 # -- usually .so, .sl on HP-UX, .dll on Cygwin
528 case $ac_sys_system in
535 # LDSHARED is the ld *command* used to create shared library
536 # -- "ld" on SunOS 4.x.x, "ld -G" on SunOS 5.x, "ld -shared" on IRIX 5
537 # (Shared libraries in this instance are shared modules to be loaded into
538 # Python, as opposed to building Python itself as a shared library.)
539 AC_MSG_CHECKING(LDSHARED)
540 if test -z "$LDSHARED"
542 case $ac_sys_system/$ac_sys_release in
544 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
545 LDSHARED="\$(BINLIBDEST)/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/python.exp"
548 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
549 LDSHARED="\$(BINLIBDEST)/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
551 IRIX/5*) LDSHARED="ld -shared";;
552 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
553 SunOS/4*) LDSHARED="ld";;
555 if test "$GCC" = "yes"
556 then LDSHARED='$(CC) -shared'
557 else LDSHARED="ld -G";
559 hp*|HP*) LDSHARED="ld -b";;
560 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
561 DYNIX/ptx*) LDSHARED="ld -G";;
564 then LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined suppress'
565 else LDSHARED='$(CC) $(CFLAGS) -nostdlib -r';
567 if test "$with_next_framework" ; then
568 LDSHARED="$LDSHARED \$(LDLIBRARY)"
570 Linux*) LDSHARED="gcc -shared";;
571 dgux*) LDSHARED="ld -G";;
572 BSD/OS*/4*) LDSHARED="gcc -shared";;
573 OpenBSD*) LDSHARED="ld -Bshareable";;
575 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
577 LDSHARED="cc -shared"
579 LDSHARED="ld -Bshareable"
582 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
584 LDSHARED="cc -shared ${LDFLAGS}"
586 LDSHARED="ld -Bshareable ${LDFLAGS}"
589 if test "$GCC" = "yes"
590 then LDSHARED="$(CC) -shared"
591 else LDSHARED="$(CC) -G"
593 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
594 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
595 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
599 AC_MSG_RESULT($LDSHARED)
600 BLDSHARED=${BLDSHARED-$LDSHARED}
601 # CCSHARED are the C *flags* used to create objects to go into a shared
602 # library (module) -- this is only needed for a few systems
603 AC_MSG_CHECKING(CCSHARED)
604 if test -z "$CCSHARED"
606 case $ac_sys_system/$ac_sys_release in
607 SunOS*) if test "$GCC" = yes;
608 then CCSHARED="-fPIC";
610 hp*|HP*) if test "$GCC" = yes;
611 then CCSHARED="-fpic";
614 Linux*) CCSHARED="-fPIC";;
615 BSD/OS*/4*) CCSHARED="-fpic";;
616 OpenBSD*) CCSHARED="-fpic";;
617 FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
619 if test "$GCC" = "yes"
620 then CCSHARED="-fPIC"
621 else CCSHARED="-KPIC"
623 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
624 Monterey*) CCSHARED="-G";;
625 IRIX*/6*) case $CC in
626 *gcc*) CCSHARED="-shared";;
629 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
632 AC_MSG_RESULT($CCSHARED)
633 # LINKFORSHARED are the flags passed to the $(CC) command that links
634 # the python executable -- this is only needed for a few systems
635 AC_MSG_CHECKING(LINKFORSHARED)
636 if test -z "$LINKFORSHARED"
638 case $ac_sys_system/$ac_sys_release in
639 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
641 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
642 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
643 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
644 # -u libsys_s pulls in all symbols in libsys
645 next/2*|next/3*) LINKFORSHARED="-u libsys_s";;
646 # -u __dummy makes the linker aware of the objc runtime
647 # in System.framework; otherwise, __objcInit (referenced in
648 # crt1.o) gets erroneously defined as common, which breaks dynamic
649 # loading of any modules which reference it in System.framework
650 next/4*|next/5*) LINKFORSHARED="-u __dummy -framework System" ;;
651 Darwin/*) LINKFORSHARED="-u __dummy -framework System -framework Foundation" ;;
652 UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
653 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
654 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
656 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
658 LINKFORSHARED="-Wl,--export-dynamic"
660 SunOS/5*) case $CC in
662 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
664 LINKFORSHARED="-Xlinker --export-dynamic"
669 AC_MSG_RESULT($LINKFORSHARED)
671 AC_SUBST(CFLAGSFORSHARED)
672 AC_MSG_CHECKING(CFLAGSFORSHARED)
673 if test ! "$LIBRARY" = "$LDLIBRARY"
675 case $ac_sys_system in
677 # Cygwin needs CCSHARED when building extension DLLs
678 # but not when building the interpreter DLL.
681 CFLAGSFORSHARED='$(CCSHARED)'
684 AC_MSG_RESULT($CFLAGSFORSHARED)
686 # checks for libraries
687 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
688 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
690 # Check for --with-pydebug
691 AC_MSG_CHECKING(for --with-pydebug)
693 [ --with-pydebug build with Py_DEBUG defined], [
694 if test "$withval" != no
695 then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes)
696 else AC_MSG_RESULT(no)
700 # checks for system dependent C++ extensions support
701 case "$ac_sys_system" in
702 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
703 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
704 [loadAndInit("", 0, "")],
705 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
707 [AC_MSG_RESULT(no)]);;
711 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
712 # However on SGI IRIX, these exist but are broken.
713 # BeOS' sockets are stashed in libnet.
714 case "$ac_sys_system" in
717 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
718 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
721 case "$ac_sys_system" in
723 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
727 AC_MSG_CHECKING(for --with-libs)
729 [ --with-libs='lib1 ...' link against additional libs], [
730 AC_MSG_RESULT($withval)
731 LIBS="$withval $LIBS"
732 ], AC_MSG_RESULT(no))
734 # Determine if signalmodule should be used.
735 AC_SUBST(USE_SIGNAL_MODULE)
736 AC_SUBST(SIGNAL_OBJS)
737 AC_MSG_CHECKING(for --with-signal-module)
738 AC_ARG_WITH(signal-module,
739 [ --with-signal-module disable/enable signal module])
741 if test -z "$with_signal_module"
742 then with_signal_module="yes"
744 AC_MSG_RESULT($with_signal_module)
746 if test "${with_signal_module}" = "yes"; then
750 USE_SIGNAL_MODULE="#"
751 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
754 # This is used to generate Setup.config
755 AC_SUBST(USE_THREAD_MODULE)
758 AC_MSG_CHECKING(for --with-dec-threads)
760 AC_ARG_WITH(dec-threads,
761 [ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
762 AC_MSG_RESULT($withval)
764 if test "${with_thread+set}" != set; then
765 with_thread="$withval";
769 AC_MSG_CHECKING(for --with-threads)
771 [ --with(out)-threads[=DIRECTORY] disable/enable thread support])
773 # --with-thread is deprecated, but check for it anyway
775 [ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
776 with_threads=$with_thread])
778 if test -z "$with_threads"
779 then with_threads="yes"
781 AC_MSG_RESULT($with_threads)
783 if test "$with_threads" = "no"
785 USE_THREAD_MODULE="#"
787 if test ! -z "$with_threads" -a -d "$with_threads"
788 then LDFLAGS="$LDFLAGS -L$with_threads"
790 if test ! -z "$withval" -a -d "$withval"
791 then LDFLAGS="$LDFLAGS -L$withval"
793 AC_DEFINE(_REENTRANT)
794 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
796 LIBOBJS="$LIBOBJS thread.o"],[
797 AC_MSG_CHECKING(for --with-pth)
799 [ --with-pth use GNU pth threading libraries], [
800 AC_MSG_RESULT($withval)
801 AC_DEFINE(WITH_THREAD)
804 LIBOBJS="$LIBOBJS thread.o"],[
806 AC_CHECK_LIB(pthread, pthread_create, [AC_DEFINE(WITH_THREAD)
807 AC_DEFINE(_POSIX_THREADS)
808 LIBS="-lpthread $LIBS"
809 LIBOBJS="$LIBOBJS thread.o"],[
810 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
811 case $ac_sys_system in
813 *) AC_DEFINE(_POSIX_THREADS);;
815 LIBOBJS="$LIBOBJS thread.o"],[
816 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
817 AC_DEFINE(BEOS_THREADS)
818 LIBOBJS="$LIBOBJS thread.o"],[
819 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
820 AC_DEFINE(_POSIX_THREADS)
821 LIBS="$LIBS -lpthreads"
822 LIBOBJS="$LIBOBJS thread.o"], [
823 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
824 AC_DEFINE(_POSIX_THREADS)
826 LIBOBJS="$LIBOBJS thread.o"], [
827 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
828 AC_DEFINE(_POSIX_THREADS)
829 LIBS="$LIBS -lthread"
830 LIBOBJS="$LIBOBJS thread.o"], [
831 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
832 AC_DEFINE(_POSIX_THREADS)
833 LIBS="$LIBS -lpthread"
834 LIBOBJS="$LIBOBJS thread.o"], [
835 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
836 AC_DEFINE(_POSIX_THREADS)
838 LIBOBJS="$LIBOBJS thread.o"],[
839 USE_THREAD_MODULE="#"])
842 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
844 LIBOBJS="$LIBOBJS thread.o"
845 USE_THREAD_MODULE=""])
846 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
847 LIBS="$LIBS -lthread"
848 LIBOBJS="$LIBOBJS thread.o"
849 USE_THREAD_MODULE=""])
851 if test "$USE_THREAD_MODULE" != "#"
853 # If the above checks didn't disable threads, (at least) OSF1
854 # needs this '-threads' argument during linking.
855 case $ac_sys_system in
856 OSF1) LDLAST=-threads;;
861 # Check for GC support
862 AC_SUBST(USE_GC_MODULE)
864 AC_MSG_CHECKING(for --with-cycle-gc)
865 AC_ARG_WITH(cycle-gc,
866 [ --with(out)-cycle-gc disable/enable garbage collection])
868 if test -z "$with_cycle_gc"
869 then with_cycle_gc="yes"
871 if test "$with_cycle_gc" = "no"
875 AC_DEFINE(WITH_CYCLE_GC)
877 AC_MSG_RESULT($with_cycle_gc)
879 # Check for Python-specific malloc support
880 AC_MSG_CHECKING(for --with-pymalloc)
881 AC_ARG_WITH(pymalloc,
882 [ --with(out)-pymalloc disable/enable specialized mallocs], [
883 if test "$withval" != no
884 then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
885 else AC_MSG_RESULT(no)
889 # Check for --with-wctype-functions
890 AC_MSG_CHECKING(for --with-wctype-functions)
891 AC_ARG_WITH(wctype-functions,
892 [ --with-wctype-functions use wctype.h functions], [
893 if test "$withval" != no
894 then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
895 else AC_MSG_RESULT(no)
899 # -I${DLINCLDIR} is added to the compile rule for importdl.o
903 AC_MSG_CHECKING(for --with-sgi-dl)
905 [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
906 AC_MSG_RESULT($withval)
907 AC_DEFINE(WITH_SGI_DL)
908 DYNLOADFILE="dynload_dl.o"
910 if test ! -z "$dldir" -a -d "$dldir"
911 then LDFLAGS="$LDFLAGS -L$dldir"
912 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
915 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
917 AC_MSG_CHECKING(for --with-dl-dld)
918 AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
919 AC_MSG_RESULT($withval)
920 AC_DEFINE(WITH_DL_DLD)
921 DYNLOADFILE="dynload_dl.o"
922 dldir=`echo "$withval" | sed 's/,.*//'`
923 dlddir=`echo "$withval" | sed 's/.*,//'`
924 if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
925 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
926 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
929 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
931 # the dlopen() function means we might want to use dynload_shlib.o. some
932 # platforms, such as AIX, have dlopen(), but don't want to use it.
933 AC_CHECK_FUNCS(dlopen)
935 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
936 # loading of modules.
937 AC_SUBST(DYNLOADFILE)
938 AC_MSG_CHECKING(DYNLOADFILE)
939 if test -z "$DYNLOADFILE"
941 case $ac_sys_system/$ac_sys_release in
942 AIX*) DYNLOADFILE="dynload_aix.o";;
943 BeOS*) DYNLOADFILE="dynload_beos.o";;
944 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
945 Darwin/*|next/*) DYNLOADFILE="dynload_next.o";;
947 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
948 # out any dynamic loading
949 if test "$ac_cv_func_dlopen" = yes
950 then DYNLOADFILE="dynload_shlib.o"
951 else DYNLOADFILE="dynload_stub.o"
956 AC_MSG_RESULT($DYNLOADFILE)
957 if test "$DYNLOADFILE" != "dynload_stub.o"
959 AC_DEFINE(HAVE_DYNAMIC_LOADING)
962 # checks for library functions
963 AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r execv \
964 flock fork fsync fdatasync fpathconf ftime ftruncate \
965 getgroups getlogin getpeername getpid getpwent getwd \
966 kill link lstat mkfifo mktime mremap \
967 nice pathconf pause plock poll pthread_init \
969 select setegid seteuid setgid \
970 setlocale setregid setreuid setsid setpgid setuid setvbuf \
971 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
972 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
973 truncate uname waitpid _getpty)
975 # check for openpty and forkpty
977 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
978 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
980 # check for long file support functions
981 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
983 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
984 AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
985 AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
986 AC_CHECK_FUNCS(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
988 # checks for structures
993 AC_MSG_CHECKING(for time.h that defines altzone)
994 AC_CACHE_VAL(ac_cv_header_time_altzone,
995 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
996 ac_cv_header_time_altzone=yes,
997 ac_cv_header_time_altzone=no)])
998 AC_MSG_RESULT($ac_cv_header_time_altzone)
999 if test $ac_cv_header_time_altzone = yes; then
1000 AC_DEFINE(HAVE_ALTZONE)
1004 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
1006 #include <sys/types.h>
1007 #include <sys/select.h>
1008 #include <sys/time.h>
1009 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1010 AC_MSG_RESULT($was_it_defined)
1012 # checks for compiler characteristics
1018 AC_MSG_CHECKING(for working volatile)
1019 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1020 AC_MSG_RESULT($works)
1023 AC_MSG_CHECKING(for working signed char)
1024 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1025 AC_MSG_RESULT($works)
1028 AC_MSG_CHECKING(for prototypes)
1029 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1030 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
1031 AC_MSG_RESULT($have_prototypes)
1034 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
1037 int foo(int x, ...) {
1045 ], [return foo(10, "", 3.14);],
1046 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1047 AC_MSG_RESULT($works)
1049 if test "$have_prototypes" = yes; then
1051 AC_MSG_CHECKING(for bad exec* prototypes)
1052 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1053 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1054 AC_MSG_RESULT($bad_prototypes)
1058 AC_MSG_CHECKING(for bad static forward)
1060 struct s { int a; int b; };
1061 static struct s foo;
1064 random = (int) &foo;
1067 static struct s foo = { 1, 2 };
1069 exit(!((int)&foo == foobar()));
1071 ], , AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes)
1072 AC_MSG_RESULT($bad_forward)
1075 AC_MSG_CHECKING(whether va_list is an array)
1077 #ifdef HAVE_STDARG_PROTOTYPES
1080 #include <varargs.h>
1082 ], [va_list list1, list2; list1 = list2;], ,
1083 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1084 AC_MSG_RESULT($va_list_is_array)
1086 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1087 AC_CHECK_FUNC(gethostbyname_r, [
1088 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1089 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1091 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1096 struct hostent *he, *res;
1101 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1103 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1104 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1108 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1118 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1120 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1121 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1125 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1131 struct hostent_data data;
1133 (void) gethostbyname_r(name, he, &data);
1135 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1136 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1145 AC_CHECK_FUNCS(gethostbyname)
1147 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1148 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1149 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
1150 AC_SUBST(HAVE_GETHOSTBYNAME_R)
1151 AC_SUBST(HAVE_GETHOSTBYNAME)
1153 # checks for system services
1156 # Linux requires this for correct f.p. operations
1157 AC_CHECK_FUNC(__fpu_control,
1159 [AC_CHECK_LIB(ieee, __fpu_control)
1162 # Check for --with-fpectl
1163 AC_MSG_CHECKING(for --with-fpectl)
1165 [ --with-fpectl enable SIGFPE catching], [
1166 if test "$withval" != no
1167 then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1168 else AC_MSG_RESULT(no)
1170 [AC_MSG_RESULT(no)])
1172 # check for --with-libm=...
1174 case $ac_sys_system in
1180 AC_MSG_CHECKING(for --with-libm=STRING)
1181 AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
1182 if test "$withval" = no
1184 AC_MSG_RESULT(force LIBM empty)
1185 elif test "$withval" != yes
1187 AC_MSG_RESULT(set LIBM=\"$withval\")
1188 else AC_ERROR(proper usage is --with-libm=STRING)
1190 [AC_MSG_RESULT(default LIBM=\"$LIBM\")])
1192 # check for --with-libc=...
1194 AC_MSG_CHECKING(for --with-libc=STRING)
1195 AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
1196 if test "$withval" = no
1198 AC_MSG_RESULT(force LIBC empty)
1199 elif test "$withval" != yes
1201 AC_MSG_RESULT(set LIBC=\"$withval\")
1202 else AC_ERROR(proper usage is --with-libc=STRING)
1204 [AC_MSG_RESULT(default LIBC=\"$LIBC\")])
1206 # check for hypot() in math library
1209 AC_REPLACE_FUNCS(hypot)
1212 # check whether malloc(0) returns NULL or not
1213 AC_MSG_CHECKING(what malloc(0) returns)
1214 AC_CACHE_VAL(ac_cv_malloc_zero,
1215 [AC_TRY_RUN([#include <stdio.h>
1219 char *malloc(), *realloc();
1225 if (p == NULL) exit(1);
1227 if (p == NULL) exit(1);
1230 }], ac_cv_malloc_zero=nonnull, ac_cv_malloc_zero=null)])
1231 AC_MSG_RESULT($ac_cv_malloc_zero)
1232 if test "$ac_cv_malloc_zero" = null
1234 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1238 AC_CHECK_HEADER(wchar.h,
1239 AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1243 # check for usable wchar_t
1244 usable_wchar_t="unkown"
1245 AC_MSG_CHECKING(for usable wchar_t)
1257 AC_DEFINE(HAVE_USABLE_WCHAR_T) usable_wchar_t="yes",
1258 usable_wchar_t="no")
1259 AC_MSG_RESULT($usable_wchar_t)
1261 # check for endianness
1264 # Check whether right shifting a negative integer extends the sign bit
1265 # or fills with zeros (like the Cray J90, according to Tim Peters).
1266 AC_MSG_CHECKING(whether right shift extends the sign bit)
1267 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
1271 exit(((-1)>>3 == -1) ? 0 : 1);
1273 ], ac_cv_rshift_extends_sign=yes, ac_cv_rshift_extends_sign=no)])
1274 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1275 if test "$ac_cv_rshift_extends_sign" = no
1277 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1280 # check for getc_unlocked and related locking functions
1281 AC_MSG_CHECKING(for getc_unlocked() and friends)
1282 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1283 AC_TRY_LINK([#include <stdio.h>],[
1284 FILE *f = fopen("/dev/null", "r");
1288 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1289 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1290 if test "$ac_cv_have_getc_unlocked" = yes
1292 AC_DEFINE(HAVE_GETC_UNLOCKED)
1295 # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
1296 # Add sys/socket.h to confdefs.h
1297 cat >> confdefs.h <<\EOF
1298 #ifdef HAVE_SYS_SOCKET_H
1299 #include <sys/socket.h>
1302 AC_CHECK_TYPE(socklen_t, int)
1304 # Add Python/ prefix to LIBOBJS
1307 for obj in $libobjs; do
1308 LIBOBJS="$LIBOBJS Python/$obj"
1311 #AC_MSG_CHECKING(for Modules/Setup)
1312 #if test ! -f Modules/Setup ; then
1313 # if test ! -d Modules ; then
1316 # cp "$srcdir/Modules/Setup.dist" Modules/Setup
1317 # AC_MSG_RESULT(creating)
1319 # AC_MSG_RESULT(already exists)
1323 SRCDIRS="Parser Grammar Objects Python Modules"
1324 AC_MSG_CHECKING(for build directories)
1325 for dir in $SRCDIRS; do
1326 if test ! -d $dir; then
1332 # generate output files
1333 AC_OUTPUT(Makefile.pre Modules/Setup.config)
1335 echo "creating Setup"
1336 if test ! -f Modules/Setup
1338 cp $srcdir/Modules/Setup.dist Modules/Setup
1341 echo "creating Setup.local"
1342 if test ! -f Modules/Setup.local
1344 echo "# Edit this file for local setup changes" >Modules/Setup.local
1347 echo "creating Makefile"
1348 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
1349 -s Modules Modules/Setup.config \
1350 Modules/Setup Modules/Setup.local