configure: Test compiler flags

When AC_PROG_CC detects GCC, Make.mk adds a bunch of flags to CFLAGS.
Works only for flags that any version of gcc in use accepts.

Instead, make configure add the flags that actually work to CFLAGS.
This will let us add flags that work only for some compilers.

The new autoconf macros are from autoconf-archive v2015.02.24.

Unfortunately, AX_APPEND_COMPILE_FLAGS doesn't work reliably for
-Wno-*: gcc complains about unknown -Wno-foo only when other
diagnostics are being produced.  Test -Wfoo instead of -Wno-foo, and
rename to MY_APPEND_COMPILE_FLAGS.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-06-06 15:53:00 +02:00
parent 35f34581be
commit 23373d01d9
7 changed files with 269 additions and 9 deletions

View file

@ -169,13 +169,6 @@ CPPFLAGS += -I$(srcdir)/include -I.
ifeq ($(empthread),Windows) # really: W32, regardless of thread package
CPPFLAGS += -I$(srcdir)/src/lib/w32
endif
ifeq ($(have_gcc),yes)
CFLAGS += -fno-builtin-carg # conflicts with our carg()
CFLAGS += -fno-common
CFLAGS += -Wall -W -Wno-unused-parameter -Wpointer-arith \
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs \
-Wredundant-decls
endif
$(client): LDLIBS := $(LIBS_client)
$(server): LDLIBS := $(LIBS_server)