bpo-11063: Add a configure check for uuid_generate_time_safe (GH-4287)
This commit is contained in:
parent
bf9d317626
commit
9a10ff4deb
|
@ -4,17 +4,10 @@
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
|
|
||||||
|
|
||||||
/* bpo-11063: libuuid on macOS doesn't provide uuid_generate_time_safe(),
|
|
||||||
only uuid_generate_time(). */
|
|
||||||
#ifndef __APPLE__
|
|
||||||
# define HAVE_TIME_SAFE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
py_uuid_generate_time_safe(void)
|
py_uuid_generate_time_safe(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TIME_SAFE
|
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
|
||||||
uuid_t out;
|
uuid_t out;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
@ -45,7 +38,7 @@ PyInit__uuid(void)
|
||||||
{
|
{
|
||||||
PyObject *mod;
|
PyObject *mod;
|
||||||
assert(sizeof(uuid_t) == 16);
|
assert(sizeof(uuid_t) == 16);
|
||||||
#ifdef HAVE_TIME_SAFE
|
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
|
||||||
int has_uuid_generate_time_safe = 1;
|
int has_uuid_generate_time_safe = 1;
|
||||||
#else
|
#else
|
||||||
int has_uuid_generate_time_safe = 0;
|
int has_uuid_generate_time_safe = 0;
|
||||||
|
|
|
@ -9512,6 +9512,37 @@ _ACEOF
|
||||||
fi
|
fi
|
||||||
# Dynamic linking for HP-UX
|
# Dynamic linking for HP-UX
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate_time_safe" >&5
|
||||||
|
$as_echo_n "checking for uuid_generate_time_safe... " >&6; }
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <uuid/uuid.h>
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifndef uuid_generate_time_safe
|
||||||
|
uuid_t out;
|
||||||
|
uuid_generate_time_safe(out);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_compile "$LINENO"; then :
|
||||||
|
|
||||||
|
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||||
|
$as_echo "yes" >&6; }
|
||||||
|
else
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||||
|
$as_echo "no" >&6; }
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5
|
||||||
$as_echo_n "checking for library containing sem_init... " >&6; }
|
$as_echo_n "checking for library containing sem_init... " >&6; }
|
||||||
if ${ac_cv_search_sem_init+:} false; then :
|
if ${ac_cv_search_sem_init+:} false; then :
|
||||||
|
|
12
configure.ac
12
configure.ac
|
@ -2677,6 +2677,18 @@ 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
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for uuid_generate_time_safe)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <uuid/uuid.h>]], [[
|
||||||
|
#ifndef uuid_generate_time_safe
|
||||||
|
uuid_t out;
|
||||||
|
uuid_generate_time_safe(out);
|
||||||
|
#endif
|
||||||
|
]])],
|
||||||
|
[AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE, 1, Define if uuid_generate_time_safe() exists.)
|
||||||
|
AC_MSG_RESULT(yes)],
|
||||||
|
[AC_MSG_RESULT(no)]
|
||||||
|
)
|
||||||
|
|
||||||
AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
|
AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
|
||||||
# posix4 on Solaris 2.6
|
# posix4 on Solaris 2.6
|
||||||
# pthread (first!) on Linux
|
# pthread (first!) on Linux
|
||||||
|
|
|
@ -1187,6 +1187,9 @@
|
||||||
/* Define to 1 if you have the <utime.h> header file. */
|
/* Define to 1 if you have the <utime.h> header file. */
|
||||||
#undef HAVE_UTIME_H
|
#undef HAVE_UTIME_H
|
||||||
|
|
||||||
|
/* Define if uuid_generate_time_safe() exists. */
|
||||||
|
#undef HAVE_UUID_GENERATE_TIME_SAFE
|
||||||
|
|
||||||
/* Define to 1 if you have the `wait3' function. */
|
/* Define to 1 if you have the `wait3' function. */
|
||||||
#undef HAVE_WAIT3
|
#undef HAVE_WAIT3
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue