Commit 574b59a3 authored by Olivier Crête's avatar Olivier Crête

configure: Verify that the compiler understands warning cflags

Older compilers don't understand all of the flags
parent 951924aa
......@@ -37,7 +37,6 @@ stamp-h1
# top level stuff
debian
m4
# address/ stuff
address/libaddress.la
......
......@@ -10,7 +10,7 @@ include $(top_srcdir)/common.mk
AM_CFLAGS = \
-DG_LOG_DOMAIN=\"libnice\" \
$(ERROR_CFLAGS) \
$(LIBNICE_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS) \
-I $(top_srcdir) \
......
ERROR_CFLAGS = \
$(LIBNICE_CFLAGS) \
-fno-strict-aliasing \
-Wextra \
-Wundef \
-Wnested-externs \
-Wwrite-strings \
-Wpointer-arith \
-Wbad-function-cast \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wstrict-prototypes \
-Wredundant-decls \
-Wno-unused-parameter \
-Wno-missing-field-initializers
# -Wold-style-definition -Winline -Wunreachable-code
CLEANFILES = *.gcno *.gcda
pkgincludedir = $(includedir)/nice
......
......@@ -99,6 +99,25 @@ dnl if asked for, add -Werror if supported
if test "x$LIBNICE_RELEASE" != "xyes"; then
LIBNICE_CFLAGS="$LIBNICE_CFLAGS -Werror"
fi
AC_DEFUN([NICE_ADD_FLAG],
AS_COMPILER_FLAG([$1], LIBNICE_CFLAGS="$LIBNICE_CFLAGS $1", [])
)
NICE_ADD_FLAG([-fno-strict-aliasing])
NICE_ADD_FLAG([-Wextra])
NICE_ADD_FLAG([-Wundef])
NICE_ADD_FLAG([-Wnested-externs])
NICE_ADD_FLAG([-Wwrite-strings])
NICE_ADD_FLAG([-Wpointer-arith])
NICE_ADD_FLAG([-Wbad-function-cast])
NICE_ADD_FLAG([-Wmissing-declarations])
NICE_ADD_FLAG([-Wmissing-prototypes])
NICE_ADD_FLAG([-Wstrict-prototypes])
NICE_ADD_FLAG([-Wredundant-decls])
NICE_ADD_FLAG([-Wno-unused-parameter])
NICE_ADD_FLAG([-Wno-missing-field-initializers])
#
# Fixes for Solaris
#
......
......@@ -72,7 +72,7 @@ expand_content_files=
# signals and properties.
# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
AM_CFLAGS = $(ERROR_CFLAGS) \
AM_CFLAGS = $(LIBNICE_CFLAGS) \
$(GLIB_CFLAGS) \
-I $(top_srcdir) \
-I $(top_srcdir)/random \
......
......@@ -14,7 +14,7 @@ AM_CFLAGS = \
-I $(top_srcdir)/random \
-I $(top_srcdir)/socket \
-I $(top_srcdir)/stun \
$(ERROR_CFLAGS) \
$(LIBNICE_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS)
......
dnl as-compiler-flag.m4 0.1.0
dnl autostars m4 macro for detection of compiler flags
dnl David Schleef <ds@schleef.org>
dnl Tim-Philipp Müller <tim centricular net>
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
dnl Tries to compile with the given CFLAGS.
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
AC_DEFUN([AS_COMPILER_FLAG],
[
AC_MSG_CHECKING([to see if compiler understands $1])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CFLAGS="$save_CFLAGS"
if test "X$flag_ok" = Xyes ; then
$2
true
else
$3
true
fi
AC_MSG_RESULT([$flag_ok])
])
dnl AS_CXX_COMPILER_FLAG(CPPFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
dnl Tries to compile with the given CPPFLAGS.
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
AC_DEFUN([AS_CXX_COMPILER_FLAG],
[
AC_REQUIRE([AC_PROG_CXX])
AC_MSG_CHECKING([to see if c++ compiler understands $1])
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $1"
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CPPFLAGS="$save_CPPFLAGS"
if test "X$flag_ok" = Xyes ; then
$2
true
else
$3
true
fi
AC_LANG_POP(C++)
AC_MSG_RESULT([$flag_ok])
])
......@@ -26,7 +26,7 @@ libnice_la_LDFLAGS = \
AM_CFLAGS = \
$(ERROR_CFLAGS) \
$(LIBNICE_CFLAGS) \
$(GLIB_CFLAGS) \
-I $(top_srcdir) \
-I $(top_srcdir)/agent \
......
......@@ -8,7 +8,7 @@
include $(top_srcdir)/common.mk
AM_CFLAGS = $(ERROR_CFLAGS) $(GLIB_CFLAGS)
AM_CFLAGS = $(LIBNICE_CFLAGS) $(GLIB_CFLAGS)
noinst_LTLIBRARIES = libnice-random.la
......
......@@ -10,7 +10,7 @@ include $(top_srcdir)/common.mk
AM_CFLAGS = \
-DG_LOG_DOMAIN=\"libnice-socket\" \
$(ERROR_CFLAGS) \
$(LIBNICE_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS) \
-I $(top_srcdir)/random \
......
......@@ -10,7 +10,7 @@ SUBDIRS = . tools tests
include $(top_srcdir)/common.mk
AM_CFLAGS = -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" $(ERROR_CFLAGS)
AM_CFLAGS = -std=gnu99 -DG_LOG_DOMAIN=\"libnice-stun\" $(LIBNICE_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)
if WINDOWS
......
......@@ -8,7 +8,7 @@
#
include $(top_srcdir)/common.mk
AM_CFLAGS = -std=gnu99 $(ERROR_CFLAGS)
AM_CFLAGS = -std=gnu99 $(LIBNICE_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)
bin_PROGRAMS = stunbdc stund
......
......@@ -9,7 +9,7 @@
include $(top_srcdir)/common.mk
AM_CFLAGS = \
$(ERROR_CFLAGS) \
$(LIBNICE_CFLAGS) \
$(GLIB_CFLAGS) \
$(GUPNP_CFLAGS) \
-I $(top_srcdir) \
......
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