@@ -197,7 +197,6 @@ add_option("runtime-library-search-path",
197197 1 , False )
198198
199199add_option ( "ssl" , "Enable SSL" , 0 , True )
200- add_option ( "ssl-fips-capability" , "Enable the ability to activate FIPS 140-2 mode" , 0 , True );
201200
202201# library choices
203202add_option ( "libc++" , "use libc++ (experimental, requires clang)" , 0 , True )
@@ -930,8 +929,6 @@ if has_option( "ssl" ):
930929 else :
931930 env .Append ( LIBS = ["ssl" ] )
932931 env .Append ( LIBS = ["crypto" ] )
933- if has_option ("ssl-fips-capability" ):
934- env .Append ( CPPDEFINES = ["MONGO_SSL_FIPS" ] )
935932else :
936933 env ["MONGO_SSL" ] = False
937934
@@ -1806,6 +1803,41 @@ def doConfigure(myenv):
18061803 if conf .CheckDeclaration ('strnlen' , includes = "#include <string.h>" , language = 'C' ):
18071804 conf .env ['MONGO_HAVE_STRNLEN' ] = True
18081805
1806+ def CheckLinkSSL (context ):
1807+ test_body = """
1808+ #include <openssl/err.h>
1809+ #include <openssl/ssl.h>
1810+ #include <stdlib.h>
1811+
1812+ int main() {
1813+ SSL_library_init();
1814+ SSL_load_error_strings();
1815+ ERR_load_crypto_strings();
1816+
1817+ OpenSSL_add_all_algorithms();
1818+ ERR_free_strings();
1819+ return EXIT_SUCCESS;
1820+ }
1821+ """
1822+ context .Message ("Checking if OpenSSL is available..." )
1823+ ret = context .TryLink (textwrap .dedent (test_body ), ".c" )
1824+ context .Result (ret )
1825+ return ret
1826+ conf .AddTest ("CheckLinkSSL" , CheckLinkSSL )
1827+
1828+ if has_option ("ssl" ):
1829+ if not conf .CheckLinkSSL ():
1830+ print "SSL is enabled, but is unavailable"
1831+ Exit (1 )
1832+
1833+ if conf .CheckDeclaration (
1834+ "FIPS_mode_set" ,
1835+ includes = """
1836+ #include <openssl/crypto.h>
1837+ #include <openssl/evp.h>
1838+ """ ):
1839+ conf .env .Append (CPPDEFINES = ['MONGO_HAVE_FIPS_MODE_SET' ])
1840+
18091841 return conf .Finish ()
18101842
18111843env = doConfigure ( env )
0 commit comments