From 57254cdd05981a6d2c035f868316bbca2c5495f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 21 Aug 2020 10:37:20 +0200 Subject: [PATCH] configure: add option --enable-werror Adds the compiler flag -Werror to fail on warnings. Useful for CI runs. --- Makefile.am | 2 +- configure.ac | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 159e22a7..0cc47b69 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,7 +12,7 @@ applications_DATA = htop.desktop pixmapdir = $(datadir)/pixmaps pixmap_DATA = htop.png -AM_CFLAGS = -pedantic -Wall $(wextra_flag) -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"$(sysconfdir)\" -I"$(top_srcdir)/$(my_htop_platform)" +AM_CFLAGS += -pedantic -Wall $(wextra_flag) -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR=\"$(sysconfdir)\" -I"$(top_srcdir)/$(my_htop_platform)" AM_LDFLAGS = AM_CPPFLAGS = -DNDEBUG diff --git a/configure.ac b/configure.ac index 71a4f799..4e357a31 100644 --- a/configure.ac +++ b/configure.ac @@ -295,6 +295,9 @@ then ]) fi +AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror], [Treat warnings as errors (default: warnings are not errors)])], [enable_werror="$enableval"], [enable_werror=no]) +AS_IF([test "x$enable_werror" = "xyes"], [AM_CFLAGS="$AM_CFLAGS -Werror"]) +AC_SUBST([AM_CFLAGS]) # Bail out on errors. # ----------------------------------------------------------------------