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)
384 AC_DEFUN([LC_STRUCT_INTENT_FILE],
385 [AC_MSG_CHECKING([if struct open_intent has a file field])
386 LB_LINUX_TRY_COMPILE([
387 #include <linux/fs.h>
388 #include <linux/namei.h>
390 struct open_intent intent;
394 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
403 AC_DEFUN([LC_CAPA_CRYPTO],
404 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
405 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
407 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
408 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
410 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
411 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
416 # LC_CONFIG_RMTCLIENT
419 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
421 AC_DEFUN([LC_CONFIG_RMTCLIENT],
422 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
423 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
428 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
430 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
431 [AC_MSG_CHECKING([whether to enable gss keyring backend])
432 AC_ARG_ENABLE([gss_keyring],
433 [AC_HELP_STRING([--disable-gss-keyring],
434 [disable gss keyring backend])],
435 [],[enable_gss_keyring='yes'])
436 AC_MSG_RESULT([$enable_gss_keyring])
438 if test x$enable_gss_keyring != xno; then
439 LB_LINUX_CONFIG_IM([KEYS],[],
440 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
442 AC_CHECK_LIB([keyutils], [keyctl_search], [],
443 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
445 AC_DEFINE([HAVE_GSS_KEYRING], [1],
446 [Define this if you enable gss keyring backend])
450 AC_DEFUN([LC_SUNRPC_CACHE],
451 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
452 LB_LINUX_TRY_COMPILE([
453 #include <linux/sunrpc/cache.h>
455 struct cache_head ch;
459 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
465 AC_DEFUN([LC_CONFIG_SUNRPC],
466 [LB_LINUX_CONFIG_IM([SUNRPC],[],
467 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
472 # LC_CONFIG_GSS (default disabled)
474 # Build gss and related tools of Lustre. Currently both kernel and user space
475 # parts are depend on linux platform.
477 AC_DEFUN([LC_CONFIG_GSS],
478 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
480 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
481 [],[enable_gss='no'])
482 AC_MSG_RESULT([$enable_gss])
484 if test x$enable_gss == xyes; then
485 LC_CONFIG_GSS_KEYRING
488 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
490 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
491 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
492 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
493 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
494 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
495 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
496 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
497 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
499 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
500 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
501 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
502 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
503 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
505 AC_SUBST(GSSAPI_LIBS)
512 # LC_FUNC_HAVE_CAN_SLEEP_ARG
514 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
516 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
517 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
518 LB_LINUX_TRY_COMPILE([
519 #include <linux/fs.h>
523 struct file_lock *file_lock;
524 flock_lock_file_wait(file, file_lock, cansleep);
526 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
527 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
537 # rhel4.2 kernel has f_op->flock field
539 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
540 [AC_MSG_CHECKING([if struct file_operations has flock field])
541 LB_LINUX_TRY_COMPILE([
542 #include <linux/fs.h>
544 struct file_operations ll_file_operations_flock;
545 ll_file_operations_flock.flock = NULL;
547 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
548 [struct file_operations has flock field])
555 AC_DEFUN([LC_QUOTA_READ],
556 [AC_MSG_CHECKING([if kernel supports quota_read])
557 LB_LINUX_TRY_COMPILE([
558 #include <linux/fs.h>
560 struct super_operations sp;
561 void *i = (void *)sp.quota_read;
564 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
571 # LC_COOKIE_FOLLOW_LINK
573 # kernel 2.6.13+ ->follow_link returns a cookie
576 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
577 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
578 LB_LINUX_TRY_COMPILE([
579 #include <linux/fs.h>
580 #include <linux/namei.h>
582 struct dentry dentry;
585 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
587 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
597 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
598 # call_rcu takes three parameters.
600 AC_DEFUN([LC_FUNC_RCU],
601 [AC_MSG_CHECKING([if kernel have RCU supported])
602 LB_LINUX_TRY_COMPILE([
603 #include <linux/rcupdate.h>
605 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
608 AC_MSG_CHECKING([if call_rcu takes three parameters])
609 LB_LINUX_TRY_COMPILE([
610 #include <linux/rcupdate.h>
613 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
615 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
626 AC_DEFUN([LC_PERCPU_COUNTER],
627 [AC_MSG_CHECKING([if have struct percpu_counter defined])
628 LB_LINUX_TRY_COMPILE([
629 #include <linux/percpu_counter.h>
631 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
634 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
635 LB_LINUX_TRY_COMPILE([
636 #include <linux/percpu_counter.h>
638 struct percpu_counter c;
639 percpu_counter_init(&c, 0);
641 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
652 AC_DEFUN([LC_TASK_CLENV_STORE],
654 AC_MSG_CHECKING([if we can store cl_env in task_struct])
655 if test x$have_task_clenv_store != xyes ; then
656 LC_TASK_CLENV_TUX_INFO
662 AC_DEFUN([LC_S_TIME_GRAN],
663 [AC_MSG_CHECKING([if super block has s_time_gran member])
664 LB_LINUX_TRY_COMPILE([
665 #include <linux/fs.h>
667 struct super_block sb;
669 return sb.s_time_gran;
672 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
678 AC_DEFUN([LC_SB_TIME_GRAN],
679 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
680 LB_LINUX_TRY_COMPILE([
681 #include <linux/fs.h>
683 return get_sb_time_gran(NULL);
686 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
694 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
695 AC_DEFUN([LC_RW_TREE_LOCK],
696 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
697 tmp_flags="$EXTRA_KCFLAGS"
698 EXTRA_KCFLAGS="-Werror"
699 LB_LINUX_TRY_COMPILE([
700 #include <linux/fs.h>
702 struct address_space a;
704 write_lock(&a.tree_lock);
707 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
711 EXTRA_KCFLAGS="$tmp_flags"
717 # after 2.6.15 inode have i_mutex intead of i_sem
718 AC_DEFUN([LC_INODE_I_MUTEX],
719 [AC_MSG_CHECKING([if inode has i_mutex ])
720 LB_LINUX_TRY_COMPILE([
721 #include <linux/mutex.h>
722 #include <linux/fs.h>
727 mutex_unlock(&i.i_mutex);
730 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
731 [after 2.6.15 inode have i_mutex intead of i_sem])
739 # LC_SECURITY_PLUG # for SLES10 SP2
740 # check security plug in sles10 sp2 kernel
741 AC_DEFUN([LC_SECURITY_PLUG],
742 [AC_MSG_CHECKING([If kernel has security plug support])
743 LB_LINUX_TRY_COMPILE([
744 #include <linux/fs.h>
746 struct dentry *dentry;
747 struct vfsmount *mnt;
750 notify_change(dentry, mnt, iattr);
753 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
754 [SLES10 SP2 use extra parameter in vfs])
762 # inode have i_private field since 2.6.17
763 AC_DEFUN([LC_INODE_IPRIVATE],
764 [AC_MSG_CHECKING([if inode has a i_private field])
765 LB_LINUX_TRY_COMPILE([
766 #include <linux/fs.h>
772 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
773 [struct inode has i_private field])
780 # after 2.6.17 dquote use mutex instead if semaphore
781 AC_DEFUN([LC_DQUOTOFF_MUTEX],
782 [AC_MSG_CHECKING([use dqonoff_mutex])
783 LB_LINUX_TRY_COMPILE([
784 #include <linux/mutex.h>
785 #include <linux/fs.h>
786 #include <linux/quota.h>
788 struct quota_info dq;
790 mutex_unlock(&dq.dqonoff_mutex);
793 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
794 [after 2.6.17 dquote use mutex instead if semaphore])
803 # 2.6.18 don't export nr_pagecahe
804 AC_DEFUN([LC_NR_PAGECACHE],
805 [AC_MSG_CHECKING([kernel export nr_pagecache])
806 LB_LINUX_TRY_COMPILE([
807 #include <linux/pagemap.h>
809 return atomic_read(&nr_pagecache);
812 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
813 [is kernel export nr_pagecache])
820 # LC_STATFS_DENTRY_PARAM
821 # starting from 2.6.18 linux kernel uses dentry instead of super_block
822 # for the first parameter of the super_operations->statfs() callback.
825 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
826 [AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
827 tmp_flags="$EXTRA_KCFLAGS"
828 EXTRA_KCFLAGS="-Werror"
829 LB_LINUX_TRY_COMPILE([
830 #include <linux/fs.h>
832 ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
834 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
835 [super_ops.statfs() first parameter is dentry])
840 EXTRA_KCFLAGS="$tmp_flags"
843 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
844 # 2.6.18~2.6.25 umount_begin has different parameters
845 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
846 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
847 tmp_flags="$EXTRA_KCFLAGS"
848 EXTRA_KCFLAGS="-Werror"
849 LB_LINUX_TRY_COMPILE([
850 #include <linux/fs.h>
853 static void cfg_umount_begin (struct vfsmount *v, int flags)
858 static struct super_operations cfg_super_operations = {
859 .umount_begin = cfg_umount_begin,
862 cfg_super_operations.umount_begin(NULL,0);
865 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
866 [Define umount_begin need second argument])
870 EXTRA_KCFLAGS="$tmp_flags"
874 # starting from 2.6.18 the file_operations .flush
875 # method has a new "fl_owner_t id" parameter
877 AC_DEFUN([LC_FLUSH_OWNER_ID],
878 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
879 LB_LINUX_TRY_COMPILE([
880 #include <linux/fs.h>
882 struct file_operations *fops = NULL;
886 i = fops->flush(NULL, id);
888 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
889 [file_operations .flush method has an fl_owner_t id])
897 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
899 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
900 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
902 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
903 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
904 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
905 [exported invalidate_mapping_pages])],
906 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
907 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
908 [exported invalidate_inode_pages])], [
909 AC_MSG_ERROR([no way to invalidate pages])
914 #2.6.18 + RHEL5 (fc6)
916 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
917 AC_DEFUN([LC_PG_FS_MISC],
918 [AC_MSG_CHECKING([kernel has PG_fs_misc])
919 LB_LINUX_TRY_COMPILE([
920 #include <linux/mm.h>
921 #include <linux/page-flags.h>
924 #error PG_fs_misc not defined in kernel
928 AC_DEFINE(HAVE_PG_FS_MISC, 1,
929 [is kernel have PG_fs_misc])
935 # RHEL5 PageChecked and SetPageChecked defined
936 AC_DEFUN([LC_PAGE_CHECKED],
937 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
938 LB_LINUX_TRY_COMPILE([
939 #include <linux/mm.h>
940 #ifdef HAVE_LINUX_MMTYPES_H
941 #include <linux/mm_types.h>
943 #include <linux/page-flags.h>
945 struct page *p = NULL;
947 /* before 2.6.26 this define*/
949 /* 2.6.26 use function instead of define for it */
955 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
956 [does kernel have PageChecked and SetPageChecked])
965 # If we have fiemap.h
966 # after 2.6.27 use fiemap.h in include/linux
968 AC_DEFUN([LC_LINUX_FIEMAP_H],
969 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
970 AC_MSG_CHECKING([if fiemap.h can be compiled])
971 LB_LINUX_TRY_COMPILE([
972 #include <linux/types.h>
973 #include <linux/fiemap.h>
976 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
987 # inode don't have i_blksize field
988 AC_DEFUN([LC_INODE_BLKSIZE],
989 [AC_MSG_CHECKING([inode has i_blksize field])
990 LB_LINUX_TRY_COMPILE([
991 #include <linux/fs.h>
997 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
998 [struct inode has i_blksize field])
1005 # 2.6.19 replaced writev with aio_write
1006 AC_DEFUN([LC_FILE_WRITEV],
1007 [AC_MSG_CHECKING([writev in fops])
1008 LB_LINUX_TRY_COMPILE([
1009 #include <linux/fs.h>
1011 struct file_operations *fops = NULL;
1012 fops->writev = NULL;
1015 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1023 # 2.6.19 replaced readv with aio_read
1024 AC_DEFUN([LC_FILE_READV],
1025 [AC_MSG_CHECKING([readv in fops])
1026 LB_LINUX_TRY_COMPILE([
1027 #include <linux/fs.h>
1029 struct file_operations *fops = NULL;
1033 AC_DEFINE(HAVE_FILE_READV, 1,
1042 # LC_CANCEL_DIRTY_PAGE
1043 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
1044 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1045 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1046 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
1047 # backport is broken, so ignore it
1048 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
1049 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
1052 LB_LINUX_TRY_COMPILE([
1053 #include <linux/mm.h>
1054 #include <linux/page-flags.h>
1056 cancel_dirty_page(NULL, 0);
1059 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1060 [kernel has cancel_dirty_page instead of clear_page_dirty])
1067 # raid5-zerocopy patch
1072 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1073 # it support constant page, which means the page won't be modified during the
1076 AC_DEFUN([LC_PAGE_CONSTANT],
1077 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1078 LB_LINUX_TRY_COMPILE([
1079 #include <linux/mm.h>
1080 #include <linux/page-flags.h>
1083 #error "Have no raid5 zcopy patch"
1087 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1095 # 2.6.22 lost second parameter for invalidate_bdev
1096 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1097 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1098 LB_LINUX_TRY_COMPILE([
1099 #include <linux/buffer_head.h>
1101 invalidate_bdev(NULL,0);
1103 AC_MSG_RESULT([yes])
1104 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1105 [invalidate_bdev has second argument])
1112 # check for crypto API
1114 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1115 [AC_MSG_CHECKING([if kernel has block cipher support])
1116 LB_LINUX_TRY_COMPILE([
1117 #include <linux/err.h>
1118 #include <linux/crypto.h>
1120 struct crypto_blkcipher *tfm;
1121 tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
1123 AC_MSG_RESULT([yes])
1124 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1131 # check for struct hash_desc
1133 AC_DEFUN([LC_STRUCT_HASH_DESC],
1134 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1135 LB_LINUX_TRY_COMPILE([
1136 #include <linux/err.h>
1137 #include <linux/crypto.h>
1139 struct hash_desc foo;
1141 AC_MSG_RESULT([yes])
1142 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1149 # check for struct blkcipher_desc
1151 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1152 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1153 LB_LINUX_TRY_COMPILE([
1154 #include <linux/err.h>
1155 #include <linux/crypto.h>
1157 struct blkcipher_desc foo;
1159 AC_MSG_RESULT([yes])
1160 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1167 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1169 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1170 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1171 LB_LINUX_TRY_COMPILE([
1172 #include <linux/fs.h>
1174 int v = FS_RENAME_DOES_D_MOVE;
1176 AC_MSG_RESULT([yes])
1177 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1185 # 2.6.23 have return type 'void' for unregister_blkdev
1186 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1187 [AC_MSG_CHECKING([if unregister_blkdev return int])
1188 LB_LINUX_TRY_COMPILE([
1189 #include <linux/fs.h>
1191 int i = unregister_blkdev(0,NULL);
1193 AC_MSG_RESULT([yes])
1194 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1195 [unregister_blkdev return int])
1201 # 2.6.23 change .sendfile to .splice_read
1202 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1203 [AC_MSG_CHECKING([if kernel has .splice_read])
1204 LB_LINUX_TRY_COMPILE([
1205 #include <linux/fs.h>
1207 struct file_operations file;
1209 file.splice_read = NULL;
1211 AC_MSG_RESULT([yes])
1212 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1213 [kernel has .slice_read])
1219 # 2.6.23 change .sendfile to .splice_read
1220 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1221 AC_DEFUN([LC_KERNEL_SENDFILE],
1222 [AC_MSG_CHECKING([if kernel has .sendfile])
1223 LB_LINUX_TRY_COMPILE([
1224 #include <linux/fs.h>
1226 struct file_operations file;
1228 file.sendfile = NULL;
1230 AC_MSG_RESULT([yes])
1231 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1232 [kernel has .sendfile])
1238 # 2.6.23 extract nfs export related data into exportfs.h
1239 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1240 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1241 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1242 [kernel has include/exportfs.h])
1248 # 2.6.23 has new page fault handling API
1249 AC_DEFUN([LC_VM_OP_FAULT],
1250 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1251 LB_LINUX_TRY_COMPILE([
1252 #include <linux/mm.h>
1254 struct vm_operations_struct op;
1258 AC_MSG_RESULT([yes])
1259 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1260 [kernel has .fault in vm_operation_struct])
1266 # 2.6.23 add code to wait other users to complete before removing procfs entry
1267 AC_DEFUN([LC_PROCFS_USERS],
1268 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1269 LB_LINUX_TRY_COMPILE([
1270 #include <linux/proc_fs.h>
1272 struct proc_dir_entry pde;
1276 AC_MSG_RESULT([yes])
1277 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1278 [kernel has pde_users member in procfs entry struct])
1284 # 2.6.23 exports exportfs_decode_fh
1285 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1286 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1287 [fs/exportfs/expfs.c],[
1288 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1289 [exportfs_decode_fh has been export])
1296 # 2.6.24 need linux/mm_types.h included
1297 AC_DEFUN([LC_HAVE_MMTYPES_H],
1298 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1299 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1300 [kernel has include/mm_types.h])
1306 # 2.6.24 has bio_endio with 2 args
1307 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1308 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1309 LB_LINUX_TRY_COMPILE([
1310 #include <linux/bio.h>
1314 AC_MSG_RESULT([yes])
1315 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1316 [kernel has bio_endio with 2 args])
1322 # 2.6.24 has new members in exports struct.
1323 AC_DEFUN([LC_FH_TO_DENTRY],
1324 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1325 LB_LINUX_TRY_COMPILE([
1326 #include <linux/fs.h>
1327 #ifdef HAVE_LINUX_EXPORTFS_H
1328 #include <linux/exportfs.h>
1331 do{ }while(sizeof(((struct export_operations *)0)->fh_to_dentry));
1333 AC_MSG_RESULT([yes])
1334 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1335 [kernel has .fh_to_dentry member in export_operations struct])
1341 # 2.6.24 removes long aged procfs entry -> deleted member
1342 AC_DEFUN([LC_PROCFS_DELETED],
1343 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1344 LB_LINUX_TRY_COMPILE([
1345 #include <linux/proc_fs.h>
1347 struct proc_dir_entry pde;
1349 pde.deleted = sizeof(pde);
1351 AC_MSG_RESULT([yes])
1352 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1353 [kernel has deleted member in procfs entry struct])
1359 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1360 AC_DEFUN([LC_EXPORT_BDI_INIT],
1361 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1362 [mm/backing-dev.c],[
1363 AC_DEFINE(HAVE_BDI_INIT, 1,
1364 [bdi_init/bdi_destroy functions are present])
1371 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1372 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1373 [AC_MSG_CHECKING([fs_struct use path structure])
1374 LB_LINUX_TRY_COMPILE([
1375 #include <asm/atomic.h>
1376 #include <linux/spinlock.h>
1377 #include <linux/fs_struct.h>
1379 struct fs_struct fs;
1381 fs.pwd = *((struct path *)sizeof(fs));
1383 AC_MSG_RESULT([yes])
1384 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1385 [fs_struct use path structure])
1395 AC_DEFUN([LC_PGMKWRITE_USE_VMFAULT],
1396 [AC_MSG_CHECKING([kernel .page_mkwrite uses struct vm_fault *])
1397 tmp_flags="$EXTRA_KCFLAGS"
1398 EXTRA_KCFLAGS="-Werror"
1399 LB_LINUX_TRY_COMPILE([
1400 #include <linux/mm.h>
1402 ((struct vm_operations_struct *)0)->page_mkwrite((struct vm_area_struct *)0, (struct vm_fault *)0);
1404 AC_MSG_RESULT([yes])
1405 AC_DEFINE(HAVE_PGMKWRITE_USE_VMFAULT, 1,
1406 [kernel vm_operation_struct.page_mkwrite uses struct vm_fault * as second parameter])
1410 EXTRA_KCFLAGS="$tmp_flags"
1413 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1414 [AC_MSG_CHECKING([inode_operations->permission has two args])
1415 LB_LINUX_TRY_COMPILE([
1416 #include <linux/fs.h>
1418 struct inode *inode;
1419 inode->i_op->permission(NULL, 0);
1421 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1422 [inode_operations->permission has two args])
1423 AC_MSG_RESULT([yes])
1429 # 2.6.27 has file_remove_suid instead of remove_suid
1430 AC_DEFUN([LC_FILE_REMOVE_SUID],
1431 [AC_MSG_CHECKING([kernel has file_remove_suid])
1432 LB_LINUX_TRY_COMPILE([
1433 #include <linux/fs.h>
1435 file_remove_suid(NULL);
1437 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1438 [kernel have file_remove_suid])
1439 AC_MSG_RESULT([yes])
1445 # 2.6.27 have new page locking API
1446 AC_DEFUN([LC_TRYLOCKPAGE],
1447 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1448 LB_LINUX_TRY_COMPILE([
1449 #include <linux/pagemap.h>
1453 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1454 [kernel uses trylock_page for page lock])
1455 AC_MSG_RESULT([yes])
1461 # 2.6.27 removed the read_inode from super_operations.
1462 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1463 [AC_MSG_CHECKING([super_operations has a read_inode field])
1464 LB_LINUX_TRY_COMPILE([
1465 #include <linux/fs.h>
1467 struct super_operations *sop;
1468 sop->read_inode(NULL);
1470 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1471 [super_operations has a read_inode])
1472 AC_MSG_RESULT([yes])
1478 # 2.6.27 has inode_permission instead of permisson
1479 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1480 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1482 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1483 [inode_permission is exported by the kernel])
1488 # 2.6.27 use 5th parameter in quota_on for remount.
1489 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1490 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1491 LB_LINUX_TRY_COMPILE([
1492 #include <linux/quota.h>
1494 struct quotactl_ops *qop;
1495 qop->quota_on(NULL, 0, 0, NULL, 0);
1497 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1498 [quota_on needs 5 paramters])
1499 AC_MSG_RESULT([yes])
1505 # 2.6.27 use 3th parameter in quota_off for remount.
1506 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1507 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1508 LB_LINUX_TRY_COMPILE([
1509 #include <linux/quota.h>
1511 struct quotactl_ops *qop;
1512 qop->quota_off(NULL, 0, 0);
1514 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1515 [quota_off needs 3 paramters])
1516 AC_MSG_RESULT([yes])
1522 # 2.6.27 has vfs_dq_off inline function.
1523 AC_DEFUN([LC_VFS_DQ_OFF],
1524 [AC_MSG_CHECKING([vfs_dq_off is defined])
1525 LB_LINUX_TRY_COMPILE([
1526 #include <linux/quotaops.h>
1528 vfs_dq_off(NULL, 0);
1530 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1531 AC_MSG_RESULT([yes])
1537 # LC_LOCK_MAP_ACQUIRE
1538 # after 2.6.27 lock_map_acquire replaces lock_acquire
1539 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1540 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1541 LB_LINUX_TRY_COMPILE([
1542 #include <linux/lockdep.h>
1544 lock_map_acquire(NULL);
1547 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1548 [lock_map_acquire is defined])
1554 # 2.6.27.15-2 sles11
1556 # 2.6.27 sles11 remove the bi_hw_segments
1557 AC_DEFUN([LC_BI_HW_SEGMENTS],
1558 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1559 LB_LINUX_TRY_COMPILE([
1560 #include <linux/bio.h>
1563 io.bi_hw_segments = sizeof(io);
1565 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1566 [struct bio has a bi_hw_segments field])
1567 AC_MSG_RESULT([yes])
1574 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1575 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1576 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1577 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1578 AC_DEFINE(HAVE_QUOTAIO_H, 1,
1579 [kernel has include/linux/quotaio_v2.h])
1580 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1581 AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1582 [kernel has fs/quotaio_v1.h])
1583 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1584 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1585 [kernel has fs/quota/quotaio_v2.h])
1593 # 2.6.27 sles11 has sb_any_quota_active
1594 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1595 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1596 LB_LINUX_TRY_COMPILE([
1597 #include <linux/quotaops.h>
1599 sb_any_quota_active(NULL);
1601 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1602 [Kernel has a sb_any_quota_active])
1603 AC_MSG_RESULT([yes])
1609 # 2.6.27 sles11 has sb_has_quota_active
1610 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1611 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1612 LB_LINUX_TRY_COMPILE([
1613 #include <linux/quotaops.h>
1615 sb_has_quota_active(NULL, 0);
1617 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1618 [Kernel has a sb_has_quota_active])
1619 AC_MSG_RESULT([yes])
1625 # 2.6.27 exported add_to_page_cache_lru.
1626 AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
1627 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1629 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1630 [add_to_page_cache_lru functions are present])
1636 # 2.6.29 introduce sb_any_quota_loaded.
1638 AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
1639 [AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
1640 LB_LINUX_TRY_COMPILE([
1641 #include <linux/quotaops.h>
1643 sb_any_quota_loaded(NULL);
1645 AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
1646 [Kernel has a sb_any_quota_loaded])
1647 AC_MSG_RESULT([yes])
1653 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
1654 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
1655 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
1656 [arch/$LINUX_ARCH/mm/numa.c],
1657 [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
1658 [node_to_cpumask_map is exported by
1659 the kernel])]) # x86_64
1662 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1663 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1664 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1665 LB_LINUX_TRY_COMPILE([
1666 #include <linux/blkdev.h>
1668 blk_queue_logical_block_size(NULL, 0);
1671 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1672 [blk_queue_logical_block_size is defined])
1680 # 2.6.32 changes cache_detail's member cache_request to cache_upcall
1681 # in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
1682 AC_DEFUN([LC_CACHE_UPCALL],
1683 [AC_MSG_CHECKING([if cache_detail has cache_upcall field])
1684 LB_LINUX_TRY_COMPILE([
1685 #include <linux/sunrpc/cache.h>
1687 struct cache_detail cd;
1688 cd.cache_upcall = NULL;
1691 AC_DEFINE(HAVE_CACHE_UPCALL, 1,
1692 [cache_detail has cache_upcall field])
1698 # 2.6.32 add a limits member in struct request_queue.
1699 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1700 [AC_MSG_CHECKING([if request_queue has a limits field])
1701 LB_LINUX_TRY_COMPILE([
1702 #include <linux/blkdev.h>
1704 struct request_queue rq;
1705 rq.limits.io_min = 0;
1708 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1709 [request_queue has a limits field])
1715 # 2.6.32 has bdi_register() functions.
1716 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1717 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1718 [mm/backing-dev.c],[
1719 AC_DEFINE(HAVE_BDI_REGISTER, 1,
1720 [bdi_register function is present])
1725 # 2.6.32 add s_bdi for super block
1726 AC_DEFUN([LC_SB_BDI],
1727 [AC_MSG_CHECKING([if super_block has s_bdi field])
1728 LB_LINUX_TRY_COMPILE([
1729 #include <linux/fs.h>
1731 struct super_block sb;
1735 AC_DEFINE(HAVE_SB_BDI, 1,
1736 [super_block has s_bdi field])
1742 # 2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
1743 AC_DEFUN([LC_BDI_NAME],
1744 [AC_MSG_CHECKING([if backing_device_info has name field])
1745 LB_LINUX_TRY_COMPILE([
1746 #include <linux/blkkdev.h>
1748 struct backing_dev_info bdi;
1752 AC_DEFINE(HAVE_BDI_NAME, 1,
1753 [backing_device_info has name field])
1759 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1760 # check blk_queue_max_sectors and use it until disappear.
1761 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1762 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1763 LB_LINUX_TRY_COMPILE([
1764 #include <linux/blkdev.h>
1766 blk_queue_max_sectors(NULL, 0);
1769 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1770 [blk_queue_max_sectors is defined])
1776 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
1777 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1778 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1779 LB_LINUX_TRY_COMPILE([
1780 #include <linux/blkdev.h>
1782 blk_queue_max_segments(NULL, 0);
1785 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1786 [blk_queue_max_segments is defined])
1795 # Check if kernel has been patched for 64-bit quota limits support.
1796 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
1797 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
1798 # that in the absence of quotaio_v1.h in the kernel headers.
1800 AC_DEFUN([LC_QUOTA64],[
1801 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1802 tmp_flags="$EXTRA_KCFLAGS"
1803 EXTRA_KCFLAGS="-I$LINUX/fs"
1804 LB_LINUX_TRY_COMPILE([
1805 #include <linux/kernel.h>
1806 #include <linux/fs.h>
1807 #ifdef HAVE_QUOTAIO_H
1808 # include <linux/quotaio_v2.h>
1809 int versions[] = V2_INITQVERSIONS_R1;
1810 struct v2_disk_dqblk_r1 dqblk_r1;
1811 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
1812 # include <quota/quotaio_v2.h>
1813 struct v2r1_disk_dqblk dqblk_r1;
1814 #elif defined(HAVE_FS_QUOTAIO_H)
1815 # include <quotaio_v2.h>
1816 struct v2r1_disk_dqblk dqblk_r1;
1818 #include <linux/quota.h>
1819 int ver = QFMT_VFS_V1;
1822 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1823 AC_MSG_RESULT([yes])
1825 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1826 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1830 EXTRA_KCFLAGS=$tmp_flags
1833 # 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
1834 AC_DEFUN([LC_SET_CPUS_ALLOWED],
1835 [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
1836 LB_LINUX_TRY_COMPILE(
1837 [#include <linux/sched.h>],
1838 [struct task_struct *p = NULL;
1839 cpumask_t mask = { { 0 } };
1840 (void) set_cpus_allowed(p, mask);],
1841 [AC_MSG_RESULT([yes])
1842 AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
1843 [set_cpus_allowed is exported by the kernel])],
1844 [AC_MSG_RESULT([no])] )])
1848 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1849 # d_obtain_alias() for getting anonymous dentries
1850 # RHEL5(2.6.18) has d_obtain_alias but SLES11SP0(2.6.27) not
1852 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1853 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1854 LB_LINUX_TRY_COMPILE([
1855 #include <linux/dcache.h>
1857 d_obtain_alias(NULL);
1859 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1860 [d_obtain_alias exist in kernel])
1861 AC_MSG_RESULT([yes])
1868 # LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
1870 AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
1871 [LB_CHECK_SYMBOL_EXPORT(
1872 [generic_error_remove_page],
1874 [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
1875 [kernel export generic_error_remove_page])],
1881 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
1883 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
1884 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
1885 LB_LINUX_TRY_COMPILE([
1886 #include <asm/atomic.h>
1887 #include <linux/spinlock.h>
1888 #include <linux/fs_struct.h>
1890 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
1892 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
1893 [fs_struct.lock use rwlock])
1894 AC_MSG_RESULT([yes])
1901 # 2.6.36 super_operations add evict_inode method. it hybird of
1902 # delete_inode & clear_inode.
1904 AC_DEFUN([LC_SBOPS_EVICT_INODE],
1905 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
1906 LB_LINUX_TRY_COMPILE([
1907 #include <linux/fs.h>
1909 ((struct super_operations *)0)->evict_inode(NULL);
1911 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
1912 [super_operations.evict_inode() is exist in kernel])
1913 AC_MSG_RESULT([yes])
1920 # 2.6.35 file_operations.fsync taken 2 arguments.
1921 # 3.0.0 file_operations.fsync takes 4 arguments.
1923 AC_DEFUN([LC_FILE_FSYNC],
1924 [AC_MSG_CHECKING([if file_operations.fsync takes 4 or 2 arguments])
1925 LB_LINUX_TRY_COMPILE([
1926 #include <linux/fs.h>
1928 ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
1930 AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
1931 [file_operations.fsync takes 4 arguments])
1932 AC_MSG_RESULT([yes, 4 args])
1934 LB_LINUX_TRY_COMPILE([
1935 #include <linux/fs.h>
1937 ((struct file_operations *)0)->fsync(NULL, 0);
1939 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
1940 [file_operations.fsync takes 2 arguments])
1941 AC_MSG_RESULT([yes, 2 args])
1949 # 2.6.38 export blkdev_get_by_dev
1951 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
1952 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
1954 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
1955 [blkdev_get_by_dev is exported by the kernel])
1961 # 2.6.38 vfsmount.mnt_count doesn't use atomic_t
1963 AC_DEFUN([LC_ATOMIC_MNT_COUNT],
1964 [AC_MSG_CHECKING([if vfsmount.mnt_count is atomic_t])
1965 LB_LINUX_TRY_COMPILE([
1966 #include <asm/atomic.h>
1967 #include <linux/fs.h>
1968 #include <linux/mount.h>
1970 ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
1972 AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
1973 [vfsmount.mnt_count is atomic_t])
1974 AC_MSG_RESULT([yes])
1981 # 2.6.38 use path as 4th parameter in quota_on.
1983 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
1984 [AC_MSG_CHECKING([quota_on use path as parameter])
1985 tmp_flags="$EXTRA_KCFLAGS"
1986 EXTRA_KCFLAGS="-Werror"
1987 LB_LINUX_TRY_COMPILE([
1988 #include <linux/fs.h>
1989 #include <linux/quota.h>
1991 ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
1993 AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
1994 [quota_on use path as 4th paramter])
1995 AC_MSG_RESULT([yes])
1999 EXTRA_KCFLAGS="$tmp_flags"
2003 # 2.6.39 remove unplug_fn from request_queue.
2005 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
2006 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
2007 LB_LINUX_TRY_COMPILE([
2008 #include <linux/blkdev.h>
2010 do{ }while(sizeof(((struct request_queue *)0)->unplug_fn));
2012 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
2013 [request_queue has unplug_fn field])
2014 AC_MSG_RESULT([yes])
2021 # 2.6.38 generic_permission taken 4 paremater.
2022 # in fact, it means rcu-walk aware permission bring.
2024 AC_DEFUN([LC_GENERIC_PERMISSION],
2025 [AC_MSG_CHECKING([if generic_permission take 4 arguments])
2026 LB_LINUX_TRY_COMPILE([
2027 #include <linux/fs.h>
2029 generic_permission(NULL, 0, 0, NULL);
2031 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
2032 [generic_permission taken 4 arguments])
2033 AC_MSG_RESULT([yes])
2040 # 2.6.38 export simple_setattr
2042 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
2043 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
2045 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
2046 [simple_setattr is exported by the kernel])
2054 # Lustre linux kernel checks
2056 AC_DEFUN([LC_PROG_LINUX],
2057 [LC_LUSTRE_VERSION_H
2060 LC_CONFIG_LIBLUSTRE_RECOVERY
2061 LC_CONFIG_HEALTH_CHECK_WRITE
2062 LC_CONFIG_LRU_RESIZE
2064 LC_LLITE_LLOOP_MODULE
2067 LC_EXPORT_TRUNCATE_COMPLETE
2068 LC_EXPORT_D_REHASH_COND
2069 LC_EXPORT___D_REHASH
2070 LC_EXPORT_NODE_TO_CPUMASK
2077 LC_STRUCT_INTENT_FILE
2082 LC_FUNC_HAVE_CAN_SLEEP_ARG
2085 LC_COOKIE_FOLLOW_LINK
2101 LC_SECURITY_PLUG # for SLES10 SP2
2109 LC_STATFS_DENTRY_PARAM
2110 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2112 if test x$enable_server = xyes ; then
2113 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2116 #2.6.18 + RHEL5 (fc6)
2127 LC_CANCEL_DIRTY_PAGE
2129 # raid5-zerocopy patch
2133 LC_INVALIDATE_BDEV_2ARG
2134 LC_ASYNC_BLOCK_CIPHER
2136 LC_STRUCT_BLKCIPHER_DESC
2137 LC_FS_RENAME_DOES_D_MOVE
2140 LC_UNREGISTER_BLKDEV_RETURN_INT
2141 LC_KERNEL_SPLICE_READ
2146 LC_EXPORTFS_DECODE_FH
2156 LC_FS_STRUCT_USE_PATH
2159 LC_PGMKWRITE_USE_VMFAULT
2160 LC_INODE_PERMISION_2ARGS
2163 LC_READ_INODE_IN_SBOPS
2164 LC_EXPORT_INODE_PERMISSION
2170 # 2.6.27.15-2 sles11
2174 LC_SB_ANY_QUOTA_ACTIVE
2175 LC_SB_HAS_QUOTA_ACTIVE
2176 LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
2179 LC_SB_ANY_QUOTA_LOADED
2182 LC_EXPORT_CPUMASK_OF_NODE
2185 LC_BLK_QUEUE_LOG_BLK_SIZE
2188 LC_REQUEST_QUEUE_LIMITS
2189 LC_EXPORT_BDI_REGISTER
2191 LC_BLK_QUEUE_MAX_SECTORS
2192 LC_BLK_QUEUE_MAX_SEGMENTS
2195 LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
2199 LC_EXPORT_SIMPLE_SETATTR
2203 LC_SBOPS_EVICT_INODE
2207 LC_BLKDEV_GET_BY_DEV
2208 LC_GENERIC_PERMISSION
2209 LC_QUOTA_ON_USE_PATH
2212 LC_REQUEST_QUEUE_UNPLUG_FN
2215 if test x$enable_server = xyes ; then
2216 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2217 LC_FUNC_DEV_SET_RDONLY
2224 # LC_CONFIG_CLIENT_SERVER
2226 # Build client/server sides of Lustre
2228 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2229 [AC_MSG_CHECKING([whether to build Lustre server support])
2230 AC_ARG_ENABLE([server],
2231 AC_HELP_STRING([--disable-server],
2232 [disable Lustre server support]),
2233 [],[enable_server='yes'])
2234 AC_MSG_RESULT([$enable_server])
2236 AC_MSG_CHECKING([whether to build Lustre client support])
2237 AC_ARG_ENABLE([client],
2238 AC_HELP_STRING([--disable-client],
2239 [disable Lustre client support]),
2240 [],[enable_client='yes'])
2241 AC_MSG_RESULT([$enable_client])])
2244 # LC_CONFIG_LIBLUSTRE
2246 # whether to build liblustre
2248 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2249 [AC_MSG_CHECKING([whether to build Lustre library])
2250 AC_ARG_ENABLE([liblustre],
2251 AC_HELP_STRING([--disable-liblustre],
2252 [disable building of Lustre library]),
2253 [],[enable_liblustre=$with_sysio])
2254 AC_MSG_RESULT([$enable_liblustre])
2255 # only build sysio if liblustre is built
2256 with_sysio="$enable_liblustre"
2258 AC_MSG_CHECKING([whether to build liblustre tests])
2259 AC_ARG_ENABLE([liblustre-tests],
2260 AC_HELP_STRING([--enable-liblustre-tests],
2261 [enable liblustre tests, if --disable-tests is used]),
2262 [],[enable_liblustre_tests=$enable_tests])
2263 if test x$enable_liblustre != xyes ; then
2264 enable_liblustre_tests='no'
2266 AC_MSG_RESULT([$enable_liblustre_tests])
2268 AC_MSG_CHECKING([whether to enable liblustre acl])
2269 AC_ARG_ENABLE([liblustre-acl],
2270 AC_HELP_STRING([--disable-liblustre-acl],
2271 [disable ACL support for liblustre]),
2272 [],[enable_liblustre_acl=yes])
2273 AC_MSG_RESULT([$enable_liblustre_acl])
2274 if test x$enable_liblustre_acl = xyes ; then
2275 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2278 # 2.6.29 change prepare/commit_write to write_begin/end
2279 AC_DEFUN([LC_WRITE_BEGIN_END],
2280 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2281 LB_LINUX_TRY_COMPILE([
2282 #include <linux/fs.h>
2283 #include <linux/pagemap.h>
2284 #ifdef HAVE_LINUX_MMTYPES_H
2285 #include <linux/mm_types.h>
2288 struct address_space_operations aops;
2291 aops.write_begin = NULL;
2292 aops.write_end = NULL;
2293 page = grab_cache_page_write_begin(NULL, 0, 0);
2295 AC_MSG_RESULT([yes])
2296 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2297 [kernel has .write_begin/end])
2303 # 2.6.29 blkdev_put has 2 arguments
2304 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2305 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2306 LB_LINUX_TRY_COMPILE([
2307 #include <linux/fs.h>
2309 blkdev_put(NULL, 0);
2311 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2312 [blkdev_put needs 2 paramters])
2313 AC_MSG_RESULT([yes])
2319 # 2.6.29 dentry_open has 4 arguments
2320 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2321 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2322 LB_LINUX_TRY_COMPILE([
2323 #include <linux/fs.h>
2325 dentry_open(NULL, NULL, 0, NULL);
2327 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2328 [dentry_open needs 4 paramters])
2329 AC_MSG_RESULT([yes])
2335 # 2.6.29 split file and anonymous page queues
2336 AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
2337 [AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
2338 LB_LINUX_TRY_COMPILE([
2339 #include <linux/mm.h>
2340 #include <linux/pagevec.h>
2342 struct pagevec lru_pagevec;
2344 pagevec_init(&lru_pagevec, 0);
2345 pagevec_lru_add_file(&lru_pagevec);
2347 AC_MSG_RESULT([yes])
2348 AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
2349 [kernel has .pagevec_lru_add_file])
2358 AC_ARG_ENABLE(mpitests,
2359 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2360 [include mpi tests]),
2371 MPICC_WRAPPER=$enableval
2381 if test x$enable_mpitests != xno; then
2382 AC_MSG_CHECKING([whether mpitests can be built])
2390 MPI_Initialized(&flag);
2393 AC_MSG_RESULT([yes])
2400 AC_SUBST(MPICC_WRAPPER)
2402 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2403 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2406 LC_CONFIG_LIBLUSTRE_RECOVERY
2412 # whether to enable quota support global control
2414 AC_DEFUN([LC_CONFIG_QUOTA],
2415 [AC_ARG_ENABLE([quota],
2416 AC_HELP_STRING([--enable-quota],
2417 [enable quota support]),
2418 [],[enable_quota='yes'])
2421 AC_DEFUN([LC_QUOTA],
2425 AC_CHECK_HEADER(sys/quota.h,
2426 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2427 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2433 # whether to enable split support
2435 AC_DEFUN([LC_CONFIG_SPLIT],
2436 [AC_MSG_CHECKING([whether to enable split support])
2437 AC_ARG_ENABLE([split],
2438 AC_HELP_STRING([--enable-split],
2439 [enable split support]),
2440 [],[enable_split='no'])
2441 AC_MSG_RESULT([$enable_split])
2442 if test x$enable_split != xno; then
2443 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2447 # RHEL5(2.6.18) has tux_info
2448 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2449 [AC_MSG_CHECKING([tux_info])
2450 LB_LINUX_TRY_COMPILE([
2451 #include <linux/sched.h>
2453 struct task_struct task;
2456 AC_MSG_RESULT([yes])
2457 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2458 have_task_clenv_store='yes'
2465 # LC_LLITE_LLOOP_MODULE
2466 # lloop_llite.ko does not currently work with page sizes
2469 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2470 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2471 LB_LINUX_TRY_COMPILE([
2472 #include <asm/page.h>
2474 #if PAGE_SIZE >= 65536
2475 #error "PAGE_SIZE >= 65536"
2478 enable_llite_lloop_module='yes'
2479 AC_MSG_RESULT([yes])
2481 enable_llite_lloop_module='no'
2489 # other configure checks
2491 AC_DEFUN([LC_CONFIGURE],
2492 [LC_CONFIG_OBD_BUFFER_SIZE
2494 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2495 CFLAGS="$CFLAGS -Werror"
2498 # maximum MDS thread count
2501 # include/liblustre.h
2502 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2504 # liblustre/llite_lib.h
2505 AC_CHECK_HEADERS([xtio.h file.h])
2508 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2511 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2512 AC_CHECK_FUNCS([inet_ntoa])
2514 # libsysio/src/readlink.c
2517 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2518 AC_CHECK_HEADERS([linux/random.h], [], [],
2519 [#ifdef HAVE_LINUX_TYPES_H
2520 # include <linux/types.h>
2525 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2527 # check for -lz support
2531 [AC_CHECK_HEADERS([zlib.h],
2533 AC_DEFINE([HAVE_ADLER], 1,
2534 [support alder32 checksum type])],
2535 [AC_MSG_WARN([No zlib-devel package found,
2536 unable to use adler32 checksum])])],
2537 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2542 AC_ARG_ENABLE([mindf],
2543 AC_HELP_STRING([--enable-mindf],
2544 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2546 if test "$enable_mindf" = "yes" ; then
2547 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2550 AC_ARG_ENABLE([fail_alloc],
2551 AC_HELP_STRING([--disable-fail-alloc],
2552 [disable randomly alloc failure]),
2553 [],[enable_fail_alloc=yes])
2554 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2555 AC_MSG_RESULT([$enable_fail_alloc])
2556 if test x$enable_fail_alloc != xno ; then
2557 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2560 AC_ARG_ENABLE([invariants],
2561 AC_HELP_STRING([--enable-invariants],
2562 [enable invariant checking (cpu intensive)]),
2564 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2565 AC_MSG_RESULT([$enable_invariants])
2566 if test x$enable_invariants = xyes ; then
2567 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2570 AC_ARG_ENABLE([lu_ref],
2571 AC_HELP_STRING([--enable-lu_ref],
2572 [enable lu_ref reference tracking code]),
2574 AC_MSG_CHECKING([whether to track references with lu_ref])
2575 AC_MSG_RESULT([$enable_lu_ref])
2576 if test x$enable_lu_ref = xyes ; then
2577 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2580 AC_ARG_ENABLE([pgstate-track],
2581 AC_HELP_STRING([--enable-pgstate-track],
2582 [enable page state tracking]),
2583 [enable_pgstat_track='yes'],[])
2584 AC_MSG_CHECKING([whether to enable page state tracking])
2585 AC_MSG_RESULT([$enable_pgstat_track])
2586 if test x$enable_pgstat_track = xyes ; then
2587 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2588 [enable page state tracking code])
2595 LC_DENTRY_OPEN_4ARGS
2596 LC_PAGEVEC_LRU_ADD_FILE
2603 # AM_CONDITIONALS for lustre
2605 AC_DEFUN([LC_CONDITIONALS],
2606 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2607 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2608 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2609 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2610 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2611 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2612 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2613 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2614 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2615 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2616 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2617 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2618 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2619 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2620 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2626 # files that should be generated with AC_OUTPUT
2628 AC_DEFUN([LC_CONFIG_FILES],
2632 lustre/autoconf/Makefile
2633 lustre/conf/Makefile
2634 lustre/contrib/Makefile
2636 lustre/include/Makefile
2637 lustre/include/lustre_ver.h
2638 lustre/include/linux/Makefile
2639 lustre/include/darwin/Makefile
2640 lustre/include/lustre/Makefile
2641 lustre/kernel_patches/targets/2.6-rhel6.target
2642 lustre/kernel_patches/targets/2.6-rhel5.target
2643 lustre/kernel_patches/targets/2.6-sles10.target
2644 lustre/kernel_patches/targets/2.6-sles11.target
2645 lustre/kernel_patches/targets/2.6-oel5.target
2646 lustre/kernel_patches/targets/2.6-fc11.target
2647 lustre/kernel_patches/targets/2.6-fc12.target
2648 lustre/ldlm/Makefile
2650 lustre/fid/autoMakefile
2651 lustre/liblustre/Makefile
2652 lustre/liblustre/tests/Makefile
2653 lustre/liblustre/tests/mpi/Makefile
2654 lustre/llite/Makefile
2655 lustre/llite/autoMakefile
2656 lustre/lclient/Makefile
2658 lustre/lov/autoMakefile
2659 lustre/lvfs/Makefile
2660 lustre/lvfs/autoMakefile
2662 lustre/mdc/autoMakefile
2664 lustre/lmv/autoMakefile
2666 lustre/mds/autoMakefile
2668 lustre/mdt/autoMakefile
2670 lustre/cmm/autoMakefile
2672 lustre/mdd/autoMakefile
2674 lustre/fld/autoMakefile
2675 lustre/obdclass/Makefile
2676 lustre/obdclass/autoMakefile
2677 lustre/obdclass/linux/Makefile
2678 lustre/obdecho/Makefile
2679 lustre/obdecho/autoMakefile
2680 lustre/obdfilter/Makefile
2681 lustre/obdfilter/autoMakefile
2683 lustre/osc/autoMakefile
2685 lustre/ost/autoMakefile
2686 lustre/osd-ldiskfs/Makefile
2687 lustre/osd-ldiskfs/autoMakefile
2689 lustre/mgc/autoMakefile
2691 lustre/mgs/autoMakefile
2692 lustre/ptlrpc/Makefile
2693 lustre/ptlrpc/autoMakefile
2694 lustre/ptlrpc/gss/Makefile
2695 lustre/ptlrpc/gss/autoMakefile
2696 lustre/quota/Makefile
2697 lustre/quota/autoMakefile
2698 lustre/scripts/Makefile
2699 lustre/tests/Makefile
2700 lustre/tests/mpi/Makefile
2701 lustre/utils/Makefile
2702 lustre/utils/gss/Makefile
2703 lustre/obdclass/darwin/Makefile