[Git][NTPsec/ntpsec][master] 3 commits: Only build Audio refclocks when OSS is available.

Amar Takhar gitlab at mg.gitlab.com
Mon Dec 7 18:55:03 UTC 2015


Amar Takhar pushed to branch master at NTPsec / ntpsec


Commits:
0bdf7bc7 by Amar Takhar at 2015-12-07T13:49:21Z
Only build Audio refclocks when OSS is available.

Fixes #25

- - - - -
24fe0ff7 by Amar Takhar at 2015-12-07T13:52:12Z
Fix #pragmas in msyslog.c

This checks for __clang__ and falls down to GCC pragmas.  This is not ideal once
we get into other compilers I'll work on something more general for compiler
detection.

Fixes #29

- - - - -
2508258f by Amar Takhar at 2015-12-07T13:54:01Z
Fix spelling mistake.

Fixes #30

Submitted by: Matt Selsky

- - - - -


5 changed files:

- libntp/wscript
- pylib/check_libevent2.py
- pylib/configure.py
- pylib/refclock.py
- tests/libntp/msyslog.c


Changes:

=====================================
libntp/wscript
=====================================
--- a/libntp/wscript
+++ b/libntp/wscript
@@ -54,8 +54,7 @@ def build(ctx):
 		"ymd2yd.c",
 	]
 
-	if ctx.env.REFCLOCK_CHU == True \
-		or ctx.env.REFCLOCK_IRIG == True:
+	if ctx.env.AUDIO_ENABLE:
 
 		libntp_source += [
 			"audio.c"


=====================================
pylib/check_libevent2.py
=====================================
--- a/pylib/check_libevent2.py
+++ b/pylib/check_libevent2.py
@@ -43,7 +43,7 @@ def check_libevent2(ctx):
 		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.")
+		pprint("RED", "While not necessary you will lose 'ntpdate' functionality.")
 		print("")
 	else:
 		ctx.env.LIBEVENT2_ENABLE=True


=====================================
pylib/configure.py
=====================================
--- a/pylib/configure.py
+++ b/pylib/configure.py
@@ -456,6 +456,12 @@ def cmd_configure(ctx):
 
 	ctx.define("DIR_SEP", "'%s'" % sep, quote=False)
 
+	# Enable audio when the right headers exist.
+	if ctx.get_define("HAVE_SYS_AUDIOIO_H") or \
+			ctx.get_define("HAVE_SYS_SOUNDCARD_H") or \
+			ctx.get_define("HAVE_MACHINE_SOUNDCARD_H"):
+		ctx.env.AUDIO_ENABLE = True
+
 
 	# libisc/
 	# XXX: Hack that needs to be fixed properly for all platforms


=====================================
pylib/refclock.py
=====================================
--- a/pylib/refclock.py
+++ b/pylib/refclock.py
@@ -30,12 +30,14 @@ refclock_map = {
 	6: {
 		"descr":	"IRIG Audio Decoder",
 		"define":	"CLOCK_IRIG",
+		"require":	["audio"],
 		"file":		"irig"
 	},
 
 	7: {
 		"descr":	"Radio CHU Audio Demodulator/Decoder",
 		"define":	"CLOCK_CHU",
+		"require":	["audio"],
 		"file":		"chu"
 	},
 
@@ -236,6 +238,13 @@ def refclock_config(ctx):
 					pprint("RED", "Refclock \"%s\" disabled, PPS API has not been detected as working." % rc["descr"])
 					continue
 
+			if "audio" in rc["require"]:
+				if not ctx.env.AUDIO_ENABLE:
+					ctx.end_msg("No")
+					pprint("RED", "Refclock \"%s\" disabled, Audio (OSS) support is not available." % rc["descr"])
+					continue
+
+
 		ctx.env.REFCLOCK_SOURCE.append((rc["file"], rc["define"]))
 		ctx.env["REFCLOCK_%s" % rc["file"].upper()] = True
 		ctx.define(rc["define"], 1)


=====================================
tests/libntp/msyslog.c
=====================================
--- a/tests/libntp/msyslog.c
+++ b/tests/libntp/msyslog.c
@@ -90,22 +90,20 @@ TEST(msyslog, msnprintfHangingPercent)
 	ZERO(exp_buf);
 	ZERO(act_buf);
 /* warning: format string contains '\0' within the string body [-Wformat] */
-#ifdef __GNUC__
+#ifdef __clang__
+#  pragma clang diagnostic push
+#  pragma clang diagnostic ignored "-Wformat"
+#else /* GCC */
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wformat-contains-nul"
 #pragma GCC diagnostic ignored "-Wformat="
 #pragma GCC diagnostic ignored "-Wformat"
 #endif
-#ifdef __clang__
-#  pragma clang diagnostic push
-#  pragma clang diagnostic ignored "-Wformat"
-#endif
 	exp_cnt = snprintf(exp_buf, sizeof(exp_buf), "percent then nul term then non-nul %\0oops!");
 	act_cnt = msnprintf(act_buf, sizeof(act_buf), "percent then nul term then non-nul %\0oops!");
 #ifdef __clang__
 #  pragma clang diagnostic pop
-#endif
-#ifdef __GNUC__
+#else
 #pragma GCC diagnostic pop
 #endif
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/813f50ee4285d17350c306fa8b3a4369d6dd2018...2508258fa955044040d2e9c21d3893fd659ef577
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151207/bd73a6ea/attachment.html>


More information about the vc mailing list