From a8f3c276d5f408d39b2474f62e1f80cc97e5a2b0 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Thu, 18 Jun 2009 11:27:58 -0400 Subject: Allow the use of custom CFLAGS on the make command line Setting CFLAGS explicitly in configure.ac means that they would be overwritten when using e.g. make CFLAGS="-O0 -g" This replaces the explicit setting of CFLAGS with an AM_CONDITIONAL to have Makefile.am set these instead. Also fixes a missing #include that was coincidentally obscured because gcc's -O2 happened to be able to locate it. Setting -O0 revealed the problem. --- server/Makefile.am | 4 ++++ server/configure.ac | 4 +--- server/util/sssd-i18n.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/Makefile.am b/server/Makefile.am index 45f5eec55..bed9060bd 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -18,6 +18,10 @@ AM_CFLAGS = if WANT_AUX_INFO AM_CFLAGS += -aux-info $@.X endif +if HAVE_GCC + AM_CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \ + -Wcast-qual -Wcast-align -Wwrite-strings +endif REPLACE_CFLAGS = \ -I $(srcdir)/../replace diff --git a/server/configure.ac b/server/configure.ac index 77f7ec73b..88032766e 100644 --- a/server/configure.ac +++ b/server/configure.ac @@ -26,9 +26,7 @@ AM_GNU_GETTEXT_VERSION([0.17]) m4_pattern_allow([AM_SILENT_RULES]) AM_SILENT_RULES -if test "$ac_cv_prog_gcc" = yes; then - CFLAGS="$CFLAGS -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings" -fi +AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes]) AC_CHECK_HEADERS(stdint.h dlfcn.h) AC_CONFIG_HEADER(config.h) diff --git a/server/util/sssd-i18n.h b/server/util/sssd-i18n.h index 74f9bec01..fab1cdd04 100644 --- a/server/util/sssd-i18n.h +++ b/server/util/sssd-i18n.h @@ -1,6 +1,7 @@ #ifndef _SSSD_I18N_H #define _SSSD_I18N_H +#include #include #define _(STRING) gettext (STRING) #include "config.h" -- cgit