1 dnl ***********************************************
2 dnl * Please run autoreconf to test your changes! *
3 dnl ***********************************************
4 dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61).
6 # Set VERSION so we only need to edit in one place (i.e., here)
7 m4_define(PYTHON_VERSION, 3.1)
9 AC_REVISION($Revision$)
11 AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
12 AC_CONFIG_SRCDIR([Include/object.h])
13 AC_CONFIG_HEADER(pyconfig.h)
15 dnl Ensure that if prefix is specified, it does not end in a slash. If
16 dnl it does, we get path names containing '//' which is both ugly and
17 dnl can cause trouble.
19 dnl Last slash shouldn't be stripped if prefix=/
20 if test "$prefix" != "/"; then
21 prefix=`echo "$prefix" | sed -e 's/\/$//g'`
24 dnl This is for stuff that absolutely must end up in pyconfig.h.
25 dnl Please use pyport.h instead, if possible.
31 /* Define the macros needed if on a UnixWare 7.x system. */
32 #if defined(__USLC__) && defined(__SCO_VERSION__)
33 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
36 #endif /*Py_PYCONFIG_H*/
39 # We don't use PACKAGE_ variables, and they cause conflicts
40 # with other autoconf-based packages that include Python.h
41 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
43 mv confdefs.h.new confdefs.h
46 VERSION=PYTHON_VERSION
51 # The later defininition of _XOPEN_SOURCE disables certain features
52 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
53 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
55 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
56 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
58 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
60 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
61 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
63 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
65 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
66 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
67 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
69 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
70 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
72 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
75 define_xopen_source=yes
77 # Arguments passed to configure.
79 CONFIG_ARGS="$ac_configure_args"
81 AC_MSG_CHECKING([for --enable-universalsdk])
82 AC_ARG_ENABLE(universalsdk,
83 AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
87 enableval=/Developer/SDKs/MacOSX10.4u.sdk
88 if test ! -d "${enableval}"
100 UNIVERSALSDK=$enableval
101 if test ! -d "${UNIVERSALSDK}"
103 AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
112 if test -n "${UNIVERSALSDK}"
114 AC_MSG_RESULT(${UNIVERSALSDK})
118 AC_SUBST(UNIVERSALSDK)
120 AC_SUBST(ARCH_RUN_32BIT)
122 UNIVERSAL_ARCHS="32-bit"
123 AC_MSG_CHECKING(for --with-universal-archs)
124 AC_ARG_WITH(universal-archs,
125 AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
127 AC_MSG_RESULT($withval)
128 UNIVERSAL_ARCHS="$withval"
131 AC_MSG_RESULT(32-bit)
136 AC_ARG_WITH(framework-name,
137 AC_HELP_STRING(--with-framework-name=FRAMEWORK,
138 specify an alternate name of the framework built with --enable-framework),
140 PYTHONFRAMEWORK=${withval}
141 PYTHONFRAMEWORKDIR=${withval}.framework
142 PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
144 PYTHONFRAMEWORK=Python
145 PYTHONFRAMEWORKDIR=Python.framework
146 PYTHONFRAMEWORKIDENTIFIER=org.python.python
148 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
149 AC_ARG_ENABLE(framework,
150 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
154 enableval=/Library/Frameworks
159 PYTHONFRAMEWORKDIR=no-framework
160 PYTHONFRAMEWORKPREFIX=
161 PYTHONFRAMEWORKINSTALLDIR=
162 FRAMEWORKINSTALLFIRST=
163 FRAMEWORKINSTALLLAST=
164 FRAMEWORKALTINSTALLFIRST=
165 FRAMEWORKALTINSTALLLAST=
166 if test "x${prefix}" = "xNONE"; then
167 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
169 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
174 PYTHONFRAMEWORKPREFIX=$enableval
175 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
176 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
177 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure "
178 if test "$UNIVERSAL_ARCHS" = "all"
180 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
181 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkaltinstallunixtools4way"
183 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
184 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
187 if test "x${prefix}" = "xNONE" ; then
188 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
190 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
192 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
194 # Add files for Mac specific code to the list of output
196 AC_CONFIG_FILES(Mac/Makefile)
197 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
198 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
199 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
203 PYTHONFRAMEWORKDIR=no-framework
204 PYTHONFRAMEWORKPREFIX=
205 PYTHONFRAMEWORKINSTALLDIR=
206 FRAMEWORKINSTALLFIRST=
207 FRAMEWORKINSTALLLAST=
208 FRAMEWORKALTINSTALLFIRST=
209 FRAMEWORKALTINSTALLLAST=
210 if test "x${prefix}" = "xNONE" ; then
211 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
213 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
217 if test "$UNIVERSAL_ARCHS" = "all"
219 FRAMEWORKINSTALLLAST=update4wayuniversal
220 FRAMEWORKALTINSTALLLAST=update4wayuniversal
223 AC_SUBST(PYTHONFRAMEWORK)
224 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
225 AC_SUBST(PYTHONFRAMEWORKDIR)
226 AC_SUBST(PYTHONFRAMEWORKPREFIX)
227 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
228 AC_SUBST(FRAMEWORKINSTALLFIRST)
229 AC_SUBST(FRAMEWORKINSTALLLAST)
230 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
231 AC_SUBST(FRAMEWORKALTINSTALLLAST)
232 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
235 ## AC_HELP_STRING(--with-dyld,
236 ## Use (OpenStep|Rhapsody) dynamic linker))
238 # Set name for machine-dependent library files
240 AC_MSG_CHECKING(MACHDEP)
241 if test -z "$MACHDEP"
243 ac_sys_system=`uname -s`
244 if test "$ac_sys_system" = "AIX" \
245 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
246 ac_sys_release=`uname -v`
248 ac_sys_release=`uname -r`
250 ac_md_system=`echo $ac_sys_system |
251 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
252 ac_md_release=`echo $ac_sys_release |
253 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
254 MACHDEP="$ac_md_system$ac_md_release"
257 cygwin*) MACHDEP="cygwin";;
258 darwin*) MACHDEP="darwin";;
259 atheos*) MACHDEP="atheos";;
260 irix646) MACHDEP="irix6";;
261 '') MACHDEP="unknown";;
265 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
266 # disable features if it is defined, without any means to access these
267 # features as extensions. For these systems, we skip the definition of
268 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
269 # some feature, make sure there is no alternative way to access this
270 # feature. Also, when using wildcards, make sure you have verified the
271 # need for not defining _XOPEN_SOURCE on all systems matching the
272 # wildcard, and that the wildcard does not include future systems
273 # (which may remove their limitations).
274 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
275 case $ac_sys_system/$ac_sys_release in
276 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
277 # even though select is a POSIX function. Reported by J. Ribbens.
278 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
279 # In addition, Stefan Krah confirms that issue #1244610 exists through
280 # OpenBSD 4.6, but is fixed in 4.7.
281 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123456@:>@)
282 define_xopen_source=no
283 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
284 # also defined. This can be overridden by defining _BSD_SOURCE
285 # As this has a different meaning on Linux, only define it on OpenBSD
286 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
288 OpenBSD/4.@<:@789@:>@)
289 # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
290 # also defined. This can be overridden by defining _BSD_SOURCE
291 # As this has a different meaning on Linux, only define it on OpenBSD
292 AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
294 # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
295 # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
297 NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
298 define_xopen_source=no;;
299 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
300 # of union __?sigval. Reported by Stuart Bishop.
302 define_xopen_source=no;;
303 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
304 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
305 # Reconfirmed for 7.1.4 by Martin v. Loewis.
306 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
307 define_xopen_source=no;;
308 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
309 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
311 define_xopen_source=no;;
312 # On FreeBSD 4, the math functions C89 does not cover are never defined
313 # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
315 define_xopen_source=no;;
316 # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
317 # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
318 # identifies itself as Darwin/7.*
319 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
320 # disables platform specific features beyond repair.
321 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
322 # has no effect, don't bother defining them
323 Darwin/@<:@6789@:>@.*)
324 define_xopen_source=no;;
325 Darwin/1@<:@0-9@:>@.*)
326 define_xopen_source=no;;
327 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
328 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
329 # or has another value. By not (re)defining it, the defaults come in place.
331 define_xopen_source=no;;
333 if test `uname -r` -eq 1; then
334 define_xopen_source=no
337 # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
338 # defining NI_NUMERICHOST.
340 define_xopen_source=no
345 if test $define_xopen_source = yes
347 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
348 # defined precisely as g++ defines it
349 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
351 case $ac_sys_system/$ac_sys_release in
352 SunOS/5.8|SunOS/5.9|SunOS/5.10)
353 AC_DEFINE(_XOPEN_SOURCE, 500,
354 Define to the level of X/Open that your system supports)
357 AC_DEFINE(_XOPEN_SOURCE, 600,
358 Define to the level of X/Open that your system supports)
362 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
363 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
364 # several APIs are not declared. Since this is also needed in some
365 # cases for HP-UX, we define it globally.
366 # except for Solaris 10, where it must not be defined,
367 # as it implies XPG4.2
368 case $ac_sys_system/$ac_sys_release in
372 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
373 Define to activate Unix95-and-earlier features)
377 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
382 # SGI compilers allow the specification of the both the ABI and the
383 # ISA on the command line. Depending on the values of these switches,
384 # different and often incompatable code will be generated.
386 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
387 # thus supply support for various ABI/ISA combinations. The MACHDEP
388 # variable is also adjusted.
391 if test ! -z "$SGI_ABI"
394 LDFLAGS="$SGI_ABI $LDFLAGS"
395 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
397 AC_MSG_RESULT($MACHDEP)
399 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
400 # it may influence the way we can build extensions, so distutils
402 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
403 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
404 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
405 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
407 AC_MSG_CHECKING(machine type as reported by uname -m)
408 ac_sys_machine=`uname -m`
409 AC_MSG_RESULT($ac_sys_machine)
411 # checks for alternative programs
413 # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
414 # for debug/optimization stuff. BASECFLAGS is for flags that are required
415 # just to get things to compile and link. Users are free to override OPT
416 # when running configure or make. The build should not break if they do.
417 # BASECFLAGS should generally not be messed with, however.
419 # XXX shouldn't some/most/all of this code be merged with the stuff later
420 # on that fiddles with OPT and BASECFLAGS?
421 AC_MSG_CHECKING(for --without-gcc)
423 AC_HELP_STRING(--without-gcc,never use gcc),
431 without_gcc=$withval;;
433 case $ac_sys_system in
438 AC_MSG_RESULT($without_gcc)
440 # If the user switches compilers, we can't believe the cache
441 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
443 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
444 (it is also a good idea to do 'make clean' before compiling)])
451 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
452 AC_ARG_WITH(cxx_main,
453 AC_HELP_STRING([--with-cxx-main=<compiler>],
454 [compile main() and link python executable with C++ compiler]),
460 yes) with_cxx_main=yes
472 AC_MSG_RESULT($with_cxx_main)
478 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
479 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
481 if test "$CXX" = "notfound"
488 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
489 if test "$CXX" = "notfound"
494 if test "$preset_cxx" != "$CXX"
498 By default, distutils will build C++ extension modules with "$CXX".
499 If this is not intended, then set CXX on the configure command line.
504 # checks for UNIX variants that set C preprocessor variables
507 # Check for unsupported systems
508 case $ac_sys_system/$ac_sys_release in
510 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
511 echo See README for details.
516 AC_MSG_CHECKING(for --with-suffix)
518 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
525 AC_MSG_RESULT($EXEEXT)
527 # Test whether we're running on a non-case-sensitive system, in which
528 # case we give a warning if no ext is given
529 AC_SUBST(BUILDEXEEXT)
530 AC_MSG_CHECKING(for case-insensitive build directory)
531 if test ! -d CaseSensitiveTestDir; then
532 mkdir CaseSensitiveTestDir
535 if test -d casesensitivetestdir
543 rmdir CaseSensitiveTestDir
548 gcc) CC="$CC -D_HAVE_BSDI";;
552 case $ac_sys_system in
555 cc|*/cc) CC="$CC -Ae";;
558 # Some functions have a prototype only with that define, e.g. confstr
559 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
565 AC_MSG_CHECKING(LIBRARY)
566 if test -z "$LIBRARY"
568 LIBRARY='libpython$(VERSION).a'
570 AC_MSG_RESULT($LIBRARY)
572 # LDLIBRARY is the name of the library to link against (as opposed to the
573 # name of the library into which to insert object files). BLDLIBRARY is also
574 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
575 # is blank as the main program is not linked directly against LDLIBRARY.
576 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
577 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
578 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
579 # DLLLIBRARY is the shared (i.e., DLL) library.
581 # RUNSHARED is used to run shared python without installed libraries
583 # INSTSONAME is the name of the shared library that will be use to install
584 # on the system - some systems like version suffix, others don't
588 AC_SUBST(LDLIBRARYDIR)
592 BLDLIBRARY='$(LDLIBRARY)'
593 INSTSONAME='$(LDLIBRARY)'
598 # LINKCC is the command that links the python executable -- default is $(CC).
599 # If CXX is set, and if it is needed to link a main function that was
600 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
601 # python might then depend on the C++ runtime
602 # This is altered for AIX in order to build the export list before
605 AC_MSG_CHECKING(LINKCC)
608 LINKCC='$(PURIFY) $(MAINCC)'
609 case $ac_sys_system in
612 if test $ac_sys_release -ge 5 -o \
613 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
616 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
618 # qcc must be used because the other compilers do not
623 AC_MSG_RESULT($LINKCC)
625 # GNULD is set to "yes" if the GNU linker is used. If this goes wrong
626 # make sure we default having it set to "no": this is used by
627 # distutils.unixccompiler to know if it should add --enable-new-dtags
628 # to linker command lines, and failing to detect GNU ld simply results
629 # in the same bahaviour as before.
631 AC_MSG_CHECKING(for GNU ld)
633 if test "$GCC" = yes; then
634 ac_prog=`$CC -print-prog-name=ld`
636 case `"$ac_prog" -V 2>&1 < /dev/null` in
642 AC_MSG_RESULT($GNULD)
644 AC_MSG_CHECKING(for --enable-shared)
645 AC_ARG_ENABLE(shared,
646 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
648 if test -z "$enable_shared"
650 case $ac_sys_system in
652 enable_shared="yes";;
657 AC_MSG_RESULT($enable_shared)
659 AC_MSG_CHECKING(for --enable-profiling)
660 AC_ARG_ENABLE(profiling,
661 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
664 AC_TRY_RUN([int main() { return 0; }],
665 ac_enable_profiling="yes",
666 ac_enable_profiling="no",
667 ac_enable_profiling="no")
669 AC_MSG_RESULT($ac_enable_profiling)
671 case "$ac_enable_profiling" in
673 BASECFLAGS="-pg $BASECFLAGS"
674 LDFLAGS="-pg $LDFLAGS"
678 AC_MSG_CHECKING(LDLIBRARY)
680 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
681 # library that we build, but we do not want to link against it (we
682 # will find it with a -framework option). For this reason there is an
683 # extra variable BLDLIBRARY against which Python and the extension
684 # modules are linked, BLDLIBRARY. This is normally the same as
685 # LDLIBRARY, but empty for MacOSX framework builds.
686 if test "$enable_framework"
688 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
689 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
692 BLDLIBRARY='$(LDLIBRARY)'
695 # Other platforms follow
696 if test $enable_shared = "yes"; then
697 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
698 case $ac_sys_system in
700 LDLIBRARY='libpython$(VERSION).dll.a'
701 DLLLIBRARY='libpython$(VERSION).dll'
704 LDLIBRARY='libpython$(VERSION).so'
705 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
706 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
707 INSTSONAME="$LDLIBRARY".$SOVERSION
709 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
710 LDLIBRARY='libpython$(VERSION).so'
711 BLDLIBRARY='-L. -lpython$(VERSION)'
712 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
713 case $ac_sys_system in
715 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
718 INSTSONAME="$LDLIBRARY".$SOVERSION
723 LDLIBRARY='libpython$(VERSION).so'
726 LDLIBRARY='libpython$(VERSION).sl'
729 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
730 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
733 LDLIBRARY='libpython$(VERSION).so'
734 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
735 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
738 LDLIBRARY='libpython$(VERSION).so'
739 BLDLIBRARY='-L. -lpython$(VERSION)'
740 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
743 LDLIBRARY='libpython$(VERSION).dylib'
744 BLDLIBRARY='-L. -lpython$(VERSION)'
745 RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
749 else # shared is disabled
750 case $ac_sys_system in
752 BLDLIBRARY='$(LIBRARY)'
753 LDLIBRARY='libpython$(VERSION).dll.a'
758 AC_MSG_RESULT($LDLIBRARY)
762 AC_CHECK_PROGS(AR, ar aal, ar)
764 # tweak ARFLAGS only if the user didn't set it on the command line
766 if test -z "$ARFLAGS"
772 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
773 if test $SVNVERSION = found
775 SVNVERSION="svnversion \$(srcdir)"
777 SVNVERSION="echo Unversioned directory"
782 # install -d does not work on BSDI or HP-UX
783 if test -z "$INSTALL"
785 INSTALL="${srcdir}/install-sh -c"
790 # Not every filesystem supports hard links
792 if test -z "$LN" ; then
793 case $ac_sys_system in
794 CYGWIN*) LN="ln -s";;
795 atheos*) LN="ln -s";;
800 # Check for --with-pydebug
801 AC_MSG_CHECKING(for --with-pydebug)
803 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
805 if test "$withval" != no
807 AC_DEFINE(Py_DEBUG, 1,
808 [Define if you want to build an interpreter with many run-time checks.])
811 else AC_MSG_RESULT(no); Py_DEBUG='false'
815 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
816 # merged with this chunk of code?
818 # Optimizer/debugger flags
819 # ------------------------
820 # (The following bit of code is complicated enough - please keep things
821 # indented properly. Just pretend you're editing Python code. ;-)
823 # There are two parallel sets of case statements below, one that checks to
824 # see if OPT was set and one that does BASECFLAGS setting based upon
825 # compiler and platform. BASECFLAGS tweaks need to be made even if the
828 # tweak OPT based on compiler and platform, only if the user didn't set
829 # it on the command line
831 if test "${OPT-unset}" == "unset"
835 if test "$CC" != 'g++' ; then
836 STRICT_PROTO="-Wstrict-prototypes"
838 # For gcc 4.x we need to use -fwrapv so lets check if its supported
839 if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
842 case $ac_cv_prog_cc_g in
844 if test "$Py_DEBUG" = 'true' ; then
845 # Optimization messes up debuggers, so turn it off for
847 OPT="-g -Wall $STRICT_PROTO"
849 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
853 OPT="-O3 -Wall $STRICT_PROTO"
856 case $ac_sys_system in
857 SCO_SV*) OPT="$OPT -m486 -DSCO5"
870 # The -arch flags for universal builds on OSX
871 UNIVERSAL_ARCH_FLAGS=
872 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
874 # tweak BASECFLAGS based on compiler and platform
877 # Python violates C99 rules, by casting between incompatible
878 # pointer types. GCC may generate bad code as a result of that,
879 # so use -fno-strict-aliasing if supported.
880 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
882 CC="$CC -fno-strict-aliasing"
883 AC_TRY_RUN([int main() { return 0; }],
884 ac_cv_no_strict_aliasing_ok=yes,
885 ac_cv_no_strict_aliasing_ok=no,
886 ac_cv_no_strict_aliasing_ok=no)
888 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
889 if test $ac_cv_no_strict_aliasing_ok = yes
891 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
894 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
895 # support. Without this, treatment of subnormals doesn't follow
897 case $ac_sys_machine in
899 BASECFLAGS="$BASECFLAGS -mieee"
903 case $ac_sys_system in
905 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
907 # is there any other compiler on Darwin besides gcc?
909 # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
910 # used to be here, but non-Apple gcc doesn't accept them.
913 if test "${enable_universalsdk}"; then
914 UNIVERSAL_ARCH_FLAGS=""
915 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
916 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
919 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
920 UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
921 ARCH_RUN_32BIT="true"
923 elif test "$UNIVERSAL_ARCHS" = "all" ; then
924 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
925 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
927 elif test "$UNIVERSAL_ARCHS" = "intel" ; then
928 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
929 ARCH_RUN_32BIT="/usr/bin/arch -i386"
931 elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
932 UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
933 ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc"
936 AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
941 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
942 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
943 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
944 CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
948 # Calculate the right deployment target for this build.
950 cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
951 if test ${cur_target} '>' 10.2; then
953 if test ${enable_universalsdk}; then
954 if test "${UNIVERSAL_ARCHS}" = "all"; then
955 # Ensure that the default platform for a
956 # 4-way universal build is OSX 10.5,
957 # that's the first OS release where
958 # 4-way builds make sense.
961 elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
964 elif test "${UNIVERSAL_ARCHS}" = "intel"; then
967 elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
971 if test `/usr/bin/arch` = "i386"; then
972 # On Intel macs default to a deployment
973 # target of 10.4, that's the first OSX
974 # release with Intel support.
979 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
981 # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
982 # environment with a value that is the same as what we'll use
983 # in the Makefile to ensure that we'll get the same compiler
984 # environment during configure and build time.
985 MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
986 export MACOSX_DEPLOYMENT_TARGET
987 EXPORT_MACOSX_DEPLOYMENT_TARGET=''
991 BASECFLAGS="$BASECFLAGS -mieee"
997 case $ac_sys_system in
999 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1002 BASECFLAGS="$BASECFLAGS -ieee -std"
1005 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1011 if test "$Py_DEBUG" = 'true'; then
1017 if test "$ac_arch_flags"
1019 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1022 # disable check for icc since it seems to pass, but generates a warning
1025 ac_cv_opt_olimit_ok=no
1028 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1029 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1031 CC="$CC -OPT:Olimit=0"
1032 AC_TRY_RUN([int main() { return 0; }],
1033 ac_cv_opt_olimit_ok=yes,
1034 ac_cv_opt_olimit_ok=no,
1035 ac_cv_opt_olimit_ok=no)
1037 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1038 if test $ac_cv_opt_olimit_ok = yes; then
1039 case $ac_sys_system in
1040 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1041 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
1046 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1050 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1051 AC_CACHE_VAL(ac_cv_olimit_ok,
1053 CC="$CC -Olimit 1500"
1054 AC_TRY_RUN([int main() { return 0; }],
1055 ac_cv_olimit_ok=yes,
1059 AC_MSG_RESULT($ac_cv_olimit_ok)
1060 if test $ac_cv_olimit_ok = yes; then
1061 BASECFLAGS="$BASECFLAGS -Olimit 1500"
1065 # Check whether GCC supports PyArg_ParseTuple format
1066 if test "$GCC" = "yes"
1068 AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1070 CFLAGS="$CFLAGS -Werror"
1072 void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1074 AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1081 # On some compilers, pthreads are available without further options
1082 # (e.g. MacOS X). On some of these systems, the compiler will not
1083 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1084 # So we have to see first whether pthreads are available without
1085 # options before we can check whether -Kpthread improves anything.
1086 AC_MSG_CHECKING(whether pthreads are available without options)
1087 AC_CACHE_VAL(ac_cv_pthread_is_default,
1089 #include <pthread.h>
1091 void* routine(void* p){return NULL;}
1095 if(pthread_create(&p,NULL,routine,NULL)!=0)
1097 (void)pthread_detach(p);
1102 ac_cv_pthread_is_default=yes
1106 ac_cv_pthread_is_default=no,
1107 ac_cv_pthread_is_default=no)
1109 AC_MSG_RESULT($ac_cv_pthread_is_default)
1112 if test $ac_cv_pthread_is_default = yes
1116 # -Kpthread, if available, provides the right #defines
1117 # and linker options to make pthread_create available
1118 # Some compilers won't report that they do not support -Kpthread,
1119 # so we need to run a program to see whether it really made the
1120 # function available.
1121 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1122 AC_CACHE_VAL(ac_cv_kpthread,
1126 #include <pthread.h>
1128 void* routine(void* p){return NULL;}
1132 if(pthread_create(&p,NULL,routine,NULL)!=0)
1134 (void)pthread_detach(p);
1142 AC_MSG_RESULT($ac_cv_kpthread)
1145 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1147 # -Kthread, if available, provides the right #defines
1148 # and linker options to make pthread_create available
1149 # Some compilers won't report that they do not support -Kthread,
1150 # so we need to run a program to see whether it really made the
1151 # function available.
1152 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1153 AC_CACHE_VAL(ac_cv_kthread,
1157 #include <pthread.h>
1159 void* routine(void* p){return NULL;}
1163 if(pthread_create(&p,NULL,routine,NULL)!=0)
1165 (void)pthread_detach(p);
1173 AC_MSG_RESULT($ac_cv_kthread)
1176 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1178 # -pthread, if available, provides the right #defines
1179 # and linker options to make pthread_create available
1180 # Some compilers won't report that they do not support -pthread,
1181 # so we need to run a program to see whether it really made the
1182 # function available.
1183 AC_MSG_CHECKING(whether $CC accepts -pthread)
1184 AC_CACHE_VAL(ac_cv_thread,
1188 #include <pthread.h>
1190 void* routine(void* p){return NULL;}
1194 if(pthread_create(&p,NULL,routine,NULL)!=0)
1196 (void)pthread_detach(p);
1204 AC_MSG_RESULT($ac_cv_pthread)
1207 # If we have set a CC compiler flag for thread support then
1208 # check if it works for CXX, too.
1212 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1215 if test "$ac_cv_kpthread" = "yes"
1217 CXX="$CXX -Kpthread"
1218 ac_cv_cxx_thread=yes
1219 elif test "$ac_cv_kthread" = "yes"
1222 ac_cv_cxx_thread=yes
1223 elif test "$ac_cv_pthread" = "yes"
1226 ac_cv_cxx_thread=yes
1229 if test $ac_cv_cxx_thread = yes
1231 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1232 $CXX -c conftest.$ac_ext 2>&5
1233 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1234 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1236 ac_cv_cxx_thread=yes
1242 AC_MSG_RESULT($ac_cv_cxx_thread)
1246 dnl # check for ANSI or K&R ("traditional") preprocessor
1247 dnl AC_MSG_CHECKING(for C preprocessor type)
1248 dnl AC_TRY_COMPILE([
1249 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1251 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1252 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1253 dnl AC_MSG_RESULT($cpp_type)
1255 # checks for header files
1257 AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1259 ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1260 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1262 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1263 sys/lock.h sys/mkdev.h sys/modem.h \
1264 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1265 sys/termio.h sys/time.h \
1266 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1267 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1268 bluetooth/bluetooth.h linux/tipc.h)
1272 # On Solaris, term.h requires curses.h
1273 AC_CHECK_HEADERS(term.h,,,[
1274 #ifdef HAVE_CURSES_H
1279 # On Linux, netlink.h requires asm/types.h
1280 AC_CHECK_HEADERS(linux/netlink.h,,,[
1281 #ifdef HAVE_ASM_TYPES_H
1282 #include <asm/types.h>
1284 #ifdef HAVE_SYS_SOCKET_H
1285 #include <sys/socket.h>
1289 # checks for typedefs
1291 AC_MSG_CHECKING(for clock_t in time.h)
1292 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1293 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1295 AC_MSG_RESULT($was_it_defined)
1297 # Check whether using makedev requires defining _OSF_SOURCE
1298 AC_MSG_CHECKING(for makedev)
1299 AC_TRY_LINK([#include <sys/types.h> ],
1301 ac_cv_has_makedev=yes,
1302 ac_cv_has_makedev=no)
1303 if test "$ac_cv_has_makedev" = "no"; then
1304 # we didn't link, try if _OSF_SOURCE will allow us to link
1306 #define _OSF_SOURCE 1
1307 #include <sys/types.h>
1310 ac_cv_has_makedev=yes,
1311 ac_cv_has_makedev=no)
1312 if test "$ac_cv_has_makedev" = "yes"; then
1313 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1316 AC_MSG_RESULT($ac_cv_has_makedev)
1317 if test "$ac_cv_has_makedev" = "yes"; then
1318 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1321 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1322 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1323 # defined, but the compiler does not support pragma redefine_extname,
1324 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1325 # structures (such as rlimit64) without declaring them. As a
1326 # work-around, disable LFS on such configurations
1329 AC_MSG_CHECKING(Solaris LFS bug)
1331 #define _LARGEFILE_SOURCE 1
1332 #define _FILE_OFFSET_BITS 64
1333 #include <sys/resource.h>
1334 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1335 AC_MSG_RESULT($sol_lfs_bug)
1336 if test "$sol_lfs_bug" = "yes"; then
1340 if test "$use_lfs" = "yes"; then
1341 # Two defines needed to enable largefile support on various platforms
1342 # These may affect some typedefs
1343 AC_DEFINE(_LARGEFILE_SOURCE, 1,
1344 [This must be defined on some systems to enable large file support.])
1345 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1346 [This must be set to 64 on some systems to enable large file support.])
1349 # Add some code to confdefs.h so that the test for off_t works on SCO
1350 cat >> confdefs.h <<\EOF
1356 # Type availability checks
1367 AC_CHECK_TYPE(ssize_t,
1368 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1370 # Sizes of various common basic types
1371 # ANSI C requires sizeof(char) == 1, so no need to check it
1372 AC_CHECK_SIZEOF(int, 4)
1373 AC_CHECK_SIZEOF(long, 4)
1374 AC_CHECK_SIZEOF(void *, 4)
1375 AC_CHECK_SIZEOF(short, 2)
1376 AC_CHECK_SIZEOF(float, 4)
1377 AC_CHECK_SIZEOF(double, 8)
1378 AC_CHECK_SIZEOF(fpos_t, 4)
1379 AC_CHECK_SIZEOF(size_t, 4)
1380 AC_CHECK_SIZEOF(pid_t, 4)
1382 AC_MSG_CHECKING(for long long support)
1384 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1385 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1388 AC_MSG_RESULT($have_long_long)
1389 if test "$have_long_long" = yes ; then
1390 AC_CHECK_SIZEOF(long long, 8)
1393 AC_MSG_CHECKING(for long double support)
1395 AC_TRY_COMPILE([], [long double x; x = (long double)0;], [
1396 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1397 have_long_double=yes
1399 AC_MSG_RESULT($have_long_double)
1400 if test "$have_long_double" = yes ; then
1401 AC_CHECK_SIZEOF(long double, 16)
1405 AC_MSG_CHECKING(for _Bool support)
1407 AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1408 AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
1411 AC_MSG_RESULT($have_c99_bool)
1412 if test "$have_c99_bool" = yes ; then
1413 AC_CHECK_SIZEOF(_Bool, 1)
1416 AC_CHECK_TYPES(uintptr_t,
1417 [AC_CHECK_SIZEOF(uintptr_t, 4)],
1418 [], [#ifdef HAVE_STDINT_H
1423 # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1424 AC_MSG_CHECKING(size of off_t)
1425 AC_CACHE_VAL(ac_cv_sizeof_off_t,
1426 [AC_TRY_RUN([#include <stdio.h>
1427 #include <sys/types.h>
1430 FILE *f=fopen("conftestval", "w");
1432 fprintf(f, "%d\n", sizeof(off_t));
1435 ac_cv_sizeof_off_t=`cat conftestval`,
1436 ac_cv_sizeof_off_t=0,
1437 ac_cv_sizeof_off_t=4)
1439 AC_MSG_RESULT($ac_cv_sizeof_off_t)
1440 AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1441 [The number of bytes in an off_t.])
1443 AC_MSG_CHECKING(whether to enable large file support)
1444 if test "$have_long_long" = yes
1446 if test "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1447 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1448 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1449 [Defined to enable large file support when an off_t is bigger than a long
1450 and long long is available and at least as big as an off_t. You may need
1451 to add some flags for configuration and compilation to enable this mode.
1452 (For Solaris and Linux, the necessary defines are already defined.)])
1461 # AC_CHECK_SIZEOF() doesn't include <time.h>.
1462 AC_MSG_CHECKING(size of time_t)
1463 AC_CACHE_VAL(ac_cv_sizeof_time_t,
1464 [AC_TRY_RUN([#include <stdio.h>
1468 FILE *f=fopen("conftestval", "w");
1470 fprintf(f, "%d\n", sizeof(time_t));
1473 ac_cv_sizeof_time_t=`cat conftestval`,
1474 ac_cv_sizeof_time_t=0,
1475 ac_cv_sizeof_time_t=4)
1477 AC_MSG_RESULT($ac_cv_sizeof_time_t)
1478 AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
1479 [The number of bytes in a time_t.])
1482 # if have pthread_t then define SIZEOF_PTHREAD_T
1484 if test "$ac_cv_kpthread" = "yes"
1485 then CC="$CC -Kpthread"
1486 elif test "$ac_cv_kthread" = "yes"
1487 then CC="$CC -Kthread"
1488 elif test "$ac_cv_pthread" = "yes"
1489 then CC="$CC -pthread"
1491 AC_MSG_CHECKING(for pthread_t)
1493 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1494 AC_MSG_RESULT($have_pthread_t)
1495 if test "$have_pthread_t" = yes ; then
1496 # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
1497 AC_MSG_CHECKING(size of pthread_t)
1498 AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
1499 [AC_TRY_RUN([#include <stdio.h>
1500 #include <pthread.h>
1503 FILE *f=fopen("conftestval", "w");
1505 fprintf(f, "%d\n", sizeof(pthread_t));
1508 ac_cv_sizeof_pthread_t=`cat conftestval`,
1509 ac_cv_sizeof_pthread_t=0,
1510 ac_cv_sizeof_pthread_t=4)
1512 AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
1513 AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
1514 [The number of bytes in a pthread_t.])
1520 AC_SUBST(OTHER_LIBTOOL_OPT)
1521 case $ac_sys_system/$ac_sys_release in
1522 Darwin/@<:@01567@:>@\..*)
1523 OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1526 OTHER_LIBTOOL_OPT=""
1532 AC_SUBST(LIBTOOL_CRUFT)
1533 case $ac_sys_system/$ac_sys_release in
1534 Darwin/@<:@01567@:>@\..*)
1535 LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1536 if test "${enable_universalsdk}"; then
1539 LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `/usr/bin/arch`"
1541 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1542 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1544 gcc_version=`gcc -dumpversion`
1545 if test ${gcc_version} '<' 4.0
1547 LIBTOOL_CRUFT="-lcc_dynamic"
1553 int main(int argc, char*argv[])
1555 if (sizeof(long) == 4) {
1561 ], ac_osx_32bit=yes,
1565 if test "${ac_osx_32bit}" = "yes"; then
1566 case `/usr/bin/arch` in
1568 MACOSX_DEFAULT_ARCH="i386"
1571 MACOSX_DEFAULT_ARCH="ppc"
1574 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1578 case `/usr/bin/arch` in
1580 MACOSX_DEFAULT_ARCH="x86_64"
1583 MACOSX_DEFAULT_ARCH="ppc64"
1586 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1590 #ARCH_RUN_32BIT="true"
1593 LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
1594 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1595 LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1598 AC_MSG_CHECKING(for --enable-framework)
1599 if test "$enable_framework"
1601 BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1602 # -F. is needed to allow linking to the framework while
1603 # in the build location.
1604 AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
1605 [Define if you want to produce an OpenStep/Rhapsody framework
1606 (shared library plus accessory files).])
1608 if test $enable_shared = "yes"
1610 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead])
1616 AC_MSG_CHECKING(for dyld)
1617 case $ac_sys_system/$ac_sys_release in
1619 AC_DEFINE(WITH_DYLD, 1,
1620 [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1621 dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1622 linker (rld). Dyld is necessary to support frameworks.])
1623 AC_MSG_RESULT(always on for Darwin)
1630 # Set info about shared libraries.
1635 AC_SUBST(LINKFORSHARED)
1636 # SO is the extension of shared libraries `(including the dot!)
1637 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1641 case $ac_sys_system in
1652 # this might also be a termcap variable, see #610332
1654 echo '====================================================================='
1656 echo '+ WARNING: You have set SO in your environment. +'
1657 echo '+ Do you really mean to change the extension for shared libraries? +'
1658 echo '+ Continuing in 10 seconds to let you to ponder. +'
1660 echo '====================================================================='
1665 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1666 # LDSHARED is the ld *command* used to create shared library
1667 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1668 # (Shared libraries in this instance are shared modules to be loaded into
1669 # Python, as opposed to building Python itself as a shared library.)
1670 AC_MSG_CHECKING(LDSHARED)
1671 if test -z "$LDSHARED"
1673 case $ac_sys_system/$ac_sys_release in
1675 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1676 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1678 IRIX/5*) LDSHARED="ld -shared";;
1679 IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1681 if test "$GCC" = "yes"
1682 then LDSHARED='$(CC) -shared'
1683 else LDSHARED='$(CC) -G';
1686 if test "$GCC" = "yes"
1687 then LDSHARED='$(CC) -shared'
1688 else LDSHARED='ld -b';
1690 OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1692 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1693 if test "$enable_framework" ; then
1694 # Link against the framework. All externals should be defined.
1695 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1696 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1698 # No framework. Ignore undefined symbols, assuming they come from Python
1699 LDSHARED="$LDSHARED -undefined suppress"
1701 Darwin/1.4*|Darwin/5.*|Darwin/6.*)
1702 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1703 if test "$enable_framework" ; then
1704 # Link against the framework. All externals should be defined.
1705 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1706 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1708 # No framework, use the Python app as bundle-loader
1709 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1710 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1713 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1714 # This allows an extension to be used in any Python
1716 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
1718 if test "${enable_universalsdk}"; then
1719 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1721 LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1722 BLDSHARED="$LDSHARED"
1724 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1725 if test "$enable_framework" ; then
1726 # Link against the framework. All externals should be defined.
1727 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1728 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1730 # No framework, use the Python app as bundle-loader
1731 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1732 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1736 Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
1737 BSD/OS*/4*) LDSHARED="gcc -shared";;
1739 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1741 LDSHARED="$CC -shared ${LDFLAGS}"
1743 LDSHARED="ld -Bshareable ${LDFLAGS}"
1746 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1748 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1751 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1752 LDSHARED="ld -Bshareable ${LDFLAGS}"
1755 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1759 NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1760 OpenUNIX*|UnixWare*)
1761 if test "$GCC" = "yes"
1762 then LDSHARED='$(CC) -shared'
1763 else LDSHARED='$(CC) -G'
1765 SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1766 CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1767 atheos*) LDSHARED="gcc -shared";;
1771 AC_MSG_RESULT($LDSHARED)
1772 BLDSHARED=${BLDSHARED-$LDSHARED}
1773 # CCSHARED are the C *flags* used to create objects to go into a shared
1774 # library (module) -- this is only needed for a few systems
1775 AC_MSG_CHECKING(CCSHARED)
1776 if test -z "$CCSHARED"
1778 case $ac_sys_system/$ac_sys_release in
1779 SunOS*) if test "$GCC" = yes;
1780 then CCSHARED="-fPIC";
1781 elif test `uname -p` = sparc;
1782 then CCSHARED="-xcode=pic32";
1783 else CCSHARED="-Kpic";
1785 hp*|HP*) if test "$GCC" = yes;
1786 then CCSHARED="-fPIC";
1789 Linux*|GNU*) CCSHARED="-fPIC";;
1790 BSD/OS*/4*) CCSHARED="-fpic";;
1791 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1792 OpenUNIX*|UnixWare*)
1793 if test "$GCC" = "yes"
1794 then CCSHARED="-fPIC"
1795 else CCSHARED="-KPIC"
1798 if test "$GCC" = "yes"
1799 then CCSHARED="-fPIC"
1800 else CCSHARED="-Kpic -belf"
1802 IRIX*/6*) case $CC in
1803 *gcc*) CCSHARED="-shared";;
1806 atheos*) CCSHARED="-fPIC";;
1809 AC_MSG_RESULT($CCSHARED)
1810 # LINKFORSHARED are the flags passed to the $(CC) command that links
1811 # the python executable -- this is only needed for a few systems
1812 AC_MSG_CHECKING(LINKFORSHARED)
1813 if test -z "$LINKFORSHARED"
1815 case $ac_sys_system/$ac_sys_release in
1816 AIX*) LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1818 LINKFORSHARED="-Wl,-E -Wl,+s";;
1819 # LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1820 BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1821 Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1822 # -u libsys_s pulls in all symbols in libsys
1824 LINKFORSHARED="$extra_undefs -framework CoreFoundation"
1825 if test "$enable_framework"
1827 LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1829 LINKFORSHARED="$LINKFORSHARED";;
1830 OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1831 SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1832 ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1833 FreeBSD*|NetBSD*|OpenBSD*|DragonFly*)
1834 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1836 LINKFORSHARED="-Wl,--export-dynamic"
1838 SunOS/5*) case $CC in
1840 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1842 LINKFORSHARED="-Xlinker --export-dynamic"
1846 if test $enable_shared = "no"
1848 LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1851 # -Wl,-E causes the symbols to be added to the dynamic
1852 # symbol table so that they can be found when a module
1853 # is loaded. -N 2048K causes the stack size to be set
1854 # to 2048 kilobytes so that the stack doesn't overflow
1855 # when running test_compile.py.
1856 LINKFORSHARED='-Wl,-E -N 2048K';;
1859 AC_MSG_RESULT($LINKFORSHARED)
1862 AC_SUBST(CFLAGSFORSHARED)
1863 AC_MSG_CHECKING(CFLAGSFORSHARED)
1864 if test ! "$LIBRARY" = "$LDLIBRARY"
1866 case $ac_sys_system in
1868 # Cygwin needs CCSHARED when building extension DLLs
1869 # but not when building the interpreter DLL.
1870 CFLAGSFORSHARED='';;
1872 CFLAGSFORSHARED='$(CCSHARED)'
1875 AC_MSG_RESULT($CFLAGSFORSHARED)
1877 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1878 # library (with --enable-shared).
1879 # For platforms on which shared libraries are not allowed to have unresolved
1880 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1881 # if it is not required, since it creates a dependency of the shared library
1882 # to LIBS. This, in turn, means that applications linking the shared libpython
1883 # don't need to link LIBS explicitly. The default should be only changed
1884 # on systems where this approach causes problems.
1886 AC_MSG_CHECKING(SHLIBS)
1887 case "$ac_sys_system" in
1891 AC_MSG_RESULT($SHLIBS)
1894 # checks for libraries
1895 AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
1896 AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
1898 # only check for sem_init if thread support is requested
1899 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1900 AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1901 # posix4 on Solaris 2.6
1902 # pthread (first!) on Linux
1905 # check if we need libintl for locale functions
1906 AC_CHECK_LIB(intl, textdomain,
1907 [AC_DEFINE(WITH_LIBINTL, 1,
1908 [Define to 1 if libintl is needed for locale functions.])
1909 LIBS="-lintl $LIBS"])
1911 # checks for system dependent C++ extensions support
1912 case "$ac_sys_system" in
1913 AIX*) AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1914 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1915 [loadAndInit("", 0, "")],
1916 [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1917 [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1918 and you want support for AIX C++ shared extension modules.])
1919 AC_MSG_RESULT(yes)],
1920 [AC_MSG_RESULT(no)]);;
1924 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1925 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1926 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1928 AC_MSG_CHECKING(for --with-libs)
1930 AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1932 AC_MSG_RESULT($withval)
1933 LIBS="$withval $LIBS"
1935 [AC_MSG_RESULT(no)])
1937 # Check for use of the system libffi library
1938 AC_MSG_CHECKING(for --with-system-ffi)
1939 AC_ARG_WITH(system_ffi,
1940 AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
1942 AC_MSG_RESULT($with_system_ffi)
1944 # Check for --with-dbmliborder
1945 AC_MSG_CHECKING(for --with-dbmliborder)
1946 AC_ARG_WITH(dbmliborder,
1947 AC_HELP_STRING([--with-dbmliborder=db1:db2:...], [order to check db backends for dbm. Valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
1949 if test x$with_dbmliborder = xyes
1951 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1953 for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
1954 if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
1956 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1960 AC_MSG_RESULT($with_dbmliborder)
1962 # Determine if signalmodule should be used.
1963 AC_SUBST(USE_SIGNAL_MODULE)
1964 AC_SUBST(SIGNAL_OBJS)
1965 AC_MSG_CHECKING(for --with-signal-module)
1966 AC_ARG_WITH(signal-module,
1967 AC_HELP_STRING(--with-signal-module, disable/enable signal module))
1969 if test -z "$with_signal_module"
1970 then with_signal_module="yes"
1972 AC_MSG_RESULT($with_signal_module)
1974 if test "${with_signal_module}" = "yes"; then
1975 USE_SIGNAL_MODULE=""
1978 USE_SIGNAL_MODULE="#"
1979 SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
1982 # This is used to generate Setup.config
1983 AC_SUBST(USE_THREAD_MODULE)
1984 USE_THREAD_MODULE=""
1986 AC_MSG_CHECKING(for --with-dec-threads)
1988 AC_ARG_WITH(dec-threads,
1989 AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
1991 AC_MSG_RESULT($withval)
1993 if test "${with_thread+set}" != set; then
1994 with_thread="$withval";
1996 [AC_MSG_RESULT(no)])
1998 # Templates for things AC_DEFINEd more than once.
1999 # For a single AC_DEFINE, no template is needed.
2000 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2001 AH_TEMPLATE(_REENTRANT,
2002 [Define to force use of thread-safe errno, h_errno, and other functions])
2003 AH_TEMPLATE(WITH_THREAD,
2004 [Define if you want to compile in rudimentary thread support])
2006 AC_MSG_CHECKING(for --with-threads)
2007 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2008 AC_ARG_WITH(threads,
2009 AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
2011 # --with-thread is deprecated, but check for it anyway
2012 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2014 AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2015 [with_threads=$with_thread])
2017 if test -z "$with_threads"
2018 then with_threads="yes"
2020 AC_MSG_RESULT($with_threads)
2023 if test "$with_threads" = "no"
2025 USE_THREAD_MODULE="#"
2026 elif test "$ac_cv_pthread_is_default" = yes
2028 AC_DEFINE(WITH_THREAD)
2029 # Defining _REENTRANT on system with POSIX threads should not hurt.
2030 AC_DEFINE(_REENTRANT)
2032 THREADOBJ="Python/thread.o"
2033 elif test "$ac_cv_kpthread" = "yes"
2036 if test "$ac_cv_cxx_thread" = "yes"; then
2037 CXX="$CXX -Kpthread"
2039 AC_DEFINE(WITH_THREAD)
2041 THREADOBJ="Python/thread.o"
2042 elif test "$ac_cv_kthread" = "yes"
2045 if test "$ac_cv_cxx_thread" = "yes"; then
2048 AC_DEFINE(WITH_THREAD)
2050 THREADOBJ="Python/thread.o"
2051 elif test "$ac_cv_pthread" = "yes"
2054 if test "$ac_cv_cxx_thread" = "yes"; then
2057 AC_DEFINE(WITH_THREAD)
2059 THREADOBJ="Python/thread.o"
2061 if test ! -z "$with_threads" -a -d "$with_threads"
2062 then LDFLAGS="$LDFLAGS -L$with_threads"
2064 if test ! -z "$withval" -a -d "$withval"
2065 then LDFLAGS="$LDFLAGS -L$withval"
2068 # According to the POSIX spec, a pthreads implementation must
2069 # define _POSIX_THREADS in unistd.h. Some apparently don't
2070 # (e.g. gnu pth with pthread emulation)
2071 AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2075 #ifdef _POSIX_THREADS
2078 ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2079 AC_MSG_RESULT($unistd_defines_pthreads)
2081 AC_DEFINE(_REENTRANT)
2082 AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2083 AC_DEFINE(C_THREADS)
2084 AC_DEFINE(HURD_C_THREADS, 1,
2085 [Define if you are using Mach cthreads directly under /include])
2086 LIBS="$LIBS -lthreads"
2087 THREADOBJ="Python/thread.o"],[
2088 AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2089 AC_DEFINE(C_THREADS)
2090 AC_DEFINE(MACH_C_THREADS, 1,
2091 [Define if you are using Mach cthreads under mach /])
2092 THREADOBJ="Python/thread.o"],[
2093 AC_MSG_CHECKING(for --with-pth)
2095 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2096 [AC_MSG_RESULT($withval)
2097 AC_DEFINE([WITH_THREAD])
2098 AC_DEFINE([HAVE_PTH], 1,
2099 [Define if you have GNU PTH threads.])
2101 THREADOBJ="Python/thread.o"],
2104 # Just looking for pthread_create in libpthread is not enough:
2105 # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2106 # So we really have to include pthread.h, and then link.
2108 LIBS="$LIBS -lpthread"
2109 AC_MSG_CHECKING([for pthread_create in -lpthread])
2110 AC_TRY_LINK([#include <pthread.h>
2112 void * start_routine (void *arg) { exit (0); }], [
2113 pthread_create (NULL, NULL, start_routine, NULL)], [
2115 AC_DEFINE(WITH_THREAD)
2117 THREADOBJ="Python/thread.o"],[
2119 AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2121 THREADOBJ="Python/thread.o"],[
2122 AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2123 AC_DEFINE(ATHEOS_THREADS, 1,
2124 [Define this if you have AtheOS threads.])
2125 THREADOBJ="Python/thread.o"],[
2126 AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2128 LIBS="$LIBS -lpthreads"
2129 THREADOBJ="Python/thread.o"], [
2130 AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2133 THREADOBJ="Python/thread.o"], [
2134 AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2136 LIBS="$LIBS -lpthread"
2137 THREADOBJ="Python/thread.o"], [
2138 AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2141 THREADOBJ="Python/thread.o"],[
2142 USE_THREAD_MODULE="#"])
2145 AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2147 THREADOBJ="Python/thread.o"
2148 USE_THREAD_MODULE=""])
2150 if test "$posix_threads" != "yes"; then
2151 AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2152 LIBS="$LIBS -lthread"
2153 THREADOBJ="Python/thread.o"
2154 USE_THREAD_MODULE=""])
2157 if test "$USE_THREAD_MODULE" != "#"
2159 # If the above checks didn't disable threads, (at least) OSF1
2160 # needs this '-threads' argument during linking.
2161 case $ac_sys_system in
2162 OSF1) LDLAST=-threads;;
2167 if test "$posix_threads" = "yes"; then
2168 if test "$unistd_defines_pthreads" = "no"; then
2169 AC_DEFINE(_POSIX_THREADS, 1,
2170 [Define if you have POSIX threads,
2171 and your system does not define that.])
2174 # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2175 case $ac_sys_system/$ac_sys_release in
2176 SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2177 Defined for Solaris 2.6 bug in pthread header.)
2179 SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2180 Define if the Posix semaphores do not work on your system)
2182 AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2183 Define if the Posix semaphores do not work on your system)
2187 AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2188 AC_CACHE_VAL(ac_cv_pthread_system_supported,
2189 [AC_TRY_RUN([#include <pthread.h>
2190 void *foo(void *parm) {
2194 pthread_attr_t attr;
2196 if (pthread_attr_init(&attr)) exit(-1);
2197 if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2198 if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2201 ac_cv_pthread_system_supported=yes,
2202 ac_cv_pthread_system_supported=no,
2203 ac_cv_pthread_system_supported=no)
2205 AC_MSG_RESULT($ac_cv_pthread_system_supported)
2206 if test "$ac_cv_pthread_system_supported" = "yes"; then
2207 AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2209 AC_CHECK_FUNCS(pthread_sigmask,
2210 [case $ac_sys_system in
2212 AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2213 [Define if pthread_sigmask() does not work on your system.])
2219 # Check for enable-ipv6
2220 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2221 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2223 [ --enable-ipv6 Enable ipv6 (with ipv4) support
2224 --disable-ipv6 Disable ipv6 support],
2225 [ case "$enableval" in
2230 *) AC_MSG_RESULT(yes)
2231 AC_DEFINE(ENABLE_IPV6)
2237 dnl the check does not work on cross compilation case...
2238 AC_TRY_RUN([ /* AF_INET6 available check */
2239 #include <sys/types.h>
2240 #include <sys/socket.h>
2243 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2257 if test "$ipv6" = "yes"; then
2258 AC_MSG_CHECKING(if RFC2553 API is available)
2259 AC_TRY_COMPILE([#include <sys/types.h>
2260 #include <netinet/in.h>],
2261 [struct sockaddr_in6 x;
2265 AC_MSG_RESULT(no, IPv6 disabled)
2269 if test "$ipv6" = "yes"; then
2270 AC_DEFINE(ENABLE_IPV6)
2278 if test "$ipv6" = "yes"; then
2279 AC_MSG_CHECKING([ipv6 stack type])
2280 for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2284 dnl http://www.kame.net/
2286 #include <netinet/in.h>
2287 #ifdef IPV6_INRIA_VERSION
2293 dnl http://www.kame.net/
2295 #include <netinet/in.h>
2301 ipv6libdir=/usr/local/v6/lib
2305 dnl http://www.v6.linux.or.jp/
2307 #include <features.h>
2308 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2315 dnl http://www.v6.linux.or.jp/
2316 if test -d /usr/inet6; then
2319 ipv6libdir=/usr/inet6/lib
2320 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2324 if test -f /etc/netconfig; then
2325 if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2333 #include <sys/param.h>
2334 #ifdef _TOSHIBA_INET6
2339 ipv6libdir=/usr/local/v6/lib])
2343 #include </usr/local/v6/include/sys/v6config.h>
2349 ipv6libdir=/usr/local/v6/lib;
2350 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2354 #include <sys/param.h>
2355 #ifdef _ZETA_MINAMI_INET6
2360 ipv6libdir=/usr/local/v6/lib])
2363 if test "$ipv6type" != "unknown"; then
2367 AC_MSG_RESULT($ipv6type)
2370 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2371 if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2372 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2373 echo "using lib$ipv6lib"
2375 if test $ipv6trylibc = "yes"; then
2378 echo 'Fatal: no $ipv6lib library found. cannot continue.'
2379 echo "You need to fetch lib$ipv6lib.a from appropriate"
2380 echo 'ipv6 kit and compile beforehand.'
2386 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2387 AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2388 AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2393 # Check for --with-doc-strings
2394 AC_MSG_CHECKING(for --with-doc-strings)
2395 AC_ARG_WITH(doc-strings,
2396 AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2398 if test -z "$with_doc_strings"
2399 then with_doc_strings="yes"
2401 if test "$with_doc_strings" != "no"
2403 AC_DEFINE(WITH_DOC_STRINGS, 1,
2404 [Define if you want documentation strings in extension modules])
2406 AC_MSG_RESULT($with_doc_strings)
2408 # Check for Python-specific malloc support
2409 AC_MSG_CHECKING(for --with-tsc)
2411 [ --with(out)-tsc enable/disable timestamp counter profile], [
2412 if test "$withval" != no
2414 AC_DEFINE(WITH_TSC, 1,
2415 [Define to profile with the Pentium timestamp counter])
2417 else AC_MSG_RESULT(no)
2419 [AC_MSG_RESULT(no)])
2421 # Check for Python-specific malloc support
2422 AC_MSG_CHECKING(for --with-pymalloc)
2423 AC_ARG_WITH(pymalloc,
2424 AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2426 if test -z "$with_pymalloc"
2427 then with_pymalloc="yes"
2429 if test "$with_pymalloc" != "no"
2431 AC_DEFINE(WITH_PYMALLOC, 1,
2432 [Define if you want to compile in Python-specific mallocs])
2434 AC_MSG_RESULT($with_pymalloc)
2436 # Check for --with-wctype-functions
2437 AC_MSG_CHECKING(for --with-wctype-functions)
2438 AC_ARG_WITH(wctype-functions,
2439 AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2441 if test "$withval" != no
2443 AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2444 [Define if you want wctype.h functions to be used instead of the
2445 one supplied by Python itself. (see Include/unicodectype.h).])
2447 else AC_MSG_RESULT(no)
2449 [AC_MSG_RESULT(no)])
2451 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2455 # the dlopen() function means we might want to use dynload_shlib.o. some
2456 # platforms, such as AIX, have dlopen(), but don't want to use it.
2457 AC_CHECK_FUNCS(dlopen)
2459 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2460 # loading of modules.
2461 AC_SUBST(DYNLOADFILE)
2462 AC_MSG_CHECKING(DYNLOADFILE)
2463 if test -z "$DYNLOADFILE"
2465 case $ac_sys_system/$ac_sys_release in
2466 AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2467 if test "$ac_cv_func_dlopen" = yes
2468 then DYNLOADFILE="dynload_shlib.o"
2469 else DYNLOADFILE="dynload_aix.o"
2472 hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2473 # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2474 Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2475 atheos*) DYNLOADFILE="dynload_atheos.o";;
2477 # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2478 # out any dynamic loading
2479 if test "$ac_cv_func_dlopen" = yes
2480 then DYNLOADFILE="dynload_shlib.o"
2481 else DYNLOADFILE="dynload_stub.o"
2486 AC_MSG_RESULT($DYNLOADFILE)
2487 if test "$DYNLOADFILE" != "dynload_stub.o"
2489 AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2490 [Defined when any dynamic module loading is enabled.])
2493 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2495 AC_SUBST(MACHDEP_OBJS)
2496 AC_MSG_CHECKING(MACHDEP_OBJS)
2497 if test -z "$MACHDEP_OBJS"
2499 MACHDEP_OBJS=$extra_machdep_objs
2501 MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2503 AC_MSG_RESULT(MACHDEP_OBJS)
2505 # checks for library functions
2506 AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2507 clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2508 gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2509 getpriority getpwent getspnam getspent getsid getwd \
2510 kill killpg lchmod lchown lstat mbrtowc mkfifo mknod mktime \
2511 mremap nice pathconf pause plock poll pthread_init \
2512 putenv readlink realpath \
2513 select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2515 setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2516 sigaction siginterrupt sigrelse strftime strlcpy \
2517 sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2518 truncate uname unsetenv utimes waitpid wait3 wait4 \
2519 wcscoll wcsftime wcsxfrm _getpty)
2521 # For some functions, having a definition is not sufficient, since
2522 # we want to take their address.
2523 AC_MSG_CHECKING(for chroot)
2524 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2525 AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2529 AC_MSG_CHECKING(for link)
2530 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2531 AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2535 AC_MSG_CHECKING(for symlink)
2536 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2537 AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2541 AC_MSG_CHECKING(for fchdir)
2542 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2543 AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2547 AC_MSG_CHECKING(for fsync)
2548 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2549 AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2553 AC_MSG_CHECKING(for fdatasync)
2554 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2555 AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2559 AC_MSG_CHECKING(for epoll)
2560 AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2561 AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2565 AC_MSG_CHECKING(for kqueue)
2567 #include <sys/types.h>
2568 #include <sys/event.h>
2570 AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2574 # On some systems (eg. FreeBSD 5), we would find a definition of the
2575 # functions ctermid_r, setgroups in the library, but no prototype
2576 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2577 # address to avoid compiler warnings and potential miscompilations
2578 # because of the missing prototypes.
2580 AC_MSG_CHECKING(for ctermid_r)
2582 #include "confdefs.h"
2584 ], void* p = ctermid_r,
2585 AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2590 AC_MSG_CHECKING(for flock)
2592 #include "confdefs.h"
2593 #include <sys/file.h>
2595 AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2600 AC_MSG_CHECKING(for getpagesize)
2602 #include "confdefs.h"
2604 ], void* p = getpagesize,
2605 AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2611 AC_CHECK_PROGS(TRUE, true, /bin/true)
2613 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2614 dnl On others, they are in the C library, so we to take no action
2615 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2616 AC_CHECK_LIB(resolv, inet_aton)
2619 # On Tru64, chflags seems to be present, but calling it will
2621 AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl
2623 #include <sys/stat.h>
2625 int main(int argc, char*argv[])
2627 if(chflags(argv[0], 0) != 0)
2631 ]], ac_cv_have_chflags=yes,
2632 ac_cv_have_chflags=no,
2633 ac_cv_have_chflags=cross)
2635 if test "$ac_cv_have_chflags" = cross ; then
2636 AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"])
2638 if test "$ac_cv_have_chflags" = yes ; then
2639 AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2642 AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl
2644 #include <sys/stat.h>
2646 int main(int argc, char*argv[])
2648 if(lchflags(argv[0], 0) != 0)
2652 ]], ac_cv_have_lchflags=yes,
2653 ac_cv_have_lchflags=no,
2654 ac_cv_have_lchflags=cross)
2656 if test "$ac_cv_have_lchflags" = cross ; then
2657 AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"])
2659 if test "$ac_cv_have_lchflags" = yes ; then
2660 AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2663 dnl Check if system zlib has *Copy() functions
2665 dnl On MacOSX the linker will search for dylibs on the entire linker path
2666 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2667 dnl to revert to a more traditional unix behaviour and make it possible to
2668 dnl override the system libz with a local static library of libz. Temporarily
2669 dnl add that flag to our CFLAGS as well to ensure that we check the version
2670 dnl of libz that will be used by setup.py.
2671 dnl The -L/usr/local/lib is needed as wel to get the same compilation
2672 dnl environment as setup.py (and leaving it out can cause configure to use the
2673 dnl wrong version of the library)
2674 case $ac_sys_system/$ac_sys_release in
2676 _CUR_CFLAGS="${CFLAGS}"
2677 _CUR_LDFLAGS="${LDFLAGS}"
2678 CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2679 LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2683 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2685 case $ac_sys_system/$ac_sys_release in
2687 CFLAGS="${_CUR_CFLAGS}"
2688 LDFLAGS="${_CUR_LDFLAGS}"
2692 AC_MSG_CHECKING(for hstrerror)
2694 #include "confdefs.h"
2696 ], void* p = hstrerror; hstrerror(0),
2697 AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2702 AC_MSG_CHECKING(for inet_aton)
2704 #include "confdefs.h"
2705 #include <sys/types.h>
2706 #include <sys/socket.h>
2707 #include <netinet/in.h>
2708 #include <arpa/inet.h>
2709 ], void* p = inet_aton;inet_aton(0,0),
2710 AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2715 AC_MSG_CHECKING(for inet_pton)
2717 #include "confdefs.h"
2718 #include <sys/types.h>
2719 #include <sys/socket.h>
2720 #include <netinet/in.h>
2721 #include <arpa/inet.h>
2722 ], void* p = inet_pton,
2723 AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2728 # On some systems, setgroups is in unistd.h, on others, in grp.h
2729 AC_MSG_CHECKING(for setgroups)
2731 #include "confdefs.h"
2737 void* p = setgroups,
2738 AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2743 # check for openpty and forkpty
2745 AC_CHECK_FUNCS(openpty,,
2746 AC_CHECK_LIB(util,openpty,
2747 [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2748 AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2751 AC_CHECK_FUNCS(forkpty,,
2752 AC_CHECK_LIB(util,forkpty,
2753 [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2754 AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2759 AC_CHECK_FUNCS(memmove)
2761 # check for long file support functions
2762 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2764 AC_REPLACE_FUNCS(dup2 getcwd strdup)
2765 AC_CHECK_FUNCS(getpgrp,
2766 AC_TRY_COMPILE([#include <unistd.h>],
2768 AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2769 [Define if getpgrp() must be called as getpgrp(0).])
2772 AC_CHECK_FUNCS(setpgrp,
2773 AC_TRY_COMPILE([#include <unistd.h>],
2775 AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2776 [Define if setpgrp() must be called as setpgrp(0, 0).])
2779 AC_CHECK_FUNCS(gettimeofday,
2780 AC_TRY_COMPILE([#include <sys/time.h>],
2781 [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2782 AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2783 [Define if gettimeofday() does not have second (timezone) argument
2784 This is the case on Motorola V4 (R40V4.2)])
2788 AC_MSG_CHECKING(for major, minor, and makedev)
2790 #if defined(MAJOR_IN_MKDEV)
2791 #include <sys/mkdev.h>
2792 #elif defined(MAJOR_IN_SYSMACROS)
2793 #include <sys/sysmacros.h>
2795 #include <sys/types.h>
2798 makedev(major(0),minor(0));
2800 AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2801 [Define to 1 if you have the device macros.])
2807 # On OSF/1 V5.1, getaddrinfo is available, but a define
2808 # for [no]getaddrinfo in netdb.h.
2809 AC_MSG_CHECKING(for getaddrinfo)
2811 #include <sys/types.h>
2812 #include <sys/socket.h>
2816 getaddrinfo(NULL, NULL, NULL, NULL);
2819 AC_MSG_CHECKING(getaddrinfo bug)
2821 #include <sys/types.h>
2824 #include <sys/socket.h>
2825 #include <netinet/in.h>
2829 int passive, gaierr, inet4 = 0, inet6 = 0;
2830 struct addrinfo hints, *ai, *aitop;
2831 char straddr[INET6_ADDRSTRLEN], strport[16];
2833 for (passive = 0; passive <= 1; passive++) {
2834 memset(&hints, 0, sizeof(hints));
2835 hints.ai_family = AF_UNSPEC;
2836 hints.ai_flags = passive ? AI_PASSIVE : 0;
2837 hints.ai_socktype = SOCK_STREAM;
2838 hints.ai_protocol = IPPROTO_TCP;
2839 if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2840 (void)gai_strerror(gaierr);
2843 for (ai = aitop; ai; ai = ai->ai_next) {
2844 if (ai->ai_addr == NULL ||
2845 ai->ai_addrlen == 0 ||
2846 getnameinfo(ai->ai_addr, ai->ai_addrlen,
2847 straddr, sizeof(straddr), strport, sizeof(strport),
2848 NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2851 switch (ai->ai_family) {
2853 if (strcmp(strport, "54321") != 0) {
2857 if (strcmp(straddr, "0.0.0.0") != 0) {
2861 if (strcmp(straddr, "127.0.0.1") != 0) {
2868 if (strcmp(strport, "54321") != 0) {
2872 if (strcmp(straddr, "::") != 0) {
2876 if (strcmp(straddr, "::1") != 0) {
2886 /* another family support? */
2892 if (!(inet4 == 0 || inet4 == 2))
2894 if (!(inet6 == 0 || inet6 == 2))
2898 freeaddrinfo(aitop);
2903 freeaddrinfo(aitop);
2908 buggygetaddrinfo=no,
2909 AC_MSG_RESULT(buggy)
2910 buggygetaddrinfo=yes,
2911 AC_MSG_RESULT(buggy)
2912 buggygetaddrinfo=yes)], [
2914 buggygetaddrinfo=yes
2917 if test "$buggygetaddrinfo" = "yes"; then
2918 if test "$ipv6" = "yes"; then
2919 echo 'Fatal: You must get working getaddrinfo() function.'
2920 echo ' or you can specify "--disable-ipv6"'.
2924 AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2926 AC_CHECK_FUNCS(getnameinfo)
2928 # checks for structures
2932 AC_CHECK_MEMBERS([struct stat.st_rdev])
2933 AC_CHECK_MEMBERS([struct stat.st_blksize])
2934 AC_CHECK_MEMBERS([struct stat.st_flags])
2935 AC_CHECK_MEMBERS([struct stat.st_gen])
2936 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2939 AC_MSG_CHECKING(for time.h that defines altzone)
2940 AC_CACHE_VAL(ac_cv_header_time_altzone,
2941 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2942 ac_cv_header_time_altzone=yes,
2943 ac_cv_header_time_altzone=no)])
2944 AC_MSG_RESULT($ac_cv_header_time_altzone)
2945 if test $ac_cv_header_time_altzone = yes; then
2946 AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2950 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2952 #include <sys/types.h>
2953 #include <sys/select.h>
2954 #include <sys/time.h>
2956 AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2957 [Define if you can safely include both <sys/select.h> and <sys/time.h>
2958 (which you can't on SCO ODT 3.0).])
2961 AC_MSG_RESULT($was_it_defined)
2963 AC_MSG_CHECKING(for addrinfo)
2964 AC_CACHE_VAL(ac_cv_struct_addrinfo,
2966 # include <netdb.h>],
2967 [struct addrinfo a],
2968 ac_cv_struct_addrinfo=yes,
2969 ac_cv_struct_addrinfo=no))
2970 AC_MSG_RESULT($ac_cv_struct_addrinfo)
2971 if test $ac_cv_struct_addrinfo = yes; then
2972 AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
2975 AC_MSG_CHECKING(for sockaddr_storage)
2976 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
2978 # include <sys/types.h>
2979 # include <sys/socket.h>],
2980 [struct sockaddr_storage s],
2981 ac_cv_struct_sockaddr_storage=yes,
2982 ac_cv_struct_sockaddr_storage=no))
2983 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
2984 if test $ac_cv_struct_sockaddr_storage = yes; then
2985 AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
2988 # checks for compiler characteristics
2994 AC_MSG_CHECKING(for working volatile)
2995 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes,
2996 AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
2998 AC_MSG_RESULT($works)
3001 AC_MSG_CHECKING(for working signed char)
3002 AC_TRY_COMPILE([], [signed char c;], works=yes,
3003 AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3005 AC_MSG_RESULT($works)
3008 AC_MSG_CHECKING(for prototypes)
3009 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3010 AC_DEFINE(HAVE_PROTOTYPES, 1,
3011 [Define if your compiler supports function prototype])
3014 AC_MSG_RESULT($have_prototypes)
3017 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3020 int foo(int x, ...) {
3028 ], [return foo(10, "", 3.14);], [
3029 AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3030 [Define if your compiler supports variable length function prototypes
3031 (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>])
3034 AC_MSG_RESULT($works)
3036 # check for socketpair
3037 AC_MSG_CHECKING(for socketpair)
3039 #include <sys/types.h>
3040 #include <sys/socket.h>
3041 ], void *x=socketpair,
3042 AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3047 # check if sockaddr has sa_len member
3048 AC_MSG_CHECKING(if sockaddr has sa_len member)
3049 AC_TRY_COMPILE([#include <sys/types.h>
3050 #include <sys/socket.h>],
3054 AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
3058 AC_MSG_CHECKING(whether va_list is an array)
3060 #ifdef HAVE_STDARG_PROTOTYPES
3063 #include <varargs.h>
3065 ], [va_list list1, list2; list1 = list2;], , [
3066 AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind])
3067 va_list_is_array=yes
3069 AC_MSG_RESULT($va_list_is_array)
3071 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3072 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3073 [Define this if you have some version of gethostbyname_r()])
3075 AC_CHECK_FUNC(gethostbyname_r, [
3076 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3077 AC_MSG_CHECKING([gethostbyname_r with 6 args])
3079 CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3084 struct hostent *he, *res;
3089 (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3091 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3092 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3093 [Define this if you have the 6-arg version of gethostbyname_r().])
3097 AC_MSG_CHECKING([gethostbyname_r with 5 args])
3107 (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3109 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3110 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3111 [Define this if you have the 5-arg version of gethostbyname_r().])
3115 AC_MSG_CHECKING([gethostbyname_r with 3 args])
3121 struct hostent_data data;
3123 (void) gethostbyname_r(name, he, &data);
3125 AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3126 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3127 [Define this if you have the 3-arg version of gethostbyname_r().])
3136 AC_CHECK_FUNCS(gethostbyname)
3138 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3139 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3140 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3141 AC_SUBST(HAVE_GETHOSTBYNAME_R)
3142 AC_SUBST(HAVE_GETHOSTBYNAME)
3144 # checks for system services
3147 # Linux requires this for correct f.p. operations
3148 AC_CHECK_FUNC(__fpu_control,
3150 [AC_CHECK_LIB(ieee, __fpu_control)
3153 # Check for --with-fpectl
3154 AC_MSG_CHECKING(for --with-fpectl)
3156 AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3158 if test "$withval" != no
3160 AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3161 [Define if you want SIGFPE handled (see Include/pyfpe.h).])
3163 else AC_MSG_RESULT(no)
3165 [AC_MSG_RESULT(no)])
3167 # check for --with-libm=...
3169 case $ac_sys_system in
3173 AC_MSG_CHECKING(for --with-libm=STRING)
3175 AC_HELP_STRING(--with-libm=STRING, math library),
3177 if test "$withval" = no
3179 AC_MSG_RESULT(force LIBM empty)
3180 elif test "$withval" != yes
3182 AC_MSG_RESULT(set LIBM="$withval")
3183 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3185 [AC_MSG_RESULT(default LIBM="$LIBM")])
3187 # check for --with-libc=...
3189 AC_MSG_CHECKING(for --with-libc=STRING)
3191 AC_HELP_STRING(--with-libc=STRING, C library),
3193 if test "$withval" = no
3195 AC_MSG_RESULT(force LIBC empty)
3196 elif test "$withval" != yes
3198 AC_MSG_RESULT(set LIBC="$withval")
3199 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3201 [AC_MSG_RESULT(default LIBC="$LIBC")])
3203 # **************************************************
3204 # * Check for various properties of floating point *
3205 # **************************************************
3207 AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3208 AC_CACHE_VAL(ac_cv_little_endian_double, [
3212 double x = 9006104071832581.0;
3213 if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3219 ac_cv_little_endian_double=yes,
3220 ac_cv_little_endian_double=no,
3221 ac_cv_little_endian_double=no)])
3222 AC_MSG_RESULT($ac_cv_little_endian_double)
3223 if test "$ac_cv_little_endian_double" = yes
3225 AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3226 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3227 with the least significant byte first])
3230 AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3231 AC_CACHE_VAL(ac_cv_big_endian_double, [
3235 double x = 9006104071832581.0;
3236 if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3242 ac_cv_big_endian_double=yes,
3243 ac_cv_big_endian_double=no,
3244 ac_cv_big_endian_double=no)])
3245 AC_MSG_RESULT($ac_cv_big_endian_double)
3246 if test "$ac_cv_big_endian_double" = yes
3248 AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3249 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3250 with the most significant byte first])
3253 # Some ARM platforms use a mixed-endian representation for doubles.
3254 # While Python doesn't currently have full support for these platforms
3255 # (see e.g., issue 1762561), we can at least make sure that float <-> string
3257 AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3258 AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3262 double x = 9006104071832581.0;
3263 if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3269 ac_cv_mixed_endian_double=yes,
3270 ac_cv_mixed_endian_double=no,
3271 ac_cv_mixed_endian_double=no)])
3272 AC_MSG_RESULT($ac_cv_mixed_endian_double)
3273 if test "$ac_cv_mixed_endian_double" = yes
3275 AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3276 [Define if C doubles are 64-bit IEEE 754 binary format, stored
3277 in ARM mixed-endian order (byte order 45670123)])
3280 # The short float repr introduced in Python 3.1 requires the
3281 # correctly-rounded string <-> double conversion functions from
3282 # Python/dtoa.c, which in turn require that the FPU uses 53-bit
3283 # rounding; this is a problem on x86, where the x87 FPU has a default
3284 # rounding precision of 64 bits. For gcc/x86, we try to fix this by
3285 # using inline assembler to get and set the x87 FPU control word.
3286 if test "$GCC" = yes && test -n "`$CC -dM -E - </dev/null | grep i386`"
3288 # Check that it's okay to use gcc inline assembler to get and set
3289 # x87 control word. It should be, but you never know...
3290 AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3291 AC_TRY_COMPILE([], [
3293 __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3294 __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3296 [have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3297 AC_MSG_RESULT($have_gcc_asm_for_x87)
3298 if test "$have_gcc_asm_for_x87" = yes
3300 AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3301 [Define if we can use gcc inline assembler to get and set x87 control word])
3305 # Detect whether system arithmetic is subject to x87-style double
3306 # rounding issues. The result of this test has little meaning on non
3307 # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
3308 # mode is round-to-nearest and double rounding issues are present, and
3309 # 0 otherwise. See http://bugs.python.org/issue2937 for more info.
3310 AC_MSG_CHECKING(for x87-style double rounding)
3311 # $BASECFLAGS may affect the result
3313 CC="$CC $BASECFLAGS"
3318 volatile double x, y, z;
3319 /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3320 x = 0.99999999999999989; /* 1-2**-53 */
3324 /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3330 /* both tests show evidence of double rounding */
3334 ac_cv_x87_double_rounding=no,
3335 ac_cv_x87_double_rounding=yes,
3336 ac_cv_x87_double_rounding=no)
3338 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3339 if test "$ac_cv_x87_double_rounding" = yes
3341 AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3342 [Define if arithmetic is subject to x87-style double rounding issue])
3345 # ************************************
3346 # * Check for mathematical functions *
3347 # ************************************
3352 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3353 # -0. on some architectures.
3354 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3355 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3360 /* return 0 if either negative zeros don't exist
3361 on this platform or if negative zeros exist
3362 and tanh(-0.) == -0. */
3363 if (atan2(0., -1.) == atan2(-0., -1.) ||
3364 atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3368 ac_cv_tanh_preserves_zero_sign=yes,
3369 ac_cv_tanh_preserves_zero_sign=no,
3370 ac_cv_tanh_preserves_zero_sign=no)])
3371 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3372 if test "$ac_cv_tanh_preserves_zero_sign" = yes
3374 AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3375 [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3378 AC_CHECK_FUNCS([acosh asinh atanh copysign expm1 finite hypot log1p round])
3379 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3383 # For multiprocessing module, check that sem_open
3384 # actually works. For FreeBSD versions <= 7.2,
3385 # the kernel module that provides POSIX semaphores
3386 # isn't loaded by default, so an attempt to call
3387 # sem_open results in a 'Signal 12' error.
3388 AC_MSG_CHECKING(whether POSIX semaphores are enabled)
3389 AC_CACHE_VAL(ac_cv_posix_semaphores_enabled,
3394 #include <semaphore.h>
3395 #include <sys/stat.h>
3398 sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3399 if (a == SEM_FAILED) {
3404 sem_unlink("/autoconf");
3407 ], ac_cv_posix_semaphores_enabled=yes,
3408 ac_cv_posix_semaphores_enabled=no,
3409 ac_cv_posix_semaphores_enabled=yes)
3411 AC_MSG_RESULT($ac_cv_posix_semaphores_enabled)
3412 if test $ac_cv_posix_semaphores_enabled = no
3414 AC_DEFINE(POSIX_SEMAPHORES_NOT_ENABLED, 1,
3415 [Define if POSIX semaphores aren't enabled on your system])
3418 # Multiprocessing check for broken sem_getvalue
3419 AC_MSG_CHECKING(for broken sem_getvalue)
3424 #include <semaphore.h>
3425 #include <sys/stat.h>
3428 sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
3436 res = sem_getvalue(a, &count);
3438 sem_unlink("/autocftw");
3439 return res==-1 ? 1 : 0;
3444 AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1, define to 1 if your sem_getvalue is broken.)
3447 # determine what size digit to use for Python's longs
3448 AC_MSG_CHECKING([digit size for Python's longs])
3449 AC_ARG_ENABLE(big-digits,
3450 AC_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3451 [case $enable_big_digits in
3453 enable_big_digits=30 ;;
3455 enable_big_digits=15 ;;
3459 AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3461 AC_MSG_RESULT($enable_big_digits)
3462 AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3464 [AC_MSG_RESULT(no value specified)])
3467 AC_CHECK_HEADER(wchar.h, [
3468 AC_DEFINE(HAVE_WCHAR_H, 1,
3469 [Define if the compiler provides a wchar.h header file.])
3475 # determine wchar_t size
3476 if test "$wchar_h" = yes
3478 AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3481 AC_MSG_CHECKING(for UCS-4 tcl)
3485 #if TCL_UTF_MAX != 6
3486 # error "NOT UCS4_TCL"
3488 AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3491 AC_MSG_RESULT($have_ucs4_tcl)
3493 # check whether wchar_t is signed or not
3494 if test "$wchar_h" = yes
3496 # check whether wchar_t is signed or not
3497 AC_MSG_CHECKING(whether wchar_t is signed)
3498 AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3503 /* Success: exit code 0 */
3504 exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3507 ac_cv_wchar_t_signed=yes,
3508 ac_cv_wchar_t_signed=no,
3509 ac_cv_wchar_t_signed=yes)])
3510 AC_MSG_RESULT($ac_cv_wchar_t_signed)
3513 AC_MSG_CHECKING(what type to use for str)
3514 AC_ARG_WITH(wide-unicode,
3515 AC_HELP_STRING(--with-wide-unicode, Use 4-byte Unicode characters (default is 2 bytes)),
3517 if test "$withval" != no
3518 then unicode_size="4"
3519 else unicode_size="2"
3523 case "$have_ucs4_tcl" in
3524 yes) unicode_size="4" ;;
3525 *) unicode_size="2" ;;
3529 AH_TEMPLATE(Py_UNICODE_SIZE,
3530 [Define as the size of the unicode type.])
3531 case "$unicode_size" in
3532 4) AC_DEFINE(Py_UNICODE_SIZE, 4) ;;
3533 *) AC_DEFINE(Py_UNICODE_SIZE, 2) ;;
3536 AH_TEMPLATE(PY_UNICODE_TYPE,
3537 [Define as the integral type used for Unicode representation.])
3539 # wchar_t is only usable if it maps to an unsigned type
3540 if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3541 -a "$ac_cv_wchar_t_signed" = "no"
3543 PY_UNICODE_TYPE="wchar_t"
3544 AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3545 [Define if you have a useable wchar_t type defined in wchar.h; useable
3546 means wchar_t must be an unsigned type with at least 16 bits. (see
3547 Include/unicodeobject.h).])
3548 AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3549 elif test "$ac_cv_sizeof_short" = "$unicode_size"
3551 PY_UNICODE_TYPE="unsigned short"
3552 AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3553 elif test "$ac_cv_sizeof_long" = "$unicode_size"
3555 PY_UNICODE_TYPE="unsigned long"
3556 AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3558 PY_UNICODE_TYPE="no type found"
3560 AC_MSG_RESULT($PY_UNICODE_TYPE)
3562 # check for endianness
3565 # Check whether right shifting a negative integer extends the sign bit
3566 # or fills with zeros (like the Cray J90, according to Tim Peters).
3567 AC_MSG_CHECKING(whether right shift extends the sign bit)
3568 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
3572 exit(((-1)>>3 == -1) ? 0 : 1);
3575 ac_cv_rshift_extends_sign=yes,
3576 ac_cv_rshift_extends_sign=no,
3577 ac_cv_rshift_extends_sign=yes)])
3578 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3579 if test "$ac_cv_rshift_extends_sign" = no
3581 AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3582 [Define if i>>j for signed int i does not extend the sign bit
3586 # check for getc_unlocked and related locking functions
3587 AC_MSG_CHECKING(for getc_unlocked() and friends)
3588 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3589 AC_TRY_LINK([#include <stdio.h>],[
3590 FILE *f = fopen("/dev/null", "r");
3594 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3595 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3596 if test "$ac_cv_have_getc_unlocked" = yes
3598 AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3599 [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
3602 # check where readline lives
3603 # save the value of LIBS so we don't actually link Python with readline
3604 LIBS_no_readline=$LIBS
3606 # On some systems we need to link readline to a termcap compatible
3607 # library. NOTE: Keep the precedence of listed libraries synchronised
3609 py_cv_lib_readline=no
3610 AC_MSG_CHECKING([how to link readline libs])
3611 for py_libtermcap in "" ncursesw ncurses curses termcap; do
3612 if test -z "$py_libtermcap"; then
3613 READLINE_LIBS="-lreadline"
3615 READLINE_LIBS="-lreadline -l$py_libtermcap"
3617 LIBS="$READLINE_LIBS $LIBS_no_readline"
3619 [AC_LANG_CALL([],[readline])],
3620 [py_cv_lib_readline=yes])
3621 if test $py_cv_lib_readline = yes; then
3625 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3626 #AC_SUBST([READLINE_LIBS])
3627 if test $py_cv_lib_readline = no; then
3628 AC_MSG_RESULT([none])
3630 AC_MSG_RESULT([$READLINE_LIBS])
3631 AC_DEFINE(HAVE_LIBREADLINE, 1,
3632 [Define if you have the readline library (-lreadline).])
3635 # check for readline 2.1
3636 AC_CHECK_LIB(readline, rl_callback_handler_install,
3637 AC_DEFINE(HAVE_RL_CALLBACK, 1,
3638 [Define if you have readline 2.1]), ,$READLINE_LIBS)
3640 # check for readline 2.2
3641 AC_TRY_CPP([#include <readline/readline.h>],
3642 have_readline=yes, have_readline=no)
3643 if test $have_readline = yes
3645 AC_EGREP_HEADER([extern int rl_completion_append_character;],
3646 [readline/readline.h],
3647 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3648 [Define if you have readline 2.2]), )
3649 AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3650 [readline/readline.h],
3651 AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3652 [Define if you have rl_completion_suppress_append]), )
3655 # check for readline 4.0
3656 AC_CHECK_LIB(readline, rl_pre_input_hook,
3657 AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3658 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3661 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3662 AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3663 [Define if you have readline 4.0]), ,$READLINE_LIBS)
3665 # check for readline 4.2
3666 AC_CHECK_LIB(readline, rl_completion_matches,
3667 AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3668 [Define if you have readline 4.2]), ,$READLINE_LIBS)
3670 # also in readline 4.2
3671 AC_TRY_CPP([#include <readline/readline.h>],
3672 have_readline=yes, have_readline=no)
3673 if test $have_readline = yes
3675 AC_EGREP_HEADER([extern int rl_catch_signals;],
3676 [readline/readline.h],
3677 AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3678 [Define if you can turn off readline's signal handling.]), )
3681 # End of readline checks: restore LIBS
3682 LIBS=$LIBS_no_readline
3684 AC_MSG_CHECKING(for broken nice())
3685 AC_CACHE_VAL(ac_cv_broken_nice, [
3690 if (val1 != -1 && val1 == nice(2))
3695 ac_cv_broken_nice=yes,
3696 ac_cv_broken_nice=no,
3697 ac_cv_broken_nice=no)])
3698 AC_MSG_RESULT($ac_cv_broken_nice)
3699 if test "$ac_cv_broken_nice" = yes
3701 AC_DEFINE(HAVE_BROKEN_NICE, 1,
3702 [Define if nice() returns success/failure instead of the new priority.])
3705 AC_MSG_CHECKING(for broken poll())
3711 struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3715 int poll_test = poll (&poll_struct, 1, 0);
3721 else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3731 ac_cv_broken_poll=yes,
3732 ac_cv_broken_poll=no,
3733 ac_cv_broken_poll=no)
3734 AC_MSG_RESULT($ac_cv_broken_poll)
3735 if test "$ac_cv_broken_poll" = yes
3737 AC_DEFINE(HAVE_BROKEN_POLL, 1,
3738 [Define if poll() sets errno on invalid file descriptors.])
3741 # Before we can test tzset, we need to check if struct tm has a tm_zone
3742 # (which is not required by ISO C or UNIX spec) and/or if we support
3746 # check tzset(3) exists and works like we expect it to
3747 AC_MSG_CHECKING(for working tzset())
3748 AC_CACHE_VAL(ac_cv_working_tzset, [
3755 extern char *tzname[];
3760 /* Note that we need to ensure that not only does tzset(3)
3761 do 'something' with localtime, but it works as documented
3762 in the library reference and as expected by the test suite.
3763 This includes making sure that tzname is set properly if
3764 tm->tm_zone does not exist since it is the alternative way
3765 of getting timezone info.
3767 Red Hat 6.2 doesn't understand the southern hemisphere
3768 after New Year's Day.
3771 time_t groundhogday = 1044144000; /* GMT-based */
3772 time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3776 if (localtime(&groundhogday)->tm_hour != 0)
3779 /* For UTC, tzname[1] is sometimes "", sometimes " " */
3780 if (strcmp(tzname[0], "UTC") ||
3781 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3785 putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3787 if (localtime(&groundhogday)->tm_hour != 19)
3790 if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3794 putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3796 if (localtime(&groundhogday)->tm_hour != 11)
3799 if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3803 #if HAVE_STRUCT_TM_TM_ZONE
3804 if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3806 if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3813 ac_cv_working_tzset=yes,
3814 ac_cv_working_tzset=no,
3815 ac_cv_working_tzset=no)])
3816 AC_MSG_RESULT($ac_cv_working_tzset)
3817 if test "$ac_cv_working_tzset" = yes
3819 AC_DEFINE(HAVE_WORKING_TZSET, 1,
3820 [Define if tzset() actually switches the local timezone in a meaningful way.])
3823 # Look for subsecond timestamps in struct stat
3824 AC_MSG_CHECKING(for tv_nsec in struct stat)
3825 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3826 AC_TRY_COMPILE([#include <sys/stat.h>], [
3828 st.st_mtim.tv_nsec = 1;
3830 ac_cv_stat_tv_nsec=yes,
3831 ac_cv_stat_tv_nsec=no,
3832 ac_cv_stat_tv_nsec=no))
3833 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3834 if test "$ac_cv_stat_tv_nsec" = yes
3836 AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3837 [Define if you have struct stat.st_mtim.tv_nsec])
3840 # Look for BSD style subsecond timestamps in struct stat
3841 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3842 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3843 AC_TRY_COMPILE([#include <sys/stat.h>], [
3845 st.st_mtimespec.tv_nsec = 1;
3847 ac_cv_stat_tv_nsec2=yes,
3848 ac_cv_stat_tv_nsec2=no,
3849 ac_cv_stat_tv_nsec2=no))
3850 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3851 if test "$ac_cv_stat_tv_nsec2" = yes
3853 AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3854 [Define if you have struct stat.st_mtimensec])
3857 # On HP/UX 11.0, mvwdelch is a block with a return statement
3858 AC_MSG_CHECKING(whether mvwdelch is an expression)
3859 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3860 AC_TRY_COMPILE([#include <curses.h>], [
3862 rtn = mvwdelch(0,0,0);
3863 ], ac_cv_mvwdelch_is_expression=yes,
3864 ac_cv_mvwdelch_is_expression=no,
3865 ac_cv_mvwdelch_is_expression=yes))
3866 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3868 if test "$ac_cv_mvwdelch_is_expression" = yes
3870 AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3871 [Define if mvwdelch in curses.h is an expression.])
3874 AC_MSG_CHECKING(whether WINDOW has _flags)
3875 AC_CACHE_VAL(ac_cv_window_has_flags,
3876 AC_TRY_COMPILE([#include <curses.h>], [
3879 ], ac_cv_window_has_flags=yes,
3880 ac_cv_window_has_flags=no,
3881 ac_cv_window_has_flags=no))
3882 AC_MSG_RESULT($ac_cv_window_has_flags)
3885 if test "$ac_cv_window_has_flags" = yes
3887 AC_DEFINE(WINDOW_HAS_FLAGS, 1,
3888 [Define if WINDOW in curses.h offers a field _flags.])
3891 AC_MSG_CHECKING(for is_term_resized)
3892 AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
3893 AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
3898 AC_MSG_CHECKING(for resize_term)
3899 AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
3900 AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
3905 AC_MSG_CHECKING(for resizeterm)
3906 AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
3907 AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
3912 AC_MSG_CHECKING(for /dev/ptmx)
3914 if test -r /dev/ptmx
3917 AC_DEFINE(HAVE_DEV_PTMX, 1,
3918 [Define if we have /dev/ptmx.])
3923 AC_MSG_CHECKING(for /dev/ptc)
3928 AC_DEFINE(HAVE_DEV_PTC, 1,
3929 [Define if we have /dev/ptc.])
3934 AC_MSG_CHECKING(for %zd printf() format support)
3935 AC_TRY_RUN([#include <stdio.h>
3939 #ifdef HAVE_SYS_TYPES_H
3940 #include <sys/types.h>
3944 typedef ssize_t Py_ssize_t;
3945 #elif SIZEOF_VOID_P == SIZEOF_LONG
3946 typedef long Py_ssize_t;
3948 typedef int Py_ssize_t;
3955 if(sprintf(buffer, "%zd", (size_t)123) < 0)
3958 if (strcmp(buffer, "123"))
3961 if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
3964 if (strcmp(buffer, "-123"))
3970 AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])],
3973 AC_CHECK_TYPE(socklen_t,,
3974 AC_DEFINE(socklen_t,int,
3975 Define to `int' if <sys/socket.h> does not define.),[
3976 #ifdef HAVE_SYS_TYPES_H
3977 #include <sys/types.h>
3979 #ifdef HAVE_SYS_SOCKET_H
3980 #include <sys/socket.h>
3984 AC_MSG_CHECKING(for broken mbstowcs)
3989 const char *str = "text";
3990 len = mbstowcs(NULL, str, 0);
3994 ac_cv_broken_mbstowcs=no,
3995 ac_cv_broken_mbstowcs=yes,
3996 ac_cv_broken_mbstowcs=no)
3997 AC_MSG_RESULT($ac_cv_broken_mbstowcs)
3998 if test "$ac_cv_broken_mbstowcs" = yes
4000 AC_DEFINE(HAVE_BROKEN_MBSTOWCS, 1,
4001 [Define if mbstowcs(NULL, "text", 0) does not return the number of
4002 wide chars that would be converted.])
4005 # Check for --with-computed-gotos
4006 AC_MSG_CHECKING(for --with-computed-gotos)
4007 AC_ARG_WITH(computed-gotos,
4008 AC_HELP_STRING(--with-computed-gotos,
4009 Use computed gotos / threaded dispatch in evaluation loop (not available on all compilers)),
4011 if test "$withval" != no
4013 AC_DEFINE(USE_COMPUTED_GOTOS, 1,
4014 [Define if you want to use computed gotos in ceval.c.])
4016 else AC_MSG_RESULT(no)
4018 [AC_MSG_RESULT(no)])
4020 if test $ac_sys_system = Darwin
4022 LIBS="$LIBS -framework CoreFoundation"
4027 AC_SUBST(THREADHEADERS)
4029 for h in `(cd $srcdir;echo Python/thread_*.h)`
4031 THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4035 SRCDIRS="Parser Grammar Objects Python Modules Mac"
4036 AC_MSG_CHECKING(for build directories)
4037 for dir in $SRCDIRS; do
4038 if test ! -d $dir; then
4044 # generate output files
4045 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
4048 echo "creating Modules/Setup"
4049 if test ! -f Modules/Setup
4051 cp $srcdir/Modules/Setup.dist Modules/Setup
4054 echo "creating Modules/Setup.local"
4055 if test ! -f Modules/Setup.local
4057 echo "# Edit this file for local setup changes" >Modules/Setup.local
4060 echo "creating Makefile"
4061 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4062 -s Modules Modules/Setup.config \
4063 Modules/Setup.local Modules/Setup