summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-12-18 15:37:17 +0100
committerHarald Welte <laforge@gnumonks.org>2015-12-18 15:38:42 +0100
commita37b06d7354c5cfec0e88dc22a8a5d784551f1b3 (patch)
tree02fdd685e1a9769902eabba107f571cdbca8fbe2 /src
parent41b85d5597119fa8105dc0641ffe5cd1bbae39b2 (diff)
add '--enable-debug' configure option to build with EMIT_ASN_DEBUG
... which in turn causes all the ASN_DEBUG() to be turned into fprintf(stderr, ...) statements, once the user application decides to set 'asn_debug = 1' somewhere in its code. The next step would be to make _ASN_DECODE_FAILED / _ASN_ENCODE_FAILED no longer depend on ASN_DEBUG (which it currently does)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/asn_codecs_prim.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 633cc04..8004b37 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,9 @@ LIBVERSION=1:0:0
AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include/asn1c
AM_CFLAGS = -fPIC -Wall $(LIBOSMOCORE_CFLAGS)
+if BUILD_DEBUG
+AM_CFLAGS += -DEMIT_ASN_DEBUG=1
+endif
lib_LTLIBRARIES = libasn1c.la
diff --git a/src/asn_codecs_prim.c b/src/asn_codecs_prim.c
index 8e604a4..53d20c0 100644
--- a/src/asn_codecs_prim.c
+++ b/src/asn_codecs_prim.c
@@ -6,6 +6,10 @@
#include <asn_codecs_prim.h>
#include <errno.h>
+#if EMIT_ASN_DEBUG == 1
+int asn_debug = 0;
+#endif
+
/*
* Decode an always-primitive type.
*/