diff options
author | Fred Wright <fw@fwright.net> | 2017-01-03 17:38:17 -0800 |
---|---|---|
committer | Fred Wright <fw@fwright.net> | 2017-01-03 17:44:43 -0800 |
commit | 99b3b3a2e642a3f182392c69512da35157f40ac3 (patch) | |
tree | c5d65b0ab67099dd9a91585f1c16b98e000adaf3 /SConstruct | |
parent | 8811b42d2435e64905012ed399ff8553eeb47f7e (diff) | |
download | gpsd-99b3b3a2e642a3f182392c69512da35157f40ac3.tar.gz |
Unreverts "Work around yet another scons fuckup."
Temporarily reinstating the CheckFunc hack, pending further
investigation.
TESTED:
Verified that the only differences in SConstruct across the
revert/unrevert are the minor intervening changes. Ran "build-all
check" on OSX.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 51 |
1 files changed, 49 insertions, 2 deletions
@@ -430,6 +430,52 @@ values can be listed with 'scons -h'. ## Configuration +# CheckFunc from upstream scons fails always with -Wstrict-prototypes + +def CheckFuncFor_Wstrict_prototypes(context, function_name, header = None, language = None): + if context.headerfilename: + includetext = '#include "%s"' % context.headerfilename + else: + includetext = '' + if not header: + header = """ +#ifdef __cplusplus +extern "C" +#endif +char %s(void);""" % function_name + + if not language or language in ["C", "c"]: + lang, suffix, msg = ("C", ".c", None) + elif language in ["c++", "C++", "cpp", "CXX", "cxx"]: + lang, suffix, msg = ("C++", ".cpp", None) + + if msg: + context.Display("Cannot check for %s(): %s\n" % (function_name, msg)) + return msg + + text = """ +%(include)s +#include <assert.h> +%(hdr)s + +int main(void) { +#if defined (__stub_%(name)s) || defined (__stub___%(name)s) + fail fail fail +#else + %(name)s(); +#endif + + return 0; +} +""" % { 'name': function_name, + 'include': includetext, + 'hdr': header } + + context.Display("Checking for %s function %s()... " % (lang, function_name)) + ret = context.TryBuild(context.env.Program, text, suffix) + context.Result(ret) + return ret + def CheckPKG(context, name): context.Message('Checking pkg-config for %s... ' % name) @@ -558,7 +604,8 @@ def GetLoadPath(context): cleaning = env.GetOption('clean') helping = env.GetOption('help') -config = Configure(env, custom_tests={'CheckPKG': CheckPKG, +config = Configure(env, custom_tests={'CheckFuncFor_Wstrict_prototypes': CheckFuncFor_Wstrict_prototypes, + 'CheckPKG': CheckPKG, 'CheckXsltproc': CheckXsltproc, 'CheckCompilerOption': CheckCompilerOption, 'CheckCompilerDefines': CheckCompilerDefines, @@ -753,7 +800,7 @@ else: # check function after libraries, because some function require libraries # for example clock_gettime() require librt on Linux glibc < 2.17 for f in ("daemon", "strlcpy", "strlcat", "clock_gettime", "strptime", "gmtime_r" ): - if config.CheckFunc(f): + if config.CheckFuncFor_Wstrict_prototypes(f): confdefs.append("#define HAVE_%s 1\n" % f.upper()) else: confdefs.append("/* #undef HAVE_%s */\n" % f.upper()) |