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 # LC_FUNC_RELEASEPAGE_WITH_GFP
90 # 2.6.9 ->releasepage() takes a gfp_t arg
91 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
92 # while others either don't have gfp_t or pass gfp_t as the parameter.
94 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
95 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
96 RELEASEPAGE_WITH_GFP="$(grep -c 'releasepage.*gfp_t' $LINUX/include/linux/fs.h)"
97 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
98 AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
99 [releasepage with gfp_t parameter])
109 # only for Lustre-patched kernels
111 AC_DEFUN([LC_LUSTRE_VERSION_H],
112 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
113 rm -f "$LUSTRE/include/linux/lustre_version.h"
115 touch "$LUSTRE/include/linux/lustre_version.h"
116 if test x$enable_server = xyes ; then
117 AC_MSG_WARN([Unpatched kernel detected.])
118 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
119 AC_MSG_WARN([disabling server build])
126 # LC_FUNC_DEV_SET_RDONLY
128 # check for the old-style dev_set_rdonly which took an extra "devno" param
129 # and can only set a single device to discard writes at one time
131 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
132 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
133 LB_LINUX_TRY_COMPILE([
134 #include <linux/fs.h>
135 #include <linux/blkdev.h>
137 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
138 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
142 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
144 AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
145 kernel patches from Lustre version 1.4.3 or above.])
150 # Ensure stack size big than 8k in Lustre server (all kernels)
152 AC_DEFUN([LC_STACK_SIZE],
153 [AC_MSG_CHECKING([stack size big than 8k])
154 LB_LINUX_TRY_COMPILE([
155 #include <linux/thread_info.h>
157 #if THREAD_SIZE < 8192
158 #error "stack size < 8192"
163 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
168 # Allow the user to set the MDS thread upper limit
170 AC_DEFUN([LC_MDS_MAX_THREADS],
172 AC_ARG_WITH([mds_max_threads],
173 AC_HELP_STRING([--with-mds-max-threads=size],
174 [define the maximum number of threads available on the MDS: (default=512)]),
176 MDS_THREAD_COUNT=$with_mds_max_threads
177 AC_DEFINE_UNQUOTED(MDT_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of mdt threads])
182 # LC_CONFIG_BACKINGFS
184 # setup, check the backing filesystem
186 AC_DEFUN([LC_CONFIG_BACKINGFS],
190 if test x$with_ldiskfs = xno ; then
191 if test x$linux25$enable_server = xyesyes ; then
192 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
196 LB_DEFINE_LDISKFS_OPTIONS
199 AC_MSG_CHECKING([which backing filesystem to use])
200 AC_MSG_RESULT([$BACKINGFS])
207 # the pinger is temporary, until we have the recovery node in place
209 AC_DEFUN([LC_CONFIG_PINGER],
210 [AC_MSG_CHECKING([whether to enable pinger support])
211 AC_ARG_ENABLE([pinger],
212 AC_HELP_STRING([--disable-pinger],
213 [disable recovery pinger support]),
214 [],[enable_pinger='yes'])
215 AC_MSG_RESULT([$enable_pinger])
216 if test x$enable_pinger != xno ; then
217 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
224 # do checksum of bulk data between client and OST
226 AC_DEFUN([LC_CONFIG_CHECKSUM],
227 [AC_MSG_CHECKING([whether to enable data checksum support])
228 AC_ARG_ENABLE([checksum],
229 AC_HELP_STRING([--disable-checksum],
230 [disable data checksum support]),
231 [],[enable_checksum='yes'])
232 AC_MSG_RESULT([$enable_checksum])
233 if test x$enable_checksum != xno ; then
234 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
239 # LC_CONFIG_LIBLUSTRE_RECOVERY
241 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
242 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
243 AC_ARG_ENABLE([liblustre-recovery],
244 AC_HELP_STRING([--disable-liblustre-recovery],
245 [disable liblustre recovery support]),
246 [],[enable_liblustre_recovery='yes'])
247 AC_MSG_RESULT([$enable_liblustre_recovery])
248 if test x$enable_liblustre_recovery != xno ; then
249 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
254 # LC_CONFIG_HEALTH_CHECK_WRITE
256 # Turn off the actual write to the disk
258 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
259 [AC_MSG_CHECKING([whether to enable a write with the health check])
260 AC_ARG_ENABLE([health_write],
261 AC_HELP_STRING([--enable-health_write],
262 [enable disk writes when doing health check]),
263 [],[enable_health_write='no'])
264 AC_MSG_RESULT([$enable_health_write])
265 if test x$enable_health_write != xno ; then
266 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
270 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
271 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
272 AC_ARG_ENABLE([lru_resize],
273 AC_HELP_STRING([--enable-lru-resize],
274 [enable lru resize support]),
275 [],[enable_lru_resize='yes'])
276 AC_MSG_RESULT([$enable_lru_resize])
277 if test x$enable_lru_resize != xno; then
278 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
282 # whether to enable quota support(kernel modules)
283 AC_DEFUN([LC_QUOTA_MODULE],
284 [if test x$enable_quota != xno; then
285 LB_LINUX_CONFIG([QUOTA],[
286 enable_quota_module='yes'
287 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
289 enable_quota_module='no'
290 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
295 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
296 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
298 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
299 [kernel export truncate_complete_page])
304 AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
305 [LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
307 AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
308 [kernel export truncate_inode_pages_range])
313 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
314 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
316 AC_DEFINE(HAVE_D_REHASH_COND, 1,
317 [d_rehash_cond is exported by the kernel])
322 AC_DEFUN([LC_EXPORT___D_REHASH],
323 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
325 AC_DEFINE(HAVE___D_REHASH, 1,
326 [__d_rehash is exported by the kernel])
331 # The actual symbol exported varies among architectures, so we need
332 # to check many symbols (but only in the current architecture.) No
333 # matter what symbol is exported, the kernel #defines node_to_cpumask
334 # to the appropriate function and that's what we use.
335 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
336 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
337 [arch/$LINUX_ARCH/mm/numa.c],
338 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
339 [node_to_cpumask is exported by
340 the kernel])]) # x86_64
341 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
342 [arch/$LINUX_ARCH/kernel/smpboot.c],
343 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
344 [node_to_cpumask is exported by
345 the kernel])]) # ia64
346 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
347 [arch/$LINUX_ARCH/kernel/smpboot.c],
348 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
349 [node_to_cpumask is exported by
350 the kernel])]) # i386
354 # LC_HEADER_LDISKFS_XATTR
356 # CHAOS kernel-devel package will not include fs/ldiskfs/xattr.h
358 AC_DEFUN([LC_HEADER_LDISKFS_XATTR],
359 [AC_MSG_CHECKING([if ldiskfs has xattr.h header])
360 tmp_flags="$EXTRA_KCFLAGS"
361 EXTRA_KCFLAGS="-I$LINUX/fs -I$LDISKFS_DIR -I$LDISKFS_DIR/ldiskfs"
362 LB_LINUX_TRY_COMPILE([
363 #include <ldiskfs/xattr.h>
365 ldiskfs_xattr_get(NULL, 0, "", NULL, 0);
366 ldiskfs_xattr_set_handle(NULL, NULL, 0, "", NULL, 0, 0);
370 AC_DEFINE(HAVE_LDISKFS_XATTR_H, 1, [ldiskfs/xattr.h found])
374 EXTRA_KCFLAGS="$tmp_flags"
378 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
380 # Check for our patched grab_cache_page_nowait_gfp() function
381 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
383 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
384 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
386 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
387 [kernel exports grab_cache_page_nowait_gfp])
389 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
391 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
392 [kernel exports add_to_page_cache_lru])
401 # AIX does not have statfs.f_namelen
403 AC_DEFUN([LC_STRUCT_STATFS],
404 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
405 LB_LINUX_TRY_COMPILE([
406 #include <linux/vfs.h>
412 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
419 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
421 AC_DEFUN([LC_FILEMAP_POPULATE],
422 [AC_MSG_CHECKING([for exported filemap_populate])
423 LB_LINUX_TRY_COMPILE([
424 #include <asm/page.h>
425 #include <linux/mm.h>
427 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
430 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
439 AC_DEFUN([LC_D_ADD_UNIQUE],
440 [AC_MSG_CHECKING([for d_add_unique])
441 LB_LINUX_TRY_COMPILE([
442 #include <linux/dcache.h>
444 d_add_unique(NULL, NULL);
447 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
456 AC_DEFUN([LC_BIT_SPINLOCK_H],
457 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
458 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
459 LB_LINUX_TRY_COMPILE([
460 #include <asm/processor.h>
461 #include <linux/spinlock.h>
462 #include <linux/bit_spinlock.h>
465 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
474 # After 2.6.26 we no longer have xattr_acl.h
476 AC_DEFUN([LC_XATTR_ACL],
477 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
478 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
479 LB_LINUX_TRY_COMPILE([
480 #include <linux/xattr_acl.h>
483 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
492 # After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
494 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
495 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
496 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
497 LB_LINUX_TRY_COMPILE([
498 #include <linux/fs.h>
499 #include <linux/posix_acl_xattr.h>
502 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
513 AC_DEFUN([LC_CONST_ACL_SIZE],
514 [AC_MSG_CHECKING([calc acl size])
516 CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`uname -m|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include $EXTRA_KCFLAGS"
519 #include <linux/autoconf.h>
520 #include <linux/types.h>
523 #define __LINUX_POSIX_ACL_H
525 # ifdef CONFIG_FS_POSIX_ACL
526 # ifdef HAVE_XATTR_ACL
527 # include <linux/xattr_acl.h>
529 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
530 # include <linux/posix_acl_xattr.h>
534 #include <lustre_acl.h>
540 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
541 FILE *f = fopen("acl.size","w+");
542 fprintf(f,"%d", size);
548 acl_size=`cat acl.size`
549 AC_MSG_RESULT([ACL size $acl_size])
550 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
552 AC_ERROR([ACL size can't computed])
559 AC_DEFUN([LC_STRUCT_INTENT_FILE],
560 [AC_MSG_CHECKING([if struct open_intent has a file field])
561 LB_LINUX_TRY_COMPILE([
562 #include <linux/fs.h>
563 #include <linux/namei.h>
565 struct open_intent intent;
569 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
578 AC_DEFUN([LC_CAPA_CRYPTO],
579 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
580 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
582 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
583 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
585 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
586 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
591 # LC_CONFIG_RMTCLIENT
594 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
596 AC_DEFUN([LC_CONFIG_RMTCLIENT],
597 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
598 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
603 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
605 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
606 [AC_MSG_CHECKING([whether to enable gss keyring backend])
607 AC_ARG_ENABLE([gss_keyring],
608 [AC_HELP_STRING([--disable-gss-keyring],
609 [disable gss keyring backend])],
610 [],[enable_gss_keyring='yes'])
611 AC_MSG_RESULT([$enable_gss_keyring])
613 if test x$enable_gss_keyring != xno; then
614 LB_LINUX_CONFIG_IM([KEYS],[],
615 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
617 AC_CHECK_LIB([keyutils], [keyctl_search], [],
618 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
620 AC_DEFINE([HAVE_GSS_KEYRING], [1],
621 [Define this if you enable gss keyring backend])
625 AC_DEFUN([LC_SUNRPC_CACHE],
626 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
627 LB_LINUX_TRY_COMPILE([
628 #include <linux/sunrpc/cache.h>
630 struct cache_head ch;
634 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
640 AC_DEFUN([LC_CONFIG_SUNRPC],
641 [LB_LINUX_CONFIG_IM([SUNRPC],[],
642 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
647 # LC_CONFIG_GSS (default disabled)
649 # Build gss and related tools of Lustre. Currently both kernel and user space
650 # parts are depend on linux platform.
652 AC_DEFUN([LC_CONFIG_GSS],
653 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
655 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
656 [],[enable_gss='no'])
657 AC_MSG_RESULT([$enable_gss])
659 if test x$enable_gss == xyes; then
660 LC_CONFIG_GSS_KEYRING
663 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
665 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
666 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
667 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
668 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
669 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
670 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
671 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
672 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
674 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
675 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
676 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
677 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
678 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
680 AC_SUBST(GSSAPI_LIBS)
687 # LC_FUNC_HAVE_CAN_SLEEP_ARG
689 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
691 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
692 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
693 LB_LINUX_TRY_COMPILE([
694 #include <linux/fs.h>
698 struct file_lock *file_lock;
699 flock_lock_file_wait(file, file_lock, cansleep);
701 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
702 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
712 # rhel4.2 kernel has f_op->flock field
714 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
715 [AC_MSG_CHECKING([if struct file_operations has flock field])
716 LB_LINUX_TRY_COMPILE([
717 #include <linux/fs.h>
719 struct file_operations ll_file_operations_flock;
720 ll_file_operations_flock.flock = NULL;
722 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
723 [struct file_operations has flock field])
730 AC_DEFUN([LC_QUOTA_READ],
731 [AC_MSG_CHECKING([if kernel supports quota_read])
732 LB_LINUX_TRY_COMPILE([
733 #include <linux/fs.h>
735 struct super_operations sp;
736 void *i = (void *)sp.quota_read;
739 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
746 # LC_COOKIE_FOLLOW_LINK
748 # kernel 2.6.13+ ->follow_link returns a cookie
751 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
752 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
753 LB_LINUX_TRY_COMPILE([
754 #include <linux/fs.h>
755 #include <linux/namei.h>
757 struct dentry dentry;
760 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
762 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
772 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
773 # call_rcu takes three parameters.
775 AC_DEFUN([LC_FUNC_RCU],
776 [AC_MSG_CHECKING([if kernel have RCU supported])
777 LB_LINUX_TRY_COMPILE([
778 #include <linux/rcupdate.h>
780 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
783 AC_MSG_CHECKING([if call_rcu takes three parameters])
784 LB_LINUX_TRY_COMPILE([
785 #include <linux/rcupdate.h>
788 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
790 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
801 AC_DEFUN([LC_PERCPU_COUNTER],
802 [AC_MSG_CHECKING([if have struct percpu_counter defined])
803 LB_LINUX_TRY_COMPILE([
804 #include <linux/percpu_counter.h>
806 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
809 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
810 LB_LINUX_TRY_COMPILE([
811 #include <linux/percpu_counter.h>
813 struct percpu_counter c;
814 percpu_counter_init(&c, 0);
816 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
827 AC_DEFUN([LC_TASK_CLENV_STORE],
829 AC_MSG_CHECKING([if we can store cl_env in task_struct])
830 if test x$have_task_clenv_store != xyes ; then
831 LC_TASK_CLENV_TUX_INFO
837 AC_DEFUN([LC_S_TIME_GRAN],
838 [AC_MSG_CHECKING([if super block has s_time_gran member])
839 LB_LINUX_TRY_COMPILE([
840 #include <linux/fs.h>
842 struct super_block sb;
844 return sb.s_time_gran;
847 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
853 AC_DEFUN([LC_SB_TIME_GRAN],
854 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
855 LB_LINUX_TRY_COMPILE([
856 #include <linux/fs.h>
858 return get_sb_time_gran(NULL);
861 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
869 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
870 AC_DEFUN([LC_RW_TREE_LOCK],
871 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
872 tmp_flags="$EXTRA_KCFLAGS"
873 EXTRA_KCFLAGS="-Werror"
874 LB_LINUX_TRY_COMPILE([
875 #include <linux/fs.h>
877 struct address_space a;
879 write_lock(&a.tree_lock);
882 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
886 EXTRA_KCFLAGS="$tmp_flags"
889 # LC_EXPORT_SYNCHRONIZE_RCU
890 # after 2.6.12 synchronize_rcu is preferred over synchronize_kernel
891 AC_DEFUN([LC_EXPORT_SYNCHRONIZE_RCU],
892 [LB_CHECK_SYMBOL_EXPORT([synchronize_rcu],
893 [kernel/rcupdate.c],[
894 AC_DEFINE(HAVE_SYNCHRONIZE_RCU, 1,
895 [in 2.6.12 synchronize_rcu preferred over synchronize_kernel])
903 # after 2.6.15 inode have i_mutex intead of i_sem
904 AC_DEFUN([LC_INODE_I_MUTEX],
905 [AC_MSG_CHECKING([if inode has i_mutex ])
906 LB_LINUX_TRY_COMPILE([
907 #include <linux/mutex.h>
908 #include <linux/fs.h>
913 mutex_unlock(&i.i_mutex);
916 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
917 [after 2.6.15 inode have i_mutex intead of i_sem])
925 # LC_SECURITY_PLUG # for SLES10 SP2
926 # check security plug in sles10 sp2 kernel
927 AC_DEFUN([LC_SECURITY_PLUG],
928 [AC_MSG_CHECKING([If kernel has security plug support])
929 LB_LINUX_TRY_COMPILE([
930 #include <linux/fs.h>
932 struct dentry *dentry;
933 struct vfsmount *mnt;
936 notify_change(dentry, mnt, iattr);
939 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
940 [SLES10 SP2 use extra parameter in vfs])
948 # inode have i_private field since 2.6.17
949 AC_DEFUN([LC_INODE_IPRIVATE],
950 [AC_MSG_CHECKING([if inode has a i_private field])
951 LB_LINUX_TRY_COMPILE([
952 #include <linux/fs.h>
958 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
959 [struct inode has i_private field])
966 # after 2.6.17 dquote use mutex instead if semaphore
967 AC_DEFUN([LC_DQUOTOFF_MUTEX],
968 [AC_MSG_CHECKING([use dqonoff_mutex])
969 LB_LINUX_TRY_COMPILE([
970 #include <linux/mutex.h>
971 #include <linux/fs.h>
972 #include <linux/quota.h>
974 struct quota_info dq;
976 mutex_unlock(&dq.dqonoff_mutex);
979 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
980 [after 2.6.17 dquote use mutex instead if semaphore])
989 # 2.6.18 don't export nr_pagecahe
990 AC_DEFUN([LC_NR_PAGECACHE],
991 [AC_MSG_CHECKING([kernel export nr_pagecache])
992 LB_LINUX_TRY_COMPILE([
993 #include <linux/pagemap.h>
995 return atomic_read(&nr_pagecache);
998 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
999 [is kernel export nr_pagecache])
1006 # LC_STATFS_DENTRY_PARAM
1007 # starting from 2.6.18 linux kernel uses dentry instead of
1008 # super_block for first vfs_statfs argument
1010 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
1011 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
1012 LB_LINUX_TRY_COMPILE([
1013 #include <linux/fs.h>
1015 int vfs_statfs(struct dentry *, struct kstatfs *);
1017 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
1018 [first parameter of vfs_statfs is dentry])
1019 AC_MSG_RESULT([yes])
1027 # starting from 2.6.18 kernel don't export do_kern_mount
1028 # and want to use vfs_kern_mount instead.
1030 AC_DEFUN([LC_VFS_KERN_MOUNT],
1031 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
1032 LB_LINUX_TRY_COMPILE([
1033 #include <linux/mount.h>
1035 vfs_kern_mount(NULL, 0, NULL, NULL);
1037 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
1038 [vfs_kern_mount exist in kernel])
1039 AC_MSG_RESULT([yes])
1046 # LC_INVALIDATEPAGE_RETURN_INT
1047 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
1049 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
1050 [AC_MSG_CHECKING([invalidatepage has return int])
1051 LB_LINUX_TRY_COMPILE([
1052 #include <linux/buffer_head.h>
1054 int rc = block_invalidatepage(NULL, 0);
1057 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
1058 [Define if return type of invalidatepage should be int])
1064 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
1065 # after 2.6.18 umount_begin has different parameters
1066 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
1067 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
1068 tmp_flags="$EXTRA_KCFLAGS"
1069 EXTRA_KCFLAGS="-Werror"
1070 LB_LINUX_TRY_COMPILE([
1071 #include <linux/fs.h>
1074 static void cfg_umount_begin (struct vfsmount *v, int flags)
1079 static struct super_operations cfg_super_operations = {
1080 .umount_begin = cfg_umount_begin,
1083 cfg_super_operations.umount_begin(NULL,0);
1086 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
1087 [Define umount_begin need second argument])
1091 EXTRA_KCFLAGS="$tmp_flags"
1095 # after 2.6.18 seq_file has lock intead of sem
1096 AC_DEFUN([LC_SEQ_LOCK],
1097 [AC_MSG_CHECKING([if struct seq_file has lock field])
1098 LB_LINUX_TRY_COMPILE([
1099 #include <linux/seq_file.h>
1101 struct seq_file seq;
1103 mutex_unlock(&seq.lock);
1106 AC_DEFINE(HAVE_SEQ_LOCK, 1,
1107 [after 2.6.18 seq_file has lock intead of sem])
1114 # LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1116 # No standard kernels export this
1118 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1119 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1121 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1122 [filemap_fdatawrite_range is exported by the kernel])
1128 # starting from 2.6.18 the file_operations .flush
1129 # method has a new "fl_owner_t id" parameter
1131 AC_DEFUN([LC_FLUSH_OWNER_ID],
1132 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
1133 LB_LINUX_TRY_COMPILE([
1134 #include <linux/fs.h>
1136 struct file_operations *fops = NULL;
1140 i = fops->flush(NULL, id);
1142 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
1143 [file_operations .flush method has an fl_owner_t id])
1144 AC_MSG_RESULT([yes])
1151 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1153 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1154 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1156 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1157 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1158 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1159 [exported invalidate_mapping_pages])],
1160 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1161 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1162 [exported invalidate_inode_pages])], [
1163 AC_MSG_ERROR([no way to invalidate pages])
1169 # LC_EXT4_DISCARD_PREALLOCATIONS
1171 AC_DEFUN([LC_EXT4_DISCARD_PREALLOCATIONS],
1172 [AC_MSG_CHECKING([if ext4_discard_preallocatoins defined])
1173 tmp_flags="$EXTRA_KCFLAGS"
1174 EXTRA_KCFLAGS="-I$LINUX/fs"
1175 LB_LINUX_TRY_COMPILE([
1176 #include <ext4/ext4.h>
1179 ext4_discard_preallocations(&i);
1182 AC_DEFINE(LDISKFS_DISCARD_PREALLOCATIONS, 1,
1183 [ext4_discard_preacllocations defined])
1187 EXTRA_KCFLAGS="$tmp_flags"
1191 # LC_EXT_INSERT_EXTENT_WITH_5ARGS
1193 AC_DEFUN([LC_EXT_INSERT_EXTENT_WITH_5ARGS],
1194 [AC_MSG_CHECKING([ext4_ext_insert_extent needs 5 arguments])
1195 tmp_flags="$EXTRA_KCFLAGS"
1196 EXTRA_KCFLAGS="-I$LINUX/fs"
1197 LB_LINUX_TRY_COMPILE([
1198 #include <ext4/ext4_extents.h>
1200 ext4_ext_insert_extent(NULL, NULL, NULL, NULL, 0);
1202 AC_DEFINE([EXT_INSERT_EXTENT_WITH_5ARGS], 1,
1203 [ext4_ext_insert_exent needs 5 arguments])
1204 AC_MSG_RESULT([yes])
1208 EXTRA_KCFLAGS="$tmp_flags"
1211 #2.6.18 + RHEL5 (fc6)
1213 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
1214 AC_DEFUN([LC_PG_FS_MISC],
1215 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1216 LB_LINUX_TRY_COMPILE([
1217 #include <linux/mm.h>
1218 #include <linux/page-flags.h>
1221 #error PG_fs_misc not defined in kernel
1225 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1226 [is kernel have PG_fs_misc])
1232 # RHEL5 PageChecked and SetPageChecked defined
1233 AC_DEFUN([LC_PAGE_CHECKED],
1234 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1235 LB_LINUX_TRY_COMPILE([
1236 #include <linux/autoconf.h>
1237 #ifdef HAVE_LINUX_MMTYPES_H
1238 #include <linux/mm_types.h>
1240 #include <linux/page-flags.h>
1244 /* before 2.6.26 this define*/
1246 /* 2.6.26 use function instead of define for it */
1252 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1253 [does kernel have PageChecked and SetPageChecked])
1262 # If we have fiemap.h
1263 # after 2.6.27 use fiemap.h in include/linux
1265 AC_DEFUN([LC_LINUX_FIEMAP_H],
1266 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1267 AC_MSG_CHECKING([if fiemap.h can be compiled])
1268 LB_LINUX_TRY_COMPILE([
1269 #include <linux/types.h>
1270 #include <linux/fiemap.h>
1272 AC_MSG_RESULT([yes])
1273 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1283 # 2.6.19 API changes
1284 # inode don't have i_blksize field
1285 AC_DEFUN([LC_INODE_BLKSIZE],
1286 [AC_MSG_CHECKING([inode has i_blksize field])
1287 LB_LINUX_TRY_COMPILE([
1288 #include <linux/fs.h>
1294 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1295 [struct inode has i_blksize field])
1301 # LC_VFS_READDIR_U64_INO
1302 # 2.6.19 use u64 for inode number instead of inode_t
1303 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1304 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1305 tmp_flags="$EXTRA_KCFLAGS"
1306 EXTRA_KCFLAGS="-Werror"
1307 LB_LINUX_TRY_COMPILE([
1308 #include <linux/fs.h>
1309 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1310 u64 ino, unsigned int d_type)
1317 filter = fillonedir;
1321 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1322 [if vfs_readdir need 64bit inode number])
1326 EXTRA_KCFLAGS="$tmp_flags"
1330 # 2.6.19 replaced writev with aio_write
1331 AC_DEFUN([LC_FILE_WRITEV],
1332 [AC_MSG_CHECKING([writev in fops])
1333 LB_LINUX_TRY_COMPILE([
1334 #include <linux/fs.h>
1336 struct file_operations *fops = NULL;
1337 fops->writev = NULL;
1340 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1348 # 2.6.19 replaced readv with aio_read
1349 AC_DEFUN([LC_FILE_READV],
1350 [AC_MSG_CHECKING([readv in fops])
1351 LB_LINUX_TRY_COMPILE([
1352 #include <linux/fs.h>
1354 struct file_operations *fops = NULL;
1358 AC_DEFINE(HAVE_FILE_READV, 1,
1367 # LC_CANCEL_DIRTY_PAGE
1368 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
1369 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1370 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1371 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
1372 # backport is broken, so ignore it
1373 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
1374 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
1377 LB_LINUX_TRY_COMPILE([
1378 #include <linux/mm.h>
1379 #include <linux/page-flags.h>
1381 cancel_dirty_page(NULL, 0);
1384 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1385 [kernel has cancel_dirty_page instead of clear_page_dirty])
1392 # raid5-zerocopy patch
1397 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1398 # it support constant page, which means the page won't be modified during the
1401 AC_DEFUN([LC_PAGE_CONSTANT],
1402 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1403 LB_LINUX_TRY_COMPILE([
1404 #include <linux/mm.h>
1405 #include <linux/page-flags.h>
1408 #error "Have no raid5 zcopy patch"
1412 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1420 # 2.6.22 lost second parameter for invalidate_bdev
1421 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1422 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1423 LB_LINUX_TRY_COMPILE([
1424 #include <linux/buffer_head.h>
1426 invalidate_bdev(NULL,0);
1428 AC_MSG_RESULT([yes])
1429 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1430 [invalidate_bdev has second argument])
1437 # check for crypto API
1439 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1440 [AC_MSG_CHECKING([if kernel has block cipher support])
1441 LB_LINUX_TRY_COMPILE([
1442 #include <linux/err.h>
1443 #include <linux/crypto.h>
1445 struct crypto_blkcipher *tfm;
1446 tfm = crypto_alloc_blkcipher("aes", 0, 0 );
1448 AC_MSG_RESULT([yes])
1449 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1456 # check for struct hash_desc
1458 AC_DEFUN([LC_STRUCT_HASH_DESC],
1459 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1460 LB_LINUX_TRY_COMPILE([
1461 #include <linux/err.h>
1462 #include <linux/crypto.h>
1464 struct hash_desc foo;
1466 AC_MSG_RESULT([yes])
1467 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1474 # check for struct blkcipher_desc
1476 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1477 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1478 LB_LINUX_TRY_COMPILE([
1479 #include <linux/err.h>
1480 #include <linux/crypto.h>
1482 struct blkcipher_desc foo;
1484 AC_MSG_RESULT([yes])
1485 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1492 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1494 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1495 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1496 LB_LINUX_TRY_COMPILE([
1497 #include <linux/fs.h>
1499 int v = FS_RENAME_DOES_D_MOVE;
1501 AC_MSG_RESULT([yes])
1502 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1510 # 2.6.23 have return type 'void' for unregister_blkdev
1511 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1512 [AC_MSG_CHECKING([if unregister_blkdev return int])
1513 LB_LINUX_TRY_COMPILE([
1514 #include <linux/fs.h>
1516 int i = unregister_blkdev(0,NULL);
1518 AC_MSG_RESULT([yes])
1519 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1520 [unregister_blkdev return int])
1526 # 2.6.23 change .sendfile to .splice_read
1527 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1528 [AC_MSG_CHECKING([if kernel has .splice_read])
1529 LB_LINUX_TRY_COMPILE([
1530 #include <linux/fs.h>
1532 struct file_operations file;
1534 file.splice_read = NULL;
1536 AC_MSG_RESULT([yes])
1537 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1538 [kernel has .slice_read])
1544 # 2.6.23 change .sendfile to .splice_read
1545 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1546 AC_DEFUN([LC_KERNEL_SENDFILE],
1547 [AC_MSG_CHECKING([if kernel has .sendfile])
1548 LB_LINUX_TRY_COMPILE([
1549 #include <linux/fs.h>
1551 struct file_operations file;
1553 file.sendfile = NULL;
1555 AC_MSG_RESULT([yes])
1556 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1557 [kernel has .sendfile])
1563 # 2.6.23 extract nfs export related data into exportfs.h
1564 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1565 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1566 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1567 [kernel has include/exportfs.h])
1573 # 2.6.23 has new page fault handling API
1574 AC_DEFUN([LC_VM_OP_FAULT],
1575 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1576 LB_LINUX_TRY_COMPILE([
1577 #include <linux/mm.h>
1579 struct vm_operations_struct op;
1583 AC_MSG_RESULT([yes])
1584 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1585 [kernel has .fault in vm_operation_struct])
1591 # 2.6.23 add code to wait other users to complete before removing procfs entry
1592 AC_DEFUN([LC_PROCFS_USERS],
1593 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1594 LB_LINUX_TRY_COMPILE([
1595 #include <linux/proc_fs.h>
1597 struct proc_dir_entry pde;
1601 AC_MSG_RESULT([yes])
1602 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1603 [kernel has pde_users member in procfs entry struct])
1609 # 2.6.23 exports exportfs_decode_fh
1610 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1611 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1612 [fs/exportfs/expfs.c],[
1613 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1614 [exportfs_decode_fh has been export])
1621 # 2.6.24 need linux/mm_types.h included
1622 AC_DEFUN([LC_HAVE_MMTYPES_H],
1623 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1624 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1625 [kernel has include/mm_types.h])
1631 # 2.6.24 has bio_endio with 2 args
1632 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1633 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1634 LB_LINUX_TRY_COMPILE([
1635 #include <linux/bio.h>
1639 AC_MSG_RESULT([yes])
1640 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1641 [kernel has bio_endio with 2 args])
1647 # 2.6.24 has new members in exports struct.
1648 AC_DEFUN([LC_FH_TO_DENTRY],
1649 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1650 LB_LINUX_TRY_COMPILE([
1651 #ifdef HAVE_LINUX_EXPORTFS_H
1652 #include <linux/exportfs.h>
1654 #include <linux/fs.h>
1657 struct export_operations exp;
1659 exp.fh_to_dentry = NULL;
1661 AC_MSG_RESULT([yes])
1662 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1663 [kernel has .fh_to_dentry member in export_operations struct])
1669 # 2.6.24 removes long aged procfs entry -> deleted member
1670 AC_DEFUN([LC_PROCFS_DELETED],
1671 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1672 LB_LINUX_TRY_COMPILE([
1673 #include <linux/proc_fs.h>
1675 struct proc_dir_entry pde;
1679 AC_MSG_RESULT([yes])
1680 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1681 [kernel has deleted member in procfs entry struct])
1687 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1688 AC_DEFUN([LC_EXPORT_BDI_INIT],
1689 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1690 [mm/backing-dev.c],[
1691 AC_DEFINE(HAVE_BDI_INIT, 1,
1692 [bdi_init/bdi_destroy functions are present])
1699 # 2.6.25 change define to inline
1700 AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
1701 [AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
1702 LB_LINUX_TRY_COMPILE([
1703 #include <linux/backing-dev.h>
1705 #ifndef mapping_cap_writeback_dirty
1706 mapping_cap_writeback_dirty(NULL);
1709 AC_MSG_RESULT([yes])
1710 AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
1711 [kernel have mapping_cap_writeback_dirty])
1719 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1720 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1721 [AC_MSG_CHECKING([fs_struct use path structure])
1722 LB_LINUX_TRY_COMPILE([
1723 #include <asm/atomic.h>
1724 #include <linux/spinlock.h>
1725 #include <linux/fs_struct.h>
1728 struct fs_struct fs;
1732 AC_MSG_RESULT([yes])
1733 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1734 [fs_struct use path structure])
1742 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1743 [AC_MSG_CHECKING([inode_operations->permission has two args])
1744 LB_LINUX_TRY_COMPILE([
1745 #include <linux/fs.h>
1747 struct inode *inode;
1749 inode->i_op->permission(NULL,0);
1751 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1752 [inode_operations->permission has two args])
1753 AC_MSG_RESULT([yes])
1759 # 2.6.27 has file_remove_suid instead of remove_suid
1760 AC_DEFUN([LC_FILE_REMOVE_SUID],
1761 [AC_MSG_CHECKING([kernel has file_remove_suid])
1762 LB_LINUX_TRY_COMPILE([
1763 #include <linux/fs.h>
1765 file_remove_suid(NULL);
1767 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1768 [kernel have file_remove_suid])
1769 AC_MSG_RESULT([yes])
1775 # 2.6.27 have new page locking API
1776 AC_DEFUN([LC_TRYLOCKPAGE],
1777 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1778 LB_LINUX_TRY_COMPILE([
1779 #include <linux/pagemap.h>
1783 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1784 [kernel uses trylock_page for page lock])
1785 AC_MSG_RESULT([yes])
1791 # 2.6.27 removed the read_inode from super_operations.
1792 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1793 [AC_MSG_CHECKING([super_operations has a read_inode field])
1794 LB_LINUX_TRY_COMPILE([
1795 #include <linux/fs.h>
1797 struct super_operations *sop;
1798 sop->read_inode(NULL);
1800 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1801 [super_operations has a read_inode])
1802 AC_MSG_RESULT([yes])
1808 # 2.6.27 has inode_permission instead of permisson
1809 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1810 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1812 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1813 [inode_permission is exported by the kernel])
1818 # 2.6.27 use 5th parameter in quota_on for remount.
1819 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1820 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1821 LB_LINUX_TRY_COMPILE([
1822 #include <linux/quota.h>
1824 struct quotactl_ops *qop;
1825 qop->quota_on(NULL, 0, 0, NULL, 0);
1827 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1828 [quota_on needs 5 paramters])
1829 AC_MSG_RESULT([yes])
1835 # 2.6.27 use 3th parameter in quota_off for remount.
1836 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1837 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1838 LB_LINUX_TRY_COMPILE([
1839 #include <linux/quota.h>
1841 struct quotactl_ops *qop;
1842 qop->quota_off(NULL, 0, 0);
1844 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1845 [quota_off needs 3 paramters])
1846 AC_MSG_RESULT([yes])
1852 # 2.6.27 has vfs_dq_off inline function.
1853 AC_DEFUN([LC_VFS_DQ_OFF],
1854 [AC_MSG_CHECKING([vfs_dq_off is defined])
1855 LB_LINUX_TRY_COMPILE([
1856 #include <linux/quotaops.h>
1858 vfs_dq_off(NULL, 0);
1860 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1861 AC_MSG_RESULT([yes])
1867 # LC_LOCK_MAP_ACQUIRE
1868 # after 2.6.27 lock_map_acquire replaces lock_acquire
1869 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1870 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1871 LB_LINUX_TRY_COMPILE([
1872 #include <linux/lockdep.h>
1874 lock_map_acquire(NULL);
1877 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1878 [lock_map_acquire is defined])
1884 # 2.6.27.15-2 sles11
1886 # 2.6.27 sles11 remove the bi_hw_segments
1887 AC_DEFUN([LC_BI_HW_SEGMENTS],
1888 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1889 LB_LINUX_TRY_COMPILE([
1890 #include <linux/bio.h>
1893 io.bi_hw_segments = 0;
1895 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1896 [struct bio has a bi_hw_segments field])
1897 AC_MSG_RESULT([yes])
1904 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1905 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1906 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1907 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1908 AC_DEFINE(HAVE_QUOTAIO_H, 1,
1909 [kernel has include/linux/quotaio_v2.h])
1910 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1911 AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1912 [kernel has fs/quotaio_v1.h])
1913 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1914 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1915 [kernel has fs/quota/quotaio_v2.h])
1923 # sles10 sp2 need 5 parameter for vfs_symlink
1924 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
1925 [AC_MSG_CHECKING([vfs_symlink need 5 parameter])
1926 LB_LINUX_TRY_COMPILE([
1927 #include <linux/fs.h>
1929 struct inode *dir = NULL;
1930 struct dentry *dentry = NULL;
1931 struct vfsmount *mnt = NULL;
1932 const char * path = NULL;
1933 vfs_symlink(dir, dentry, mnt, path, 0);
1935 AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
1936 [vfs_symlink need 5 parameteres])
1937 AC_MSG_RESULT([yes])
1943 # 2.6.27 sles11 has sb_any_quota_active
1944 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1945 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1946 LB_LINUX_TRY_COMPILE([
1947 #include <linux/quotaops.h>
1949 sb_any_quota_active(NULL);
1951 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1952 [Kernel has a sb_any_quota_active])
1953 AC_MSG_RESULT([yes])
1959 # 2.6.27 sles11 has sb_has_quota_active
1960 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1961 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1962 LB_LINUX_TRY_COMPILE([
1963 #include <linux/quotaops.h>
1965 sb_has_quota_active(NULL, 0);
1967 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1968 [Kernel has a sb_has_quota_active])
1969 AC_MSG_RESULT([yes])
1977 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1978 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1979 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1980 LB_LINUX_TRY_COMPILE([
1981 #include <linux/blkdev.h>
1983 blk_queue_logical_block_size(NULL, 0);
1986 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1987 [blk_queue_logical_block_size is defined])
1995 # 2.6.32 add a limits member in struct request_queue.
1996 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1997 [AC_MSG_CHECKING([if request_queue has a limits field])
1998 LB_LINUX_TRY_COMPILE([
1999 #include <linux/blkdev.h>
2001 struct request_queue rq;
2002 rq.limits.io_min = 0;
2005 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
2006 [request_queue has a limits field])
2012 # 2.6.32 has bdi_register() functions.
2013 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
2014 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
2015 [mm/backing-dev.c],[
2016 AC_DEFINE(HAVE_BDI_REGISTER, 1,
2017 [bdi_register function is present])
2022 # 2.6.32 add s_bdi for super block
2023 AC_DEFUN([LC_SB_BDI],
2024 [AC_MSG_CHECKING([if super_block has s_bdi field])
2025 LB_LINUX_TRY_COMPILE([
2026 #include <linux/fs.h>
2028 struct super_block sb;
2032 AC_DEFINE(HAVE_SB_BDI, 1,
2033 [super_block has s_bdi field])
2039 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
2040 # check blk_queue_max_sectors and use it until disappear.
2041 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
2042 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
2043 LB_LINUX_TRY_COMPILE([
2044 #include <linux/blkdev.h>
2046 blk_queue_max_sectors(NULL, 0);
2049 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
2050 [blk_queue_max_sectors is defined])
2056 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
2057 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
2058 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
2059 LB_LINUX_TRY_COMPILE([
2060 #include <linux/blkdev.h>
2062 blk_queue_max_segments(NULL, 0);
2065 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
2066 [blk_queue_max_segments is defined])
2073 # LC_EXT4_SINGLEDATA_TRANS_BLOCKS_SB
2075 AC_DEFUN([LC_EXT4_SINGLEDATA_TRANS_BLOCKS_SB],
2076 [AC_MSG_CHECKING([if EXT4_SINGLEDATA_TRANS_BLOCKS takes the sb as argument])
2077 tmp_flags="$EXTRA_KCFLAGS"
2078 EXTRA_KCFLAGS="-I$LINUX/fs"
2079 LB_LINUX_TRY_COMPILE([
2080 #include <ext4/ext4.h>
2081 #include <ext4/ext4_jbd2.h>
2083 struct super_block sb;
2084 EXT4_SINGLEDATA_TRANS_BLOCKS(&sb);
2087 AC_DEFINE(LDISKFS_SINGLEDATA_TRANS_BLOCKS_HAS_SB, 1,
2088 [EXT4_SINGLEDATA_TRANS_BLOCKS takes sb as argument])
2092 EXTRA_KCFLAGS="$tmp_flags"
2096 # LC_WALK_SPACE_HAS_DATA_SEM
2098 # 2.6.32 ext4_ext_walk_space() takes i_data_sem internally.
2100 AC_DEFUN([LC_WALK_SPACE_HAS_DATA_SEM],
2101 [AC_MSG_CHECKING([if ext4_ext_walk_space() takes i_data_sem])
2102 WALK_SPACE_DATA_SEM="$(awk 'BEGIN { in_walk_space = 0 } \
2103 /^int ext4_ext_walk_space\(/ { in_walk_space = 1 } \
2104 /^}/ { if (in_walk_space) in_walk_space = 0 } \
2105 /i_data_sem/ { if (in_walk_space) { print("yes"); exit } }' \
2106 $LINUX/fs/ext4/extents.c)"
2107 if test x"$WALK_SPACE_DATA_SEM" == xyes ; then
2108 AC_DEFINE(WALK_SPACE_HAS_DATA_SEM, 1,
2109 [ext4_ext_walk_space takes i_data_sem])
2110 AC_MSG_RESULT([yes])
2119 # Check if kernel has been patched for 64-bit quota limits support.
2120 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
2121 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
2122 # that in the absence of quotaio_v1.h in the kernel headers.
2124 AC_DEFUN([LC_QUOTA64],[
2125 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
2126 tmp_flags="$EXTRA_KCFLAGS"
2127 EXTRA_KCFLAGS="-I$LINUX/fs"
2128 LB_LINUX_TRY_COMPILE([
2129 #include <linux/kernel.h>
2130 #include <linux/fs.h>
2131 #ifdef HAVE_QUOTAIO_H
2132 # include <linux/quotaio_v2.h>
2133 int versions[] = V2_INITQVERSIONS_R1;
2134 struct v2_disk_dqblk_r1 dqblk_r1;
2135 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
2136 # include <quota/quotaio_v2.h>
2137 struct v2r1_disk_dqblk dqblk_r1;
2138 #elif defined(HAVE_FS_QUOTAIO_H)
2139 # include <quotaio_v2.h>
2140 struct v2r1_disk_dqblk dqblk_r1;
2142 #include <linux/quota.h>
2143 int ver = QFMT_VFS_V1;
2146 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
2147 AC_MSG_RESULT([yes])
2149 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
2150 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
2154 EXTRA_KCFLAGS=$tmp_flags
2159 # starting from 2.6.28 kernel replaces d_alloc_anon() with
2160 # d_obtain_alias() for getting anonymous dentries
2162 AC_DEFUN([LC_D_OBTAIN_ALIAS],
2163 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
2164 LB_LINUX_TRY_COMPILE([
2165 #include <linux/dcache.h>
2167 d_obtain_alias(NULL);
2169 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
2170 [d_obtain_alias exist in kernel])
2171 AC_MSG_RESULT([yes])
2181 # Lustre linux kernel checks
2183 AC_DEFUN([LC_PROG_LINUX],
2184 [LC_LUSTRE_VERSION_H
2187 LC_CONFIG_LIBLUSTRE_RECOVERY
2188 LC_CONFIG_HEALTH_CHECK_WRITE
2189 LC_CONFIG_LRU_RESIZE
2191 LC_LLITE_LLOOP_MODULE
2194 LC_EXPORT_TRUNCATE_COMPLETE
2195 LC_EXPORT_TRUNCATE_RANGE
2196 LC_EXPORT_D_REHASH_COND
2197 LC_EXPORT___D_REHASH
2198 LC_EXPORT_NODE_TO_CPUMASK
2200 LC_HEADER_LDISKFS_XATTR
2201 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
2208 LC_POSIX_ACL_XATTR_H
2211 LC_STRUCT_INTENT_FILE
2216 LC_FUNC_HAVE_CAN_SLEEP_ARG
2219 LC_COOKIE_FOLLOW_LINK
2230 LC_EXPORT_SYNCHRONIZE_RCU
2236 LC_SECURITY_PLUG # for SLES10 SP2
2244 LC_STATFS_DENTRY_PARAM
2246 LC_INVALIDATEPAGE_RETURN_INT
2247 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2249 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
2251 if test x$enable_server = xyes ; then
2252 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2254 LC_EXT4_DISCARD_PREALLOCATIONS
2255 LC_EXT_INSERT_EXTENT_WITH_5ARGS
2257 #2.6.18 + RHEL5 (fc6)
2264 LC_VFS_READDIR_U64_INO
2269 LC_CANCEL_DIRTY_PAGE
2271 # raid5-zerocopy patch
2275 LC_INVALIDATE_BDEV_2ARG
2276 LC_ASYNC_BLOCK_CIPHER
2278 LC_STRUCT_BLKCIPHER_DESC
2279 LC_FS_RENAME_DOES_D_MOVE
2282 LC_UNREGISTER_BLKDEV_RETURN_INT
2283 LC_KERNEL_SPLICE_READ
2288 LC_EXPORTFS_DECODE_FH
2298 LC_MAPPING_CAP_WRITEBACK_DIRTY
2301 LC_FS_STRUCT_USE_PATH
2304 LC_INODE_PERMISION_2ARGS
2307 LC_READ_INODE_IN_SBOPS
2308 LC_EXPORT_INODE_PERMISSION
2314 # 2.6.27.15-2 sles11
2317 LC_VFS_SYMLINK_5ARGS
2318 LC_SB_ANY_QUOTA_ACTIVE
2319 LC_SB_HAS_QUOTA_ACTIVE
2322 LC_BLK_QUEUE_LOG_BLK_SIZE
2325 LC_REQUEST_QUEUE_LIMITS
2326 LC_EXPORT_BDI_REGISTER
2328 LC_BLK_QUEUE_MAX_SECTORS
2329 LC_BLK_QUEUE_MAX_SEGMENTS
2330 LC_EXT4_SINGLEDATA_TRANS_BLOCKS_SB
2331 LC_WALK_SPACE_HAS_DATA_SEM
2334 if test x$enable_server = xyes ; then
2335 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2336 LC_FUNC_DEV_SET_RDONLY
2344 # LC_CONFIG_CLIENT_SERVER
2346 # Build client/server sides of Lustre
2348 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2349 [AC_MSG_CHECKING([whether to build Lustre server support])
2350 AC_ARG_ENABLE([server],
2351 AC_HELP_STRING([--disable-server],
2352 [disable Lustre server support]),
2353 [],[enable_server='yes'])
2354 AC_MSG_RESULT([$enable_server])
2356 AC_MSG_CHECKING([whether to build Lustre client support])
2357 AC_ARG_ENABLE([client],
2358 AC_HELP_STRING([--disable-client],
2359 [disable Lustre client support]),
2360 [],[enable_client='yes'])
2361 AC_MSG_RESULT([$enable_client])])
2364 # LC_CONFIG_LIBLUSTRE
2366 # whether to build liblustre
2368 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2369 [AC_MSG_CHECKING([whether to build Lustre library])
2370 AC_ARG_ENABLE([liblustre],
2371 AC_HELP_STRING([--disable-liblustre],
2372 [disable building of Lustre library]),
2373 [],[enable_liblustre=$with_sysio])
2374 AC_MSG_RESULT([$enable_liblustre])
2375 # only build sysio if liblustre is built
2376 with_sysio="$enable_liblustre"
2378 AC_MSG_CHECKING([whether to build liblustre tests])
2379 AC_ARG_ENABLE([liblustre-tests],
2380 AC_HELP_STRING([--enable-liblustre-tests],
2381 [enable liblustre tests, if --disable-tests is used]),
2382 [],[enable_liblustre_tests=$enable_tests])
2383 if test x$enable_liblustre != xyes ; then
2384 enable_liblustre_tests='no'
2386 AC_MSG_RESULT([$enable_liblustre_tests])
2388 AC_MSG_CHECKING([whether to enable liblustre acl])
2389 AC_ARG_ENABLE([liblustre-acl],
2390 AC_HELP_STRING([--disable-liblustre-acl],
2391 [disable ACL support for liblustre]),
2392 [],[enable_liblustre_acl=yes])
2393 AC_MSG_RESULT([$enable_liblustre_acl])
2394 if test x$enable_liblustre_acl = xyes ; then
2395 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2398 # 2.6.29 change prepare/commit_write to write_begin/end
2399 AC_DEFUN([LC_WRITE_BEGIN_END],
2400 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2401 LB_LINUX_TRY_COMPILE([
2402 #include <linux/fs.h>
2403 #include <linux/pagemap.h>
2404 #ifdef HAVE_LINUX_MMTYPES_H
2405 #include <linux/mm_types.h>
2408 struct address_space_operations aops;
2411 aops.write_begin = NULL;
2412 aops.write_end = NULL;
2413 page = grab_cache_page_write_begin(NULL, 0, 0);
2415 AC_MSG_RESULT([yes])
2416 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2417 [kernel has .write_begin/end])
2423 # 2.6.29 blkdev_put has 2 arguments
2424 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2425 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2426 LB_LINUX_TRY_COMPILE([
2427 #include <linux/fs.h>
2429 blkdev_put(NULL, 0);
2431 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2432 [blkdev_put needs 2 paramters])
2433 AC_MSG_RESULT([yes])
2439 # 2.6.29 dentry_open has 4 arguments
2440 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2441 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2442 LB_LINUX_TRY_COMPILE([
2443 #include <linux/fs.h>
2445 dentry_open(NULL, NULL, 0, NULL);
2447 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2448 [dentry_open needs 4 paramters])
2449 AC_MSG_RESULT([yes])
2458 AC_ARG_ENABLE(mpitests,
2459 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2460 [include mpi tests]),
2471 MPICC_WRAPPER=$enableval
2481 if test x$enable_mpitests != xno; then
2482 AC_MSG_CHECKING([whether mpitests can be built])
2490 MPI_Initialized(&flag);
2493 AC_MSG_RESULT([yes])
2500 AC_SUBST(MPICC_WRAPPER)
2502 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2503 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2506 LC_CONFIG_LIBLUSTRE_RECOVERY
2512 # whether to enable quota support global control
2514 AC_DEFUN([LC_CONFIG_QUOTA],
2515 [AC_ARG_ENABLE([quota],
2516 AC_HELP_STRING([--enable-quota],
2517 [enable quota support]),
2518 [],[enable_quota='yes'])
2521 AC_DEFUN([LC_QUOTA],
2525 AC_CHECK_HEADER(sys/quota.h,
2526 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2527 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2533 # whether to enable split support
2535 AC_DEFUN([LC_CONFIG_SPLIT],
2536 [AC_MSG_CHECKING([whether to enable split support])
2537 AC_ARG_ENABLE([split],
2538 AC_HELP_STRING([--enable-split],
2539 [enable split support]),
2540 [],[enable_split='no'])
2541 AC_MSG_RESULT([$enable_split])
2542 if test x$enable_split != xno; then
2543 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2547 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2548 [AC_MSG_CHECKING([tux_info])
2549 LB_LINUX_TRY_COMPILE([
2550 #include <linux/sched.h>
2552 struct task_struct task;
2555 AC_MSG_RESULT([yes])
2556 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2557 have_task_clenv_store='yes'
2564 # LC_LLITE_LLOOP_MODULE
2565 # lloop_llite.ko does not currently work with page sizes
2568 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2569 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2570 LB_LINUX_TRY_COMPILE([
2571 #include <asm/page.h>
2573 #if PAGE_SIZE >= 65536
2574 #error "PAGE_SIZE >= 65536"
2577 enable_llite_lloop_module='yes'
2578 AC_MSG_RESULT([yes])
2580 enable_llite_lloop_module='no'
2588 # other configure checks
2590 AC_DEFUN([LC_CONFIGURE],
2591 [LC_CONFIG_OBD_BUFFER_SIZE
2593 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2594 CFLAGS="$CFLAGS -Werror"
2597 # maximum MDS thread count
2600 # include/liblustre.h
2601 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2603 # liblustre/llite_lib.h
2604 AC_CHECK_HEADERS([xtio.h file.h])
2607 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2610 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2611 AC_CHECK_FUNCS([inet_ntoa])
2613 # libsysio/src/readlink.c
2616 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2617 AC_CHECK_HEADERS([linux/random.h], [], [],
2618 [#ifdef HAVE_LINUX_TYPES_H
2619 # include <linux/types.h>
2624 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2626 # check for -lz support
2630 [AC_CHECK_HEADERS([zlib.h],
2632 AC_DEFINE([HAVE_ADLER], 1,
2633 [support alder32 checksum type])],
2634 [AC_MSG_WARN([No zlib-devel package found,
2635 unable to use adler32 checksum])])],
2636 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2641 AC_ARG_ENABLE([mindf],
2642 AC_HELP_STRING([--enable-mindf],
2643 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2645 if test "$enable_mindf" = "yes" ; then
2646 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2649 AC_ARG_ENABLE([fail_alloc],
2650 AC_HELP_STRING([--disable-fail-alloc],
2651 [disable randomly alloc failure]),
2652 [],[enable_fail_alloc=yes])
2653 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2654 AC_MSG_RESULT([$enable_fail_alloc])
2655 if test x$enable_fail_alloc != xno ; then
2656 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2659 AC_ARG_ENABLE([invariants],
2660 AC_HELP_STRING([--enable-invariants],
2661 [enable invariant checking (cpu intensive)]),
2663 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2664 AC_MSG_RESULT([$enable_invariants])
2665 if test x$enable_invariants = xyes ; then
2666 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2669 AC_ARG_ENABLE([lu_ref],
2670 AC_HELP_STRING([--enable-lu_ref],
2671 [enable lu_ref reference tracking code]),
2673 AC_MSG_CHECKING([whether to track references with lu_ref])
2674 AC_MSG_RESULT([$enable_lu_ref])
2675 if test x$enable_lu_ref = xyes ; then
2676 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2679 AC_ARG_ENABLE([pgstate-track],
2680 AC_HELP_STRING([--enable-pgstate-track],
2681 [enable page state tracking]),
2682 [enable_pgstat_track='yes'],[])
2683 AC_MSG_CHECKING([whether to enable page state tracking])
2684 AC_MSG_RESULT([$enable_pgstat_track])
2685 if test x$enable_pgstat_track = xyes ; then
2686 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2687 [enable page state tracking code])
2694 LC_DENTRY_OPEN_4ARGS
2701 # AM_CONDITIONALS for lustre
2703 AC_DEFUN([LC_CONDITIONALS],
2704 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2705 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2706 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2707 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2708 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2709 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2710 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2711 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2712 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2713 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2714 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2715 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2716 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2717 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2718 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2724 # files that should be generated with AC_OUTPUT
2726 AC_DEFUN([LC_CONFIG_FILES],
2730 lustre/autoconf/Makefile
2731 lustre/conf/Makefile
2732 lustre/contrib/Makefile
2734 lustre/include/Makefile
2735 lustre/include/lustre_ver.h
2736 lustre/include/linux/Makefile
2737 lustre/include/lustre/Makefile
2738 lustre/kernel_patches/targets/2.6-rhel6.target
2739 lustre/kernel_patches/targets/2.6-rhel5.target
2740 lustre/kernel_patches/targets/2.6-sles10.target
2741 lustre/kernel_patches/targets/2.6-sles11.target
2742 lustre/kernel_patches/targets/2.6-oel5.target
2743 lustre/kernel_patches/targets/2.6-fc11.target
2744 lustre/kernel_patches/targets/2.6-fc12.target
2745 lustre/ldlm/Makefile
2747 lustre/fid/autoMakefile
2748 lustre/liblustre/Makefile
2749 lustre/liblustre/tests/Makefile
2750 lustre/liblustre/tests/mpi/Makefile
2751 lustre/llite/Makefile
2752 lustre/llite/autoMakefile
2753 lustre/lclient/Makefile
2755 lustre/lov/autoMakefile
2756 lustre/lvfs/Makefile
2757 lustre/lvfs/autoMakefile
2759 lustre/mdc/autoMakefile
2761 lustre/lmv/autoMakefile
2763 lustre/mds/autoMakefile
2765 lustre/mdt/autoMakefile
2767 lustre/cmm/autoMakefile
2769 lustre/mdd/autoMakefile
2771 lustre/fld/autoMakefile
2772 lustre/obdclass/Makefile
2773 lustre/obdclass/autoMakefile
2774 lustre/obdclass/linux/Makefile
2775 lustre/obdecho/Makefile
2776 lustre/obdecho/autoMakefile
2777 lustre/obdfilter/Makefile
2778 lustre/obdfilter/autoMakefile
2780 lustre/osc/autoMakefile
2782 lustre/ost/autoMakefile
2783 lustre/osd-ldiskfs/Makefile
2784 lustre/osd-ldiskfs/autoMakefile
2786 lustre/mgc/autoMakefile
2788 lustre/mgs/autoMakefile
2789 lustre/ptlrpc/Makefile
2790 lustre/ptlrpc/autoMakefile
2791 lustre/ptlrpc/gss/Makefile
2792 lustre/ptlrpc/gss/autoMakefile
2793 lustre/quota/Makefile
2794 lustre/quota/autoMakefile
2795 lustre/scripts/Makefile
2796 lustre/tests/Makefile
2797 lustre/tests/mpi/Makefile
2798 lustre/utils/Makefile
2799 lustre/utils/gss/Makefile
2800 lustre/obdclass/darwin/Makefile