Fix duplicate test numbers in extra.decTest
[python.git] / configure.in
blob01e26a083458c9f804d021cbd4c4aa857925f1b3
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, 2.7)
9 dnl Some m4 magic to ensure that the configure script is generated
10 dnl by the correct autoconf version.
11 m4_define([version_required],
12 [m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), 0,
13        [],
14        [m4_fatal([Autoconf version $1 is required for Python], 63)])
16 version_required(2.61)
18 AC_REVISION($Revision$)
19 AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
20 AC_CONFIG_SRCDIR([Include/object.h])
21 AC_CONFIG_HEADER(pyconfig.h)
23 dnl Ensure that if prefix is specified, it does not end in a slash. If
24 dnl it does, we get path names containing '//' which is both ugly and
25 dnl can cause trouble.
27 dnl Last slash shouldn't be stripped if prefix=/
28 if test "$prefix" != "/"; then
29     prefix=`echo "$prefix" | sed -e 's/\/$//g'`
30 fi    
32 dnl This is for stuff that absolutely must end up in pyconfig.h.
33 dnl Please use pyport.h instead, if possible.
34 AH_TOP([
35 #ifndef Py_PYCONFIG_H
36 #define Py_PYCONFIG_H
38 AH_BOTTOM([
39 /* Define the macros needed if on a UnixWare 7.x system. */
40 #if defined(__USLC__) && defined(__SCO_VERSION__)
41 #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
42 #endif
44 #endif /*Py_PYCONFIG_H*/
47 # We don't use PACKAGE_ variables, and they cause conflicts
48 # with other autoconf-based packages that include Python.h
49 grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
50 rm confdefs.h
51 mv confdefs.h.new confdefs.h
53 AC_SUBST(VERSION)
54 VERSION=PYTHON_VERSION
56 AC_SUBST(SOVERSION)
57 SOVERSION=1.0
59 # The later defininition of _XOPEN_SOURCE disables certain features
60 # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
61 AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
63 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
64 # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
65 # them.
66 AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
68 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
69 # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
70 # them.
71 AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
73 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
74 # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
75 AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
77 # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
78 # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
79 # them.
80 AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
83 define_xopen_source=yes
85 # Arguments passed to configure.
86 AC_SUBST(CONFIG_ARGS)
87 CONFIG_ARGS="$ac_configure_args"
89 AC_ARG_ENABLE(universalsdk,
90         AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
92         case $enableval in
93         yes)
94                 enableval=/Developer/SDKs/MacOSX10.4u.sdk
95                 ;;
96         esac
97         case $enableval in
98         no)
99                 UNIVERSALSDK=
100                 enable_universalsdk=
101                 ;;
102         *)
103                 UNIVERSALSDK=$enableval
104                 ;;
105         esac
107         UNIVERSALSDK=
108         enable_universalsdk=
110 AC_SUBST(UNIVERSALSDK)
112 AC_SUBST(ARCH_RUN_32BIT)
114 UNIVERSAL_ARCHS="32-bit"
115 AC_MSG_CHECKING(for --with-universal-archs)
116 AC_ARG_WITH(universal-archs,
117     AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
119         AC_MSG_RESULT($withval)
120         UNIVERSAL_ARCHS="$withval"
121         if test "${enable_universalsdk}" ; then
122                 :
123         else
124                 AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
125         fi
128         AC_MSG_RESULT(32-bit)
133 AC_ARG_WITH(framework-name,
134               AC_HELP_STRING(--with-framework-name=FRAMEWORK, 
135                              specify an alternate name of the framework built with --enable-framework),
137     if test "${enable_framework}"; then
138             :
139     else
140         AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
141     fi
142     PYTHONFRAMEWORK=${withval}
143     PYTHONFRAMEWORKDIR=${withval}.framework
144     PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
145     ],[
146     PYTHONFRAMEWORK=Python
147     PYTHONFRAMEWORKDIR=Python.framework
148     PYTHONFRAMEWORKIDENTIFIER=org.python.python
150 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
151 AC_ARG_ENABLE(framework,
152               AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
154         case $enableval in
155         yes) 
156                 enableval=/Library/Frameworks
157         esac
158         case $enableval in
159         no)
160                 PYTHONFRAMEWORK=
161                 PYTHONFRAMEWORKDIR=no-framework
162                 PYTHONFRAMEWORKPREFIX=
163                 PYTHONFRAMEWORKINSTALLDIR=
164                 FRAMEWORKINSTALLFIRST=
165                 FRAMEWORKINSTALLLAST=
166                 FRAMEWORKALTINSTALLFIRST=
167                 FRAMEWORKALTINSTALLLAST=
168                 if test "x${prefix}" = "xNONE"; then
169                         FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
170                 else
171                         FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
172                 fi
173                 enable_framework=
174                 ;;
175         *)
176                 PYTHONFRAMEWORKPREFIX=$enableval
177                 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
178                 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
179                 FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
180                 if test "$UNIVERSAL_ARCHS" = "all"
181                 then
182                         FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
183                         FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkaltinstallunixtools4way"
184                 else
185                         FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
186                         FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
187                 fi
189                 if test "x${prefix}" = "xNONE" ; then
190                         FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
191                 else
192                         FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
193                 fi
194                 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
196                 # Add files for Mac specific code to the list of output
197                 # files:
198                 AC_CONFIG_FILES(Mac/Makefile)
199                 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
200                 AC_CONFIG_FILES(Mac/IDLE/Makefile)
201                 AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
202                 AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
203         esac
204         ],[
205         PYTHONFRAMEWORK=
206         PYTHONFRAMEWORKDIR=no-framework
207         PYTHONFRAMEWORKPREFIX=
208         PYTHONFRAMEWORKINSTALLDIR=
209         FRAMEWORKINSTALLFIRST=
210         FRAMEWORKINSTALLLAST=
211         FRAMEWORKALTINSTALLFIRST=
212         FRAMEWORKALTINSTALLLAST=
213         if test "x${prefix}" = "xNONE" ; then
214                 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
215         else
216                 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
217         fi
218         enable_framework=
220         if test "$UNIVERSAL_ARCHS" = "all" 
221         then
222                 FRAMEWORKINSTALLLAST=update4wayuniversal
223                 FRAMEWORKALTINSTALLLAST=update4wayuniversal
224         fi
226 AC_SUBST(PYTHONFRAMEWORK)
227 AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
228 AC_SUBST(PYTHONFRAMEWORKDIR)
229 AC_SUBST(PYTHONFRAMEWORKPREFIX)
230 AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
231 AC_SUBST(FRAMEWORKINSTALLFIRST)
232 AC_SUBST(FRAMEWORKINSTALLLAST)
233 AC_SUBST(FRAMEWORKALTINSTALLFIRST)
234 AC_SUBST(FRAMEWORKALTINSTALLLAST)
235 AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
237 ##AC_ARG_WITH(dyld,
238 ##            AC_HELP_STRING(--with-dyld,
239 ##                           Use (OpenStep|Rhapsody) dynamic linker))
241 # Set name for machine-dependent library files
242 AC_SUBST(MACHDEP)
243 AC_MSG_CHECKING(MACHDEP)
244 if test -z "$MACHDEP"
245 then
246         ac_sys_system=`uname -s`
247         if test "$ac_sys_system" = "AIX" \
248         -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
249                 ac_sys_release=`uname -v`
250         else
251                 ac_sys_release=`uname -r`
252         fi
253         ac_md_system=`echo $ac_sys_system |
254                            tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
255         ac_md_release=`echo $ac_sys_release |
256                            tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
257         MACHDEP="$ac_md_system$ac_md_release"
259         case $MACHDEP in
260         cygwin*) MACHDEP="cygwin";;
261         darwin*) MACHDEP="darwin";;
262         atheos*) MACHDEP="atheos";;
263         irix646) MACHDEP="irix6";;
264         '')     MACHDEP="unknown";;
265         esac
267         
268 # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
269 # disable features if it is defined, without any means to access these
270 # features as extensions. For these systems, we skip the definition of
271 # _XOPEN_SOURCE. Before adding a system to the list to gain access to
272 # some feature, make sure there is no alternative way to access this
273 # feature. Also, when using wildcards, make sure you have verified the
274 # need for not defining _XOPEN_SOURCE on all systems matching the
275 # wildcard, and that the wildcard does not include future systems
276 # (which may remove their limitations).
277 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
278 case $ac_sys_system/$ac_sys_release in
279   # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
280   # even though select is a POSIX function. Reported by J. Ribbens.
281   # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
282   OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@) 
283     define_xopen_source=no
284     # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
285     # also defined. This can be overridden by defining _BSD_SOURCE
286     # As this has a different meaning on Linux, only define it on OpenBSD
287     AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
288     ;;
289   # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
290   # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
291   # Marc Recht
292   NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
293     define_xopen_source=no;;
294   # On Solaris 2.6, sys/wait.h is inconsistent in the usage
295   # of union __?sigval. Reported by Stuart Bishop.
296   SunOS/5.6)
297     define_xopen_source=no;;
298   # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
299   # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
300   # Reconfirmed for 7.1.4 by Martin v. Loewis.
301   OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
302     define_xopen_source=no;;
303   # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
304   # but used in struct sockaddr.sa_family. Reported by Tim Rice.
305   SCO_SV/3.2)
306     define_xopen_source=no;;
307   # On FreeBSD 4, the math functions C89 does not cover are never defined
308   # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
309   FreeBSD/4.*)
310     define_xopen_source=no;;
311   # On MacOS X 10.2, a bug in ncurses.h means that it craps out if 
312   # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
313   # identifies itself as Darwin/7.*
314   # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
315   # disables platform specific features beyond repair.
316   # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE 
317   # has no effect, don't bother defining them
318   Darwin/@<:@6789@:>@.*)
319     define_xopen_source=no;;
320   # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
321   # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
322   # or has another value. By not (re)defining it, the defaults come in place.
323   AIX/4)
324     define_xopen_source=no;;
325   AIX/5)
326     if test `uname -r` -eq 1; then
327       define_xopen_source=no
328     fi
329     ;;
330   # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
331   # defining NI_NUMERICHOST.
332   QNX/6.3.2)
333     define_xopen_source=no
334     ;;
336 esac
338 if test $define_xopen_source = yes
339 then
340   # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
341   # defined precisely as g++ defines it
342   # Furthermore, on Solaris 10, XPG6 requires the use of a C99
343   # compiler
344   case $ac_sys_system/$ac_sys_release in
345     SunOS/5.8|SunOS/5.9|SunOS/5.10)
346       AC_DEFINE(_XOPEN_SOURCE, 500, 
347                 Define to the level of X/Open that your system supports)
348       ;;
349     *)
350       AC_DEFINE(_XOPEN_SOURCE, 600, 
351                 Define to the level of X/Open that your system supports)
352       ;;
353   esac
355   # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
356   # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
357   # several APIs are not declared. Since this is also needed in some
358   # cases for HP-UX, we define it globally.
359   # except for Solaris 10, where it must not be defined, 
360   # as it implies XPG4.2
361   case $ac_sys_system/$ac_sys_release in
362     SunOS/5.10)
363       ;;
364     *)
365       AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
366                 Define to activate Unix95-and-earlier features)
367       ;;
368   esac
370   AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
371   
375 # SGI compilers allow the specification of the both the ABI and the
376 # ISA on the command line.  Depending on the values of these switches,
377 # different and often incompatable code will be generated.
379 # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
380 # thus supply support for various ABI/ISA combinations.  The MACHDEP
381 # variable is also adjusted.
383 AC_SUBST(SGI_ABI)
384 if test ! -z "$SGI_ABI"
385 then
386         CC="cc $SGI_ABI"
387         LDFLAGS="$SGI_ABI $LDFLAGS"
388         MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
390 AC_MSG_RESULT($MACHDEP)
392 # And add extra plat-mac for darwin
393 AC_SUBST(EXTRAPLATDIR)
394 AC_SUBST(EXTRAMACHDEPPATH)
395 AC_MSG_CHECKING(EXTRAPLATDIR)
396 if test -z "$EXTRAPLATDIR"
397 then
398         case $MACHDEP in
399         darwin) 
400                 EXTRAPLATDIR="\$(PLATMACDIRS)"
401                 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
402                 ;;
403         *) 
404                 EXTRAPLATDIR=""
405                 EXTRAMACHDEPPATH=""
406                 ;;
407         esac
409 AC_MSG_RESULT($EXTRAPLATDIR)
411 # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
412 # it may influence the way we can build extensions, so distutils
413 # needs to check it
414 AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
415 AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
416 CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
417 EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
419 AC_MSG_CHECKING(machine type as reported by uname -m)
420 ac_sys_machine=`uname -m`
421 AC_MSG_RESULT($ac_sys_machine)
423 # checks for alternative programs
425 # compiler flags are generated in two sets, BASECFLAGS and OPT.  OPT is just
426 # for debug/optimization stuff.  BASECFLAGS is for flags that are required
427 # just to get things to compile and link.  Users are free to override OPT
428 # when running configure or make.  The build should not break if they do.
429 # BASECFLAGS should generally not be messed with, however.
431 # XXX shouldn't some/most/all of this code be merged with the stuff later
432 # on that fiddles with OPT and BASECFLAGS?
433 AC_MSG_CHECKING(for --without-gcc)
434 AC_ARG_WITH(gcc,
435             AC_HELP_STRING(--without-gcc,never use gcc),
437         case $withval in
438         no)     CC=${CC:-cc}
439                 without_gcc=yes;;
440         yes)    CC=gcc
441                 without_gcc=no;;
442         *)      CC=$withval
443                 without_gcc=$withval;;
444         esac], [
445         case $ac_sys_system in
446         AIX*)   CC=cc_r
447                 without_gcc=;;
448         BeOS*)
449                 case $BE_HOST_CPU in
450                 ppc)
451                         CC=mwcc
452                         without_gcc=yes
453                         BASECFLAGS="$BASECFLAGS -export pragma"
454                         OPT="$OPT -O"
455                         LDFLAGS="$LDFLAGS -nodup"
456                         ;;
457                 x86)
458                         CC=gcc
459                         without_gcc=no
460                         OPT="$OPT -O"
461                         ;;
462                 *)
463                         AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
464                         ;;
465                 esac
466                 AR="\$(srcdir)/Modules/ar_beos"
467                 RANLIB=:
468                 ;;
469         *)      without_gcc=no;;
470         esac])
471 AC_MSG_RESULT($without_gcc)
473 # If the user switches compilers, we can't believe the cache
474 if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
475 then
476   AC_MSG_ERROR([cached CC is different -- throw away $cache_file
477 (it is also a good idea to do 'make clean' before compiling)])
480 AC_PROG_CC
482 AC_SUBST(CXX)
483 AC_SUBST(MAINCC)
484 AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
485 AC_ARG_WITH(cxx_main,
486             AC_HELP_STRING([--with-cxx-main=<compiler>],
487                            [compile main() and link python executable with C++ compiler]),
489         
490         case $withval in
491         no)     with_cxx_main=no
492                 MAINCC='$(CC)';;
493         yes)    with_cxx_main=yes
494                 MAINCC='$(CXX)';;
495         *)      with_cxx_main=yes
496                 MAINCC=$withval
497                 if test -z "$CXX"
498                 then
499                         CXX=$withval
500                 fi;;
501         esac], [
502         with_cxx_main=no
503         MAINCC='$(CC)'
505 AC_MSG_RESULT($with_cxx_main)
507 preset_cxx="$CXX"
508 if test -z "$CXX"
509 then
510         case "$CC" in
511         gcc)    AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
512         cc)     AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
513         esac
514         if test "$CXX" = "notfound"
515         then
516                 CXX=""
517         fi
519 if test -z "$CXX"
520 then
521         AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
522         if test "$CXX" = "notfound"
523         then
524                 CXX=""
525         fi
527 if test "$preset_cxx" != "$CXX"
528 then
529         AC_MSG_WARN([
531   By default, distutils will build C++ extension modules with "$CXX".
532   If this is not intended, then set CXX on the configure command line.
533   ])
537 # checks for UNIX variants that set C preprocessor variables
538 AC_AIX
540 # Check for unsupported systems
541 case $ac_sys_system/$ac_sys_release in
542 atheos*|Linux*/1*)
543    echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
544    echo See README for details.
545    exit 1;;
546 esac
548 AC_EXEEXT
549 AC_MSG_CHECKING(for --with-suffix)
550 AC_ARG_WITH(suffix,
551             AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
553         case $withval in
554         no)     EXEEXT=;;
555         yes)    EXEEXT=.exe;;
556         *)      EXEEXT=$withval;;
557         esac])
558 AC_MSG_RESULT($EXEEXT)
560 # Test whether we're running on a non-case-sensitive system, in which
561 # case we give a warning if no ext is given
562 AC_SUBST(BUILDEXEEXT)
563 AC_MSG_CHECKING(for case-insensitive build directory)
564 if test ! -d CaseSensitiveTestDir; then
565 mkdir CaseSensitiveTestDir
568 if test -d casesensitivetestdir
569 then
570     AC_MSG_RESULT(yes)
571     BUILDEXEEXT=.exe
572 else
573         AC_MSG_RESULT(no)
574         BUILDEXEEXT=$EXEEXT
576 rmdir CaseSensitiveTestDir
578 case $MACHDEP in
579 bsdos*)
580     case $CC in
581     gcc) CC="$CC -D_HAVE_BSDI";;
582     esac;;
583 esac
585 case $ac_sys_system in
586 hp*|HP*)
587     case $CC in
588     cc|*/cc) CC="$CC -Ae";;
589     esac;;
590 SunOS*)
591     # Some functions have a prototype only with that define, e.g. confstr
592     AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
593     ;;
594 esac
597 AC_SUBST(LIBRARY)
598 AC_MSG_CHECKING(LIBRARY)
599 if test -z "$LIBRARY"
600 then
601         LIBRARY='libpython$(VERSION).a'
603 AC_MSG_RESULT($LIBRARY)
605 # LDLIBRARY is the name of the library to link against (as opposed to the
606 # name of the library into which to insert object files). BLDLIBRARY is also
607 # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
608 # is blank as the main program is not linked directly against LDLIBRARY.
609 # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
610 # systems without shared libraries, LDLIBRARY is the same as LIBRARY
611 # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
612 # DLLLIBRARY is the shared (i.e., DLL) library.
614 # RUNSHARED is used to run shared python without installed libraries
616 # INSTSONAME is the name of the shared library that will be use to install
617 # on the system - some systems like version suffix, others don't
618 AC_SUBST(LDLIBRARY)
619 AC_SUBST(DLLLIBRARY)
620 AC_SUBST(BLDLIBRARY)
621 AC_SUBST(LDLIBRARYDIR)
622 AC_SUBST(INSTSONAME)
623 AC_SUBST(RUNSHARED)
624 LDLIBRARY="$LIBRARY"
625 BLDLIBRARY='$(LDLIBRARY)'
626 INSTSONAME='$(LDLIBRARY)'
627 DLLLIBRARY=''
628 LDLIBRARYDIR=''
629 RUNSHARED=''
631 # LINKCC is the command that links the python executable -- default is $(CC).
632 # If CXX is set, and if it is needed to link a main function that was
633 # compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
634 # python might then depend on the C++ runtime
635 # This is altered for AIX in order to build the export list before 
636 # linking.
637 AC_SUBST(LINKCC)
638 AC_MSG_CHECKING(LINKCC)
639 if test -z "$LINKCC"
640 then
641         LINKCC='$(PURIFY) $(MAINCC)'
642         case $ac_sys_system in
643         AIX*)
644            exp_extra="\"\""
645            if test $ac_sys_release -ge 5 -o \
646                    $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
647                exp_extra="."
648            fi
649            LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
650         QNX*)
651            # qcc must be used because the other compilers do not
652            # support -N.
653            LINKCC=qcc;;
654         esac
656 AC_MSG_RESULT($LINKCC)
658 # GNULD is set to "yes" if the GNU linker is used.  If this goes wrong
659 # make sure we default having it set to "no": this is used by
660 # distutils.unixccompiler to know if it should add --enable-new-dtags
661 # to linker command lines, and failing to detect GNU ld simply results
662 # in the same bahaviour as before.
663 AC_SUBST(GNULD)
664 AC_MSG_CHECKING(for GNU ld)
665 ac_prog=ld
666 if test "$GCC" = yes; then
667        ac_prog=`$CC -print-prog-name=ld`
669 case `"$ac_prog" -V 2>&1 < /dev/null` in
670       *GNU*)
671           GNULD=yes;;
672       *)
673           GNULD=no;;
674 esac
675 AC_MSG_RESULT($GNULD)
677 AC_MSG_CHECKING(for --enable-shared)
678 AC_ARG_ENABLE(shared,
679               AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
681 if test -z "$enable_shared"
682 then 
683   case $ac_sys_system in
684   CYGWIN* | atheos*)
685     enable_shared="yes";;
686   *)
687     enable_shared="no";;
688   esac
690 AC_MSG_RESULT($enable_shared)
692 AC_MSG_CHECKING(for --enable-profiling)
693 AC_ARG_ENABLE(profiling,
694               AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
695 [ac_save_cc="$CC"
696  CC="$CC -pg"
697  AC_TRY_RUN([int main() { return 0; }],
698    ac_enable_profiling="yes",
699    ac_enable_profiling="no",
700    ac_enable_profiling="no")
701  CC="$ac_save_cc"])
702 AC_MSG_RESULT($ac_enable_profiling)
704 case "$ac_enable_profiling" in
705     "yes")
706         BASECFLAGS="-pg $BASECFLAGS"
707         LDFLAGS="-pg $LDFLAGS"
708     ;;
709 esac
711 AC_MSG_CHECKING(LDLIBRARY)
713 # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
714 # library that we build, but we do not want to link against it (we
715 # will find it with a -framework option). For this reason there is an
716 # extra variable BLDLIBRARY against which Python and the extension
717 # modules are linked, BLDLIBRARY. This is normally the same as
718 # LDLIBRARY, but empty for MacOSX framework builds.
719 if test "$enable_framework"
720 then
721   LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
722   RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
723   BLDLIBRARY=''
724 else
725   BLDLIBRARY='$(LDLIBRARY)'
726 fi  
728 # Other platforms follow
729 if test $enable_shared = "yes"; then
730   AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
731   case $ac_sys_system in
732     BeOS*)
733           LDLIBRARY='libpython$(VERSION).so'
734           ;;
735     CYGWIN*)
736           LDLIBRARY='libpython$(VERSION).dll.a'
737           DLLLIBRARY='libpython$(VERSION).dll'
738           ;;
739     SunOS*)
740           LDLIBRARY='libpython$(VERSION).so'
741           BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
742           RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
743           INSTSONAME="$LDLIBRARY".$SOVERSION
744           ;;
745     Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
746           LDLIBRARY='libpython$(VERSION).so'
747           BLDLIBRARY='-L. -lpython$(VERSION)'
748           RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
749           case $ac_sys_system in
750               FreeBSD*)
751                 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
752                 ;;
753           esac
754           INSTSONAME="$LDLIBRARY".$SOVERSION
755           ;;
756     hp*|HP*)
757           case `uname -m` in
758                 ia64)
759                         LDLIBRARY='libpython$(VERSION).so'
760                         ;;
761                 *)
762                         LDLIBRARY='libpython$(VERSION).sl'
763                         ;;
764           esac
765           BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
766           RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
767           ;;
768     OSF*)
769           LDLIBRARY='libpython$(VERSION).so'
770           BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
771           RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
772           ;;
773     atheos*)
774           LDLIBRARY='libpython$(VERSION).so'
775           BLDLIBRARY='-L. -lpython$(VERSION)'
776           RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
777           ;;
778     Darwin*)
779         LDLIBRARY='libpython$(VERSION).dylib'
780         BLDLIBRARY='-L. -lpython$(VERSION)'
781         RUNSHARED='DYLD_LIBRARY_PATH=`pwd`:${DYLD_LIBRARY_PATH}'
782         ;;
784   esac
785 else # shared is disabled
786   case $ac_sys_system in
787     CYGWIN*)
788           BLDLIBRARY='$(LIBRARY)'
789           LDLIBRARY='libpython$(VERSION).dll.a'
790           ;;
791   esac
794 AC_MSG_RESULT($LDLIBRARY)
796 AC_PROG_RANLIB
797 AC_SUBST(AR)
798 AC_CHECK_PROGS(AR, ar aal, ar)
800 # tweak ARFLAGS only if the user didn't set it on the command line
801 AC_SUBST(ARFLAGS)
802 if test -z "$ARFLAGS"
803 then
804         ARFLAGS="rc"
807 AC_SUBST(SVNVERSION)
808 AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
809 if test $SVNVERSION = found
810 then
811         SVNVERSION="svnversion \$(srcdir)"
812 else
813         SVNVERSION="echo Unversioned directory"
816 case $MACHDEP in
817 bsdos*|hp*|HP*)
818         # install -d does not work on BSDI or HP-UX
819         if test -z "$INSTALL"
820         then
821                 INSTALL="${srcdir}/install-sh -c"
822         fi
823 esac
824 AC_PROG_INSTALL
826 # Not every filesystem supports hard links
827 AC_SUBST(LN)
828 if test -z "$LN" ; then
829         case $ac_sys_system in
830                 BeOS*) LN="ln -s";;
831                 CYGWIN*) LN="ln -s";;
832                 atheos*) LN="ln -s";;
833                 *) LN=ln;;
834         esac
837 # Check for --with-pydebug
838 AC_MSG_CHECKING(for --with-pydebug)
839 AC_ARG_WITH(pydebug, 
840             AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
842 if test "$withval" != no
843 then 
844   AC_DEFINE(Py_DEBUG, 1, 
845   [Define if you want to build an interpreter with many run-time checks.]) 
846   AC_MSG_RESULT(yes); 
847   Py_DEBUG='true'
848 else AC_MSG_RESULT(no); Py_DEBUG='false'
849 fi],
850 [AC_MSG_RESULT(no)])
852 # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
853 # merged with this chunk of code?
855 # Optimizer/debugger flags
856 # ------------------------
857 # (The following bit of code is complicated enough - please keep things
858 # indented properly.  Just pretend you're editing Python code. ;-)
860 # There are two parallel sets of case statements below, one that checks to
861 # see if OPT was set and one that does BASECFLAGS setting based upon
862 # compiler and platform.  BASECFLAGS tweaks need to be made even if the
863 # user set OPT.
865 # tweak OPT based on compiler and platform, only if the user didn't set
866 # it on the command line
867 AC_SUBST(OPT)
868 if test -z "$OPT"
869 then
870     case $GCC in
871     yes)
872         if test "$CC" != 'g++' ; then
873             STRICT_PROTO="-Wstrict-prototypes"
874         fi
875         # For gcc 4.x we need to use -fwrapv so lets check if its supported
876         if "$CC" -v --help 2>/dev/null |grep -- -fwrapv > /dev/null; then
877            WRAP="-fwrapv"
878         fi
879         case $ac_cv_prog_cc_g in
880         yes)
881             if test "$Py_DEBUG" = 'true' ; then
882                 # Optimization messes up debuggers, so turn it off for
883                 # debug builds.
884                 OPT="-g -Wall $STRICT_PROTO"
885             else
886                 OPT="-g $WRAP -O3 -Wall $STRICT_PROTO"
887             fi
888             ;;
889         *)
890             OPT="-O3 -Wall $STRICT_PROTO"
891             ;;
892         esac
893         case $ac_sys_system in
894             SCO_SV*) OPT="$OPT -m486 -DSCO5"
895             ;;
896         esac
897         ;;
899     *)
900         OPT="-O"
901         ;;
902     esac
905 AC_SUBST(BASECFLAGS)
907 # The -arch flags for universal builds on OSX
908 UNIVERSAL_ARCH_FLAGS=
909 AC_SUBST(UNIVERSAL_ARCH_FLAGS)
911 # tweak BASECFLAGS based on compiler and platform
912 case $GCC in
913 yes)
914     # Python violates C99 rules, by casting between incompatible
915     # pointer types. GCC may generate bad code as a result of that,
916     # so use -fno-strict-aliasing if supported.
917     AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
918      ac_save_cc="$CC"
919      CC="$CC -fno-strict-aliasing"
920      AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok,
921      AC_TRY_RUN([int main() { return 0; }],
922      ac_cv_no_strict_aliasing_ok=yes,
923      ac_cv_no_strict_aliasing_ok=no,
924      ac_cv_no_strict_aliasing_ok=no))
925      CC="$ac_save_cc"
926     AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
927     if test $ac_cv_no_strict_aliasing_ok = yes
928     then
929       BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
930     fi
932     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
933     # support.  Without this, treatment of subnormals doesn't follow
934     # the standard.
935     case $ac_sys_machine in
936          alpha*)
937                 BASECFLAGS="$BASECFLAGS -mieee"
938                 ;;
939     esac
941     case $ac_sys_system in
942         SCO_SV*)
943             BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
944             ;;
945         # is there any other compiler on Darwin besides gcc?
946         Darwin*)
947             # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
948             # used to be here, but non-Apple gcc doesn't accept them.
951             if test "${enable_universalsdk}"; then
952                 UNIVERSAL_ARCH_FLAGS=""
953                 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
954                    UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
955                    ARCH_RUN_32BIT=""
957                  elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
958                    UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
959                    ARCH_RUN_32BIT="true"
961                  elif test "$UNIVERSAL_ARCHS" = "all" ; then
962                    UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
963                    ARCH_RUN_32BIT="arch -i386 -ppc"
965                  elif test "$UNIVERSAL_ARCHS" = "intel" ; then
966                    UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
967                    ARCH_RUN_32BIT="arch -i386"
969                  elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
970                    UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
971                    ARCH_RUN_32BIT="arch -i386 -ppc"
973                  else
974                    AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
976                  fi
979                 BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
980                 tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
981                 if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
982                         CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
983                 fi
984             fi
986             # Calculate the right deployment target for this build.
987             #
988             cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
989             if test ${cur_target} '>' 10.2; then
990                     cur_target=10.3
991                     if test ${enable_universalsdk}; then
992                             if test "${UNIVERSAL_ARCHS}" = "all"; then
993                                     # Ensure that the default platform for a 
994                                     # 4-way universal build is OSX 10.5, 
995                                     # that's the first OS release where 
996                                     # 4-way builds make sense.
997                                     cur_target='10.5'
999                             elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
1000                                     cur_target='10.5'
1002                             elif test "${UNIVERSAL_ARCHS}" = "intel"; then
1003                                     cur_target='10.5'
1005                             elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
1006                                     cur_target='10.5'
1007                             fi
1008                     else
1009                             if test `arch` = "i386"; then
1010                                     # On Intel macs default to a deployment
1011                                     # target of 10.4, that's the first OSX
1012                                     # release with Intel support.
1013                                     cur_target="10.4"
1014                             fi
1015                     fi
1016             fi
1017             CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1018             
1019             # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the 
1020             # environment with a value that is the same as what we'll use
1021             # in the Makefile to ensure that we'll get the same compiler
1022             # environment during configure and build time.
1023             MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
1024             export MACOSX_DEPLOYMENT_TARGET
1025             EXPORT_MACOSX_DEPLOYMENT_TARGET=''
1027             ;;
1028         OSF*)
1029             BASECFLAGS="$BASECFLAGS -mieee"
1030             ;;
1031     esac
1032     ;;
1035     case $ac_sys_system in
1036     OpenUNIX*|UnixWare*)
1037         BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
1038         ;;
1039     OSF*)
1040         BASECFLAGS="$BASECFLAGS -ieee -std"
1041         ;;
1042     SCO_SV*)
1043         BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
1044         ;;
1045     esac
1046     ;;
1047 esac
1049 if test "$Py_DEBUG" = 'true'; then
1050   :
1051 else
1052   OPT="-DNDEBUG $OPT"
1055 if test "$ac_arch_flags"
1056 then
1057         BASECFLAGS="$BASECFLAGS $ac_arch_flags"
1060 # disable check for icc since it seems to pass, but generates a warning
1061 if test "$CC" = icc
1062 then
1063   ac_cv_opt_olimit_ok=no
1066 AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
1067 AC_CACHE_VAL(ac_cv_opt_olimit_ok,
1068 [ac_save_cc="$CC"
1069 CC="$CC -OPT:Olimit=0"
1070 AC_TRY_RUN([int main() { return 0; }],
1071   ac_cv_opt_olimit_ok=yes,
1072   ac_cv_opt_olimit_ok=no,
1073   ac_cv_opt_olimit_ok=no)
1074 CC="$ac_save_cc"])
1075 AC_MSG_RESULT($ac_cv_opt_olimit_ok)
1076 if test $ac_cv_opt_olimit_ok = yes; then
1077     case $ac_sys_system in
1078         # XXX is this branch needed? On MacOSX 10.2.2 the result of the
1079         # olimit_ok test is "no".  Is it "yes" in some other Darwin-esque
1080         # environment?
1081         Darwin*)
1082             ;;
1083         *)
1084             BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
1085             ;;
1086     esac
1087 else
1088   AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
1089   AC_CACHE_VAL(ac_cv_olimit_ok,
1090   [ac_save_cc="$CC"
1091   CC="$CC -Olimit 1500"
1092   AC_TRY_RUN([int main() { return 0; }],
1093     ac_cv_olimit_ok=yes,
1094     ac_cv_olimit_ok=no,
1095     ac_cv_olimit_ok=no)
1096   CC="$ac_save_cc"])
1097   AC_MSG_RESULT($ac_cv_olimit_ok)
1098   if test $ac_cv_olimit_ok = yes; then
1099     BASECFLAGS="$BASECFLAGS -Olimit 1500"
1100   fi
1103 # Check whether GCC supports PyArg_ParseTuple format
1104 if test "$GCC" = "yes"
1105 then
1106   AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
1107   save_CFLAGS=$CFLAGS
1108   CFLAGS="$CFLAGS -Werror"
1109   AC_TRY_COMPILE([
1110     void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
1111   ],,
1112   AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
1113   AC_MSG_RESULT(yes),
1114   AC_MSG_RESULT(no)
1115   )
1116   CFLAGS=$save_CFLAGS
1119 # On some compilers, pthreads are available without further options
1120 # (e.g. MacOS X). On some of these systems, the compiler will not
1121 # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
1122 # So we have to see first whether pthreads are available without
1123 # options before we can check whether -Kpthread improves anything.
1124 AC_MSG_CHECKING(whether pthreads are available without options)
1125 AC_CACHE_VAL(ac_cv_pthread_is_default,
1126 [AC_TRY_RUN([
1127 #include <pthread.h>
1129 void* routine(void* p){return NULL;}
1131 int main(){
1132   pthread_t p;
1133   if(pthread_create(&p,NULL,routine,NULL)!=0)
1134     return 1;
1135   (void)pthread_detach(p);
1136   return 0;
1140   ac_cv_pthread_is_default=yes
1141   ac_cv_kthread=no
1142   ac_cv_pthread=no
1144   ac_cv_pthread_is_default=no,
1145   ac_cv_pthread_is_default=no)
1147 AC_MSG_RESULT($ac_cv_pthread_is_default)
1150 if test $ac_cv_pthread_is_default = yes 
1151 then
1152   ac_cv_kpthread=no
1153 else
1154 # -Kpthread, if available, provides the right #defines
1155 # and linker options to make pthread_create available
1156 # Some compilers won't report that they do not support -Kpthread,
1157 # so we need to run a program to see whether it really made the
1158 # function available.
1159 AC_MSG_CHECKING(whether $CC accepts -Kpthread)
1160 AC_CACHE_VAL(ac_cv_kpthread,
1161 [ac_save_cc="$CC"
1162 CC="$CC -Kpthread"
1163 AC_TRY_RUN([
1164 #include <pthread.h>
1166 void* routine(void* p){return NULL;}
1168 int main(){
1169   pthread_t p;
1170   if(pthread_create(&p,NULL,routine,NULL)!=0)
1171     return 1;
1172   (void)pthread_detach(p);
1173   return 0;
1176   ac_cv_kpthread=yes,
1177   ac_cv_kpthread=no,
1178   ac_cv_kpthread=no)
1179 CC="$ac_save_cc"])
1180 AC_MSG_RESULT($ac_cv_kpthread)
1183 if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
1184 then
1185 # -Kthread, if available, provides the right #defines
1186 # and linker options to make pthread_create available
1187 # Some compilers won't report that they do not support -Kthread,
1188 # so we need to run a program to see whether it really made the
1189 # function available.
1190 AC_MSG_CHECKING(whether $CC accepts -Kthread)
1191 AC_CACHE_VAL(ac_cv_kthread,
1192 [ac_save_cc="$CC"
1193 CC="$CC -Kthread"
1194 AC_TRY_RUN([
1195 #include <pthread.h>
1197 void* routine(void* p){return NULL;}
1199 int main(){
1200   pthread_t p;
1201   if(pthread_create(&p,NULL,routine,NULL)!=0)
1202     return 1;
1203   (void)pthread_detach(p);
1204   return 0;
1207   ac_cv_kthread=yes,
1208   ac_cv_kthread=no,
1209   ac_cv_kthread=no)
1210 CC="$ac_save_cc"])
1211 AC_MSG_RESULT($ac_cv_kthread)
1214 if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1215 then
1216 # -pthread, if available, provides the right #defines
1217 # and linker options to make pthread_create available
1218 # Some compilers won't report that they do not support -pthread,
1219 # so we need to run a program to see whether it really made the
1220 # function available.
1221 AC_MSG_CHECKING(whether $CC accepts -pthread)
1222 AC_CACHE_VAL(ac_cv_thread,
1223 [ac_save_cc="$CC"
1224 CC="$CC -pthread"
1225 AC_TRY_RUN([
1226 #include <pthread.h>
1228 void* routine(void* p){return NULL;}
1230 int main(){
1231   pthread_t p;
1232   if(pthread_create(&p,NULL,routine,NULL)!=0)
1233     return 1;
1234   (void)pthread_detach(p);
1235   return 0;
1238   ac_cv_pthread=yes,
1239   ac_cv_pthread=no,
1240   ac_cv_pthread=no)
1241 CC="$ac_save_cc"])
1242 AC_MSG_RESULT($ac_cv_pthread)
1245 # If we have set a CC compiler flag for thread support then
1246 # check if it works for CXX, too.
1247 ac_cv_cxx_thread=no
1248 if test ! -z "$CXX"
1249 then
1250 AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1251 ac_save_cxx="$CXX"
1253 if test "$ac_cv_kpthread" = "yes"
1254 then
1255   CXX="$CXX -Kpthread"  
1256   ac_cv_cxx_thread=yes
1257 elif test "$ac_cv_kthread" = "yes"
1258 then
1259   CXX="$CXX -Kthread"
1260   ac_cv_cxx_thread=yes
1261 elif test "$ac_cv_pthread" = "yes"
1262 then 
1263   CXX="$CXX -pthread"
1264   ac_cv_cxx_thread=yes
1267 if test $ac_cv_cxx_thread = yes
1268 then
1269   echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1270   $CXX -c conftest.$ac_ext 2>&5
1271   if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1272      && test -s conftest$ac_exeext && ./conftest$ac_exeext
1273   then
1274     ac_cv_cxx_thread=yes
1275   else
1276     ac_cv_cxx_thread=no
1277   fi
1278   rm -fr conftest*
1280 AC_MSG_RESULT($ac_cv_cxx_thread)
1282 CXX="$ac_save_cxx"
1284 dnl # check for ANSI or K&R ("traditional") preprocessor
1285 dnl AC_MSG_CHECKING(for C preprocessor type)
1286 dnl AC_TRY_COMPILE([
1287 dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1288 dnl int foo;
1289 dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1290 dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1291 dnl AC_MSG_RESULT($cpp_type)
1293 # checks for header files
1294 AC_HEADER_STDC
1295 AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1296 fcntl.h grp.h \
1297 ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1298 shadow.h signal.h stdint.h stropts.h termios.h thread.h \
1299 unistd.h utime.h \
1300 sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
1301 sys/lock.h sys/mkdev.h sys/modem.h \
1302 sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1303 sys/termio.h sys/time.h \
1304 sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1305 sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1306 bluetooth/bluetooth.h linux/tipc.h)
1307 AC_HEADER_DIRENT
1308 AC_HEADER_MAJOR
1310 # On Solaris, term.h requires curses.h
1311 AC_CHECK_HEADERS(term.h,,,[
1312 #ifdef HAVE_CURSES_H
1313 #include <curses.h>
1314 #endif
1317 # On Linux, netlink.h requires asm/types.h
1318 AC_CHECK_HEADERS(linux/netlink.h,,,[
1319 #ifdef HAVE_ASM_TYPES_H
1320 #include <asm/types.h>
1321 #endif
1322 #ifdef HAVE_SYS_SOCKET_H
1323 #include <sys/socket.h>
1324 #endif
1327 # checks for typedefs
1328 was_it_defined=no
1329 AC_MSG_CHECKING(for clock_t in time.h)
1330 AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1331     AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1333 AC_MSG_RESULT($was_it_defined)
1335 # Check whether using makedev requires defining _OSF_SOURCE
1336 AC_MSG_CHECKING(for makedev)
1337 AC_TRY_LINK([#include <sys/types.h> ],
1338             [ makedev(0, 0) ],
1339             ac_cv_has_makedev=yes,
1340             ac_cv_has_makedev=no)
1341 if test "$ac_cv_has_makedev" = "no"; then
1342     # we didn't link, try if _OSF_SOURCE will allow us to link
1343     AC_TRY_LINK([
1344 #define _OSF_SOURCE 1
1345 #include <sys/types.h>
1346     ],
1347     [ makedev(0, 0) ],
1348     ac_cv_has_makedev=yes,
1349     ac_cv_has_makedev=no)
1350     if test "$ac_cv_has_makedev" = "yes"; then
1351         AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1352     fi
1354 AC_MSG_RESULT($ac_cv_has_makedev)
1355 if test "$ac_cv_has_makedev" = "yes"; then
1356     AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1359 # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1360 # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1361 # defined, but the compiler does not support pragma redefine_extname,
1362 # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1363 # structures (such as rlimit64) without declaring them. As a
1364 # work-around, disable LFS on such configurations
1366 use_lfs=yes
1367 AC_MSG_CHECKING(Solaris LFS bug)
1368 AC_TRY_COMPILE([
1369 #define _LARGEFILE_SOURCE 1
1370 #define _FILE_OFFSET_BITS 64
1371 #include <sys/resource.h>
1372 ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1373 AC_MSG_RESULT($sol_lfs_bug)
1374 if test "$sol_lfs_bug" = "yes"; then
1375   use_lfs=no
1378 if test "$use_lfs" = "yes"; then
1379 # Two defines needed to enable largefile support on various platforms
1380 # These may affect some typedefs
1381 AC_DEFINE(_LARGEFILE_SOURCE, 1, 
1382 [This must be defined on some systems to enable large file support.])
1383 AC_DEFINE(_FILE_OFFSET_BITS, 64,
1384 [This must be set to 64 on some systems to enable large file support.])
1387 # Add some code to confdefs.h so that the test for off_t works on SCO
1388 cat >> confdefs.h <<\EOF
1389 #if defined(SCO_DS)
1390 #undef _OFF_T
1391 #endif
1394 # Type availability checks
1395 AC_TYPE_MODE_T
1396 AC_TYPE_OFF_T
1397 AC_TYPE_PID_T
1398 AC_TYPE_SIGNAL
1399 AC_TYPE_SIZE_T
1400 AC_TYPE_UID_T
1401 AC_TYPE_UINT32_T
1402 AC_TYPE_UINT64_T
1403 AC_TYPE_INT32_T
1404 AC_TYPE_INT64_T
1405 AC_CHECK_TYPE(ssize_t,
1406   AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1408 # Sizes of various common basic types
1409 # ANSI C requires sizeof(char) == 1, so no need to check it
1410 AC_CHECK_SIZEOF(int, 4)
1411 AC_CHECK_SIZEOF(long, 4)
1412 AC_CHECK_SIZEOF(void *, 4)
1413 AC_CHECK_SIZEOF(short, 2)
1414 AC_CHECK_SIZEOF(float, 4)
1415 AC_CHECK_SIZEOF(double, 8)
1416 AC_CHECK_SIZEOF(fpos_t, 4)
1417 AC_CHECK_SIZEOF(size_t, 4)
1418 AC_CHECK_SIZEOF(pid_t, 4)
1420 AC_MSG_CHECKING(for long long support)
1421 have_long_long=no
1422 AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1423   AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.]) 
1424   have_long_long=yes
1426 AC_MSG_RESULT($have_long_long)
1427 if test "$have_long_long" = yes ; then
1428 AC_CHECK_SIZEOF(long long, 8)
1431 AC_MSG_CHECKING(for long double support)
1432 have_long_double=no
1433 AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
1434   AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
1435   have_long_double=yes
1437 AC_MSG_RESULT($have_long_double)
1438 if test "$have_long_double" = yes ; then
1439 AC_CHECK_SIZEOF(long double, 12)
1442 AC_MSG_CHECKING(for _Bool support)
1443 have_c99_bool=no
1444 AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
1445   AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.]) 
1446   have_c99_bool=yes
1448 AC_MSG_RESULT($have_c99_bool)
1449 if test "$have_c99_bool" = yes ; then
1450 AC_CHECK_SIZEOF(_Bool, 1)
1453 AC_CHECK_TYPES(uintptr_t, 
1454    [AC_CHECK_SIZEOF(uintptr_t, 4)], 
1455    [], [#ifdef HAVE_STDINT_H
1456         #include <stdint.h>
1457         #endif])
1459 AC_CHECK_SIZEOF(off_t, [], [
1460 #ifdef HAVE_SYS_TYPES_H
1461 #include <sys/types.h>
1462 #endif
1465 AC_MSG_CHECKING(whether to enable large file support)
1466 if test "$have_long_long" = yes -a \
1467         "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1468         "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1469   AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1, 
1470   [Defined to enable large file support when an off_t is bigger than a long
1471    and long long is available and at least as big as an off_t. You may need
1472    to add some flags for configuration and compilation to enable this mode.
1473    (For Solaris and Linux, the necessary defines are already defined.)])
1474   AC_MSG_RESULT(yes)
1475 else
1476   AC_MSG_RESULT(no)
1479 AC_CHECK_SIZEOF(time_t, [], [
1480 #ifdef HAVE_SYS_TYPES_H
1481 #include <sys/types.h>
1482 #endif
1483 #ifdef HAVE_TIME_H
1484 #include <time.h>
1485 #endif
1488 # if have pthread_t then define SIZEOF_PTHREAD_T
1489 ac_save_cc="$CC"
1490 if test "$ac_cv_kpthread" = "yes"
1491 then CC="$CC -Kpthread"
1492 elif test "$ac_cv_kthread" = "yes"
1493 then CC="$CC -Kthread"
1494 elif test "$ac_cv_pthread" = "yes"
1495 then CC="$CC -pthread"
1497 AC_MSG_CHECKING(for pthread_t)
1498 have_pthread_t=no
1499 AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
1500 AC_MSG_RESULT($have_pthread_t)
1501 if test "$have_pthread_t" = yes ; then
1502   AC_CHECK_SIZEOF(pthread_t, [], [
1503 #ifdef HAVE_PTHREAD_H
1504 #include <pthread.h>
1505 #endif
1506   ])
1508 CC="$ac_save_cc"
1510 AC_MSG_CHECKING(for --enable-toolbox-glue)
1511 AC_ARG_ENABLE(toolbox-glue,
1512               AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
1514 if test -z "$enable_toolbox_glue"
1515 then 
1516         case $ac_sys_system/$ac_sys_release in
1517         Darwin/*)
1518                 enable_toolbox_glue="yes";;
1519         *)
1520                 enable_toolbox_glue="no";;
1521         esac
1523 case "$enable_toolbox_glue" in
1524 yes)
1525         extra_machdep_objs="Python/mactoolboxglue.o"
1526         extra_undefs="-u _PyMac_Error"
1527         AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
1528          [Define if you want to use MacPython modules on MacOSX in unix-Python.])
1529         ;;
1531         extra_machdep_objs=""
1532         extra_undefs=""
1533         ;;
1534 esac
1535 AC_MSG_RESULT($enable_toolbox_glue)
1538 AC_SUBST(OTHER_LIBTOOL_OPT)
1539 case $ac_sys_system/$ac_sys_release in
1540   Darwin/@<:@01567@:>@\..*) 
1541     OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
1542     ;;
1543   Darwin/*)
1544     OTHER_LIBTOOL_OPT=""
1545     ;;
1546 esac
1549 ARCH_RUN_32BIT=""
1550 AC_SUBST(LIBTOOL_CRUFT)
1551 case $ac_sys_system/$ac_sys_release in
1552   Darwin/@<:@01567@:>@\..*) 
1553     LIBTOOL_CRUFT="-framework System -lcc_dynamic"
1554     if test "${enable_universalsdk}"; then
1555             :
1556     else
1557         LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
1558     fi
1559     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1560     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1561   Darwin/*)
1562     gcc_version=`gcc -v 2>&1 |  grep version | cut -d\  -f3`
1563     if test ${gcc_version} '<' 4.0
1564         then
1565             LIBTOOL_CRUFT="-lcc_dynamic"
1566         else 
1567             LIBTOOL_CRUFT=""
1568     fi
1569     AC_TRY_RUN([
1570     #include <unistd.h>
1571     int main(int argc, char*argv[])
1572     {
1573       if (sizeof(long) == 4) {
1574           return 0;
1575       } else {
1576           return 1;
1577       }
1578     }
1579     ], ac_osx_32bit=yes,
1580        ac_osx_32bit=no,
1581        ac_osx_32bit=yes)
1582     
1583     if test "${ac_osx_32bit}" = "yes"; then
1584         case `arch` in
1585         i386) 
1586                 MACOSX_DEFAULT_ARCH="i386" 
1587                 ;;
1588         ppc) 
1589                 MACOSX_DEFAULT_ARCH="ppc" 
1590                 ;;
1591         *)
1592                 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1593                 ;;
1594         esac
1595     else
1596         case `arch` in
1597         i386) 
1598                 MACOSX_DEFAULT_ARCH="x86_64" 
1599                 ;;
1600         ppc) 
1601                 MACOSX_DEFAULT_ARCH="ppc64" 
1602                 ;;
1603         *)
1604                 AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
1605                 ;;
1606         esac
1608         #ARCH_RUN_32BIT="true"
1609     fi
1611     LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
1612     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1613     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
1614 esac
1616 AC_MSG_CHECKING(for --enable-framework)
1617 if test "$enable_framework"
1618 then
1619         BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
1620         # -F. is needed to allow linking to the framework while 
1621         # in the build location.
1622         AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, 
1623          [Define if you want to produce an OpenStep/Rhapsody framework
1624          (shared library plus accessory files).])
1625         AC_MSG_RESULT(yes)
1626         if test $enable_shared = "yes"
1627         then
1628                 AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead. See Mac/README.])
1629         fi
1630 else
1631         AC_MSG_RESULT(no)
1634 AC_MSG_CHECKING(for dyld)
1635 case $ac_sys_system/$ac_sys_release in
1636   Darwin/*)
1637         AC_DEFINE(WITH_DYLD, 1, 
1638         [Define if you want to use the new-style (Openstep, Rhapsody, MacOS)
1639          dynamic linker (dyld) instead of the old-style (NextStep) dynamic
1640          linker (rld). Dyld is necessary to support frameworks.])
1641         AC_MSG_RESULT(always on for Darwin)
1642         ;;
1643   *)
1644         AC_MSG_RESULT(no)
1645         ;;
1646 esac
1648 # Set info about shared libraries.
1649 AC_SUBST(SO)
1650 AC_SUBST(LDSHARED)
1651 AC_SUBST(BLDSHARED)
1652 AC_SUBST(CCSHARED)
1653 AC_SUBST(LINKFORSHARED)
1654 # SO is the extension of shared libraries `(including the dot!)
1655 # -- usually .so, .sl on HP-UX, .dll on Cygwin
1656 AC_MSG_CHECKING(SO)
1657 if test -z "$SO"
1658 then
1659         case $ac_sys_system in
1660         hp*|HP*)
1661                 case `uname -m` in
1662                         ia64) SO=.so;;
1663                         *)    SO=.sl;;
1664                 esac
1665                 ;;
1666         CYGWIN*)   SO=.dll;;
1667         *)         SO=.so;;
1668         esac
1669 else
1670         # this might also be a termcap variable, see #610332
1671         echo
1672         echo '====================================================================='
1673         echo '+                                                                   +'
1674         echo '+ WARNING: You have set SO in your environment.                     +'
1675         echo '+ Do you really mean to change the extension for shared libraries?  +'
1676         echo '+ Continuing in 10 seconds to let you to ponder.                    +'
1677         echo '+                                                                   +'
1678         echo '====================================================================='
1679         sleep 10
1681 AC_MSG_RESULT($SO)
1683 AC_DEFINE_UNQUOTED(SHLIB_EXT, "$SO", [Define this to be extension of shared libraries (including the dot!).])
1684 # LDSHARED is the ld *command* used to create shared library
1685 # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5
1686 # (Shared libraries in this instance are shared modules to be loaded into
1687 # Python, as opposed to building Python itself as a shared library.)
1688 AC_MSG_CHECKING(LDSHARED)
1689 if test -z "$LDSHARED"
1690 then
1691         case $ac_sys_system/$ac_sys_release in
1692         AIX*)
1693                 BLDSHARED="\$(srcdir)/Modules/ld_so_aix \$(CC) -bI:Modules/python.exp"
1694                 LDSHARED="\$(BINLIBDEST)/config/ld_so_aix \$(CC) -bI:\$(BINLIBDEST)/config/python.exp"
1695                 ;;
1696         BeOS*)
1697                 BLDSHARED="\$(srcdir)/Modules/ld_so_beos $LDLIBRARY"
1698                 LDSHARED="\$(BINLIBDEST)/config/ld_so_beos \$(LIBDIR)/$LDLIBRARY"
1699                 ;;
1700         IRIX/5*) LDSHARED="ld -shared";;
1701         IRIX*/6*) LDSHARED="ld ${SGI_ABI} -shared -all";;
1702         SunOS/5*) 
1703                 if test "$GCC" = "yes"
1704                 then LDSHARED='$(CC) -shared'
1705                 else LDSHARED='$(CC) -G';
1706                 fi ;;
1707         hp*|HP*)
1708                 if test "$GCC" = "yes"
1709                 then LDSHARED='$(CC) -shared'
1710                 else LDSHARED='ld -b';
1711                 fi ;;
1712         OSF*) LDSHARED="ld -shared -expect_unresolved \"*\"";;
1713         Darwin/1.3*)
1714                 LDSHARED='$(CC) $(LDFLAGS) -bundle'
1715                 if test "$enable_framework" ; then
1716                         # Link against the framework. All externals should be defined.
1717                         BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1718                         LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1719                 else
1720                         # No framework. Ignore undefined symbols, assuming they come from Python
1721                         LDSHARED="$LDSHARED -undefined suppress"
1722                 fi ;;
1723         Darwin/1.4*|Darwin/5.*|Darwin/6.*)
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)'
1729                 else
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)'
1733                 fi ;;
1734         Darwin/*)
1735                 # Use -undefined dynamic_lookup whenever possible (10.3 and later).
1736                 # This allows an extension to be used in any Python
1738                 if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2
1739                 then
1740                         if test "${enable_universalsdk}"; then
1741                                 LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}"
1742                         fi
1743                         LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1744                         BLDSHARED="$LDSHARED"
1745                 else
1746                         LDSHARED='$(CC) $(LDFLAGS) -bundle'
1747                         if test "$enable_framework" ; then
1748                                 # Link against the framework. All externals should be defined.
1749                                 BLDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1750                                 LDSHARED="$LDSHARED "'$(PYTHONFRAMEWORKPREFIX)/$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1751                         else
1752                                 # No framework, use the Python app as bundle-loader
1753                                 BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
1754                                 LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
1755                         fi
1756                 fi
1757                 ;;
1758         Linux*|GNU*|QNX*) LDSHARED='$(CC) -shared';;
1759         BSD/OS*/4*) LDSHARED="gcc -shared";;
1760         FreeBSD*)
1761                 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1762                 then
1763                         LDSHARED="$CC -shared ${LDFLAGS}"
1764                 else
1765                         LDSHARED="ld -Bshareable ${LDFLAGS}"
1766                 fi;;
1767         OpenBSD*)
1768                 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1769                 then
1770                                 LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1771                 else
1772                                 case `uname -r` in
1773                                 [[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
1774                                    LDSHARED="ld -Bshareable ${LDFLAGS}"
1775                                    ;;
1776                                 *)
1777                                    LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
1778                                    ;;
1779                                 esac
1780                 fi;;
1781         NetBSD*|DragonFly*) LDSHARED="cc -shared ${LDFLAGS}";;
1782         OpenUNIX*|UnixWare*)
1783                 if test "$GCC" = "yes"
1784                 then LDSHARED='$(CC) -shared'
1785                 else LDSHARED='$(CC) -G'
1786                 fi;;
1787         SCO_SV*) LDSHARED='$(CC) -Wl,-G,-Bexport';;
1788         CYGWIN*) LDSHARED="gcc -shared -Wl,--enable-auto-image-base";;
1789         atheos*) LDSHARED="gcc -shared";;
1790         *)      LDSHARED="ld";;
1791         esac
1793 AC_MSG_RESULT($LDSHARED)
1794 BLDSHARED=${BLDSHARED-$LDSHARED}
1795 # CCSHARED are the C *flags* used to create objects to go into a shared
1796 # library (module) -- this is only needed for a few systems
1797 AC_MSG_CHECKING(CCSHARED)
1798 if test -z "$CCSHARED"
1799 then
1800         case $ac_sys_system/$ac_sys_release in
1801         SunOS*) if test "$GCC" = yes;
1802                 then CCSHARED="-fPIC";
1803                 elif test `uname -p` = sparc;
1804                 then CCSHARED="-xcode=pic32";
1805                 else CCSHARED="-Kpic";
1806                 fi;;
1807         hp*|HP*) if test "$GCC" = yes;
1808                  then CCSHARED="-fPIC";
1809                  else CCSHARED="+z";
1810                  fi;;
1811         Linux*|GNU*) CCSHARED="-fPIC";;
1812         BSD/OS*/4*) CCSHARED="-fpic";;
1813         FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) CCSHARED="-fPIC";;
1814         OpenUNIX*|UnixWare*)
1815                 if test "$GCC" = "yes"
1816                 then CCSHARED="-fPIC"
1817                 else CCSHARED="-KPIC"
1818                 fi;;
1819         SCO_SV*)
1820                 if test "$GCC" = "yes"
1821                 then CCSHARED="-fPIC"
1822                 else CCSHARED="-Kpic -belf"
1823                 fi;;
1824         IRIX*/6*)  case $CC in
1825                    *gcc*) CCSHARED="-shared";;
1826                    *) CCSHARED="";;
1827                    esac;;
1828         atheos*) CCSHARED="-fPIC";;
1829         esac
1831 AC_MSG_RESULT($CCSHARED)
1832 # LINKFORSHARED are the flags passed to the $(CC) command that links
1833 # the python executable -- this is only needed for a few systems
1834 AC_MSG_CHECKING(LINKFORSHARED)
1835 if test -z "$LINKFORSHARED"
1836 then
1837         case $ac_sys_system/$ac_sys_release in
1838         AIX*)   LINKFORSHARED='-Wl,-bE:Modules/python.exp -lld';;
1839         hp*|HP*)
1840             LINKFORSHARED="-Wl,-E -Wl,+s";;
1841 #           LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
1842         BSD/OS/4*) LINKFORSHARED="-Xlinker -export-dynamic";;
1843         Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
1844         # -u libsys_s pulls in all symbols in libsys
1845         Darwin/*) 
1846                 # -u _PyMac_Error is needed to pull in the mac toolbox glue,
1847                 # which is
1848                 # not used by the core itself but which needs to be in the core so
1849                 # that dynamically loaded extension modules have access to it.
1850                 # -prebind is no longer used, because it actually seems to give a
1851                 # slowdown in stead of a speedup, maybe due to the large number of
1852                 # dynamic loads Python does.
1854                 LINKFORSHARED="$extra_undefs"
1855                 if test "$enable_framework"
1856                 then
1857                         LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
1858                 fi
1859                 LINKFORSHARED="$LINKFORSHARED";;
1860         OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
1861         SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
1862         ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
1863         FreeBSD*|NetBSD*|OpenBSD*|DragonFly*) 
1864                 if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
1865                 then
1866                         LINKFORSHARED="-Wl,--export-dynamic"
1867                 fi;;
1868         SunOS/5*) case $CC in
1869                   *gcc*)
1870                     if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
1871                     then
1872                         LINKFORSHARED="-Xlinker --export-dynamic"
1873                     fi;;
1874                   esac;;
1875         CYGWIN*)
1876                 if test $enable_shared = "no"
1877                 then
1878                         LINKFORSHARED='-Wl,--out-implib=$(LDLIBRARY)'
1879                 fi;;
1880         QNX*)
1881                 # -Wl,-E causes the symbols to be added to the dynamic
1882                 # symbol table so that they can be found when a module
1883                 # is loaded.  -N 2048K causes the stack size to be set
1884                 # to 2048 kilobytes so that the stack doesn't overflow
1885                 # when running test_compile.py.
1886                 LINKFORSHARED='-Wl,-E -N 2048K';;
1887         esac
1889 AC_MSG_RESULT($LINKFORSHARED)
1892 AC_SUBST(CFLAGSFORSHARED)
1893 AC_MSG_CHECKING(CFLAGSFORSHARED)
1894 if test ! "$LIBRARY" = "$LDLIBRARY"
1895 then
1896         case $ac_sys_system in
1897         CYGWIN*)
1898                 # Cygwin needs CCSHARED when building extension DLLs
1899                 # but not when building the interpreter DLL.
1900                 CFLAGSFORSHARED='';;
1901         *)
1902                 CFLAGSFORSHARED='$(CCSHARED)'
1903         esac
1905 AC_MSG_RESULT($CFLAGSFORSHARED)
1907 # SHLIBS are libraries (except -lc and -lm) to link to the python shared
1908 # library (with --enable-shared).
1909 # For platforms on which shared libraries are not allowed to have unresolved
1910 # symbols, this must be set to $(LIBS) (expanded by make). We do this even
1911 # if it is not required, since it creates a dependency of the shared library
1912 # to LIBS. This, in turn, means that applications linking the shared libpython
1913 # don't need to link LIBS explicitly. The default should be only changed
1914 # on systems where this approach causes problems.
1915 AC_SUBST(SHLIBS)
1916 AC_MSG_CHECKING(SHLIBS)
1917 case "$ac_sys_system" in
1918         *)
1919                 SHLIBS='$(LIBS)';;
1920 esac
1921 AC_MSG_RESULT($SHLIBS)
1924 # checks for libraries
1925 AC_CHECK_LIB(dl, dlopen)        # Dynamic linking for SunOS/Solaris and SYSV
1926 AC_CHECK_LIB(dld, shl_load)     # Dynamic linking for HP-UX
1928 # only check for sem_init if thread support is requested
1929 if test "$with_threads" = "yes" -o -z "$with_threads"; then
1930     AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
1931                                                 # posix4 on Solaris 2.6
1932                                                 # pthread (first!) on Linux
1935 # check if we need libintl for locale functions
1936 AC_CHECK_LIB(intl, textdomain,
1937         AC_DEFINE(WITH_LIBINTL, 1,
1938         [Define to 1 if libintl is needed for locale functions.]))
1940 # checks for system dependent C++ extensions support
1941 case "$ac_sys_system" in
1942         AIX*)   AC_MSG_CHECKING(for genuine AIX C++ extensions support)
1943                 AC_TRY_LINK([#include "/usr/lpp/xlC/include/load.h"],
1944                             [loadAndInit("", 0, "")],
1945                             [AC_DEFINE(AIX_GENUINE_CPLUSPLUS, 1,
1946                       [Define for AIX if your compiler is a genuine IBM xlC/xlC_r
1947                        and you want support for AIX C++ shared extension modules.])
1948                              AC_MSG_RESULT(yes)],
1949                             [AC_MSG_RESULT(no)]);;
1950         *) ;;
1951 esac
1953 # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl.
1954 # BeOS' sockets are stashed in libnet.
1955 AC_CHECK_LIB(nsl, t_open, [LIBS="-lnsl $LIBS"]) # SVR4
1956 AC_CHECK_LIB(socket, socket, [LIBS="-lsocket $LIBS"], [], $LIBS) # SVR4 sockets
1958 case "$ac_sys_system" in
1959 BeOS*)
1960 AC_CHECK_LIB(net, socket, [LIBS="-lnet $LIBS"], [], $LIBS) # BeOS
1962 esac
1964 AC_MSG_CHECKING(for --with-libs)
1965 AC_ARG_WITH(libs,
1966             AC_HELP_STRING(--with-libs='lib1 ...', link against additional libs),
1968 AC_MSG_RESULT($withval)
1969 LIBS="$withval $LIBS"
1971 [AC_MSG_RESULT(no)])
1973 # Check for use of the system libffi library
1974 AC_MSG_CHECKING(for --with-system-ffi)
1975 AC_ARG_WITH(system_ffi,
1976             AC_HELP_STRING(--with-system-ffi, build _ctypes module using an installed ffi library))
1978 AC_MSG_RESULT($with_system_ffi)
1980 # Check for --with-dbmliborder
1981 AC_MSG_CHECKING(for --with-dbmliborder)
1982 AC_ARG_WITH(dbmliborder,
1983             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'.]),
1985 if test x$with_dbmliborder = xyes
1986 then
1987 AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1988 else
1989   for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
1990     if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
1991     then
1992       AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
1993     fi
1994   done
1995 fi])
1996 AC_MSG_RESULT($with_dbmliborder)
1998 # Determine if signalmodule should be used.
1999 AC_SUBST(USE_SIGNAL_MODULE)
2000 AC_SUBST(SIGNAL_OBJS)
2001 AC_MSG_CHECKING(for --with-signal-module)
2002 AC_ARG_WITH(signal-module,
2003             AC_HELP_STRING(--with-signal-module, disable/enable signal module))
2005 if test -z "$with_signal_module"
2006 then with_signal_module="yes"
2008 AC_MSG_RESULT($with_signal_module)
2010 if test "${with_signal_module}" = "yes"; then
2011         USE_SIGNAL_MODULE=""
2012         SIGNAL_OBJS=""
2013 else
2014         USE_SIGNAL_MODULE="#"
2015         SIGNAL_OBJS="Parser/intrcheck.o Python/sigcheck.o"
2018 # This is used to generate Setup.config
2019 AC_SUBST(USE_THREAD_MODULE)
2020 USE_THREAD_MODULE=""
2022 AC_MSG_CHECKING(for --with-dec-threads)
2023 AC_SUBST(LDLAST)
2024 AC_ARG_WITH(dec-threads,
2025             AC_HELP_STRING(--with-dec-threads, use DEC Alpha/OSF1 thread-safe libraries),
2027 AC_MSG_RESULT($withval)
2028 LDLAST=-threads
2029 if test "${with_thread+set}" != set; then
2030    with_thread="$withval";
2031 fi],
2032 [AC_MSG_RESULT(no)])
2034 # Templates for things AC_DEFINEd more than once.
2035 # For a single AC_DEFINE, no template is needed.
2036 AH_TEMPLATE(C_THREADS,[Define if you have the Mach cthreads package])
2037 AH_TEMPLATE(_REENTRANT,
2038   [Define to force use of thread-safe errno, h_errno, and other functions])
2039 AH_TEMPLATE(WITH_THREAD,
2040   [Define if you want to compile in rudimentary thread support])
2042 AC_MSG_CHECKING(for --with-threads)
2043 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2044 AC_ARG_WITH(threads,
2045             AC_HELP_STRING(--with(out)-threads@<:@=DIRECTORY@:>@, disable/enable thread support))
2047 # --with-thread is deprecated, but check for it anyway
2048 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
2049 AC_ARG_WITH(thread,
2050             AC_HELP_STRING(--with(out)-thread@<:@=DIRECTORY@:>@, deprecated; use --with(out)-threads),
2051             [with_threads=$with_thread])
2053 if test -z "$with_threads"
2054 then with_threads="yes"
2056 AC_MSG_RESULT($with_threads)
2058 AC_SUBST(THREADOBJ)
2059 if test "$with_threads" = "no"
2060 then
2061     USE_THREAD_MODULE="#"
2062 elif test "$ac_cv_pthread_is_default" = yes
2063 then
2064     AC_DEFINE(WITH_THREAD)
2065     # Defining _REENTRANT on system with POSIX threads should not hurt.
2066     AC_DEFINE(_REENTRANT)
2067     posix_threads=yes
2068     THREADOBJ="Python/thread.o"    
2069 elif test "$ac_cv_kpthread" = "yes"
2070 then
2071     CC="$CC -Kpthread"
2072     if test "$ac_cv_cxx_thread" = "yes"; then
2073         CXX="$CXX -Kpthread"
2074     fi
2075     AC_DEFINE(WITH_THREAD)
2076     posix_threads=yes
2077     THREADOBJ="Python/thread.o"
2078 elif test "$ac_cv_kthread" = "yes"
2079 then
2080     CC="$CC -Kthread"
2081     if test "$ac_cv_cxx_thread" = "yes"; then
2082         CXX="$CXX -Kthread"
2083     fi
2084     AC_DEFINE(WITH_THREAD)
2085     posix_threads=yes
2086     THREADOBJ="Python/thread.o"
2087 elif test "$ac_cv_pthread" = "yes"
2088 then
2089     CC="$CC -pthread"
2090     if test "$ac_cv_cxx_thread" = "yes"; then
2091         CXX="$CXX -pthread"
2092     fi
2093     AC_DEFINE(WITH_THREAD)
2094     posix_threads=yes
2095     THREADOBJ="Python/thread.o"
2096 else
2097     if test ! -z "$with_threads" -a -d "$with_threads"
2098     then LDFLAGS="$LDFLAGS -L$with_threads"
2099     fi
2100     if test ! -z "$withval" -a -d "$withval"
2101     then LDFLAGS="$LDFLAGS -L$withval"
2102     fi
2104     # According to the POSIX spec, a pthreads implementation must
2105     # define _POSIX_THREADS in unistd.h. Some apparently don't
2106     # (e.g. gnu pth with pthread emulation)
2107     AC_MSG_CHECKING(for _POSIX_THREADS in unistd.h)
2108     AC_EGREP_CPP(yes,
2109     [
2110 #include <unistd.h>
2111 #ifdef _POSIX_THREADS
2113 #endif
2114     ], unistd_defines_pthreads=yes, unistd_defines_pthreads=no)
2115     AC_MSG_RESULT($unistd_defines_pthreads)
2117     AC_DEFINE(_REENTRANT)
2118     AC_CHECK_HEADER(cthreads.h, [AC_DEFINE(WITH_THREAD)
2119     AC_DEFINE(C_THREADS)
2120     AC_DEFINE(HURD_C_THREADS, 1,
2121     [Define if you are using Mach cthreads directly under /include])
2122     LIBS="$LIBS -lthreads"
2123     THREADOBJ="Python/thread.o"],[
2124     AC_CHECK_HEADER(mach/cthreads.h, [AC_DEFINE(WITH_THREAD)
2125     AC_DEFINE(C_THREADS)
2126     AC_DEFINE(MACH_C_THREADS, 1,
2127     [Define if you are using Mach cthreads under mach /])
2128     THREADOBJ="Python/thread.o"],[
2129     AC_MSG_CHECKING(for --with-pth)
2130     AC_ARG_WITH([pth],
2131                 AC_HELP_STRING(--with-pth, use GNU pth threading libraries),
2132                 [AC_MSG_RESULT($withval)
2133                   AC_DEFINE([WITH_THREAD])
2134                   AC_DEFINE([HAVE_PTH], 1,
2135                             [Define if you have GNU PTH threads.])
2136                   LIBS="-lpth $LIBS"
2137                   THREADOBJ="Python/thread.o"],
2138                 [AC_MSG_RESULT(no)
2140     # Just looking for pthread_create in libpthread is not enough:
2141     # on HP/UX, pthread.h renames pthread_create to a different symbol name.
2142     # So we really have to include pthread.h, and then link.
2143     _libs=$LIBS
2144     LIBS="$LIBS -lpthread"
2145     AC_MSG_CHECKING([for pthread_create in -lpthread])
2146     AC_TRY_LINK([#include <pthread.h>
2148 void * start_routine (void *arg) { exit (0); }], [
2149 pthread_create (NULL, NULL, start_routine, NULL)], [
2150     AC_MSG_RESULT(yes)
2151     AC_DEFINE(WITH_THREAD)
2152     posix_threads=yes
2153     THREADOBJ="Python/thread.o"],[
2154     LIBS=$_libs
2155     AC_CHECK_FUNC(pthread_detach, [AC_DEFINE(WITH_THREAD)
2156     posix_threads=yes
2157     THREADOBJ="Python/thread.o"],[
2158     AC_CHECK_HEADER(atheos/threads.h, [AC_DEFINE(WITH_THREAD)
2159     AC_DEFINE(ATHEOS_THREADS, 1,
2160     [Define this if you have AtheOS threads.])
2161     THREADOBJ="Python/thread.o"],[
2162     AC_CHECK_HEADER(kernel/OS.h, [AC_DEFINE(WITH_THREAD)
2163     AC_DEFINE(BEOS_THREADS, 1,
2164     [Define this if you have BeOS threads.])
2165     THREADOBJ="Python/thread.o"],[
2166     AC_CHECK_LIB(pthreads, pthread_create, [AC_DEFINE(WITH_THREAD)
2167     posix_threads=yes
2168     LIBS="$LIBS -lpthreads"
2169     THREADOBJ="Python/thread.o"], [
2170     AC_CHECK_LIB(c_r, pthread_create, [AC_DEFINE(WITH_THREAD)
2171     posix_threads=yes
2172     LIBS="$LIBS -lc_r"
2173     THREADOBJ="Python/thread.o"], [
2174     AC_CHECK_LIB(pthread, __pthread_create_system, [AC_DEFINE(WITH_THREAD)
2175     posix_threads=yes
2176     LIBS="$LIBS -lpthread"
2177     THREADOBJ="Python/thread.o"], [
2178     AC_CHECK_LIB(cma, pthread_create, [AC_DEFINE(WITH_THREAD)
2179     posix_threads=yes
2180     LIBS="$LIBS -lcma"
2181     THREADOBJ="Python/thread.o"],[
2182     USE_THREAD_MODULE="#"])
2183     ])])])])])])])])])])
2185     AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD)
2186     LIBS="$LIBS -lmpc"
2187     THREADOBJ="Python/thread.o"
2188     USE_THREAD_MODULE=""])
2190     if test "$posix_threads" != "yes"; then     
2191       AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD)
2192       LIBS="$LIBS -lthread"
2193       THREADOBJ="Python/thread.o"
2194       USE_THREAD_MODULE=""])
2195     fi
2197     if test "$USE_THREAD_MODULE" != "#"
2198     then
2199         # If the above checks didn't disable threads, (at least) OSF1
2200         # needs this '-threads' argument during linking.
2201         case $ac_sys_system in
2202         OSF1) LDLAST=-threads;;
2203         esac
2204     fi
2207 if test "$posix_threads" = "yes"; then
2208       if test "$unistd_defines_pthreads" = "no"; then
2209          AC_DEFINE(_POSIX_THREADS, 1,
2210          [Define if you have POSIX threads, 
2211           and your system does not define that.])
2212       fi
2214       # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8.
2215       case  $ac_sys_system/$ac_sys_release in
2216   SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1,
2217                        Defined for Solaris 2.6 bug in pthread header.)
2218                        ;;
2219       SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2220                        Define if the Posix semaphores do not work on your system)
2221                        ;;
2222       AIX/5) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1,
2223                        Define if the Posix semaphores do not work on your system)
2224                        ;;
2225       esac
2227       AC_MSG_CHECKING(if PTHREAD_SCOPE_SYSTEM is supported)
2228       AC_CACHE_VAL(ac_cv_pthread_system_supported,
2229       [AC_TRY_RUN([#include <pthread.h>
2230       void *foo(void *parm) {
2231         return NULL;
2232       }
2233       main() {
2234         pthread_attr_t attr;
2235         pthread_t id;
2236         if (pthread_attr_init(&attr)) exit(-1);
2237         if (pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM)) exit(-1);
2238         if (pthread_create(&id, &attr, foo, NULL)) exit(-1);
2239         exit(0);
2240       }],
2241       ac_cv_pthread_system_supported=yes,
2242       ac_cv_pthread_system_supported=no,
2243       ac_cv_pthread_system_supported=no)
2244       ])
2245       AC_MSG_RESULT($ac_cv_pthread_system_supported)
2246       if test "$ac_cv_pthread_system_supported" = "yes"; then
2247         AC_DEFINE(PTHREAD_SYSTEM_SCHED_SUPPORTED, 1, [Defined if PTHREAD_SCOPE_SYSTEM supported.])
2248       fi
2249       AC_CHECK_FUNCS(pthread_sigmask,
2250         [case $ac_sys_system in
2251         CYGWIN*)
2252           AC_DEFINE(HAVE_BROKEN_PTHREAD_SIGMASK, 1,
2253             [Define if pthread_sigmask() does not work on your system.])
2254             ;;
2255         esac])
2259 # Check for enable-ipv6
2260 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
2261 AC_MSG_CHECKING([if --enable-ipv6 is specified])
2262 AC_ARG_ENABLE(ipv6,
2263 [  --enable-ipv6           Enable ipv6 (with ipv4) support
2264   --disable-ipv6          Disable ipv6 support],
2265 [ case "$enableval" in
2266   no)
2267        AC_MSG_RESULT(no)
2268        ipv6=no
2269        ;;
2270   *)   AC_MSG_RESULT(yes)
2271        AC_DEFINE(ENABLE_IPV6)
2272        ipv6=yes
2273        ;;
2274   esac ],
2277 dnl the check does not work on cross compilation case...
2278   AC_TRY_RUN([ /* AF_INET6 available check */
2279 #include <sys/types.h>
2280 #include <sys/socket.h>
2281 main()
2283  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
2284    exit(1);
2285  else
2286    exit(0);
2289   AC_MSG_RESULT(yes)
2290   ipv6=yes,
2291   AC_MSG_RESULT(no)
2292   ipv6=no,
2293   AC_MSG_RESULT(no)
2294   ipv6=no
2297 if test "$ipv6" = "yes"; then
2298         AC_MSG_CHECKING(if RFC2553 API is available)
2299         AC_TRY_COMPILE([#include <sys/types.h>
2300 #include <netinet/in.h>],
2301         [struct sockaddr_in6 x;
2302 x.sin6_scope_id;],
2303                 AC_MSG_RESULT(yes)
2304                 ipv6=yes,
2305                 AC_MSG_RESULT(no, IPv6 disabled)
2306                 ipv6=no)
2309 if test "$ipv6" = "yes"; then
2310         AC_DEFINE(ENABLE_IPV6)
2314 ipv6type=unknown
2315 ipv6lib=none
2316 ipv6trylibc=no
2318 if test "$ipv6" = "yes"; then
2319         AC_MSG_CHECKING([ipv6 stack type])
2320         for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta;
2321         do
2322                 case $i in
2323                 inria)
2324                         dnl http://www.kame.net/
2325                         AC_EGREP_CPP(yes, [
2326 #include <netinet/in.h>
2327 #ifdef IPV6_INRIA_VERSION
2329 #endif],
2330                                 [ipv6type=$i])
2331                         ;;
2332                 kame)
2333                         dnl http://www.kame.net/
2334                         AC_EGREP_CPP(yes, [
2335 #include <netinet/in.h>
2336 #ifdef __KAME__
2338 #endif],
2339                                 [ipv6type=$i;
2340                                 ipv6lib=inet6
2341                                 ipv6libdir=/usr/local/v6/lib
2342                                 ipv6trylibc=yes])
2343                         ;;
2344                 linux-glibc)
2345                         dnl http://www.v6.linux.or.jp/
2346                         AC_EGREP_CPP(yes, [
2347 #include <features.h>
2348 #if defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2))
2350 #endif],
2351                                 [ipv6type=$i;
2352                                 ipv6trylibc=yes])
2353                         ;;
2354                 linux-inet6)
2355                         dnl http://www.v6.linux.or.jp/
2356                         if test -d /usr/inet6; then
2357                                 ipv6type=$i
2358                                 ipv6lib=inet6
2359                                 ipv6libdir=/usr/inet6/lib
2360                                 BASECFLAGS="-I/usr/inet6/include $BASECFLAGS"
2361                         fi
2362                         ;;
2363                 solaris)
2364                         if test -f /etc/netconfig; then
2365                           if /usr/xpg4/bin/grep -q tcp6 /etc/netconfig; then
2366                                 ipv6type=$i
2367                                 ipv6trylibc=yes
2368                           fi
2369                         fi
2370                         ;;
2371                 toshiba)
2372                         AC_EGREP_CPP(yes, [
2373 #include <sys/param.h>
2374 #ifdef _TOSHIBA_INET6
2376 #endif],
2377                                 [ipv6type=$i;
2378                                 ipv6lib=inet6;
2379                                 ipv6libdir=/usr/local/v6/lib])
2380                         ;;
2381                 v6d)
2382                         AC_EGREP_CPP(yes, [
2383 #include </usr/local/v6/include/sys/v6config.h>
2384 #ifdef __V6D__
2386 #endif],
2387                                 [ipv6type=$i;
2388                                 ipv6lib=v6;
2389                                 ipv6libdir=/usr/local/v6/lib;
2390                                 BASECFLAGS="-I/usr/local/v6/include $BASECFLAGS"])
2391                         ;;
2392                 zeta)
2393                         AC_EGREP_CPP(yes, [
2394 #include <sys/param.h>
2395 #ifdef _ZETA_MINAMI_INET6
2397 #endif],
2398                                 [ipv6type=$i;
2399                                 ipv6lib=inet6;
2400                                 ipv6libdir=/usr/local/v6/lib])
2401                         ;;
2402                 esac
2403                 if test "$ipv6type" != "unknown"; then
2404                         break
2405                 fi
2406         done
2407         AC_MSG_RESULT($ipv6type)
2410 if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
2411         if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
2412                 LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
2413                 echo "using lib$ipv6lib"
2414         else
2415                 if test $ipv6trylibc = "yes"; then
2416                         echo "using libc"
2417                 else
2418                         echo 'Fatal: no $ipv6lib library found.  cannot continue.'
2419                         echo "You need to fetch lib$ipv6lib.a from appropriate"
2420                         echo 'ipv6 kit and compile beforehand.'
2421                         exit 1
2422                 fi
2423         fi
2426 AC_MSG_CHECKING(for OSX 10.5 SDK or later)
2427 AC_TRY_COMPILE([#include <Carbon/Carbon.h>], FSIORefNum fRef = 0,
2428   AC_DEFINE(HAVE_OSX105_SDK, 1, Define if compiling using MacOS X 10.5 SDK or later.)
2429   AC_MSG_RESULT(yes),
2430   AC_MSG_RESULT(no)
2433 # Check for --with-doc-strings
2434 AC_MSG_CHECKING(for --with-doc-strings)
2435 AC_ARG_WITH(doc-strings,
2436             AC_HELP_STRING(--with(out)-doc-strings, disable/enable documentation strings))
2438 if test -z "$with_doc_strings"
2439 then with_doc_strings="yes"
2441 if test "$with_doc_strings" != "no"
2442 then
2443     AC_DEFINE(WITH_DOC_STRINGS, 1,
2444       [Define if you want documentation strings in extension modules])
2446 AC_MSG_RESULT($with_doc_strings)
2448 # Check for Python-specific malloc support
2449 AC_MSG_CHECKING(for --with-tsc)
2450 AC_ARG_WITH(tsc,
2451 [  --with(out)-tsc         enable/disable timestamp counter profile], [
2452 if test "$withval" != no
2453 then 
2454   AC_DEFINE(WITH_TSC, 1, 
2455     [Define to profile with the Pentium timestamp counter]) 
2456     AC_MSG_RESULT(yes)
2457 else AC_MSG_RESULT(no)
2458 fi],
2459 [AC_MSG_RESULT(no)])
2461 # Check for Python-specific malloc support
2462 AC_MSG_CHECKING(for --with-pymalloc)
2463 AC_ARG_WITH(pymalloc,
2464             AC_HELP_STRING(--with(out)-pymalloc, disable/enable specialized mallocs))
2466 if test -z "$with_pymalloc"
2467 then with_pymalloc="yes"
2469 if test "$with_pymalloc" != "no"
2470 then
2471     AC_DEFINE(WITH_PYMALLOC, 1, 
2472      [Define if you want to compile in Python-specific mallocs])
2474 AC_MSG_RESULT($with_pymalloc)
2476 # Check for --with-wctype-functions
2477 AC_MSG_CHECKING(for --with-wctype-functions)
2478 AC_ARG_WITH(wctype-functions, 
2479             AC_HELP_STRING(--with-wctype-functions, use wctype.h functions),
2481 if test "$withval" != no
2482 then 
2483   AC_DEFINE(WANT_WCTYPE_FUNCTIONS, 1,
2484   [Define if you want wctype.h functions to be used instead of the
2485    one supplied by Python itself. (see Include/unicodectype.h).]) 
2486   AC_MSG_RESULT(yes)
2487 else AC_MSG_RESULT(no)
2488 fi],
2489 [AC_MSG_RESULT(no)])
2491 # -I${DLINCLDIR} is added to the compile rule for importdl.o
2492 AC_SUBST(DLINCLDIR)
2493 DLINCLDIR=.
2495 # the dlopen() function means we might want to use dynload_shlib.o. some
2496 # platforms, such as AIX, have dlopen(), but don't want to use it.
2497 AC_CHECK_FUNCS(dlopen)
2499 # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic
2500 # loading of modules.
2501 AC_SUBST(DYNLOADFILE)
2502 AC_MSG_CHECKING(DYNLOADFILE)
2503 if test -z "$DYNLOADFILE"
2504 then
2505         case $ac_sys_system/$ac_sys_release in
2506         AIX*) # Use dynload_shlib.c and dlopen() if we have it; otherwise dynload_aix.c
2507         if test "$ac_cv_func_dlopen" = yes
2508         then DYNLOADFILE="dynload_shlib.o"
2509         else DYNLOADFILE="dynload_aix.o"
2510         fi
2511         ;;
2512         BeOS*) DYNLOADFILE="dynload_beos.o";;
2513         hp*|HP*) DYNLOADFILE="dynload_hpux.o";;
2514         # Use dynload_next.c only on 10.2 and below, which don't have native dlopen()
2515         Darwin/@<:@0156@:>@\..*) DYNLOADFILE="dynload_next.o";;
2516         atheos*) DYNLOADFILE="dynload_atheos.o";;
2517         *)
2518         # use dynload_shlib.c and dlopen() if we have it; otherwise stub
2519         # out any dynamic loading
2520         if test "$ac_cv_func_dlopen" = yes
2521         then DYNLOADFILE="dynload_shlib.o"
2522         else DYNLOADFILE="dynload_stub.o"
2523         fi
2524         ;;
2525         esac
2527 AC_MSG_RESULT($DYNLOADFILE)
2528 if test "$DYNLOADFILE" != "dynload_stub.o"
2529 then
2530         AC_DEFINE(HAVE_DYNAMIC_LOADING, 1,
2531         [Defined when any dynamic module loading is enabled.])
2534 # MACHDEP_OBJS can be set to platform-specific object files needed by Python
2536 AC_SUBST(MACHDEP_OBJS)
2537 AC_MSG_CHECKING(MACHDEP_OBJS)
2538 if test -z "$MACHDEP_OBJS"
2539 then
2540         MACHDEP_OBJS=$extra_machdep_objs
2541 else
2542         MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
2544 AC_MSG_RESULT(MACHDEP_OBJS)
2546 # checks for library functions
2547 AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
2548  clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
2549  gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2550  getpriority getpwent getspnam getspent getsid getwd \
2551  kill killpg lchmod lchown lstat mkfifo mknod mktime \
2552  mremap nice pathconf pause plock poll pthread_init \
2553  putenv readlink realpath \
2554  select sem_open sem_timedwait sem_getvalue sem_unlink setegid seteuid \
2555  setgid \
2556  setlocale setregid setreuid setsid setpgid setpgrp setuid setvbuf snprintf \
2557  sigaction siginterrupt sigrelse strftime \
2558  sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
2559  truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty)
2561 # For some functions, having a definition is not sufficient, since
2562 # we want to take their address.
2563 AC_MSG_CHECKING(for chroot)
2564 AC_TRY_COMPILE([#include <unistd.h>], void *x=chroot,
2565   AC_DEFINE(HAVE_CHROOT, 1, Define if you have the 'chroot' function.)
2566   AC_MSG_RESULT(yes),
2567   AC_MSG_RESULT(no)
2569 AC_MSG_CHECKING(for link)
2570 AC_TRY_COMPILE([#include <unistd.h>], void *x=link,
2571   AC_DEFINE(HAVE_LINK, 1, Define if you have the 'link' function.)
2572   AC_MSG_RESULT(yes),
2573   AC_MSG_RESULT(no)
2575 AC_MSG_CHECKING(for symlink)
2576 AC_TRY_COMPILE([#include <unistd.h>], void *x=symlink,
2577   AC_DEFINE(HAVE_SYMLINK, 1, Define if you have the 'symlink' function.)
2578   AC_MSG_RESULT(yes),
2579   AC_MSG_RESULT(no)
2581 AC_MSG_CHECKING(for fchdir)
2582 AC_TRY_COMPILE([#include <unistd.h>], void *x=fchdir,
2583   AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
2584   AC_MSG_RESULT(yes),
2585   AC_MSG_RESULT(no)
2587 AC_MSG_CHECKING(for fsync)
2588 AC_TRY_COMPILE([#include <unistd.h>], void *x=fsync,
2589   AC_DEFINE(HAVE_FSYNC, 1, Define if you have the 'fsync' function.)
2590   AC_MSG_RESULT(yes),
2591   AC_MSG_RESULT(no)
2593 AC_MSG_CHECKING(for fdatasync)
2594 AC_TRY_COMPILE([#include <unistd.h>], void *x=fdatasync,
2595   AC_DEFINE(HAVE_FDATASYNC, 1, Define if you have the 'fdatasync' function.)
2596   AC_MSG_RESULT(yes),
2597   AC_MSG_RESULT(no)
2599 AC_MSG_CHECKING(for epoll)
2600 AC_TRY_COMPILE([#include <sys/epoll.h>], void *x=epoll_create,
2601   AC_DEFINE(HAVE_EPOLL, 1, Define if you have the 'epoll' functions.)
2602   AC_MSG_RESULT(yes),
2603   AC_MSG_RESULT(no)
2605 AC_MSG_CHECKING(for kqueue)
2606 AC_TRY_COMPILE([
2607 #include <sys/types.h>
2608 #include <sys/event.h>
2609     ], int x=kqueue(),
2610   AC_DEFINE(HAVE_KQUEUE, 1, Define if you have the 'kqueue' functions.)
2611   AC_MSG_RESULT(yes),
2612   AC_MSG_RESULT(no)
2614 # On some systems (eg. FreeBSD 5), we would find a definition of the
2615 # functions ctermid_r, setgroups in the library, but no prototype
2616 # (e.g. because we use _XOPEN_SOURCE). See whether we can take their
2617 # address to avoid compiler warnings and potential miscompilations
2618 # because of the missing prototypes.
2620 AC_MSG_CHECKING(for ctermid_r)
2621 AC_TRY_COMPILE([
2622 #include "confdefs.h" 
2623 #include <stdio.h>
2624 ], void* p = ctermid_r,
2625   AC_DEFINE(HAVE_CTERMID_R, 1, Define if you have the 'ctermid_r' function.)
2626   AC_MSG_RESULT(yes),
2627   AC_MSG_RESULT(no)
2630 AC_MSG_CHECKING(for flock)
2631 AC_TRY_COMPILE([
2632 #include "confdefs.h" 
2633 #include <sys/file.h>
2634 ], void* p = flock,
2635   AC_DEFINE(HAVE_FLOCK, 1, Define if you have the 'flock' function.)
2636   AC_MSG_RESULT(yes),
2637   AC_MSG_RESULT(no)
2640 AC_MSG_CHECKING(for getpagesize)
2641 AC_TRY_COMPILE([
2642 #include "confdefs.h" 
2643 #include <unistd.h>
2644 ], void* p = getpagesize,
2645   AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.)
2646   AC_MSG_RESULT(yes),
2647   AC_MSG_RESULT(no)
2650 dnl check for true
2651 AC_CHECK_PROGS(TRUE, true, /bin/true)
2653 dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv
2654 dnl On others, they are in the C library, so we to take no action
2655 AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE],
2656   AC_CHECK_LIB(resolv, inet_aton)
2659 # On Tru64, chflags seems to be present, but calling it will
2660 # exit Python
2661 AC_MSG_CHECKING(for chflags)
2662 AC_CACHE_VAL(ac_cv_have_chflags,
2663 AC_TRY_RUN([[
2664 #include <sys/stat.h>
2665 #include <unistd.h>
2666 int main(int argc, char*argv[])
2668   if(chflags(argv[0], 0) != 0)
2669     return 1;
2670   return 0;
2672 ]], ac_cv_have_chflags=yes,
2673    ac_cv_have_chflags=no,
2674    ac_cv_have_chflags=no)
2676 AC_MSG_RESULT($ac_cv_have_chflags)
2677 if test $ac_cv_have_chflags = yes
2678 then
2679   AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.)
2682 AC_MSG_CHECKING(for lchflags)
2683 AC_CACHE_VAL(ac_cv_have_lchflags,
2684 AC_TRY_RUN([[
2685 #include <sys/stat.h>
2686 #include <unistd.h>
2687 int main(int argc, char*argv[])
2689   if(lchflags(argv[0], 0) != 0)
2690     return 1;
2691   return 0;
2693 ]], ac_cv_have_lchflags=yes,
2694    ac_cv_have_lchflags=no,
2695    ac_cv_have_lchflags=no)
2697 AC_MSG_RESULT($ac_cv_have_lchflags)
2698 if test $ac_cv_have_lchflags = yes
2699 then
2700   AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.)
2703 dnl Check if system zlib has *Copy() functions
2705 dnl On MacOSX the linker will search for dylibs on the entire linker path
2706 dnl before searching for static libraries. setup.py adds -Wl,-search_paths_first
2707 dnl to revert to a more traditional unix behaviour and make it possible to
2708 dnl override the system libz with a local static library of libz. Temporarily
2709 dnl add that flag to our CFLAGS as well to ensure that we check the version
2710 dnl of libz that will be used by setup.py. 
2711 dnl The -L/usr/local/lib is needed as wel to get the same compilation 
2712 dnl environment as setup.py (and leaving it out can cause configure to use the
2713 dnl wrong version of the library)
2714 case $ac_sys_system/$ac_sys_release in
2715 Darwin/*) 
2716         _CUR_CFLAGS="${CFLAGS}"
2717         _CUR_LDFLAGS="${LDFLAGS}"
2718         CFLAGS="${CFLAGS} -Wl,-search_paths_first"
2719         LDFLAGS="${LDFLAGS} -Wl,-search_paths_first -L/usr/local/lib"
2720         ;;
2721 esac
2723 AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_ZLIB_COPY, 1, Define if the zlib library has inflateCopy))
2725 case $ac_sys_system/$ac_sys_release in
2726 Darwin/*) 
2727         CFLAGS="${_CUR_CFLAGS}"
2728         LDFLAGS="${_CUR_LDFLAGS}"
2729         ;;
2730 esac
2732 AC_MSG_CHECKING(for hstrerror)
2733 AC_TRY_LINK([
2734 #include "confdefs.h" 
2735 #include <netdb.h>
2736 ], void* p = hstrerror; hstrerror(0),
2737   AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.)
2738   AC_MSG_RESULT(yes),
2739   AC_MSG_RESULT(no)
2742 AC_MSG_CHECKING(for inet_aton)
2743 AC_TRY_LINK([
2744 #include "confdefs.h" 
2745 #include <sys/types.h>
2746 #include <sys/socket.h>
2747 #include <netinet/in.h>
2748 #include <arpa/inet.h>
2749 ], void* p = inet_aton;inet_aton(0,0),
2750   AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.)
2751   AC_MSG_RESULT(yes),
2752   AC_MSG_RESULT(no)
2755 AC_MSG_CHECKING(for inet_pton)
2756 AC_TRY_COMPILE([
2757 #include "confdefs.h" 
2758 #include <sys/types.h>
2759 #include <sys/socket.h>
2760 #include <netinet/in.h>
2761 #include <arpa/inet.h>
2762 ], void* p = inet_pton,
2763   AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.)
2764   AC_MSG_RESULT(yes),
2765   AC_MSG_RESULT(no)
2768 # On some systems, setgroups is in unistd.h, on others, in grp.h
2769 AC_MSG_CHECKING(for setgroups)
2770 AC_TRY_COMPILE([
2771 #include "confdefs.h" 
2772 #include <unistd.h>
2773 #ifdef HAVE_GRP_H
2774 #include <grp.h>
2775 #endif
2776 ], 
2777 void* p = setgroups,
2778   AC_DEFINE(HAVE_SETGROUPS, 1, Define if you have the 'setgroups' function.)
2779   AC_MSG_RESULT(yes),
2780   AC_MSG_RESULT(no)
2783 # check for openpty and forkpty
2785 AC_CHECK_FUNCS(openpty,, 
2786    AC_CHECK_LIB(util,openpty,
2787      [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lutil"],
2788      AC_CHECK_LIB(bsd,openpty, [AC_DEFINE(HAVE_OPENPTY) LIBS="$LIBS -lbsd"])
2789    )
2791 AC_CHECK_FUNCS(forkpty,, 
2792    AC_CHECK_LIB(util,forkpty, 
2793      [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"],
2794      AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"])
2795    )
2798 # Stuff for expat.
2799 AC_CHECK_FUNCS(memmove)
2801 # check for long file support functions
2802 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
2804 AC_REPLACE_FUNCS(dup2 getcwd strdup)
2805 AC_CHECK_FUNCS(getpgrp, 
2806   AC_TRY_COMPILE([#include <unistd.h>], 
2807    [getpgrp(0);], 
2808    AC_DEFINE(GETPGRP_HAVE_ARG, 1,
2809    [Define if getpgrp() must be called as getpgrp(0).])
2812 AC_CHECK_FUNCS(setpgrp,
2813   AC_TRY_COMPILE([#include <unistd.h>],
2814     [setpgrp(0,0);],
2815     AC_DEFINE(SETPGRP_HAVE_ARG, 1,
2816     [Define if setpgrp() must be called as setpgrp(0, 0).])
2817   )
2819 AC_CHECK_FUNCS(gettimeofday, 
2820   AC_TRY_COMPILE([#include <sys/time.h>], 
2821     [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,
2822     AC_DEFINE(GETTIMEOFDAY_NO_TZ, 1,
2823     [Define if gettimeofday() does not have second (timezone) argument
2824      This is the case on Motorola V4 (R40V4.2)])
2825   )
2828 AC_MSG_CHECKING(for major, minor, and makedev)
2829 AC_TRY_LINK([
2830 #if defined(MAJOR_IN_MKDEV)
2831 #include <sys/mkdev.h>
2832 #elif defined(MAJOR_IN_SYSMACROS)
2833 #include <sys/sysmacros.h>
2834 #else
2835 #include <sys/types.h>
2836 #endif
2838   makedev(major(0),minor(0));
2840   AC_DEFINE(HAVE_DEVICE_MACROS, 1,
2841             [Define to 1 if you have the device macros.])
2842   AC_MSG_RESULT(yes)
2844   AC_MSG_RESULT(no)
2847 # On OSF/1 V5.1, getaddrinfo is available, but a define
2848 # for [no]getaddrinfo in netdb.h. 
2849 AC_MSG_CHECKING(for getaddrinfo)
2850 AC_TRY_LINK([
2851 #include <sys/types.h>
2852 #include <sys/socket.h>
2853 #include <netdb.h>
2854 #include <stdio.h>
2855 ], [getaddrinfo(NULL, NULL, NULL, NULL);],
2856 have_getaddrinfo=yes,
2857 have_getaddrinfo=no)
2858 AC_MSG_RESULT($have_getaddrinfo)
2859 if test $have_getaddrinfo = yes
2860 then
2861   AC_MSG_CHECKING(getaddrinfo bug)
2862   AC_CACHE_VAL(ac_cv_buggy_getaddrinfo,
2863   AC_TRY_RUN([[
2864 #include <sys/types.h>
2865 #include <netdb.h>
2866 #include <string.h>
2867 #include <sys/socket.h>
2868 #include <netinet/in.h>
2870 int main()
2872   int passive, gaierr, inet4 = 0, inet6 = 0;
2873   struct addrinfo hints, *ai, *aitop;
2874   char straddr[INET6_ADDRSTRLEN], strport[16];
2876   for (passive = 0; passive <= 1; passive++) {
2877     memset(&hints, 0, sizeof(hints));
2878     hints.ai_family = AF_UNSPEC;
2879     hints.ai_flags = passive ? AI_PASSIVE : 0;
2880     hints.ai_socktype = SOCK_STREAM;
2881     hints.ai_protocol = IPPROTO_TCP;
2882     if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
2883       (void)gai_strerror(gaierr);
2884       goto bad;
2885     }
2886     for (ai = aitop; ai; ai = ai->ai_next) {
2887       if (ai->ai_addr == NULL ||
2888           ai->ai_addrlen == 0 ||
2889           getnameinfo(ai->ai_addr, ai->ai_addrlen,
2890                       straddr, sizeof(straddr), strport, sizeof(strport),
2891                       NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
2892         goto bad;
2893       }
2894       switch (ai->ai_family) {
2895       case AF_INET:
2896         if (strcmp(strport, "54321") != 0) {
2897           goto bad;
2898         }
2899         if (passive) {
2900           if (strcmp(straddr, "0.0.0.0") != 0) {
2901             goto bad;
2902           }
2903         } else {
2904           if (strcmp(straddr, "127.0.0.1") != 0) {
2905             goto bad;
2906           }
2907         }
2908         inet4++;
2909         break;
2910       case AF_INET6:
2911         if (strcmp(strport, "54321") != 0) {
2912           goto bad;
2913         }
2914         if (passive) {
2915           if (strcmp(straddr, "::") != 0) {
2916             goto bad;
2917           }
2918         } else {
2919           if (strcmp(straddr, "::1") != 0) {
2920             goto bad;
2921           }
2922         }
2923         inet6++;
2924         break;
2925       case AF_UNSPEC:
2926         goto bad;
2927         break;
2928       default:
2929         /* another family support? */
2930         break;
2931       }
2932     }
2933   }
2935   if (!(inet4 == 0 || inet4 == 2))
2936     goto bad;
2937   if (!(inet6 == 0 || inet6 == 2))
2938     goto bad;
2940   if (aitop)
2941     freeaddrinfo(aitop);
2942   return 0;
2944  bad:
2945   if (aitop)
2946     freeaddrinfo(aitop);
2947   return 1;
2949 ]], ac_cv_buggy_getaddrinfo=no,
2950     ac_cv_buggy_getaddrinfo=yes,
2951     ac_cv_buggy_getaddrinfo=yes))
2954 if test $have_getaddrinfo = no -o $ac_cv_buggy_getaddrinfo = yes
2955 then
2956         if test $ipv6 = yes
2957         then
2958                 echo 'Fatal: You must get working getaddrinfo() function.'
2959                 echo '       or you can specify "--disable-ipv6"'.
2960                 exit 1
2961         fi
2962 else
2963         AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if you have the getaddrinfo function.])
2965 AC_CHECK_FUNCS(getnameinfo)
2967 # checks for structures
2968 AC_HEADER_TIME
2969 AC_STRUCT_TM
2970 AC_STRUCT_TIMEZONE
2971 AC_CHECK_MEMBERS([struct stat.st_rdev])
2972 AC_CHECK_MEMBERS([struct stat.st_blksize])
2973 AC_CHECK_MEMBERS([struct stat.st_flags])
2974 AC_CHECK_MEMBERS([struct stat.st_gen])
2975 AC_CHECK_MEMBERS([struct stat.st_birthtime])
2976 AC_STRUCT_ST_BLOCKS
2978 AC_MSG_CHECKING(for time.h that defines altzone)
2979 AC_CACHE_VAL(ac_cv_header_time_altzone,
2980 [AC_TRY_COMPILE([#include <time.h>], [return altzone;],
2981   ac_cv_header_time_altzone=yes,
2982   ac_cv_header_time_altzone=no)])
2983 AC_MSG_RESULT($ac_cv_header_time_altzone)
2984 if test $ac_cv_header_time_altzone = yes; then
2985   AC_DEFINE(HAVE_ALTZONE, 1, [Define this if your time.h defines altzone.])
2988 was_it_defined=no
2989 AC_MSG_CHECKING(whether sys/select.h and sys/time.h may both be included)
2990 AC_TRY_COMPILE([
2991 #include <sys/types.h>
2992 #include <sys/select.h>
2993 #include <sys/time.h>
2994 ], [;], [
2995   AC_DEFINE(SYS_SELECT_WITH_SYS_TIME, 1,
2996   [Define if  you can safely include both <sys/select.h> and <sys/time.h>
2997    (which you can't on SCO ODT 3.0).]) 
2998   was_it_defined=yes
3000 AC_MSG_RESULT($was_it_defined)
3002 AC_MSG_CHECKING(for addrinfo)
3003 AC_CACHE_VAL(ac_cv_struct_addrinfo,
3004 AC_TRY_COMPILE([
3005 #               include <netdb.h>],
3006         [struct addrinfo a],
3007         ac_cv_struct_addrinfo=yes,
3008         ac_cv_struct_addrinfo=no))
3009 AC_MSG_RESULT($ac_cv_struct_addrinfo)
3010 if test $ac_cv_struct_addrinfo = yes; then
3011         AC_DEFINE(HAVE_ADDRINFO, 1, [struct addrinfo (netdb.h)])
3014 AC_MSG_CHECKING(for sockaddr_storage)
3015 AC_CACHE_VAL(ac_cv_struct_sockaddr_storage,
3016 AC_TRY_COMPILE([
3017 #               include <sys/types.h>
3018 #               include <sys/socket.h>],
3019         [struct sockaddr_storage s],
3020         ac_cv_struct_sockaddr_storage=yes,
3021         ac_cv_struct_sockaddr_storage=no))
3022 AC_MSG_RESULT($ac_cv_struct_sockaddr_storage)
3023 if test $ac_cv_struct_sockaddr_storage = yes; then
3024         AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [struct sockaddr_storage (sys/socket.h)])
3027 # checks for compiler characteristics
3029 AC_C_CHAR_UNSIGNED
3030 AC_C_CONST
3032 works=no
3033 AC_MSG_CHECKING(for working volatile)
3034 AC_TRY_COMPILE([],[volatile int x; x = 0;], works=yes, 
3035   AC_DEFINE(volatile, [], [Define to empty if the keyword does not work.])
3037 AC_MSG_RESULT($works)
3039 works=no
3040 AC_MSG_CHECKING(for working signed char)
3041 AC_TRY_COMPILE([], [signed char c;], works=yes, 
3042   AC_DEFINE(signed, [], [Define to empty if the keyword does not work.])
3044 AC_MSG_RESULT($works)
3046 have_prototypes=no
3047 AC_MSG_CHECKING(for prototypes)
3048 AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],[
3049   AC_DEFINE(HAVE_PROTOTYPES, 1, 
3050    [Define if your compiler supports function prototype]) 
3051   have_prototypes=yes
3053 AC_MSG_RESULT($have_prototypes)
3055 works=no
3056 AC_MSG_CHECKING(for variable length prototypes and stdarg.h)
3057 AC_TRY_COMPILE([
3058 #include <stdarg.h>
3059 int foo(int x, ...) {
3060         va_list va;
3061         va_start(va, x);
3062         va_arg(va, int);
3063         va_arg(va, char *);
3064         va_arg(va, double);
3065         return 0;
3067 ], [return foo(10, "", 3.14);], [
3068   AC_DEFINE(HAVE_STDARG_PROTOTYPES, 1,
3069    [Define if your compiler supports variable length function prototypes
3070    (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h>]) 
3071   works=yes
3073 AC_MSG_RESULT($works)
3075 # check for socketpair
3076 AC_MSG_CHECKING(for socketpair)
3077 AC_TRY_COMPILE([
3078 #include <sys/types.h>
3079 #include <sys/socket.h>
3080 ], void *x=socketpair,
3081   AC_DEFINE(HAVE_SOCKETPAIR, 1, Define if you have the 'socketpair' function.)
3082   AC_MSG_RESULT(yes),
3083   AC_MSG_RESULT(no)
3086 # check if sockaddr has sa_len member
3087 AC_MSG_CHECKING(if sockaddr has sa_len member)
3088 AC_TRY_COMPILE([#include <sys/types.h>
3089 #include <sys/socket.h>],
3090 [struct sockaddr x;
3091 x.sa_len = 0;],
3092         AC_MSG_RESULT(yes)
3093         AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, [Define if sockaddr has sa_len member]),
3094         AC_MSG_RESULT(no))
3096 va_list_is_array=no
3097 AC_MSG_CHECKING(whether va_list is an array)
3098 AC_TRY_COMPILE([
3099 #ifdef HAVE_STDARG_PROTOTYPES
3100 #include <stdarg.h>
3101 #else
3102 #include <varargs.h>
3103 #endif
3104 ], [va_list list1, list2; list1 = list2;], , [
3105  AC_DEFINE(VA_LIST_IS_ARRAY, 1, [Define if a va_list is an array of some kind]) 
3106  va_list_is_array=yes
3108 AC_MSG_RESULT($va_list_is_array)
3110 # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-(
3111 AH_TEMPLATE(HAVE_GETHOSTBYNAME_R,
3112   [Define this if you have some version of gethostbyname_r()])
3114 AC_CHECK_FUNC(gethostbyname_r, [
3115   AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3116   AC_MSG_CHECKING([gethostbyname_r with 6 args])
3117   OLD_CFLAGS=$CFLAGS
3118   CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS"
3119   AC_TRY_COMPILE([
3120 #   include <netdb.h>
3121   ], [
3122     char *name;
3123     struct hostent *he, *res;
3124     char buffer[2048];
3125     int buflen = 2048;
3126     int h_errnop;
3128     (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
3129   ], [
3130     AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3131     AC_DEFINE(HAVE_GETHOSTBYNAME_R_6_ARG, 1,
3132     [Define this if you have the 6-arg version of gethostbyname_r().])
3133     AC_MSG_RESULT(yes)
3134   ], [
3135     AC_MSG_RESULT(no)
3136     AC_MSG_CHECKING([gethostbyname_r with 5 args])
3137     AC_TRY_COMPILE([
3138 #     include <netdb.h>
3139     ], [
3140       char *name;
3141       struct hostent *he;
3142       char buffer[2048];
3143       int buflen = 2048;
3144       int h_errnop;
3146       (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
3147     ], [
3148       AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3149       AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
3150       [Define this if you have the 5-arg version of gethostbyname_r().])
3151       AC_MSG_RESULT(yes)
3152     ], [
3153       AC_MSG_RESULT(no)
3154       AC_MSG_CHECKING([gethostbyname_r with 3 args])
3155       AC_TRY_COMPILE([
3156 #       include <netdb.h>
3157       ], [
3158         char *name;
3159         struct hostent *he;
3160         struct hostent_data data;
3162         (void) gethostbyname_r(name, he, &data);
3163       ], [
3164         AC_DEFINE(HAVE_GETHOSTBYNAME_R)
3165         AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
3166         [Define this if you have the 3-arg version of gethostbyname_r().])
3167         AC_MSG_RESULT(yes)
3168       ], [
3169         AC_MSG_RESULT(no)
3170       ])
3171     ])
3172   ])
3173   CFLAGS=$OLD_CFLAGS
3174 ], [
3175   AC_CHECK_FUNCS(gethostbyname)
3177 AC_SUBST(HAVE_GETHOSTBYNAME_R_6_ARG)
3178 AC_SUBST(HAVE_GETHOSTBYNAME_R_5_ARG)
3179 AC_SUBST(HAVE_GETHOSTBYNAME_R_3_ARG)
3180 AC_SUBST(HAVE_GETHOSTBYNAME_R)
3181 AC_SUBST(HAVE_GETHOSTBYNAME)
3183 # checks for system services
3184 # (none yet)
3186 # Linux requires this for correct f.p. operations
3187 AC_CHECK_FUNC(__fpu_control,
3188   [],
3189   [AC_CHECK_LIB(ieee, __fpu_control)
3192 # Check for --with-fpectl
3193 AC_MSG_CHECKING(for --with-fpectl)
3194 AC_ARG_WITH(fpectl,
3195             AC_HELP_STRING(--with-fpectl, enable SIGFPE catching),
3197 if test "$withval" != no
3198 then 
3199   AC_DEFINE(WANT_SIGFPE_HANDLER, 1,
3200   [Define if you want SIGFPE handled (see Include/pyfpe.h).]) 
3201   AC_MSG_RESULT(yes)
3202 else AC_MSG_RESULT(no)
3203 fi],
3204 [AC_MSG_RESULT(no)])
3206 # check for --with-libm=...
3207 AC_SUBST(LIBM)
3208 case $ac_sys_system in
3209 Darwin) ;;
3210 BeOS) ;;
3211 *) LIBM=-lm
3212 esac
3213 AC_MSG_CHECKING(for --with-libm=STRING)
3214 AC_ARG_WITH(libm,
3215             AC_HELP_STRING(--with-libm=STRING, math library),
3217 if test "$withval" = no
3218 then LIBM=
3219      AC_MSG_RESULT(force LIBM empty)
3220 elif test "$withval" != yes
3221 then LIBM=$withval
3222      AC_MSG_RESULT(set LIBM="$withval")
3223 else AC_MSG_ERROR([proper usage is --with-libm=STRING])
3224 fi],
3225 [AC_MSG_RESULT(default LIBM="$LIBM")])
3227 # check for --with-libc=...
3228 AC_SUBST(LIBC)
3229 AC_MSG_CHECKING(for --with-libc=STRING)
3230 AC_ARG_WITH(libc,
3231             AC_HELP_STRING(--with-libc=STRING, C library),
3233 if test "$withval" = no
3234 then LIBC=
3235      AC_MSG_RESULT(force LIBC empty)
3236 elif test "$withval" != yes
3237 then LIBC=$withval
3238      AC_MSG_RESULT(set LIBC="$withval")
3239 else AC_MSG_ERROR([proper usage is --with-libc=STRING])
3240 fi],
3241 [AC_MSG_RESULT(default LIBC="$LIBC")])
3243 # **************************************************
3244 # * Check for various properties of floating point *
3245 # **************************************************
3247 AC_MSG_CHECKING(whether C doubles are little-endian IEEE 754 binary64)
3248 AC_CACHE_VAL(ac_cv_little_endian_double, [
3249 AC_TRY_RUN([
3250 #include <string.h>
3251 int main() {
3252     double x = 9006104071832581.0;
3253     if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0)
3254         return 0;
3255     else
3256         return 1;
3259 ac_cv_little_endian_double=yes,
3260 ac_cv_little_endian_double=no,
3261 ac_cv_little_endian_double=no)])
3262 AC_MSG_RESULT($ac_cv_little_endian_double)
3263 if test "$ac_cv_little_endian_double" = yes
3264 then
3265   AC_DEFINE(DOUBLE_IS_LITTLE_ENDIAN_IEEE754, 1,
3266   [Define if C doubles are 64-bit IEEE 754 binary format, stored
3267    with the least significant byte first])
3270 AC_MSG_CHECKING(whether C doubles are big-endian IEEE 754 binary64)
3271 AC_CACHE_VAL(ac_cv_big_endian_double, [
3272 AC_TRY_RUN([
3273 #include <string.h>
3274 int main() {
3275     double x = 9006104071832581.0;
3276     if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0)
3277         return 0;
3278     else
3279         return 1;
3282 ac_cv_big_endian_double=yes,
3283 ac_cv_big_endian_double=no,
3284 ac_cv_big_endian_double=no)])
3285 AC_MSG_RESULT($ac_cv_big_endian_double)
3286 if test "$ac_cv_big_endian_double" = yes
3287 then
3288   AC_DEFINE(DOUBLE_IS_BIG_ENDIAN_IEEE754, 1,
3289   [Define if C doubles are 64-bit IEEE 754 binary format, stored
3290    with the most significant byte first])
3293 # Some ARM platforms use a mixed-endian representation for doubles.
3294 # While Python doesn't currently have full support for these platforms
3295 # (see e.g., issue 1762561), we can at least make sure that float <-> string
3296 # conversions work.
3297 AC_MSG_CHECKING(whether C doubles are ARM mixed-endian IEEE 754 binary64)
3298 AC_CACHE_VAL(ac_cv_mixed_endian_double, [
3299 AC_TRY_RUN([
3300 #include <string.h>
3301 int main() {
3302     double x = 9006104071832581.0;
3303     if (memcmp(&x, "\x01\xff\x3f\x43\x05\x04\x03\x02", 8) == 0)
3304         return 0;
3305     else
3306         return 1;
3309 ac_cv_mixed_endian_double=yes,
3310 ac_cv_mixed_endian_double=no,
3311 ac_cv_mixed_endian_double=no)])
3312 AC_MSG_RESULT($ac_cv_mixed_endian_double)
3313 if test "$ac_cv_mixed_endian_double" = yes
3314 then
3315   AC_DEFINE(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754, 1,
3316   [Define if C doubles are 64-bit IEEE 754 binary format, stored
3317    in ARM mixed-endian order (byte order 45670123)])
3320 # The short float repr introduced in Python 3.1 requires the
3321 # correctly-rounded string <-> double conversion functions from
3322 # Python/dtoa.c, which in turn require that the FPU uses 53-bit
3323 # rounding; this is a problem on x86, where the x87 FPU has a default
3324 # rounding precision of 64 bits.  For gcc/x86, we try to fix this by
3325 # using inline assembler to get and set the x87 FPU control word.
3326 if test "$GCC" = yes && test -n "`$CC -dM -E - </dev/null | grep i386`"
3327 then
3328     # Check that it's okay to use gcc inline assembler to get and set
3329     # x87 control word.  It should be, but you never know...
3330     AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3331     AC_TRY_COMPILE([], [
3332       unsigned short cw;
3333       __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3334       __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3335     ],
3336     [have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3337     AC_MSG_RESULT($have_gcc_asm_for_x87)
3338     if test "$have_gcc_asm_for_x87" = yes
3339     then
3340         AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3341         [Define if we can use gcc inline assembler to get and set x87 control word])
3342     fi
3345 # Detect whether system arithmetic is subject to x87-style double
3346 # rounding issues.  The result of this test has little meaning on non
3347 # IEEE 754 platforms.  On IEEE 754, test should return 1 if rounding
3348 # mode is round-to-nearest and double rounding issues are present, and
3349 # 0 otherwise.  See http://bugs.python.org/issue2937 for more info.
3350 AC_MSG_CHECKING(for x87-style double rounding)
3351 # $BASECFLAGS may affect the result
3352 ac_save_cc="$CC"
3353 CC="$CC $BASECFLAGS"
3354 AC_TRY_RUN([
3355 #include <stdlib.h>
3356 #include <math.h>
3357 int main() {
3358     volatile double x, y, z;
3359     /* 1./(1-2**-53) -> 1+2**-52 (correct), 1.0 (double rounding) */
3360     x = 0.99999999999999989; /* 1-2**-53 */
3361     y = 1./x;
3362     if (y != 1.)
3363         exit(0);
3364     /* 1e16+2.99999 -> 1e16+2. (correct), 1e16+4. (double rounding) */
3365     x = 1e16;
3366     y = 2.99999;
3367     z = x + y;
3368     if (z != 1e16+4.)
3369         exit(0);
3370     /* both tests show evidence of double rounding */
3371     exit(1);
3374 ac_cv_x87_double_rounding=no,
3375 ac_cv_x87_double_rounding=yes,
3376 ac_cv_x87_double_rounding=no)
3377 CC="$ac_save_cc"
3378 AC_MSG_RESULT($ac_cv_x87_double_rounding)
3379 if test "$ac_cv_x87_double_rounding" = yes
3380 then
3381   AC_DEFINE(X87_DOUBLE_ROUNDING, 1,
3382   [Define if arithmetic is subject to x87-style double rounding issue])
3385 # ************************************
3386 # * Check for mathematical functions *
3387 # ************************************
3389 LIBS_SAVE=$LIBS
3390 LIBS="$LIBS $LIBM"
3392 # Multiprocessing check for broken sem_getvalue
3393 AC_MSG_CHECKING(for broken sem_getvalue)
3394 AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
3395 AC_TRY_RUN([
3396 #include <unistd.h>
3397 #include <fcntl.h>
3398 #include <stdio.h>
3399 #include <semaphore.h>
3400 #include <sys/stat.h>
3402 int main(void){
3403   sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
3404   int count;
3405   int res;
3406   if(a==SEM_FAILED){
3407     perror("sem_open");
3408     return 1;
3410   }
3411   res = sem_getvalue(a, &count);
3412   sem_close(a);
3413   return res==-1 ? 1 : 0;
3415 ], ac_cv_broken_sem_getvalue=no,
3416    ac_cv_broken_sem_getvalue=yes,
3417    ac_cv_broken_sem_getvalue=yes)
3419 AC_MSG_RESULT($ac_cv_broken_sem_getvalue)
3420 if test $ac_cv_broken_sem_getvalue = yes
3421 then
3422   AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
3423   [define to 1 if your sem_getvalue is broken.])
3426 # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of
3427 # -0. on some architectures.
3428 AC_MSG_CHECKING(whether tanh preserves the sign of zero)
3429 AC_CACHE_VAL(ac_cv_tanh_preserves_zero_sign, [
3430 AC_TRY_RUN([
3431 #include <math.h>
3432 #include <stdlib.h>
3433 int main() {
3434     /* return 0 if either negative zeros don't exist
3435        on this platform or if negative zeros exist
3436        and tanh(-0.) == -0. */
3437   if (atan2(0., -1.) == atan2(-0., -1.) ||
3438       atan2(tanh(-0.), -1.) == atan2(-0., -1.)) exit(0);
3439   else exit(1);
3442 ac_cv_tanh_preserves_zero_sign=yes,
3443 ac_cv_tanh_preserves_zero_sign=no,
3444 ac_cv_tanh_preserves_zero_sign=no)])
3445 AC_MSG_RESULT($ac_cv_tanh_preserves_zero_sign)
3446 if test "$ac_cv_tanh_preserves_zero_sign" = yes
3447 then
3448   AC_DEFINE(TANH_PRESERVES_ZERO_SIGN, 1,
3449   [Define if tanh(-0.) is -0., or if platform doesn't have signed zeros])
3452 AC_CHECK_FUNCS([acosh asinh atanh copysign erf erfc expm1 finite gamma])
3453 AC_CHECK_FUNCS([hypot lgamma log1p round tgamma])
3454 AC_CHECK_DECLS([isinf, isnan, isfinite], [], [], [[#include <math.h>]])
3456 LIBS=$LIBS_SAVE
3458 # determine what size digit to use for Python's longs
3459 AC_MSG_CHECKING([digit size for Python's longs])
3460 AC_ARG_ENABLE(big-digits,
3461 AC_HELP_STRING([--enable-big-digits@<:@=BITS@:>@],[use big digits for Python longs [[BITS=30]]]),
3462 [case $enable_big_digits in
3463 yes)
3464   enable_big_digits=30 ;;
3466   enable_big_digits=15 ;;
3467 [15|30])
3468   ;;
3470   AC_MSG_ERROR([bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30]) ;;
3471 esac
3472 AC_MSG_RESULT($enable_big_digits)
3473 AC_DEFINE_UNQUOTED(PYLONG_BITS_IN_DIGIT, $enable_big_digits, [Define as the preferred size in bits of long digits])
3475 [AC_MSG_RESULT(no value specified)])
3477 # check for wchar.h
3478 AC_CHECK_HEADER(wchar.h, [
3479   AC_DEFINE(HAVE_WCHAR_H, 1, 
3480   [Define if the compiler provides a wchar.h header file.]) 
3481   wchar_h="yes"
3483 wchar_h="no"
3486 # determine wchar_t size
3487 if test "$wchar_h" = yes
3488 then
3489   AC_CHECK_SIZEOF(wchar_t, 4, [#include <wchar.h>])
3492 AC_MSG_CHECKING(for UCS-4 tcl)
3493 have_ucs4_tcl=no
3494 AC_TRY_COMPILE([
3495 #include <tcl.h>
3496 #if TCL_UTF_MAX != 6
3497 # error "NOT UCS4_TCL"
3498 #endif], [], [
3499   AC_DEFINE(HAVE_UCS4_TCL, 1, [Define this if you have tcl and TCL_UTF_MAX==6])
3500   have_ucs4_tcl=yes
3502 AC_MSG_RESULT($have_ucs4_tcl)
3504 # check whether wchar_t is signed or not
3505 if test "$wchar_h" = yes
3506 then
3507   # check whether wchar_t is signed or not
3508   AC_MSG_CHECKING(whether wchar_t is signed)
3509   AC_CACHE_VAL(ac_cv_wchar_t_signed, [
3510   AC_TRY_RUN([
3511   #include <wchar.h>
3512   int main()
3513   {
3514         /* Success: exit code 0 */
3515         exit((((wchar_t) -1) < ((wchar_t) 0)) ? 0 : 1);
3516   }
3517   ],
3518   ac_cv_wchar_t_signed=yes,
3519   ac_cv_wchar_t_signed=no,
3520   ac_cv_wchar_t_signed=yes)])
3521   AC_MSG_RESULT($ac_cv_wchar_t_signed)
3523   
3524 AC_MSG_CHECKING(what type to use for unicode)
3525 dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
3526 AC_ARG_ENABLE(unicode, 
3527               AC_HELP_STRING(--enable-unicode@<:@=ucs@<:@24@:>@@:>@, Enable Unicode strings (default is yes)),
3528               [],
3529               [enable_unicode=yes])
3531 if test $enable_unicode = yes
3532 then
3533   # Without any arguments, Py_UNICODE defaults to two-byte mode
3534   case "$have_ucs4_tcl" in
3535   yes) enable_unicode="ucs4"
3536        ;;
3537   *)   enable_unicode="ucs2"
3538        ;;
3539   esac
3542 AH_TEMPLATE(Py_UNICODE_SIZE,
3543   [Define as the size of the unicode type.])
3544 case "$enable_unicode" in
3545 ucs2) unicode_size="2"
3546       AC_DEFINE(Py_UNICODE_SIZE,2)
3547       ;;
3548 ucs4) unicode_size="4"
3549       AC_DEFINE(Py_UNICODE_SIZE,4)
3550       ;;
3551 esac
3553 AH_TEMPLATE(PY_UNICODE_TYPE,
3554   [Define as the integral type used for Unicode representation.])
3556 AC_SUBST(UNICODE_OBJS)
3557 if test "$enable_unicode" = "no"
3558 then
3559   UNICODE_OBJS=""
3560   AC_MSG_RESULT(not used)
3561 else
3562   UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o"
3563   AC_DEFINE(Py_USING_UNICODE, 1,
3564   [Define if you want to have a Unicode type.])
3566   # wchar_t is only usable if it maps to an unsigned type
3567   if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \
3568           -a "$ac_cv_wchar_t_signed" = "no"
3569   then
3570     PY_UNICODE_TYPE="wchar_t"
3571     AC_DEFINE(HAVE_USABLE_WCHAR_T, 1,
3572     [Define if you have a useable wchar_t type defined in wchar.h; useable
3573      means wchar_t must be an unsigned type with at least 16 bits. (see
3574      Include/unicodeobject.h).])
3575     AC_DEFINE(PY_UNICODE_TYPE,wchar_t)
3576   elif test "$ac_cv_sizeof_short" = "$unicode_size"
3577   then
3578        PY_UNICODE_TYPE="unsigned short"
3579        AC_DEFINE(PY_UNICODE_TYPE,unsigned short)
3580   elif test "$ac_cv_sizeof_long" = "$unicode_size"
3581   then
3582        PY_UNICODE_TYPE="unsigned long"
3583        AC_DEFINE(PY_UNICODE_TYPE,unsigned long)
3584   else
3585        PY_UNICODE_TYPE="no type found"
3586   fi
3587   AC_MSG_RESULT($PY_UNICODE_TYPE)
3590 # check for endianness
3591 AC_C_BIGENDIAN
3593 # Check whether right shifting a negative integer extends the sign bit
3594 # or fills with zeros (like the Cray J90, according to Tim Peters).
3595 AC_MSG_CHECKING(whether right shift extends the sign bit)
3596 AC_CACHE_VAL(ac_cv_rshift_extends_sign, [
3597 AC_TRY_RUN([
3598 int main()
3600         exit(((-1)>>3 == -1) ? 0 : 1);
3603 ac_cv_rshift_extends_sign=yes,
3604 ac_cv_rshift_extends_sign=no,
3605 ac_cv_rshift_extends_sign=yes)])
3606 AC_MSG_RESULT($ac_cv_rshift_extends_sign)
3607 if test "$ac_cv_rshift_extends_sign" = no
3608 then
3609   AC_DEFINE(SIGNED_RIGHT_SHIFT_ZERO_FILLS, 1,
3610   [Define if i>>j for signed int i does not extend the sign bit
3611    when i < 0])
3614 # check for getc_unlocked and related locking functions
3615 AC_MSG_CHECKING(for getc_unlocked() and friends)
3616 AC_CACHE_VAL(ac_cv_have_getc_unlocked, [
3617 AC_TRY_LINK([#include <stdio.h>],[
3618         FILE *f = fopen("/dev/null", "r");
3619         flockfile(f);
3620         getc_unlocked(f);
3621         funlockfile(f);
3622 ], ac_cv_have_getc_unlocked=yes, ac_cv_have_getc_unlocked=no)])
3623 AC_MSG_RESULT($ac_cv_have_getc_unlocked)
3624 if test "$ac_cv_have_getc_unlocked" = yes
3625 then
3626   AC_DEFINE(HAVE_GETC_UNLOCKED, 1,
3627   [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
3630 # check where readline lives
3631 # save the value of LIBS so we don't actually link Python with readline
3632 LIBS_no_readline=$LIBS
3634 # On some systems we need to link readline to a termcap compatible
3635 # library.  NOTE: Keep the precedence of listed libraries synchronised
3636 # with setup.py.
3637 py_cv_lib_readline=no
3638 AC_MSG_CHECKING([how to link readline libs])
3639 for py_libtermcap in "" ncursesw ncurses curses termcap; do
3640   if test -z "$py_libtermcap"; then
3641     READLINE_LIBS="-lreadline"
3642   else
3643     READLINE_LIBS="-lreadline -l$py_libtermcap"
3644   fi
3645   LIBS="$READLINE_LIBS $LIBS_no_readline"
3646   AC_LINK_IFELSE(
3647     [AC_LANG_CALL([],[readline])],
3648     [py_cv_lib_readline=yes])
3649   if test $py_cv_lib_readline = yes; then
3650     break
3651   fi
3652 done
3653 # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
3654 #AC_SUBST([READLINE_LIBS])
3655 if test $py_cv_lib_readline = no; then
3656   AC_MSG_RESULT([none])
3657 else
3658   AC_MSG_RESULT([$READLINE_LIBS])
3659   AC_DEFINE(HAVE_LIBREADLINE, 1,
3660     [Define if you have the readline library (-lreadline).])
3663 # check for readline 2.1
3664 AC_CHECK_LIB(readline, rl_callback_handler_install,
3665         AC_DEFINE(HAVE_RL_CALLBACK, 1,
3666         [Define if you have readline 2.1]), ,$READLINE_LIBS)
3668 # check for readline 2.2
3669 AC_TRY_CPP([#include <readline/readline.h>],
3670 have_readline=yes, have_readline=no)
3671 if test $have_readline = yes
3672 then
3673   AC_EGREP_HEADER([extern int rl_completion_append_character;],
3674   [readline/readline.h],
3675   AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
3676   [Define if you have readline 2.2]), )
3677   AC_EGREP_HEADER([extern int rl_completion_suppress_append;],
3678   [readline/readline.h],
3679   AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_APPEND, 1,
3680   [Define if you have rl_completion_suppress_append]), )
3683 # check for readline 4.0
3684 AC_CHECK_LIB(readline, rl_pre_input_hook,
3685         AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
3686         [Define if you have readline 4.0]), ,$READLINE_LIBS)
3688 # also in 4.0
3689 AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
3690         AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
3691         [Define if you have readline 4.0]), ,$READLINE_LIBS)
3693 # check for readline 4.2
3694 AC_CHECK_LIB(readline, rl_completion_matches,
3695         AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
3696         [Define if you have readline 4.2]), ,$READLINE_LIBS)
3698 # also in readline 4.2
3699 AC_TRY_CPP([#include <readline/readline.h>],
3700 have_readline=yes, have_readline=no)
3701 if test $have_readline = yes
3702 then
3703   AC_EGREP_HEADER([extern int rl_catch_signals;],
3704   [readline/readline.h],
3705   AC_DEFINE(HAVE_RL_CATCH_SIGNAL, 1,
3706   [Define if you can turn off readline's signal handling.]), )
3709 # End of readline checks: restore LIBS
3710 LIBS=$LIBS_no_readline
3712 AC_MSG_CHECKING(for broken nice())
3713 AC_CACHE_VAL(ac_cv_broken_nice, [
3714 AC_TRY_RUN([
3715 int main()
3717         int val1 = nice(1);
3718         if (val1 != -1 && val1 == nice(2))
3719                 exit(0);
3720         exit(1);
3723 ac_cv_broken_nice=yes,
3724 ac_cv_broken_nice=no,
3725 ac_cv_broken_nice=no)])
3726 AC_MSG_RESULT($ac_cv_broken_nice)
3727 if test "$ac_cv_broken_nice" = yes
3728 then
3729   AC_DEFINE(HAVE_BROKEN_NICE, 1,
3730   [Define if nice() returns success/failure instead of the new priority.])
3733 AC_MSG_CHECKING(for broken poll())
3734 AC_CACHE_VAL(ac_cv_broken_poll,
3735 AC_TRY_RUN([
3736 #include <poll.h>
3738 int main()
3740     struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };
3741     int poll_test;
3743     close (42);
3745     poll_test = poll(&poll_struct, 1, 0);
3746     if (poll_test < 0)
3747         return 0;
3748     else if (poll_test == 0 && poll_struct.revents != POLLNVAL)
3749         return 0;
3750     else
3751         return 1;
3754 ac_cv_broken_poll=yes,
3755 ac_cv_broken_poll=no,
3756 ac_cv_broken_poll=no))
3757 AC_MSG_RESULT($ac_cv_broken_poll)
3758 if test "$ac_cv_broken_poll" = yes
3759 then
3760   AC_DEFINE(HAVE_BROKEN_POLL, 1,
3761       [Define if poll() sets errno on invalid file descriptors.])
3764 # Before we can test tzset, we need to check if struct tm has a tm_zone 
3765 # (which is not required by ISO C or UNIX spec) and/or if we support
3766 # tzname[]
3767 AC_STRUCT_TIMEZONE
3769 # check tzset(3) exists and works like we expect it to
3770 AC_MSG_CHECKING(for working tzset())
3771 AC_CACHE_VAL(ac_cv_working_tzset, [
3772 AC_TRY_RUN([
3773 #include <stdlib.h>
3774 #include <time.h>
3775 #include <string.h>
3777 #if HAVE_TZNAME
3778 extern char *tzname[];
3779 #endif
3781 int main()
3783         /* Note that we need to ensure that not only does tzset(3)
3784            do 'something' with localtime, but it works as documented
3785            in the library reference and as expected by the test suite.
3786            This includes making sure that tzname is set properly if
3787            tm->tm_zone does not exist since it is the alternative way
3788            of getting timezone info.
3790            Red Hat 6.2 doesn't understand the southern hemisphere 
3791            after New Year's Day.
3792         */
3794         time_t groundhogday = 1044144000; /* GMT-based */
3795         time_t midyear = groundhogday + (365 * 24 * 3600 / 2);
3797         putenv("TZ=UTC+0");
3798         tzset();
3799         if (localtime(&groundhogday)->tm_hour != 0)
3800             exit(1);
3801 #if HAVE_TZNAME
3802         /* For UTC, tzname[1] is sometimes "", sometimes "   " */
3803         if (strcmp(tzname[0], "UTC") || 
3804                 (tzname[1][0] != 0 && tzname[1][0] != ' '))
3805             exit(1);
3806 #endif
3808         putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
3809         tzset();
3810         if (localtime(&groundhogday)->tm_hour != 19)
3811             exit(1);
3812 #if HAVE_TZNAME
3813         if (strcmp(tzname[0], "EST") || strcmp(tzname[1], "EDT"))
3814             exit(1);
3815 #endif
3817         putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
3818         tzset();
3819         if (localtime(&groundhogday)->tm_hour != 11)
3820             exit(1);
3821 #if HAVE_TZNAME
3822         if (strcmp(tzname[0], "AEST") || strcmp(tzname[1], "AEDT"))
3823             exit(1);
3824 #endif
3826 #if HAVE_STRUCT_TM_TM_ZONE
3827         if (strcmp(localtime(&groundhogday)->tm_zone, "AEDT"))
3828             exit(1);
3829         if (strcmp(localtime(&midyear)->tm_zone, "AEST"))
3830             exit(1);
3831 #endif
3833         exit(0);
3836 ac_cv_working_tzset=yes,
3837 ac_cv_working_tzset=no,
3838 ac_cv_working_tzset=no)])
3839 AC_MSG_RESULT($ac_cv_working_tzset)
3840 if test "$ac_cv_working_tzset" = yes
3841 then
3842   AC_DEFINE(HAVE_WORKING_TZSET, 1,
3843   [Define if tzset() actually switches the local timezone in a meaningful way.])
3846 # Look for subsecond timestamps in struct stat
3847 AC_MSG_CHECKING(for tv_nsec in struct stat)
3848 AC_CACHE_VAL(ac_cv_stat_tv_nsec,
3849 AC_TRY_COMPILE([#include <sys/stat.h>], [
3850 struct stat st;
3851 st.st_mtim.tv_nsec = 1;
3853 ac_cv_stat_tv_nsec=yes,
3854 ac_cv_stat_tv_nsec=no,
3855 ac_cv_stat_tv_nsec=no))
3856 AC_MSG_RESULT($ac_cv_stat_tv_nsec)
3857 if test "$ac_cv_stat_tv_nsec" = yes
3858 then
3859   AC_DEFINE(HAVE_STAT_TV_NSEC, 1,
3860   [Define if you have struct stat.st_mtim.tv_nsec])
3863 # Look for BSD style subsecond timestamps in struct stat
3864 AC_MSG_CHECKING(for tv_nsec2 in struct stat)
3865 AC_CACHE_VAL(ac_cv_stat_tv_nsec2,
3866 AC_TRY_COMPILE([#include <sys/stat.h>], [
3867 struct stat st;
3868 st.st_mtimespec.tv_nsec = 1;
3870 ac_cv_stat_tv_nsec2=yes,
3871 ac_cv_stat_tv_nsec2=no,
3872 ac_cv_stat_tv_nsec2=no))
3873 AC_MSG_RESULT($ac_cv_stat_tv_nsec2)
3874 if test "$ac_cv_stat_tv_nsec2" = yes
3875 then
3876   AC_DEFINE(HAVE_STAT_TV_NSEC2, 1,
3877   [Define if you have struct stat.st_mtimensec])
3880 # On HP/UX 11.0, mvwdelch is a block with a return statement
3881 AC_MSG_CHECKING(whether mvwdelch is an expression)
3882 AC_CACHE_VAL(ac_cv_mvwdelch_is_expression,
3883 AC_TRY_COMPILE([#include <curses.h>], [
3884   int rtn;
3885   rtn = mvwdelch(0,0,0);
3886 ], ac_cv_mvwdelch_is_expression=yes,
3887    ac_cv_mvwdelch_is_expression=no,
3888    ac_cv_mvwdelch_is_expression=yes))
3889 AC_MSG_RESULT($ac_cv_mvwdelch_is_expression)
3891 if test "$ac_cv_mvwdelch_is_expression" = yes
3892 then
3893   AC_DEFINE(MVWDELCH_IS_EXPRESSION, 1,
3894   [Define if mvwdelch in curses.h is an expression.])
3897 AC_MSG_CHECKING(whether WINDOW has _flags)
3898 AC_CACHE_VAL(ac_cv_window_has_flags,
3899 AC_TRY_COMPILE([#include <curses.h>], [
3900   WINDOW *w;
3901   w->_flags = 0;
3902 ], ac_cv_window_has_flags=yes,
3903    ac_cv_window_has_flags=no,
3904    ac_cv_window_has_flags=no))
3905 AC_MSG_RESULT($ac_cv_window_has_flags)
3908 if test "$ac_cv_window_has_flags" = yes
3909 then
3910   AC_DEFINE(WINDOW_HAS_FLAGS, 1, 
3911   [Define if WINDOW in curses.h offers a field _flags.])
3914 AC_MSG_CHECKING(for is_term_resized)
3915 AC_TRY_COMPILE([#include <curses.h>], void *x=is_term_resized,
3916   AC_DEFINE(HAVE_CURSES_IS_TERM_RESIZED, 1, Define if you have the 'is_term_resized' function.)
3917   AC_MSG_RESULT(yes),
3918   AC_MSG_RESULT(no)
3921 AC_MSG_CHECKING(for resize_term)
3922 AC_TRY_COMPILE([#include <curses.h>], void *x=resize_term,
3923   AC_DEFINE(HAVE_CURSES_RESIZE_TERM, 1, Define if you have the 'resize_term' function.)
3924   AC_MSG_RESULT(yes),
3925   AC_MSG_RESULT(no)
3928 AC_MSG_CHECKING(for resizeterm)
3929 AC_TRY_COMPILE([#include <curses.h>], void *x=resizeterm,
3930   AC_DEFINE(HAVE_CURSES_RESIZETERM, 1, Define if you have the 'resizeterm' function.)
3931   AC_MSG_RESULT(yes),
3932   AC_MSG_RESULT(no)
3935 AC_MSG_CHECKING(for /dev/ptmx)
3937 if test -r /dev/ptmx
3938 then
3939   AC_MSG_RESULT(yes)
3940   AC_DEFINE(HAVE_DEV_PTMX, 1,
3941   [Define if we have /dev/ptmx.])
3942 else
3943   AC_MSG_RESULT(no)
3946 AC_MSG_CHECKING(for /dev/ptc)
3948 if test -r /dev/ptc
3949 then
3950   AC_MSG_RESULT(yes)
3951   AC_DEFINE(HAVE_DEV_PTC, 1,
3952   [Define if we have /dev/ptc.])
3953 else
3954   AC_MSG_RESULT(no)
3957 AC_MSG_CHECKING(for %zd printf() format support)
3958 AC_CACHE_VAL(ac_cv_have_size_t_format,
3959 AC_TRY_RUN([[
3960 #include <stdio.h>
3961 #include <stddef.h>
3962 #include <string.h>
3964 #ifdef HAVE_SYS_TYPES_H
3965 #include <sys/types.h>
3966 #endif
3968 #ifdef HAVE_SSIZE_T
3969 typedef ssize_t Py_ssize_t;
3970 #elif SIZEOF_VOID_P == SIZEOF_LONG
3971 typedef long Py_ssize_t;
3972 #else
3973 typedef int Py_ssize_t;
3974 #endif
3976 int main()
3978     char buffer[256];
3980     if(sprintf(buffer, "%zd", (size_t)123) < 0)
3981         return 1;
3983     if (strcmp(buffer, "123"))
3984         return 1;
3986     if (sprintf(buffer, "%zd", (Py_ssize_t)-123) < 0)
3987         return 1;
3989     if (strcmp(buffer, "-123"))
3990         return 1;
3992     return 0;
3994 ]], ac_cv_have_size_t_format=yes,
3995     ac_cv_have_size_t_format=no,
3996     ac_cv_have_size_t_format=no)
3998 AC_MSG_RESULT($ac_cv_have_size_t_format)
3999 if test $ac_cv_have_size_t_format = yes
4000 then
4001   AC_DEFINE(PY_FORMAT_SIZE_T, "z",
4002   [Define to printf format modifier for Py_ssize_t])
4005 AC_CHECK_TYPE(socklen_t,,
4006   AC_DEFINE(socklen_t,int,
4007             Define to `int' if <sys/socket.h> does not define.),[
4008 #ifdef HAVE_SYS_TYPES_H
4009 #include <sys/types.h>
4010 #endif
4011 #ifdef HAVE_SYS_SOCKET_H
4012 #include <sys/socket.h>
4013 #endif
4016 AC_SUBST(THREADHEADERS)
4018 for h in `(cd $srcdir;echo Python/thread_*.h)`
4020   THREADHEADERS="$THREADHEADERS \$(srcdir)/$h"
4021 done
4023 AC_SUBST(SRCDIRS)
4024 SRCDIRS="Parser Grammar Objects Python Modules Mac"
4025 AC_MSG_CHECKING(for build directories)
4026 for dir in $SRCDIRS; do
4027     if test ! -d $dir; then
4028         mkdir $dir
4029     fi
4030 done
4031 AC_MSG_RESULT(done)
4033 # generate output files
4034 AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
4035 AC_OUTPUT
4037 echo "creating Modules/Setup"
4038 if test ! -f Modules/Setup
4039 then
4040         cp $srcdir/Modules/Setup.dist Modules/Setup
4043 echo "creating Modules/Setup.local"
4044 if test ! -f Modules/Setup.local
4045 then
4046         echo "# Edit this file for local setup changes" >Modules/Setup.local
4049 echo "creating Makefile"
4050 $SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
4051                         -s Modules Modules/Setup.config \
4052                         Modules/Setup.local Modules/Setup
4054 case $ac_sys_system in
4055 BeOS)
4056         AC_MSG_WARN([
4058   Support for BeOS is deprecated as of Python 2.6.
4059   See PEP 11 for the gory details.
4060   ])
4061   ;;
4062 *) ;;
4063 esac
4065 mv config.c Modules