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 dnl This is for stuff that absolutely must end up in pyconfig.h.
13 dnl 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*/
27 # We don't use PACKAGE_ variables, and they cause conflicts
28 # with other autoconf-based packages that include Python.h
29 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
31 mv confdefs.h.new confdefs.h
34 VERSION=PYTHON_VERSION
39 # The later defininition of _XOPEN_SOURCE disables certain features
40 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
41 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
43 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
44 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
46 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
48 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
49 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
51 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
53 define_xopen_source=yes
55 # Arguments passed to configure.
57 CONFIG_ARGS="$ac_configure_args"
59 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
60 AC_ARG_ENABLE(framework,
61 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
65 enableval=/Library/Frameworks
70 PYTHONFRAMEWORKDIR=no-framework
71 PYTHONFRAMEWORKPREFIX=
72 PYTHONFRAMEWORKINSTALLDIR=
76 PYTHONFRAMEWORK=Python
77 PYTHONFRAMEWORKDIR=Python.framework
78 PYTHONFRAMEWORKPREFIX=$enableval
79 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
80 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
84 PYTHONFRAMEWORKDIR=no-framework
85 PYTHONFRAMEWORKPREFIX=
86 PYTHONFRAMEWORKINSTALLDIR=
89 AC_SUBST(PYTHONFRAMEWORK)
90 AC_SUBST(PYTHONFRAMEWORKDIR)
91 AC_SUBST(PYTHONFRAMEWORKPREFIX)
92 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
95 ## AC_HELP_STRING(--with-dyld,
96 ## Use (OpenStep|Rhapsody) dynamic linker))
98 # Set name for machine-dependent library files
100 AC_MSG_CHECKING(MACHDEP)
101 if test -z "$MACHDEP"
103 ac_sys_system=`uname -s`
104 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
105 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
106 ac_sys_release=`uname -v`
108 ac_sys_release=`uname -r`
110 ac_md_system=`echo $ac_sys_system |
111 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
112 ac_md_release=`echo $ac_sys_release |
113 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
114 MACHDEP="$ac_md_system$ac_md_release"
117 cygwin*) MACHDEP="cygwin";;
118 darwin*) MACHDEP="darwin";;
119 atheos*) MACHDEP="atheos";;
120 irix646) MACHDEP="irix6";;
121 '') MACHDEP="unknown";;
125 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
126 # disable features if it is defined, without any means to access these
127 # features as extensions. For these systems, we skip the definition of
128 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
129 # some feature, make sure there is no alternative way to access this
130 # feature. Also, when using wildcards, make sure you have verified the
131 # need for not defining _XOPEN_SOURCE on all systems matching the
132 # wildcard, and that the wildcard does not include future systems
133 # (which may remove their limitations).
134 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
135 case $ac_sys_system/$ac_sys_release in
136 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
137 # even though select is a POSIX function. Reported by J. Ribbens.
138 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
139 OpenBSD/2.* | OpenBSD/3.@<:@01234@:>@)
140 define_xopen_source=no;;
141 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
142 # of union __?sigval. Reported by Stuart Bishop.
144 define_xopen_source=no;;
145 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
146 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
147 # Reconfirmed for 7.1.4 by Martin v. Loewis.
148 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
149 define_xopen_source=no;;
150 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
151 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
153 define_xopen_source=no;;
154 # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that
155 # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently,
156 # this is fixed in 10.3, which identifies itself as Darwin/7.*
157 # This should hopefully be fixed in FreeBSD 4.9
158 FreeBSD/4.8* | Darwin/6* )
159 define_xopen_source=no;;
160 # On AIX 4, mbstate_t is defined only when _XOPEN_SOURCE == 500 but used in
161 # wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined or
162 # has another value. By not (re)defining it, the defaults come in place.
164 define_xopen_source=no;;
167 if test $define_xopen_source = yes
169 AC_DEFINE(_XOPEN_SOURCE, 600,
170 Define to the level of X/Open that your system supports)
172 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
173 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
174 # several APIs are not declared. Since this is also needed in some
175 # cases for HP-UX, we define it globally.
177 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Define to activate Unix95-and-earlier features)
178 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
183 # SGI compilers allow the specification of the both the ABI and the
184 # ISA on the command line. Depending on the values of these switches,
185 # different and often incompatable code will be generated.
187 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
188 # thus supply support for various ABI/ISA combinations. The MACHDEP
189 # variable is also adjusted.
192 if test ! -z "$SGI_ABI"
195 LDFLAGS="$SGI_ABI $LDFLAGS"
196 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
198 AC_MSG_RESULT($MACHDEP)
200 # And add extra plat-mac for darwin
201 AC_SUBST(EXTRAPLATDIR)
202 AC_SUBST(EXTRAMACHDEPPATH)
203 AC_MSG_CHECKING(EXTRAPLATDIR)
204 if test -z "$EXTRAPLATDIR"
208 EXTRAPLATDIR="\$(PLATMACDIRS)"
209 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
217 AC_MSG_RESULT($EXTRAPLATDIR)
219 # checks for alternative programs
221 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
222 # for debug/optimization stuff. BASECFLAGS is for flags that are required
223 # just to get things to compile and link. Users are free to override OPT
224 # when running configure or make. The build should not break if they do.
225 # BASECFLAGS should generally not be messed with, however.
227 # XXX shouldn't some/most/all of this code be merged with the stuff later
228 # on that fiddles with OPT and BASECFLAGS?
229 AC_MSG_CHECKING(for --without-gcc)
231 AC_HELP_STRING(--without-gcc,never use gcc),
239 without_gcc=$withval;;
241 case $ac_sys_system in
249 BASECFLAGS="$BASECFLAGS -export pragma"
251 LDFLAGS="$LDFLAGS -nodup"
259 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
262 AR="\$(srcdir)/Modules/ar_beos"
270 AC_MSG_RESULT($without_gcc)
275 AC_MSG_CHECKING(for --with-cxx=<compiler>)
277 AC_HELP_STRING(--with-cxx=<compiler>, enable C++ support),
290 AC_MSG_RESULT($with_cxx)
292 if test "$with_cxx" = "yes"
294 AC_MSG_ERROR([must supply a compiler when using --with-cxx])
297 dnl The following fragment works similar to AC_PROG_CXX.
298 dnl It does not fail if CXX is not found, and it is not executed if
299 dnl --without-cxx was given.
300 dnl Finally, it does not test whether CXX is g++.
302 dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
303 ifdef([AC_PROG_CXX_WORKS],[],
304 [AC_DEFUN([AC_PROG_CXX_WORKS],
305 [AC_LANG_PUSH(C++)dnl
311 if test "$check_cxx" = "yes"
313 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
314 if test "$CXX" = "notfound"
322 # If the user switches compilers, we can't believe the cache
323 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
325 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
326 (it is also a good idea to do 'make clean' before compiling)])
331 # checks for UNIX variants that set C preprocessor variables
335 # Check for unsupported systems
336 case $ac_sys_system/$ac_sys_release in
337 SunOS/4*|DYNIX/*|dgux*/*|IRIX/4*|Linux*/1*)
338 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
339 echo See README for details.
343 if test "$MINIX" = yes; then
344 echo This system \(MINIX\) is no longer supported.
345 echo Read README for details.
350 AC_MSG_CHECKING(for --with-suffix)
352 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
359 AC_MSG_RESULT($EXEEXT)
361 # Test whether we're running on a non-case-sensitive system, in which
362 # case we give a warning if no ext is given
363 AC_SUBST(BUILDEXEEXT)
364 AC_MSG_CHECKING(for case-insensitive build directory)
365 if test ! -d CaseSensitiveTestDir; then
366 mkdir CaseSensitiveTestDir
369 if test -d casesensitivetestdir
377 rmdir CaseSensitiveTestDir
382 gcc) CC="$CC -D_HAVE_BSDI";;
386 case $ac_sys_system in
389 cc|*/cc) CC="$CC -Ae";;
393 cc) CC="$CC -Wl,-Bexport";;
396 # Some functions have a prototype only with that define, e.g. confstr
397 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
403 AC_MSG_CHECKING(LIBRARY)
404 if test -z "$LIBRARY"
406 LIBRARY='libpython$(VERSION).a'
408 AC_MSG_RESULT($LIBRARY)
410 # LDLIBRARY is the name of the library to link against (as opposed to the
411 # name of the library into which to insert object files). BLDLIBRARY is also
412 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
413 # is blank as the main program is not linked directly against LDLIBRARY.
414 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
415 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
416 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
417 # DLLLIBRARY is the shared (i.e., DLL) library.
419 # RUNSHARED is used to run shared python without installed libraries
421 # INSTSONAME is the name of the shared library that will be use to install
422 # on the system - some systems like version suffix, others don't
426 AC_SUBST(LDLIBRARYDIR)
430 BLDLIBRARY='$(LDLIBRARY)'
431 INSTSONAME='$(LDLIBRARY)'
436 # LINKCC is the command that links the python executable -- default is $(CC).
437 # If CXX is set, and if it is needed to link a main function that was
438 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
439 # python might then depend on the C++ runtime
440 # This is altered for AIX in order to build the export list before
443 AC_MSG_CHECKING(LINKCC)
446 if test -z "$CXX"; then
447 LINKCC="\$(PURIFY) \$(CC)"
449 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
450 $CXX -c conftest.$ac_ext 2>&5
451 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
452 && test -s conftest$ac_exeext && ./conftest$ac_exeext
454 LINKCC="\$(PURIFY) \$(CC)"
456 LINKCC="\$(PURIFY) \$(CXX)"
460 case $ac_sys_system in
463 if test $ac_sys_release -ge 5 -o \
464 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
467 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
469 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
471 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
474 AC_MSG_RESULT($LINKCC)
476 AC_MSG_CHECKING(for --enable-shared)
477 AC_ARG_ENABLE(shared,
478 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
480 if test -z "$enable_shared"
482 case $ac_sys_system in
484 enable_shared="yes";;
489 AC_MSG_RESULT($enable_shared)
492 AC_MSG_CHECKING(LDLIBRARY)
494 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
495 # library that we build, but we do not want to link against it (we
496 # will find it with a -framework option). For this reason there is an
497 # extra variable BLDLIBRARY against which Python and the extension
498 # modules are linked, BLDLIBRARY. This is normally the same as
499 # LDLIBRARY, but empty for MacOSX framework builds.
500 if test "$enable_framework"
502 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
503 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
506 BLDLIBRARY='$(LDLIBRARY)'
509 # Other platforms follow
510 if test $enable_shared = "yes"; then
511 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
512 case $ac_sys_system in
514 LDLIBRARY='libpython$(VERSION).so'
517 LDLIBRARY='libpython$(VERSION).dll.a'
518 DLLLIBRARY='libpython$(VERSION).dll'
521 LDLIBRARY='libpython$(VERSION).so'
522 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
523 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
524 INSTSONAME="$LDLIBRARY".$SOVERSION
527 LDLIBRARY='libpython$(VERSION).so'
528 BLDLIBRARY='-L. -lpython$(VERSION)'
529 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
530 INSTSONAME="$LDLIBRARY".$SOVERSION
533 LDLIBRARY='libpython$(VERSION).sl'
534 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
535 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
538 LDLIBRARY='libpython$(VERSION).so'
539 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
540 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
543 LDLIBRARY='libpython$(VERSION).so'
544 BLDLIBRARY='-L. -lpython$(VERSION)'
545 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
548 # DG/UX requires some fancy ld contortions to produce a .so from an .a
551 LDLIBRARY='libpython$(VERSION).so'
552 BASECFLAGS="$BASECFLAGS -pic"
557 AC_MSG_RESULT($LDLIBRARY)
561 AC_CHECK_PROGS(AR, ar aal, ar)
565 # install -d does not work on BSDI or HP-UX
566 if test -z "$INSTALL"
568 INSTALL="${srcdir}/install-sh -c"
573 # Not every filesystem supports hard links
575 if test -z "$LN" ; then
576 case $ac_sys_system in
578 CYGWIN*) LN="ln -s";;
579 atheos*) LN="ln -s";;
584 # Check for --with-pydebug
585 AC_MSG_CHECKING(for --with-pydebug)
587 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
589 if test "$withval" != no
591 AC_DEFINE(Py_DEBUG, 1,
592 [Define if you want to build an interpreter with many run-time checks.])
595 else AC_MSG_RESULT(no); Py_DEBUG='false'
599 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
600 # merged with this chunk of code?
602 # Optimizer/debugger flags
603 # ------------------------
604 # (The following bit of code is complicated enough - please keep things
605 # indented properly. Just pretend you're editing Python code. ;-)
607 # There are two parallel sets of case statements below, one that checks to
608 # see if OPT was set and one that does BASECFLAGS setting based upon
609 # compiler and platform. BASECFLAGS tweaks need to be made even if the
612 # tweak OPT based on compiler and platform, only if the user didn't set
613 # it on the command line
619 case $ac_cv_prog_cc_g in
621 if test "$Py_DEBUG" = 'true' ; then
622 # Optimization messes up debuggers, so turn it off for
624 OPT="-g -Wall -Wstrict-prototypes"
626 OPT="-g -O3 -Wall -Wstrict-prototypes"
630 OPT="-O3 -Wall -Wstrict-prototypes"
633 case $ac_sys_system in
634 SCO_SV*) OPT="$OPT -m486 -DSCO5"
644 # The current (beta) Monterey compiler dies with optimizations
645 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
646 case $ac_sys_system in
655 # tweak BASECFLAGS based on compiler and platform
658 # Python violates C99 rules, by casting between incompatible
659 # pointer types. GCC may generate bad code as a result of that,
660 # so use -fno-strict-aliasing if supported.
661 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
663 CC="$CC -fno-strict-aliasing"
664 AC_TRY_RUN([int main() { return 0; }],
665 ac_cv_no_strict_aliasing_ok=yes,
666 ac_cv_no_strict_aliasing_ok=no,
667 ac_cv_no_strict_aliasing_ok=no)
669 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
670 if test $ac_cv_no_strict_aliasing_ok = yes
672 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
674 case $ac_sys_system in
676 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
678 # is there any other compiler on Darwin besides gcc?
680 BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
686 case $ac_sys_system in
688 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
691 BASECFLAGS="$BASECFLAGS -ieee -std"
694 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
700 if test "$Py_DEBUG" = 'true'; then
706 if test "$ac_arch_flags"
708 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
711 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
712 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
714 CC="$CC -OPT:Olimit=0"
715 AC_TRY_RUN([int main() { return 0; }],
716 ac_cv_opt_olimit_ok=yes,
717 ac_cv_opt_olimit_ok=no,
718 ac_cv_opt_olimit_ok=no)
720 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
721 if test $ac_cv_opt_olimit_ok = yes; then
722 case $ac_sys_system in
723 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
724 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
729 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
733 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
734 AC_CACHE_VAL(ac_cv_olimit_ok,
736 CC="$CC -Olimit 1500"
737 AC_TRY_RUN([int main() { return 0; }],
742 AC_MSG_RESULT($ac_cv_olimit_ok)
743 if test $ac_cv_olimit_ok = yes; then
744 BASECFLAGS="$BASECFLAGS -Olimit 1500"
748 # On some compilers, pthreads are available without further options
749 # (e.g. MacOS X). On some of these systems, the compiler will not
750 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
751 # So we have to see first whether pthreads are available without
752 # options before we can check whether -Kpthread improves anything.
753 AC_MSG_CHECKING(whether pthreads are available without options)
754 AC_CACHE_VAL(ac_cv_pthread_is_default,
758 void* routine(void* p){return NULL;}
762 if(pthread_create(&p,NULL,routine,NULL)!=0)
764 (void)pthread_detach(p);
769 ac_cv_pthread_is_default=yes
773 ac_cv_pthread_is_default=no,
774 ac_cv_pthread_is_default=no)
776 AC_MSG_RESULT($ac_cv_pthread_is_default)
779 if test $ac_cv_pthread_is_default = yes
783 # -Kpthread, if available, provides the right #defines
784 # and linker options to make pthread_create available
785 # Some compilers won't report that they do not support -Kpthread,
786 # so we need to run a program to see whether it really made the
787 # function available.
788 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
789 AC_CACHE_VAL(ac_cv_kpthread,
795 void* routine(void* p){return NULL;}
799 if(pthread_create(&p,NULL,routine,NULL)!=0)
801 (void)pthread_detach(p);
809 AC_MSG_RESULT($ac_cv_kpthread)
812 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
814 # -Kthread, if available, provides the right #defines
815 # and linker options to make pthread_create available
816 # Some compilers won't report that they do not support -Kthread,
817 # so we need to run a program to see whether it really made the
818 # function available.
819 AC_MSG_CHECKING(whether $CC accepts -Kthread)
820 AC_CACHE_VAL(ac_cv_kthread,
826 void* routine(void* p){return NULL;}
830 if(pthread_create(&p,NULL,routine,NULL)!=0)
832 (void)pthread_detach(p);
840 AC_MSG_RESULT($ac_cv_kthread)
843 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
845 # -pthread, if available, provides the right #defines
846 # and linker options to make pthread_create available
847 # Some compilers won't report that they do not support -pthread,
848 # so we need to run a program to see whether it really made the
849 # function available.
850 AC_MSG_CHECKING(whether $CC accepts -pthread)
851 AC_CACHE_VAL(ac_cv_thread,
857 void* routine(void* p){return NULL;}
861 if(pthread_create(&p,NULL,routine,NULL)!=0)
863 (void)pthread_detach(p);
871 AC_MSG_RESULT($ac_cv_pthread)
874 # If we have set a CC compiler flag for thread support then
875 # check if it works for CXX, too.
879 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
882 if test "$ac_cv_kpthread" = "yes"
886 elif test "$ac_cv_kthread" = "yes"
890 elif test "$ac_cv_pthread" = "yes"
896 if test $ac_cv_cxx_thread = yes
898 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
899 $CXX -c conftest.$ac_ext 2>&5
900 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
901 && test -s conftest$ac_exeext && ./conftest$ac_exeext
911 AC_MSG_RESULT($ac_cv_cxx_thread)
913 dnl # check for ANSI or K&R ("traditional") preprocessor
914 dnl AC_MSG_CHECKING(for C preprocessor type)
916 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
918 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
919 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
920 dnl AC_MSG_RESULT($cpp_type)
922 # checks for header files
924 AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
925 libintl.h locale.h ncurses.h poll.h pthread.h \
926 signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \
928 sys/audioio.h sys/bsdtty.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \
929 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
930 sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
931 sys/resource.h netpacket/packet.h sysexits.h)
935 # checks for typedefs
937 AC_MSG_CHECKING(for clock_t in time.h)
938 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
939 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
941 AC_MSG_RESULT($was_it_defined)
943 # Check whether using makedev requires defining _OSF_SOURCE
944 AC_MSG_CHECKING(for makedev)
945 AC_TRY_LINK([#include <sys/types.h> ],
947 ac_cv_has_makedev=yes,
948 ac_cv_has_makedev=no)
949 if test "$ac_cv_has_makedev" = "no"; then
950 # we didn't link, try if _OSF_SOURCE will allow us to link
952 #define _OSF_SOURCE 1
953 #include <sys/types.h>
956 ac_cv_has_makedev=yes,
957 ac_cv_has_makedev=no)
958 if test "$ac_cv_has_makedev" = "yes"; then
959 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
962 AC_MSG_RESULT($ac_cv_has_makedev)
963 if test "$ac_cv_has_makedev" = "yes"; then
964 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
967 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
968 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
969 # defined, but the compiler does not support pragma redefine_extname,
970 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
971 # structures (such as rlimit64) without declaring them. As a
972 # work-around, disable LFS on such configurations
975 AC_MSG_CHECKING(Solaris LFS bug)
977 #define _LARGEFILE_SOURCE 1
978 #define _FILE_OFFSET_BITS 64
979 #include <sys/resource.h>
980 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
981 AC_MSG_RESULT($sol_lfs_bug)
982 if test "$sol_lfs_bug" = "yes"; then
986 if test "$use_lfs" = "yes"; then
987 # Two defines needed to enable largefile support on various platforms
988 # These may affect some typedefs
989 AC_DEFINE(_LARGEFILE_SOURCE, 1,
990 [This must be defined on some systems to enable large file support.])
991 AC_DEFINE(_FILE_OFFSET_BITS, 64,
992 [This must be set to 64 on some systems to enable large file support.])
995 # Add some code to confdefs.h so that the test for off_t works on SCO
996 cat >> confdefs.h <<\EOF
1002 # Type availability checks
1010 # Sizes of various common basic types
1011 AC_CHECK_SIZEOF(int, 4)
1012 AC_CHECK_SIZEOF(long, 4)
1013 AC_CHECK_SIZEOF(void *, 4)
1014 AC_CHECK_SIZEOF(char, 1)
1015 AC_CHECK_SIZEOF(short, 2)
1016 AC_CHECK_SIZEOF(float, 4)
1017 AC_CHECK_SIZEOF(double, 8)
1018 AC_CHECK_SIZEOF(fpos_t, 4)
1020 AC_MSG_CHECKING(for long long support)
1022 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1023 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1026 AC_MSG_RESULT($have_long_long)
1027 if test "$have_long_long" = yes ; then
1028 AC_CHECK_SIZEOF(long long, 8)
1031 AC_MSG_CHECKING(for uintptr_t support)
1033 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
1034 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
1037 AC_MSG_RESULT($have_uintptr_t)
1038 if test "$have_uintptr_t" = yes ; then
1039 AC_CHECK_SIZEOF(uintptr_t, 4)
1042 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1043 AC_MSG_CHECKING(size of off_t)
1044 AC_CACHE_VAL(ac_cv_sizeof_off_t,
1045 [AC_TRY_RUN([#include <stdio.h>
1046 #include <sys/types.h>
1049 FILE *f=fopen("conftestval", "w");
1051 fprintf(f, "%d\n", sizeof(off_t));
1054 ac_cv_sizeof_off_t=`cat conftestval`,
1055 ac_cv_sizeof_off_t=0,
1056 ac_cv_sizeof_off_t=4)
1058 AC_MSG_RESULT($ac_cv_sizeof_off_t)
1059 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1060 [The number of bytes in an off_t.])
1062 AC_MSG_CHECKING(whether to enable large file support)
1063 if test "$have_long_long" = yes -a \
1064 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1065 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1066 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1067 [Defined to enable large file support when an off_t is bigger than a long
1068 and long long is available and at least as big as an off_t. You may need
1069 to add some flags for configuration and compilation to enable this mode.
1070 (For Solaris and Linux, the necessary defines are already defined.)])
1076 # AC_CHECK_SIZEOF() doesn't include <time.h>.
1077 AC_MSG_CHECKING(size of time_t)
1078 AC_CACHE_VAL(ac_cv_sizeof_time_t,
1079 [AC_TRY_RUN([#include <stdio.h>
1083 FILE *f=fopen("conftestval", "w");
1085 fprintf(f, "%d\n", sizeof(time_t));
1088 ac_cv_sizeof_time_t=`cat conftestval`,
1089 ac_cv_sizeof_time_t=0,
1090 ac_cv_sizeof_time_t=4)
1092 AC_MSG_RESULT($ac_cv_sizeof_time_t)
1093 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1094 [The number of bytes in a time_t.])
1097 # if have pthread_t then define SIZEOF_PTHREAD_T
1099 if test "$ac_cv_kpthread" = "yes"
1100 then CC="$CC -Kpthread"
1101 elif test "$ac_cv_kthread" = "yes"
1102 then CC="$CC -Kthread"
1103 elif test "$ac_cv_pthread" = "yes"
1104 then CC="$CC -pthread"
1106 AC_MSG_CHECKING(for pthread_t)
1108 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1109 AC_MSG_RESULT($have_pthread_t)
1110 if test "$have_pthread_t" = yes ; then
1111 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1112 AC_MSG_CHECKING(size of pthread_t)
1113 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1114 [AC_TRY_RUN([#include <stdio.h>
1115 #include <pthread.h>
1118 FILE *f=fopen("conftestval", "w");
1120 fprintf(f, "%d\n", sizeof(pthread_t));
1123 ac_cv_sizeof_pthread_t=`cat conftestval`,
1124 ac_cv_sizeof_pthread_t=0,
1125 ac_cv_sizeof_pthread_t=4)
1127 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
1128 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1129 [The number of bytes in a pthread_t.])
1133 AC_MSG_CHECKING(for --enable-toolbox-glue)
1134 AC_ARG_ENABLE(toolbox-glue,
1135 AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1137 if test -z "$enable_toolbox_glue"
1139 case $ac_sys_system/$ac_sys_release in
1141 enable_toolbox_glue="yes";;
1143 enable_toolbox_glue="no";;
1146 case "$enable_toolbox_glue" in
1148 extra_frameworks="-framework CoreServices -framework Foundation"
1149 extra_machdep_objs="Python/mactoolboxglue.o"
1150 extra_undefs="-u __dummy -u _PyMac_Error"
1151 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1152 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1156 extra_machdep_objs=""
1160 AC_MSG_RESULT($enable_toolbox_glue)
1162 AC_SUBST(LIBTOOL_CRUFT)
1163 case $ac_sys_system/$ac_sys_release in
1165 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
1166 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
1167 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python'
1168 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1170 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
1171 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
1172 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/Python'
1173 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1176 AC_MSG_CHECKING(for --enable-framework)
1177 if test "$enable_framework"
1179 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1180 # -F. is needed to allow linking to the framework while
1181 # in the build location.
1182 LDFLAGS="$LDFLAGS -Wl,-F."
1183 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1184 [Define if you want to produce an OpenStep/Rhapsody framework
1185 (shared library plus accessory files).])
1191 AC_MSG_CHECKING(for dyld)
1192 case $ac_sys_system/$ac_sys_release in
1194 AC_DEFINE(WITH_DYLD, 1,
1195 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1196 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1197 linker (rld). Dyld is necessary to support frameworks.])
1198 AC_MSG_RESULT(always on for Darwin)
1205 # Set info about shared libraries.
1210 AC_SUBST(LINKFORSHARED)
1211 # SO is the extension of shared libraries `(including the dot!)
1212 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1216 case $ac_sys_system in
1222 # this might also be a termcap variable, see #610332
1224 echo '====================================================================='
1226 echo '+ WARNING: You have set SO in your environment. +'
1227 echo '+ Do you really mean to change the extension for shared libraries? +'
1228 echo '+ Continuing in 10 seconds to let you to ponder. +'
1230 echo '====================================================================='
1234 # LDSHARED is the ld *command* used to create shared library
1235 # -- "ld" on SunOS 4.x.x, "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1236 # (Shared libraries in this instance are shared modules to be loaded into
1237 # Python, as opposed to building Python itself as a shared library.)
1238 AC_MSG_CHECKING(LDSHARED)
1239 if test -z "$LDSHARED"
1241 case $ac_sys_system/$ac_sys_release in
1243 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1244 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1247 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1248 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1250 IRIX/5*) LDSHARED="ld -shared";;
1251 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1252 SunOS/4*) LDSHARED="ld";;
1254 if test "$GCC" = "yes"
1255 then LDSHARED='$(CC) -shared'
1256 else LDSHARED='$(CC) -G';
1258 hp*|HP*) LDSHARED="ld -b";;
1259 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1260 DYNIX/ptx*) LDSHARED="ld -G";;
1262 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1263 if test "$enable_framework" ; then
1264 # Link against the framework. All externals should be defined.
1265 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1267 # No framework. Ignore undefined symbols, assuming they come from Python
1268 LDSHARED="$LDSHARED -undefined suppress"
1271 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1272 if test "$enable_framework" ; then
1273 # Link against the framework. All externals should be defined.
1274 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
1276 # No framework, use the Python app as bundle-loader
1277 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1278 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1280 Linux*|GNU*) LDSHARED='$(CC) -shared';;
1281 dgux*) LDSHARED="ld -G";;
1282 BSD/OS*/4*) LDSHARED="gcc -shared";;
1284 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1286 LDSHARED="cc -shared ${LDFLAGS}"
1288 LDSHARED="ld -Bshareable ${LDFLAGS}"
1290 NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
1291 OpenUNIX*|UnixWare*)
1292 if test "$GCC" = "yes"
1293 then LDSHARED='$(CC) -shared'
1294 else LDSHARED='$(CC) -G'
1296 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1297 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
1298 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1299 atheos*) LDSHARED="gcc -shared";;
1303 AC_MSG_RESULT($LDSHARED)
1304 BLDSHARED=${BLDSHARED-$LDSHARED}
1305 # CCSHARED are the C *flags* used to create objects to go into a shared
1306 # library (module) -- this is only needed for a few systems
1307 AC_MSG_CHECKING(CCSHARED)
1308 if test -z "$CCSHARED"
1310 case $ac_sys_system/$ac_sys_release in
1311 SunOS*) if test "$GCC" = yes;
1312 then CCSHARED="-fPIC";
1314 hp*|HP*) if test "$GCC" = yes;
1315 then CCSHARED="-fPIC";
1318 Linux*|GNU*) CCSHARED="-fPIC";;
1319 BSD/OS*/4*) CCSHARED="-fpic";;
1320 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
1321 OpenUNIX*|UnixWare*)
1322 if test "$GCC" = "yes"
1323 then CCSHARED="-fPIC"
1324 else CCSHARED="-KPIC"
1327 if test "$GCC" = "yes"
1328 then CCSHARED="-fPIC"
1329 else CCSHARED="-Kpic -belf"
1331 Monterey*) CCSHARED="-G";;
1332 IRIX*/6*) case $CC in
1333 *gcc*) CCSHARED="-shared";;
1336 atheos*) CCSHARED="-fPIC";;
1339 AC_MSG_RESULT($CCSHARED)
1340 # LINKFORSHARED are the flags passed to the $(CC) command that links
1341 # the python executable -- this is only needed for a few systems
1342 AC_MSG_CHECKING(LINKFORSHARED)
1343 if test -z "$LINKFORSHARED"
1345 case $ac_sys_system/$ac_sys_release in
1346 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1348 LINKFORSHARED="-Wl,-E -Wl,+s";;
1349 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1350 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1351 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1352 # -u libsys_s pulls in all symbols in libsys
1354 # -u __dummy makes the linker aware of the objc runtime
1355 # in System.framework; otherwise, __objcInit (referenced in
1356 # crt1.o) gets erroneously defined as common, which breaks dynamic
1357 # loading of any modules which reference it in System.framework.
1358 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
1359 # not used by the core itself but which needs to be in the core so
1360 # that dynamically loaded extension modules have access to it.
1361 # -prebind is no longer used, because it actually seems to give a
1362 # slowdown in stead of a speedup, maybe due to the large number of
1363 # dynamic loads Python does.
1364 LINKFORSHARED="$extra_undefs -framework System"
1365 if test "$enable_framework"
1367 LINKFORSHARED="$LINKFORSHARED -framework Python"
1369 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
1370 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1371 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1372 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1373 FreeBSD*|NetBSD*|OpenBSD*)
1374 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1376 LINKFORSHARED="-Wl,--export-dynamic"
1378 SunOS/5*) case $CC in
1380 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1382 LINKFORSHARED="-Xlinker --export-dynamic"
1387 AC_MSG_RESULT($LINKFORSHARED)
1389 AC_SUBST(CFLAGSFORSHARED)
1390 AC_MSG_CHECKING(CFLAGSFORSHARED)
1391 if test ! "$LIBRARY" = "$LDLIBRARY"
1393 case $ac_sys_system in
1395 # Cygwin needs CCSHARED when building extension DLLs
1396 # but not when building the interpreter DLL.
1397 CFLAGSFORSHARED='';;
1399 CFLAGSFORSHARED='$(CCSHARED)'
1402 AC_MSG_RESULT($CFLAGSFORSHARED)
1404 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1405 # library (with --enable-shared).
1406 # For platforms on which shared libraries are not allowed to have unresolved
1407 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1408 # if it is not required, since it creates a dependency of the shared library
1409 # to LIBS. This, in turn, means that applications linking the shared libpython
1410 # don't need to link LIBS explicitly. The default should be only changed
1411 # on systems where this approach causes problems.
1413 AC_MSG_CHECKING(SHLIBS)
1414 case "$ac_sys_system" in
1418 AC_MSG_RESULT($SHLIBS)
1421 # checks for libraries
1422 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1423 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1425 # only check for sem_ini if thread support is requested
1426 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1427 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1428 # posix4 on Solaris 2.6
1429 # pthread (first!) on Linux
1432 # check if we need libintl for locale functions
1433 AC_CHECK_LIB(intl, textdomain,
1434 AC_DEFINE(WITH_LIBINTL, 1,
1435 [Define to 1 if libintl is needed for locale functions.]))
1437 # checks for system dependent C++ extensions support
1438 case "$ac_sys_system" in
1439 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1440 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1441 [loadAndInit("", 0, "")],
1442 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1443 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1444 and you want support for AIX C++ shared extension modules.])
1445 AC_MSG_RESULT(yes)],
1446 [AC_MSG_RESULT(no)]);;
1450 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1451 # However on SGI IRIX 4, these exist but are broken.
1452 # BeOS' sockets are stashed in libnet.
1453 case "$ac_sys_system" in
1456 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1457 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1460 case "$ac_sys_system" in
1462 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1466 AC_MSG_CHECKING(for --with-libs)
1468 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1470 AC_MSG_RESULT($withval)
1471 LIBS="$withval $LIBS"
1473 [AC_MSG_RESULT(no)])
1475 # Determine if signalmodule should be used.
1476 AC_SUBST(USE_SIGNAL_MODULE)
1477 AC_SUBST(SIGNAL_OBJS)
1478 AC_MSG_CHECKING(for --with-signal-module)
1479 AC_ARG_WITH(signal-module,
1480 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1482 if test -z "$with_signal_module"
1483 then with_signal_module="yes"
1485 AC_MSG_RESULT($with_signal_module)
1487 if test "${with_signal_module}" = "yes"; then
1488 USE_SIGNAL_MODULE=""
1491 USE_SIGNAL_MODULE="#"
1492 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1495 # This is used to generate Setup.config
1496 AC_SUBST(USE_THREAD_MODULE)
1497 USE_THREAD_MODULE=""
1499 AC_MSG_CHECKING(for --with-dec-threads)
1501 AC_ARG_WITH(dec-threads,
1502 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1504 AC_MSG_RESULT($withval)
1506 if test "${with_thread+set}" != set; then
1507 with_thread="$withval";
1509 [AC_MSG_RESULT(no)])
1511 # Templates for things AC_DEFINEd more than once.
1512 # For a single AC_DEFINE, no template is needed.
1513 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1514 AH_TEMPLATE(_REENTRANT,
1515 [Define to force use of thread-safe errno, h_errno, and other functions])
1516 AH_TEMPLATE(WITH_THREAD,
1517 [Define if you want to compile in rudimentary thread support])
1519 AC_MSG_CHECKING(for --with-threads)
1520 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1521 AC_ARG_WITH(threads,
1522 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
1524 # --with-thread is deprecated, but check for it anyway
1525 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
1527 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
1528 [with_threads=$with_thread])
1530 if test -z "$with_threads"
1531 then with_threads="yes"
1533 AC_MSG_RESULT($with_threads)
1536 if test "$with_threads" = "no"
1538 USE_THREAD_MODULE="#"
1539 elif test "$ac_cv_pthread_is_default" = yes
1541 AC_DEFINE(WITH_THREAD)
1542 # Defining _REENTRANT on system with POSIX threads should not hurt.
1543 AC_DEFINE(_REENTRANT)
1545 THREADOBJ="Python/thread.o"
1546 elif test "$ac_cv_kpthread" = "yes"
1549 if test "$ac_cv_cxx_thread" = "yes"; then
1550 CXX="$CXX -Kpthread"
1552 AC_DEFINE(WITH_THREAD)
1554 THREADOBJ="Python/thread.o"
1555 elif test "$ac_cv_kthread" = "yes"
1558 if test "$ac_cv_cxx_thread" = "yes"; then
1561 AC_DEFINE(WITH_THREAD)
1563 THREADOBJ="Python/thread.o"
1564 elif test "$ac_cv_pthread" = "yes"
1567 if test "$ac_cv_cxx_thread" = "yes"; then
1570 AC_DEFINE(WITH_THREAD)
1572 THREADOBJ="Python/thread.o"
1574 if test ! -z "$with_threads" -a -d "$with_threads"
1575 then LDFLAGS="$LDFLAGS -L$with_threads"
1577 if test ! -z "$withval" -a -d "$withval"
1578 then LDFLAGS="$LDFLAGS -L$withval"
1581 # According to the POSIX spec, a pthreads implementation must
1582 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1583 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1587 #ifdef _POSIX_THREADS
1590 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1591 AC_MSG_RESULT($unistd_defines_pthreads)
1593 AC_DEFINE(_REENTRANT)
1594 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1595 AC_DEFINE(C_THREADS)
1596 AC_DEFINE(HURD_C_THREADS, 1,
1597 [Define if you are using Mach cthreads directly under /include])
1598 LIBS="$LIBS -lthreads"
1599 THREADOBJ="Python/thread.o"],[
1600 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1601 AC_DEFINE(C_THREADS)
1602 AC_DEFINE(MACH_C_THREADS, 1,
1603 [Define if you are using Mach cthreads under mach /])
1604 THREADOBJ="Python/thread.o"],[
1605 AC_MSG_CHECKING(for --with-pth)
1607 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
1608 [AC_MSG_RESULT($withval)
1609 AC_DEFINE([WITH_THREAD])
1610 AC_DEFINE([HAVE_PTH], 1,
1611 [Define if you have GNU PTH threads.])
1613 THREADOBJ="Python/thread.o"],
1616 # Just looking for pthread_create in libpthread is not enough:
1617 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1618 # So we really have to include pthread.h, and then link.
1620 LIBS="$LIBS -lpthread"
1621 AC_MSG_CHECKING([for pthread_create in -lpthread])
1622 AC_TRY_LINK([#include <pthread.h>
1624 void * start_routine (void *arg) { exit (0); }], [
1625 pthread_create (NULL, NULL, start_routine, NULL)], [
1627 AC_DEFINE(WITH_THREAD)
1629 THREADOBJ="Python/thread.o"],[
1631 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1633 THREADOBJ="Python/thread.o"],[
1634 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1635 AC_DEFINE(ATHEOS_THREADS, 1,
1636 [Define this if you have AtheOS threads.])
1637 THREADOBJ="Python/thread.o"],[
1638 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1639 AC_DEFINE(BEOS_THREADS, 1,
1640 [Define this if you have BeOS threads.])
1641 THREADOBJ="Python/thread.o"],[
1642 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1644 LIBS="$LIBS -lpthreads"
1645 THREADOBJ="Python/thread.o"], [
1646 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1649 THREADOBJ="Python/thread.o"], [
1650 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1651 echo Systems with __d6_pthread_create are not supported anymore.
1655 LIBS="$LIBS -lthread"
1656 THREADOBJ="Python/thread.o"], [
1657 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1659 LIBS="$LIBS -lpthread"
1660 THREADOBJ="Python/thread.o"], [
1661 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1664 THREADOBJ="Python/thread.o"],[
1665 USE_THREAD_MODULE="#"])
1666 ])])])])])])])])])])])
1668 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1670 THREADOBJ="Python/thread.o"
1671 USE_THREAD_MODULE=""])
1673 if test "$posix_threads" != "yes"; then
1674 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1675 LIBS="$LIBS -lthread"
1676 THREADOBJ="Python/thread.o"
1677 USE_THREAD_MODULE=""])
1680 if test "$USE_THREAD_MODULE" != "#"
1682 # If the above checks didn't disable threads, (at least) OSF1
1683 # needs this '-threads' argument during linking.
1684 case $ac_sys_system in
1685 OSF1) LDLAST=-threads;;
1690 if test "$posix_threads" = "yes"; then
1691 if test "$unistd_defines_pthreads" = "no"; then
1692 AC_DEFINE(_POSIX_THREADS, 1,
1693 [Define if you have POSIX threads,
1694 and your system does not define that.])
1697 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
1698 case $ac_sys_system/$ac_sys_release in
1699 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1700 Defined for Solaris 2.6 bug in pthread header.)
1702 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
1703 Define if the Posix semaphores do not work on your system)
1707 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1708 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1709 [AC_TRY_RUN([#include <pthread.h>
1710 void *foo(void *parm) {
1714 pthread_attr_t attr;
1716 if (pthread_attr_init(&attr)) exit(-1);
1717 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1718 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1721 ac_cv_pthread_system_supported=yes,
1722 ac_cv_pthread_system_supported=no,
1723 ac_cv_pthread_system_supported=no)
1725 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1726 if test "$ac_cv_pthread_system_supported" = "yes"; then
1727 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
1729 AC_CHECK_FUNCS(pthread_sigmask,
1730 [case $ac_sys_system in
1732 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
1733 [Define if pthread_sigmask() does not work on your system.])
1739 # Check for enable-ipv6
1740 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1741 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1743 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1744 --disable-ipv6 Disable ipv6 support],
1745 [ case "$enableval" in
1750 *) AC_MSG_RESULT(yes)
1751 AC_DEFINE(ENABLE_IPV6)
1757 dnl the check does not work on cross compilation case...
1758 AC_TRY_RUN([ /* AF_INET6 available check */
1759 #include <sys/types.h>
1760 #include <sys/socket.h>
1763 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1777 if test "$ipv6" = "yes"; then
1778 AC_MSG_CHECKING(if RFC2553 API is available)
1779 AC_TRY_COMPILE([#include <sys/types.h>
1780 #include <netinet/in.h>],
1781 [struct sockaddr_in6 x;
1785 AC_MSG_RESULT(no, IPv6 disabled)
1789 if test "$ipv6" = "yes"; then
1790 AC_DEFINE(ENABLE_IPV6)
1798 if test "$ipv6" = "yes"; then
1799 AC_MSG_CHECKING([ipv6 stack type])
1800 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1804 dnl http://www.kame.net/
1806 #include <netinet/in.h>
1807 #ifdef IPV6_INRIA_VERSION
1813 dnl http://www.kame.net/
1815 #include <netinet/in.h>
1821 ipv6libdir=/usr/local/v6/lib
1825 dnl http://www.v6.linux.or.jp/
1827 #include <features.h>
1828 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1835 dnl http://www.v6.linux.or.jp/
1836 if test -d /usr/inet6; then
1839 ipv6libdir=/usr/inet6/lib
1840 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
1844 if test -f /etc/netconfig; then
1845 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1853 #include <sys/param.h>
1854 #ifdef _TOSHIBA_INET6
1859 ipv6libdir=/usr/local/v6/lib])
1863 #include </usr/local/v6/include/sys/v6config.h>
1869 ipv6libdir=/usr/local/v6/lib;
1870 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
1874 #include <sys/param.h>
1875 #ifdef _ZETA_MINAMI_INET6
1880 ipv6libdir=/usr/local/v6/lib])
1883 if test "$ipv6type" != "unknown"; then
1887 AC_MSG_RESULT($ipv6type)
1890 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1891 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1892 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1893 echo "using lib$ipv6lib"
1895 if test $ipv6trylibc = "yes"; then
1898 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1899 echo "You need to fetch lib$ipv6lib.a from appropriate"
1900 echo 'ipv6 kit and compile beforehand.'
1906 # Check for universal newline support
1907 AC_MSG_CHECKING(for --with-universal-newlines)
1908 AC_ARG_WITH(universal-newlines,
1909 AC_HELP_STRING(--with(out)-universal-newlines, disable/enable foreign newlines))
1911 if test -z "$with_universal_newlines"
1912 then with_universal_newlines="yes"
1914 if test "$with_universal_newlines" = "no"
1916 echo --without-universal-newlines is unsupported, see README
1919 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1920 [Define if you want to read files with foreign newlines.])
1922 AC_MSG_RESULT($with_universal_newlines)
1924 # Check for --with-doc-strings
1925 AC_MSG_CHECKING(for --with-doc-strings)
1926 AC_ARG_WITH(doc-strings,
1927 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
1929 if test -z "$with_doc_strings"
1930 then with_doc_strings="yes"
1932 if test "$with_doc_strings" != "no"
1934 AC_DEFINE(WITH_DOC_STRINGS, 1,
1935 [Define if you want documentation strings in extension modules])
1937 AC_MSG_RESULT($with_doc_strings)
1939 # Check for Python-specific malloc support
1940 AC_MSG_CHECKING(for --with-pymalloc)
1941 AC_ARG_WITH(pymalloc,
1942 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
1944 if test -z "$with_pymalloc"
1945 then with_pymalloc="yes"
1947 if test "$with_pymalloc" != "no"
1949 AC_DEFINE(WITH_PYMALLOC, 1,
1950 [Define if you want to compile in Python-specific mallocs])
1952 AC_MSG_RESULT($with_pymalloc)
1954 # Check for --with-wctype-functions
1955 AC_MSG_CHECKING(for --with-wctype-functions)
1956 AC_ARG_WITH(wctype-functions,
1957 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
1959 if test "$withval" != no
1961 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1962 [Define if you want wctype.h functions to be used instead of the
1963 one supplied by Python itself. (see Include/unicodectype.h).])
1965 else AC_MSG_RESULT(no)
1967 [AC_MSG_RESULT(no)])
1969 # -I${DLINCLDIR} is added to the compile rule for importdl.o
1973 AC_MSG_CHECKING(for --with-sgi-dl)
1975 AC_HELP_STRING(--with-sgi-dl=DIRECTORY, IRIX 4 dynamic linking),
1977 AC_MSG_RESULT($withval)
1978 echo --with-sgi-dl is unsupported, see README
1980 AC_DEFINE(WITH_SGI_DL, 1,
1981 [Define if you want to use SGI (IRIX 4) dynamic linking.
1982 This requires the "dl" library by Jack Jansen,
1983 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1984 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1985 style shared libraries])
1986 DYNLOADFILE="dynload_dl.o"
1988 if test ! -z "$dldir" -a -d "$dldir"
1989 then LDFLAGS="$LDFLAGS -L$dldir"
1990 else AC_MSG_ERROR([proper usage is --with-sgi-dl=DIRECTORY])
1993 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
1995 AC_MSG_CHECKING(for --with-dl-dld)
1997 AC_HELP_STRING(--with-dl-dld=DL_DIR, GNU dynamic linking),
1999 AC_MSG_RESULT($withval)
2000 echo --with-dl-dld is unsupported, see README
2002 AC_DEFINE(WITH_DL_DLD, 1,
2003 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
2004 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
2005 Sequent Symmetry (Dynix), and Atari ST.
2006 This requires the 'dl-dld' library,
2007 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
2008 as well as the 'GNU dld' library,
2009 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
2010 Do not bother on SunOS 4 or 5, they already have dynamic linking using
2012 DYNLOADFILE="dynload_dl.o"
2013 dldir=`echo "$withval" | sed 's/,.*//'`
2014 dlddir=`echo "$withval" | sed 's/.*,//'`
2015 if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
2016 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
2017 else AC_MSG_ERROR([proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY])
2020 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
2022 # the dlopen() function means we might want to use dynload_shlib.o. some
2023 # platforms, such as AIX, have dlopen(), but don't want to use it.
2024 AC_CHECK_FUNCS(dlopen)
2026 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2027 # loading of modules.
2028 AC_SUBST(DYNLOADFILE)
2029 AC_MSG_CHECKING(DYNLOADFILE)
2030 if test -z "$DYNLOADFILE"
2032 case $ac_sys_system/$ac_sys_release in
2033 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2034 if test "$ac_cv_func_dlopen" = yes
2035 then DYNLOADFILE="dynload_shlib.o"
2036 else DYNLOADFILE="dynload_aix.o"
2039 BeOS*) DYNLOADFILE="dynload_beos.o";;
2040 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2041 Darwin/*) DYNLOADFILE="dynload_next.o";;
2042 atheos*) DYNLOADFILE="dynload_atheos.o";;
2044 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2045 # out any dynamic loading
2046 if test "$ac_cv_func_dlopen" = yes
2047 then DYNLOADFILE="dynload_shlib.o"
2048 else DYNLOADFILE="dynload_stub.o"
2053 AC_MSG_RESULT($DYNLOADFILE)
2054 if test "$DYNLOADFILE" != "dynload_stub.o"
2056 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2057 [Defined when any dynamic module loading is enabled.])
2060 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2062 AC_SUBST(MACHDEP_OBJS)
2063 AC_MSG_CHECKING(MACHDEP_OBJS)
2064 if test -z "$MACHDEP_OBJS"
2066 MACHDEP_OBJS=$extra_machdep_objs
2068 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2070 AC_MSG_RESULT(MACHDEP_OBJS)
2072 # checks for library functions
2073 AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
2074 fork fpathconf ftime ftruncate \
2075 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2076 getpriority getpwent getwd \
2077 kill killpg lchown lstat mkfifo mknod mktime \
2078 mremap nice pathconf pause plock poll pthread_init \
2079 putenv readlink realpath \
2080 select setegid seteuid setgid \
2081 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2082 sigaction siginterrupt sigrelse strftime strptime \
2083 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2084 truncate uname unsetenv utimes waitpid wcscoll _getpty)
2086 # For some functions, having a definition is not sufficient, since
2087 # we want to take their address.
2088 AC_MSG_CHECKING(for chroot)
2089 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2090 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2094 AC_MSG_CHECKING(for link)
2095 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2096 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2100 AC_MSG_CHECKING(for symlink)
2101 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2102 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2106 AC_MSG_CHECKING(for fchdir)
2107 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2108 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2112 AC_MSG_CHECKING(for fsync)
2113 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2114 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2118 AC_MSG_CHECKING(for fdatasync)
2119 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2120 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2125 # On some systems (eg. FreeBSD 5), we would find a definition of the
2126 # functions ctermid_r, setgroups in the library, but no prototype
2127 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2128 # address to avoid compiler warnings and potential miscompilations
2129 # because of the missing prototypes.
2131 AC_MSG_CHECKING(for ctermid_r)
2133 #include "confdefs.h"
2135 ], void* p = ctermid_r,
2136 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2141 AC_MSG_CHECKING(for flock)
2143 #include "confdefs.h"
2144 #include <sys/file.h>
2146 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2151 AC_MSG_CHECKING(for getpagesize)
2153 #include "confdefs.h"
2155 ], void* p = getpagesize,
2156 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2162 AC_CHECK_PROGS(TRUE, true, /bin/true)
2164 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2165 dnl On others, they are in the C library, so we to take no action
2166 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2167 AC_CHECK_LIB(resolv, inet_aton)
2170 AC_MSG_CHECKING(for hstrerror)
2172 #include "confdefs.h"
2174 ], void* p = hstrerror; hstrerror(0),
2175 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2180 AC_MSG_CHECKING(for inet_aton)
2182 #include "confdefs.h"
2183 #include <sys/socket.h>
2184 #include <netinet/in.h>
2185 #include <arpa/inet.h>
2186 ], void* p = inet_aton;inet_aton(0,0),
2187 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2192 AC_MSG_CHECKING(for inet_pton)
2194 #include "confdefs.h"
2195 #include <sys/types.h>
2196 #include <sys/socket.h>
2197 #include <netinet/in.h>
2198 #include <arpa/inet.h>
2199 ], void* p = inet_pton,
2200 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2205 # On some systems, setgroups is in unistd.h, on others, in grp.h
2206 AC_MSG_CHECKING(for setgroups)
2208 #include "confdefs.h"
2214 void* p = setgroups,
2215 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2220 # check for openpty and forkpty
2222 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
2223 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
2225 # check for long file support functions
2226 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2228 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
2229 AC_CHECK_FUNCS(getpgrp,
2230 AC_TRY_COMPILE([#include <unistd.h>],
2232 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2233 [Define if getpgrp() must be called as getpgrp(0).])
2236 AC_CHECK_FUNCS(setpgrp,
2237 AC_TRY_COMPILE([#include <unistd.h>],
2239 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2240 [Define if setpgrp() must be called as setpgrp(0, 0).])
2243 AC_CHECK_FUNCS(gettimeofday,
2244 AC_TRY_COMPILE([#include <sys/time.h>],
2245 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2246 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2247 [Define if gettimeofday() does not have second (timezone) argument
2248 This is the case on Motorola V4 (R40V4.2)])
2252 AC_MSG_CHECKING(for major, minor, and makedev)
2254 #if defined(MAJOR_IN_MKDEV)
2255 #include <sys/mkdev.h>
2256 #elif defined(MAJOR_IN_SYSMACROS)
2257 #include <sys/sysmacros.h>
2259 #include <sys/types.h>
2262 makedev(major(0),minor(0));
2264 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2265 [Define to 1 if you have the device macros.])
2271 # On OSF/1 V5.1, getaddrinfo is available, but a define
2272 # for [no]getaddrinfo in netdb.h.
2273 AC_MSG_CHECKING(for getaddrinfo)
2275 #include <sys/types.h>
2276 #include <sys/socket.h>
2280 getaddrinfo(NULL, NULL, NULL, NULL);
2283 AC_MSG_CHECKING(getaddrinfo bug)
2285 #include <sys/types.h>
2288 #include <sys/socket.h>
2289 #include <netinet/in.h>
2293 int passive, gaierr, inet4 = 0, inet6 = 0;
2294 struct addrinfo hints, *ai, *aitop;
2295 char straddr[INET6_ADDRSTRLEN], strport[16];
2297 for (passive = 0; passive <= 1; passive++) {
2298 memset(&hints, 0, sizeof(hints));
2299 hints.ai_family = AF_UNSPEC;
2300 hints.ai_flags = passive ? AI_PASSIVE : 0;
2301 hints.ai_socktype = SOCK_STREAM;
2302 hints.ai_protocol = IPPROTO_TCP;
2303 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2304 (void)gai_strerror(gaierr);
2307 for (ai = aitop; ai; ai = ai->ai_next) {
2308 if (ai->ai_addr == NULL ||
2309 ai->ai_addrlen == 0 ||
2310 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2311 straddr, sizeof(straddr), strport, sizeof(strport),
2312 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2315 switch (ai->ai_family) {
2317 if (strcmp(strport, "54321") != 0) {
2321 if (strcmp(straddr, "0.0.0.0") != 0) {
2325 if (strcmp(straddr, "127.0.0.1") != 0) {
2332 if (strcmp(strport, "54321") != 0) {
2336 if (strcmp(straddr, "::") != 0) {
2340 if (strcmp(straddr, "::1") != 0) {
2350 /* another family support? */
2356 if (!(inet4 == 0 || inet4 == 2))
2358 if (!(inet6 == 0 || inet6 == 2))
2362 freeaddrinfo(aitop);
2367 freeaddrinfo(aitop);
2372 buggygetaddrinfo=no,
2373 AC_MSG_RESULT(buggy)
2374 buggygetaddrinfo=yes,
2375 AC_MSG_RESULT(buggy)
2376 buggygetaddrinfo=yes)], [
2378 buggygetaddrinfo=yes
2381 if test "$buggygetaddrinfo" = "yes"; then
2382 if test "$ipv6" = "yes"; then
2383 echo 'Fatal: You must get working getaddrinfo() function.'
2384 echo ' or you can specify "--disable-ipv6"'.
2388 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2390 AC_CHECK_FUNCS(getnameinfo)
2392 # checks for structures
2396 AC_CHECK_MEMBERS([struct stat.st_rdev])
2397 AC_CHECK_MEMBERS([struct stat.st_blksize])
2400 AC_MSG_CHECKING(for time.h that defines altzone)
2401 AC_CACHE_VAL(ac_cv_header_time_altzone,
2402 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2403 ac_cv_header_time_altzone=yes,
2404 ac_cv_header_time_altzone=no)])
2405 AC_MSG_RESULT($ac_cv_header_time_altzone)
2406 if test $ac_cv_header_time_altzone = yes; then
2407 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2411 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2413 #include <sys/types.h>
2414 #include <sys/select.h>
2415 #include <sys/time.h>
2417 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2418 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2419 (which you can't on SCO ODT 3.0).])
2422 AC_MSG_RESULT($was_it_defined)
2424 AC_MSG_CHECKING(for addrinfo)
2425 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2427 # include <netdb.h>],
2428 [struct addrinfo a],
2429 ac_cv_struct_addrinfo=yes,
2430 ac_cv_struct_addrinfo=no))
2431 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2432 if test $ac_cv_struct_addrinfo = yes; then
2433 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2436 AC_MSG_CHECKING(for sockaddr_storage)
2437 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2439 # include <sys/types.h>
2440 # include <sys/socket.h>],
2441 [struct sockaddr_storage s],
2442 ac_cv_struct_sockaddr_storage=yes,
2443 ac_cv_struct_sockaddr_storage=no))
2444 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2445 if test $ac_cv_struct_sockaddr_storage = yes; then
2446 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2449 # checks for compiler characteristics
2455 AC_MSG_CHECKING(for working volatile)
2456 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2457 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2459 AC_MSG_RESULT($works)
2462 AC_MSG_CHECKING(for working signed char)
2463 AC_TRY_COMPILE([], [signed char c;], works=yes,
2464 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
2466 AC_MSG_RESULT($works)
2469 AC_MSG_CHECKING(for prototypes)
2470 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
2471 AC_DEFINE(HAVE_PROTOTYPES, 1,
2472 [Define if your compiler supports function prototype])
2475 AC_MSG_RESULT($have_prototypes)
2478 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
2481 int foo(int x, ...) {
2489 ], [return foo(10, "", 3.14);], [
2490 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
2491 [Define if your compiler supports variable length function prototypes
2492 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
2495 AC_MSG_RESULT($works)
2497 if test "$have_prototypes" = yes; then
2499 AC_MSG_CHECKING(for bad exec* prototypes)
2500 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
2501 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
2502 [Define if your <unistd.h> contains bad prototypes for exec*()
2503 (as it does on SGI IRIX 4.x)])
2506 AC_MSG_RESULT($bad_prototypes)
2509 # check if sockaddr has sa_len member
2510 AC_MSG_CHECKING(if sockaddr has sa_len member)
2511 AC_TRY_COMPILE([#include <sys/types.h>
2512 #include <sys/socket.h>],
2516 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
2520 AC_MSG_CHECKING(whether va_list is an array)
2522 #ifdef HAVE_STDARG_PROTOTYPES
2525 #include <varargs.h>
2527 ], [va_list list1, list2; list1 = list2;], , [
2528 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
2529 va_list_is_array=yes
2531 AC_MSG_RESULT($va_list_is_array)
2533 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
2534 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
2535 [Define this if you have some version of gethostbyname_r()])
2537 AC_CHECK_FUNC(gethostbyname_r, [
2538 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2539 AC_MSG_CHECKING([gethostbyname_r with 6 args])
2541 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
2546 struct hostent *he, *res;
2551 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2553 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2554 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2555 [Define this if you have the 6-arg version of gethostbyname_r().])
2559 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2569 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2571 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2572 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2573 [Define this if you have the 5-arg version of gethostbyname_r().])
2577 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2583 struct hostent_data data;
2585 (void) gethostbyname_r(name, he, &data);
2587 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2588 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2589 [Define this if you have the 3-arg version of gethostbyname_r().])
2598 AC_CHECK_FUNCS(gethostbyname)
2600 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2601 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2602 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2603 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2604 AC_SUBST(HAVE_GETHOSTBYNAME)
2606 # checks for system services
2609 # Linux requires this for correct f.p. operations
2610 AC_CHECK_FUNC(__fpu_control,
2612 [AC_CHECK_LIB(ieee, __fpu_control)
2615 # Check for --with-fpectl
2616 AC_MSG_CHECKING(for --with-fpectl)
2618 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
2620 if test "$withval" != no
2622 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2623 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2625 else AC_MSG_RESULT(no)
2627 [AC_MSG_RESULT(no)])
2629 # check for --with-libm=...
2631 case $ac_sys_system in
2636 AC_MSG_CHECKING(for --with-libm=STRING)
2638 AC_HELP_STRING(--with-libm=STRING, math library),
2640 if test "$withval" = no
2642 AC_MSG_RESULT(force LIBM empty)
2643 elif test "$withval" != yes
2645 AC_MSG_RESULT(set LIBM="$withval")
2646 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
2648 [AC_MSG_RESULT(default LIBM="$LIBM")])
2650 # check for --with-libc=...
2652 AC_MSG_CHECKING(for --with-libc=STRING)
2654 AC_HELP_STRING(--with-libc=STRING, C library),
2656 if test "$withval" = no
2658 AC_MSG_RESULT(force LIBC empty)
2659 elif test "$withval" != yes
2661 AC_MSG_RESULT(set LIBC="$withval")
2662 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
2664 [AC_MSG_RESULT(default LIBC="$LIBC")])
2666 # check for hypot() in math library
2669 AC_REPLACE_FUNCS(hypot)
2673 AC_CHECK_HEADER(wchar.h, [
2674 AC_DEFINE(HAVE_WCHAR_H, 1,
2675 [Define if the compiler provides a wchar.h header file.])
2681 # determine wchar_t size
2682 if test "$wchar_h" = yes
2684 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
2687 AC_MSG_CHECKING(for UCS-4 tcl)
2691 #if TCL_UTF_MAX != 6
2692 # error "NOT UCS4_TCL"
2694 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
2697 AC_MSG_RESULT($have_ucs4_tcl)
2699 AC_MSG_CHECKING(what type to use for unicode)
2700 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2701 AC_ARG_ENABLE(unicode,
2702 AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
2704 [enable_unicode=yes])
2706 if test $enable_unicode = yes
2708 # Without any arguments, Py_UNICODE defaults to two-byte mode
2709 case "$have_ucs4_tcl" in
2710 yes) enable_unicode="ucs4"
2712 *) enable_unicode="ucs2"
2717 AH_TEMPLATE(Py_UNICODE_SIZE,
2718 [Define as the size of the unicode type.])
2719 case "$enable_unicode" in
2720 ucs2) unicode_size="2"
2721 AC_DEFINE(Py_UNICODE_SIZE,2)
2723 ucs4) unicode_size="4"
2724 AC_DEFINE(Py_UNICODE_SIZE,4)
2728 AH_TEMPLATE(PY_UNICODE_TYPE,
2729 [Define as the integral type used for Unicode representation.])
2731 AC_SUBST(UNICODE_OBJS)
2732 if test "$enable_unicode" = "no"
2735 AC_MSG_RESULT(not used)
2737 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
2738 AC_DEFINE(Py_USING_UNICODE, 1,
2739 [Define if you want to have a Unicode type.])
2740 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2742 PY_UNICODE_TYPE="wchar_t"
2743 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2744 [Define if you have a useable wchar_t type defined in wchar.h; useable
2745 means wchar_t must be 16-bit unsigned type. (see
2746 Include/unicodeobject.h).])
2747 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2748 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2750 PY_UNICODE_TYPE="unsigned short"
2751 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2752 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2754 PY_UNICODE_TYPE="unsigned long"
2755 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2757 PY_UNICODE_TYPE="no type found"
2759 AC_MSG_RESULT($PY_UNICODE_TYPE)
2762 # check for endianness
2765 # Check whether right shifting a negative integer extends the sign bit
2766 # or fills with zeros (like the Cray J90, according to Tim Peters).
2767 AC_MSG_CHECKING(whether right shift extends the sign bit)
2768 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
2772 exit(((-1)>>3 == -1) ? 0 : 1);
2775 ac_cv_rshift_extends_sign=yes,
2776 ac_cv_rshift_extends_sign=no,
2777 ac_cv_rshift_extends_sign=yes)])
2778 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2779 if test "$ac_cv_rshift_extends_sign" = no
2781 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2782 [Define if i>>j for signed int i does not extend the sign bit
2786 # check for getc_unlocked and related locking functions
2787 AC_MSG_CHECKING(for getc_unlocked() and friends)
2788 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2789 AC_TRY_LINK([#include <stdio.h>],[
2790 FILE *f = fopen("/dev/null", "r");
2794 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2795 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2796 if test "$ac_cv_have_getc_unlocked" = yes
2798 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2799 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
2802 # check for readline 2.2
2803 AC_TRY_CPP([#include <readline/readline.h>],
2804 have_readline=yes, have_readline=no)
2805 if test $have_readline = yes
2807 AC_EGREP_HEADER([extern int rl_completion_append_character;],
2808 [readline/readline.h],
2809 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
2810 [Define if you have readline 2.2]), )
2813 # check for readline 4.0
2814 AC_CHECK_LIB(readline, rl_pre_input_hook,
2815 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2816 [Define if you have readline 4.0]), , -ltermcap)
2818 # check for readline 4.2
2819 AC_CHECK_LIB(readline, rl_completion_matches,
2820 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2821 [Define if you have readline 4.2]), , -ltermcap)
2823 AC_MSG_CHECKING(for broken nice())
2824 AC_CACHE_VAL(ac_cv_broken_nice, [
2829 if (val1 != -1 && val1 == nice(2))
2834 ac_cv_broken_nice=yes,
2835 ac_cv_broken_nice=no,
2836 ac_cv_broken_nice=no)])
2837 AC_MSG_RESULT($ac_cv_broken_nice)
2838 if test "$ac_cv_broken_nice" = yes
2840 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2841 [Define if nice() returns success/failure instead of the new priority.])
2844 AC_MSG_CHECKING(for broken poll())
2850 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
2854 int poll_test = poll (&poll_struct, 1, 0);
2860 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
2870 ac_cv_broken_poll=yes,
2871 ac_cv_broken_poll=no,
2872 ac_cv_broken_poll=no)
2873 AC_MSG_RESULT($ac_cv_broken_poll)
2874 if test "$ac_cv_broken_poll" = yes
2876 AC_DEFINE(HAVE_BROKEN_POLL, 1,
2877 [Define if poll() sets errno on invalid file descriptors.])
2881 # tzset(3) exists and works like we expect it to
2882 AC_MSG_CHECKING(for working tzset())
2883 AC_CACHE_VAL(ac_cv_working_tzset, [
2890 /* Note that we need to ensure that not only does tzset(3)
2891 do 'something' with localtime, but it works as documented
2892 in the library reference and as expected by the test suite.
2894 Linux 6.2 doesn't understand the southern hemisphere
2895 after New Year's Day.
2898 time_t groundhogday = 1044144000; /* GMT-based, well, it's a colony */
2899 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
2903 if (localtime(&groundhogday)->tm_hour != 0)
2906 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
2908 if (localtime(&groundhogday)->tm_hour != 19)
2911 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
2913 if (localtime(&groundhogday)->tm_hour != 11)
2915 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
2917 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
2923 ac_cv_working_tzset=yes,
2924 ac_cv_working_tzset=no,
2925 ac_cv_working_tzset=no)])
2926 AC_MSG_RESULT($ac_cv_working_tzset)
2927 if test "$ac_cv_working_tzset" = yes
2929 AC_DEFINE(HAVE_WORKING_TZSET, 1,
2930 [Define if tzset() actually switches the local timezone in a meaningful way.])
2933 # Look for subsecond timestamps in struct stat
2934 AC_MSG_CHECKING(for tv_nsec in struct stat)
2935 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
2936 AC_TRY_COMPILE([#include <sys/stat.h>], [
2938 st.st_mtim.tv_nsec = 1;
2940 ac_cv_stat_tv_nsec=yes,
2941 ac_cv_stat_tv_nsec=no,
2942 ac_cv_stat_tv_nsec=no))
2943 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
2944 if test "$ac_cv_stat_tv_nsec" = yes
2946 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
2947 [Define if you have struct stat.st_mtim.tv_nsec])
2950 # On HP/UX 11.0, mvwdelch is a block with a return statement
2951 AC_MSG_CHECKING(whether mvwdelch is an expression)
2952 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2953 AC_TRY_COMPILE([#include <curses.h>], [
2955 rtn = mvwdelch(0,0,0);
2956 ], ac_cv_mvwdelch_is_expression=yes,
2957 ac_cv_mvwdelch_is_expression=no,
2958 ac_cv_mvwdelch_is_expression=yes))
2959 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2961 if test "$ac_cv_mvwdelch_is_expression" = yes
2963 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2964 [Define if mvwdelch in curses.h is an expression.])
2967 AC_MSG_CHECKING(whether WINDOW has _flags)
2968 AC_CACHE_VAL(ac_cv_window_has_flags,
2969 AC_TRY_COMPILE([#include <curses.h>], [
2972 ], ac_cv_window_has_flags=yes,
2973 ac_cv_window_has_flags=no,
2974 ac_cv_window_has_flags=no))
2975 AC_MSG_RESULT($ac_cv_window_has_flags)
2978 if test "$ac_cv_window_has_flags" = yes
2980 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2981 [Define if WINDOW in curses.h offers a field _flags.])
2984 AC_MSG_CHECKING(for /dev/ptmx)
2986 if test -e /dev/ptmx
2989 AC_DEFINE(HAVE_DEV_PTMX, 1,
2990 [Define if we have /dev/ptmx.])
2995 AC_MSG_CHECKING(for /dev/ptc)
3000 AC_DEFINE(HAVE_DEV_PTC, 1,
3001 [Define if we have /dev/ptc.])
3006 AC_CHECK_TYPE(socklen_t,,
3007 AC_DEFINE(socklen_t,int,
3008 Define to `int' if <sys/socket.h> does not define.),[
3009 #ifdef HAVE_SYS_TYPES_H
3010 #include <sys/types.h>
3012 #ifdef HAVE_SYS_SOCKET_H
3013 #include <sys/socket.h>
3017 AC_SUBST(THREADHEADERS)
3019 for h in `(cd $srcdir;echo Python/thread_*.h)`
3021 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
3025 SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python"
3026 AC_MSG_CHECKING(for build directories)
3027 for dir in $SRCDIRS; do
3028 if test ! -d $dir; then
3034 # generate output files
3035 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config)
3038 echo "creating Setup"
3039 if test ! -f Modules/Setup
3041 cp $srcdir/Modules/Setup.dist Modules/Setup
3044 echo "creating Setup.local"
3045 if test ! -f Modules/Setup.local
3047 echo "# Edit this file for local setup changes" >Modules/Setup.local
3050 echo "creating Makefile"
3051 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
3052 -s Modules Modules/Setup.config \
3053 Modules/Setup.local Modules/Setup