diff options
author | Christian Heimes <christian@python.org> | 2021-11-24 09:20:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 09:20:37 (GMT) |
commit | 8af6481f6b7d43646c47d8fa6cc6d5eb465e2b0f (patch) | |
tree | b0eea88b3769dabc134777ba981a795eff554ac4 /configure.ac | |
parent | d5cd2effa69551c6bc7edfef8a414d545dea9117 (diff) | |
download | cpython-8af6481f6b7d43646c47d8fa6cc6d5eb465e2b0f.zip cpython-8af6481f6b7d43646c47d8fa6cc6d5eb465e2b0f.tar.gz cpython-8af6481f6b7d43646c47d8fa6cc6d5eb465e2b0f.tar.bz2 |
bpo-45847: Port _uuid to PY_STDLIB_MOD (GH-29741)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/configure.ac b/configure.ac index a161a8c..4961e5a 100644 --- a/configure.ac +++ b/configure.ac @@ -2871,31 +2871,51 @@ AC_CHECK_LIB(sendfile, sendfile) AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX -# checks for uuid.h location -AC_CHECK_HEADERS([uuid/uuid.h uuid.h]) -AC_CACHE_CHECK([for uuid_generate_time_safe], [ac_cv_lib_uuid_uuid_generate_time_safe], [ -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid/uuid.h>]], [[ -#ifndef uuid_generate_time_safe -void *x = uuid_generate_time_safe -#endif -]])], -[ac_cv_lib_uuid_uuid_generate_time_safe=yes], [ac_cv_lib_uuid_uuid_generate_time_safe=no]) -]) -AS_VAR_IF([ac_cv_lib_uuid_uuid_generate_time_safe], [yes], [ - AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE, 1, [Define if uuid_generate_time_safe() exists.]) +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.]) +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 + LIBUUID_CFLAGS= + LIBUUID_LIBS= + ]) ]) -# check for libuuid from util-linux -save_LIBS=$LIBS -AC_CHECK_LIB([uuid], [uuid_generate_time]) -LIBS=$save_LIBS - -# AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) -# FreeBSD and OpenBSD provides support in libc as well. -# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet -# stream in big-endian byte-order -AC_CHECK_FUNCS([uuid_create uuid_enc_be]) +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>. + have_uuid=yes + AC_DEFINE([HAVE_UUID_H], [1]) + AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1]) + ], [ + LIBUUID_LIBS="-luuid" + LIBUUID_CFLAGS= + have_uuid=no + AC_CHECK_HEADERS([uuid/uuid.h], [ + WITH_SAVE_ENV( + [AC_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes]) + ]) + WITH_SAVE_ENV([ + AC_CHECK_LIB([uuid], [uuid_generate_time_safe], [ + have_uuid=yes + AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1]) + ]) + ]) + ]) + ] + ) +]) # 'Real Time' functions on Solaris # posix4 on Solaris 2.6 @@ -6299,6 +6319,9 @@ PY_STDLIB_MOD([_sqlite3], [test "$have_sqlite3" = "yes"], [test "$have_supported_sqlite3" = "yes"], [$LIBSQLITE3_CFLAGS], [$LIBSQLITE3_LIBS]) +PY_STDLIB_MOD([_uuid], + [], [test "$have_uuid" = "yes"], + [$LIBUUID_CFLAGS], [$LIBUUID_LIBS]) dnl compression libs PY_STDLIB_MOD([zlib], [], [test "$have_zlib" = yes], |