[Git][NTPsec/ntpsec][master] waf: test for gnu99, don't just assume by CC_NAME
Gary E. Miller
gitlab at mg.gitlab.com
Thu Feb 16 21:33:18 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
457b09a9 by Gary E. Miller at 2017-02-16T13:32:46-08:00
waf: test for gnu99, don't just assume by CC_NAME
- - - - -
1 changed file:
- wafhelpers/configure.py
Changes:
=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -199,6 +199,7 @@ def cmd_configure(ctx, config):
cc_test_flags = [
('PIE', '-pie -fPIE'),
+ ('gnu99', '-std=gnu99'),
]
if ctx.options.enable_debug_gdb:
@@ -213,6 +214,8 @@ def cmd_configure(ctx, config):
ctx.env.BISONFLAGS += ["--debug"]
ctx.env.CFLAGS += [
+ # -O1 will turn on -D_FORTIFY_SOURCE=2 for us
+ "-O1",
"-Wall",
"-Wextra",
"-Wstrict-prototypes",
@@ -231,6 +234,18 @@ def cmd_configure(ctx, config):
mandatory=False,
msg='Checking if C compiler supports ' + name,)
+ # We require some things that C99 doesn't enable, like pthreads.
+ # Thus -std=gnu99 rather than -std=c99 here, if the compiler supports
+ # it.
+ if ctx.env.HAS_gnu99:
+ ctx.env.CFLAGS += [
+ "-std=gnu99",
+ ]
+ else:
+ ctx.env.CFLAGS += [
+ "-std=c99",
+ ]
+
if ctx.env.HAS_PIE:
ctx.env.CFLAGS += [
"-FPIE",
@@ -270,17 +285,14 @@ def cmd_configure(ctx, config):
else:
ctx.end_msg("no", color="YELLOW")
- # We require some things that C99 doesn't enable, like pthreads.
- # Thus -std=gnu99 rather than -std=c99 here, if the compiler supports
- # it.
if ctx.env.CC_NAME == "sun":
- ctx.env.CFLAGS += ["-std=c99"]
+ # we are sun, placeholder
+ ctx.env.CFLAGS += []
elif ctx.env.CC_NAME == "clang":
# used on macOS, FreeBSD,
# FORTIFY needs LTO to work well
ctx.env.CFLAGS += [
"-fstack-protector-all", # hardening
- "-std=gnu99",
"-D_FORTIFY_SOURCE=2", # hardening
]
if ctx.env.DEST_OS not in ["darwin", "freebsd"]:
@@ -296,10 +308,7 @@ def cmd_configure(ctx, config):
else:
# gcc, probably
ctx.env.CFLAGS += [
- # -O1 will turn on -D_FORTIFY_SOURCE=2 for us
"-fstack-protector-all", # hardening
- "-O1",
- "-std=gnu99",
]
# XXX: hack
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/457b09a91a6b13fd8c55556fd3303caab4a28a72
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170216/a60f651d/attachment.html>
More information about the vc
mailing list