From 48578f782de8d6c840fa41b8e1eed2a12ed7c1c4 Mon Sep 17 00:00:00 2001 From: famfo Date: Sun, 23 Nov 2025 13:53:14 +0100 Subject: [PATCH] m4/pdns_check_libcrypto: fix ecdsa/eddsa includedir On more excotic Linux distributions, like NixOS, the directory in which the libraries are stored and the directory of the headers is different. This uses pkg-config to find the right includedir of the headers. Signed-off-by: famfo --- m4/pdns_check_libcrypto.m4 | 2 ++ m4/pdns_check_libcrypto_ecdsa.m4 | 4 ++-- m4/pdns_check_libcrypto_eddsa.m4 | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/m4/pdns_check_libcrypto.m4 b/m4/pdns_check_libcrypto.m4 index 4ca3c702ea..b4bf73bec1 100644 --- a/m4/pdns_check_libcrypto.m4 +++ b/m4/pdns_check_libcrypto.m4 @@ -55,6 +55,7 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO], [ LIBCRYPTO_LIBS=`$PKG_CONFIG libcrypto --libs-only-l 2>/dev/null` LIBCRYPTO_INCLUDES=`$PKG_CONFIG libcrypto --cflags-only-I 2>/dev/null` ssldir=`$PKG_CONFIG libcrypto --variable=prefix 2>/dev/null` + sslincdir=`$PKG_CONFIG libcrypto --variable=includedir 2>/dev/null` found=true fi fi @@ -78,6 +79,7 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO], [ LIBCRYPTO_INCLUDES="-I$ssldir/include" LIBCRYPTO_LDFLAGS="-L$ssldir/lib" LIBCRYPTO_LIBS="-lcrypto" + sslincdir="$ssldir/include" found=true AC_MSG_RESULT([yes]) break diff --git a/m4/pdns_check_libcrypto_ecdsa.m4 b/m4/pdns_check_libcrypto_ecdsa.m4 index 8720a63966..1773890825 100644 --- a/m4/pdns_check_libcrypto_ecdsa.m4 +++ b/m4/pdns_check_libcrypto_ecdsa.m4 @@ -12,11 +12,11 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO_ECDSA], [ # Find the headers we need for ECDSA libcrypto_ecdsa=yes - AC_CHECK_HEADER([$ssldir/include/openssl/ecdsa.h], [ + AC_CHECK_HEADER([$sslincdir/openssl/ecdsa.h], [ AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [ : ], [ libcrypto_ecdsa=no ], [AC_INCLUDES_DEFAULT -#include <$ssldir/include/openssl/evp.h> +#include <$sslincdir/openssl/evp.h> ]) ], [ libcrypto_ecdsa=no diff --git a/m4/pdns_check_libcrypto_eddsa.m4 b/m4/pdns_check_libcrypto_eddsa.m4 index 3607fcf04b..ed395b5591 100644 --- a/m4/pdns_check_libcrypto_eddsa.m4 +++ b/m4/pdns_check_libcrypto_eddsa.m4 @@ -17,13 +17,13 @@ AC_DEFUN([PDNS_CHECK_LIBCRYPTO_EDDSA], [ AC_DEFINE([HAVE_LIBCRYPTO_ED25519], [1], [define to 1 if OpenSSL ed25519 support is available.]) ], [ : ], [AC_INCLUDES_DEFAULT - #include <$ssldir/include/openssl/evp.h>]) + #include <$sslincdir/openssl/evp.h>]) AC_CHECK_DECLS([NID_ED448], [ libcrypto_ed448=yes AC_DEFINE([HAVE_LIBCRYPTO_ED448], [1], [define to 1 if OpenSSL ed448 support is available.]) ], [ : ], [AC_INCLUDES_DEFAULT - #include <$ssldir/include/openssl/evp.h>]) + #include <$sslincdir/openssl/evp.h>]) AS_IF([test "$libcrypto_ed25519" = "yes" -o "$libcrypto_ed448" = "yes"], [ AC_DEFINE([HAVE_LIBCRYPTO_EDDSA], [1], [define to 1 if OpenSSL EDDSA support is available.]) -- 2.47.3