From 8cda659c36eea4973d54d46c59b48475fff86649 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 3 Nov 2026 09:19:19 +0100 Subject: [PATCH] configure.ac: fix OpenSSL detection with OpenSSL 4.0 OpenSSL 4.0 removed the ENGINE API. The ENGINE_* functions are now static inline stubs in the header and no longer exported by libcrypto, causing the configure check for libcrypto to fail: checking for ENGINE_init in -lcrypto... no configure: error: libcrypto not found gsocket does not use the ENGINE API, so probe for EVP_CIPHER_CTX_new instead, which is available in all supported OpenSSL versions. Furthermore, SRP_VBASE_get1_by_user is provided by libcrypto, not libssl. The libssl check only succeeded because -lcrypto was already part of LIBS. Check for SRP_VBASE_get1_by_user against the already found libcrypto, and use SSL_CTX_new to detect libssl. The libcrypto check remains first, so that LIBS ends up as "-lssl -lcrypto", which is the correct order for static linking. Based on an idea by loqs in https://github.com/hackerschoice/gsocket/pull/127 Closes: https://github.com/hackerschoice/gsocket/issues/122 Bug: https://bugs.gentoo.org/985505 --- configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f223a24..c6ab0c7 100755 --- a/configure.ac +++ b/configure.ac @@ -166,8 +166,9 @@ AC_CHECK_LIB(dl, dlopen, LDADD_LIBDL="-ldl") AC_CHECK_LIB(procstat, procstat_close) dnl if test x"$STATIC_SSL" != xyes; then - AC_CHECK_LIB([crypto], [ENGINE_init], [], [AC_MSG_ERROR([libcrypto not found])]) - AC_CHECK_LIB([ssl], [SRP_VBASE_get1_by_user], [], [AC_MSG_ERROR([SRP not supported. Please upgrade OpenSSL lib])]) + AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_new], [], [AC_MSG_ERROR([libcrypto not found])]) + AC_CHECK_FUNC([SRP_VBASE_get1_by_user], [], [AC_MSG_ERROR([SRP not supported. Please upgrade OpenSSL lib])]) + AC_CHECK_LIB([ssl], [SSL_CTX_new], [], [AC_MSG_ERROR([libssl not found])]) fi AC_CHECK_FUNCS(gettimeofday memcpy strchr strlcat forkpty openpty getline stat64 open64 statvfs64 accept4 connectx)