-if test x$enable_lru_resize != xno; then
- AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
-fi
-])
-
-#
-# Quota support. The kernel must support CONFIG_QUOTA.
-#
-AC_DEFUN([LC_QUOTA_CONFIG],
-[LB_LINUX_CONFIG_IM([QUOTA],[],[
- AC_MSG_ERROR([Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])
- ])
-])
-
-# truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
-# remove_from_page_cache() was exported between 2.6.35 and 2.6.38
-# delete_from_page_cache() is exported from 2.6.39
-AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
- [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
- [mm/truncate.c],
- [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
- [kernel export truncate_complete_page])])
- LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
- [mm/filemap.c],
- [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
- [kernel export remove_from_page_cache])])
- LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
- [mm/filemap.c],
- [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
- [kernel export delete_from_page_cache])])
- ])
-
-AC_DEFUN([LC_EXPORT_D_REHASH_COND],
-[LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
-[fs/dcache.c],[
-AC_DEFINE(HAVE_D_REHASH_COND, 1,
- [d_rehash_cond is exported by the kernel])
-],[
-])
-])
-
-AC_DEFUN([LC_EXPORT___D_REHASH],
-[LB_CHECK_SYMBOL_EXPORT([__d_rehash],
-[fs/dcache.c],[
-AC_DEFINE(HAVE___D_REHASH, 1,
- [__d_rehash is exported by the kernel])
-],[
-])
-])
-
-# The actual symbol exported varies among architectures, so we need
-# to check many symbols (but only in the current architecture.) No
-# matter what symbol is exported, the kernel #defines node_to_cpumask
-# to the appropriate function and that's what we use.
-AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
- [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
- [arch/$LINUX_ARCH/mm/numa.c],
- [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
- [node_to_cpumask is exported by
- the kernel])]) # x86_64
- LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
- [arch/$LINUX_ARCH/kernel/smpboot.c],
- [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
- [node_to_cpumask is exported by
- the kernel])]) # ia64
- LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
- [arch/$LINUX_ARCH/kernel/smpboot.c],
- [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
- [node_to_cpumask is exported by
- the kernel])]) # i386
- ])
-
-#
-#
-# between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
-#
-AC_DEFUN([LC_FILEMAP_POPULATE],
-[AC_MSG_CHECKING([for exported filemap_populate])
-LB_LINUX_TRY_COMPILE([
- #include <asm/page.h>
- #include <linux/mm.h>
-],[
- filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# added in 2.6.17
-#
-AC_DEFUN([LC_BIT_SPINLOCK_H],
-[LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
- AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
- LB_LINUX_TRY_COMPILE([
- #include <asm/processor.h>
- #include <linux/spinlock.h>
- #include <linux/bit_spinlock.h>
- ],[],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
- ],[
- AC_MSG_RESULT([no])
- ])
-],
-[])
-])
-
-#
-# LC_CONST_ACL_SIZE
-#
-AC_DEFUN([LC_CONST_ACL_SIZE],
-[AC_MSG_CHECKING([calc acl size])
-tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -include $AUTOCONF_HDIR/autoconf.h $EXTRA_KCFLAGS"
-AC_TRY_RUN([
- #define __KERNEL__
- #include <linux/types.h>
- #undef __KERNEL__
- // block include
- #define __LINUX_POSIX_ACL_H
-
- #ifdef CONFIG_FS_POSIX_ACL
- # include <linux/posix_acl_xattr.h>
- #endif
-
- #include <stdio.h>
-
- int main(void)
- {
- /* LUSTRE_POSIX_ACL_MAX_ENTRIES = 32 */
- int size = posix_acl_xattr_size(32);
- FILE *f = fopen("acl.size","w+");
- fprintf(f,"%d", size);
- fclose(f);
-
- return 0;
- }
-],[
- acl_size=`cat acl.size`
- AC_MSG_RESULT([ACL size $acl_size])
- AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
-],[
- AC_ERROR([ACL size can't be computed])
-],[
- AC_MSG_RESULT([can't check ACL size, make it 260])
- AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
-])
-CFLAGS="$tmp_flags"
-])
-
-#
-# LC_CAPA_CRYPTO
-#
-AC_DEFUN([LC_CAPA_CRYPTO],
-[LB_LINUX_CONFIG_IM([CRYPTO],[],[
- AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
-])
-LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
- AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
-])
-LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
- AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
-])
-])
-
-#
-# LC_CONFIG_RMTCLIENT
-#
-dnl FIXME
-dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
-dnl FIXME
-AC_DEFUN([LC_CONFIG_RMTCLIENT],
-[LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
- AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
-])
-])
-
-#
-# LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
-#
-AC_DEFUN([LC_CONFIG_GSS_KEYRING],
-[AC_MSG_CHECKING([whether to enable gss keyring backend])
- AC_ARG_ENABLE([gss_keyring],
- [AC_HELP_STRING([--disable-gss-keyring],
- [disable gss keyring backend])],
- [],[enable_gss_keyring='yes'])
- AC_MSG_RESULT([$enable_gss_keyring])
-
- if test x$enable_gss_keyring != xno; then
- LB_LINUX_CONFIG_IM([KEYS],[],
- [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
-
- AC_CHECK_LIB([keyutils], [keyctl_search], [],
- [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
-
- AC_DEFINE([HAVE_GSS_KEYRING], [1],
- [Define this if you enable gss keyring backend])
- fi
-])
-
-AC_DEFUN([LC_CONFIG_SUNRPC],
-[LB_LINUX_CONFIG_IM([SUNRPC],[],
- [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
-])
-
-#
-# LC_CONFIG_GSS (default disabled)
-#
-# Build gss and related tools of Lustre. Currently both kernel and user space
-# parts are depend on linux platform.
-#
-AC_DEFUN([LC_CONFIG_GSS],
-[AC_MSG_CHECKING([whether to enable gss/krb5 support])
- AC_ARG_ENABLE([gss],
- [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
- [],[enable_gss='no'])
- AC_MSG_RESULT([$enable_gss])
-
- if test x$enable_gss == xyes; then
- LC_CONFIG_GSS_KEYRING
- LC_CONFIG_SUNRPC
-
- AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
-
- LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
- [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
- LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
- [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
- LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
- [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
- LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
- [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
-
- AC_CHECK_LIB([gssapi], [gss_init_sec_context],
- [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
- [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
- [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
- [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
-
- AC_SUBST(GSSAPI_LIBS)
-
- AC_KERBEROS_V5
- fi
-])
-
-AC_DEFUN([LC_TASK_CLENV_STORE],
-[
- AC_MSG_CHECKING([if we can store cl_env in task_struct])
- if test x$have_task_clenv_store != xyes ; then
- LC_TASK_CLENV_TUX_INFO
- fi
-])
-
-# 2.6.12
-
-# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
-# yet tree_lock is converted from rwlock to spin_lock since v2.6.26
-AC_DEFUN([LC_RW_TREE_LOCK],
-[AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct address_space a;
-
- write_lock(&a.tree_lock);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-# 2.6.18
-
-# LC_UMOUNTBEGIN_HAS_VFSMOUNT
-# 2.6.18~2.6.25 umount_begin has different parameters
-AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
-[AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-
- struct vfsmount;
- static void cfg_umount_begin (struct vfsmount *v, int flags)
- {
- ;
- }
-
- static struct super_operations cfg_super_operations = {
- .umount_begin = cfg_umount_begin,
- };
-],[
- cfg_super_operations.umount_begin(NULL,0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
- [Define umount_begin need second argument])
-],[
- AC_MSG_RESULT(no)
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-#2.6.18 + RHEL5 (fc6)
-
-#
-# LC_LINUX_FIEMAP_H
-#
-# fiemap.h is added since v2.6.28
-# RHEL5 2.6.18 has it, while SLES10 2.6.27 does not
-#
-AC_DEFUN([LC_LINUX_FIEMAP_H],
-[LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
- AC_MSG_CHECKING([if fiemap.h can be compiled])
- LB_LINUX_TRY_COMPILE([
- #include <linux/types.h>
- #include <linux/fiemap.h>
- ],[],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
- ],[
- AC_MSG_RESULT([no])
- ])
-],
-[])
-])
-
-# 2.6.19
-
-# LC_FILE_WRITEV
-# 2.6.19 replaced writev with aio_write
-AC_DEFUN([LC_FILE_WRITEV],
-[AC_MSG_CHECKING([writev in fops])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations *fops = NULL;
- fops->writev = NULL;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FILE_WRITEV, 1,
- [use fops->writev])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# LC_FILE_READV
-# 2.6.19 replaced readv with aio_read
-AC_DEFUN([LC_FILE_READV],
-[AC_MSG_CHECKING([readv in fops])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations *fops = NULL;
- fops->readv = NULL;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FILE_READV, 1,
- [use fops->readv])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.20
-
-# LC_CANCEL_DIRTY_PAGE
-# 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
-AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
- [AC_MSG_CHECKING([kernel has cancel_dirty_page])
- # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
- # backport is broken, so ignore it
- if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
- test "$(sed -ne '/^static inline void cancel_dirty_page(struct page \*page, unsigned int account_size)$/,/^}$/p' $OFED_BACKPORT_PATH/linux/mm.h | md5sum)" = "c518cb32d6394760c5bca14cb7538d3e -"; then
- AC_MSG_RESULT(no)
- else
- LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/page-flags.h>
-],[
- cancel_dirty_page(NULL, 0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
- [kernel has cancel_dirty_page instead of clear_page_dirty])
-],[
- AC_MSG_RESULT(no)
-])
- fi
-])
-
-# raid5-zerocopy patch
-
-#
-# LC_PAGE_CONSTANT
-#
-# In order to support raid5 zerocopy patch, we have to patch the kernel to make
-# it support constant page, which means the page won't be modified during the
-# IO.
-#
-AC_DEFUN([LC_PAGE_CONSTANT],
-[AC_MSG_CHECKING([if kernel have PageConstant defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/page-flags.h>
-],[
- #ifndef PG_constant
- #error "Have no raid5 zcopy patch"
- #endif
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
-],[
- AC_MSG_RESULT(no);
-])
-])
-
-# 2.6.22
-
-# 2.6.22 lost second parameter for invalidate_bdev
-AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
-[AC_MSG_CHECKING([if invalidate_bdev has second argument])
-LB_LINUX_TRY_COMPILE([
- #include <linux/buffer_head.h>
-],[
- invalidate_bdev(NULL,0);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
- [invalidate_bdev has second argument])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# check for crypto API
-#
-AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
-[AC_MSG_CHECKING([if kernel has block cipher support])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct crypto_blkcipher *tfm;
- tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
-],[
- AC_MSG_RESULT([no])
-])
-])