From fc012d801202a9ea139df143b934778060d51a60 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 6 Dec 2021 22:43:44 +0200 Subject: bpo-45847: Fix uuid detection on macOS (GH-29946) --- configure | 33 +++++++++++++++++++++++++++++++-- configure.ac | 14 +++++++++++++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/configure b/configure index fca9567..2237e6e 100755 --- a/configure +++ b/configure @@ -10623,7 +10623,6 @@ fi 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" @@ -10754,7 +10753,6 @@ $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" @@ -10895,6 +10893,37 @@ fi fi +if test "x$have_uuid" = xmissing; then : + + 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 + + ac_fn_c_check_func "$LINENO" "uuid_generate_time" "ac_cv_func_uuid_generate_time" +if test "x$ac_cv_func_uuid_generate_time" = xyes; then : + + have_uuid=yes + LIBUUID_CFLAGS= + LIBUUID_LIBS= + +fi + + +fi + +done + + +fi + +if test "x$have_uuid" = xmissing; then : + have_uuid=no +fi + # 'Real Time' functions on Solaris # posix4 on Solaris 2.6 # pthread (first!) on Linux diff --git a/configure.ac b/configure.ac index c7c7125..f1aac2d 100644 --- a/configure.ac +++ b/configure.ac @@ -2963,7 +2963,6 @@ AS_VAR_IF([have_uuid], [missing], [ ], [ 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]) @@ -2979,6 +2978,19 @@ AS_VAR_IF([have_uuid], [missing], [ ) ]) +dnl macOS has uuid/uuid.h but uuid_generate_time is in libc +AS_VAR_IF([have_uuid], [missing], [ + AC_CHECK_HEADERS([uuid/uuid.h], [ + AC_CHECK_FUNC([uuid_generate_time], [ + have_uuid=yes + LIBUUID_CFLAGS= + LIBUUID_LIBS= + ]) + ]) +]) + +AS_VAR_IF([have_uuid], [missing], [have_uuid=no]) + # 'Real Time' functions on Solaris # posix4 on Solaris 2.6 # pthread (first!) on Linux -- cgit v0.12