Repository navigation
Expand file tree
/
Copy pathconfigure.ac
More file actions
Your blame took too long to compute.
9074 lines (8301 loc) · 297 KB
/
Copy pathconfigure.ac
File metadata and controls
9074 lines (8301 loc) · 297 KB
Edit and raw actions
OlderNewer
1
dnl ************************************************************
2
dnl * Please run autoreconf -ivf -Werror to test your changes! *
3
dnl ************************************************************
4
dnl
5
dnl Python's configure script requires autoconf 2.72, autoconf-archive,
6
dnl aclocal 1.16, and pkg-config.
7
dnl
8
dnl It is recommended to use the Tools/build/regen-configure.sh shell script
9
dnl to regenerate the configure script.
10
dnl
11
12
# Set VERSION so we only need to edit in one place (i.e., here)
13
m4_define([PYTHON_VERSION], [3.16])
14
15
AC_PREREQ([2.72])
16
17
AC_INIT([python],[PYTHON_VERSION],[https://github.com/python/cpython/issues/])
18
19
m4_ifdef(
20
[AX_C_FLOAT_WORDS_BIGENDIAN],
21
[],
22
[AC_MSG_ERROR([Please install autoconf-archive package and re-run autoreconf])]
23
)dnl
24
m4_ifdef(
25
[PKG_PROG_PKG_CONFIG],
26
[],
27
[AC_MSG_ERROR([Please install pkgconf's m4 macro package and re-run autoreconf])]
28
)dnl
29
30
dnl Helpers for saving and restoring environment variables:
31
dnl - _SAVE_VAR([VAR]) Helper for SAVE_ENV; stores VAR as save_VAR
32
dnl - _RESTORE_VAR([VAR]) Helper for RESTORE_ENV; restores VAR from save_VAR
33
dnl - SAVE_ENV Saves CFLAGS, LDFLAGS, LIBS, and CPPFLAGS
34
dnl - RESTORE_ENV Restores CFLAGS, LDFLAGS, LIBS, and CPPFLAGS
35
dnl - WITH_SAVE_ENV([SCRIPT]) Runs SCRIPT wrapped with SAVE_ENV/RESTORE_ENV
36
AC_DEFUN([_SAVE_VAR], [AS_VAR_COPY([save_][$1], [$1])])dnl
37
AC_DEFUN([_RESTORE_VAR], [AS_VAR_COPY([$1], [save_][$1])])dnl
38
AC_DEFUN([SAVE_ENV],
39
[_SAVE_VAR([CFLAGS])]
40
[_SAVE_VAR([CPPFLAGS])]
41
[_SAVE_VAR([LDFLAGS])]
42
[_SAVE_VAR([LIBS])]
43
)dnl
44
AC_DEFUN([RESTORE_ENV],
45
[_RESTORE_VAR([CFLAGS])]
46
[_RESTORE_VAR([CPPFLAGS])]
47
[_RESTORE_VAR([LDFLAGS])]
48
[_RESTORE_VAR([LIBS])]
49
)dnl
50
AC_DEFUN([WITH_SAVE_ENV],
51
[SAVE_ENV]
52
[$1]
53
[RESTORE_ENV]
54
)dnl
55
56
dnl PY_CHECK_FUNC(FUNCTION, [INCLUDES], [AC_DEFINE-VAR])
57
AC_DEFUN([PY_CHECK_FUNC],
58
[ AS_VAR_PUSHDEF([py_var], [ac_cv_func_$1])
59
AS_VAR_PUSHDEF([py_define], m4_ifblank([$3], [[HAVE_]m4_toupper($1)], [$3]))
60
AC_CACHE_CHECK(
61
[for $1],
62
[py_var],
63
[AC_COMPILE_IFELSE(
64
[AC_LANG_PROGRAM([$2], [(void)$1])],
65
[AS_VAR_SET([py_var], [yes])],
66
[AS_VAR_SET([py_var], [no])])]
67
)
68
AS_VAR_IF(
69
[py_var],
70
[yes],
71
[AC_DEFINE([py_define], [1], [Define if you have the '$1' function.])])
72
AS_VAR_POPDEF([py_var])
73
AS_VAR_POPDEF([py_define])
74
])
75
76
dnl PY_CHECK_FUNC_PRIVATE(FUNCTION, [INCLUDES], [AC_DEFINE-VAR])
77
dnl Similar to PY_CHECK_FUNC but define macro _Py_HAVE_xxx instead of HAVE_xxx
78
AC_DEFUN([PY_CHECK_FUNC_PRIVATE],
79
[ PY_CHECK_FUNC([$1], [$2], m4_ifblank([$3], [[_Py_HAVE_]m4_toupper($1)], [$3]))
80
])
81
82
dnl PY_CHECK_LIB(LIBRARY, FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
83
dnl Like AC_CHECK_LIB() but does not modify LIBS
84
AC_DEFUN([PY_CHECK_LIB],
85
[AS_VAR_COPY([py_check_lib_save_LIBS], [LIBS])]
86
[AC_CHECK_LIB([$1], [$2], [$3], [$4], [$5])]
87
[AS_VAR_COPY([LIBS], [py_check_lib_save_LIBS])]
88
)
89
90
dnl PY_CHECK_EMSCRIPTEN_PORT(PKG_VAR, [EMPORT_ARGS])
91
dnl Use Emscripten port unless user passes ${PKG_VAR}_CFLAGS
92
dnl or ${PKG_VAR}_LIBS to configure.
93
AC_DEFUN([PY_CHECK_EMSCRIPTEN_PORT], [
94
AS_VAR_PUSHDEF([py_cflags], [$1_CFLAGS])
95
AS_VAR_PUSHDEF([py_libs], [$1_LIBS])
96
AS_IF([test "$ac_sys_system" = "Emscripten" -a -z "$py_cflags" -a -z "$py_libs"], [
97
py_cflags="$2"
98
py_libs="$2"
99
])
100
AS_VAR_POPDEF([py_cflags])
101
AS_VAR_POPDEF([py_libs])
102
])
103
104
AC_SUBST([BASECPPFLAGS])
105
if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
106
# If we're building out-of-tree, we need to make sure the following
107
# resources get picked up before their $srcdir counterparts.
108
# Objects/ -> slots_generated.c
109
# Include/ -> Python.h
110
# (A side effect of this is that these resources will automatically be
111
# regenerated when building out-of-tree, regardless of whether or not
112
# the $srcdir counterpart is up-to-date. This is an acceptable trade
113
# off.)
114
BASECPPFLAGS="-IObjects -IInclude -IPython"
115
else
116
BASECPPFLAGS=""
117
fi
118
119
AC_SUBST([GITVERSION])
120
AC_SUBST([GITTAG])
121
AC_SUBST([GITBRANCH])
122
123
if test -e $srcdir/.git
124
then
125
AC_CHECK_PROG([HAS_GIT], [git], [found], [not-found])
126
else
127
HAS_GIT=no-repository
128
fi
129
if test $HAS_GIT = found
130
then
131
GITVERSION="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) rev-parse --short HEAD"
132
GITTAG="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) describe --all --always --dirty"
133
GITBRANCH="git --git-dir \$(srcdir)/.git --work-tree \$(srcdir) name-rev --name-only HEAD"
134
else
135
GITVERSION=""
136
GITTAG=""
137
GITBRANCH=""
138
fi
139
140
AC_CONFIG_SRCDIR([Include/object.h])
141
AC_CONFIG_HEADERS([pyconfig.h])
142
143
AC_CANONICAL_HOST
144
AC_SUBST([build])
145
AC_SUBST([host])
146
147
AS_VAR_IF([cross_compiling], [maybe],
148
[AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])]
149
)
150
151
# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
152
rm -f pybuilddir.txt
153
154
AC_ARG_WITH([build-python],
155
[AS_HELP_STRING([--with-build-python=python]PYTHON_VERSION,
156
[path to build python binary for cross compiling (default: _bootstrap_python or python]PYTHON_VERSION[)])],
157
[
158
AC_MSG_CHECKING([for --with-build-python])
159
160
AS_VAR_IF([with_build_python], [yes], [with_build_python=python$PACKAGE_VERSION])
161
AS_VAR_IF([with_build_python], [no], [AC_MSG_ERROR([invalid --with-build-python option: expected path or "yes", not "no"])])
162
163
if ! $(command -v "$with_build_python" >/dev/null 2>&1); then
164
AC_MSG_ERROR([invalid or missing build python binary "$with_build_python"])
165
fi
166
build_python_ver=$($with_build_python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
167
if test "$build_python_ver" != "$PACKAGE_VERSION"; then
168
AC_MSG_ERROR(["$with_build_python" has incompatible version $build_python_ver (expected: $PACKAGE_VERSION)])
169
fi
170
dnl Build Python interpreter is used for regeneration and freezing.
171
ac_cv_prog_PYTHON_FOR_REGEN=$with_build_python
172
PYTHON_FOR_FREEZE="$with_build_python"
173
PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH) _PYTHON_SYSCONFIGDATA_PATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`) '$with_build_python
174
AC_MSG_RESULT([$with_build_python])
175
], [
176
AS_VAR_IF([cross_compiling], [yes],
177
[AC_MSG_ERROR([Cross compiling requires --with-build-python])]
178
)
179
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
180
PYTHON_FOR_FREEZE="./_bootstrap_python"
181
]
182
)
183
AC_SUBST([PYTHON_FOR_BUILD])
184
185
AC_MSG_CHECKING([for Python interpreter freezing])
186
AC_MSG_RESULT([$PYTHON_FOR_FREEZE])
187
AC_SUBST([PYTHON_FOR_FREEZE])
188
189
AS_VAR_IF([cross_compiling], [yes],
190
[
191
dnl external build Python, freezing depends on Programs/_freeze_module.py
192
FREEZE_MODULE_BOOTSTRAP='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py'
193
FREEZE_MODULE_BOOTSTRAP_DEPS='$(srcdir)/Programs/_freeze_module.py'
194
FREEZE_MODULE='$(FREEZE_MODULE_BOOTSTRAP)'
195
FREEZE_MODULE_DEPS='$(FREEZE_MODULE_BOOTSTRAP_DEPS)'
196
PYTHON_FOR_BUILD_DEPS=''
197
# The build Python is a separate interpreter. RUNSHARED would make it
198
# load the in-tree libpython, which may need a different libc.
199
RUNSHARED_FOR_BUILD=''
200
],
201
[
202
dnl internal build tools also depend on Programs/_freeze_module and _bootstrap_python.
203
FREEZE_MODULE_BOOTSTRAP='./Programs/_freeze_module'
204
FREEZE_MODULE_BOOTSTRAP_DEPS="Programs/_freeze_module"
205
FREEZE_MODULE='$(PYTHON_FOR_FREEZE) $(srcdir)/Programs/_freeze_module.py'
206
FREEZE_MODULE_DEPS="_bootstrap_python \$(srcdir)/Programs/_freeze_module.py"
207
PYTHON_FOR_BUILD_DEPS='$(BUILDPYTHON)'
208
RUNSHARED_FOR_BUILD='$(RUNSHARED)'
209
]
210
)
211
AC_SUBST([FREEZE_MODULE_BOOTSTRAP])
212
AC_SUBST([FREEZE_MODULE_BOOTSTRAP_DEPS])
213
AC_SUBST([FREEZE_MODULE])
214
AC_SUBST([FREEZE_MODULE_DEPS])
215
AC_SUBST([PYTHON_FOR_BUILD_DEPS])
216
AC_SUBST([RUNSHARED_FOR_BUILD])
217
218
AC_CHECK_PROGS([PYTHON_FOR_REGEN],
219
[python$PACKAGE_VERSION python3.16 python3.15 python3.14 python3.13 python3.12 python3.11 python3.10 python3 python],
220
[python3])
221
AC_SUBST([PYTHON_FOR_REGEN])
222
223
AC_MSG_CHECKING([Python for regen version])
224
if command -v "$PYTHON_FOR_REGEN" >/dev/null 2>&1; then
225
AC_MSG_RESULT([$($PYTHON_FOR_REGEN -V 2>/dev/null)])
226
else
227
AC_MSG_RESULT([missing])
228
fi
229
230
dnl Ensure that if prefix is specified, it does not end in a slash. If
231
dnl it does, we get path names containing '//' which is both ugly and
232
dnl can cause trouble.
233
234
dnl Last slash shouldn't be stripped if prefix=/
235
if test "$prefix" != "/"; then
236
prefix=`echo "$prefix" | sed -e 's/\/$//g'`
237
fi
238
239
dnl This is for stuff that absolutely must end up in pyconfig.h.
240
dnl Please use pyport.h instead, if possible.
241
AH_TOP([
242
#ifndef Py_PYCONFIG_H
243
#define Py_PYCONFIG_H
244
])
245
AH_BOTTOM([
246
#endif /*Py_PYCONFIG_H*/
247
])
248
249
# We don't use PACKAGE_ variables, and they cause conflicts
250
# with other autoconf-based packages that include Python.h
251
grep -v 'define PACKAGE_' <confdefs.h >confdefs.h.new
252
rm confdefs.h
253
mv confdefs.h.new confdefs.h
254
255
AC_SUBST([VERSION])
256
VERSION=PYTHON_VERSION
257
258
# Version number of Python's own shared library file.
259
AC_SUBST([SOVERSION])
260
SOVERSION=1.0
261
262
# The later definition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
263
# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable
264
# them.
265
AC_DEFINE([_NETBSD_SOURCE], [1],
266
[Define on NetBSD to activate all library features])
267
268
# The later definition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
269
# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable
270
# them.
271
AC_DEFINE([__BSD_VISIBLE], [1],
272
[Define on FreeBSD to activate all library features])
273
274
# The later definition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables
275
# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable
276
# them.
277
AC_DEFINE([_DARWIN_C_SOURCE], [1],
278
[Define on Darwin to activate all library features])
279
280
281
define_xopen_source=yes
282
283
# Arguments passed to configure.
284
AC_SUBST([CONFIG_ARGS])
285
CONFIG_ARGS="$ac_configure_args"
286
287
dnl Allow users to disable pkg-config or require pkg-config
288
AC_ARG_WITH([pkg-config],
289
[AS_HELP_STRING([[--with-pkg-config=[yes|no|check]]],
290
[use pkg-config to detect build options (default is check)])],
291
[],
292
[with_pkg_config=check]
293
)
294
AS_CASE([$with_pkg_config],
295
[yes|check], [
296
if test -z "$PKG_CONFIG"; then
297
dnl invalidate stale config.cache values
298
AS_UNSET([PKG_CONFIG])
299
AS_UNSET([ac_cv_path_ac_pt_PKG_CONFIG])
300
AS_UNSET([ac_cv_prog_ac_ct_PKG_CONFIG])
301
fi
302
PKG_PROG_PKG_CONFIG
303
],
304
[no], [
305
PKG_CONFIG=''
306
dnl force AX_CHECK_OPENSSL to ignore pkg-config
307
ac_cv_path_ac_pt_PKG_CONFIG=''
308
ac_cv_prog_ac_ct_PKG_CONFIG=''
309
],
310
[AC_MSG_ERROR([invalid argument --with-pkg-config=$with_pkg_config])]
311
)
312
if test "$with_pkg_config" = yes -a -z "$PKG_CONFIG"; then
313
AC_MSG_ERROR([pkg-config is required])]
314
fi
315
316
dnl Allow distributors to provide custom missing stdlib module error messages
317
AC_ARG_WITH([missing-stdlib-config],
318
[AS_HELP_STRING([--with-missing-stdlib-config=FILE],
319
[File with custom module error messages for missing stdlib modules])],
320
[MISSING_STDLIB_CONFIG="$withval"],
321
[MISSING_STDLIB_CONFIG=""]
322
)
323
AC_SUBST([MISSING_STDLIB_CONFIG])
324
325
# Set name for machine-dependent library files
326
AC_ARG_VAR([MACHDEP], [name for machine-dependent library files])
327
AC_MSG_CHECKING([MACHDEP])
328
if test -z "$MACHDEP"
329
then
330
# avoid using uname for cross builds
331
if test "$cross_compiling" = yes; then
332
# ac_sys_system and ac_sys_release are used for setting
333
# a lot of different things including 'define_xopen_source'
334
# in the case statement below.
335
case "$host" in
336
*-*-linux-android*)
337
ac_sys_system=Linux-android
338
;;
339
*-*-linux*)
340
ac_sys_system=Linux
341
;;
342
*-*-cygwin*)
343
ac_sys_system=CYGWIN
344
;;
345
*-apple-ios*)
346
ac_sys_system=iOS
347
;;
348
*-apple-tvos*)
349
ac_sys_system=tvOS
350
;;
351
*-apple-xros*)
352
ac_sys_system=visionOS
353
;;
354
*-apple-watchos*)
355
ac_sys_system=watchOS
356
;;
357
*-*-darwin*)
358
ac_sys_system=Darwin
359
;;
360
*-gnu)
361
ac_sys_system=GNU
362
;;
363
*-*-vxworks*)
364
ac_sys_system=VxWorks
365
;;
366
*-*-emscripten)
367
ac_sys_system=Emscripten
368
;;
369
*-*-wasi*)
370
ac_sys_system=WASI
371
;;
372
*)
373
# for now, limit cross builds to known configurations
374
MACHDEP="unknown"
375
AC_MSG_ERROR([cross build not supported for $host])
376
esac
377
ac_sys_release=
378
else
379
ac_sys_system=`uname -s`
380
if test "$ac_sys_system" = "AIX"; then
381
ac_sys_release=`uname -v`
382
else
383
ac_sys_release=`uname -r`
384
fi
385
fi
386
ac_md_system=`echo $ac_sys_system |
387
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
388
ac_md_release=`echo $ac_sys_release |
389
tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
390
MACHDEP="$ac_md_system$ac_md_release"
391
392
case $MACHDEP in
393
aix*) MACHDEP="aix";;
394
freebsd*) MACHDEP="freebsd";;
395
linux-android*) MACHDEP="android";;
396
linux*) MACHDEP="linux";;
397
cygwin*) MACHDEP="cygwin";;
398
darwin*) MACHDEP="darwin";;
399
'') MACHDEP="unknown";;
400
esac
401
402
if test "$ac_sys_system" = "SunOS"; then
403
# For Solaris, there isn't an OS version specific macro defined
404
# in most compilers, so we define one here.
405
SUNOS_VERSION=`echo $ac_sys_release | sed -e 's!\.\([0-9]\)$!.0\1!g' | tr -d '.'`
406
AC_DEFINE_UNQUOTED([Py_SUNOS_VERSION], [$SUNOS_VERSION],
407
[The version of SunOS/Solaris as reported by `uname -r' without the dot.])
408
fi
409
fi
410
AC_MSG_RESULT(["$MACHDEP"])
411
412
dnl For cross compilation, we distinguish between "prefix" (where we install the
413
dnl files) and "host_prefix" (where we expect to find the files at runtime)
414
415
if test -z "$host_prefix"; then
416
AS_CASE([$ac_sys_system],
417
[Emscripten], [host_prefix=/],
418
[host_prefix='${prefix}']
419
)
420
fi
421
AC_SUBST([host_prefix])
422
423
if test -z "$host_exec_prefix"; then
424
AS_CASE([$ac_sys_system],
425
[Emscripten], [host_exec_prefix=$host_prefix],
426
[host_exec_prefix='${exec_prefix}']
427
)
428
fi
429
AC_SUBST([host_exec_prefix])
430
431
# On cross-compile builds, configure will look for a host-specific compiler by
432
# prepending the user-provided host triple to the required binary name.
433
#
434
# On iOS/tvOS/visionOS/watchOS, this results in binaries like "arm64-apple-ios13.0-simulator-gcc",
435
# which isn't a binary that exists, and isn't very convenient, as it contains the
436
# iOS version. As the default cross-compiler name won't exist, configure falls
437
# back to gcc, which *definitely* won't work. We're providing wrapper scripts for
438
# these tools; the binary names of these scripts are better defaults than "gcc".
439
# This only requires that the user put the platform scripts folder (e.g.,
440
# "iOS/Resources/bin") in their path, rather than defining platform-specific
441
# names/paths for AR, CC, CPP, and CXX explicitly; and if the user forgets to
442
# either put the platform scripts folder in the path, or specify CC etc,
443
# configure will fail.
444
if test -z "$AR"; then
445
case "$host" in
446
aarch64-apple-ios*-simulator) AR=arm64-apple-ios-simulator-ar ;;
447
aarch64-apple-ios*) AR=arm64-apple-ios-ar ;;
448
x86_64-apple-ios*-simulator) AR=x86_64-apple-ios-simulator-ar ;;
449
450
aarch64-apple-tvos*-simulator) AR=arm64-apple-tvos-simulator-ar ;;
451
aarch64-apple-tvos*) AR=arm64-apple-tvos-ar ;;
452
x86_64-apple-tvos*-simulator) AR=x86_64-apple-tvos-simulator-ar ;;
453
454
aarch64-apple-xros*-simulator) AR=arm64-apple-xros-simulator-ar ;;
455
aarch64-apple-xros*) AR=arm64-apple-xros-ar ;;
456
457
aarch64-apple-watchos*-simulator) AR=arm64-apple-watchos-simulator-ar ;;
458
aarch64-apple-watchos*) AR=arm64_32-apple-watchos-ar ;;
459
x86_64-apple-watchos*-simulator) AR=x86_64-apple-watchos-simulator-ar ;;
460
*)
461
esac
462
fi
463
if test -z "$CC"; then
464
case "$host" in
465
aarch64-apple-ios*-simulator) CC=arm64-apple-ios-simulator-clang ;;
466
aarch64-apple-ios*) CC=arm64-apple-ios-clang ;;
467
x86_64-apple-ios*-simulator) CC=x86_64-apple-ios-simulator-clang ;;
468
469
aarch64-apple-tvos*-simulator) CC=arm64-apple-tvos-simulator-clang ;;
470
aarch64-apple-tvos*) CC=arm64-apple-tvos-clang ;;
471
x86_64-apple-tvos*-simulator) CC=x86_64-apple-tvos-simulator-clang ;;
472
473
aarch64-apple-xros*-simulator) CC=arm64-apple-xros-simulator-clang ;;
474
aarch64-apple-xros*) CC=arm64-apple-xros-clang ;;
475
476
aarch64-apple-watchos*-simulator) CC=arm64-apple-watchos-simulator-clang ;;
477
aarch64-apple-watchos*) CC=arm64_32-apple-watchos-clang ;;
478
x86_64-apple-watchos*-simulator) CC=x86_64-apple-watchos-simulator-clang ;;
479
*)
480
esac
481
fi
482
if test -z "$CPP"; then
483
case "$host" in
484
aarch64-apple-ios*-simulator) CPP=arm64-apple-ios-simulator-cpp ;;
485
aarch64-apple-ios*) CPP=arm64-apple-ios-cpp ;;
486
x86_64-apple-ios*-simulator) CPP=x86_64-apple-ios-simulator-cpp ;;
487
488
aarch64-apple-tvos*-simulator) CPP=arm64-apple-tvos-simulator-cpp ;;
489
aarch64-apple-tvos*) CPP=arm64-apple-tvos-cpp ;;
490
x86_64-apple-tvos*-simulator) CPP=x86_64-apple-tvos-simulator-cpp ;;
491
492
aarch64-apple-xros*-simulator) CPP=arm64-apple-xros-simulator-cpp ;;
493
aarch64-apple-xros*) CPP=arm64-apple-xros-cpp ;;
494
495
aarch64-apple-watchos*-simulator) CPP=arm64-apple-watchos-simulator-cpp ;;
496
aarch64-apple-watchos*) CPP=arm64_32-apple-watchos-cpp ;;
497
x86_64-apple-watchos*-simulator) CPP=x86_64-apple-watchos-simulator-cpp ;;
498
*)
499
esac
500
fi
501
if test -z "$CXX"; then
502
case "$host" in
503
aarch64-apple-ios*-simulator) CXX=arm64-apple-ios-simulator-clang++ ;;
504
aarch64-apple-ios*) CXX=arm64-apple-ios-clang++ ;;
505
x86_64-apple-ios*-simulator) CXX=x86_64-apple-ios-simulator-clang++ ;;
506
507
aarch64-apple-tvos*-simulator) CXX=arm64-apple-tvos-simulator-clang++ ;;
508
aarch64-apple-tvos*) CXX=arm64-apple-tvos-clang++ ;;
509
x86_64-apple-tvos*-simulator) CXX=x86_64-apple-tvos-simulator-clang++ ;;
510
511
aarch64-apple-xros*-simulator) CXX=arm64-apple-xros-simulator-clang++ ;;
512
aarch64-apple-xros*) CXX=arm64-apple-xros-clang++ ;;
513
514
aarch64-apple-watchos*-simulator) CXX=arm64-apple-watchos-simulator-clang++ ;;
515
aarch64-apple-watchos*) CXX=arm64_32-apple-watchos-clang++ ;;
516
x86_64-apple-watchos*-simulator) CXX=x86_64-apple-watchos-simulator-clang++ ;;
517
*)
518
esac
519
fi
520
521
AC_MSG_CHECKING([for --enable-universalsdk])
522
AC_ARG_ENABLE([universalsdk],
523
AS_HELP_STRING([--enable-universalsdk@<:@=SDKDIR@:>@],
524
[create a universal binary build.
525
SDKDIR specifies which macOS SDK should be used to perform the build,
526
see Mac/README.rst. (default is no)]),
527
[
528
case $enableval in
529
yes)
530
# Locate the best usable SDK, see Mac/README for more
531
# information
532
enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`"
533
if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null )
534
then
535
enableval=/Developer/SDKs/MacOSX10.4u.sdk
536
if test ! -d "${enableval}"
537
then
538
enableval=/
539
fi
540
fi
541
;;
542
esac
543
case $enableval in
544
no)
545
UNIVERSALSDK=
546
enable_universalsdk=
547
;;
548
*)
549
UNIVERSALSDK=$enableval
550
if test ! -d "${UNIVERSALSDK}"
551
then
552
AC_MSG_ERROR([--enable-universalsdk specifies non-existing SDK: ${UNIVERSALSDK}])
553
fi
554
;;
555
esac
556
557
],[
558
UNIVERSALSDK=
559
enable_universalsdk=
560
])
561
if test -n "${UNIVERSALSDK}"
562
then
563
AC_MSG_RESULT([${UNIVERSALSDK}])
564
else
565
AC_MSG_RESULT([no])
566
fi
567
AC_SUBST([UNIVERSALSDK])
568
569
AC_SUBST([ARCH_RUN_32BIT])
570
ARCH_RUN_32BIT=""
571
572
# For backward compatibility reasons we prefer to select '32-bit' if available,
573
# otherwise use 'intel'
574
UNIVERSAL_ARCHS="32-bit"
575
if test "`uname -s`" = "Darwin"
576
then
577
if test -n "${UNIVERSALSDK}"
578
then
579
if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`"
580
then
581
UNIVERSAL_ARCHS="intel"
582
fi
583
fi
584
fi
585
586
AC_SUBST([LIPO_32BIT_FLAGS])
587
AC_SUBST([LIPO_INTEL64_FLAGS])
588
AC_MSG_CHECKING([for --with-universal-archs])
589
AC_ARG_WITH([universal-archs],
590
AS_HELP_STRING([--with-universal-archs=ARCH],
591
[specify the kind of macOS universal binary that should be created.
592
This option is only valid when --enable-universalsdk is set; options are:
593
("universal2", "intel-64", "intel-32", "intel", "32-bit",
594
"64-bit", "3-way", or "all")
595
see Mac/README.rst]),
596
[
597
UNIVERSAL_ARCHS="$withval"
598
],
599
[])
600
if test -n "${UNIVERSALSDK}"
601
then
602
AC_MSG_RESULT([${UNIVERSAL_ARCHS}])
603
else
604
AC_MSG_RESULT([no])
605
fi
606
607
AC_ARG_WITH([framework-name],
608
AS_HELP_STRING([--with-framework-name=FRAMEWORK],
609
[specify the name for the python framework on macOS
610
only valid when --enable-framework is set. see Mac/README.rst
611
(default is 'Python')]),
612
[
613
PYTHONFRAMEWORK=${withval}
614
PYTHONFRAMEWORKDIR=${withval}.framework
615
PYTHONFRAMEWORKIDENTIFIER=org.python.`echo $withval | tr '[A-Z]' '[a-z]'`
616
],[
617
PYTHONFRAMEWORK=Python
618
PYTHONFRAMEWORKDIR=Python.framework
619
PYTHONFRAMEWORKIDENTIFIER=org.python.python
620
])
621
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
622
AC_ARG_ENABLE([framework],
623
AS_HELP_STRING([--enable-framework@<:@=INSTALLDIR@:>@],
624
[create a Python.framework rather than a traditional Unix install.
625
optional INSTALLDIR specifies the installation path. see Mac/README.rst
626
(default is no)]),
627
[
628
case $enableval in
629
yes)
630
case $ac_sys_system in
631
Darwin) enableval=/Library/Frameworks ;;
632
iOS) enableval=Platforms/Apple/iOS/Frameworks/\$\(MULTIARCH\) ;;
633
tvOS) enableval=Platforms/Apple/tvOS/Frameworks/\$\(MULTIARCH\) ;;
634
visionOS) enableval=Platforms/Apple/visionOS/Frameworks/\$\(MULTIARCH\) ;;
635
watchOS) enableval=Platforms/Apple/watchOS/Frameworks/\$\(MULTIARCH\) ;;
636
*) AC_MSG_ERROR([Unknown platform for framework build])
637
esac
638
esac
639
640
case $enableval in
641
no)
642
PYTHONFRAMEWORK=
643
PYTHONFRAMEWORKDIR=no-framework
644
PYTHONFRAMEWORKPREFIX=
645
PYTHONFRAMEWORKINSTALLDIR=
646
PYTHONFRAMEWORKINSTALLNAMEPREFIX=
647
RESSRCDIR=
648
FRAMEWORKINSTALLFIRST=
649
FRAMEWORKINSTALLLAST=
650
FRAMEWORKALTINSTALLFIRST=
651
FRAMEWORKALTINSTALLLAST=
652
FRAMEWORKPYTHONW=
653
INSTALLTARGETS="commoninstall bininstall maninstall"
654
655
if test "x${prefix}" = "xNONE"; then
656
FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
657
else
658
FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
659
fi
660
enable_framework=
661
;;
662
*)
663
PYTHONFRAMEWORKPREFIX="${enableval}"
664
PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
665
666
case $ac_sys_system in #(
667
Darwin) :
668
FRAMEWORKINSTALLFIRST="frameworkinstallversionedstructure"
669
FRAMEWORKALTINSTALLFIRST="frameworkinstallversionedstructure "
670
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
671
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
672
FRAMEWORKPYTHONW="frameworkpythonw"
673
FRAMEWORKINSTALLAPPSPREFIX="/Applications"
674
INSTALLTARGETS="commoninstall bininstall maninstall"
675
676
if test "x${prefix}" = "xNONE" ; then
677
FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
678
679
else
680
FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
681
fi
682
683
case "${enableval}" in
684
/System*)
685
FRAMEWORKINSTALLAPPSPREFIX="/Applications"
686
if test "${prefix}" = "NONE" ; then
687
# See below
688
FRAMEWORKUNIXTOOLSPREFIX="/usr"
689
fi
690
;;
691
692
/Library*)
693
FRAMEWORKINSTALLAPPSPREFIX="/Applications"
694
;;
695
696
*/Library/Frameworks)
697
MDIR="`dirname "${enableval}"`"
698
MDIR="`dirname "${MDIR}"`"
699
FRAMEWORKINSTALLAPPSPREFIX="${MDIR}/Applications"
700
701
if test "${prefix}" = "NONE"; then
702
# User hasn't specified the
703
# --prefix option, but wants to install
704
# the framework in a non-default location,
705
# ensure that the compatibility links get
706
# installed relative to that prefix as well
707
# instead of in /usr/local.
708
FRAMEWORKUNIXTOOLSPREFIX="${MDIR}"
709
fi
710
;;
711
712
*)
713
FRAMEWORKINSTALLAPPSPREFIX="/Applications"
714
;;
715
esac
716
717
prefix=$PYTHONFRAMEWORKINSTALLDIR/Versions/$VERSION
718
PYTHONFRAMEWORKINSTALLNAMEPREFIX=${prefix}
719
RESSRCDIR=Mac/Resources/framework
720
721
# Add files for Mac specific code to the list of output
722
# files:
723
AC_CONFIG_FILES([Mac/Makefile])
724
AC_CONFIG_FILES([Mac/PythonLauncher/Makefile])
725
AC_CONFIG_FILES([Mac/Resources/framework/Info.plist])
726
AC_CONFIG_FILES([Mac/Resources/app/Info.plist])
727
;;
728
iOS) :
729
FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
730
FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
731
FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
732
FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
733
FRAMEWORKPYTHONW=
734
INSTALLTARGETS="libinstall inclinstall sharedinstall"
735
736
prefix=$PYTHONFRAMEWORKPREFIX
737
PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
738
RESSRCDIR=Platforms/Apple/iOS/Resources
739
740
AC_CONFIG_FILES([Platforms/Apple/iOS/Resources/Info.plist])
741
;;
742
tvOS) :
743
FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
744
FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
745
FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
746
FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
747
FRAMEWORKPYTHONW=
748
INSTALLTARGETS="libinstall inclinstall sharedinstall"
749
750
prefix=$PYTHONFRAMEWORKPREFIX
751
PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
752
RESSRCDIR=Platforms/Apple/tvOS/Resources
753
754
AC_CONFIG_FILES([Platforms/Apple/tvOS/Resources/Info.plist])
755
;;
756
visionOS) :
757
FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
758
FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
759
FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
760
FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
761
FRAMEWORKPYTHONW=
762
INSTALLTARGETS="libinstall inclinstall sharedinstall"
763
764
prefix=$PYTHONFRAMEWORKPREFIX
765
PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
766
RESSRCDIR=Platforms/Apple/visionOS/Resources
767
768
AC_CONFIG_FILES([Platforms/Apple/visionOS/Resources/Info.plist])
769
;;
770
watchOS) :
771
FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
772
FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
773
FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
774
FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
775
FRAMEWORKPYTHONW=
776
INSTALLTARGETS="libinstall inclinstall sharedinstall"
777
778
prefix=$PYTHONFRAMEWORKPREFIX
779
PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
780
RESSRCDIR=Platforms/Apple/watchOS/Resources
781
782
AC_CONFIG_FILES([Platforms/Apple/watchOS/Resources/Info.plist])
783
;;
784
*)
785
AC_MSG_ERROR([Unknown platform for framework build])
786
;;
787
esac
788
esac
789
],[
790
PYTHONFRAMEWORK=
791
PYTHONFRAMEWORKDIR=no-framework
792
PYTHONFRAMEWORKPREFIX=
793
PYTHONFRAMEWORKINSTALLDIR=
794
PYTHONFRAMEWORKINSTALLNAMEPREFIX=
795
RESSRCDIR=
796
FRAMEWORKINSTALLFIRST=
797
FRAMEWORKINSTALLLAST=
798
FRAMEWORKALTINSTALLFIRST=
799
FRAMEWORKALTINSTALLLAST=
800
FRAMEWORKPYTHONW=
801
INSTALLTARGETS="commoninstall bininstall maninstall"
802
if test "x${prefix}" = "xNONE" ; then
803
FRAMEWORKUNIXTOOLSPREFIX="${ac_default_prefix}"
804
else
805
FRAMEWORKUNIXTOOLSPREFIX="${prefix}"
806
fi
807
enable_framework=
808
])
809
AC_SUBST([PYTHONFRAMEWORK])
810
AC_SUBST([PYTHONFRAMEWORKIDENTIFIER])
811
AC_SUBST([PYTHONFRAMEWORKDIR])
812
AC_SUBST([PYTHONFRAMEWORKPREFIX])
813
AC_SUBST([PYTHONFRAMEWORKINSTALLDIR])
814
AC_SUBST([PYTHONFRAMEWORKINSTALLNAMEPREFIX])
815
AC_SUBST([RESSRCDIR])
816
AC_SUBST([FRAMEWORKINSTALLFIRST])
817
AC_SUBST([FRAMEWORKINSTALLLAST])
818
AC_SUBST([FRAMEWORKALTINSTALLFIRST])
819
AC_SUBST([FRAMEWORKALTINSTALLLAST])
820
AC_SUBST([FRAMEWORKPYTHONW])
821
AC_SUBST([FRAMEWORKUNIXTOOLSPREFIX])
822
AC_SUBST([FRAMEWORKINSTALLAPPSPREFIX])
823
AC_SUBST([INSTALLTARGETS])
824
825
AC_DEFINE_UNQUOTED([_PYTHONFRAMEWORK], ["${PYTHONFRAMEWORK}"],
826
[framework name])
827
828
dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output
829
AC_MSG_CHECKING([for --with-app-store-compliance])
830
AC_ARG_WITH(
831
[app_store_compliance],
832
[AS_HELP_STRING(
833
[--with-app-store-compliance=@<:@PATCH-FILE@:>@],
834
[Enable any patches required for compiliance with app stores.
835
Optional PATCH-FILE specifies the custom patch to apply.]
836
)],[
837
case "$withval" in
838
yes)
839
case $ac_sys_system in
840
Darwin|iOS|tvOS|visionOS|watchOS)
841
# iOS/tvOS/visionOS/watchOS is able to share the macOS patch
842
APP_STORE_COMPLIANCE_PATCH="Mac/Resources/app-store-compliance.patch"
843
;;
844
*) AC_MSG_ERROR([no default app store compliance patch available for $ac_sys_system]) ;;
845
esac
846
AC_MSG_RESULT([applying default app store compliance patch])
847
;;
848
*)
849
APP_STORE_COMPLIANCE_PATCH="${withval}"
850
AC_MSG_RESULT([applying custom app store compliance patch])
851
;;
852
esac
853
],[
854
case $ac_sys_system in
855
iOS|tvOS|visionOS|watchOS)
856
# Always apply the compliance patch on iOS/tvOS/visionOS/watchOS; we can use the macOS patch
857
APP_STORE_COMPLIANCE_PATCH="Mac/Resources/app-store-compliance.patch"
858
AC_MSG_RESULT([applying default app store compliance patch])
859
;;
860
*)
861
# No default app compliance patching on any other platform
862
APP_STORE_COMPLIANCE_PATCH=
863
AC_MSG_RESULT([not patching for app store compliance])
864
;;
865
esac
866
])
867
AC_SUBST([APP_STORE_COMPLIANCE_PATCH])
868
869
EXPORT_XROS_DEPLOYMENT_TARGET='#'
870
871
AC_SUBST([_PYTHON_HOST_PLATFORM])
872
if test "$cross_compiling" = yes; then
873
case "$host" in
874
*-*-linux*)
875
case "$host_cpu" in
876
arm*)
877
_host_ident=arm
878
;;
879
*)
880
_host_ident=$host_cpu
881
esac
882
;;
883
*-gnu)
884
_host_ident=$host_cpu
885
;;
886
*-*-cygwin*)
887
_host_ident=
888
;;
889
*-apple-ios*)
890
_host_os=`echo $host | cut -d '-' -f3`
891
_host_device=`echo $host | cut -d '-' -f4`
892
_host_device=${_host_device:=os}
893
894
# IPHONEOS_DEPLOYMENT_TARGET is the minimum supported iOS version
895
AC_MSG_CHECKING([iOS deployment target])
896
IPHONEOS_DEPLOYMENT_TARGET=$(echo ${_host_os} | cut -c4-)
897
IPHONEOS_DEPLOYMENT_TARGET=${IPHONEOS_DEPLOYMENT_TARGET:=13.0}
898
AC_MSG_RESULT([$IPHONEOS_DEPLOYMENT_TARGET])
899
900
case "$host_cpu" in
901
aarch64)
902
_host_ident=${IPHONEOS_DEPLOYMENT_TARGET}-arm64-iphone${_host_device}
903
;;
904
*)
905
_host_ident=${IPHONEOS_DEPLOYMENT_TARGET}-$host_cpu-iphone${_host_device}
906
;;
907
esac
908
;;
909
*-apple-tvos*)
910
_host_os=`echo $host | cut -d '-' -f3`
911
_host_device=`echo $host | cut -d '-' -f4`
912
_host_device=${_host_device:=os}
913
914
# TVOS_DEPLOYMENT_TARGET is the minimum supported tvOS version
915
AC_MSG_CHECKING([tvOS deployment target])
916
TVOS_DEPLOYMENT_TARGET=${_host_os:4}
917
TVOS_DEPLOYMENT_TARGET=${TVOS_DEPLOYMENT_TARGET:=12.0}
918
AC_MSG_RESULT([$TVOS_DEPLOYMENT_TARGET])
919
920
case "$host_cpu" in
921
aarch64)
922
_host_ident=${TVOS_DEPLOYMENT_TARGET}-arm64-appletv${_host_device}
923
;;
924
*)
925
_host_ident=${TVOS_DEPLOYMENT_TARGET}-$host_cpu-appletv${_host_device}
926
;;
927
esac
928
;;
929
*-apple-xros*)
930
_host_os=`echo $host | cut -d '-' -f3`
931
_host_device=`echo $host | cut -d '-' -f4`
932
_host_device=${_host_device:=os}
933
934
# XROS_DEPLOYMENT_TARGET is the minimum supported visionOS version
935
AC_MSG_CHECKING([visionOS deployment target])
936
XROS_DEPLOYMENT_TARGET=${_host_os:8}
937
XROS_DEPLOYMENT_TARGET=${XROS_DEPLOYMENT_TARGET:=2.0}
938
AC_MSG_RESULT([$XROS_DEPLOYMENT_TARGET])
939
AC_MSG_CHECKING([exporting flag of visionOS deployment target])
940
export XROS_DEPLOYMENT_TARGET
941
EXPORT_XROS_DEPLOYMENT_TARGET=''
942
AC_MSG_RESULT([$EXPORT_XROS_DEPLOYMENT_TARGET])
943
944
case "$host_cpu" in
945
aarch64)
946
_host_ident=${XROS_DEPLOYMENT_TARGET}-arm64-xr${_host_device}
947
;;
948
*)
949
_host_ident=${XROS_DEPLOYMENT_TARGET}-$host_cpu-xr${_host_device}
950
;;
951
esac
952
;;
953
*-apple-watchos*)
954
_host_os=`echo $host | cut -d '-' -f3`
955
_host_device=`echo $host | cut -d '-' -f4`
956
_host_device=${_host_device:=os}
957
958
# WATCHOS_DEPLOYMENT_TARGET is the minimum supported watchOS version
959
AC_MSG_CHECKING([watchOS deployment target])
960
WATCHOS_DEPLOYMENT_TARGET=${_host_os:7}
961
WATCHOS_DEPLOYMENT_TARGET=${WATCHOS_DEPLOYMENT_TARGET:=9.0}
962
AC_MSG_RESULT([$WATCHOS_DEPLOYMENT_TARGET])
963
964
case "$host_cpu" in
965
aarch64)
966
_host_ident=${WATCHOS_DEPLOYMENT_TARGET}-arm64-watch${_host_device}
967
;;
968
*)
969
_host_ident=${WATCHOS_DEPLOYMENT_TARGET}-$host_cpu-watch${_host_device}
970
;;
971
esac
972
;;
973
*-*-darwin*)
974
case "$host_cpu" in
975
arm*)
976
_host_ident=arm
977
;;
978
*)
979
_host_ident=$host_cpu
980
esac
981
;;
982
*-*-vxworks*)
983
_host_ident=$host_cpu
984
;;
985
*-*-emscripten)
986
_host_ident=$(emcc -dumpversion | cut -f1 -d-)-$host_cpu
987
;;
988
wasm32-*-* | wasm64-*-*)
989
_host_ident=$host_cpu
990
;;
991
*)
992
# for now, limit cross builds to known configurations
993
MACHDEP="unknown"
994
AC_MSG_ERROR([cross build not supported for $host])
995
esac
996
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_ident:+-$_host_ident}"
997
fi
998
999
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
1000
# disable features if it is defined, without any means to access these