[Nice] [nice/master] correctly pass -Wall and -Werror dependending on whether we are in a release or not

Youness Alaoui youness.alaoui at collabora.co.uk
Wed Nov 12 13:36:36 PST 2008


---
 common.mk              |    3 +--
 configure.ac           |   17 ++++++++++++++++-
 gst/Makefile.am        |    2 +-
 stun/tools/Makefile.am |    2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/common.mk b/common.mk
index 8fb45df..caff72a 100644
--- a/common.mk
+++ b/common.mk
@@ -1,7 +1,6 @@
 
 ERROR_CFLAGS = \
-	-Wall \
-	-Werror \
+	$(NICE_CFLAGS) \
 	-Wextra \
 	-Wundef \
 	-Wnested-externs \
diff --git a/configure.ac b/configure.ac
index 1b47d6b..21ad1ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,11 @@
 
 AC_PREREQ(2.59c)
+
+dnl releases only do -Wall, cvs and prerelease does -Werror too
+dnl use a three digit version number for releases, and four for cvs/prerelease
 AC_INIT(nice, 0.0.1.1)
+NICE_RELEASE="no"
+
 AC_CONFIG_SRCDIR([agent/agent.c])
 AC_CONFIG_HEADER([config.h])
 AM_INIT_AUTOMAKE([-Wall])
@@ -28,13 +33,14 @@ NICE_LIBVERSION=${NICE_CURRENT}:${NICE_REVISION}:${NICE_AGE}
 NICE_LT_LDFLAGS="-version-info ${NICE_LIBVERSION}"
 AC_SUBST(NICE_LT_LDFLAGS)
 
+
 # Checks for programs.
 
 AC_PROG_CC
-dnl AC_PROG_CC_C99
 AC_USE_SYSTEM_EXTENSIONS
 AC_PROG_LIBTOOL
 
+
 # Checks for compiler features
 
 AC_C_RESTRICT
@@ -45,6 +51,15 @@ AC_DEFINE([_FORTIFY_SOURCE], [2], [Define to `2' to get GNU/libc warnings.])
 AC_DEFINE([NICEAPI_EXPORT], [ ], [Public library function implementation])
 AC_CHECK_HEADERS([arpa/inet.h net/in.h ifaddrs.h])
 
+NICE_CFLAGS="-Wall"
+dnl if asked for, add -Werror if supported
+if test "x$NICE_RELEASE" != "xyes"; then
+  NICE_CFLAGS="$NICE_CFLAGS -Werror"
+fi
+
+AC_SUBST(NICE_CFLAGS)
+AC_MSG_NOTICE([set NICE_CFLAGS to $NICE_CFLAGS])
+
 # Checks for libraries.
 AC_CHECK_LIB(rt, clock_gettime, [LIBRT="-lrt"], [LIBRT=""])
 AC_CHECK_FUNCS([poll])
diff --git a/gst/Makefile.am b/gst/Makefile.am
index eb0f335..db38cca 100644
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
@@ -6,7 +6,7 @@
 #
 # Licensed under MPL 1.1/LGPL 2.1. See file COPYING.
 
-AM_CFLAGS = -Wall -Werror \
+AM_CFLAGS = $(NICE_CFLAGS) \
 	$(GST_CFLAGS) \
 	-I $(top_srcdir) \
 	-I $(top_srcdir)/socket \
diff --git a/stun/tools/Makefile.am b/stun/tools/Makefile.am
index 84876ee..ea24b3f 100644
--- a/stun/tools/Makefile.am
+++ b/stun/tools/Makefile.am
@@ -8,7 +8,7 @@
 #
 
 include $(top_srcdir)/common.mk
-AM_CFLAGS = -std=gnu99
+AM_CFLAGS = -std=gnu99 $(ERROR_CFLAGS)
 AM_CPPFLAGS = -I$(top_srcdir) 
 
 bin_PROGRAMS = stunbdc stund
-- 
1.5.6.5




More information about the Nice mailing list