From 4ff23c7a3439edd9c16360f3863a03afaaa506c8 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 8 Jun 2020 23:04:48 +0100 Subject: [PATCH 1/2] bpo-40900: uuid module build fix on FreeBSD proposal. Adding a new --with-uuid configure directive. --- configure | 139 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 84 insertions(+), 55 deletions(-) diff --git a/configure b/configure index 1124412dce4753..610b571f4878aa 100755 --- a/configure +++ b/configure @@ -849,6 +849,7 @@ with_openssl with_ssl_default_suites with_builtin_hashlib_hashes with_experimental_isolated_subinterpreters +with_uuid ' ac_precious_vars='build_alias host_alias @@ -1588,6 +1589,7 @@ Optional Packages: --with-experimental-isolated-subinterpreters better isolate subinterpreters, experimental build mode (default is no) + --with-uuid=DIR override rott of libuuid to DIR Some influential environment variables: MACHDEP name for machine-dependent library files @@ -9819,55 +9821,64 @@ _ACEOF fi # Dynamic linking for HP-UX +uuiddirs="/usr /usr/local /usr/pkg" +if test "${with_uuid+set}" = set; then : + withval=$with_uuid; + case "$withval" in + "" | y | ye | yes | n | no) + as_fn_error $? "Invalid --with-uuid value" "$LINENO" 5 + ;; + *) uuiddirs="$withval" + ;; + esac +fi + # checks for uuid.h location -for ac_header in uuid/uuid.h uuid.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +found=false +for uuiddir in $uuiddirs; do +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid.h header" >&5 +$as_echo_n "checking for uuid.h header... " >&6; } + if test -f "$uuiddir/include/uuid.h"; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define HAVE_UUID_H 1 _ACEOF - -fi - -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; } +# AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) +# FreeBSD and OpenBSD provides support as well + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create" >&5 +$as_echo_n "checking for uuid_create... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include int main () { -#ifndef uuid_generate_time_safe -void *x = uuid_generate_time_safe +#ifndef uuid_create +void *x = uuid_create #endif ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + 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; } + $as_echo "#define HAVE_UUID_CREATE 1" >>confdefs.h -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } + found=true + break + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + $as_echo "no" >&6; } -# AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) -# FreeBSD and OpenBSD provides support as well -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create" >&5 -$as_echo_n "checking for uuid_create... " >&6; } + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet +# stream in big-endian byte-order + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_enc_be" >&5 +$as_echo_n "checking for uuid_enc_be... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -9875,58 +9886,76 @@ int main () { -#ifndef uuid_create -void *x = uuid_create +#ifndef uuid_enc_be +void *x = uuid_enc_be #endif ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO"; then : -$as_echo "#define HAVE_UUID_CREATE 1" >>confdefs.h + $as_echo "#define HAVE_UUID_ENC_BE 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $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 + found=true + break + 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 - -# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet -# stream in big-endian byte-order -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_enc_be" >&5 -$as_echo_n "checking for uuid_enc_be... " >&6; } + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid/uuid.h header" >&5 +$as_echo_n "checking for uuid/uuid.h header... " >&6; } + if test -f "$uuiddir/include/uuid/uuid.h"; then + cat >>confdefs.h <<_ACEOF +#define HAVE_UUID_UUID_H 1 +_ACEOF +{ $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 +#include int main () { -#ifndef uuid_enc_be -void *x = uuid_enc_be +#ifndef uuid_generate_time_safe +void *x = uuid_generate_time_safe #endif ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO"; then : -$as_echo "#define HAVE_UUID_ENC_BE 1" >>confdefs.h + $as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $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 + found=true + break + 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 + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + fi + if $found; then + CPPFLAGS="-I$uuiddir/include $CPPFLAGS" + LDFLAGS="-L$uuidir/lib $LDFLAGS" + break + fi +done + + # 'Real Time' functions on Solaris # posix4 on Solaris 2.6 From 718efbb105c051606b7df76894c84f8288eb0e32 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 11 Jun 2020 17:01:48 +0100 Subject: [PATCH 2/2] Reworking of the approach, detecting per header individually --- configure | 153 ++++++++++++++++++++++----------------------------- configure.ac | 69 ++++++++++++----------- 2 files changed, 104 insertions(+), 118 deletions(-) diff --git a/configure b/configure index 610b571f4878aa..1dd6e95386cec1 100755 --- a/configure +++ b/configure @@ -849,7 +849,6 @@ with_openssl with_ssl_default_suites with_builtin_hashlib_hashes with_experimental_isolated_subinterpreters -with_uuid ' ac_precious_vars='build_alias host_alias @@ -1589,7 +1588,6 @@ Optional Packages: --with-experimental-isolated-subinterpreters better isolate subinterpreters, experimental build mode (default is no) - --with-uuid=DIR override rott of libuuid to DIR Some influential environment variables: MACHDEP name for machine-dependent library files @@ -9821,139 +9819,120 @@ _ACEOF fi # Dynamic linking for HP-UX -uuiddirs="/usr /usr/local /usr/pkg" -if test "${with_uuid+set}" = set; then : - withval=$with_uuid; - case "$withval" in - "" | y | ye | yes | n | no) - as_fn_error $? "Invalid --with-uuid value" "$LINENO" 5 - ;; - *) uuiddirs="$withval" - ;; - esac -fi - # checks for uuid.h location -found=false -for uuiddir in $uuiddirs; do -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid.h header" >&5 -$as_echo_n "checking for uuid.h header... " >&6; } - if test -f "$uuiddir/include/uuid.h"; then - cat >>confdefs.h <<_ACEOF -#define HAVE_UUID_H 1 -_ACEOF -# AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) -# FreeBSD and OpenBSD provides support as well - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create" >&5 -$as_echo_n "checking for uuid_create... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +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 : + + +$as_echo "#define HAVE_UUID_UUID_H 1" >>confdefs.h + + { $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 +#include int main () { -#ifndef uuid_create -void *x = uuid_create +#ifndef uuid_generate_time_safe +void *x = uuid_generate_time_safe #endif ; return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define HAVE_UUID_CREATE 1" >>confdefs.h +$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; } - found=true - break - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 - $as_echo "no" >&6; } + { $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 -# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet -# stream in big-endian byte-order - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_enc_be" >&5 -$as_echo_n "checking for uuid_enc_be... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +else + +ac_fn_c_check_header_mongrel "$LINENO" "uuid.h" "ac_cv_header_uuid_h" "$ac_includes_default" +if test "x$ac_cv_header_uuid_h" = xyes; then : + + +$as_echo "#define HAVE_UUID_H 1" >>confdefs.h + + # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) + # FreeBSD and OpenBSD provides support as well + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create" >&5 +$as_echo_n "checking for uuid_create... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { -#ifndef uuid_enc_be -void *x = uuid_enc_be -#endif + #ifndef uuid_create + void *x = uuid_create + #endif ; return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define HAVE_UUID_ENC_BE 1" >>confdefs.h +$as_echo "#define HAVE_UUID_CREATE 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - found=true - break - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +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 - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid/uuid.h header" >&5 -$as_echo_n "checking for uuid/uuid.h header... " >&6; } - if test -f "$uuiddir/include/uuid/uuid.h"; then - cat >>confdefs.h <<_ACEOF -#define HAVE_UUID_UUID_H 1 -_ACEOF -{ $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 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + # Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet + # stream in big-endian byte-order + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_enc_be" >&5 +$as_echo_n "checking for uuid_enc_be... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include int main () { -#ifndef uuid_generate_time_safe -void *x = uuid_generate_time_safe +#ifndef uuid_enc_be +void *x = uuid_enc_be #endif ; return 0; } _ACEOF - if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define HAVE_UUID_GENERATE_TIME_SAFE 1" >>confdefs.h +$as_echo "#define HAVE_UUID_ENC_BE 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - found=true - break - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +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 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if $found; then - CPPFLAGS="-I$uuiddir/include $CPPFLAGS" - LDFLAGS="-L$uuidir/lib $LDFLAGS" - break - fi -done +fi + + + +fi diff --git a/configure.ac b/configure.ac index 84d1f00983f899..d02d4e730342d9 100644 --- a/configure.ac +++ b/configure.ac @@ -2817,44 +2817,51 @@ 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_MSG_CHECKING(for uuid_generate_time_safe) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ +AC_CHECK_HEADER(uuid/uuid.h, + [ + AC_DEFINE(HAVE_UUID_UUID_H, 1, Define to 1 if you have the header file.) + AC_MSG_CHECKING(for uuid_generate_time_safe) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ #ifndef uuid_generate_time_safe void *x = uuid_generate_time_safe #endif -]])], - [AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE, 1, Define if uuid_generate_time_safe() exists.) - AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)] -) - -# AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) -# FreeBSD and OpenBSD provides support as well -AC_MSG_CHECKING(for uuid_create) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ -#ifndef uuid_create -void *x = uuid_create -#endif -]])], - [AC_DEFINE(HAVE_UUID_CREATE, 1, Define if uuid_create() exists.) - AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)] -) + ]])], + [AC_DEFINE(HAVE_UUID_GENERATE_TIME_SAFE, 1, Define if uuid_generate_time_safe() exists.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)] + ) + ], + [ +AC_CHECK_HEADER(uuid.h, + [ + AC_DEFINE(HAVE_UUID_H, 1, Define to 1 if you have the header file.) + # AIX provides support for RFC4122 (uuid) in libc.a starting with AIX 6.1 (anno 2007) + # FreeBSD and OpenBSD provides support as well + AC_MSG_CHECKING(for uuid_create) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + #ifndef uuid_create + void *x = uuid_create + #endif + ]])], + [AC_DEFINE(HAVE_UUID_CREATE, 1, Define if uuid_create() exists.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)] + ) -# Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet -# stream in big-endian byte-order -AC_MSG_CHECKING(for uuid_enc_be) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ + # Little-endian FreeBSD, OpenBSD and NetBSD needs encoding into an octet + # stream in big-endian byte-order + AC_MSG_CHECKING(for uuid_enc_be) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ #ifndef uuid_enc_be void *x = uuid_enc_be #endif -]])], - [AC_DEFINE(HAVE_UUID_ENC_BE, 1, Define if uuid_enc_be() exists.) - AC_MSG_RESULT(yes)], - [AC_MSG_RESULT(no)] -) + ]])], + [AC_DEFINE(HAVE_UUID_ENC_BE, 1, Define if uuid_enc_be() exists.) + AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no)] + ) + ], [] []) +], []) # 'Real Time' functions on Solaris # posix4 on Solaris 2.6