summaryrefslogtreecommitdiff
path: root/gnuradio-runtime
diff options
context:
space:
mode:
authorMichael Dickens <michael.dickens@ettus.com>2017-05-09 11:29:06 -0400
committerMichael Dickens <michael.dickens@ettus.com>2017-05-09 11:29:06 -0400
commit08ab03d781135481f15afc1ef0754c60d4ccad42 (patch)
tree367f0941e68b35197471a9fc6395bf6d7c3ffe00 /gnuradio-runtime
parent26475d40e123a139cd7029c5172612d6f59d9fd3 (diff)
runtime: fix logger to work with log4cpp 1.1.2 & prior both in tree & OOT.
Diffstat (limited to 'gnuradio-runtime')
-rw-r--r--gnuradio-runtime/include/gnuradio/logger.h.in51
1 files changed, 49 insertions, 2 deletions
diff --git a/gnuradio-runtime/include/gnuradio/logger.h.in b/gnuradio-runtime/include/gnuradio/logger.h.in
index 08cb209c7..13fda6f6c 100644
--- a/gnuradio-runtime/include/gnuradio/logger.h.in
+++ b/gnuradio-runtime/include/gnuradio/logger.h.in
@@ -35,13 +35,60 @@
*
*/
-#ifndef ENABLE_GR_LOG
+// handle current status of GR_LOG
+#ifdef EXT_ENABLE_GR_LOG
+#undef EXT_ENABLE_GR_LOG
+#endif
+#ifdef ENABLE_GR_LOG
+#define EXT_ENABLE_GR_LOG
+#undef ENABLE_GR_LOG
+#endif
+
+// did GR enable LOG?
#cmakedefine ENABLE_GR_LOG
+
+// if GR does not provide logging and the current module is requesting
+// it, disable it.
+#if defined(EXT_ENABLE_GR_LOG) && !defined(ENABLE_GR_LOG)
+#warning "Logging was requested but is not enabled in GNU Radio, so disabling."
+#undef EXT_ENABLE_GR_LOG
#endif
-#ifndef HAVE_LOG4CPP
+
+// if GR provides logging but the current module is not requesting it,
+// disable it.
+#if !defined(EXT_ENABLE_GR_LOG) && defined(ENABLE_GR_LOG)
+#undef ENABLE_GR_LOG
+#endif
+
+// the other 2 cases work; no need to check them!
+
+// handle current status of LOG4CPP
+#ifdef EXT_HAVE_LOG4CPP
+#undef EXT_HAVE_LOG4CPP
+#endif
+#ifdef HAVE_LOG4CPP
+#define EXT_HAVE_LOG4CPP
+#undef HAVE_LOG4CPP
+#endif
+
+// did GR use log4cpp?
#cmakedefine HAVE_LOG4CPP
+
+// if GR does not use log4cpp and the current module is requesting it,
+// disable it & print a warning.
+#if defined(EXT_HAVE_LOG4CPP) && !defined(HAVE_LOG4CPP)
+#warning "Log4Cpp use was requested but was not in GNU Radio, so disabling."
+#undef EXT_HAVE_LOG4CPP
+#endif
+
+// if GR provides for using log4cpp but the current module is not
+// requesting it, disable it quietly.
+#if !defined(EXT_HAVE_LOG4CPP) && defined(HAVE_LOG4CPP)
+#undef HAVE_LOG4CPP
#endif
+// the other 2 cases work; no need to check them!
+
#ifdef _MSC_VER
typedef unsigned short mode_t;
#else