From 649c1e8e262de175ad1759adbb85435c52ad92a9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 3 Jul 2011 19:10:51 +0200 Subject: [PATCH] Check if OpenSSL supports SSL_COMP_get_compression_methods(). Fixes #1242. --- src/node_crypto.cc | 2 +- wscript | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 03e6a35454a..7cb723d822f 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -3638,7 +3638,7 @@ void InitCrypto(Handle target) { ERR_load_crypto_strings(); // Turn off compression. Saves memory - do it in userland. -#ifdef SSL_COMP_get_compression_methods +#ifdef HAVE_SSL_COMP_GET_COMPRESSION_METHODS // Before OpenSSL 0.9.8 this was not possible. STACK_OF(SSL_COMP)* comp_methods = SSL_COMP_get_compression_methods(); sk_SSL_COMP_zero(comp_methods); diff --git a/wscript b/wscript index e85ac1524f9..1c820c69ad3 100644 --- a/wscript +++ b/wscript @@ -261,7 +261,9 @@ def configure(conf): uselib_store="EXECINFO"): conf.fatal("Install the libexecinfo port from /usr/ports/devel/libexecinfo.") - if not Options.options.without_ssl: + if o.without_ssl: + o.use_openssl = conf.env["USE_OPENSSL"] = False + else: # Don't override explicitly supplied openssl paths with pkg-config results. explicit_openssl = o.openssl_includes or o.openssl_libpath @@ -272,7 +274,7 @@ def configure(conf): if not explicit_openssl and conf.check_cfg(package='openssl', args='--cflags --libs', uselib_store='OPENSSL'): - Options.options.use_openssl = conf.env["USE_OPENSSL"] = True + o.use_openssl = conf.env["USE_OPENSSL"] = True conf.env.append_value("CPPFLAGS", "-DHAVE_OPENSSL=1") else: if o.openssl_libpath: @@ -317,8 +319,22 @@ def configure(conf): conf.fatal("Could not autodetect OpenSSL support. " + "Make sure OpenSSL development packages are installed. " + "Use configure --without-ssl to disable this message.") - else: - Options.options.use_openssl = conf.env["USE_OPENSSL"] = False + + # use='OPENSSL' doesn't work with our version of waf + # and we have to use a fragment because function_name + # wont't detect macros :( + conf.check_cc(fragment=''' + #include + int main(void) { + (void) SSL_COMP_get_compression_methods(); + return 0; + } + ''', + function_name='SSL_COMP_get_compression_methods', + includes=conf.env['INCLUDES_OPENSSL'], + defines=conf.env['DEFINES_OPENSSL'], + libpath=conf.env['LIBPATH_OPENSSL'], + lib=conf.env['LIB_OPENSSL']) conf.check(lib='util', libpath=['/usr/lib', '/usr/local/lib'], uselib_store='UTIL')