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(pyconfig.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"
16 AC_ARG_ENABLE(framework,
17 [ --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework],[
20 enableval=/Library/Frameworks
25 PYTHONFRAMEWORKDIR=no-framework
26 PYTHONFRAMEWORKPREFIX=
27 PYTHONFRAMEWORKINSTALLDIR=
31 PYTHONFRAMEWORK=Python
32 PYTHONFRAMEWORKDIR=Python.framework
33 PYTHONFRAMEWORKPREFIX=$enableval
34 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
35 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
39 PYTHONFRAMEWORKDIR=no-framework
40 PYTHONFRAMEWORKPREFIX=
41 PYTHONFRAMEWORKINSTALLDIR=
44 AC_SUBST(PYTHONFRAMEWORK)
45 AC_SUBST(PYTHONFRAMEWORKDIR)
46 AC_SUBST(PYTHONFRAMEWORKPREFIX)
47 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
50 ##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
52 # Set name for machine-dependent library files
54 AC_MSG_CHECKING(MACHDEP)
57 ac_sys_system=`uname -s`
58 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64"; then
59 ac_sys_release=`uname -v`
61 ac_sys_release=`uname -r`
63 ac_md_system=`echo $ac_sys_system |
64 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
65 ac_md_release=`echo $ac_sys_release |
66 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
67 MACHDEP="$ac_md_system$ac_md_release"
70 cygwin*) MACHDEP="cygwin";;
71 darwin*) MACHDEP="darwin";;
72 '') MACHDEP="unknown";;
77 # SGI compilers allow the specification of the both the ABI and the
78 # ISA on the command line. Depending on the values of these switches,
79 # different and often incompatable code will be generated.
81 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
82 # thus supply support for various ABI/ISA combinations. The MACHDEP
83 # variable is also adjusted.
86 if test ! -z "$SGI_ABI"
89 LDFLAGS="$SGI_ABI $LDFLAGS"
90 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
92 AC_MSG_RESULT($MACHDEP)
94 # checks for alternative programs
95 AC_MSG_CHECKING(for --without-gcc)
96 AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
103 without_gcc=$withval;;
105 case $ac_sys_system in
113 OPT="-O -D'DL_EXPORT(RTYPE)=__declspec(dllexport) RTYPE' -D'DL_IMPORT(RTYPE)=__declspec(dllexport) RTYPE' -export pragma"
114 CCSHARED="-UDL_IMPORT -D'DL_IMPORT(RTYPE)=__declspec(dllimport) RTYPE'"
115 LDFLAGS="$LDFLAGS -nodup"
123 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
126 AR="\$(srcdir)/Modules/ar_beos"
134 AC_MSG_RESULT($without_gcc)
139 AC_MSG_CHECKING(for --with-cxx=<compiler>)
140 AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
152 AC_MSG_RESULT($with_cxx)
154 if test "$with_cxx" = "yes"
156 AC_ERROR(must supply a compiler when using --with-cxx)
159 dnl The following fragment works similar to AC_PROG_CXX.
160 dnl It does not fail if CXX is not found, and it is not executed if
161 dnl --without-cxx was given.
162 dnl Finally, it does not test whether CXX is g++.
164 dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
165 ifdef([AC_PROG_CXX_WORKS],[],
166 [AC_DEFUN([AC_PROG_CXX_WORKS],
167 [AC_LANG_PUSH(C++)dnl
173 if test "$check_cxx" = "yes"
175 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
176 if test "$CXX" = "notfound"
184 # If the user switches compilers, we can't believe the cache
185 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
187 AC_ERROR(cached CC is different -- throw away $cache_file
188 (it is also a good idea to do 'make clean' before compiling))
193 # checks for UNIX variants that set C preprocessor variables
198 AC_MSG_CHECKING(for --with-suffix)
199 AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
205 AC_MSG_RESULT($EXEEXT)
207 # Test whether we're running on a non-case-sensitive system, in which
208 # case we give a warning if no ext is given
209 AC_SUBST(BUILDEXEEXT)
210 AC_MSG_CHECKING(for case-insensitive build directory)
223 gcc) CC="$CC -D_HAVE_BSDI";;
227 case $ac_sys_system in
230 cc|*/cc) CC="$CC -Ae";;
234 cc) CC="$CC -Wl,-Bexport";;
237 # Some functions have a prototype only with that define, e.g. confstr
238 AC_DEFINE(__EXTENSIONS__)
244 AC_MSG_CHECKING(LIBRARY)
245 if test -z "$LIBRARY"
247 LIBRARY='libpython$(VERSION).a'
249 AC_MSG_RESULT($LIBRARY)
251 # LDLIBRARY is the name of the library to link against (as opposed to the
252 # name of the library into which to insert object files). BLDLIBRARY is also
253 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
254 # is blank as the main program is not linked directly against LDLIBRARY.
255 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
256 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
257 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
258 # DLLLIBRARY is the shared (i.e., DLL) library.
263 AC_SUBST(LDLIBRARYDIR)
265 BLDLIBRARY='$(LDLIBRARY)'
269 # LINKCC is the command that links the python executable -- default is $(CC).
270 # If CXX is set, and if it is needed to link a main function that was
271 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
272 # python might then depend on the C++ runtime
273 # This is altered for AIX in order to build the export list before
276 AC_MSG_CHECKING(LINKCC)
279 if test -z "$CXX"; then
280 LINKCC="\$(PURIFY) \$(CC)"
282 echo 'int main(){return 0;}' > conftest.$ac_ext
283 $CXX -c conftest.$ac_ext 2>&5
284 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
285 && test -s conftest$ac_exeext && ./conftest$ac_exeext
287 LINKCC="\$(PURIFY) \$(CC)"
289 LINKCC="\$(PURIFY) \$(CXX)"
293 case $ac_sys_system in
295 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
297 LINKCC="LD_RUN_PATH=$libdir $(LINKCC)";;
299 LINKCC="$(LINKCC) -L/usr/lib/ia64l64";;
302 AC_MSG_RESULT($LINKCC)
304 AC_MSG_CHECKING(LDLIBRARY)
306 # DG/UX requires some fancy ld contortions to produce a .so from an .a
309 LDLIBRARY='libpython$(VERSION).so'
313 LDLIBRARY='libpython$(VERSION).so'
316 LDLIBRARY='libpython$(VERSION).dll.a'
317 DLLLIBRARY='libpython$(VERSION).dll'
321 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
322 # library that we build, but we do not want to link against it (we
323 # will find it with a -framework option). For this reason there is an
324 # extra variable BLDLIBRARY against which Python and the extension
325 # modules are linked, BLDLIBRARY. This is normally the same as
326 # LDLIBRARY, but empty for MacOSX framework builds.
327 if test "$enable_framework"
329 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
330 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
333 BLDLIBRARY='$(LDLIBRARY)'
336 AC_MSG_RESULT($LDLIBRARY)
340 AC_CHECK_PROGS(AR, ar aal, ar)
344 # install -d does not work on BSDI or HP-UX
345 if test -z "$INSTALL"
347 INSTALL="${srcdir}/install-sh -c"
352 # Not every filesystem supports hard links
354 if test -z "$LN" ; then
355 case $ac_sys_system in
357 CYGWIN*) LN="ln -s";;
362 # Check for --with-pydebug
363 AC_MSG_CHECKING(for --with-pydebug)
365 [ --with-pydebug build with Py_DEBUG defined], [
366 if test "$withval" != no
367 then AC_DEFINE(Py_DEBUG) AC_MSG_RESULT(yes); Py_DEBUG='true'
368 else AC_MSG_RESULT(no); Py_DEBUG='false'
372 # Optimizer/debugger flags
378 case $ac_cv_prog_cc_g in
380 if test "$Py_DEBUG" = 'true' ; then
381 # Optimization messes up debuggers, so turn it off for
383 OPT="-g -Wall -Wstrict-prototypes"
385 OPT="-g -O3 -Wall -Wstrict-prototypes"
388 OPT="-O3 -Wall -Wstrict-prototypes";;
392 case $ac_sys_system in
394 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
399 case $ac_sys_system in
401 OPT="$OPT -no-cpp-precomp";;
405 if test "$Py_DEBUG" = 'true'; then
411 # The current (beta) Monterey compiler dies with optimizations
412 case $ac_sys_system in
416 if test "$ac_arch_flags"
418 OPT="$OPT $ac_arch_flags"
421 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
422 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
424 CC="$CC -OPT:Olimit=0"
425 AC_TRY_RUN([int main() { return 0; }],
426 ac_cv_opt_olimit_ok=yes,
427 ac_cv_opt_olimit_ok=no,
428 ac_cv_opt_olimit_ok=no)
430 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
431 if test $ac_cv_opt_olimit_ok = yes; then
432 case $ac_sys_system in
433 Darwin*) OPT="$OPT" ;;
434 *) OPT="$OPT -OPT:Olimit=0";;
437 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
438 AC_CACHE_VAL(ac_cv_olimit_ok,
440 CC="$CC -Olimit 1500"
441 AC_TRY_RUN([int main() { return 0; }],
446 AC_MSG_RESULT($ac_cv_olimit_ok)
447 if test $ac_cv_olimit_ok = yes; then
448 OPT="$OPT -Olimit 1500"
452 # On some compilers, pthreads are available without further options
453 # (e.g. MacOS X). On some of these systems, the compiler will not
454 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
455 # So we have to see first whether pthreads are available without
456 # options before we can check whether -Kpthread improves anything.
457 AC_MSG_CHECKING(whether pthreads are available without options)
458 AC_CACHE_VAL(ac_cv_pthread_is_default,
462 void* routine(void* p){return NULL;}
466 if(pthread_create(&p,NULL,routine,NULL)!=0)
468 (void)pthread_detach(p);
472 ac_cv_pthread_is_default=yes,
473 ac_cv_pthread_is_default=no,
474 ac_cv_pthread_is_default=no)
476 AC_MSG_RESULT($ac_cv_pthread_is_default)
479 if test $ac_cv_pthread_is_default = yes
483 # -Kpthread, if available, provides the right #defines
484 # and linker options to make pthread_create available
485 # Some compilers won't report that they do not support -Kpthread,
486 # so we need to run a program to see whether it really made the
487 # function available.
488 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
489 AC_CACHE_VAL(ac_cv_kpthread,
495 void* routine(void* p){return NULL;}
499 if(pthread_create(&p,NULL,routine,NULL)!=0)
501 (void)pthread_detach(p);
509 AC_MSG_RESULT($ac_cv_kpthread)
512 dnl # check for ANSI or K&R ("traditional") preprocessor
513 dnl AC_MSG_CHECKING(for C preprocessor type)
515 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
517 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
518 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
519 dnl AC_MSG_RESULT($cpp_type)
521 # checks for header files
523 AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h locale.h \
524 ncurses.h poll.h pthread.h \
525 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
526 sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \
527 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
528 sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
529 ndbm.h db1/ndbm.h gdbm/ndbm.h sys/resource.h netpacket/packet.h)
532 # checks for typedefs
534 AC_MSG_CHECKING(for clock_t in time.h)
535 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, AC_DEFINE(clock_t, long))
536 AC_MSG_RESULT($was_it_defined)
538 # Two defines needed to enable largefile support on various platforms
539 # These may affect some typedefs
540 AC_DEFINE(_LARGEFILE_SOURCE)
541 AC_DEFINE(_FILE_OFFSET_BITS, 64)
543 # Add some code to confdefs.h so that the test for off_t works on SCO
544 cat >> confdefs.h <<\EOF
550 # Type availability checks
558 # Sizes of various common basic types
559 AC_CHECK_SIZEOF(int, 4)
560 AC_CHECK_SIZEOF(long, 4)
561 AC_CHECK_SIZEOF(void *, 4)
562 AC_CHECK_SIZEOF(char, 1)
563 AC_CHECK_SIZEOF(short, 2)
564 AC_CHECK_SIZEOF(float, 4)
565 AC_CHECK_SIZEOF(double, 8)
566 AC_CHECK_SIZEOF(fpos_t, 4)
568 AC_MSG_CHECKING(for long long support)
570 AC_TRY_COMPILE([], [long long x; x = (long long)0;], AC_DEFINE(HAVE_LONG_LONG) have_long_long=yes)
571 AC_MSG_RESULT($have_long_long)
572 if test "$have_long_long" = yes ; then
573 AC_CHECK_SIZEOF(long long, 8)
576 AC_MSG_CHECKING(for uintptr_t support)
578 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], AC_DEFINE(HAVE_UINTPTR_T) have_uintptr_t=yes)
579 AC_MSG_RESULT($have_uintptr_t)
580 if test "$have_uintptr_t" = yes ; then
581 AC_CHECK_SIZEOF(uintptr_t, 4)
584 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
585 AC_MSG_CHECKING(size of off_t)
586 AC_CACHE_VAL(ac_cv_sizeof_off_t,
587 [AC_TRY_RUN([#include <stdio.h>
588 #include <sys/types.h>
591 FILE *f=fopen("conftestval", "w");
593 fprintf(f, "%d\n", sizeof(off_t));
596 ac_cv_sizeof_off_t=`cat conftestval`,
597 ac_cv_sizeof_off_t=0,
598 ac_cv_sizeof_off_t=4)
600 AC_MSG_RESULT($ac_cv_sizeof_off_t)
601 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
603 AC_MSG_CHECKING(whether to enable large file support)
604 if test "$have_long_long" = yes -a \
605 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
606 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
607 AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
613 # AC_CHECK_SIZEOF() doesn't include <time.h>.
614 AC_MSG_CHECKING(size of time_t)
615 AC_CACHE_VAL(ac_cv_sizeof_time_t,
616 [AC_TRY_RUN([#include <stdio.h>
620 FILE *f=fopen("conftestval", "w");
622 fprintf(f, "%d\n", sizeof(time_t));
625 ac_cv_sizeof_time_t=`cat conftestval`,
626 ac_cv_sizeof_time_t=0,
627 ac_cv_sizeof_time_t=4)
629 AC_MSG_RESULT($ac_cv_sizeof_time_t)
630 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t)
633 # if have pthread_t then define SIZEOF_PTHREAD_T
635 if test "$ac_cv_kpthread" = "yes"
636 then CC="$CC -Kpthread"
638 AC_MSG_CHECKING(for pthread_t)
640 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
641 AC_MSG_RESULT($have_pthread_t)
642 if test "$have_pthread_t" = yes ; then
643 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
644 AC_MSG_CHECKING(size of pthread_t)
645 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
646 [AC_TRY_RUN([#include <stdio.h>
650 FILE *f=fopen("conftestval", "w");
652 fprintf(f, "%d\n", sizeof(pthread_t));
655 ac_cv_sizeof_pthread_t=`cat conftestval`,
656 ac_cv_sizeof_pthread_t=0,
657 ac_cv_sizeof_pthread_t=4)
659 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
660 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t)
664 AC_MSG_CHECKING(for --enable-toolbox-glue)
665 AC_ARG_ENABLE(toolbox-glue,
666 [ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
668 if test -z "$enable_toolbox_glue"
670 case $ac_sys_system/$ac_sys_release in
672 enable_toolbox_glue="yes";;
674 enable_toolbox_glue="no";;
677 case "$enable_toolbox_glue" in
679 extra_frameworks="-framework CoreServices -framework Foundation"
680 extra_machdep_objs="Python/mactoolboxglue.o"
681 extra_undefs="-u __dummy -u _PyMac_Error"
682 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE)
686 extra_machdep_objs=""
690 AC_MSG_RESULT($enable_toolbox_glue)
692 AC_SUBST(LIBTOOL_CRUFT)
693 case $ac_sys_system/$ac_sys_release in
695 ns_undef_sym='_environ'
696 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -U $ns_undef_sym"
697 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
698 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
699 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
701 ns_undef_sym='_environ'
702 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc -flat_namespace -U $ns_undef_sym"
703 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
704 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
705 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
708 AC_MSG_CHECKING(for --enable-framework)
709 if test "$enable_framework"
711 OPT="$OPT -fno-common -dynamic"
712 # -U __environ is needed since bundles don't have access
713 # to crt0 when built but will always be linked against it
714 # -F. is needed to allow linking to the framework while
715 # in the build location.
717 case $ac_sys_system/$ac_sys_release in
718 Darwin/1.3*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-U,$ns_undef_sym";;
719 Darwin/*)LDFLAGS="$LDFLAGS -Wl,-F. -Wl,-flat_namespace,-U,$ns_undef_sym";;
721 AC_DEFINE(WITH_NEXT_FRAMEWORK)
727 AC_MSG_CHECKING(for dyld)
728 case $ac_sys_system/$ac_sys_release in
731 AC_MSG_RESULT(always on for Darwin)
738 # Set info about shared libraries.
743 AC_SUBST(LINKFORSHARED)
744 # SO is the extension of shared libraries `(including the dot!)
745 # -- usually .so, .sl on HP-UX, .dll on Cygwin
749 case $ac_sys_system in
756 # LDSHARED is the ld *command* used to create shared library
757 # -- "ld" on SunOS 4.x.x, "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
758 # (Shared libraries in this instance are shared modules to be loaded into
759 # Python, as opposed to building Python itself as a shared library.)
760 AC_MSG_CHECKING(LDSHARED)
761 if test -z "$LDSHARED"
763 case $ac_sys_system/$ac_sys_release in
765 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
766 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
769 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
770 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
772 IRIX/5*) LDSHARED="ld -shared";;
773 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
774 SunOS/4*) LDSHARED="ld";;
776 if test "$GCC" = "yes"
777 then LDSHARED='$(CC) -shared'
778 else LDSHARED="$(CC) -G";
780 hp*|HP*) LDSHARED="ld -b";;
781 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
782 DYNIX/ptx*) LDSHARED="ld -G";;
784 LDSHARED='$(CC) $(LDFLAGS) -bundle'
785 if test "$enable_framework" ; then
786 # Link against the framework. All externals should be defined.
787 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
789 # No framework. Ignore undefined symbols, assuming they come from Python
790 LDSHARED="$LDSHARED -undefined suppress"
793 LDSHARED='$(CC) $(LDFLAGS) -bundle'
794 if test "$enable_framework" ; then
795 # Link against the framework. All externals should be defined.
796 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
798 # No framework, use the Python app as bundle-loader
799 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
800 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
802 Linux*) LDSHARED="gcc -shared";;
803 dgux*) LDSHARED="ld -G";;
804 BSD/OS*/4*) LDSHARED="gcc -shared";;
805 OpenBSD*|NetBSD*|FreeBSD*)
806 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
808 LDSHARED="cc -shared ${LDFLAGS}"
810 LDSHARED="ld -Bshareable ${LDFLAGS}"
813 if test "$GCC" = "yes"
814 then LDSHARED="$(CC) -shared"
815 else LDSHARED="$(CC) -G"
817 SCO_SV*) LDSHARED="cc -G -KPIC -Ki486 -belf -Wl,-Bexport";;
818 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
819 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
823 AC_MSG_RESULT($LDSHARED)
824 BLDSHARED=${BLDSHARED-$LDSHARED}
825 # CCSHARED are the C *flags* used to create objects to go into a shared
826 # library (module) -- this is only needed for a few systems
827 AC_MSG_CHECKING(CCSHARED)
828 if test -z "$CCSHARED"
830 case $ac_sys_system/$ac_sys_release in
831 SunOS*) if test "$GCC" = yes;
832 then CCSHARED="-fPIC";
834 hp*|HP*) if test "$GCC" = yes;
835 then CCSHARED="-fPIC";
838 Linux*) CCSHARED="-fPIC";;
839 BSD/OS*/4*) CCSHARED="-fpic";;
840 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
842 if test "$GCC" = "yes"
843 then CCSHARED="-fPIC"
844 else CCSHARED="-KPIC"
846 SCO_SV*) CCSHARED="-KPIC -dy -Bdynamic";;
847 Monterey*) CCSHARED="-G";;
848 IRIX*/6*) case $CC in
849 *gcc*) CCSHARED="-shared";;
852 CYGWIN*) CCSHARED="-DUSE_DL_IMPORT";;
855 AC_MSG_RESULT($CCSHARED)
856 # LINKFORSHARED are the flags passed to the $(CC) command that links
857 # the python executable -- this is only needed for a few systems
858 AC_MSG_CHECKING(LINKFORSHARED)
859 if test -z "$LINKFORSHARED"
861 case $ac_sys_system/$ac_sys_release in
862 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
864 LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
865 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
866 Linux*) LINKFORSHARED="-Xlinker -export-dynamic";;
867 # -u libsys_s pulls in all symbols in libsys
869 # -u __dummy makes the linker aware of the objc runtime
870 # in System.framework; otherwise, __objcInit (referenced in
871 # crt1.o) gets erroneously defined as common, which breaks dynamic
872 # loading of any modules which reference it in System.framework.
873 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
874 # not used by the core itself but which needs to be in the core so
875 # that dynamically loaded extension modules have access to it.
876 LINKFORSHARED="$extra_undefs -framework System"
877 if test "$enable_framework"
879 LINKFORSHARED="$LINKFORSHARED -framework Python"
881 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
882 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
883 SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
884 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
885 FreeBSD*|NetBSD*|OpenBSD*)
886 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
888 LINKFORSHARED="-Wl,--export-dynamic"
890 SunOS/5*) case $CC in
892 if $CC -Xlinker -V 2>&1 | grep BFD >/dev/null
894 LINKFORSHARED="-Xlinker --export-dynamic"
899 AC_MSG_RESULT($LINKFORSHARED)
901 AC_SUBST(CFLAGSFORSHARED)
902 AC_MSG_CHECKING(CFLAGSFORSHARED)
903 if test ! "$LIBRARY" = "$LDLIBRARY"
905 case $ac_sys_system in
907 # Cygwin needs CCSHARED when building extension DLLs
908 # but not when building the interpreter DLL.
911 CFLAGSFORSHARED='$(CCSHARED)'
914 AC_MSG_RESULT($CFLAGSFORSHARED)
916 # checks for libraries
917 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
918 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
920 # checks for system dependent C++ extensions support
921 case "$ac_sys_system" in
922 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
923 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
924 [loadAndInit("", 0, "")],
925 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS)
927 [AC_MSG_RESULT(no)]);;
931 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
932 # However on SGI IRIX, these exist but are broken.
933 # BeOS' sockets are stashed in libnet.
934 case "$ac_sys_system" in
937 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
938 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
941 case "$ac_sys_system" in
943 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
947 AC_MSG_CHECKING(for --with-libs)
949 [ --with-libs='lib1 ...' link against additional libs], [
950 AC_MSG_RESULT($withval)
951 LIBS="$withval $LIBS"
952 ], AC_MSG_RESULT(no))
954 # Determine if signalmodule should be used.
955 AC_SUBST(USE_SIGNAL_MODULE)
956 AC_SUBST(SIGNAL_OBJS)
957 AC_MSG_CHECKING(for --with-signal-module)
958 AC_ARG_WITH(signal-module,
959 [ --with-signal-module disable/enable signal module])
961 if test -z "$with_signal_module"
962 then with_signal_module="yes"
964 AC_MSG_RESULT($with_signal_module)
966 if test "${with_signal_module}" = "yes"; then
970 USE_SIGNAL_MODULE="#"
971 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
974 # This is used to generate Setup.config
975 AC_SUBST(USE_THREAD_MODULE)
978 AC_MSG_CHECKING(for --with-dec-threads)
980 AC_ARG_WITH(dec-threads,
981 [ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
982 AC_MSG_RESULT($withval)
984 if test "${with_thread+set}" != set; then
985 with_thread="$withval";
989 AC_MSG_CHECKING(for --with-threads)
991 [ --with(out)-threads[=DIRECTORY] disable/enable thread support])
993 # --with-thread is deprecated, but check for it anyway
995 [ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
996 with_threads=$with_thread])
998 if test -z "$with_threads"
999 then with_threads="yes"
1001 AC_MSG_RESULT($with_threads)
1003 if test "$with_threads" = "no"
1005 USE_THREAD_MODULE="#"
1006 elif test "$ac_cv_pthread_is_default" = yes
1008 AC_DEFINE(WITH_THREAD)
1009 # Defining _REENTRANT on system with POSIX threads should not hurt.
1010 AC_DEFINE(_REENTRANT)
1012 LIBOBJS="$LIBOBJS thread.o"
1013 elif test "$ac_cv_kpthread" = "yes"
1016 AC_DEFINE(WITH_THREAD)
1018 LIBOBJS="$LIBOBJS thread.o"
1020 if test ! -z "$with_threads" -a -d "$with_threads"
1021 then LDFLAGS="$LDFLAGS -L$with_threads"
1023 if test ! -z "$withval" -a -d "$withval"
1024 then LDFLAGS="$LDFLAGS -L$withval"
1027 # According to the POSIX spec, a pthreads implementation must
1028 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1029 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1031 [#include <unistd.h>
1032 #ifdef _POSIX_THREADS
1035 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1036 AC_MSG_RESULT($unistd_defines_pthreads)
1038 AC_DEFINE(_REENTRANT)
1039 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1040 AC_DEFINE(C_THREADS)
1041 LIBOBJS="$LIBOBJS thread.o"],[
1042 AC_MSG_CHECKING(for --with-pth)
1044 [ --with-pth use GNU pth threading libraries], [
1045 AC_MSG_RESULT($withval)
1046 AC_DEFINE(WITH_THREAD)
1049 LIBOBJS="$LIBOBJS thread.o"],[
1052 # Just looking for pthread_create in libpthread is not enough:
1053 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1054 # So we really have to include pthread.h, and then link.
1056 LIBS="$LIBS -lpthread"
1057 AC_MSG_CHECKING([for pthread_create in -lpthread])
1058 AC_TRY_LINK([#include <pthread.h>
1060 void * start_routine (void *arg) { exit (0); }], [
1061 pthread_create (NULL, NULL, start_routine, NULL)], [
1063 AC_DEFINE(WITH_THREAD)
1065 LIBOBJS="$LIBOBJS thread.o"],[
1067 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1069 LIBOBJS="$LIBOBJS thread.o"],[
1070 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1071 AC_DEFINE(BEOS_THREADS)
1072 LIBOBJS="$LIBOBJS thread.o"],[
1073 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1075 LIBS="$LIBS -lpthreads"
1076 LIBOBJS="$LIBOBJS thread.o"], [
1077 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1080 LIBOBJS="$LIBOBJS thread.o"], [
1081 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1083 LIBS="$LIBS -lthread"
1084 LIBOBJS="$LIBOBJS thread.o"], [
1085 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1087 LIBS="$LIBS -lpthread"
1088 LIBOBJS="$LIBOBJS thread.o"], [
1089 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1092 LIBOBJS="$LIBOBJS thread.o"],[
1093 USE_THREAD_MODULE="#"])
1096 if test "$posix_threads" = "yes"; then
1097 if test "$unistd_defines_pthreads" = "no"; then
1098 AC_DEFINE(_POSIX_THREADS)
1101 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1102 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1103 [AC_TRY_RUN([#include <pthread.h>
1104 void *foo(void *parm) {
1108 pthread_attr_t attr;
1110 if (pthread_attr_init(&attr)) exit(-1);
1111 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1112 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1115 ac_cv_pthread_system_supported=yes,
1116 ac_cv_pthread_system_supported=no,
1117 ac_cv_pthread_system_supported=no)
1119 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1120 if test "$ac_cv_pthread_system_supported" = "yes"; then
1121 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED)
1123 AC_CHECK_FUNCS(pthread_sigmask)
1126 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1128 LIBOBJS="$LIBOBJS thread.o"
1129 USE_THREAD_MODULE=""])
1130 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1131 LIBS="$LIBS -lthread"
1132 LIBOBJS="$LIBOBJS thread.o"
1133 USE_THREAD_MODULE=""])
1135 if test "$USE_THREAD_MODULE" != "#"
1137 # If the above checks didn't disable threads, (at least) OSF1
1138 # needs this '-threads' argument during linking.
1139 case $ac_sys_system in
1140 OSF1) LDLAST=-threads;;
1145 # Check for enable-ipv6
1146 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1148 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1149 --disable-ipv6 Disable ipv6 support],
1150 [ case "$enableval" in
1155 *) AC_MSG_RESULT(yes)
1156 AC_DEFINE(ENABLE_IPV6)
1162 dnl the check does not work on cross compilation case...
1163 AC_TRY_RUN([ /* AF_INET6 available check */
1164 #include <sys/types.h>
1165 #include <sys/socket.h>
1168 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1182 if test "$ipv6" = "yes"; then
1183 AC_MSG_CHECKING(if RFC2553 API is available)
1184 AC_TRY_COMPILE([#include <sys/types.h>
1185 #include <netinet/in.h>],
1186 [struct sockaddr_in6 x;
1190 AC_MSG_RESULT(no, IPv6 disabled)
1194 if test "$ipv6" = "yes"; then
1195 AC_DEFINE(ENABLE_IPV6)
1203 if test "$ipv6" = "yes"; then
1204 AC_MSG_CHECKING([ipv6 stack type])
1205 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1209 dnl http://www.kame.net/
1211 #include <netinet/in.h>
1212 #ifdef IPV6_INRIA_VERSION
1218 dnl http://www.kame.net/
1220 #include <netinet/in.h>
1226 ipv6libdir=/usr/local/v6/lib
1230 dnl http://www.v6.linux.or.jp/
1232 #include <features.h>
1233 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1240 dnl http://www.v6.linux.or.jp/
1241 if test -d /usr/inet6; then
1244 ipv6libdir=/usr/inet6/lib
1245 OPT="-I/usr/inet6/include $OPT"
1249 if test -f /etc/netconfig; then
1250 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1258 #include <sys/param.h>
1259 #ifdef _TOSHIBA_INET6
1264 ipv6libdir=/usr/local/v6/lib])
1268 #include </usr/local/v6/include/sys/v6config.h>
1274 ipv6libdir=/usr/local/v6/lib;
1275 OPT="-I/usr/local/v6/include $OPT"])
1279 #include <sys/param.h>
1280 #ifdef _ZETA_MINAMI_INET6
1285 ipv6libdir=/usr/local/v6/lib])
1288 if test "$ipv6type" != "unknown"; then
1292 AC_MSG_RESULT($ipv6type)
1295 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1296 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1297 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1298 echo "using lib$ipv6lib"
1300 if test $ipv6trylibc = "yes"; then
1303 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1304 echo "You need to fetch lib$ipv6lib.a from appropriate"
1305 echo 'ipv6 kit and compile beforehand.'
1311 # Check for GC support
1312 AC_MSG_CHECKING(for --with-cycle-gc)
1313 AC_ARG_WITH(cycle-gc,
1314 [ --with(out)-cycle-gc disable/enable garbage collection])
1316 if test -z "$with_cycle_gc"
1317 then with_cycle_gc="yes"
1319 if test "$with_cycle_gc" != "no"
1321 AC_DEFINE(WITH_CYCLE_GC)
1323 AC_MSG_RESULT($with_cycle_gc)
1325 # Check for Python-specific malloc support
1326 AC_MSG_CHECKING(for --with-pymalloc)
1327 AC_ARG_WITH(pymalloc,
1328 [ --with(out)-pymalloc disable/enable specialized mallocs], [
1329 if test "$withval" != no
1330 then AC_DEFINE(WITH_PYMALLOC) AC_MSG_RESULT(yes)
1331 else AC_MSG_RESULT(no)
1333 [AC_MSG_RESULT(no)])
1335 # Check for --with-wctype-functions
1336 AC_MSG_CHECKING(for --with-wctype-functions)
1337 AC_ARG_WITH(wctype-functions,
1338 [ --with-wctype-functions use wctype.h functions], [
1339 if test "$withval" != no
1340 then AC_DEFINE(WANT_WCTYPE_FUNCTIONS) AC_MSG_RESULT(yes)
1341 else AC_MSG_RESULT(no)
1343 [AC_MSG_RESULT(no)])
1345 # -I${DLINCLDIR} is added to the compile rule for importdl.o
1349 AC_MSG_CHECKING(for --with-sgi-dl)
1351 [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
1352 AC_MSG_RESULT($withval)
1353 AC_DEFINE(WITH_SGI_DL)
1354 DYNLOADFILE="dynload_dl.o"
1356 if test ! -z "$dldir" -a -d "$dldir"
1357 then LDFLAGS="$LDFLAGS -L$dldir"
1358 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1361 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
1363 AC_MSG_CHECKING(for --with-dl-dld)
1364 AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
1365 AC_MSG_RESULT($withval)
1366 AC_DEFINE(WITH_DL_DLD)
1367 DYNLOADFILE="dynload_dl.o"
1368 dldir=`echo "$withval" | sed 's/,.*//'`
1369 dlddir=`echo "$withval" | sed 's/.*,//'`
1370 if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
1371 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
1372 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1375 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
1377 # the dlopen() function means we might want to use dynload_shlib.o. some
1378 # platforms, such as AIX, have dlopen(), but don't want to use it.
1379 AC_CHECK_FUNCS(dlopen)
1381 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1382 # loading of modules.
1383 AC_SUBST(DYNLOADFILE)
1384 AC_MSG_CHECKING(DYNLOADFILE)
1385 if test -z "$DYNLOADFILE"
1387 case $ac_sys_system/$ac_sys_release in
1388 AIX*) DYNLOADFILE="dynload_aix.o";;
1389 BeOS*) DYNLOADFILE="dynload_beos.o";;
1390 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
1391 Darwin/*) DYNLOADFILE="dynload_next.o";;
1393 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1394 # out any dynamic loading
1395 if test "$ac_cv_func_dlopen" = yes
1396 then DYNLOADFILE="dynload_shlib.o"
1397 else DYNLOADFILE="dynload_stub.o"
1402 AC_MSG_RESULT($DYNLOADFILE)
1403 if test "$DYNLOADFILE" != "dynload_stub.o"
1405 AC_DEFINE(HAVE_DYNAMIC_LOADING)
1408 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
1410 AC_SUBST(MACHDEP_OBJS)
1411 AC_MSG_CHECKING(MACHDEP_OBJS)
1412 if test -z "$MACHDEP_OBJS"
1414 MACHDEP_OBJS=$extra_machdep_objs
1416 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
1418 AC_MSG_RESULT(MACHDEP_OBJS)
1420 # checks for library functions
1421 AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
1422 flock fork fsync fdatasync fpathconf ftime ftruncate \
1423 gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
1424 hstrerror inet_pton kill link lstat mkfifo mktime mremap \
1425 nice pathconf pause plock poll pthread_init \
1427 select setegid seteuid setgid setgroups \
1428 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
1429 sigaction siginterrupt sigrelse strftime strptime symlink sysconf \
1430 tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
1431 truncate uname unsetenv waitpid _getpty getpriority)
1433 # check for openpty and forkpty
1435 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
1436 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY)] [LIBS="$LIBS -lutil"]))
1438 # check for long file support functions
1439 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1441 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
1442 AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_DEFINE(GETPGRP_HAVE_ARG)))
1443 AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
1444 AC_CHECK_FUNCS(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
1447 # On OSF/1 V5.1, getaddrinfo is available, but a define
1448 # for [no]getaddrinfo in netdb.h.
1449 AC_MSG_CHECKING(for getaddrinfo)
1451 #include <sys/types.h>
1452 #include <sys/socket.h>
1456 getaddrinfo(NULL, NULL, NULL, NULL);
1459 AC_MSG_CHECKING(getaddrinfo bug)
1461 #include <sys/types.h>
1464 #include <sys/socket.h>
1465 #include <netinet/in.h>
1469 int passive, gaierr, inet4 = 0, inet6 = 0;
1470 struct addrinfo hints, *ai, *aitop;
1471 char straddr[INET6_ADDRSTRLEN], strport[16];
1473 for (passive = 0; passive <= 1; passive++) {
1474 memset(&hints, 0, sizeof(hints));
1475 hints.ai_family = AF_UNSPEC;
1476 hints.ai_flags = passive ? AI_PASSIVE : 0;
1477 hints.ai_socktype = SOCK_STREAM;
1478 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1479 (void)gai_strerror(gaierr);
1482 for (ai = aitop; ai; ai = ai->ai_next) {
1483 if (ai->ai_addr == NULL ||
1484 ai->ai_addrlen == 0 ||
1485 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1486 straddr, sizeof(straddr), strport, sizeof(strport),
1487 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1490 switch (ai->ai_family) {
1492 if (strcmp(strport, "54321") != 0) {
1496 if (strcmp(straddr, "0.0.0.0") != 0) {
1500 if (strcmp(straddr, "127.0.0.1") != 0) {
1507 if (strcmp(strport, "54321") != 0) {
1511 if (strcmp(straddr, "::") != 0) {
1515 if (strcmp(straddr, "::1") != 0) {
1525 /* another family support? */
1531 if (!(inet4 == 0 || inet4 == 2))
1533 if (!(inet6 == 0 || inet6 == 2))
1537 freeaddrinfo(aitop);
1542 freeaddrinfo(aitop);
1547 buggygetaddrinfo=no,
1548 AC_MSG_RESULT(buggy)
1549 buggygetaddrinfo=yes,
1550 AC_MSG_RESULT(buggy)
1551 buggygetaddrinfo=yes)], [
1553 buggygetaddrinfo=yes
1556 if test "$buggygetaddrinfo" = "yes"; then
1557 if test "$ipv6" = "yes"; then
1558 echo 'Fatal: You must get working getaddrinfo() function.'
1559 echo ' or you can specify "--disable-ipv6"'.
1563 AC_DEFINE(HAVE_GETADDRINFO)
1565 AC_CHECK_FUNCS(getnameinfo)
1567 # checks for structures
1572 AC_STRUCT_ST_BLKSIZE
1575 AC_MSG_CHECKING(for time.h that defines altzone)
1576 AC_CACHE_VAL(ac_cv_header_time_altzone,
1577 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1578 ac_cv_header_time_altzone=yes,
1579 ac_cv_header_time_altzone=no)])
1580 AC_MSG_RESULT($ac_cv_header_time_altzone)
1581 if test $ac_cv_header_time_altzone = yes; then
1582 AC_DEFINE(HAVE_ALTZONE)
1586 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
1588 #include <sys/types.h>
1589 #include <sys/select.h>
1590 #include <sys/time.h>
1591 ], [;], [AC_DEFINE(SYS_SELECT_WITH_SYS_TIME) was_it_defined=yes])
1592 AC_MSG_RESULT($was_it_defined)
1594 AC_MSG_CHECKING(for addrinfo)
1595 AC_CACHE_VAL(ac_cv_struct_addrinfo,
1597 # include <netdb.h>],
1598 [struct addrinfo a],
1599 ac_cv_struct_addrinfo=yes,
1600 ac_cv_struct_addrinfo=no))
1601 AC_MSG_RESULT($ac_cv_struct_addrinfo)
1602 if test $ac_cv_struct_addrinfo = yes; then
1603 AC_DEFINE(HAVE_ADDRINFO)
1606 AC_MSG_CHECKING(for sockaddr_storage)
1607 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1609 # include <sys/types.h>
1610 # include <sys/socket.h>],
1611 [struct sockaddr_storage s],
1612 ac_cv_struct_sockaddr_storage=yes,
1613 ac_cv_struct_sockaddr_storage=no))
1614 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1615 if test $ac_cv_struct_sockaddr_storage = yes; then
1616 AC_DEFINE(HAVE_SOCKADDR_STORAGE)
1619 # checks for compiler characteristics
1625 AC_MSG_CHECKING(for working volatile)
1626 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, AC_DEFINE(volatile, []))
1627 AC_MSG_RESULT($works)
1630 AC_MSG_CHECKING(for working signed char)
1631 AC_TRY_COMPILE([], [signed char c;], works=yes, AC_DEFINE(signed, []))
1632 AC_MSG_RESULT($works)
1635 AC_MSG_CHECKING(for prototypes)
1636 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
1637 AC_DEFINE(HAVE_PROTOTYPES) have_prototypes=yes)
1638 AC_MSG_RESULT($have_prototypes)
1641 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
1644 int foo(int x, ...) {
1652 ], [return foo(10, "", 3.14);],
1653 AC_DEFINE(HAVE_STDARG_PROTOTYPES) works=yes)
1654 AC_MSG_RESULT($works)
1656 if test "$have_prototypes" = yes; then
1658 AC_MSG_CHECKING(for bad exec* prototypes)
1659 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1660 AC_DEFINE(BAD_EXEC_PROTOTYPES) bad_prototypes=yes)
1661 AC_MSG_RESULT($bad_prototypes)
1664 # check if sockaddr has sa_len member
1665 AC_MSG_CHECKING(if sockaddr has sa_len member)
1666 AC_TRY_COMPILE([#include <sys/types.h>
1667 #include <sys/socket.h>],
1671 AC_DEFINE(HAVE_SOCKADDR_SA_LEN),
1674 AC_MSG_CHECKING(for bad static forward)
1675 AC_CACHE_VAL(ac_cv_bad_static_forward,
1677 struct s { int a; int b; };
1678 static struct s foo;
1681 random = (int) &foo;
1684 static struct s foo = { 1, 2 };
1686 exit(!((int)&foo == foobar()));
1688 ac_cv_bad_static_forward=no,
1689 ac_cv_bad_static_forward=yes,
1690 ac_cv_bad_static_forward=no)])
1691 AC_MSG_RESULT($ac_cv_bad_static_forward)
1692 if test "$ac_cv_bad_static_forward" = yes
1694 AC_DEFINE(BAD_STATIC_FORWARD)
1698 AC_MSG_CHECKING(whether va_list is an array)
1700 #ifdef HAVE_STDARG_PROTOTYPES
1703 #include <varargs.h>
1705 ], [va_list list1, list2; list1 = list2;], ,
1706 AC_DEFINE(VA_LIST_IS_ARRAY) va_list_is_array=yes)
1707 AC_MSG_RESULT($va_list_is_array)
1709 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1710 AC_CHECK_FUNC(gethostbyname_r, [
1711 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1712 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1714 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1719 struct hostent *he, *res;
1724 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
1726 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1727 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG)
1731 AC_MSG_CHECKING([gethostbyname_r with 5 args])
1741 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
1743 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1744 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG)
1748 AC_MSG_CHECKING([gethostbyname_r with 3 args])
1754 struct hostent_data data;
1756 (void) gethostbyname_r(name, he, &data);
1758 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1759 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG)
1768 AC_CHECK_FUNCS(gethostbyname)
1770 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
1771 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
1772 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
1773 AC_SUBST(HAVE_GETHOSTBYNAME_R)
1774 AC_SUBST(HAVE_GETHOSTBYNAME)
1776 # checks for system services
1779 # Linux requires this for correct f.p. operations
1780 AC_CHECK_FUNC(__fpu_control,
1782 [AC_CHECK_LIB(ieee, __fpu_control)
1785 # Check for --with-fpectl
1786 AC_MSG_CHECKING(for --with-fpectl)
1788 [ --with-fpectl enable SIGFPE catching], [
1789 if test "$withval" != no
1790 then AC_DEFINE(WANT_SIGFPE_HANDLER) AC_MSG_RESULT(yes)
1791 else AC_MSG_RESULT(no)
1793 [AC_MSG_RESULT(no)])
1795 # check for --with-libm=...
1797 case $ac_sys_system in
1802 AC_MSG_CHECKING(for --with-libm=STRING)
1803 AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
1804 if test "$withval" = no
1806 AC_MSG_RESULT(force LIBM empty)
1807 elif test "$withval" != yes
1809 AC_MSG_RESULT(set LIBM=\"$withval\")
1810 else AC_ERROR(proper usage is --with-libm=STRING)
1812 [AC_MSG_RESULT(default LIBM=\"$LIBM\")])
1814 # check for --with-libc=...
1816 AC_MSG_CHECKING(for --with-libc=STRING)
1817 AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
1818 if test "$withval" = no
1820 AC_MSG_RESULT(force LIBC empty)
1821 elif test "$withval" != yes
1823 AC_MSG_RESULT(set LIBC=\"$withval\")
1824 else AC_ERROR(proper usage is --with-libc=STRING)
1826 [AC_MSG_RESULT(default LIBC=\"$LIBC\")])
1828 # check for hypot() in math library
1831 AC_REPLACE_FUNCS(hypot)
1834 # check whether malloc(0) returns NULL or not
1835 AC_MSG_CHECKING(what malloc(0) returns)
1836 AC_CACHE_VAL(ac_cv_malloc_zero,
1837 [AC_TRY_RUN([#include <stdio.h>
1841 char *malloc(), *realloc();
1847 if (p == NULL) exit(1);
1849 if (p == NULL) exit(1);
1853 ac_cv_malloc_zero=nonnull,
1854 ac_cv_malloc_zero=null,
1855 ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
1856 AC_MSG_RESULT($ac_cv_malloc_zero)
1857 if test "$ac_cv_malloc_zero" = null
1859 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL)
1863 AC_CHECK_HEADER(wchar.h,
1864 AC_DEFINE(HAVE_WCHAR_H) wchar_h="yes",
1868 # determine wchar_t size
1869 if test "$wchar_h" = yes
1871 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
1874 AC_MSG_CHECKING(what type to use for unicode)
1875 AC_ARG_ENABLE(unicode,
1876 [ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
1878 if test $enable_unicode = yes
1880 # Without any arguments, Py_UNICODE defaults to two-byte mode
1881 enable_unicode="ucs2"
1884 case "$enable_unicode" in
1885 ucs2) unicode_size="2"
1886 AC_DEFINE(Py_UNICODE_SIZE,2)
1888 ucs4) unicode_size="4"
1889 AC_DEFINE(Py_UNICODE_SIZE,4)
1893 AC_SUBST(UNICODE_OBJS)
1894 if test "$enable_unicode" = "no"
1897 AC_MSG_RESULT(not used)
1899 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
1900 AC_DEFINE(Py_USING_UNICODE)
1901 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
1903 PY_UNICODE_TYPE="wchar_t"
1904 AC_DEFINE(HAVE_USABLE_WCHAR_T)
1905 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
1906 elif test "$ac_cv_sizeof_short" = "$unicode_size"
1908 PY_UNICODE_TYPE="unsigned short"
1909 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
1910 elif test "$ac_cv_sizeof_long" = "$unicode_size"
1912 PY_UNICODE_TYPE="unsigned long"
1913 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
1915 PY_UNICODE_TYPE="no type found"
1917 AC_MSG_RESULT($PY_UNICODE_TYPE)
1920 # check for endianness
1923 # Check whether right shifting a negative integer extends the sign bit
1924 # or fills with zeros (like the Cray J90, according to Tim Peters).
1925 AC_MSG_CHECKING(whether right shift extends the sign bit)
1926 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
1930 exit(((-1)>>3 == -1) ? 0 : 1);
1933 ac_cv_rshift_extends_sign=yes,
1934 ac_cv_rshift_extends_sign=no,
1935 ac_cv_rshift_extends_sign=yes)])
1936 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
1937 if test "$ac_cv_rshift_extends_sign" = no
1939 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS)
1942 # check for getc_unlocked and related locking functions
1943 AC_MSG_CHECKING(for getc_unlocked() and friends)
1944 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
1945 AC_TRY_LINK([#include <stdio.h>],[
1946 FILE *f = fopen("/dev/null", "r");
1950 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
1951 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
1952 if test "$ac_cv_have_getc_unlocked" = yes
1954 AC_DEFINE(HAVE_GETC_UNLOCKED)
1957 # check for readline 4.0
1958 AC_CHECK_LIB(readline, rl_pre_input_hook,
1959 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK), , -ltermcap)
1961 # check for readline 4.2
1962 AC_CHECK_LIB(readline, rl_completion_matches,
1963 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap)
1965 AC_MSG_CHECKING(for broken nice())
1966 AC_CACHE_VAL(ac_cv_broken_nice, [
1971 if (val1 != -1 && val1 == nice(2))
1976 ac_cv_broken_nice=yes,
1977 ac_cv_broken_nice=no,
1978 ac_cv_broken_nice=no)])
1979 AC_MSG_RESULT($ac_cv_broken_nice)
1980 if test "$ac_cv_broken_nice" = yes
1982 AC_DEFINE(HAVE_BROKEN_NICE)
1985 # On HP/UX 11.0, mvwdelch is a block with a return statement
1986 AC_MSG_CHECKING(whether mvwdelch is an expression)
1987 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
1988 AC_TRY_COMPILE([#include <curses.h>], [
1990 rtn = mvwdelch(0,0,0);
1991 ], ac_cv_mvwdelch_is_expression=yes,
1992 ac_cv_mvwdelch_is_expression=no,
1993 ac_cv_mvwdelch_is_expression=yes))
1994 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
1996 if test "$ac_cv_mvwdelch_is_expression" = yes
1998 AC_DEFINE(MVWDELCH_IS_EXPRESSION)
2001 AC_MSG_CHECKING(whether WINDOW has _flags)
2002 AC_CACHE_VAL(ac_cv_window_has_flags,
2003 AC_TRY_COMPILE([#include <curses.h>], [
2006 ], ac_cv_window_has_flags=yes,
2007 ac_cv_window_has_flags=no,
2008 ac_cv_window_has_flags=no))
2009 AC_MSG_RESULT($ac_cv_window_has_flags)
2012 if test "$ac_cv_window_has_flags" = yes
2014 AC_DEFINE(WINDOW_HAS_FLAGS)
2017 # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
2018 # Add sys/socket.h to confdefs.h
2019 cat >> confdefs.h <<\EOF
2020 #ifdef HAVE_SYS_SOCKET_H
2021 #include <sys/socket.h>
2024 AC_CHECK_TYPE(socklen_t, int)
2026 # Add Python/ prefix to LIBOBJS
2029 for obj in $libobjs; do
2030 LIBOBJS="$LIBOBJS Python/$obj"
2033 #AC_MSG_CHECKING(for Modules/Setup)
2034 #if test ! -f Modules/Setup ; then
2035 # if test ! -d Modules ; then
2038 # cp "$srcdir/Modules/Setup.dist" Modules/Setup
2039 # AC_MSG_RESULT(creating)
2041 # AC_MSG_RESULT(already exists)
2044 AC_SUBST(THREADHEADERS)
2046 for h in `(cd $srcdir;echo Python/thread_*.h)`
2048 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2052 SRCDIRS="Parser Grammar Objects Python Modules"
2053 AC_MSG_CHECKING(for build directories)
2054 for dir in $SRCDIRS; do
2055 if test ! -d $dir; then
2061 # generate output files
2062 AC_OUTPUT(Makefile.pre Modules/Setup.config)
2064 echo "creating Setup"
2065 if test ! -f Modules/Setup
2067 cp $srcdir/Modules/Setup.dist Modules/Setup
2070 echo "creating Setup.local"
2071 if test ! -f Modules/Setup.local
2073 echo "# Edit this file for local setup changes" >Modules/Setup.local
2076 echo "creating Makefile"
2077 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2078 -s Modules Modules/Setup.config \
2079 Modules/Setup.local Modules/Setup