From 97a12ba3f184a76c406eb5622ec21a4d4d6fc8bf Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Wed, 16 Jun 2010 22:49:16 +0200 Subject: configure/Makefile and debug fixes --- Make_global.am | 7 ++++++- configure.ac | 12 ++++++++++++ include/libipset/debug.h | 2 -- lib/parse.c | 4 ++++ lib/session.c | 5 ++++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Make_global.am b/Make_global.am index ac9a2ca..857d0de 100644 --- a/Make_global.am +++ b/Make_global.am @@ -13,7 +13,7 @@ AM_CPPFLAGS = $(kinclude_CFLAGS) $(all_includes) -I$(top_srcdir)/include \ # -Wunreachable-code -> fails with ntoh* if DISABLE_EXTRA_FLAGS -AM_CFLAGS = +AM_CFLAGS = else AM_CFLAGS = -std=gnu99 \ -Wall \ @@ -42,7 +42,12 @@ AM_CFLAGS = -std=gnu99 \ -g -ggdb -gdwarf-2 -g3 endif +if ENABLE_DEBUG +AM_CFLAGS += -DIPSET_DEBUG +endif + if ! ENABLE_VERBOSE +AM_LIBTOOL_SILENT = --silent AM_VERBOSE_CC = @echo " CC " $@; AM_VERBOSE_CCLD = @echo " CCLD " $@; endif diff --git a/configure.ac b/configure.ac index cfffa99..658d5f0 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,18 @@ AC_ARG_ENABLE([verbose], AM_CONDITIONAL([ENABLE_VERBOSE], [test "x$enable_verbose" = xyes]) +dnl Enable debugging +AC_ARG_ENABLE([debug], + AS_HELP_STRING([--enable-debug], + [Enable compiling with debug support.]), + [case "${enableval}" in + yes) enable_verbose=yes ;; + no) enable_verbose=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; + esac], [enable_debug=no]) + +AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = xyes]) + dnl Disable extra warn flags AC_ARG_ENABLE([extra-flags], AS_HELP_STRING([--disable-extra-flags], diff --git a/include/libipset/debug.h b/include/libipset/debug.h index 1e32ce2..b0f4dfd 100644 --- a/include/libipset/debug.h +++ b/include/libipset/debug.h @@ -7,8 +7,6 @@ #ifndef LIBIPSET_DEBUG_H #define LIBIPSET_DEBUG_H -#define IPSET_DEBUG - #ifdef IPSET_DEBUG #include #include diff --git a/lib/parse.c b/lib/parse.c index e347c69..a07168d 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -21,6 +21,10 @@ #include /* string utilities */ #include /* prototypes */ +#ifndef ULLONG_MAX +#define ULLONG_MAX 18446744073709551615ULL +#endif + /* Parse input data */ #define cidr_separator(str) ipset_strchr(str, IPSET_CIDR_SEPARATOR) diff --git a/lib/session.c b/lib/session.c index 64d5c4a..36716f0 100644 --- a/lib/session.c +++ b/lib/session.c @@ -488,13 +488,16 @@ attr2data(struct ipset_session *session, struct nlattr *nla[], break; } } +#ifdef IPSET_DEBUG if (type == IPSET_ATTR_TYPENAME) D("nla typename %s", (char *) d); +#endif ret = ipset_data_set(data, attr->opt, d); +#ifdef IPSET_DEBUG if (type == IPSET_ATTR_TYPENAME) D("nla typename %s", (char *) ipset_data_get(data, IPSET_OPT_TYPENAME)); - +#endif return ret; } -- cgit v1.2.3