diff options
author | rlar <rlar> | 2016-03-29 13:59:39 +0200 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2016-03-31 07:11:51 -0400 |
commit | f1ce47684c73c71bc32bfb07372229f7f9876a97 (patch) | |
tree | 1212627e10741c3cdc5531f92941e9496bdcfd6e | |
parent | babe9a1e8eeb5497756d4d7998dd1ca82c62a189 (diff) | |
download | flex-git-f1ce47684c73c71bc32bfb07372229f7f9876a97.tar.gz |
configure option `--enable-warnings' and `WARNINGFLAGS'
`WARNINGFLAGS' can be passed when invoking `configure'
and when invoking `make'
if configure switch `--enable-warnings' was given
then default to something useful if we have `GCC'
`WARNINGFLAGS' is not used when compiling `stage1flex'
to avoid unnecessary clutter
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | tests/Makefile.am | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 2bfdd1e..14dfea1 100644 --- a/configure.ac +++ b/configure.ac @@ -48,6 +48,18 @@ AC_PROG_LN_S AC_PROG_AWK AC_PROG_INSTALL +# allow passing a variable `WARNINGFLAGS', +# either when invoking `configure', or when invoking `make' +# default to something useful if GCC was detected + +AC_ARG_ENABLE([warnings], + [AS_HELP_STRING([--enable-warnings], + [enable a bunch of compiler warning flags (defaults to GCC warning flags).])], + [AS_IF([test "x$GCC" == xyes], + [ : ${WARNINGFLAGS="-Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -Wno-unused-but-set-variable"} ])]) + +AC_SUBST([WARNINGFLAGS]) + AC_PATH_PROG([BISON], bison, no) AS_IF([test "$BISON" != no],[], [ AC_SUBST([BISON], [\${top_srcdir}/build-aux/missing bison]) diff --git a/src/Makefile.am b/src/Makefile.am index adfbbf3..f8354ed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,10 +15,14 @@ stage1flex_SOURCES = \ scan.l \ $(COMMON_SOURCES) +stage1flex_CFLAGS = $(AM_CFLAGS) + flex_SOURCES = \ stage1scan.l \ $(COMMON_SOURCES) +flex_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS) + COMMON_SOURCES = \ buf.c \ ccl.c \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 428e4b2..817f1a3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -19,6 +19,8 @@ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE. +AM_CFLAGS = $(WARNINGFLAGS) + TESTS = $(check_PROGRAMS) options.cn # The script testwrapper.sh will run most tests as is. A couple tests |