File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1434,6 +1434,11 @@ def doConfigure(myenv):
14341434 if not conf .CheckLib ("execinfo" ):
14351435 Exit (1 )
14361436
1437+ conf .env ['MONGO_HAVE_TIMEGM' ] = conf .CheckDeclaration (
1438+ 'timegm' , includes = "#include <time.h>" , language = 'C' )
1439+ if conf .env ['MONGO_HAVE_TIMEGM' ]:
1440+ conf .env .Append (CPPDEFINES = ['MONGO_HAVE_TIMEGM' ])
1441+
14371442 # 'tcmalloc' needs to be the last library linked. Please, add new libraries before this
14381443 # point.
14391444 if get_option ('allocator' ) == 'tcmalloc' :
Original file line number Diff line number Diff line change @@ -107,13 +107,15 @@ clientSourceBasic = [
107107 'third_party/murmurhash3/MurmurHash3.cpp' ,
108108 ]
109109
110+ clientSourceTz = [] if clientEnv ['MONGO_HAVE_TIMEGM' ] else ['third_party/tz/timegm.c' ]
111+
110112clientSourceSasl = [
111113 'mongo/client/sasl_client_authenticate_impl.cpp' ,
112114 'mongo/client/sasl_client_session.cpp' ,
113115 'mongo/client/sasl_sspi.cpp' ,
114116]
115117
116- clientSourceAll = clientSourceBasic + clientSourceSasl
118+ clientSourceAll = clientSourceBasic + clientSourceTz + clientSourceSasl
117119
118120usingSasl = libEnv ['MONGO_BUILD_SASL_CLIENT' ]
119121
Original file line number Diff line number Diff line change 4040#define snprintf _snprintf
4141#endif
4242
43+ #if !defined(MONGO_HAVE_TIMEGM)
44+ // Not all systems have timegm defined (it isn't part of POSIX), so fall back to our vendored
45+ // implementation if our configure checks did not detect it as available on the current
46+ // system. See SERVER-13446, SERVER-14019, and CXX-204.
47+ extern " C" time_t timegm (struct tm *const tmp);
48+ #endif
49+
4350namespace mongo {
4451
4552 // jsTime_virtual_skew is just for testing. a test command manipulates it.
You can’t perform that action at this time.
0 commit comments