bpo-45847: Port _uuid to PY_STDLIB_MOD (GH-29741)

This commit is contained in:
Christian Heimes 2021-11-24 11:20:37 +02:00 committed by GitHub
parent d5cd2effa6
commit 8af6481f6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 414 additions and 97 deletions

View File

@ -136,6 +136,8 @@
# needs -lcrypt # needs -lcrypt
@MODULE__HASHLIB_TRUE@_hashlib _hashopenssl.c @MODULE__HASHLIB_TRUE@_hashlib _hashopenssl.c
# Linux: -luuid, BSD/AIX: libc's uuid_create()
@MODULE__UUID_TRUE@_uuid _uuidmodule.c
############################################################################ ############################################################################
# macOS specific modules # macOS specific modules

View File

@ -6,10 +6,12 @@
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
#ifdef HAVE_UUID_UUID_H #if defined(HAVE_UUID_H)
#include <uuid/uuid.h> // AIX, FreeBSD, libuuid with pkgconf
#elif defined(HAVE_UUID_H) #include <uuid.h>
#include <uuid.h> #elif defined(HAVE_UUID_UUID_H)
// libuuid without pkgconf
#include <uuid/uuid.h>
#endif #endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS

417
configure vendored
View File

@ -654,6 +654,8 @@ MODULE_BINASCII_FALSE
MODULE_BINASCII_TRUE MODULE_BINASCII_TRUE
MODULE_ZLIB_FALSE MODULE_ZLIB_FALSE
MODULE_ZLIB_TRUE MODULE_ZLIB_TRUE
MODULE__UUID_FALSE
MODULE__UUID_TRUE
MODULE__SQLITE3_FALSE MODULE__SQLITE3_FALSE
MODULE__SQLITE3_TRUE MODULE__SQLITE3_TRUE
MODULE_NIS_FALSE MODULE_NIS_FALSE
@ -827,6 +829,8 @@ LIBEXPAT_INTERNAL
LIBEXPAT_LDFLAGS LIBEXPAT_LDFLAGS
LIBEXPAT_CFLAGS LIBEXPAT_CFLAGS
TZPATH TZPATH
LIBUUID_LIBS
LIBUUID_CFLAGS
SHLIBS SHLIBS
CFLAGSFORSHARED CFLAGSFORSHARED
LINKFORSHARED LINKFORSHARED
@ -1046,6 +1050,8 @@ LIBS
CPPFLAGS CPPFLAGS
CPP CPP
PROFILE_TASK PROFILE_TASK
LIBUUID_CFLAGS
LIBUUID_LIBS
LIBNSL_CFLAGS LIBNSL_CFLAGS
LIBNSL_LIBS LIBNSL_LIBS
LIBSQLITE3_CFLAGS LIBSQLITE3_CFLAGS
@ -1833,6 +1839,10 @@ Some influential environment variables:
CPP C preprocessor CPP C preprocessor
PROFILE_TASK PROFILE_TASK
Python args for PGO generation task Python args for PGO generation task
LIBUUID_CFLAGS
C compiler flags for LIBUUID, overriding pkg-config
LIBUUID_LIBS
linker flags for LIBUUID, overriding pkg-config
LIBNSL_CFLAGS LIBNSL_CFLAGS
C compiler flags for LIBNSL, overriding pkg-config C compiler flags for LIBNSL, overriding pkg-config
LIBNSL_LIBS linker flags for LIBNSL, overriding pkg-config LIBNSL_LIBS linker flags for LIBNSL, overriding pkg-config
@ -10371,62 +10381,121 @@ _ACEOF
fi fi
# Dynamic linking for HP-UX # Dynamic linking for HP-UX
# checks for uuid.h location
for ac_header in uuid/uuid.h uuid.h have_uuid=missing
for ac_header in uuid.h
do : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default"
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if test "x$ac_cv_header_uuid_h" = xyes; then :
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 #define HAVE_UUID_H 1
_ACEOF _ACEOF
for ac_func in uuid_create uuid_enc_be
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
have_uuid=yes
LIBUUID_CFLAGS=
LIBUUID_LIBS=
fi
done
fi fi
done done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time_safe" >&5
$as_echo_n "checking for uuid_generate_time_safe... " >&6; }
if ${ac_cv_lib_uuid_uuid_generate_time_safe+:} false; then :
$as_echo_n "(cached) " >&6
if test "x$have_uuid" = xmissing; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUUID" >&5
$as_echo_n "checking for LIBUUID... " >&6; }
if test -n "$LIBUUID_CFLAGS"; then
pkg_cv_LIBUUID_CFLAGS="$LIBUUID_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"uuid >= 2.20\""; } >&5
($PKG_CONFIG --exists --print-errors "uuid >= 2.20") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBUUID_CFLAGS=`$PKG_CONFIG --cflags "uuid >= 2.20" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBUUID_LIBS"; then
pkg_cv_LIBUUID_LIBS="$LIBUUID_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"uuid >= 2.20\""; } >&5
($PKG_CONFIG --exists --print-errors "uuid >= 2.20") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBUUID_LIBS=`$PKG_CONFIG --libs "uuid >= 2.20" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <uuid/uuid.h>
int
main ()
{
#ifndef uuid_generate_time_safe
void *x = uuid_generate_time_safe
#endif
; if test $pkg_failed = yes; then
return 0; { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
} $as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBUUID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "uuid >= 2.20" 2>&1`
else
LIBUUID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "uuid >= 2.20" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBUUID_PKG_ERRORS" >&5
LIBUUID_LIBS="-luuid"
LIBUUID_CFLAGS=
have_uuid=no
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_UUID_H 1
_ACEOF _ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_lib_uuid_uuid_generate_time_safe=yes
else
ac_cv_lib_uuid_uuid_generate_time_safe=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time_safe" >&5 save_CPPFLAGS=$CPPFLAGS
$as_echo "$ac_cv_lib_uuid_uuid_generate_time_safe" >&6; } save_LDFLAGS=$LDFLAGS
if test "x$ac_cv_lib_uuid_uuid_generate_time_safe" = xyes; then :
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
fi
# check for libuuid from util-linux
save_LIBS=$LIBS save_LIBS=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time in -luuid" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time in -luuid" >&5
$as_echo_n "checking for uuid_generate_time in -luuid... " >&6; } $as_echo_n "checking for uuid_generate_time in -luuid... " >&6; }
if ${ac_cv_lib_uuid_uuid_generate_time+:} false; then : if ${ac_cv_lib_uuid_uuid_generate_time+:} false; then :
@ -10464,33 +10533,227 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time" >&5
$as_echo "$ac_cv_lib_uuid_uuid_generate_time" >&6; } $as_echo "$ac_cv_lib_uuid_uuid_generate_time" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate_time" = xyes; then : if test "x$ac_cv_lib_uuid_uuid_generate_time" = xyes; then :
cat >>confdefs.h <<_ACEOF have_uuid=yes
#define HAVE_LIBUUID 1
_ACEOF
LIBS="-luuid $LIBS"
fi fi
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS 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. save_CFLAGS=$CFLAGS
# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet save_CPPFLAGS=$CPPFLAGS
# stream in big-endian byte-order save_LDFLAGS=$LDFLAGS
for ac_func in uuid_create uuid_enc_be save_LIBS=$LIBS
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time_safe in -luuid" >&5
if eval test \"x\$"$as_ac_var"\" = x"yes"; then : $as_echo_n "checking for uuid_generate_time_safe in -luuid... " >&6; }
cat >>confdefs.h <<_ACEOF if ${ac_cv_lib_uuid_uuid_generate_time_safe+:} false; then :
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 $as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_generate_time_safe ();
int
main ()
{
return uuid_generate_time_safe ();
;
return 0;
}
_ACEOF _ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_uuid_uuid_generate_time_safe=yes
else
ac_cv_lib_uuid_uuid_generate_time_safe=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time_safe" >&5
$as_echo "$ac_cv_lib_uuid_uuid_generate_time_safe" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate_time_safe" = xyes; then :
have_uuid=yes
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
fi fi
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
fi
done done
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
LIBUUID_LIBS="-luuid"
LIBUUID_CFLAGS=
have_uuid=no
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
if test "x$ac_cv_header_uuid_uuid_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UUID_UUID_H 1
_ACEOF
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time in -luuid" >&5
$as_echo_n "checking for uuid_generate_time in -luuid... " >&6; }
if ${ac_cv_lib_uuid_uuid_generate_time+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_generate_time ();
int
main ()
{
return uuid_generate_time ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_uuid_uuid_generate_time=yes
else
ac_cv_lib_uuid_uuid_generate_time=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time" >&5
$as_echo "$ac_cv_lib_uuid_uuid_generate_time" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate_time" = xyes; then :
have_uuid=yes
fi
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time_safe in -luuid" >&5
$as_echo_n "checking for uuid_generate_time_safe in -luuid... " >&6; }
if ${ac_cv_lib_uuid_uuid_generate_time_safe+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char uuid_generate_time_safe ();
int
main ()
{
return uuid_generate_time_safe ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_uuid_uuid_generate_time_safe=yes
else
ac_cv_lib_uuid_uuid_generate_time_safe=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate_time_safe" >&5
$as_echo "$ac_cv_lib_uuid_uuid_generate_time_safe" >&6; }
if test "x$ac_cv_lib_uuid_uuid_generate_time_safe" = xyes; then :
have_uuid=yes
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
fi
CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS
fi
done
else
LIBUUID_CFLAGS=$pkg_cv_LIBUUID_CFLAGS
LIBUUID_LIBS=$pkg_cv_LIBUUID_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_uuid=yes
$as_echo "#define HAVE_UUID_H 1" >>confdefs.h
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
fi
fi
# 'Real Time' functions on Solaris # 'Real Time' functions on Solaris
# posix4 on Solaris 2.6 # posix4 on Solaris 2.6
# pthread (first!) on Linux # pthread (first!) on Linux
@ -21905,6 +22168,42 @@ fi
$as_echo "$py_cv_module__sqlite3" >&6; } $as_echo "$py_cv_module__sqlite3" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _uuid" >&5
$as_echo_n "checking for stdlib extension module _uuid... " >&6; }
case $py_stdlib_not_available in #(
*_uuid*) :
py_cv_module__uuid=n/a ;; #(
*) :
if true; then :
if test "$have_uuid" = "yes"; then :
py_cv_module__uuid=yes
else
py_cv_module__uuid=missing
fi
else
py_cv_module__uuid=disabled
fi
;;
esac
as_fn_append MODULE_BLOCK "MODULE__UUID=$py_cv_module__uuid$as_nl"
if test "x$py_cv_module__uuid" = xyes; then :
as_fn_append MODULE_BLOCK "MODULE__UUID_CFLAGS=$LIBUUID_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__UUID_LDFLAGS=$LIBUUID_LIBS$as_nl"
fi
if test "$py_cv_module__uuid" = yes; then
MODULE__UUID_TRUE=
MODULE__UUID_FALSE='#'
else
MODULE__UUID_TRUE='#'
MODULE__UUID_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__uuid" >&5
$as_echo "$py_cv_module__uuid" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module zlib" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module zlib" >&5
$as_echo_n "checking for stdlib extension module zlib... " >&6; } $as_echo_n "checking for stdlib extension module zlib... " >&6; }
@ -22774,6 +23073,10 @@ if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then
as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined. as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi fi
if test -z "${MODULE__UUID_TRUE}" && test -z "${MODULE__UUID_FALSE}"; then
as_fn_error $? "conditional \"MODULE__UUID\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_ZLIB_TRUE}" && test -z "${MODULE_ZLIB_FALSE}"; then if test -z "${MODULE_ZLIB_TRUE}" && test -z "${MODULE_ZLIB_FALSE}"; then
as_fn_error $? "conditional \"MODULE_ZLIB\" was never defined. as_fn_error $? "conditional \"MODULE_ZLIB\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5 Usually this means the macro was only invoked conditionally." "$LINENO" 5

View File

@ -2871,31 +2871,51 @@ AC_CHECK_LIB(sendfile, sendfile)
AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX 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], [ dnl check for uuid dependencies
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid/uuid.h>]], [[ AH_TEMPLATE([HAVE_UUID_H], [Define to 1 if you have the <uuid.h> header file.])
#ifndef uuid_generate_time_safe AH_TEMPLATE([HAVE_UUID_UUID_H], [Define to 1 if you have the <uuid/uuid.h> header file.])
void *x = uuid_generate_time_safe AH_TEMPLATE([HAVE_UUID_GENERATE_TIME_SAFE], [Define if uuid_generate_time_safe() exists.])
#endif have_uuid=missing
]])],
[ac_cv_lib_uuid_uuid_generate_time_safe=yes], [ac_cv_lib_uuid_uuid_generate_time_safe=no]) 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.
AS_VAR_IF([ac_cv_lib_uuid_uuid_generate_time_safe], [yes], [ dnl Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet
AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE, 1, [Define if uuid_generate_time_safe() exists.]) 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 AS_VAR_IF([have_uuid], [missing], [
save_LIBS=$LIBS PKG_CHECK_MODULES(
AC_CHECK_LIB([uuid], [uuid_generate_time]) [LIBUUID], [uuid >= 2.20], [
LIBS=$save_LIBS dnl linux-util's libuuid has uuid_generate_time_safe() since v2.20 (2011)
dnl and provides <uuid.h>.
# AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) have_uuid=yes
# FreeBSD and OpenBSD provides support in libc as well. AC_DEFINE([HAVE_UUID_H], [1])
# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1])
# stream in big-endian byte-order ], [
AC_CHECK_FUNCS([uuid_create uuid_enc_be]) 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 # 'Real Time' functions on Solaris
# posix4 on Solaris 2.6 # posix4 on Solaris 2.6
@ -6299,6 +6319,9 @@ PY_STDLIB_MOD([_sqlite3],
[test "$have_sqlite3" = "yes"], [test "$have_sqlite3" = "yes"],
[test "$have_supported_sqlite3" = "yes"], [test "$have_supported_sqlite3" = "yes"],
[$LIBSQLITE3_CFLAGS], [$LIBSQLITE3_LIBS]) [$LIBSQLITE3_CFLAGS], [$LIBSQLITE3_LIBS])
PY_STDLIB_MOD([_uuid],
[], [test "$have_uuid" = "yes"],
[$LIBUUID_CFLAGS], [$LIBUUID_LIBS])
dnl compression libs dnl compression libs
PY_STDLIB_MOD([zlib], [], [test "$have_zlib" = yes], PY_STDLIB_MOD([zlib], [], [test "$have_zlib" = yes],

View File

@ -628,9 +628,6 @@
/* Define to 1 if you have the <libutil.h> header file. */ /* Define to 1 if you have the <libutil.h> header file. */
#undef HAVE_LIBUTIL_H #undef HAVE_LIBUTIL_H
/* Define to 1 if you have the `uuid' library (-luuid). */
#undef HAVE_LIBUUID
/* Define if you have the 'link' function. */ /* Define if you have the 'link' function. */
#undef HAVE_LINK #undef HAVE_LINK

View File

@ -1401,17 +1401,7 @@ class PyBuildExt(build_ext):
def detect_uuid(self): def detect_uuid(self):
# Build the _uuid module if possible # Build the _uuid module if possible
uuid_h = sysconfig.get_config_var("HAVE_UUID_H") self.addext(Extension('_uuid', ['_uuidmodule.c']))
uuid_uuid_h = sysconfig.get_config_var("HAVE_UUID_UUID_H")
if uuid_h or uuid_uuid_h:
if sysconfig.get_config_var("HAVE_LIBUUID"):
uuid_libs = ["uuid"]
else:
uuid_libs = []
self.add(Extension('_uuid', ['_uuidmodule.c'],
libraries=uuid_libs))
else:
self.missing.append('_uuid')
def detect_modules(self): def detect_modules(self):
# remove dummy extension # remove dummy extension