summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-07 13:03:41 -0500
committerDave Reisner <dreisner@archlinux.org>2012-04-08 22:28:45 -0400
commitb729ed01093312cef7ce48d07b13e225b25446db (patch)
tree103e0d2c1b5b6a8179a6cf87747aba934f68f02c /m4
parenta8a1b093eb23450244418232c9e30c4be035fc0b (diff)
Add a new configure option for excessive compiler warning flags
This adds a bunch of warning flags to the list used when compiling. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'm4')
-rw-r--r--m4/acinclude.m420
1 files changed, 20 insertions, 0 deletions
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
index df4f83a4..8ea45973 100644
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -101,6 +101,26 @@ AC_DEFUN([GCC_GNU89_INLINE_CC],[
fi
])
+dnl CFLAGS_ADD(PARAMETER, VARIABLE)
+dnl Adds parameter to VARIABLE if the compiler supports it. For example,
+dnl CFLAGS_ADD([-Wall],[WARN_FLAGS]).
+AC_DEFUN([CFLAGS_ADD],
+[AS_VAR_PUSHDEF([my_cflags], [cflags_cv_warn_$1])dnl
+AC_CACHE_CHECK([whether compiler handles $1], [my_cflags], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="${CFLAGS} $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [AS_VAR_SET([my_cflags], [yes])],
+ [AS_VAR_SET([my_cflags], [no])])
+ CFLAGS="$save_CFLAGS"
+])
+AS_VAR_PUSHDEF([new_cflags], [[$2]])dnl
+AS_VAR_IF([my_cflags], [yes], [AS_VAR_APPEND([new_cflags], [" $1"])])
+AS_VAR_POPDEF([new_cflags])dnl
+AS_VAR_POPDEF([my_cflags])dnl
+m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
+])
+
dnl Checks for getmntinfo and determines whether it uses statfs or statvfs
AC_DEFUN([FS_STATS_TYPE],
[AC_CACHE_CHECK([filesystem statistics type], fs_stats_cv_type,