diff options
author | Justin Mitchell <jumitche@redhat.com> | 2018-03-10 11:14:48 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2018-03-10 11:17:15 -0500 |
commit | 7f033ab6861efb8ad2c54c0cf454c0ef1cd3bf89 (patch) | |
tree | 312a47bc514c18ec792c982fc092d0194d99cb12 /configure.ac | |
parent | f3d67894cb8d785d4c12d0fa708bdddad0372de5 (diff) | |
download | nfs-utils-7f033ab6861efb8ad2c54c0cf454c0ef1cd3bf89.tar.gz |
nfs-utils: Test if extra compiler warnings are available
Some of the latest compiler warnings flags are not available
on older compilers so this adds macros to test they are supported
Signed-off-by: Justin Mitchell <jumitche@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index f4eba1f..5a11636 100644 --- a/configure.ac +++ b/configure.ac @@ -550,7 +550,6 @@ my_am_cflags="\ -Werror=strict-prototypes \ -Werror=missing-prototypes \ -Werror=missing-declarations \ - -Werror=format-overflow=2 \ -Werror=format=2 \ -Werror=undef \ -Werror=missing-include-dirs \ @@ -560,16 +559,30 @@ my_am_cflags="\ -Werror=return-type \ -Werror=switch \ -Werror=overflow \ - -Werror=int-conversion \ -Werror=parentheses \ - -Werror=incompatible-pointer-types \ - -Werror=misleading-indentation \ -Werror=aggregate-return \ -Werror=unused-result \ -fno-strict-aliasing \ " -AC_SUBST([AM_CFLAGS], ["$my_am_cflags"]) +AC_DEFUN([CHECK_CCSUPPORT], [ + my_save_cflags="$CFLAGS" + CFLAGS=$1 + AC_MSG_CHECKING([whether CC supports $1]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [$2+=$1], + [AC_MSG_RESULT([no])] + ) + CFLAGS="$my_save_cflags" +]) + +CHECK_CCSUPPORT([-Werror=format-overflow=2], [flg1]) +CHECK_CCSUPPORT([-Werror=int-conversion], [flg2]) +CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [flg3]) +CHECK_CCSUPPORT([-Werror=misleading-indentation], [flg4]) + +AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4"]) # Make sure that $ACLOCAL_FLAGS are used during a rebuild AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"]) |