Skip to content

Commit

Permalink
Don't set CPPFLAGS, CFLAGS, LDFLAGS in configure.
Browse files Browse the repository at this point in the history
Instead set debug preproc/compile/link options locally in Makefile.am.
  • Loading branch information
mschuerig committed Jan 22, 2009
1 parent b667658 commit 02112e4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
1 change: 0 additions & 1 deletion TODO
@@ -1,7 +1,6 @@


* Don't restart command if exited with a specific set of status codes * Don't restart command if exited with a specific set of status codes
* Listen to multiple streams (stderr)? * Listen to multiple streams (stderr)?
* Don't set CLAGS and LDFLAGS in configure.ac
* USE the flags set in config.h! * USE the flags set in config.h!


Packaging Packaging
Expand Down
21 changes: 2 additions & 19 deletions configure.ac
Expand Up @@ -7,27 +7,10 @@ AC_CONFIG_SRCDIR([src/hangon.c])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])


# Options # Options

# -Wextra enables additional checks not included in -Wall
# AM_INIT_AUTOMAKE doesn't accept -Wextra so it is added
# manually. See gcc(1).
#
# _FORTIFY_SOURCE adds some checking against buffer overflows.
# See feature_test_macros(7).
CFLAGS="$CFLAGS -Wextra -D_FORTIFY_SOURCE=2"

AC_ARG_ENABLE([debug], AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [enable debugging]), AS_HELP_STRING([--enable-debug], [enable debugging]),
enable_debug="yes", []) enable_debug="true")
if test "x$enable_debug" = "xyes"; then AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
# Add some heavy-weight pointer checking using mudflap
# See gcc(1) and <http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging>.
CPPFLAGS="$CPPFLAGS -DDEBUG"
CFLAGS="$CFLAGS -O0 -g -fmudflap"
LDFLAGS="$LDFLAGS -lmudflap"
else
CPPFLAGS="$CPPFLAGS -DNDEBUG"
fi


# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
Expand Down
24 changes: 23 additions & 1 deletion src/Makefile.am
Expand Up @@ -4,4 +4,26 @@ hangon_SOURCES = hangon.c
hangon_LDADD = @LIBINTL@ ../gnulib/lib/libgnu.a hangon_LDADD = @LIBINTL@ ../gnulib/lib/libgnu.a


localedir = $(datadir)/locale localedir = $(datadir)/locale
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" \
-I$(top_srcdir)/gnulib/lib \
-I$(top_builddir)/gnulib/lib \
-D_FORTIFY_SOURCE=2
# _FORTIFY_SOURCE adds some checking against buffer overflows.
# See feature_test_macros(7).

AM_CFLAGS = -std=c99 \
-Wall -Wextra \
-Wwrite-strings \
-Wunused -Wno-unused-parameter \
-Werror

if DEBUG
# Add some heavy-weight pointer checking using mudflap
# See gcc(1) and <http://gcc.gnu.org/wiki/Mudflap_Pointer_Debugging>.
AM_CPPFLAGS += -DDEBUG
AM_CFLAGS += -O0 -g -fmudflap
AM_LDFLAGS = -lmudflap
else
AM_CPPFLAGS += -DNDEBUG
endif
3 changes: 3 additions & 0 deletions src/hangon.c
Expand Up @@ -7,6 +7,7 @@
*/ */
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
#include <libintl.h>
#include <locale.h> #include <locale.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h> #include <stdbool.h>
Expand Down Expand Up @@ -59,7 +60,9 @@ static char **command_args;
static int timeout_secs = 60; static int timeout_secs = 60;
static int max_retries = 0; static int max_retries = 0;
static bool quiet = false; static bool quiet = false;
#ifdef DEBUG
static bool debugging = false; static bool debugging = false;
#endif


static void static void
usage(int status) usage(int status)
Expand Down

0 comments on commit 02112e4

Please sign in to comment.