1 #* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 #* vim:expandtab:shiftwidth=8:tabstop=8:
6 # Wrapper for AC_CONFIG_SUBDIR
8 AC_DEFUN([LC_CONFIG_SRCDIR],
9 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
16 # lustre specific paths
18 AC_DEFUN([LC_PATH_DEFAULTS],
19 [# ptlrpc kernel build requires this
27 demodir='$(docdir)/demo'
30 pkgexampledir='${pkgdatadir}/examples'
31 AC_SUBST(pkgexampledir)
37 # is the target os supported?
39 AC_DEFUN([LC_TARGET_SUPPORTED],
51 # Ensure stack size big than 8k in Lustre server (all kernels)
53 AC_DEFUN([LC_STACK_SIZE],
54 [AC_MSG_CHECKING([stack size big than 8k])
55 LB_LINUX_TRY_COMPILE([
56 #include <linux/thread_info.h>
58 #if THREAD_SIZE < 8192
59 #error "stack size < 8192"
64 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
69 # LC_FUNC_DEV_SET_RDONLY
71 # check for the old-style dev_set_rdonly which took an extra "devno" param
72 # and can only set a single device to discard writes at one time
74 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
75 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
76 LB_LINUX_TRY_COMPILE([
78 #include <linux/blkdev.h>
80 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
81 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
85 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
87 AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
88 kernel patches from Lustre version 1.4.3 or above.])
93 # Allow the user to set the MDS thread upper limit
95 AC_DEFUN([LC_MDS_THREADS_MAX],
97 AC_ARG_WITH([mds_max_threads],
98 AC_HELP_STRING([--with-mds-max-threads=size],
99 [define the maximum number of threads available on the MDS: (default=512)]),
101 MDS_THREAD_COUNT=$with_mds_max_threads
102 AC_DEFINE_UNQUOTED(MDS_THREADS_MAX, $MDS_THREAD_COUNT, [maximum number of mdt threads])
107 # LC_CONFIG_BACKINGFS
109 # setup, check the backing filesystem
111 AC_DEFUN([LC_CONFIG_BACKINGFS],
115 if test x$with_ldiskfs = xno ; then
116 if test x$enable_server = xyes ; then
117 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
121 LB_DEFINE_LDISKFS_OPTIONS
124 AC_MSG_CHECKING([which backing filesystem to use])
125 AC_MSG_RESULT([$BACKINGFS])
132 # the pinger is temporary, until we have the recovery node in place
134 AC_DEFUN([LC_CONFIG_PINGER],
135 [AC_MSG_CHECKING([whether to enable pinger support])
136 AC_ARG_ENABLE([pinger],
137 AC_HELP_STRING([--disable-pinger],
138 [disable recovery pinger support]),
139 [],[enable_pinger='yes'])
140 AC_MSG_RESULT([$enable_pinger])
141 if test x$enable_pinger != xno ; then
142 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
149 # do checksum of bulk data between client and OST
151 AC_DEFUN([LC_CONFIG_CHECKSUM],
152 [AC_MSG_CHECKING([whether to enable data checksum support])
153 AC_ARG_ENABLE([checksum],
154 AC_HELP_STRING([--disable-checksum],
155 [disable data checksum support]),
156 [],[enable_checksum='yes'])
157 AC_MSG_RESULT([$enable_checksum])
158 if test x$enable_checksum != xno ; then
159 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
164 # LC_HEADER_LDISKFS_XATTR
166 # CHAOS kernel-devel package will not include fs/ldiskfs/xattr.h
168 AC_DEFUN([LC_HEADER_LDISKFS_XATTR],
169 [AC_MSG_CHECKING([if ldiskfs has xattr.h header])
170 tmp_flags="$EXTRA_KCFLAGS"
171 EXTRA_KCFLAGS="-I$LINUX/fs -I$LDISKFS_DIR -I$LDISKFS_DIR/ldiskfs"
172 LB_LINUX_TRY_COMPILE([
173 #include <ldiskfs/xattr.h>
175 ldiskfs_xattr_get(NULL, 0, "", NULL, 0);
176 ldiskfs_xattr_set_handle(NULL, NULL, 0, "", NULL, 0, 0);
180 AC_DEFINE(HAVE_LDISKFS_XATTR_H, 1, [ldiskfs/xattr.h found])
184 EXTRA_KCFLAGS="$tmp_flags"
188 # LC_CONFIG_HEALTH_CHECK_WRITE
190 # Turn on the actual write to the disk
192 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
193 [AC_MSG_CHECKING([whether to enable a write with the health check])
194 AC_ARG_ENABLE([health-write],
195 AC_HELP_STRING([--enable-health-write],
196 [enable disk writes when doing health check]),
197 [],[enable_health_write='no'])
198 AC_MSG_RESULT([$enable_health_write])
199 if test x$enable_health_write == xyes ; then
200 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
205 # LC_CONFIG_LIBLUSTRE_RECOVERY
207 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
208 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
209 AC_ARG_ENABLE([liblustre-recovery],
210 AC_HELP_STRING([--disable-liblustre-recovery],
211 [disable liblustre recovery support]),
212 [],[enable_liblustre_recovery='yes'])
213 AC_MSG_RESULT([$enable_liblustre_recovery])
214 if test x$enable_liblustre_recovery != xno ; then
215 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
220 # LC_CONFIG_OBD_BUFFER_SIZE
222 # the maximum buffer size of lctl ioctls
224 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
225 [AC_MSG_CHECKING([maximum OBD ioctl size])
226 AC_ARG_WITH([obd-buffer-size],
227 AC_HELP_STRING([--with-obd-buffer-size=[size]],
228 [set lctl ioctl maximum bytes (default=8192)]),
230 OBD_BUFFER_SIZE=$with_obd_buffer_size
234 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
235 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
241 # AIX does not have statfs.f_namelen
243 AC_DEFUN([LC_STRUCT_STATFS],
244 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
245 LB_LINUX_TRY_COMPILE([
246 #include <linux/vfs.h>
252 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
259 # LC_READLINK_SSIZE_T
261 AC_DEFUN([LC_READLINK_SSIZE_T],
262 [AC_MSG_CHECKING([if readlink returns ssize_t])
266 ssize_t readlink(const char *, char *, size_t);
269 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
276 # LC_FUNC_MS_FLOCK_LOCK
278 # 2.6.5 kernel has MS_FLOCK_LOCK sb flag
280 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
281 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
282 LB_LINUX_TRY_COMPILE([
283 #include <linux/fs.h>
285 int flags = MS_FLOCK_LOCK;
287 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
288 [kernel has MS_FLOCK_LOCK flag])
296 # LC_FUNC_HAVE_CAN_SLEEP_ARG
298 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
300 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
301 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
302 LB_LINUX_TRY_COMPILE([
303 #include <linux/fs.h>
307 struct file_lock *file_lock;
308 flock_lock_file_wait(file, file_lock, cansleep);
310 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
311 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
319 # LC_FUNC_RELEASEPAGE_WITH_GFP
321 # 2.6.9 ->releasepage() takes a gfp_t arg
322 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
323 # while others either don't have gfp_t or pass gfp_t as the parameter.
325 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
326 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
327 RELEASEPAGE_WITH_GFP="$(grep -c 'releasepage.*gfp_t' $LINUX/include/linux/fs.h)"
328 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
329 AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
330 [releasepage with gfp_t parameter])
338 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
340 AC_DEFUN([LC_FILEMAP_POPULATE],
341 [AC_MSG_CHECKING([for exported filemap_populate])
342 LB_LINUX_TRY_COMPILE([
343 #include <asm/page.h>
344 #include <linux/mm.h>
346 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
349 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
358 AC_DEFUN([LC_D_ADD_UNIQUE],
359 [AC_MSG_CHECKING([for d_add_unique])
360 LB_LINUX_TRY_COMPILE([
361 #include <linux/dcache.h>
363 d_add_unique(NULL, NULL);
366 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
375 AC_DEFUN([LC_BIT_SPINLOCK_H],
376 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
377 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
378 LB_LINUX_TRY_COMPILE([
379 #include <asm/processor.h>
380 #include <linux/spinlock.h>
381 #include <linux/bit_spinlock.h>
384 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
393 # After 2.6.26 we no longer have xattr_acl.h
395 AC_DEFUN([LC_XATTR_ACL],
396 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
397 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
398 LB_LINUX_TRY_COMPILE([
399 #include <linux/xattr_acl.h>
402 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
414 AC_DEFUN([LC_STRUCT_INTENT_FILE],
415 [AC_MSG_CHECKING([if struct open_intent has a file field])
416 LB_LINUX_TRY_COMPILE([
417 #include <linux/fs.h>
418 #include <linux/namei.h>
420 struct open_intent intent;
424 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
432 # After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
434 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
435 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
436 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
437 LB_LINUX_TRY_COMPILE([
438 #include <linux/fs.h>
439 #include <linux/posix_acl_xattr.h>
442 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
454 # only for Lustre-patched kernels
456 AC_DEFUN([LC_LUSTRE_VERSION_H],
457 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
458 rm -f "$LUSTRE/include/linux/lustre_version.h"
460 touch "$LUSTRE/include/linux/lustre_version.h"
461 if test x$enable_server = xyes ; then
462 AC_MSG_WARN([Unpatched kernel detected.])
463 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
464 AC_MSG_WARN([disabling server build])
468 if test x$enable_server = xyes ; then
469 if test x$RHEL_KERNEL = xyes -a x$LINUXRELEASE != x${LINUXRELEASE##2.6.9} ; then
470 AC_MSG_WARN([Lustre server has been disabled with rhel4 kernel;])
471 AC_MSG_WARN([disabling server build])
474 if test x$SUSE_KERNEL = xyes -a x$LINUXRELEASE != x${LINUXRELEASE##2.6.5} ; then
475 AC_MSG_WARN([Lustre server has been disabled with sles9 kernel;])
476 AC_MSG_WARN([disabling server build])
483 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
485 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
486 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
487 LB_LINUX_TRY_COMPILE([
488 #include <linux/fs.h>
490 int v = FS_RENAME_DOES_D_MOVE;
493 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
503 # rhel4.2 kernel has f_op->flock field
505 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
506 [AC_MSG_CHECKING([if struct file_operations has flock field])
507 LB_LINUX_TRY_COMPILE([
508 #include <linux/fs.h>
510 struct file_operations ll_file_operations_flock;
511 ll_file_operations_flock.flock = NULL;
513 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
514 [struct file_operations has flock field])
521 # LC_EXPORT_SYNCHRONIZE_RCU
522 # after 2.6.12 synchronize_rcu is preferred over synchronize_kernel
523 AC_DEFUN([LC_EXPORT_SYNCHRONIZE_RCU],
524 [LB_CHECK_SYMBOL_EXPORT([synchronize_rcu],
525 [kernel/rcupdate.c],[
526 AC_DEFINE(HAVE_SYNCHRONIZE_RCU, 1,
527 [in 2.6.12 synchronize_rcu preferred over synchronize_kernel])
533 # after 2.6.15 inode have i_mutex intead of i_sem
534 AC_DEFUN([LC_INODE_I_MUTEX],
535 [AC_MSG_CHECKING([if inode has i_mutex ])
536 LB_LINUX_TRY_COMPILE([
537 #include <linux/mutex.h>
538 #include <linux/fs.h>
543 mutex_unlock(&i.i_mutex);
546 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
547 [after 2.6.15 inode have i_mutex intead of i_sem])
554 # after 2.6.17 dquote use mutex instead if semaphore
555 AC_DEFUN([LC_DQUOTOFF_MUTEX],
556 [AC_MSG_CHECKING([use dqonoff_mutex])
557 LB_LINUX_TRY_COMPILE([
558 #include <linux/mutex.h>
559 #include <linux/fs.h>
560 #include <linux/quota.h>
562 struct quota_info dq;
564 mutex_unlock(&dq.dqonoff_mutex);
567 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
568 [after 2.6.17 dquote use mutex instead if semaphore])
576 # starting from 2.6.18 the file_operations .flush
577 # method has a new "fl_owner_t id" parameter
579 AC_DEFUN([LC_FLUSH_OWNER_ID],
580 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
581 LB_LINUX_TRY_COMPILE([
582 #include <linux/fs.h>
584 struct file_operations *fops = NULL;
588 i = fops->flush(NULL, id);
590 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
591 [file_operations .flush method has an fl_owner_t id])
599 # LC_STATFS_DENTRY_PARAM
600 # starting from 2.6.18 linux kernel uses dentry instead of super_block
601 # for the first parameter of the super_operations->statfs() callback.
603 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
604 [AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
605 tmp_flags="$EXTRA_KCFLAGS"
606 EXTRA_KCFLAGS="-Werror"
607 LB_LINUX_TRY_COMPILE([
608 #include <linux/fs.h>
610 ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
612 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
613 [super_ops.statfs() first parameter is dentry])
618 EXTRA_KCFLAGS="$tmp_flags"
623 # starting from 2.6.18 kernel don't export do_kern_mount
624 # and want to use vfs_kern_mount instead.
626 AC_DEFUN([LC_VFS_KERN_MOUNT],
627 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
628 LB_LINUX_TRY_COMPILE([
629 #include <linux/mount.h>
631 vfs_kern_mount(NULL, 0, NULL, NULL);
633 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
634 [vfs_kern_mount exist in kernel])
642 # LC_INVALIDATEPAGE_RETURN_INT
643 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
645 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
646 [AC_MSG_CHECKING([invalidatepage has return int])
647 LB_LINUX_TRY_COMPILE([
648 #include <linux/buffer_head.h>
650 int rc = block_invalidatepage(NULL, 0);
653 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
654 [Define if return type of invalidatepage should be int])
660 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
661 # after 2.6.18 umount_begin has different parameters
662 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
663 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
664 tmp_flags="$EXTRA_KCFLAGS"
665 EXTRA_KCFLAGS="-Werror"
666 LB_LINUX_TRY_COMPILE([
667 #include <linux/fs.h>
670 static void cfg_umount_begin (struct vfsmount *v, int flags)
675 static struct super_operations cfg_super_operations = {
676 .umount_begin = cfg_umount_begin,
679 cfg_super_operations.umount_begin(NULL,0);
682 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
683 [Define umount_begin need second argument])
687 EXTRA_KCFLAGS="$tmp_flags"
690 # inode have i_private field since 2.6.17
691 AC_DEFUN([LC_INODE_IPRIVATE],
692 [AC_MSG_CHECKING([if inode has a i_private field])
693 LB_LINUX_TRY_COMPILE([
694 #include <linux/fs.h>
700 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
701 [struct inode has i_private field])
708 # inode don't have i_blksize field
709 AC_DEFUN([LC_INODE_BLKSIZE],
710 [AC_MSG_CHECKING([inode has i_blksize field])
711 LB_LINUX_TRY_COMPILE([
712 #include <linux/fs.h>
718 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
719 [struct inode has i_blksize field])
725 # LC_VFS_READDIR_U64_INO
726 # 2.6.19 use u64 for inode number instead of inode_t
727 AC_DEFUN([LC_VFS_READDIR_U64_INO],
728 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
729 tmp_flags="$EXTRA_KCFLAGS"
730 EXTRA_KCFLAGS="-Werror"
731 LB_LINUX_TRY_COMPILE([
732 #include <linux/fs.h>
733 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
734 u64 ino, unsigned int d_type)
745 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
746 [if vfs_readdir need 64bit inode number])
750 EXTRA_KCFLAGS="$tmp_flags"
753 # LC_FILE_UPDATE_TIME
754 # 2.6.9 has inode_update_time instead of file_update_time
755 AC_DEFUN([LC_FILE_UPDATE_TIME],
756 [AC_MSG_CHECKING([if file_update_time is exported])
757 LB_LINUX_TRY_COMPILE([
758 #include <linux/fs.h>
760 file_update_time(NULL);
763 AC_DEFINE(HAVE_FILE_UPDATE_TIME, 1,
764 [use file_update_time])
771 # 2.6.19 replaced writev with aio_write
772 AC_DEFUN([LC_FILE_WRITEV],
773 [AC_MSG_CHECKING([writev in fops])
774 LB_LINUX_TRY_COMPILE([
775 #include <linux/fs.h>
777 struct file_operations *fops = NULL;
781 AC_DEFINE(HAVE_FILE_WRITEV, 1,
789 # LC_GENERIC_FILE_READ
790 # 2.6.19 replaced readv with aio_read
791 AC_DEFUN([LC_FILE_READV],
792 [AC_MSG_CHECKING([readv in fops])
793 LB_LINUX_TRY_COMPILE([
794 #include <linux/fs.h>
796 struct file_operations *fops = NULL;
800 AC_DEFINE(HAVE_FILE_READV, 1,
808 # 2.6.18 don't export nr_pagecahe
809 AC_DEFUN([LC_NR_PAGECACHE],
810 [AC_MSG_CHECKING([kernel export nr_pagecache])
811 LB_LINUX_TRY_COMPILE([
812 #include <linux/pagemap.h>
814 return atomic_read(&nr_pagecache);
817 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
818 [is kernel export nr_pagecache])
824 # LC_CANCEL_DIRTY_PAGE
825 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
826 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
827 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
828 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
829 # backport is broken, so ignore it
830 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
831 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
834 LB_LINUX_TRY_COMPILE([
835 #include <linux/mm.h>
836 #include <linux/page-flags.h>
838 cancel_dirty_page(NULL, 0);
841 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
842 [kernel has cancel_dirty_page instead of clear_page_dirty])
852 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
853 # it support constant page, which means the page won't be modified during the
856 AC_DEFUN([LC_PAGE_CONSTANT],
857 [AC_MSG_CHECKING([if kernel have PageConstant defined])
858 LB_LINUX_TRY_COMPILE([
859 #include <linux/mm.h>
860 #include <linux/page-flags.h>
863 #error "Have no raid5 zcopy patch"
867 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
873 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
874 AC_DEFUN([LC_PG_FS_MISC],
875 [AC_MSG_CHECKING([kernel has PG_fs_misc])
876 LB_LINUX_TRY_COMPILE([
877 #include <linux/mm.h>
878 #include <linux/page-flags.h>
881 #error PG_fs_misc not defined in kernel
885 AC_DEFINE(HAVE_PG_FS_MISC, 1,
886 [is kernel have PG_fs_misc])
892 # RHEL5 PageChecked and SetPageChecked defined
893 AC_DEFUN([LC_PAGE_CHECKED],
894 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
895 LB_LINUX_TRY_COMPILE([
896 #include <linux/autoconf.h>
897 #ifdef HAVE_LINUX_MMTYPES_H
898 #include <linux/mm_types.h>
900 #include <linux/page-flags.h>
904 /* before 2.6.26 this define*/
906 /* 2.6.26 use function instead of define for it */
912 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
913 [does kernel have PageChecked and SetPageChecked])
919 # truncate_complete_page() was exported from RHEL5/SLES10/SLES11
920 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
921 # delete_from_page_cache() is exported from 2.6.39
922 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE],
923 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
925 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
926 [kernel export truncate_complete_page])])
927 LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
929 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
930 [kernel export remove_from_page_cache])])
931 LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
933 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
934 [kernel export delete_from_page_cache])])
937 AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
938 [LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
940 AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
941 [kernel export truncate_inode_pages_range])
946 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
947 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
949 AC_DEFINE(HAVE_D_REHASH_COND, 1,
950 [d_rehash_cond is exported by the kernel])
955 AC_DEFUN([LC_EXPORT___D_REHASH],
956 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
958 AC_DEFINE(HAVE___D_REHASH, 1,
959 [__d_rehash is exported by the kernel])
964 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
965 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
967 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
968 [d_move_locked is exported by the kernel])
973 AC_DEFUN([LC_EXPORT___D_MOVE],
974 [LB_CHECK_SYMBOL_EXPORT([__d_move],
976 AC_DEFINE(HAVE___D_MOVE, 1,
977 [__d_move is exported by the kernel])
983 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
985 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
986 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
988 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
989 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
990 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
991 [exported invalidate_mapping_pages])],
992 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
993 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
994 [exported invalidate_inode_pages])], [
995 AC_MSG_ERROR([no way to invalidate pages])
1001 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
1003 # No standard kernels export this
1005 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1006 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1008 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1009 [filemap_fdatawrite_range is exported by the kernel])
1014 # The actual symbol exported varies among architectures, so we need
1015 # to check many symbols (but only in the current architecture.) No
1016 # matter what symbol is exported, the kernel #defines node_to_cpumask
1017 # to the appropriate function and that's what we use.
1018 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1019 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1020 [arch/$LINUX_ARCH/mm/numa.c],
1021 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1022 [node_to_cpumask is exported by
1023 the kernel])]) # x86_64
1024 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1025 [arch/$LINUX_ARCH/kernel/smpboot.c],
1026 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1027 [node_to_cpumask is exported by
1028 the kernel])]) # ia64
1029 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1030 [arch/$LINUX_ARCH/kernel/smpboot.c],
1031 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1032 [node_to_cpumask is exported by
1033 the kernel])]) # i386
1037 # LC_VFS_INTENT_PATCHES
1039 # check if the kernel has the VFS intent patches
1040 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1041 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1042 LB_LINUX_TRY_COMPILE([
1043 #include <linux/fs.h>
1044 #include <linux/namei.h>
1046 struct nameidata nd;
1047 struct lookup_intent *it;
1050 intent_init(it, IT_OPEN);
1051 it->d.lustre.it_disposition = 0;
1052 it->d.lustre.it_data = NULL;
1054 AC_MSG_RESULT([yes])
1055 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1061 # 2.6.22 lost second parameter for invalidate_bdev
1062 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1063 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1064 LB_LINUX_TRY_COMPILE([
1065 #include <linux/buffer_head.h>
1067 invalidate_bdev(NULL,0);
1069 AC_MSG_RESULT([yes])
1070 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1071 [invalidate_bdev has second argument])
1077 # 2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1078 AC_DEFUN([LC_RW_TREE_LOCK],
1079 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1080 tmp_flags="$EXTRA_KCFLAGS"
1081 EXTRA_KCFLAGS="-Werror"
1082 LB_LINUX_TRY_COMPILE([
1083 #include <linux/fs.h>
1085 struct address_space a;
1087 write_lock(&a.tree_lock);
1089 AC_MSG_RESULT([yes])
1090 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1094 EXTRA_KCFLAGS="$tmp_flags"
1098 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1100 # Check for our patched grab_cache_page_nowait_gfp() function
1101 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
1103 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
1104 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
1106 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
1107 [kernel exports grab_cache_page_nowait_gfp])
1109 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1111 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1112 [kernel exports add_to_page_cache_lru])
1119 # 2.6.23 have return type 'void' for unregister_blkdev
1120 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1121 [AC_MSG_CHECKING([if unregister_blkdev return int])
1122 LB_LINUX_TRY_COMPILE([
1123 #include <linux/fs.h>
1125 int i = unregister_blkdev(0,NULL);
1127 AC_MSG_RESULT([yes])
1128 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1129 [unregister_blkdev return int])
1135 # 2.6.23 change .sendfile to .splice_read
1136 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1137 AC_DEFUN([LC_KERNEL_SENDFILE],
1138 [AC_MSG_CHECKING([if kernel has .sendfile])
1139 LB_LINUX_TRY_COMPILE([
1140 #include <linux/fs.h>
1142 struct file_operations file;
1144 file.sendfile = NULL;
1146 AC_MSG_RESULT([yes])
1147 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1148 [kernel has .sendfile])
1154 # 2.6.23 change .sendfile to .splice_read
1155 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1156 [AC_MSG_CHECKING([if kernel has .splice_read])
1157 LB_LINUX_TRY_COMPILE([
1158 #include <linux/fs.h>
1160 struct file_operations file;
1162 file.splice_read = NULL;
1164 AC_MSG_RESULT([yes])
1165 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1166 [kernel has .slice_read])
1172 # 2.6.23 extract nfs export related data into exportfs.h
1173 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1174 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1175 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1176 [kernel has include/exportfs.h])
1182 # 2.6.23 have new page fault handling API
1183 AC_DEFUN([LC_VM_OP_FAULT],
1184 [AC_MSG_CHECKING([if kernel has .fault in vm_operation_struct])
1185 LB_LINUX_TRY_COMPILE([
1186 #include <linux/mm.h>
1188 struct vm_operations_struct op;
1192 AC_MSG_RESULT([yes])
1193 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1194 [if kernel has .fault in vm_operation_struct])
1200 # 2.6.23 has new shrinker API
1201 AC_DEFUN([LC_REGISTER_SHRINKER],
1202 [LB_CHECK_SYMBOL_EXPORT([register_shrinker],
1204 AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
1205 [kernel exports register_shrinker])
1206 # 2.6.32 added another argument to struct shrinker->shrink
1207 AC_MSG_CHECKING([if passing shrinker as first argument])
1208 tmp_flags="$EXTRA_KCFLAGS"
1209 EXTRA_KCFLAGS="-Werror"
1210 LB_LINUX_TRY_COMPILE([
1211 #include <linux/mm.h>
1212 int test_shrink(struct shrinker *, int, gfp_t);
1214 struct shrinker *shr = NULL;
1215 shr->shrink = test_shrink;
1217 AC_MSG_RESULT([yes])
1218 AC_DEFINE(SHRINKER_FIRST_ARG, [struct shrinker *shrinker,],
1219 [kernel is passing shrinker as first argument])
1222 AC_DEFINE(SHRINKER_FIRST_ARG, ,
1223 [kernel doesn't have shrinker as first argument])
1225 EXTRA_KCFLAGS="$tmp_flags"
1227 AC_DEFINE(SHRINKER_FIRST_ARG, ,
1228 [kernel doesn't have shrinker as first argument])
1232 # 2.6.23 add code to wait other users to complete before removing procfs entry
1233 AC_DEFUN([LC_PROCFS_USERS],
1234 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1235 LB_LINUX_TRY_COMPILE([
1236 #include <linux/proc_fs.h>
1238 struct proc_dir_entry pde;
1242 AC_MSG_RESULT([yes])
1243 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1244 [kernel has pde_users member in procfs entry struct])
1250 # 2.6.24 has bio_endio with 2 args
1251 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1252 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1253 LB_LINUX_TRY_COMPILE([
1254 #include <linux/bio.h>
1258 AC_MSG_RESULT([yes])
1259 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1260 [if kernel has bio_endio with 2 args])
1266 # 2.6.24 has new members in exports struct.
1267 AC_DEFUN([LC_FH_TO_DENTRY],
1268 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1269 LB_LINUX_TRY_COMPILE([
1270 #ifdef HAVE_LINUX_EXPORTFS_H
1271 #include <linux/exportfs.h>
1273 #include <linux/fs.h>
1276 struct export_operations exp;
1278 exp.fh_to_dentry = NULL;
1280 AC_MSG_RESULT([yes])
1281 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1282 [kernel has .fh_to_dentry member in export_operations struct])
1288 # 2.6.24 need linux/mm_types.h included
1289 AC_DEFUN([LC_HAVE_MMTYPES_H],
1290 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1291 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1292 [kernel has include/mm_types.h])
1298 # 2.6.24 remove long aged procfs entry -> deleted member
1299 AC_DEFUN([LC_PROCFS_DELETED],
1300 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1301 LB_LINUX_TRY_COMPILE([
1302 #include <linux/proc_fs.h>
1304 struct proc_dir_entry pde;
1308 AC_MSG_RESULT([yes])
1309 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1310 [kernel has deleted member in procfs entry struct])
1316 # 2.6.25 change define to inline
1317 AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
1318 [AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
1319 LB_LINUX_TRY_COMPILE([
1320 #include <linux/backing-dev.h>
1322 #ifndef mapping_cap_writeback_dirty
1323 mapping_cap_writeback_dirty(NULL);
1326 AC_MSG_RESULT([yes])
1327 AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
1328 [kernel have mapping_cap_writeback_dirty])
1336 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1337 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1338 [AC_MSG_CHECKING([fs_struct use path structure])
1339 LB_LINUX_TRY_COMPILE([
1340 #include <asm/atomic.h>
1341 #include <linux/spinlock.h>
1342 #include <linux/fs_struct.h>
1345 struct fs_struct fs;
1349 AC_MSG_RESULT([yes])
1350 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1351 [fs_struct use path structure])
1361 # If we have fiemap.h
1362 # after 2.6.27 use fiemap.h in include/linux
1364 AC_DEFUN([LC_LINUX_FIEMAP_H],
1365 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1366 AC_MSG_CHECKING([if fiemap.h can be compiled])
1367 LB_LINUX_TRY_COMPILE([
1368 #include <linux/types.h>
1369 #include <linux/fiemap.h>
1371 AC_MSG_RESULT([yes])
1372 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1381 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1382 [AC_MSG_CHECKING([inode_operations->permission have two args])
1383 LB_LINUX_TRY_COMPILE([
1384 #include <linux/fs.h>
1386 struct inode *inode;
1388 inode->i_op->permission(NULL,0);
1390 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1391 [inode_operations->permission have two args])
1392 AC_MSG_RESULT([yes])
1398 # 2.6.27 have file_remove_suid instead of remove_suid
1399 AC_DEFUN([LC_FILE_REMOVE_SUID],
1400 [AC_MSG_CHECKING([kernel have file_remove_suid])
1401 LB_LINUX_TRY_COMPILE([
1402 #include <linux/fs.h>
1404 file_remove_suid(NULL);
1406 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1407 [kernel have file_remove_suid])
1408 AC_MSG_RESULT([yes])
1414 # (Ubuntu) 2.6.24's remove_suid() takes a struct path *
1415 AC_DEFUN([LC_PATH_REMOVE_SUID],
1416 [AC_MSG_CHECKING([kernel has a remove_suid that takes a struct path])
1417 LB_LINUX_TRY_COMPILE([
1418 #include <linux/fs.h>
1420 struct path *a_path = NULL;
1421 remove_suid(a_path);
1423 AC_DEFINE(HAVE_PATH_REMOVE_SUID, 1,
1424 [kernel has a remove suid that takes a struct path])
1425 AC_MSG_RESULT([yes])
1431 # 2.6.27 have new page locking API
1432 AC_DEFUN([LC_TRYLOCKPAGE],
1433 [AC_MSG_CHECKING([kernel use trylock_page for page lock])
1434 LB_LINUX_TRY_COMPILE([
1435 #include <linux/pagemap.h>
1439 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1440 [kernel use trylock_page for page lock])
1441 AC_MSG_RESULT([yes])
1447 # 2.6.27 and some older have mapping->tree_lock as spin_lock
1448 AC_DEFUN([LC_RW_TREE_LOCK],
1449 [AC_MSG_CHECKING([mapping->tree_lock is rw_lock])
1450 tmp_flags="$EXTRA_KCFLAGS"
1451 EXTRA_KCFLAGS="-Werror"
1452 LB_LINUX_TRY_COMPILE([
1453 #include <linux/fs.h>
1455 struct address_space *map = NULL;
1457 write_lock_irq(&map->tree_lock);
1460 AC_DEFINE(HAVE_RW_TREE_LOCK, 1,
1461 [mapping->tree_lock is rw_lock])
1465 EXTRA_KCFLAGS="$tmp_flags"
1468 # 2.6.5 sles9 hasn't define sysctl_vfs_cache_pressure
1469 AC_DEFUN([LC_HAVE_SYSCTL_VFS_CACHE_PRESSURE],
1470 [LB_CHECK_SYMBOL_EXPORT([sysctl_vfs_cache_pressure],
1472 AC_DEFINE(HAVE_SYSCTL_VFS_CACHE_PRESSURE, 1, [kernel exports sysctl_vfs_cache_pressure])
1477 # vfs_symlink seems to have started out with 3 args until 2.6.7 where a
1478 # "mode" argument was added, but then again, in some later version it was
1480 AC_DEFUN([LC_4ARGS_VFS_SYMLINK],
1481 [AC_MSG_CHECKING([if vfs_symlink wants 4 args])
1482 LB_LINUX_TRY_COMPILE([
1483 #include <linux/fs.h>
1486 struct dentry *dentry;
1487 const char *oldname = NULL;
1490 vfs_symlink(dir, dentry, oldname, mode);
1493 AC_DEFINE(HAVE_4ARGS_VFS_SYMLINK, 1,
1494 [vfs_symlink wants 4 args])
1500 # 2.6.27 sles11 remove the bi_hw_segments
1501 AC_DEFUN([LC_BI_HW_SEGMENTS],
1502 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1503 LB_LINUX_TRY_COMPILE([
1504 #include <linux/bio.h>
1507 io.bi_hw_segments = 0;
1509 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1510 [struct bio has a bi_hw_segments field])
1511 AC_MSG_RESULT([yes])
1518 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1519 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1520 AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
1521 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[
1522 AC_DEFINE(HAVE_QUOTAIO_V1_H, 1,
1523 [kernel has include/linux/quotaio_v1.h])
1524 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v1.h],[
1525 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_V1_H, 1,
1526 [kernel has fs/quota/quotaio_v1.h])
1533 # sles10 sp2 need 5 parameter for vfs_symlink
1534 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
1535 [AC_MSG_CHECKING([vfs_symlink need 5 parameter])
1536 LB_LINUX_TRY_COMPILE([
1537 #include <linux/fs.h>
1539 struct inode *dir = NULL;
1540 struct dentry *dentry = NULL;
1541 struct vfsmount *mnt = NULL;
1542 const char * path = NULL;
1543 vfs_symlink(dir, dentry, mnt, path, 0);
1545 AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
1546 [vfs_symlink need 5 parameteres])
1547 AC_MSG_RESULT([yes])
1553 # 2.6.27 removed the read_inode from super_operations.
1554 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1555 [AC_MSG_CHECKING([super_operations has a read_inode field])
1556 LB_LINUX_TRY_COMPILE([
1557 #include <linux/fs.h>
1559 struct super_operations *sop;
1560 sop->read_inode(NULL);
1562 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1563 [super_operations has a read_inode])
1564 AC_MSG_RESULT([yes])
1570 # 2.6.27 sles11 has sb_any_quota_active
1571 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1572 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1573 LB_LINUX_TRY_COMPILE([
1574 #include <linux/quotaops.h>
1576 sb_any_quota_active(NULL);
1578 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1579 [Kernel has a sb_any_quota_active])
1580 AC_MSG_RESULT([yes])
1586 # 2.6.27 sles11 has sb_has_quota_active
1587 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1588 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1589 LB_LINUX_TRY_COMPILE([
1590 #include <linux/quotaops.h>
1592 sb_has_quota_active(NULL, 0);
1594 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1595 [Kernel has a sb_has_quota_active])
1596 AC_MSG_RESULT([yes])
1602 # 2.6.27 has inode_permission instead of permisson
1603 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1604 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1606 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1607 [inode_permission is exported by the kernel])
1612 # 2.6.27 use 5th parameter in quota_on for remount.
1613 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1614 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1615 LB_LINUX_TRY_COMPILE([
1616 #include <linux/quota.h>
1618 struct quotactl_ops *qop;
1619 qop->quota_on(NULL, 0, 0, NULL, 0);
1621 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1622 [quota_on needs 5 paramters])
1623 AC_MSG_RESULT([yes])
1629 # 2.6.27 use 3th parameter in quota_off for remount.
1630 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1631 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1632 LB_LINUX_TRY_COMPILE([
1633 #include <linux/quota.h>
1635 struct quotactl_ops *qop;
1636 qop->quota_off(NULL, 0, 0);
1638 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1639 [quota_off needs 3 paramters])
1640 AC_MSG_RESULT([yes])
1646 # 2.6.27 has vfs_dq_off inline function.
1647 AC_DEFUN([LC_VFS_DQ_OFF],
1648 [AC_MSG_CHECKING([vfs_dq_off is defined])
1649 LB_LINUX_TRY_COMPILE([
1650 #include <linux/quotaops.h>
1652 vfs_dq_off(NULL, 0);
1654 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1655 AC_MSG_RESULT([yes])
1661 # 2.6.27 has bdi_init()/bdi_destroy() functions.
1662 AC_DEFUN([LC_EXPORT_BDI_INIT],
1663 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1664 [mm/backing-dev.c],[
1665 AC_DEFINE(HAVE_BDI_INIT, 1,
1666 [bdi_init/bdi_destroy functions are present])
1673 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1674 # d_obtain_alias() for getting anonymous dentries
1676 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1677 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1678 LB_LINUX_TRY_COMPILE([
1679 #include <linux/dcache.h>
1681 d_obtain_alias(NULL);
1683 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1684 [d_obtain_alias exist in kernel])
1685 AC_MSG_RESULT([yes])
1691 # 2.6.29 change prepare/commit_write to write_begin/end
1692 AC_DEFUN([LC_WRITE_BEGIN_END],
1693 [AC_MSG_CHECKING([if kernel has .write_begin/end])
1694 LB_LINUX_TRY_COMPILE([
1695 #include <linux/fs.h>
1696 #ifdef HAVE_LINUX_MMTYPES_H
1697 #include <linux/mm_types.h>
1699 #include <linux/pagemap.h>
1701 struct address_space_operations aops;
1704 aops.write_begin = NULL;
1705 aops.write_end = NULL;
1706 page = grab_cache_page_write_begin(NULL, 0, 0);
1708 AC_MSG_RESULT([yes])
1709 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
1710 [kernel has .write_begin/end])
1716 # 2.6.29 blkdev_put has 2 arguments
1717 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
1718 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
1719 LB_LINUX_TRY_COMPILE([
1720 #include <linux/fs.h>
1722 blkdev_put(NULL, 0);
1724 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
1725 [blkdev_put needs 2 paramters])
1726 AC_MSG_RESULT([yes])
1732 # 2.6.29 dentry_open has 4 arguments
1733 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
1734 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
1735 LB_LINUX_TRY_COMPILE([
1736 #include <linux/fs.h>
1738 dentry_open(NULL, NULL, 0, NULL);
1740 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
1741 [dentry_open needs 4 paramters])
1742 AC_MSG_RESULT([yes])
1748 AC_DEFUN([LC_ATOMIC_CMPXCHG],
1749 [AC_MSG_CHECKING([if kernel has atomic_cmpxchg])
1750 LB_LINUX_TRY_COMPILE([
1751 #include <asm/atomic.h>
1753 #ifndef atomic_cmpxchg
1754 #error missing atomic_cmpxchg
1757 AC_MSG_RESULT([yes])
1758 AC_DEFINE(HAVE_ATOMIC_CMPXCHG, 1, [kernel has atomic_cmpxchg])
1764 AC_DEFUN([LC_ATOMIC_INC_NOT_ZERO],
1765 [AC_MSG_CHECKING([if kernel has atomic_inc_not_zero])
1766 LB_LINUX_TRY_COMPILE([
1767 #include <asm/atomic.h>
1769 #ifndef atomic_inc_not_zero
1770 #error missing atomic_inc_not_zero
1773 AC_MSG_RESULT([yes])
1774 AC_DEFINE(HAVE_ATOMIC_INC_NOT_ZERO, 1, [kernel has atomic_inc_not_zero])
1780 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1781 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1782 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1783 LB_LINUX_TRY_COMPILE([
1784 #include <linux/blkdev.h>
1786 blk_queue_logical_block_size(NULL, 0);
1789 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1790 [blk_queue_logical_block_size is defined])
1796 # 2.6.32 has bdi_register() functions.
1797 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1798 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1799 [mm/backing-dev.c],[
1800 AC_DEFINE(HAVE_BDI_REGISTER, 1,
1801 [bdi_register function is present])
1806 # 2.6.32 add s_bdi for super block
1807 AC_DEFUN([LC_SB_BDI],
1808 [AC_MSG_CHECKING([if super_block has s_bdi field])
1809 LB_LINUX_TRY_COMPILE([
1810 #include <linux/fs.h>
1812 struct super_block sb;
1816 AC_DEFINE(HAVE_SB_BDI, 1,
1817 [super_block has s_bdi field])
1823 # LC_WALK_SPACE_HAS_DATA_SEM
1825 # 2.6.33 ext4_ext_walk_space() takes i_data_sem internally.
1826 # Not a very robust check, but it will hopefully last long
1827 # enough until it can avoid being conditional.
1829 AC_DEFUN([LC_WALK_SPACE_HAS_DATA_SEM],
1830 [AC_MSG_CHECKING([if ext4_ext_walk_space() takes i_data_sem])
1831 WALK_SPACE_DATA_SEM="$(awk '/ext4_ext_walk_space/,/ext4_ext_find_extent/' $LINUX/fs/ext4/extents.c | grep -c 'down_read.*i_data_sem')"
1832 if test "$WALK_SPACE_DATA_SEM" != 0 ; then
1833 AC_DEFINE(WALK_SPACE_HAS_DATA_SEM, 1,
1834 [ext4_ext_walk_space takes i_data_sem])
1835 AC_MSG_RESULT([yes])
1841 # 2.6.32 without DQUOT_INIT defined.
1842 AC_DEFUN([LC_DQUOT_INIT],
1843 [AC_MSG_CHECKING([if DQUOT_INIT is defined])
1844 LB_LINUX_TRY_COMPILE([
1845 #include <linux/quotaops.h>
1850 AC_DEFINE(HAVE_DQUOT_INIT, 1,
1851 [DQUOT_INIT is defined])
1857 # 2.6.32 add a limits member in struct request_queue.
1858 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1859 [AC_MSG_CHECKING([if request_queue has a limits field])
1860 LB_LINUX_TRY_COMPILE([
1861 #include <linux/blkdev.h>
1863 struct request_queue rq;
1864 rq.limits.io_min = 0;
1867 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1868 [request_queue has a limits field])
1874 # RHEL6(backport from 2.6.34) removes 2 functions blk_queue_max_phys_segments and
1875 # blk_queue_max_hw_segments add blk_queue_max_segments
1876 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1877 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1878 LB_LINUX_TRY_COMPILE([
1879 #include <linux/blkdev.h>
1881 blk_queue_max_segments(NULL, 0);
1884 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1885 [blk_queue_max_segments is defined])
1891 # RHEL6(backport from 2.6.34) removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1892 # check blk_queue_max_sectors and use it until disappear.
1893 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1894 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1895 LB_LINUX_TRY_COMPILE([
1896 #include <linux/blkdev.h>
1898 blk_queue_max_sectors(NULL, 0);
1901 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1902 [blk_queue_max_sectors is defined])
1912 # Lustre linux kernel checks
1914 AC_DEFUN([LC_PROG_LINUX],
1915 [LC_LUSTRE_VERSION_H
1916 if test x$enable_server = xyes ; then
1917 LC_FUNC_DEV_SET_RDONLY
1923 LC_CONFIG_LIBLUSTRE_RECOVERY
1924 LC_CONFIG_HEALTH_CHECK_WRITE
1925 LC_CONFIG_LRU_RESIZE
1926 LC_CONFIG_ADAPTIVE_TIMEOUTS
1927 LC_CONFIG_DELAYED_RECOVERY
1931 LC_EXPORT_TRUNCATE_COMPLETE_PAGE
1932 LC_EXPORT_TRUNCATE_RANGE
1933 LC_EXPORT_D_REHASH_COND
1934 LC_EXPORT___D_REHASH
1935 LC_EXPORT_D_MOVE_LOCKED
1937 LC_EXPORT_NODE_TO_CPUMASK
1939 LC_FUNC_RELEASEPAGE_WITH_GFP
1940 LC_HEADER_LDISKFS_XATTR
1941 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1947 LC_STRUCT_INTENT_FILE
1948 LC_POSIX_ACL_XATTR_H
1949 LC_FUNC_MS_FLOCK_LOCK
1950 LC_FUNC_HAVE_CAN_SLEEP_ARG
1953 LC_COOKIE_FOLLOW_LINK
1956 LC_4ARGS_VFS_SYMLINK
1958 # does the kernel have VFS intent patches?
1959 LC_VFS_INTENT_PATCHES
1962 LC_HAVE_SYSCTL_VFS_CACHE_PRESSURE
1966 LC_EXPORT_SYNCHRONIZE_RCU
1971 LC_ATOMIC_INC_NOT_ZERO
1974 LC_SECURITY_PLUG # for SLES10 SP2
1981 LC_STATFS_DENTRY_PARAM
1983 LC_INVALIDATEPAGE_RETURN_INT
1984 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1986 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1988 if test x$enable_server = xyes ; then
1989 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1992 #2.6.18 + RHEL5 (fc6)
1999 LC_VFS_READDIR_U64_INO
2005 LC_CANCEL_DIRTY_PAGE
2007 # raid5-zerocopy patch
2011 LC_INVALIDATE_BDEV_2ARG
2012 LC_FS_RENAME_DOES_D_MOVE
2014 LC_UNREGISTER_BLKDEV_RETURN_INT
2016 LC_KERNEL_SPLICE_READ
2019 LC_REGISTER_SHRINKER
2023 LC_MAPPING_CAP_WRITEBACK_DIRTY
2031 # 2.6.24-19-generic Ubuntu
2035 LC_FS_STRUCT_USE_PATH
2038 LC_INODE_PERMISION_2ARGS
2042 LC_READ_INODE_IN_SBOPS
2043 LC_EXPORT_INODE_PERMISSION
2048 # 2.6.27.15-2 sles11
2050 LC_HAVE_QUOTAIO_V1_H
2051 LC_VFS_SYMLINK_5ARGS
2052 LC_SB_ANY_QUOTA_ACTIVE
2053 LC_SB_HAS_QUOTA_ACTIVE
2060 LC_DENTRY_OPEN_4ARGS
2063 LC_BLK_QUEUE_LOG_BLK_SIZE
2066 LC_EXPORT_BDI_REGISTER
2068 if test x$enable_server = xyes ; then
2069 LC_WALK_SPACE_HAS_DATA_SEM
2072 LC_REQUEST_QUEUE_LIMITS
2073 LC_BLK_QUEUE_MAX_SECTORS
2074 LC_BLK_QUEUE_MAX_SEGMENTS
2077 if test x$enable_server = xyes ; then
2078 LC_QUOTA64 # must after LC_HAVE_QUOTAIO_V1_H
2083 # LC_CONFIG_CLIENT_SERVER
2085 # Build client/server sides of Lustre
2087 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2088 [AC_MSG_CHECKING([whether to build Lustre server support])
2089 AC_ARG_ENABLE([server],
2090 AC_HELP_STRING([--disable-server],
2091 [disable Lustre server support]),
2092 [],[enable_server='yes'])
2093 AC_MSG_RESULT([$enable_server])
2095 AC_MSG_CHECKING([whether to build Lustre client support])
2096 AC_ARG_ENABLE([client],
2097 AC_HELP_STRING([--disable-client],
2098 [disable Lustre client support]),
2099 [],[enable_client='yes'])
2100 AC_MSG_RESULT([$enable_client])])
2103 # LC_CONFIG_LIBLUSTRE
2105 # whether to build liblustre
2107 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2108 [AC_MSG_CHECKING([whether to build Lustre library])
2109 AC_ARG_ENABLE([liblustre],
2110 AC_HELP_STRING([--disable-liblustre],
2111 [disable building of Lustre library]),
2112 [],[enable_liblustre=$with_sysio])
2113 AC_MSG_RESULT([$enable_liblustre])
2114 # only build sysio if liblustre is built
2115 with_sysio="$enable_liblustre"
2117 AC_MSG_CHECKING([whether to build liblustre tests])
2118 AC_ARG_ENABLE([liblustre-tests],
2119 AC_HELP_STRING([--enable-liblustre-tests],
2120 [enable liblustre tests, if --disable-tests is used]),
2121 [],[enable_liblustre_tests=$enable_tests])
2122 if test x$enable_liblustre != xyes ; then
2123 enable_liblustre_tests='no'
2125 AC_MSG_RESULT([$enable_liblustre_tests])
2127 AC_MSG_CHECKING([whether to enable liblustre acl])
2128 AC_ARG_ENABLE([liblustre-acl],
2129 AC_HELP_STRING([--disable-liblustre-acl],
2130 [disable ACL support for liblustre]),
2131 [],[enable_liblustre_acl=yes])
2132 AC_MSG_RESULT([$enable_liblustre_acl])
2133 if test x$enable_liblustre_acl = xyes ; then
2134 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2140 AC_ARG_ENABLE(mpitests,
2141 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2142 [include mpi tests]),
2153 MPICC_WRAPPER=$enableval
2163 if test x$enable_mpitests != xno; then
2164 AC_MSG_CHECKING([whether mpitests can be built])
2172 MPI_Initialized(&flag);
2175 AC_MSG_RESULT([yes])
2182 AC_SUBST(MPICC_WRAPPER)
2184 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2185 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2188 LC_CONFIG_LIBLUSTRE_RECOVERY
2191 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
2192 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
2193 AC_ARG_ENABLE([lru_resize],
2194 AC_HELP_STRING([--enable-lru-resize],
2195 [enable lru resize support]),
2196 [],[enable_lru_resize='yes'])
2197 AC_MSG_RESULT([$enable_lru_resize])
2198 if test x$enable_lru_resize != xno; then
2199 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
2203 AC_DEFUN([LC_CONFIG_ADAPTIVE_TIMEOUTS],
2204 [AC_MSG_CHECKING([whether to enable ptlrpc adaptive timeouts support])
2205 AC_ARG_ENABLE([adaptive_timeouts],
2206 AC_HELP_STRING([--disable-adaptive-timeouts],
2207 [disable ptlrpc adaptive timeouts support]),
2208 [],[enable_adaptive_timeouts='yes'])
2209 AC_MSG_RESULT([$enable_adaptive_timeouts])
2210 if test x$enable_adaptive_timeouts == xyes; then
2211 AC_DEFINE(HAVE_AT_SUPPORT, 1, [Enable adaptive timeouts support])
2215 # config delayed recovery
2216 AC_DEFUN([LC_CONFIG_DELAYED_RECOVERY],
2217 [AC_MSG_CHECKING([whether to enable delayed recovery support])
2218 AC_ARG_ENABLE([delayed-recovery],
2219 AC_HELP_STRING([--enable-delayed-recovery],
2220 [enable late recovery after main one]),
2221 [],[enable_delayed_recovery='no'])
2222 AC_MSG_RESULT([$enable_delayed_recovery])
2223 if test x$enable_delayed_recovery == xyes; then
2224 AC_DEFINE(HAVE_DELAYED_RECOVERY, 1, [Enable delayed recovery support])
2231 # whether to enable quota support global control
2233 AC_DEFUN([LC_CONFIG_QUOTA],
2234 [AC_ARG_ENABLE([quota],
2235 AC_HELP_STRING([--enable-quota],
2236 [enable quota support]),
2237 [],[enable_quota='yes'])
2240 # whether to enable quota support(kernel modules)
2241 AC_DEFUN([LC_QUOTA_MODULE],
2242 [if test x$enable_quota != xno; then
2243 LB_LINUX_CONFIG([QUOTA],[
2244 enable_quota_module='yes'
2245 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
2247 enable_quota_module='no'
2248 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
2253 AC_DEFUN([LC_QUOTA],
2257 AC_CHECK_HEADER(sys/quota.h,
2258 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2259 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2262 AC_DEFUN([LC_QUOTA_READ],
2263 [AC_MSG_CHECKING([if kernel supports quota_read])
2264 LB_LINUX_TRY_COMPILE([
2265 #include <linux/fs.h>
2267 struct super_operations sp;
2268 void *i = (void *)sp.quota_read;
2270 AC_MSG_RESULT([yes])
2271 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
2278 # LC_COOKIE_FOLLOW_LINK
2280 # kernel 2.6.13+ ->follow_link returns a cookie
2283 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
2284 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
2285 LB_LINUX_TRY_COMPILE([
2286 #include <linux/fs.h>
2287 #include <linux/namei.h>
2289 struct dentry dentry;
2290 struct nameidata nd;
2292 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
2294 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
2295 AC_MSG_RESULT([yes])
2304 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
2305 # call_rcu takes three parameters.
2307 AC_DEFUN([LC_FUNC_RCU],
2308 [AC_MSG_CHECKING([if kernel have RCU supported])
2309 LB_LINUX_TRY_COMPILE([
2310 #include <linux/rcupdate.h>
2312 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
2313 AC_MSG_RESULT([yes])
2315 AC_MSG_CHECKING([if call_rcu takes three parameters])
2316 LB_LINUX_TRY_COMPILE([
2317 #include <linux/rcupdate.h>
2320 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
2322 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
2323 AC_MSG_RESULT([yes])
2335 # linux kernel may have 64-bit limits support
2337 AC_DEFUN([LC_QUOTA64],
2338 [AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
2339 tmp_flags="$EXTRA_KCFLAGS"
2340 EXTRA_KCFLAGS="-I$LINUX/fs"
2341 LB_LINUX_TRY_COMPILE([
2342 #include <linux/kernel.h>
2343 #include <linux/fs.h>
2344 #ifdef HAVE_QUOTAIO_V1_H
2345 # include <linux/quotaio_v2.h>
2346 int versions[] = V2_INITQVERSIONS_R1;
2347 struct v2_disk_dqblk_r1 dqblk_r1;
2349 # ifdef HAVE_FS_QUOTA_QUOTAIO_V1_H
2350 # include <quota/quotaio_v2.h>
2352 # include <quotaio_v2.h>
2354 struct v2r1_disk_dqblk dqblk_r1;
2357 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
2358 AC_MSG_RESULT([yes])
2361 AC_MSG_WARN([4 TB (or larger) block quota limits can only be used with OSTs not larger than 4 TB.])
2362 AC_MSG_WARN([Continuing with limited quota support.])
2363 AC_MSG_WARN([quotacheck is needed for filesystems with recent quota versions.])
2365 EXTRA_KCFLAGS=$tmp_flags
2368 # LC_SECURITY_PLUG # for SLES10 SP2
2369 # check security plug in sles10 sp2 kernel
2370 AC_DEFUN([LC_SECURITY_PLUG],
2371 [AC_MSG_CHECKING([If kernel has security plug support])
2372 LB_LINUX_TRY_COMPILE([
2373 #include <linux/fs.h>
2375 struct dentry *dentry;
2376 struct vfsmount *mnt;
2377 struct iattr *iattr;
2379 notify_change(dentry, mnt, iattr);
2382 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
2383 [SLES10 SP2 use extra parameter in vfs])
2389 AC_DEFUN([LC_PERCPU_COUNTER],
2390 [AC_MSG_CHECKING([if have struct percpu_counter defined])
2391 LB_LINUX_TRY_COMPILE([
2392 #include <linux/percpu_counter.h>
2394 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
2395 AC_MSG_RESULT([yes])
2397 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
2398 LB_LINUX_TRY_COMPILE([
2399 #include <linux/percpu_counter.h>
2401 struct percpu_counter c;
2402 percpu_counter_init(&c, 0);
2404 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
2406 AC_MSG_RESULT([yes])
2418 # other configure checks
2420 AC_DEFUN([LC_CONFIGURE],
2421 [LC_CONFIG_OBD_BUFFER_SIZE
2423 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2424 CFLAGS="$CFLAGS -Werror"
2427 # maximum MDS thread count
2430 # include/liblustre.h
2431 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2433 # liblustre/llite_lib.h
2434 AC_CHECK_HEADERS([xtio.h file.h])
2437 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2440 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2441 AC_CHECK_FUNCS([inet_ntoa])
2443 # libsysio/src/readlink.c
2446 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2447 AC_CHECK_HEADERS([linux/random.h], [], [],
2448 [#ifdef HAVE_LINUX_TYPES_H
2449 # include <linux/types.h>
2454 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2456 # check for -lz support
2460 [AC_CHECK_HEADERS([zlib.h],
2462 AC_DEFINE([HAVE_ADLER], 1,
2463 [support alder32 checksum type])],
2464 [AC_MSG_WARN([No zlib-devel package found,
2465 unable to use adler32 checksum])])],
2466 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2471 AC_ARG_ENABLE([mindf],
2472 AC_HELP_STRING([--enable-mindf],
2473 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2475 if test "$enable_mindf" = "yes" ; then
2476 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2479 AC_ARG_ENABLE([fail_alloc],
2480 AC_HELP_STRING([--disable-fail-alloc],
2481 [disable randomly alloc failure]),
2482 [],[enable_fail_alloc=yes])
2483 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2484 AC_MSG_RESULT([$enable_fail_alloc])
2485 if test x$enable_fail_alloc != xno ; then
2486 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2494 # AM_CONDITIONALS for lustre
2496 AC_DEFUN([LC_CONDITIONALS],
2497 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2498 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2499 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2500 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2501 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2502 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2503 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2504 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2505 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2506 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2512 # files that should be generated with AC_OUTPUT
2514 AC_DEFUN([LC_CONFIG_FILES],
2518 lustre/autoconf/Makefile
2519 lustre/conf/Makefile
2520 lustre/contrib/Makefile
2522 lustre/include/Makefile
2523 lustre/include/lustre_ver.h
2524 lustre/include/linux/Makefile
2525 lustre/include/darwin/Makefile
2526 lustre/include/lustre/Makefile
2527 lustre/kernel_patches/targets/2.6-suse.target
2528 lustre/kernel_patches/targets/2.6-vanilla.target
2529 lustre/kernel_patches/targets/2.6-rhel4.target
2530 lustre/kernel_patches/targets/2.6-rhel6.target
2531 lustre/kernel_patches/targets/2.6-rhel5.target
2532 lustre/kernel_patches/targets/2.6-fc5.target
2533 lustre/kernel_patches/targets/2.6-patchless.target
2534 lustre/kernel_patches/targets/2.6-sles10.target
2535 lustre/kernel_patches/targets/2.6-sles11.target
2536 lustre/kernel_patches/targets/hp_pnnl-2.4.target
2537 lustre/kernel_patches/targets/rh-2.4.target
2538 lustre/kernel_patches/targets/rhel-2.4.target
2539 lustre/kernel_patches/targets/suse-2.4.21-2.target
2540 lustre/kernel_patches/targets/sles-2.4.target
2541 lustre/kernel_patches/targets/2.6-oel5.target
2542 lustre/ldlm/Makefile
2543 lustre/liblustre/Makefile
2544 lustre/liblustre/tests/Makefile
2545 lustre/liblustre/tests/mpi/Makefile
2546 lustre/llite/Makefile
2547 lustre/llite/autoMakefile
2549 lustre/lov/autoMakefile
2550 lustre/lvfs/Makefile
2551 lustre/lvfs/autoMakefile
2553 lustre/mdc/autoMakefile
2555 lustre/mds/autoMakefile
2556 lustre/obdclass/Makefile
2557 lustre/obdclass/autoMakefile
2558 lustre/obdclass/linux/Makefile
2559 lustre/obdecho/Makefile
2560 lustre/obdecho/autoMakefile
2561 lustre/obdfilter/Makefile
2562 lustre/obdfilter/autoMakefile
2564 lustre/osc/autoMakefile
2566 lustre/ost/autoMakefile
2568 lustre/mgc/autoMakefile
2570 lustre/mgs/autoMakefile
2571 lustre/ptlrpc/Makefile
2572 lustre/ptlrpc/autoMakefile
2573 lustre/quota/Makefile
2574 lustre/quota/autoMakefile
2575 lustre/scripts/Makefile
2576 lustre/tests/Makefile
2577 lustre/tests/mpi/Makefile
2578 lustre/utils/Makefile
2579 lustre/obdclass/darwin/Makefile