You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2022/10/11 23:12:38 UTC

[trafficserver] 02/03: Add compatibility define when building with OpenSSL3 (#8837)

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 9cb73bcb76338e4fb7087ff4caefeef07ce04964
Author: Bryan Call <bc...@apache.org>
AuthorDate: Thu May 12 08:10:06 2022 -0700

    Add compatibility define when building with OpenSSL3 (#8837)
    
    (cherry picked from commit cea26fe72406963fa7648a9bef3099a1a545f838)
---
 build/crypto.m4 | 19 +++++++++++++++++++
 configure.ac    |  3 +++
 2 files changed, 22 insertions(+)

diff --git a/build/crypto.m4 b/build/crypto.m4
index 8a4d8fea8..d4c054be6 100644
--- a/build/crypto.m4
+++ b/build/crypto.m4
@@ -58,6 +58,25 @@ int main() {
   [AC_MSG_FAILURE([requires an OpenSSL version 1.0.2 or greater])])
 ])
 
+dnl
+dnl Check OpenSSL Version 3
+dnl
+AC_DEFUN([TS_CHECK_OPENSSL3], [
+  AC_MSG_CHECKING([for OpenSSL version 3])
+  AC_RUN_IFELSE([AC_LANG_SOURCE(
+  [
+#include <openssl/opensslv.h>
+int main() {
+  if (OPENSSL_VERSION_NUMBER > 0x3000000fL) {
+    return 0;
+  }
+  return 1;
+}
+  ])],
+  [AC_MSG_RESULT(yes) TS_ADDTO(CPPFLAGS, -DOPENSSL_API_COMPAT=10002)], [AC_MSG_RESULT(no)]
+  )
+])
+
 dnl
 dnl Since OpenSSL 1.1.0
 dnl
diff --git a/configure.ac b/configure.ac
index d753b294c..24cac8875 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1249,6 +1249,9 @@ TS_CHECK_CRYPTO
 # Check for OpenSSL Version
 TS_CHECK_CRYPTO_VERSION
 
+# Check for OpenSSL Version 3 and add compatiblity define if needed
+TS_CHECK_OPENSSL3
+
 # Check for openssl ASYNC jobs
 TS_CHECK_CRYPTO_ASYNC