0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SERVER-13762 added configure check for POSIX system - replaces existing checks for unistd.h and clock_gettime

This commit is contained in:
Benety Goh 2014-04-28 09:38:32 -04:00
parent ac3c2c2972
commit a3f67f410b

View File

@ -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: