summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-11-18 08:18:44 (GMT)
committerGitHub <noreply@github.com>2021-11-18 08:18:44 (GMT)
commit25ecc040d007a55e4b5c30fa739054b52c1aacac (patch)
treea804c5fba2fba0e13a45dbd723eafee1f08f833f /configure.ac
parentfc4474e45eecbea8e88095f28c98c5d56438d841 (diff)
downloadcpython-25ecc040d007a55e4b5c30fa739054b52c1aacac.zip
cpython-25ecc040d007a55e4b5c30fa739054b52c1aacac.tar.gz
cpython-25ecc040d007a55e4b5c30fa739054b52c1aacac.tar.bz2
bpo-45573: Introduce extension module flags in Makefile (GH-29594)
``configure`` now uses a standardized format to forward state, compiler flags, and linker flags to ``Makefile``, ``setup.py``, and ``Modules/Setup``. ``makesetup`` use the new variables by default if a module line does not contain any compiler or linker flags. ``setup.py`` has a new function ``addext()``. For a module ``egg``, configure adds: * ``MODULE_EGG`` with value yes, missing, disabled, or n/a * ``MODULE_EGG_CFLAGS`` * ``MODULE_EGG_LDFLAGS`` ``Makefile.pre.in`` may also provide ``MODULE_EGG_DEPS`` that lists dependencies such as header files and static libs. Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac62
1 files changed, 62 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f43030e..43c8f76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5936,6 +5936,68 @@ else
fi
AC_SUBST(TEST_MODULES)
+dnl Modules that are not available on some platforms
+dnl AIX has shadow passwords, but access is not via getspent()
+dnl VxWorks does not provide crypt() function
+AS_CASE([$ac_sys_system],
+ [AIX], [py_stdlib_not_available="_scproxy spwd"],
+ [VxWorks*], [py_stdlib_not_available="_scproxy _crypt termios grp"],
+ [Darwin], [py_stdlib_not_available="ossaudiodev spwd"],
+ [CYGWIN*], [py_stdlib_not_available="_scproxy nis"],
+ [QNX*], [py_stdlib_not_available="_scproxy nis"],
+ [FreeBSD*], [py_stdlib_not_available="_scproxy spwd"],
+ [py_stdlib_not_available="_scproxy"]
+)
+
+dnl _MODULE_BLOCK_ADD([VAR], [VALUE])
+dnl internal: adds $1=quote($2) to MODULE_BLOCK
+AC_DEFUN([_MODULE_BLOCK_ADD], [AS_VAR_APPEND([MODULE_BLOCK], ["$1=_AS_QUOTE([$2])$as_nl"])])
+MODULE_BLOCK=
+
+dnl Check for stdlib extension modules
+dnl PY_STDLIB_MOD([NAME], [ENABLED-TEST], [SUPPORTED-TEST], [CFLAGS], [LDFLAGS])
+dnl sets MODULE_$NAME based on $py_stdlib_not_available, ENABLED-TEST,
+dnl and SUPPORTED_TEST. ENABLED-TEST and SUPPORTED-TEST default to true if
+dnl empty.
+dnl n/a: $NAME in $py_stdlib_not_available (not available on platform)
+dnl yes: enabled and supported
+dnl missing: enabled and not supported
+dnl disabled: not enabled
+dnl sets MODULE_$NAME_CFLAGS and MODULE_$NAME_LDFLAGS
+AC_DEFUN([PY_STDLIB_MOD], [
+ AC_MSG_CHECKING([for stdlib extension module $1])
+ m4_pushdef([modcond], [MODULE_]m4_toupper([$1]))dnl
+ m4_pushdef([modstate], [py_cv_module_$1])dnl
+ AS_CASE([$py_stdlib_not_available],
+ [*$1*], [modstate=n/a],
+ [
+ AS_IF(m4_ifblank([$2], [true], [$2]),
+ [AS_IF([m4_ifblank([$3], [true], [$3])], [modstate=yes], [modstate=missing])],
+ [modstate=disabled]
+ )
+ ]
+ )
+ _MODULE_BLOCK_ADD(modcond, [$modstate])
+ AS_VAR_IF([modstate], [yes], [
+ _MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_CFLAGS], [$4])
+ _MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_LDFLAGS], [$5])
+ AM_CONDITIONAL(modcond, [true])
+ ], [
+ AM_CONDITIONAL(modcond, [false])
+ ])
+ AC_MSG_RESULT([$modstate])
+ m4_popdef([modcond])dnl
+ m4_popdef([modstate])dnl
+])
+
+dnl _elementtree loads libexpat via CAPI hook in pyexpat
+PY_STDLIB_MOD([pyexpat], [], [], [$LIBEXPAT_CFLAGS], [$LIBEXPAT_LDFLAGS])
+PY_STDLIB_MOD([_elementtree], [], [], [$LIBEXPAT_CFLAGS], [])
+
+PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS])
+
+# substitute multiline block, must come after last PY_STDLIB_MOD()
+AC_SUBST([MODULE_BLOCK])
# generate output files
AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)