From e7bd9e0380163dd8df75039c061195ceb7e68ae8 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 6 Mar 2017 02:46:23 +0300 Subject: [PATCH] Merge branch 'fix-openssl-linking' * fix-openssl-linking: sample/https-client: use ERR_remove_*state() when we have them Do not check for ERR_remove_thread_state() (do not link ssl into every library) Closes: #476 (cherry picked from commit 98faf19895bd6aa41c68f7da050179e207f05ae1) --- CMakeLists.txt | 4 ---- configure.ac | 4 ---- event-config.h.cmake | 3 --- sample/https-client.c | 7 ++++--- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cda730e..8cc5e66a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -879,10 +879,6 @@ if (NOT EVENT__DISABLE_SAMPLES) time-test) if (NOT EVENT__DISABLE_OPENSSL AND OPENSSL_LIBRARIES) - set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) - CHECK_FUNCTION_EXISTS_EX(ERR_remove_thread_state EVENT__HAVE_ERR_REMOVE_THREAD_STATE) - set(CMAKE_REQUIRED_LIBRARIES "") - # Special sample with more than one file. add_executable(https-client sample/https-client.c diff --git a/configure.ac b/configure.ac index ebb59110..03389241 100644 --- a/configure.ac +++ b/configure.ac @@ -790,10 +790,6 @@ fi # check if we have and should use openssl AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"]) -if test "x$enable_openssl" = "xyes"; then - AC_SEARCH_LIBS([ERR_remove_thread_state], [crypto eay32], - [AC_DEFINE(HAVE_ERR_REMOVE_THREAD_STATE, 1, [Define to 1 if you have ERR_remove_thread_stat().])]) -fi # Add some more warnings which we use in development but not in the # released versions. (Some relevant gcc versions can't handle these.) diff --git a/event-config.h.cmake b/event-config.h.cmake index faa159b7..472ffe17 100644 --- a/event-config.h.cmake +++ b/event-config.h.cmake @@ -526,9 +526,6 @@ #cmakedefine EVENT__NEED_DLLIMPORT -/* Define to 1 if you have ERR_remove_thread_stat(). */ -#cmakedefine EVENT__HAVE_ERR_REMOVE_THREAD_STATE - /* Define if waitpid() supports WNOWAIT */ #cmakedefine EVENT__HAVE_WAITPID_WITH_WNOWAIT diff --git a/sample/https-client.c b/sample/https-client.c index 18cea906..8ef75987 100644 --- a/sample/https-client.c +++ b/sample/https-client.c @@ -492,11 +492,12 @@ cleanup: EVP_cleanup(); ERR_free_strings(); -#ifdef EVENT__HAVE_ERR_REMOVE_THREAD_STATE - ERR_remove_thread_state(NULL); -#else +#if OPENSSL_VERSION_NUMBER < 0x10000000L ERR_remove_state(0); +#else + ERR_remove_thread_state(NULL); #endif + CRYPTO_cleanup_all_ex_data(); sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); -- 2.40.0