From 4a4a6f8999594a056ad03451646143016ec9a5d1 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Tue, 19 Apr 2016 23:16:42 +0900 Subject: ext/openssl: check if SSL_CTX_clear_options() is available Fix build with very very old versions of OpenSSL. SSL_CTX_clear_options() is new in OpenSSL 0.9.8m but some Linux distributions still uses 0.9.8e. --- ext/openssl/extconf.rb | 1 + ext/openssl/openssl_missing.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index c36a7021e4..aa1e8254c1 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -109,6 +109,7 @@ have_func("TLSv1_1_client_method") have_func("TLSv1_2_method") have_func("TLSv1_2_server_method") have_func("TLSv1_2_client_method") +have_macro("SSL_CTX_clear_options", ["openssl/ssl.h"]) && $defs.push("-DHAVE_SSL_CTX_CLEAR_OPTIONS") have_func("SSL_CTX_set_alpn_select_cb") have_func("SSL_CTX_set_next_proto_select_cb") have_macro("SSL_get_server_tmp_key", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_GET_SERVER_TMP_KEY") diff --git a/ext/openssl/openssl_missing.h b/ext/openssl/openssl_missing.h index 2dc49d3fd2..6cf45a0d82 100644 --- a/ext/openssl/openssl_missing.h +++ b/ext/openssl/openssl_missing.h @@ -188,6 +188,11 @@ int PEM_def_callback(char *buf, int num, int w, void *key); int ASN1_put_eoc(unsigned char **pp); #endif +#if !defined(HAVE_SSL_CTX_CLEAR_OPTIONS) +# define SSL_CTX_clear_options(ctx, op) do \ + (ctx)->options &= ~(op); while (0) +#endif + #if defined(__cplusplus) } #endif -- cgit v1.2.3