From: Teemu Toivola Date: Sat, 10 Mar 2018 16:06:58 +0000 (+0200) Subject: add --enable-werror parameter for configure and use it in travis X-Git-Tag: v2.0~79^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b97cf760bdbb2b3cfedefa965268c95ef158e2d;p=vnstat add --enable-werror parameter for configure and use it in travis --- diff --git a/.travis.yml b/.travis.yml index 5a1a327..1e2aa36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,15 @@ matrix: dist: trusty sudo: required compiler: gcc + env: CFLAGS='-Wall -Wextra' - os: linux dist: trusty sudo: required compiler: clang + env: CFLAGS='-Weverything -Wno-padded' - os: osx compiler: clang + env: CFLAGS='-Weverything -Wno-padded' addons: apt: @@ -26,8 +29,7 @@ before_install: - if [ "${TRAVIS_OS_NAME}" == "osx" ]; then brew install gd sqlite check ; fi script: - - if [ "${CC}" == "clang" ]; then export CFLAGS='-Weverything -Wno-padded -Werror' ; else export CFLAGS='-Wall -Wextra -Werror' ; fi - - ./configure && make check || ( cat test.log ; exit 1 ) && egrep '^[0-9]+%' test.log && ./vnstat --version + - ./configure --enable-werror && make check || ( cat test.log ; exit 1 ) && egrep '^[0-9]+%' test.log && ./vnstat --version notifications: email: diff --git a/Makefile.am b/Makefile.am index 870b43d..804c0e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = . +AM_CFLAGS = @CFLAG_EXTRAS@ dist_man_MANS = man/vnstat.1 man/vnstat.conf.5 man/vnstatd.1 man/vnstati.1 @@ -9,7 +10,7 @@ sbin_PROGRAMS = vnstatd if HAVE_LIBGD bin_PROGRAMS += vnstati endif -vnstati_LDADD = $(IMAGELIBS) +vnstati_LDADD = @IMAGELIBS@ vnstat_SOURCES = src/vnstat.c src/vnstat.h \ src/ifinfo.c src/ifinfo.h \ @@ -50,7 +51,7 @@ vnstati_SOURCES = src/vnstati.c src/vnstati.h \ if HAVE_CHECK TESTS = check_vnstat check_PROGRAMS = check_vnstat -check_vnstat_CFLAGS = @CHECK_CFLAGS@ \ +check_vnstat_CFLAGS = @CFLAG_EXTRAS@ @CHECK_CFLAGS@ \ -DPROCNETDEV=\"testdir/proc/dev\" \ -DSYSCLASSNET=\"testdir/sysclassnet\" \ -DCFGFILE=\"$(top_srcdir)/cfg/vnstat.conf\" \ @@ -87,7 +88,7 @@ check_vnstat_SOURCES += src/cfg.c src/cfg.h \ if HAVE_LIBGD check_vnstat_CFLAGS += -DHAVE_IMAGE -check_vnstat_LDADD += $(IMAGELIBS) +check_vnstat_LDADD += @IMAGELIBS@ check_vnstat_SOURCES += tests/image_tests.c tests/image_tests.h \ src/image.c src/image.h endif diff --git a/Makefile.in b/Makefile.in index 67085de..ffc18ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -84,7 +84,7 @@ sbin_PROGRAMS = vnstatd$(EXEEXT) @HAVE_CHECK_TRUE@TESTS = check_vnstat$(EXEEXT) @HAVE_CHECK_TRUE@check_PROGRAMS = check_vnstat$(EXEEXT) @HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@am__append_2 = -DHAVE_IMAGE -@HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@am__append_3 = $(IMAGELIBS) +@HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@am__append_3 = @IMAGELIBS@ @HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@am__append_4 = tests/image_tests.c tests/image_tests.h \ @HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@ src/image.c src/image.h @@ -157,9 +157,7 @@ am__dirstamp = $(am__leading_dot)dirstamp @HAVE_CHECK_TRUE@ $(am__objects_1) check_vnstat_OBJECTS = $(am_check_vnstat_OBJECTS) am__DEPENDENCIES_1 = -@HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@am__DEPENDENCIES_2 = \ -@HAVE_CHECK_TRUE@@HAVE_LIBGD_TRUE@ $(am__DEPENDENCIES_1) -@HAVE_CHECK_TRUE@check_vnstat_DEPENDENCIES = $(am__DEPENDENCIES_2) +@HAVE_CHECK_TRUE@check_vnstat_DEPENDENCIES = $(am__DEPENDENCIES_1) check_vnstat_LINK = $(CCLD) $(check_vnstat_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_vnstat_OBJECTS = src/vnstat.$(OBJEXT) src/ifinfo.$(OBJEXT) \ @@ -180,7 +178,7 @@ am_vnstati_OBJECTS = src/vnstati.$(OBJEXT) src/image.$(OBJEXT) \ src/dbsql.$(OBJEXT) src/common.$(OBJEXT) src/misc.$(OBJEXT) \ src/fs.$(OBJEXT) src/id.$(OBJEXT) src/cfg.$(OBJEXT) vnstati_OBJECTS = $(am_vnstati_OBJECTS) -vnstati_DEPENDENCIES = $(am__DEPENDENCIES_1) +vnstati_DEPENDENCIES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -518,6 +516,7 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAG_EXTRAS = @CFLAG_EXTRAS@ CHECK_CFLAGS = @CHECK_CFLAGS@ CHECK_LIBS = @CHECK_LIBS@ CPP = @CPP@ @@ -611,9 +610,10 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = . +AM_CFLAGS = @CFLAG_EXTRAS@ dist_man_MANS = man/vnstat.1 man/vnstat.conf.5 man/vnstatd.1 man/vnstati.1 EXTRA_DIST = cfg examples UPGRADE CHANGES FAQ INSTALL_BSD INSTALL_OSX UNINSTALL -vnstati_LDADD = $(IMAGELIBS) +vnstati_LDADD = @IMAGELIBS@ vnstat_SOURCES = src/vnstat.c src/vnstat.h \ src/ifinfo.c src/ifinfo.h \ src/dbsql.c src/dbsql.h \ @@ -650,7 +650,7 @@ vnstati_SOURCES = src/vnstati.c src/vnstati.h \ src/id.c src/id.h \ src/cfg.c src/cfg.h -@HAVE_CHECK_TRUE@check_vnstat_CFLAGS = @CHECK_CFLAGS@ \ +@HAVE_CHECK_TRUE@check_vnstat_CFLAGS = @CFLAG_EXTRAS@ @CHECK_CFLAGS@ \ @HAVE_CHECK_TRUE@ -DPROCNETDEV=\"testdir/proc/dev\" \ @HAVE_CHECK_TRUE@ -DSYSCLASSNET=\"testdir/sysclassnet\" \ @HAVE_CHECK_TRUE@ -DCFGFILE=\"$(top_srcdir)/cfg/vnstat.conf\" \ diff --git a/configure b/configure index 38d521a..51bcf38 100755 --- a/configure +++ b/configure @@ -648,6 +648,7 @@ PKG_CONFIG HAVE_LIBGD_FALSE HAVE_LIBGD_TRUE IMAGELIBS +CFLAG_EXTRAS am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE @@ -740,6 +741,7 @@ enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_image_output +enable_werror ' ac_precious_vars='build_alias host_alias @@ -1385,6 +1387,8 @@ Optional Features: --disable-image-output disable PNG image output + --enable-werror add -Werror to CFLAGS + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -4078,12 +4082,21 @@ fi +# Extra options # Check whether --enable-image-output was given. if test "${enable_image_output+set}" = set; then : enableval=$enable_image_output; fi +CFLAG_EXTRAS="" +# Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then : + enableval=$enable_werror; CFLAG_EXTRAS="-Werror" +fi + + + # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 diff --git a/configure.ac b/configure.ac index 95f6b9f..80b3713 100644 --- a/configure.ac +++ b/configure.ac @@ -13,9 +13,15 @@ AM_PROG_CC_C_O AC_PROG_MAKE_SET AC_PROG_MKDIR_P +# Extra options AC_ARG_ENABLE([image-output], [ AS_HELP_STRING([--disable-image-output], [disable PNG image output])]) +CFLAG_EXTRAS="" +AC_ARG_ENABLE([werror], [ +AS_HELP_STRING([--enable-werror], [add -Werror to CFLAGS])], [CFLAG_EXTRAS="-Werror"]) +AC_SUBST([CFLAG_EXTRAS]) + # Checks for libraries. AC_CHECK_LIB([m], [pow], [], [AC_MSG_ERROR([could not find required math library])]) AC_CHECK_LIB([sqlite3], [sqlite3_prepare_v2], [], [AC_MSG_ERROR([could not find required sqlite3 library])])