diff options
Diffstat (limited to 'sys/contrib/openzfs/config/always-compiler-options.m4')
-rw-r--r-- | sys/contrib/openzfs/config/always-compiler-options.m4 | 83 |
1 files changed, 63 insertions, 20 deletions
diff --git a/sys/contrib/openzfs/config/always-compiler-options.m4 b/sys/contrib/openzfs/config/always-compiler-options.m4 index 6383b12506ee..0e96435e3713 100644 --- a/sys/contrib/openzfs/config/always-compiler-options.m4 +++ b/sys/contrib/openzfs/config/always-compiler-options.m4 @@ -156,6 +156,34 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH], [ ]) dnl # +dnl # Check if kernel cc supports -Wno-format-zero-length option. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_NO_FORMAT_ZERO_LENGTH], [ + saved_cc="$CC" + AS_IF( + [ test -n "$KERNEL_CC" ], [ CC="$KERNEL_CC" ], + [ test -n "$KERNEL_LLVM" ], [ CC="clang" ], + [ CC="gcc" ] + ) + AC_MSG_CHECKING([whether $CC supports -Wno-format-zero-length]) + + saved_flags="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-format-zero-length" + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ + KERNEL_NO_FORMAT_ZERO_LENGTH=-Wno-format-zero-length + AC_MSG_RESULT([yes]) + ], [ + KERNEL_NO_FORMAT_ZERO_LENGTH= + AC_MSG_RESULT([no]) + ]) + + CC="$saved_cc" + CFLAGS="$saved_flags" + AC_SUBST([KERNEL_NO_FORMAT_ZERO_LENGTH]) +]) + +dnl # dnl # Check if cc supports -Wno-clobbered option. dnl # dnl # We actually invoke it with the -Wclobbered option @@ -182,6 +210,27 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_CLOBBERED], [ ]) dnl # +dnl # Check if cc supports -Wno-atomic-alignment option. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_ATOMIC_ALIGNMENT], [ + AC_MSG_CHECKING([whether $CC supports -Wno-atomic-alignment]) + + saved_flags="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Wno-atomic-alignment" + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ + NO_ATOMIC_ALIGNMENT=-Wno-atomic-alignment + AC_MSG_RESULT([yes]) + ], [ + NO_ATOMIC_ALIGNMENT= + AC_MSG_RESULT([no]) + ]) + + CFLAGS="$saved_flags" + AC_SUBST([NO_ATOMIC_ALIGNMENT]) +]) + +dnl # dnl # Check if cc supports -Wimplicit-fallthrough option. dnl # AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH], [ @@ -231,20 +280,17 @@ dnl # dnl # Check if kernel cc supports -Winfinite-recursion option. dnl # AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_INFINITE_RECURSION], [ - AC_MSG_CHECKING([whether $KERNEL_CC supports -Winfinite-recursion]) - saved_cc="$CC" + AS_IF( + [ test -n "$KERNEL_CC" ], [ CC="$KERNEL_CC" ], + [ test -n "$KERNEL_LLVM" ], [ CC="clang" ], + [ CC="gcc" ] + ) + AC_MSG_CHECKING([whether $CC supports -Winfinite-recursion]) + saved_flags="$CFLAGS" - CC="gcc" CFLAGS="$CFLAGS -Werror -Winfinite-recursion" - AS_IF([ test -n "$KERNEL_CC" ], [ - CC="$KERNEL_CC" - ]) - AS_IF([ test -n "$KERNEL_LLVM" ], [ - CC="clang" - ]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ KERNEL_INFINITE_RECURSION=-Winfinite-recursion AC_DEFINE([HAVE_KERNEL_INFINITE_RECURSION], 1, @@ -329,20 +375,17 @@ dnl # dnl # Check if kernel cc supports -fno-ipa-sra option. dnl # AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_NO_IPA_SRA], [ - AC_MSG_CHECKING([whether $KERNEL_CC supports -fno-ipa-sra]) - saved_cc="$CC" + AS_IF( + [ test -n "$KERNEL_CC" ], [ CC="$KERNEL_CC" ], + [ test -n "$KERNEL_LLVM" ], [ CC="clang" ], + [ CC="gcc" ] + ) + AC_MSG_CHECKING([whether $CC supports -fno-ipa-sra]) + saved_flags="$CFLAGS" - CC="gcc" CFLAGS="$CFLAGS -Werror -fno-ipa-sra" - AS_IF([ test -n "$KERNEL_CC" ], [ - CC="$KERNEL_CC" - ]) - AS_IF([ test -n "$KERNEL_LLVM" ], [ - CC="clang" - ]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ KERNEL_NO_IPA_SRA=-fno-ipa-sra AC_MSG_RESULT([yes]) |