From 29b483f0aa5de7937a562ade54901457feee3432 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN\"" Date: Sun, 1 Apr 2012 15:21:22 +0200 Subject: [PATCH] configure: add option to build with -Werror Signed-off-by: "Yann E. MORIN" --- configure.ac | 20 ++++++++++++++++++-- frontends/conf/Makefile.am | 1 + frontends/gconf/Makefile.am | 3 ++- frontends/mconf/Makefile.am | 2 ++ frontends/nconf/Makefile.am | 2 ++ frontends/qconf/Makefile.am | 3 ++- libs/lxdialog/Makefile.am | 1 + libs/parser/Makefile.am | 1 + 8 files changed, 29 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 78b1342..2cfeefd 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,19 @@ LT_INIT([disable-static]) #--------------------------------------------------------------------------- # Set misc options + +# By default, do not build with -Werror, unless the user asks for it +AC_ARG_ENABLE( + [werror], + [AS_HELP_STRING( + [--enable-werror], + [build with -Werror (default=no)])], + [AS_CASE( + ["$enableval"], + [yes], [werror_CFLAGS=-Werror], + [*], [werror_CFLAGS=""])]) +AC_SUBST([werror_CFLAGS],[${werror_CFLAGS}]) + # Although there is a default (="linux") in the code, we do provide # a default here, to get a consistent autostuff behavior AC_ARG_ENABLE( @@ -372,8 +385,11 @@ AC_OUTPUT AC_MSG_NOTICE() AC_MSG_NOTICE([Configured with:]) -AC_MSG_NOTICE([- root-menu prompt: '$root_menu']) -AC_MSG_NOTICE([- config prefix: '$config_prefix']) +AS_IF([test "$enable_werror" = "yes"], + [AC_MSG_NOTICE([- treat warnings as errors: yes])], + [AC_MSG_NOTICE([- treat warnings as errors: no])]) +AC_MSG_NOTICE([- root-menu prompt: '$root_menu']) +AC_MSG_NOTICE([- config prefix: '$config_prefix']) AC_MSG_NOTICE([- frontends:]) AS_IF([test "$enable_conf" = "yes"], [AC_MSG_NOTICE([ - conf: yes])], diff --git a/frontends/conf/Makefile.am b/frontends/conf/Makefile.am index 9b464cc..4c3ce1f 100644 --- a/frontends/conf/Makefile.am +++ b/frontends/conf/Makefile.am @@ -4,5 +4,6 @@ conf_SOURCES = conf.c conf_CPPFLAGS = $(AM_CPPFLAGS) \ $(GETTEXT) \ -I$(top_srcdir)/libs/parser +conf_CFLAGS = $(AM_CFLAGS) $(werror_CFLAGS) conf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ $(conf_EXTRA_LIBS) diff --git a/frontends/gconf/Makefile.am b/frontends/gconf/Makefile.am index 0edd622..2aa1a55 100644 --- a/frontends/gconf/Makefile.am +++ b/frontends/gconf/Makefile.am @@ -6,7 +6,8 @@ gconf_CPPFLAGS = $(AM_CPPFLAGS) \ -I$(top_srcdir)/libs/parser \ -I$(top_srcdir)/libs/images \ -DGUI_PATH='"$(pkgdatadir)/gconf.glade"' -gconf_CFLAGS = $(AM_CFLAGS) \ +gconf_CFLAGS = $(AM_CFLAGS) \ + $(werror_CFLAGS) \ $(gtk_CFLAGS) gconf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ $(gtk_LIBS) $(gconf_EXTRA_LIBS) diff --git a/frontends/mconf/Makefile.am b/frontends/mconf/Makefile.am index 9219d0d..c107ec9 100644 --- a/frontends/mconf/Makefile.am +++ b/frontends/mconf/Makefile.am @@ -6,6 +6,8 @@ mconf_CPPFLAGS = $(AM_CPPFLAGS) \ $(GETTEXT) \ -I$(top_srcdir)/libs \ -I$(top_srcdir)/libs/parser +mconf_CFLAGS = $(AM_CFLAGS) \ + $(werror_CFLAGS) mconf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ $(top_builddir)/libs/lxdialog/liblxdialog.a \ $(ncurses_LIBS) $(mconf_EXTRA_LIBS) diff --git a/frontends/nconf/Makefile.am b/frontends/nconf/Makefile.am index 241912c..87402e2 100644 --- a/frontends/nconf/Makefile.am +++ b/frontends/nconf/Makefile.am @@ -4,6 +4,8 @@ nconf_SOURCES = nconf.c nconf.gui.c nconf.h nconf_CPPFLAGS = $(AM_CPPFLAGS) \ $(GETTEXT) \ -I$(top_srcdir)/libs/parser +nconf_CFLAGS = $(AM_CFLAGS) \ + $(werror_CFLAGS) nconf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ $(ncurses_extra_LIBS) $(ncurses_LIBS) \ $(nconf_EXTRA_LIBS) diff --git a/frontends/qconf/Makefile.am b/frontends/qconf/Makefile.am index 5815271..616d3d4 100644 --- a/frontends/qconf/Makefile.am +++ b/frontends/qconf/Makefile.am @@ -6,7 +6,8 @@ qconf_CPPFLAGS = $(AM_CPPFLAGS) \ $(GETTEXT) \ -I$(top_srcdir)/libs/parser \ -I$(top_srcdir)/libs/images -qconf_CXXFLAGS = $(AM_CXXFLAGS) \ +qconf_CXXFLAGS = $(AM_CXXFLAGS) \ + $(werror_CFLAGS) \ $(qt4_CFLAGS) qconf_LDADD = $(top_builddir)/libs/parser/libkconfigparser.la \ $(qt4_LIBS) $(qconf_EXTRA_LIBS) diff --git a/libs/lxdialog/Makefile.am b/libs/lxdialog/Makefile.am index 5f22423..fa2358c 100644 --- a/libs/lxdialog/Makefile.am +++ b/libs/lxdialog/Makefile.am @@ -12,3 +12,4 @@ liblxdialog_a_SOURCES = \ liblxdialog_a_CPPFLAGS = $(AM_CPPFLAGS) \ -DCURSES_LOC='"${CURSES_LOC}"' \ $(GETTEXT) +liblxdialog_a_CFLAGS = $(AM_CFLAGS) $(werror_CFLAGS) diff --git a/libs/parser/Makefile.am b/libs/parser/Makefile.am index 2ef195c..92bcf1e 100644 --- a/libs/parser/Makefile.am +++ b/libs/parser/Makefile.am @@ -8,6 +8,7 @@ dist_EXTRA_libkconfigparser_la_SOURCES = \ expr.c expr.h lkc.h lkc_proto.h libkconfigparser_la_CPPFLAGS = -DROOTMENU="\"$(root_menu)\"" \ -DCONFIG_=\"$(config_prefix)\" +libkconfigparser_la_CFLAGS = $(AM_CFLAGS) $(werror_CFLAGS) libkconfigparser_la_LDFLAGS = -release $(KCONFIGPARSER_LIB_VERSION) kconfig_includedir = $(includedir)/kconfig -- 2.39.5