Commit a53aaa86 authored by Geoff Simmons's avatar Geoff Simmons

Get rid of old boilerplate in configure.ac, and enforce -Wextra -std=c99

parent fd77c8ea
AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2015 UPLEX Nils Goroll Systemoptimierung])
AC_INIT([libvmod-backend_dyn], [trunk])
AC_INIT([VMOD backend_dyn], [trunk], [varnish-support@uplex.de],
[libvmod-backend_dyn],
[https://code.uplex.de/uplex-varnish/libvmod-gcrypt])
AC_CONFIG_MACRO_DIR([m4])
m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
m4_ifndef([VARNISH_VMOD_INCLUDES],
AC_MSG_ERROR([Need varnish.m4 -- see INSTALL.rst]))
AC_CONFIG_SRCDIR(src/vmod.vcc)
AM_CONFIG_HEADER(config.h)
......@@ -74,60 +77,6 @@ AC_PATH_PROG([VARNISHTEST], [varnishtest], [],
AC_PATH_PROG([VARNISHD], [varnishd], [],
[$LIBVARNISHAPI_SBINDIR:$LIBVARNISHAPI_BINDIR:$PATH])
##
## --enable-developer-warnings, --enable-stack-protector and
## --enable-debugging-symbols from Varnish 4.1 configure.ac
##
#######################################################################
# Now that we're done using the compiler to look for functions and
# libraries, set CFLAGS to what we want them to be for our own code
# This is a test to see how much havoc Jenkins exposes.
#
# The reason for -Wno-error=unused-result is a glibc/gcc interaction
# idiocy where write is marked as warn_unused_result, causing build
# failures.
CFLAGS="${CFLAGS} -Wall -Werror"
OCFLAGS="${OCFLAGS} -Wall -Werror"
AX_CHECK_COMPILE_FLAG([-Werror=unused-result],
[CFLAGS="${CFLAGS} -Wno-error=unused-result"
OCFLAGS="${OCFLAGS} -Wno-error=unused-result"],
[AX_CHECK_COMPILE_FLAG([-Wunused-result],
[CFLAGS="${CFLAGS} -Wno-unused-result"
OCFLAGS="${OCFLAGS} -Wno-unused-result"])])
# This corresponds to FreeBSD's WARNS level 6
DEVELOPER_CFLAGS=" \
-Werror \
-Wall \
-Wno-format-y2k \
-W \
-Wstrict-prototypes \
-Wmissing-prototypes \
-Wpointer-arith \
-Wreturn-type \
-Wcast-qual \
-Wwrite-strings \
-Wswitch \
-Wshadow \
-Wunused-parameter \
-Wcast-align \
-Wchar-subscripts \
-Wnested-externs \
-Wextra \
-Wno-sign-compare \
"
# These are not compliable yet
DEVELOPER_GCC_CFLAGS="-Wold-style-definition -Wredundant-decls "
#DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_GCC_CFLAGS}"
# These are compilable
DEVELOPER_CLANG_CFLAGS="-Wmissing-variable-declarations -Wno-string-plus-int"
# -Wno-empty-body
#DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_CLANG_CFLAGS}"
# --enable-stack-protector
AC_ARG_ENABLE(stack-protector,
AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is YES)]),
......@@ -141,36 +90,24 @@ if test "x$enable_stack_protector" != "xno"; then
[], [])
fi
# --enable-developer-warnings
AC_ARG_ENABLE(developer-warnings,
AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]),
# --enable-debugging
AC_ARG_ENABLE(debugging,
AS_HELP_STRING([--enable-debugging],[enable debugging (default is NO)]),
[],
[enable_developer_warnings=no])
if test "x$enable_developer_warnings" != "xno"; then
# compiler flags not available on gcc3
AX_CHECK_COMPILE_FLAG([-Wno-pointer-sign],
[DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-pointer-sign"], [], [])
# Not available in gcc 4.1.2
AX_CHECK_COMPILE_FLAG([-Wno-address],
[DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-address"])
# no known way to specifically disabling missing-field-initializers warnings
# keeping the rest of Wextra
AX_CHECK_COMPILE_FLAG([-Wno-missing-field-initializers],
[DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-missing-field-initializers"],
[DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -Wno-extra"],
[enable_debugging=no])
# AC_PROG_CC sets CFLAGS to '-g -O2' unless it is already set, so
# there's no need to add -g. Disable or change by explicitly setting
# CFLAGS. If this option is enabled, then -Og or -O0 becomes the last
# optimization option, and hence takes precedence.
if test "x$enable_debugging" != "xno"; then
CFLAGS="${CFLAGS} -fno-inline"
AX_CHECK_COMPILE_FLAG([-Og],
[CFLAGS="${CFLAGS} -Og"],
[CFLAGS="${CFLAGS} -O0"],
[])
CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
OCFLAGS="${OCFLAGS} ${DEVELOPER_CFLAGS}"
fi
# --enable-debugging-symbols
AC_ARG_ENABLE(debugging-symbols,
AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]),
CFLAGS="${CFLAGS} -O0 -g -fno-inline")
AC_CONFIG_FILES([
Makefile
src/Makefile
......
AM_CPPFLAGS = @VMOD_INCLUDES@ -Wall -Werror
AM_CPPFLAGS = @VMOD_INCLUDES@ -Wall -Werror -Wextra -std=c99
vmoddir = @VMOD_DIR@
vmod_LTLIBRARIES = libvmod_backend_dyn.la
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment