@@ -657,19 +657,22 @@ def detect_modules(self):
657657
658658 #print 'openssl_ver = 0x%08x' % openssl_ver
659659 min_openssl_ver = 0x00907000
660- have_usable_openssl = ( ssl_incs is not None and
661- ssl_libs is not None and
660+ have_any_openssl = ssl_incs is not None and ssl_libs is not None
661+ have_usable_openssl = ( have_any_openssl and
662662 openssl_ver >= min_openssl_ver )
663663
664- if have_usable_openssl :
665- # The _hashlib module wraps optimized implementations
666- # of hash functions from the OpenSSL library.
667- exts .append ( Extension ('_hashlib' , ['_hashopenssl.c' ],
668- include_dirs = ssl_incs ,
669- library_dirs = ssl_libs ,
670- libraries = ['ssl' , 'crypto' ]) )
671- # these aren't strictly missing since they are unneeded.
672- #missing.extend(['_sha', '_md5'])
664+ if have_any_openssl :
665+ if have_usable_openssl :
666+ # The _hashlib module wraps optimized implementations
667+ # of hash functions from the OpenSSL library.
668+ exts .append ( Extension ('_hashlib' , ['_hashopenssl.c' ],
669+ include_dirs = ssl_incs ,
670+ library_dirs = ssl_libs ,
671+ libraries = ['ssl' , 'crypto' ]) )
672+ else :
673+ print ("warning: openssl 0x%08x is too old for _hashlib" %
674+ openssl_ver )
675+ missing .append ('_hashlib' )
673676 if COMPILED_WITH_PYDEBUG or not have_usable_openssl :
674677 # The _sha module implements the SHA1 hash algorithm.
675678 exts .append ( Extension ('_sha' , ['shamodule.c' ]) )
@@ -679,7 +682,6 @@ def detect_modules(self):
679682 exts .append ( Extension ('_md5' ,
680683 sources = ['md5module.c' , 'md5.c' ],
681684 depends = ['md5.h' ]) )
682- missing .append ('_hashlib' )
683685
684686 min_sha2_openssl_ver = 0x00908000
685687 if COMPILED_WITH_PYDEBUG or openssl_ver < min_sha2_openssl_ver :
0 commit comments