1 dnl Process this file with autoconf 2.0 or later to make a configure script.
2 AC_REVISION($Revision$)
4 AC_INIT(Include/object.h)
5 AC_CONFIG_HEADER(pyconfig.h)
7 # This is for stuff that absolutely must end up in pyconfig.h.
8 # Please use pyport.h instead, if possible.
10 /* Define the macros needed if on a UnixWare 7.x system. */
11 #if defined(__USLC__) && defined(__SCO_VERSION__)
12 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
16 # Set VERSION so we only need to edit in one place (i.e., here)
23 # The later defininition of _XOPEN_SOURCE disables certain features
24 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
25 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
27 # The definition of _GNU_SOURCE potentially causes a change of the value
28 # of _XOPEN_SOURCE. So define it only conditionally.
29 AH_VERBATIM([_XOPEN_SOURCE],
30 [/* Define on UNIX to activate XPG/5 features. */
32 # define _XOPEN_SOURCE 500
34 AC_DEFINE(_XOPEN_SOURCE, 500)
36 # Arguments passed to configure.
38 CONFIG_ARGS="$ac_configure_args"
41 AC_ARG_ENABLE(framework,
42 [ --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework],[
45 enableval=/Library/Frameworks
50 PYTHONFRAMEWORKDIR=no-framework
51 PYTHONFRAMEWORKPREFIX=
52 PYTHONFRAMEWORKINSTALLDIR=
56 PYTHONFRAMEWORK=Python
57 PYTHONFRAMEWORKDIR=Python.framework
58 PYTHONFRAMEWORKPREFIX=$enableval
59 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
60 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
64 PYTHONFRAMEWORKDIR=no-framework
65 PYTHONFRAMEWORKPREFIX=
66 PYTHONFRAMEWORKINSTALLDIR=
69 AC_SUBST(PYTHONFRAMEWORK)
70 AC_SUBST(PYTHONFRAMEWORKDIR)
71 AC_SUBST(PYTHONFRAMEWORKPREFIX)
72 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
75 ##[ --with-dyld Use (OpenStep|Rhapsody) dynamic linker],,)
77 # Set name for machine-dependent library files
79 AC_MSG_CHECKING(MACHDEP)
82 ac_sys_system=`uname -s`
83 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
84 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
85 ac_sys_release=`uname -v`
87 ac_sys_release=`uname -r`
89 ac_md_system=`echo $ac_sys_system |
90 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
91 ac_md_release=`echo $ac_sys_release |
92 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
93 MACHDEP="$ac_md_system$ac_md_release"
96 cygwin*) MACHDEP="cygwin";;
97 darwin*) MACHDEP="darwin";;
98 atheos*) MACHDEP="atheos";;
99 '') MACHDEP="unknown";;
104 # SGI compilers allow the specification of the both the ABI and the
105 # ISA on the command line. Depending on the values of these switches,
106 # different and often incompatable code will be generated.
108 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
109 # thus supply support for various ABI/ISA combinations. The MACHDEP
110 # variable is also adjusted.
113 if test ! -z "$SGI_ABI"
116 LDFLAGS="$SGI_ABI $LDFLAGS"
117 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
119 AC_MSG_RESULT($MACHDEP)
121 # checks for alternative programs
122 AC_MSG_CHECKING(for --without-gcc)
123 AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [
130 without_gcc=$withval;;
132 case $ac_sys_system in
140 OPT="-O -export pragma"
141 LDFLAGS="$LDFLAGS -nodup"
149 AC_ERROR(Unknown BeOS platform \"$BE_HOST_CPU\")
152 AR="\$(srcdir)/Modules/ar_beos"
160 AC_MSG_RESULT($without_gcc)
165 AC_MSG_CHECKING(for --with-cxx=<compiler>)
166 AC_ARG_WITH(cxx, [ --with-cxx=<compiler> enable C++ support],[
178 AC_MSG_RESULT($with_cxx)
180 if test "$with_cxx" = "yes"
182 AC_ERROR(must supply a compiler when using --with-cxx)
185 dnl The following fragment works similar to AC_PROG_CXX.
186 dnl It does not fail if CXX is not found, and it is not executed if
187 dnl --without-cxx was given.
188 dnl Finally, it does not test whether CXX is g++.
190 dnl Autoconf 2.5x does not have AC_PROG_CXX_WORKS anymore
191 ifdef([AC_PROG_CXX_WORKS],[],
192 [AC_DEFUN([AC_PROG_CXX_WORKS],
193 [AC_LANG_PUSH(C++)dnl
199 if test "$check_cxx" = "yes"
201 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
202 if test "$CXX" = "notfound"
210 # If the user switches compilers, we can't believe the cache
211 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
213 AC_ERROR(cached CC is different -- throw away $cache_file
214 (it is also a good idea to do 'make clean' before compiling))
219 # checks for UNIX variants that set C preprocessor variables
224 AC_MSG_CHECKING(for --with-suffix)
225 AC_ARG_WITH(suffix, [ --with-suffix=.exe set executable suffix],[
231 AC_MSG_RESULT($EXEEXT)
233 # Test whether we're running on a non-case-sensitive system, in which
234 # case we give a warning if no ext is given
235 AC_SUBST(BUILDEXEEXT)
236 AC_MSG_CHECKING(for case-insensitive build directory)
237 if test -d "${srcdir}/python"
249 gcc) CC="$CC -D_HAVE_BSDI";;
253 case $ac_sys_system in
256 cc|*/cc) CC="$CC -Ae";;
260 cc) CC="$CC -Wl,-Bexport";;
263 # Some functions have a prototype only with that define, e.g. confstr
264 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
270 AC_MSG_CHECKING(LIBRARY)
271 if test -z "$LIBRARY"
273 LIBRARY='libpython$(VERSION).a'
275 AC_MSG_RESULT($LIBRARY)
277 # LDLIBRARY is the name of the library to link against (as opposed to the
278 # name of the library into which to insert object files). BLDLIBRARY is also
279 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
280 # is blank as the main program is not linked directly against LDLIBRARY.
281 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
282 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
283 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
284 # DLLLIBRARY is the shared (i.e., DLL) library.
286 # RUNSHARED is used to run shared python without installed libraries
288 # INSTSONAME is the name of the shared library that will be use to install
289 # on the system - some systems like version suffix, others don't
293 AC_SUBST(LDLIBRARYDIR)
297 BLDLIBRARY='$(LDLIBRARY)'
298 INSTSONAME='$(LDLIBRARY)'
303 # LINKCC is the command that links the python executable -- default is $(CC).
304 # If CXX is set, and if it is needed to link a main function that was
305 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
306 # python might then depend on the C++ runtime
307 # This is altered for AIX in order to build the export list before
310 AC_MSG_CHECKING(LINKCC)
313 if test -z "$CXX"; then
314 LINKCC="\$(PURIFY) \$(CC)"
316 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
317 $CXX -c conftest.$ac_ext 2>&5
318 if $CC -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
319 && test -s conftest$ac_exeext && ./conftest$ac_exeext
321 LINKCC="\$(PURIFY) \$(CC)"
323 LINKCC="\$(PURIFY) \$(CXX)"
327 case $ac_sys_system in
329 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp \"\" \$(LIBRARY); $LINKCC";;
331 LINKCC="LD_RUN_PATH=$libdir $LINKCC";;
333 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
336 AC_MSG_RESULT($LINKCC)
338 AC_MSG_CHECKING(for --enable-shared)
339 AC_ARG_ENABLE(shared,
340 [ --enable-shared disable/enable building shared python library])
342 if test -z "$enable_shared"
344 case $ac_sys_system in
346 enable_shared="yes";;
351 AC_MSG_RESULT($enable_shared)
354 AC_MSG_CHECKING(LDLIBRARY)
356 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
357 # library that we build, but we do not want to link against it (we
358 # will find it with a -framework option). For this reason there is an
359 # extra variable BLDLIBRARY against which Python and the extension
360 # modules are linked, BLDLIBRARY. This is normally the same as
361 # LDLIBRARY, but empty for MacOSX framework builds.
362 if test "$enable_framework"
364 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
365 LDLIBRARYDIR='$(PYTHONFRAMEWORKDIR)'
368 BLDLIBRARY='$(LDLIBRARY)'
371 # Other platforms follow
372 if test $enable_shared = "yes"; then
373 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
374 case $ac_sys_system in
376 LDLIBRARY='libpython$(VERSION).so'
379 LDLIBRARY='libpython$(VERSION).dll.a'
380 DLLLIBRARY='libpython$(VERSION).dll'
383 LDLIBRARY='libpython$(VERSION).so'
384 BLDLIBRARY='-Wl,-rpath,$(LIBDIR) -L. -lpython$(VERSION)'
385 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
388 LDLIBRARY='libpython$(VERSION).so'
389 BLDLIBRARY='-L. -lpython$(VERSION)'
390 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
391 INSTSONAME="$LDLIBRARY".$SOVERSION
394 LDLIBRARY='libpython$(VERSION).sl'
395 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
396 RUNSHARED=SHLIB_PATH=`pwd`:$SHLIB_PATH
399 LDLIBRARY='libpython$(VERSION).so'
400 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
401 RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
404 LDLIBRARY='libpython$(VERSION).so'
405 BLDLIBRARY='-L. -lpython$(VERSION)'
406 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
409 # DG/UX requires some fancy ld contortions to produce a .so from an .a
412 LDLIBRARY='libpython$(VERSION).so'
418 AC_MSG_RESULT($LDLIBRARY)
422 AC_CHECK_PROGS(AR, ar aal, ar)
426 # install -d does not work on BSDI or HP-UX
427 if test -z "$INSTALL"
429 INSTALL="${srcdir}/install-sh -c"
434 # Not every filesystem supports hard links
436 if test -z "$LN" ; then
437 case $ac_sys_system in
439 CYGWIN*) LN="ln -s";;
440 atheos*) LN="ln -s";;
445 # Check for --with-pydebug
446 AC_MSG_CHECKING(for --with-pydebug)
448 [ --with-pydebug build with Py_DEBUG defined], [
449 if test "$withval" != no
451 AC_DEFINE(Py_DEBUG, 1,
452 [Define if you want to build an interpreter with many run-time checks.])
455 else AC_MSG_RESULT(no); Py_DEBUG='false'
459 # Optimizer/debugger flags
465 case $ac_cv_prog_cc_g in
467 if test "$Py_DEBUG" = 'true' ; then
468 # Optimization messes up debuggers, so turn it off for
470 OPT="-g -Wall -Wstrict-prototypes"
472 OPT="-g -O3 -Wall -Wstrict-prototypes"
475 OPT="-O3 -Wall -Wstrict-prototypes";;
477 case $ac_sys_system in
478 SCO_SV*) OPT="$OPT -m486 -DSCO5";;
482 case $ac_sys_system in
484 OPT="-O -K pentium,host,inline,loop_unroll,alloca ";;
486 CFLAGS="$CFLAGS -belf"
487 OPT="-belf -O -Ki486 -DSCO5";;
492 case $ac_sys_system in
494 OPT="$OPT -Wno-long-double -no-cpp-precomp";;
498 if test "$Py_DEBUG" = 'true'; then
504 # The current (beta) Monterey compiler dies with optimizations
505 case $ac_sys_system in
509 if test "$ac_arch_flags"
511 OPT="$OPT $ac_arch_flags"
514 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
515 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
517 CC="$CC -OPT:Olimit=0"
518 AC_TRY_RUN([int main() { return 0; }],
519 ac_cv_opt_olimit_ok=yes,
520 ac_cv_opt_olimit_ok=no,
521 ac_cv_opt_olimit_ok=no)
523 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
524 if test $ac_cv_opt_olimit_ok = yes; then
525 case $ac_sys_system in
526 Darwin*) OPT="$OPT" ;;
527 *) OPT="$OPT -OPT:Olimit=0";;
530 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
531 AC_CACHE_VAL(ac_cv_olimit_ok,
533 CC="$CC -Olimit 1500"
534 AC_TRY_RUN([int main() { return 0; }],
539 AC_MSG_RESULT($ac_cv_olimit_ok)
540 if test $ac_cv_olimit_ok = yes; then
541 OPT="$OPT -Olimit 1500"
545 # On some compilers, pthreads are available without further options
546 # (e.g. MacOS X). On some of these systems, the compiler will not
547 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
548 # So we have to see first whether pthreads are available without
549 # options before we can check whether -Kpthread improves anything.
550 AC_MSG_CHECKING(whether pthreads are available without options)
551 AC_CACHE_VAL(ac_cv_pthread_is_default,
555 void* routine(void* p){return NULL;}
559 if(pthread_create(&p,NULL,routine,NULL)!=0)
561 (void)pthread_detach(p);
565 ac_cv_pthread_is_default=yes,
566 ac_cv_pthread_is_default=no,
567 ac_cv_pthread_is_default=no)
569 AC_MSG_RESULT($ac_cv_pthread_is_default)
572 if test $ac_cv_pthread_is_default = yes
576 # -Kpthread, if available, provides the right #defines
577 # and linker options to make pthread_create available
578 # Some compilers won't report that they do not support -Kpthread,
579 # so we need to run a program to see whether it really made the
580 # function available.
581 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
582 AC_CACHE_VAL(ac_cv_kpthread,
588 void* routine(void* p){return NULL;}
592 if(pthread_create(&p,NULL,routine,NULL)!=0)
594 (void)pthread_detach(p);
602 AC_MSG_RESULT($ac_cv_kpthread)
605 dnl # check for ANSI or K&R ("traditional") preprocessor
606 dnl AC_MSG_CHECKING(for C preprocessor type)
608 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
610 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
611 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
612 dnl AC_MSG_RESULT($cpp_type)
614 # checks for header files
616 AC_CHECK_HEADERS(dlfcn.h fcntl.h grp.h limits.h langinfo.h \
617 libintl.h locale.h ncurses.h poll.h pthread.h \
618 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \
619 sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \
620 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \
621 sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \
622 sys/resource.h netpacket/packet.h)
625 # checks for typedefs
627 AC_MSG_CHECKING(for clock_t in time.h)
628 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
629 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
631 AC_MSG_RESULT($was_it_defined)
633 # Check whether using makedev requires defining _OSF_SOURCE
634 AC_MSG_CHECKING(for makedev)
635 AC_TRY_LINK([ #include <sys/types.h> ],
637 ac_cv_has_makedev=yes,
638 ac_cv_has_makedev=no)
639 if test "$ac_cv_has_makedev" = "no"; then
640 # we didn't link, try if _OSF_SOURCE will allow us to link
642 #define _OSF_SOURCE 1
643 #include <sys/types.h>
646 ac_cv_has_makedev=yes,
647 ac_cv_has_makedev=no)
648 if test "$ac_cv_has_makedev" = "yes"; then
649 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
652 AC_MSG_RESULT($ac_cv_has_makedev)
653 if test "$ac_cv_has_makedev" = "yes"; then
654 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
657 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
658 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
659 # defined, but the compiler does not support pragma redefine_extname,
660 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
661 # structures (such as rlimit64) without declaring them. As a
662 # work-around, disable LFS on such configurations
665 AC_MSG_CHECKING(Solaris LFS bug)
667 #define _LARGEFILE_SOURCE 1
668 #define _FILE_OFFSET_BITS 64
669 #include <sys/resource.h>
670 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
671 AC_MSG_RESULT($sol_lfs_bug)
672 if test "$sol_lfs_bug" = "yes"; then
676 if test "$use_lfs" = "yes"; then
677 # Two defines needed to enable largefile support on various platforms
678 # These may affect some typedefs
679 AC_DEFINE(_LARGEFILE_SOURCE, 1,
680 [This must be defined on some systems to enable large file support.])
681 AC_DEFINE(_FILE_OFFSET_BITS, 64,
682 [This must be set to 64 on some systems to enable large file support.])
685 # Add some code to confdefs.h so that the test for off_t works on SCO
686 cat >> confdefs.h <<\EOF
692 # Type availability checks
700 # Sizes of various common basic types
701 AC_CHECK_SIZEOF(int, 4)
702 AC_CHECK_SIZEOF(long, 4)
703 AC_CHECK_SIZEOF(void *, 4)
704 AC_CHECK_SIZEOF(char, 1)
705 AC_CHECK_SIZEOF(short, 2)
706 AC_CHECK_SIZEOF(float, 4)
707 AC_CHECK_SIZEOF(double, 8)
708 AC_CHECK_SIZEOF(fpos_t, 4)
710 AC_MSG_CHECKING(for long long support)
712 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
713 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
716 AC_MSG_RESULT($have_long_long)
717 if test "$have_long_long" = yes ; then
718 AC_CHECK_SIZEOF(long long, 8)
721 AC_MSG_CHECKING(for uintptr_t support)
723 AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
724 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
727 AC_MSG_RESULT($have_uintptr_t)
728 if test "$have_uintptr_t" = yes ; then
729 AC_CHECK_SIZEOF(uintptr_t, 4)
732 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
733 AC_MSG_CHECKING(size of off_t)
734 AC_CACHE_VAL(ac_cv_sizeof_off_t,
735 [AC_TRY_RUN([#include <stdio.h>
736 #include <sys/types.h>
739 FILE *f=fopen("conftestval", "w");
741 fprintf(f, "%d\n", sizeof(off_t));
744 ac_cv_sizeof_off_t=`cat conftestval`,
745 ac_cv_sizeof_off_t=0,
746 ac_cv_sizeof_off_t=4)
748 AC_MSG_RESULT($ac_cv_sizeof_off_t)
749 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
750 [The number of bytes in an off_t.])
752 AC_MSG_CHECKING(whether to enable large file support)
753 if test "$have_long_long" = yes -a \
754 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
755 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
756 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
757 [Defined to enable large file support when an off_t is bigger than a long
758 and long long is available and at least as big as an off_t. You may need
759 to add some flags for configuration and compilation to enable this mode.
760 (For Solaris and Linux, the necessary defines are already defined.)])
766 # AC_CHECK_SIZEOF() doesn't include <time.h>.
767 AC_MSG_CHECKING(size of time_t)
768 AC_CACHE_VAL(ac_cv_sizeof_time_t,
769 [AC_TRY_RUN([#include <stdio.h>
773 FILE *f=fopen("conftestval", "w");
775 fprintf(f, "%d\n", sizeof(time_t));
778 ac_cv_sizeof_time_t=`cat conftestval`,
779 ac_cv_sizeof_time_t=0,
780 ac_cv_sizeof_time_t=4)
782 AC_MSG_RESULT($ac_cv_sizeof_time_t)
783 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
784 [The number of bytes in a time_t.])
787 # if have pthread_t then define SIZEOF_PTHREAD_T
789 if test "$ac_cv_kpthread" = "yes"
790 then CC="$CC -Kpthread"
792 AC_MSG_CHECKING(for pthread_t)
794 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
795 AC_MSG_RESULT($have_pthread_t)
796 if test "$have_pthread_t" = yes ; then
797 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
798 AC_MSG_CHECKING(size of pthread_t)
799 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
800 [AC_TRY_RUN([#include <stdio.h>
804 FILE *f=fopen("conftestval", "w");
806 fprintf(f, "%d\n", sizeof(pthread_t));
809 ac_cv_sizeof_pthread_t=`cat conftestval`,
810 ac_cv_sizeof_pthread_t=0,
811 ac_cv_sizeof_pthread_t=4)
813 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
814 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
815 [The number of bytes in a pthread_t.])
819 AC_MSG_CHECKING(for --enable-toolbox-glue)
820 AC_ARG_ENABLE(toolbox-glue,
821 [ --enable-toolbox-glue disable/enable MacOSX glue code for extensions])
823 if test -z "$enable_toolbox_glue"
825 case $ac_sys_system/$ac_sys_release in
827 enable_toolbox_glue="yes";;
829 enable_toolbox_glue="no";;
832 case "$enable_toolbox_glue" in
834 extra_frameworks="-framework CoreServices -framework Foundation"
835 extra_machdep_objs="Python/mactoolboxglue.o"
836 extra_undefs="-u __dummy -u _PyMac_Error"
837 AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
838 [Define if you want to use MacPython modules on MacOSX in unix-Python.])
842 extra_machdep_objs=""
846 AC_MSG_RESULT($enable_toolbox_glue)
848 AC_SUBST(LIBTOOL_CRUFT)
849 case $ac_sys_system/$ac_sys_release in
851 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
852 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
853 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
854 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
856 LIBTOOL_CRUFT="-lcc_dynamic -arch_only ppc"
857 LIBTOOL_CRUFT="$LIBTOOL_CRUFT $extra_frameworks"
858 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Python'
859 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
862 AC_MSG_CHECKING(for --enable-framework)
863 if test "$enable_framework"
865 OPT="$OPT -fno-common -dynamic"
866 # -F. is needed to allow linking to the framework while
867 # in the build location.
868 LDFLAGS="$LDFLAGS -Wl,-F."
869 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
870 [Define if you want to produce an OpenStep/Rhapsody framework
871 (shared library plus accessory files).])
877 AC_MSG_CHECKING(for dyld)
878 case $ac_sys_system/$ac_sys_release in
880 AC_DEFINE(WITH_DYLD, 1,
881 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
882 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
883 linker (rld). Dyld is necessary to support frameworks.])
884 AC_MSG_RESULT(always on for Darwin)
891 # Set info about shared libraries.
896 AC_SUBST(LINKFORSHARED)
897 # SO is the extension of shared libraries `(including the dot!)
898 # -- usually .so, .sl on HP-UX, .dll on Cygwin
902 case $ac_sys_system in
909 # LDSHARED is the ld *command* used to create shared library
910 # -- "ld" on SunOS 4.x.x, "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
911 # (Shared libraries in this instance are shared modules to be loaded into
912 # Python, as opposed to building Python itself as a shared library.)
913 AC_MSG_CHECKING(LDSHARED)
914 if test -z "$LDSHARED"
916 case $ac_sys_system/$ac_sys_release in
918 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
919 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
922 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
923 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
925 IRIX/5*) LDSHARED="ld -shared";;
926 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
927 SunOS/4*) LDSHARED="ld";;
929 if test "$GCC" = "yes"
930 then LDSHARED='$(CC) -shared'
931 else LDSHARED='$(CC) -G';
933 hp*|HP*) LDSHARED="ld -b";;
934 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
935 DYNIX/ptx*) LDSHARED="ld -G";;
937 LDSHARED='$(CC) $(LDFLAGS) -bundle'
938 if test "$enable_framework" ; then
939 # Link against the framework. All externals should be defined.
940 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
942 # No framework. Ignore undefined symbols, assuming they come from Python
943 LDSHARED="$LDSHARED -undefined suppress"
946 LDSHARED='$(CC) $(LDFLAGS) -bundle'
947 if test "$enable_framework" ; then
948 # Link against the framework. All externals should be defined.
949 LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)'
951 # No framework, use the Python app as bundle-loader
952 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
953 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/$(PYTHON)'
955 Linux*|GNU*) LDSHARED='$(CC) -shared';;
956 dgux*) LDSHARED="ld -G";;
957 BSD/OS*/4*) LDSHARED="gcc -shared";;
959 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
961 LDSHARED="cc -shared ${LDFLAGS}"
963 LDSHARED="ld -Bshareable ${LDFLAGS}"
965 NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
967 if test "$GCC" = "yes"
968 then LDSHARED="$(CC) -shared"
969 else LDSHARED="$(CC) -G"
971 SCO_SV*) LDSHARED="$(CC) -Wl,-G,-Bexport";;
972 Monterey*) LDSHARED="cc -G -dy -Bdynamic -Bexport -L/usr/lib/ia64l64";;
973 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
974 atheos*) LDSHARED="gcc -shared";;
978 AC_MSG_RESULT($LDSHARED)
979 BLDSHARED=${BLDSHARED-$LDSHARED}
980 # CCSHARED are the C *flags* used to create objects to go into a shared
981 # library (module) -- this is only needed for a few systems
982 AC_MSG_CHECKING(CCSHARED)
983 if test -z "$CCSHARED"
985 case $ac_sys_system/$ac_sys_release in
986 SunOS*) if test "$GCC" = yes;
987 then CCSHARED="-fPIC";
989 hp*|HP*) if test "$GCC" = yes;
990 then CCSHARED="-fPIC";
993 Linux*|GNU*) CCSHARED="-fPIC";;
994 BSD/OS*/4*) CCSHARED="-fpic";;
995 FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
997 if test "$GCC" = "yes"
998 then CCSHARED="-fPIC"
999 else CCSHARED="-KPIC"
1002 if test "$GCC" = "yes"
1003 then CCSHARED="-fPIC"
1004 else CCSHARED="-Kpic -belf"
1006 Monterey*) CCSHARED="-G";;
1007 IRIX*/6*) case $CC in
1008 *gcc*) CCSHARED="-shared";;
1011 atheos*) CCSHARED="-fPIC";;
1014 AC_MSG_RESULT($CCSHARED)
1015 # LINKFORSHARED are the flags passed to the $(CC) command that links
1016 # the python executable -- this is only needed for a few systems
1017 AC_MSG_CHECKING(LINKFORSHARED)
1018 if test -z "$LINKFORSHARED"
1020 case $ac_sys_system/$ac_sys_release in
1021 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1023 LINKFORSHARED="-Wl,-E -Wl,+s";;
1024 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1025 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1026 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1027 # -u libsys_s pulls in all symbols in libsys
1029 # -u __dummy makes the linker aware of the objc runtime
1030 # in System.framework; otherwise, __objcInit (referenced in
1031 # crt1.o) gets erroneously defined as common, which breaks dynamic
1032 # loading of any modules which reference it in System.framework.
1033 # -u _PyMac_Error is needed to pull in the mac toolbox glue, which is
1034 # not used by the core itself but which needs to be in the core so
1035 # that dynamically loaded extension modules have access to it.
1036 LINKFORSHARED="$extra_undefs -framework System"
1037 if test "$enable_framework"
1039 LINKFORSHARED="$LINKFORSHARED -framework Python"
1041 LINKFORSHARED="$LINKFORSHARED $extra_frameworks";;
1042 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1043 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1044 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1045 FreeBSD*|NetBSD*|OpenBSD*)
1046 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1048 LINKFORSHARED="-Wl,--export-dynamic"
1050 SunOS/5*) case $CC in
1052 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1054 LINKFORSHARED="-Xlinker --export-dynamic"
1059 AC_MSG_RESULT($LINKFORSHARED)
1061 AC_SUBST(CFLAGSFORSHARED)
1062 AC_MSG_CHECKING(CFLAGSFORSHARED)
1063 if test ! "$LIBRARY" = "$LDLIBRARY"
1065 case $ac_sys_system in
1067 # Cygwin needs CCSHARED when building extension DLLs
1068 # but not when building the interpreter DLL.
1069 CFLAGSFORSHARED='';;
1071 CFLAGSFORSHARED='$(CCSHARED)'
1074 AC_MSG_RESULT($CFLAGSFORSHARED)
1076 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1077 # library (with --enable-shared).
1078 # For platforms on which shared libraries are not allowed to have unresolved
1079 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1080 # if it is not required, since it creates a dependency of the shared library
1081 # to LIBS. This, in turn, means that applications linking the shared libpython
1082 # don't need to link LIBS explicitly. The default should be only changed
1083 # on systems where this approach causes problems.
1085 AC_MSG_CHECKING(SHLIBS)
1086 case "$ac_sys_system" in
1090 AC_MSG_RESULT($SHLIBS)
1093 # checks for libraries
1094 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1095 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1096 AC_SEARCH_LIBS(sem_init, rt posix4) # 'Real Time' functions on Solaris,
1097 # posix4 on Solaris 2.6
1099 # checks for system dependent C++ extensions support
1100 case "$ac_sys_system" in
1101 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1102 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1103 [loadAndInit("", 0, "")],
1104 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1105 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1106 and you want support for AIX C++ shared extension modules.])
1107 AC_MSG_RESULT(yes)],
1108 [AC_MSG_RESULT(no)]);;
1112 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1113 # However on SGI IRIX, these exist but are broken.
1114 # BeOS' sockets are stashed in libnet.
1115 case "$ac_sys_system" in
1118 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1119 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1122 case "$ac_sys_system" in
1124 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1128 AC_MSG_CHECKING(for --with-libs)
1130 [ --with-libs='lib1 ...' link against additional libs], [
1131 AC_MSG_RESULT($withval)
1132 LIBS="$withval $LIBS"
1133 ], AC_MSG_RESULT(no))
1135 # Determine if signalmodule should be used.
1136 AC_SUBST(USE_SIGNAL_MODULE)
1137 AC_SUBST(SIGNAL_OBJS)
1138 AC_MSG_CHECKING(for --with-signal-module)
1139 AC_ARG_WITH(signal-module,
1140 [ --with-signal-module disable/enable signal module])
1142 if test -z "$with_signal_module"
1143 then with_signal_module="yes"
1145 AC_MSG_RESULT($with_signal_module)
1147 if test "${with_signal_module}" = "yes"; then
1148 USE_SIGNAL_MODULE=""
1151 USE_SIGNAL_MODULE="#"
1152 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1155 # This is used to generate Setup.config
1156 AC_SUBST(USE_THREAD_MODULE)
1157 USE_THREAD_MODULE=""
1159 AC_MSG_CHECKING(for --with-dec-threads)
1161 AC_ARG_WITH(dec-threads,
1162 [ --with-dec-threads use DEC Alpha/OSF1 thread-safe libraries], [
1163 AC_MSG_RESULT($withval)
1165 if test "${with_thread+set}" != set; then
1166 with_thread="$withval";
1170 # Templates for things AC_DEFINEd more than once.
1171 # For a single AC_DEFINE, no template is needed.
1172 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
1173 AH_TEMPLATE(_REENTRANT,
1174 [Define to force use of thread-safe errno, h_errno, and other functions])
1175 AH_TEMPLATE(WITH_THREAD,
1176 [Define if you want to compile in rudimentary thread support])
1178 AC_MSG_CHECKING(for --with-threads)
1179 AC_ARG_WITH(threads,
1180 [ --with(out)-threads[=DIRECTORY] disable/enable thread support])
1182 # --with-thread is deprecated, but check for it anyway
1184 [ --with(out)-thread[=DIRECTORY] deprecated; use --with(out)-threads],[
1185 with_threads=$with_thread])
1187 if test -z "$with_threads"
1188 then with_threads="yes"
1190 AC_MSG_RESULT($with_threads)
1193 if test "$with_threads" = "no"
1195 USE_THREAD_MODULE="#"
1196 elif test "$ac_cv_pthread_is_default" = yes
1198 AC_DEFINE(WITH_THREAD)
1199 # Defining _REENTRANT on system with POSIX threads should not hurt.
1200 AC_DEFINE(_REENTRANT)
1202 THREADOBJ="Python/thread.o"
1203 elif test "$ac_cv_kpthread" = "yes"
1206 AC_DEFINE(WITH_THREAD)
1208 THREADOBJ="Python/thread.o"
1210 if test ! -z "$with_threads" -a -d "$with_threads"
1211 then LDFLAGS="$LDFLAGS -L$with_threads"
1213 if test ! -z "$withval" -a -d "$withval"
1214 then LDFLAGS="$LDFLAGS -L$withval"
1217 # According to the POSIX spec, a pthreads implementation must
1218 # define _POSIX_THREADS in unistd.h. Some apparently don't (which ones?)
1219 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
1221 [#include <unistd.h>
1222 #ifdef _POSIX_THREADS
1225 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
1226 AC_MSG_RESULT($unistd_defines_pthreads)
1228 AC_DEFINE(_REENTRANT)
1229 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
1230 AC_DEFINE(C_THREADS)
1231 AC_DEFINE(HURD_C_THREADS, 1,
1232 [Define if you are using Mach cthreads directly under /include])
1233 LIBS="$LIBS -lthreads"
1234 THREADOBJ="Python/thread.o"],[
1235 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
1236 AC_DEFINE(C_THREADS)
1237 AC_DEFINE(MACH_C_THREADS, 1,
1238 [Define if you are using Mach cthreads under mach /])
1239 THREADOBJ="Python/thread.o"],[
1240 AC_MSG_CHECKING(for --with-pth)
1242 [ --with-pth use GNU pth threading libraries], [
1243 AC_MSG_RESULT($withval)
1244 AC_DEFINE(WITH_THREAD)
1245 AC_DEFINE(HAVE_PTH, 1, [Define if you have GNU PTH threads.])
1247 THREADOBJ="Python/thread.o"],[
1250 # Just looking for pthread_create in libpthread is not enough:
1251 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
1252 # So we really have to include pthread.h, and then link.
1254 LIBS="$LIBS -lpthread"
1255 AC_MSG_CHECKING([for pthread_create in -lpthread])
1256 AC_TRY_LINK([#include <pthread.h>
1258 void * start_routine (void *arg) { exit (0); }], [
1259 pthread_create (NULL, NULL, start_routine, NULL)], [
1261 AC_DEFINE(WITH_THREAD)
1263 THREADOBJ="Python/thread.o"],[
1265 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
1267 THREADOBJ="Python/thread.o"],[
1268 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
1269 AC_DEFINE(ATHEOS_THREADS, 1,
1270 [Define this if you have AtheOS threads.])
1271 THREADOBJ="Python/thread.o"],[
1272 AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
1273 AC_DEFINE(BEOS_THREADS, 1,
1274 [Define this if you have BeOS threads.])
1275 THREADOBJ="Python/thread.o"],[
1276 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
1278 LIBS="$LIBS -lpthreads"
1279 THREADOBJ="Python/thread.o"], [
1280 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
1283 THREADOBJ="Python/thread.o"], [
1284 AC_CHECK_LIB(thread, __d6_pthread_create, [AC_DEFINE(WITH_THREAD)
1286 LIBS="$LIBS -lthread"
1287 THREADOBJ="Python/thread.o"], [
1288 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
1290 LIBS="$LIBS -lpthread"
1291 THREADOBJ="Python/thread.o"], [
1292 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
1295 THREADOBJ="Python/thread.o"],[
1296 USE_THREAD_MODULE="#"])
1297 ])])])])])])])])])])])
1299 if test "$posix_threads" = "yes"; then
1300 if test "$unistd_defines_pthreads" = "no"; then
1301 AC_DEFINE(_POSIX_THREADS, 1,
1302 [Define if you have POSIX threads,
1303 and your system does not define that.])
1306 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
1307 AC_CACHE_VAL(ac_cv_pthread_system_supported,
1308 [AC_TRY_RUN([#include <pthread.h>
1309 void *foo(void *parm) {
1313 pthread_attr_t attr;
1315 if (pthread_attr_init(&attr)) exit(-1);
1316 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
1317 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
1320 ac_cv_pthread_system_supported=yes,
1321 ac_cv_pthread_system_supported=no,
1322 ac_cv_pthread_system_supported=no)
1324 AC_MSG_RESULT($ac_cv_pthread_system_supported)
1325 if test "$ac_cv_pthread_system_supported" = "yes"; then
1326 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
1328 AC_CHECK_FUNCS(pthread_sigmask)
1331 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
1333 THREADOBJ="Python/thread.o"
1334 USE_THREAD_MODULE=""])
1336 if test $posix_threads != "yes"; then
1337 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
1338 LIBS="$LIBS -lthread"
1339 THREADOBJ="Python/thread.o"
1340 USE_THREAD_MODULE=""])
1343 if test "$USE_THREAD_MODULE" != "#"
1345 # If the above checks didn't disable threads, (at least) OSF1
1346 # needs this '-threads' argument during linking.
1347 case $ac_sys_system in
1348 OSF1) LDLAST=-threads;;
1352 if test "$posix_threads" = yes -a \
1353 "$ac_sys_system" = "SunOS" -a \
1354 "$ac_sys_release" = "5.6"; then
1355 AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
1356 [Defined for Solaris 2.6 bug in pthread header.])
1361 # Check for enable-ipv6
1362 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
1363 AC_MSG_CHECKING([if --enable-ipv6 is specified])
1365 [ --enable-ipv6 Enable ipv6 (with ipv4) support
1366 --disable-ipv6 Disable ipv6 support],
1367 [ case "$enableval" in
1372 *) AC_MSG_RESULT(yes)
1373 AC_DEFINE(ENABLE_IPV6)
1379 dnl the check does not work on cross compilation case...
1380 AC_TRY_RUN([ /* AF_INET6 available check */
1381 #include <sys/types.h>
1382 #include <sys/socket.h>
1385 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
1399 if test "$ipv6" = "yes"; then
1400 AC_MSG_CHECKING(if RFC2553 API is available)
1401 AC_TRY_COMPILE([#include <sys/types.h>
1402 #include <netinet/in.h>],
1403 [struct sockaddr_in6 x;
1407 AC_MSG_RESULT(no, IPv6 disabled)
1411 if test "$ipv6" = "yes"; then
1412 AC_DEFINE(ENABLE_IPV6)
1420 if test "$ipv6" = "yes"; then
1421 AC_MSG_CHECKING([ipv6 stack type])
1422 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
1426 dnl http://www.kame.net/
1428 #include <netinet/in.h>
1429 #ifdef IPV6_INRIA_VERSION
1435 dnl http://www.kame.net/
1437 #include <netinet/in.h>
1443 ipv6libdir=/usr/local/v6/lib
1447 dnl http://www.v6.linux.or.jp/
1449 #include <features.h>
1450 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
1457 dnl http://www.v6.linux.or.jp/
1458 if test -d /usr/inet6; then
1461 ipv6libdir=/usr/inet6/lib
1462 OPT="-I/usr/inet6/include $OPT"
1466 if test -f /etc/netconfig; then
1467 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
1475 #include <sys/param.h>
1476 #ifdef _TOSHIBA_INET6
1481 ipv6libdir=/usr/local/v6/lib])
1485 #include </usr/local/v6/include/sys/v6config.h>
1491 ipv6libdir=/usr/local/v6/lib;
1492 OPT="-I/usr/local/v6/include $OPT"])
1496 #include <sys/param.h>
1497 #ifdef _ZETA_MINAMI_INET6
1502 ipv6libdir=/usr/local/v6/lib])
1505 if test "$ipv6type" != "unknown"; then
1509 AC_MSG_RESULT($ipv6type)
1512 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
1513 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
1514 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
1515 echo "using lib$ipv6lib"
1517 if test $ipv6trylibc = "yes"; then
1520 echo 'Fatal: no $ipv6lib library found. cannot continue.'
1521 echo "You need to fetch lib$ipv6lib.a from appropriate"
1522 echo 'ipv6 kit and compile beforehand.'
1528 # Check for universal newline support
1529 AC_MSG_CHECKING(for --with-universal-newlines)
1530 AC_ARG_WITH(universal-newlines,
1531 [ --with(out)-universal-newlines disable/enable foreign newlines])
1533 if test -z "$with_universal_newlines"
1534 then with_universal_newlines="yes"
1536 if test "$with_universal_newlines" != "no"
1538 AC_DEFINE(WITH_UNIVERSAL_NEWLINES, 1,
1539 [Define if you want to read files with foreign newlines.])
1541 AC_MSG_RESULT($with_universal_newlines)
1543 # Check for --with-doc-strings
1544 AC_MSG_CHECKING(for --with-doc-strings)
1545 AC_ARG_WITH(doc-strings,
1546 [ --with(out)-doc-strings disable/enable documentation strings])
1548 if test -z "$with_doc_strings"
1549 then with_doc_strings="yes"
1551 if test "$with_doc_strings" != "no"
1553 AC_DEFINE(WITH_DOC_STRINGS, 1,
1554 [Define if you want documentation strings in extension modules])
1556 AC_MSG_RESULT($with_doc_strings)
1558 # Check for Python-specific malloc support
1559 AC_MSG_CHECKING(for --with-pymalloc)
1560 AC_ARG_WITH(pymalloc,
1561 [ --with(out)-pymalloc disable/enable specialized mallocs])
1563 if test -z "$with_pymalloc"
1564 then with_pymalloc="yes"
1566 if test "$with_pymalloc" != "no"
1568 AC_DEFINE(WITH_PYMALLOC, 1,
1569 [Define if you want to compile in Python-specific mallocs])
1571 AC_MSG_RESULT($with_pymalloc)
1573 # Check for --with-wctype-functions
1574 AC_MSG_CHECKING(for --with-wctype-functions)
1575 AC_ARG_WITH(wctype-functions,
1576 [ --with-wctype-functions use wctype.h functions], [
1577 if test "$withval" != no
1579 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
1580 [Define if you want wctype.h functions to be used instead of the
1581 one supplied by Python itself. (see Include/unicodectype.h).])
1583 else AC_MSG_RESULT(no)
1585 [AC_MSG_RESULT(no)])
1587 # -I${DLINCLDIR} is added to the compile rule for importdl.o
1591 AC_MSG_CHECKING(for --with-sgi-dl)
1593 [ --with-sgi-dl=DIRECTORY IRIX 4 dynamic linking], [
1594 AC_MSG_RESULT($withval)
1595 AC_DEFINE(WITH_SGI_DL, 1,
1596 [Define if you want to use SGI (IRIX 4) dynamic linking.
1597 This requires the "dl" library by Jack Jansen,
1598 ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
1599 Do not bother on IRIX 5, it already has dynamic linking using SunOS
1600 style shared libraries])
1601 DYNLOADFILE="dynload_dl.o"
1603 if test ! -z "$dldir" -a -d "$dldir"
1604 then LDFLAGS="$LDFLAGS -L$dldir"
1605 else AC_ERROR(proper usage is --with-sgi-dl=DIRECTORY)
1608 LIBS="$LIBS -ldl -lmld"], AC_MSG_RESULT(no))
1610 AC_MSG_CHECKING(for --with-dl-dld)
1611 AC_ARG_WITH(dl-dld, [ --with-dl-dld=DL_DIR,DLD_DIR GNU dynamic linking], [
1612 AC_MSG_RESULT($withval)
1613 AC_DEFINE(WITH_DL_DLD, 1,
1614 [Define if you want to emulate SGI (IRIX 4) dynamic linking.
1615 This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
1616 Sequent Symmetry (Dynix), and Atari ST.
1617 This requires the 'dl-dld' library,
1618 ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
1619 as well as the 'GNU dld' library,
1620 ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
1621 Do not bother on SunOS 4 or 5, they already have dynamic linking using
1623 DYNLOADFILE="dynload_dl.o"
1624 dldir=`echo "$withval" | sed 's/,.*//'`
1625 dlddir=`echo "$withval" | sed 's/.*,//'`
1626 if test ! -z "$dldir" -a -d "$dldir" -a ! -z "$dlddir" -a -d "$dlddir"
1627 then LDFLAGS="$LDFLAGS -L$dldir -L$dlddir"
1628 else AC_ERROR(proper usage is --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY)
1631 LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no))
1633 # the dlopen() function means we might want to use dynload_shlib.o. some
1634 # platforms, such as AIX, have dlopen(), but don't want to use it.
1635 AC_CHECK_FUNCS(dlopen)
1637 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
1638 # loading of modules.
1639 AC_SUBST(DYNLOADFILE)
1640 AC_MSG_CHECKING(DYNLOADFILE)
1641 if test -z "$DYNLOADFILE"
1643 case $ac_sys_system/$ac_sys_release in
1644 AIX*) DYNLOADFILE="dynload_aix.o";;
1645 BeOS*) DYNLOADFILE="dynload_beos.o";;
1646 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
1647 Darwin/*) DYNLOADFILE="dynload_next.o";;
1648 atheos*) DYNLOADFILE="dynload_atheos.o";;
1650 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
1651 # out any dynamic loading
1652 if test "$ac_cv_func_dlopen" = yes
1653 then DYNLOADFILE="dynload_shlib.o"
1654 else DYNLOADFILE="dynload_stub.o"
1659 AC_MSG_RESULT($DYNLOADFILE)
1660 if test "$DYNLOADFILE" != "dynload_stub.o"
1662 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
1663 [Defined when any dynamic module loading is enabled.])
1666 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
1668 AC_SUBST(MACHDEP_OBJS)
1669 AC_MSG_CHECKING(MACHDEP_OBJS)
1670 if test -z "$MACHDEP_OBJS"
1672 MACHDEP_OBJS=$extra_machdep_objs
1674 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
1676 AC_MSG_RESULT(MACHDEP_OBJS)
1678 # checks for library functions
1679 AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
1680 fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
1681 gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \
1682 hstrerror inet_pton iswprint kill killpg lchown link lstat mbtowc mkfifo \
1683 mknod mktime mremap nice pathconf pause plock poll pthread_init \
1685 select setegid seteuid setgid setgroups \
1686 setlocale setregid setreuid setsid setpgid setuid setvbuf snprintf \
1687 sigaction siginterrupt sigrelse strftime strptime symlink \
1688 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
1689 truncate uname unsetenv utimes waitpid _getpty getpriority)
1691 # check for openpty and forkpty
1693 AC_CHECK_FUNCS(openpty,, AC_CHECK_LIB(util,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"]))
1694 AC_CHECK_FUNCS(forkpty,, AC_CHECK_LIB(util,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"]))
1696 # check for long file support functions
1697 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
1699 AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
1700 AC_CHECK_FUNCS(getpgrp,
1701 AC_TRY_COMPILE([#include <unistd.h>],
1703 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
1704 [Define if getpgrp() must be called as getpgrp(0).])
1707 AC_FUNC_SETPGRP(AC_DEFINE(SETPGRP_HAVE_ARG, 1,
1708 [Define if setpgrp() must be called as setpgrp(0, 0).])
1710 AC_CHECK_FUNCS(gettimeofday,
1711 AC_TRY_COMPILE([#include <sys/time.h>],
1712 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
1713 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
1714 [Define if gettimeofday() does not have second (timezone) argument
1715 This is the case on Motorola V4 (R40V4.2)])
1720 # On OSF/1 V5.1, getaddrinfo is available, but a define
1721 # for [no]getaddrinfo in netdb.h.
1722 AC_MSG_CHECKING(for getaddrinfo)
1724 #include <sys/types.h>
1725 #include <sys/socket.h>
1729 getaddrinfo(NULL, NULL, NULL, NULL);
1732 AC_MSG_CHECKING(getaddrinfo bug)
1734 #include <sys/types.h>
1737 #include <sys/socket.h>
1738 #include <netinet/in.h>
1742 int passive, gaierr, inet4 = 0, inet6 = 0;
1743 struct addrinfo hints, *ai, *aitop;
1744 char straddr[INET6_ADDRSTRLEN], strport[16];
1746 for (passive = 0; passive <= 1; passive++) {
1747 memset(&hints, 0, sizeof(hints));
1748 hints.ai_family = AF_UNSPEC;
1749 hints.ai_flags = passive ? AI_PASSIVE : 0;
1750 hints.ai_socktype = SOCK_STREAM;
1751 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
1752 (void)gai_strerror(gaierr);
1755 for (ai = aitop; ai; ai = ai->ai_next) {
1756 if (ai->ai_addr == NULL ||
1757 ai->ai_addrlen == 0 ||
1758 getnameinfo(ai->ai_addr, ai->ai_addrlen,
1759 straddr, sizeof(straddr), strport, sizeof(strport),
1760 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
1763 switch (ai->ai_family) {
1765 if (strcmp(strport, "54321") != 0) {
1769 if (strcmp(straddr, "0.0.0.0") != 0) {
1773 if (strcmp(straddr, "127.0.0.1") != 0) {
1780 if (strcmp(strport, "54321") != 0) {
1784 if (strcmp(straddr, "::") != 0) {
1788 if (strcmp(straddr, "::1") != 0) {
1798 /* another family support? */
1804 if (!(inet4 == 0 || inet4 == 2))
1806 if (!(inet6 == 0 || inet6 == 2))
1810 freeaddrinfo(aitop);
1815 freeaddrinfo(aitop);
1820 buggygetaddrinfo=no,
1821 AC_MSG_RESULT(buggy)
1822 buggygetaddrinfo=yes,
1823 AC_MSG_RESULT(buggy)
1824 buggygetaddrinfo=yes)], [
1826 buggygetaddrinfo=yes
1829 if test "$buggygetaddrinfo" = "yes"; then
1830 if test "$ipv6" = "yes"; then
1831 echo 'Fatal: You must get working getaddrinfo() function.'
1832 echo ' or you can specify "--disable-ipv6"'.
1836 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
1838 AC_CHECK_FUNCS(getnameinfo)
1840 # checks for structures
1845 AC_STRUCT_ST_BLKSIZE
1848 AC_MSG_CHECKING(for time.h that defines altzone)
1849 AC_CACHE_VAL(ac_cv_header_time_altzone,
1850 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
1851 ac_cv_header_time_altzone=yes,
1852 ac_cv_header_time_altzone=no)])
1853 AC_MSG_RESULT($ac_cv_header_time_altzone)
1854 if test $ac_cv_header_time_altzone = yes; then
1855 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
1859 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
1861 #include <sys/types.h>
1862 #include <sys/select.h>
1863 #include <sys/time.h>
1865 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
1866 [Define if you can safely include both <sys/select.h> and <sys/time.h>
1867 (which you can't on SCO ODT 3.0).])
1870 AC_MSG_RESULT($was_it_defined)
1872 AC_MSG_CHECKING(for addrinfo)
1873 AC_CACHE_VAL(ac_cv_struct_addrinfo,
1875 # include <netdb.h>],
1876 [struct addrinfo a],
1877 ac_cv_struct_addrinfo=yes,
1878 ac_cv_struct_addrinfo=no))
1879 AC_MSG_RESULT($ac_cv_struct_addrinfo)
1880 if test $ac_cv_struct_addrinfo = yes; then
1881 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
1884 AC_MSG_CHECKING(for sockaddr_storage)
1885 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
1887 # include <sys/types.h>
1888 # include <sys/socket.h>],
1889 [struct sockaddr_storage s],
1890 ac_cv_struct_sockaddr_storage=yes,
1891 ac_cv_struct_sockaddr_storage=no))
1892 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
1893 if test $ac_cv_struct_sockaddr_storage = yes; then
1894 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
1897 # checks for compiler characteristics
1903 AC_MSG_CHECKING(for working volatile)
1904 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
1905 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
1907 AC_MSG_RESULT($works)
1910 AC_MSG_CHECKING(for working signed char)
1911 AC_TRY_COMPILE([], [signed char c;], works=yes,
1912 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
1914 AC_MSG_RESULT($works)
1917 AC_MSG_CHECKING(for prototypes)
1918 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
1919 AC_DEFINE(HAVE_PROTOTYPES, 1,
1920 [Define if your compiler supports function prototype])
1923 AC_MSG_RESULT($have_prototypes)
1926 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
1929 int foo(int x, ...) {
1937 ], [return foo(10, "", 3.14);], [
1938 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
1939 [Define if your compiler supports variable length function prototypes
1940 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
1943 AC_MSG_RESULT($works)
1945 if test "$have_prototypes" = yes; then
1947 AC_MSG_CHECKING(for bad exec* prototypes)
1948 AC_TRY_COMPILE([#include <unistd.h>], [char **t;execve("@",t,t);], ,
1949 AC_DEFINE(BAD_EXEC_PROTOTYPES, 1,
1950 [Define if your <unistd.h> contains bad prototypes for exec*()
1951 (as it does on SGI IRIX 4.x)])
1954 AC_MSG_RESULT($bad_prototypes)
1957 # check if sockaddr has sa_len member
1958 AC_MSG_CHECKING(if sockaddr has sa_len member)
1959 AC_TRY_COMPILE([#include <sys/types.h>
1960 #include <sys/socket.h>],
1964 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
1968 AC_MSG_CHECKING(whether va_list is an array)
1970 #ifdef HAVE_STDARG_PROTOTYPES
1973 #include <varargs.h>
1975 ], [va_list list1, list2; list1 = list2;], , [
1976 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
1977 va_list_is_array=yes
1979 AC_MSG_RESULT($va_list_is_array)
1981 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
1982 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
1983 [Define this if you have some version of gethostbyname_r()])
1985 AC_CHECK_FUNC(gethostbyname_r, [
1986 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
1987 AC_MSG_CHECKING([gethostbyname_r with 6 args])
1989 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
1994 struct hostent *he, *res;
1999 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
2001 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2002 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
2003 [Define this if you have the 6-arg version of gethostbyname_r().])
2007 AC_MSG_CHECKING([gethostbyname_r with 5 args])
2017 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
2019 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2020 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
2021 [Define this if you have the 5-arg version of gethostbyname_r().])
2025 AC_MSG_CHECKING([gethostbyname_r with 3 args])
2031 struct hostent_data data;
2033 (void) gethostbyname_r(name, he, &data);
2035 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
2036 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
2037 [Define this if you have the 3-arg version of gethostbyname_r().])
2046 AC_CHECK_FUNCS(gethostbyname)
2048 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
2049 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
2050 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
2051 AC_SUBST(HAVE_GETHOSTBYNAME_R)
2052 AC_SUBST(HAVE_GETHOSTBYNAME)
2054 # checks for system services
2057 # Linux requires this for correct f.p. operations
2058 AC_CHECK_FUNC(__fpu_control,
2060 [AC_CHECK_LIB(ieee, __fpu_control)
2063 # Check for --with-fpectl
2064 AC_MSG_CHECKING(for --with-fpectl)
2066 [ --with-fpectl enable SIGFPE catching], [
2067 if test "$withval" != no
2069 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
2070 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
2072 else AC_MSG_RESULT(no)
2074 [AC_MSG_RESULT(no)])
2076 # check for --with-libm=...
2078 case $ac_sys_system in
2083 AC_MSG_CHECKING(for --with-libm=STRING)
2084 AC_ARG_WITH(libm, [ --with-libm=STRING math library], [
2085 if test "$withval" = no
2087 AC_MSG_RESULT(force LIBM empty)
2088 elif test "$withval" != yes
2090 AC_MSG_RESULT(set LIBM=\"$withval\")
2091 else AC_ERROR(proper usage is --with-libm=STRING)
2093 [AC_MSG_RESULT(default LIBM=\"$LIBM\")])
2095 # check for --with-libc=...
2097 AC_MSG_CHECKING(for --with-libc=STRING)
2098 AC_ARG_WITH(libc, [ --with-libc=STRING C library], [
2099 if test "$withval" = no
2101 AC_MSG_RESULT(force LIBC empty)
2102 elif test "$withval" != yes
2104 AC_MSG_RESULT(set LIBC=\"$withval\")
2105 else AC_ERROR(proper usage is --with-libc=STRING)
2107 [AC_MSG_RESULT(default LIBC=\"$LIBC\")])
2109 # check for hypot() in math library
2112 AC_REPLACE_FUNCS(hypot)
2115 # check whether malloc(0) returns NULL or not
2116 AC_MSG_CHECKING(what malloc(0) returns)
2117 AC_CACHE_VAL(ac_cv_malloc_zero,
2118 [AC_TRY_RUN([#include <stdio.h>
2122 char *malloc(), *realloc();
2128 if (p == NULL) exit(1);
2130 if (p == NULL) exit(1);
2134 ac_cv_malloc_zero=nonnull,
2135 ac_cv_malloc_zero=null,
2136 ac_cv_malloc_zero=nonnull)]) # XXX arm cross-compile?
2137 AC_MSG_RESULT($ac_cv_malloc_zero)
2138 if test "$ac_cv_malloc_zero" = null
2140 AC_DEFINE(MALLOC_ZERO_RETURNS_NULL, 1,
2141 [Define if malloc(0) returns a NULL pointer.])
2145 AC_CHECK_HEADER(wchar.h, [
2146 AC_DEFINE(HAVE_WCHAR_H, 1,
2147 [Define if the compiler provides a wchar.h header file.])
2153 # determine wchar_t size
2154 if test "$wchar_h" = yes
2156 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
2159 AC_MSG_CHECKING(what type to use for unicode)
2160 AC_ARG_ENABLE(unicode,
2161 [ --enable-unicode[=ucs2,ucs4] Enable Unicode strings (default is yes)],,enable_unicode=yes)
2163 if test $enable_unicode = yes
2165 # Without any arguments, Py_UNICODE defaults to two-byte mode
2166 enable_unicode="ucs2"
2169 AH_TEMPLATE(Py_UNICODE_SIZE,
2170 [Define as the size of the unicode type.])
2171 case "$enable_unicode" in
2172 ucs2) unicode_size="2"
2173 AC_DEFINE(Py_UNICODE_SIZE,2)
2175 ucs4) unicode_size="4"
2176 AC_DEFINE(Py_UNICODE_SIZE,4)
2180 AH_TEMPLATE(PY_UNICODE_TYPE,
2181 [Define as the integral type used for Unicode representation.])
2183 AC_SUBST(UNICODE_OBJS)
2184 if test "$enable_unicode" = "no"
2187 AC_MSG_RESULT(not used)
2189 UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
2190 AC_DEFINE(Py_USING_UNICODE, 1,
2191 [Define if you want to have a Unicode type.])
2192 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t"
2194 PY_UNICODE_TYPE="wchar_t"
2195 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
2196 [Define if you have a useable wchar_t type defined in wchar.h; useable
2197 means wchar_t must be 16-bit unsigned type. (see
2198 Include/unicodeobject.h).])
2199 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
2200 elif test "$ac_cv_sizeof_short" = "$unicode_size"
2202 PY_UNICODE_TYPE="unsigned short"
2203 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
2204 elif test "$ac_cv_sizeof_long" = "$unicode_size"
2206 PY_UNICODE_TYPE="unsigned long"
2207 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
2209 PY_UNICODE_TYPE="no type found"
2211 AC_MSG_RESULT($PY_UNICODE_TYPE)
2214 # check for endianness
2217 # Check whether right shifting a negative integer extends the sign bit
2218 # or fills with zeros (like the Cray J90, according to Tim Peters).
2219 AC_MSG_CHECKING(whether right shift extends the sign bit)
2220 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
2224 exit(((-1)>>3 == -1) ? 0 : 1);
2227 ac_cv_rshift_extends_sign=yes,
2228 ac_cv_rshift_extends_sign=no,
2229 ac_cv_rshift_extends_sign=yes)])
2230 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
2231 if test "$ac_cv_rshift_extends_sign" = no
2233 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
2234 [Define if i>>j for signed int i does not extend the sign bit
2238 # check for getc_unlocked and related locking functions
2239 AC_MSG_CHECKING(for getc_unlocked() and friends)
2240 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
2241 AC_TRY_LINK([#include <stdio.h>],[
2242 FILE *f = fopen("/dev/null", "r");
2246 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
2247 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
2248 if test "$ac_cv_have_getc_unlocked" = yes
2250 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
2251 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
2254 # check for readline 4.0
2255 AC_CHECK_LIB(readline, rl_pre_input_hook,
2256 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
2257 [Define if you have readline 4.0]), , -ltermcap)
2259 # check for readline 4.2
2260 AC_CHECK_LIB(readline, rl_completion_matches,
2261 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
2262 [Define if you have readline 4.2]), , -ltermcap)
2264 AC_MSG_CHECKING(for broken nice())
2265 AC_CACHE_VAL(ac_cv_broken_nice, [
2270 if (val1 != -1 && val1 == nice(2))
2275 ac_cv_broken_nice=yes,
2276 ac_cv_broken_nice=no,
2277 ac_cv_broken_nice=no)])
2278 AC_MSG_RESULT($ac_cv_broken_nice)
2279 if test "$ac_cv_broken_nice" = yes
2281 AC_DEFINE(HAVE_BROKEN_NICE, 1,
2282 [Define if nice() returns success/failure instead of the new priority.])
2285 # Look for subsecond timestamps in struct stat
2286 AC_MSG_CHECKING(for tv_nsec in struct stat)
2287 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
2288 AC_TRY_COMPILE([#include <sys/stat.h>], [
2290 st.st_mtim.tv_nsec = 1;
2292 ac_cv_stat_tv_nsec=yes,
2293 ac_cv_stat_tv_nsec=no,
2294 ac_cv_stat_tv_nsec=no))
2295 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
2296 if test "$ac_cv_stat_tv_nsec" = yes
2298 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
2299 [Define if you have struct stat.st_mtim.tv_nsec])
2302 # On HP/UX 11.0, mvwdelch is a block with a return statement
2303 AC_MSG_CHECKING(whether mvwdelch is an expression)
2304 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
2305 AC_TRY_COMPILE([#include <curses.h>], [
2307 rtn = mvwdelch(0,0,0);
2308 ], ac_cv_mvwdelch_is_expression=yes,
2309 ac_cv_mvwdelch_is_expression=no,
2310 ac_cv_mvwdelch_is_expression=yes))
2311 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
2313 if test "$ac_cv_mvwdelch_is_expression" = yes
2315 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
2316 [Define if mvwdelch in curses.h is an expression.])
2319 AC_MSG_CHECKING(whether WINDOW has _flags)
2320 AC_CACHE_VAL(ac_cv_window_has_flags,
2321 AC_TRY_COMPILE([#include <curses.h>], [
2324 ], ac_cv_window_has_flags=yes,
2325 ac_cv_window_has_flags=no,
2326 ac_cv_window_has_flags=no))
2327 AC_MSG_RESULT($ac_cv_window_has_flags)
2330 if test "$ac_cv_window_has_flags" = yes
2332 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
2333 [Define if WINDOW in curses.h offers a field _flags.])
2336 # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS!
2337 # Add sys/socket.h to confdefs.h
2338 cat >> confdefs.h <<\EOF
2339 #ifdef HAVE_SYS_SOCKET_H
2340 #include <sys/socket.h>
2343 AC_CHECK_TYPE(socklen_t, int)
2345 #AC_MSG_CHECKING(for Modules/Setup)
2346 #if test ! -f Modules/Setup ; then
2347 # if test ! -d Modules ; then
2350 # cp "$srcdir/Modules/Setup.dist" Modules/Setup
2351 # AC_MSG_RESULT(creating)
2353 # AC_MSG_RESULT(already exists)
2356 AC_SUBST(THREADHEADERS)
2358 for h in `(cd $srcdir;echo Python/thread_*.h)`
2360 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
2364 SRCDIRS="Parser Grammar Objects Python Modules Mac Mac/Python"
2365 AC_MSG_CHECKING(for build directories)
2366 for dir in $SRCDIRS; do
2367 if test ! -d $dir; then
2373 # generate output files
2374 AC_OUTPUT(Makefile.pre Modules/Setup.config)
2376 echo "creating Setup"
2377 if test ! -f Modules/Setup
2379 cp $srcdir/Modules/Setup.dist Modules/Setup
2382 echo "creating Setup.local"
2383 if test ! -f Modules/Setup.local
2385 echo "# Edit this file for local setup changes" >Modules/Setup.local
2388 echo "creating Makefile"
2389 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
2390 -s Modules Modules/Setup.config \
2391 Modules/Setup.local Modules/Setup