[Git][NTPsec/ntpsec][master] 2 commits: Fix typo s/PAI/API/
Amar Takhar
gitlab at mg.gitlab.com
Mon Nov 30 18:46:13 UTC 2015
Amar Takhar pushed to branch master at NTPsec / ntpsec
Commits:
e14a9946 by Amar Takhar at 2015-11-30T13:26:50Z
Fix typo s/PAI/API/
- - - - -
a6c7b023 by Amar Takhar at 2015-11-30T13:44:58Z
Add a more robust check for libevent2.
* Rely on 'event_core' vs 'event' to leave out protocol code.
* Check for event2/thread.h
* Add support for alternate platform includes
* Send a prominent notice if libevent2 is not detected along with the
consequences.
* Remove event2/util.h from ntpdig/main.c as it is not used.
* Disable ntpdig if libevent2 is not detected.
* Build a small test binary with one func from each library.
This fixes #16
- - - - -
7 changed files:
- ntpdig/main.c
- ntpdig/wscript
- + pylib/check_libevent2.py
- pylib/check_timepps.py
- pylib/configure.py
- tests/wscript
- wscript
Changes:
=====================================
ntpdig/main.c
=====================================
--- a/ntpdig/main.c
+++ b/ntpdig/main.c
@@ -1,6 +1,5 @@
#include <config.h>
-#include <event2/util.h>
#include <event2/event.h>
#include "ntp_workimpl.h"
=====================================
ntpdig/wscript
=====================================
--- a/ntpdig/wscript
+++ b/ntpdig/wscript
@@ -14,7 +14,7 @@ def build(ctx):
ctx(
target = "ntpdig_obj",
features = "c bld_include src_include libisc_include",
- use = "ntp isc opts M PTHREAD LIBEVENT LIBEVENT_CORE LIBEVENT_PTHREADS RT CRYPTO",
+ use = "ntp isc opts M PTHREAD LIBEVENT_CORE LIBEVENT_PTHREADS RT CRYPTO",
source = ntpdig_obj_source,
includes = [
"%s/ntpdig/" % bldnode
@@ -28,7 +28,7 @@ def build(ctx):
ctx(
target = "ntpdig",
features = "c cprogram bld_include src_include libisc_include ntp_version",
- use = "ntp isc opts ntpdig_obj M PTHREAD ntpdig_obj LIBEVENT LIBEVENT_CORE LIBEVENT_PTHREADS RT CRYPTO",
+ use = "ntp isc opts ntpdig_obj M PTHREAD ntpdig_obj LIBEVENT_CORE LIBEVENT_PTHREADS RT CRYPTO",
source = ntpdig_source,
includes = [
"%s/ntpdig/" % bldnode
=====================================
pylib/check_libevent2.py
=====================================
--- /dev/null
+++ b/pylib/check_libevent2.py
@@ -0,0 +1,50 @@
+from waflib.Logs import pprint
+LIBEVENT2_FRAG = """
+#include <event2/thread.h>
+#include <event2/event.h>
+
+int main(void) {
+ struct event_config * evcfg;
+
+ evthread_use_pthreads();
+ evcfg = event_config_new();
+ return 0;
+}
+"""
+
+
+def check_libevent2(ctx):
+ check_libevent2.false = False
+
+ def check(**kwargs):
+ if not ctx.check_cc(**kwargs):
+ check_libevent2.false = True
+
+
+ check(header_name="event2/event.h", includes=ctx.env.PLATFORM_INCLUDES, mandatory = False)
+ check(header_name="event2/thread.h", includes=ctx.env.PLATFORM_INCLUDES, mandatory = False)
+ check(feature="c cshlib", lib="event_core", libpath=ctx.env.PLATFORM_LIBPATH, uselib_store="LIBEVENT_CORE", mandatory = False)
+ check(feature="c cshlib", lib="event_pthreads", libpath=ctx.env.PLATFORM_LIBPATH, uselib_store="LIBEVENT_PTHREADS", use="LIBEVENT_CORE", mandatory = False)
+
+
+ ctx.check(
+ fragment = LIBEVENT2_FRAG,
+ define_name = "HAVE_LIBEVENT2",
+ features = "c",
+ use = "LIBEVENT, LIBEVENT_CORE, LIBEVENT_PTHREADS",
+ msg = "Checking if libevent2 works",
+ includes = ctx.env.PLATFORM_INCLUDES,
+ export_includes = ctx.env.PLATFORM_INCLUDES,
+ mandatory = False
+ )
+
+
+ if check_libevent2.false:
+ print("")
+ pprint("RED", "Warning libevent2 does not work")
+ pprint("RED", "This means ntpdig will not be built")
+ pprint("RED", "While not nessicary you will lose 'ntpdate' functionality.")
+ print("")
+ else:
+ ctx.env.LIBEVENT2_ENABLE=True
+ ctx.define("HAVE_LIBEVENT2", 1)
=====================================
pylib/check_timepps.py
=====================================
--- a/pylib/check_timepps.py
+++ b/pylib/check_timepps.py
@@ -23,7 +23,7 @@ def check_timepps(ctx):
fragment = TIMEPPS_FRAG,
define_name = "HAVE_PPSAPI",
features = "c",
- msg = "Checking if PPS PAI works",
+ msg = "Checking if PPS API works",
mandatory = False
)
=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -307,10 +307,9 @@ def cmd_configure(ctx):
check_timepps(ctx)
- ctx.check_cc(header_name="event2/event.h", includes=ctx.env.PLATFORM_INCLUDES)
- ctx.check_cc(feature="c cshlib", lib="event", libpath=ctx.env.PLATFORM_LIBPATH, uselib_store="LIBEVENT")
- ctx.check_cc(feature="c cshlib", lib="event_core", libpath=ctx.env.PLATFORM_LIBPATH, uselib_store="LIBEVENT_CORE")
- ctx.check_cc(feature="c cshlib", lib="event_pthreads", libpath=ctx.env.PLATFORM_LIBPATH, uselib_store="LIBEVENT_PTHREADS", use="LIBEVENT")
+ # Check for libevent and whether it is working.
+ from pylib.check_libevent2 import check_libevent2
+ check_libevent2(ctx)
# Check for Linux capability.
=====================================
tests/wscript
=====================================
--- a/tests/wscript
+++ b/tests/wscript
@@ -33,19 +33,20 @@ def build(ctx):
# ntpdig/
- ctx.ntp_test(
- features = "c cprogram bld_include src_include libisc_include test",
- target = "test_ntpdig",
- defines = ["TEST_NTPDIG=1"],
- includes = [
- "%s/tests/unity/" % srcnode,
- "%s/tests/common/" % srcnode,
- "%s/ntpdig/" % srcnode
- ],
- use = "unity ntpdig_obj ntp",
- source = ntpdig_source,
- test_args = ["%s/tests/ntpdig/data/" % srcnode, "%s/tests/ntpdig/" % bldnode]
- )
+ if ctx.env.LIBEVENT2_ENABLE:
+ ctx.ntp_test(
+ features = "c cprogram bld_include src_include libisc_include test",
+ target = "test_ntpdig",
+ defines = ["TEST_NTPDIG=1"],
+ includes = [
+ "%s/tests/unity/" % srcnode,
+ "%s/tests/common/" % srcnode,
+ "%s/ntpdig/" % srcnode
+ ],
+ use = "unity ntpdig_obj ntp",
+ source = ntpdig_source,
+ test_args = ["%s/tests/ntpdig/data/" % srcnode, "%s/tests/ntpdig/" % bldnode]
+ )
# libntp/
=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -114,7 +114,8 @@ def build(ctx):
if ctx.env.REFCLOCK_PARSE: # Only required by the parse refclock
ctx.recurse("libparse")
ctx.recurse("libntp")
- ctx.recurse("ntpdig")
+ if ctx.env.LIBEVENT2_ENABLE:
+ ctx.recurse("ntpdig")
ctx.recurse("libsodium")
ctx.recurse("ntpd")
ctx.recurse("ntpfrob")
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/38e49ac7719213a43e6957adb6bdee31f86cffbd...a6c7b0235396cf9fe0fb60e9103891e469b7affe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151130/f4737ea8/attachment.html>
More information about the vc
mailing list