Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-11063: Add a configure check for uuid_generate_time_safe #4287

Merged
merged 5 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
another attempt
  • Loading branch information
berkerpeksag committed Nov 7, 2017
commit 9688f318755507fef58dec59bad9dd681f03a4fa
4 changes: 2 additions & 2 deletions Modules/_uuidmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
static PyObject *
py_uuid_generate_time_safe(void)
{
#ifdef HAVE_LIBUUID
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
uuid_t out;
int res;

Expand Down Expand Up @@ -38,7 +38,7 @@ PyInit__uuid(void)
{
PyObject *mod;
assert(sizeof(uuid_t) == 16);
#ifdef HAVE_LIBUUID
#ifdef HAVE_UUID_GENERATE_TIME_SAFE
int has_uuid_generate_time_safe = 1;
#else
int has_uuid_generate_time_safe = 0;
Expand Down
58 changes: 39 additions & 19 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -9511,13 +9511,13 @@ _ACEOF

fi
# Dynamic linking for HP-UX
{ $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 "$as_me:${as_lineno-$LINENO}: checking for library containing uuid_generate_time_safe" >&5
$as_echo_n "checking for library containing uuid_generate_time_safe... " >&6; }
if ${ac_cv_search_uuid_generate_time_safe+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-luuid $LIBS"
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

Expand All @@ -9536,25 +9536,45 @@ 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
for ac_lib in '' uuid; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_uuid_generate_time_safe=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
conftest$ac_exeext
if ${ac_cv_search_uuid_generate_time_safe+:} false; then :
break
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 :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBUUID 1
_ACEOF

LIBS="-luuid $LIBS"
done
if ${ac_cv_search_uuid_generate_time_safe+:} false; then :

else
ac_cv_search_uuid_generate_time_safe=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_uuid_generate_time_safe" >&5
$as_echo "$ac_cv_search_uuid_generate_time_safe" >&6; }
ac_res=$ac_cv_search_uuid_generate_time_safe
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"

>...
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h


else

>...
$as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 0" >>confdefs.h



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sem_init" >&5
Expand Down
7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2676,7 +2676,12 @@ AC_MSG_RESULT($SHLIBS)
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
AC_CHECK_LIB(uuid, uuid_generate_time_safe)

AC_SEARCH_LIBS([uuid_generate_time_safe], [uuid], [
>...AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [1], [Define if uuid_generate_time_safe() exists.])
], [
>...AC_DEFINE([HAVE_UUID_GENERATE_TIME_SAFE], [0], [Define if uuid_generate_time_safe() exists.])
]

AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
# posix4 on Solaris 2.6
Expand Down
6 changes: 3 additions & 3 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,6 @@
/* Define to 1 if you have the <libutil.h> header file. */
#undef HAVE_LIBUTIL_H

/* Define to 1 if you have the `uuid' library (-luuid). */
#undef HAVE_LIBUUID

/* Define if you have the 'link' function. */
#undef HAVE_LINK

Expand Down Expand Up @@ -1190,6 +1187,9 @@
/* Define to 1 if you have the <utime.h> header file. */
#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. */
#undef HAVE_WAIT3

Expand Down