1 dnl Process this file with autoconf 2.0 or later to make a configure script.
3 # Set VERSION so we only need to edit in one place (i.e., here)
4 m4_define(PYTHON_VERSION, 2.3)
6 AC_REVISION($Revision$)
8 AC_INIT(python, PYTHON_VERSION)
9 AC_CONFIG_SRCDIR([Include/object.h])
10 AC_CONFIG_HEADER(pyconfig.h)
12 # This is for stuff that absolutely must end up in pyconfig.h.
13 # Please use pyport.h instead, if possible.
19 /* Define the macros needed if on a UnixWare 7.x system. */
20 #if defined(__USLC__) && defined(__SCO_VERSION__)
21 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
24 #endif /*Py_PYCONFIG_H*/
28 VERSION=PYTHON_VERSION
33 # The later defininition of _XOPEN_SOURCE disables certain features
34 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
35 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
37 define_xopen_source=yes
39 # Arguments passed to configure.
41 CONFIG_ARGS="$ac_configure_args"
43 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
44 AC_ARG_ENABLE(framework,
45 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
49 enableval=/Library/Frameworks
54 PYTHONFRAMEWORKDIR=no-framework
55 PYTHONFRAMEWORKPREFIX=
56 PYTHONFRAMEWORKINSTALLDIR=
60 PYTHONFRAMEWORK=Python
61 PYTHONFRAMEWORKDIR=Python.framework
62 PYTHONFRAMEWORKPREFIX=$enableval
63 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
64 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
68 PYTHONFRAMEWORKDIR=no-framework
69 PYTHONFRAMEWORKPREFIX=
70 PYTHONFRAMEWORKINSTALLDIR=
73 AC_SUBST(PYTHONFRAMEWORK)
74 AC_SUBST(PYTHONFRAMEWORKDIR)
75 AC_SUBST(PYTHONFRAMEWORKPREFIX)
76 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
79 ## AC_HELP_STRING(--with-dyld,
80 ## Use (OpenStep|Rhapsody) dynamic linker))
82 # Set name for machine-dependent library files
84 AC_MSG_CHECKING(MACHDEP)
87 ac_sys_system=`uname -s`
88 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
89 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
90 ac_sys_release=`uname -v`
92 ac_sys_release=`uname -r`
94 ac_md_system=`echo $ac_sys_system |
95 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
96 ac_md_release=`echo $ac_sys_release |
97 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
98 MACHDEP="$ac_md_system$ac_md_release"
101 cygwin*) MACHDEP="cygwin";;
102 darwin*) MACHDEP="darwin";;
103 atheos*) MACHDEP="atheos";;
104 '') MACHDEP="unknown";;
108 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
109 # disable features if it is defined, without any means to access these
110 # features as extensions. For these systems, we skip the definition of
111 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
112 # some feature, make sure there is no alternative way to access this
113 # feature. Also, when using wildcards, make sure you have verified the
114 # need for not defining _XOPEN_SOURCE on all systems matching the
115 # wildcard, and that the wildcard does not include future systems
116 # (which may remove their limitations).
117 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
118 case $ac_sys_system/$ac_sys_release in
119 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
120 # even though select is a POSIX function. Reported by J. Ribbens.
121 OpenBSD/2.* | OpenBSD/3.@<:@012@:>@)
122 define_xopen_source=no;;
125 if test $define_xopen_source = yes
127 AC_DEFINE(_XOPEN_SOURCE, 600,
128 Define to the level of X/Open that your system supports)
130 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
131 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
132 # several APIs are not declared. Since this is also needed in some
133 # cases for HP-UX, we define it globally.
135 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Define to activate Unix95-and-earlier features)
136 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
141 # SGI compilers allow the specification of the both the ABI and the
142 # ISA on the command line. Depending on the values of these switches,
143 # different and often incompatable code will be generated.
145 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
146 # thus supply support for various ABI/ISA combinations. The MACHDEP
147 # variable is also adjusted.
150 if test ! -z "$SGI_ABI"
153 LDFLAGS="$SGI_ABI $LDFLAGS"
154 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
156 AC_MSG_RESULT($MACHDEP)
158 # And add extra plat-mac for darwin
159 AC_SUBST(EXTRAPLATDIR)
160 AC_MSG_CHECKING(EXTRAPLATDIR)
161 if test -z "$EXTRAPLATDIR"
164 darwin) EXTRAPLATDIR="\$(PLATMACDIRS)";;
168 AC_MSG_RESULT($EXTRAPLATDIR)
170 # checks for alternative programs
171 AC_MSG_CHECKING(for --without-gcc)
173 AC_HELP_STRING(--without-gcc,never use gcc),
181 without_gcc=$withval;;
183 case $ac_sys_system in
191 OPT="-O -export pragma"
192 LDFLAGS="$LDFLAGS -nodup"
200 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
203 AR="\$(srcdir)/Modules/ar_beos"
211 AC_MSG_RESULT($without_gcc)
216 AC_MSG_CHECKING(for --with-cxx=<compiler>)
218 AC_HELP_STRING(--with-cxx=<compiler>, enable C++ support),
231 AC_MSG_RESULT($with_cxx)
233 if test "$with_cxx" = "yes"
235 AC_MSG_ERROR([must supply a compiler when using --with-cxx])
238 dnl The following fragment works similar to AC_PROG_CXX.
239 dnl It does not fail if CXX is not found, and it is not executed if
240 dnl --without-cxx was given.
241 dnl Finally, it does not test whether CXX is g++.
243 dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
244 ifdef([AC_PROG_CXX_WORKS],[],
245 [AC_DEFUN([AC_PROG_CXX_WORKS],
246 [AC_LANG_PUSH(C++)dnl
252 if test "$check_cxx" = "yes"
254 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
255 if test "$CXX" = "notfound"
263 # If the user switches compilers, we can't believe the cache
264 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
266 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
267 (it is also a good idea to do 'make clean' before compiling)])
272 # checks for UNIX variants that set C preprocessor variables
276 # Check for unsupported systems
277 case $ac_sys_system/$ac_sys_release in
278 SunOS/4*|DYNIX/*|dgux*/*|IRIX/4*|Linux*/1*)
279 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
280 echo See README for details.
284 if test "$MINIX" = yes; then
285 echo This system \(MINIX\) is no longer supported.
286 echo Read README for details.
291 AC_MSG_CHECKING(for --with-suffix)
293 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
300 AC_MSG_RESULT($EXEEXT)
302 # Test whether we're running on a non-case-sensitive system, in which
303 # case we give a warning if no ext is given
304 AC_SUBST(BUILDEXEEXT)
305 AC_MSG_CHECKING(for case-insensitive build directory)
306 if test ! -d CaseSensitiveTestDir; then
307 mkdir CaseSensitiveTestDir
310 if test -d casesensitivetestdir
318 rmdir CaseSensitiveTestDir
323 gcc) CC="$CC -D_HAVE_BSDI";;
327 case $ac_sys_system in
330 cc|*/cc) CC="$CC -Ae";;
334 cc) CC="$CC -Wl,-Bexport";;
337 # Some functions have a prototype only with that define, e.g. confstr
338 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
344 AC_MSG_CHECKING(LIBRARY)
345 if test -z "$LIBRARY"
347 LIBRARY='libpython$(VERSION).a'
349 AC_MSG_RESULT($LIBRARY)
351 # LDLIBRARY is the name of the library to link against (as opposed to the
352 # name of the library into which to insert object files). BLDLIBRARY is also
353 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
354 # is blank as the main program is not linked directly against LDLIBRARY.
355 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
356 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
357 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
358 # DLLLIBRARY is the shared (i.e., DLL) library.
360 # RUNSHARED is used to run shared python without installed libraries
362 # INSTSONAME is the name of the shared library that will be use to install
363 # on the system - some systems like version suffix, others don't
367 AC_SUBST(LDLIBRARYDIR)
371 BLDLIBRARY='$(LDLIBRARY)'
372 INSTSONAME='$(LDLIBRARY)'
377 # LINKCC is the command that links the python executable -- default is $(CC).
378 # If CXX is set, and if it is needed to link a main function that was
379 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
380 # python might then depend on the C++ runtime
381 # This is altered for AIX in order to build the export list before
384 AC_MSG_CHECKING(LINKCC)
387 if test -z "$CXX"; then
388 LINKCC="\$(PURIFY) \$(CC)"
390 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
391 $CXX -c conftest.$ac_ext 2>&5
392 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
393 && test -s conftest$ac_exeext && ./conftest$ac_exeext
395 LINKCC="\$(PURIFY) \$(CC)"
397 LINKCC="\$(PURIFY) \$(CXX)"
401 case $ac_sys_system in
403 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
405 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
407 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
410 AC_MSG_RESULT($LINKCC)
412 AC_MSG_CHECKING(for --enable-shared)
413 AC_ARG_ENABLE(shared,
414 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
416 if test -z "$enable_shared"
418 case $ac_sys_system in
420 enable_shared="yes";;
425 AC_MSG_RESULT($enable_shared)
428 AC_MSG_CHECKING(LDLIBRARY)
430 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
431 # library that we build, but we do not want to link against it (we
432 # will find it with a -framework option). For this reason there is an
433 # extra variable BLDLIBRARY against which Python and the extension
434 # modules are linked, BLDLIBRARY. This is normally the same as
435 # LDLIBRARY, but empty for MacOSX framework builds.
436 if test "$enable_framework"
438 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
439 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
442 BLDLIBRARY='$(LDLIBRARY)'
445 # Other platforms follow
446 if test $enable_shared = "yes"; then
447 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
448 case $ac_sys_system in
450 LDLIBRARY='libpython$(VERSION).so'
453 LDLIBRARY='libpython$(VERSION).dll.a'
454 DLLLIBRARY='libpython$(VERSION).dll'
457 LDLIBRARY='libpython$(VERSION).so'
458 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
459 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
462 LDLIBRARY='libpython$(VERSION).so'
463 BLDLIBRARY='-L. -lpython$(VERSION)'
464 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
465 INSTSONAME="$LDLIBRARY".$SOVERSION
468 LDLIBRARY='libpython$(VERSION).sl'
469 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
470 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
473 LDLIBRARY='libpython$(VERSION).so'
474 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
475 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
478 LDLIBRARY='libpython$(VERSION).so'
479 BLDLIBRARY='-L. -lpython$(VERSION)'
480 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
483 # DG/UX requires some fancy ld contortions to produce a .so from an .a
486 LDLIBRARY='libpython$(VERSION).so'
492 AC_MSG_RESULT($LDLIBRARY)
496 AC_CHECK_PROGS(AR, ar aal, ar)
500 # install -d does not work on BSDI or HP-UX
501 if test -z "$INSTALL"
503 INSTALL="${srcdir}/install-sh -c"
508 # Not every filesystem supports hard links
510 if test -z "$LN" ; then
511 case $ac_sys_system in
513 CYGWIN*) LN="ln -s";;
514 atheos*) LN="ln -s";;
519 # Check for --with-pydebug
520 AC_MSG_CHECKING(for --with-pydebug)
522 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
524 if test "$withval" != no
526 AC_DEFINE(Py_DEBUG, 1,
527 [Define if you want to build an interpreter with many run-time checks.])
530 else AC_MSG_RESULT(no); Py_DEBUG='false'
534 # Optimizer/debugger flags
540 case $ac_cv_prog_cc_g in
542 if test "$Py_DEBUG" = 'true' ; then
543 # Optimization messes up debuggers, so turn it off for
545 OPT="-g -Wall -Wstrict-prototypes"
547 OPT="-g -O3 -Wall -Wstrict-prototypes"
550 OPT="-O3 -Wall -Wstrict-prototypes";;
552 case $ac_sys_system in
553 SCO_SV*) OPT="$OPT -m486 -DSCO5";;
557 case $ac_sys_system in
559 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
561 CFLAGS="$CFLAGS -belf"
562 OPT="-belf -O -Ki486 -DSCO5";;
567 case $ac_sys_system in
569 OPT="$OPT -Wno-long-double -no-cpp-precomp";;
573 if test "$Py_DEBUG" = 'true'; then
579 # The current (beta) Monterey compiler dies with optimizations
580 case $ac_sys_system in
584 if test "$ac_arch_flags"
586 OPT="$OPT $ac_arch_flags"
589 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
590 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
592 CC="$CC -OPT:Olimit=0"
593 AC_TRY_RUN([int main() { return 0; }],
594 ac_cv_opt_olimit_ok=yes,
595 ac_cv_opt_olimit_ok=no,
596 ac_cv_opt_olimit_ok=no)
598 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
599 if test $ac_cv_opt_olimit_ok = yes; then
600 case $ac_sys_system in
601 Darwin*) OPT="$OPT" ;;
602 *) OPT="$OPT -OPT:Olimit=0";;
605 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
606 AC_CACHE_VAL(ac_cv_olimit_ok,
608 CC="$CC -Olimit 1500"
609 AC_TRY_RUN([int main() { return 0; }],
614 AC_MSG_RESULT($ac_cv_olimit_ok)
615 if test $ac_cv_olimit_ok = yes; then
616 OPT="$OPT -Olimit 1500"
620 # On some compilers, pthreads are available without further options
621 # (e.g. MacOS X). On some of these systems, the compiler will not
622 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
623 # So we have to see first whether pthreads are available without
624 # options before we can check whether -Kpthread improves anything.
625 AC_MSG_CHECKING(whether pthreads are available without options)
626 AC_CACHE_VAL(ac_cv_pthread_is_default,
630 void* routine(void* p){return NULL;}
634 if(pthread_create(&p,NULL,routine,NULL)!=0)
636 (void)pthread_detach(p);
640 ac_cv_pthread_is_default=yes,
641 ac_cv_pthread_is_default=no,
642 ac_cv_pthread_is_default=no)
644 AC_MSG_RESULT($ac_cv_pthread_is_default)
647 if test $ac_cv_pthread_is_default = yes
651 # -Kpthread, if available, provides the right #defines
652 # and linker options to make pthread_create available
653 # Some compilers won't report that they do not support -Kpthread,
654 # so we need to run a program to see whether it really made the
655 # function available.
656 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
657 AC_CACHE_VAL(ac_cv_kpthread,
663 void* routine(void* p){return NULL;}
667 if(pthread_create(&p,NULL,routine,NULL)!=0)
669 (void)pthread_detach(p);
677 AC_MSG_RESULT($ac_cv_kpthread)
680 dnl # check for ANSI or K&R ("traditional") preprocessor
681 dnl AC_MSG_CHECKING(for C preprocessor type)
683 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
685 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
686 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
687 dnl AC_MSG_RESULT($cpp_type)
689 # checks for header files
691 AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
692 libintl.h locale.h ncurses.h poll.h pthread.h \
693 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
694 sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \
695 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
696 sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
697 sys/resource.h netpacket/packet.h)
701 # checks for typedefs
703 AC_MSG_CHECKING(for clock_t in time.h)
704 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
705 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
707 AC_MSG_RESULT($was_it_defined)
709 # Check whether using makedev requires defining _OSF_SOURCE
710 AC_MSG_CHECKING(for makedev)
711 AC_TRY_LINK([ #include <sys/types.h> ],
713 ac_cv_has_makedev=yes,
714 ac_cv_has_makedev=no)
715 if test "$ac_cv_has_makedev" = "no"; then
716 # we didn't link, try if _OSF_SOURCE will allow us to link
718 #define _OSF_SOURCE 1
719 #include <sys/types.h>
722 ac_cv_has_makedev=yes,
723 ac_cv_has_makedev=no)
724 if test "$ac_cv_has_makedev" = "yes"; then
725 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
728 AC_MSG_RESULT($ac_cv_has_makedev)
729 if test "$ac_cv_has_makedev" = "yes"; then
730 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
733 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
734 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
735 # defined, but the compiler does not support pragma redefine_extname,
736 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
737 # structures (such as rlimit64) without declaring them. As a
738 # work-around, disable LFS on such configurations
741 AC_MSG_CHECKING(Solaris LFS bug)
743 #define _LARGEFILE_SOURCE 1
744 #define _FILE_OFFSET_BITS 64
745 #include <sys/resource.h>
746 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
747 AC_MSG_RESULT($sol_lfs_bug)
748 if test "$sol_lfs_bug" = "yes"; then
752 if test "$use_lfs" = "yes"; then
753 # Two defines needed to enable largefile support on various platforms
754 # These may affect some typedefs
755 AC_DEFINE(_LARGEFILE_SOURCE, 1,
756 [This must be defined on some systems to enable large file support.])
757 AC_DEFINE(_FILE_OFFSET_BITS, 64,
758 [This must be set to 64 on some systems to enable large file support.])
761 # Add some code to confdefs.h so that the test for off_t works on SCO
762 cat >> confdefs.h <<\EOF
768 # Type availability checks
776 # Sizes of various common basic types
777 AC_CHECK_SIZEOF(int, 4)
778 AC_CHECK_SIZEOF(long, 4)
779 AC_CHECK_SIZEOF(void *, 4)
780 AC_CHECK_SIZEOF(char, 1)
781 AC_CHECK_SIZEOF(short, 2)
782 AC_CHECK_SIZEOF(float, 4)
783 AC_CHECK_SIZEOF(double, 8)
784 AC_CHECK_SIZEOF(fpos_t, 4)
786 AC_MSG_CHECKING(for long long support)
788 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
789 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
792 AC_MSG_RESULT($have_long_long)
793 if test "$have_long_long" = yes ; then
794 AC_CHECK_SIZEOF(long long, 8)
797 AC_MSG_CHECKING(for uintptr_t support)
799 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
800 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
803 AC_MSG_RESULT($have_uintptr_t)
804 if test "$have_uintptr_t" = yes ; then
805 AC_CHECK_SIZEOF(uintptr_t, 4)
808 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
809 AC_MSG_CHECKING(size of off_t)
810 AC_CACHE_VAL(ac_cv_sizeof_off_t,
811 [AC_TRY_RUN([#include <stdio.h>
812 #include <sys/types.h>
815 FILE *f=fopen("conftestval", "w");
817 fprintf(f, "%d\n", sizeof(off_t));
820 ac_cv_sizeof_off_t=`cat conftestval`,
821 ac_cv_sizeof_off_t=0,
822 ac_cv_sizeof_off_t=4)
824 AC_MSG_RESULT($ac_cv_sizeof_off_t)
825 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
826 [The number of bytes in an off_t.])
828 AC_MSG_CHECKING(whether to enable large file support)
829 if test "$have_long_long" = yes -a \
830 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
831 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
832 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
833 [Defined to enable large file support when an off_t is bigger than a long
834 and long long is available and at least as big as an off_t. You may need
835 to add some flags for configuration and compilation to enable this mode.
836 (For Solaris and Linux, the necessary defines are already defined.)])
842 # AC_CHECK_SIZEOF() doesn't include <time.h>.
843 AC_MSG_CHECKING(size of time_t)
844 AC_CACHE_VAL(ac_cv_sizeof_time_t,
845 [AC_TRY_RUN([#include <stdio.h>
849 FILE *f=fopen("conftestval", "w");
851 fprintf(f, "%d\n", sizeof(time_t));
854 ac_cv_sizeof_time_t=`cat conftestval`,
855 ac_cv_sizeof_time_t=0,
856 ac_cv_sizeof_time_t=4)
858 AC_MSG_RESULT($ac_cv_sizeof_time_t)
859 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
860 [The number of bytes in a time_t.])
863 # if have pthread_t then define SIZEOF_PTHREAD_T
865 if test "$ac_cv_kpthread" = "yes"
866 then CC="$CC -Kpthread"
868 AC_MSG_CHECKING(for pthread_t)
870 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
871 AC_MSG_RESULT($have_pthread_t)
872 if test "$have_pthread_t" = yes ; then
873 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
874 AC_MSG_CHECKING(size of pthread_t)
875 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
876 [AC_TRY_RUN([#include <stdio.h>
880 FILE *f=fopen("conftestval", "w");
882 fprintf(f, "%d\n", sizeof(pthread_t));
885 ac_cv_sizeof_pthread_t=`cat conftestval`,
886 ac_cv_sizeof_pthread_t=0,
887 ac_cv_sizeof_pthread_t=4)
889 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
890 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
891 [The number of bytes in a pthread_t.])
895 AC_MSG_CHECKING(for --enable-toolbox-glue)
896 AC_ARG_ENABLE(toolbox-glue,
897 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
899 if test -z "$enable_toolbox_glue"
901 case $ac_sys_system/$ac_sys_release in
903 enable_toolbox_glue="yes";;
905 enable_toolbox_glue="no";;
908 case "$enable_toolbox_glue" in
910 extra_frameworks="-framework CoreServices -framework Foundation"
911 extra_machdep_objs="Python/mactoolboxglue.o"
912 extra_undefs="-u __dummy -u _PyMac_Error"
913 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
914 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
918 extra_machdep_objs=""
922 AC_MSG_RESULT($enable_toolbox_glue)
924 AC_SUBST(LIBTOOL_CRUFT)
925 case $ac_sys_system/$ac_sys_release in
927 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
928 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
929 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
930 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
932 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
933 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
934 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
935 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
938 AC_MSG_CHECKING(for --enable-framework)
939 if test "$enable_framework"
941 OPT="$OPT -fno-common -dynamic"
942 # -F. is needed to allow linking to the framework while
943 # in the build location.
944 LDFLAGS="$LDFLAGS -Wl,-F."
945 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
946 [Define if you want to produce an OpenStep/Rhapsody framework
947 (shared library plus accessory files).])
953 AC_MSG_CHECKING(for dyld)
954 case $ac_sys_system/$ac_sys_release in
956 AC_DEFINE(WITH_DYLD, 1,
957 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
958 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
959 linker (rld). Dyld is necessary to support frameworks.])
960 AC_MSG_RESULT(always on for Darwin)
967 # Set info about shared libraries.
972 AC_SUBST(LINKFORSHARED)
973 # SO is the extension of shared libraries `(including the dot!)
974 # -- usually .so, .sl on HP-UX, .dll on Cygwin
978 case $ac_sys_system in
985 # LDSHARED is the ld *command* used to create shared library
986 # -- "ld" on SunOS 4.x.x, "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
987 # (Shared libraries in this instance are shared modules to be loaded into
988 # Python, as opposed to building Python itself as a shared library.)
989 AC_MSG_CHECKING(LDSHARED)
990 if test -z "$LDSHARED"
992 case $ac_sys_system/$ac_sys_release in
994 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
995 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
998 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
999 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1001 IRIX/5*) LDSHARED="ld -shared";;
1002 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1003 SunOS/4*) LDSHARED="ld";;
1005 if test "$GCC" = "yes"
1006 then LDSHARED='$(CC) -shared'
1007 else LDSHARED='$(CC) -G';
1009 hp*|HP*) LDSHARED="ld -b";;
1010 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1011 DYNIX/ptx*) LDSHARED="ld -G";;
1013 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1014 if test "$enable_framework" ; then
1015 # Link against the framework. All externals should be defined.
1016 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1018 # No framework. Ignore undefined symbols, assuming they come from Python
1019 LDSHARED="$LDSHARED -undefined suppress"
1022 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1023 if test "$enable_framework" ; then
1024 # Link against the framework. All externals should be defined.
1025 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1027 # No framework, use the Python app as bundle-loader
1028 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1029 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
1031 Linux*|GNU*) LDSHARED='$(CC) -shared';;
1032 dgux*) LDSHARED="ld -G";;
1033 BSD/OS*/4*) LDSHARED="gcc -shared";;
1035 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1037 LDSHARED="cc -shared ${LDFLAGS}"
1039 LDSHARED="ld -Bshareable ${LDFLAGS}"
1041 NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
1042 OpenUNIX*|UnixWare*)
1043 if test "$GCC" = "yes"
1044 then LDSHARED='$(CC) -shared'
1045 else LDSHARED='$(CC) -G'
1047 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1048 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1049 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1050 atheos*) LDSHARED="gcc -shared";;
1054 AC_MSG_RESULT($LDSHARED)
1055 BLDSHARED=${BLDSHARED-$LDSHARED}
1056 # CCSHARED are the C *flags* used to create objects to go into a shared
1057 # library (module) -- this is only needed for a few systems
1058 AC_MSG_CHECKING(CCSHARED)
1059 if test -z "$CCSHARED"
1061 case $ac_sys_system/$ac_sys_release in
1062 SunOS*) if test "$GCC" = yes;
1063 then CCSHARED="-fPIC";
1065 hp*|HP*) if test "$GCC" = yes;
1066 then CCSHARED="-fPIC";
1069 Linux*|GNU*) CCSHARED="-fPIC";;
1070 BSD/OS*/4*) CCSHARED="-fpic";;
1071 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
1072 OpenUNIX*|UnixWare*)
1073 if test "$GCC" = "yes"
1074 then CCSHARED="-fPIC"
1075 else CCSHARED="-KPIC"
1078 if test "$GCC" = "yes"
1079 then CCSHARED="-fPIC"
1080 else CCSHARED="-Kpic -belf"
1082 Monterey*) CCSHARED="-G";;
1083 IRIX*/6*) case $CC in
1084 *gcc*) CCSHARED="-shared";;
1087 atheos*) CCSHARED="-fPIC";;
1090 AC_MSG_RESULT($CCSHARED)
1091 # LINKFORSHARED are the flags passed to the $(CC) command that links
1092 # the python executable -- this is only needed for a few systems
1093 AC_MSG_CHECKING(LINKFORSHARED)
1094 if test -z "$LINKFORSHARED"
1096 case $ac_sys_system/$ac_sys_release in
1097 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1099 LINKFORSHARED="-Wl,-E -Wl,+s";;
1100 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1101 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1102 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1103 # -u libsys_s pulls in all symbols in libsys
1105 # -u __dummy makes the linker aware of the objc runtime
1106 # in System.framework; otherwise, __objcInit (referenced in
1107 # crt1.o) gets erroneously defined as common, which breaks dynamic
1108 # loading of any modules which reference it in System.framework.
1109 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
1110 # not used by the core itself but which needs to be in the core so
1111 # that dynamically loaded extension modules have access to it.
1112 LINKFORSHARED="$extra_undefs -framework System"
1113 if test "$enable_framework"
1115 LINKFORSHARED="$LINKFORSHARED -framework Python"
1117 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
1118 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1119 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1120 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1121 FreeBSD*|NetBSD*|OpenBSD*)
1122 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1124 LINKFORSHARED="-Wl,--export-dynamic"
1126 SunOS/5*) case $CC in
1128 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1130 LINKFORSHARED="-Xlinker --export-dynamic"
1135 AC_MSG_RESULT($LINKFORSHARED)
1137 AC_SUBST(CFLAGSFORSHARED)
1138 AC_MSG_CHECKING(CFLAGSFORSHARED)
1139 if test ! "$LIBRARY" = "$LDLIBRARY"
1141 case $ac_sys_system in
1143 # Cygwin needs CCSHARED when building extension DLLs
1144 # but not when building the interpreter DLL.
1145 CFLAGSFORSHARED='';;
1147 CFLAGSFORSHARED='$(CCSHARED)'
1150 AC_MSG_RESULT($CFLAGSFORSHARED)
1152 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1153 # library (with --enable-shared).
1154 # For platforms on which shared libraries are not allowed to have unresolved
1155 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1156 # if it is not required, since it creates a dependency of the shared library
1157 # to LIBS. This, in turn, means that applications linking the shared libpython
1158 # don't need to link LIBS explicitly. The default should be only changed
1159 # on systems where this approach causes problems.
1161 AC_MSG_CHECKING(SHLIBS)
1162 case "$ac_sys_system" in
1166 AC_MSG_RESULT($SHLIBS)
1169 # checks for libraries
1170 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1171 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1172 AC_SEARCH_LIBS(sem_init, rt posix4) # 'Real Time' functions on Solaris,
1173 # posix4 on Solaris 2.6
1175 # checks for system dependent C++ extensions support
1176 case "$ac_sys_system" in
1177 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1178 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1179 [loadAndInit("", 0, "")],
1180 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1181 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1182 and you want support for AIX C++ shared extension modules.])
1183 AC_MSG_RESULT(yes)],
1184 [AC_MSG_RESULT(no)]);;
1188 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1189 # However on SGI IRIX 4, these exist but are broken.
1190 # BeOS' sockets are stashed in libnet.
1191 case "$ac_sys_system" in
1194 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1195 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1198 case "$ac_sys_system" in
1200 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1204 AC_MSG_CHECKING(for --with-libs)
1206 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1208 AC_MSG_RESULT($withval)
1209 LIBS="$withval $LIBS"
1211 [AC_MSG_RESULT(no)])
1213 # Determine if signalmodule should be used.
1214 AC_SUBST(USE_SIGNAL_MODULE)
1215 AC_SUBST(SIGNAL_OBJS)
1216 AC_MSG_CHECKING(for --with-signal-module)
1217 AC_ARG_WITH(signal-module,
1218 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1220 if test -z "$with_signal_module"
1221 then with_signal_module="yes"
1223 AC_MSG_RESULT($with_signal_module)
1225 if test "${with_signal_module}" = "yes"; then
1226 USE_SIGNAL_MODULE=""
1229 USE_SIGNAL_MODULE="#"
1230 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1233 # This is used to generate Setup.config
1234 AC_SUBST(USE_THREAD_MODULE)
1235 USE_THREAD_MODULE=""
1237 AC_MSG_CHECKING(for --with-dec-threads)
1239 AC_ARG_WITH(dec-threads,
1240 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1242 AC_MSG_RESULT($withval)
1244 if test "${with_thread+set}" != set; then
1245 with_thread="$withval";
1247 [AC_MSG_RESULT(no)])
1249 # Templates for things AC_DEFINEd more than once.
1250 # For a single AC_DEFINE, no template is needed.
1251 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1252 AH_TEMPLATE(_REENTRANT,
1253 [Define to force use of thread-safe errno, h_errno, and other functions])
1254 AH_TEMPLATE(WITH_THREAD,
1255 [Define if you want to compile in rudimentary thread support])
1257 AC_MSG_CHECKING(for --with-threads)
1258 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1259 AC_ARG_WITH(threads,
1260 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
1262 # --with-thread is deprecated, but check for it anyway
1263 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1265 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1266 [with_threads=$with_thread])
1268 if test -z "$with_threads"
1269 then with_threads="yes"
1271 AC_MSG_RESULT($with_threads)
1274 if test "$with_threads" = "no"
1276 USE_THREAD_MODULE="#"
1277 elif test "$ac_cv_pthread_is_default" = yes
1279 AC_DEFINE(WITH_THREAD)
1280 # Defining _REENTRANT on system with POSIX threads should not hurt.
1281 AC_DEFINE(_REENTRANT)
1283 THREADOBJ="Python/thread.o"
1284 elif test "$ac_cv_kpthread" = "yes"
1287 AC_DEFINE(WITH_THREAD)
1289 THREADOBJ="Python/thread.o"
1291 if test ! -z "$with_threads" -a -d "$with_threads"
1292 then LDFLAGS="$LDFLAGS -L$with_threads"
1294 if test ! -z "$withval" -a -d "$withval"
1295 then LDFLAGS="$LDFLAGS -L$withval"
1298 # According to the POSIX spec, a pthreads implementation must
1299 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1300 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1302 [#include <unistd.h>
1303 #ifdef _POSIX_THREADS
1306 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1307 AC_MSG_RESULT($unistd_defines_pthreads)
1309 AC_DEFINE(_REENTRANT)
1310 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1311 AC_DEFINE(C_THREADS)
1312 AC_DEFINE(HURD_C_THREADS, 1,
1313 [Define if you are using Mach cthreads directly under /include])
1314 LIBS="$LIBS -lthreads"
1315 THREADOBJ="Python/thread.o"],[
1316 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1317 AC_DEFINE(C_THREADS)
1318 AC_DEFINE(MACH_C_THREADS, 1,
1319 [Define if you are using Mach cthreads under mach /])
1320 THREADOBJ="Python/thread.o"],[
1321 AC_MSG_CHECKING(for --with-pth)
1323 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1324 [AC_MSG_RESULT($withval)
1325 AC_DEFINE([WITH_THREAD])
1326 AC_DEFINE([HAVE_PTH], 1,
1327 [Define if you have GNU PTH threads.])
1329 THREADOBJ="Python/thread.o"],
1332 # Just looking for pthread_create in libpthread is not enough:
1333 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1334 # So we really have to include pthread.h, and then link.
1336 LIBS="$LIBS -lpthread"
1337 AC_MSG_CHECKING([for pthread_create in -lpthread])
1338 AC_TRY_LINK([#include <pthread.h>
1340 void * start_routine (void *arg) { exit (0); }], [
1341 pthread_create (NULL, NULL, start_routine, NULL)], [
1343 AC_DEFINE(WITH_THREAD)
1345 THREADOBJ="Python/thread.o"],[
1347 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1349 THREADOBJ="Python/thread.o"],[
1350 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1351 AC_DEFINE(ATHEOS_THREADS, 1,
1352 [Define this if you have AtheOS threads.])
1353 THREADOBJ="Python/thread.o"],[
1354 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1355 AC_DEFINE(BEOS_THREADS, 1,
1356 [Define this if you have BeOS threads.])
1357 THREADOBJ="Python/thread.o"],[
1358 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1360 LIBS="$LIBS -lpthreads"
1361 THREADOBJ="Python/thread.o"], [
1362 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1365 THREADOBJ="Python/thread.o"], [
1366 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1367 echo Systems with __d6_pthread_create are not supported anymore.
1371 LIBS="$LIBS -lthread"
1372 THREADOBJ="Python/thread.o"], [
1373 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1375 LIBS="$LIBS -lpthread"
1376 THREADOBJ="Python/thread.o"], [
1377 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1380 THREADOBJ="Python/thread.o"],[
1381 USE_THREAD_MODULE="#"])
1382 ])])])])])])])])])])])
1384 if test "$posix_threads" = "yes"; then
1385 if test "$unistd_defines_pthreads" = "no"; then
1386 AC_DEFINE(_POSIX_THREADS, 1,
1387 [Define if you have POSIX threads,
1388 and your system does not define that.])
1391 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1392 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1393 [AC_TRY_RUN([#include <pthread.h>
1394 void *foo(void *parm) {
1398 pthread_attr_t attr;
1400 if (pthread_attr_init(&attr)) exit(-1);
1401 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1402 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1405 ac_cv_pthread_system_supported=yes,
1406 ac_cv_pthread_system_supported=no,
1407 ac_cv_pthread_system_supported=no)
1409 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1410 if test "$ac_cv_pthread_system_supported" = "yes"; then
1411 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
1413 AC_CHECK_FUNCS(pthread_sigmask)
1416 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1418 THREADOBJ="Python/thread.o"
1419 USE_THREAD_MODULE=""])
1421 if test "$posix_threads" != "yes"; then
1422 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1423 LIBS="$LIBS -lthread"
1424 THREADOBJ="Python/thread.o"
1425 USE_THREAD_MODULE=""])
1428 if test "$USE_THREAD_MODULE" != "#"
1430 # If the above checks didn't disable threads, (at least) OSF1
1431 # needs this '-threads' argument during linking.
1432 case $ac_sys_system in
1433 OSF1) LDLAST=-threads;;
1437 if test "$posix_threads" = yes -a \
1438 "$ac_sys_system" = "SunOS" -a \
1439 "$ac_sys_release" = "5.6"; then
1440 AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1441 [Defined for Solaris 2.6 bug in pthread header.])
1446 # Check for enable-ipv6
1447 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1448 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1450 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1451 --disable-ipv6 Disable ipv6 support],
1452 [ case "$enableval" in
1457 *) AC_MSG_RESULT(yes)
1458 AC_DEFINE(ENABLE_IPV6)
1464 dnl the check does not work on cross compilation case...
1465 AC_TRY_RUN([ /* AF_INET6 available check */
1466 #include <sys/types.h>
1467 #include <sys/socket.h>
1470 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1484 if test "$ipv6" = "yes"; then
1485 AC_MSG_CHECKING(if RFC2553 API is available)
1486 AC_TRY_COMPILE([#include <sys/types.h>
1487 #include <netinet/in.h>],
1488 [struct sockaddr_in6 x;
1492 AC_MSG_RESULT(no, IPv6 disabled)
1496 if test "$ipv6" = "yes"; then
1497 AC_DEFINE(ENABLE_IPV6)
1505 if test "$ipv6" = "yes"; then
1506 AC_MSG_CHECKING([ipv6 stack type])
1507 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1511 dnl http://www.kame.net/
1513 #include <netinet/in.h>
1514 #ifdef IPV6_INRIA_VERSION
1520 dnl http://www.kame.net/
1522 #include <netinet/in.h>
1528 ipv6libdir=/usr/local/v6/lib
1532 dnl http://www.v6.linux.or.jp/
1534 #include <features.h>
1535 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1542 dnl http://www.v6.linux.or.jp/
1543 if test -d /usr/inet6; then
1546 ipv6libdir=/usr/inet6/lib
1547 OPT="-I/usr/inet6/include $OPT"
1551 if test -f /etc/netconfig; then
1552 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1560 #include <sys/param.h>
1561 #ifdef _TOSHIBA_INET6
1566 ipv6libdir=/usr/local/v6/lib])
1570 #include </usr/local/v6/include/sys/v6config.h>
1576 ipv6libdir=/usr/local/v6/lib;
1577 OPT="-I/usr/local/v6/include $OPT"])
1581 #include <sys/param.h>
1582 #ifdef _ZETA_MINAMI_INET6
1587 ipv6libdir=/usr/local/v6/lib])
1590 if test "$ipv6type" != "unknown"; then
1594 AC_MSG_RESULT($ipv6type)
1597 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1598 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1599 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1600 echo "using lib$ipv6lib"
1602 if test $ipv6trylibc = "yes"; then
1605 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1606 echo "You need to fetch lib$ipv6lib.a from appropriate"
1607 echo 'ipv6 kit and compile beforehand.'
1613 # Check for universal newline support
1614 AC_MSG_CHECKING(for --with-universal-newlines)
1615 AC_ARG_WITH(universal-newlines,
1616 AC_HELP_STRING(--with(out)-universal-newlines, disable/enable foreign newlines))
1618 if test -z "$with_universal_newlines"
1619 then with_universal_newlines="yes"
1621 if test "$with_universal_newlines" = "no"
1623 echo --without-universal-newlines is unsupported, see README
1626 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1627 [Define if you want to read files with foreign newlines.])
1629 AC_MSG_RESULT($with_universal_newlines)
1631 # Check for --with-doc-strings
1632 AC_MSG_CHECKING(for --with-doc-strings)
1633 AC_ARG_WITH(doc-strings,
1634 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
1636 if test -z "$with_doc_strings"
1637 then with_doc_strings="yes"
1639 if test "$with_doc_strings" != "no"
1641 AC_DEFINE(WITH_DOC_STRINGS, 1,
1642 [Define if you want documentation strings in extension modules])
1644 AC_MSG_RESULT($with_doc_strings)
1646 # Check for Python-specific malloc support
1647 AC_MSG_CHECKING(for --with-pymalloc)
1648 AC_ARG_WITH(pymalloc,
1649 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
1651 if test -z "$with_pymalloc"
1652 then with_pymalloc="yes"
1654 if test "$with_pymalloc" != "no"
1656 AC_DEFINE(WITH_PYMALLOC, 1,
1657 [Define if you want to compile in Python-specific mallocs])
1659 AC_MSG_RESULT($with_pymalloc)
1661 # Check for --with-wctype-functions
1662 AC_MSG_CHECKING(for --with-wctype-functions)
1663 AC_ARG_WITH(wctype-functions,
1664 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
1666 if test "$withval" != no
1668 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1669 [Define if you want wctype.h functions to be used instead of the
1670 one supplied by Python itself. (see Include/unicodectype.h).])
1672 else AC_MSG_RESULT(no)
1674 [AC_MSG_RESULT(no)])
1676 # -I${DLINCLDIR} is added to the compile rule for importdl.o
1680 AC_MSG_CHECKING(for --with-sgi-dl)
1682 AC_HELP_STRING(--with-sgi-dl=DIRECTORY, IRIX 4 dynamic linking),
1684 AC_MSG_RESULT($withval)
1685 echo --with-sgi-dl is unsupported, see README
1687 AC_DEFINE(WITH_SGI_DL, 1,
1688 [Define if you want to use SGI (IRIX 4) dynamic linking.
1689 This requires the "dl" library by Jack Jansen,
1690 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1691 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1692 style shared libraries])
1693 DYNLOADFILE="dynload_dl.o"
1695 if test ! -z "$dldir" -a -d "$dldir"
1696 then LDFLAGS="$LDFLAGS -L$dldir"
1697 else AC_MSG_ERROR([proper usage is --with-sgi-dl=DIRECTORY])
1700 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
1702 AC_MSG_CHECKING(for --with-dl-dld)
1704 AC_HELP_STRING(--with-dl-dld=DL_DIR, GNU dynamic linking),
1706 AC_MSG_RESULT($withval)
1707 echo --with-dl-dld is unsupported, see README
1709 AC_DEFINE(WITH_DL_DLD, 1,
1710 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1711 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1712 Sequent Symmetry (Dynix), and Atari ST.
1713 This requires the 'dl-dld' library,
1714 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1715 as well as the 'GNU dld' library,
1716 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1717 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1719 DYNLOADFILE="dynload_dl.o"
1720 dldir=`echo "$withval" | sed 's/,.*//'`
1721 dlddir=`echo "$withval" | sed 's/.*,//'`
1722 if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
1723 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
1724 else AC_MSG_ERROR([proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY])
1727 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
1729 # the dlopen() function means we might want to use dynload_shlib.o. some
1730 # platforms, such as AIX, have dlopen(), but don't want to use it.
1731 AC_CHECK_FUNCS(dlopen)
1733 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1734 # loading of modules.
1735 AC_SUBST(DYNLOADFILE)
1736 AC_MSG_CHECKING(DYNLOADFILE)
1737 if test -z "$DYNLOADFILE"
1739 case $ac_sys_system/$ac_sys_release in
1740 AIX*) DYNLOADFILE="dynload_aix.o";;
1741 BeOS*) DYNLOADFILE="dynload_beos.o";;
1742 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
1743 Darwin/*) DYNLOADFILE="dynload_next.o";;
1744 atheos*) DYNLOADFILE="dynload_atheos.o";;
1746 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1747 # out any dynamic loading
1748 if test "$ac_cv_func_dlopen" = yes
1749 then DYNLOADFILE="dynload_shlib.o"
1750 else DYNLOADFILE="dynload_stub.o"
1755 AC_MSG_RESULT($DYNLOADFILE)
1756 if test "$DYNLOADFILE" != "dynload_stub.o"
1758 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1759 [Defined when any dynamic module loading is enabled.])
1762 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
1764 AC_SUBST(MACHDEP_OBJS)
1765 AC_MSG_CHECKING(MACHDEP_OBJS)
1766 if test -z "$MACHDEP_OBJS"
1768 MACHDEP_OBJS=$extra_machdep_objs
1770 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
1772 AC_MSG_RESULT(MACHDEP_OBJS)
1774 # checks for library functions
1775 AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
1776 fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
1777 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
1778 getpriority getpwent getwd \
1779 hstrerror inet_pton kill killpg lchown lstat mkfifo mknod mktime \
1780 mremap nice pathconf pause plock poll pthread_init \
1782 select setegid seteuid setgid \
1783 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
1784 sigaction siginterrupt sigrelse strftime strptime \
1785 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
1786 truncate uname unsetenv utimes waitpid wcscoll _getpty)
1788 # For some functions, having a definition is not sufficient, since
1789 # we want to take their address.
1790 AC_MSG_CHECKING(for chroot)
1791 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
1792 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
1796 AC_MSG_CHECKING(for link)
1797 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
1798 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
1802 AC_MSG_CHECKING(for symlink)
1803 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
1804 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
1809 # On some systems (eg. FreeBSD 5), we would find a definition of the
1810 # functions ctermid_r, setgroups in the library, but no prototype
1811 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
1812 # address to avoid compiler warnings and potential miscompilations
1813 # because of the missing prototypes.
1815 AC_MSG_CHECKING(for ctermid_r)
1817 #include "confdefs.h"
1819 ], void* p = ctermid_r,
1820 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
1825 AC_MSG_CHECKING(for setgroups)
1827 #include "confdefs.h"
1828 #include <unistd.h.h>
1830 void* p = setgroups,
1831 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
1836 # check for openpty and forkpty
1838 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1839 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
1841 # check for long file support functions
1842 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1844 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
1845 AC_CHECK_FUNCS(getpgrp,
1846 AC_TRY_COMPILE([#include <unistd.h>],
1848 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1849 [Define if getpgrp() must be called as getpgrp(0).])
1852 AC_FUNC_SETPGRP(AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1853 [Define if setpgrp() must be called as setpgrp(0, 0).])
1855 AC_CHECK_FUNCS(gettimeofday,
1856 AC_TRY_COMPILE([#include <sys/time.h>],
1857 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1858 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1859 [Define if gettimeofday() does not have second (timezone) argument
1860 This is the case on Motorola V4 (R40V4.2)])
1864 AC_MSG_CHECKING(for major, minor, and makedev)
1866 #if defined(MAJOR_IN_MKDEV)
1867 #include <sys/mkdev.h>
1868 #elif defined(MAJOR_IN_SYSMACROS)
1869 #include <sys/sysmacros.h>
1871 #include <sys/types.h>
1874 makedev(major(0),minor(0));
1876 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
1877 [Define to 1 if you have the device macros.])
1883 # On OSF/1 V5.1, getaddrinfo is available, but a define
1884 # for [no]getaddrinfo in netdb.h.
1885 AC_MSG_CHECKING(for getaddrinfo)
1887 #include <sys/types.h>
1888 #include <sys/socket.h>
1892 getaddrinfo(NULL, NULL, NULL, NULL);
1895 AC_MSG_CHECKING(getaddrinfo bug)
1897 #include <sys/types.h>
1900 #include <sys/socket.h>
1901 #include <netinet/in.h>
1905 int passive, gaierr, inet4 = 0, inet6 = 0;
1906 struct addrinfo hints, *ai, *aitop;
1907 char straddr[INET6_ADDRSTRLEN], strport[16];
1909 for (passive = 0; passive <= 1; passive++) {
1910 memset(&hints, 0, sizeof(hints));
1911 hints.ai_family = AF_UNSPEC;
1912 hints.ai_flags = passive ? AI_PASSIVE : 0;
1913 hints.ai_socktype = SOCK_STREAM;
1914 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1915 (void)gai_strerror(gaierr);
1918 for (ai = aitop; ai; ai = ai->ai_next) {
1919 if (ai->ai_addr == NULL ||
1920 ai->ai_addrlen == 0 ||
1921 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1922 straddr, sizeof(straddr), strport, sizeof(strport),
1923 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1926 switch (ai->ai_family) {
1928 if (strcmp(strport, "54321") != 0) {
1932 if (strcmp(straddr, "0.0.0.0") != 0) {
1936 if (strcmp(straddr, "127.0.0.1") != 0) {
1943 if (strcmp(strport, "54321") != 0) {
1947 if (strcmp(straddr, "::") != 0) {
1951 if (strcmp(straddr, "::1") != 0) {
1961 /* another family support? */
1967 if (!(inet4 == 0 || inet4 == 2))
1969 if (!(inet6 == 0 || inet6 == 2))
1973 freeaddrinfo(aitop);
1978 freeaddrinfo(aitop);
1983 buggygetaddrinfo=no,
1984 AC_MSG_RESULT(buggy)
1985 buggygetaddrinfo=yes,
1986 AC_MSG_RESULT(buggy)
1987 buggygetaddrinfo=yes)], [
1989 buggygetaddrinfo=yes
1992 if test "$buggygetaddrinfo" = "yes"; then
1993 if test "$ipv6" = "yes"; then
1994 echo 'Fatal: You must get working getaddrinfo() function.'
1995 echo ' or you can specify "--disable-ipv6"'.
1999 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2001 AC_CHECK_FUNCS(getnameinfo)
2003 # checks for structures
2007 AC_CHECK_MEMBERS([struct stat.st_rdev])
2008 AC_CHECK_MEMBERS([struct stat.st_blksize])
2011 AC_MSG_CHECKING(for time.h that defines altzone)
2012 AC_CACHE_VAL(ac_cv_header_time_altzone,
2013 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2014 ac_cv_header_time_altzone=yes,
2015 ac_cv_header_time_altzone=no)])
2016 AC_MSG_RESULT($ac_cv_header_time_altzone)
2017 if test $ac_cv_header_time_altzone = yes; then
2018 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2022 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2024 #include <sys/types.h>
2025 #include <sys/select.h>
2026 #include <sys/time.h>
2028 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2029 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2030 (which you can't on SCO ODT 3.0).])
2033 AC_MSG_RESULT($was_it_defined)
2035 AC_MSG_CHECKING(for addrinfo)
2036 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2038 # include <netdb.h>],
2039 [struct addrinfo a],
2040 ac_cv_struct_addrinfo=yes,
2041 ac_cv_struct_addrinfo=no))
2042 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2043 if test $ac_cv_struct_addrinfo = yes; then
2044 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2047 AC_MSG_CHECKING(for sockaddr_storage)
2048 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2050 # include <sys/types.h>
2051 # include <sys/socket.h>],
2052 [struct sockaddr_storage s],
2053 ac_cv_struct_sockaddr_storage=yes,
2054 ac_cv_struct_sockaddr_storage=no))
2055 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2056 if test $ac_cv_struct_sockaddr_storage = yes; then
2057 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2060 # checks for compiler characteristics
2066 AC_MSG_CHECKING(for working volatile)
2067 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2068 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2070 AC_MSG_RESULT($works)
2073 AC_MSG_CHECKING(for working signed char)
2074 AC_TRY_COMPILE([], [signed char c;], works=yes,
2075 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2077 AC_MSG_RESULT($works)
2080 AC_MSG_CHECKING(for prototypes)
2081 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2082 AC_DEFINE(HAVE_PROTOTYPES, 1,
2083 [Define if your compiler supports function prototype])
2086 AC_MSG_RESULT($have_prototypes)
2089 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
2092 int foo(int x, ...) {
2100 ], [return foo(10, "", 3.14);], [
2101 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2102 [Define if your compiler supports variable length function prototypes
2103 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2106 AC_MSG_RESULT($works)
2108 if test "$have_prototypes" = yes; then
2110 AC_MSG_CHECKING(for bad exec* prototypes)
2111 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
2112 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
2113 [Define if your <unistd.h> contains bad prototypes for exec*()
2114 (as it does on SGI IRIX 4.x)])
2117 AC_MSG_RESULT($bad_prototypes)
2120 # check if sockaddr has sa_len member
2121 AC_MSG_CHECKING(if sockaddr has sa_len member)
2122 AC_TRY_COMPILE([#include <sys/types.h>
2123 #include <sys/socket.h>],
2127 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
2131 AC_MSG_CHECKING(whether va_list is an array)
2133 #ifdef HAVE_STDARG_PROTOTYPES
2136 #include <varargs.h>
2138 ], [va_list list1, list2; list1 = list2;], , [
2139 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2140 va_list_is_array=yes
2142 AC_MSG_RESULT($va_list_is_array)
2144 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
2145 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2146 [Define this if you have some version of gethostbyname_r()])
2148 AC_CHECK_FUNC(gethostbyname_r, [
2149 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2150 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2152 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2157 struct hostent *he, *res;
2162 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2164 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2165 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2166 [Define this if you have the 6-arg version of gethostbyname_r().])
2170 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2180 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2182 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2183 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2184 [Define this if you have the 5-arg version of gethostbyname_r().])
2188 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2194 struct hostent_data data;
2196 (void) gethostbyname_r(name, he, &data);
2198 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2199 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2200 [Define this if you have the 3-arg version of gethostbyname_r().])
2209 AC_CHECK_FUNCS(gethostbyname)
2211 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2212 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2213 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2214 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2215 AC_SUBST(HAVE_GETHOSTBYNAME)
2217 # checks for system services
2220 # Linux requires this for correct f.p. operations
2221 AC_CHECK_FUNC(__fpu_control,
2223 [AC_CHECK_LIB(ieee, __fpu_control)
2226 # Check for --with-fpectl
2227 AC_MSG_CHECKING(for --with-fpectl)
2229 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2231 if test "$withval" != no
2233 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2234 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2236 else AC_MSG_RESULT(no)
2238 [AC_MSG_RESULT(no)])
2240 # check for --with-libm=...
2242 case $ac_sys_system in
2247 AC_MSG_CHECKING(for --with-libm=STRING)
2249 AC_HELP_STRING(--with-libm=STRING, math library),
2251 if test "$withval" = no
2253 AC_MSG_RESULT(force LIBM empty)
2254 elif test "$withval" != yes
2256 AC_MSG_RESULT(set LIBM="$withval")
2257 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
2259 [AC_MSG_RESULT(default LIBM="$LIBM")])
2261 # check for --with-libc=...
2263 AC_MSG_CHECKING(for --with-libc=STRING)
2265 AC_HELP_STRING(--with-libc=STRING, C library),
2267 if test "$withval" = no
2269 AC_MSG_RESULT(force LIBC empty)
2270 elif test "$withval" != yes
2272 AC_MSG_RESULT(set LIBC="$withval")
2273 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
2275 [AC_MSG_RESULT(default LIBC="$LIBC")])
2277 # check for hypot() in math library
2280 AC_REPLACE_FUNCS(hypot)
2284 AC_CHECK_HEADER(wchar.h, [
2285 AC_DEFINE(HAVE_WCHAR_H, 1,
2286 [Define if the compiler provides a wchar.h header file.])
2292 # determine wchar_t size
2293 if test "$wchar_h" = yes
2295 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
2298 AC_MSG_CHECKING(what type to use for unicode)
2299 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2300 AC_ARG_ENABLE(unicode,
2301 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2303 [enable_unicode=yes])
2305 if test $enable_unicode = yes
2307 # Without any arguments, Py_UNICODE defaults to two-byte mode
2308 enable_unicode="ucs2"
2311 AH_TEMPLATE(Py_UNICODE_SIZE,
2312 [Define as the size of the unicode type.])
2313 case "$enable_unicode" in
2314 ucs2) unicode_size="2"
2315 AC_DEFINE(Py_UNICODE_SIZE,2)
2317 ucs4) unicode_size="4"
2318 AC_DEFINE(Py_UNICODE_SIZE,4)
2322 AH_TEMPLATE(PY_UNICODE_TYPE,
2323 [Define as the integral type used for Unicode representation.])
2325 AC_SUBST(UNICODE_OBJS)
2326 if test "$enable_unicode" = "no"
2329 AC_MSG_RESULT(not used)
2331 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
2332 AC_DEFINE(Py_USING_UNICODE, 1,
2333 [Define if you want to have a Unicode type.])
2334 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2336 PY_UNICODE_TYPE="wchar_t"
2337 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2338 [Define if you have a useable wchar_t type defined in wchar.h; useable
2339 means wchar_t must be 16-bit unsigned type. (see
2340 Include/unicodeobject.h).])
2341 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2342 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2344 PY_UNICODE_TYPE="unsigned short"
2345 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2346 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2348 PY_UNICODE_TYPE="unsigned long"
2349 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2351 PY_UNICODE_TYPE="no type found"
2353 AC_MSG_RESULT($PY_UNICODE_TYPE)
2356 # check for endianness
2359 # Check whether right shifting a negative integer extends the sign bit
2360 # or fills with zeros (like the Cray J90, according to Tim Peters).
2361 AC_MSG_CHECKING(whether right shift extends the sign bit)
2362 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
2366 exit(((-1)>>3 == -1) ? 0 : 1);
2369 ac_cv_rshift_extends_sign=yes,
2370 ac_cv_rshift_extends_sign=no,
2371 ac_cv_rshift_extends_sign=yes)])
2372 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2373 if test "$ac_cv_rshift_extends_sign" = no
2375 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2376 [Define if i>>j for signed int i does not extend the sign bit
2380 # check for getc_unlocked and related locking functions
2381 AC_MSG_CHECKING(for getc_unlocked() and friends)
2382 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2383 AC_TRY_LINK([#include <stdio.h>],[
2384 FILE *f = fopen("/dev/null", "r");
2388 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2389 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2390 if test "$ac_cv_have_getc_unlocked" = yes
2392 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2393 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
2396 # check for readline 2.2
2397 AC_TRY_CPP([#include <readline/readline.h>],
2398 have_readline=yes, have_readline=no)
2399 if test $have_readline = yes
2401 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2402 [readline/readline.h],
2403 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2404 [Define if you have readline 2.2]), )
2407 # check for readline 4.0
2408 AC_CHECK_LIB(readline, rl_pre_input_hook,
2409 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2410 [Define if you have readline 4.0]), , -ltermcap)
2412 # check for readline 4.2
2413 AC_CHECK_LIB(readline, rl_completion_matches,
2414 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2415 [Define if you have readline 4.2]), , -ltermcap)
2417 AC_MSG_CHECKING(for broken nice())
2418 AC_CACHE_VAL(ac_cv_broken_nice, [
2423 if (val1 != -1 && val1 == nice(2))
2428 ac_cv_broken_nice=yes,
2429 ac_cv_broken_nice=no,
2430 ac_cv_broken_nice=no)])
2431 AC_MSG_RESULT($ac_cv_broken_nice)
2432 if test "$ac_cv_broken_nice" = yes
2434 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2435 [Define if nice() returns success/failure instead of the new priority.])
2438 # Look for subsecond timestamps in struct stat
2439 AC_MSG_CHECKING(for tv_nsec in struct stat)
2440 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
2441 AC_TRY_COMPILE([#include <sys/stat.h>], [
2443 st.st_mtim.tv_nsec = 1;
2445 ac_cv_stat_tv_nsec=yes,
2446 ac_cv_stat_tv_nsec=no,
2447 ac_cv_stat_tv_nsec=no))
2448 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
2449 if test "$ac_cv_stat_tv_nsec" = yes
2451 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
2452 [Define if you have struct stat.st_mtim.tv_nsec])
2455 # On HP/UX 11.0, mvwdelch is a block with a return statement
2456 AC_MSG_CHECKING(whether mvwdelch is an expression)
2457 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2458 AC_TRY_COMPILE([#include <curses.h>], [
2460 rtn = mvwdelch(0,0,0);
2461 ], ac_cv_mvwdelch_is_expression=yes,
2462 ac_cv_mvwdelch_is_expression=no,
2463 ac_cv_mvwdelch_is_expression=yes))
2464 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2466 if test "$ac_cv_mvwdelch_is_expression" = yes
2468 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2469 [Define if mvwdelch in curses.h is an expression.])
2472 AC_MSG_CHECKING(whether WINDOW has _flags)
2473 AC_CACHE_VAL(ac_cv_window_has_flags,
2474 AC_TRY_COMPILE([#include <curses.h>], [
2477 ], ac_cv_window_has_flags=yes,
2478 ac_cv_window_has_flags=no,
2479 ac_cv_window_has_flags=no))
2480 AC_MSG_RESULT($ac_cv_window_has_flags)
2483 if test "$ac_cv_window_has_flags" = yes
2485 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2486 [Define if WINDOW in curses.h offers a field _flags.])
2489 AC_MSG_CHECKING(for /dev/ptmx)
2491 if test -e /dev/ptmx
2494 AC_DEFINE(HAVE_DEV_PTMX, 1,
2495 [Define if we have /dev/ptmx.])
2500 AC_CHECK_TYPE(socklen_t,,
2501 AC_DEFINE(socklen_t,int,
2502 Define to `int' if <sys/socket.h> does not define.),[
2503 #ifdef HAVE_SYS_TYPES_H
2504 #include <sys/types.h>
2506 #ifdef HAVE_SYS_SOCKET_H
2507 #include <sys/socket.h>
2511 AC_SUBST(THREADHEADERS)
2513 for h in `(cd $srcdir;echo Python/thread_*.h)`
2515 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2519 SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python"
2520 AC_MSG_CHECKING(for build directories)
2521 for dir in $SRCDIRS; do
2522 if test ! -d $dir; then
2528 # generate output files
2529 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
2532 echo "creating Setup"
2533 if test ! -f Modules/Setup
2535 cp $srcdir/Modules/Setup.dist Modules/Setup
2538 echo "creating Setup.local"
2539 if test ! -f Modules/Setup.local
2541 echo "# Edit this file for local setup changes" >Modules/Setup.local
2544 echo "creating Makefile"
2545 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2546 -s Modules Modules/Setup.config \
2547 Modules/Setup.local Modules/Setup