source: trunk/essentials/dev-lang/python/configure.in@ 3392

Last change on this file since 3392 was 3391, checked in by bird, 19 years ago

OS/2 and shared building

File size: 94.7 KB
Line 
1dnl Process this file with autoconf 2.0 or later to make a configure script.
2
3# Set VERSION so we only need to edit in one place (i.e., here)
4m4_define(PYTHON_VERSION, 2.5)
5
6AC_REVISION($Revision: 51727 $)
7AC_PREREQ(2.59)
8AC_INIT(python, PYTHON_VERSION, http://www.python.org/python-bugs)
9AC_CONFIG_SRCDIR([Include/object.h])
10AC_CONFIG_HEADER(pyconfig.h)
11
12dnl This is for stuff that absolutely must end up in pyconfig.h.
13dnl Please use pyport.h instead, if possible.
14AH_TOP([
15#ifndef Py_PYCONFIG_H
16#define Py_PYCONFIG_H
17])
18AH_BOTTOM([
19/* Define the macros needed if on a UnixWare 7.x system. */
20#if defined(__USLC__) && defined(__SCO_VERSION__)
21#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */
22#endif
23
24#endif /*Py_PYCONFIG_H*/
25])
26
27# We don't use PACKAGE_ variables, and they cause conflicts
28# with other autoconf-based packages that include Python.h
29grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
30rm confdefs.h
31mv confdefs.h.new confdefs.h
32
33AC_SUBST(VERSION)
34VERSION=PYTHON_VERSION
35
36AC_SUBST(SOVERSION)
37SOVERSION=1.0
38
39# The later defininition of _XOPEN_SOURCE disables certain features
40# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
41AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
42
43# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
44# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
45# them.
46AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
47
48# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
49# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
50# them.
51AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
52
53# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
54# u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
55AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
56
57define_xopen_source=yes
58
59# Arguments passed to configure.
60AC_SUBST(CONFIG_ARGS)
61CONFIG_ARGS="$ac_configure_args"
62
63AC_ARG_ENABLE(universalsdk,
64 AC_HELP_STRING(--enable-universalsdk@<:@SDKDIR@:>@, Build agains Mac OS X 10.4u SDK (ppc/i386)),
65[
66 case $enableval in
67 yes)
68 enableval=/Developer/SDKs/MacOSX10.4u.sdk
69 ;;
70 esac
71 case $enableval in
72 no)
73 UNIVERSALSDK=
74 enable_universalsdk=
75 ;;
76 *)
77 UNIVERSALSDK=$enableval
78 ;;
79 esac
80],[
81 UNIVERSALSDK=
82 enable_universalsdk=
83])
84AC_SUBST(UNIVERSALSDK)
85
86dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
87AC_ARG_ENABLE(framework,
88 AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
89[
90 case $enableval in
91 yes)
92 enableval=/Library/Frameworks
93 esac
94 case $enableval in
95 no)
96 PYTHONFRAMEWORK=
97 PYTHONFRAMEWORKDIR=no-framework
98 PYTHONFRAMEWORKPREFIX=
99 PYTHONFRAMEWORKINSTALLDIR=
100 FRAMEWORKINSTALLFIRST=
101 FRAMEWORKINSTALLLAST=
102 FRAMEWORKALTINSTALLFIRST=
103 FRAMEWORKALTINSTALLLAST=
104 if test "x${prefix}" = "xNONE"; then
105 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
106 else
107 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
108 fi
109 enable_framework=
110 ;;
111 *)
112 PYTHONFRAMEWORK=Python
113 PYTHONFRAMEWORKDIR=Python.framework
114 PYTHONFRAMEWORKPREFIX=$enableval
115 PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
116 FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
117 FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
118 FRAMEWORKALTINSTALLFIRST="${FRAMEWORKINSTALLFIRST} bininstall maninstall"
119 FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
120 if test "x${prefix}" = "xNONE" ; then
121 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
122 else
123 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
124 fi
125 prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
126
127 # Add makefiles for Mac specific code to the list of output
128 # files:
129 AC_CONFIG_FILES(Mac/Makefile)
130 AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
131 AC_CONFIG_FILES(Mac/IDLE/Makefile)
132 esac
133 ],[
134 PYTHONFRAMEWORK=
135 PYTHONFRAMEWORKDIR=no-framework
136 PYTHONFRAMEWORKPREFIX=
137 PYTHONFRAMEWORKINSTALLDIR=
138 FRAMEWORKINSTALLFIRST=
139 FRAMEWORKINSTALLLAST=
140 FRAMEWORKALTINSTALLFIRST=
141 FRAMEWORKALTINSTALLLAST=
142 if test "x${prefix}" = "xNONE" ; then
143 FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
144 else
145 FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
146 fi
147 enable_framework=
148])
149AC_SUBST(PYTHONFRAMEWORK)
150AC_SUBST(PYTHONFRAMEWORKDIR)
151AC_SUBST(PYTHONFRAMEWORKPREFIX)
152AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
153AC_SUBST(FRAMEWORKINSTALLFIRST)
154AC_SUBST(FRAMEWORKINSTALLLAST)
155AC_SUBST(FRAMEWORKALTINSTALLFIRST)
156AC_SUBST(FRAMEWORKALTINSTALLLAST)
157AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
158
159##AC_ARG_WITH(dyld,
160## AC_HELP_STRING(--with-dyld,
161## Use (OpenStep|Rhapsody) dynamic linker))
162##
163# Set name for machine-dependent library files
164AC_SUBST(MACHDEP)
165AC_MSG_CHECKING(MACHDEP)
166if test -z "$MACHDEP"
167then
168 ac_sys_system=`uname -s`
169 if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
170 -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
171 ac_sys_release=`uname -v`
172 else
173 ac_sys_release=`uname -r`
174 fi
175 ac_md_system=`echo $ac_sys_system |
176 tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
177 ac_md_release=`echo $ac_sys_release |
178 tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
179 MACHDEP="$ac_md_system$ac_md_release"
180
181 case $MACHDEP in
182 cygwin*) MACHDEP="cygwin";;
183 darwin*) MACHDEP="darwin";;
184 atheos*) MACHDEP="atheos";;
185 irix646) MACHDEP="irix6";;
186 os2*|OS/2*|emx*) MACHDEP="emx";;
187
188 '') MACHDEP="unknown";;
189 esac
190fi
191
192# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
193# disable features if it is defined, without any means to access these
194# features as extensions. For these systems, we skip the definition of
195# _XOPEN_SOURCE. Before adding a system to the list to gain access to
196# some feature, make sure there is no alternative way to access this
197# feature. Also, when using wildcards, make sure you have verified the
198# need for not defining _XOPEN_SOURCE on all systems matching the
199# wildcard, and that the wildcard does not include future systems
200# (which may remove their limitations).
201dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
202case $ac_sys_system/$ac_sys_release in
203 # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
204 # even though select is a POSIX function. Reported by J. Ribbens.
205 # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
206 OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0@:>@)
207 define_xopen_source=no;;
208 # On Solaris 2.6, sys/wait.h is inconsistent in the usage
209 # of union __?sigval. Reported by Stuart Bishop.
210 SunOS/5.6)
211 define_xopen_source=no;;
212 # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
213 # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
214 # Reconfirmed for 7.1.4 by Martin v. Loewis.
215 OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
216 define_xopen_source=no;;
217 # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
218 # but used in struct sockaddr.sa_family. Reported by Tim Rice.
219 SCO_SV/3.2)
220 define_xopen_source=no;;
221 # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that
222 # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently,
223 # this is fixed in 10.3, which identifies itself as Darwin/7.*
224 # This should hopefully be fixed in FreeBSD 4.9
225 FreeBSD/4.8* | Darwin/6* )
226 define_xopen_source=no;;
227 # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
228 # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
229 # or has another value. By not (re)defining it, the defaults come in place.
230 AIX/4)
231 define_xopen_source=no;;
232 AIX/5)
233 if test `uname -r` -eq 1; then
234 define_xopen_source=no
235 fi
236 ;;
237 # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
238 # disables platform specific features beyond repair.
239 # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
240 # has no effect, don't bother defining them
241 Darwin/@<:@789@:>@.*)
242 define_xopen_source=no
243 ;;
244
245esac
246
247if test $define_xopen_source = yes
248then
249 # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
250 # defined precisely as g++ defines it
251 # Furthermore, on Solaris 10, XPG6 requires the use of a C99
252 # compiler
253 case $ac_sys_system/$ac_sys_release in
254 SunOS/5.8|SunOS/5.9|SunOS/5.10)
255 AC_DEFINE(_XOPEN_SOURCE, 500,
256 Define to the level of X/Open that your system supports)
257 ;;
258 *)
259 AC_DEFINE(_XOPEN_SOURCE, 600,
260 Define to the level of X/Open that your system supports)
261 ;;
262 esac
263
264 # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
265 # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
266 # several APIs are not declared. Since this is also needed in some
267 # cases for HP-UX, we define it globally.
268 # except for Solaris 10, where it must not be defined,
269 # as it implies XPG4.2
270 case $ac_sys_system/$ac_sys_release in
271 SunOS/5.10)
272 ;;
273 *)
274 AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
275 Define to activate Unix95-and-earlier features)
276 ;;
277 esac
278
279 AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
280
281fi
282
283#
284# SGI compilers allow the specification of the both the ABI and the
285# ISA on the command line. Depending on the values of these switches,
286# different and often incompatable code will be generated.
287#
288# The SGI_ABI variable can be used to modify the CC and LDFLAGS and
289# thus supply support for various ABI/ISA combinations. The MACHDEP
290# variable is also adjusted.
291#
292AC_SUBST(SGI_ABI)
293if test ! -z "$SGI_ABI"
294then
295 CC="cc $SGI_ABI"
296 LDFLAGS="$SGI_ABI $LDFLAGS"
297 MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
298fi
299AC_MSG_RESULT($MACHDEP)
300
301# And add extra plat-mac for darwin
302AC_SUBST(EXTRAPLATDIR)
303AC_SUBST(EXTRAMACHDEPPATH)
304AC_MSG_CHECKING(EXTRAPLATDIR)
305if test -z "$EXTRAPLATDIR"
306then
307 case $MACHDEP in
308 darwin)
309 EXTRAPLATDIR="\$(PLATMACDIRS)"
310 EXTRAMACHDEPPATH="\$(PLATMACPATH)"
311 ;;
312 *)
313 EXTRAPLATDIR=""
314 EXTRAMACHDEPPATH=""
315 ;;
316 esac
317fi
318AC_MSG_RESULT($EXTRAPLATDIR)
319
320# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
321# it may influence the way we can build extensions, so distutils
322# needs to check it
323AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
324AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
325CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
326EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
327
328# checks for alternative programs
329
330# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
331# for debug/optimization stuff. BASECFLAGS is for flags that are required
332# just to get things to compile and link. Users are free to override OPT
333# when running configure or make. The build should not break if they do.
334# BASECFLAGS should generally not be messed with, however.
335
336# XXX shouldn't some/most/all of this code be merged with the stuff later
337# on that fiddles with OPT and BASECFLAGS?
338AC_MSG_CHECKING(for --without-gcc)
339AC_ARG_WITH(gcc,
340 AC_HELP_STRING(--without-gcc,never use gcc),
341[
342 case $withval in
343 no) CC=cc
344 without_gcc=yes;;
345 yes) CC=gcc
346 without_gcc=no;;
347 *) CC=$withval
348 without_gcc=$withval;;
349 esac], [
350 case $ac_sys_system in
351 AIX*) CC=cc_r
352 without_gcc=;;
353 BeOS*)
354 case $BE_HOST_CPU in
355 ppc)
356 CC=mwcc
357 without_gcc=yes
358 BASECFLAGS="$BASECFLAGS -export pragma"
359 OPT="$OPT -O"
360 LDFLAGS="$LDFLAGS -nodup"
361 ;;
362 x86)
363 CC=gcc
364 without_gcc=no
365 OPT="$OPT -O"
366 ;;
367 *)
368 AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
369 ;;
370 esac
371 AR="\$(srcdir)/Modules/ar_beos"
372 RANLIB=:
373 ;;
374 Monterey*)
375 RANLIB=:
376 without_gcc=;;
377 *) without_gcc=no;;
378 esac])
379AC_MSG_RESULT($without_gcc)
380
381# If the user switches compilers, we can't believe the cache
382if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
383then
384 AC_MSG_ERROR([cached CC is different -- throw away $cache_file
385(it is also a good idea to do 'make clean' before compiling)])
386fi
387
388AC_PROG_CC
389
390AC_SUBST(CXX)
391AC_SUBST(MAINCC)
392AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
393AC_ARG_WITH(cxx_main,
394 AC_HELP_STRING([--with-cxx-main=<compiler>],
395 [compile main() and link python executable with C++ compiler]),
396[
397
398 case $withval in
399 no) with_cxx_main=no
400 MAINCC='$(CC)';;
401 yes) with_cxx_main=yes
402 MAINCC='$(CXX)';;
403 *) with_cxx_main=yes
404 MAINCC=$withval
405 if test -z "$CXX"
406 then
407 CXX=$withval
408 fi;;
409 esac], [
410 with_cxx_main=no
411 MAINCC='$(CC)'
412])
413AC_MSG_RESULT($with_cxx_main)
414
415preset_cxx="$CXX"
416if test -z "$CXX"
417then
418 case "$CC" in
419 gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
420 cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
421 esac
422 if test "$CXX" = "notfound"
423 then
424 CXX=""
425 fi
426fi
427if test -z "$CXX"
428then
429 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
430 if test "$CXX" = "notfound"
431 then
432 CXX=""
433 fi
434fi
435if test "$preset_cxx" != "$CXX"
436then
437 AC_MSG_WARN([
438
439 By default, distutils will build C++ extension modules with "$CXX".
440 If this is not intended, then set CXX on the configure command line.
441 ])
442fi
443
444
445# checks for UNIX variants that set C preprocessor variables
446AC_AIX
447
448# Check for unsupported systems
449case $ac_sys_system/$ac_sys_release in
450Linux*/1*)
451 echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
452 echo See README for details.
453 exit 1;;
454esac
455
456AC_EXEEXT
457AC_MSG_CHECKING(for --with-suffix)
458AC_ARG_WITH(suffix,
459 AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
460[
461 case $withval in
462 no) EXEEXT=;;
463 yes) EXEEXT=.exe;;
464 *) EXEEXT=$withval;;
465 esac])
466AC_MSG_RESULT($EXEEXT)
467
468# Test whether we're running on a non-case-sensitive system, in which
469# case we give a warning if no ext is given
470AC_SUBST(BUILDEXEEXT)
471AC_MSG_CHECKING(for case-insensitive build directory)
472if test ! -d CaseSensitiveTestDir; then
473mkdir CaseSensitiveTestDir
474fi
475
476if test -d casesensitivetestdir
477then
478 AC_MSG_RESULT(yes)
479 BUILDEXEEXT=.exe
480else
481 AC_MSG_RESULT(no)
482 BUILDEXEEXT=$EXEEXT
483fi
484rmdir CaseSensitiveTestDir
485
486case $MACHDEP in
487bsdos*)
488 case $CC in
489 gcc) CC="$CC -D_HAVE_BSDI";;
490 esac;;
491OS/2*|os2*|emx*)
492 CC="$CC -DPYOS_OS2=1 -DPYCC_GCC=1"
493 ;;
494esac
495
496case $ac_sys_system in
497hp*|HP*)
498 case $CC in
499 cc|*/cc) CC="$CC -Ae";;
500 esac;;
501Monterey*)
502 case $CC in
503 cc) CC="$CC -Wl,-Bexport";;
504 esac;;
505SunOS*)
506 # Some functions have a prototype only with that define, e.g. confstr
507 AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
508 ;;
509esac
510
511
512AC_SUBST(LIBRARY)
513AC_MSG_CHECKING(LIBRARY)
514if test -z "$LIBRARY"
515then
516 LIBRARY='libpython$(VERSION).a'
517fi
518AC_MSG_RESULT($LIBRARY)
519
520# LDLIBRARY is the name of the library to link against (as opposed to the
521# name of the library into which to insert object files). BLDLIBRARY is also
522# the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
523# is blank as the main program is not linked directly against LDLIBRARY.
524# LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
525# systems without shared libraries, LDLIBRARY is the same as LIBRARY
526# (defined in the Makefiles). On Cygwin and OS/2 LDLIBRARY is the import
527# library, DLLLIBRARY is the shared (i.e., DLL) library.
528#
529# RUNSHARED is used to run shared python without installed libraries
530#
531# INSTSONAME is the name of the shared library that will be use to install
532# on the system - some systems like version suffix, others don't
533AC_SUBST(LDLIBRARY)
534AC_SUBST(DLLLIBRARY)
535AC_SUBST(BLDLIBRARY)
536AC_SUBST(LDLIBRARYDIR)
537AC_SUBST(INSTSONAME)
538AC_SUBST(RUNSHARED)
539AC_SUBST(CONDENSED_VERSION)
540LDLIBRARY="$LIBRARY"
541BLDLIBRARY='$(LDLIBRARY)'
542INSTSONAME='$(LDLIBRARY)'
543DLLLIBRARY=''
544LDLIBRARYDIR=''
545RUNSHARED=''
546CONDENSED_VERSION=''
547
548# LINKCC is the command that links the python executable -- default is $(CC).
549# If CXX is set, and if it is needed to link a main function that was
550# compiled with CXX, LINKCC is CXX instead. Always using CXX is undesirable:
551# python might then depend on the C++ runtime
552# This is altered for AIX in order to build the export list before
553# linking.
554AC_SUBST(LINKCC)
555AC_MSG_CHECKING(LINKCC)
556if test -z "$LINKCC"
557then
558 LINKCC='$(PURIFY) $(MAINCC)'
559 case $ac_sys_system in
560 AIX*)
561 exp_extra="\"\""
562 if test $ac_sys_release -ge 5 -o \
563 $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
564 exp_extra="."
565 fi
566 LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
567 Monterey64*)
568 LINKCC="$LINKCC -L/usr/lib/ia64l64";;
569 esac
570fi
571AC_MSG_RESULT($LINKCC)
572
573AC_MSG_CHECKING(for --enable-shared)
574AC_ARG_ENABLE(shared,
575 AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
576
577if test -z "$enable_shared"
578then
579 case $ac_sys_system in
580 CYGWIN* | atheos* | *OS/2* | *emx*)
581 enable_shared="yes";;
582 *)
583 enable_shared="no";;
584 esac
585fi
586AC_MSG_RESULT($enable_shared)
587
588AC_MSG_CHECKING(for --enable-profiling)
589AC_ARG_ENABLE(profiling,
590 AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
591[ac_save_cc="$CC"
592 CC="$CC -pg"
593 AC_TRY_RUN([int main() { return 0; }],
594 ac_enable_profiling="yes",
595 ac_enable_profiling="no",
596 ac_enable_profiling="no")
597 CC="$ac_save_cc"])
598AC_MSG_RESULT($ac_enable_profiling)
599
600case "$ac_enable_profiling" in
601 "yes")
602 BASECFLAGS="-pg $BASECFLAGS"
603 LDFLAGS="-pg $LDFLAGS"
604 ;;
605esac
606
607AC_MSG_CHECKING(LDLIBRARY)
608
609# MacOSX framework builds need more magic. LDLIBRARY is the dynamic
610# library that we build, but we do not want to link against it (we
611# will find it with a -framework option). For this reason there is an
612# extra variable BLDLIBRARY against which Python and the extension
613# modules are linked, BLDLIBRARY. This is normally the same as
614# LDLIBRARY, but empty for MacOSX framework builds.
615if test "$enable_framework"
616then
617 LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
618 RUNSHARED=DYLD_FRAMEWORK_PATH="`pwd`:$DYLD_FRAMEWORK_PATH"
619 BLDLIBRARY=''
620else
621 BLDLIBRARY='$(LDLIBRARY)'
622fi
623
624# Other platforms follow
625if test $enable_shared = "yes"; then
626 AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
627 case $ac_sys_system in
628 BeOS*)
629 LDLIBRARY='libpython$(VERSION).so'
630 ;;
631 CYGWIN*)
632 LDLIBRARY='libpython$(VERSION).dll.a'
633 DLLLIBRARY='libpython$(VERSION).dll'
634 ;;
635 SunOS*)
636 LDLIBRARY='libpython$(VERSION).so'
637 BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
638 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
639 INSTSONAME="$LDLIBRARY".$SOVERSION
640 ;;
641 Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
642 LDLIBRARY='libpython$(VERSION).so'
643 BLDLIBRARY='-L. -lpython$(VERSION)'
644 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
645 case $ac_sys_system in
646 FreeBSD*)
647 SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
648 ;;
649 esac
650 INSTSONAME="$LDLIBRARY".$SOVERSION
651 ;;
652 hp*|HP*)
653 case `uname -m` in
654 ia64)
655 LDLIBRARY='libpython$(VERSION).so'
656 ;;
657 *)
658 LDLIBRARY='libpython$(VERSION).sl'
659 ;;
660 esac
661 BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
662 RUNSHARED=SHLIB_PATH=`pwd`:${SHLIB_PATH}
663 ;;
664 OSF*)
665 LDLIBRARY='libpython$(VERSION).so'
666 BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
667 RUNSHARED=LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}
668 ;;
669 atheos*)
670 LDLIBRARY='libpython$(VERSION).so'
671 BLDLIBRARY='-L. -lpython$(VERSION)'
672 RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
673 ;;
674 OS/2*|os2*|emx*)
675 LDLIBRARY='python$(VERSION)_dll.a'
676 BLDLIBRARY='-L. -lpython$(VERSION)'
677 RUNSHARED=BEGINLIBPATH="'`pwd`;$BEGINLIBPATH'"
678 CONDENSED_VERSION=`echo "$(VERSION)" | tr -d .,"`
679 DLLLIBRARY='python$(CONDENSED_VERSION).dll'
680 ;;
681 esac
682else # shared is disabled
683 case $ac_sys_system in
684 CYGWIN*)
685 BLDLIBRARY='$(LIBRARY)'
686 LDLIBRARY='libpython$(VERSION).dll.a'
687 ;;
688 esac
689fi
690
691AC_MSG_RESULT($LDLIBRARY)
692
693AC_PROG_RANLIB
694AC_SUBST(AR)
695AC_CHECK_PROGS(AR, ar aal, ar)
696
697AC_SUBST(SVNVERSION)
698AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
699if test $SVNVERSION = found
700then
701 SVNVERSION="svnversion \$(srcdir)"
702else
703 SVNVERSION="echo exported"
704fi
705
706case $MACHDEP in
707bsdos*|hp*|HP*)
708 # install -d does not work on BSDI or HP-UX
709 if test -z "$INSTALL"
710 then
711 INSTALL="${srcdir}/install-sh -c"
712 fi
713esac
714AC_PROG_INSTALL
715
716# Not every filesystem supports hard links
717AC_SUBST(LN)
718if test -z "$LN" ; then
719 case $ac_sys_system in
720 BeOS*) LN="ln -s";;
721 CYGWIN*) LN="ln -s";;
722 OS/2*|os2*|emx*) LN="ln -s";;
723 atheos*) LN="ln -s";;
724 *) LN=ln;;
725 esac
726fi
727
728# Check for --with-pydebug
729AC_MSG_CHECKING(for --with-pydebug)
730AC_ARG_WITH(pydebug,
731 AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
732[
733if test "$withval" != no
734then
735 AC_DEFINE(Py_DEBUG, 1,
736 [Define if you want to build an interpreter with many run-time checks.])
737 AC_MSG_RESULT(yes);
738 Py_DEBUG='true'
739else AC_MSG_RESULT(no); Py_DEBUG='false'
740fi],
741[AC_MSG_RESULT(no)])
742
743# XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
744# merged with this chunk of code?
745
746# Optimizer/debugger flags
747# ------------------------
748# (The following bit of code is complicated enough - please keep things
749# indented properly. Just pretend you're editing Python code. ;-)
750
751# There are two parallel sets of case statements below, one that checks to
752# see if OPT was set and one that does BASECFLAGS setting based upon
753# compiler and platform. BASECFLAGS tweaks need to be made even if the
754# user set OPT.
755
756# tweak OPT based on compiler and platform, only if the user didn't set
757# it on the command line
758AC_SUBST(OPT)
759if test -z "$OPT"
760then
761 case $GCC in
762 yes)
763 if test "$CC" != 'g++' ; then
764 STRICT_PROTO="-Wstrict-prototypes"
765 fi
766 case $ac_cv_prog_cc_g in
767 yes)
768 if test "$Py_DEBUG" = 'true' ; then
769 # Optimization messes up debuggers, so turn it off for
770 # debug builds.
771 OPT="-g -Wall $STRICT_PROTO"
772 else
773 OPT="-g -O3 -Wall $STRICT_PROTO"
774 fi
775 ;;
776 *)
777 OPT="-O3 -Wall $STRICT_PROTO"
778 ;;
779 esac
780 case $ac_sys_system in
781 SCO_SV*) OPT="$OPT -m486 -DSCO5"
782 ;;
783 esac
784 ;;
785
786 *)
787 OPT="-O"
788 ;;
789 esac
790
791 # The current (beta) Monterey compiler dies with optimizations
792 # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
793 case $ac_sys_system in
794 Monterey*)
795 OPT=""
796 ;;
797 esac
798
799fi
800
801AC_SUBST(BASECFLAGS)
802# tweak BASECFLAGS based on compiler and platform
803case $GCC in
804yes)
805 # Python violates C99 rules, by casting between incompatible
806 # pointer types. GCC may generate bad code as a result of that,
807 # so use -fno-strict-aliasing if supported.
808 AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
809 ac_save_cc="$CC"
810 CC="$CC -fno-strict-aliasing"
811 AC_TRY_RUN([int main() { return 0; }],
812 ac_cv_no_strict_aliasing_ok=yes,
813 ac_cv_no_strict_aliasing_ok=no,
814 ac_cv_no_strict_aliasing_ok=no)
815 CC="$ac_save_cc"
816 AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
817 if test $ac_cv_no_strict_aliasing_ok = yes
818 then
819 BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
820 fi
821 case $ac_sys_system in
822 SCO_SV*)
823 BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
824 ;;
825 # is there any other compiler on Darwin besides gcc?
826 Darwin*)
827 BASECFLAGS="$BASECFLAGS -Wno-long-double -no-cpp-precomp -mno-fused-madd"
828 if test "${enable_universalsdk}"; then
829 BASECFLAGS="-arch ppc -arch i386 -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
830 fi
831
832 ;;
833 OSF*)
834 BASECFLAGS="$BASECFLAGS -mieee"
835 ;;
836 esac
837 ;;
838
839*)
840 case $ac_sys_system in
841 OpenUNIX*|UnixWare*)
842 BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
843 ;;
844 OSF*)
845 BASECFLAGS="$BASECFLAGS -ieee -std"
846 ;;
847 SCO_SV*)
848 BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
849 ;;
850 esac
851 ;;
852esac
853
854if test "$Py_DEBUG" = 'true'; then
855 :
856else
857 OPT="-DNDEBUG $OPT"
858fi
859
860if test "$ac_arch_flags"
861then
862 BASECFLAGS="$BASECFLAGS $ac_arch_flags"
863fi
864
865# disable check for icc since it seems to pass, but generates a warning
866if test "$CC" = icc
867then
868 ac_cv_opt_olimit_ok=no
869fi
870
871AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
872AC_CACHE_VAL(ac_cv_opt_olimit_ok,
873[ac_save_cc="$CC"
874CC="$CC -OPT:Olimit=0"
875AC_TRY_RUN([int main() { return 0; }],
876 ac_cv_opt_olimit_ok=yes,
877 ac_cv_opt_olimit_ok=no,
878 ac_cv_opt_olimit_ok=no)
879CC="$ac_save_cc"])
880AC_MSG_RESULT($ac_cv_opt_olimit_ok)
881if test $ac_cv_opt_olimit_ok = yes; then
882 case $ac_sys_system in
883 # XXX is this branch needed? On MacOSX 10.2.2 the result of the
884 # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
885 # environment?
886 Darwin*)
887 ;;
888 *)
889 BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
890 ;;
891 esac
892else
893 AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
894 AC_CACHE_VAL(ac_cv_olimit_ok,
895 [ac_save_cc="$CC"
896 CC="$CC -Olimit 1500"
897 AC_TRY_RUN([int main() { return 0; }],
898 ac_cv_olimit_ok=yes,
899 ac_cv_olimit_ok=no,
900 ac_cv_olimit_ok=no)
901 CC="$ac_save_cc"])
902 AC_MSG_RESULT($ac_cv_olimit_ok)
903 if test $ac_cv_olimit_ok = yes; then
904 BASECFLAGS="$BASECFLAGS -Olimit 1500"
905 fi
906fi
907
908# On some compilers, pthreads are available without further options
909# (e.g. MacOS X). On some of these systems, the compiler will not
910# complain if unaccepted options are passed (e.g. gcc on Mac OS X).
911# So we have to see first whether pthreads are available without
912# options before we can check whether -Kpthread improves anything.
913AC_MSG_CHECKING(whether pthreads are available without options)
914AC_CACHE_VAL(ac_cv_pthread_is_default,
915[AC_TRY_RUN([
916#include <pthread.h>
917
918void* routine(void* p){return NULL;}
919
920int main(){
921 pthread_t p;
922 if(pthread_create(&p,NULL,routine,NULL)!=0)
923 return 1;
924 (void)pthread_detach(p);
925 return 0;
926}
927],
928[
929 ac_cv_pthread_is_default=yes
930 ac_cv_kthread=no
931 ac_cv_pthread=no
932],
933 ac_cv_pthread_is_default=no,
934 ac_cv_pthread_is_default=no)
935])
936AC_MSG_RESULT($ac_cv_pthread_is_default)
937
938
939if test $ac_cv_pthread_is_default = yes
940then
941 ac_cv_kpthread=no
942else
943# -Kpthread, if available, provides the right #defines
944# and linker options to make pthread_create available
945# Some compilers won't report that they do not support -Kpthread,
946# so we need to run a program to see whether it really made the
947# function available.
948AC_MSG_CHECKING(whether $CC accepts -Kpthread)
949AC_CACHE_VAL(ac_cv_kpthread,
950[ac_save_cc="$CC"
951CC="$CC -Kpthread"
952AC_TRY_RUN([
953#include <pthread.h>
954
955void* routine(void* p){return NULL;}
956
957int main(){
958 pthread_t p;
959 if(pthread_create(&p,NULL,routine,NULL)!=0)
960 return 1;
961 (void)pthread_detach(p);
962 return 0;
963}
964],
965 ac_cv_kpthread=yes,
966 ac_cv_kpthread=no,
967 ac_cv_kpthread=no)
968CC="$ac_save_cc"])
969AC_MSG_RESULT($ac_cv_kpthread)
970fi
971
972if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
973then
974# -Kthread, if available, provides the right #defines
975# and linker options to make pthread_create available
976# Some compilers won't report that they do not support -Kthread,
977# so we need to run a program to see whether it really made the
978# function available.
979AC_MSG_CHECKING(whether $CC accepts -Kthread)
980AC_CACHE_VAL(ac_cv_kthread,
981[ac_save_cc="$CC"
982CC="$CC -Kthread"
983AC_TRY_RUN([
984#include <pthread.h>
985
986void* routine(void* p){return NULL;}
987
988int main(){
989 pthread_t p;
990 if(pthread_create(&p,NULL,routine,NULL)!=0)
991 return 1;
992 (void)pthread_detach(p);
993 return 0;
994}
995],
996 ac_cv_kthread=yes,
997 ac_cv_kthread=no,
998 ac_cv_kthread=no)
999CC="$ac_save_cc"])
1000AC_MSG_RESULT($ac_cv_kthread)
1001fi
1002
1003if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
1004then
1005# -pthread, if available, provides the right #defines
1006# and linker options to make pthread_create available
1007# Some compilers won't report that they do not support -pthread,
1008# so we need to run a program to see whether it really made the
1009# function available.
1010AC_MSG_CHECKING(whether $CC accepts -pthread)
1011AC_CACHE_VAL(ac_cv_thread,
1012[ac_save_cc="$CC"
1013CC="$CC -pthread"
1014AC_TRY_RUN([
1015#include <pthread.h>
1016
1017void* routine(void* p){return NULL;}
1018
1019int main(){
1020 pthread_t p;
1021 if(pthread_create(&p,NULL,routine,NULL)!=0)
1022 return 1;
1023 (void)pthread_detach(p);
1024 return 0;
1025}
1026],
1027 ac_cv_pthread=yes,
1028 ac_cv_pthread=no,
1029 ac_cv_pthread=no)
1030CC="$ac_save_cc"])
1031AC_MSG_RESULT($ac_cv_pthread)
1032fi
1033
1034# If we have set a CC compiler flag for thread support then
1035# check if it works for CXX, too.
1036ac_cv_cxx_thread=no
1037if test ! -z "$CXX"
1038then
1039AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
1040ac_save_cxx="$CXX"
1041
1042if test "$ac_cv_kpthread" = "yes"
1043then
1044 CXX="$CXX -Kpthread"
1045 ac_cv_cxx_thread=yes
1046elif test "$ac_cv_kthread" = "yes"
1047then
1048 CXX="$CXX -Kthread"
1049 ac_cv_cxx_thread=yes
1050elif test "$ac_cv_pthread" = "yes"
1051then
1052 CXX="$CXX -pthread"
1053 ac_cv_cxx_thread=yes
1054fi
1055
1056if test $ac_cv_cxx_thread = yes
1057then
1058 echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
1059 $CXX -c conftest.$ac_ext 2>&5
1060 if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
1061 && test -s conftest$ac_exeext && ./conftest$ac_exeext
1062 then
1063 ac_cv_cxx_thread=yes
1064 else
1065 ac_cv_cxx_thread=no
1066 fi
1067 rm -fr conftest*
1068fi
1069AC_MSG_RESULT($ac_cv_cxx_thread)
1070fi
1071CXX="$ac_save_cxx"
1072
1073dnl # check for ANSI or K&R ("traditional") preprocessor
1074dnl AC_MSG_CHECKING(for C preprocessor type)
1075dnl AC_TRY_COMPILE([
1076dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
1077dnl int foo;
1078dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
1079dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
1080dnl AC_MSG_RESULT($cpp_type)
1081
1082# checks for header files
1083AC_HEADER_STDC
1084AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
1085fcntl.h grp.h \
1086shadow.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
1087signal.h stropts.h termios.h thread.h \
1088unistd.h utime.h \
1089sys/audioio.h sys/bsdtty.h sys/file.h sys/loadavg.h sys/lock.h sys/mkdev.h \
1090sys/modem.h \
1091sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
1092sys/time.h \
1093sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
1094sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
1095bluetooth/bluetooth.h)
1096AC_HEADER_DIRENT
1097AC_HEADER_MAJOR
1098
1099# On Solaris, term.h requires curses.h
1100AC_CHECK_HEADERS(term.h,,,[
1101#ifdef HAVE_CURSES_H
1102#include <curses.h>
1103#endif
1104])
1105
1106# On Linux, netlink.h requires asm/types.h
1107AC_CHECK_HEADERS(linux/netlink.h,,,[
1108#ifdef HAVE_ASM_TYPES_H
1109#include <asm/types.h>
1110#endif
1111#ifdef HAVE_SYS_SOCKET_H
1112#include <sys/socket.h>
1113#endif
1114])
1115
1116# checks for typedefs
1117was_it_defined=no
1118AC_MSG_CHECKING(for clock_t in time.h)
1119AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
1120 AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
1121])
1122AC_MSG_RESULT($was_it_defined)
1123
1124# Check whether using makedev requires defining _OSF_SOURCE
1125AC_MSG_CHECKING(for makedev)
1126AC_TRY_LINK([#include <sys/types.h> ],
1127 [ makedev(0, 0) ],
1128 ac_cv_has_makedev=yes,
1129 ac_cv_has_makedev=no)
1130if test "$ac_cv_has_makedev" = "no"; then
1131 # we didn't link, try if _OSF_SOURCE will allow us to link
1132 AC_TRY_LINK([
1133#define _OSF_SOURCE 1
1134#include <sys/types.h>
1135 ],
1136 [ makedev(0, 0) ],
1137 ac_cv_has_makedev=yes,
1138 ac_cv_has_makedev=no)
1139 if test "$ac_cv_has_makedev" = "yes"; then
1140 AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
1141 fi
1142fi
1143AC_MSG_RESULT($ac_cv_has_makedev)
1144if test "$ac_cv_has_makedev" = "yes"; then
1145 AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
1146fi
1147
1148# Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
1149# the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
1150# defined, but the compiler does not support pragma redefine_extname,
1151# and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
1152# structures (such as rlimit64) without declaring them. As a
1153# work-around, disable LFS on such configurations
1154
1155use_lfs=yes
1156AC_MSG_CHECKING(Solaris LFS bug)
1157AC_TRY_COMPILE([
1158#define _LARGEFILE_SOURCE 1
1159#define _FILE_OFFSET_BITS 64
1160#include <sys/resource.h>
1161],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
1162AC_MSG_RESULT($sol_lfs_bug)
1163if test "$sol_lfs_bug" = "yes"; then
1164 use_lfs=no
1165fi
1166
1167if test "$use_lfs" = "yes"; then
1168# Two defines needed to enable largefile support on various platforms
1169# These may affect some typedefs
1170AC_DEFINE(_LARGEFILE_SOURCE, 1,
1171[This must be defined on some systems to enable large file support.])
1172AC_DEFINE(_FILE_OFFSET_BITS, 64,
1173[This must be set to 64 on some systems to enable large file support.])
1174fi
1175
1176# Add some code to confdefs.h so that the test for off_t works on SCO
1177cat >> confdefs.h <<\EOF
1178#if defined(SCO_DS)
1179#undef _OFF_T
1180#endif
1181EOF
1182
1183# Type availability checks
1184AC_TYPE_MODE_T
1185AC_TYPE_OFF_T
1186AC_TYPE_PID_T
1187AC_TYPE_SIGNAL
1188AC_TYPE_SIZE_T
1189AC_TYPE_UID_T
1190AC_CHECK_TYPE(ssize_t,
1191 AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
1192
1193# Sizes of various common basic types
1194# ANSI C requires sizeof(char) == 1, so no need to check it
1195AC_CHECK_SIZEOF(int, 4)
1196AC_CHECK_SIZEOF(long, 4)
1197AC_CHECK_SIZEOF(void *, 4)
1198AC_CHECK_SIZEOF(short, 2)
1199AC_CHECK_SIZEOF(float, 4)
1200AC_CHECK_SIZEOF(double, 8)
1201AC_CHECK_SIZEOF(fpos_t, 4)
1202AC_CHECK_SIZEOF(size_t, 4)
1203
1204AC_MSG_CHECKING(for long long support)
1205have_long_long=no
1206AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
1207 AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
1208 have_long_long=yes
1209])
1210AC_MSG_RESULT($have_long_long)
1211if test "$have_long_long" = yes ; then
1212AC_CHECK_SIZEOF(long long, 8)
1213fi
1214
1215AC_MSG_CHECKING(for uintptr_t support)
1216have_uintptr_t=no
1217AC_TRY_COMPILE([], [uintptr_t x; x = (uintptr_t)0;], [
1218 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define this if you have the type uintptr_t.])
1219 have_uintptr_t=yes
1220])
1221AC_MSG_RESULT($have_uintptr_t)
1222if test "$have_uintptr_t" = yes ; then
1223AC_CHECK_SIZEOF(uintptr_t, 4)
1224fi
1225
1226# Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
1227AC_MSG_CHECKING(size of off_t)
1228AC_CACHE_VAL(ac_cv_sizeof_off_t,
1229[AC_TRY_RUN([#include <stdio.h>
1230#include <sys/types.h>
1231main()
1232{
1233 FILE *f=fopen("conftestval", "w");
1234 if (!f) exit(1);
1235 fprintf(f, "%d\n", sizeof(off_t));
1236 exit(0);
1237}],
1238ac_cv_sizeof_off_t=`cat conftestval`,
1239ac_cv_sizeof_off_t=0,
1240ac_cv_sizeof_off_t=4)
1241])
1242AC_MSG_RESULT($ac_cv_sizeof_off_t)
1243AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
1244[The number of bytes in an off_t.])
1245
1246AC_MSG_CHECKING(whether to enable large file support)
1247if test "$have_long_long" = yes -a \
1248 "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
1249 "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
1250 AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
1251 [Defined to enable large file support when an off_t is bigger than a long
1252 and long long is available and at least as big as an off_t. You may need
1253 to add some flags for configuration and compilation to enable this mode.
1254 (For Solaris and Linux, the necessary defines are already defined.)])
1255 AC_MSG_RESULT(yes)
1256else
1257 AC_MSG_RESULT(no)
1258fi
1259
1260# AC_CHECK_SIZEOF() doesn't include <time.h>.
1261AC_MSG_CHECKING(size of time_t)
1262AC_CACHE_VAL(ac_cv_sizeof_time_t,
1263[AC_TRY_RUN([#include <stdio.h>
1264#include <time.h>
1265main()
1266{
1267 FILE *f=fopen("conftestval", "w");
1268 if (!f) exit(1);
1269 fprintf(f, "%d\n", sizeof(time_t));
1270 exit(0);
1271}],
1272ac_cv_sizeof_time_t=`cat conftestval`,
1273ac_cv_sizeof_time_t=0,
1274ac_cv_sizeof_time_t=4)
1275])
1276AC_MSG_RESULT($ac_cv_sizeof_time_t)