@@ -4,7 +4,7 @@ import Options
44import sys , os , shutil , glob
55import Utils
66from Utils import cmd_output
7- from os .path import join , dirname , abspath
7+ from os .path import join , dirname , abspath , normpath
88from logging import fatal
99
1010cwd = os .getcwd ()
@@ -101,6 +101,20 @@ def set_options(opt):
101101 , dest = 'shared_v8_libname'
102102 )
103103
104+ opt .add_option ( '--openssl-includes'
105+ , action = 'store'
106+ , default = False
107+ , help = 'A directory to search for the OpenSSL includes'
108+ , dest = 'openssl_includes'
109+ )
110+
111+ opt .add_option ( '--openssl-libpath'
112+ , action = 'store'
113+ , default = False
114+ , help = "A directory to search for the OpenSSL libraries"
115+ , dest = 'openssl_libpath'
116+ )
117+
104118 opt .add_option ( '--oprofile'
105119 , action = 'store_true'
106120 , default = False
@@ -247,17 +261,44 @@ def configure(conf):
247261 Options .options .use_openssl = conf .env ["USE_OPENSSL" ] = True
248262 conf .env .append_value ("CPPFLAGS" , "-DHAVE_OPENSSL=1" )
249263 else :
250- libssl = conf .check_cc (lib = ['ssl' , 'crypto' ],
264+ if o .openssl_libpath :
265+ openssl_libpath = [o .openssl_libpath ]
266+ elif not sys .platform .startswith ('win32' ):
267+ openssl_libpath = ['/usr/lib' , '/usr/local/lib' , '/opt/local/lib' , '/usr/sfw/lib' ]
268+ else :
269+ openssl_libpath = [normpath (join (cwd , '../openssl' ))]
270+
271+ if o .openssl_includes :
272+ openssl_includes = [o .openssl_includes ]
273+ elif not sys .platform .startswith ('win32' ):
274+ openssl_includes = [];
275+ else :
276+ openssl_includes = [normpath (join (cwd , '../openssl/include' ))];
277+
278+ openssl_lib_names = ['ssl' , 'crypto' ]
279+ if sys .platform .startswith ('win32' ):
280+ openssl_lib_names += ['ws2_32' , 'gdi32' ]
281+
282+ libssl = conf .check_cc (lib = openssl_lib_names ,
251283 header_name = 'openssl/ssl.h' ,
252284 function_name = 'SSL_library_init' ,
253- libpath = ['/usr/lib' , '/usr/local/lib' , '/opt/local/lib' , '/usr/sfw/lib' ],
285+ includes = openssl_includes ,
286+ libpath = openssl_libpath ,
254287 uselib_store = 'OPENSSL' )
288+
255289 libcrypto = conf .check_cc (lib = 'crypto' ,
256290 header_name = 'openssl/crypto.h' ,
291+ includes = openssl_includes ,
292+ libpath = openssl_libpath ,
257293 uselib_store = 'OPENSSL' )
294+
258295 if libcrypto and libssl :
259296 conf .env ["USE_OPENSSL" ] = Options .options .use_openssl = True
260297 conf .env .append_value ("CPPFLAGS" , "-DHAVE_OPENSSL=1" )
298+ elif sys .platform .startswith ('win32' ):
299+ conf .fatal ("Could not autodetect OpenSSL support. " +
300+ "Use the --openssl-libpath and --openssl-includes options to set the search path. " +
301+ "Use configure --without-ssl to disable this message." )
261302 else :
262303 conf .fatal ("Could not autodetect OpenSSL support. " +
263304 "Make sure OpenSSL development packages are installed. " +
0 commit comments