]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix to link with -lcrypt32 for OpenSSL 3.2.0 on Windows.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 15 Jan 2024 15:44:27 +0000 (16:44 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Mon, 15 Jan 2024 15:44:27 +0000 (16:44 +0100)
acx_nlnetlabs.m4
configure
configure.ac
doc/Changelog

index f27615bd8bced88a81048e0014fa998182ed3b2f..579e7099151b14a5891949db2f1e7ca9c583e69a 100644 (file)
@@ -2,7 +2,8 @@
 # Copyright 2009, Wouter Wijngaards, NLnet Labs.   
 # BSD licensed.
 #
-# Version 46
+# Version 47
+# 2024-01-15 fix to add crypt32 to -lcrypto link check when checking for gdi32.
 # 2023-05-04 fix to remove unused whitespace.
 # 2023-01-26 fix -Wstrict-prototypes.
 # 2022-09-01 fix checking if nonblocking sockets work on OpenBSD.
@@ -707,7 +708,7 @@ AC_DEFUN([ACX_SSL_CHECKS], [
                    LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir_lib"
                    ACX_RUNTIME_PATH_ADD([$ssldir_lib])
            fi
-        
+
             AC_MSG_CHECKING([for EVP_sha256 in -lcrypto])
             LIBS="$LIBS -lcrypto"
             LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto"
@@ -732,38 +733,55 @@ AC_DEFUN([ACX_SSL_CHECKS], [
                   ]])],[
                     AC_DEFINE([HAVE_EVP_SHA256], 1,
                         [If you have EVP_sha256])
-                    AC_MSG_RESULT(yes) 
+                    AC_MSG_RESULT(yes)
                   ],[
                     AC_MSG_RESULT(no)
                     LIBS="$BAKLIBS"
                     LIBSSL_LIBS="$BAKSSLLIBS"
-                    LIBS="$LIBS -ldl"
-                    LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
-                    AC_MSG_CHECKING([if -lcrypto needs -ldl])
-                    AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
-                        int EVP_sha256(void);
-                        (void)EVP_sha256();
-                      ]])],[
-                        AC_DEFINE([HAVE_EVP_SHA256], 1,
-                            [If you have EVP_sha256])
-                        AC_MSG_RESULT(yes) 
-                      ],[
-                        AC_MSG_RESULT(no)
-                        LIBS="$BAKLIBS"
-                        LIBSSL_LIBS="$BAKSSLLIBS"
-                        LIBS="$LIBS -ldl -pthread"
-                        LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
-                        AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread])
-                        AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
-                            int EVP_sha256(void);
-                            (void)EVP_sha256();
-                          ]])],[
-                            AC_DEFINE([HAVE_EVP_SHA256], 1,
-                                [If you have EVP_sha256])
-                            AC_MSG_RESULT(yes) 
-                          ],[
-                            AC_MSG_RESULT(no)
-                            AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
+
+                   LIBS="$LIBS -lgdi32 -lws2_32 -lcrypt32"
+                   LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32 -lcrypt32"
+                    AC_MSG_CHECKING([if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32])
+                   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
+                       int EVP_sha256(void);
+                       (void)EVP_sha256();
+                     ]])],[
+                       AC_DEFINE([HAVE_EVP_SHA256], 1,
+                           [If you have EVP_sha256])
+                       AC_MSG_RESULT(yes)
+                     ],[
+                       AC_MSG_RESULT(no)
+                       LIBS="$BAKLIBS"
+                       LIBSSL_LIBS="$BAKSSLLIBS"
+
+                       LIBS="$LIBS -ldl"
+                       LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
+                       AC_MSG_CHECKING([if -lcrypto needs -ldl])
+                       AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
+                           int EVP_sha256(void);
+                           (void)EVP_sha256();
+                         ]])],[
+                           AC_DEFINE([HAVE_EVP_SHA256], 1,
+                               [If you have EVP_sha256])
+                           AC_MSG_RESULT(yes)
+                         ],[
+                           AC_MSG_RESULT(no)
+                           LIBS="$BAKLIBS"
+                           LIBSSL_LIBS="$BAKSSLLIBS"
+                           LIBS="$LIBS -ldl -pthread"
+                           LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
+                           AC_MSG_CHECKING([if -lcrypto needs -ldl -pthread])
+                           AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
+                               int EVP_sha256(void);
+                               (void)EVP_sha256();
+                             ]])],[
+                               AC_DEFINE([HAVE_EVP_SHA256], 1,
+                                   [If you have EVP_sha256])
+                               AC_MSG_RESULT(yes)
+                             ],[
+                               AC_MSG_RESULT(no)
+                               AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
+                           ])
                        ])
                     ])
                 ])
@@ -779,7 +797,7 @@ AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
 
 dnl Check for SSL, where SSL is mandatory
 dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
