From 92579489e0f6606daea8e745af7ca1c8e735f487 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Mon, 21 Oct 2024 08:59:10 +0300 Subject: [PATCH] config: cleanup KERNEL_CC checks, fix broken status output If $KERNEL_CC was not defined, configure status output would print an empty string where the kernel compiler should have been. Fix this and simplify the code generally. Reviewed-by: Brian Behlendorf Signed-off-by: Ivan Shapovalov Closes #16997 --- config/always-compiler-options.m4 | 38 +++++++++++++------------------ 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/config/always-compiler-options.m4 b/config/always-compiler-options.m4 index 6383b1250..acd17cbf4 100644 --- a/config/always-compiler-options.m4 +++ b/config/always-compiler-options.m4 @@ -231,19 +231,16 @@ 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" - saved_flags="$CFLAGS" - CC="gcc" - CFLAGS="$CFLAGS -Werror -Winfinite-recursion" + 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]) - AS_IF([ test -n "$KERNEL_CC" ], [ - CC="$KERNEL_CC" - ]) - AS_IF([ test -n "$KERNEL_LLVM" ], [ - CC="clang" - ]) + saved_flags="$CFLAGS" + CFLAGS="$CFLAGS -Werror -Winfinite-recursion" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ KERNEL_INFINITE_RECURSION=-Winfinite-recursion @@ -329,19 +326,16 @@ 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" - saved_flags="$CFLAGS" - CC="gcc" - CFLAGS="$CFLAGS -Werror -fno-ipa-sra" + 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]) - AS_IF([ test -n "$KERNEL_CC" ], [ - CC="$KERNEL_CC" - ]) - AS_IF([ test -n "$KERNEL_LLVM" ], [ - CC="clang" - ]) + saved_flags="$CFLAGS" + CFLAGS="$CFLAGS -Werror -fno-ipa-sra" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ KERNEL_NO_IPA_SRA=-fno-ipa-sra