[Git][NTPsec/ntpsec][master] waf: test for libs before testing for compiler options.

Gary E. Miller gitlab at mg.gitlab.com
Thu Mar 30 21:33:30 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
8250677b by Gary E. Miller at 2017-03-30T14:32:45-07:00
waf: test for libs before testing for compiler options.

Some compiler options, like stack protection, sometimes depend on
some libs, like -lssp.

- - - - -


1 changed file:

- wafhelpers/configure.py


Changes:

=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -231,6 +231,27 @@ def cmd_configure(ctx, config):
         ctx.define("ENABLE_LEAP_SMEAR", 1,
                    comment="Enable experimental leap smearing code")
 
+    # check for some libs first.  some options, like stack protector,
+    # may depend on some libs, like -lssp
+    ctx.check_cc(lib="m", comment="Math library")
+    ctx.check_cc(lib="rt", mandatory=False, comment="realtime library")
+    ret = ctx.check_cc(lib="bsd", mandatory=False,
+                 comment="BSD compatibility library")
+    if ret:
+        ctx.env.LDFLAGS += ["-lbsd"]
+
+    # -lssp and -lssp_nonshared may be needed by older gcc to
+    # support "-fstack-protector-all"
+    ret = ctx.check_cc(lib="ssp", mandatory=False,
+                 comment="libssp")
+    if ret:
+        ctx.env.LDFLAGS += ["-lssp"]
+
+    ret = ctx.check_cc(lib="ssp_nonshared", mandatory=False,
+                 comment="libssp_nonshared")
+    if ret:
+        ctx.env.LDFLAGS += ["-lssp_nonshared"]
+
     cc_test_flags = [
         ('PIC', '-fPIC'),
         ('PIE', '-pie -fPIE'),
@@ -440,25 +461,6 @@ int main(int argc, char **argv) {
     ctx.define("HAS_ROUTING_SOCKET", 1,
                comment="Whether a routing socket exists")
 
-    ctx.check_cc(lib="m", comment="Math library")
-    ctx.check_cc(lib="rt", mandatory=False, comment="realtime library")
-    ret = ctx.check_cc(lib="bsd", mandatory=False,
-                 comment="BSD compatibility library")
-    if ret:
-        ctx.env.LDFLAGS += ["-lbsd"]
-
-    # -lssp and -lssp_nonshared may be needed by older gcc to
-    # support "-fstack-protector-all"
-    ret = ctx.check_cc(lib="ssp", mandatory=False,
-                 comment="libssp")
-    if ret:
-        ctx.env.LDFLAGS += ["-lssp"]
-
-    ret = ctx.check_cc(lib="ssp_nonshared", mandatory=False,
-                 comment="libssp_nonshared")
-    if ret:
-        ctx.env.LDFLAGS += ["-lssp_nonshared"]
-
 
     # Find OpenSSL. Must happen before function checks
     # Versions older than 0.9.7d were deemed incompatible in NTP Classic.



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/8250677bc70090374d320600106b7976a3fc1b50
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170330/d1677aa0/attachment.html>


More information about the vc mailing list