aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--include/asn1c/asn_system.h2
-rw-r--r--src/Makefile.am3
-rw-r--r--src/asn_codecs_prim.c4
4 files changed, 13 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index b8b5743..aaa2b5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,10 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
CFLAGS="$saved_CFLAGS"
AC_SUBST(SYMBOL_VISIBILITY)
+AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Buld the library with EMIT_ASN_DEBUG enabled])],
+ [build_debug="$enableval"], [build_debug="no"])
+AM_CONDITIONAL(BUILD_DEBUG, test "x$build_debug" = "xyes")
+
AC_OUTPUT(
libasn1c.pc
src/Makefile
diff --git a/include/asn1c/asn_system.h b/include/asn1c/asn_system.h
index e420ad2..fe8a377 100644
--- a/include/asn1c/asn_system.h
+++ b/include/asn1c/asn_system.h
@@ -21,6 +21,8 @@
#include <stdarg.h> /* For va_start */
#include <stddef.h> /* for offsetof and ptrdiff_t */
+extern int asn_debug;
+
#ifdef _WIN32
#include <malloc.h>
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.
*/