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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Mike Frysinger
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


_______________________________________________
Confuse-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/confuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: [patch] unify -Wall flags and make -Werror optional

ohnobinki
On Sun, Jan 17, 2010 at 06:14:51PM -0500, Mike Frysinger wrote:
> 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.
Setting AM_CFLAGS to anything as well as the GCC test have been removed from confuse-2.7. Thanks for pointing this out.

--
ohnobinki

Look out for missing apostrophes! (or extraneous ones)


_______________________________________________
Confuse-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/confuse-devel