diff options
author | Kim Woelders <kim@woelders.dk> | 2013-07-02 06:57:19 +0200 |
---|---|---|
committer | Kim Woelders <kim@woelders.dk> | 2013-07-03 15:07:51 +0200 |
commit | 6e41fe2e1ace8298e2bb9116f30206594b7c064e (patch) | |
tree | 2bc8eb5af7c0dbbccee5abc5ad0bbf16d7b70ad1 /m4 | |
parent | 41dc2bb98bd99fbf82add85cf6e5b7100aa65693 (diff) | |
download | imlib2-6e41fe2e1ace8298e2bb9116f30206594b7c064e.tar.gz |
Set warning options when using gcc.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ac_warnflags.m4 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/m4/ac_warnflags.m4 b/m4/ac_warnflags.m4 new file mode 100644 index 0000000..84128c0 --- /dev/null +++ b/m4/ac_warnflags.m4 @@ -0,0 +1,31 @@ +dnl Copyright (C) 2008 Kim Woelders +dnl This code is public domain and can be freely used or copied. + +dnl Macro to set compiler warning flags + +dnl Provides configure argument --enable-werror to stop compilation on warnings + +dnl Usage: AC_C_WARNFLAGS([LANG]) +dnl Set LANG to 'cpp' when compiling for C++ + +AC_DEFUN([AC_C_WARNFLAGS], [ + define(ac_c_compile_cpp, ifelse([$1], [cpp], [yes], [no])) + + AC_ARG_ENABLE(werror, + [ --enable-werror treat compiler warnings as errors @<:@default=no@:>@],, + enable_werror=no) + + if test "x$GCC" = "xyes"; then + CWARNFLAGS="-W -Wall -Waggregate-return -Wcast-align -Wpointer-arith -Wshadow -Wwrite-strings" +dnl # ignore some warnings for now... + CWARNFLAGS="$CWARNFLAGS -Wno-unused-parameter" + ifelse(ac_c_compile_cpp, no, [ + CWARNFLAGS="$CWARNFLAGS -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes" + ],) + + if test "x$enable_werror" = "xyes"; then + CWARNFLAGS="$CWARNFLAGS -Werror" + fi + fi + AC_SUBST(CWARNFLAGS) +]) |