-dnl Setup of CPPFLAGS, CFLAGS.  Adds -lcrypto to LIBS. 
+dnl Setup of CPPFLAGS, CFLAGS.  Adds -lcrypto to LIBS.
 dnl Checks main header files of SSL.
 dnl
 AC_DEFUN([ACX_WITH_SSL],
index c87c669c84350c8d23c25799d17b77114ad71a3f..2b100b613cb4afb76d7bef3db8f03d6d5f4c82bb 100755 (executable)
--- a/configure
+++ b/configure
@@ -18104,19 +18104,53 @@ else
 $as_echo "no" >&6; }
                     LIBS="$BAKLIBS"
                     LIBSSL_LIBS="$BAKSSLLIBS"
-                    LIBS="$LIBS -ldl"
-                    LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
-                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5
+
+                   LIBS="$LIBS -lgdi32 -lws2_32 -lcrypt32"
+                   LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32 -lws2_32 -lcrypt32"
+                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32" >&5
+$as_echo_n "checking if -lcrypto needs -lgdi32 -lws2_32 -lcrypt32... " >&6; }
+                   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+                       int EVP_sha256(void);
+                       (void)EVP_sha256();
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+
+$as_echo "#define HAVE_EVP_SHA256 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; }
+                       LIBS="$BAKLIBS"
+                       LIBSSL_LIBS="$BAKSSLLIBS"
+
+                       LIBS="$LIBS -ldl"
+                       LIBSSL_LIBS="$LIBSSL_LIBS -ldl"
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5
 $as_echo_n "checking if -lcrypto needs -ldl... " >&6; }
-                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
 
-                        int EVP_sha256(void);
-                        (void)EVP_sha256();
+                           int EVP_sha256(void);
+                           (void)EVP_sha256();
 
   ;
   return 0;
@@ -18127,28 +18161,28 @@ if ac_fn_c_try_link "$LINENO"; then :
 
 $as_echo "#define HAVE_EVP_SHA256 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
+                           { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-                        LIBS="$BAKLIBS"
-                        LIBSSL_LIBS="$BAKSSLLIBS"
-                        LIBS="$LIBS -ldl -pthread"
-                        LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
-                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl -pthread" >&5
+                           LIBS="$BAKLIBS"
+                           LIBSSL_LIBS="$BAKSSLLIBS"
+                           LIBS="$LIBS -ldl -pthread"
+                           LIBSSL_LIBS="$LIBSSL_LIBS -ldl -pthread"
+                           { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl -pthread" >&5
 $as_echo_n "checking if -lcrypto needs -ldl -pthread... " >&6; }
-                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                           cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
 
-                            int EVP_sha256(void);
-                            (void)EVP_sha256();
+                               int EVP_sha256(void);
+                               (void)EVP_sha256();
 
   ;
   return 0;
@@ -18159,14 +18193,18 @@ if ac_fn_c_try_link "$LINENO"; then :
 
 $as_echo "#define HAVE_EVP_SHA256 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
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-                            as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5
+                               as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
 fi
 rm -f core conftest.err conftest.$ac_objext \
@@ -20166,7 +20204,11 @@ else
   WINDRES="$ac_cv_prog_WINDRES"
 fi
 
-       LIBS="$LIBS -liphlpapi -lcrypt32"
+       if echo "$LIBS" | grep crypt32 >/dev/null; then
+               LIBS="$LIBS -liphlpapi"
+       else
+               LIBS="$LIBS -liphlpapi -lcrypt32"
+       fi
        WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe"
 
        WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c"
index 70fc7e7fdf4930558447b7cec92d6199d31ca593..04d4e00ed0e2797c1751b57dc869e8706102f0e2 100644 (file)
@@ -1569,7 +1569,11 @@ if test "$USE_WINSOCK" = 1; then
 #include <windows.h>
        ])
        AC_CHECK_TOOL(WINDRES, windres)
-       LIBS="$LIBS -liphlpapi -lcrypt32"
+       if echo "$LIBS" | grep crypt32 >/dev/null; then
+               LIBS="$LIBS -liphlpapi"
+       else
+               LIBS="$LIBS -liphlpapi -lcrypt32"
+       fi
        WINAPPS="unbound-service-install.exe unbound-service-remove.exe anchor-update.exe"
        AC_SUBST(WINAPPS)
        WIN_DAEMON_SRC="winrc/win_svc.c winrc/w_inst.c"
index 23f43087d4c94b9b3251d4f3dbdc33693758d7a1..733ba123ec48df15e44c3c9cc90e282e66616543 100644 (file)
@@ -1,3 +1,6 @@
+15 January 2024: Wouter
+       - Fix to link with -lcrypt32 for OpenSSL 3.2.0 on Windows.
+
 9 January 2024: Wouter
        - Merge #988: Fix NLnetLabs#981: dump_cache truncates large records.