Whamcloud - gitweb
LU-13485 kernel: Parallel core configure tests
authorShaun Tancheff <shaun.tancheff@hpe.com>
Fri, 12 May 2023 08:02:08 +0000 (01:02 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Tue, 13 Jun 2023 09:03:39 +0000 (09:03 +0000)
Transform the compile tests in lustre-core to run in parallel

Lustre-change: https://review.whamcloud.com/38361
Lustre-commit: a346cf6cf22c285e05177a5a5e70a7d8e5bd9fa8

LU-16586 build: Remove old check for linux_selinux_enabled

LC_SRC_HAS_LINUX_SELINUX_ENABLED is used and not defined, it
should be removed.

LC_PROG_LINUX_SRC and LC_PROG_LINUX_RESULTS are defined twice,
remove the unused ones.

Lustre-change: https://review.whamcloud.com/50111
Lustre-commit: 2bdff20f97707cf05118e822adf202ccb209e3a5

Fixes: a346cf6cf22 ("LU-13485 kernel: Parallel core configure tests")

Test-Parameters: trivial
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I46fa852659eb4db86a12ec4ad3efddd0fdd3a655
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/50976
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Tested-by: Shuichi Ihara <sihara@ddn.com>
Reviewed-by: Shuichi Ihara <sihara@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/autoconf/lustre-core.m4

index d7fe681..ef84393 100644 (file)
@@ -70,18 +70,21 @@ AC_CHECK_FUNCS([copy_file_range],
 #
 # Ensure the stack size is at least 8k in Lustre server (all kernels)
 #
+AC_DEFUN([LC_SRC_STACK_SIZE], [
+       LB2_LINUX_TEST_SRC([stack_size_8k], [
+               #include <linux/thread_info.h>
+       ], [
+               #if THREAD_SIZE < 8192
+               #error "stack size < 8192"
+               #endif
+       ])
+])
 AC_DEFUN([LC_STACK_SIZE], [
-LB_CHECK_COMPILE([if stack size is at least 8k],
-stack_size_8k, [
-       #include <linux/thread_info.h>
-], [
-       #if THREAD_SIZE < 8192
-       #error "stack size < 8192"
-       #endif
-], [], [AC_MSG_ERROR([
-
-Lustre requires that Linux is configured with at least a 8KB stack.
-])])
+       AC_MSG_CHECKING([if stack size is at least 8k])
+       LB2_LINUX_TEST_RESULT([stack_size_8k], [],[
+               AC_MSG_ERROR(
+               [Lustre requires that Linux is configured with at least a 8KB stack.])
+       ])
 ]) # LC_STACK_SIZE
 
 #
@@ -198,17 +201,17 @@ AS_IF([test "x$enable_lru_resize" != xno], [
 ]) # LC_CONFIG_LRU_RESIZE
 
 #
-# LC_QUOTA_CONFIG
+# LC_CONFIG_QUOTA
 #
 # Quota support. The kernel must support CONFIG_QUOTA.
 #
-AC_DEFUN([LC_QUOTA_CONFIG], [
-LB_CHECK_CONFIG_IM([QUOTA], [],
-       [AC_MSG_ERROR([
-
-Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
-])])
-]) # LC_QUOTA_CONFIG
+AC_DEFUN([LC_SRC_CONFIG_QUOTA], [
+       LB2_SRC_CHECK_CONFIG_IM([QUOTA])
+])
+AC_DEFUN([LC_CONFIG_QUOTA], [
+       LB2_TEST_CHECK_CONFIG_IM([QUOTA],[],[AC_MSG_ERROR(
+[Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])])
+]) # LC_CONFIG_QUOTA
 
 #
 # LC_CONFIG_FHANDLE
@@ -216,12 +219,12 @@ Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
 # fhandle kernel support for open_by_handle_at() and name_to_handle_at()
 # system calls. The kernel must support CONFIG_FHANDLE.
 #
+AC_DEFUN([LC_SRC_CONFIG_FHANDLE], [
+       LB2_SRC_CHECK_CONFIG_IM([FHANDLE])
+])
 AC_DEFUN([LC_CONFIG_FHANDLE], [
-LB_CHECK_CONFIG_IM([FHANDLE], [],
-       [AC_MSG_ERROR([
-
-Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.
-])])
+       LB2_TEST_CHECK_CONFIG_IM([FHANDLE],[],[AC_MSG_ERROR(
+[Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.])])
 ]) # LC_CONFIG_FHANDLE
 
 #
@@ -229,14 +232,16 @@ Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.
 #
 # POSIX ACL support.
 #
+AC_DEFUN([LC_SRC_POSIX_ACL_CONFIG], [
+       LB2_SRC_CHECK_CONFIG_IM([FS_POSIX_ACL])
+])
 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
-LB_CHECK_CONFIG_IM([FS_POSIX_ACL],
-       [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])
-], [ ])
+       LB2_TEST_CHECK_CONFIG_IM([FS_POSIX_ACL],
+               [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])],
+               [])
 ]) # LC_POSIX_ACL_CONFIG
 
-LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
-               [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
+# CRYPTO_MD5 check and warn only if GSS is not disabled.
 
 #
 # LC_CONFIG_GSS_KEYRING
@@ -282,16 +287,19 @@ AS_IF([test "x$enable_gss_keyring" != xno], [
 #
 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
 #
-AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
-LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
-key_type_instantiate_2args, [
-       #include <linux/key-type.h>
-],[
-       ((struct key_type *)0)->instantiate(0, NULL);
-],[
-       AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
-               [key_type->instantiate has two args])
+AC_DEFUN([LC_SRC_KEY_TYPE_INSTANTIATE_2ARGS], [
+       LB2_LINUX_TEST_SRC([key_type_instantiate_2args], [
+               #include <linux/key-type.h>
+       ],[
+               ((struct key_type *)0)->instantiate(0, NULL);
+       ])
 ])
+AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
+       AC_MSG_CHECKING([if 'key_type->instantiate' has two args])
+       LB2_LINUX_TEST_RESULT([key_type_instantiate_2args], [
+               AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
+                       [key_type->instantiate has two args])
+       ])
 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
 
 #
@@ -334,20 +342,11 @@ AC_SUBST(TEST_DIR)
 
 AS_IF([test "x$enable_gss" != xno], [
        LC_CONFIG_GSS_KEYRING
-       LC_KEY_TYPE_INSTANTIATE_2ARGS
+
        sunrpc_required=$enable_gss
        LC_CONFIG_SUNRPC
        sunrpc_required="no"
 
-       LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
-               [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
-       LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
-               [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
-       LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
-               [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
-       LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
-               [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
-
        require_krb5=$enable_gss
        AC_KERBEROS_V5
        require_krb5="no"
@@ -478,7 +477,7 @@ CFLAGS="$saved_flags"
 AC_DEFUN([LC_HAVE_LIBAIO], [
        AC_CHECK_HEADER([libaio.h],
                enable_libaio="yes",
-               AC_MSG_WARN([libaio is not installed in the system]))
+               AC_MSG_WARN([libaio is not installed on the system]))
 ]) # LC_HAVE_LIBAIO
 
 #
@@ -486,17 +485,21 @@ AC_DEFUN([LC_HAVE_LIBAIO], [
 #
 # 3.11 invalidatepage requires the length of the range to invalidate
 #
-AC_DEFUN([LC_INVALIDATE_RANGE], [
-LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
-address_space_ops_invalidatepage_3args, [
-       #include <linux/fs.h>
-],[
-       struct address_space_operations a_ops;
-       a_ops.invalidatepage(NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
-               [address_space_operations.invalidatepage needs 3 arguments])
+AC_DEFUN([LC_SRC_INVALIDATE_RANGE], [
+       LB2_LINUX_TEST_SRC([address_space_ops_invalidatepage_3args], [
+               #include <linux/fs.h>
+       ],[
+               struct address_space_operations a_ops;
+               a_ops.invalidatepage(NULL, 0, 0);
+       ])
 ])
+AC_DEFUN([LC_INVALIDATE_RANGE], [
+       AC_MSG_CHECKING(
+               [if 'address_space_operations.invalidatepage' requires 3 arguments])
+       LB2_LINUX_TEST_RESULT([address_space_ops_invalidatepage_3args], [
+               AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
+                       [address_space_operations.invalidatepage needs 3 arguments])
+       ])
 ]) # LC_INVALIDATE_RANGE
 
 #
@@ -504,22 +507,24 @@ address_space_ops_invalidatepage_3args, [
 #
 # 3.11 readdir now takes the new struct dir_context
 #
-AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
-LB_CHECK_COMPILE([if 'dir_context' exist],
-dir_context, [
-       #include <linux/fs.h>
-],[
-#ifdef FMODE_KABI_ITERATE
-#error "back to use readdir in kabi_extand mode"
-#else
-       struct dir_context ctx;
+AC_DEFUN([LC_SRC_HAVE_DIR_CONTEXT], [
+       LB2_LINUX_TEST_SRC([dir_context], [
+               #include <linux/fs.h>
+       ],[
+       #ifdef FMODE_KABI_ITERATE
+       #error "back to use readdir in kabi_extand mode"
+       #else
+               struct dir_context ctx;
 
-       ctx.pos = 0;
-#endif
-],[
-       AC_DEFINE(HAVE_DIR_CONTEXT, 1,
-               [dir_context exist])
+               ctx.pos = 0;
+       #endif
+       ])
 ])
+AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
+       AC_MSG_CHECKING([if 'dir_context' exist])
+       LB2_LINUX_TEST_RESULT([dir_context], [
+               AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist])
+       ])
 ]) # LC_HAVE_DIR_CONTEXT
 
 #
@@ -527,16 +532,19 @@ dir_context, [
 #
 # 3.11 dentry_operations.d_compare() taken 5 arguments.
 #
-AC_DEFUN([LC_D_COMPARE_5ARGS], [
-LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
-d_compare_5args, [
-       #include <linux/dcache.h>
-],[
-       ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
-],[
-       AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
-               [d_compare need 5 arguments])
+AC_DEFUN([LC_SRC_D_COMPARE_5ARGS], [
+       LB2_LINUX_TEST_SRC([d_compare_5args], [
+               #include <linux/dcache.h>
+       ],[
+               ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
+       ])
 ])
+AC_DEFUN([LC_D_COMPARE_5ARGS], [
+       AC_MSG_CHECKING([if 'd_compare' taken 5 arguments])
+       LB2_LINUX_TEST_RESULT([d_compare_5args], [
+               AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
+                       [d_compare need 5 arguments])
+       ])
 ]) # LC_D_COMPARE_5ARGS
 
 #
@@ -544,19 +552,21 @@ d_compare_5args, [
 #
 # 3.11 need to access d_count to get dentry reference count
 #
-AC_DEFUN([LC_HAVE_DCOUNT], [
-LB_CHECK_COMPILE([if 'd_count' exists],
-d_count, [
-       #include <linux/dcache.h>
-],[
-       struct dentry de = { };
-       int count;
+AC_DEFUN([LC_SRC_HAVE_DCOUNT], [
+       LB2_LINUX_TEST_SRC([d_count], [
+               #include <linux/dcache.h>
+       ],[
+               struct dentry de = { };
+               int count;
 
-       count = d_count(&de);
-],[
-       AC_DEFINE(HAVE_D_COUNT, 1,
-               [d_count exist])
+               count = d_count(&de);
+       ])
 ])
+AC_DEFUN([LC_HAVE_DCOUNT], [
+       AC_MSG_CHECKING([if 'd_count' exists])
+       LB2_LINUX_TEST_RESULT([d_count], [
+               AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
+       ])
 ]) # LC_HAVE_DCOUNT
 
 #
@@ -564,17 +574,20 @@ d_count, [
 #
 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
 #
-AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
-LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
-pid_ns_for_children, [
-       #include <linux/nsproxy.h>
-],[
-       struct nsproxy ns;
-       ns.pid_ns_for_children = NULL;
-],[
-       AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
-                 ['struct nsproxy' has 'pid_ns_for_children'])
+AC_DEFUN([LC_SRC_PID_NS_FOR_CHILDREN], [
+       LB2_LINUX_TEST_SRC([pid_ns_for_children], [
+               #include <linux/nsproxy.h>
+       ],[
+               struct nsproxy ns;
+               ns.pid_ns_for_children = NULL;
+       ])
 ])
+AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
+       AC_MSG_CHECKING([if 'struct nsproxy' has 'pid_ns_for_children'])
+       LB2_LINUX_TEST_RESULT([pid_ns_for_children], [
+               AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
+                         ['struct nsproxy' has 'pid_ns_for_children'])
+       ])
 ]) # LC_PID_NS_FOR_CHILDREN
 
 #
@@ -582,16 +595,19 @@ pid_ns_for_children, [
 #
 # 3.12 truncate_pagecache without oldsize parameter
 #
-AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
-LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
-truncate_pagecache_old_size, [
-       #include <linux/mm.h>
-],[
-       truncate_pagecache(NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
-               [with oldsize])
+AC_DEFUN([LC_SRC_OLDSIZE_TRUNCATE_PAGECACHE], [
+       LB2_LINUX_TEST_SRC([truncate_pagecache_old_size], [
+               #include <linux/mm.h>
+       ],[
+               truncate_pagecache(NULL, 0, 0);
+       ])
 ])
+AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
+       AC_MSG_CHECKING([if 'truncate_pagecache' with 'old_size' parameter])
+       LB2_LINUX_TEST_RESULT([truncate_pagecache_old_size], [
+               AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
+                       [with oldsize])
+       ])
 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
 
 #
@@ -600,16 +616,19 @@ truncate_pagecache_old_size, [
 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
 # It was added to linux kernel 3.12
 #
-AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
-LB_CHECK_COMPILE([if 'PTR_ERR_OR_ZERO' is missing],
-is_err_or_null, [
-       #include <linux/err.h>
-],[
-       if (PTR_ERR_OR_ZERO(NULL)) return 0;
-],[
-       AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
-               ['PTR_ERR_OR_ZERO' exist])
+AC_DEFUN([LC_SRC_PTR_ERR_OR_ZERO_MISSING], [
+       LB2_LINUX_TEST_SRC([is_err_or_null], [
+               #include <linux/err.h>
+       ],[
+               if (PTR_ERR_OR_ZERO(NULL)) return 0;
+       ])
 ])
+AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
+       AC_MSG_CHECKING([if 'PTR_ERR_OR_ZERO' is missing])
+       LB2_LINUX_TEST_RESULT([is_err_or_null], [
+               AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
+                       ['PTR_ERR_OR_ZERO' exist])
+       ])
 ]) # LC_PTR_ERR_OR_ZERO_MISSING
 
 #
@@ -619,33 +638,45 @@ is_err_or_null, [
 #
 # Some distros move d_alias to d_u but it is still a struct list
 #
-AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
-AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
-       LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
-       d_alias, [
+AC_DEFUN([LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_LIST], [
+       LB2_LINUX_TEST_SRC([d_alias_list], [
                #include <linux/list.h>
                #include <linux/dcache.h>
        ],[
                struct dentry de;
                INIT_LIST_HEAD(&de.d_u.d_alias);
-       ],[
+       ])
+])
+AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS_LIST], [
+       AC_MSG_CHECKING([if list 'dentry.d_u.d_alias' exist])
+       LB2_LINUX_TEST_RESULT([d_alias_list], [
                AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
                        [list dentry.d_u.d_alias exist])
        ])
-],[
-       LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
-       d_alias, [
+]) # LC_HAVE_DENTRY_D_U_D_ALIAS_LIST
+
+#
+# LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
+#
+# Some distros move d_alias to d_u and it is an hlist
+#
+AC_DEFUN([LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_HLIST], [
+       LB2_LINUX_TEST_SRC([d_alias_hlist], [
                #include <linux/list.h>
                #include <linux/dcache.h>
        ],[
                struct dentry de;
                INIT_HLIST_NODE(&de.d_u.d_alias);
-       ],[
-               AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
-                       [hlist dentry.d_u.d_alias exist])
        ])
 ])
-]) # LC_HAVE_DENTRY_D_U_D_ALIAS
+AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST], [
+       AC_MSG_CHECKING([if hlist 'dentry.d_u.d_alias' exist])
+       LB2_LINUX_TEST_RESULT([d_alias_hlist], [
+               AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
+                       [list dentry.d_u.d_alias exist])
+       ])
+]) # LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
+
 
 #
 # LC_HAVE_DENTRY_D_CHILD
@@ -653,18 +684,20 @@ AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
 # 3.11 kernel d_child has been moved out of the union d_u
 # in struct dentry
 #
-AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
-LB_CHECK_COMPILE([if 'dentry.d_child' exist],
-d_child, [
-       #include <linux/list.h>
-       #include <linux/dcache.h>
-],[
-       struct dentry de;
-       INIT_LIST_HEAD(&de.d_child);
-],[
-       AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
-               [dentry.d_child exist])
+AC_DEFUN([LC_SRC_HAVE_DENTRY_D_CHILD], [
+       LB2_LINUX_TEST_SRC([d_child], [
+               #include <linux/list.h>
+               #include <linux/dcache.h>
+       ],[
+               struct dentry de;
+               INIT_LIST_HEAD(&de.d_child);
+       ])
 ])
+AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
+       AC_MSG_CHECKING([if 'dentry.d_child' exist])
+       LB2_LINUX_TEST_RESULT([d_child], [
+               AC_DEFINE(HAVE_DENTRY_D_CHILD, 1, [dentry.d_child exist])
+       ])
 ]) # LC_HAVE_DENTRY_D_CHILD
 
 #
@@ -672,16 +705,19 @@ d_child, [
 #
 # 3.12 ki_left removed from struct kiocb
 #
-AC_DEFUN([LC_KIOCB_KI_LEFT], [
-LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
-kiocb_ki_left, [
-       #include <linux/aio.h>
-],[
-       ((struct kiocb*)0)->ki_left = 0;
-],[
-       AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
-               [ki_left exist])
+AC_DEFUN([LC_SRC_KIOCB_KI_LEFT], [
+       LB2_LINUX_TEST_SRC([kiocb_ki_left], [
+               #include <linux/aio.h>
+       ],[
+               ((struct kiocb*)0)->ki_left = 0;
+       ])
 ])
+AC_DEFUN([LC_KIOCB_KI_LEFT], [
+       AC_MSG_CHECKING([if 'struct kiocb' with 'ki_left' member])
+       LB2_LINUX_TEST_RESULT([kiocb_ki_left], [
+               AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
+                       [ki_left exist])
+       ])
 ]) # LC_KIOCB_KI_LEFT
 
 #
@@ -689,16 +725,22 @@ kiocb_ki_left, [
 #
 # 3.13 has vfs_rename with 5 args
 #
-AC_DEFUN([LC_VFS_RENAME_5ARGS], [
-LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
-vfs_rename_5args, [
-       #include <linux/fs.h>
-],[
-       vfs_rename(NULL, NULL, NULL, NULL, NULL);
-], [
-       AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
-               [kernel has vfs_rename with 5 args])
+AC_DEFUN([LC_SRC_VFS_RENAME_5ARGS], [
+       LB2_LINUX_TEST_SRC([vfs_rename_5args], [
+               #include <linux/fs.h>
+       ],[
+               vfs_rename(NULL, NULL, NULL, NULL, NULL);
+       ], [
+               AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
+                       [kernel has vfs_rename with 5 args])
+       ])
 ])
+AC_DEFUN([LC_VFS_RENAME_5ARGS], [
+       AC_MSG_CHECKING([if Linux kernel has 'vfs_rename' with 5 args])
+       LB2_LINUX_TEST_RESULT([vfs_rename_5args], [
+               AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
+                       [kernel has vfs_rename with 5 args])
+       ])
 ]) # LC_VFS_RENAME_5ARGS
 
 #
@@ -706,16 +748,19 @@ vfs_rename_5args, [
 #
 # 3.13 has vfs_unlink with 3 args
 #
-AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
-LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
-vfs_unlink_3args, [
-       #include <linux/fs.h>
-],[
-       vfs_unlink(NULL, NULL, NULL);
-], [
-       AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
-               [kernel has vfs_unlink with 3 args])
+AC_DEFUN([LC_SRC_VFS_UNLINK_3ARGS], [
+       LB2_LINUX_TEST_SRC([vfs_unlink_3args], [
+               #include <linux/fs.h>
+       ],[
+               vfs_unlink(NULL, NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
+       AC_MSG_CHECKING([if Linux kernel has 'vfs_unlink' with 3 args])
+       LB2_LINUX_TEST_RESULT([vfs_unlink_3args], [
+               AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
+                       [kernel has vfs_unlink with 3 args])
+       ])
 ]) # LC_VFS_UNLINK_3ARGS
 
 # LC_HAVE_D_IS_POSITIVE
@@ -723,16 +768,19 @@ vfs_unlink_3args, [
 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
 # d_is_positive is added
 #
-AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
-LB_CHECK_COMPILE([if 'd_is_positive' exist],
-d_is_positive, [
-       #include <linux/dcache.h>
-],[
-       d_is_positive(NULL);
-],[
-       AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
-               ['d_is_positive' is available])
+AC_DEFUN([LC_SRC_HAVE_D_IS_POSITIVE], [
+       LB2_LINUX_TEST_SRC([d_is_positive], [
+               #include <linux/dcache.h>
+       ],[
+               d_is_positive(NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
+       AC_MSG_CHECKING([if 'd_is_positive' exist])
+       LB2_LINUX_TEST_RESULT([d_is_positive], [
+               AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
+                       ['d_is_positive' is available])
+       ])
 ]) # LC_HAVE_D_IS_POSITIVE
 
 #
@@ -741,18 +789,21 @@ d_is_positive, [
 # 3.14 move some of its data in struct bio into the new
 # struct bvec_iter
 #
-AC_DEFUN([LC_HAVE_BVEC_ITER], [
-LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
-have_bvec_iter, [
-       #include <linux/bio.h>
-],[
-       struct bvec_iter iter;
+AC_DEFUN([LC_SRC_HAVE_BVEC_ITER], [
+       LB2_LINUX_TEST_SRC([have_bvec_iter], [
+               #include <linux/bio.h>
+       ],[
+               struct bvec_iter iter;
 
-       iter.bi_bvec_done = 0;
-], [
-       AC_DEFINE(HAVE_BVEC_ITER, 1,
-               [kernel has struct bvec_iter])
+               iter.bi_bvec_done = 0;
+       ])
 ])
+AC_DEFUN([LC_HAVE_BVEC_ITER], [
+       AC_MSG_CHECKING([if Linux kernel has struct bvec_iter])
+       LB2_LINUX_TEST_RESULT([have_bvec_iter], [
+               AC_DEFINE(HAVE_BVEC_ITER, 1,
+                       [kernel has struct bvec_iter])
+       ])
 ]) # LC_HAVE_BVEC_ITER
 
 #
@@ -761,17 +812,20 @@ have_bvec_iter, [
 # 3.14 adds set_acl method to inode_operations
 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
 #
-AC_DEFUN([LC_IOP_SET_ACL], [
-LB_CHECK_COMPILE([if 'inode_operations' has '.set_acl' member function],
-inode_ops_set_acl, [
-       #include <linux/fs.h>
-],[
-       struct inode_operations iop;
-       iop.set_acl = NULL;
-],[
-       AC_DEFINE(HAVE_IOP_SET_ACL, 1,
-               [inode_operations has .set_acl member function])
+AC_DEFUN([LC_SRC_IOP_SET_ACL], [
+       LB2_LINUX_TEST_SRC([inode_ops_set_acl], [
+               #include <linux/fs.h>
+       ],[
+               struct inode_operations iop;
+               iop.set_acl = NULL;
+       ])
 ])
+AC_DEFUN([LC_IOP_SET_ACL], [
+       AC_MSG_CHECKING([if 'inode_operations' has '.set_acl' member function])
+       LB2_LINUX_TEST_RESULT([inode_ops_set_acl], [
+               AC_DEFINE(HAVE_IOP_SET_ACL, 1,
+                       [inode_operations has .set_acl member function])
+       ])
 ]) # LC_IOP_SET_ACL
 
 #
@@ -779,16 +833,19 @@ inode_ops_set_acl, [
 #
 # 3.14 bring truncate_inode_pages_final for evict_inode
 #
-AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
-LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
-truncate_ipages_final, [
-       #include <linux/mm.h>
-],[
-       truncate_inode_pages_final(NULL);
-], [
-       AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
-               [kernel has truncate_inode_pages_final])
+AC_DEFUN([LC_SRC_HAVE_TRUNCATE_IPAGES_FINAL], [
+       LB2_LINUX_TEST_SRC([truncate_ipages_final], [
+               #include <linux/mm.h>
+       ],[
+               truncate_inode_pages_final(NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
+       AC_MSG_CHECKING([if Linux kernel has truncate_inode_pages_final])
+       LB2_LINUX_TEST_RESULT([truncate_ipages_final], [
+               AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
+                       [kernel has truncate_inode_pages_final])
+       ])
 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
 
 #
@@ -797,19 +854,22 @@ truncate_ipages_final, [
 # 3.14 has inode_operations->rename with 5 args
 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
 #
+AC_DEFUN([LC_SRC_IOPS_RENAME_WITH_FLAGS], [
+       LB2_LINUX_TEST_SRC([iops_rename_with_flags], [
+               #include <linux/fs.h>
+       ],[
+               struct inode *i1 = NULL, *i2 = NULL;
+               struct dentry *d1 = NULL, *d2 = NULL;
+               int rc;
+               rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
+       ])
+]) # LC_IOPS_RENAME_WITH_FLAGS
 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
-LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
-iops_rename_with_flags, [
-       #include <linux/fs.h>
-],[
-       struct inode *i1 = NULL, *i2 = NULL;
-       struct dentry *d1 = NULL, *d2 = NULL;
-       int rc;
-       rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
-], [
-       AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
-               [inode_operations->rename need flags as argument])
-])
+       AC_MSG_CHECKING([if 'inode_operations->rename' taken flags as argument])
+       LB2_LINUX_TEST_RESULT([iops_rename_with_flags], [
+               AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
+                       [inode_operations->rename need flags as argument])
+       ])
 ]) # LC_IOPS_RENAME_WITH_FLAGS
 
 #
@@ -817,16 +877,19 @@ iops_rename_with_flags, [
 #
 # 3.15 has vfs_rename with 6 args
 #
-AC_DEFUN([LC_VFS_RENAME_6ARGS], [
-LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
-vfs_rename_6args, [
-       #include <linux/fs.h>
-],[
-       vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
-], [
-       AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
-               [kernel has vfs_rename with 6 args])
+AC_DEFUN([LC_SRC_VFS_RENAME_6ARGS], [
+       LB2_LINUX_TEST_SRC([vfs_rename_6args], [
+               #include <linux/fs.h>
+       ],[
+               vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_VFS_RENAME_6ARGS], [
+       AC_MSG_CHECKING([if Linux kernel has 'vfs_rename' with 6 args])
+       LB2_LINUX_TEST_RESULT([vfs_rename_6args], [
+               AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
+                       [kernel has vfs_rename with 6 args])
+       ])
 ]) # LC_VFS_RENAME_6ARGS
 
 #
@@ -834,20 +897,22 @@ vfs_rename_6args, [
 #
 # 3.16 kernel changes direct IO to use iov_iter
 #
-AC_DEFUN([LC_DIRECTIO_USE_ITER], [
-LB_CHECK_COMPILE([if direct IO uses iov_iter],
-direct_io_iter, [
-       #include <linux/fs.h>
-],[
-       struct address_space_operations ops = { };
-       struct iov_iter *iter = NULL;
-       loff_t offset = 0;
+AC_DEFUN([LC_SRC_DIRECTIO_USE_ITER], [
+       LB2_LINUX_TEST_SRC([direct_io_iter], [
+               #include <linux/fs.h>
+       ],[
+               struct address_space_operations ops = { };
+               struct iov_iter *iter = NULL;
+               loff_t offset = 0;
 
-       ops.direct_IO(0, NULL, iter, offset);
-],[
-       AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
-               [direct IO uses iov_iter])
+               ops.direct_IO(0, NULL, iter, offset);
+       ])
 ])
+AC_DEFUN([LC_DIRECTIO_USE_ITER], [
+       AC_MSG_CHECKING([if direct IO uses iov_iter])
+       LB2_LINUX_TEST_RESULT([direct_io_iter], [
+               AC_DEFINE(HAVE_DIRECTIO_ITER, 1, [direct IO uses iov_iter])
+       ])
 ]) # LC_DIRECTIO_USE_ITER
 
 #
@@ -858,22 +923,22 @@ direct_io_iter, [
 #      changed iov_iter_init api to start accepting a tag
 #      that defines if its a read or write operation
 #
-AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
-iter_init, [
-       #include <linux/uio.h>
-       #include <linux/fs.h>
-],[
-       const struct iovec *iov = NULL;
+AC_DEFUN([LC_SRC_HAVE_IOV_ITER_INIT_DIRECTION], [
+       LB2_LINUX_TEST_SRC([iter_init], [
+               #include <linux/uio.h>
+               #include <linux/fs.h>
+       ],[
+               const struct iovec *iov = NULL;
 
-       iov_iter_init(NULL, READ, iov, 1, 0);
-],[
-       AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
-               [iov_iter_init handles directional tag])
+               iov_iter_init(NULL, READ, iov, 1, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
+       AC_MSG_CHECKING([if 'iov_iter_init' takes a tag])
+       LB2_LINUX_TEST_RESULT([iter_init], [
+               AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
+                       [iov_iter_init handles directional tag])
+       ])
 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
 
 #
@@ -882,21 +947,21 @@ EXTRA_KCFLAGS="$tmp_flags"
 #
 # 3.16 introduces a new API iov_iter_truncate()
 #
-AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
-iter_truncate, [
-       #include <linux/uio.h>
-       #include <linux/fs.h>
-],[
-       struct iov_iter *i = NULL;
+AC_DEFUN([LC_SRC_HAVE_IOV_ITER_TRUNCATE], [
+       LB2_LINUX_TEST_SRC([iter_truncate], [
+               #include <linux/uio.h>
+               #include <linux/fs.h>
+       ],[
+               struct iov_iter *i = NULL;
 
-       iov_iter_truncate(i, 0);
-],[
-       AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
+               iov_iter_truncate(i, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
+       AC_MSG_CHECKING([if 'iov_iter_truncate' exists])
+       LB2_LINUX_TEST_RESULT([iter_truncate], [
+               AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
+       ])
 ]) # LC_HAVE_IOV_ITER_TRUNCATE
 
 #
@@ -904,17 +969,20 @@ EXTRA_KCFLAGS="$tmp_flags"
 #
 # 3.16 introduces [read|write]_iter to struct file_operations
 #
-AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
-LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
-file_function_iter, [
-       #include <linux/fs.h>
-],[
-       ((struct file_operations *)NULL)->read_iter(NULL, NULL);
-       ((struct file_operations *)NULL)->write_iter(NULL, NULL);
-],[
-       AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
-               [file_operations.[read|write]_iter functions exist])
+AC_DEFUN([LC_SRC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
+       LB2_LINUX_TEST_SRC([file_function_iter], [
+               #include <linux/fs.h>
+       ],[
+               ((struct file_operations *)NULL)->read_iter(NULL, NULL);
+               ((struct file_operations *)NULL)->write_iter(NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
+       AC_MSG_CHECKING([if 'file_operations.[read|write]_iter' exist])
+       LB2_LINUX_TEST_RESULT([file_function_iter], [
+               AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
+                       [file_operations.[read|write]_iter functions exist])
+       ])
 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
 
 #
@@ -922,16 +990,19 @@ file_function_iter, [
 #
 # 3.17 replace sector_size with interval in struct blk_integrity
 #
-AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
-LB_CHECK_COMPILE([if 'blk_integrity.interval' exist],
-interval_blk_integrity, [
-       #include <linux/blkdev.h>
-],[
-       ((struct blk_integrity *)0)->interval = 0;
-],[
-       AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
-               [blk_integrity.interval exist])
+AC_DEFUN([LC_SRC_HAVE_INTERVAL_BLK_INTEGRITY], [
+       LB2_LINUX_TEST_SRC([interval_blk_integrity], [
+               #include <linux/blkdev.h>
+       ],[
+               ((struct blk_integrity *)0)->interval = 0;
+       ])
 ])
+AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
+       AC_MSG_CHECKING([if 'blk_integrity.interval' exist])
+       LB2_LINUX_TEST_RESULT([interval_blk_integrity], [
+               AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
+                       [blk_integrity.interval exist])
+       ])
 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
 
 #
@@ -940,18 +1011,20 @@ interval_blk_integrity, [
 # 3.17 replaces key_type::match with match_preparse
 #      and has new struct key_match_data
 #
-AC_DEFUN([LC_KEY_MATCH_DATA], [
-LB_CHECK_COMPILE([if struct key_match field exist],
-key_match, [
-       #include <linux/key-type.h>
-],[
-       struct key_match_data data;
+AC_DEFUN([LC_SRC_KEY_MATCH_DATA], [
+       LB2_LINUX_TEST_SRC([key_match], [
+               #include <linux/key-type.h>
+       ],[
+               struct key_match_data data;
 
-       data.raw_data = NULL;
-],[
-       AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
-               [struct key_match_data exist])
+               data.raw_data = NULL;
+       ])
 ])
+AC_DEFUN([LC_KEY_MATCH_DATA], [
+       AC_MSG_CHECKING([if struct key_match field exist])
+       LB2_LINUX_TEST_RESULT([key_match], [
+               AC_DEFINE(HAVE_KEY_MATCH_DATA, 1, [struct key_match_data exist])
+       ])
 ]) # LC_KEY_MATCH_DATA
 
 #
@@ -960,22 +1033,29 @@ key_match, [
 # Linux commit v3.17-rc5-69-g1859308853b1 replaces
 # struct blk_integrity_exchg with struct blk_integrity_iter
 #
-AC_DEFUN([LC_HAVE_BLK_INTEGRITY_ITER], [
-LB_CHECK_COMPILE([if struct blk_integrity_iter exist],
-blk_integrity_iter, [
-       #ifdef HAVE_LINUX_BLK_INTEGRITY_HEADER
-       # include <linux/blk-integrity.h>
-       #else
-       # include <linux/blkdev.h>
-       #endif
-],[
-       struct blk_integrity_iter iter;
+# LB_CHECK_LINUX_HEADER has already run so we can rely on
+# HAVE_LINUX_BLK_INTEGRITY_HEADER being set correctly before
+# this test is run.
+#
+AC_DEFUN([LC_SRC_HAVE_BLK_INTEGRITY_ITER], [
+       LB2_LINUX_TEST_SRC([blk_integrity_iter], [
+               #ifdef HAVE_LINUX_BLK_INTEGRITY_HEADER
+               # include <linux/blk-integrity.h>
+               #else
+               # include <linux/blkdev.h>
+               #endif
+       ],[
+               struct blk_integrity_iter iter;
 
-       iter.prot_buf = NULL;
-],[
-       AC_DEFINE(HAVE_BLK_INTEGRITY_ITER, 1,
-               [kernel has struct blk_integrity_iter])
+               iter.prot_buf = NULL;
+       ])
 ])
+AC_DEFUN([LC_HAVE_BLK_INTEGRITY_ITER], [
+       AC_MSG_CHECKING([if struct blk_integrity_iter exist])
+       LB2_LINUX_TEST_RESULT([blk_integrity_iter], [
+               AC_DEFINE(HAVE_BLK_INTEGRITY_ITER, 1,
+                       [kernel has struct blk_integrity_iter])
+       ])
 ]) # LC_HAVE_BLK_INTEGRITY_ITER
 
 #
@@ -983,29 +1063,29 @@ blk_integrity_iter, [
 #
 # 3.18 kernel moved from void cookie to struct dir_context
 #
-AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
-filldir_ctx, [
-       #include <linux/fs.h>
-],[
-       int filldir(struct dir_context *ctx, const char* name,
-                   int i, loff_t off, u64 tmp, unsigned temp)
-       {
-               return 0;
-       }
+AC_DEFUN([LC_SRC_NFS_FILLDIR_USE_CTX], [
+       LB2_LINUX_TEST_SRC([filldir_ctx], [
+               #include <linux/fs.h>
+       ],[
+               int filldir(struct dir_context *ctx, const char* name,
+                           int i, loff_t off, u64 tmp, unsigned temp)
+               {
+                       return 0;
+               }
 
-       struct dir_context ctx = {
-               .actor = filldir,
-       };
+               struct dir_context ctx = {
+                       .actor = filldir,
+               };
 
-       ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
-],[
-       AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
-               [filldir_t needs struct dir_context as argument])
+               ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
+       AC_MSG_CHECKING([if filldir_t uses struct dir_context])
+       LB2_LINUX_TEST_RESULT([filldir_ctx], [
+               AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
+                       [filldir_t needs struct dir_context as argument])
+       ])
 ]) # LC_NFS_FILLDIR_USE_CTX
 
 #
@@ -1015,16 +1095,19 @@ EXTRA_KCFLAGS="$tmp_flags"
 #      to pass a GFP_* memory allocation flag for internal
 #      memory allocation purposes.
 #
-AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
-LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
-percpu_counter_init, [
-       #include <linux/percpu_counter.h>
-],[
-       percpu_counter_init(NULL, 0, GFP_KERNEL);
-],[
-       AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
-               [percpu_counter_init uses GFP_* flag])
+AC_DEFUN([LC_SRC_PERCPU_COUNTER_INIT], [
+       LB2_LINUX_TEST_SRC([percpu_counter_init], [
+               #include <linux/percpu_counter.h>
+       ],[
+               percpu_counter_init(NULL, 0, GFP_KERNEL);
+       ])
 ])
+AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
+       AC_MSG_CHECKING([if percpu_counter_init uses GFP_* flag as argument])
+       LB2_LINUX_TEST_RESULT([percpu_counter_init], [
+               AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
+                       [percpu_counter_init uses GFP_* flag])
+       ])
 ]) # LC_PERCPU_COUNTER_INIT
 
 #
@@ -1032,17 +1115,20 @@ percpu_counter_init, [
 #
 # 3.19 kernel removed ki_nbytes from struct kiocb
 #
-AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
-LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
-ki_nbytes, [
-       #include <linux/fs.h>
-],[
-       struct kiocb iocb = { };
+AC_DEFUN([LC_SRC_KIOCB_HAS_NBYTES], [
+       LB2_LINUX_TEST_SRC([ki_nbytes], [
+               #include <linux/fs.h>
+       ],[
+               struct kiocb iocb = { };
 
-       iocb.ki_nbytes = 0;
-],[
-       AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
+               iocb.ki_nbytes = 0;
+       ])
 ])
+AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
+       AC_MSG_CHECKING([if struct kiocb has ki_nbytes field])
+       LB2_LINUX_TEST_RESULT([ki_nbytes], [
+               AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
+       ])
 ]) # LC_KIOCB_HAS_NBYTES
 
 #
@@ -1051,22 +1137,22 @@ ki_nbytes, [
 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
 # Added in commit 14bf61ffe
 #
-AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
-qc_dqblk, [
-       #include <linux/fs.h>
-       #include <linux/quota.h>
-],[
-       ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
-],[
-       AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
-               [quotactl_ops.set_dqblk takes struct qc_dqblk])
-       AC_DEFINE(HAVE_DQUOT_KQID, 1,
-               [quotactl_ops.set_dqblk takes struct kqid])
+AC_DEFUN([LC_SRC_HAVE_DQUOT_QC_DQBLK], [
+       LB2_LINUX_TEST_SRC([qc_dqblk], [
+               #include <linux/fs.h>
+               #include <linux/quota.h>
+       ],[
+               ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
+       AC_MSG_CHECKING([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk])
+       LB2_LINUX_TEST_RESULT([qc_dqblk], [
+               AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
+                       [quotactl_ops.set_dqblk takes struct qc_dqblk])
+               AC_DEFINE(HAVE_DQUOT_KQID, 1,
+                       [quotactl_ops.set_dqblk takes struct kqid])
+       ])
 ]) # LC_HAVE_DQUOT_QC_DQBLK
 
 #
@@ -1074,15 +1160,18 @@ EXTRA_KCFLAGS="$tmp_flags"
 #
 # 3.19 kernel makes aio_complete() static
 #
-AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
-LB_CHECK_COMPILE([if kernel has exported aio_complete() ],
-aio_complete, [
-       #include <linux/aio.h>
-],[
-       aio_complete(NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
+AC_DEFUN([LC_SRC_HAVE_AIO_COMPLETE], [
+       LB2_LINUX_TEST_SRC([aio_complete], [
+               #include <linux/aio.h>
+       ],[
+               aio_complete(NULL, 0, 0);
+       ])
 ])
+AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
+       AC_MSG_CHECKING([if kernel has exported aio_complete()])
+       LB2_LINUX_TEST_RESULT([aio_complete], [
+               AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
+       ])
 ]) # LC_HAVE_AIO_COMPLETE
 
 #
@@ -1090,17 +1179,20 @@ aio_complete, [
 #
 # 3.20 kernel removed backing_dev_info from address_space
 #
-AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
-LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
-backing_dev_info, [
-       #include <linux/fs.h>
-],[
-       struct address_space mapping;
+AC_DEFUN([LC_SRC_BACKING_DEV_INFO_REMOVAL], [
+       LB2_LINUX_TEST_SRC([backing_dev_info], [
+               #include <linux/fs.h>
+       ],[
+               struct address_space mapping;
 
-       mapping.backing_dev_info = NULL;
-],[
-       AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
+               mapping.backing_dev_info = NULL;
+       ])
 ])
+AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
+       AC_MSG_CHECKING([if struct address_space has backing_dev_info])
+       LB2_LINUX_TEST_RESULT([backing_dev_info], [
+               AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
+       ])
 ]) # LC_BACKING_DEV_INFO_REMOVAL
 
 #
@@ -1110,18 +1202,21 @@ backing_dev_info, [
 #      it breaks on non-MMU systems. See kernel commit
 #      b4caecd48005fbed3949dde6c1cb233142fd69e9
 #
-AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
-LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
-bdi_cap_map_copy, [
-       #include <linux/backing-dev.h>
-],[
-       struct backing_dev_info info;
+AC_DEFUN([LC_SRC_HAVE_BDI_CAP_MAP_COPY], [
+       LB2_LINUX_TEST_SRC([bdi_cap_map_copy], [
+               #include <linux/backing-dev.h>
+       ],[
+               struct backing_dev_info info;
 
-       info.capabilities = BDI_CAP_MAP_COPY;
-],[
-       AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
-               [BDI_CAP_MAP_COPY exist])
-])
+               info.capabilities = BDI_CAP_MAP_COPY;
+       ])
+]) # LC_HAVE_BDI_CAP_MAP_COPY
+AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
+       AC_MSG_CHECKING([if have 'BDI_CAP_MAP_COPY'])
+       LB2_LINUX_TEST_RESULT([bdi_cap_map_copy], [
+               AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
+                       [BDI_CAP_MAP_COPY exist])
+       ])
 ]) # LC_HAVE_BDI_CAP_MAP_COPY
 
 #
@@ -1129,19 +1224,22 @@ bdi_cap_map_copy, [
 #
 # Kernel version v4.0-rc1-197-g847aac644e92
 #
-AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
-LB_CHECK_COMPILE([if get_projid exists],
-get_projid, [
-       struct inode;
-       #include <linux/quota.h>
-],[
-       struct dquot_operations ops = { };
+AC_DEFUN([LC_SRC_HAVE_PROJECT_QUOTA], [
+       LB2_LINUX_TEST_SRC([get_projid], [
+               struct inode;
+               #include <linux/quota.h>
+       ],[
+               struct dquot_operations ops = { };
 
-       ops.get_projid(NULL, NULL);
-],[
-       AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
-               [get_projid function exists])
+               ops.get_projid(NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
+       AC_MSG_CHECKING([if get_projid exists])
+       LB2_LINUX_TEST_RESULT([get_projid], [
+               AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
+                       [get_projid function exists])
+       ])
 ]) # LC_HAVE_PROJECT_QUOTA
 
 #
@@ -1149,19 +1247,21 @@ get_projid, [
 #
 # 4.1 kernel has iov_iter_rw
 #
-AC_DEFUN([LC_IOV_ITER_RW], [
-LB_CHECK_COMPILE([if iov_iter_rw exist],
-iov_iter_rw, [
-       #include <linux/fs.h>
-       #include <linux/uio.h>
-],[
-       struct iov_iter *iter = NULL;
+AC_DEFUN([LC_SRC_IOV_ITER_RW], [
+       LB2_LINUX_TEST_SRC([iov_iter_rw], [
+               #include <linux/fs.h>
+               #include <linux/uio.h>
+       ],[
+               struct iov_iter *iter = NULL;
 
-       iov_iter_rw(iter);
-],[
-       AC_DEFINE(HAVE_IOV_ITER_RW, 1,
-               [iov_iter_rw exist])
+               iov_iter_rw(iter);
+       ])
 ])
+AC_DEFUN([LC_IOV_ITER_RW], [
+       AC_MSG_CHECKING([if iov_iter_rw exist])
+       LB2_LINUX_TEST_RESULT([iov_iter_rw], [
+               AC_DEFINE(HAVE_IOV_ITER_RW, 1, [iov_iter_rw exist])
+       ])
 ]) # LC_IOV_ITER_RW
 
 #
@@ -1180,20 +1280,22 @@ LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
 #
 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
 #
-AC_DEFUN([LC_HAVE___BI_CNT], [
-LB_CHECK_COMPILE([if Linux kernel has __bi_cnt in struct bio],
-have___bi_cnt, [
-       #include <asm/atomic.h>
-       #include <linux/bio.h>
-       #include <linux/blk_types.h>
-],[
-       struct bio bio = { };
-       int cnt;
-       cnt = atomic_read(&bio.__bi_cnt);
-], [
-       AC_DEFINE(HAVE___BI_CNT, 1,
-               [struct bio has __bi_cnt])
+AC_DEFUN([LC_SRC_HAVE___BI_CNT], [
+       LB2_LINUX_TEST_SRC([have___bi_cnt], [
+               #include <asm/atomic.h>
+               #include <linux/bio.h>
+               #include <linux/blk_types.h>
+       ],[
+               struct bio bio = { };
+               int cnt;
+               cnt = atomic_read(&bio.__bi_cnt);
+       ])
 ])
+AC_DEFUN([LC_HAVE___BI_CNT], [
+       AC_MSG_CHECKING([if Linux kernel has __bi_cnt in struct bio])
+       LB2_LINUX_TEST_RESULT([have___bi_cnt], [
+               AC_DEFINE(HAVE___BI_CNT, 1, [struct bio has __bi_cnt])
+       ])
 ]) # LC_HAVE___BI_CNT
 
 #
@@ -1202,20 +1304,23 @@ have___bi_cnt, [
 # For the 4.2+ kernels the file system internal symlink api no
 # longer uses struct nameidata as a argument
 #
-AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
-LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
-symlink_use_nameidata, [
-       #include <linux/namei.h>
-       #include <linux/fs.h>
-],[
-       struct nameidata *nd = NULL;
+AC_DEFUN([LC_SRC_SYMLINK_OPS_USE_NAMEIDATA], [
+       LB2_LINUX_TEST_SRC([symlink_use_nameidata], [
+               #include <linux/namei.h>
+               #include <linux/fs.h>
+       ],[
+               struct nameidata *nd = NULL;
 
-       ((struct inode_operations *)0)->follow_link(NULL, nd);
-       ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
-],[
-       AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
-               [symlink inode operations need struct nameidata argument])
+               ((struct inode_operations *)0)->follow_link(NULL, nd);
+               ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
+       ])
 ])
+AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
+       AC_MSG_CHECKING([if symlink inode operations have struct nameidata argument])
+       LB2_LINUX_TEST_RESULT([symlink_use_nameidata], [
+               AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
+                       [symlink inode operations need struct nameidata argument])
+       ])
 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
 
 #
@@ -1223,16 +1328,19 @@ symlink_use_nameidata, [
 #
 # 4.2 kernel bio_endio now only takes one argument
 #
-AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
-LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
-bio_endio, [
-       #include <linux/bio.h>
-],[
-       bio_endio(NULL);
-],[
-       AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
-               [bio_endio takes only one argument])
+AC_DEFUN([LC_SRC_BIO_ENDIO_USES_ONE_ARG], [
+       LB2_LINUX_TEST_SRC([bio_endio], [
+               #include <linux/bio.h>
+       ],[
+               bio_endio(NULL);
+       ])
 ])
+AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
+       AC_MSG_CHECKING([if 'bio_endio' with one argument exist])
+       LB2_LINUX_TEST_RESULT([bio_endio], [
+               AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
+                       [bio_endio takes only one argument])
+       ])
 ]) # LC_BIO_ENDIO_USES_ONE_ARG
 
 #
@@ -1240,16 +1348,19 @@ bio_endio, [
 #
 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
 #
-AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
-LB_CHECK_COMPILE([if 'account_page_dirtied' with 3 args exists],
-account_page_dirtied, [
-       #include <linux/mm.h>
-],[
-       account_page_dirtied(NULL, NULL, NULL);
-],[
-       AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
-               [account_page_dirtied takes three arguments])
+AC_DEFUN([LC_SRC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
+       LB2_LINUX_TEST_SRC([account_page_dirtied_3a], [
+               #include <linux/mm.h>
+       ],[
+               account_page_dirtied(NULL, NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
+       AC_MSG_CHECKING([if 'account_page_dirtied' with 3 args exists])
+       LB2_LINUX_TEST_RESULT([account_page_dirtied_3a], [
+               AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
+                       [account_page_dirtied takes three arguments])
+       ])
 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
 
 #
@@ -1258,16 +1369,19 @@ account_page_dirtied, [
 # Kernel version 4.12 commit 7a7ffe65c8c5
 # introduced crypto_alloc_skcipher().
 #
-AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
-LB_CHECK_COMPILE([if crypto_alloc_skcipher is defined],
-crypto_alloc_skcipher, [
-       #include <crypto/skcipher.h>
-],[
-       crypto_alloc_skcipher(NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
-               [crypto_alloc_skcipher is defined])
+AC_DEFUN([LC_SRC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
+       LB2_LINUX_TEST_SRC([crypto_alloc_skcipher], [
+               #include <crypto/skcipher.h>
+       ],[
+               crypto_alloc_skcipher(NULL, 0, 0);
+       ])
 ])
+AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
+       AC_MSG_CHECKING([if crypto_alloc_skcipher is defined])
+       LB2_LINUX_TEST_RESULT([crypto_alloc_skcipher], [
+               AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
+                       [crypto_alloc_skcipher is defined])
+       ])
 ]) # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
 
 #
@@ -1295,16 +1409,19 @@ crypto_init_wait, [
 # 'struct blk_integrity_profile' is also added in this version,
 # thus use this to determine whether 'struct blk_integrity' has profile
 #
-AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
-LB_CHECK_COMPILE([if 'blk_integrity.interval_exp' exist],
-blk_integrity_interval_exp, [
-       #include <linux/blkdev.h>
-],[
-       ((struct blk_integrity *)0)->interval_exp = 0;
-],[
-       AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
-               [blk_integrity.interval_exp exist])
+AC_DEFUN([LC_SRC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
+       LB2_LINUX_TEST_SRC([blk_integrity_interval_exp], [
+               #include <linux/blkdev.h>
+       ],[
+               ((struct blk_integrity *)0)->interval_exp = 0;
+       ])
 ])
+AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
+       AC_MSG_CHECKING([if 'blk_integrity.interval_exp' exist])
+       LB2_LINUX_TEST_RESULT([blk_integrity_interval_exp], [
+               AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
+                       [blk_integrity.interval_exp exist])
+       ])
 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
 
 #
@@ -1312,16 +1429,19 @@ blk_integrity_interval_exp, [
 #
 # 4.3 kernel swiched to hlist for cache_head
 #
-AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
-LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
-cache_head_has_hlist, [
-       #include <linux/sunrpc/cache.h>
-],[
-       do {} while(sizeof(((struct cache_head *)0)->cache_list));
-],[
-       AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
-               [cache_head has hlist cache_list])
+AC_DEFUN([LC_SRC_HAVE_CACHE_HEAD_HLIST], [
+       LB2_LINUX_TEST_SRC([cache_head_has_hlist], [
+               #include <linux/sunrpc/cache.h>
+       ],[
+               do {} while(sizeof(((struct cache_head *)0)->cache_list));
+       ])
 ])
+AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
+       AC_MSG_CHECKING([if 'struct cache_head' has 'cache_list' field])
+       LB2_LINUX_TEST_RESULT([cache_head_has_hlist], [
+               AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
+                       [cache_head has hlist cache_list])
+       ])
 ]) # LC_HAVE_CACHE_HEAD_HLIST
 
 #
@@ -1330,21 +1450,22 @@ cache_head_has_hlist, [
 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
 # simplified xattr_handler handling by passing in the handler pointer
 #
-AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'struct xattr_handler' functions pass in handler pointer],
-xattr_handler_simplified, [
-       #include <linux/xattr.h>
-],[
-       struct xattr_handler handler;
+AC_DEFUN([LC_SRC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
+       LB2_LINUX_TEST_SRC([xattr_handler_simplified], [
+               #include <linux/xattr.h>
+       ],[
+               struct xattr_handler handler;
 
-       ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
-       ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1, [handler pointer is parameter])
+               ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
+               ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
+       AC_MSG_CHECKING([if 'struct xattr_handler' functions pass in handler pointer])
+       LB2_LINUX_TEST_RESULT([xattr_handler_simplified], [
+               AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1,
+                       [handler pointer is parameter])
+       ])
 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
 
 #
@@ -1352,16 +1473,19 @@ EXTRA_KCFLAGS="$tmp_flags"
 #
 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
 #
-AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
-LB_CHECK_COMPILE([if 'bio_integrity_payload.bip_iter' exist],
-bio_integrity_payload_bip_iter, [
-       #include <linux/bio.h>
-],[
-       ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
-],[
-       AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
-               [bio_integrity_payload.bip_iter exist])
+AC_DEFUN([LC_SRC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
+       LB2_LINUX_TEST_SRC([bio_integrity_payload_bip_iter], [
+               #include <linux/bio.h>
+       ],[
+               ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
+       ])
 ])
+AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
+       AC_MSG_CHECKING([if 'bio_integrity_payload.bip_iter' exist])
+       LB2_LINUX_TEST_RESULT([bio_integrity_payload_bip_iter], [
+               AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
+                       [bio_integrity_payload.bip_iter exist])
+       ])
 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
 
 #
@@ -1370,19 +1494,22 @@ bio_integrity_payload_bip_iter, [
 # Lustre kernel patch extents bio_integrity_prep to accept optional
 # generate/verify_fn as extra args.
 #
-AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
-LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' exists],
-bio_integrity_prep_fn, [
-       #include <linux/bio.h>
-],[
-       bio_integrity_prep_fn(NULL, NULL, NULL);
-],[
-       AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
-               [kernel has bio_integrity_prep_fn])
-       AC_SUBST(PATCHED_INTEGRITY_INTF)
-],[
-       AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
+AC_DEFUN([LC_SRC_BIO_INTEGRITY_PREP_FN], [
+       LB2_LINUX_TEST_SRC([bio_integrity_prep_fn], [
+               #include <linux/bio.h>
+       ],[
+               bio_integrity_prep_fn(NULL, NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
+       AC_MSG_CHECKING([if 'bio_integrity_prep_fn' exists])
+       LB2_LINUX_TEST_RESULT([bio_integrity_prep_fn], [
+               AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
+                       [kernel has bio_integrity_prep_fn])
+               AC_SUBST(PATCHED_INTEGRITY_INTF)
+       ],[
+               AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
+       ])
 ]) # LC_BIO_INTEGRITY_PREP_FN
 
 # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
@@ -1391,20 +1518,23 @@ bio_integrity_prep_fn, [
 # (as well as in rhel 8.4) bio_integrity_prep() returns boolean true
 # on success.
 #
-AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
-LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' returns bool],
-bio_integrity_prep, [
-       #include <linux/bio.h>
-       #include <linux/typecheck.h>
-],[
-       #pragma GCC diagnostic warning "-Werror"
-       typedef bool (*bio_integrity_prep_type)(struct bio *bio) ;
+AC_DEFUN([LC_SRC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
+       LB2_LINUX_TEST_SRC([bio_integrity_prep_ret_bool], [
+               #include <linux/bio.h>
+               #include <linux/typecheck.h>
+       ],[
+               #pragma GCC diagnostic warning "-Werror"
+               typedef bool (*bio_integrity_prep_type)(struct bio *bio) ;
 
-       typecheck_fn(bio_integrity_prep_type, bio_integrity_prep);
-],[
-       AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1,
-               [bio_integrity_prep_fn returns bool])
+               typecheck_fn(bio_integrity_prep_type, bio_integrity_prep);
+       ])
 ])
+AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
+       AC_MSG_CHECKING([if 'bio_integrity_prep_fn' returns bool])
+       LB2_LINUX_TEST_RESULT([bio_integrity_prep_ret_bool], [
+               AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1,
+                       [bio_integrity_prep_fn returns bool])
+       ])
 ]) # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
 
 #
@@ -1412,18 +1542,20 @@ bio_integrity_prep, [
 #
 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
 #
-AC_DEFUN([LC_HAVE_BI_OPF], [
-LB_CHECK_COMPILE([if Linux kernel has bi_opf in struct bio],
-have_bi_opf, [
-       #include <linux/bio.h>
-],[
-       struct bio bio;
+AC_DEFUN([LC_SRC_HAVE_BI_OPF], [
+       LB2_LINUX_TEST_SRC([have_bi_opf], [
+               #include <linux/bio.h>
+       ],[
+               struct bio bio;
 
-       bio.bi_opf = 0;
-], [
-       AC_DEFINE(HAVE_BI_OPF, 1,
-               [struct bio has bi_opf])
+               bio.bi_opf = 0;
+       ])
 ])
+AC_DEFUN([LC_HAVE_BI_OPF], [
+       AC_MSG_CHECKING([if Linux kernel has bi_opf in struct bio])
+       LB2_LINUX_TEST_RESULT([have_bi_opf], [
+               AC_DEFINE(HAVE_BI_OPF, 1, [struct bio has bi_opf])
+       ])
 ]) # LC_HAVE_BI_OPF
 
 #
@@ -1431,17 +1563,20 @@ have_bi_opf, [
 #
 # 4.4 removed an argument from submit_bio
 #
-AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
-LB_CHECK_COMPILE([if submit_bio takes two arguments],
-have_submit_bio_2args, [
-       #include <linux/bio.h>
-],[
-       struct bio bio;
-       submit_bio(READ, &bio);
-], [
-       AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
-               [submit_bio takes two arguments])
+AC_DEFUN([LC_SRC_HAVE_SUBMIT_BIO_2ARGS], [
+       LB2_LINUX_TEST_SRC([have_submit_bio_2args], [
+               #include <linux/bio.h>
+       ],[
+               struct bio bio;
+               submit_bio(READ, &bio);
+       ])
 ])
+AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
+       AC_MSG_CHECKING([if submit_bio takes two arguments])
+       LB2_LINUX_TEST_RESULT([have_submit_bio_2args], [
+               AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
+                       [submit_bio takes two arguments])
+       ])
 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
 
 #
@@ -1450,16 +1585,19 @@ have_submit_bio_2args, [
 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
 # (SLES12/kernel commit 29f3ad7d8380364c)
 #
-AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
-LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
-have_clean_bdev_aliases, [
-       #include <linux/buffer_head.h>
-],[
-       clean_bdev_aliases(NULL,1,1);
-], [
-       AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
-               [kernel has clean_bdev_aliases])
+AC_DEFUN([LC_SRC_HAVE_CLEAN_BDEV_ALIASES], [
+       LB2_LINUX_TEST_SRC([have_clean_bdev_aliases], [
+               #include <linux/buffer_head.h>
+       ],[
+               clean_bdev_aliases(NULL,1,1);
+       ])
 ])
+AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
+       AC_MSG_CHECKING([if kernel has clean_bdev_aliases])
+       LB2_LINUX_TEST_RESULT([have_clean_bdev_aliases], [
+               AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
+                       [kernel has clean_bdev_aliases])
+       ])
 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
 
 #
@@ -1468,16 +1606,19 @@ have_clean_bdev_aliases, [
 # 4.4 kernel have moved locks API users to
 # locks_lock_inode_wait()
 #
-AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
-LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
-locks_lock_file_wait, [
-       #include <linux/fs.h>
-],[
-       locks_lock_file_wait(NULL, NULL);
-],[
-       AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
-               [kernel has locks_lock_file_wait])
+AC_DEFUN([LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT], [
+       LB2_LINUX_TEST_SRC([locks_lock_file_wait], [
+               #include <linux/fs.h>
+       ],[
+               locks_lock_file_wait(NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
+       AC_MSG_CHECKING([if 'locks_lock_file_wait' exists])
+       LB2_LINUX_TEST_RESULT([locks_lock_file_wait], [
+               AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
+                       [kernel has locks_lock_file_wait])
+       ])
 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
 
 #
@@ -1485,18 +1626,21 @@ locks_lock_file_wait, [
 #
 # 4.4 kernel merged type-specific data with the payload data for keys
 #
-AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
-LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
-key_payload_data_array, [
-       #include <linux/key.h>
-],[
-       struct key key = { };
+AC_DEFUN([LC_SRC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
+       LB2_LINUX_TEST_SRC([key_payload_data_array], [
+               #include <linux/key.h>
+       ],[
+               struct key key = { };
 
-       key.payload.data[0] = NULL;
-],[
-       AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
+               key.payload.data[0] = NULL;
+       ])
 ])
-]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
+AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
+       AC_MSG_CHECKING([if 'struct key' has 'payload.data' as an array])
+       LB2_LINUX_TEST_RESULT([key_payload_data_array], [
+               AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
+       ])
+]) # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
 
 #
 # LC_HAVE_XATTR_HANDLER_NAME
@@ -1504,18 +1648,19 @@ key_payload_data_array, [
 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
 # add a name member to struct xattr_handler
 #
-AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
-xattr_handler_name, [
-       #include <linux/xattr.h>
-],[
-       ((struct xattr_handler *)NULL)->name = NULL;
-],[
-       AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
+AC_DEFUN([LC_SRC_HAVE_XATTR_HANDLER_NAME], [
+       LB2_LINUX_TEST_SRC([xattr_handler_name], [
+               #include <linux/xattr.h>
+       ],[
+               ((struct xattr_handler *)NULL)->name = NULL;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
+       AC_MSG_CHECKING([if 'struct xattr_handler' has a name member])
+       LB2_LINUX_TEST_RESULT([xattr_handler_name], [
+               AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
+                       [xattr_handler has a name member])
+       ])
 ]) # LC_HAVE_XATTR_HANDLER_NAME
 
 #
@@ -1523,16 +1668,18 @@ EXTRA_KCFLAGS="$tmp_flags"
 #
 # 4.5 adds wrapper file_dentry
 #
-AC_DEFUN([LC_HAVE_FILE_DENTRY], [
-LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
-file_dentry, [
-       #include <linux/fs.h>
-],[
-       file_dentry(NULL);
-], [
-       AC_DEFINE(HAVE_FILE_DENTRY, 1,
-               [kernel has file_dentry])
+AC_DEFUN([LC_SRC_HAVE_FILE_DENTRY], [
+       LB2_LINUX_TEST_SRC([file_dentry], [
+               #include <linux/fs.h>
+       ],[
+               file_dentry(NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_FILE_DENTRY], [
+       AC_MSG_CHECKING([if Linux kernel has 'file_dentry'])
+       LB2_LINUX_TEST_RESULT([file_dentry], [
+               AC_DEFINE(HAVE_FILE_DENTRY, 1, [kernel has file_dentry])
+       ])
 ]) # LC_HAVE_FILE_DENTRY
 
 #
@@ -1540,16 +1687,18 @@ file_dentry, [
 #
 # 4.5 introduced inode_lock
 #
-AC_DEFUN([LC_HAVE_INODE_LOCK], [
-LB_CHECK_COMPILE([if 'inode_lock' is defined],
-inode_lock, [
-       #include <linux/fs.h>
-],[
-       inode_lock(NULL);
-], [
-       AC_DEFINE(HAVE_INODE_LOCK, 1,
-                 [inode_lock is defined])
+AC_DEFUN([LC_SRC_HAVE_INODE_LOCK], [
+       LB2_LINUX_TEST_SRC([inode_lock], [
+               #include <linux/fs.h>
+       ],[
+               inode_lock(NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_INODE_LOCK], [
+       AC_MSG_CHECKING([if 'inode_lock' is defined])
+       LB2_LINUX_TEST_RESULT([inode_lock], [
+               AC_DEFINE(HAVE_INODE_LOCK, 1, [inode_lock is defined])
+       ])
 ]) # LC_HAVE_INODE_LOCK
 
 #
@@ -1578,17 +1727,19 @@ i_rwsem, [
 # 4.5 vfs replaced iop->follow_link with
 # iop->get_link
 #
-AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
-LB_CHECK_COMPILE([if 'iop' has 'get_link'],
-inode_ops_get_link, [
-       #include <linux/fs.h>
-],[
-       struct inode_operations iop;
-       iop.get_link = NULL;
-],[
-       AC_DEFINE(HAVE_IOP_GET_LINK, 1,
-               [have iop get_link])
+AC_DEFUN([LC_SRC_HAVE_IOP_GET_LINK], [
+       LB2_LINUX_TEST_SRC([inode_ops_get_link], [
+               #include <linux/fs.h>
+       ],[
+               struct inode_operations iop;
+               iop.get_link = NULL;
+       ])
 ])
+AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
+       AC_MSG_CHECKING([if 'iop' has 'get_link'])
+       LB2_LINUX_TEST_RESULT([inode_ops_get_link], [
+               AC_DEFINE(HAVE_IOP_GET_LINK, 1, [have iop get_link])
+       ])
 ]) # LC_HAVE_IOP_GET_LINK
 
 #
@@ -1596,16 +1747,18 @@ inode_ops_get_link, [
 #
 # 4.6 renamed is_compat_task to in_compat_syscall
 #
-AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
-LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
-in_compat_syscall, [
-       #include <linux/compat.h>
-],[
-       in_compat_syscall();
-],[
-       AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
-               [have in_compat_syscall])
+AC_DEFUN([LC_SRC_HAVE_IN_COMPAT_SYSCALL], [
+       LB2_LINUX_TEST_SRC([in_compat_syscall], [
+               #include <linux/compat.h>
+       ],[
+               in_compat_syscall();
+       ])
 ])
+AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
+       AC_MSG_CHECKING([if 'in_compat_syscall' is defined])
+       LB2_LINUX_TEST_RESULT([in_compat_syscall], [
+               AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1, [have in_compat_syscall])
+       ])
 ]) # LC_HAVE_IN_COMPAT_SYSCALL
 
 #
@@ -1615,21 +1768,21 @@ in_compat_syscall, [
 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
 # to xattr_handler functions
 #
-AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'struct xattr_handler' functions have inode parameter],
-xattr_handler_inode_param, [
-       #include <linux/xattr.h>
-],[
-       const struct xattr_handler handler;
+AC_DEFUN([LC_SRC_HAVE_XATTR_HANDLER_INODE_PARAM], [
+       LB2_LINUX_TEST_SRC([xattr_handler_inode_param], [
+               #include <linux/xattr.h>
+       ],[
+               const struct xattr_handler handler;
 
-       ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
-       ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
+               ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
+               ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
+       AC_MSG_CHECKING([if 'struct xattr_handler' functions have inode parameter])
+       LB2_LINUX_TEST_RESULT([xattr_handler_inode_param], [
+               AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
+       ])
 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
 
 #
@@ -1640,18 +1793,18 @@ EXTRA_KCFLAGS="$tmp_flags"
 # d_in_lookup was added to notify when the same item was being queried
 # at the same time.
 #
-AC_DEFUN([LC_D_IN_LOOKUP], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'd_in_lookup' is defined],
-d_in_lookup, [
-       #include <linux/dcache.h>
-],[
-       d_in_lookup(NULL);
-],[
-       AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
+AC_DEFUN([LC_SRC_D_IN_LOOKUP], [
+       LB2_LINUX_TEST_SRC([d_in_lookup], [
+               #include <linux/dcache.h>
+       ],[
+               d_in_lookup(NULL);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_D_IN_LOOKUP], [
+       AC_MSG_CHECKING([if 'd_in_lookup' is defined])
+       LB2_LINUX_TEST_RESULT([d_in_lookup], [
+               AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
+       ])
 ]) # LC_D_IN_LOOKUP
 
 #
@@ -1661,16 +1814,18 @@ EXTRA_KCFLAGS="$tmp_flags"
 # Linux commit v5.15-12273-gab2f9d2d3626
 #   mm: unexport {,un}lock_page_memcg
 #
-AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
-LB_CHECK_COMPILE([if 'lock_page_memcg' is defined],
-lock_page_memcg, [
-       #include <linux/memcontrol.h>
-],[
-       lock_page_memcg(NULL);
-],[
-       AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1,
-               [lock_page_memcg is defined])
+AC_DEFUN([LC_SRC_LOCK_PAGE_MEMCG], [
+       LB2_LINUX_TEST_SRC([lock_page_memcg], [
+               #include <linux/memcontrol.h>
+       ],[
+               lock_page_memcg(NULL);
+       ],[-Werror])
 ])
+AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
+       AC_MSG_CHECKING([if 'lock_page_memcg' is defined])
+       LB2_LINUX_TEST_RESULT([lock_page_memcg], [
+               AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1, [lock_page_memcg is defined])
+       ])
 ]) # LC_LOCK_PAGE_MEMCG
 
 #
@@ -1678,19 +1833,24 @@ lock_page_memcg, [
 #
 # Kernel version v4.6-rc3-28-g916633a40370
 #
-AC_DEFUN([LC_HAVE_DOWN_WRITE_KILLABLE], [
-LB_CHECK_COMPILE([if down_write_killable exists],
-down_write_killable, [
-       struct rw_semaphore sem;
-       #include <linux/rwsem.h>
-],[
-       int rc;
+AC_DEFUN([LC_SRC_HAVE_DOWN_WRITE_KILLABLE], [
+       LB2_LINUX_TEST_SRC([down_write_killable], [
+               #include <linux/rwsem.h>
 
-       rc = down_write_killable(&sem);
-],[
-       AC_DEFINE(HAVE_DOWN_WRITE_KILLABLE, 1,
-               [down_write_killable function exists])
+               struct rw_semaphore sem;
+       ],[
+               int rc;
+
+               rc = down_write_killable(&sem);
+               (void)rc;
+       ])
 ])
+AC_DEFUN([LC_HAVE_DOWN_WRITE_KILLABLE], [
+       AC_MSG_CHECKING([if down_write_killable exists])
+       LB2_LINUX_TEST_RESULT([down_write_killable], [
+               AC_DEFINE(HAVE_DOWN_WRITE_KILLABLE, 1,
+                       [down_write_killable function exists])
+       ])
 ]) # LC_HAVE_DOWN_WRITE_KILLABLE
 
 #
@@ -1699,21 +1859,23 @@ down_write_killable, [
 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
 # direct-io: eliminate the offset argument to ->direct_IO
 #
-AC_DEFUN([LC_DIRECTIO_2ARGS], [
-LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
-direct_io_2args, [
-       #include <linux/fs.h>
-],[
-       struct address_space_operations ops = { };
-       struct iov_iter *iter = NULL;
-       struct kiocb *iocb = NULL;
-       int rc;
+AC_DEFUN([LC_SRC_DIRECTIO_2ARGS], [
+       LB2_LINUX_TEST_SRC([direct_io_2args], [
+               #include <linux/fs.h>
+       ],[
+               struct address_space_operations ops = { };
+               struct iov_iter *iter = NULL;
+               struct kiocb *iocb = NULL;
+               int rc;
 
-       rc = ops.direct_IO(iocb, iter);
-],[
-       AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
-               [direct_IO need 2 arguments])
+               rc = ops.direct_IO(iocb, iter);
+       ])
 ])
+AC_DEFUN([LC_DIRECTIO_2ARGS], [
+       AC_MSG_CHECKING([if '->direct_IO()' takes 2 arguments])
+       LB2_LINUX_TEST_RESULT([direct_io_2args], [
+               AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1, [direct_IO has 2 arguments])
+       ])
 ]) # LC_DIRECTIO_2ARGS
 
 #
@@ -1722,19 +1884,22 @@ direct_io_2args, [
 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
 # fs: add IOCB_SYNC and IOCB_DSYNC
 #
-AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
-LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
-generic_write_sync_2args, [
-       #include <linux/fs.h>
-],[
-       struct kiocb *iocb = NULL;
-       ssize_t rc;
+AC_DEFUN([LC_SRC_GENERIC_WRITE_SYNC_2ARGS], [
+       LB2_LINUX_TEST_SRC([generic_write_sync_2args], [
+               #include <linux/fs.h>
+       ],[
+               struct kiocb *iocb = NULL;
+               ssize_t rc;
 
-       rc = generic_write_sync(iocb, 0);
-],[
-       AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
-               [generic_write_sync need 2 arguments])
+               rc = generic_write_sync(iocb, 0);
+       ])
 ])
+AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
+       AC_MSG_CHECKING([if 'generic_write_sync()' takes 2 arguments])
+       LB2_LINUX_TEST_RESULT([generic_write_sync_2args], [
+               AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
+                       [generic_write_sync has 2 arguments])
+       ])
 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
 
 #
@@ -1742,17 +1907,20 @@ generic_write_sync_2args, [
 #
 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
 #
-AC_DEFUN([LC_FOP_ITERATE_SHARED], [
-LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'],
-fop_iterate_shared, [
-       #include <linux/fs.h>
-],[
-       struct file_operations fop;
-       fop.iterate_shared = NULL;
-],[
-       AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
-               [file_operations has iterate_shared])
+AC_DEFUN([LC_SRC_FOP_ITERATE_SHARED], [
+       LB2_LINUX_TEST_SRC([fop_iterate_shared], [
+               #include <linux/fs.h>
+       ],[
+               struct file_operations fop;
+               fop.iterate_shared = NULL;
+       ])
 ])
+AC_DEFUN([LC_FOP_ITERATE_SHARED], [
+       AC_MSG_CHECKING([if 'file_operations' has 'iterate_shared'])
+       LB2_LINUX_TEST_RESULT([fop_iterate_shared], [
+               AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
+                       [file_operations has iterate_shared])
+       ])
 ]) # LC_FOP_ITERATE_SHARED
 
 #
@@ -1773,17 +1941,20 @@ LB_CHECK_EXPORT([default_file_splice_read], [fs/splice.c],
 #
 # 4.8 posix_acl_valid takes struct user_namespace
 #
-AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
-LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
-posix_acl_valid, [
-       #include <linux/fs.h>
-       #include <linux/posix_acl.h>
-],[
-       posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
-],[
-       AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
-               [posix_acl_valid takes struct user_namespace])
+AC_DEFUN([LC_SRC_HAVE_POSIX_ACL_VALID_USER_NS], [
+       LB2_LINUX_TEST_SRC([posix_acl_valid], [
+               #include <linux/fs.h>
+               #include <linux/posix_acl.h>
+       ],[
+               posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
+       AC_MSG_CHECKING([if 'posix_acl_valid' takes 'struct user_namespace'])
+       LB2_LINUX_TEST_RESULT([posix_acl_valid], [
+               AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
+                       [posix_acl_valid takes struct user_namespace])
+       ])
 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
 
 #
@@ -1792,16 +1963,19 @@ posix_acl_valid, [
 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
 # get rid of 'parent' argument of ->d_compare()
 #
-AC_DEFUN([LC_D_COMPARE_4ARGS], [
-LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
-d_compare_4args, [
-       #include <linux/dcache.h>
-],[
-       ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
-],[
-       AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
-               [d_compare need 4 arguments])
+AC_DEFUN([LC_SRC_D_COMPARE_4ARGS], [
+       LB2_LINUX_TEST_SRC([d_compare_4args], [
+               #include <linux/dcache.h>
+       ],[
+               ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
+       ])
 ])
+AC_DEFUN([LC_D_COMPARE_4ARGS], [
+       AC_MSG_CHECKING([if 'd_compare' taken 4 arguments])
+       LB2_LINUX_TEST_RESULT([d_compare_4args], [
+               AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
+                       [d_compare need 4 arguments])
+       ])
 ]) # LC_D_COMPARE_4ARGS
 
 #
@@ -1810,17 +1984,20 @@ d_compare_4args, [
 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
 # vfs: make the string hashes salt the hash
 #
-AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
-LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
-full_name_hash_3args, [
-       #include <linux/stringhash.h>
-],[
-       unsigned int hash;
-       hash = full_name_hash(NULL,NULL,0);
-],[
-       AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
-               [full_name_hash need 3 arguments])
+AC_DEFUN([LC_SRC_FULL_NAME_HASH_3ARGS], [
+       LB2_LINUX_TEST_SRC([full_name_hash_3args], [
+               #include <linux/stringhash.h>
+       ],[
+               unsigned int hash;
+               hash = full_name_hash(NULL,NULL,0);
+       ])
 ])
+AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
+       AC_MSG_CHECKING([if 'full_name_hash' taken 3 arguments])
+       LB2_LINUX_TEST_RESULT([full_name_hash_3args], [
+               AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
+                       [full_name_hash need 3 arguments])
+       ])
 ]) # LC_FULL_NAME_HASH_3ARGS
 
 #
@@ -1829,19 +2006,22 @@ full_name_hash_3args, [
 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
 # posix_acl: xattr representation cleanups
 #
-AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
-LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
-struct_posix_acl_xattr, [
-       #include <linux/fs.h>
-       #include <linux/posix_acl_xattr.h>
-],[
-       struct posix_acl_xattr_header *h = NULL;
-       struct posix_acl_xattr_entry  *e;
-       e = (void *)(h + 1);
-],[
-       AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
-               [struct posix_acl_xattr_{header,entry} defined])
+AC_DEFUN([LC_SRC_STRUCT_POSIX_ACL_XATTR], [
+       LB2_LINUX_TEST_SRC([struct_posix_acl_xattr], [
+               #include <linux/fs.h>
+               #include <linux/posix_acl_xattr.h>
+       ],[
+               struct posix_acl_xattr_header *h = NULL;
+               struct posix_acl_xattr_entry  *e;
+               e = (void *)(h + 1);
+       ])
 ])
+AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
+       AC_MSG_CHECKING([if 'struct posix_acl_xattr_{header,entry}' defined])
+       LB2_LINUX_TEST_RESULT([struct_posix_acl_xattr], [
+               AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
+                       [struct posix_acl_xattr_{header,entry} defined])
+       ])
 ]) # LC_STRUCT_POSIX_ACL_XATTR
 
 #
@@ -1850,19 +2030,22 @@ struct_posix_acl_xattr, [
 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
 # removed {get,set,remove}xattr inode operations
 #
-AC_DEFUN([LC_IOP_XATTR], [
-LB_CHECK_COMPILE([if 'inode_operations' has {get,set,remove}xattr members],
-inode_ops_xattr, [
-       #include <linux/fs.h>
-],[
-       struct inode_operations iop;
-       iop.setxattr = NULL;
-       iop.getxattr = NULL;
-       iop.removexattr = NULL;
-],[
-       AC_DEFINE(HAVE_IOP_XATTR, 1,
-               [inode_operations has {get,set,remove}xattr members])
+AC_DEFUN([LC_SRC_IOP_XATTR], [
+       LB2_LINUX_TEST_SRC([inode_ops_xattr], [
+               #include <linux/fs.h>
+       ],[
+               struct inode_operations iop;
+               iop.setxattr = NULL;
+               iop.getxattr = NULL;
+               iop.removexattr = NULL;
+       ])
 ])
+AC_DEFUN([LC_IOP_XATTR], [
+       AC_MSG_CHECKING([if 'inode_operations' has {get,set,remove}xattr members])
+       LB2_LINUX_TEST_RESULT([inode_ops_xattr], [
+               AC_DEFINE(HAVE_IOP_XATTR, 1,
+                       [inode_operations has {get,set,remove}xattr members])
+       ])
 ]) # LC_IOP_XATTR
 
 #
@@ -1871,17 +2054,20 @@ inode_ops_xattr, [
 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
 # cred: simpler, 1D supplementary groups
 #
-AC_DEFUN([LC_GROUP_INFO_GID], [
-LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
-group_info_gid, [
-       #include <linux/cred.h>
-],[
-       kgid_t *p;
-       p = ((struct group_info *)0)->gid;
-],[
-       AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
-               [struct group_info has member gid])
+AC_DEFUN([LC_SRC_GROUP_INFO_GID], [
+       LB2_LINUX_TEST_SRC([group_info_gid], [
+               #include <linux/cred.h>
+       ],[
+               kgid_t *p;
+               p = ((struct group_info *)0)->gid;
+       ])
 ])
+AC_DEFUN([LC_GROUP_INFO_GID], [
+       AC_MSG_CHECKING([if 'struct group_info' has member 'gid'])
+       LB2_LINUX_TEST_RESULT([group_info_gid], [
+               AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
+                       [struct group_info has member gid])
+       ])
 ]) # LC_GROUP_INFO_GID
 
 #
@@ -1890,16 +2076,18 @@ group_info_gid, [
 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
 # added __vfs_{get,set,remove}xattr helpers
 #
-AC_DEFUN([LC_VFS_SETXATTR], [
-LB_CHECK_COMPILE([if '__vfs_setxattr' helper is available],
-vfs_setxattr, [
-       #include <linux/xattr.h>
-],[
-       __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_VFS_SETXATTR, 1,
-               ['__vfs_setxattr' is available])
+AC_DEFUN([LC_SRC_VFS_SETXATTR], [
+       LB2_LINUX_TEST_SRC([vfs_setxattr], [
+               #include <linux/xattr.h>
+       ],[
+               __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
+       ])
 ])
+AC_DEFUN([LC_VFS_SETXATTR], [
+       AC_MSG_CHECKING([if '__vfs_setxattr' helper is available])
+       LB2_LINUX_TEST_RESULT([vfs_setxattr], [
+               AC_DEFINE(HAVE_VFS_SETXATTR, 1, ['__vfs_setxattr' is available])
+       ])
 ]) # LC_VFS_SETXATTR
 
 #
@@ -1908,17 +2096,20 @@ vfs_setxattr, [
 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
 # posix_acl: Clear SGID bit when setting file permissions
 #
-AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
-LB_CHECK_COMPILE([if 'posix_acl_update_mode' exists],
-posix_acl_update_mode, [
-       #include <linux/fs.h>
-       #include <linux/posix_acl.h>
-],[
-       posix_acl_update_mode(NULL, NULL, NULL);
-],[
-       AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
-               ['posix_acl_update_mode' is available])
+AC_DEFUN([LC_SRC_POSIX_ACL_UPDATE_MODE], [
+       LB2_LINUX_TEST_SRC([posix_acl_update_mode], [
+               #include <linux/fs.h>
+               #include <linux/posix_acl.h>
+       ],[
+               posix_acl_update_mode(NULL, NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
+       AC_MSG_CHECKING([if 'posix_acl_update_mode' exists])
+       LB2_LINUX_TEST_RESULT([posix_acl_update_mode], [
+               AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
+                       ['posix_acl_update_mode' is available])
+       ])
 ]) # LC_POSIX_ACL_UPDATE_MODE
 
 #
@@ -1928,18 +2119,21 @@ posix_acl_update_mode, [
 # mm: don't cap request size based on read-ahead setting
 # This patch introduces a bdi hint, io_pages.
 #
-AC_DEFUN([LC_HAVE_BDI_IO_PAGES], [
-LB_CHECK_COMPILE([if 'struct backing_dev_info' has 'io_pages' field],
-bdi_has_io_pages, [
-       #include <linux/backing-dev.h>
-],[
-       struct backing_dev_info info;
+AC_DEFUN([LC_SRC_HAVE_BDI_IO_PAGES], [
+       LB2_LINUX_TEST_SRC([bdi_has_io_pages], [
+               #include <linux/backing-dev.h>
+       ],[
+               struct backing_dev_info info;
 
-       info.io_pages = 0;
-],[
-       AC_DEFINE(HAVE_BDI_IO_PAGES, 1,
-               [backing_dev_info has io_pages])
+               info.io_pages = 0;
+       ])
 ])
+AC_DEFUN([LC_HAVE_BDI_IO_PAGES], [
+       AC_MSG_CHECKING([if 'struct backing_dev_info' has 'io_pages' field])
+       LB2_LINUX_TEST_RESULT([bdi_has_io_pages], [
+               AC_DEFINE(HAVE_BDI_IO_PAGES, 1,
+                       [backing_dev_info has io_pages])
+       ])
 ]) # LC_HAVE_BDI_IO_PAGES
 
 #
@@ -1948,17 +2142,20 @@ bdi_has_io_pages, [
 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
 # removed generic_readlink from individual file systems
 #
-AC_DEFUN([LC_IOP_GENERIC_READLINK], [
-LB_CHECK_COMPILE([if 'generic_readlink' still exist],
-inode_ops_readlink, [
-       #include <linux/fs.h>
-],[
-       struct inode_operations iop;
-       iop.readlink = generic_readlink;
-],[
-       AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
-               [generic_readlink has been removed])
+AC_DEFUN([LC_SRC_IOP_GENERIC_READLINK], [
+       LB2_LINUX_TEST_SRC([inode_ops_readlink], [
+               #include <linux/fs.h>
+       ],[
+               struct inode_operations iop;
+               iop.readlink = generic_readlink;
+       ])
 ])
+AC_DEFUN([LC_IOP_GENERIC_READLINK], [
+       AC_MSG_CHECKING([if 'generic_readlink' still exist])
+       LB2_LINUX_TEST_RESULT([inode_ops_readlink], [
+               AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
+                       [generic_readlink has been removed])
+       ])
 ]) # LC_IOP_GENERIC_READLINK
 
 #
@@ -1967,17 +2164,21 @@ inode_ops_readlink, [
 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
 # removed virtual_address field. Need to use address field instead
 #
-AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
-LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field],
-vm_fault_address, [
-       #include <linux/mm.h>
-],[
-       unsigned long vaddr = ((struct vm_fault *)0)->address;
-       (void)vaddr;
-],[
-       AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
-               [virtual_address has been replaced by address field])
+AC_DEFUN([LC_SRC_HAVE_VM_FAULT_ADDRESS], [
+       LB2_LINUX_TEST_SRC([vm_fault_address], [
+               #include <linux/mm.h>
+       ],[
+               struct vm_fault vmf = { 0 };
+               unsigned long addr = (unsigned long)vmf.address;
+               (void)addr;
+       ])
 ])
+AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
+       AC_MSG_CHECKING([if 'struct vm_fault' replaced virtual_address with address field])
+       LB2_LINUX_TEST_RESULT([vm_fault_address], [
+               AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
+                       [virtual_address has been replaced by address field])
+       ])
 ]) # LC_HAVE_VM_FAULT_ADDRESS
 
 #
@@ -1986,18 +2187,21 @@ vm_fault_address, [
 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
 # expanded getattr to be able to get more stat information.
 #
-AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
-LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
-getattr_path, [
-       #include <linux/fs.h>
-],[
-       struct path path;
+AC_DEFUN([LC_SRC_INODEOPS_ENHANCED_GETATTR], [
+       LB2_LINUX_TEST_SRC([getattr_path], [
+               #include <linux/fs.h>
+       ],[
+               struct path path;
 
-       ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
-               [inode_operations .getattr member function can gather advance stats])
+               ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
+       ])
 ])
+AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
+       AC_MSG_CHECKING([if 'inode_operations' getattr member can gather advance stats])
+       LB2_LINUX_TEST_RESULT([getattr_path], [
+               AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
+                       [inode_operations .getattr member function can gather advance stats])
+       ])
 ]) # LC_INODEOPS_ENHANCED_GETATTR
 
 #
@@ -2008,19 +2212,22 @@ getattr_path, [
 # in the same kernel version struct vma_area_struct was folded into
 # struct vm_fault.
 #
-AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
-LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
-vm_operations_no_vm_area_struct, [
-       #include <linux/mm.h>
-],[
-       struct vm_fault vmf;
+AC_DEFUN([LC_SRC_VM_OPERATIONS_REMOVE_VMF_ARG], [
+       LB2_LINUX_TEST_SRC([vm_operations_no_vm_area_struct], [
+               #include <linux/mm.h>
+       ],[
+               struct vm_fault vmf;
 
-       ((struct vm_operations_struct *)0)->fault(&vmf);
-       ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
-],[
-       AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
-               ['struct vm_operations' remove struct vm_area_struct argument])
+               ((struct vm_operations_struct *)0)->fault(&vmf);
+               ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
+       ])
 ])
+AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
+       AC_MSG_CHECKING([if 'struct vm_operations' removed struct vm_area_struct])
+       LB2_LINUX_TEST_RESULT([vm_operations_no_vm_area_struct], [
+               AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
+                       ['struct vm_operations' remove struct vm_area_struct argument])
+       ])
 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
 
 #
@@ -2029,17 +2236,21 @@ vm_operations_no_vm_area_struct, [
 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
 # converted key.usage from atomic_t to refcount_t.
 #
-AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
-LB_CHECK_COMPILE([if 'key.usage' is refcount_t],
-key_usage_refcount, [
-       #include <linux/key.h>
-],[
-       struct key key = { };
+AC_DEFUN([LC_SRC_HAVE_KEY_USAGE_REFCOUNT], [
+       LB2_LINUX_TEST_SRC([key_usage_refcount], [
+               #include <linux/key.h>
+       ],[
+               struct key key = { };
 
-       refcount_read(&key.usage);
-],[
-       AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1, [key.usage is of type refcount_t])
+               refcount_read(&key.usage);
+       ])
 ])
+AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
+       AC_MSG_CHECKING([if 'key.usage' is refcount_t])
+       LB2_LINUX_TEST_RESULT([key_usage_refcount], [
+               AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1,
+                       [key.usage is of type refcount_t])
+       ])
 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
 
 #
@@ -2048,18 +2259,21 @@ key_usage_refcount, [
 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
 #
-AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
-LB_CHECK_COMPILE([if 'CRYPTO_MAX_ALG_NAME' is 128],
-crypto_max_alg_name, [
-       #include <linux/crypto.h>
-],[
-       #if CRYPTO_MAX_ALG_NAME != 128
-       exit(1);
-       #endif
-],[
-       AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
-               ['CRYPTO_MAX_ALG_NAME' is 128])
+AC_DEFUN([LC_SRC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
+       LB2_LINUX_TEST_SRC([crypto_max_alg_name], [
+               #include <linux/crypto.h>
+       ],[
+               #if CRYPTO_MAX_ALG_NAME != 128
+               exit(1);
+               #endif
+       ])
 ])
+AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
+       AC_MSG_CHECKING([if 'CRYPTO_MAX_ALG_NAME' is 128])
+       LB2_LINUX_TEST_RESULT([crypto_max_alg_name], [
+               AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
+                       ['CRYPTO_MAX_ALG_NAME' is 128])
+       ])
 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
 
 #
@@ -2088,18 +2302,21 @@ cdev_device_add, [
 # CURRENT_TIME is not 64 bit time safe so it was replaced with
 # current_time()
 #
-AC_DEFUN([LC_CURRENT_TIME], [
-LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
-current_time, [
-       #include <linux/fs.h>
-],[
-       struct iattr attr;
+AC_DEFUN([LC_SRC_CURRENT_TIME], [
+       LB2_LINUX_TEST_SRC([current_time], [
+               #include <linux/fs.h>
+       ],[
+               struct iattr attr;
 
-       attr.ia_atime = current_time(NULL);
-],[
-       AC_DEFINE(HAVE_CURRENT_TIME, 1,
-               [current_time() has replaced CURRENT_TIME])
+               attr.ia_atime = current_time(NULL);
+       ])
 ])
+AC_DEFUN([LC_CURRENT_TIME], [
+       AC_MSG_CHECKING([if CURRENT_TIME has been replaced with current_time])
+       LB2_LINUX_TEST_RESULT([current_time], [
+               AC_DEFINE(HAVE_CURRENT_TIME, 1,
+                       [current_time() has replaced CURRENT_TIME])
+       ])
 ]) # LIBCFS_CURRENT_TIME
 
 #
@@ -2107,37 +2324,42 @@ current_time, [
 #
 # Kernel version v4.12-rc2-43-g7a9ca53aea10
 #
-AC_DEFUN([LC_HAVE_GET_INODE_USAGE], [
-LB_CHECK_COMPILE([if get_inode_usage exists],
-get_inode_usage, [
-       struct inode;
-       #include <linux/quota.h>
-],[
-       struct dquot_operations ops = { };
+AC_DEFUN([LC_SRC_HAVE_GET_INODE_USAGE], [
+       LB2_LINUX_TEST_SRC([get_inode_usage], [
+               struct inode;
+               #include <linux/quota.h>
+       ],[
+               struct dquot_operations ops = { };
 
-       ops.get_inode_usage(NULL, NULL);
-],[
-       AC_DEFINE(HAVE_GET_INODE_USAGE, 1,
-               [get_inode_usage function exists])
+               ops.get_inode_usage(NULL, NULL);
+       ])
 ])
+AC_DEFUN([LC_HAVE_GET_INODE_USAGE], [
+       AC_MSG_CHECKING([if get_inode_usage exists])
+       LB2_LINUX_TEST_RESULT([get_inode_usage], [
+               AC_DEFINE(HAVE_GET_INODE_USAGE, 1,
+                       [get_inode_usage function exists])
+       ])
 ]) # LC_HAVE_GET_INODE_USAGE
 
-
 #
 # Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
 # changed struct super_block s_uuid into a proper uuid_t
 #
-AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
-LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
-super_block_s_uuid, [
-       #include <linux/fs.h>
-],[
-       struct super_block sb;
+AC_DEFUN([LC_SRC_SUPER_BLOCK_S_UUID], [
+       LB2_LINUX_TEST_SRC([super_block_s_uuid], [
+               #include <linux/fs.h>
+       ],[
+               struct super_block sb;
 
-       uuid_parse(NULL, &sb.s_uuid);
-],[
-       AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
+               uuid_parse(NULL, &sb.s_uuid);
+       ])
 ])
+AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
+       AC_MSG_CHECKING([if 'struct super_block' s_uuid is uuid_t])
+       LB2_LINUX_TEST_RESULT([super_block_s_uuid], [
+               AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
+       ])
 ]) # LC_SUPER_BLOCK_S_UUID
 
 #
@@ -2146,16 +2368,19 @@ super_block_s_uuid, [
 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
 # unified bdi handling
 #
-AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
-LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
-super_setup_bdi_name, [
-       #include <linux/fs.h>
-],[
-       super_setup_bdi_name(NULL, "lustre");
-],[
-       AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
-               ['super_setup_bdi_name' is available])
+AC_DEFUN([LC_SRC_SUPER_SETUP_BDI_NAME], [
+       LB2_LINUX_TEST_SRC([super_setup_bdi_name], [
+               #include <linux/fs.h>
+       ],[
+               super_setup_bdi_name(NULL, "lustre");
+       ])
 ])
+AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
+       AC_MSG_CHECKING([if 'super_setup_bdi_name' exist])
+       LB2_LINUX_TEST_RESULT([super_setup_bdi_name], [
+               AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
+                       ['super_setup_bdi_name' is available])
+       ])
 ]) # LC_SUPER_SETUP_BDI_NAME
 
 #
@@ -2163,16 +2388,18 @@ super_setup_bdi_name, [
 #
 # 4.12 replace bi_error to bi_status
 #
-AC_DEFUN([LC_BI_STATUS], [
-LB_CHECK_COMPILE([if 'bi_status' exist],
-bi_status, [
-       #include <linux/blk_types.h>
-],[
-       ((struct bio *)0)->bi_status = 0;
-],[
-       AC_DEFINE(HAVE_BI_STATUS, 1,
-               ['bi_status' is available])
+AC_DEFUN([LC_SRC_BI_STATUS], [
+       LB2_LINUX_TEST_SRC([bi_status], [
+               #include <linux/blk_types.h>
+       ],[
+               ((struct bio *)0)->bi_status = 0;
+       ])
 ])
+AC_DEFUN([LC_BI_STATUS], [
+       AC_MSG_CHECKING([if 'bi_status' exist])
+       LB2_LINUX_TEST_RESULT([bi_status], [
+               AC_DEFINE(HAVE_BI_STATUS, 1, ['bi_status' is available])
+       ])
 ]) # LC_BI_STATUS
 
 #
@@ -2180,16 +2407,19 @@ bi_status, [
 #
 # 4.13 removed bio_integrity_enabled
 #
-AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
-LB_CHECK_COMPILE([if 'bio_integrity_enabled' exist],
-bio_integrity_enabled, [
-       #include <linux/bio.h>
-],[
-       bio_integrity_enabled(NULL);
-],[
-       AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
-               ['bio_integrity_enabled' is available])
+AC_DEFUN([LC_SRC_BIO_INTEGRITY_ENABLED], [
+       LB2_LINUX_TEST_SRC([bio_integrity_enabled], [
+               #include <linux/bio.h>
+       ],[
+               bio_integrity_enabled(NULL);
+       ])
 ])
+AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
+       AC_MSG_CHECKING([if 'bio_integrity_enabled' exist])
+       LB2_LINUX_TEST_RESULT([bio_integrity_enabled], [
+               AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
+                       ['bio_integrity_enabled' is available])
+       ])
 ]) # LC_BIO_INTEGRITY_ENABLED
 
 #
@@ -2197,16 +2427,19 @@ bio_integrity_enabled, [
 #
 # 4.14 pagevec_init takes one parameter
 #
-AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
-LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter],
-pagevec_init, [
-       #include <linux/pagevec.h>
-],[
-       pagevec_init(NULL);
-],[
-       AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
-               ['pagevec_init' takes one parameter])
+AC_DEFUN([LC_SRC_PAGEVEC_INIT_ONE_PARAM], [
+       LB2_LINUX_TEST_SRC([pagevec_init], [
+               #include <linux/pagevec.h>
+       ],[
+               pagevec_init(NULL);
+       ])
 ])
+AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
+       AC_MSG_CHECKING([if 'pagevec_init' takes one parameter])
+       LB2_LINUX_TEST_RESULT([pagevec_init], [
+               AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
+                       ['pagevec_init' takes one parameter])
+       ])
 ]) # LC_PAGEVEC_INIT_ONE_PARAM
 
 #
@@ -2231,16 +2464,18 @@ pagevec_lookup, [
 #
 # 4.14 replaced bi_bdev to bi_disk
 #
-AC_DEFUN([LC_BI_BDEV], [
-LB_CHECK_COMPILE([if 'bi_bdev' exist],
-bi_bdev, [
-       #include <linux/bio.h>
-],[
-       ((struct bio *)0)->bi_bdev = NULL;
-],[
-       AC_DEFINE(HAVE_BI_BDEV, 1,
-               ['bi_bdev' is available])
+AC_DEFUN([LC_SRC_BI_BDEV], [
+       LB2_LINUX_TEST_SRC([bi_bdev], [
+               #include <linux/bio.h>
+       ],[
+               ((struct bio *)0)->bi_bdev = NULL;
+       ])
 ])
+AC_DEFUN([LC_BI_BDEV], [
+       AC_MSG_CHECKING([if 'bi_bdev' exist])
+       LB2_LINUX_TEST_RESULT([bi_bdev], [
+               AC_DEFINE(HAVE_BI_BDEV, 1, ['bi_bdev' is available])
+       ])
 ]) # LC_BI_BDEV
 
 #
@@ -2257,26 +2492,28 @@ is_encrypted, [
 ],[
        has_is_encrypted="yes"
 ])
-]) # LC_IS_ENCRYPTED
+]) # LC_IS_ENCRYPTED used by LC_CONFIG_CRYPTO
 
 #
 # LC_I_PAGES
 #
 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
 #
-AC_DEFUN([LC_I_PAGES], [
-LB_CHECK_COMPILE([if struct address_space has i_pages],
-i_pages, [
-       #include <linux/fs.h>
-],[
-       struct address_space mapping = {};
-       void *i_pages;
+AC_DEFUN([LC_SRC_I_PAGES], [
+       LB2_LINUX_TEST_SRC([i_pages], [
+               #include <linux/fs.h>
+       ],[
+               struct address_space mapping = {};
+               void *i_pages;
 
-       i_pages = &mapping.i_pages;
-],[
-       AC_DEFINE(HAVE_I_PAGES, 1,
-               [struct address_space has i_pages])
+               i_pages = &mapping.i_pages;
+       ])
 ])
+AC_DEFUN([LC_I_PAGES], [
+       AC_MSG_CHECKING([if struct address_space has i_pages])
+       LB2_LINUX_TEST_RESULT([i_pages], [
+               AC_DEFINE(HAVE_I_PAGES, 1, [struct address_space has i_pages])
+       ])
 ]) # LC_I_PAGES
 
 #
@@ -2285,17 +2522,19 @@ i_pages, [
 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
 # mm: create the new vm_fault_t type
 #
-AC_DEFUN([LC_VM_FAULT_T], [
-LB_CHECK_COMPILE([if vm_fault_t type exists],
-vm_fault_t, [
-       #include <linux/mm_types.h>
-],[
-       vm_fault_t x = VM_FAULT_SIGBUS;
-       (void)x
-],[
-       AC_DEFINE(HAVE_VM_FAULT_T, 1,
-               [if vm_fault_t type exists])
+AC_DEFUN([LC_SRC_VM_FAULT_T], [
+       LB2_LINUX_TEST_SRC([vm_fault_t], [
+               #include <linux/mm_types.h>
+       ],[
+               vm_fault_t x = VM_FAULT_SIGBUS;
+               (void)x
+       ])
 ])
+AC_DEFUN([LC_VM_FAULT_T], [
+       AC_MSG_CHECKING([if vm_fault_t type exists])
+       LB2_LINUX_TEST_RESULT([vm_fault_t], [
+               AC_DEFINE(HAVE_VM_FAULT_T, 1, [if vm_fault_t type exists])
+       ])
 ]) # LC_VM_FAULT_T
 
 #
@@ -2304,19 +2543,22 @@ vm_fault_t, [
 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
 # mm: VM_FAULT_RETRY is defined in enum vm_fault_reason
 #
-AC_DEFUN([LC_VM_FAULT_RETRY], [
-LB_CHECK_COMPILE([if VM_FAULT_RETRY is defined],
-VM_FAULT_RETRY, [
-       #include <linux/mm.h>
-],[
-       #ifndef VM_FAULT_RETRY
-               vm_fault_t x;
-               x = VM_FAULT_RETRY;
-       #endif
-],[
-       AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
-               [if VM_FAULT_RETRY is defined])
+AC_DEFUN([LC_SRC_VM_FAULT_RETRY], [
+       LB2_LINUX_TEST_SRC([VM_FAULT_RETRY], [
+               #include <linux/mm.h>
+       ],[
+               #ifndef VM_FAULT_RETRY
+                       vm_fault_t x;
+                       x = VM_FAULT_RETRY;
+               #endif
+       ])
 ])
+AC_DEFUN([LC_VM_FAULT_RETRY], [
+       AC_MSG_CHECKING([if VM_FAULT_RETRY is defined])
+       LB2_LINUX_TEST_RESULT([VM_FAULT_RETRY], [
+               AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
+                       [if VM_FAULT_RETRY is defined])
+       ])
 ]) # LC_VM_FAULT_RETRY
 
 #
@@ -2325,18 +2567,21 @@ VM_FAULT_RETRY, [
 # kernel 4.18-rc1 commit d93aa9d82aea80b80f225dbf9c7986df444d8106
 # new wrapper: alloc_file_pseudo()
 #
-AC_DEFUN([LC_ALLOC_FILE_PSEUDO], [
-LB_CHECK_COMPILE([if 'alloc_file_pseudo' is defined],
-alloc_file_pseudo, [
-       #include <linux/file.h>
-],[
-       struct file *file;
-       file = alloc_file_pseudo(NULL, NULL, "[test]",
-                                00000002, NULL);
-],[
-       AC_DEFINE(HAVE_ALLOC_FILE_PSEUDO, 1,
-               ['alloc_file_pseudo' exist])
+AC_DEFUN([LC_SRC_ALLOC_FILE_PSEUDO], [
+       LB2_LINUX_TEST_SRC([alloc_file_pseudo], [
+               #include <linux/file.h>
+       ],[
+               struct file *file;
+               file = alloc_file_pseudo(NULL, NULL, "[test]",
+                                        00000002, NULL);
+       ])
 ])
+AC_DEFUN([LC_ALLOC_FILE_PSEUDO], [
+       AC_MSG_CHECKING([if 'alloc_file_pseudo' is defined])
+       LB2_LINUX_TEST_RESULT([alloc_file_pseudo], [
+               AC_DEFINE(HAVE_ALLOC_FILE_PSEUDO, 1,
+                       ['alloc_file_pseudo' exist])
+       ])
 ]) # LC_ALLOC_FILE_PSEUDO
 
 #
@@ -2357,46 +2602,46 @@ alloc_file_pseudo, [
 # kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
 # fs: Delete timespec64_trunc()
 #
-AC_DEFUN([LC_INODE_TIMESPEC64], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
-inode_timespec64, [
-       #include <linux/fs.h>
-],[
-       struct inode *inode = NULL;
-       struct timespec64 ts = {0, 1};
+AC_DEFUN([LC_SRC_INODE_TIMESPEC64], [
+       LB2_LINUX_TEST_SRC([inode_timespec64], [
+               #include <linux/fs.h>
+       ],[
+               struct inode *inode = NULL;
+               struct timespec64 ts = {0, 1};
 
-       inode->i_atime = ts;
-       (void)inode;
-],[
-       AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
-               [inode times are using timespec64])
+               inode->i_atime = ts;
+               (void)inode;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_INODE_TIMESPEC64], [
+       AC_MSG_CHECKING([if inode timestamps are struct timespec64])
+       LB2_LINUX_TEST_RESULT([inode_timespec64], [
+               AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
+                       [inode times are using timespec64])
+       ])
 ]) # LC_INODE_TIMESPEC64
 
 #
-# LC___XA_SET_MARK
+# LC_RADIX_TREE_TAG_SET
 #
 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
 # xarray: Add XArray marks - replaced radix_tree_tag_set
 #
-AC_DEFUN([LC___XA_SET_MARK], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if '__xa_set_mark' exists],
-__xa_set_mark, [
-       #include <linux/fs.h>
-       #include <linux/radix-tree.h>
-],[
-       radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
-],[
-       AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
-               [__xa_set_mark exists])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-]) # LC___XA_SET_MARK
+AC_DEFUN([LC_SRC_RADIX_TREE_TAG_SET], [
+       LB2_LINUX_TEST_SRC([radix_tree_tag_set], [
+               #include <linux/fs.h>
+               #include <linux/radix-tree.h>
+       ],[
+               radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
+       ],[-Werror])
+])
+AC_DEFUN([LC_RADIX_TREE_TAG_SET], [
+       AC_MSG_CHECKING([if 'radix_tree_tag_set' exists])
+       LB2_LINUX_TEST_RESULT([radix_tree_tag_set], [
+               AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
+                       [radix_tree_tag_set exists])
+       ])
+]) # LC_RADIX_TREE_TAG_SET
 
 #
 # LC_UAPI_LINUX_MOUNT_H
@@ -2404,20 +2649,20 @@ EXTRA_KCFLAGS="$tmp_flags"
 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
 # vfs: Suppress MS_* flag defs within the kernel ...
 #
-AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if MS_RDONLY was moved to uapi/linux/mount.h],
-uapi_linux_mount, [
-       #include <uapi/linux/mount.h>
-],[
-       int x = MS_RDONLY;
-       (void)x;
-],[
-       AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
-               [if MS_RDONLY was moved to uapi/linux/mount.h])
+AC_DEFUN([LC_SRC_UAPI_LINUX_MOUNT_H], [
+       LB2_LINUX_TEST_SRC([uapi_linux_mount], [
+               #include <uapi/linux/mount.h>
+       ],[
+               int x = MS_RDONLY;
+               (void)x;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
+       AC_MSG_CHECKING([if MS_RDONLY was moved to uapi/linux/mount.h])
+       LB2_LINUX_TEST_RESULT([uapi_linux_mount], [
+               AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
+                       [if MS_RDONLY was moved to uapi/linux/mount.h])
+       ])
 ]) # LC_UAPI_LINUX_MOUNT_H
 
 #
@@ -2429,43 +2674,43 @@ EXTRA_KCFLAGS="$tmp_flags"
 # Now that the reader functions are all RCU protected, use a regular
 # spinlock rather than a reader/writer lock.
 #
-AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if cache_detail->hash_lock is a spinlock],
-hash_lock_isa_spinlock_t, [
-       #include <linux/sunrpc/cache.h>
-],[
-       spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
-       spin_lock(lock);
-],[
-       AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
-               [if cache_detail->hash_lock is a spinlock])
+AC_DEFUN([LC_SRC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
+       LB2_LINUX_TEST_SRC([hash_lock_isa_spinlock_t], [
+               #include <linux/sunrpc/cache.h>
+       ],[
+               spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
+               spin_lock(lock);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
+       AC_MSG_CHECKING([if cache_detail->hash_lock is a spinlock])
+       LB2_LINUX_TEST_RESULT([hash_lock_isa_spinlock_t], [
+               AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
+                       [if cache_detail->hash_lock is a spinlock])
+       ])
 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
 
 #
-# LB_HAVE_BVEC_ITER_ALL
+# LC_HAVE_BVEC_ITER_ALL
 #
 # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
 # block: allow bio_for_each_segment_all() to iterate over multi-page bvec
 #
-AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
-ext4fs_dirhash, [
-       #include <linux/bvec.h>
-],[
-       struct bvec_iter_all iter;
-       (void)iter;
-],[
-       AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
-               [if bvec_iter_all exists for multi-page bvec iternation])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-]) # LB_HAVE_BVEC_ITER_ALL
+AC_DEFUN([LC_SRC_HAVE_BVEC_ITER_ALL], [
+       LB2_LINUX_TEST_SRC([struct_bvec_iter_all], [
+               #include <linux/bvec.h>
+       ],[
+               struct bvec_iter_all iter;
+               (void)iter;
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_BVEC_ITER_ALL], [
+       AC_MSG_CHECKING([if bvec_iter_all exists for multi-page bvec iternation])
+       LB2_LINUX_TEST_RESULT([struct_bvec_iter_all], [
+               AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
+                       [if bvec_iter_all exists for multi-page bvec iternation])
+       ])
+]) # LC_HAVE_BVEC_ITER_ALL
 
 #
 # LC_ACCOUNT_PAGE_DIRTIED
@@ -2484,17 +2729,20 @@ LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
 # Kernel 5.2 commit dcf49dbc8077
 # keys: Add a 'recurse' flag for keyring searches
 #
-AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
-LB_CHECK_COMPILE([if 'keyring_search' has 4 args],
-keyring_search_4args, [
-       #include <linux/key.h>
-],[
-       key_ref_t keyring;
-       keyring_search(keyring, NULL, NULL, false);
-],[
-       AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
-               [keyring_search has 4 args])
+AC_DEFUN([LC_SRC_KEYRING_SEARCH_4ARGS], [
+       LB2_LINUX_TEST_SRC([keyring_search_4args], [
+               #include <linux/key.h>
+       ],[
+               key_ref_t keyring;
+               keyring_search(keyring, NULL, NULL, false);
+       ])
 ])
+AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
+       AC_MSG_CHECKING([if 'keyring_search' has 4 args])
+       LB2_LINUX_TEST_RESULT([keyring_search_4args], [
+               AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
+                       [keyring_search has 4 args])
+       ])
 ]) # LC_KEYRING_SEARCH_4ARGS
 
 #
@@ -2503,20 +2751,20 @@ keyring_search_4args, [
 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
 # block: remove the bi_phys_segments field in struct bio
 #
-AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if struct bio has bi_phys_segments member],
-bye_bio_bi_phys_segments, [
-       #include <linux/bio.h>
-],[
-       struct bio *bio = NULL;
-       bio->bi_phys_segments++;
-],[
-       AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
-               [struct bio has bi_phys_segments member])
+AC_DEFUN([LC_SRC_BIO_BI_PHYS_SEGMENTS], [
+       LB2_LINUX_TEST_SRC([bye_bio_bi_phys_segments], [
+               #include <linux/bio.h>
+       ],[
+               struct bio *bio = NULL;
+               bio->bi_phys_segments++;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
+       AC_MSG_CHECKING([if struct bio has bi_phys_segments member])
+       LB2_LINUX_TEST_RESULT([bye_bio_bi_phys_segments], [
+               AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
+                       [struct bio has bi_phys_segments member])
+       ])
 ]) # LC_BIO_BI_PHYS_SEGMENTS
 
 #
@@ -2526,20 +2774,20 @@ EXTRA_KCFLAGS="$tmp_flags"
 # locks: Cleanup lm_compare_owner and lm_owner_key
 # removed lm_compare_owner
 #
-AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
-lock_manager_ops_lm_compare_owner, [
-       #include <linux/fs.h>
-],[
-       struct lock_manager_operations lm_ops;
-       lm_ops.lm_compare_owner = NULL;
-],[
-       AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
-               [lock_manager_operations has lm_compare_owner])
+AC_DEFUN([LC_SRC_LM_COMPARE_OWNER_EXISTS], [
+       LB2_LINUX_TEST_SRC([lock_manager_ops_lm_compare_owner], [
+               #include <linux/fs.h>
+       ],[
+               struct lock_manager_operations lm_ops;
+               lm_ops.lm_compare_owner = NULL;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
+       AC_MSG_CHECKING([if lock_manager_operations has lm_compare_owner])
+       LB2_LINUX_TEST_RESULT([lock_manager_ops_lm_compare_owner], [
+               AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
+                       [lock_manager_operations has lm_compare_owner])
+       ])
 ]) # LC_LM_COMPARE_OWNER_EXISTS
 
 #
@@ -2571,19 +2819,19 @@ EXTRA_KCFLAGS="$tmp_flags"
 # Linux commit v5.9-rc1-6-g36e2c7421f02
 #  fs: don't allow splice read/write without explicit ops
 #
-AC_DEFUN([LC_HAVE_ITER_FILE_SPLICE_WRITE], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'iter_file_splice_write' exists],
-iter_file_splice_write, [
-       #include <linux/fs.h>
-],[
-       (void)iter_file_splice_write(NULL, NULL, NULL, 1, 0);
-],[
-       AC_DEFINE(HAVE_ITER_FILE_SPLICE_WRITE, 1,
-               ['iter_file_splice_write' exists])
+AC_DEFUN([LC_SRC_HAVE_ITER_FILE_SPLICE_WRITE], [
+       LB2_LINUX_TEST_SRC([iter_file_splice_write], [
+               #include <linux/fs.h>
+       ],[
+               (void)iter_file_splice_write(NULL, NULL, NULL, 1, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_ITER_FILE_SPLICE_WRITE], [
+       AC_MSG_CHECKING([if iter_file_splice_write() exists])
+       LB2_LINUX_TEST_RESULT([iter_file_splice_write], [
+               AC_DEFINE(HAVE_ITER_FILE_SPLICE_WRITE, 1,
+                       ['iter_file_splice_write' exists])
+       ])
 ]) # LC_HAVE_ITER_FILE_SPLICE_WRITE
 
 #
@@ -2601,7 +2849,7 @@ fscrypt_support, [
 ],[
        has_fscrypt_support="yes"
 ])
-]) # LC_FSCRYPT_SUPPORT
+]) # LC_FSCRYPT_SUPPORT used by LC_CONFIG_CRYPTO
 
 #
 # LC_HAVE_USER_NAMESPACE_ARG
@@ -2610,20 +2858,20 @@ fscrypt_support, [
 # fs: make helpers idmap mount aware
 # Extend some inode methods with an additional user namespace argument.
 #
-AC_DEFUN([LC_HAVE_USER_NAMESPACE_ARG], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'inode_operations' members have user namespace argument],
-user_namespace_argument, [
-       #include <linux/fs.h>
-],[
-       ((struct inode_operations *)1)->getattr((struct user_namespace *)NULL,
-                                               NULL, NULL, 0, 0);
-],[
-       AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1,
-               ['inode_operations' members have user namespace argument])
+AC_DEFUN([LC_SRC_HAVE_USER_NAMESPACE_ARG], [
+       LB2_LINUX_TEST_SRC([inode_ops_has_user_namespace_argument], [
+               #include <linux/fs.h>
+       ],[
+               ((struct inode_operations *)1)->getattr((struct user_namespace *)NULL,
+                                                       NULL, NULL, 0, 0);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_USER_NAMESPACE_ARG], [
+       AC_MSG_CHECKING([if 'inode_operations' members have user namespace argument])
+       LB2_LINUX_TEST_RESULT([inode_ops_has_user_namespace_argument], [
+               AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1,
+                       ['inode_operations' members have user namespace argument])
+       ])
 ]) # LC_HAVE_USER_NAMESPACE_ARG
 
 #
@@ -2656,19 +2904,19 @@ EXTRA_KCFLAGS="$tmp_flags"
 # Add a rcu argument to the ->get_acl() callback to allow
 # get_cached_acl_rcu() to call the ->get_acl() method.
 #
-AC_DEFUN([LC_HAVE_GET_ACL_RCU_ARG], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if 'get_acl' has a rcu argument],
-get_acl_rcu_argument, [
-       #include <linux/fs.h>
-],[
-       ((struct inode_operations *)1)->get_acl((struct inode *)NULL, 0, false);
-],[
-       AC_DEFINE(HAVE_GET_ACL_RCU_ARG, 1,
-               ['get_acl' has a rcu argument])
+AC_DEFUN([LC_SRC_HAVE_GET_ACL_RCU_ARG], [
+       LB2_LINUX_TEST_SRC([get_acl_rcu_argument], [
+               #include <linux/fs.h>
+       ],[
+               ((struct inode_operations *)1)->get_acl((struct inode *)NULL, 0, false);
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_GET_ACL_RCU_ARG], [
+       AC_MSG_CHECKING([if 'get_acl' has a rcu argument])
+       LB2_LINUX_TEST_RESULT([get_acl_rcu_argument], [
+               AC_DEFINE(HAVE_GET_ACL_RCU_ARG, 1,
+                       ['get_acl' has a rcu argument])
+       ])
 ]) # LC_HAVE_GET_ACL_RCU_ARG
 
 #
@@ -2677,28 +2925,28 @@ EXTRA_KCFLAGS="$tmp_flags"
 # Linux v5.15-rc1-20-g15bf32398ad4
 # security: Return xattr name from security_dentry_init_security()
 #
-AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if security_dentry_init_security() returns xattr name],
-security_dentry_init_security_xattr_name_arg, [
-       #include <linux/security.h>
-],[
-       struct dentry *dentry = NULL;
-       int mode = 0;
-       const struct qstr *name = NULL;
-       const char *xattr_name = NULL;
-       void **ctx = NULL;
-       u32 *ctxlen = 0;
-       int rc = security_dentry_init_security(dentry, mode, name, &xattr_name,
-                                              ctx, ctxlen);
-       (void)rc;
-
-],[
-       AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG, 1,
-               [security_dentry_init_security() returns xattr name])
+AC_DEFUN([LC_SRC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG], [
+       LB2_LINUX_TEST_SRC([security_dentry_init_security_xattr_name_arg], [
+               #include <linux/security.h>
+       ],[
+               struct dentry *dentry = NULL;
+               int mode = 0;
+               const struct qstr *name = NULL;
+               const char *xattr_name = NULL;
+               void **ctx = NULL;
+               u32 *ctxlen = 0;
+               int rc = security_dentry_init_security(dentry, mode, name, &xattr_name,
+                                                      ctx, ctxlen);
+               (void)rc;
+
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG], [
+       AC_MSG_CHECKING([if security_dentry_init_security() returns xattr name])
+       LB2_LINUX_TEST_RESULT([security_dentry_init_security_xattr_name_arg], [
+               AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG, 1,
+                       [security_dentry_init_security() returns xattr name])
+       ])
 ]) # LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
 
 #
@@ -2707,27 +2955,27 @@ EXTRA_KCFLAGS="$tmp_flags"
 # kernel v5.15-rc6-145-g6b19b766e8f0
 # fs: get rid of the res2 iocb->ki_complete argument
 #
-AC_DEFUN([LC_HAVE_KIOCB_COMPLETE_2ARGS], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if kiocb->ki_complete() has 2 arguments],
-kiocb_ki_complete_2args, [
-       #include <linux/fs.h>
+AC_DEFUN([LC_SRC_HAVE_KIOCB_COMPLETE_2ARGS], [
+       LB2_LINUX_TEST_SRC([kiocb_ki_complete_2args], [
+               #include <linux/fs.h>
 
-       static void complete_fn(struct kiocb *iocb, long ret)
-       {
-               (void)iocb;
-               (void)ret;
-       }
-],[
-       struct kiocb *kio = NULL;
+               static void complete_fn(struct kiocb *iocb, long ret)
+               {
+                       (void)iocb;
+                       (void)ret;
+               }
+       ],[
+               struct kiocb *kio = NULL;
 
-       kio->ki_complete = complete_fn;
-],[
-       AC_DEFINE(HAVE_KIOCB_COMPLETE_2ARGS, 1,
-               [kiocb->ki_complete() has 2 arguments])
+               kio->ki_complete = complete_fn;
+       ],[-Werror])
 ])
-EXTRA_KCFLAGS="$tmp_flags"
+AC_DEFUN([LC_HAVE_KIOCB_COMPLETE_2ARGS], [
+       AC_MSG_CHECKING([if kiocb->ki_complete() has 2 arguments])
+       LB2_LINUX_TEST_RESULT([kiocb_ki_complete_2args], [
+               AC_DEFINE(HAVE_KIOCB_COMPLETE_2ARGS, 1,
+                       [kiocb->ki_complete() has 2 arguments])
+       ])
 ]) # LC_HAVE_KIOCB_COMPLETE_2ARGS
 
 #
@@ -2750,21 +2998,22 @@ LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
 # linux commit v5.17-rc4-10-g128d1f8241d6
 # fs: Add invalidate_folio() aops method
 #
-AC_DEFUN([LC_HAVE_INVALIDATE_FOLIO], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if have address_spaace_operaions->invalidate_folio() member],
-address_spaace_operaions_invalidate_folio, [
+AC_DEFUN([LC_SRC_HAVE_INVALIDATE_FOLIO], [
+       LB2_LINUX_TEST_SRC([address_spaace_operaions_invalidate_folio], [
                #include <linux/fs.h>
        ],[
                struct address_space_operations *aops = NULL;
                struct folio *folio = NULL;
                aops->invalidate_folio(folio, 0, PAGE_SIZE);
-       ],[
+
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_INVALIDATE_FOLIO], [
+       AC_MSG_CHECKING([if have address_spaace_operaions->invalidate_folio() member])
+       LB2_LINUX_TEST_RESULT([address_spaace_operaions_invalidate_folio], [
                AC_DEFINE(HAVE_INVALIDATE_FOLIO, 1,
                        [address_spaace_operaions->invalidate_folio() member exists])
        ])
-EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAVE_INVALIDATE_FOLIO
 
 #
@@ -2774,11 +3023,8 @@ EXTRA_KCFLAGS="$tmp_flags"
 # fs: Add aops->dirty_folio
 # ... replaces ->set_page_dirty() with ->dirty_folio()
 #
-AC_DEFUN([LC_HAVE_DIRTY_FOLIO], [
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_CHECK_COMPILE([if have address_spaace_operaions->dirty_folio() member],
-address_spaace_operaions_dirty_folio, [
+AC_DEFUN([LC_SRC_HAVE_DIRTY_FOLIO], [
+       LB2_LINUX_TEST_SRC([address_spaace_operaions_dirty_folio], [
                #include <linux/fs.h>
        ],[
                struct address_space_operations *aops = NULL;
@@ -2786,11 +3032,14 @@ address_spaace_operaions_dirty_folio, [
                struct folio *folio = NULL;
                bool dirty = aops->dirty_folio(mapping, folio);
                (void) dirty;
-       ],[
+       ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_DIRTY_FOLIO], [
+       AC_MSG_CHECKING([if have address_spaace_operaions->dirty_folio() member])
+       LB2_LINUX_TEST_RESULT([address_spaace_operaions_dirty_folio], [
                AC_DEFINE(HAVE_DIRTY_FOLIO, 1,
                        [address_spaace_operaions->dirty_folio() member exists])
        ])
-EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAVE_DIRTY_FOLIO
 
 #
@@ -2817,27 +3066,227 @@ alloc_inode_sb, [
 EXTRA_KCFLAGS="$tmp_flags"
 ]) # LC_HAVE_ALLOC_INODE_SB
 
-AC_DEFUN([LC_PROG_LINUX_SRC], [])
-AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
-
 #
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
 #
-AC_DEFUN([LC_PROG_LINUX], [
-       AC_MSG_NOTICE([Lustre kernel checks
-==============================================================================])
+AC_DEFUN([LC_PROG_LINUX_SRC], [
+       AS_IF([test "x$enable_gss" != xno], [
+               LC_SRC_KEY_TYPE_INSTANTIATE_2ARGS
+               LB2_SRC_CHECK_CONFIG_IM([CRYPTO_MD5])
+               LB2_SRC_CHECK_CONFIG_IM([CRYPTO_SHA1])
+               LB2_SRC_CHECK_CONFIG_IM([CRYPTO_SHA256])
+               LB2_SRC_CHECK_CONFIG_IM([CRYPTO_SHA512])
+       ])
+       AS_IF([test "x$enable_server" != xno], [
+               LC_SRC_CONFIG_QUOTA
+               LC_SRC_STACK_SIZE
+       ])
+       LC_SRC_CONFIG_FHANDLE
+       LC_SRC_POSIX_ACL_CONFIG
+       LC_SRC_HAVE_PROJECT_QUOTA
 
-       LC_CONFIG_PINGER
-       LC_CONFIG_CHECKSUM
-       LC_CONFIG_FLOCK
-       LC_CONFIG_HEALTH_CHECK_WRITE
-       LC_CONFIG_LRU_RESIZE
-       LC_CONFIG_FHANDLE
-       LC_CONFIG_GSS
+       # 3.11
+       LC_SRC_INVALIDATE_RANGE
+       LC_SRC_HAVE_DIR_CONTEXT
+       LC_SRC_D_COMPARE_5ARGS
+       LC_SRC_HAVE_DCOUNT
+       LC_SRC_PID_NS_FOR_CHILDREN
+
+       # 3.12
+       LC_SRC_OLDSIZE_TRUNCATE_PAGECACHE
+       LC_SRC_PTR_ERR_OR_ZERO_MISSING
+       LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_LIST
+       LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
+       LC_SRC_HAVE_DENTRY_D_CHILD
+       LC_SRC_KIOCB_KI_LEFT
+
+       # 3.13
+       LC_SRC_VFS_RENAME_5ARGS
+       LC_SRC_VFS_UNLINK_3ARGS
+       LC_SRC_HAVE_D_IS_POSITIVE
+
+       # 3.14
+       LC_SRC_HAVE_BVEC_ITER
+       LC_SRC_HAVE_TRUNCATE_IPAGES_FINAL
+       LC_SRC_IOPS_RENAME_WITH_FLAGS
+       LC_SRC_IOP_SET_ACL
+
+       # 3.15
+       LC_SRC_VFS_RENAME_6ARGS
+
+       # 3.16
+       LC_SRC_DIRECTIO_USE_ITER
+       LC_SRC_HAVE_IOV_ITER_INIT_DIRECTION
+       LC_SRC_HAVE_IOV_ITER_TRUNCATE
+       LC_SRC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
+
+       # 3.17
+       LC_SRC_HAVE_INTERVAL_BLK_INTEGRITY
+       LC_SRC_KEY_MATCH_DATA
+       LC_SRC_HAVE_BLK_INTEGRITY_ITER
+
+       # 3.18
+       LC_SRC_NFS_FILLDIR_USE_CTX
+       LC_SRC_PERCPU_COUNTER_INIT
+
+       # 3.19
+       LC_SRC_KIOCB_HAS_NBYTES
+       LC_SRC_HAVE_DQUOT_QC_DQBLK
+       LC_SRC_HAVE_AIO_COMPLETE
+
+       # 3.20
+       LC_SRC_BACKING_DEV_INFO_REMOVAL
+       LC_SRC_HAVE_BDI_CAP_MAP_COPY
+
+       # 4.1.0
+       LC_SRC_IOV_ITER_RW
+       LC_SRC_HAVE___BI_CNT
+
+       # 4.2
+       LC_SRC_BIO_ENDIO_USES_ONE_ARG
+       LC_SRC_SYMLINK_OPS_USE_NAMEIDATA
+       LC_SRC_ACCOUNT_PAGE_DIRTIED_3ARGS
+       LC_SRC_HAVE_CRYPTO_ALLOC_SKCIPHER
+
+       # 4.3
+       LC_SRC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
+       LC_SRC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
+       LC_SRC_HAVE_CACHE_HEAD_HLIST
+       LC_SRC_HAVE_XATTR_HANDLER_SIMPLIFIED
+
+       # 4.4
+       LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT
+       LC_SRC_HAVE_KEY_PAYLOAD_DATA_ARRAY
+       LC_SRC_HAVE_XATTR_HANDLER_NAME
+       LC_SRC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
+       LC_SRC_HAVE_BI_OPF
+       LC_SRC_HAVE_SUBMIT_BIO_2ARGS
+       LC_SRC_HAVE_CLEAN_BDEV_ALIASES
+
+       # 4.5
+       LC_SRC_HAVE_FILE_DENTRY
+
+       # 4.6
+       LC_SRC_HAVE_INODE_LOCK
+       LC_SRC_HAVE_IOP_GET_LINK
+       LC_SRC_HAVE_IN_COMPAT_SYSCALL
+       LC_SRC_HAVE_XATTR_HANDLER_INODE_PARAM
+       LC_SRC_LOCK_PAGE_MEMCG
+       LC_SRC_HAVE_DOWN_WRITE_KILLABLE
+
+       # 4.7
+       LC_SRC_D_IN_LOOKUP
+       LC_SRC_DIRECTIO_2ARGS
+       LC_SRC_GENERIC_WRITE_SYNC_2ARGS
+       LC_SRC_FOP_ITERATE_SHARED
+
+       # 4.8
+       LC_SRC_HAVE_POSIX_ACL_VALID_USER_NS
+       LC_SRC_D_COMPARE_4ARGS
+       LC_SRC_FULL_NAME_HASH_3ARGS
+       LC_SRC_STRUCT_POSIX_ACL_XATTR
+       LC_SRC_IOP_XATTR
+
+       # 4.9
+       LC_SRC_GROUP_INFO_GID
+       LC_SRC_VFS_SETXATTR
+       LC_SRC_POSIX_ACL_UPDATE_MODE
+       LC_SRC_HAVE_BDI_IO_PAGES
+
+       # 4.10
+       LC_SRC_IOP_GENERIC_READLINK
+       LC_SRC_HAVE_VM_FAULT_ADDRESS
+
+       # 4.11
+       LC_SRC_INODEOPS_ENHANCED_GETATTR
+       LC_SRC_VM_OPERATIONS_REMOVE_VMF_ARG
+       LC_SRC_HAVE_KEY_USAGE_REFCOUNT
+       LC_SRC_HAVE_CRYPTO_MAX_ALG_NAME_128
+
+       # 4.12
+       LC_SRC_CURRENT_TIME
+       LC_SRC_SUPER_BLOCK_S_UUID
+       LC_SRC_SUPER_SETUP_BDI_NAME
+       LC_SRC_BI_STATUS
+
+       # 4.13
+       LC_SRC_BIO_INTEGRITY_ENABLED
+       LC_SRC_HAVE_GET_INODE_USAGE
 
-       # 3.10
+       # 4.14
+       LC_SRC_PAGEVEC_INIT_ONE_PARAM
+       LC_SRC_BI_BDEV
+
+       # 4.17
+       LC_SRC_VM_FAULT_T
+       LC_SRC_VM_FAULT_RETRY
+       LC_SRC_I_PAGES
+
+       # 4.18
+       LC_SRC_INODE_TIMESPEC64
+       LC_SRC_ALLOC_FILE_PSEUDO
+
+       # 4.20
+       LC_SRC_RADIX_TREE_TAG_SET
+       LC_SRC_UAPI_LINUX_MOUNT_H
+       LC_SRC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
+
+       # 5.1
+       LC_SRC_HAVE_BVEC_ITER_ALL
+
+       # 5.2
+       LC_SRC_KEYRING_SEARCH_4ARGS
+
+       # 5.3
+       LC_SRC_BIO_BI_PHYS_SEGMENTS
+       LC_SRC_LM_COMPARE_OWNER_EXISTS
+
+       # 5.9
+       LC_SRC_HAVE_ITER_FILE_SPLICE_WRITE
+
+       # 5.12
+       LC_SRC_HAVE_USER_NAMESPACE_ARG
+
+       # 5.15
+       LC_SRC_HAVE_GET_ACL_RCU_ARG
+
+       # 5.16
+       LC_SRC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
+       LC_SRC_HAVE_KIOCB_COMPLETE_2ARGS
+
+       # 5.18
+       LC_SRC_HAVE_INVALIDATE_FOLIO
+       LC_SRC_HAVE_DIRTY_FOLIO
+
+       # kernel patch to extend integrity interface
+       LC_SRC_BIO_INTEGRITY_PREP_FN
+])
+
+AC_DEFUN([LC_PROG_LINUX_RESULTS], [
+       AS_IF([test "x$enable_gss" != xno], [
+               LC_KEY_TYPE_INSTANTIATE_2ARGS
+
+               LB2_TEST_CHECK_CONFIG_IM([CRYPTO_MD5], [],
+                       [AC_MSG_WARN(
+                       [kernel MD5 support is recommended by using GSS.])])
+               LB2_TEST_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
+                       [AC_MSG_WARN(
+                       [kernel SHA1 support is recommended by using GSS.])])
+               LB2_TEST_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
+                       [AC_MSG_WARN(
+                       [kernel SHA256 support is recommended by using GSS.])])
+               LB2_TEST_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
+                       [AC_MSG_WARN(
+                       [kernel SHA512 support is recommended by using GSS.])])
+       ])
+       AS_IF([test "x$enable_server" != xno], [
+               LC_CONFIG_QUOTA
+               LC_STACK_SIZE
+       ])
+       LC_CONFIG_FHANDLE
+       LC_POSIX_ACL_CONFIG
        LC_HAVE_PROJECT_QUOTA
 
        # 3.11
@@ -2845,7 +3294,8 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_HAVE_DIR_CONTEXT
        LC_D_COMPARE_5ARGS
        LC_HAVE_DCOUNT
-       LC_HAVE_DENTRY_D_U_D_ALIAS
+       LC_HAVE_DENTRY_D_U_D_ALIAS_LIST
+       LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
        LC_HAVE_DENTRY_D_CHILD
        LC_PID_NS_FOR_CHILDREN
 
@@ -2894,7 +3344,6 @@ AC_DEFUN([LC_PROG_LINUX], [
 
        # 4.1.0
        LC_IOV_ITER_RW
-       LC_HAVE_SYNC_READ_WRITE
        LC_HAVE___BI_CNT
 
        # 4.2
@@ -2938,7 +3387,6 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_FOP_ITERATE_SHARED
 
        # 4.8
-       LC_EXPORT_DEFAULT_FILE_SPLICE_READ
        LC_HAVE_POSIX_ACL_VALID_USER_NS
        LC_D_COMPARE_4ARGS
        LC_FULL_NAME_HASH_3ARGS
@@ -2991,15 +3439,14 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_INODE_TIMESPEC64
 
        # 4.20
-       LC___XA_SET_MARK
+       LC_RADIX_TREE_TAG_SET
        LC_UAPI_LINUX_MOUNT_H
        LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
 
        # 5.1
-       LB_HAVE_BVEC_ITER_ALL
+       LC_HAVE_BVEC_ITER_ALL
 
        # 5.2
-       LC_ACCOUNT_PAGE_DIRTIED
        LC_KEYRING_SEARCH_4ARGS
 
        # 5.3
@@ -3035,13 +3482,38 @@ AC_DEFUN([LC_PROG_LINUX], [
 
        # kernel patch to extend integrity interface
        LC_BIO_INTEGRITY_PREP_FN
+])
+
+#
+# LC_PROG_LINUX
+#
+# Lustre linux kernel checks
+#
+AC_DEFUN([LC_PROG_LINUX], [
+       AC_MSG_NOTICE([Lustre kernel checks
+==============================================================================])
+
+       LC_CONFIG_PINGER
+       LC_CONFIG_CHECKSUM
+       LC_CONFIG_FLOCK
+       LC_CONFIG_HEALTH_CHECK_WRITE
+       LC_CONFIG_LRU_RESIZE
+       LC_CONFIG_GSS
+
+       LC_GLIBC_SUPPORT_FHANDLES
+       LC_GLIBC_SUPPORT_COPY_FILE_RANGE
+       LC_OPENSSL_SSK
+       LC_OPENSSL_GETSEPOL
+
+       # 4.1.0 - Check export
+       LC_HAVE_SYNC_READ_WRITE
+
+       # 4.8 - Check export
+       LC_EXPORT_DEFAULT_FILE_SPLICE_READ
+
+       # 5.2 - Check export
+       LC_ACCOUNT_PAGE_DIRTIED
 
-       #
-       AS_IF([test "x$enable_server" != xno], [
-               LC_STACK_SIZE
-               LC_QUOTA_CONFIG
-       ])
-       LC_POSIX_ACL_CONFIG
 ]) # LC_PROG_LINUX
 
 #
@@ -3107,11 +3579,11 @@ AC_ARG_ENABLE([mpitests],
 ]) # LB_CONFIG_MPITESTS
 
 #
-# LC_CONFIG_QUOTA
+# LC_ENABLE_QUOTA
 #
 # whether to enable quota support global control
 #
-AC_DEFUN([LC_CONFIG_QUOTA], [
+AC_DEFUN([LC_ENABLE_QUOTA], [
 AC_MSG_CHECKING([whether to enable quota support global control])
 AC_ARG_ENABLE([quota],
        AS_HELP_STRING([--enable-quota],
@@ -3120,20 +3592,20 @@ AC_ARG_ENABLE([quota],
 AS_IF([test "x$enable_quota" = xyes],
        [AC_MSG_RESULT([yes])],
        [AC_MSG_RESULT([no])])
-]) # LC_CONFIG_QUOTA
+]) # LC_ENABLE_QUOTA
 
 #
 # LC_QUOTA
 #
 AC_DEFUN([LC_QUOTA], [
 #check global
-LC_CONFIG_QUOTA
+LC_ENABLE_QUOTA
 #check for utils
 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
        AC_CHECK_HEADER([sys/quota.h],
                [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
                        [Define to 1 if you have <sys/quota.h>.])],
-               [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
+               [AC_MSG_ERROR([did not find <sys/quota.h> on your system])])
 ])
 ]) # LC_QUOTA
 
@@ -3166,13 +3638,13 @@ AS_IF([test $ENABLEOSDADDON -eq 0], [
 ], [
        OSDMODNAME=$(basename $OSDADDON)
        AS_IF([test -e $LUSTRE/$OSDMODNAME], [
-               AC_MSG_RESULT([can't link])
+               AC_MSG_RESULT([cannot link])
                OSDADDON=""
        ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
                AC_MSG_RESULT([$OSDMODNAME])
                OSDADDON="obj-m += $OSDMODNAME/"
        ], [
-               AC_MSG_RESULT([can't link])
+               AC_MSG_RESULT([cannot link])
                OSDADDON=""
        ])
 ])