aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac101
1 files changed, 91 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 5525a5b0ed5..eb52365d95b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2776,7 +2776,7 @@ AS_VAR_IF([jit_flags],
[],
[AS_VAR_APPEND([CFLAGS_NODIST], [" $jit_flags"])
AS_VAR_SET([REGEN_JIT_COMMAND],
- ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host}"])
+ ["\$(PYTHON_FOR_REGEN) \$(srcdir)/Tools/jit/build.py ${ARCH_TRIPLES:-$host} --output-dir . --pyconfig-dir ."])
AS_VAR_SET([JIT_STENCILS_H], ["jit_stencils.h"])
AS_VAR_IF([Py_DEBUG],
[true],
@@ -3740,15 +3740,17 @@ dnl check for uuid dependencies
AH_TEMPLATE([HAVE_UUID_H], [Define to 1 if you have the <uuid.h> header file.])
AH_TEMPLATE([HAVE_UUID_UUID_H], [Define to 1 if you have the <uuid/uuid.h> header file.])
AH_TEMPLATE([HAVE_UUID_GENERATE_TIME_SAFE], [Define if uuid_generate_time_safe() exists.])
+AH_TEMPLATE([HAVE_UUID_GENERATE_TIME_SAFE_STABLE_MAC], [Define if uuid_generate_time_safe() is able to deduce a MAC address.])
have_uuid=missing
dnl AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1
dnl (anno 2007). FreeBSD and OpenBSD provides support in libc as well.
dnl Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet
dnl stream in big-endian byte-order
-AC_CHECK_HEADERS([uuid.h],
- [AC_CHECK_FUNCS([uuid_create uuid_enc_be],
- [have_uuid=yes
+AC_CHECK_HEADERS([uuid.h], [
+ AC_CHECK_FUNCS([uuid_create uuid_enc_be], [
+ have_uuid=yes
+ ac_cv_have_uuid_h=yes
LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
LIBUUID_LIBS=${LIBUUID_LIBS-""}
])
@@ -3758,19 +3760,29 @@ AS_VAR_IF([have_uuid], [missing], [
PKG_CHECK_MODULES(
[LIBUUID], [uuid >= 2.20],
[dnl linux-util's libuuid has uuid_generate_time_safe() since v2.20 (2011)
- dnl and provides <uuid.h>.
+ dnl and provides <uuid.h> assuming specific include paths are given
have_uuid=yes
- AC_DEFINE([HAVE_UUID_H], [1])
- AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1])
+ ac_cv_have_uuid_generate_time_safe=yes
+ # The uuid.h file to include may be <uuid.h> *or* <uuid/uuid.h>.
+ # Since pkg-config --cflags uuid may return -I/usr/include/uuid,
+ # it's possible to write '#include <uuid.h>' in _uuidmodule.c,
+ # assuming that the compiler flags are properly updated.
+ #
+ # Ideally, we should have defined HAVE_UUID_H if and only if
+ # #include <uuid.h> can be written, *without* assuming extra
+ # include path.
+ ac_cv_have_uuid_h=yes
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
LIBS="$LIBS $LIBUUID_LIBS"
AC_CHECK_HEADERS([uuid/uuid.h], [
+ ac_cv_have_uuid_uuid_h=yes
PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
- PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
- [have_uuid=yes
- AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1]) ]) ])
+ PY_CHECK_LIB([uuid], [uuid_generate_time_safe], [
+ have_uuid=yes
+ ac_cv_have_uuid_generate_time_safe=yes
+ ])])
AS_VAR_IF([have_uuid], [yes], [
LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
LIBUUID_LIBS=${LIBUUID_LIBS-"-luuid"}
@@ -3785,12 +3797,19 @@ AS_VAR_IF([have_uuid], [missing], [
AC_CHECK_HEADERS([uuid/uuid.h], [
AC_CHECK_FUNC([uuid_generate_time], [
have_uuid=yes
+ ac_cv_have_uuid_uuid_h=yes
LIBUUID_CFLAGS=${LIBUUID_CFLAGS-""}
LIBUUID_LIBS=${LIBUUID_LIBS-""}
])
])
])
+AS_VAR_IF([ac_cv_have_uuid_h], [yes], [AC_DEFINE([HAVE_UUID_H], [1])])
+AS_VAR_IF([ac_cv_have_uuid_uuid_h], [yes], [AC_DEFINE([HAVE_UUID_UUID_H], [1])])
+AS_VAR_IF([ac_cv_have_uuid_generate_time_safe], [yes], [
+ AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1])
+])
+
# gh-124228: While the libuuid library is available on NetBSD, it supports only UUID version 4.
# This restriction inhibits the proper generation of time-based UUIDs.
if test "$ac_sys_system" = "NetBSD"; then
@@ -3800,6 +3819,68 @@ fi
AS_VAR_IF([have_uuid], [missing], [have_uuid=no])
+# gh-132710: The UUID node is fetched by using libuuid when possible
+# and cached. While the node is constant within the same process,
+# different interpreters may have different values as libuuid may
+# randomize the node value if the latter cannot be deduced.
+#
+# Consumers may define HAVE_UUID_GENERATE_TIME_SAFE_STABLE_MAC
+# to indicate that libuuid is unstable and should not be relied
+# upon to deduce the MAC address.
+AC_DEFUN([PY_EXTRACT_UUID_GENERATE_TIME_SAFE_MAC], [WITH_SAVE_ENV([
+ # Be sure to add the extra include path if we used pkg-config
+ # as HAVE_UUID_H may be set even though <uuid.h> is only reachable
+ # by adding extra -I flags.
+ #
+ # If the following script does not compile, we simply assume that
+ # libuuid is missing.
+ CFLAGS="$CFLAGS $LIBUUID_CFLAGS"
+ LIBS="$LIBS $LIBUUID_LIBS"
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <inttypes.h> // PRIu64
+ #include <stdint.h> // uint64_t
+ #include <stdio.h> // fopen(), fclose()
+
+ #ifdef HAVE_UUID_H
+ #include <uuid.h>
+ #else
+ #include <uuid/uuid.h>
+ #endif
+
+ #define ERR 1
+ int main(void) {
+ uuid_t uuid; // unsigned char[16]
+ (void)uuid_generate_time_safe(uuid);
+ uint64_t node = 0;
+ for (size_t i = 0; i < 6; i++) {
+ node |= (uint64_t)uuid[15 - i] << (8 * i);
+ }
+ FILE *fp = fopen("conftest.out", "w");
+ if (fp == NULL) {
+ return ERR;
+ }
+ int rc = fprintf(fp, "%" PRIu64 "\n", node) >= 0;
+ rc |= fclose(fp);
+ return rc == 0 ? 0 : ERR;
+ }]])], [
+ AS_VAR_SET([$1], [`cat conftest.out`])
+ ], [], []
+ )])])
+
+if test "$have_uuid" = "yes" -a "$HAVE_UUID_GENERATE_TIME_SAFE" = "1"
+then
+ AC_MSG_CHECKING([if uuid_generate_time_safe() node value is stable])
+ PY_EXTRACT_UUID_GENERATE_TIME_SAFE_MAC([py_cv_uuid_node1])
+ PY_EXTRACT_UUID_GENERATE_TIME_SAFE_MAC([py_cv_uuid_node2])
+ if test -n "$py_cv_uuid_node1" -a "$py_cv_uuid_node1" = "$py_cv_uuid_node2"
+ then
+ AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE_STABLE_MAC], [1])
+ AC_MSG_RESULT([stable])
+ else
+ AC_MSG_RESULT([unstable])
+ fi
+fi
+
# 'Real Time' functions on Solaris
# posix4 on Solaris 2.6
# pthread (first!) on Linux