From: David Levine Date: Fri, 13 Jan 2012 04:14:59 +0000 (-0600) Subject: Added -Wunused-macros with gcc, if supported. Added -Wno-unused-macros, X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=b70215dfee4aeb9f530a104e348ce2c28e97add6;p=mmh Added -Wunused-macros with gcc, if supported. Added -Wno-unused-macros, if supported, to compile of sbr/dtimep.o with gcc because it uses generated code that would be too much trouble to clean up. --- diff --git a/configure.ac b/configure.ac index 43a1029..28821ae 100644 --- a/configure.ac +++ b/configure.ac @@ -218,6 +218,20 @@ fi AC_PROG_CC +AC_CACHE_CHECK(whether preprocessor supports -Wunused-macros, + nmh_cv_has_unusedmacros, + [nmh_saved_cppflags="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -Wunused-macros -Wno-unused-macros" + AC_TRY_COMPILE([],[],nmh_cv_has_unusedmacros=yes,nmh_cv_has_unusedmacros=no) + CPPFLAGS="$nmh_saved_cppflags"]) + +if test "$nmh_cv_has_unusedmacros" = 'yes'; then + test -z "$CPPLAGS" && CPPFLAGS=-Wunused-macros \ + || CPPFLAGS="$CPPFLAGS -Wunused-macros" + DISABLE_UNUSED_MACROS_WARNING=-Wno-unused-macros +fi +AC_SUBST(DISABLE_UNUSED_MACROS_WARNING)dnl + AC_CACHE_CHECK(whether compiler supports -Wno-pointer-sign, nmh_cv_has_noptrsign, [nmh_saved_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wno-pointer-sign" @@ -456,7 +470,8 @@ dnl before system header files. case "$target_os" in linux*) # Like DEFS, but doesn't get stomped on by configure when using config.h: - OURDEFS="$OURDEFS -D_GNU_SOURCE" + test -z "$OURDEFS" && OURDEFS="-D_GNU_SOURCE" \ + || OURDEFS="$OURDEFS -D_GNU_SOURCE" ;; esac AC_SUBST(OURDEFS) diff --git a/sbr/Makefile.in b/sbr/Makefile.in index 555d031..c949469 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -16,6 +16,7 @@ etcdir = @sysconfdir@ CC = @CC@ CFLAGS = @CFLAGS@ +DISABLE_UNUSED_MACROS_WARNING = @DISABLE_UNUSED_MACROS_WARNING@ DEFS = @DEFS@ CONFIGDEFS = -DNMHETCDIR='"$(etcdir)"' -DMAILSPOOL='"$(mailspool)"' -DSENDMAILPATH='"$(sendmailpath)"' INCLUDES = -I. -I$(top_srcdir) @CPPFLAGS@ @@ -39,7 +40,7 @@ COMPILE2 = $(CC) -c $(DEFS) $(CONFIGDEFS) $(INCLUDES) $(CFLAGS) .SUFFIXES: -.SUFFIXES: .c .o +.SUFFIXES: .c .o .lex .c.o: $(COMPILE) $< @@ -97,8 +98,9 @@ lint: sigmsg.h # some lexes will only accept '-n -t', not '-nt'. # Also, not all makes accept $< in non-pattern rules, # hence the explicit filenames here. -dtimep.c: dtimep.lex +dtimep.o: dtimep.lex $(LEX) -n -t $(srcdir)/dtimep.lex > dtimep.c + $(COMPILE) $(DISABLE_UNUSED_MACROS_WARNING) dtimep.c client.o: client.c $(COMPILE2) $(srcdir)/client.c