From 3ef6433255cfeabdeb70bbfa51ac32a287c5d243 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Wed, 16 Feb 2011 05:09:02 +0100 Subject: [PATCH] MinGW: OpenSSL support --- wscript | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/wscript b/wscript index 53d1e50d5a..a13b91b7c7 100644 --- a/wscript +++ b/wscript @@ -4,7 +4,7 @@ import Options import sys, os, shutil, glob import Utils from Utils import cmd_output -from os.path import join, dirname, abspath +from os.path import join, dirname, abspath, normpath from logging import fatal cwd = os.getcwd() @@ -101,6 +101,20 @@ def set_options(opt): , dest='shared_v8_libname' ) + opt.add_option( '--openssl-includes' + , action='store' + , default=False + , help='A directory to search for the OpenSSL includes' + , dest='openssl_includes' + ) + + opt.add_option( '--openssl-libpath' + , action='store' + , default=False + , help="A directory to search for the OpenSSL libraries" + , dest='openssl_libpath' + ) + opt.add_option( '--oprofile' , action='store_true' , default=False @@ -247,17 +261,44 @@ def configure(conf): Options.options.use_openssl = conf.env["USE_OPENSSL"] = True conf.env.append_value("CPPFLAGS", "-DHAVE_OPENSSL=1") else: - libssl = conf.check_cc(lib=['ssl', 'crypto'], + if o.openssl_libpath: + openssl_libpath = [o.openssl_libpath] + elif not sys.platform.startswith('win32'): + openssl_libpath = ['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'] + else: + openssl_libpath = [normpath(join(cwd, '../openssl'))] + + if o.openssl_includes: + openssl_includes = [o.openssl_includes] + elif not sys.platform.startswith('win32'): + openssl_includes = []; + else: + openssl_includes = [normpath(join(cwd, '../openssl/include'))]; + + openssl_lib_names = ['ssl', 'crypto'] + if sys.platform.startswith('win32'): + openssl_lib_names += ['ws2_32', 'gdi32'] + + libssl = conf.check_cc(lib=openssl_lib_names, header_name='openssl/ssl.h', function_name='SSL_library_init', - libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'], + includes=openssl_includes, + libpath=openssl_libpath, uselib_store='OPENSSL') + libcrypto = conf.check_cc(lib='crypto', header_name='openssl/crypto.h', + includes=openssl_includes, + libpath=openssl_libpath, uselib_store='OPENSSL') + if libcrypto and libssl: conf.env["USE_OPENSSL"] = Options.options.use_openssl = True conf.env.append_value("CPPFLAGS", "-DHAVE_OPENSSL=1") + elif sys.platform.startswith('win32'): + conf.fatal("Could not autodetect OpenSSL support. " + + "Use the --openssl-libpath and --openssl-includes options to set the search path. " + + "Use configure --without-ssl to disable this message.") else: conf.fatal("Could not autodetect OpenSSL support. " + "Make sure OpenSSL development packages are installed. " +