AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [Enable debugging]),
CFLAGS="$CFLAGS -g -D_DEBUG")
AC_HELP_STRING([--enable-debug], [Enable debugging]),
CFLAGS="$CFLAGS -g -D_DEBUG")
Define:
#ifdef _DEBUG
#define DEBUG(format, args...) printf("[%s:%d] "format, __FILE__, __LINE__, ##args)
#else
#define DEBUG(args...)
#endif
#define DEBUG(format, args...) printf("[%s:%d] "format, __FILE__, __LINE__, ##args)
#else
#define DEBUG(args...)
#endif
Usage:
DEBUG("Debugging Mode was enabled\n")
Result:
[main.c:3] Debugging mode was enabled
Reference:
為你的程式加上 Debugging Mode
沒有留言:
張貼留言