]> granicus.if.org Git - vnstat/commitdiff
add --enable-werror parameter for configure and use it in travis
authorTeemu Toivola <git@humdi.net>
Sat, 10 Mar 2018 16:06:58 +0000 (18:06 +0200)
committerTeemu Toivola <git@humdi.net>
Sat, 10 Mar 2018 16:06:58 +0000 (18:06 +0200)
.travis.yml
Makefile.am
Makefile.in
configure
configure.ac

index 5a1a3279f5bc4c9986ac1ca93d25a8e2bd48f3ea..1e2aa36360715a847306f5242775094b3807422f 100644 (file)
@@ -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:
index 870b43d869aa7b019ab98661f753902eae58dc2d..804c0e89db79ab1d993e8a7850a6b9469219fcfe 100644 (file)
@@ -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
index 67085de0999cbfd11f0e4c4eb11fa06a0f6bb2c9..ffc18ce823472316b12e08aabebf41480d55df13 100644 (file)
@@ -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\" \
index 38d521a5b5e409675cc869f99b10915c8a8b2048..51bcf38112828cbe175912999d754b33f6fc8d22 100755 (executable)
--- 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
index 95f6b9f725692a6fb5df18b57bfc6d5ea4e8b521..80b3713a1c747b27f6e480949b68671b4c82b838 100644 (file)
@@ -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])])