From 33c933bda79addc3ca46ed8dc3b86c99c72d81f7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 12 Apr 2021 15:42:24 +0300 Subject: [PATCH 26/26] Fix build on cygwin See osdn #41995 Signed-off-by: Marko Lindqvist --- configure.ac | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index b8e1ac60f3..02f8e2beb7 100644 --- a/configure.ac +++ b/configure.ac @@ -1318,10 +1318,15 @@ AC_CHECK_FUNCS([strerror strlcat strlcpy strncasecmp strstr uname nanosleep]) AC_CHECK_FUNCS([usleep getline _strcoll stricoll _stricoll strcasecoll backtrace]) dnl Possible random sources -AC_CHECK_HEADERS([sys/random.h bcrypt.h]) -AC_CHECK_LIB([bcrypt], [BCryptGenRandom], [ - AC_DEFINE([HAVE_BCRYPTGENRANDOM], [1], [BCryptGenRandom() available]) - UTILITY_LIBS="${UTILITY_LIBS} -lbcrypt" ]) +AC_CHECK_HEADER([sys/random.h]) +AC_CHECK_HEADER([bcrypt.h], [bcrypt_h_found=yes], [bcrypt_h_found=no]) +if test "x$bcrypt_h_found" = "xyes" ; then + dnl Cygwin would find the symbol in library despite not finding the header, + dnl leading to compile time error if we set HAVE_BCRYPTGENRANDOM + AC_CHECK_LIB([bcrypt], [BCryptGenRandom], [ + AC_DEFINE([HAVE_BCRYPTGENRANDOM], [1], [BCryptGenRandom() available]) + UTILITY_LIBS="${UTILITY_LIBS} -lbcrypt" ]) +fi AC_CHECK_FUNCS([getentropy clock_gettime]) AC_CACHE_VAL([ac_cv_dev_urandom], -- 2.30.2