summaryrefslogtreecommitdiffstats
path: root/common/logging.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-12-07 14:53:49 +0100
committerWerner Koch <wk@gnupg.org>2017-12-07 14:53:49 +0100
commit2fedf8583bcc493f587c90bc9632d25dfd10bd10 (patch)
tree518b5eb765cd8b26de7b6ab84ea28a1b720392d6 /common/logging.h
parentagent: Change intialization of assuan socket system hooks. (diff)
downloadgnupg2-2fedf8583bcc493f587c90bc9632d25dfd10bd10.tar.xz
gnupg2-2fedf8583bcc493f587c90bc9632d25dfd10bd10.zip
build: Do not define logging.h constants for libgpg-error dev versions.
* common/logging.h [GPGRT_LOG_WITH_PREFIX]: Do not define the log constants. -- logging.h uses constants we plan to use for future versions of libgpg-error. My dev version already has the logging functions and thus I run into a conflict. This patch protects against this and make the GnuPG work with later libgpg-error versions. It was not the best idea to use constants from a planned libgpg-error in the first place. The actual problem are the enums, the macros won't harm. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to '')
-rw-r--r--common/logging.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/common/logging.h b/common/logging.h
index e1bf56b17..c6a32b45a 100644
--- a/common/logging.h
+++ b/common/logging.h
@@ -70,15 +70,21 @@ estream_t log_get_stream (void);
: _log_assert (#expr, __FILE__, __LINE__))
#endif /*!GPGRT_HAVE_MACRO_FUNCTION*/
-/* Flag values for log_set_prefix. */
-#define GPGRT_LOG_WITH_PREFIX 1
-#define GPGRT_LOG_WITH_TIME 2
-#define GPGRT_LOG_WITH_PID 4
-#define GPGRT_LOG_RUN_DETACHED 256
-#define GPGRT_LOG_NO_REGISTRY 512
-/* Log levels as used by log_log. */
-enum jnlib_log_levels {
+/* If we use an older libgpg-error we need to define the constants
+ * which will be used by current libgpg-error development
+ * versions. */
+#ifndef GPGRT_LOG_WITH_PREFIX
+
+ /* Flag values for log_set_prefix. */
+# define GPGRT_LOG_WITH_PREFIX 1
+# define GPGRT_LOG_WITH_TIME 2
+# define GPGRT_LOG_WITH_PID 4
+# define GPGRT_LOG_RUN_DETACHED 256
+# define GPGRT_LOG_NO_REGISTRY 512
+
+ /* Log levels as used by log_log. */
+ enum jnlib_log_levels {
GPGRT_LOG_BEGIN,
GPGRT_LOG_CONT,
GPGRT_LOG_INFO,
@@ -87,7 +93,9 @@ enum jnlib_log_levels {
GPGRT_LOG_FATAL,
GPGRT_LOG_BUG,
GPGRT_LOG_DEBUG
-};
+ };
+#endif /* Old libgpg-error. */
+
void log_log (int level, const char *fmt, ...) GPGRT_ATTR_PRINTF(2,3);
void log_logv (int level, const char *fmt, va_list arg_ptr);
void log_logv_with_prefix (int level, const char *prefix,