@@ -197,7 +197,6 @@ add_option("runtime-library-search-path",
197
197
1 , False )
198
198
199
199
add_option ( "ssl" , "Enable SSL" , 0 , True )
200
- add_option ( "ssl-fips-capability" , "Enable the ability to activate FIPS 140-2 mode" , 0 , True );
201
200
202
201
# library choices
203
202
add_option ( "libc++" , "use libc++ (experimental, requires clang)" , 0 , True )
@@ -930,8 +929,6 @@ if has_option( "ssl" ):
930
929
else :
931
930
env .Append ( LIBS = ["ssl" ] )
932
931
env .Append ( LIBS = ["crypto" ] )
933
- if has_option ("ssl-fips-capability" ):
934
- env .Append ( CPPDEFINES = ["MONGO_SSL_FIPS" ] )
935
932
else :
936
933
env ["MONGO_SSL" ] = False
937
934
@@ -1806,6 +1803,41 @@ def doConfigure(myenv):
1806
1803
if conf .CheckDeclaration ('strnlen' , includes = "#include <string.h>" , language = 'C' ):
1807
1804
conf .env ['MONGO_HAVE_STRNLEN' ] = True
1808
1805
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
+
1809
1841
return conf .Finish ()
1810
1842
1811
1843
env = doConfigure ( env )
0 commit comments