[Git][NTPsec/ntpsec][master] Merge check_openssl.pl into configure.py and simplify
Matt Selsky
gitlab at mg.gitlab.com
Thu Feb 9 06:03:44 UTC 2017
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
cdecb656 by Matt Selsky at 2017-02-09T01:00:31-05:00
Merge check_openssl.pl into configure.py and simplify
Also, don't bother to execute the version check snippet; it breaks for
cross-compiles and we just need the preprocessor for the version check.
- - - - -
2 changed files:
- − wafhelpers/check_openssl.py
- wafhelpers/configure.py
Changes:
=====================================
wafhelpers/check_openssl.py deleted
=====================================
--- a/wafhelpers/check_openssl.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Versions older than 0.9.7d were deemed incompatible in NTP Classic.
-OPENSSL_FRAG = """
-%s
-int main(void) {
-#if OPENSSL_VERSION_NUMBER < 0x0090704fL
-#error OpenSSL is too old.
-#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
- OpenSSL_add_all_digests();
-#endif
- return 0;
-}
-"""
-
-
-def configure_openssl(ctx):
-
- OPENSSL_HEADERS = True
- OPENSSL_LIB = True
-
- headers = (
- "openssl/evp.h",
- "openssl/rand.h",
- "openssl/objects.h",
- )
-
- for hdr in headers:
- if not ctx.check_cc(header_name=hdr, comment="<%s> header" % hdr,
- includes=ctx.env.PLATFORM_INCLUDES,
- ):
- OPENSSL_HEADERS = False
-
- if not ctx.check_cc(lib="crypto"):
- OPENSSL_LIB = False
-
- if OPENSSL_HEADERS and OPENSSL_LIB:
- ctx.check_cc(
- comment="OpenSSL support",
- execute=True,
- fragment=OPENSSL_FRAG % "\n".join(["#include <%s>" % x
- for x in headers]),
- includes=ctx.env.PLATFORM_INCLUDES,
- msg="Checking if OpenSSL works",
- use="CRYPTO",
- )
=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -296,8 +296,28 @@ def cmd_configure(ctx, config):
ctx.check_cc(lib="rt", mandatory=False, comment="realtime library")
# Find OpenSSL. Must happen before function checks
- from wafhelpers.check_openssl import configure_openssl
- configure_openssl(ctx)
+ # Versions older than 0.9.7d were deemed incompatible in NTP Classic.
+ SNIP_OPENSSL_VERSION_CHECK = """
+ #include <openssl/evp.h>
+ int main(void) {
+ #if OPENSSL_VERSION_NUMBER < 0x0090704fL
+ #error OpenSSL must be at least 0.9.7
+ #endif
+ return 0;
+ }
+ """
+
+ openssl_headers = (
+ "openssl/evp.h",
+ "openssl/rand.h",
+ "openssl/objects.h",
+ )
+ for hdr in openssl_headers:
+ ctx.check_cc(header_name=hdr, includes=ctx.env.PLATFORM_INCLUDES)
+ ctx.check_cc(lib="crypto")
+ ctx.check_cc(comment="OpenSSL support", fragment=SNIP_OPENSSL_VERSION_CHECK,
+ includes=ctx.env.PLATFORM_INCLUDES, msg="Checking OpenSSL >= 0.9.7",
+ )
# Optional functions. Do all function checks here, otherwise
# we're likely to duplicate them.
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/cdecb6562ca9a44a520132ddb95d180e2283ef08
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170209/351f8aed/attachment.html>
More information about the vc
mailing list