1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
From bf325c01d737fd7ef9d32e75531dd0649809af0c Mon Sep 17 00:00:00 2001
From: hasufell <hasufell@posteo.de>
Date: Fri, 23 Aug 2013 08:32:59 +0200
Subject: [PATCH] build: add --enable-Werror switch
There are too many cases where general -Werror causes compile
failures without good reason including:
* new warnings on version bumps of GCC/GLIBC the developer was
not aware of at the point of coding
* some autoconf checks will fail badly
* libraries adding deprecated API warnings although that API
is still working/supported
* on less known architectures we may get different/more
warnings than on common ones
* random breakage depending on what distro/architecture/library
version/kernel/userland the developer was testing "-Werror" on
So we add a switch and have it default to off, since it
is only interesting for development.
Specific flags such as -Werror=implicit-function-declaration
might be ok to force unconditionally for everyone depending
on what we expect from the code.
---
configure.ac | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index d9760a3..bcd9303 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ AC_PREREQ(2.57)
AC_INIT([libuv], [0.11.5], [https://github.com/joyent/libuv/issues])
AC_CONFIG_MACRO_DIR([m4])
m4_include([m4/libuv-extra-automake-flags.m4])
-AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS)
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS)
AC_CANONICAL_HOST
AC_ENABLE_SHARED
AC_ENABLE_STATIC
@@ -37,6 +37,17 @@ AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([sendfile], [sendfile])
AC_CHECK_LIB([socket], [socket])
AC_SYS_LARGEFILE
+
+# only use this for development
+AC_ARG_ENABLE([Werror],
+ [AS_HELP_STRING([--enable-Werror],
+ [turn all warnings into errors [default=no]])],
+ [enable_werror=$enableval],
+ [enable_werror="no"])
+
+AS_IF([test "x$enable_werror" != "xno"],
+ [CFLAGS="$CFLAGS -Werror"])
+
AM_CONDITIONAL([AIX], [AS_CASE([$host_os], [aix*], [true], [false])])
AM_CONDITIONAL([DARWIN], [AS_CASE([$host_os], [darwin*], [true], [false])])
AM_CONDITIONAL([FREEBSD], [AS_CASE([$host_os], [freebsd*], [true], [false])])
--
1.8.1.6
|