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])
17 # lustre specific paths
19 AC_DEFUN([LC_PATH_DEFAULTS],
20 [# ptlrpc kernel build requires this
28 demodir='$(docdir)/demo'
31 pkgexampledir='${pkgdatadir}/examples'
32 AC_SUBST(pkgexampledir)
38 # is the target os supported?
40 AC_DEFUN([LC_TARGET_SUPPORTED],
52 # Ensure stack size big than 8k in Lustre server (all kernels)
54 AC_DEFUN([LC_STACK_SIZE],
55 [AC_MSG_CHECKING([stack size big than 8k])
56 LB_LINUX_TRY_COMPILE([
57 #include <linux/thread_info.h>
59 #if THREAD_SIZE < 8192
60 #error "stack size < 8192"
65 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
70 # LC_FUNC_DEV_SET_RDONLY
72 # check for the old-style dev_set_rdonly which took an extra "devno" param
73 # and can only set a single device to discard writes at one time
75 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
76 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
77 LB_LINUX_TRY_COMPILE([
79 #include <linux/blkdev.h>
81 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
82 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
86 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
88 AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
89 kernel patches from Lustre version 1.4.3 or above.])
96 # setup, check the backing filesystem
98 AC_DEFUN([LC_CONFIG_BACKINGFS],
102 if test x$with_ldiskfs = xno ; then
103 if test x$linux25$enable_server = xyesyes ; then
104 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
108 LB_DEFINE_LDISKFS_OPTIONS
111 AC_MSG_CHECKING([which backing filesystem to use])
112 AC_MSG_RESULT([$BACKINGFS])
119 # the pinger is temporary, until we have the recovery node in place
121 AC_DEFUN([LC_CONFIG_PINGER],
122 [AC_MSG_CHECKING([whether to enable pinger support])
123 AC_ARG_ENABLE([pinger],
124 AC_HELP_STRING([--disable-pinger],
125 [disable recovery pinger support]),
126 [],[enable_pinger='yes'])
127 AC_MSG_RESULT([$enable_pinger])
128 if test x$enable_pinger != xno ; then
129 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
136 # do checksum of bulk data between client and OST
138 AC_DEFUN([LC_CONFIG_CHECKSUM],
139 [AC_MSG_CHECKING([whether to enable data checksum support])
140 AC_ARG_ENABLE([checksum],
141 AC_HELP_STRING([--disable-checksum],
142 [disable data checksum support]),
143 [],[enable_checksum='yes'])
144 AC_MSG_RESULT([$enable_checksum])
145 if test x$enable_checksum != xno ; then
146 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
151 # LC_HEADER_LDISKFS_XATTR
153 # CHAOS kernel-devel package will not include fs/ldiskfs/xattr.h
155 AC_DEFUN([LC_HEADER_LDISKFS_XATTR],
156 [AC_MSG_CHECKING([if ldiskfs has xattr.h header])
157 tmp_flags="$EXTRA_KCFLAGS"
158 EXTRA_KCFLAGS="-I$LINUX/fs -I$LDISKFS_DIR -I$LDISKFS_DIR/ldiskfs"
159 LB_LINUX_TRY_COMPILE([
160 #include <ldiskfs/xattr.h>
162 ldiskfs_xattr_get(NULL, 0, "", NULL, 0);
163 ldiskfs_xattr_set_handle(NULL, NULL, 0, "", NULL, 0, 0);
167 AC_DEFINE(HAVE_LDISKFS_XATTR_H, 1, [ldiskfs/xattr.h found])
171 EXTRA_KCFLAGS="$tmp_flags"
175 # LC_CONFIG_HEALTH_CHECK_WRITE
177 # Turn off the actual write to the disk
179 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
180 [AC_MSG_CHECKING([whether to enable a write with the health check])
181 AC_ARG_ENABLE([health_write],
182 AC_HELP_STRING([--enable-health_write],
183 [enable disk writes when doing health check]),
184 [],[enable_health_write='no'])
185 AC_MSG_RESULT([$enable_health_write])
186 if test x$enable_health_write != xno ; then
187 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
192 # LC_CONFIG_LIBLUSTRE_RECOVERY
194 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
195 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
196 AC_ARG_ENABLE([liblustre-recovery],
197 AC_HELP_STRING([--disable-liblustre-recovery],
198 [disable liblustre recovery support]),
199 [],[enable_liblustre_recovery='yes'])
200 AC_MSG_RESULT([$enable_liblustre_recovery])
201 if test x$enable_liblustre_recovery != xno ; then
202 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
207 # LC_CONFIG_OBD_BUFFER_SIZE
209 # the maximum buffer size of lctl ioctls
211 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
212 [AC_MSG_CHECKING([maximum OBD ioctl size])
213 AC_ARG_WITH([obd-buffer-size],
214 AC_HELP_STRING([--with-obd-buffer-size=[size]],
215 [set lctl ioctl maximum bytes (default=8192)]),
217 OBD_BUFFER_SIZE=$with_obd_buffer_size
221 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
222 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
228 # AIX does not have statfs.f_namelen
230 AC_DEFUN([LC_STRUCT_STATFS],
231 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
232 LB_LINUX_TRY_COMPILE([
233 #include <linux/vfs.h>
239 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
246 # LC_READLINK_SSIZE_T
248 AC_DEFUN([LC_READLINK_SSIZE_T],
249 [AC_MSG_CHECKING([if readlink returns ssize_t])
253 ssize_t readlink(const char *, char *, size_t);
256 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
263 # LC_FUNC_MS_FLOCK_LOCK
265 # 2.6.5 kernel has MS_FLOCK_LOCK sb flag
267 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
268 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
269 LB_LINUX_TRY_COMPILE([
270 #include <linux/fs.h>
272 int flags = MS_FLOCK_LOCK;
274 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
275 [kernel has MS_FLOCK_LOCK flag])
283 # LC_FUNC_HAVE_CAN_SLEEP_ARG
285 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
287 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
288 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
289 LB_LINUX_TRY_COMPILE([
290 #include <linux/fs.h>
294 struct file_lock *file_lock;
295 flock_lock_file_wait(file, file_lock, cansleep);
297 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
298 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
306 # LC_FUNC_RELEASEPAGE_WITH_GFP
308 # 2.6.9 ->releasepage() takes a gfp_t arg
309 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
310 # while others either don't have gfp_t or pass gfp_t as the parameter.
312 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
313 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
314 RELEASEPAGE_WITH_GFP="$(grep -c 'releasepage.*gfp_t' $LINUX/include/linux/fs.h)"
315 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
316 AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
317 [releasepage with gfp_t parameter])
325 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
327 AC_DEFUN([LC_FILEMAP_POPULATE],
328 [AC_MSG_CHECKING([for exported filemap_populate])
329 LB_LINUX_TRY_COMPILE([
330 #include <asm/page.h>
331 #include <linux/mm.h>
333 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
336 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
345 AC_DEFUN([LC_D_ADD_UNIQUE],
346 [AC_MSG_CHECKING([for d_add_unique])
347 LB_LINUX_TRY_COMPILE([
348 #include <linux/dcache.h>
350 d_add_unique(NULL, NULL);
353 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
362 AC_DEFUN([LC_BIT_SPINLOCK_H],
363 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
364 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
365 LB_LINUX_TRY_COMPILE([
366 #include <asm/processor.h>
367 #include <linux/spinlock.h>
368 #include <linux/bit_spinlock.h>
371 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
380 # After 2.6.26 we no longer have xattr_acl.h
382 AC_DEFUN([LC_XATTR_ACL],
383 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
384 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
385 LB_LINUX_TRY_COMPILE([
386 #include <linux/xattr_acl.h>
389 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
400 AC_DEFUN([LC_STRUCT_INTENT_FILE],
401 [AC_MSG_CHECKING([if struct open_intent has a file field])
402 LB_LINUX_TRY_COMPILE([
403 #include <linux/fs.h>
404 #include <linux/namei.h>
406 struct open_intent intent;
410 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
418 # After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
420 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
421 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
422 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
423 LB_LINUX_TRY_COMPILE([
424 #include <linux/fs.h>
425 #include <linux/posix_acl_xattr.h>
428 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
440 # only for Lustre-patched kernels
442 AC_DEFUN([LC_LUSTRE_VERSION_H],
443 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
444 rm -f "$LUSTRE/include/linux/lustre_version.h"
446 touch "$LUSTRE/include/linux/lustre_version.h"
447 if test x$enable_server = xyes ; then
448 AC_MSG_WARN([Unpatched kernel detected.])
449 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
450 AC_MSG_WARN([disabling server build])
459 AC_DEFUN([LC_CAPA_CRYPTO],
460 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
461 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
463 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
464 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
466 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
467 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
472 # LC_CONFIG_RMTCLIENT
475 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
477 AC_DEFUN([LC_CONFIG_RMTCLIENT],
478 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
479 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
483 AC_DEFUN([LC_SUNRPC_CACHE],
484 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
485 LB_LINUX_TRY_COMPILE([
486 #include <linux/sunrpc/cache.h>
488 struct cache_head ch;
492 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
498 AC_DEFUN([LC_CONFIG_SUNRPC],
499 [LB_LINUX_CONFIG_IM([SUNRPC],[],
500 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
505 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
507 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
508 [AC_MSG_CHECKING([whether to enable gss keyring backend])
509 AC_ARG_ENABLE([gss_keyring],
510 [AC_HELP_STRING([--disable-gss-keyring],
511 [disable gss keyring backend])],
512 [],[enable_gss_keyring='yes'])
513 AC_MSG_RESULT([$enable_gss_keyring])
515 if test x$enable_gss_keyring != xno; then
516 LB_LINUX_CONFIG_IM([KEYS],[],
517 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
519 AC_CHECK_LIB([keyutils], [keyctl_search], [],
520 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
522 AC_DEFINE([HAVE_GSS_KEYRING], [1],
523 [Define this if you enable gss keyring backend])
528 # LC_CONFIG_GSS (default disabled)
530 # Build gss and related tools of Lustre. Currently both kernel and user space
531 # parts are depend on linux platform.
533 AC_DEFUN([LC_CONFIG_GSS],
534 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
536 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
537 [],[enable_gss='no'])
538 AC_MSG_RESULT([$enable_gss])
540 if test x$enable_gss == xyes; then
541 LC_CONFIG_GSS_KEYRING
544 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
546 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
547 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
548 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
549 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
550 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
551 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
552 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
553 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
555 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
556 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
557 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
558 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
559 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
561 AC_SUBST(GSSAPI_LIBS)
567 # LC_EXPORT_SYNCHRONIZE_RCU
568 # after 2.6.12 synchronize_rcu is preferred over synchronize_kernel
569 AC_DEFUN([LC_EXPORT_SYNCHRONIZE_RCU],
570 [LB_CHECK_SYMBOL_EXPORT([synchronize_rcu],
571 [kernel/rcupdate.c],[
572 AC_DEFINE(HAVE_SYNCHRONIZE_RCU, 1,
573 [in 2.6.12 synchronize_rcu preferred over synchronize_kernel])
579 # after 2.6.15 inode have i_mutex intead of i_sem
580 AC_DEFUN([LC_INODE_I_MUTEX],
581 [AC_MSG_CHECKING([if inode has i_mutex ])
582 LB_LINUX_TRY_COMPILE([
583 #include <linux/mutex.h>
584 #include <linux/fs.h>
589 mutex_unlock(&i.i_mutex);
592 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
593 [after 2.6.15 inode have i_mutex intead of i_sem])
600 # after 2.6.18 seq_file has lock intead of sem
601 AC_DEFUN([LC_SEQ_LOCK],
602 [AC_MSG_CHECKING([if struct seq_file has lock field])
603 LB_LINUX_TRY_COMPILE([
604 #include <linux/seq_file.h>
608 mutex_unlock(&seq.lock);
611 AC_DEFINE(HAVE_SEQ_LOCK, 1,
612 [after 2.6.18 seq_file has lock intead of sem])
619 # after 2.6.17 dquote use mutex instead if semaphore
620 AC_DEFUN([LC_DQUOTOFF_MUTEX],
621 [AC_MSG_CHECKING([use dqonoff_mutex])
622 LB_LINUX_TRY_COMPILE([
623 #include <linux/mutex.h>
624 #include <linux/fs.h>
625 #include <linux/quota.h>
627 struct quota_info dq;
629 mutex_unlock(&dq.dqonoff_mutex);
632 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
633 [after 2.6.17 dquote use mutex instead if semaphore])
640 # starting from 2.6.18 the file_operations .flush
641 # method has a new "fl_owner_t id" parameter
643 AC_DEFUN([LC_FLUSH_OWNER_ID],
644 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
645 LB_LINUX_TRY_COMPILE([
646 #include <linux/fs.h>
648 struct file_operations *fops = NULL;
652 i = fops->flush(NULL, id);
654 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
655 [file_operations .flush method has an fl_owner_t id])
663 # LC_STATFS_DENTRY_PARAM
664 # starting from 2.6.18 linux kernel uses dentry instead of
665 # super_block for first vfs_statfs argument
667 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
668 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
669 LB_LINUX_TRY_COMPILE([
670 #include <linux/fs.h>
672 int vfs_statfs(struct dentry *, struct kstatfs *);
674 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
675 [first parameter of vfs_statfs is dentry])
684 # starting from 2.6.18 kernel don't export do_kern_mount
685 # and want to use vfs_kern_mount instead.
687 AC_DEFUN([LC_VFS_KERN_MOUNT],
688 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
689 LB_LINUX_TRY_COMPILE([
690 #include <linux/mount.h>
692 vfs_kern_mount(NULL, 0, NULL, NULL);
694 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
695 [vfs_kern_mount exist in kernel])
703 # LC_INVALIDATEPAGE_RETURN_INT
704 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
706 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
707 [AC_MSG_CHECKING([invalidatepage has return int])
708 LB_LINUX_TRY_COMPILE([
709 #include <linux/buffer_head.h>
711 int rc = block_invalidatepage(NULL, 0);
714 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
715 [Define if return type of invalidatepage should be int])
721 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
722 # after 2.6.18 umount_begin has different parameters
723 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
724 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
725 tmp_flags="$EXTRA_KCFLAGS"
726 EXTRA_KCFLAGS="-Werror"
727 LB_LINUX_TRY_COMPILE([
728 #include <linux/fs.h>
731 static void cfg_umount_begin (struct vfsmount *v, int flags)
736 static struct super_operations cfg_super_operations = {
737 .umount_begin = cfg_umount_begin,
740 cfg_super_operations.umount_begin(NULL,0);
743 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
744 [Define umount_begin need second argument])
748 EXTRA_KCFLAGS="$tmp_flags"
751 # inode have i_private field since 2.6.17
752 AC_DEFUN([LC_INODE_IPRIVATE],
753 [AC_MSG_CHECKING([if inode has a i_private field])
754 LB_LINUX_TRY_COMPILE([
755 #include <linux/fs.h>
761 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
762 [struct inode has i_private field])
769 # inode don't have i_blksize field
770 AC_DEFUN([LC_INODE_BLKSIZE],
771 [AC_MSG_CHECKING([inode has i_blksize field])
772 LB_LINUX_TRY_COMPILE([
773 #include <linux/fs.h>
779 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
780 [struct inode has i_blksize field])
786 # LC_VFS_READDIR_U64_INO
787 # 2.6.19 use u64 for inode number instead of inode_t
788 AC_DEFUN([LC_VFS_READDIR_U64_INO],
789 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
790 tmp_flags="$EXTRA_KCFLAGS"
791 EXTRA_KCFLAGS="-Werror"
792 LB_LINUX_TRY_COMPILE([
793 #include <linux/fs.h>
794 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
795 u64 ino, unsigned int d_type)
806 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
807 [if vfs_readdir need 64bit inode number])
811 EXTRA_KCFLAGS="$tmp_flags"
815 # 2.6.19 replaced writev with aio_write
816 AC_DEFUN([LC_FILE_WRITEV],
817 [AC_MSG_CHECKING([writev in fops])
818 LB_LINUX_TRY_COMPILE([
819 #include <linux/fs.h>
821 struct file_operations *fops = NULL;
825 AC_DEFINE(HAVE_FILE_WRITEV, 1,
832 # LC_GENERIC_FILE_READ
833 # 2.6.19 replaced readv with aio_read
834 AC_DEFUN([LC_FILE_READV],
835 [AC_MSG_CHECKING([readv in fops])
836 LB_LINUX_TRY_COMPILE([
837 #include <linux/fs.h>
839 struct file_operations *fops = NULL;
843 AC_DEFINE(HAVE_FILE_READV, 1,
851 # 2.6.18 don't export nr_pagecahe
852 AC_DEFUN([LC_NR_PAGECACHE],
853 [AC_MSG_CHECKING([kernel export nr_pagecache])
854 LB_LINUX_TRY_COMPILE([
855 #include <linux/pagemap.h>
857 return atomic_read(&nr_pagecache);
860 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
861 [is kernel export nr_pagecache])
867 # LC_CANCEL_DIRTY_PAGE
868 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
869 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
870 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
871 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
872 # backport is broken, so ignore it
873 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
874 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
877 LB_LINUX_TRY_COMPILE([
878 #include <linux/mm.h>
879 #include <linux/page-flags.h>
881 cancel_dirty_page(NULL, 0);
884 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
885 [kernel has cancel_dirty_page instead of clear_page_dirty])
895 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
896 # it support constant page, which means the page won't be modified during the
899 AC_DEFUN([LC_PAGE_CONSTANT],
900 [AC_MSG_CHECKING([if kernel have PageConstant defined])
901 LB_LINUX_TRY_COMPILE([
902 #include <linux/mm.h>
903 #include <linux/page-flags.h>
906 #error "Have no raid5 zcopy patch"
910 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
916 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
917 AC_DEFUN([LC_PG_FS_MISC],
918 [AC_MSG_CHECKING([kernel has PG_fs_misc])
919 LB_LINUX_TRY_COMPILE([
920 #include <linux/mm.h>
921 #include <linux/page-flags.h>
924 #error PG_fs_misc not defined in kernel
928 AC_DEFINE(HAVE_PG_FS_MISC, 1,
929 [is kernel have PG_fs_misc])
935 # RHEL5 PageChecked and SetPageChecked defined
936 AC_DEFUN([LC_PAGE_CHECKED],
937 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
938 LB_LINUX_TRY_COMPILE([
939 #include <linux/autoconf.h>
940 #ifdef HAVE_LINUX_MMTYPES_H
941 #include <linux/mm_types.h>
943 #include <linux/page-flags.h>
947 /* before 2.6.26 this define*/
949 /* 2.6.26 use function instead of define for it */
955 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
956 [does kernel have PageChecked and SetPageChecked])
962 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
963 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
965 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
966 [kernel export truncate_complete_page])
971 AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
972 [LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
974 AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
975 [kernel export truncate_inode_pages_range])
980 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
981 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
983 AC_DEFINE(HAVE_D_REHASH_COND, 1,
984 [d_rehash_cond is exported by the kernel])
989 AC_DEFUN([LC_EXPORT___D_REHASH],
990 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
992 AC_DEFINE(HAVE___D_REHASH, 1,
993 [__d_rehash is exported by the kernel])
998 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
999 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1001 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1002 [d_move_locked is exported by the kernel])
1007 AC_DEFUN([LC_EXPORT___D_MOVE],
1008 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1010 AC_DEFINE(HAVE___D_MOVE, 1,
1011 [__d_move is exported by the kernel])
1017 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1019 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1020 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1022 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1023 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1024 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1025 [exported invalidate_mapping_pages])],
1026 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1027 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1028 [exported invalidate_inode_pages])], [
1029 AC_MSG_ERROR([no way to invalidate pages])
1035 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
1037 # No standard kernels export this
1039 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1040 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1042 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1043 [filemap_fdatawrite_range is exported by the kernel])
1048 # The actual symbol exported varies among architectures, so we need
1049 # to check many symbols (but only in the current architecture.) No
1050 # matter what symbol is exported, the kernel #defines node_to_cpumask
1051 # to the appropriate function and that's what we use.
1052 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1053 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1054 [arch/$LINUX_ARCH/mm/numa.c],
1055 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1056 [node_to_cpumask is exported by
1057 the kernel])]) # x86_64
1058 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1059 [arch/$LINUX_ARCH/kernel/smpboot.c],
1060 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1061 [node_to_cpumask is exported by
1062 the kernel])]) # ia64
1063 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1064 [arch/$LINUX_ARCH/kernel/smpboot.c],
1065 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1066 [node_to_cpumask is exported by
1067 the kernel])]) # i386
1070 # 2.6.22 lost second parameter for invalidate_bdev
1071 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1072 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1073 LB_LINUX_TRY_COMPILE([
1074 #include <linux/buffer_head.h>
1076 invalidate_bdev(NULL,0);
1078 AC_MSG_RESULT([yes])
1079 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1080 [invalidate_bdev has second argument])
1089 # 2.6.23 have return type 'void' for unregister_blkdev
1090 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1091 [AC_MSG_CHECKING([if unregister_blkdev return int])
1092 LB_LINUX_TRY_COMPILE([
1093 #include <linux/fs.h>
1095 int i = unregister_blkdev(0,NULL);
1097 AC_MSG_RESULT([yes])
1098 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1099 [unregister_blkdev return int])
1105 # 2.6.23 change .sendfile to .splice_read
1106 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1107 AC_DEFUN([LC_KERNEL_SENDFILE],
1108 [AC_MSG_CHECKING([if kernel has .sendfile])
1109 LB_LINUX_TRY_COMPILE([
1110 #include <linux/fs.h>
1112 struct file_operations file;
1114 file.sendfile = NULL;
1116 AC_MSG_RESULT([yes])
1117 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1118 [kernel has .sendfile])
1124 # 2.6.23 change .sendfile to .splice_read
1125 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1126 [AC_MSG_CHECKING([if kernel has .splice_read])
1127 LB_LINUX_TRY_COMPILE([
1128 #include <linux/fs.h>
1130 struct file_operations file;
1132 file.splice_read = NULL;
1134 AC_MSG_RESULT([yes])
1135 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1136 [kernel has .slice_read])
1142 # 2.6.23 extract nfs export related data into exportfs.h
1143 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1144 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1145 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1146 [kernel has include/exportfs.h])
1152 # 2.6.23 has new page fault handling API
1153 AC_DEFUN([LC_VM_OP_FAULT],
1154 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1155 LB_LINUX_TRY_COMPILE([
1156 #include <linux/mm.h>
1158 struct vm_operations_struct op;
1162 AC_MSG_RESULT([yes])
1163 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1164 [kernel has .fault in vm_operation_struct])
1170 #2.6.23 has new shrinker API
1171 AC_DEFUN([LC_REGISTER_SHRINKER],
1172 [AC_MSG_CHECKING([if kernel has register_shrinker])
1173 LB_LINUX_TRY_COMPILE([
1174 #include <linux/mm.h>
1176 register_shrinker(NULL);
1178 AC_MSG_RESULT([yes])
1179 AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
1180 [kernel has register_shrinker])
1186 # 2.6.23 add code to wait other users to complete before removing procfs entry
1187 AC_DEFUN([LC_PROCFS_USERS],
1188 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1189 LB_LINUX_TRY_COMPILE([
1190 #include <linux/proc_fs.h>
1192 struct proc_dir_entry pde;
1196 AC_MSG_RESULT([yes])
1197 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1198 [kernel has pde_users member in procfs entry struct])
1204 # 2.6.24 has bio_endio with 2 args
1205 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1206 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1207 LB_LINUX_TRY_COMPILE([
1208 #include <linux/bio.h>
1212 AC_MSG_RESULT([yes])
1213 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1214 [kernel has bio_endio with 2 args])
1220 # 2.6.24 has new members in exports struct.
1221 AC_DEFUN([LC_FH_TO_DENTRY],
1222 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1223 LB_LINUX_TRY_COMPILE([
1224 #ifdef HAVE_LINUX_EXPORTFS_H
1225 #include <linux/exportfs.h>
1227 #include <linux/fs.h>
1230 struct export_operations exp;
1232 exp.fh_to_dentry = NULL;
1234 AC_MSG_RESULT([yes])
1235 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1236 [kernel has .fh_to_dentry member in export_operations struct])
1242 # 2.6.24 need linux/mm_types.h included
1243 AC_DEFUN([LC_HAVE_MMTYPES_H],
1244 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1245 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1246 [kernel has include/mm_types.h])
1252 # 2.6.24 removes long aged procfs entry -> deleted member
1253 AC_DEFUN([LC_PROCFS_DELETED],
1254 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1255 LB_LINUX_TRY_COMPILE([
1256 #include <linux/proc_fs.h>
1258 struct proc_dir_entry pde;
1262 AC_MSG_RESULT([yes])
1263 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1264 [kernel has deleted member in procfs entry struct])
1270 # 2.6.25 change define to inline
1271 AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
1272 [AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
1273 LB_LINUX_TRY_COMPILE([
1274 #include <linux/backing-dev.h>
1276 #ifndef mapping_cap_writeback_dirty
1277 mapping_cap_writeback_dirty(NULL);
1280 AC_MSG_RESULT([yes])
1281 AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
1282 [kernel have mapping_cap_writeback_dirty])
1290 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1291 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1292 [AC_MSG_CHECKING([fs_struct use path structure])
1293 LB_LINUX_TRY_COMPILE([
1294 #include <asm/atomic.h>
1295 #include <linux/spinlock.h>
1296 #include <linux/fs_struct.h>
1299 struct fs_struct fs;
1303 AC_MSG_RESULT([yes])
1304 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1305 [fs_struct use path structure])
1312 # LC_VFS_INTENT_PATCHES
1314 # check if the kernel has the VFS intent patches
1315 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1316 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1317 LB_LINUX_TRY_COMPILE([
1318 #include <linux/fs.h>
1319 #include <linux/namei.h>
1321 struct nameidata nd;
1322 struct lookup_intent *it;
1325 intent_init(it, IT_OPEN);
1326 it->d.lustre.it_disposition = 0;
1327 it->d.lustre.it_data = NULL;
1329 AC_MSG_RESULT([yes])
1330 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1336 AC_DEFUN([LC_S_TIME_GRAN],
1337 [AC_MSG_CHECKING([if super block has s_time_gran member])
1338 LB_LINUX_TRY_COMPILE([
1339 #include <linux/fs.h>
1341 struct super_block sb;
1343 return sb.s_time_gran;
1345 AC_MSG_RESULT([yes])
1346 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1352 AC_DEFUN([LC_SB_TIME_GRAN],
1353 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1354 LB_LINUX_TRY_COMPILE([
1355 #include <linux/fs.h>
1357 return get_sb_time_gran(NULL);
1359 AC_MSG_RESULT([yes])
1360 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1367 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1369 # Check for our patched grab_cache_page_nowait_gfp() function
1370 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
1372 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
1373 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
1375 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
1376 [kernel exports grab_cache_page_nowait_gfp])
1378 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1380 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1381 [kernel exports add_to_page_cache_lru])
1387 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1388 AC_DEFUN([LC_RW_TREE_LOCK],
1389 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1390 tmp_flags="$EXTRA_KCFLAGS"
1391 EXTRA_KCFLAGS="-Werror"
1392 LB_LINUX_TRY_COMPILE([
1393 #include <linux/fs.h>
1395 struct address_space a;
1397 write_lock(&a.tree_lock);
1399 AC_MSG_RESULT([yes])
1400 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1404 EXTRA_KCFLAGS="$tmp_flags"
1407 AC_DEFUN([LC_CONST_ACL_SIZE],
1408 [AC_MSG_CHECKING([calc acl size])
1410 CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`uname -m|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include $EXTRA_KCFLAGS"
1413 #include <linux/autoconf.h>
1414 #include <linux/types.h>
1417 #define __LINUX_POSIX_ACL_H
1419 # ifdef CONFIG_FS_POSIX_ACL
1420 # ifdef HAVE_XATTR_ACL
1421 # include <linux/xattr_acl.h>
1423 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1424 # include <linux/posix_acl_xattr.h>
1428 #include <lustre_acl.h>
1434 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1435 FILE *f = fopen("acl.size","w+");
1436 fprintf(f,"%d", size);
1443 acl_size=`cat acl.size`
1444 AC_MSG_RESULT([ACL size $acl_size])
1445 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1447 AC_ERROR([ACL size can't computed])
1453 # check for crypto API
1455 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1456 [AC_MSG_CHECKING([if kernel has block cipher support])
1457 LB_LINUX_TRY_COMPILE([
1458 #include <linux/err.h>
1459 #include <linux/crypto.h>
1461 struct crypto_blkcipher *tfm;
1462 tfm = crypto_alloc_blkcipher("aes", 0, 0 );
1464 AC_MSG_RESULT([yes])
1465 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1472 # check for struct hash_desc
1474 AC_DEFUN([LC_STRUCT_HASH_DESC],
1475 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1476 LB_LINUX_TRY_COMPILE([
1477 #include <linux/err.h>
1478 #include <linux/crypto.h>
1480 struct hash_desc foo;
1482 AC_MSG_RESULT([yes])
1483 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1490 # check for struct blkcipher_desc
1492 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1493 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1494 LB_LINUX_TRY_COMPILE([
1495 #include <linux/err.h>
1496 #include <linux/crypto.h>
1498 struct blkcipher_desc foo;
1500 AC_MSG_RESULT([yes])
1501 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1508 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1510 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1511 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1512 LB_LINUX_TRY_COMPILE([
1513 #include <linux/fs.h>
1515 int v = FS_RENAME_DOES_D_MOVE;
1517 AC_MSG_RESULT([yes])
1518 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1525 # LC_FUNC_F_OP_FLOCK
1527 # rhel4.2 kernel has f_op->flock field
1529 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
1530 [AC_MSG_CHECKING([if struct file_operations has flock field])
1531 LB_LINUX_TRY_COMPILE([
1532 #include <linux/fs.h>
1534 struct file_operations ll_file_operations_flock;
1535 ll_file_operations_flock.flock = NULL;
1537 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
1538 [struct file_operations has flock field])
1539 AC_MSG_RESULT([yes])
1545 # vfs_symlink seems to have started out with 3 args until 2.6.7 where a
1546 # "mode" argument was added, but then again, in some later version it was
1548 AC_DEFUN([LC_4ARGS_VFS_SYMLINK],
1549 [AC_MSG_CHECKING([if vfs_symlink wants 4 args])
1550 LB_LINUX_TRY_COMPILE([
1551 #include <linux/fs.h>
1554 struct dentry *dentry;
1555 const char *oldname = NULL;
1558 vfs_symlink(dir, dentry, oldname, mode);
1561 AC_DEFINE(HAVE_4ARGS_VFS_SYMLINK, 1,
1562 [vfs_symlink wants 4 args])
1568 # 2.6.23 has new shrinker API
1569 AC_DEFUN([LC_REGISTER_SHRINKER],
1570 [LB_CHECK_SYMBOL_EXPORT([register_shrinker],
1572 AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
1573 [kernel exports register_shrinker])
1579 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1580 [AC_MSG_CHECKING([inode_operations->permission has two args])
1581 LB_LINUX_TRY_COMPILE([
1582 #include <linux/fs.h>
1584 struct inode *inode;
1586 inode->i_op->permission(NULL,0);
1588 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1589 [inode_operations->permission has two args])
1590 AC_MSG_RESULT([yes])
1596 # 2.6.27 has file_remove_suid instead of remove_suid
1597 AC_DEFUN([LC_FILE_REMOVE_SUID],
1598 [AC_MSG_CHECKING([kernel has file_remove_suid])
1599 LB_LINUX_TRY_COMPILE([
1600 #include <linux/fs.h>
1602 file_remove_suid(NULL);
1604 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1605 [kernel have file_remove_suid])
1606 AC_MSG_RESULT([yes])
1612 # 2.6.27 have new page locking API
1613 AC_DEFUN([LC_TRYLOCKPAGE],
1614 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1615 LB_LINUX_TRY_COMPILE([
1616 #include <linux/pagemap.h>
1620 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1621 [kernel uses trylock_page for page lock])
1622 AC_MSG_RESULT([yes])
1628 # vfs_symlink seems to have started out with 3 args until 2.6.7 where a
1629 # "mode" argument was added, but then again, in some later version it was
1631 AC_DEFUN([LC_4ARGS_VFS_SYMLINK],
1632 [AC_MSG_CHECKING([if vfs_symlink wants 4 args])
1633 LB_LINUX_TRY_COMPILE([
1634 #include <linux/fs.h>
1637 struct dentry *dentry;
1638 const char *oldname = NULL;
1641 vfs_symlink(dir, dentry, oldname, mode);
1644 AC_DEFINE(HAVE_4ARGS_VFS_SYMLINK, 1,
1645 [vfs_symlink wants 4 args])
1651 # 2.6.27 sles11 remove the bi_hw_segments
1652 AC_DEFUN([LC_BI_HW_SEGMENTS],
1653 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1654 LB_LINUX_TRY_COMPILE([
1655 #include <linux/bio.h>
1658 io.bi_hw_segments = 0;
1660 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1661 [struct bio has a bi_hw_segments field])
1662 AC_MSG_RESULT([yes])
1669 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1670 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1671 AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
1672 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[
1673 AC_DEFINE(HAVE_QUOTAIO_V1_H, 1,
1674 [kernel has include/linux/quotaio_v1.h])
1675 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v1.h],[
1676 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_V1_H, 1,
1677 [kernel has fs/quota/quotaio_v1.h])
1684 # sles10 sp2 need 5 parameter for vfs_symlink
1685 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
1686 [AC_MSG_CHECKING([vfs_symlink need 5 parameter])
1687 LB_LINUX_TRY_COMPILE([
1688 #include <linux/fs.h>
1690 struct inode *dir = NULL;
1691 struct dentry *dentry = NULL;
1692 struct vfsmount *mnt = NULL;
1693 const char * path = NULL;
1694 vfs_symlink(dir, dentry, mnt, path, 0);
1696 AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
1697 [vfs_symlink need 5 parameteres])
1698 AC_MSG_RESULT([yes])
1704 # 2.6.27 removed the read_inode from super_operations.
1705 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1706 [AC_MSG_CHECKING([super_operations has a read_inode field])
1707 LB_LINUX_TRY_COMPILE([
1708 #include <linux/fs.h>
1710 struct super_operations *sop;
1711 sop->read_inode(NULL);
1713 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1714 [super_operations has a read_inode])
1715 AC_MSG_RESULT([yes])
1721 # 2.6.27 sles11 has sb_any_quota_active
1722 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1723 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1724 LB_LINUX_TRY_COMPILE([
1725 #include <linux/quotaops.h>
1727 sb_any_quota_active(NULL);
1729 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1730 [Kernel has a sb_any_quota_active])
1731 AC_MSG_RESULT([yes])
1737 # 2.6.27 sles11 has sb_has_quota_active
1738 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1739 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1740 LB_LINUX_TRY_COMPILE([
1741 #include <linux/quotaops.h>
1743 sb_has_quota_active(NULL, 0);
1745 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1746 [Kernel has a sb_has_quota_active])
1747 AC_MSG_RESULT([yes])
1753 # 2.6.27 has inode_permission instead of permisson
1754 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1755 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1757 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1758 [inode_permission is exported by the kernel])
1763 # 2.6.27 use 5th parameter in quota_on for remount.
1764 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1765 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1766 LB_LINUX_TRY_COMPILE([
1767 #include <linux/quota.h>
1769 struct quotactl_ops *qop;
1770 qop->quota_on(NULL, 0, 0, NULL, 0);
1772 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1773 [quota_on needs 5 paramters])
1774 AC_MSG_RESULT([yes])
1780 # 2.6.27 use 3th parameter in quota_off for remount.
1781 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1782 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1783 LB_LINUX_TRY_COMPILE([
1784 #include <linux/quota.h>
1786 struct quotactl_ops *qop;
1787 qop->quota_off(NULL, 0, 0);
1789 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1790 [quota_off needs 3 paramters])
1791 AC_MSG_RESULT([yes])
1797 # 2.6.27 has vfs_dq_off inline function.
1798 AC_DEFUN([LC_VFS_DQ_OFF],
1799 [AC_MSG_CHECKING([vfs_dq_off is defined])
1800 LB_LINUX_TRY_COMPILE([
1801 #include <linux/quotaops.h>
1803 vfs_dq_off(NULL, 0);
1805 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1806 AC_MSG_RESULT([yes])
1815 # If we have fiemap.h
1816 # after 2.6.27 use fiemap.h in include/linux
1818 AC_DEFUN([LC_LINUX_FIEMAP_H],
1819 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1820 AC_MSG_CHECKING([if fiemap.h can be compiled])
1821 LB_LINUX_TRY_COMPILE([
1822 #include <linux/types.h>
1823 #include <linux/fiemap.h>
1825 AC_MSG_RESULT([yes])
1826 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1834 # LC_LOCK_MAP_ACQUIRE
1835 # after 2.6.27 lock_map_acquire replaces lock_acquire
1836 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1837 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1838 LB_LINUX_TRY_COMPILE([
1839 #include <linux/lockdep.h>
1841 lock_map_acquire(NULL);
1844 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1845 [lock_map_acquire is defined])
1853 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1854 # d_obtain_alias() for getting anonymous dentries
1856 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1857 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1858 LB_LINUX_TRY_COMPILE([
1859 #include <linux/dcache.h>
1861 d_obtain_alias(NULL);
1863 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1864 [d_obtain_alias exist in kernel])
1865 AC_MSG_RESULT([yes])
1871 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1872 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1873 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1874 LB_LINUX_TRY_COMPILE([
1875 #include <linux/blkdev.h>
1877 blk_queue_logical_block_size(NULL, 0);
1880 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1881 [blk_queue_logical_block_size is defined])
1887 # 2.6.32 add a limits member in struct request_queue.
1888 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1889 [AC_MSG_CHECKING([if request_queue has a limits field])
1890 LB_LINUX_TRY_COMPILE([
1891 #include <linux/blkdev.h>
1893 struct request_queue rq;
1894 rq.limits.io_min = 0;
1897 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1898 [request_queue has a limits field])
1904 # RHEL6(backport from 2.6.34) removes 2 functions blk_queue_max_phys_segments and
1905 # blk_queue_max_hw_segments add blk_queue_max_segments
1906 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1907 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1908 LB_LINUX_TRY_COMPILE([
1909 #include <linux/blkdev.h>
1911 blk_queue_max_segments(NULL, 0);
1914 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1915 [blk_queue_max_segments is defined])
1921 # RHEL6(backport from 2.6.34) removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1922 # check blk_queue_max_sectors and use it until disappear.
1923 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1924 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1925 LB_LINUX_TRY_COMPILE([
1926 #include <linux/blkdev.h>
1928 blk_queue_max_sectors(NULL, 0);
1931 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1932 [blk_queue_max_sectors is defined])
1938 # 2.6.32 has new BDI interface.
1939 AC_DEFUN([LC_NEW_BACKING_DEV_INFO],
1940 [AC_MSG_CHECKING([if backing_dev_info has a wb_cnt field])
1941 LB_LINUX_TRY_COMPILE([
1942 #include <linux/backing-dev.h>
1944 struct backing_dev_info bdi;
1948 AC_DEFINE(HAVE_NEW_BACKING_DEV_INFO, 1,
1949 [backing_dev_info has a wb_cnt field])
1955 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1956 AC_DEFUN([LC_EXPORT_BDI_INIT],
1957 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1958 [mm/backing-dev.c],[
1959 AC_DEFINE(HAVE_BDI_INIT, 1,
1960 [bdi_init/bdi_destroy functions are present])
1965 # 2.6.23 exports exportfs_decode_fh
1966 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1967 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1968 [fs/exportfs/expfs.c],[
1969 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1970 [exportfs_decode_fh has been export])
1978 # Lustre linux kernel checks
1980 AC_DEFUN([LC_PROG_LINUX],
1981 [LC_LUSTRE_VERSION_H
1982 if test x$enable_server = xyes ; then
1983 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1984 LC_FUNC_DEV_SET_RDONLY
1990 LC_CONFIG_LIBLUSTRE_RECOVERY
1991 LC_CONFIG_HEALTH_CHECK_WRITE
1992 LC_CONFIG_LRU_RESIZE
1996 LC_EXPORT_TRUNCATE_COMPLETE
1997 LC_EXPORT_TRUNCATE_RANGE
1998 LC_EXPORT_D_REHASH_COND
1999 LC_EXPORT___D_REHASH
2000 LC_EXPORT_D_MOVE_LOCKED
2002 LC_EXPORT_NODE_TO_CPUMASK
2004 LC_HEADER_LDISKFS_XATTR
2005 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
2012 LC_POSIX_ACL_XATTR_H
2015 LC_STRUCT_INTENT_FILE
2020 LC_FUNC_MS_FLOCK_LOCK
2021 LC_FUNC_HAVE_CAN_SLEEP_ARG
2024 LC_COOKIE_FOLLOW_LINK
2028 LC_4ARGS_VFS_SYMLINK
2030 # does the kernel have VFS intent patches?
2031 LC_VFS_INTENT_PATCHES
2039 LC_EXPORT_SYNCHRONIZE_RCU
2045 LC_SECURITY_PLUG # for SLES10 SP2
2053 LC_STATFS_DENTRY_PARAM
2055 LC_INVALIDATEPAGE_RETURN_INT
2056 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2058 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
2060 if test x$enable_server = xyes ; then
2061 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2064 #2.6.18 + RHEL5 (fc6)
2071 LC_VFS_READDIR_U64_INO
2076 LC_CANCEL_DIRTY_PAGE
2078 # raid5-zerocopy patch
2082 LC_INVALIDATE_BDEV_2ARG
2083 LC_ASYNC_BLOCK_CIPHER
2085 LC_STRUCT_BLKCIPHER_DESC
2086 LC_FS_RENAME_DOES_D_MOVE
2089 LC_UNREGISTER_BLKDEV_RETURN_INT
2090 LC_KERNEL_SPLICE_READ
2094 LC_REGISTER_SHRINKER
2096 LC_EXPORTFS_DECODE_FH
2106 LC_MAPPING_CAP_WRITEBACK_DIRTY
2109 LC_FS_STRUCT_USE_PATH
2112 LC_INODE_PERMISION_2ARGS
2115 LC_READ_INODE_IN_SBOPS
2116 LC_EXPORT_INODE_PERMISSION
2122 # 2.6.27.15-2 sles11
2124 LC_HAVE_QUOTAIO_V1_H
2125 LC_VFS_SYMLINK_5ARGS
2126 LC_SB_ANY_QUOTA_ACTIVE
2127 LC_SB_HAS_QUOTA_ACTIVE
2130 LC_BLK_QUEUE_LOG_BLK_SIZE
2133 LC_REQUEST_QUEUE_LIMITS
2134 LC_NEW_BACKING_DEV_INFO
2135 LC_BLK_QUEUE_MAX_SECTORS
2136 LC_BLK_QUEUE_MAX_SEGMENTS
2139 if test x$enable_server = xyes ; then
2140 if test x$enable_quota_module = xyes ; then
2141 LC_QUOTA64 # must after LC_HAVE_QUOTAIO_V1_H
2147 # LC_CONFIG_CLIENT_SERVER
2149 # Build client/server sides of Lustre
2151 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2152 [AC_MSG_CHECKING([whether to build Lustre server support])
2153 AC_ARG_ENABLE([server],
2154 AC_HELP_STRING([--disable-server],
2155 [disable Lustre server support]),
2156 [],[enable_server='yes'])
2157 AC_MSG_RESULT([$enable_server])
2159 AC_MSG_CHECKING([whether to build Lustre client support])
2160 AC_ARG_ENABLE([client],
2161 AC_HELP_STRING([--disable-client],
2162 [disable Lustre client support]),
2163 [],[enable_client='yes'])
2164 AC_MSG_RESULT([$enable_client])])
2167 # LC_CONFIG_LIBLUSTRE
2169 # whether to build liblustre
2171 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2172 [AC_MSG_CHECKING([whether to build Lustre library])
2173 AC_ARG_ENABLE([liblustre],
2174 AC_HELP_STRING([--disable-liblustre],
2175 [disable building of Lustre library]),
2176 [],[enable_liblustre=$with_sysio])
2177 AC_MSG_RESULT([$enable_liblustre])
2178 # only build sysio if liblustre is built
2179 with_sysio="$enable_liblustre"
2181 AC_MSG_CHECKING([whether to build liblustre tests])
2182 AC_ARG_ENABLE([liblustre-tests],
2183 AC_HELP_STRING([--enable-liblustre-tests],
2184 [enable liblustre tests, if --disable-tests is used]),
2185 [],[enable_liblustre_tests=$enable_tests])
2186 if test x$enable_liblustre != xyes ; then
2187 enable_liblustre_tests='no'
2189 AC_MSG_RESULT([$enable_liblustre_tests])
2191 AC_MSG_CHECKING([whether to enable liblustre acl])
2192 AC_ARG_ENABLE([liblustre-acl],
2193 AC_HELP_STRING([--disable-liblustre-acl],
2194 [disable ACL support for liblustre]),
2195 [],[enable_liblustre_acl=yes])
2196 AC_MSG_RESULT([$enable_liblustre_acl])
2197 if test x$enable_liblustre_acl = xyes ; then
2198 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2201 # 2.6.29 change prepare/commit_write to write_begin/end
2202 AC_DEFUN([LC_WRITE_BEGIN_END],
2203 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2204 LB_LINUX_TRY_COMPILE([
2205 #include <linux/fs.h>
2206 #include <linux/pagemap.h>
2207 #ifdef HAVE_LINUX_MMTYPES_H
2208 #include <linux/mm_types.h>
2211 struct address_space_operations aops;
2214 aops.write_begin = NULL;
2215 aops.write_end = NULL;
2216 page = grab_cache_page_write_begin(NULL, 0, 0);
2218 AC_MSG_RESULT([yes])
2219 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2220 [kernel has .write_begin/end])
2226 # 2.6.29 blkdev_put has 2 arguments
2227 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2228 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2229 LB_LINUX_TRY_COMPILE([
2230 #include <linux/fs.h>
2232 blkdev_put(NULL, 0);
2234 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2235 [blkdev_put needs 2 paramters])
2236 AC_MSG_RESULT([yes])
2242 # 2.6.29 dentry_open has 4 arguments
2243 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2244 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2245 LB_LINUX_TRY_COMPILE([
2246 #include <linux/fs.h>
2248 dentry_open(NULL, NULL, 0, NULL);
2250 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2251 [dentry_open needs 4 paramters])
2252 AC_MSG_RESULT([yes])
2261 AC_ARG_ENABLE(mpitests,
2262 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2263 [include mpi tests]),
2274 MPICC_WRAPPER=$enableval
2284 if test x$enable_mpitests != xno; then
2285 AC_MSG_CHECKING([whether mpitests can be built])
2293 MPI_Initialized(&flag);
2296 AC_MSG_RESULT([yes])
2303 AC_SUBST(MPICC_WRAPPER)
2305 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2306 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2309 LC_CONFIG_LIBLUSTRE_RECOVERY
2312 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
2313 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
2314 AC_ARG_ENABLE([lru_resize],
2315 AC_HELP_STRING([--enable-lru-resize],
2316 [enable lru resize support]),
2317 [],[enable_lru_resize='yes'])
2318 AC_MSG_RESULT([$enable_lru_resize])
2319 if test x$enable_lru_resize != xno; then
2320 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
2327 # whether to enable quota support global control
2329 AC_DEFUN([LC_CONFIG_QUOTA],
2330 [AC_ARG_ENABLE([quota],
2331 AC_HELP_STRING([--enable-quota],
2332 [enable quota support]),
2333 [],[enable_quota='yes'])
2336 # whether to enable quota support(kernel modules)
2337 AC_DEFUN([LC_QUOTA_MODULE],
2338 [if test x$enable_quota != xno; then
2339 LB_LINUX_CONFIG([QUOTA],[
2340 enable_quota_module='yes'
2341 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
2343 enable_quota_module='no'
2344 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
2349 AC_DEFUN([LC_QUOTA],
2353 AC_CHECK_HEADER(sys/quota.h,
2354 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2355 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2358 AC_DEFUN([LC_QUOTA_READ],
2359 [AC_MSG_CHECKING([if kernel supports quota_read])
2360 LB_LINUX_TRY_COMPILE([
2361 #include <linux/fs.h>
2363 struct super_operations sp;
2364 void *i = (void *)sp.quota_read;
2366 AC_MSG_RESULT([yes])
2367 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
2376 # whether to enable split support
2378 AC_DEFUN([LC_CONFIG_SPLIT],
2379 [AC_MSG_CHECKING([whether to enable split support])
2380 AC_ARG_ENABLE([split],
2381 AC_HELP_STRING([--enable-split],
2382 [enable split support]),
2383 [],[enable_split='no'])
2384 AC_MSG_RESULT([$enable_split])
2385 if test x$enable_split != xno; then
2386 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2391 # LC_COOKIE_FOLLOW_LINK
2393 # kernel 2.6.13+ ->follow_link returns a cookie
2396 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
2397 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
2398 LB_LINUX_TRY_COMPILE([
2399 #include <linux/fs.h>
2400 #include <linux/namei.h>
2402 struct dentry dentry;
2403 struct nameidata nd;
2405 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
2407 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
2408 AC_MSG_RESULT([yes])
2417 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
2418 # call_rcu takes three parameters.
2420 AC_DEFUN([LC_FUNC_RCU],
2421 [AC_MSG_CHECKING([if kernel have RCU supported])
2422 LB_LINUX_TRY_COMPILE([
2423 #include <linux/rcupdate.h>
2425 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
2426 AC_MSG_RESULT([yes])
2428 AC_MSG_CHECKING([if call_rcu takes three parameters])
2429 LB_LINUX_TRY_COMPILE([
2430 #include <linux/rcupdate.h>
2433 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
2435 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
2436 AC_MSG_RESULT([yes])
2448 # linux kernel have 64-bit limits support
2450 AC_DEFUN([LC_QUOTA64],[
2451 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
2452 tmp_flags="$EXTRA_KCFLAGS"
2453 EXTRA_KCFLAGS="-I$LINUX/fs"
2454 LB_LINUX_TRY_COMPILE([
2455 #include <linux/kernel.h>
2456 #include <linux/fs.h>
2457 #ifdef HAVE_QUOTAIO_V1_H
2458 # include <linux/quotaio_v2.h>
2459 int versions[] = V2_INITQVERSIONS_R1;
2460 struct v2_disk_dqblk_r1 dqblk_r1;
2462 # ifdef HAVE_FS_QUOTA_QUOTAIO_V1_H
2463 # include <quota/quotaio_v2.h>
2465 # include <quotaio_v2.h>
2467 struct v2r1_disk_dqblk dqblk_r1;
2470 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
2471 AC_MSG_RESULT([yes])
2473 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
2474 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
2478 EXTRA_KCFLAGS=$tmp_flags
2481 # LC_SECURITY_PLUG # for SLES10 SP2
2482 # check security plug in sles10 sp2 kernel
2483 AC_DEFUN([LC_SECURITY_PLUG],
2484 [AC_MSG_CHECKING([If kernel has security plug support])
2485 LB_LINUX_TRY_COMPILE([
2486 #include <linux/fs.h>
2488 struct dentry *dentry;
2489 struct vfsmount *mnt;
2490 struct iattr *iattr;
2492 notify_change(dentry, mnt, iattr);
2495 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
2496 [SLES10 SP2 use extra parameter in vfs])
2502 AC_DEFUN([LC_PERCPU_COUNTER],
2503 [AC_MSG_CHECKING([if have struct percpu_counter defined])
2504 LB_LINUX_TRY_COMPILE([
2505 #include <linux/percpu_counter.h>
2507 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
2508 AC_MSG_RESULT([yes])
2510 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
2511 LB_LINUX_TRY_COMPILE([
2512 #include <linux/percpu_counter.h>
2514 struct percpu_counter c;
2515 percpu_counter_init(&c, 0);
2517 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
2519 AC_MSG_RESULT([yes])
2528 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2529 [AC_MSG_CHECKING([tux_info])
2530 LB_LINUX_TRY_COMPILE([
2531 #include <linux/sched.h>
2533 struct task_struct task;
2536 AC_MSG_RESULT([yes])
2537 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2538 have_task_clenv_store='yes'
2544 AC_DEFUN([LC_TASK_CLENV_STORE],
2546 AC_MSG_CHECKING([if we can store cl_env in task_struct])
2547 if test x$have_task_clenv_store != xyes ; then
2548 LC_TASK_CLENV_TUX_INFO
2555 # other configure checks
2557 AC_DEFUN([LC_CONFIGURE],
2558 [LC_CONFIG_OBD_BUFFER_SIZE
2560 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2561 CFLAGS="$CFLAGS -Werror"
2564 # include/liblustre.h
2565 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2567 # liblustre/llite_lib.h
2568 AC_CHECK_HEADERS([xtio.h file.h])
2571 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2574 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2575 AC_CHECK_FUNCS([inet_ntoa])
2577 # libsysio/src/readlink.c
2580 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2581 AC_CHECK_HEADERS([linux/random.h], [], [],
2582 [#ifdef HAVE_LINUX_TYPES_H
2583 # include <linux/types.h>
2588 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2590 # check for -lz support
2594 [AC_CHECK_HEADERS([zlib.h],
2596 AC_DEFINE([HAVE_ADLER], 1,
2597 [support alder32 checksum type])],
2598 [AC_MSG_WARN([No zlib-devel package found,
2599 unable to use adler32 checksum])])],
2600 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2605 AC_ARG_ENABLE([mindf],
2606 AC_HELP_STRING([--enable-mindf],
2607 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2609 if test "$enable_mindf" = "yes" ; then
2610 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2613 AC_ARG_ENABLE([fail_alloc],
2614 AC_HELP_STRING([--disable-fail-alloc],
2615 [disable randomly alloc failure]),
2616 [],[enable_fail_alloc=yes])
2617 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2618 AC_MSG_RESULT([$enable_fail_alloc])
2619 if test x$enable_fail_alloc != xno ; then
2620 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2623 AC_ARG_ENABLE([invariants],
2624 AC_HELP_STRING([--enable-invariants],
2625 [enable invariant checking (cpu intensive)]),
2627 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2628 AC_MSG_RESULT([$enable_invariants])
2629 if test x$enable_invariants = xyes ; then
2630 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2633 AC_ARG_ENABLE([lu_ref],
2634 AC_HELP_STRING([--enable-lu_ref],
2635 [enable lu_ref reference tracking code]),
2637 AC_MSG_CHECKING([whether to track references with lu_ref])
2638 AC_MSG_RESULT([$enable_lu_ref])
2639 if test x$enable_lu_ref = xyes ; then
2640 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2643 AC_ARG_ENABLE([pgstate-track],
2644 AC_HELP_STRING([--enable-pgstate-track],
2645 [enable page state tracking]),
2646 [enable_pgstat_track='yes'],[])
2647 AC_MSG_CHECKING([whether to enable page state tracking])
2648 AC_MSG_RESULT([$enable_pgstat_track])
2649 if test x$enable_pgstat_track = xyes ; then
2650 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2651 [enable page state tracking code])
2658 LC_DENTRY_OPEN_4ARGS
2665 # AM_CONDITIONALS for lustre
2667 AC_DEFUN([LC_CONDITIONALS],
2668 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2669 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2670 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2671 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2672 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2673 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2674 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2675 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2676 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2677 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2678 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2679 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2680 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2681 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2687 # files that should be generated with AC_OUTPUT
2689 AC_DEFUN([LC_CONFIG_FILES],
2693 lustre/autoconf/Makefile
2694 lustre/conf/Makefile
2695 lustre/contrib/Makefile
2697 lustre/include/Makefile
2698 lustre/include/lustre_ver.h
2699 lustre/include/linux/Makefile
2700 lustre/include/lustre/Makefile
2701 lustre/kernel_patches/targets/2.6-rhel5.target
2702 lustre/kernel_patches/targets/2.6-sles10.target
2703 lustre/kernel_patches/targets/2.6-sles11.target
2704 lustre/kernel_patches/targets/2.6-oel5.target
2705 lustre/kernel_patches/targets/2.6-fc11.target
2706 lustre/kernel_patches/targets/2.6-fc12.target
2707 lustre/ldlm/Makefile
2709 lustre/fid/autoMakefile
2710 lustre/liblustre/Makefile
2711 lustre/liblustre/tests/Makefile
2712 lustre/liblustre/tests/mpi/Makefile
2713 lustre/llite/Makefile
2714 lustre/llite/autoMakefile
2715 lustre/lclient/Makefile
2717 lustre/lov/autoMakefile
2718 lustre/lvfs/Makefile
2719 lustre/lvfs/autoMakefile
2721 lustre/mdc/autoMakefile
2723 lustre/lmv/autoMakefile
2725 lustre/mds/autoMakefile
2727 lustre/mdt/autoMakefile
2729 lustre/cmm/autoMakefile
2731 lustre/mdd/autoMakefile
2733 lustre/fld/autoMakefile
2734 lustre/obdclass/Makefile
2735 lustre/obdclass/autoMakefile
2736 lustre/obdclass/linux/Makefile
2737 lustre/obdecho/Makefile
2738 lustre/obdecho/autoMakefile
2739 lustre/obdfilter/Makefile
2740 lustre/obdfilter/autoMakefile
2742 lustre/osc/autoMakefile
2744 lustre/ost/autoMakefile
2745 lustre/osd-ldiskfs/Makefile
2746 lustre/osd-ldiskfs/autoMakefile
2748 lustre/mgc/autoMakefile
2750 lustre/mgs/autoMakefile
2751 lustre/ptlrpc/Makefile
2752 lustre/ptlrpc/autoMakefile
2753 lustre/ptlrpc/gss/Makefile
2754 lustre/ptlrpc/gss/autoMakefile
2755 lustre/quota/Makefile
2756 lustre/quota/autoMakefile
2757 lustre/scripts/Makefile
2758 lustre/tests/Makefile
2759 lustre/tests/mpi/Makefile
2760 lustre/utils/Makefile
2761 lustre/utils/gss/Makefile
2762 lustre/obdclass/darwin/Makefile