summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-04-28 09:38:32 -0400
committerBenety Goh <benety@mongodb.com>2014-04-28 18:44:55 -0400
commita3f67f410b333dde69330eeb138ccc65f2c21045 (patch)
tree9e9c96fd42466ffb63929476caee31f41bf04c02 /SConstruct
parentac3c2c29726cc6f576ffa1343151072b9fae24f1 (diff)
downloadmongo-a3f67f410b333dde69330eeb138ccc65f2c21045.tar.gz
SERVER-13762 added configure check for POSIX system - replaces existing checks for unistd.h and clock_gettime
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct27
1 files changed, 24 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct
index 8a61055ab21..49bc434ff2b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1314,6 +1314,29 @@ def doConfigure(myenv):
if (not using_system_version_of_cxx_libraries()):
myenv.Append(CPPDEFINES=["_GLIBCXX_DEBUG"]);
+ # Check if we are on a POSIX system by testing if _POSIX_VERSION is defined.
+ def CheckPosixSystem(context):
+
+ test_body = """
+ // POSIX requires the existence of unistd.h, so if we can't include unistd.h, we
+ // are definitely not a POSIX system.
+ #include <unistd.h>
+ #if !defined(_POSIX_VERSION)
+ #error not a POSIX system
+ #endif
+ """
+
+ context.Message('Checking if we are on a POSIX system... ')
+ ret = context.TryCompile(textwrap.dedent(test_body), ".c")
+ context.Result(ret)
+ return ret
+
+ conf = Configure(myenv, help=False, custom_tests = {
+ 'CheckPosixSystem' : CheckPosixSystem,
+ })
+ posix_system = conf.CheckPosixSystem()
+ conf.Finish()
+
if has_option('sanitize'):
if not (using_clang() or using_gcc()):
print( 'sanitize is only supported with clang or gcc')
@@ -1428,10 +1451,8 @@ def doConfigure(myenv):
boostlib = "boost_" + b
conf.FindSysLibDep( boostlib, [ boostlib + "-mt", boostlib ], language='C++' )
- if conf.CheckHeader('unistd.h'):
+ if posix_system:
conf.env.Append(CPPDEFINES=['MONGO_HAVE_HEADER_UNISTD_H'])
-
- if solaris or conf.CheckDeclaration('clock_gettime', includes='#include <time.h>'):
conf.CheckLib('rt')
if linux: