+AC_DEFUN([LC_FUNC_F_OP_FLOCK],
+[AC_MSG_CHECKING([if struct file_operations has flock field])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct file_operations ll_file_operations_flock;
+ ll_file_operations_flock.flock = NULL;
+],[
+ AC_DEFINE(HAVE_F_OP_FLOCK, 1,
+ [struct file_operations has flock field])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_TASK_PPTR
+#
+# task struct has p_pptr instead of parent
+#
+AC_DEFUN([LC_TASK_PPTR],
+[AC_MSG_CHECKING([task p_pptr found])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/sched.h>
+],[
+ struct task_struct *p;
+
+ p = p->p_pptr;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_FUNC_F_OP_FLOCK
+#
+# rhel4.2 kernel has f_op->flock field
+#
+AC_DEFUN([LC_FUNC_F_OP_FLOCK],
+[AC_MSG_CHECKING([if struct file_operations has flock field])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct file_operations ll_file_operations_flock;
+ ll_file_operations_flock.flock = NULL;
+],[
+ AC_DEFINE(HAVE_F_OP_FLOCK, 1,
+ [struct file_operations has flock field])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+# LC_INODE_I_MUTEX
+# after 2.6.15 inode have i_mutex intead of i_sem
+AC_DEFUN([LC_INODE_I_MUTEX],
+[AC_MSG_CHECKING([use inode have i_mutex ])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/mutex.h>
+ #include <linux/fs.h>
+ #undef i_mutex
+],[
+ struct inode i;
+
+ mutex_unlock(&i.i_mutex);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
+ [after 2.6.15 inode have i_mutex intead of i_sem])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# LC_DQUOTOFF_MUTEX
+# after 2.6.17 dquote use mutex instead if semaphore
+AC_DEFUN([LC_DQUOTOFF_MUTEX],
+[AC_MSG_CHECKING([use dqonoff_mutex])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/mutex.h>
+ #include <linux/fs.h>
+ #include <linux/quota.h>
+],[
+ struct quota_info dq;
+
+ mutex_unlock(&dq.dqonoff_mutex);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
+ [after 2.6.17 dquote use mutex instead if semaphore])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+#
+# LC_STATFS_DENTRY_PARAM
+# starting from 2.6.18 linux kernel uses dentry instead of
+# super_block for first vfs_statfs argument
+#
+AC_DEFUN([LC_STATFS_DENTRY_PARAM],
+[AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ int vfs_statfs(struct dentry *, struct kstatfs *);
+],[
+ AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
+ [first parameter of vfs_statfs is dentry])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_VFS_KERN_MOUNT
+# starting from 2.6.18 kernel don't export do_kern_mount
+# and want to use vfs_kern_mount instead.
+#
+AC_DEFUN([LC_VFS_KERN_MOUNT],
+[AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/mount.h>
+],[
+ vfs_kern_mount(NULL, 0, NULL, NULL);
+],[
+ AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
+ [vfs_kern_mount exist in kernel])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_INVALIDATEPAGE_RETURN_INT
+# more 2.6 api changes. return type for the invalidatepage
+# address_space_operation is 'void' in new kernels but 'int' in old
+#
+AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
+[AC_MSG_CHECKING([invalidatepage has return int])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/buffer_head.h>
+],[
+ int rc = block_invalidatepage(NULL, 0);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
+ [Define if return type of invalidatepage should be int])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# LC_UMOUNTBEGIN_HAS_VFSMOUNT
+# more 2.6 API changes. 2.6.18 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.19 API changes
+# inode don't have i_blksize field
+AC_DEFUN([LC_INODE_BLKSIZE],
+[AC_MSG_CHECKING([inode has i_blksize field])
+LB_LINUX_TRY_COMPILE([
+#include <linux/fs.h>
+],[
+ struct inode i;
+ i.i_blksize = 0;
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
+ [struct inode has i_blksize field])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# LC_VFS_READDIR_U64_INO
+# 2.6.19 use u64 for inode number instead of inode_t
+AC_DEFUN([LC_VFS_READDIR_U64_INO],
+[AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+#include <linux/fs.h>
+ int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
+ u64 ino, unsigned int d_type)
+ {
+ return 0;
+ }
+],[
+ filldir_t filter;
+
+ filter = fillonedir;
+ return 1;
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
+ [if vfs_readdir need 64bit inode number])
+],[
+ AC_MSG_RESULT(NO)
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
+# LC_GENERIC_FILE_WRITE
+# 2.6.19 introduce do_sync_write instead of
+# generic_file_write
+AC_DEFUN([LC_GENERIC_FILE_WRITE],
+[AC_MSG_CHECKING([use generic_file_write])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ int result = generic_file_read(NULL, NULL, 0, 0);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
+ [use generic_file_write])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# LC_GENERIC_FILE_READ
+# 2.6.19 need to use do_sync_read instead of
+# generic_file_read
+AC_DEFUN([LC_GENERIC_FILE_READ],
+[AC_MSG_CHECKING([use generic_file_read])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ int result = generic_file_read(NULL, NULL, 0, 0);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
+ [use generic_file_read])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# LC_NR_PAGECACHE
+# 2.6.18 don't export nr_pagecahe
+AC_DEFUN([LC_NR_PAGECACHE],
+[AC_MSG_CHECKING([kernel export nr_pagecache])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/pagemap.h>
+],[
+ return atomic_read(&nr_pagecache);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NR_PAGECACHE, 1,
+ [is kernel export nr_pagecache])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# LC_CANCEL_DIRTY_PAGE
+# 2.6.20 introduse cancel_dirty_page instead of
+# clear_page_dirty.
+AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
+[AC_MSG_CHECKING([kernel has cancel_dirty_page])
+LB_LINUX_TRY_COMPILE([
+ #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)
+])
+])
+
+#
+# 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/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);
+])
+])
+
+# RHEL5 in FS-cache patch rename PG_checked flag
+# into PG_fs_misc
+AC_DEFUN([LC_PG_FS_MISC],
+[AC_MSG_CHECKING([kernel has PG_fs_misc])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/page-flags.h>
+],[
+ #ifndef PG_fs_misc
+ #error PG_fs_misc not defined in kernel
+ #endif
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PG_FS_MISC, 1,
+ [is kernel have PG_fs_misc])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# RHEL5 PageChecked and SetPageChecked defined
+AC_DEFUN([LC_PAGE_CHECKED],
+[AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/page-flags.h>
+],[
+ #ifndef PageChecked
+ #error PageChecked not defined in kernel
+ #endif
+ #ifndef SetPageChecked
+ #error SetPageChecked not defined in kernel
+ #endif
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_PAGE_CHECKED, 1,
+ [does kernel have PageChecked and SetPageChecked])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+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])
+],[
+])
+])
+
+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])
+],[
+])
+])
+
+AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
+[LB_CHECK_SYMBOL_EXPORT([d_move_locked],
+[fs/dcache.c],[
+AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
+ [d_move_locked is exported by the kernel])
+],[
+])
+])
+
+AC_DEFUN([LC_EXPORT___D_MOVE],
+[LB_CHECK_SYMBOL_EXPORT([__d_move],
+[fs/dcache.c],[
+AC_DEFINE(HAVE___D_MOVE, 1,
+ [__d_move 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
+ ])
+
+# 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])
+])
+])
+
+# 2.6.23 have return type 'void' for unregister_blkdev
+AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
+[AC_MSG_CHECKING([if unregister_blkdev return int])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ int i = unregister_blkdev(0,NULL);
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
+ [unregister_blkdev return int])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+# 2.6.23 change .sendfile to .splice_read
+AC_DEFUN([LC_KERNEL_SPLICE_READ],
+[AC_MSG_CHECKING([if kernel has .splice_read])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct file_operations file;
+
+ file.splice_read = NULL;
+], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
+ [kernel has .slice_read])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+# 2.6.23 extract nfs export related data into exportfs.h
+AC_DEFUN([LC_HAVE_EXPORTFS_H],
+[
+tmpfl="$CFLAGS"
+CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
+AC_CHECK_HEADERS([linux/exportfs.h])
+CFLAGS="$tmpfl"
+])
+
+#
+# LC_VFS_INTENT_PATCHES
+#
+# check if the kernel has the VFS intent patches
+AC_DEFUN([LC_VFS_INTENT_PATCHES],
+[AC_MSG_CHECKING([if the kernel has the VFS intent patches])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ #include <linux/namei.h>
+],[
+ struct nameidata nd;
+ struct lookup_intent *it;
+
+ it = &nd.intent;
+ intent_init(it, IT_OPEN);
+ it->d.lustre.it_disposition = 0;
+ it->d.lustre.it_data = NULL;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_S_TIME_GRAN],
+[AC_MSG_CHECKING([if super block has s_time_gran member])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct super_block sb;
+
+ return sb.s_time_gran;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+AC_DEFUN([LC_SB_TIME_GRAN],
+[AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ return get_sb_time_gran(NULL);
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+
+# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
+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"
+])
+
+AC_DEFUN([LC_CONST_ACL_SIZE],
+[AC_MSG_CHECKING([calc acl size])
+tmp_flags="$CFLAGS"
+CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
+AC_TRY_RUN([
+#define __KERNEL__
+#include <linux/autoconf.h>
+#include <linux/types.h>
+#undef __KERNEL__
+// block include
+#define __LINUX_POSIX_ACL_H
+
+# ifdef CONFIG_FS_POSIX_ACL
+# ifdef HAVE_XATTR_ACL
+# include <linux/xattr_acl.h>
+# endif
+# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
+# include <linux/posix_acl_xattr.h>
+# endif
+# endif
+
+#include <linux/lustre_acl.h>
+
+#include <stdio.h>
+
+int main(void)
+{
+ int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
+ 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 computed])
+])
+CFLAGS="$tmp_flags"
+])
+
+#
+# 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/crypto.h>
+],[
+ int v = CRYPTO_ALG_TYPE_BLKCIPHER;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# check for FS_RENAME_DOES_D_MOVE flag
+#
+AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
+[AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ int v = FS_RENAME_DOES_D_MOVE;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_PROG_LINUX
+#
+# Lustre linux kernel checks
+#
+AC_DEFUN([LC_PROG_LINUX],
+ [LC_LUSTRE_VERSION_H
+ if test x$enable_server = xyes ; then
+ AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
+ LC_CONFIG_BACKINGFS
+ fi
+ LC_CONFIG_PINGER
+ LC_CONFIG_CHECKSUM
+ LC_CONFIG_LIBLUSTRE_RECOVERY
+ LC_CONFIG_QUOTA
+ LC_CONFIG_HEALTH_CHECK_WRITE
+ LC_CONFIG_LRU_RESIZE
+
+ LC_TASK_PPTR
+ # RHEL4 patches
+ LC_EXPORT_TRUNCATE_COMPLETE
+ LC_EXPORT_D_REHASH_COND
+ LC_EXPORT___D_REHASH
+ LC_EXPORT_D_MOVE_LOCKED
+ LC_EXPORT___D_MOVE
+ LC_EXPORT_NODE_TO_CPUMASK
+
+ LC_STRUCT_KIOBUF
+ LC_FUNC_COND_RESCHED
+ LC_FUNC_ZAP_PAGE_RANGE
+ LC_FUNC_PDE
+ LC_FUNC_DIRECT_IO
+ LC_HEADER_MM_INLINE
+ LC_STRUCT_INODE
+ LC_FUNC_REGISTER_CACHE
+ LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
+ LC_FUNC_DEV_SET_RDONLY
+ LC_FUNC_FILEMAP_FDATAWRITE
+ LC_STRUCT_STATFS
+ LC_FUNC_PAGE_MAPPED
+ LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
+ LC_FILEMAP_POPULATE
+ LC_D_ADD_UNIQUE
+ LC_BIT_SPINLOCK_H
+
+ LC_XATTR_ACL
+ LC_POSIX_ACL_XATTR_H
+ LC_CONST_ACL_SIZE
+
+ LC_STRUCT_INTENT_FILE
+
+ LC_FUNC_SET_FS_PWD
+ LC_CAPA_CRYPTO
+ LC_CONFIG_GSS
+ LC_FUNC_MS_FLOCK_LOCK
+ LC_FUNC_HAVE_CAN_SLEEP_ARG
+ LC_FUNC_F_OP_FLOCK
+ LC_QUOTA_READ
+ LC_COOKIE_FOLLOW_LINK
+ LC_FUNC_RCU
+
+ # does the kernel have VFS intent patches?
+ LC_VFS_INTENT_PATCHES
+
+ # ~2.6.11
+ LC_S_TIME_GRAN
+ LC_SB_TIME_GRAN
+
+ # 2.6.12
+ LC_RW_TREE_LOCK
+
+ # 2.6.15
+ LC_INODE_I_MUTEX
+
+ # 2.6.17
+ LC_DQUOTOFF_MUTEX
+
+ # 2.6.18
+ LC_NR_PAGECACHE
+ LC_STATFS_DENTRY_PARAM
+ LC_VFS_KERN_MOUNT
+ LC_INVALIDATEPAGE_RETURN_INT
+ LC_UMOUNTBEGIN_HAS_VFSMOUNT
+
+ #2.6.18 + RHEL5 (fc6)
+ LC_PG_FS_MISC
+ LC_PAGE_CHECKED
+
+ # 2.6.19
+ LC_INODE_BLKSIZE
+ LC_VFS_READDIR_U64_INO
+ LC_GENERIC_FILE_READ
+ LC_GENERIC_FILE_WRITE
+
+ # 2.6.20
+ LC_CANCEL_DIRTY_PAGE
+
+ # raid5-zerocopy patch
+ LC_PAGE_CONSTANT
+
+ # 2.6.22
+ LC_INVALIDATE_BDEV_2ARG
+ LC_ASYNC_BLOCK_CIPHER
+ LC_FS_RENAME_DOES_D_MOVE
+ # 2.6.23
+ LC_UNREGISTER_BLKDEV_RETURN_INT
+ LC_KERNEL_SPLICE_READ
+ LC_HAVE_EXPORTFS_H
+ LC_EXPORT_NR_FREE_BUFFER_PAGES
+])
+
+#
+# LC_CONFIG_CLIENT_SERVER
+#
+# Build client/server sides of Lustre
+#
+AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
+[AC_MSG_CHECKING([whether to build Lustre server support])
+AC_ARG_ENABLE([server],
+ AC_HELP_STRING([--disable-server],
+ [disable Lustre server support]),
+ [],[enable_server='yes'])
+AC_MSG_RESULT([$enable_server])
+
+AC_MSG_CHECKING([whether to build Lustre client support])
+AC_ARG_ENABLE([client],
+ AC_HELP_STRING([--disable-client],
+ [disable Lustre client support]),
+ [],[enable_client='yes'])
+AC_MSG_RESULT([$enable_client])])
+
+#
+# LC_CONFIG_LIBLUSTRE
+#
+# whether to build liblustre
+#
+AC_DEFUN([LC_CONFIG_LIBLUSTRE],
+[AC_MSG_CHECKING([whether to build Lustre library])
+AC_ARG_ENABLE([liblustre],
+ AC_HELP_STRING([--disable-liblustre],
+ [disable building of Lustre library]),
+ [],[enable_liblustre=$with_sysio])
+AC_MSG_RESULT([$enable_liblustre])
+# only build sysio if liblustre is built
+with_sysio="$enable_liblustre"
+
+AC_MSG_CHECKING([whether to build liblustre tests])
+AC_ARG_ENABLE([liblustre-tests],
+ AC_HELP_STRING([--enable-liblustre-tests],
+ [enable liblustre tests, if --disable-tests is used]),
+ [],[enable_liblustre_tests=$enable_tests])
+if test x$enable_liblustre != xyes ; then
+ enable_liblustre_tests='no'
+fi
+AC_MSG_RESULT([$enable_liblustre_tests])
+
+AC_MSG_CHECKING([whether to enable liblustre acl])
+AC_ARG_ENABLE([liblustre-acl],
+ AC_HELP_STRING([--disable-liblustre-acl],
+ [disable ACL support for liblustre]),
+ [],[enable_liblustre_acl=yes])
+AC_MSG_RESULT([$enable_liblustre_acl])
+if test x$enable_liblustre_acl = xyes ; then
+ AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
+fi
+
+AC_MSG_CHECKING([whether to build mpitests])
+AC_ARG_ENABLE([mpitests],
+ AC_HELP_STRING([--enable-mpitests],
+ [build liblustre mpi tests]),
+ [],[enable_mpitests=no])
+AC_MSG_RESULT([$enable_mpitests])
+
+AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
+ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
+
+LC_CONFIG_PINGER
+LC_CONFIG_LIBLUSTRE_RECOVERY
+])
+
+AC_DEFUN([LC_CONFIG_LRU_RESIZE],
+[AC_MSG_CHECKING([whether to enable lru self-adjusting])
+AC_ARG_ENABLE([lru_resize],
+ AC_HELP_STRING([--enable-lru-resize],
+ [enable lru resize support]),
+ [],[enable_lru_resize='yes'])
+AC_MSG_RESULT([$enable_lru_resize])
+if test x$enable_lru_resize != xno; then
+ AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
+fi
+])
+
+#
+# LC_CONFIG_QUOTA
+#
+# whether to enable quota support
+#
+AC_DEFUN([LC_CONFIG_QUOTA],
+[AC_MSG_CHECKING([whether to disable quota support])
+AC_ARG_ENABLE([quota],
+ AC_HELP_STRING([--disable-quota],
+ [disable quota support]),
+ [],[enable_quota='yes'])
+AC_MSG_RESULT([$enable_quota])
+if test x$linux25 != xyes; then
+ enable_quota='no'
+fi
+if test x$enable_quota != xno; then
+ AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
+fi
+])
+
+#
+# LC_CONFIG_SPLIT
+#
+# whether to enable split support
+#
+AC_DEFUN([LC_CONFIG_SPLIT],
+[AC_MSG_CHECKING([whether to enable split support])
+AC_ARG_ENABLE([split],
+ AC_HELP_STRING([--enable-split],
+ [enable split support]),
+ [],[enable_split='no'])
+AC_MSG_RESULT([$enable_split])
+if test x$enable_split != xno; then
+ AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
+fi
+])
+
+AC_DEFUN([LC_QUOTA_READ],
+[AC_MSG_CHECKING([if kernel supports quota_read])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ struct super_operations sp;
+ void *i = (void *)sp.quota_read;
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_COOKIE_FOLLOW_LINK
+#
+# kernel 2.6.13+ ->follow_link returns a cookie
+#
+
+AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
+[AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+ #include <linux/namei.h>
+],[
+ struct dentry dentry;
+ struct nameidata nd;
+
+ dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
+],[
+ AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_FUNC_RCU
+#
+# kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
+# call_rcu takes three parameters.
+#
+AC_DEFUN([LC_FUNC_RCU],
+[AC_MSG_CHECKING([if kernel have RCU supported])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/rcupdate.h>
+],[],[
+ AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
+ AC_MSG_RESULT([yes])
+
+ AC_MSG_CHECKING([if call_rcu takes three parameters])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/rcupdate.h>
+ ],[
+ struct rcu_head rh;
+ call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
+ ],[
+ AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
+# LC_CONFIGURE
+#
+# other configure checks
+#
+AC_DEFUN([LC_CONFIGURE],
+[LC_CONFIG_OBD_BUFFER_SIZE
+
+# include/liblustre.h
+AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
+
+# include/lustre/lustre_user.h
+# See note there re: __ASM_X86_64_PROCESSOR_H
+AC_CHECK_HEADERS([linux/fs.h linux/quota.h])
+
+# liblustre/llite_lib.h
+AC_CHECK_HEADERS([xtio.h file.h])
+
+# liblustre/dir.c
+AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
+
+# liblustre/lutil.c
+AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
+AC_CHECK_FUNCS([inet_ntoa])
+
+# libsysio/src/readlink.c
+LC_READLINK_SSIZE_T
+
+# lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
+AC_CHECK_HEADERS([linux/random.h], [], [],
+ [#ifdef HAVE_LINUX_TYPES_H
+ # include <linux/types.h>
+ #endif
+ ])
+
+# utils/llverfs.c
+AC_CHECK_HEADERS([ext2fs/ext2fs.h])
+
+# check for -lz support
+ZLIB=""
+AC_CHECK_LIB([z],
+ [adler32],
+ [AC_CHECK_HEADERS([zlib.h],
+ [ZLIB="-lz"
+ AC_DEFINE([HAVE_ADLER], 1,
+ [support alder32 checksum type])],
+ [AC_MSG_WARN([No zlib-devel package found,
+ unable to use adler32 checksum])])],
+ [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
+)
+AC_SUBST(ZLIB)
+
+# Super safe df
+AC_ARG_ENABLE([mindf],
+ AC_HELP_STRING([--enable-mindf],
+ [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
+ [],[])
+if test "$enable_mindf" = "yes" ; then
+ AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
+fi
+
+AC_ARG_ENABLE([fail_alloc],
+ AC_HELP_STRING([--disable-fail-alloc],
+ [disable randomly alloc failure]),
+ [],[enable_fail_alloc=yes])
+AC_MSG_CHECKING([whether to randomly failing memory alloc])
+AC_MSG_RESULT([$enable_fail_alloc])
+if test x$enable_fail_alloc != xno ; then
+ AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
+fi
+
+])
+
+#
+# LC_CONDITIONALS
+#
+# AM_CONDITIONALS for lustre
+#
+AC_DEFUN([LC_CONDITIONALS],
+[AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
+AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
+AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
+AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
+AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
+AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
+AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
+AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
+AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
+AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
+AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
+AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
+AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
+AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
+])
+
+#
+# LC_CONFIG_FILES
+#
+# files that should be generated with AC_OUTPUT
+#
+AC_DEFUN([LC_CONFIG_FILES],
+[AC_CONFIG_FILES([
+lustre/Makefile
+lustre/autoMakefile
+lustre/autoconf/Makefile
+lustre/contrib/Makefile
+lustre/doc/Makefile
+lustre/include/Makefile
+lustre/include/lustre_ver.h
+lustre/include/linux/Makefile
+lustre/include/lustre/Makefile
+lustre/kernel_patches/targets/2.6-vanilla.target
+lustre/kernel_patches/targets/2.6-rhel4.target
+lustre/kernel_patches/targets/2.6-rhel5.target
+lustre/kernel_patches/targets/2.6-fc5.target
+lustre/kernel_patches/targets/2.6-patchless.target
+lustre/kernel_patches/targets/2.6-sles10.target
+lustre/ldlm/Makefile
+lustre/fid/Makefile
+lustre/fid/autoMakefile
+lustre/liblustre/Makefile
+lustre/liblustre/tests/Makefile
+lustre/llite/Makefile
+lustre/llite/autoMakefile
+lustre/lov/Makefile
+lustre/lov/autoMakefile