Add SERVAL_ENABLE_DEBUG macro

This commit is contained in:
Andrew Bettison 2016-11-14 11:26:28 +10:30
parent e769af0067
commit 2690a5795b
3 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,7 @@ SERVALD_LOCAL_CFLAGS = \
-Wno-unknown-attributes \
-DSERVALD_VERSION="\"Android\"" -DSERVALD_COPYRIGHT="\"Android\"" \
-DINSTANCE_PATH="\"/data/data/org.servalproject/var/serval-node\"" \
-DSERVAL_ENABLE_DEBUG=1 \
-DSHELL -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" \
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" \
-DHAVE_FUNC_ATTRIBUTE_ERROR=1 \

View File

@ -79,6 +79,7 @@ CFLAGS+=-DSQLITE_THREADSAFE=0 \
-DSQLITE_OMIT_AUTHORIZATION
CFLAGS+=-fPIC
CFLAGS+=-Wall -Werror
CFLAGS+=-DSERVAL_ENABLE_DEBUG=1
# Solaris magic
CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1
# OSX magic to compensate for the Solaris magic

8
conf.h
View File

@ -704,7 +704,15 @@ extern __thread int cf_initialised;
extern __thread int cf_limbo;
extern __thread struct config_main config;
// This macro is used in an if (IF_DEBUG(flagname)) { } statement around all
// debugging log statements. If macro SERVAL_ENABLE_DEBUG can be pre-defined as 0
// (eg, using the -D command-line option) to build without any debug
// statements.
#if SERVAL_ENABLE_DEBUG+0
#define IF_DEBUG(flagname) (config.debug.flagname)
#else
#define IF_DEBUG(flagname) (0)
#endif
int cf_init(void);
int cf_load(void);