Browse Source

configure.ac: enable assertions explicitly

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Toni Uhlig 4 years ago
parent
commit
6c8c121cc1
2 changed files with 15 additions and 0 deletions
  1. 11 0
      configure.ac
  2. 4 0
      src/Makefile.am

+ 11 - 0
configure.ac

@@ -174,6 +174,16 @@ AC_MSG_RESULT([${with_rngdev}])
 AC_DEFINE_UNQUOTED([RNGDEV], ["${with_rngdev}"],
 	[set the path to the random device you want to use for pt_random])
 
+dnl `--enable-asserts`: Disabled per defult
+AC_ARG_ENABLE([asserts],
+	[AS_HELP_STRING([--enable-asserts], [Enable asserts(). (default: disabled)])],[asserts_enabled=yes],)
+asserts_enabled=$(echo ${asserts_enabled})
+case ${asserts_enabled} in
+	1|y|yes) asserts_enabled=yes ;;
+	''|0|n|no) asserts_enabled=no ;;
+	*) AC_MSG_ERROR([Unknown option \`${asserts_enabled}\` for --enable-asserts]) ;;
+esac
+
 dnl Check libpcap headers/functions.
 if test x"${pcap_enabled}" != x -a \
         x"${use_msw}" != xyes; then
@@ -236,6 +246,7 @@ AM_CONDITIONAL([IS_WINDOWS], [test x"${use_msw}" = xyes])
 AM_CONDITIONAL([HAVE_ICMPFILTER], [test x"${with_icmp_filter}" = xyes])
 AM_CONDITIONAL([HAVE_ARC4RANDOM], [test x"${arc4random_enabled}" = xyes])
 AM_CONDITIONAL([USE_CUSTOMRNG], [test x"${use_customrng}" = xyes])
+AM_CONDITIONAL([DISABLE_ASSERTS], [test x"${asserts_enabled}" != xyes])
 
 dnl output config headers
 AC_CONFIG_HEADERS([src/config.h:src/config.h.in])

+ 4 - 0
src/Makefile.am

@@ -30,6 +30,10 @@ if USE_CUSTOMRNG
 ptunnel_ng_CFLAGS += -DUSE_CUSTOMRNG=1
 endif
 
+if DISABLE_ASSERTS
+ptunnel_ng_CFLAGS += -DNDEBUG=1
+endif
+
 ptunnel_ng_SOURCES = \
 	md5.c \
 	challenge.c \