summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6294016)
raw | patch | inline | side by side (parent: 6294016)
author | Max Kellermann <max@duempel.org> | |
Mon, 15 Sep 2008 10:27:28 +0000 (12:27 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 15 Sep 2008 10:27:28 +0000 (12:27 +0200) |
Enable all useful warnings which were also enabled in MPD. Steal
m4/mpd_check_cflag.m4 from MPD.
m4/mpd_check_cflag.m4 from MPD.
configure.ac | patch | blob | history | |
m4/cflags.m4 | [new file with mode: 0644] | patch | blob |
diff --git a/configure.ac b/configure.ac
index 3ffc870097dd9a2e76052610acfe639514afaa4b..16a13571d1c0dba76dc1ce49d633516e56217db8 100644 (file)
--- a/configure.ac
+++ b/configure.ac
[enable_debug=no])
AC_MSG_RESULT([$enable_debug])
if test "x$enable_debug" = "xyes" ; then
- CFLAGS="$CFLAGS -Wall -g -DDEBUG"
+ CFLAGS="$CFLAGS -g -DDEBUG"
fi
+dnl CFLAGS
+
+AC_SUBST(AM_CFLAGS)
+
+CHECK_CFLAG([-Wall])
+CHECK_CFLAG([-Wextra])
+CHECK_CFLAG([-Wno-deprecated-declarations])
+CHECK_CFLAG([-Wmissing-prototypes])
+CHECK_CFLAG([-Wdeclaration-after-statement])
+CHECK_CFLAG([-Wshadow])
+CHECK_CFLAG([-Wpointer-arith])
+CHECK_CFLAG([-Wstrict-prototypes])
+CHECK_CFLAG([-Wcast-qual])
+CHECK_CFLAG([-Wwrite-strings])
+
dnl Optional screen - help screen
#AC_MSG_CHECKING([whether to include the help screen])
#AC_ARG_ENABLE([help-screen],
diff --git a/m4/cflags.m4 b/m4/cflags.m4
--- /dev/null
+++ b/m4/cflags.m4
@@ -0,0 +1,15 @@
+AC_DEFUN([CHECK_CFLAG], [
+ var=`echo "$1" | tr "=-" "__"`
+ AC_CACHE_CHECK([whether the C compiler accepts $1],[check_cflag_$var],[
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_COMPILE_IFELSE([int main(void) { return 0; }],
+ [eval "check_cflag_$var=yes"],
+ [eval "check_cflag_$var=no"])
+ CFLAGS="$save_CFLAGS"
+ ])
+ if eval "test x`echo '$check_cflag_'$var` = xyes"; then
+ AM_CFLAGS="$AM_CFLAGS $1"
+ fi
+ ])
+])