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.])
95 # setup, check the backing filesystem
97 AC_DEFUN([LC_CONFIG_BACKINGFS],
101 if test x$with_ldiskfs = xno ; then
102 if test x$linux25$enable_server = xyesyes ; then
103 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
107 LB_DEFINE_LDISKFS_OPTIONS
110 AC_MSG_CHECKING([which backing filesystem to use])
111 AC_MSG_RESULT([$BACKINGFS])
118 # the pinger is temporary, until we have the recovery node in place
120 AC_DEFUN([LC_CONFIG_PINGER],
121 [AC_MSG_CHECKING([whether to enable pinger support])
122 AC_ARG_ENABLE([pinger],
123 AC_HELP_STRING([--disable-pinger],
124 [disable recovery pinger support]),
125 [],[enable_pinger='yes'])
126 AC_MSG_RESULT([$enable_pinger])
127 if test x$enable_pinger != xno ; then
128 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
135 # do checksum of bulk data between client and OST
137 AC_DEFUN([LC_CONFIG_CHECKSUM],
138 [AC_MSG_CHECKING([whether to enable data checksum support])
139 AC_ARG_ENABLE([checksum],
140 AC_HELP_STRING([--disable-checksum],
141 [disable data checksum support]),
142 [],[enable_checksum='yes'])
143 AC_MSG_RESULT([$enable_checksum])
144 if test x$enable_checksum != xno ; then
145 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
150 # LC_CONFIG_HEALTH_CHECK_WRITE
152 # Turn off the actual write to the disk
154 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
155 [AC_MSG_CHECKING([whether to enable a write with the health check])
156 AC_ARG_ENABLE([health_write],
157 AC_HELP_STRING([--enable-health_write],
158 [enable disk writes when doing health check]),
159 [],[enable_health_write='no'])
160 AC_MSG_RESULT([$enable_health_write])
161 if test x$enable_health_write != xno ; then
162 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
167 # LC_CONFIG_LIBLUSTRE_RECOVERY
169 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
170 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
171 AC_ARG_ENABLE([liblustre-recovery],
172 AC_HELP_STRING([--disable-liblustre-recovery],
173 [disable liblustre recovery support]),
174 [],[enable_liblustre_recovery='yes'])
175 AC_MSG_RESULT([$enable_liblustre_recovery])
176 if test x$enable_liblustre_recovery != xno ; then
177 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
182 # LC_CONFIG_OBD_BUFFER_SIZE
184 # the maximum buffer size of lctl ioctls
186 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
187 [AC_MSG_CHECKING([maximum OBD ioctl size])
188 AC_ARG_WITH([obd-buffer-size],
189 AC_HELP_STRING([--with-obd-buffer-size=[size]],
190 [set lctl ioctl maximum bytes (default=8192)]),
192 OBD_BUFFER_SIZE=$with_obd_buffer_size
196 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
197 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
203 # AIX does not have statfs.f_namelen
205 AC_DEFUN([LC_STRUCT_STATFS],
206 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
207 LB_LINUX_TRY_COMPILE([
208 #include <linux/vfs.h>
214 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
221 # LC_READLINK_SSIZE_T
223 AC_DEFUN([LC_READLINK_SSIZE_T],
224 [AC_MSG_CHECKING([if readlink returns ssize_t])
228 ssize_t readlink(const char *, char *, size_t);
231 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
238 # LC_FUNC_MS_FLOCK_LOCK
240 # 2.6.5 kernel has MS_FLOCK_LOCK sb flag
242 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
243 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
244 LB_LINUX_TRY_COMPILE([
245 #include <linux/fs.h>
247 int flags = MS_FLOCK_LOCK;
249 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
250 [kernel has MS_FLOCK_LOCK flag])
258 # LC_FUNC_HAVE_CAN_SLEEP_ARG
260 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
262 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
263 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
264 LB_LINUX_TRY_COMPILE([
265 #include <linux/fs.h>
269 struct file_lock *file_lock;
270 flock_lock_file_wait(file, file_lock, cansleep);
272 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
273 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
281 # LC_FUNC_RELEASEPAGE_WITH_GFP
283 # 2.6.9 ->releasepage() takes a gfp_t arg
284 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
285 # while others either don't have gfp_t or pass gfp_t as the parameter.
287 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
288 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
289 RELEASEPAGE_WITH_GFP="$(grep -c 'releasepage.*gfp_t' $LINUX/include/linux/fs.h)"
290 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
291 AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
292 [releasepage with gfp_t parameter])
300 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
302 AC_DEFUN([LC_FILEMAP_POPULATE],
303 [AC_MSG_CHECKING([for exported filemap_populate])
304 LB_LINUX_TRY_COMPILE([
305 #include <asm/page.h>
306 #include <linux/mm.h>
308 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
311 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
320 AC_DEFUN([LC_D_ADD_UNIQUE],
321 [AC_MSG_CHECKING([for d_add_unique])
322 LB_LINUX_TRY_COMPILE([
323 #include <linux/dcache.h>
325 d_add_unique(NULL, NULL);
328 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
337 AC_DEFUN([LC_BIT_SPINLOCK_H],
338 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
339 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
340 LB_LINUX_TRY_COMPILE([
341 #include <asm/processor.h>
342 #include <linux/spinlock.h>
343 #include <linux/bit_spinlock.h>
346 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
355 # After 2.6.26 we no longer have xattr_acl.h
357 AC_DEFUN([LC_XATTR_ACL],
358 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
359 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
360 LB_LINUX_TRY_COMPILE([
361 #include <linux/xattr_acl.h>
364 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
376 AC_DEFUN([LC_STRUCT_INTENT_FILE],
377 [AC_MSG_CHECKING([if struct open_intent has a file field])
378 LB_LINUX_TRY_COMPILE([
379 #include <linux/fs.h>
380 #include <linux/namei.h>
382 struct open_intent intent;
386 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
394 # After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
396 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
397 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
398 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
399 LB_LINUX_TRY_COMPILE([
400 #include <linux/posix_acl_xattr.h>
403 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
416 # starting from 2.6.19 linux kernel exports __iget()
418 AC_DEFUN([LC_EXPORT___IGET],
419 [LB_CHECK_SYMBOL_EXPORT([__iget],
421 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
427 # only for Lustre-patched kernels
429 AC_DEFUN([LC_LUSTRE_VERSION_H],
430 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
431 rm -f "$LUSTRE/include/linux/lustre_version.h"
433 touch "$LUSTRE/include/linux/lustre_version.h"
434 if test x$enable_server = xyes ; then
435 AC_MSG_WARN([Unpatched kernel detected.])
436 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
437 AC_MSG_WARN([disabling server build])
446 AC_DEFUN([LC_CAPA_CRYPTO],
447 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
448 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
450 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
451 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
453 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
454 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
459 # LC_CONFIG_RMTCLIENT
462 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
464 AC_DEFUN([LC_CONFIG_RMTCLIENT],
465 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
466 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
470 AC_DEFUN([LC_SUNRPC_CACHE],
471 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
472 LB_LINUX_TRY_COMPILE([
473 #include <linux/sunrpc/cache.h>
475 struct cache_head ch;
479 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
485 AC_DEFUN([LC_CONFIG_SUNRPC],
486 [LB_LINUX_CONFIG_IM([SUNRPC],[],
487 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
492 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
494 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
495 [AC_MSG_CHECKING([whether to enable gss keyring backend])
496 AC_ARG_ENABLE([gss_keyring],
497 [AC_HELP_STRING([--disable-gss-keyring],
498 [disable gss keyring backend])],
499 [],[enable_gss_keyring='yes'])
500 AC_MSG_RESULT([$enable_gss_keyring])
502 if test x$enable_gss_keyring != xno; then
503 LB_LINUX_CONFIG_IM([KEYS],[],
504 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
506 AC_CHECK_LIB([keyutils], [keyctl_search], [],
507 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
509 AC_DEFINE([HAVE_GSS_KEYRING], [1],
510 [Define this if you enable gss keyring backend])
515 # LC_CONFIG_GSS (default disabled)
517 # Build gss and related tools of Lustre. Currently both kernel and user space
518 # parts are depend on linux platform.
520 AC_DEFUN([LC_CONFIG_GSS],
521 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
523 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
524 [],[enable_gss='no'])
525 AC_MSG_RESULT([$enable_gss])
527 if test x$enable_gss == xyes; then
528 LC_CONFIG_GSS_KEYRING
531 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
533 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
534 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
535 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
536 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
537 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
538 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
539 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
540 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
542 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
543 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
544 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
545 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
546 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
548 AC_SUBST(GSSAPI_LIBS)
554 # LC_EXPORT_SYNCHRONIZE_RCU
555 # after 2.6.12 synchronize_rcu is preferred over synchronize_kernel
556 AC_DEFUN([LC_EXPORT_SYNCHRONIZE_RCU],
557 [LB_CHECK_SYMBOL_EXPORT([synchronize_rcu],
558 [kernel/rcupdate.c],[
559 AC_DEFINE(HAVE_SYNCHRONIZE_RCU, 1,
560 [in 2.6.12 synchronize_rcu preferred over synchronize_kernel])
566 # after 2.6.15 inode have i_mutex intead of i_sem
567 AC_DEFUN([LC_INODE_I_MUTEX],
568 [AC_MSG_CHECKING([if inode has i_mutex ])
569 LB_LINUX_TRY_COMPILE([
570 #include <linux/mutex.h>
571 #include <linux/fs.h>
576 mutex_unlock(&i.i_mutex);
579 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
580 [after 2.6.15 inode have i_mutex intead of i_sem])
587 # after 2.6.18 seq_file has lock intead of sem
588 AC_DEFUN([LC_SEQ_LOCK],
589 [AC_MSG_CHECKING([if struct seq_file has lock field])
590 LB_LINUX_TRY_COMPILE([
591 #include <linux/seq_file.h>
595 mutex_unlock(&seq.lock);
598 AC_DEFINE(HAVE_SEQ_LOCK, 1,
599 [after 2.6.18 seq_file has lock intead of sem])
606 # after 2.6.17 dquote use mutex instead if semaphore
607 AC_DEFUN([LC_DQUOTOFF_MUTEX],
608 [AC_MSG_CHECKING([use dqonoff_mutex])
609 LB_LINUX_TRY_COMPILE([
610 #include <linux/mutex.h>
611 #include <linux/fs.h>
612 #include <linux/quota.h>
614 struct quota_info dq;
616 mutex_unlock(&dq.dqonoff_mutex);
619 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
620 [after 2.6.17 dquote use mutex instead if semaphore])
627 # LC_STATFS_DENTRY_PARAM
628 # starting from 2.6.18 linux kernel uses dentry instead of
629 # super_block for first vfs_statfs argument
631 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
632 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
633 LB_LINUX_TRY_COMPILE([
634 #include <linux/fs.h>
636 int vfs_statfs(struct dentry *, struct kstatfs *);
638 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
639 [first parameter of vfs_statfs is dentry])
648 # starting from 2.6.18 kernel don't export do_kern_mount
649 # and want to use vfs_kern_mount instead.
651 AC_DEFUN([LC_VFS_KERN_MOUNT],
652 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
653 LB_LINUX_TRY_COMPILE([
654 #include <linux/mount.h>
656 vfs_kern_mount(NULL, 0, NULL, NULL);
658 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
659 [vfs_kern_mount exist in kernel])
667 # LC_INVALIDATEPAGE_RETURN_INT
668 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
670 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
671 [AC_MSG_CHECKING([invalidatepage has return int])
672 LB_LINUX_TRY_COMPILE([
673 #include <linux/buffer_head.h>
675 int rc = block_invalidatepage(NULL, 0);
678 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
679 [Define if return type of invalidatepage should be int])
685 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
686 # after 2.6.18 umount_begin has different parameters
687 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
688 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
689 tmp_flags="$EXTRA_KCFLAGS"
690 EXTRA_KCFLAGS="-Werror"
691 LB_LINUX_TRY_COMPILE([
692 #include <linux/fs.h>
695 static void cfg_umount_begin (struct vfsmount *v, int flags)
700 static struct super_operations cfg_super_operations = {
701 .umount_begin = cfg_umount_begin,
704 cfg_super_operations.umount_begin(NULL,0);
707 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
708 [Define umount_begin need second argument])
712 EXTRA_KCFLAGS="$tmp_flags"
715 # inode have i_private field since 2.6.17
716 AC_DEFUN([LC_INODE_IPRIVATE],
717 [AC_MSG_CHECKING([if inode has a i_private field])
718 LB_LINUX_TRY_COMPILE([
719 #include <linux/fs.h>
725 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
726 [struct inode has i_private field])
733 # inode don't have i_blksize field
734 AC_DEFUN([LC_INODE_BLKSIZE],
735 [AC_MSG_CHECKING([inode has i_blksize field])
736 LB_LINUX_TRY_COMPILE([
737 #include <linux/fs.h>
743 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
744 [struct inode has i_blksize field])
750 # LC_VFS_READDIR_U64_INO
751 # 2.6.19 use u64 for inode number instead of inode_t
752 AC_DEFUN([LC_VFS_READDIR_U64_INO],
753 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
754 tmp_flags="$EXTRA_KCFLAGS"
755 EXTRA_KCFLAGS="-Werror"
756 LB_LINUX_TRY_COMPILE([
757 #include <linux/fs.h>
758 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
759 u64 ino, unsigned int d_type)
770 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
771 [if vfs_readdir need 64bit inode number])
775 EXTRA_KCFLAGS="$tmp_flags"
779 # 2.6.19 replaced writev with aio_write
780 AC_DEFUN([LC_FILE_WRITEV],
781 [AC_MSG_CHECKING([writev in fops])
782 LB_LINUX_TRY_COMPILE([
783 #include <linux/fs.h>
785 struct file_operations *fops = NULL;
789 AC_DEFINE(HAVE_FILE_WRITEV, 1,
796 # LC_GENERIC_FILE_READ
797 # 2.6.19 replaced readv with aio_read
798 AC_DEFUN([LC_FILE_READV],
799 [AC_MSG_CHECKING([readv in fops])
800 LB_LINUX_TRY_COMPILE([
801 #include <linux/fs.h>
803 struct file_operations *fops = NULL;
807 AC_DEFINE(HAVE_FILE_READV, 1,
815 # 2.6.18 don't export nr_pagecahe
816 AC_DEFUN([LC_NR_PAGECACHE],
817 [AC_MSG_CHECKING([kernel export nr_pagecache])
818 LB_LINUX_TRY_COMPILE([
819 #include <linux/pagemap.h>
821 return atomic_read(&nr_pagecache);
824 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
825 [is kernel export nr_pagecache])
831 # LC_CANCEL_DIRTY_PAGE
832 # 2.6.20 introduse cancel_dirty_page instead of
834 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
835 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
836 LB_LINUX_TRY_COMPILE([
837 #include <linux/mm.h>
838 #include <linux/page-flags.h>
840 /* tmp workaround for broken OFED 1.4.1 at SLES10 */
841 #if defined(CONFIG_SLE_VERSION) && CONFIG_SLE_VERSION == 10 && defined(_BACKPORT_LINUX_MM_H_)
842 #error badly implementation of cancel_dirty_pages
844 cancel_dirty_page(NULL, 0);
847 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
848 [kernel has cancel_dirty_page instead of clear_page_dirty])
857 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
858 # it support constant page, which means the page won't be modified during the
861 AC_DEFUN([LC_PAGE_CONSTANT],
862 [AC_MSG_CHECKING([if kernel have PageConstant defined])
863 LB_LINUX_TRY_COMPILE([
864 #include <linux/mm.h>
865 #include <linux/page-flags.h>
868 #error "Have no raid5 zcopy patch"
872 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
878 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
879 AC_DEFUN([LC_PG_FS_MISC],
880 [AC_MSG_CHECKING([kernel has PG_fs_misc])
881 LB_LINUX_TRY_COMPILE([
882 #include <linux/mm.h>
883 #include <linux/page-flags.h>
886 #error PG_fs_misc not defined in kernel
890 AC_DEFINE(HAVE_PG_FS_MISC, 1,
891 [is kernel have PG_fs_misc])
897 # RHEL5 PageChecked and SetPageChecked defined
898 AC_DEFUN([LC_PAGE_CHECKED],
899 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
900 LB_LINUX_TRY_COMPILE([
901 #include <linux/mm.h>
902 #include <linux/page-flags.h>
905 #error PageChecked not defined in kernel
907 #ifndef SetPageChecked
908 #error SetPageChecked not defined in kernel
912 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
913 [does kernel have PageChecked and SetPageChecked])
919 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
920 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
922 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
923 [kernel export truncate_complete_page])
928 AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
929 [LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
931 AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
932 [kernel export truncate_inode_pages_range])
937 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
938 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
940 AC_DEFINE(HAVE_D_REHASH_COND, 1,
941 [d_rehash_cond is exported by the kernel])
946 AC_DEFUN([LC_EXPORT___D_REHASH],
947 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
949 AC_DEFINE(HAVE___D_REHASH, 1,
950 [__d_rehash is exported by the kernel])
955 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
956 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
958 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
959 [d_move_locked is exported by the kernel])
964 AC_DEFUN([LC_EXPORT___D_MOVE],
965 [LB_CHECK_SYMBOL_EXPORT([__d_move],
967 AC_DEFINE(HAVE___D_MOVE, 1,
968 [__d_move is exported by the kernel])
974 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
976 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
977 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
979 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
980 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
981 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
982 [exported invalidate_mapping_pages])],
983 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
984 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
985 [exported invalidate_inode_pages])], [
986 AC_MSG_ERROR([no way to invalidate pages])
992 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
994 # No standard kernels export this
996 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
997 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
999 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1000 [filemap_fdatawrite_range is exported by the kernel])
1005 # The actual symbol exported varies among architectures, so we need
1006 # to check many symbols (but only in the current architecture.) No
1007 # matter what symbol is exported, the kernel #defines node_to_cpumask
1008 # to the appropriate function and that's what we use.
1009 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1010 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1011 [arch/$LINUX_ARCH/mm/numa.c],
1012 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1013 [node_to_cpumask is exported by
1014 the kernel])]) # x86_64
1015 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1016 [arch/$LINUX_ARCH/kernel/smpboot.c],
1017 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1018 [node_to_cpumask is exported by
1019 the kernel])]) # ia64
1020 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1021 [arch/$LINUX_ARCH/kernel/smpboot.c],
1022 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1023 [node_to_cpumask is exported by
1024 the kernel])]) # i386
1027 # 2.6.22 lost second parameter for invalidate_bdev
1028 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1029 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1030 LB_LINUX_TRY_COMPILE([
1031 #include <linux/buffer_head.h>
1033 invalidate_bdev(NULL,0);
1035 AC_MSG_RESULT([yes])
1036 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1037 [invalidate_bdev has second argument])
1043 # 2.6.23 have return type 'void' for unregister_blkdev
1044 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1045 [AC_MSG_CHECKING([if unregister_blkdev return int])
1046 LB_LINUX_TRY_COMPILE([
1047 #include <linux/fs.h>
1049 int i = unregister_blkdev(0,NULL);
1051 AC_MSG_RESULT([yes])
1052 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1053 [unregister_blkdev return int])
1059 # 2.6.23 change .sendfile to .splice_read
1060 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1061 [AC_MSG_CHECKING([if kernel has .splice_read])
1062 LB_LINUX_TRY_COMPILE([
1063 #include <linux/fs.h>
1065 struct file_operations file;
1067 file.splice_read = NULL;
1069 AC_MSG_RESULT([yes])
1070 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1071 [kernel has .slice_read])
1077 # 2.6.23 extract nfs export related data into exportfs.h
1078 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1081 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1082 AC_CHECK_HEADERS([linux/exportfs.h])
1087 # LC_VFS_INTENT_PATCHES
1089 # check if the kernel has the VFS intent patches
1090 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1091 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1092 LB_LINUX_TRY_COMPILE([
1093 #include <linux/fs.h>
1094 #include <linux/namei.h>
1096 struct nameidata nd;
1097 struct lookup_intent *it;
1100 intent_init(it, IT_OPEN);
1101 it->d.lustre.it_disposition = 0;
1102 it->d.lustre.it_data = NULL;
1104 AC_MSG_RESULT([yes])
1105 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1111 AC_DEFUN([LC_S_TIME_GRAN],
1112 [AC_MSG_CHECKING([if super block has s_time_gran member])
1113 LB_LINUX_TRY_COMPILE([
1114 #include <linux/fs.h>
1116 struct super_block sb;
1118 return sb.s_time_gran;
1120 AC_MSG_RESULT([yes])
1121 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1127 AC_DEFUN([LC_SB_TIME_GRAN],
1128 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1129 LB_LINUX_TRY_COMPILE([
1130 #include <linux/fs.h>
1132 return get_sb_time_gran(NULL);
1134 AC_MSG_RESULT([yes])
1135 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1142 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1144 # Check for our patched grab_cache_page_nowait_gfp() function
1145 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
1147 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
1148 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
1150 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
1151 [kernel exports grab_cache_page_nowait_gfp])
1153 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1155 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1156 [kernel exports add_to_page_cache_lru])
1162 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1163 AC_DEFUN([LC_RW_TREE_LOCK],
1164 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1165 tmp_flags="$EXTRA_KCFLAGS"
1166 EXTRA_KCFLAGS="-Werror"
1167 LB_LINUX_TRY_COMPILE([
1168 #include <linux/fs.h>
1170 struct address_space a;
1172 write_lock(&a.tree_lock);
1174 AC_MSG_RESULT([yes])
1175 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1179 EXTRA_KCFLAGS="$tmp_flags"
1182 AC_DEFUN([LC_CONST_ACL_SIZE],
1183 [AC_MSG_CHECKING([calc acl size])
1185 CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 $EXTRA_KCFLAGS"
1188 #include <linux/autoconf.h>
1189 #include <linux/types.h>
1192 #define __LINUX_POSIX_ACL_H
1194 # ifdef CONFIG_FS_POSIX_ACL
1195 # ifdef HAVE_XATTR_ACL
1196 # include <linux/xattr_acl.h>
1198 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1199 # include <linux/posix_acl_xattr.h>
1203 #include <lustre_acl.h>
1209 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1210 FILE *f = fopen("acl.size","w+");
1211 fprintf(f,"%d", size);
1218 acl_size=`cat acl.size`
1219 AC_MSG_RESULT([ACL size $acl_size])
1220 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1222 AC_ERROR([ACL size can't computed])
1228 # check for crypto API
1230 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1231 [AC_MSG_CHECKING([if kernel has block cipher support])
1232 LB_LINUX_TRY_COMPILE([
1233 #include <linux/err.h>
1234 #include <linux/crypto.h>
1236 struct crypto_blkcipher *tfm;
1237 tfm = crypto_alloc_blkcipher("aes", 0, 0 );
1239 AC_MSG_RESULT([yes])
1240 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1247 # check for struct hash_desc
1249 AC_DEFUN([LC_STRUCT_HASH_DESC],
1250 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1251 LB_LINUX_TRY_COMPILE([
1252 #include <linux/err.h>
1253 #include <linux/crypto.h>
1255 struct hash_desc foo;
1257 AC_MSG_RESULT([yes])
1258 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1265 # check for struct blkcipher_desc
1267 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1268 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1269 LB_LINUX_TRY_COMPILE([
1270 #include <linux/err.h>
1271 #include <linux/crypto.h>
1273 struct blkcipher_desc foo;
1275 AC_MSG_RESULT([yes])
1276 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1283 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1285 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1286 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1287 LB_LINUX_TRY_COMPILE([
1288 #include <linux/fs.h>
1290 int v = FS_RENAME_DOES_D_MOVE;
1292 AC_MSG_RESULT([yes])
1293 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1299 # vfs_symlink seems to have started out with 3 args until 2.6.7 where a
1300 # "mode" argument was added, but then again, in some later version it was
1302 AC_DEFUN([LC_4ARGS_VFS_SYMLINK],
1303 [AC_MSG_CHECKING([if vfs_symlink wants 4 args])
1304 LB_LINUX_TRY_COMPILE([
1305 #include <linux/fs.h>
1308 struct dentry *dentry;
1309 const char *oldname = NULL;
1312 vfs_symlink(dir, dentry, oldname, mode);
1315 AC_DEFINE(HAVE_4ARGS_VFS_SYMLINK, 1,
1316 [vfs_symlink wants 4 args])
1322 # 2.6.23 has new shrinker API
1323 AC_DEFUN([LC_REGISTER_SHRINKER],
1324 [LB_CHECK_SYMBOL_EXPORT([register_shrinker],
1326 AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
1327 [kernel exports register_shrinker])
1335 # If we have fiemap.h
1336 # after 2.6.27 use fiemap.h in include/linux
1338 AC_DEFUN([LC_LINUX_FIEMAP_H],
1339 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1340 AC_MSG_CHECKING([if fiemap.h can be compiled])
1341 LB_LINUX_TRY_COMPILE([
1342 #include <linux/fiemap.h>
1344 AC_MSG_RESULT([yes])
1345 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1356 # Lustre linux kernel checks
1358 AC_DEFUN([LC_PROG_LINUX],
1359 [LC_LUSTRE_VERSION_H
1360 if test x$enable_server = xyes ; then
1361 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1362 LC_FUNC_DEV_SET_RDONLY
1368 LC_CONFIG_LIBLUSTRE_RECOVERY
1369 LC_CONFIG_HEALTH_CHECK_WRITE
1370 LC_CONFIG_LRU_RESIZE
1375 LC_EXPORT_TRUNCATE_COMPLETE
1376 LC_EXPORT_TRUNCATE_RANGE
1377 LC_EXPORT_D_REHASH_COND
1378 LC_EXPORT___D_REHASH
1379 LC_EXPORT_D_MOVE_LOCKED
1381 LC_EXPORT_NODE_TO_CPUMASK
1383 LC_FUNC_RELEASEPAGE_WITH_INT
1384 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1391 LC_POSIX_ACL_XATTR_H
1394 LC_STRUCT_INTENT_FILE
1399 LC_FUNC_MS_FLOCK_LOCK
1400 LC_FUNC_HAVE_CAN_SLEEP_ARG
1402 LC_COOKIE_FOLLOW_LINK
1406 LC_4ARGS_VFS_SYMLINK
1409 # does the kernel have VFS intent patches?
1410 LC_VFS_INTENT_PATCHES
1418 LC_EXPORT_SYNCHRONIZE_RCU
1424 LC_SECURITY_PLUG # for SLES10 SP2
1432 LC_STATFS_DENTRY_PARAM
1434 LC_INVALIDATEPAGE_RETURN_INT
1435 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1437 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1438 if test x$enable_server = xyes ; then
1439 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1442 #2.6.18 + RHEL5 (fc6)
1448 LC_VFS_READDIR_U64_INO
1453 LC_CANCEL_DIRTY_PAGE
1455 # raid5-zerocopy patch
1459 LC_INVALIDATE_BDEV_2ARG
1460 LC_ASYNC_BLOCK_CIPHER
1462 LC_STRUCT_BLKCIPHER_DESC
1463 LC_FS_RENAME_DOES_D_MOVE
1465 LC_UNREGISTER_BLKDEV_RETURN_INT
1466 LC_KERNEL_SPLICE_READ
1471 # LC_CONFIG_CLIENT_SERVER
1473 # Build client/server sides of Lustre
1475 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1476 [AC_MSG_CHECKING([whether to build Lustre server support])
1477 AC_ARG_ENABLE([server],
1478 AC_HELP_STRING([--disable-server],
1479 [disable Lustre server support]),
1480 [],[enable_server='yes'])
1481 AC_MSG_RESULT([$enable_server])
1483 AC_MSG_CHECKING([whether to build Lustre client support])
1484 AC_ARG_ENABLE([client],
1485 AC_HELP_STRING([--disable-client],
1486 [disable Lustre client support]),
1487 [],[enable_client='yes'])
1488 AC_MSG_RESULT([$enable_client])])
1491 # LC_CONFIG_LIBLUSTRE
1493 # whether to build liblustre
1495 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1496 [AC_MSG_CHECKING([whether to build Lustre library])
1497 AC_ARG_ENABLE([liblustre],
1498 AC_HELP_STRING([--disable-liblustre],
1499 [disable building of Lustre library]),
1500 [],[enable_liblustre=$with_sysio])
1501 AC_MSG_RESULT([$enable_liblustre])
1502 # only build sysio if liblustre is built
1503 with_sysio="$enable_liblustre"
1505 AC_MSG_CHECKING([whether to build liblustre tests])
1506 AC_ARG_ENABLE([liblustre-tests],
1507 AC_HELP_STRING([--enable-liblustre-tests],
1508 [enable liblustre tests, if --disable-tests is used]),
1509 [],[enable_liblustre_tests=$enable_tests])
1510 if test x$enable_liblustre != xyes ; then
1511 enable_liblustre_tests='no'
1513 AC_MSG_RESULT([$enable_liblustre_tests])
1515 AC_MSG_CHECKING([whether to enable liblustre acl])
1516 AC_ARG_ENABLE([liblustre-acl],
1517 AC_HELP_STRING([--disable-liblustre-acl],
1518 [disable ACL support for liblustre]),
1519 [],[enable_liblustre_acl=yes])
1520 AC_MSG_RESULT([$enable_liblustre_acl])
1521 if test x$enable_liblustre_acl = xyes ; then
1522 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1528 AC_ARG_ENABLE(mpitests,
1529 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
1530 [include mpi tests]),
1541 MPICC_WRAPPER=$enableval
1551 if test x$enable_mpitests != xno; then
1552 AC_MSG_CHECKING([whether mpitests can be built])
1560 MPI_Initialized(&flag);
1563 AC_MSG_RESULT([yes])
1570 AC_SUBST(MPICC_WRAPPER)
1572 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1573 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1576 LC_CONFIG_LIBLUSTRE_RECOVERY
1579 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1580 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1581 AC_ARG_ENABLE([lru_resize],
1582 AC_HELP_STRING([--enable-lru-resize],
1583 [enable lru resize support]),
1584 [],[enable_lru_resize='yes'])
1585 AC_MSG_RESULT([$enable_lru_resize])
1586 if test x$enable_lru_resize != xno; then
1587 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1594 # whether to enable quota support global control
1596 AC_DEFUN([LC_CONFIG_QUOTA],
1597 [AC_ARG_ENABLE([quota],
1598 AC_HELP_STRING([--enable-quota],
1599 [enable quota support]),
1600 [],[enable_quota='yes'])
1603 # whether to enable quota support(kernel modules)
1604 AC_DEFUN([LC_QUOTA_MODULE],
1605 [if test x$enable_quota != xno; then
1606 LB_LINUX_CONFIG([QUOTA],[
1607 enable_quota_module='yes'
1608 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1610 enable_quota_module='no'
1611 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
1616 AC_DEFUN([LC_QUOTA],
1620 AC_CHECK_HEADER(sys/quota.h,
1621 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
1622 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
1625 AC_DEFUN([LC_QUOTA_READ],
1626 [AC_MSG_CHECKING([if kernel supports quota_read])
1627 LB_LINUX_TRY_COMPILE([
1628 #include <linux/fs.h>
1630 struct super_operations sp;
1631 void *i = (void *)sp.quota_read;
1633 AC_MSG_RESULT([yes])
1634 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1643 # whether to enable split support
1645 AC_DEFUN([LC_CONFIG_SPLIT],
1646 [AC_MSG_CHECKING([whether to enable split support])
1647 AC_ARG_ENABLE([split],
1648 AC_HELP_STRING([--enable-split],
1649 [enable split support]),
1650 [],[enable_split='no'])
1651 AC_MSG_RESULT([$enable_split])
1652 if test x$enable_split != xno; then
1653 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1658 # LC_COOKIE_FOLLOW_LINK
1660 # kernel 2.6.13+ ->follow_link returns a cookie
1663 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1664 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1665 LB_LINUX_TRY_COMPILE([
1666 #include <linux/fs.h>
1667 #include <linux/namei.h>
1669 struct dentry dentry;
1670 struct nameidata nd;
1672 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1674 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1675 AC_MSG_RESULT([yes])
1684 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1685 # call_rcu takes three parameters.
1687 AC_DEFUN([LC_FUNC_RCU],
1688 [AC_MSG_CHECKING([if kernel have RCU supported])
1689 LB_LINUX_TRY_COMPILE([
1690 #include <linux/rcupdate.h>
1692 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1693 AC_MSG_RESULT([yes])
1695 AC_MSG_CHECKING([if call_rcu takes three parameters])
1696 LB_LINUX_TRY_COMPILE([
1697 #include <linux/rcupdate.h>
1700 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1702 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1703 AC_MSG_RESULT([yes])
1714 # linux kernel have 64-bit limits support
1716 AC_DEFUN([LC_QUOTA64],
1717 [if test x$enable_quota_module = xyes -a x$enable_server = xyes ; then
1718 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1719 LB_LINUX_TRY_COMPILE([
1720 #include <linux/kernel.h>
1721 #include <linux/fs.h>
1722 #include <linux/quotaio_v2.h>
1723 int versions[] = V2_INITQVERSIONS_R1;
1724 struct v2_disk_dqblk_r1 dqblk_r1;
1726 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1727 AC_MSG_RESULT([yes])
1729 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1730 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1737 # LC_SECURITY_PLUG # for SLES10 SP2
1738 # check security plug in sles10 sp2 kernel
1739 AC_DEFUN([LC_SECURITY_PLUG],
1740 [AC_MSG_CHECKING([If kernel has security plug support])
1741 LB_LINUX_TRY_COMPILE([
1742 #include <linux/fs.h>
1744 struct dentry *dentry;
1745 struct vfsmount *mnt;
1746 struct iattr *iattr;
1748 notify_change(dentry, mnt, iattr);
1751 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
1752 [SLES10 SP2 use extra parameter in vfs])
1758 AC_DEFUN([LC_PERCPU_COUNTER],
1759 [AC_MSG_CHECKING([if have struct percpu_counter defined])
1760 LB_LINUX_TRY_COMPILE([
1761 #include <linux/percpu_counter.h>
1763 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
1764 AC_MSG_RESULT([yes])
1766 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
1767 LB_LINUX_TRY_COMPILE([
1768 #include <linux/percpu_counter.h>
1770 struct percpu_counter c;
1771 percpu_counter_init(&c, 0);
1773 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
1775 AC_MSG_RESULT([yes])
1787 # If we have netlink.h, and nlmsg_new takes 2 args
1789 AC_DEFUN([LC_NETLINK],
1790 [AC_MSG_CHECKING([if netlink.h can be compiled])
1791 LB_LINUX_TRY_COMPILE([
1792 #include <net/netlink.h>
1794 AC_MSG_RESULT([yes])
1795 AC_DEFINE(HAVE_NETLINK, 1, [net/netlink.h found])
1797 AC_MSG_CHECKING([if nlmsg_new takes a 2nd argument])
1798 LB_LINUX_TRY_COMPILE([
1799 #include <net/netlink.h>
1801 nlmsg_new(100, GFP_KERNEL);
1803 AC_MSG_RESULT([yes])
1804 AC_DEFINE(HAVE_NETLINK_NL2, 1, [nlmsg_new takes 2 args])
1816 # other configure checks
1818 AC_DEFUN([LC_CONFIGURE],
1819 [LC_CONFIG_OBD_BUFFER_SIZE
1821 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1822 CFLAGS="$CFLAGS -Werror"
1825 # include/liblustre.h
1826 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1828 # liblustre/llite_lib.h
1829 AC_CHECK_HEADERS([xtio.h file.h])
1832 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1835 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1836 AC_CHECK_FUNCS([inet_ntoa])
1838 # libsysio/src/readlink.c
1841 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1842 AC_CHECK_HEADERS([linux/random.h], [], [],
1843 [#ifdef HAVE_LINUX_TYPES_H
1844 # include <linux/types.h>
1849 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1851 # check for -lz support
1855 [AC_CHECK_HEADERS([zlib.h],
1857 AC_DEFINE([HAVE_ADLER], 1,
1858 [support alder32 checksum type])],
1859 [AC_MSG_WARN([No zlib-devel package found,
1860 unable to use adler32 checksum])])],
1861 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1866 AC_ARG_ENABLE([mindf],
1867 AC_HELP_STRING([--enable-mindf],
1868 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1870 if test "$enable_mindf" = "yes" ; then
1871 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1874 AC_ARG_ENABLE([fail_alloc],
1875 AC_HELP_STRING([--disable-fail-alloc],
1876 [disable randomly alloc failure]),
1877 [],[enable_fail_alloc=yes])
1878 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1879 AC_MSG_RESULT([$enable_fail_alloc])
1880 if test x$enable_fail_alloc != xno ; then
1881 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1884 AC_ARG_ENABLE([invariants],
1885 AC_HELP_STRING([--enable-invariants],
1886 [enable invariant checking (cpu intensive)]),
1888 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
1889 AC_MSG_RESULT([$enable_invariants])
1890 if test x$enable_invariants = xyes ; then
1891 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
1894 AC_ARG_ENABLE([lu_ref],
1895 AC_HELP_STRING([--enable-lu_ref],
1896 [enable lu_ref reference tracking code]),
1898 AC_MSG_CHECKING([whether to track references with lu_ref])
1899 AC_MSG_RESULT([$enable_lu_ref])
1900 if test x$enable_lu_ref = xyes ; then
1901 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
1909 # AM_CONDITIONALS for lustre
1911 AC_DEFUN([LC_CONDITIONALS],
1912 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1913 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1914 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1915 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1916 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1917 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1918 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
1919 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1920 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1921 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1922 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1923 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1924 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1925 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1931 # files that should be generated with AC_OUTPUT
1933 AC_DEFUN([LC_CONFIG_FILES],
1937 lustre/autoconf/Makefile
1938 lustre/contrib/Makefile
1940 lustre/include/Makefile
1941 lustre/include/lustre_ver.h
1942 lustre/include/linux/Makefile
1943 lustre/include/lustre/Makefile
1944 lustre/kernel_patches/targets/2.6-vanilla.target
1945 lustre/kernel_patches/targets/2.6-rhel4.target
1946 lustre/kernel_patches/targets/2.6-rhel5.target
1947 lustre/kernel_patches/targets/2.6-fc5.target
1948 lustre/kernel_patches/targets/2.6-patchless.target
1949 lustre/kernel_patches/targets/2.6-sles10.target
1950 lustre/ldlm/Makefile
1952 lustre/fid/autoMakefile
1953 lustre/liblustre/Makefile
1954 lustre/liblustre/tests/Makefile
1955 lustre/liblustre/tests/mpi/Makefile
1956 lustre/llite/Makefile
1957 lustre/llite/autoMakefile
1958 lustre/lclient/Makefile
1960 lustre/lov/autoMakefile
1961 lustre/lvfs/Makefile
1962 lustre/lvfs/autoMakefile
1964 lustre/mdc/autoMakefile
1966 lustre/lmv/autoMakefile
1968 lustre/mds/autoMakefile
1970 lustre/mdt/autoMakefile
1972 lustre/cmm/autoMakefile
1974 lustre/mdd/autoMakefile
1976 lustre/fld/autoMakefile
1977 lustre/obdclass/Makefile
1978 lustre/obdclass/autoMakefile
1979 lustre/obdclass/linux/Makefile
1980 lustre/obdecho/Makefile
1981 lustre/obdecho/autoMakefile
1982 lustre/obdfilter/Makefile
1983 lustre/obdfilter/autoMakefile
1985 lustre/osc/autoMakefile
1987 lustre/ost/autoMakefile
1989 lustre/osd/autoMakefile
1991 lustre/mgc/autoMakefile
1993 lustre/mgs/autoMakefile
1994 lustre/ptlrpc/Makefile
1995 lustre/ptlrpc/autoMakefile
1996 lustre/ptlrpc/gss/Makefile
1997 lustre/ptlrpc/gss/autoMakefile
1998 lustre/quota/Makefile
1999 lustre/quota/autoMakefile
2000 lustre/scripts/Makefile
2001 lustre/tests/Makefile
2002 lustre/tests/mpi/Makefile
2003 lustre/utils/Makefile
2004 lustre/utils/gss/Makefile
2006 case $lb_target_os in
2008 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])