serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1834935 - in /serf/trunk: CMakeLists.txt build/SerfChecks.cmake
Date Tue, 03 Jul 2018 09:19:15 GMT
Author: brane
Date: Tue Jul  3 09:19:15 2018
New Revision: 1834935

URL: http://svn.apache.org/viewvc?rev=1834935&view=rev
Log:
Some of the OpenSSL symbols that we perform configure checks for exist
only as macros in version 1.1.0, so adjust the CMake build to look for
these symbols in headers, not just in libraries.

* build/SerfChecks.cmake
  (_CheckSymbol): New function.
  (CheckFunctionMacro): New feature test macro.
* CMakeLists.txt: Change feature tests.

Modified:
    serf/trunk/CMakeLists.txt
    serf/trunk/build/SerfChecks.cmake

Modified: serf/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/serf/trunk/CMakeLists.txt?rev=1834935&r1=1834934&r2=1834935&view=diff
==============================================================================
--- serf/trunk/CMakeLists.txt (original)
+++ serf/trunk/CMakeLists.txt Tue Jul  3 09:19:15 2018
@@ -210,10 +210,12 @@ CheckNotFunction("X509_get0_notAfter" "S
 CheckNotFunction("X509_STORE_CTX_get0_chain" "SERF_NO_SSL_X509_GET0_CHAIN" ${OPENSSL_LIBRARIES}
${SERF_STANDARD_LIBRARIES})
 CheckNotFunction("ASN1_STRING_get0_data" "SERF_NO_SSL_ASN1_STRING_GET0_DATA" ${OPENSSL_LIBRARIES}
${SERF_STANDARD_LIBRARIES})
 CheckFunction("CRYPTO_set_locking_callback" "SERF_HAVE_SSL_LOCKING_CALLBACKS" ${OPENSSL_LIBRARIES}
${SERF_STANDARD_LIBRARIES})
-CheckFunction("OPENSSL_malloc_init" "SERF_HAVE_OPENSSL_MALLOC_INIT" ${OPENSSL_LIBRARIES}
${SERF_STANDARD_LIBRARIES})
-CheckFunction("SSL_library_init" "SERF_HAVE_OPENSSL_SSL_LIBRARY_INIT" ${OPENSSL_LIBRARIES}
${SERF_STANDARD_LIBRARIES})
 CheckFunction("OpenSSL_version_num" "SERF_HAVE_OPENSSL_VERSION_NUM" ${OPENSSL_LIBRARIES}
${SERF_STANDARD_LIBRARIES})
 CheckFunction("SSL_set_alpn_protos" "SERF_HAVE_OPENSSL_ALPN" ${OPENSSL_LIBRARIES} ${SERF_STANDARD_LIBRARIES})
+CheckFunctionMacro("OPENSSL_malloc_init" "SERF_HAVE_OPENSSL_MALLOC_INIT" "openssl/crypto.h"
+                   "${OPENSSL_INCLUDE_DIR}" ${OPENSSL_LIBRARIES} ${SERF_STANDARD_LIBRARIES})
+CheckFunctionMacro("SSL_library_init" "SERF_HAVE_OPENSSL_SSL_LIBRARY_INIT" "openssl/ssl.h"
+                   "${OPENSSL_INCLUDE_DIR}" ${OPENSSL_LIBRARIES} ${SERF_STANDARD_LIBRARIES})
 CheckHeader("openssl/applink.c" "SERF_HAVE_OPENSSL_APPLINK_C" ${OPENSSL_INCLUDE_DIR})
 CheckHeader("stdbool.h" "HAVE_STDBOOL_H=1")
 CheckType("OSSL_HANDSHAKE_STATE" "openssl/ssl.h" "SERF_HAVE_OSSL_HANDSHAKE_STATE" ${OPENSSL_INCLUDE_DIR})

Modified: serf/trunk/build/SerfChecks.cmake
URL: http://svn.apache.org/viewvc/serf/trunk/build/SerfChecks.cmake?rev=1834935&r1=1834934&r2=1834935&view=diff
==============================================================================
--- serf/trunk/build/SerfChecks.cmake (original)
+++ serf/trunk/build/SerfChecks.cmake Tue Jul  3 09:19:15 2018
@@ -19,6 +19,7 @@
 
 include(CheckFunctionExists)
 include(CheckIncludeFile)
+include(CheckSymbolExists)
 include(CheckTypeSize)
 
 function(_CheckFunction var_ name_ libraries_)
@@ -29,7 +30,7 @@ function(_CheckFunction var_ name_ libra
   endif()
 
   check_function_exists("${name_}" "serf_foundit_${name_}_")
-  if(${serf_foundit_${name_}_})
+  if(serf_foundit_${name_}_)
     set("${var_}" TRUE PARENT_SCOPE)
   else()
     set("${var_}" FALSE PARENT_SCOPE)
@@ -52,6 +53,35 @@ macro(CheckNotFunction name_ symbol_)
 endmacro(CheckNotFunction)
 
 
+function(_CheckSymbol var_ name_ header_ includes_)
+  if(includes_)
+    set(CMAKE_REQUIRED_INCLUDES "${includes_}")
+  else()
+    unset(CMAKE_REQUIRED_INCLUDES)
+  endif()
+
+  check_symbol_exists("${name_}" "${header_}" "serf_foundit_symbol_${name_}_")
+  if(serf_foundit_symbol_${name_}_)
+    set("${var_}" TRUE PARENT_SCOPE)
+  else()
+    set("${var_}" FALSE PARENT_SCOPE)
+  endif()
+  unset(CMAKE_REQUIRED_INCLUDES)
+endfunction(_CheckSymbol)
+
+macro(CheckFunctionMacro name_ symbol_ header_ includes_)
+  _CheckFunction("serf_feature_CheckFunctionMacro_${name}_" "${name_}" "${ARGN}")
+  if("${serf_feature_CheckFunctionMacro_${name}_}")
+    add_definitions("-D${symbol_}")
+  else()
+    _CheckSymbol("serf_feature_CheckFunctionMacro_${name}_" "${name_}" "${header_}" "${includes_}")
+    if("${serf_feature_CheckFunctionMacro_${name}_}")
+      add_definitions("-D${symbol_}")
+    endif()
+  endif()
+endmacro(CheckFunctionMacro)
+
+
 function(_CheckHeader var_ name_ includes_)
   if(includes_)
     set(CMAKE_REQUIRED_INCLUDES "${includes_}")



Mime
View raw message