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 for the old-style dev_set_rdonly which took an extra "devno" param
108 # and can only set a single device to discard writes at one time
110 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
111 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
112 LB_LINUX_TRY_COMPILE([
113 #include <linux/fs.h>
114 #include <linux/blkdev.h>
116 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
117 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
121 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
123 AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
124 kernel patches from Lustre version 1.4.3 or above.])
129 # Ensure stack size big than 8k in Lustre server (all kernels)
131 AC_DEFUN([LC_STACK_SIZE],
132 [AC_MSG_CHECKING([stack size big than 8k])
133 LB_LINUX_TRY_COMPILE([
134 #include <linux/thread_info.h>
136 #if THREAD_SIZE < 8192
137 #error "stack size < 8192"
142 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
147 # Allow the user to set the MDS thread upper limit
149 AC_DEFUN([LC_MDS_MAX_THREADS],
151 AC_ARG_WITH([mds_max_threads],
152 AC_HELP_STRING([--with-mds-max-threads=size],
153 [define the maximum number of threads available on the MDS: (default=512)]),
155 MDS_THREAD_COUNT=$with_mds_max_threads
156 AC_DEFINE_UNQUOTED(MDT_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of mdt threads])
163 # the pinger is temporary, until we have the recovery node in place
165 AC_DEFUN([LC_CONFIG_PINGER],
166 [AC_MSG_CHECKING([whether to enable pinger support])
167 AC_ARG_ENABLE([pinger],
168 AC_HELP_STRING([--disable-pinger],
169 [disable recovery pinger support]),
170 [],[enable_pinger='yes'])
171 AC_MSG_RESULT([$enable_pinger])
172 if test x$enable_pinger != xno ; then
173 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
180 # do checksum of bulk data between client and OST
182 AC_DEFUN([LC_CONFIG_CHECKSUM],
183 [AC_MSG_CHECKING([whether to enable data checksum support])
184 AC_ARG_ENABLE([checksum],
185 AC_HELP_STRING([--disable-checksum],
186 [disable data checksum support]),
187 [],[enable_checksum='yes'])
188 AC_MSG_RESULT([$enable_checksum])
189 if test x$enable_checksum != xno ; then
190 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
195 # LC_CONFIG_LIBLUSTRE_RECOVERY
197 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
198 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
199 AC_ARG_ENABLE([liblustre-recovery],
200 AC_HELP_STRING([--disable-liblustre-recovery],
201 [disable liblustre recovery support]),
202 [],[enable_liblustre_recovery='yes'])
203 AC_MSG_RESULT([$enable_liblustre_recovery])
204 if test x$enable_liblustre_recovery != xno ; then
205 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
210 # LC_CONFIG_HEALTH_CHECK_WRITE
212 # Turn off the actual write to the disk
214 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
215 [AC_MSG_CHECKING([whether to enable a write with the health check])
216 AC_ARG_ENABLE([health_write],
217 AC_HELP_STRING([--enable-health_write],
218 [enable disk writes when doing health check]),
219 [],[enable_health_write='no'])
220 AC_MSG_RESULT([$enable_health_write])
221 if test x$enable_health_write != xno ; then
222 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
226 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
227 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
228 AC_ARG_ENABLE([lru_resize],
229 AC_HELP_STRING([--enable-lru-resize],
230 [enable lru resize support]),
231 [],[enable_lru_resize='yes'])
232 AC_MSG_RESULT([$enable_lru_resize])
233 if test x$enable_lru_resize != xno; then
234 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
238 # whether to enable quota support(kernel modules)
239 AC_DEFUN([LC_QUOTA_MODULE],
240 [if test x$enable_quota != xno; then
241 LB_LINUX_CONFIG([QUOTA],[
242 enable_quota_module='yes'
243 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
245 enable_quota_module='no'
246 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
251 # truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
252 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
253 # delete_from_page_cache() is exported from 2.6.39
254 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
255 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
257 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
258 [kernel export truncate_complete_page])])
259 LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
261 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
262 [kernel export remove_from_page_cache])])
263 LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
265 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
266 [kernel export delete_from_page_cache])])
269 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
270 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
272 AC_DEFINE(HAVE_D_REHASH_COND, 1,
273 [d_rehash_cond is exported by the kernel])
278 AC_DEFUN([LC_EXPORT___D_REHASH],
279 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
281 AC_DEFINE(HAVE___D_REHASH, 1,
282 [__d_rehash is exported by the kernel])
287 # The actual symbol exported varies among architectures, so we need
288 # to check many symbols (but only in the current architecture.) No
289 # matter what symbol is exported, the kernel #defines node_to_cpumask
290 # to the appropriate function and that's what we use.
291 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
292 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
293 [arch/$LINUX_ARCH/mm/numa.c],
294 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
295 [node_to_cpumask is exported by
296 the kernel])]) # x86_64
297 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
298 [arch/$LINUX_ARCH/kernel/smpboot.c],
299 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
300 [node_to_cpumask is exported by
301 the kernel])]) # ia64
302 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
303 [arch/$LINUX_ARCH/kernel/smpboot.c],
304 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
305 [node_to_cpumask is exported by
306 the kernel])]) # i386
311 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
313 AC_DEFUN([LC_FILEMAP_POPULATE],
314 [AC_MSG_CHECKING([for exported filemap_populate])
315 LB_LINUX_TRY_COMPILE([
316 #include <asm/page.h>
317 #include <linux/mm.h>
319 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
322 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
331 AC_DEFUN([LC_BIT_SPINLOCK_H],
332 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
333 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
334 LB_LINUX_TRY_COMPILE([
335 #include <asm/processor.h>
336 #include <linux/spinlock.h>
337 #include <linux/bit_spinlock.h>
340 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
351 AC_DEFUN([LC_CONST_ACL_SIZE],
352 [AC_MSG_CHECKING([calc acl size])
354 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"
357 #include <linux/types.h>
360 #define __LINUX_POSIX_ACL_H
362 #ifdef CONFIG_FS_POSIX_ACL
363 # include <linux/posix_acl_xattr.h>
370 /* LUSTRE_POSIX_ACL_MAX_ENTRIES = 32 */
371 int size = posix_acl_xattr_size(32);
372 FILE *f = fopen("acl.size","w+");
373 fprintf(f,"%d", size);
379 acl_size=`cat acl.size`
380 AC_MSG_RESULT([ACL size $acl_size])
381 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
383 AC_ERROR([ACL size can't be computed])
385 AC_MSG_RESULT([can't check ACL size, make it 260])
386 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
393 AC_DEFUN([LC_STRUCT_INTENT_FILE],
394 [AC_MSG_CHECKING([if struct open_intent has a file field])
395 LB_LINUX_TRY_COMPILE([
396 #include <linux/fs.h>
397 #include <linux/namei.h>
399 struct open_intent intent;
403 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
412 AC_DEFUN([LC_CAPA_CRYPTO],
413 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
414 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
416 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
417 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
419 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
420 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
425 # LC_CONFIG_RMTCLIENT
428 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
430 AC_DEFUN([LC_CONFIG_RMTCLIENT],
431 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
432 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
437 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
439 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
440 [AC_MSG_CHECKING([whether to enable gss keyring backend])
441 AC_ARG_ENABLE([gss_keyring],
442 [AC_HELP_STRING([--disable-gss-keyring],
443 [disable gss keyring backend])],
444 [],[enable_gss_keyring='yes'])
445 AC_MSG_RESULT([$enable_gss_keyring])
447 if test x$enable_gss_keyring != xno; then
448 LB_LINUX_CONFIG_IM([KEYS],[],
449 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
451 AC_CHECK_LIB([keyutils], [keyctl_search], [],
452 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
454 AC_DEFINE([HAVE_GSS_KEYRING], [1],
455 [Define this if you enable gss keyring backend])
459 AC_DEFUN([LC_SUNRPC_CACHE],
460 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
461 LB_LINUX_TRY_COMPILE([
462 #include <linux/sunrpc/cache.h>
464 struct cache_head ch;
468 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
474 AC_DEFUN([LC_CONFIG_SUNRPC],
475 [LB_LINUX_CONFIG_IM([SUNRPC],[],
476 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
481 # LC_CONFIG_GSS (default disabled)
483 # Build gss and related tools of Lustre. Currently both kernel and user space
484 # parts are depend on linux platform.
486 AC_DEFUN([LC_CONFIG_GSS],
487 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
489 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
490 [],[enable_gss='no'])
491 AC_MSG_RESULT([$enable_gss])
493 if test x$enable_gss == xyes; then
494 LC_CONFIG_GSS_KEYRING
497 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
499 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
500 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
501 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
502 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
503 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
504 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
505 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
506 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
508 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
509 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
510 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
511 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
512 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
514 AC_SUBST(GSSAPI_LIBS)
521 # LC_FUNC_HAVE_CAN_SLEEP_ARG
523 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
525 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
526 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
527 LB_LINUX_TRY_COMPILE([
528 #include <linux/fs.h>
532 struct file_lock *file_lock;
533 flock_lock_file_wait(file, file_lock, cansleep);
535 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
536 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
546 # rhel4.2 kernel has f_op->flock field
548 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
549 [AC_MSG_CHECKING([if struct file_operations has flock field])
550 LB_LINUX_TRY_COMPILE([
551 #include <linux/fs.h>
553 struct file_operations ll_file_operations_flock;
554 ll_file_operations_flock.flock = NULL;
556 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
557 [struct file_operations has flock field])
564 AC_DEFUN([LC_QUOTA_READ],
565 [AC_MSG_CHECKING([if kernel supports quota_read])
566 LB_LINUX_TRY_COMPILE([
567 #include <linux/fs.h>
569 struct super_operations sp;
570 void *i = (void *)sp.quota_read;
573 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
580 # LC_COOKIE_FOLLOW_LINK
582 # kernel 2.6.13+ ->follow_link returns a cookie
585 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
586 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
587 LB_LINUX_TRY_COMPILE([
588 #include <linux/fs.h>
589 #include <linux/namei.h>
591 struct dentry dentry;
594 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
596 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
606 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
607 # call_rcu takes three parameters.
609 AC_DEFUN([LC_FUNC_RCU],
610 [AC_MSG_CHECKING([if kernel have RCU supported])
611 LB_LINUX_TRY_COMPILE([
612 #include <linux/rcupdate.h>
614 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
617 AC_MSG_CHECKING([if call_rcu takes three parameters])
618 LB_LINUX_TRY_COMPILE([
619 #include <linux/rcupdate.h>
622 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
624 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
635 AC_DEFUN([LC_PERCPU_COUNTER],
636 [AC_MSG_CHECKING([if have struct percpu_counter defined])
637 LB_LINUX_TRY_COMPILE([
638 #include <linux/percpu_counter.h>
640 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
643 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
644 LB_LINUX_TRY_COMPILE([
645 #include <linux/percpu_counter.h>
647 struct percpu_counter c;
648 percpu_counter_init(&c, 0);
650 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
661 AC_DEFUN([LC_TASK_CLENV_STORE],
663 AC_MSG_CHECKING([if we can store cl_env in task_struct])
664 if test x$have_task_clenv_store != xyes ; then
665 LC_TASK_CLENV_TUX_INFO
671 AC_DEFUN([LC_S_TIME_GRAN],
672 [AC_MSG_CHECKING([if super block has s_time_gran member])
673 LB_LINUX_TRY_COMPILE([
674 #include <linux/fs.h>
676 struct super_block sb;
678 return sb.s_time_gran;
681 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
687 AC_DEFUN([LC_SB_TIME_GRAN],
688 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
689 LB_LINUX_TRY_COMPILE([
690 #include <linux/fs.h>
692 return get_sb_time_gran(NULL);
695 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
703 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
704 AC_DEFUN([LC_RW_TREE_LOCK],
705 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
706 tmp_flags="$EXTRA_KCFLAGS"
707 EXTRA_KCFLAGS="-Werror"
708 LB_LINUX_TRY_COMPILE([
709 #include <linux/fs.h>
711 struct address_space a;
713 write_lock(&a.tree_lock);
716 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
720 EXTRA_KCFLAGS="$tmp_flags"
726 # after 2.6.15 inode have i_mutex intead of i_sem
727 AC_DEFUN([LC_INODE_I_MUTEX],
728 [AC_MSG_CHECKING([if inode has i_mutex ])
729 LB_LINUX_TRY_COMPILE([
730 #include <linux/mutex.h>
731 #include <linux/fs.h>
736 mutex_unlock(&i.i_mutex);
739 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
740 [after 2.6.15 inode have i_mutex intead of i_sem])
748 # LC_SECURITY_PLUG # for SLES10 SP2
749 # check security plug in sles10 sp2 kernel
750 AC_DEFUN([LC_SECURITY_PLUG],
751 [AC_MSG_CHECKING([If kernel has security plug support])
752 LB_LINUX_TRY_COMPILE([
753 #include <linux/fs.h>
755 struct dentry *dentry;
756 struct vfsmount *mnt;
759 notify_change(dentry, mnt, iattr);
762 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
763 [SLES10 SP2 use extra parameter in vfs])
771 # inode have i_private field since 2.6.17
772 AC_DEFUN([LC_INODE_IPRIVATE],
773 [AC_MSG_CHECKING([if inode has a i_private field])
774 LB_LINUX_TRY_COMPILE([
775 #include <linux/fs.h>
781 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
782 [struct inode has i_private field])
789 # after 2.6.17 dquote use mutex instead if semaphore
790 AC_DEFUN([LC_DQUOTOFF_MUTEX],
791 [AC_MSG_CHECKING([use dqonoff_mutex])
792 LB_LINUX_TRY_COMPILE([
793 #include <linux/mutex.h>
794 #include <linux/fs.h>
795 #include <linux/quota.h>
797 struct quota_info dq;
799 mutex_unlock(&dq.dqonoff_mutex);
802 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
803 [after 2.6.17 dquote use mutex instead if semaphore])
812 # 2.6.18 don't export nr_pagecahe
813 AC_DEFUN([LC_NR_PAGECACHE],
814 [AC_MSG_CHECKING([kernel export nr_pagecache])
815 LB_LINUX_TRY_COMPILE([
816 #include <linux/pagemap.h>
818 return atomic_read(&nr_pagecache);
821 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
822 [is kernel export nr_pagecache])
829 # LC_STATFS_DENTRY_PARAM
830 # starting from 2.6.18 linux kernel uses dentry instead of super_block
831 # for the first parameter of the super_operations->statfs() callback.
834 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
835 [AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
836 tmp_flags="$EXTRA_KCFLAGS"
837 EXTRA_KCFLAGS="-Werror"
838 LB_LINUX_TRY_COMPILE([
839 #include <linux/fs.h>
841 ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
843 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
844 [super_ops.statfs() first parameter is dentry])
849 EXTRA_KCFLAGS="$tmp_flags"
854 # starting from 2.6.18 kernel don't export do_kern_mount
855 # and want to use vfs_kern_mount instead.
857 AC_DEFUN([LC_VFS_KERN_MOUNT],
858 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
859 LB_LINUX_TRY_COMPILE([
860 #include <linux/mount.h>
862 vfs_kern_mount(NULL, 0, NULL, NULL);
864 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
865 [vfs_kern_mount exist in kernel])
873 # LC_INVALIDATEPAGE_RETURN_INT
874 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
876 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
877 [AC_MSG_CHECKING([invalidatepage has return int])
878 LB_LINUX_TRY_COMPILE([
879 #include <linux/buffer_head.h>
881 int rc = block_invalidatepage(NULL, 0);
884 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
885 [Define if return type of invalidatepage should be int])
891 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
892 # after 2.6.18 umount_begin has different parameters
893 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
894 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
895 tmp_flags="$EXTRA_KCFLAGS"
896 EXTRA_KCFLAGS="-Werror"
897 LB_LINUX_TRY_COMPILE([
898 #include <linux/fs.h>
901 static void cfg_umount_begin (struct vfsmount *v, int flags)
906 static struct super_operations cfg_super_operations = {
907 .umount_begin = cfg_umount_begin,
910 cfg_super_operations.umount_begin(NULL,0);
913 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
914 [Define umount_begin need second argument])
918 EXTRA_KCFLAGS="$tmp_flags"
922 # after 2.6.18 seq_file has lock intead of sem
923 AC_DEFUN([LC_SEQ_LOCK],
924 [AC_MSG_CHECKING([if struct seq_file has lock field])
925 LB_LINUX_TRY_COMPILE([
926 #include <linux/seq_file.h>
930 mutex_unlock(&seq.lock);
933 AC_DEFINE(HAVE_SEQ_LOCK, 1,
934 [after 2.6.18 seq_file has lock intead of sem])
941 # LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
943 # No standard kernels export this
945 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
946 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
948 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
949 [filemap_fdatawrite_range is exported by the kernel])
955 # starting from 2.6.18 the file_operations .flush
956 # method has a new "fl_owner_t id" parameter
958 AC_DEFUN([LC_FLUSH_OWNER_ID],
959 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
960 LB_LINUX_TRY_COMPILE([
961 #include <linux/fs.h>
963 struct file_operations *fops = NULL;
967 i = fops->flush(NULL, id);
969 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
970 [file_operations .flush method has an fl_owner_t id])
978 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
980 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
981 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
983 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
984 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
985 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
986 [exported invalidate_mapping_pages])],
987 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
988 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
989 [exported invalidate_inode_pages])], [
990 AC_MSG_ERROR([no way to invalidate pages])
995 #2.6.18 + RHEL5 (fc6)
997 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
998 AC_DEFUN([LC_PG_FS_MISC],
999 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1000 LB_LINUX_TRY_COMPILE([
1001 #include <linux/mm.h>
1002 #include <linux/page-flags.h>
1005 #error PG_fs_misc not defined in kernel
1009 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1010 [is kernel have PG_fs_misc])
1016 # RHEL5 PageChecked and SetPageChecked defined
1017 AC_DEFUN([LC_PAGE_CHECKED],
1018 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1019 LB_LINUX_TRY_COMPILE([
1020 #include <linux/mm.h>
1021 #ifdef HAVE_LINUX_MMTYPES_H
1022 #include <linux/mm_types.h>
1024 #include <linux/page-flags.h>
1026 struct page *p = NULL;
1028 /* before 2.6.26 this define*/
1030 /* 2.6.26 use function instead of define for it */
1036 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1037 [does kernel have PageChecked and SetPageChecked])
1046 # If we have fiemap.h
1047 # after 2.6.27 use fiemap.h in include/linux
1049 AC_DEFUN([LC_LINUX_FIEMAP_H],
1050 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1051 AC_MSG_CHECKING([if fiemap.h can be compiled])
1052 LB_LINUX_TRY_COMPILE([
1053 #include <linux/types.h>
1054 #include <linux/fiemap.h>
1056 AC_MSG_RESULT([yes])
1057 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1067 # 2.6.19 API changes
1068 # inode don't have i_blksize field
1069 AC_DEFUN([LC_INODE_BLKSIZE],
1070 [AC_MSG_CHECKING([inode has i_blksize field])
1071 LB_LINUX_TRY_COMPILE([
1072 #include <linux/fs.h>
1078 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1079 [struct inode has i_blksize field])
1086 # 2.6.19 replaced writev with aio_write
1087 AC_DEFUN([LC_FILE_WRITEV],
1088 [AC_MSG_CHECKING([writev in fops])
1089 LB_LINUX_TRY_COMPILE([
1090 #include <linux/fs.h>
1092 struct file_operations *fops = NULL;
1093 fops->writev = NULL;
1096 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1104 # 2.6.19 replaced readv with aio_read
1105 AC_DEFUN([LC_FILE_READV],
1106 [AC_MSG_CHECKING([readv in fops])
1107 LB_LINUX_TRY_COMPILE([
1108 #include <linux/fs.h>
1110 struct file_operations *fops = NULL;
1114 AC_DEFINE(HAVE_FILE_READV, 1,
1123 # LC_CANCEL_DIRTY_PAGE
1124 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
1125 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1126 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1127 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
1128 # backport is broken, so ignore it
1129 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
1130 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
1133 LB_LINUX_TRY_COMPILE([
1134 #include <linux/mm.h>
1135 #include <linux/page-flags.h>
1137 cancel_dirty_page(NULL, 0);
1140 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1141 [kernel has cancel_dirty_page instead of clear_page_dirty])
1148 # raid5-zerocopy patch
1153 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1154 # it support constant page, which means the page won't be modified during the
1157 AC_DEFUN([LC_PAGE_CONSTANT],
1158 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1159 LB_LINUX_TRY_COMPILE([
1160 #include <linux/mm.h>
1161 #include <linux/page-flags.h>
1164 #error "Have no raid5 zcopy patch"
1168 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1176 # 2.6.22 lost second parameter for invalidate_bdev
1177 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1178 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1179 LB_LINUX_TRY_COMPILE([
1180 #include <linux/buffer_head.h>
1182 invalidate_bdev(NULL,0);
1184 AC_MSG_RESULT([yes])
1185 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1186 [invalidate_bdev has second argument])
1193 # check for crypto API
1195 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1196 [AC_MSG_CHECKING([if kernel has block cipher support])
1197 LB_LINUX_TRY_COMPILE([
1198 #include <linux/err.h>
1199 #include <linux/crypto.h>
1201 struct crypto_blkcipher *tfm;
1202 tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
1204 AC_MSG_RESULT([yes])
1205 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1212 # check for struct hash_desc
1214 AC_DEFUN([LC_STRUCT_HASH_DESC],
1215 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1216 LB_LINUX_TRY_COMPILE([
1217 #include <linux/err.h>
1218 #include <linux/crypto.h>
1220 struct hash_desc foo;
1222 AC_MSG_RESULT([yes])
1223 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1230 # check for struct blkcipher_desc
1232 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1233 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1234 LB_LINUX_TRY_COMPILE([
1235 #include <linux/err.h>
1236 #include <linux/crypto.h>
1238 struct blkcipher_desc foo;
1240 AC_MSG_RESULT([yes])
1241 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1248 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1250 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1251 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1252 LB_LINUX_TRY_COMPILE([
1253 #include <linux/fs.h>
1255 int v = FS_RENAME_DOES_D_MOVE;
1257 AC_MSG_RESULT([yes])
1258 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1266 # 2.6.23 have return type 'void' for unregister_blkdev
1267 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1268 [AC_MSG_CHECKING([if unregister_blkdev return int])
1269 LB_LINUX_TRY_COMPILE([
1270 #include <linux/fs.h>
1272 int i = unregister_blkdev(0,NULL);
1274 AC_MSG_RESULT([yes])
1275 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1276 [unregister_blkdev return int])
1282 # 2.6.23 change .sendfile to .splice_read
1283 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1284 [AC_MSG_CHECKING([if kernel has .splice_read])
1285 LB_LINUX_TRY_COMPILE([
1286 #include <linux/fs.h>
1288 struct file_operations file;
1290 file.splice_read = NULL;
1292 AC_MSG_RESULT([yes])
1293 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1294 [kernel has .slice_read])
1300 # 2.6.23 change .sendfile to .splice_read
1301 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1302 AC_DEFUN([LC_KERNEL_SENDFILE],
1303 [AC_MSG_CHECKING([if kernel has .sendfile])
1304 LB_LINUX_TRY_COMPILE([
1305 #include <linux/fs.h>
1307 struct file_operations file;
1309 file.sendfile = NULL;
1311 AC_MSG_RESULT([yes])
1312 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1313 [kernel has .sendfile])
1319 # 2.6.23 extract nfs export related data into exportfs.h
1320 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1321 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1322 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1323 [kernel has include/exportfs.h])
1329 # 2.6.23 has new page fault handling API
1330 AC_DEFUN([LC_VM_OP_FAULT],
1331 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1332 LB_LINUX_TRY_COMPILE([
1333 #include <linux/mm.h>
1335 struct vm_operations_struct op;
1339 AC_MSG_RESULT([yes])
1340 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1341 [kernel has .fault in vm_operation_struct])
1347 # 2.6.23 add code to wait other users to complete before removing procfs entry
1348 AC_DEFUN([LC_PROCFS_USERS],
1349 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1350 LB_LINUX_TRY_COMPILE([
1351 #include <linux/proc_fs.h>
1353 struct proc_dir_entry pde;
1357 AC_MSG_RESULT([yes])
1358 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1359 [kernel has pde_users member in procfs entry struct])
1365 # 2.6.23 exports exportfs_decode_fh
1366 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1367 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1368 [fs/exportfs/expfs.c],[
1369 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1370 [exportfs_decode_fh has been export])
1377 # 2.6.24 need linux/mm_types.h included
1378 AC_DEFUN([LC_HAVE_MMTYPES_H],
1379 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1380 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1381 [kernel has include/mm_types.h])
1387 # 2.6.24 has bio_endio with 2 args
1388 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1389 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1390 LB_LINUX_TRY_COMPILE([
1391 #include <linux/bio.h>
1395 AC_MSG_RESULT([yes])
1396 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1397 [kernel has bio_endio with 2 args])
1403 # 2.6.24 has new members in exports struct.
1404 AC_DEFUN([LC_FH_TO_DENTRY],
1405 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1406 LB_LINUX_TRY_COMPILE([
1407 #include <linux/fs.h>
1408 #ifdef HAVE_LINUX_EXPORTFS_H
1409 #include <linux/exportfs.h>
1412 struct export_operations exp;
1413 memset(exp.fh_to_dentry, 0, sizeof(exp.fh_to_dentry));
1415 AC_MSG_RESULT([yes])
1416 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1417 [kernel has .fh_to_dentry member in export_operations struct])
1423 # 2.6.24 removes long aged procfs entry -> deleted member
1424 AC_DEFUN([LC_PROCFS_DELETED],
1425 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1426 LB_LINUX_TRY_COMPILE([
1427 #include <linux/proc_fs.h>
1429 struct proc_dir_entry pde;
1431 pde.deleted = sizeof(pde);
1433 AC_MSG_RESULT([yes])
1434 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1435 [kernel has deleted member in procfs entry struct])
1441 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1442 AC_DEFUN([LC_EXPORT_BDI_INIT],
1443 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1444 [mm/backing-dev.c],[
1445 AC_DEFINE(HAVE_BDI_INIT, 1,
1446 [bdi_init/bdi_destroy functions are present])
1453 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1454 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1455 [AC_MSG_CHECKING([fs_struct use path structure])
1456 LB_LINUX_TRY_COMPILE([
1457 #include <asm/atomic.h>
1458 #include <linux/spinlock.h>
1459 #include <linux/fs_struct.h>
1462 struct fs_struct fs;
1465 memset(&fs, 0, sizeof(fs));
1467 AC_MSG_RESULT([yes])
1468 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1469 [fs_struct use path structure])
1479 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1480 [AC_MSG_CHECKING([inode_operations->permission has two args])
1481 LB_LINUX_TRY_COMPILE([
1482 #include <linux/fs.h>
1484 struct inode *inode;
1485 inode->i_op->permission(NULL, 0);
1487 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1488 [inode_operations->permission has two args])
1489 AC_MSG_RESULT([yes])
1495 # 2.6.27 has file_remove_suid instead of remove_suid
1496 AC_DEFUN([LC_FILE_REMOVE_SUID],
1497 [AC_MSG_CHECKING([kernel has file_remove_suid])
1498 LB_LINUX_TRY_COMPILE([
1499 #include <linux/fs.h>
1501 file_remove_suid(NULL);
1503 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1504 [kernel have file_remove_suid])
1505 AC_MSG_RESULT([yes])
1511 # 2.6.27 have new page locking API
1512 AC_DEFUN([LC_TRYLOCKPAGE],
1513 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1514 LB_LINUX_TRY_COMPILE([
1515 #include <linux/pagemap.h>
1519 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1520 [kernel uses trylock_page for page lock])
1521 AC_MSG_RESULT([yes])
1527 # 2.6.27 removed the read_inode from super_operations.
1528 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1529 [AC_MSG_CHECKING([super_operations has a read_inode field])
1530 LB_LINUX_TRY_COMPILE([
1531 #include <linux/fs.h>
1533 struct super_operations *sop;
1534 sop->read_inode(NULL);
1536 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1537 [super_operations has a read_inode])
1538 AC_MSG_RESULT([yes])
1544 # 2.6.27 has inode_permission instead of permisson
1545 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1546 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1548 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1549 [inode_permission is exported by the kernel])
1554 # 2.6.27 use 5th parameter in quota_on for remount.
1555 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1556 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1557 LB_LINUX_TRY_COMPILE([
1558 #include <linux/quota.h>
1560 struct quotactl_ops *qop;
1561 qop->quota_on(NULL, 0, 0, NULL, 0);
1563 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1564 [quota_on needs 5 paramters])
1565 AC_MSG_RESULT([yes])
1571 # 2.6.27 use 3th parameter in quota_off for remount.
1572 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1573 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1574 LB_LINUX_TRY_COMPILE([
1575 #include <linux/quota.h>
1577 struct quotactl_ops *qop;
1578 qop->quota_off(NULL, 0, 0);
1580 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1581 [quota_off needs 3 paramters])
1582 AC_MSG_RESULT([yes])
1588 # 2.6.27 has vfs_dq_off inline function.
1589 AC_DEFUN([LC_VFS_DQ_OFF],
1590 [AC_MSG_CHECKING([vfs_dq_off is defined])
1591 LB_LINUX_TRY_COMPILE([
1592 #include <linux/quotaops.h>
1594 vfs_dq_off(NULL, 0);
1596 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1597 AC_MSG_RESULT([yes])
1603 # LC_LOCK_MAP_ACQUIRE
1604 # after 2.6.27 lock_map_acquire replaces lock_acquire
1605 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1606 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1607 LB_LINUX_TRY_COMPILE([
1608 #include <linux/lockdep.h>
1610 lock_map_acquire(NULL);
1613 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1614 [lock_map_acquire is defined])
1620 # 2.6.27.15-2 sles11
1622 # 2.6.27 sles11 remove the bi_hw_segments
1623 AC_DEFUN([LC_BI_HW_SEGMENTS],
1624 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1625 LB_LINUX_TRY_COMPILE([
1626 #include <linux/bio.h>
1629 io.bi_hw_segments = sizeof(io);
1631 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1632 [struct bio has a bi_hw_segments field])
1633 AC_MSG_RESULT([yes])
1640 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1641 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1642 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1643 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1644 AC_DEFINE(HAVE_QUOTAIO_H, 1,
1645 [kernel has include/linux/quotaio_v2.h])
1646 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1647 AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1648 [kernel has fs/quotaio_v1.h])
1649 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1650 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1651 [kernel has fs/quota/quotaio_v2.h])
1659 # 2.6.27 sles11 has sb_any_quota_active
1660 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1661 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1662 LB_LINUX_TRY_COMPILE([
1663 #include <linux/quotaops.h>
1665 sb_any_quota_active(NULL);
1667 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1668 [Kernel has a sb_any_quota_active])
1669 AC_MSG_RESULT([yes])
1675 # 2.6.27 sles11 has sb_has_quota_active
1676 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1677 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1678 LB_LINUX_TRY_COMPILE([
1679 #include <linux/quotaops.h>
1681 sb_has_quota_active(NULL, 0);
1683 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1684 [Kernel has a sb_has_quota_active])
1685 AC_MSG_RESULT([yes])
1691 # 2.6.27 exported add_to_page_cache_lru.
1692 AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
1693 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1695 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1696 [add_to_page_cache_lru functions are present])
1702 # 2.6.29 introduce sb_any_quota_loaded.
1704 AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
1705 [AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
1706 LB_LINUX_TRY_COMPILE([
1707 #include <linux/quotaops.h>
1709 sb_any_quota_loaded(NULL);
1711 AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
1712 [Kernel has a sb_any_quota_loaded])
1713 AC_MSG_RESULT([yes])
1719 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
1720 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
1721 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
1722 [arch/$LINUX_ARCH/mm/numa.c],
1723 [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
1724 [node_to_cpumask_map is exported by
1725 the kernel])]) # x86_64
1728 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1729 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1730 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1731 LB_LINUX_TRY_COMPILE([
1732 #include <linux/blkdev.h>
1734 blk_queue_logical_block_size(NULL, 0);
1737 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1738 [blk_queue_logical_block_size is defined])
1746 # 2.6.32 changes cache_detail's member cache_request to cache_upcall
1747 # in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
1748 AC_DEFUN([LC_CACHE_UPCALL],
1749 [AC_MSG_CHECKING([if cache_detail has cache_upcall field])
1750 LB_LINUX_TRY_COMPILE([
1751 #include <linux/sunrpc/cache.h>
1753 struct cache_detail cd;
1754 cd.cache_upcall = NULL;
1757 AC_DEFINE(HAVE_CACHE_UPCALL, 1,
1758 [cache_detail has cache_upcall field])
1764 # 2.6.32 add a limits member in struct request_queue.
1765 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1766 [AC_MSG_CHECKING([if request_queue has a limits field])
1767 LB_LINUX_TRY_COMPILE([
1768 #include <linux/blkdev.h>
1770 struct request_queue rq;
1771 rq.limits.io_min = 0;
1774 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1775 [request_queue has a limits field])
1781 # 2.6.32 has bdi_register() functions.
1782 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1783 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1784 [mm/backing-dev.c],[
1785 AC_DEFINE(HAVE_BDI_REGISTER, 1,
1786 [bdi_register function is present])
1791 # 2.6.32 add s_bdi for super block
1792 AC_DEFUN([LC_SB_BDI],
1793 [AC_MSG_CHECKING([if super_block has s_bdi field])
1794 LB_LINUX_TRY_COMPILE([
1795 #include <linux/fs.h>
1797 struct super_block sb;
1801 AC_DEFINE(HAVE_SB_BDI, 1,
1802 [super_block has s_bdi field])
1808 # 2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
1809 AC_DEFUN([LC_BDI_NAME],
1810 [AC_MSG_CHECKING([if backing_device_info has name field])
1811 LB_LINUX_TRY_COMPILE([
1812 #include <linux/blkkdev.h>
1814 struct backing_dev_info bdi;
1818 AC_DEFINE(HAVE_BDI_NAME, 1,
1819 [backing_device_info has name field])
1825 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1826 # check blk_queue_max_sectors and use it until disappear.
1827 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1828 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1829 LB_LINUX_TRY_COMPILE([
1830 #include <linux/blkdev.h>
1832 blk_queue_max_sectors(NULL, 0);
1835 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1836 [blk_queue_max_sectors is defined])
1842 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
1843 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1844 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1845 LB_LINUX_TRY_COMPILE([
1846 #include <linux/blkdev.h>
1848 blk_queue_max_segments(NULL, 0);
1851 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1852 [blk_queue_max_segments is defined])
1861 # Check if kernel has been patched for 64-bit quota limits support.
1862 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
1863 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
1864 # that in the absence of quotaio_v1.h in the kernel headers.
1866 AC_DEFUN([LC_QUOTA64],[
1867 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1868 tmp_flags="$EXTRA_KCFLAGS"
1869 EXTRA_KCFLAGS="-I$LINUX/fs"
1870 LB_LINUX_TRY_COMPILE([
1871 #include <linux/kernel.h>
1872 #include <linux/fs.h>
1873 #ifdef HAVE_QUOTAIO_H
1874 # include <linux/quotaio_v2.h>
1875 int versions[] = V2_INITQVERSIONS_R1;
1876 struct v2_disk_dqblk_r1 dqblk_r1;
1877 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
1878 # include <quota/quotaio_v2.h>
1879 struct v2r1_disk_dqblk dqblk_r1;
1880 #elif defined(HAVE_FS_QUOTAIO_H)
1881 # include <quotaio_v2.h>
1882 struct v2r1_disk_dqblk dqblk_r1;
1884 #include <linux/quota.h>
1885 int ver = QFMT_VFS_V1;
1888 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1889 AC_MSG_RESULT([yes])
1891 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1892 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1896 EXTRA_KCFLAGS=$tmp_flags
1899 # 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
1900 AC_DEFUN([LC_SET_CPUS_ALLOWED],
1901 [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
1902 LB_LINUX_TRY_COMPILE(
1903 [#include <linux/sched.h>],
1904 [struct task_struct *p = NULL;
1905 cpumask_t mask = { { 0 } };
1906 (void) set_cpus_allowed(p, mask);],
1907 [AC_MSG_RESULT([yes])
1908 AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
1909 [set_cpus_allowed is exported by the kernel])],
1910 [AC_MSG_RESULT([no])] )])
1914 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1915 # d_obtain_alias() for getting anonymous dentries
1916 # RHEL5(2.6.18) has d_obtain_alias but SLES11SP0(2.6.27) not
1918 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1919 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1920 LB_LINUX_TRY_COMPILE([
1921 #include <linux/dcache.h>
1923 d_obtain_alias(NULL);
1925 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1926 [d_obtain_alias exist in kernel])
1927 AC_MSG_RESULT([yes])
1934 # LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
1936 AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
1937 [LB_CHECK_SYMBOL_EXPORT(
1938 [generic_error_remove_page],
1940 [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
1941 [kernel export generic_error_remove_page])],
1947 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
1949 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
1950 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
1951 LB_LINUX_TRY_COMPILE([
1952 #include <asm/atomic.h>
1953 #include <linux/spinlock.h>
1954 #include <linux/fs_struct.h>
1956 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
1958 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
1959 [fs_struct.lock use rwlock])
1960 AC_MSG_RESULT([yes])
1967 # 2.6.36 super_operations add evict_inode method. it hybird of
1968 # delete_inode & clear_inode.
1970 AC_DEFUN([LC_SBOPS_EVICT_INODE],
1971 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
1972 LB_LINUX_TRY_COMPILE([
1973 #include <linux/fs.h>
1975 ((struct super_operations *)0)->evict_inode(NULL);
1977 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
1978 [super_operations.evict_inode() is exist in kernel])
1979 AC_MSG_RESULT([yes])
1986 # 2.6.35 file_operations.fsync taken 2 arguments.
1988 AC_DEFUN([LC_FILE_FSYNC],
1989 [AC_MSG_CHECKING([if file_operations.fsync taken 2 arguments])
1990 LB_LINUX_TRY_COMPILE([
1991 #include <linux/fs.h>
1993 ((struct file_operations *)0)->fsync(NULL, 0);
1995 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
1996 [file_operations.fsync taken 2 arguments])
1997 AC_MSG_RESULT([yes])
2004 # 2.6.38 export blkdev_get_by_dev
2006 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
2007 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
2009 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
2010 [blkdev_get_by_dev is exported by the kernel])
2016 # 2.6.38 vfsmount.mnt_count doesn't use atomic_t
2018 AC_DEFUN([LC_ATOMIC_MNT_COUNT],
2019 [AC_MSG_CHECKING([if vfsmount.mnt_count is atomic_t])
2020 LB_LINUX_TRY_COMPILE([
2021 #include <asm/atomic.h>
2022 #include <linux/fs.h>
2023 #include <linux/mount.h>
2025 ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
2027 AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
2028 [vfsmount.mnt_count is atomic_t])
2029 AC_MSG_RESULT([yes])
2036 # 2.6.38 use path as 4th parameter in quota_on.
2038 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
2039 [AC_MSG_CHECKING([quota_on use path as parameter])
2040 tmp_flags="$EXTRA_KCFLAGS"
2041 EXTRA_KCFLAGS="-Werror"
2042 LB_LINUX_TRY_COMPILE([
2043 #include <linux/fs.h>
2044 #include <linux/quota.h>
2046 ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
2048 AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
2049 [quota_on use path as 4th paramter])
2050 AC_MSG_RESULT([yes])
2054 EXTRA_KCFLAGS="$tmp_flags"
2058 # 2.6.39 remove unplug_fn from request_queue.
2060 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
2061 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
2062 LB_LINUX_TRY_COMPILE([
2063 #include <linux/blkdev.h>
2065 struct request_queue rq;
2066 memset(rq.unplug_fn, 0, sizeof(rq.unplug_fn));
2068 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
2069 [request_queue has unplug_fn field])
2070 AC_MSG_RESULT([yes])
2077 # 2.6.38 generic_permission taken 4 paremater.
2078 # in fact, it means rcu-walk aware permission bring.
2080 AC_DEFUN([LC_GENERIC_PERMISSION],
2081 [AC_MSG_CHECKING([if generic_permission take 4 arguments])
2082 LB_LINUX_TRY_COMPILE([
2083 #include <linux/fs.h>
2085 generic_permission(NULL, 0, 0, NULL);
2087 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
2088 [generic_permission taken 4 arguments])
2089 AC_MSG_RESULT([yes])
2096 # 2.6.38 export simple_setattr
2098 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
2099 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
2101 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
2102 [simple_setattr is exported by the kernel])
2110 # Lustre linux kernel checks
2112 AC_DEFUN([LC_PROG_LINUX],
2113 [LC_LUSTRE_VERSION_H
2116 LC_CONFIG_LIBLUSTRE_RECOVERY
2117 LC_CONFIG_HEALTH_CHECK_WRITE
2118 LC_CONFIG_LRU_RESIZE
2120 LC_LLITE_LLOOP_MODULE
2123 LC_EXPORT_TRUNCATE_COMPLETE
2124 LC_EXPORT_D_REHASH_COND
2125 LC_EXPORT___D_REHASH
2126 LC_EXPORT_NODE_TO_CPUMASK
2133 LC_STRUCT_INTENT_FILE
2138 LC_FUNC_HAVE_CAN_SLEEP_ARG
2141 LC_COOKIE_FOLLOW_LINK
2157 LC_SECURITY_PLUG # for SLES10 SP2
2165 LC_STATFS_DENTRY_PARAM
2167 LC_INVALIDATEPAGE_RETURN_INT
2168 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2170 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
2172 if test x$enable_server = xyes ; then
2173 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2176 #2.6.18 + RHEL5 (fc6)
2187 LC_CANCEL_DIRTY_PAGE
2189 # raid5-zerocopy patch
2193 LC_INVALIDATE_BDEV_2ARG
2194 LC_ASYNC_BLOCK_CIPHER
2196 LC_STRUCT_BLKCIPHER_DESC
2197 LC_FS_RENAME_DOES_D_MOVE
2200 LC_UNREGISTER_BLKDEV_RETURN_INT
2201 LC_KERNEL_SPLICE_READ
2206 LC_EXPORTFS_DECODE_FH
2216 LC_FS_STRUCT_USE_PATH
2219 LC_INODE_PERMISION_2ARGS
2222 LC_READ_INODE_IN_SBOPS
2223 LC_EXPORT_INODE_PERMISSION
2229 # 2.6.27.15-2 sles11
2233 LC_SB_ANY_QUOTA_ACTIVE
2234 LC_SB_HAS_QUOTA_ACTIVE
2235 LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
2238 LC_SB_ANY_QUOTA_LOADED
2241 LC_EXPORT_CPUMASK_OF_NODE
2244 LC_BLK_QUEUE_LOG_BLK_SIZE
2247 LC_REQUEST_QUEUE_LIMITS
2248 LC_EXPORT_BDI_REGISTER
2250 LC_BLK_QUEUE_MAX_SECTORS
2251 LC_BLK_QUEUE_MAX_SEGMENTS
2254 LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
2258 LC_EXPORT_SIMPLE_SETATTR
2262 LC_SBOPS_EVICT_INODE
2266 LC_BLKDEV_GET_BY_DEV
2267 LC_GENERIC_PERMISSION
2268 LC_QUOTA_ON_USE_PATH
2271 LC_REQUEST_QUEUE_UNPLUG_FN
2274 if test x$enable_server = xyes ; then
2275 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2276 LC_FUNC_DEV_SET_RDONLY
2283 # LC_CONFIG_CLIENT_SERVER
2285 # Build client/server sides of Lustre
2287 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2288 [AC_MSG_CHECKING([whether to build Lustre server support])
2289 AC_ARG_ENABLE([server],
2290 AC_HELP_STRING([--disable-server],
2291 [disable Lustre server support]),
2292 [],[enable_server='yes'])
2293 AC_MSG_RESULT([$enable_server])
2295 AC_MSG_CHECKING([whether to build Lustre client support])
2296 AC_ARG_ENABLE([client],
2297 AC_HELP_STRING([--disable-client],
2298 [disable Lustre client support]),
2299 [],[enable_client='yes'])
2300 AC_MSG_RESULT([$enable_client])])
2303 # LC_CONFIG_LIBLUSTRE
2305 # whether to build liblustre
2307 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2308 [AC_MSG_CHECKING([whether to build Lustre library])
2309 AC_ARG_ENABLE([liblustre],
2310 AC_HELP_STRING([--disable-liblustre],
2311 [disable building of Lustre library]),
2312 [],[enable_liblustre=$with_sysio])
2313 AC_MSG_RESULT([$enable_liblustre])
2314 # only build sysio if liblustre is built
2315 with_sysio="$enable_liblustre"
2317 AC_MSG_CHECKING([whether to build liblustre tests])
2318 AC_ARG_ENABLE([liblustre-tests],
2319 AC_HELP_STRING([--enable-liblustre-tests],
2320 [enable liblustre tests, if --disable-tests is used]),
2321 [],[enable_liblustre_tests=$enable_tests])
2322 if test x$enable_liblustre != xyes ; then
2323 enable_liblustre_tests='no'
2325 AC_MSG_RESULT([$enable_liblustre_tests])
2327 AC_MSG_CHECKING([whether to enable liblustre acl])
2328 AC_ARG_ENABLE([liblustre-acl],
2329 AC_HELP_STRING([--disable-liblustre-acl],
2330 [disable ACL support for liblustre]),
2331 [],[enable_liblustre_acl=yes])
2332 AC_MSG_RESULT([$enable_liblustre_acl])
2333 if test x$enable_liblustre_acl = xyes ; then
2334 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2337 # 2.6.29 change prepare/commit_write to write_begin/end
2338 AC_DEFUN([LC_WRITE_BEGIN_END],
2339 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2340 LB_LINUX_TRY_COMPILE([
2341 #include <linux/fs.h>
2342 #include <linux/pagemap.h>
2343 #ifdef HAVE_LINUX_MMTYPES_H
2344 #include <linux/mm_types.h>
2347 struct address_space_operations aops;
2350 aops.write_begin = NULL;
2351 aops.write_end = NULL;
2352 page = grab_cache_page_write_begin(NULL, 0, 0);
2354 AC_MSG_RESULT([yes])
2355 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2356 [kernel has .write_begin/end])
2362 # 2.6.29 blkdev_put has 2 arguments
2363 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2364 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2365 LB_LINUX_TRY_COMPILE([
2366 #include <linux/fs.h>
2368 blkdev_put(NULL, 0);
2370 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2371 [blkdev_put needs 2 paramters])
2372 AC_MSG_RESULT([yes])
2378 # 2.6.29 dentry_open has 4 arguments
2379 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2380 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2381 LB_LINUX_TRY_COMPILE([
2382 #include <linux/fs.h>
2384 dentry_open(NULL, NULL, 0, NULL);
2386 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2387 [dentry_open needs 4 paramters])
2388 AC_MSG_RESULT([yes])
2394 # 2.6.29 split file and anonymous page queues
2395 AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
2396 [AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
2397 LB_LINUX_TRY_COMPILE([
2398 #include <linux/mm.h>
2399 #include <linux/pagevec.h>
2401 struct pagevec lru_pagevec;
2403 pagevec_init(&lru_pagevec, 0);
2404 pagevec_lru_add_file(&lru_pagevec);
2406 AC_MSG_RESULT([yes])
2407 AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
2408 [kernel has .pagevec_lru_add_file])
2417 AC_ARG_ENABLE(mpitests,
2418 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2419 [include mpi tests]),
2430 MPICC_WRAPPER=$enableval
2440 if test x$enable_mpitests != xno; then
2441 AC_MSG_CHECKING([whether mpitests can be built])
2449 MPI_Initialized(&flag);
2452 AC_MSG_RESULT([yes])
2459 AC_SUBST(MPICC_WRAPPER)
2461 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2462 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2465 LC_CONFIG_LIBLUSTRE_RECOVERY
2471 # whether to enable quota support global control
2473 AC_DEFUN([LC_CONFIG_QUOTA],
2474 [AC_ARG_ENABLE([quota],
2475 AC_HELP_STRING([--enable-quota],
2476 [enable quota support]),
2477 [],[enable_quota='yes'])
2480 AC_DEFUN([LC_QUOTA],
2484 AC_CHECK_HEADER(sys/quota.h,
2485 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2486 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2492 # whether to enable split support
2494 AC_DEFUN([LC_CONFIG_SPLIT],
2495 [AC_MSG_CHECKING([whether to enable split support])
2496 AC_ARG_ENABLE([split],
2497 AC_HELP_STRING([--enable-split],
2498 [enable split support]),
2499 [],[enable_split='no'])
2500 AC_MSG_RESULT([$enable_split])
2501 if test x$enable_split != xno; then
2502 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2506 # RHEL5(2.6.18) has tux_info
2507 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2508 [AC_MSG_CHECKING([tux_info])
2509 LB_LINUX_TRY_COMPILE([
2510 #include <linux/sched.h>
2512 struct task_struct task;
2515 AC_MSG_RESULT([yes])
2516 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2517 have_task_clenv_store='yes'
2524 # LC_LLITE_LLOOP_MODULE
2525 # lloop_llite.ko does not currently work with page sizes
2528 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2529 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2530 LB_LINUX_TRY_COMPILE([
2531 #include <asm/page.h>
2533 #if PAGE_SIZE >= 65536
2534 #error "PAGE_SIZE >= 65536"
2537 enable_llite_lloop_module='yes'
2538 AC_MSG_RESULT([yes])
2540 enable_llite_lloop_module='no'
2548 # other configure checks
2550 AC_DEFUN([LC_CONFIGURE],
2551 [LC_CONFIG_OBD_BUFFER_SIZE
2553 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2554 CFLAGS="$CFLAGS -Werror"
2557 # maximum MDS thread count
2560 # include/liblustre.h
2561 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2563 # liblustre/llite_lib.h
2564 AC_CHECK_HEADERS([xtio.h file.h])
2567 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2570 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2571 AC_CHECK_FUNCS([inet_ntoa])
2573 # libsysio/src/readlink.c
2576 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2577 AC_CHECK_HEADERS([linux/random.h], [], [],
2578 [#ifdef HAVE_LINUX_TYPES_H
2579 # include <linux/types.h>
2584 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2586 # check for -lz support
2590 [AC_CHECK_HEADERS([zlib.h],
2592 AC_DEFINE([HAVE_ADLER], 1,
2593 [support alder32 checksum type])],
2594 [AC_MSG_WARN([No zlib-devel package found,
2595 unable to use adler32 checksum])])],
2596 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2601 AC_ARG_ENABLE([mindf],
2602 AC_HELP_STRING([--enable-mindf],
2603 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2605 if test "$enable_mindf" = "yes" ; then
2606 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2609 AC_ARG_ENABLE([fail_alloc],
2610 AC_HELP_STRING([--disable-fail-alloc],
2611 [disable randomly alloc failure]),
2612 [],[enable_fail_alloc=yes])
2613 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2614 AC_MSG_RESULT([$enable_fail_alloc])
2615 if test x$enable_fail_alloc != xno ; then
2616 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2619 AC_ARG_ENABLE([invariants],
2620 AC_HELP_STRING([--enable-invariants],
2621 [enable invariant checking (cpu intensive)]),
2623 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2624 AC_MSG_RESULT([$enable_invariants])
2625 if test x$enable_invariants = xyes ; then
2626 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2629 AC_ARG_ENABLE([lu_ref],
2630 AC_HELP_STRING([--enable-lu_ref],
2631 [enable lu_ref reference tracking code]),
2633 AC_MSG_CHECKING([whether to track references with lu_ref])
2634 AC_MSG_RESULT([$enable_lu_ref])
2635 if test x$enable_lu_ref = xyes ; then
2636 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2639 AC_ARG_ENABLE([pgstate-track],
2640 AC_HELP_STRING([--enable-pgstate-track],
2641 [enable page state tracking]),
2642 [enable_pgstat_track='yes'],[])
2643 AC_MSG_CHECKING([whether to enable page state tracking])
2644 AC_MSG_RESULT([$enable_pgstat_track])
2645 if test x$enable_pgstat_track = xyes ; then
2646 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2647 [enable page state tracking code])
2654 LC_DENTRY_OPEN_4ARGS
2655 LC_PAGEVEC_LRU_ADD_FILE
2662 # AM_CONDITIONALS for lustre
2664 AC_DEFUN([LC_CONDITIONALS],
2665 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2666 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2667 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2668 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2669 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2670 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2671 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2672 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2673 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2674 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2675 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2676 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2677 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2678 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2679 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2685 # files that should be generated with AC_OUTPUT
2687 AC_DEFUN([LC_CONFIG_FILES],
2691 lustre/autoconf/Makefile
2692 lustre/conf/Makefile
2693 lustre/contrib/Makefile
2695 lustre/include/Makefile
2696 lustre/include/lustre_ver.h
2697 lustre/include/linux/Makefile
2698 lustre/include/darwin/Makefile
2699 lustre/include/lustre/Makefile
2700 lustre/kernel_patches/targets/2.6-rhel6.target
2701 lustre/kernel_patches/targets/2.6-rhel5.target
2702 lustre/kernel_patches/targets/2.6-sles10.target
2703 lustre/kernel_patches/targets/2.6-sles11.target
2704 lustre/kernel_patches/targets/2.6-oel5.target
2705 lustre/kernel_patches/targets/2.6-fc11.target
2706 lustre/kernel_patches/targets/2.6-fc12.target
2707 lustre/ldlm/Makefile
2709 lustre/fid/autoMakefile
2710 lustre/liblustre/Makefile
2711 lustre/liblustre/tests/Makefile
2712 lustre/liblustre/tests/mpi/Makefile
2713 lustre/llite/Makefile
2714 lustre/llite/autoMakefile
2715 lustre/lclient/Makefile
2717 lustre/lov/autoMakefile
2718 lustre/lvfs/Makefile
2719 lustre/lvfs/autoMakefile
2721 lustre/mdc/autoMakefile
2723 lustre/lmv/autoMakefile
2725 lustre/mds/autoMakefile
2727 lustre/mdt/autoMakefile
2729 lustre/cmm/autoMakefile
2731 lustre/mdd/autoMakefile
2733 lustre/fld/autoMakefile
2734 lustre/obdclass/Makefile
2735 lustre/obdclass/autoMakefile
2736 lustre/obdclass/linux/Makefile
2737 lustre/obdecho/Makefile
2738 lustre/obdecho/autoMakefile
2739 lustre/obdfilter/Makefile
2740 lustre/obdfilter/autoMakefile
2742 lustre/osc/autoMakefile
2744 lustre/ost/autoMakefile
2745 lustre/osd-ldiskfs/Makefile
2746 lustre/osd-ldiskfs/autoMakefile
2748 lustre/mgc/autoMakefile
2750 lustre/mgs/autoMakefile
2751 lustre/ptlrpc/Makefile
2752 lustre/ptlrpc/autoMakefile
2753 lustre/ptlrpc/gss/Makefile
2754 lustre/ptlrpc/gss/autoMakefile
2755 lustre/quota/Makefile
2756 lustre/quota/autoMakefile
2757 lustre/scripts/Makefile
2758 lustre/tests/Makefile
2759 lustre/tests/mpi/Makefile
2760 lustre/utils/Makefile
2761 lustre/utils/gss/Makefile
2762 lustre/obdclass/darwin/Makefile