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 # LC_CONFIG_OBD_BUFFER_SIZE
54 # the maximum buffer size of lctl ioctls
56 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
57 [AC_MSG_CHECKING([maximum OBD ioctl size])
58 AC_ARG_WITH([obd-buffer-size],
59 AC_HELP_STRING([--with-obd-buffer-size=[size]],
60 [set lctl ioctl maximum bytes (default=8192)]),
62 OBD_BUFFER_SIZE=$with_obd_buffer_size
66 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
67 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
73 AC_DEFUN([LC_READLINK_SSIZE_T],
74 [AC_MSG_CHECKING([if readlink returns ssize_t])
78 ssize_t readlink(const char *, char *, size_t);
81 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
88 # only for Lustre-patched kernels
90 AC_DEFUN([LC_LUSTRE_VERSION_H],
91 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
92 rm -f "$LUSTRE/include/linux/lustre_version.h"
94 touch "$LUSTRE/include/linux/lustre_version.h"
95 if test x$enable_server = xyes ; then
96 AC_MSG_WARN([Unpatched kernel detected.])
97 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
98 AC_MSG_WARN([disabling server build])
105 # LC_FUNC_DEV_SET_RDONLY
107 # check whether dev_set_rdonly is exported. This is needed until we
108 # have another mechanism to fence IO from the underlying device.
110 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
111 [LB_CHECK_SYMBOL_EXPORT([dev_set_rdonly],
112 [block/ll_rw_block.c,block/blk-core.c],[
113 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel exports dev_set_rdonly])
115 AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])
120 # Ensure stack size big than 8k in Lustre server (all kernels)
122 AC_DEFUN([LC_STACK_SIZE],
123 [AC_MSG_CHECKING([stack size big than 8k])
124 LB_LINUX_TRY_COMPILE([
125 #include <linux/thread_info.h>
127 #if THREAD_SIZE < 8192
128 #error "stack size < 8192"
133 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
138 # Allow the user to set the MDS thread upper limit
140 AC_DEFUN([LC_MDS_MAX_THREADS],
142 AC_ARG_WITH([mds_max_threads],
143 AC_HELP_STRING([--with-mds-max-threads=size],
144 [define the maximum number of threads available on the MDS: (default=512)]),
146 MDS_THREAD_COUNT=$with_mds_max_threads
147 AC_DEFINE_UNQUOTED(MDT_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of mdt threads])
154 # the pinger is temporary, until we have the recovery node in place
156 AC_DEFUN([LC_CONFIG_PINGER],
157 [AC_MSG_CHECKING([whether to enable pinger support])
158 AC_ARG_ENABLE([pinger],
159 AC_HELP_STRING([--disable-pinger],
160 [disable recovery pinger support]),
161 [],[enable_pinger='yes'])
162 AC_MSG_RESULT([$enable_pinger])
163 if test x$enable_pinger != xno ; then
164 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
171 # do checksum of bulk data between client and OST
173 AC_DEFUN([LC_CONFIG_CHECKSUM],
174 [AC_MSG_CHECKING([whether to enable data checksum support])
175 AC_ARG_ENABLE([checksum],
176 AC_HELP_STRING([--disable-checksum],
177 [disable data checksum support]),
178 [],[enable_checksum='yes'])
179 AC_MSG_RESULT([$enable_checksum])
180 if test x$enable_checksum != xno ; then
181 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
186 # LC_CONFIG_LIBLUSTRE_RECOVERY
188 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
189 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
190 AC_ARG_ENABLE([liblustre-recovery],
191 AC_HELP_STRING([--disable-liblustre-recovery],
192 [disable liblustre recovery support]),
193 [],[enable_liblustre_recovery='yes'])
194 AC_MSG_RESULT([$enable_liblustre_recovery])
195 if test x$enable_liblustre_recovery != xno ; then
196 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
201 # LC_CONFIG_HEALTH_CHECK_WRITE
203 # Turn off the actual write to the disk
205 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
206 [AC_MSG_CHECKING([whether to enable a write with the health check])
207 AC_ARG_ENABLE([health_write],
208 AC_HELP_STRING([--enable-health_write],
209 [enable disk writes when doing health check]),
210 [],[enable_health_write='no'])
211 AC_MSG_RESULT([$enable_health_write])
212 if test x$enable_health_write != xno ; then
213 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
217 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
218 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
219 AC_ARG_ENABLE([lru_resize],
220 AC_HELP_STRING([--enable-lru-resize],
221 [enable lru resize support]),
222 [],[enable_lru_resize='yes'])
223 AC_MSG_RESULT([$enable_lru_resize])
224 if test x$enable_lru_resize != xno; then
225 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
229 # whether to enable quota support(kernel modules)
230 AC_DEFUN([LC_QUOTA_MODULE],
231 [if test x$enable_quota != xno; then
232 LB_LINUX_CONFIG([QUOTA],[
233 enable_quota_module='yes'
234 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
236 enable_quota_module='no'
237 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
242 # truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
243 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
244 # delete_from_page_cache() is exported from 2.6.39
245 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
246 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
248 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
249 [kernel export truncate_complete_page])])
250 LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
252 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
253 [kernel export remove_from_page_cache])])
254 LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
256 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
257 [kernel export delete_from_page_cache])])
260 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
261 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
263 AC_DEFINE(HAVE_D_REHASH_COND, 1,
264 [d_rehash_cond is exported by the kernel])
269 AC_DEFUN([LC_EXPORT___D_REHASH],
270 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
272 AC_DEFINE(HAVE___D_REHASH, 1,
273 [__d_rehash is exported by the kernel])
278 # The actual symbol exported varies among architectures, so we need
279 # to check many symbols (but only in the current architecture.) No
280 # matter what symbol is exported, the kernel #defines node_to_cpumask
281 # to the appropriate function and that's what we use.
282 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
283 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
284 [arch/$LINUX_ARCH/mm/numa.c],
285 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
286 [node_to_cpumask is exported by
287 the kernel])]) # x86_64
288 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
289 [arch/$LINUX_ARCH/kernel/smpboot.c],
290 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
291 [node_to_cpumask is exported by
292 the kernel])]) # ia64
293 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
294 [arch/$LINUX_ARCH/kernel/smpboot.c],
295 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
296 [node_to_cpumask is exported by
297 the kernel])]) # i386
302 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
304 AC_DEFUN([LC_FILEMAP_POPULATE],
305 [AC_MSG_CHECKING([for exported filemap_populate])
306 LB_LINUX_TRY_COMPILE([
307 #include <asm/page.h>
308 #include <linux/mm.h>
310 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
313 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
322 AC_DEFUN([LC_BIT_SPINLOCK_H],
323 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
324 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
325 LB_LINUX_TRY_COMPILE([
326 #include <asm/processor.h>
327 #include <linux/spinlock.h>
328 #include <linux/bit_spinlock.h>
331 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
342 AC_DEFUN([LC_CONST_ACL_SIZE],
343 [AC_MSG_CHECKING([calc acl size])
345 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 -include $AUTOCONF_HDIR/autoconf.h $EXTRA_KCFLAGS"
348 #include <linux/types.h>
351 #define __LINUX_POSIX_ACL_H
353 #ifdef CONFIG_FS_POSIX_ACL
354 # include <linux/posix_acl_xattr.h>
361 /* LUSTRE_POSIX_ACL_MAX_ENTRIES = 32 */
362 int size = posix_acl_xattr_size(32);
363 FILE *f = fopen("acl.size","w+");
364 fprintf(f,"%d", size);
370 acl_size=`cat acl.size`
371 AC_MSG_RESULT([ACL size $acl_size])
372 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
374 AC_ERROR([ACL size can't be computed])
376 AC_MSG_RESULT([can't check ACL size, make it 260])
377 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
385 AC_DEFUN([LC_CAPA_CRYPTO],
386 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
387 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
389 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
390 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
392 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
393 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
398 # LC_CONFIG_RMTCLIENT
401 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
403 AC_DEFUN([LC_CONFIG_RMTCLIENT],
404 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
405 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
410 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
412 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
413 [AC_MSG_CHECKING([whether to enable gss keyring backend])
414 AC_ARG_ENABLE([gss_keyring],
415 [AC_HELP_STRING([--disable-gss-keyring],
416 [disable gss keyring backend])],
417 [],[enable_gss_keyring='yes'])
418 AC_MSG_RESULT([$enable_gss_keyring])
420 if test x$enable_gss_keyring != xno; then
421 LB_LINUX_CONFIG_IM([KEYS],[],
422 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
424 AC_CHECK_LIB([keyutils], [keyctl_search], [],
425 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
427 AC_DEFINE([HAVE_GSS_KEYRING], [1],
428 [Define this if you enable gss keyring backend])
432 AC_DEFUN([LC_CONFIG_SUNRPC],
433 [LB_LINUX_CONFIG_IM([SUNRPC],[],
434 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
438 # LC_CONFIG_GSS (default disabled)
440 # Build gss and related tools of Lustre. Currently both kernel and user space
441 # parts are depend on linux platform.
443 AC_DEFUN([LC_CONFIG_GSS],
444 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
446 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
447 [],[enable_gss='no'])
448 AC_MSG_RESULT([$enable_gss])
450 if test x$enable_gss == xyes; then
451 LC_CONFIG_GSS_KEYRING
454 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
456 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
457 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
458 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
459 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
460 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
461 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
462 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
463 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
465 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
466 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
467 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
468 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
469 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
471 AC_SUBST(GSSAPI_LIBS)
477 AC_DEFUN([LC_QUOTA_READ],
478 [AC_MSG_CHECKING([if kernel supports quota_read])
479 LB_LINUX_TRY_COMPILE([
480 #include <linux/fs.h>
482 struct super_operations sp;
483 void *i = (void *)sp.quota_read;
486 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
493 # LC_COOKIE_FOLLOW_LINK
495 # kernel 2.6.13+ ->follow_link returns a cookie
498 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
499 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
500 LB_LINUX_TRY_COMPILE([
501 #include <linux/fs.h>
502 #include <linux/namei.h>
504 struct dentry dentry;
507 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
509 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
519 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
520 # call_rcu takes three parameters.
522 AC_DEFUN([LC_FUNC_RCU],
523 [AC_MSG_CHECKING([if kernel have RCU supported])
524 LB_LINUX_TRY_COMPILE([
525 #include <linux/rcupdate.h>
527 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
530 AC_MSG_CHECKING([if call_rcu takes three parameters])
531 LB_LINUX_TRY_COMPILE([
532 #include <linux/rcupdate.h>
535 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
537 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
548 AC_DEFUN([LC_PERCPU_COUNTER],
549 [AC_MSG_CHECKING([if have struct percpu_counter defined])
550 LB_LINUX_TRY_COMPILE([
551 #include <linux/percpu_counter.h>
553 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
556 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
557 LB_LINUX_TRY_COMPILE([
558 #include <linux/percpu_counter.h>
560 struct percpu_counter c;
561 percpu_counter_init(&c, 0);
563 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
574 AC_DEFUN([LC_TASK_CLENV_STORE],
576 AC_MSG_CHECKING([if we can store cl_env in task_struct])
577 if test x$have_task_clenv_store != xyes ; then
578 LC_TASK_CLENV_TUX_INFO
584 AC_DEFUN([LC_S_TIME_GRAN],
585 [AC_MSG_CHECKING([if super block has s_time_gran member])
586 LB_LINUX_TRY_COMPILE([
587 #include <linux/fs.h>
589 struct super_block sb;
591 return sb.s_time_gran;
594 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
600 AC_DEFUN([LC_SB_TIME_GRAN],
601 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
602 LB_LINUX_TRY_COMPILE([
603 #include <linux/fs.h>
605 return get_sb_time_gran(NULL);
608 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
616 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
617 AC_DEFUN([LC_RW_TREE_LOCK],
618 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
619 tmp_flags="$EXTRA_KCFLAGS"
620 EXTRA_KCFLAGS="-Werror"
621 LB_LINUX_TRY_COMPILE([
622 #include <linux/fs.h>
624 struct address_space a;
626 write_lock(&a.tree_lock);
629 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
633 EXTRA_KCFLAGS="$tmp_flags"
639 # after 2.6.15 inode have i_mutex intead of i_sem
640 AC_DEFUN([LC_INODE_I_MUTEX],
641 [AC_MSG_CHECKING([if inode has i_mutex ])
642 LB_LINUX_TRY_COMPILE([
643 #include <linux/mutex.h>
644 #include <linux/fs.h>
649 mutex_unlock(&i.i_mutex);
652 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
653 [after 2.6.15 inode have i_mutex intead of i_sem])
661 # LC_SECURITY_PLUG # for SLES10 SP2
662 # check security plug in sles10 sp2 kernel
663 AC_DEFUN([LC_SECURITY_PLUG],
664 [AC_MSG_CHECKING([If kernel has security plug support])
665 LB_LINUX_TRY_COMPILE([
666 #include <linux/fs.h>
668 struct dentry *dentry;
669 struct vfsmount *mnt;
672 notify_change(dentry, mnt, iattr);
675 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
676 [SLES10 SP2 use extra parameter in vfs])
684 # inode have i_private field since 2.6.17
685 AC_DEFUN([LC_INODE_IPRIVATE],
686 [AC_MSG_CHECKING([if inode has a i_private field])
687 LB_LINUX_TRY_COMPILE([
688 #include <linux/fs.h>
694 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
695 [struct inode has i_private field])
702 # after 2.6.17 dquote use mutex instead if semaphore
703 AC_DEFUN([LC_DQUOTOFF_MUTEX],
704 [AC_MSG_CHECKING([use dqonoff_mutex])
705 LB_LINUX_TRY_COMPILE([
706 #include <linux/mutex.h>
707 #include <linux/fs.h>
708 #include <linux/quota.h>
710 struct quota_info dq;
712 mutex_unlock(&dq.dqonoff_mutex);
715 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
716 [after 2.6.17 dquote use mutex instead if semaphore])
725 # 2.6.18 don't export nr_pagecahe
726 AC_DEFUN([LC_NR_PAGECACHE],
727 [AC_MSG_CHECKING([kernel export nr_pagecache])
728 LB_LINUX_TRY_COMPILE([
729 #include <linux/pagemap.h>
731 return atomic_read(&nr_pagecache);
734 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
735 [is kernel export nr_pagecache])
742 # LC_STATFS_DENTRY_PARAM
743 # starting from 2.6.18 linux kernel uses dentry instead of super_block
744 # for the first parameter of the super_operations->statfs() callback.
747 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
748 [AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
749 tmp_flags="$EXTRA_KCFLAGS"
750 EXTRA_KCFLAGS="-Werror"
751 LB_LINUX_TRY_COMPILE([
752 #include <linux/fs.h>
754 ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
756 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
757 [super_ops.statfs() first parameter is dentry])
762 EXTRA_KCFLAGS="$tmp_flags"
765 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
766 # 2.6.18~2.6.25 umount_begin has different parameters
767 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
768 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
769 tmp_flags="$EXTRA_KCFLAGS"
770 EXTRA_KCFLAGS="-Werror"
771 LB_LINUX_TRY_COMPILE([
772 #include <linux/fs.h>
775 static void cfg_umount_begin (struct vfsmount *v, int flags)
780 static struct super_operations cfg_super_operations = {
781 .umount_begin = cfg_umount_begin,
784 cfg_super_operations.umount_begin(NULL,0);
787 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
788 [Define umount_begin need second argument])
792 EXTRA_KCFLAGS="$tmp_flags"
796 # starting from 2.6.18 the file_operations .flush
797 # method has a new "fl_owner_t id" parameter
799 AC_DEFUN([LC_FLUSH_OWNER_ID],
800 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
801 LB_LINUX_TRY_COMPILE([
802 #include <linux/fs.h>
804 struct file_operations *fops = NULL;
808 i = fops->flush(NULL, id);
810 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
811 [file_operations .flush method has an fl_owner_t id])
819 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
821 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
822 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
824 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
825 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
826 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
827 [exported invalidate_mapping_pages])],
828 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
829 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
830 [exported invalidate_inode_pages])], [
831 AC_MSG_ERROR([no way to invalidate pages])
836 #2.6.18 + RHEL5 (fc6)
838 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
839 AC_DEFUN([LC_PG_FS_MISC],
840 [AC_MSG_CHECKING([kernel has PG_fs_misc])
841 LB_LINUX_TRY_COMPILE([
842 #include <linux/mm.h>
843 #include <linux/page-flags.h>
846 #error PG_fs_misc not defined in kernel
850 AC_DEFINE(HAVE_PG_FS_MISC, 1,
851 [is kernel have PG_fs_misc])
857 # RHEL5 PageChecked and SetPageChecked defined
858 AC_DEFUN([LC_PAGE_CHECKED],
859 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
860 LB_LINUX_TRY_COMPILE([
861 #include <linux/mm.h>
862 #ifdef HAVE_LINUX_MMTYPES_H
863 #include <linux/mm_types.h>
865 #include <linux/page-flags.h>
867 struct page *p = NULL;
869 /* before 2.6.26 this define*/
871 /* 2.6.26 use function instead of define for it */
877 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
878 [does kernel have PageChecked and SetPageChecked])
887 # If we have fiemap.h
888 # after 2.6.27 use fiemap.h in include/linux
890 AC_DEFUN([LC_LINUX_FIEMAP_H],
891 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
892 AC_MSG_CHECKING([if fiemap.h can be compiled])
893 LB_LINUX_TRY_COMPILE([
894 #include <linux/types.h>
895 #include <linux/fiemap.h>
898 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
909 # inode don't have i_blksize field
910 AC_DEFUN([LC_INODE_BLKSIZE],
911 [AC_MSG_CHECKING([inode has i_blksize field])
912 LB_LINUX_TRY_COMPILE([
913 #include <linux/fs.h>
919 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
920 [struct inode has i_blksize field])
927 # 2.6.19 replaced writev with aio_write
928 AC_DEFUN([LC_FILE_WRITEV],
929 [AC_MSG_CHECKING([writev in fops])
930 LB_LINUX_TRY_COMPILE([
931 #include <linux/fs.h>
933 struct file_operations *fops = NULL;
937 AC_DEFINE(HAVE_FILE_WRITEV, 1,
945 # 2.6.19 replaced readv with aio_read
946 AC_DEFUN([LC_FILE_READV],
947 [AC_MSG_CHECKING([readv in fops])
948 LB_LINUX_TRY_COMPILE([
949 #include <linux/fs.h>
951 struct file_operations *fops = NULL;
955 AC_DEFINE(HAVE_FILE_READV, 1,
964 # LC_CANCEL_DIRTY_PAGE
965 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
966 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
967 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
968 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
969 # backport is broken, so ignore it
970 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
971 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
974 LB_LINUX_TRY_COMPILE([
975 #include <linux/mm.h>
976 #include <linux/page-flags.h>
978 cancel_dirty_page(NULL, 0);
981 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
982 [kernel has cancel_dirty_page instead of clear_page_dirty])
989 # raid5-zerocopy patch
994 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
995 # it support constant page, which means the page won't be modified during the
998 AC_DEFUN([LC_PAGE_CONSTANT],
999 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1000 LB_LINUX_TRY_COMPILE([
1001 #include <linux/mm.h>
1002 #include <linux/page-flags.h>
1005 #error "Have no raid5 zcopy patch"
1009 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1017 # 2.6.22 lost second parameter for invalidate_bdev
1018 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1019 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1020 LB_LINUX_TRY_COMPILE([
1021 #include <linux/buffer_head.h>
1023 invalidate_bdev(NULL,0);
1025 AC_MSG_RESULT([yes])
1026 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1027 [invalidate_bdev has second argument])
1034 # check for crypto API
1036 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1037 [AC_MSG_CHECKING([if kernel has block cipher support])
1038 LB_LINUX_TRY_COMPILE([
1039 #include <linux/err.h>
1040 #include <linux/crypto.h>
1042 struct crypto_blkcipher *tfm;
1043 tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
1045 AC_MSG_RESULT([yes])
1046 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1053 # check for struct hash_desc
1055 AC_DEFUN([LC_STRUCT_HASH_DESC],
1056 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1057 LB_LINUX_TRY_COMPILE([
1058 #include <linux/err.h>
1059 #include <linux/crypto.h>
1061 struct hash_desc foo;
1063 AC_MSG_RESULT([yes])
1064 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1071 # check for struct blkcipher_desc
1073 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1074 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1075 LB_LINUX_TRY_COMPILE([
1076 #include <linux/err.h>
1077 #include <linux/crypto.h>
1079 struct blkcipher_desc foo;
1081 AC_MSG_RESULT([yes])
1082 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1089 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1091 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1092 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1093 LB_LINUX_TRY_COMPILE([
1094 #include <linux/fs.h>
1096 int v = FS_RENAME_DOES_D_MOVE;
1098 AC_MSG_RESULT([yes])
1099 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1107 # 2.6.23 have return type 'void' for unregister_blkdev
1108 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1109 [AC_MSG_CHECKING([if unregister_blkdev return int])
1110 LB_LINUX_TRY_COMPILE([
1111 #include <linux/fs.h>
1113 int i = unregister_blkdev(0,NULL);
1115 AC_MSG_RESULT([yes])
1116 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1117 [unregister_blkdev return int])
1123 # 2.6.23 change .sendfile to .splice_read
1124 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1125 [AC_MSG_CHECKING([if kernel has .splice_read])
1126 LB_LINUX_TRY_COMPILE([
1127 #include <linux/fs.h>
1129 struct file_operations file;
1131 file.splice_read = NULL;
1133 AC_MSG_RESULT([yes])
1134 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1135 [kernel has .slice_read])
1141 # 2.6.23 change .sendfile to .splice_read
1142 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1143 AC_DEFUN([LC_KERNEL_SENDFILE],
1144 [AC_MSG_CHECKING([if kernel has .sendfile])
1145 LB_LINUX_TRY_COMPILE([
1146 #include <linux/fs.h>
1148 struct file_operations file;
1150 file.sendfile = NULL;
1152 AC_MSG_RESULT([yes])
1153 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1154 [kernel has .sendfile])
1160 # 2.6.23 extract nfs export related data into exportfs.h
1161 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1162 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1163 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1164 [kernel has include/exportfs.h])
1170 # 2.6.23 has new page fault handling API
1171 AC_DEFUN([LC_VM_OP_FAULT],
1172 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1173 LB_LINUX_TRY_COMPILE([
1174 #include <linux/mm.h>
1176 struct vm_operations_struct op;
1180 AC_MSG_RESULT([yes])
1181 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1182 [kernel has .fault in vm_operation_struct])
1188 # 2.6.23 add code to wait other users to complete before removing procfs entry
1189 AC_DEFUN([LC_PROCFS_USERS],
1190 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1191 LB_LINUX_TRY_COMPILE([
1192 #include <linux/proc_fs.h>
1194 struct proc_dir_entry pde;
1198 AC_MSG_RESULT([yes])
1199 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1200 [kernel has pde_users member in procfs entry struct])
1206 # 2.6.23 exports exportfs_decode_fh
1207 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1208 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1209 [fs/exportfs/expfs.c],[
1210 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1211 [exportfs_decode_fh has been export])
1218 # 2.6.24 need linux/mm_types.h included
1219 AC_DEFUN([LC_HAVE_MMTYPES_H],
1220 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1221 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1222 [kernel has include/mm_types.h])
1228 # 2.6.24 has bio_endio with 2 args
1229 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1230 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1231 LB_LINUX_TRY_COMPILE([
1232 #include <linux/bio.h>
1236 AC_MSG_RESULT([yes])
1237 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1238 [kernel has bio_endio with 2 args])
1244 # 2.6.24 has new members in exports struct.
1245 AC_DEFUN([LC_FH_TO_DENTRY],
1246 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1247 LB_LINUX_TRY_COMPILE([
1248 #include <linux/fs.h>
1249 #ifdef HAVE_LINUX_EXPORTFS_H
1250 #include <linux/exportfs.h>
1253 do{ }while(sizeof(((struct export_operations *)0)->fh_to_dentry));
1255 AC_MSG_RESULT([yes])
1256 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1257 [kernel has .fh_to_dentry member in export_operations struct])
1263 # 2.6.24 removes long aged procfs entry -> deleted member
1264 AC_DEFUN([LC_PROCFS_DELETED],
1265 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1266 LB_LINUX_TRY_COMPILE([
1267 #include <linux/proc_fs.h>
1269 struct proc_dir_entry pde;
1271 pde.deleted = sizeof(pde);
1273 AC_MSG_RESULT([yes])
1274 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1275 [kernel has deleted member in procfs entry struct])
1281 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1282 AC_DEFUN([LC_EXPORT_BDI_INIT],
1283 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1284 [mm/backing-dev.c],[
1285 AC_DEFINE(HAVE_BDI_INIT, 1,
1286 [bdi_init/bdi_destroy functions are present])
1293 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1294 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1295 [AC_MSG_CHECKING([fs_struct use path structure])
1296 LB_LINUX_TRY_COMPILE([
1297 #include <asm/atomic.h>
1298 #include <linux/spinlock.h>
1299 #include <linux/fs_struct.h>
1301 struct fs_struct fs;
1303 fs.pwd = *((struct path *)sizeof(fs));
1305 AC_MSG_RESULT([yes])
1306 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1307 [fs_struct use path structure])
1317 AC_DEFUN([LC_PGMKWRITE_USE_VMFAULT],
1318 [AC_MSG_CHECKING([kernel .page_mkwrite uses struct vm_fault *])
1319 tmp_flags="$EXTRA_KCFLAGS"
1320 EXTRA_KCFLAGS="-Werror"
1321 LB_LINUX_TRY_COMPILE([
1322 #include <linux/mm.h>
1324 ((struct vm_operations_struct *)0)->page_mkwrite((struct vm_area_struct *)0, (struct vm_fault *)0);
1326 AC_MSG_RESULT([yes])
1327 AC_DEFINE(HAVE_PGMKWRITE_USE_VMFAULT, 1,
1328 [kernel vm_operation_struct.page_mkwrite uses struct vm_fault * as second parameter])
1332 EXTRA_KCFLAGS="$tmp_flags"
1335 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1336 [AC_MSG_CHECKING([inode_operations->permission has two args])
1337 LB_LINUX_TRY_COMPILE([
1338 #include <linux/fs.h>
1340 struct inode *inode;
1341 inode->i_op->permission(NULL, 0);
1343 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1344 [inode_operations->permission has two args])
1345 AC_MSG_RESULT([yes])
1351 # 2.6.27 has file_remove_suid instead of remove_suid
1352 AC_DEFUN([LC_FILE_REMOVE_SUID],
1353 [AC_MSG_CHECKING([kernel has file_remove_suid])
1354 LB_LINUX_TRY_COMPILE([
1355 #include <linux/fs.h>
1357 file_remove_suid(NULL);
1359 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1360 [kernel have file_remove_suid])
1361 AC_MSG_RESULT([yes])
1367 # 2.6.27 have new page locking API
1368 AC_DEFUN([LC_TRYLOCKPAGE],
1369 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1370 LB_LINUX_TRY_COMPILE([
1371 #include <linux/pagemap.h>
1375 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1376 [kernel uses trylock_page for page lock])
1377 AC_MSG_RESULT([yes])
1383 # 2.6.27 removed the read_inode from super_operations.
1384 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1385 [AC_MSG_CHECKING([super_operations has a read_inode field])
1386 LB_LINUX_TRY_COMPILE([
1387 #include <linux/fs.h>
1389 struct super_operations *sop;
1390 sop->read_inode(NULL);
1392 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1393 [super_operations has a read_inode])
1394 AC_MSG_RESULT([yes])
1400 # 2.6.27 has inode_permission instead of permisson
1401 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1402 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1404 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1405 [inode_permission is exported by the kernel])
1410 # 2.6.27 use 5th parameter in quota_on for remount.
1411 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1412 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1413 LB_LINUX_TRY_COMPILE([
1414 #include <linux/quota.h>
1416 struct quotactl_ops *qop;
1417 qop->quota_on(NULL, 0, 0, NULL, 0);
1419 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1420 [quota_on needs 5 paramters])
1421 AC_MSG_RESULT([yes])
1427 # 2.6.27 use 3th parameter in quota_off for remount.
1428 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1429 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1430 LB_LINUX_TRY_COMPILE([
1431 #include <linux/quota.h>
1433 struct quotactl_ops *qop;
1434 qop->quota_off(NULL, 0, 0);
1436 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1437 [quota_off needs 3 paramters])
1438 AC_MSG_RESULT([yes])
1444 # 2.6.27 has vfs_dq_off inline function.
1445 AC_DEFUN([LC_VFS_DQ_OFF],
1446 [AC_MSG_CHECKING([vfs_dq_off is defined])
1447 LB_LINUX_TRY_COMPILE([
1448 #include <linux/quotaops.h>
1450 vfs_dq_off(NULL, 0);
1452 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1453 AC_MSG_RESULT([yes])
1459 # LC_LOCK_MAP_ACQUIRE
1460 # after 2.6.27 lock_map_acquire replaces lock_acquire
1461 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1462 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1463 LB_LINUX_TRY_COMPILE([
1464 #include <linux/lockdep.h>
1466 lock_map_acquire(NULL);
1469 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1470 [lock_map_acquire is defined])
1476 # 2.6.27.15-2 sles11
1478 # 2.6.27 sles11 remove the bi_hw_segments
1479 AC_DEFUN([LC_BI_HW_SEGMENTS],
1480 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1481 LB_LINUX_TRY_COMPILE([
1482 #include <linux/bio.h>
1485 io.bi_hw_segments = sizeof(io);
1487 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1488 [struct bio has a bi_hw_segments field])
1489 AC_MSG_RESULT([yes])
1496 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1497 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1498 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1499 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1500 AC_DEFINE(HAVE_QUOTAIO_H, 1,
1501 [kernel has include/linux/quotaio_v2.h])
1502 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1503 AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1504 [kernel has fs/quotaio_v1.h])
1505 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1506 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1507 [kernel has fs/quota/quotaio_v2.h])
1515 # 2.6.27 sles11 has sb_any_quota_active
1516 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1517 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1518 LB_LINUX_TRY_COMPILE([
1519 #include <linux/quotaops.h>
1521 sb_any_quota_active(NULL);
1523 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1524 [Kernel has a sb_any_quota_active])
1525 AC_MSG_RESULT([yes])
1531 # 2.6.27 sles11 has sb_has_quota_active
1532 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1533 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1534 LB_LINUX_TRY_COMPILE([
1535 #include <linux/quotaops.h>
1537 sb_has_quota_active(NULL, 0);
1539 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1540 [Kernel has a sb_has_quota_active])
1541 AC_MSG_RESULT([yes])
1547 # 2.6.27 exported add_to_page_cache_lru.
1548 AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
1549 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1551 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1552 [add_to_page_cache_lru functions are present])
1558 # 2.6.29 introduce sb_any_quota_loaded.
1560 AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
1561 [AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
1562 LB_LINUX_TRY_COMPILE([
1563 #include <linux/quotaops.h>
1565 sb_any_quota_loaded(NULL);
1567 AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
1568 [Kernel has a sb_any_quota_loaded])
1569 AC_MSG_RESULT([yes])
1575 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
1576 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
1577 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
1578 [arch/$LINUX_ARCH/mm/numa.c],
1579 [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
1580 [node_to_cpumask_map is exported by
1581 the kernel])]) # x86_64
1584 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1585 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1586 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1587 LB_LINUX_TRY_COMPILE([
1588 #include <linux/blkdev.h>
1590 blk_queue_logical_block_size(NULL, 0);
1593 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1594 [blk_queue_logical_block_size is defined])
1602 # 2.6.32 changes cache_detail's member cache_request to cache_upcall
1603 # in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
1604 AC_DEFUN([LC_CACHE_UPCALL],
1605 [AC_MSG_CHECKING([if cache_detail has cache_upcall field])
1606 LB_LINUX_TRY_COMPILE([
1607 #include <linux/sunrpc/cache.h>
1609 struct cache_detail cd;
1610 cd.cache_upcall = NULL;
1613 AC_DEFINE(HAVE_CACHE_UPCALL, 1,
1614 [cache_detail has cache_upcall field])
1620 # 2.6.32 add a limits member in struct request_queue.
1621 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1622 [AC_MSG_CHECKING([if request_queue has a limits field])
1623 LB_LINUX_TRY_COMPILE([
1624 #include <linux/blkdev.h>
1626 struct request_queue rq;
1627 rq.limits.io_min = 0;
1630 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1631 [request_queue has a limits field])
1637 # 2.6.32 has bdi_register() functions.
1638 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1639 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1640 [mm/backing-dev.c],[
1641 AC_DEFINE(HAVE_BDI_REGISTER, 1,
1642 [bdi_register function is present])
1647 # 2.6.32 add s_bdi for super block
1648 AC_DEFUN([LC_SB_BDI],
1649 [AC_MSG_CHECKING([if super_block has s_bdi field])
1650 LB_LINUX_TRY_COMPILE([
1651 #include <linux/fs.h>
1653 struct super_block sb;
1657 AC_DEFINE(HAVE_SB_BDI, 1,
1658 [super_block has s_bdi field])
1664 # 2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
1665 AC_DEFUN([LC_BDI_NAME],
1666 [AC_MSG_CHECKING([if backing_device_info has name field])
1667 LB_LINUX_TRY_COMPILE([
1668 #include <linux/blkkdev.h>
1670 struct backing_dev_info bdi;
1674 AC_DEFINE(HAVE_BDI_NAME, 1,
1675 [backing_device_info has name field])
1681 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1682 # check blk_queue_max_sectors and use it until disappear.
1683 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1684 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1685 LB_LINUX_TRY_COMPILE([
1686 #include <linux/blkdev.h>
1688 blk_queue_max_sectors(NULL, 0);
1691 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1692 [blk_queue_max_sectors is defined])
1698 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
1699 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1700 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1701 LB_LINUX_TRY_COMPILE([
1702 #include <linux/blkdev.h>
1704 blk_queue_max_segments(NULL, 0);
1707 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1708 [blk_queue_max_segments is defined])
1717 # Check if kernel has been patched for 64-bit quota limits support.
1718 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
1719 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
1720 # that in the absence of quotaio_v1.h in the kernel headers.
1722 AC_DEFUN([LC_QUOTA64],[
1723 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1724 tmp_flags="$EXTRA_KCFLAGS"
1725 EXTRA_KCFLAGS="-I$LINUX/fs"
1726 LB_LINUX_TRY_COMPILE([
1727 #include <linux/kernel.h>
1728 #include <linux/fs.h>
1729 #ifdef HAVE_QUOTAIO_H
1730 # include <linux/quotaio_v2.h>
1731 int versions[] = V2_INITQVERSIONS_R1;
1732 struct v2_disk_dqblk_r1 dqblk_r1;
1733 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
1734 # include <quota/quotaio_v2.h>
1735 struct v2r1_disk_dqblk dqblk_r1;
1736 #elif defined(HAVE_FS_QUOTAIO_H)
1737 # include <quotaio_v2.h>
1738 struct v2r1_disk_dqblk dqblk_r1;
1740 #include <linux/quota.h>
1741 int ver = QFMT_VFS_V1;
1744 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1745 AC_MSG_RESULT([yes])
1747 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1748 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1752 EXTRA_KCFLAGS=$tmp_flags
1755 # 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
1756 AC_DEFUN([LC_SET_CPUS_ALLOWED],
1757 [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
1758 LB_LINUX_TRY_COMPILE(
1759 [#include <linux/sched.h>],
1760 [struct task_struct *p = NULL;
1761 cpumask_t mask = { { 0 } };
1762 (void) set_cpus_allowed(p, mask);],
1763 [AC_MSG_RESULT([yes])
1764 AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
1765 [set_cpus_allowed is exported by the kernel])],
1766 [AC_MSG_RESULT([no])] )])
1768 # 2.6.32 introduces selinux_is_enabled()
1769 AC_DEFUN([LC_SELINUX_IS_ENABLED],
1770 [AC_MSG_CHECKING([if selinux_is_enabled is available])
1771 LB_LINUX_TRY_COMPILE([
1772 #include <linux/selinux.h>
1774 selinux_is_enabled();
1776 AC_MSG_RESULT([yes])
1777 AC_DEFINE(HAVE_SELINUX_IS_ENABLED, 1,
1778 [selinux_is_enabled is defined])
1786 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1787 # d_obtain_alias() for getting anonymous dentries
1788 # RHEL5(2.6.18) has d_obtain_alias but SLES11SP0(2.6.27) not
1790 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1791 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1792 LB_LINUX_TRY_COMPILE([
1793 #include <linux/dcache.h>
1795 d_obtain_alias(NULL);
1797 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1798 [d_obtain_alias exist in kernel])
1799 AC_MSG_RESULT([yes])
1806 # LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
1808 AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
1809 [LB_CHECK_SYMBOL_EXPORT(
1810 [generic_error_remove_page],
1812 [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
1813 [kernel export generic_error_remove_page])],
1819 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
1821 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
1822 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
1823 LB_LINUX_TRY_COMPILE([
1824 #include <asm/atomic.h>
1825 #include <linux/spinlock.h>
1826 #include <linux/fs_struct.h>
1828 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
1830 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
1831 [fs_struct.lock use rwlock])
1832 AC_MSG_RESULT([yes])
1839 # 2.6.36 super_operations add evict_inode method. it hybird of
1840 # delete_inode & clear_inode.
1842 AC_DEFUN([LC_SBOPS_EVICT_INODE],
1843 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
1844 LB_LINUX_TRY_COMPILE([
1845 #include <linux/fs.h>
1847 ((struct super_operations *)0)->evict_inode(NULL);
1849 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
1850 [super_operations.evict_inode() is exist in kernel])
1851 AC_MSG_RESULT([yes])
1858 # 2.6.35 file_operations.fsync taken 2 arguments.
1859 # 3.0.0 file_operations.fsync takes 4 arguments.
1861 AC_DEFUN([LC_FILE_FSYNC],
1862 [AC_MSG_CHECKING([if file_operations.fsync takes 4 or 2 arguments])
1863 LB_LINUX_TRY_COMPILE([
1864 #include <linux/fs.h>
1866 ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
1868 AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
1869 [file_operations.fsync takes 4 arguments])
1870 AC_MSG_RESULT([yes, 4 args])
1872 LB_LINUX_TRY_COMPILE([
1873 #include <linux/fs.h>
1875 ((struct file_operations *)0)->fsync(NULL, 0);
1877 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
1878 [file_operations.fsync takes 2 arguments])
1879 AC_MSG_RESULT([yes, 2 args])
1887 # 2.6.38 export blkdev_get_by_dev
1889 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
1890 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
1892 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
1893 [blkdev_get_by_dev is exported by the kernel])
1899 # 2.6.38 vfsmount.mnt_count doesn't use atomic_t
1901 AC_DEFUN([LC_ATOMIC_MNT_COUNT],
1902 [AC_MSG_CHECKING([if vfsmount.mnt_count is atomic_t])
1903 LB_LINUX_TRY_COMPILE([
1904 #include <asm/atomic.h>
1905 #include <linux/fs.h>
1906 #include <linux/mount.h>
1908 ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
1910 AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
1911 [vfsmount.mnt_count is atomic_t])
1912 AC_MSG_RESULT([yes])
1919 # 2.6.38 use path as 4th parameter in quota_on.
1921 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
1922 [AC_MSG_CHECKING([quota_on use path as parameter])
1923 tmp_flags="$EXTRA_KCFLAGS"
1924 EXTRA_KCFLAGS="-Werror"
1925 LB_LINUX_TRY_COMPILE([
1926 #include <linux/fs.h>
1927 #include <linux/quota.h>
1929 ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
1931 AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
1932 [quota_on use path as 4th paramter])
1933 AC_MSG_RESULT([yes])
1937 EXTRA_KCFLAGS="$tmp_flags"
1941 # 2.6.39 remove unplug_fn from request_queue.
1943 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
1944 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
1945 LB_LINUX_TRY_COMPILE([
1946 #include <linux/blkdev.h>
1948 do{ }while(sizeof(((struct request_queue *)0)->unplug_fn));
1950 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
1951 [request_queue has unplug_fn field])
1952 AC_MSG_RESULT([yes])
1959 # 2.6.38 generic_permission taken 4 paremater.
1960 # in fact, it means rcu-walk aware permission bring.
1962 AC_DEFUN([LC_GENERIC_PERMISSION],
1963 [AC_MSG_CHECKING([if generic_permission take 4 arguments])
1964 LB_LINUX_TRY_COMPILE([
1965 #include <linux/fs.h>
1967 generic_permission(NULL, 0, 0, NULL);
1969 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
1970 [generic_permission taken 4 arguments])
1971 AC_MSG_RESULT([yes])
1978 # 2.6.38 export simple_setattr
1980 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
1981 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
1983 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
1984 [simple_setattr is exported by the kernel])
1992 # Lustre linux kernel checks
1994 AC_DEFUN([LC_PROG_LINUX],
1995 [LC_LUSTRE_VERSION_H
1998 LC_CONFIG_LIBLUSTRE_RECOVERY
1999 LC_CONFIG_HEALTH_CHECK_WRITE
2000 LC_CONFIG_LRU_RESIZE
2002 LC_LLITE_LLOOP_MODULE
2005 LC_EXPORT_TRUNCATE_COMPLETE
2006 LC_EXPORT_D_REHASH_COND
2007 LC_EXPORT___D_REHASH
2008 LC_EXPORT_NODE_TO_CPUMASK
2019 LC_COOKIE_FOLLOW_LINK
2035 LC_SECURITY_PLUG # for SLES10 SP2
2043 LC_STATFS_DENTRY_PARAM
2044 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2046 if test x$enable_server = xyes ; then
2047 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2050 #2.6.18 + RHEL5 (fc6)
2061 LC_CANCEL_DIRTY_PAGE
2063 # raid5-zerocopy patch
2067 LC_INVALIDATE_BDEV_2ARG
2068 LC_ASYNC_BLOCK_CIPHER
2070 LC_STRUCT_BLKCIPHER_DESC
2071 LC_FS_RENAME_DOES_D_MOVE
2074 LC_UNREGISTER_BLKDEV_RETURN_INT
2075 LC_KERNEL_SPLICE_READ
2080 LC_EXPORTFS_DECODE_FH
2090 LC_FS_STRUCT_USE_PATH
2093 LC_PGMKWRITE_USE_VMFAULT
2094 LC_INODE_PERMISION_2ARGS
2097 LC_READ_INODE_IN_SBOPS
2098 LC_EXPORT_INODE_PERMISSION
2104 # 2.6.27.15-2 sles11
2108 LC_SB_ANY_QUOTA_ACTIVE
2109 LC_SB_HAS_QUOTA_ACTIVE
2110 LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
2113 LC_SB_ANY_QUOTA_LOADED
2116 LC_EXPORT_CPUMASK_OF_NODE
2119 LC_BLK_QUEUE_LOG_BLK_SIZE
2122 LC_REQUEST_QUEUE_LIMITS
2123 LC_EXPORT_BDI_REGISTER
2125 LC_BLK_QUEUE_MAX_SECTORS
2126 LC_BLK_QUEUE_MAX_SEGMENTS
2129 LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
2130 LC_SELINUX_IS_ENABLED
2134 LC_EXPORT_SIMPLE_SETATTR
2138 LC_SBOPS_EVICT_INODE
2142 LC_BLKDEV_GET_BY_DEV
2143 LC_GENERIC_PERMISSION
2144 LC_QUOTA_ON_USE_PATH
2147 LC_REQUEST_QUEUE_UNPLUG_FN
2150 if test x$enable_server = xyes ; then
2151 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2152 LC_FUNC_DEV_SET_RDONLY
2159 # LC_CONFIG_CLIENT_SERVER
2161 # Build client/server sides of Lustre
2163 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2164 [AC_MSG_CHECKING([whether to build Lustre server support])
2165 AC_ARG_ENABLE([server],
2166 AC_HELP_STRING([--disable-server],
2167 [disable Lustre server support]),
2168 [],[enable_server='yes'])
2169 AC_MSG_RESULT([$enable_server])
2171 AC_MSG_CHECKING([whether to build Lustre client support])
2172 AC_ARG_ENABLE([client],
2173 AC_HELP_STRING([--disable-client],
2174 [disable Lustre client support]),
2175 [],[enable_client='yes'])
2176 AC_MSG_RESULT([$enable_client])])
2179 # LC_CONFIG_LIBLUSTRE
2181 # whether to build liblustre
2183 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2184 [AC_MSG_CHECKING([whether to build Lustre library])
2185 AC_ARG_ENABLE([liblustre],
2186 AC_HELP_STRING([--disable-liblustre],
2187 [disable building of Lustre library]),
2188 [],[enable_liblustre=$with_sysio])
2189 AC_MSG_RESULT([$enable_liblustre])
2190 # only build sysio if liblustre is built
2191 with_sysio="$enable_liblustre"
2193 AC_MSG_CHECKING([whether to build liblustre tests])
2194 AC_ARG_ENABLE([liblustre-tests],
2195 AC_HELP_STRING([--enable-liblustre-tests],
2196 [enable liblustre tests, if --disable-tests is used]),
2197 [],[enable_liblustre_tests=$enable_tests])
2198 if test x$enable_liblustre != xyes ; then
2199 enable_liblustre_tests='no'
2201 AC_MSG_RESULT([$enable_liblustre_tests])
2203 AC_MSG_CHECKING([whether to enable liblustre acl])
2204 AC_ARG_ENABLE([liblustre-acl],
2205 AC_HELP_STRING([--disable-liblustre-acl],
2206 [disable ACL support for liblustre]),
2207 [],[enable_liblustre_acl=yes])
2208 AC_MSG_RESULT([$enable_liblustre_acl])
2209 if test x$enable_liblustre_acl = xyes ; then
2210 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2213 # 2.6.29 change prepare/commit_write to write_begin/end
2214 AC_DEFUN([LC_WRITE_BEGIN_END],
2215 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2216 LB_LINUX_TRY_COMPILE([
2217 #include <linux/fs.h>
2218 #include <linux/pagemap.h>
2219 #ifdef HAVE_LINUX_MMTYPES_H
2220 #include <linux/mm_types.h>
2223 struct address_space_operations aops;
2226 aops.write_begin = NULL;
2227 aops.write_end = NULL;
2228 page = grab_cache_page_write_begin(NULL, 0, 0);
2230 AC_MSG_RESULT([yes])
2231 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2232 [kernel has .write_begin/end])
2238 # 2.6.29 blkdev_put has 2 arguments
2239 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2240 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2241 LB_LINUX_TRY_COMPILE([
2242 #include <linux/fs.h>
2244 blkdev_put(NULL, 0);
2246 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2247 [blkdev_put needs 2 paramters])
2248 AC_MSG_RESULT([yes])
2254 # 2.6.29 dentry_open has 4 arguments
2255 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2256 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2257 LB_LINUX_TRY_COMPILE([
2258 #include <linux/fs.h>
2260 dentry_open(NULL, NULL, 0, NULL);
2262 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2263 [dentry_open needs 4 paramters])
2264 AC_MSG_RESULT([yes])
2270 # 2.6.29 split file and anonymous page queues
2271 AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
2272 [AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
2273 LB_LINUX_TRY_COMPILE([
2274 #include <linux/mm.h>
2275 #include <linux/pagevec.h>
2277 struct pagevec lru_pagevec;
2279 pagevec_init(&lru_pagevec, 0);
2280 pagevec_lru_add_file(&lru_pagevec);
2282 AC_MSG_RESULT([yes])
2283 AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
2284 [kernel has .pagevec_lru_add_file])
2293 AC_ARG_ENABLE(mpitests,
2294 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2295 [include mpi tests]),
2306 MPICC_WRAPPER=$enableval
2316 if test x$enable_mpitests != xno; then
2317 AC_MSG_CHECKING([whether mpitests can be built])
2325 MPI_Initialized(&flag);
2328 AC_MSG_RESULT([yes])
2335 AC_SUBST(MPICC_WRAPPER)
2337 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2338 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2341 LC_CONFIG_LIBLUSTRE_RECOVERY
2347 # whether to enable quota support global control
2349 AC_DEFUN([LC_CONFIG_QUOTA],
2350 [AC_ARG_ENABLE([quota],
2351 AC_HELP_STRING([--enable-quota],
2352 [enable quota support]),
2353 [],[enable_quota='yes'])
2356 AC_DEFUN([LC_QUOTA],
2360 AC_CHECK_HEADER(sys/quota.h,
2361 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2362 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2368 # whether to enable split support
2370 AC_DEFUN([LC_CONFIG_SPLIT],
2371 [AC_MSG_CHECKING([whether to enable split support])
2372 AC_ARG_ENABLE([split],
2373 AC_HELP_STRING([--enable-split],
2374 [enable split support]),
2375 [],[enable_split='no'])
2376 AC_MSG_RESULT([$enable_split])
2377 if test x$enable_split != xno; then
2378 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2382 # RHEL5(2.6.18) has tux_info
2383 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2384 [AC_MSG_CHECKING([tux_info])
2385 LB_LINUX_TRY_COMPILE([
2386 #include <linux/sched.h>
2388 struct task_struct task;
2391 AC_MSG_RESULT([yes])
2392 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2393 have_task_clenv_store='yes'
2400 # LC_LLITE_LLOOP_MODULE
2401 # lloop_llite.ko does not currently work with page sizes
2404 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2405 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2406 LB_LINUX_TRY_COMPILE([
2407 #include <asm/page.h>
2409 #if PAGE_SIZE >= 65536
2410 #error "PAGE_SIZE >= 65536"
2413 enable_llite_lloop_module='yes'
2414 AC_MSG_RESULT([yes])
2416 enable_llite_lloop_module='no'
2424 # other configure checks
2426 AC_DEFUN([LC_CONFIGURE],
2427 [LC_CONFIG_OBD_BUFFER_SIZE
2429 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2430 CFLAGS="$CFLAGS -Werror"
2433 # maximum MDS thread count
2436 # include/liblustre.h
2437 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2439 # liblustre/llite_lib.h
2440 AC_CHECK_HEADERS([xtio.h file.h])
2443 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2446 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2447 AC_CHECK_FUNCS([inet_ntoa])
2449 # libsysio/src/readlink.c
2452 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2453 AC_CHECK_HEADERS([linux/random.h], [], [],
2454 [#ifdef HAVE_LINUX_TYPES_H
2455 # include <linux/types.h>
2460 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2462 # check for -lz support
2466 [AC_CHECK_HEADERS([zlib.h],
2468 AC_DEFINE([HAVE_ADLER], 1,
2469 [support alder32 checksum type])],
2470 [AC_MSG_WARN([No zlib-devel package found,
2471 unable to use adler32 checksum])])],
2472 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2477 AC_ARG_ENABLE([mindf],
2478 AC_HELP_STRING([--enable-mindf],
2479 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2481 if test "$enable_mindf" = "yes" ; then
2482 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2485 AC_ARG_ENABLE([fail_alloc],
2486 AC_HELP_STRING([--disable-fail-alloc],
2487 [disable randomly alloc failure]),
2488 [],[enable_fail_alloc=yes])
2489 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2490 AC_MSG_RESULT([$enable_fail_alloc])
2491 if test x$enable_fail_alloc != xno ; then
2492 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2495 AC_ARG_ENABLE([invariants],
2496 AC_HELP_STRING([--enable-invariants],
2497 [enable invariant checking (cpu intensive)]),
2499 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2500 AC_MSG_RESULT([$enable_invariants])
2501 if test x$enable_invariants = xyes ; then
2502 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2505 AC_ARG_ENABLE([lu_ref],
2506 AC_HELP_STRING([--enable-lu_ref],
2507 [enable lu_ref reference tracking code]),
2509 AC_MSG_CHECKING([whether to track references with lu_ref])
2510 AC_MSG_RESULT([$enable_lu_ref])
2511 if test x$enable_lu_ref = xyes ; then
2512 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2515 AC_ARG_ENABLE([pgstate-track],
2516 AC_HELP_STRING([--enable-pgstate-track],
2517 [enable page state tracking]),
2518 [enable_pgstat_track='yes'],[])
2519 AC_MSG_CHECKING([whether to enable page state tracking])
2520 AC_MSG_RESULT([$enable_pgstat_track])
2521 if test x$enable_pgstat_track = xyes ; then
2522 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2523 [enable page state tracking code])
2530 LC_DENTRY_OPEN_4ARGS
2531 LC_PAGEVEC_LRU_ADD_FILE
2538 # AM_CONDITIONALS for lustre
2540 AC_DEFUN([LC_CONDITIONALS],
2541 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2542 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2543 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2544 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2545 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2546 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2547 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2548 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2549 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2550 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2551 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2552 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2553 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2554 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2555 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2561 # files that should be generated with AC_OUTPUT
2563 AC_DEFUN([LC_CONFIG_FILES],
2567 lustre/autoconf/Makefile
2568 lustre/conf/Makefile
2569 lustre/contrib/Makefile
2571 lustre/include/Makefile
2572 lustre/include/lustre_ver.h
2573 lustre/include/linux/Makefile
2574 lustre/include/darwin/Makefile
2575 lustre/include/lustre/Makefile
2576 lustre/kernel_patches/targets/2.6-rhel6.target
2577 lustre/kernel_patches/targets/2.6-rhel5.target
2578 lustre/kernel_patches/targets/2.6-sles10.target
2579 lustre/kernel_patches/targets/2.6-sles11.target
2580 lustre/kernel_patches/targets/2.6-oel5.target
2581 lustre/kernel_patches/targets/2.6-fc11.target
2582 lustre/kernel_patches/targets/2.6-fc12.target
2583 lustre/ldlm/Makefile
2585 lustre/fid/autoMakefile
2586 lustre/liblustre/Makefile
2587 lustre/liblustre/tests/Makefile
2588 lustre/liblustre/tests/mpi/Makefile
2589 lustre/llite/Makefile
2590 lustre/llite/autoMakefile
2591 lustre/lclient/Makefile
2593 lustre/lov/autoMakefile
2594 lustre/lvfs/Makefile
2595 lustre/lvfs/autoMakefile
2597 lustre/mdc/autoMakefile
2599 lustre/lmv/autoMakefile
2601 lustre/mds/autoMakefile
2603 lustre/mdt/autoMakefile
2605 lustre/cmm/autoMakefile
2607 lustre/mdd/autoMakefile
2609 lustre/fld/autoMakefile
2610 lustre/obdclass/Makefile
2611 lustre/obdclass/autoMakefile
2612 lustre/obdclass/linux/Makefile
2613 lustre/obdecho/Makefile
2614 lustre/obdecho/autoMakefile
2615 lustre/obdfilter/Makefile
2616 lustre/obdfilter/autoMakefile
2618 lustre/osc/autoMakefile
2620 lustre/ost/autoMakefile
2621 lustre/osd-ldiskfs/Makefile
2622 lustre/osd-ldiskfs/autoMakefile
2624 lustre/mgc/autoMakefile
2626 lustre/mgs/autoMakefile
2627 lustre/ptlrpc/Makefile
2628 lustre/ptlrpc/autoMakefile
2629 lustre/ptlrpc/gss/Makefile
2630 lustre/ptlrpc/gss/autoMakefile
2631 lustre/quota/Makefile
2632 lustre/quota/autoMakefile
2633 lustre/scripts/Makefile
2634 lustre/tests/Makefile
2635 lustre/tests/mpi/Makefile
2636 lustre/utils/Makefile
2637 lustre/utils/gss/Makefile
2638 lustre/obdclass/darwin/Makefile