/configure.in

http://unladen-swallow.googlecode.com/ · Autoconf · 4075 lines · 3121 code · 362 blank · 592 comment · 450 complexity · 8d20e9524266eeaf8629a3a36d18bef3 MD5 · raw file

Large files are truncated click here to view the full file

  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).
  5. # Set VERSION so we only need to edit in one place (i.e., here)
  6. m4_define(PYTHON_VERSION, 2.6)
  7. AC_REVISION($Revision: 75132 $)
  8. AC_PREREQ(2.61)
  9. AC_INIT(python, PYTHON_VERSION, http://www.python.org/python-bugs)
  10. AC_CONFIG_SRCDIR([Include/object.h])
  11. AC_CONFIG_HEADER(pyconfig.h)
  12. dnl This is for stuff that absolutely must end up in pyconfig.h.
  13. dnl Please use pyport.h instead, if possible.
  14. AH_TOP([
  15. #ifndef Py_PYCONFIG_H
  16. #define Py_PYCONFIG_H
  17. ])
  18. AH_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. #endif /*Py_PYCONFIG_H*/
  24. ])
  25. # We don't use PACKAGE_ variables, and they cause conflicts
  26. # with other autoconf-based packages that include Python.h
  27. grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
  28. rm confdefs.h
  29. mv confdefs.h.new confdefs.h
  30. AC_SUBST(VERSION)
  31. VERSION=PYTHON_VERSION
  32. AC_SUBST(SOVERSION)
  33. SOVERSION=1.0
  34. # The later defininition of _XOPEN_SOURCE disables certain features
  35. # on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
  36. AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
  37. # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
  38. # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
  39. # them.
  40. AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features])
  41. # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
  42. # certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
  43. # them.
  44. AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features])
  45. # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
  46. # u_int on Irix 5.3. Defining _BSD_TYPES brings it back.
  47. AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int])
  48. # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
  49. # certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
  50. # them.
  51. AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
  52. define_xopen_source=yes
  53. # Arguments passed to configure.
  54. AC_SUBST(CONFIG_ARGS)
  55. CONFIG_ARGS="$ac_configure_args"
  56. AC_ARG_ENABLE(universalsdk,
  57. AC_HELP_STRING(--enable-universalsdk@<:@=SDKDIR@:>@, Build against Mac OS X 10.4u SDK (ppc/i386)),
  58. [
  59. case $enableval in
  60. yes)
  61. enableval=/Developer/SDKs/MacOSX10.4u.sdk
  62. ;;
  63. esac
  64. case $enableval in
  65. no)
  66. UNIVERSALSDK=
  67. enable_universalsdk=
  68. ;;
  69. *)
  70. UNIVERSALSDK=$enableval
  71. ;;
  72. esac
  73. ],[
  74. UNIVERSALSDK=
  75. enable_universalsdk=
  76. ])
  77. AC_SUBST(UNIVERSALSDK)
  78. AC_SUBST(ARCH_RUN_32BIT)
  79. UNIVERSAL_ARCHS="32-bit"
  80. AC_MSG_CHECKING(for --with-universal-archs)
  81. AC_ARG_WITH(universal-archs,
  82. AC_HELP_STRING(--with-universal-archs=ARCH, select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")),
  83. [
  84. AC_MSG_RESULT($withval)
  85. UNIVERSAL_ARCHS="$withval"
  86. if test "${enable_universalsdk}" ; then
  87. :
  88. else
  89. AC_MSG_ERROR([--with-universal-archs without --enable-universalsdk. See Mac/README])
  90. fi
  91. ],
  92. [
  93. AC_MSG_RESULT(32-bit)
  94. ])
  95. AC_ARG_WITH(framework-name,
  96. AC_HELP_STRING(--with-framework-name=FRAMEWORK,
  97. specify an alternate name of the framework built with --enable-framework),
  98. [
  99. if test "${enable_framework}"; then
  100. :
  101. else
  102. AC_MSG_ERROR([--with-framework-name without --enable-framework. See Mac/README])
  103. fi
  104. PYTHONFRAMEWORK=${withval}
  105. PYTHONFRAMEWORKDIR=${withval}.framework
  106. PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
  107. ],[
  108. PYTHONFRAMEWORK=Python
  109. PYTHONFRAMEWORKDIR=Python.framework
  110. PYTHONFRAMEWORKIDENTIFIER=org.python.python
  111. ])
  112. dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
  113. AC_ARG_ENABLE(framework,
  114. AC_HELP_STRING(--enable-framework@<:@=INSTALLDIR@:>@, Build (MacOSX|Darwin) framework),
  115. [
  116. case $enableval in
  117. yes)
  118. enableval=/Library/Frameworks
  119. esac
  120. case $enableval in
  121. no)
  122. PYTHONFRAMEWORK=
  123. PYTHONFRAMEWORKDIR=no-framework
  124. PYTHONFRAMEWORKPREFIX=
  125. PYTHONFRAMEWORKINSTALLDIR=
  126. FRAMEWORKINSTALLFIRST=
  127. FRAMEWORKINSTALLLAST=
  128. FRAMEWORKALTINSTALLFIRST=
  129. FRAMEWORKALTINSTALLLAST=
  130. if test "x${prefix}" = "xNONE"; then
  131. FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
  132. else
  133. FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
  134. fi
  135. enable_framework=
  136. ;;
  137. *)
  138. PYTHONFRAMEWORKPREFIX=$enableval
  139. PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
  140. FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
  141. FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall"
  142. if test "$UNIVERSAL_ARCHS" = "all"
  143. then
  144. FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way"
  145. FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkaltinstallunixtools4way"
  146. else
  147. FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
  148. FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
  149. fi
  150. if test "x${prefix}" = "xNONE" ; then
  151. FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
  152. else
  153. FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
  154. fi
  155. prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
  156. # Add files for Mac specific code to the list of output
  157. # files:
  158. AC_CONFIG_FILES(Mac/Makefile)
  159. AC_CONFIG_FILES(Mac/PythonLauncher/Makefile)
  160. AC_CONFIG_FILES(Mac/IDLE/Makefile)
  161. AC_CONFIG_FILES(Mac/Resources/framework/Info.plist)
  162. AC_CONFIG_FILES(Mac/Resources/app/Info.plist)
  163. esac
  164. ],[
  165. PYTHONFRAMEWORK=
  166. PYTHONFRAMEWORKDIR=no-framework
  167. PYTHONFRAMEWORKPREFIX=
  168. PYTHONFRAMEWORKINSTALLDIR=
  169. FRAMEWORKINSTALLFIRST=
  170. FRAMEWORKINSTALLLAST=
  171. FRAMEWORKALTINSTALLFIRST=
  172. FRAMEWORKALTINSTALLLAST=
  173. if test "x${prefix}" = "xNONE" ; then
  174. FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
  175. else
  176. FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
  177. fi
  178. enable_framework=
  179. if test "$UNIVERSAL_ARCHS" = "all"
  180. then
  181. FRAMEWORKINSTALLLAST=update4wayuniversal
  182. FRAMEWORKALTINSTALLLAST=update4wayuniversal
  183. fi
  184. ])
  185. AC_SUBST(PYTHONFRAMEWORK)
  186. AC_SUBST(PYTHONFRAMEWORKIDENTIFIER)
  187. AC_SUBST(PYTHONFRAMEWORKDIR)
  188. AC_SUBST(PYTHONFRAMEWORKPREFIX)
  189. AC_SUBST(PYTHONFRAMEWORKINSTALLDIR)
  190. AC_SUBST(FRAMEWORKINSTALLFIRST)
  191. AC_SUBST(FRAMEWORKINSTALLLAST)
  192. AC_SUBST(FRAMEWORKALTINSTALLFIRST)
  193. AC_SUBST(FRAMEWORKALTINSTALLLAST)
  194. AC_SUBST(FRAMEWORKUNIXTOOLSPREFIX)
  195. ##AC_ARG_WITH(dyld,
  196. ## AC_HELP_STRING(--with-dyld,
  197. ## Use (OpenStep|Rhapsody) dynamic linker))
  198. ##
  199. # Set name for machine-dependent library files
  200. AC_SUBST(MACHDEP)
  201. AC_MSG_CHECKING(MACHDEP)
  202. if test -z "$MACHDEP"
  203. then
  204. ac_sys_system=`uname -s`
  205. if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \
  206. -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
  207. ac_sys_release=`uname -v`
  208. else
  209. ac_sys_release=`uname -r`
  210. fi
  211. ac_md_system=`echo $ac_sys_system |
  212. tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
  213. ac_md_release=`echo $ac_sys_release |
  214. tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
  215. MACHDEP="$ac_md_system$ac_md_release"
  216. case $MACHDEP in
  217. cygwin*) MACHDEP="cygwin";;
  218. darwin*) MACHDEP="darwin";;
  219. atheos*) MACHDEP="atheos";;
  220. irix646) MACHDEP="irix6";;
  221. '') MACHDEP="unknown";;
  222. esac
  223. fi
  224. # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
  225. # disable features if it is defined, without any means to access these
  226. # features as extensions. For these systems, we skip the definition of
  227. # _XOPEN_SOURCE. Before adding a system to the list to gain access to
  228. # some feature, make sure there is no alternative way to access this
  229. # feature. Also, when using wildcards, make sure you have verified the
  230. # need for not defining _XOPEN_SOURCE on all systems matching the
  231. # wildcard, and that the wildcard does not include future systems
  232. # (which may remove their limitations).
  233. dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
  234. case $ac_sys_system/$ac_sys_release in
  235. # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
  236. # even though select is a POSIX function. Reported by J. Ribbens.
  237. # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
  238. OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@)
  239. define_xopen_source=no
  240. # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is
  241. # also defined. This can be overridden by defining _BSD_SOURCE
  242. # As this has a different meaning on Linux, only define it on OpenBSD
  243. AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features])
  244. ;;
  245. # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of
  246. # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by
  247. # Marc Recht
  248. NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@)
  249. define_xopen_source=no;;
  250. # On Solaris 2.6, sys/wait.h is inconsistent in the usage
  251. # of union __?sigval. Reported by Stuart Bishop.
  252. SunOS/5.6)
  253. define_xopen_source=no;;
  254. # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
  255. # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
  256. # Reconfirmed for 7.1.4 by Martin v. Loewis.
  257. OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@)
  258. define_xopen_source=no;;
  259. # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
  260. # but used in struct sockaddr.sa_family. Reported by Tim Rice.
  261. SCO_SV/3.2)
  262. define_xopen_source=no;;
  263. # On FreeBSD 4, the math functions C89 does not cover are never defined
  264. # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them.
  265. FreeBSD/4.*)
  266. define_xopen_source=no;;
  267. # On MacOS X 10.2, a bug in ncurses.h means that it craps out if
  268. # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which
  269. # identifies itself as Darwin/7.*
  270. # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
  271. # disables platform specific features beyond repair.
  272. # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE
  273. # has no effect, don't bother defining them
  274. Darwin/@<:@6789@:>@.*)
  275. define_xopen_source=no;;
  276. # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but
  277. # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined
  278. # or has another value. By not (re)defining it, the defaults come in place.
  279. AIX/4)
  280. define_xopen_source=no;;
  281. AIX/5)
  282. if test `uname -r` -eq 1; then
  283. define_xopen_source=no
  284. fi
  285. ;;
  286. # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
  287. # defining NI_NUMERICHOST.
  288. QNX/6.3.2)
  289. define_xopen_source=no
  290. ;;
  291. esac
  292. if test $define_xopen_source = yes
  293. then
  294. # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be
  295. # defined precisely as g++ defines it
  296. # Furthermore, on Solaris 10, XPG6 requires the use of a C99
  297. # compiler
  298. case $ac_sys_system/$ac_sys_release in
  299. SunOS/5.8|SunOS/5.9|SunOS/5.10)
  300. AC_DEFINE(_XOPEN_SOURCE, 500,
  301. Define to the level of X/Open that your system supports)
  302. ;;
  303. *)
  304. AC_DEFINE(_XOPEN_SOURCE, 600,
  305. Define to the level of X/Open that your system supports)
  306. ;;
  307. esac
  308. # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
  309. # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else
  310. # several APIs are not declared. Since this is also needed in some
  311. # cases for HP-UX, we define it globally.
  312. # except for Solaris 10, where it must not be defined,
  313. # as it implies XPG4.2
  314. case $ac_sys_system/$ac_sys_release in
  315. SunOS/5.10)
  316. ;;
  317. *)
  318. AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
  319. Define to activate Unix95-and-earlier features)
  320. ;;
  321. esac
  322. AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
  323. fi
  324. #
  325. # SGI compilers allow the specification of the both the ABI and the
  326. # ISA on the command line. Depending on the values of these switches,
  327. # different and often incompatable code will be generated.
  328. #
  329. # The SGI_ABI variable can be used to modify the CC and LDFLAGS and
  330. # thus supply support for various ABI/ISA combinations. The MACHDEP
  331. # variable is also adjusted.
  332. #
  333. AC_SUBST(SGI_ABI)
  334. if test ! -z "$SGI_ABI"
  335. then
  336. CC="cc $SGI_ABI"
  337. LDFLAGS="$SGI_ABI $LDFLAGS"
  338. MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
  339. fi
  340. AC_MSG_RESULT($MACHDEP)
  341. # And add extra plat-mac for darwin
  342. AC_SUBST(EXTRAPLATDIR)
  343. AC_SUBST(EXTRAMACHDEPPATH)
  344. AC_MSG_CHECKING(EXTRAPLATDIR)
  345. if test -z "$EXTRAPLATDIR"
  346. then
  347. case $MACHDEP in
  348. darwin)
  349. EXTRAPLATDIR="\$(PLATMACDIRS)"
  350. EXTRAMACHDEPPATH="\$(PLATMACPATH)"
  351. ;;
  352. *)
  353. EXTRAPLATDIR=""
  354. EXTRAMACHDEPPATH=""
  355. ;;
  356. esac
  357. fi
  358. AC_MSG_RESULT($EXTRAPLATDIR)
  359. # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
  360. # it may influence the way we can build extensions, so distutils
  361. # needs to check it
  362. AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
  363. AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
  364. CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
  365. EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
  366. AC_MSG_CHECKING(machine type as reported by uname -m)
  367. ac_sys_machine=`uname -m`
  368. AC_MSG_RESULT($ac_sys_machine)
  369. # checks for alternative programs
  370. # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
  371. # for debug/optimization stuff. BASECFLAGS is for flags that are required
  372. # just to get things to compile and link. Users are free to override OPT
  373. # when running configure or make. The build should not break if they do.
  374. # BASECFLAGS should generally not be messed with, however.
  375. # XXX shouldn't some/most/all of this code be merged with the stuff later
  376. # on that fiddles with OPT and BASECFLAGS?
  377. AC_MSG_CHECKING(for --without-gcc)
  378. AC_ARG_WITH(gcc,
  379. AC_HELP_STRING(--without-gcc,never use gcc),
  380. [
  381. case $withval in
  382. no) CC=${CC:-cc}
  383. without_gcc=yes;;
  384. yes) CC=gcc
  385. without_gcc=no;;
  386. *) CC=$withval
  387. without_gcc=$withval;;
  388. esac], [
  389. case $ac_sys_system in
  390. AIX*) CC=cc_r
  391. without_gcc=;;
  392. BeOS*)
  393. case $BE_HOST_CPU in
  394. ppc)
  395. CC=mwcc
  396. without_gcc=yes
  397. BASECFLAGS="$BASECFLAGS -export pragma"
  398. OPT="$OPT -O"
  399. LDFLAGS="$LDFLAGS -nodup"
  400. ;;
  401. x86)
  402. CC=gcc
  403. without_gcc=no
  404. OPT="$OPT -O"
  405. ;;
  406. *)
  407. AC_MSG_ERROR([Unknown BeOS platform "$BE_HOST_CPU"])
  408. ;;
  409. esac
  410. AR="\$(srcdir)/Modules/ar_beos"
  411. RANLIB=:
  412. ;;
  413. Monterey*)
  414. RANLIB=:
  415. without_gcc=;;
  416. *) without_gcc=no;;
  417. esac])
  418. AC_MSG_RESULT($without_gcc)
  419. # If the user switches compilers, we can't believe the cache
  420. if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
  421. then
  422. AC_MSG_ERROR([cached CC is different -- throw away $cache_file
  423. (it is also a good idea to do 'make clean' before compiling)])
  424. fi
  425. # Check for --with-llvm=DIRECTORY or --without-llvm.
  426. #
  427. # Check for this really early so we can use it to toggle LINKCC.
  428. #
  429. # Expected behaviour:
  430. # - Omit --with-llvm: use llvm-config we find in the path or $LLVM_CONFIG
  431. # - --with-llvm (no DIRECTORY): Same
  432. # - --with-llvm=DIRECTORY: use the LLVM installed in DIRECTORY
  433. # - --without-llvm: disable everything that requires LLVM
  434. dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
  435. AC_ARG_VAR(LLVM_CONFIG, [LLVM configuration script])
  436. AC_MSG_CHECKING(for --with(out)-llvm)
  437. AC_ARG_WITH(llvm,
  438. AC_HELP_STRING(--with(out)-llvm@<:@=DIRECTORY@:>@,
  439. build against a preinstalled LLVM
  440. or disable LLVM integration entirely. Note that
  441. Python built with --without-llvm cannot load
  442. extension modules built with --with-llvm or
  443. vice-versa.),
  444. [with_llvm=$withval],
  445. [with_llvm=yes])
  446. if test "$with_llvm" = "no"
  447. then
  448. AC_MSG_RESULT(disabled)
  449. WITH_LLVM=0
  450. else
  451. AC_MSG_RESULT($with_llvm)
  452. WITH_LLVM=1
  453. if test "$with_llvm" = "yes"
  454. then
  455. AC_PATH_PROG(LLVM_CONFIG, llvm-config)
  456. if test -z "$LLVM_CONFIG"
  457. then
  458. AC_MSG_ERROR([cannot find llvm-config on the PATH])
  459. fi
  460. else
  461. AC_PATH_PROG(LLVM_CONFIG, llvm-config, [], [$with_llvm/bin])
  462. if test -z "$LLVM_CONFIG"
  463. then
  464. AC_MSG_ERROR([cannot find llvm-config in $with_llvm/bin])
  465. fi
  466. fi
  467. LLVM_INC_DIR=`$LLVM_CONFIG --includedir`
  468. LLVM_BIN_DIR=`$LLVM_CONFIG --bindir`
  469. LLVM_CXXFLAGS=`$LLVM_CONFIG jit bitreader backend --cxxflags`
  470. LLVM_LDFLAGS=`$LLVM_CONFIG jit bitreader backend --ldflags --libs | awk '{ORS=" "} {print $0}'`
  471. LLVM_LIB_PATHS=`$LLVM_CONFIG jit bitreader backend --libfiles`
  472. AC_CHECK_FILE("$LLVM_BIN_DIR/clang",
  473. [], [AC_MSG_ERROR([Did not find clang in $LLVM_BIN_DIR])])
  474. AC_CHECK_FILE("$LLVM_BIN_DIR/opt",
  475. [], [AC_MSG_ERROR([Did not find opt in $LLVM_BIN_DIR])])
  476. AC_CHECK_FILE("$LLVM_BIN_DIR/llvm-link",
  477. [], [AC_MSG_ERROR([Did not find llvm-link in $LLVM_BIN_DIR])])
  478. AC_CHECK_FILE("$LLVM_BIN_DIR/llvm-dis",
  479. [], [AC_MSG_ERROR([Did not find llvm-dis in $LLVM_BIN_DIR])])
  480. AC_DEFINE(WITH_LLVM, 1,
  481. [Use LLVM for code generation. This makes things fast.])
  482. fi
  483. AC_SUBST(WITH_LLVM)
  484. AC_SUBST(LLVM_INC_DIR)
  485. AC_SUBST(LLVM_BIN_DIR)
  486. AC_SUBST(LLVM_CXXFLAGS)
  487. AC_SUBST(LLVM_LDFLAGS)
  488. AC_SUBST(LLVM_LIB_PATHS)
  489. save_CFLAGS=$CFLAGS
  490. AC_PROG_CC
  491. CFLAGS=$save_CFLAGS
  492. AC_SUBST(CXX)
  493. AC_SUBST(MAINCC)
  494. AC_MSG_CHECKING(for --with-cxx-main=<compiler>)
  495. AC_ARG_WITH(cxx_main,
  496. AC_HELP_STRING([--with-cxx-main=<compiler>],
  497. [compile main() and link python executable with C++ compiler]),
  498. [
  499. case $withval in
  500. no) with_cxx_main=no
  501. MAINCC='$(CC)';;
  502. yes) with_cxx_main=yes
  503. MAINCC='$(CXX)';;
  504. *) with_cxx_main=yes
  505. MAINCC=$withval
  506. if test -z "$CXX"
  507. then
  508. CXX=$withval
  509. fi;;
  510. esac
  511. ], [
  512. case "$with_llvm" in
  513. no) with_cxx_main=no
  514. MAINCC='$(CC)';;
  515. *) with_cxx_main=yes
  516. MAINCC='$(CXX)';;
  517. esac
  518. ])
  519. AC_MSG_RESULT($with_cxx_main)
  520. if test "$with_cxx_main" = "no"
  521. then
  522. if test "$with_llvm" != "no"
  523. then
  524. AC_MSG_ERROR("Cannot specify both --without-cxx-main and --with-llvm");
  525. fi
  526. fi
  527. # Use this in preference to AC_PROG_CXX, since --with-cxx-main=foo will override
  528. # CXX.
  529. preset_cxx="$CXX"
  530. if test -z "$CXX"
  531. then
  532. case "$CC" in
  533. gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
  534. cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
  535. esac
  536. if test "$CXX" = "notfound"
  537. then
  538. CXX=""
  539. fi
  540. fi
  541. if test -z "$CXX"
  542. then
  543. AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
  544. if test "$CXX" = "notfound"
  545. then
  546. CXX=""
  547. fi
  548. fi
  549. if test "$preset_cxx" != "$CXX"
  550. then
  551. AC_MSG_WARN([
  552. By default, distutils will build C++ extension modules with "$CXX".
  553. If this is not intended, then set CXX on the configure command line.
  554. ])
  555. fi
  556. # checks for UNIX variants that set C preprocessor variables
  557. AC_AIX
  558. # Check for unsupported systems
  559. case $ac_sys_system/$ac_sys_release in
  560. atheos*|Linux*/1*)
  561. echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
  562. echo See README for details.
  563. exit 1;;
  564. esac
  565. AC_EXEEXT
  566. AC_MSG_CHECKING(for --with-suffix)
  567. AC_ARG_WITH(suffix,
  568. AC_HELP_STRING(--with-suffix=.exe, set executable suffix),
  569. [
  570. case $withval in
  571. no) EXEEXT=;;
  572. yes) EXEEXT=.exe;;
  573. *) EXEEXT=$withval;;
  574. esac])
  575. AC_MSG_RESULT($EXEEXT)
  576. # Test whether we're running on a non-case-sensitive system, in which
  577. # case we give a warning if no ext is given
  578. AC_SUBST(BUILDEXEEXT)
  579. AC_MSG_CHECKING(for case-insensitive build directory)
  580. if test ! -d CaseSensitiveTestDir; then
  581. mkdir CaseSensitiveTestDir
  582. fi
  583. if test -d casesensitivetestdir
  584. then
  585. AC_MSG_RESULT(yes)
  586. BUILDEXEEXT=.exe
  587. else
  588. AC_MSG_RESULT(no)
  589. BUILDEXEEXT=$EXEEXT
  590. fi
  591. rmdir CaseSensitiveTestDir
  592. case $MACHDEP in
  593. bsdos*)
  594. case $CC in
  595. gcc) CC="$CC -D_HAVE_BSDI";;
  596. esac;;
  597. esac
  598. case $ac_sys_system in
  599. hp*|HP*)
  600. case $CC in
  601. cc|*/cc) CC="$CC -Ae";;
  602. esac;;
  603. Monterey*)
  604. case $CC in
  605. cc) CC="$CC -Wl,-Bexport";;
  606. esac;;
  607. SunOS*)
  608. # Some functions have a prototype only with that define, e.g. confstr
  609. AC_DEFINE(__EXTENSIONS__, 1, [Defined on Solaris to see additional function prototypes.])
  610. ;;
  611. esac
  612. AC_SUBST(LIBRARY)
  613. AC_MSG_CHECKING(LIBRARY)
  614. if test -z "$LIBRARY"
  615. then
  616. LIBRARY='libpython$(VERSION).a'
  617. fi
  618. AC_MSG_RESULT($LIBRARY)
  619. # LDLIBRARY is the name of the library to link against (as opposed to the
  620. # name of the library into which to insert object files). BLDLIBRARY is also
  621. # the library to link against, usually. On Mac OS X frameworks, BLDLIBRARY
  622. # is blank as the main program is not linked directly against LDLIBRARY.
  623. # LDLIBRARYDIR is the path to LDLIBRARY, which is made in a subdirectory. On
  624. # systems without shared libraries, LDLIBRARY is the same as LIBRARY
  625. # (defined in the Makefiles). On Cygwin LDLIBRARY is the import library,
  626. # DLLLIBRARY is the shared (i.e., DLL) library.
  627. #
  628. # RUNSHARED is used to run shared python without installed libraries
  629. #
  630. # INSTSONAME is the name of the shared library that will be use to install
  631. # on the system - some systems like version suffix, others don't
  632. AC_SUBST(LDLIBRARY)
  633. AC_SUBST(DLLLIBRARY)
  634. AC_SUBST(BLDLIBRARY)
  635. AC_SUBST(LDLIBRARYDIR)
  636. AC_SUBST(INSTSONAME)
  637. AC_SUBST(RUNSHARED)
  638. LDLIBRARY="$LIBRARY"
  639. BLDLIBRARY='$(LDLIBRARY)'
  640. INSTSONAME='$(LDLIBRARY)'
  641. DLLLIBRARY=''
  642. LDLIBRARYDIR=''
  643. RUNSHARED=''
  644. # LINKCC is the command that links the python executable -- this depends on
  645. # the values of --with-llvm and --with-cxx-main.
  646. # This is altered for AIX in order to build the export list before
  647. # linking. If --without-llvm was specified, we use $(CC) to avoid depending on
  648. # libstdc++.
  649. AC_SUBST(LINKCC)
  650. AC_MSG_CHECKING(LINKCC)
  651. if test -z "$LINKCC"
  652. then
  653. LINKCC='$(PURIFY) $(MAINCC)'
  654. case $ac_sys_system in
  655. AIX*)
  656. exp_extra="\"\""
  657. if test $ac_sys_release -ge 5 -o \
  658. $ac_sys_release -eq 4 -a `uname -r` -ge 2 ; then
  659. exp_extra="."
  660. fi
  661. LINKCC="\$(srcdir)/Modules/makexp_aix Modules/python.exp $exp_extra \$(LIBRARY); $LINKCC";;
  662. Monterey64*)
  663. LINKCC="$LINKCC -L/usr/lib/ia64l64";;
  664. QNX*)
  665. # qcc must be used because the other compilers do not
  666. # support -N.
  667. LINKCC=qcc;;
  668. esac
  669. fi
  670. AC_MSG_RESULT($LINKCC)
  671. AC_MSG_CHECKING(for --enable-shared)
  672. AC_ARG_ENABLE(shared,
  673. AC_HELP_STRING(--enable-shared, disable/enable building shared python library))
  674. if test -z "$enable_shared"
  675. then
  676. case $ac_sys_system in
  677. CYGWIN* | atheos*)
  678. enable_shared="yes";;
  679. *)
  680. enable_shared="no";;
  681. esac
  682. fi
  683. AC_MSG_RESULT($enable_shared)
  684. AC_MSG_CHECKING(for --enable-profiling)
  685. AC_ARG_ENABLE(profiling,
  686. AC_HELP_STRING(--enable-profiling, enable C-level code profiling),
  687. [ac_save_cc="$CC"
  688. CC="$CC -pg"
  689. AC_TRY_RUN([int main() { return 0; }],
  690. ac_enable_profiling="yes",
  691. ac_enable_profiling="no",
  692. ac_enable_profiling="no")
  693. CC="$ac_save_cc"])
  694. AC_MSG_RESULT($ac_enable_profiling)
  695. case "$ac_enable_profiling" in
  696. "yes")
  697. BASECFLAGS="-pg $BASECFLAGS"
  698. LDFLAGS="-pg $LDFLAGS"
  699. ;;
  700. esac
  701. AC_MSG_CHECKING(LDLIBRARY)
  702. # MacOSX framework builds need more magic. LDLIBRARY is the dynamic
  703. # library that we build, but we do not want to link against it (we
  704. # will find it with a -framework option). For this reason there is an
  705. # extra variable BLDLIBRARY against which Python and the extension
  706. # modules are linked, BLDLIBRARY. This is normally the same as
  707. # LDLIBRARY, but empty for MacOSX framework builds.
  708. if test "$enable_framework"
  709. then
  710. LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
  711. RUNSHARED=DYLD_FRAMEWORK_PATH="$(shell pwd):$DYLD_FRAMEWORK_PATH"
  712. BLDLIBRARY=''
  713. else
  714. BLDLIBRARY='$(LDLIBRARY)'
  715. fi
  716. # Other platforms follow
  717. if test $enable_shared = "yes"; then
  718. AC_DEFINE(Py_ENABLE_SHARED, 1, [Defined if Python is built as a shared library.])
  719. case $ac_sys_system in
  720. BeOS*)
  721. LDLIBRARY='libpython$(VERSION).so'
  722. ;;
  723. CYGWIN*)
  724. LDLIBRARY='libpython$(VERSION).dll.a'
  725. DLLLIBRARY='libpython$(VERSION).dll'
  726. ;;
  727. SunOS*)
  728. LDLIBRARY='libpython$(VERSION).so'
  729. BLDLIBRARY='-Wl,-R,$(LIBDIR) -L. -lpython$(VERSION)'
  730. RUNSHARED='LD_LIBRARY_PATH=$(shell pwd):${LD_LIBRARY_PATH}'
  731. INSTSONAME="$LDLIBRARY".$SOVERSION
  732. ;;
  733. Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*)
  734. LDLIBRARY='libpython$(VERSION).so'
  735. BLDLIBRARY='-L. -lpython$(VERSION)'
  736. RUNSHARED='LD_LIBRARY_PATH=$(shell pwd):${LD_LIBRARY_PATH}'
  737. case $ac_sys_system in
  738. FreeBSD*)
  739. SOVERSION=`echo $SOVERSION|cut -d "." -f 1`
  740. ;;
  741. esac
  742. INSTSONAME="$LDLIBRARY".$SOVERSION
  743. ;;
  744. hp*|HP*)
  745. case `uname -m` in
  746. ia64)
  747. LDLIBRARY='libpython$(VERSION).so'
  748. ;;
  749. *)
  750. LDLIBRARY='libpython$(VERSION).sl'
  751. ;;
  752. esac
  753. BLDLIBRARY='-Wl,+b,$(LIBDIR) -L. -lpython$(VERSION)'
  754. RUNSHARED='SHLIB_PATH=$(shell pwd):${SHLIB_PATH}'
  755. ;;
  756. OSF*)
  757. LDLIBRARY='libpython$(VERSION).so'
  758. BLDLIBRARY='-rpath $(LIBDIR) -L. -lpython$(VERSION)'
  759. RUNSHARED='LD_LIBRARY_PATH=$(shell pwd):${LD_LIBRARY_PATH}'
  760. ;;
  761. atheos*)
  762. LDLIBRARY='libpython$(VERSION).so'
  763. BLDLIBRARY='-L. -lpython$(VERSION)'
  764. RUNSHARED='DLL_PATH=$(shell pwd):${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}'
  765. ;;
  766. Darwin*)
  767. LDLIBRARY='libpython$(VERSION).dylib'
  768. BLDLIBRARY='-L. -lpython$(VERSION)'
  769. RUNSHARED='DYLD_LIBRARY_PATH=$(shell pwd):${DYLD_LIBRARY_PATH}'
  770. ;;
  771. esac
  772. else # shared is disabled
  773. case $ac_sys_system in
  774. CYGWIN*)
  775. BLDLIBRARY='$(LIBRARY)'
  776. LDLIBRARY='libpython$(VERSION).dll.a'
  777. ;;
  778. esac
  779. fi
  780. AC_MSG_RESULT($LDLIBRARY)
  781. AC_PROG_RANLIB
  782. AC_SUBST(AR)
  783. AC_CHECK_PROGS(AR, ar aal, ar)
  784. AC_SUBST(SVNVERSION)
  785. AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found)
  786. if test $SVNVERSION = found
  787. then
  788. SVNVERSION="svnversion \$(srcdir)"
  789. else
  790. SVNVERSION="echo Unversioned directory"
  791. fi
  792. case $MACHDEP in
  793. bsdos*|hp*|HP*)
  794. # install -d does not work on BSDI or HP-UX
  795. if test -z "$INSTALL"
  796. then
  797. INSTALL="${srcdir}/install-sh -c"
  798. fi
  799. esac
  800. AC_PROG_INSTALL
  801. # Not every filesystem supports hard links
  802. AC_SUBST(LN)
  803. if test -z "$LN" ; then
  804. case $ac_sys_system in
  805. BeOS*) LN="ln -s";;
  806. CYGWIN*) LN="ln -s";;
  807. atheos*) LN="ln -s";;
  808. *) LN=ln;;
  809. esac
  810. fi
  811. # Check for --with-pydebug
  812. AC_MSG_CHECKING(for --with-pydebug)
  813. AC_ARG_WITH(pydebug,
  814. AC_HELP_STRING(--with-pydebug, build with Py_DEBUG defined),
  815. [
  816. if test "$withval" != no
  817. then
  818. AC_DEFINE(Py_DEBUG, 1,
  819. [Define if you want to build an interpreter with many run-time checks.])
  820. AC_MSG_RESULT(yes);
  821. Py_DEBUG='true'
  822. else AC_MSG_RESULT(no); Py_DEBUG='false'
  823. fi],
  824. [AC_MSG_RESULT(no)])
  825. if test "$with_llvm" != "no"
  826. then
  827. LLVM_BUILD_MODE=`$LLVM_CONFIG --build-mode`
  828. if echo $LLVM_BUILD_MODE | grep -e -Asserts &>/dev/null
  829. then
  830. if test "$Py_DEBUG" = "true"
  831. then
  832. AC_MSG_ERROR([--with-pydebug requires +Asserts LLVM. Got "$LLVM_BUILD_MODE"])
  833. fi
  834. else
  835. if test "$Py_DEBUG" != "true"
  836. then
  837. AC_MSG_ERROR([--without-pydebug requires -Asserts LLVM. Got "$LLVM_BUILD_MODE"])
  838. fi
  839. fi
  840. fi
  841. # XXX Shouldn't the code above that fiddles with BASECFLAGS and OPT be
  842. # merged with this chunk of code?
  843. # Optimizer/debugger flags
  844. # ------------------------
  845. # (The following bit of code is complicated enough - please keep things
  846. # indented properly. Just pretend you're editing Python code. ;-)
  847. # There are two parallel sets of case statements below, one that checks to
  848. # see if OPT was set and one that does BASECFLAGS setting based upon
  849. # compiler and platform. BASECFLAGS tweaks need to be made even if the
  850. # user set OPT.
  851. # tweak OPT based on compiler and platform, only if the user didn't set
  852. # it on the command line
  853. AC_SUBST(OPT)
  854. if test -z "$OPT"
  855. then
  856. case $GCC in
  857. yes)
  858. case $ac_cv_prog_cc_g in
  859. yes)
  860. if test "$Py_DEBUG" = 'true' ; then
  861. # Optimization messes up debuggers, so turn it off for
  862. # debug builds.
  863. OPT="-g"
  864. else
  865. OPT="-g -O3"
  866. fi
  867. ;;
  868. *)
  869. OPT="-O3"
  870. ;;
  871. esac
  872. case $ac_sys_system in
  873. SCO_SV*) OPT="$OPT -m486 -DSCO5"
  874. ;;
  875. esac
  876. ;;
  877. *)
  878. OPT="-O"
  879. ;;
  880. esac
  881. # The current (beta) Monterey compiler dies with optimizations
  882. # XXX what is Monterey? Does it still die w/ -O? Can we get rid of this?
  883. case $ac_sys_system in
  884. Monterey*)
  885. OPT=""
  886. ;;
  887. esac
  888. fi
  889. AC_SUBST(BASECFLAGS)
  890. # The -arch flags for universal builds on OSX
  891. UNIVERSAL_ARCH_FLAGS=
  892. AC_SUBST(UNIVERSAL_ARCH_FLAGS)
  893. # tweak BASECFLAGS based on compiler and platform
  894. case $GCC in
  895. yes)
  896. # Python violates C99 rules, by casting between incompatible
  897. # pointer types. GCC may generate bad code as a result of that,
  898. # so use -fno-strict-aliasing if supported.
  899. AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing)
  900. ac_save_cc="$CC"
  901. CC="$CC -fno-strict-aliasing"
  902. AC_TRY_RUN([int main() { return 0; }],
  903. ac_cv_no_strict_aliasing_ok=yes,
  904. ac_cv_no_strict_aliasing_ok=no,
  905. ac_cv_no_strict_aliasing_ok=no)
  906. CC="$ac_save_cc"
  907. AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok)
  908. if test $ac_cv_no_strict_aliasing_ok = yes
  909. then
  910. BASECFLAGS="$BASECFLAGS -fno-strict-aliasing"
  911. fi
  912. # Python violates C99 rules by treating signed overflow as
  913. # 2s-compliment. GCC 4+ can generate bad code because of that, so
  914. # use -fwrapv if it's supported
  915. AC_MSG_CHECKING(whether $CC accepts -fwrapv)
  916. ac_save_cc="$CC"
  917. CC="$CC -fwrapv"
  918. AC_TRY_RUN([int main() { return 0; }],
  919. ac_cv_fwrapv_ok=yes,
  920. ac_cv_fwrapv_ok=no,
  921. ac_cv_fwrapv_ok=no)
  922. CC="$ac_save_cc"
  923. AC_MSG_RESULT($ac_cv_fwrapv_ok)
  924. if test $ac_cv_fwrapv_ok = yes
  925. then
  926. BASECFLAGS="$BASECFLAGS -fwrapv"
  927. fi
  928. BASECFLAGS="$BASECFLAGS -Wall"
  929. if test "$CC" != 'g++' ; then
  930. STRICT_PROTO="-Wstrict-prototypes"
  931. 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
  940. case $ac_sys_system in
  941. SCO_SV*)
  942. BASECFLAGS="$BASECFLAGS -m486 -DSCO5"
  943. ;;
  944. # is there any other compiler on Darwin besides gcc?
  945. Darwin*)
  946. # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd
  947. # used to be here, but non-Apple gcc doesn't accept them.
  948. if test "${enable_universalsdk}"; then
  949. UNIVERSAL_ARCH_FLAGS=""
  950. if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
  951. UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
  952. ARCH_RUN_32BIT=""
  953. elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
  954. UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
  955. ARCH_RUN_32BIT="true"
  956. elif test "$UNIVERSAL_ARCHS" = "all" ; then
  957. UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
  958. ARCH_RUN_32BIT="arch -i386 -ppc"
  959. elif test "$UNIVERSAL_ARCHS" = "intel" ; then
  960. UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64"
  961. ARCH_RUN_32BIT="arch -i386"
  962. elif test "$UNIVERSAL_ARCHS" = "3-way" ; then
  963. UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64"
  964. ARCH_RUN_32BIT="arch -i386 -ppc"
  965. else
  966. AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way])
  967. fi
  968. BASECFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${BASECFLAGS}"
  969. tgt=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
  970. if test "${UNIVERSALSDK}" != "/" -a "${tgt}" '>' '10.4' ; then
  971. CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}"
  972. fi
  973. fi
  974. # Calculate the right deployment target for this build.
  975. #
  976. cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
  977. if test ${cur_target} '>' 10.2; then
  978. cur_target=10.3
  979. if test ${enable_universalsdk}; then
  980. if test "${UNIVERSAL_ARCHS}" = "all"; then
  981. # Ensure that the default platform for a
  982. # 4-way universal build is OSX 10.5,
  983. # that's the first OS release where
  984. # 4-way builds make sense.
  985. cur_target='10.5'
  986. elif test "${UNIVERSAL_ARCHS}" = "3-way"; then
  987. cur_target='10.5'
  988. elif test "${UNIVERSAL_ARCHS}" = "intel"; then
  989. cur_target='10.5'
  990. elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then
  991. cur_target='10.5'
  992. fi
  993. else
  994. if test `arch` = "i386"; then
  995. # On Intel macs default to a deployment
  996. # target of 10.4, that's the first OSX
  997. # release with Intel support.
  998. cur_target="10.4"
  999. fi
  1000. fi
  1001. fi
  1002. CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
  1003. # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
  1004. # environment with a value that is the same as what we'll use
  1005. # in the Makefile to ensure that we'll get the same compiler
  1006. # environment during configure and build time.
  1007. MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
  1008. export MACOSX_DEPLOYMENT_TARGET
  1009. EXPORT_MACOSX_DEPLOYMENT_TARGET=''
  1010. ;;
  1011. OSF*)
  1012. BASECFLAGS="$BASECFLAGS -mieee"
  1013. ;;
  1014. esac
  1015. ;;
  1016. *)
  1017. case $ac_sys_system in
  1018. OpenUNIX*|UnixWare*)
  1019. BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca "
  1020. ;;
  1021. OSF*)
  1022. BASECFLAGS="$BASECFLAGS -ieee -std"
  1023. ;;
  1024. SCO_SV*)
  1025. BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5"
  1026. ;;
  1027. esac
  1028. ;;
  1029. esac
  1030. if test "$Py_DEBUG" = 'true'; then
  1031. :
  1032. else
  1033. OPT="-DNDEBUG $OPT"
  1034. fi
  1035. if test "$ac_arch_flags"
  1036. then
  1037. BASECFLAGS="$BASECFLAGS $ac_arch_flags"
  1038. fi
  1039. # disable check for icc since it seems to pass, but generates a warning
  1040. if test "$CC" = icc
  1041. then
  1042. ac_cv_opt_olimit_ok=no
  1043. fi
  1044. AC_MSG_CHECKING(whether $CC accepts -OPT:Olimit=0)
  1045. AC_CACHE_VAL(ac_cv_opt_olimit_ok,
  1046. [ac_save_cc="$CC"
  1047. CC="$CC -OPT:Olimit=0"
  1048. AC_TRY_RUN([int main() { return 0; }],
  1049. ac_cv_opt_olimit_ok=yes,
  1050. ac_cv_opt_olimit_ok=no,
  1051. ac_cv_opt_olimit_ok=no)
  1052. CC="$ac_save_cc"])
  1053. AC_MSG_RESULT($ac_cv_opt_olimit_ok)
  1054. if test $ac_cv_opt_olimit_ok = yes; then
  1055. case $ac_sys_system in
  1056. # XXX is this branch needed? On MacOSX 10.2.2 the result of the
  1057. # olimit_ok test is "no". Is it "yes" in some other Darwin-esque
  1058. # environment?
  1059. Darwin*)
  1060. ;;
  1061. *)
  1062. BASECFLAGS="$BASECFLAGS -OPT:Olimit=0"
  1063. ;;
  1064. esac
  1065. else
  1066. AC_MSG_CHECKING(whether $CC accepts -Olimit 1500)
  1067. AC_CACHE_VAL(ac_cv_olimit_ok,
  1068. [ac_save_cc="$CC"
  1069. CC="$CC -Olimit 1500"
  1070. AC_TRY_RUN([int main() { return 0; }],
  1071. ac_cv_olimit_ok=yes,
  1072. ac_cv_olimit_ok=no,
  1073. ac_cv_olimit_ok=no)
  1074. CC="$ac_save_cc"])
  1075. AC_MSG_RESULT($ac_cv_olimit_ok)
  1076. if test $ac_cv_olimit_ok = yes; then
  1077. BASECFLAGS="$BASECFLAGS -Olimit 1500"
  1078. fi
  1079. fi
  1080. # Check whether GCC supports PyArg_ParseTuple format
  1081. if test "$GCC" = "yes"
  1082. then
  1083. AC_MSG_CHECKING(whether gcc supports ParseTuple __format__)
  1084. save_CFLAGS=$CFLAGS
  1085. CFLAGS="$CFLAGS -Werror"
  1086. AC_TRY_COMPILE([
  1087. void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));
  1088. ],,
  1089. AC_DEFINE(HAVE_ATTRIBUTE_FORMAT_PARSETUPLE, 1, [Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3)))])
  1090. AC_MSG_RESULT(yes),
  1091. AC_MSG_RESULT(no)
  1092. )
  1093. CFLAGS=$save_CFLAGS
  1094. fi
  1095. # On some compilers, pthreads are available without further options
  1096. # (e.g. MacOS X). On some of these systems, the compiler will not
  1097. # complain if unaccepted options are passed (e.g. gcc on Mac OS X).
  1098. # So we have to see first whether pthreads are available without
  1099. # options before we can check whether -Kpthread improves anything.
  1100. AC_MSG_CHECKING(whether pthreads are available without options)
  1101. AC_CACHE_VAL(ac_cv_pthread_is_default,
  1102. [AC_TRY_RUN([
  1103. #include <pthread.h>
  1104. void* routine(void* p){return NULL;}
  1105. int main(){
  1106. pthread_t p;
  1107. if(pthread_create(&p,NULL,routine,NULL)!=0)
  1108. return 1;
  1109. (void)pthread_detach(p);
  1110. return 0;
  1111. }
  1112. ],
  1113. [
  1114. ac_cv_pthread_is_default=yes
  1115. ac_cv_kthread=no
  1116. ac_cv_pthread=no
  1117. ],
  1118. ac_cv_pthread_is_default=no,
  1119. ac_cv_pthread_is_default=no)
  1120. ])
  1121. AC_MSG_RESULT($ac_cv_pthread_is_default)
  1122. if test $ac_cv_pthread_is_default = yes
  1123. then
  1124. ac_cv_kpthread=no
  1125. else
  1126. # -Kpthread, if available, provides the right #defines
  1127. # and linker options to make pthread_create available
  1128. # Some compilers won't report that they do not support -Kpthread,
  1129. # so we need to run a program to see whether it really made the
  1130. # function available.
  1131. AC_MSG_CHECKING(whether $CC accepts -Kpthread)
  1132. AC_CACHE_VAL(ac_cv_kpthread,
  1133. [ac_save_cc="$CC"
  1134. CC="$CC -Kpthread"
  1135. AC_TRY_RUN([
  1136. #include <pthread.h>
  1137. void* routine(void* p){return NULL;}
  1138. int main(){
  1139. pthread_t p;
  1140. if(pthread_create(&p,NULL,routine,NULL)!=0)
  1141. return 1;
  1142. (void)pthread_detach(p);
  1143. return 0;
  1144. }
  1145. ],
  1146. ac_cv_kpthread=yes,
  1147. ac_cv_kpthread=no,
  1148. ac_cv_kpthread=no)
  1149. CC="$ac_save_cc"])
  1150. AC_MSG_RESULT($ac_cv_kpthread)
  1151. fi
  1152. if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no
  1153. then
  1154. # -Kthread, 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 -Kthread,
  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 -Kthread)
  1160. AC_CACHE_VAL(ac_cv_kthread,
  1161. [ac_save_cc="$CC"
  1162. CC="$CC -Kthread"
  1163. AC_TRY_RUN([
  1164. #include <pthread.h>
  1165. void* routine(void* p){return NULL;}
  1166. int main(){
  1167. pthread_t p;
  1168. if(pthread_create(&p,NULL,routine,NULL)!=0)
  1169. return 1;
  1170. (void)pthread_detach(p);
  1171. return 0;
  1172. }
  1173. ],
  1174. ac_cv_kthread=yes,
  1175. ac_cv_kthread=no,
  1176. ac_cv_kthread=no)
  1177. CC="$ac_save_cc"])
  1178. AC_MSG_RESULT($ac_cv_kthread)
  1179. fi
  1180. if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no
  1181. then
  1182. # -pthread, if available, provides the right #defines
  1183. # and linker options to make pthread_create available
  1184. # Some compilers won't report that they do not support -pthread,
  1185. # so we need to run a program to see whether it really made the
  1186. # function available.
  1187. AC_MSG_CHECKING(whether $CC accepts -pthread)
  1188. AC_CACHE_VAL(ac_cv_thread,
  1189. [ac_save_cc="$CC"
  1190. CC="$CC -pthread"
  1191. AC_TRY_RUN([
  1192. #include <pthread.h>
  1193. void* routine(void* p){return NULL;}
  1194. int main(){
  1195. pthread_t p;
  1196. if(pthread_create(&p,NULL,routine,NULL)!=0)
  1197. return 1;
  1198. (void)pthread_detach(p);
  1199. return 0;
  1200. }
  1201. ],
  1202. ac_cv_pthread=yes,
  1203. ac_cv_pthread=no,
  1204. ac_cv_pthread=no)
  1205. CC="$ac_save_cc"])
  1206. AC_MSG_RESULT($ac_cv_pthread)
  1207. fi
  1208. # If we have set a CC compiler flag for thread support then
  1209. # check if it works for CXX, too.
  1210. ac_cv_cxx_thread=no
  1211. if test ! -z "$CXX"
  1212. then
  1213. AC_MSG_CHECKING(whether $CXX also accepts flags for thread support)
  1214. ac_save_cxx="$CXX"
  1215. if test "$ac_cv_kpthread" = "yes"
  1216. then
  1217. CXX="$CXX -Kpthread"
  1218. ac_cv_cxx_thread=yes
  1219. elif test "$ac_cv_kthread" = "yes"
  1220. then
  1221. CXX="$CXX -Kthread"
  1222. ac_cv_cxx_thread=yes
  1223. elif test "$ac_cv_pthread" = "yes"
  1224. then
  1225. CXX="$CXX -pthread"
  1226. ac_cv_cxx_thread=yes
  1227. fi
  1228. if test $ac_cv_cxx_thread = yes
  1229. then
  1230. echo 'void foo();int main(){foo();}void foo(){}' > conftest.$ac_ext
  1231. $CXX -c conftest.$ac_ext 2>&5
  1232. if $CXX -o conftest$ac_exeext conftest.$ac_objext 2>&5 \
  1233. && test -s conftest$ac_exeext && ./conftest$ac_exeext
  1234. then
  1235. ac_cv_cxx_thread=yes
  1236. else
  1237. ac_cv_cxx_thread=no
  1238. fi
  1239. rm -fr conftest*
  1240. fi
  1241. AC_MSG_RESULT($ac_cv_cxx_thread)
  1242. fi
  1243. CXX="$ac_save_cxx"
  1244. dnl # check for ANSI or K&R ("traditional") preprocessor
  1245. dnl AC_MSG_CHECKING(for C preprocessor type)
  1246. dnl AC_TRY_COMPILE([
  1247. dnl #define spam(name, doc) {#name, &name, #name "() -- " doc}
  1248. dnl int foo;
  1249. dnl struct {char *name; int *addr; char *doc;} desc = spam(foo, "something");
  1250. dnl ], [;], cpp_type=ansi, AC_DEFINE(HAVE_OLD_CPP) cpp_type=traditional)
  1251. dnl AC_MSG_RESULT($cpp_type)
  1252. # checks for header files
  1253. AC_HEADER_STDC
  1254. AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \
  1255. fcntl.h grp.h \
  1256. ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \
  1257. shadow.h signal.h stdint.h stropts.h termios.h thread.h \
  1258. unistd.h utime.h \
  1259. sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \
  1260. sys/lock.h sys/mkdev.h sys/modem.h \
  1261. sys/param.h sys/poll.h sys/select.h sys/socket.h sys/statvfs.h sys/stat.h \
  1262. sys/termio.h sys/time.h \
  1263. sys/times.h sys/types.h sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \
  1264. sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
  1265. bluetooth/bluetooth.h linux/tipc.h)
  1266. AC_HEADER_DIRENT
  1267. AC_HEADER_MAJOR
  1268. # On Solaris, term.h requires curses.h
  1269. AC_CHECK_HEADERS(term.h,,,[
  1270. #ifdef HAVE_CURSES_H
  1271. #include <curses.h>
  1272. #endif
  1273. ])
  1274. # On Linux, netlink.h requires asm/types.h
  1275. AC_CHECK_HEADERS(linux/netlink.h,,,[
  1276. #ifdef HAVE_ASM_TYPES_H
  1277. #include <asm/types.h>
  1278. #endif
  1279. #ifdef HAVE_SYS_SOCKET_H
  1280. #include <sys/socket.h>
  1281. #endif
  1282. ])
  1283. # checks for typedefs
  1284. was_it_defined=no
  1285. AC_MSG_CHECKING(for clock_t in time.h)
  1286. AC_EGREP_HEADER(clock_t, time.h, was_it_defined=yes, [
  1287. AC_DEFINE(clock_t, long, [Define to 'long' if <time.h> doesn't define.])
  1288. ])
  1289. AC_MSG_RESULT($was_it_defined)
  1290. # Check whether using makedev requires defining _OSF_SOURCE
  1291. AC_MSG_CHECKING(for makedev)
  1292. AC_TRY_LINK([#include <sys/types.h> ],
  1293. [ makedev(0, 0) ],
  1294. ac_cv_has_makedev=yes,
  1295. ac_cv_has_makedev=no)
  1296. if test "$ac_cv_has_makedev" = "no"; then
  1297. # we didn't link, try if _OSF_SOURCE will allow us to link
  1298. AC_TRY_LINK([
  1299. #define _OSF_SOURCE 1
  1300. #include <sys/types.h>
  1301. ],
  1302. [ makedev(0, 0) ],
  1303. ac_cv_has_makedev=yes,
  1304. ac_cv_has_makedev=no)
  1305. if test "$ac_cv_has_makedev" = "yes"; then
  1306. AC_DEFINE(_OSF_SOURCE, 1, [Define _OSF_SOURCE to get the makedev macro.])
  1307. fi
  1308. fi
  1309. AC_MSG_RESULT($ac_cv_has_makedev)
  1310. if test "$ac_cv_has_makedev" = "yes"; then
  1311. AC_DEFINE(HAVE_MAKEDEV, 1, [Define this if you have the makedev macro.])
  1312. fi
  1313. # Enabling LFS on Solaris (2.6 to 9) with gcc 2.95 triggers a bug in
  1314. # the system headers: If _XOPEN_SOURCE and _LARGEFILE_SOURCE are
  1315. # defined, but the compiler does not support pragma redefine_extname,
  1316. # and _LARGEFILE64_SOURCE is not defined, the headers refer to 64-bit
  1317. # structures (such as rlimit64) without declaring them. As a
  1318. # work-around, disable LFS on such configurations
  1319. use_lfs=yes
  1320. AC_MSG_CHECKING(Solaris LFS bug)
  1321. AC_TRY_COMPILE([
  1322. #define _LARGEFILE_SOURCE 1
  1323. #define _FILE_OFFSET_BITS 64
  1324. #include <sys/resource.h>
  1325. ],struct rlimit foo;,sol_lfs_bug=no,sol_lfs_bug=yes)
  1326. AC_MSG_RESULT($sol_lfs_bug)
  1327. if test "$sol_lfs_bug" = "yes"; then
  1328. use_lfs=no
  1329. fi
  1330. if test "$use_lfs" = "yes"; then
  1331. # Two defines needed to enable largefile support on various platforms
  1332. # These may affect some typedefs
  1333. AC_DEFINE(_LARGEFILE_SOURCE, 1,
  1334. [This must be defined on some systems to enable large file support.])
  1335. AC_DEFINE(_FILE_OFFSET_BITS, 64,
  1336. [This must be set to 64 on some systems to enable large file support.])
  1337. fi
  1338. # Add some code to confdefs.h so that the test for off_t works on SCO
  1339. cat >> confdefs.h <<\EOF
  1340. #if defined(SCO_DS)
  1341. #undef _OFF_T
  1342. #endif
  1343. EOF
  1344. # Type availability checks
  1345. AC_TYPE_MODE_T
  1346. AC_TYPE_OFF_T
  1347. AC_TYPE_PID_T
  1348. AC_TYPE_SIGNAL
  1349. AC_TYPE_SIZE_T
  1350. AC_TYPE_UID_T
  1351. AC_CHECK_TYPE(ssize_t,
  1352. AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
  1353. # Sizes of various common basic types
  1354. # ANSI C requires sizeof(char) == 1, so no need to check it
  1355. AC_CHECK_SIZEOF(int, 4)
  1356. AC_CHECK_SIZEOF(long, 4)
  1357. AC_CHECK_SIZEOF(void *, 4)
  1358. AC_CHECK_SIZEOF(short, 2)
  1359. AC_CHECK_SIZEOF(float, 4)
  1360. AC_CHECK_SIZEOF(double, 8)
  1361. AC_CHECK_SIZEOF(fpos_t, 4)
  1362. AC_CHECK_SIZEOF(size_t, 4)
  1363. AC_CHECK_SIZEOF(pid_t, 4)
  1364. AC_MSG_CHECKING(for long long support)
  1365. have_long_long=no
  1366. AC_TRY_COMPILE([], [long long x; x = (long long)0;], [
  1367. AC_DEFINE(HAVE_LONG_LONG, 1, [Define this if you have the type long long.])
  1368. have_long_long=yes
  1369. ])
  1370. AC_MSG_RESULT($have_long_long)
  1371. if test "$have_long_long" = yes ; then
  1372. AC_CHECK_SIZEOF(long long, 8)
  1373. fi
  1374. AC_MSG_CHECKING(for long double support)
  1375. have_long_double=no
  1376. AC_TRY_COMPILE([], [long double x; x = (long double)0.;], [
  1377. AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define this if you have the type long double.])
  1378. have_long_double=yes
  1379. ])
  1380. AC_MSG_RESULT($have_long_double)
  1381. if test "$have_long_double" = yes ; then
  1382. AC_CHECK_SIZEOF(long double, 12)
  1383. fi
  1384. AC_MSG_CHECKING(for _Bool support)
  1385. have_c99_bool=no
  1386. AC_TRY_COMPILE([], [_Bool x; x = (_Bool)0;], [
  1387. AC_DEFINE(HAVE_C99_BOOL, 1, [Define this if you have the type _Bool.])
  1388. have_c99_bool=yes
  1389. ])
  1390. AC_MSG_RESULT($have_c99_bool)
  1391. if test "$have_c99_bool" = yes ; then
  1392. AC_CHECK_SIZEOF(_Bool, 1)
  1393. fi
  1394. AC_CHECK_TYPES(uintptr_t,
  1395. [AC_CHECK_SIZEOF(uintptr_t, 4)],
  1396. [], [#ifdef HAVE_STDINT_H
  1397. #include <stdint.h>
  1398. #endif])
  1399. # Hmph. AC_CHECK_SIZEOF() doesn't include <sys/types.h>.
  1400. AC_MSG_CHECKING(size of off_t)
  1401. AC_CACHE_VAL(ac_cv_sizeof_off_t,
  1402. [AC_TRY_RUN([#include <stdio.h>
  1403. #include <sys/types.h>
  1404. main()
  1405. {
  1406. FILE *f=fopen("conftestval", "w");
  1407. if (!f) exit(1);
  1408. fprintf(f, "%d\n", sizeof(off_t));
  1409. exit(0);
  1410. }],
  1411. ac_cv_sizeof_off_t=`cat conftestval`,
  1412. ac_cv_sizeof_off_t=0,
  1413. ac_cv_sizeof_off_t=4)
  1414. ])
  1415. AC_MSG_RESULT($ac_cv_sizeof_off_t)
  1416. AC_DEFINE_UNQUOTED(SIZEOF_OFF_T, $ac_cv_sizeof_off_t,
  1417. [The number of bytes in an off_t.])
  1418. AC_MSG_CHECKING(whether to enable large file support)
  1419. if test "$have_long_long" = yes -a \
  1420. "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \
  1421. "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then
  1422. AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1,
  1423. [Defined to enable large file support when an off_t is bigger than a long
  1424. and long long is available and at least as big as an off_t. You may need
  1425. to add some flags for configuration and compilation to enable this mode.
  1426. (For Solaris and Linux, the necessary defines are already defined.)])
  1427. AC_MSG_RESULT(yes)
  1428. else
  1429. AC_MSG_RESULT(no)
  1430. fi
  1431. # AC_CHECK_SIZEOF() doesn't include <time.h>.
  1432. AC_MSG_CHECKING(size of time_t)
  1433. AC_CACHE_VAL(ac_cv_sizeof_time_t,
  1434. [AC_TRY_RUN([#include <stdio.h>
  1435. #include <time.h>
  1436. main()
  1437. {
  1438. FILE *f=fopen("conftestval", "w");
  1439. if (!f) exit(1);
  1440. fprintf(f, "%d\n", sizeof(time_t));
  1441. exit(0);
  1442. }],
  1443. ac_cv_sizeof_time_t=`cat conftestval`,
  1444. ac_cv_sizeof_time_t=0,
  1445. ac_cv_sizeof_time_t=4)
  1446. ])
  1447. AC_MSG_RESULT($ac_cv_sizeof_time_t)
  1448. AC_DEFINE_UNQUOTED(SIZEOF_TIME_T, $ac_cv_sizeof_time_t,
  1449. [The number of bytes in a time_t.])
  1450. # if have pthread_t then define SIZEOF_PTHREAD_T
  1451. ac_save_cc="$CC"
  1452. if test "$ac_cv_kpthread" = "yes"
  1453. then CC="$CC -Kpthread"
  1454. elif test "$ac_cv_kthread" = "yes"
  1455. then CC="$CC -Kthread"
  1456. elif test "$ac_cv_pthread" = "yes"
  1457. then CC="$CC -pthread"
  1458. fi
  1459. AC_MSG_CHECKING(for pthread_t)
  1460. have_pthread_t=no
  1461. AC_TRY_COMPILE([#include <pthread.h>], [pthread_t x; x = *(pthread_t*)0;], have_pthread_t=yes)
  1462. AC_MSG_RESULT($have_pthread_t)
  1463. if test "$have_pthread_t" = yes ; then
  1464. # AC_CHECK_SIZEOF() doesn't include <pthread.h>.
  1465. AC_MSG_CHECKING(size of pthread_t)
  1466. AC_CACHE_VAL(ac_cv_sizeof_pthread_t,
  1467. [AC_TRY_RUN([#include <stdio.h>
  1468. #include <pthread.h>
  1469. main()
  1470. {
  1471. FILE *f=fopen("conftestval", "w");
  1472. if (!f) exit(1);
  1473. fprintf(f, "%d\n", sizeof(pthread_t));
  1474. exit(0);
  1475. }],
  1476. ac_cv_sizeof_pthread_t=`cat conftestval`,
  1477. ac_cv_sizeof_pthread_t=0,
  1478. ac_cv_sizeof_pthread_t=4)
  1479. ])
  1480. AC_MSG_RESULT($ac_cv_sizeof_pthread_t)
  1481. AC_DEFINE_UNQUOTED(SIZEOF_PTHREAD_T, $ac_cv_sizeof_pthread_t,
  1482. [The number of bytes in a pthread_t.])
  1483. fi
  1484. CC="$ac_save_cc"
  1485. AC_MSG_CHECKING(for --enable-toolbox-glue)
  1486. AC_ARG_ENABLE(toolbox-glue,
  1487. AC_HELP_STRING(--enable-toolbox-glue, disable/enable MacOSX glue code for extensions))
  1488. if test -z "$enable_toolbox_glue"
  1489. then
  1490. case $ac_sys_system/$ac_sys_release in
  1491. Darwin/*)
  1492. enable_toolbox_glue="yes";;
  1493. *)
  1494. enable_toolbox_glue="no";;
  1495. esac
  1496. fi
  1497. case "$enable_toolbox_glue" in
  1498. yes)
  1499. extra_machdep_objs="Python/mactoolboxglue.o"
  1500. extra_undefs="-u _PyMac_Error"
  1501. AC_DEFINE(USE_TOOLBOX_OBJECT_GLUE, 1,
  1502. [Define if you want to use MacPython modules on MacOSX in unix-Python.])
  1503. ;;
  1504. *)
  1505. extra_machdep_objs=""
  1506. extra_undefs=""
  1507. ;;
  1508. esac
  1509. AC_MSG_RESULT($enable_toolbox_glue)
  1510. AC_SUBST(OTHER_LIBTOOL_OPT)
  1511. case $ac_sys_system/$ac_sys_release in
  1512. Darwin/@<:@01567@:>@\..*)
  1513. OTHER_LIBTOOL_OPT="-prebind -seg1addr 0x10000000"
  1514. ;;
  1515. Darwin/*)
  1516. OTHER_LIBTOOL_OPT=""
  1517. ;;
  1518. esac
  1519. ARCH_RUN_32BIT=""
  1520. AC_SUBST(LIBTOOL_CRUFT)
  1521. case $ac_sys_system/$ac_sys_release in
  1522. Darwin/@<:@01567@:>@\..*)
  1523. LIBTOOL_CRUFT="-framework System -lcc_dynamic"
  1524. if test "${enable_universalsdk}"; then
  1525. :
  1526. else
  1527. LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
  1528. fi
  1529. LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
  1530. LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
  1531. Darwin/*)
  1532. gcc_version=`gcc -v 2>&1 | grep version | cut -d\ -f3`
  1533. if test ${gcc_version} '<' 4.0
  1534. then
  1535. LIBTOOL_CRUFT="-lcc_dynamic"
  1536. else
  1537. LIBTOOL_CRUFT=""
  1538. fi
  1539. AC_TRY_RUN([
  1540. #include <unistd.h>
  1541. int main(int argc, char*argv[])
  1542. {
  1543. if (sizeof(long) == 4) {
  1544. return 0;
  1545. } else {
  1546. return 1;
  1547. }
  1548. }
  1549. ], ac_osx_32bit=yes,
  1550. ac_osx_32bit=no,
  1551. ac_osx_32bit=yes)
  1552. if test "${ac_osx_32bit}" = "yes"; then
  1553. case `arch` in
  1554. i386)
  1555. MACOSX_DEFAULT_ARCH="i386"
  1556. ;;
  1557. ppc)
  1558. MACOSX_DEFAULT_ARCH="ppc"
  1559. ;;
  1560. *)
  1561. AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
  1562. ;;
  1563. esac
  1564. else
  1565. case `arch` in
  1566. i386)
  1567. MACOSX_DEFAULT_ARCH="x86_64"
  1568. ;;
  1569. ppc)
  1570. MACOSX_DEFAULT_ARCH="ppc64"
  1571. ;;
  1572. *)
  1573. AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
  1574. ;;
  1575. esac
  1576. #ARCH_RUN_32BIT="true"
  1577. fi
  1578. LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
  1579. LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
  1580. LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
  1581. esac
  1582. AC_MSG_CHECKING(for --enable-framework)
  1583. if test "$enable_framework"
  1584. then
  1585. BASECFLAGS="$BASECFLAGS -fno-common -dynamic"
  1586. # -F. is needed to allow linking to the framework while
  1587. # in the build location.
  1588. AC_DEFINE(WITH_NEXT_FRAMEWORK, 1,
  1589. [Define if you want to p…