confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Confuse-devel] [patch] unify -Wall flags and make -Werror optional


From: Mike Frysinger
Subject: [Confuse-devel] [patch] unify -Wall flags and make -Werror optional
Date: Sun, 17 Jan 2010 18:14:51 -0500

rather than copy and paste the same thing in every Makefile.am, handle it in
configure.  also let people disable the -Werror flag at configure time.

--- configure.ac
+++ configure.ac
@@ -24,8 +24,6 @@ AM_PROG_LEX
 AC_DISABLE_SHARED
 AC_PROG_LIBTOOL
 
-AM_CONDITIONAL([cc_is_gcc], test "$GCC" = "yes")
-
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.16.1])
 
@@ -42,6 +40,13 @@ AC_CHECK_FUNCS([strcasecmp strdup strndu
 dnl Check for the library containing inet_aton/inet_ntoa (for tests)
 AC_SEARCH_LIBS([inet_ntoa], [socket nsl])
 
+AC_ARG_ENABLE([werror],
+       [AC_HELP_STRING([--disable-werror], [disable -Werror @<:@default=enable 
if 
gcc@:>@])],
+       [enable_werror=$enableval],
+       [test "x$GCC" = "xyes" && enable_werror=yes])
+test "x$enable_werror" = "xyes" && CFLAGS="$CFLAGS -Werror"
+test "x$GCC" = "xyes" && CFLAGS="$CFLAGS -Wall"
+
 AC_CONFIG_FILES([Makefile \
                 src/Makefile \
                 examples/Makefile \
--- doc/Makefile.am
+++ doc/Makefile.am
@@ -9,10 +9,6 @@ INCLUDES = -I$(top_srcdir)/src
 AM_LDFLAGS = -L../src/
 LIBS = $(LTLIBINTL)
 
-if cc_is_gcc
-AM_CFLAGS=-Wall -Werror
-endif
-
 TUTORIAL_CSOURCES = listing1.c listing2.c listing3.c listing4.c \
                    listing5.c listing6.c listing7.c listing8.c
 TUTORIAL_LISTINGS = $(TUTORIAL_CSOURCES:.c=.xml)
--- src/Makefile.am
+++ src/Makefile.am
@@ -9,10 +9,6 @@ datadir = @datadir@
 localedir = $(datadir)/locale
 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
 
-if cc_is_gcc
-AM_CFLAGS=-Wall
-endif
-
 LIBS = @LIBS@
 
 CLEANFILES=*~ \#*\#
--- tests/Makefile.am
+++ tests/Makefile.am
@@ -10,9 +10,5 @@ CLEANFILES=*~
 
 DEFS=-DSRC_DIR='"$(srcdir)"'
 
-if cc_is_gcc
-AM_CFLAGS=-Wall -Werror
-endif
-
 celan: clean
 
-mike




reply via email to

[Prev in Thread] Current Thread [Next in Thread]