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])
184 # the pinger is temporary, until we have the recovery node in place
186 AC_DEFUN([LC_CONFIG_PINGER],
187 [AC_MSG_CHECKING([whether to enable pinger support])
188 AC_ARG_ENABLE([pinger],
189 AC_HELP_STRING([--disable-pinger],
190 [disable recovery pinger support]),
191 [],[enable_pinger='yes'])
192 AC_MSG_RESULT([$enable_pinger])
193 if test x$enable_pinger != xno ; then
194 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
201 # do checksum of bulk data between client and OST
203 AC_DEFUN([LC_CONFIG_CHECKSUM],
204 [AC_MSG_CHECKING([whether to enable data checksum support])
205 AC_ARG_ENABLE([checksum],
206 AC_HELP_STRING([--disable-checksum],
207 [disable data checksum support]),
208 [],[enable_checksum='yes'])
209 AC_MSG_RESULT([$enable_checksum])
210 if test x$enable_checksum != xno ; then
211 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
216 # LC_CONFIG_LIBLUSTRE_RECOVERY
218 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
219 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
220 AC_ARG_ENABLE([liblustre-recovery],
221 AC_HELP_STRING([--disable-liblustre-recovery],
222 [disable liblustre recovery support]),
223 [],[enable_liblustre_recovery='yes'])
224 AC_MSG_RESULT([$enable_liblustre_recovery])
225 if test x$enable_liblustre_recovery != xno ; then
226 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
231 # LC_CONFIG_HEALTH_CHECK_WRITE
233 # Turn off the actual write to the disk
235 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
236 [AC_MSG_CHECKING([whether to enable a write with the health check])
237 AC_ARG_ENABLE([health_write],
238 AC_HELP_STRING([--enable-health_write],
239 [enable disk writes when doing health check]),
240 [],[enable_health_write='no'])
241 AC_MSG_RESULT([$enable_health_write])
242 if test x$enable_health_write != xno ; then
243 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
247 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
248 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
249 AC_ARG_ENABLE([lru_resize],
250 AC_HELP_STRING([--enable-lru-resize],
251 [enable lru resize support]),
252 [],[enable_lru_resize='yes'])
253 AC_MSG_RESULT([$enable_lru_resize])
254 if test x$enable_lru_resize != xno; then
255 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
259 # whether to enable quota support(kernel modules)
260 AC_DEFUN([LC_QUOTA_MODULE],
261 [if test x$enable_quota != xno; then
262 LB_LINUX_CONFIG([QUOTA],[
263 enable_quota_module='yes'
264 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
266 enable_quota_module='no'
267 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
272 # truncate_complete_page() was exported from RHEL5/SLES10/SLES11
273 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
274 # delete_from_page_cache() is exported from 2.6.39
275 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
276 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
278 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
279 [kernel export truncate_complete_page])])
280 LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
282 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
283 [kernel export remove_from_page_cache])])
284 LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
286 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
287 [kernel export delete_from_page_cache])])
290 AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
291 [LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
293 AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
294 [kernel export truncate_inode_pages_range])
299 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
300 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
302 AC_DEFINE(HAVE_D_REHASH_COND, 1,
303 [d_rehash_cond is exported by the kernel])
308 AC_DEFUN([LC_EXPORT___D_REHASH],
309 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
311 AC_DEFINE(HAVE___D_REHASH, 1,
312 [__d_rehash is exported by the kernel])
317 # The actual symbol exported varies among architectures, so we need
318 # to check many symbols (but only in the current architecture.) No
319 # matter what symbol is exported, the kernel #defines node_to_cpumask
320 # to the appropriate function and that's what we use.
321 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
322 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
323 [arch/$LINUX_ARCH/mm/numa.c],
324 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
325 [node_to_cpumask is exported by
326 the kernel])]) # x86_64
327 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
328 [arch/$LINUX_ARCH/kernel/smpboot.c],
329 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
330 [node_to_cpumask is exported by
331 the kernel])]) # ia64
332 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
333 [arch/$LINUX_ARCH/kernel/smpboot.c],
334 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
335 [node_to_cpumask is exported by
336 the kernel])]) # i386
340 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
342 # Check for our patched grab_cache_page_nowait_gfp() function
343 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
345 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
346 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
348 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
349 [kernel exports grab_cache_page_nowait_gfp])
351 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
353 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
354 [kernel exports add_to_page_cache_lru])
363 # AIX does not have statfs.f_namelen
365 AC_DEFUN([LC_STRUCT_STATFS],
366 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
367 LB_LINUX_TRY_COMPILE([
368 #include <linux/vfs.h>
374 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
381 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
383 AC_DEFUN([LC_FILEMAP_POPULATE],
384 [AC_MSG_CHECKING([for exported filemap_populate])
385 LB_LINUX_TRY_COMPILE([
386 #include <asm/page.h>
387 #include <linux/mm.h>
389 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
392 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
401 AC_DEFUN([LC_D_ADD_UNIQUE],
402 [AC_MSG_CHECKING([for d_add_unique])
403 LB_LINUX_TRY_COMPILE([
404 #include <linux/dcache.h>
406 d_add_unique(NULL, NULL);
409 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
418 AC_DEFUN([LC_BIT_SPINLOCK_H],
419 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
420 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
421 LB_LINUX_TRY_COMPILE([
422 #include <asm/processor.h>
423 #include <linux/spinlock.h>
424 #include <linux/bit_spinlock.h>
427 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
436 # After 2.6.26 we no longer have xattr_acl.h
438 AC_DEFUN([LC_XATTR_ACL],
439 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
440 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
441 LB_LINUX_TRY_COMPILE([
442 #include <linux/xattr_acl.h>
445 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
454 # After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
456 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
457 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
458 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
459 LB_LINUX_TRY_COMPILE([
460 #include <linux/fs.h>
461 #include <linux/posix_acl_xattr.h>
464 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
475 AC_DEFUN([LC_CONST_ACL_SIZE],
476 [AC_MSG_CHECKING([calc acl size])
478 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"
481 #include <linux/types.h>
484 #define __LINUX_POSIX_ACL_H
486 # ifdef CONFIG_FS_POSIX_ACL
487 # ifdef HAVE_XATTR_ACL
488 # include <linux/xattr_acl.h>
490 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
491 # include <linux/posix_acl_xattr.h>
495 #include <lustre_acl.h>
501 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
502 FILE *f = fopen("acl.size","w+");
503 fprintf(f,"%d", size);
509 acl_size=`cat acl.size`
510 AC_MSG_RESULT([ACL size $acl_size])
511 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
513 AC_ERROR([ACL size can't be computed])
515 AC_MSG_RESULT([can't check ACL size, make it 260])
516 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
523 AC_DEFUN([LC_STRUCT_INTENT_FILE],
524 [AC_MSG_CHECKING([if struct open_intent has a file field])
525 LB_LINUX_TRY_COMPILE([
526 #include <linux/fs.h>
527 #include <linux/namei.h>
529 struct open_intent intent;
533 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
542 AC_DEFUN([LC_CAPA_CRYPTO],
543 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
544 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
546 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
547 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
549 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
550 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
555 # LC_CONFIG_RMTCLIENT
558 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
560 AC_DEFUN([LC_CONFIG_RMTCLIENT],
561 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
562 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
567 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
569 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
570 [AC_MSG_CHECKING([whether to enable gss keyring backend])
571 AC_ARG_ENABLE([gss_keyring],
572 [AC_HELP_STRING([--disable-gss-keyring],
573 [disable gss keyring backend])],
574 [],[enable_gss_keyring='yes'])
575 AC_MSG_RESULT([$enable_gss_keyring])
577 if test x$enable_gss_keyring != xno; then
578 LB_LINUX_CONFIG_IM([KEYS],[],
579 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
581 AC_CHECK_LIB([keyutils], [keyctl_search], [],
582 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
584 AC_DEFINE([HAVE_GSS_KEYRING], [1],
585 [Define this if you enable gss keyring backend])
589 AC_DEFUN([LC_SUNRPC_CACHE],
590 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
591 LB_LINUX_TRY_COMPILE([
592 #include <linux/sunrpc/cache.h>
594 struct cache_head ch;
598 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
604 AC_DEFUN([LC_CONFIG_SUNRPC],
605 [LB_LINUX_CONFIG_IM([SUNRPC],[],
606 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
611 # LC_CONFIG_GSS (default disabled)
613 # Build gss and related tools of Lustre. Currently both kernel and user space
614 # parts are depend on linux platform.
616 AC_DEFUN([LC_CONFIG_GSS],
617 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
619 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
620 [],[enable_gss='no'])
621 AC_MSG_RESULT([$enable_gss])
623 if test x$enable_gss == xyes; then
624 LC_CONFIG_GSS_KEYRING
627 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
629 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
630 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
631 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
632 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
633 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
634 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
635 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
636 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
638 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
639 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
640 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
641 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
642 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
644 AC_SUBST(GSSAPI_LIBS)
651 # LC_FUNC_HAVE_CAN_SLEEP_ARG
653 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
655 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
656 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
657 LB_LINUX_TRY_COMPILE([
658 #include <linux/fs.h>
662 struct file_lock *file_lock;
663 flock_lock_file_wait(file, file_lock, cansleep);
665 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
666 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
676 # rhel4.2 kernel has f_op->flock field
678 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
679 [AC_MSG_CHECKING([if struct file_operations has flock field])
680 LB_LINUX_TRY_COMPILE([
681 #include <linux/fs.h>
683 struct file_operations ll_file_operations_flock;
684 ll_file_operations_flock.flock = NULL;
686 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
687 [struct file_operations has flock field])
694 AC_DEFUN([LC_QUOTA_READ],
695 [AC_MSG_CHECKING([if kernel supports quota_read])
696 LB_LINUX_TRY_COMPILE([
697 #include <linux/fs.h>
699 struct super_operations sp;
700 void *i = (void *)sp.quota_read;
703 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
710 # LC_COOKIE_FOLLOW_LINK
712 # kernel 2.6.13+ ->follow_link returns a cookie
715 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
716 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
717 LB_LINUX_TRY_COMPILE([
718 #include <linux/fs.h>
719 #include <linux/namei.h>
721 struct dentry dentry;
724 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
726 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
736 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
737 # call_rcu takes three parameters.
739 AC_DEFUN([LC_FUNC_RCU],
740 [AC_MSG_CHECKING([if kernel have RCU supported])
741 LB_LINUX_TRY_COMPILE([
742 #include <linux/rcupdate.h>
744 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
747 AC_MSG_CHECKING([if call_rcu takes three parameters])
748 LB_LINUX_TRY_COMPILE([
749 #include <linux/rcupdate.h>
752 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
754 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
765 AC_DEFUN([LC_PERCPU_COUNTER],
766 [AC_MSG_CHECKING([if have struct percpu_counter defined])
767 LB_LINUX_TRY_COMPILE([
768 #include <linux/percpu_counter.h>
770 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
773 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
774 LB_LINUX_TRY_COMPILE([
775 #include <linux/percpu_counter.h>
777 struct percpu_counter c;
778 percpu_counter_init(&c, 0);
780 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
791 AC_DEFUN([LC_TASK_CLENV_STORE],
793 AC_MSG_CHECKING([if we can store cl_env in task_struct])
794 if test x$have_task_clenv_store != xyes ; then
795 LC_TASK_CLENV_TUX_INFO
801 AC_DEFUN([LC_S_TIME_GRAN],
802 [AC_MSG_CHECKING([if super block has s_time_gran member])
803 LB_LINUX_TRY_COMPILE([
804 #include <linux/fs.h>
806 struct super_block sb;
808 return sb.s_time_gran;
811 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
817 AC_DEFUN([LC_SB_TIME_GRAN],
818 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
819 LB_LINUX_TRY_COMPILE([
820 #include <linux/fs.h>
822 return get_sb_time_gran(NULL);
825 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
833 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
834 AC_DEFUN([LC_RW_TREE_LOCK],
835 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
836 tmp_flags="$EXTRA_KCFLAGS"
837 EXTRA_KCFLAGS="-Werror"
838 LB_LINUX_TRY_COMPILE([
839 #include <linux/fs.h>
841 struct address_space a;
843 write_lock(&a.tree_lock);
846 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
850 EXTRA_KCFLAGS="$tmp_flags"
853 # LC_EXPORT_SYNCHRONIZE_RCU
854 # after 2.6.12 synchronize_rcu is preferred over synchronize_kernel
855 AC_DEFUN([LC_EXPORT_SYNCHRONIZE_RCU],
856 [LB_CHECK_SYMBOL_EXPORT([synchronize_rcu],
857 [kernel/rcupdate.c],[
858 AC_DEFINE(HAVE_SYNCHRONIZE_RCU, 1,
859 [in 2.6.12 synchronize_rcu preferred over synchronize_kernel])
867 # after 2.6.15 inode have i_mutex intead of i_sem
868 AC_DEFUN([LC_INODE_I_MUTEX],
869 [AC_MSG_CHECKING([if inode has i_mutex ])
870 LB_LINUX_TRY_COMPILE([
871 #include <linux/mutex.h>
872 #include <linux/fs.h>
877 mutex_unlock(&i.i_mutex);
880 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
881 [after 2.6.15 inode have i_mutex intead of i_sem])
889 # LC_SECURITY_PLUG # for SLES10 SP2
890 # check security plug in sles10 sp2 kernel
891 AC_DEFUN([LC_SECURITY_PLUG],
892 [AC_MSG_CHECKING([If kernel has security plug support])
893 LB_LINUX_TRY_COMPILE([
894 #include <linux/fs.h>
896 struct dentry *dentry;
897 struct vfsmount *mnt;
900 notify_change(dentry, mnt, iattr);
903 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
904 [SLES10 SP2 use extra parameter in vfs])
912 # inode have i_private field since 2.6.17
913 AC_DEFUN([LC_INODE_IPRIVATE],
914 [AC_MSG_CHECKING([if inode has a i_private field])
915 LB_LINUX_TRY_COMPILE([
916 #include <linux/fs.h>
922 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
923 [struct inode has i_private field])
930 # after 2.6.17 dquote use mutex instead if semaphore
931 AC_DEFUN([LC_DQUOTOFF_MUTEX],
932 [AC_MSG_CHECKING([use dqonoff_mutex])
933 LB_LINUX_TRY_COMPILE([
934 #include <linux/mutex.h>
935 #include <linux/fs.h>
936 #include <linux/quota.h>
938 struct quota_info dq;
940 mutex_unlock(&dq.dqonoff_mutex);
943 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
944 [after 2.6.17 dquote use mutex instead if semaphore])
953 # 2.6.18 don't export nr_pagecahe
954 AC_DEFUN([LC_NR_PAGECACHE],
955 [AC_MSG_CHECKING([kernel export nr_pagecache])
956 LB_LINUX_TRY_COMPILE([
957 #include <linux/pagemap.h>
959 return atomic_read(&nr_pagecache);
962 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
963 [is kernel export nr_pagecache])
970 # LC_STATFS_DENTRY_PARAM
971 # starting from 2.6.18 linux kernel uses dentry instead of super_block
972 # for the first parameter of the super_operations->statfs() callback.
975 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
976 [AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
977 tmp_flags="$EXTRA_KCFLAGS"
978 EXTRA_KCFLAGS="-Werror"
979 LB_LINUX_TRY_COMPILE([
980 #include <linux/fs.h>
982 ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
984 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
985 [super_ops.statfs() first parameter is dentry])
990 EXTRA_KCFLAGS="$tmp_flags"
995 # starting from 2.6.18 kernel don't export do_kern_mount
996 # and want to use vfs_kern_mount instead.
998 AC_DEFUN([LC_VFS_KERN_MOUNT],
999 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
1000 LB_LINUX_TRY_COMPILE([
1001 #include <linux/mount.h>
1003 vfs_kern_mount(NULL, 0, NULL, NULL);
1005 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
1006 [vfs_kern_mount exist in kernel])
1007 AC_MSG_RESULT([yes])
1014 # LC_INVALIDATEPAGE_RETURN_INT
1015 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
1017 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
1018 [AC_MSG_CHECKING([invalidatepage has return int])
1019 LB_LINUX_TRY_COMPILE([
1020 #include <linux/buffer_head.h>
1022 int rc = block_invalidatepage(NULL, 0);
1025 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
1026 [Define if return type of invalidatepage should be int])
1032 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
1033 # after 2.6.18 umount_begin has different parameters
1034 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
1035 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
1036 tmp_flags="$EXTRA_KCFLAGS"
1037 EXTRA_KCFLAGS="-Werror"
1038 LB_LINUX_TRY_COMPILE([
1039 #include <linux/fs.h>
1042 static void cfg_umount_begin (struct vfsmount *v, int flags)
1047 static struct super_operations cfg_super_operations = {
1048 .umount_begin = cfg_umount_begin,
1051 cfg_super_operations.umount_begin(NULL,0);
1054 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
1055 [Define umount_begin need second argument])
1059 EXTRA_KCFLAGS="$tmp_flags"
1063 # after 2.6.18 seq_file has lock intead of sem
1064 AC_DEFUN([LC_SEQ_LOCK],
1065 [AC_MSG_CHECKING([if struct seq_file has lock field])
1066 LB_LINUX_TRY_COMPILE([
1067 #include <linux/seq_file.h>
1069 struct seq_file seq;
1071 mutex_unlock(&seq.lock);
1074 AC_DEFINE(HAVE_SEQ_LOCK, 1,
1075 [after 2.6.18 seq_file has lock intead of sem])
1082 # LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1084 # No standard kernels export this
1086 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1087 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1089 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1090 [filemap_fdatawrite_range is exported by the kernel])
1096 # starting from 2.6.18 the file_operations .flush
1097 # method has a new "fl_owner_t id" parameter
1099 AC_DEFUN([LC_FLUSH_OWNER_ID],
1100 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
1101 LB_LINUX_TRY_COMPILE([
1102 #include <linux/fs.h>
1104 struct file_operations *fops = NULL;
1108 i = fops->flush(NULL, id);
1110 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
1111 [file_operations .flush method has an fl_owner_t id])
1112 AC_MSG_RESULT([yes])
1119 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1121 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1122 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1124 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1125 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1126 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1127 [exported invalidate_mapping_pages])],
1128 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1129 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1130 [exported invalidate_inode_pages])], [
1131 AC_MSG_ERROR([no way to invalidate pages])
1136 #2.6.18 + RHEL5 (fc6)
1138 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
1139 AC_DEFUN([LC_PG_FS_MISC],
1140 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1141 LB_LINUX_TRY_COMPILE([
1142 #include <linux/mm.h>
1143 #include <linux/page-flags.h>
1146 #error PG_fs_misc not defined in kernel
1150 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1151 [is kernel have PG_fs_misc])
1157 # RHEL5 PageChecked and SetPageChecked defined
1158 AC_DEFUN([LC_PAGE_CHECKED],
1159 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1160 LB_LINUX_TRY_COMPILE([
1161 #include <linux/mm.h>
1162 #ifdef HAVE_LINUX_MMTYPES_H
1163 #include <linux/mm_types.h>
1165 #include <linux/page-flags.h>
1167 struct page *p = NULL;
1169 /* before 2.6.26 this define*/
1171 /* 2.6.26 use function instead of define for it */
1177 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1178 [does kernel have PageChecked and SetPageChecked])
1187 # If we have fiemap.h
1188 # after 2.6.27 use fiemap.h in include/linux
1190 AC_DEFUN([LC_LINUX_FIEMAP_H],
1191 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1192 AC_MSG_CHECKING([if fiemap.h can be compiled])
1193 LB_LINUX_TRY_COMPILE([
1194 #include <linux/types.h>
1195 #include <linux/fiemap.h>
1197 AC_MSG_RESULT([yes])
1198 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1208 # 2.6.19 API changes
1209 # inode don't have i_blksize field
1210 AC_DEFUN([LC_INODE_BLKSIZE],
1211 [AC_MSG_CHECKING([inode has i_blksize field])
1212 LB_LINUX_TRY_COMPILE([
1213 #include <linux/fs.h>
1219 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1220 [struct inode has i_blksize field])
1227 # 2.6.19 replaced writev with aio_write
1228 AC_DEFUN([LC_FILE_WRITEV],
1229 [AC_MSG_CHECKING([writev in fops])
1230 LB_LINUX_TRY_COMPILE([
1231 #include <linux/fs.h>
1233 struct file_operations *fops = NULL;
1234 fops->writev = NULL;
1237 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1245 # 2.6.19 replaced readv with aio_read
1246 AC_DEFUN([LC_FILE_READV],
1247 [AC_MSG_CHECKING([readv in fops])
1248 LB_LINUX_TRY_COMPILE([
1249 #include <linux/fs.h>
1251 struct file_operations *fops = NULL;
1255 AC_DEFINE(HAVE_FILE_READV, 1,
1264 # LC_CANCEL_DIRTY_PAGE
1265 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
1266 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1267 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1268 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
1269 # backport is broken, so ignore it
1270 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
1271 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
1274 LB_LINUX_TRY_COMPILE([
1275 #include <linux/mm.h>
1276 #include <linux/page-flags.h>
1278 cancel_dirty_page(NULL, 0);
1281 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1282 [kernel has cancel_dirty_page instead of clear_page_dirty])
1289 # raid5-zerocopy patch
1294 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1295 # it support constant page, which means the page won't be modified during the
1298 AC_DEFUN([LC_PAGE_CONSTANT],
1299 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1300 LB_LINUX_TRY_COMPILE([
1301 #include <linux/mm.h>
1302 #include <linux/page-flags.h>
1305 #error "Have no raid5 zcopy patch"
1309 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1317 # 2.6.22 lost second parameter for invalidate_bdev
1318 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1319 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1320 LB_LINUX_TRY_COMPILE([
1321 #include <linux/buffer_head.h>
1323 invalidate_bdev(NULL,0);
1325 AC_MSG_RESULT([yes])
1326 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1327 [invalidate_bdev has second argument])
1334 # check for crypto API
1336 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1337 [AC_MSG_CHECKING([if kernel has block cipher support])
1338 LB_LINUX_TRY_COMPILE([
1339 #include <linux/err.h>
1340 #include <linux/crypto.h>
1342 struct crypto_blkcipher *tfm;
1343 tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
1345 AC_MSG_RESULT([yes])
1346 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1353 # check for struct hash_desc
1355 AC_DEFUN([LC_STRUCT_HASH_DESC],
1356 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1357 LB_LINUX_TRY_COMPILE([
1358 #include <linux/err.h>
1359 #include <linux/crypto.h>
1361 struct hash_desc foo;
1363 AC_MSG_RESULT([yes])
1364 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1371 # check for struct blkcipher_desc
1373 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1374 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1375 LB_LINUX_TRY_COMPILE([
1376 #include <linux/err.h>
1377 #include <linux/crypto.h>
1379 struct blkcipher_desc foo;
1381 AC_MSG_RESULT([yes])
1382 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1389 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1391 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1392 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1393 LB_LINUX_TRY_COMPILE([
1394 #include <linux/fs.h>
1396 int v = FS_RENAME_DOES_D_MOVE;
1398 AC_MSG_RESULT([yes])
1399 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1407 # 2.6.23 have return type 'void' for unregister_blkdev
1408 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1409 [AC_MSG_CHECKING([if unregister_blkdev return int])
1410 LB_LINUX_TRY_COMPILE([
1411 #include <linux/fs.h>
1413 int i = unregister_blkdev(0,NULL);
1415 AC_MSG_RESULT([yes])
1416 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1417 [unregister_blkdev return int])
1423 # 2.6.23 change .sendfile to .splice_read
1424 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1425 [AC_MSG_CHECKING([if kernel has .splice_read])
1426 LB_LINUX_TRY_COMPILE([
1427 #include <linux/fs.h>
1429 struct file_operations file;
1431 file.splice_read = NULL;
1433 AC_MSG_RESULT([yes])
1434 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1435 [kernel has .slice_read])
1441 # 2.6.23 change .sendfile to .splice_read
1442 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1443 AC_DEFUN([LC_KERNEL_SENDFILE],
1444 [AC_MSG_CHECKING([if kernel has .sendfile])
1445 LB_LINUX_TRY_COMPILE([
1446 #include <linux/fs.h>
1448 struct file_operations file;
1450 file.sendfile = NULL;
1452 AC_MSG_RESULT([yes])
1453 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1454 [kernel has .sendfile])
1460 # 2.6.23 extract nfs export related data into exportfs.h
1461 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1462 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1463 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1464 [kernel has include/exportfs.h])
1470 # 2.6.23 has new page fault handling API
1471 AC_DEFUN([LC_VM_OP_FAULT],
1472 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1473 LB_LINUX_TRY_COMPILE([
1474 #include <linux/mm.h>
1476 struct vm_operations_struct op;
1480 AC_MSG_RESULT([yes])
1481 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1482 [kernel has .fault in vm_operation_struct])
1488 # 2.6.23 add code to wait other users to complete before removing procfs entry
1489 AC_DEFUN([LC_PROCFS_USERS],
1490 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1491 LB_LINUX_TRY_COMPILE([
1492 #include <linux/proc_fs.h>
1494 struct proc_dir_entry pde;
1498 AC_MSG_RESULT([yes])
1499 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1500 [kernel has pde_users member in procfs entry struct])
1506 # 2.6.23 exports exportfs_decode_fh
1507 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1508 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1509 [fs/exportfs/expfs.c],[
1510 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1511 [exportfs_decode_fh has been export])
1518 # 2.6.24 need linux/mm_types.h included
1519 AC_DEFUN([LC_HAVE_MMTYPES_H],
1520 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1521 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1522 [kernel has include/mm_types.h])
1528 # 2.6.24 has bio_endio with 2 args
1529 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1530 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1531 LB_LINUX_TRY_COMPILE([
1532 #include <linux/bio.h>
1536 AC_MSG_RESULT([yes])
1537 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1538 [kernel has bio_endio with 2 args])
1544 # 2.6.24 has new members in exports struct.
1545 AC_DEFUN([LC_FH_TO_DENTRY],
1546 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1547 LB_LINUX_TRY_COMPILE([
1548 #include <linux/fs.h>
1549 #ifdef HAVE_LINUX_EXPORTFS_H
1550 #include <linux/exportfs.h>
1553 struct export_operations exp;
1554 memset(exp.fh_to_dentry, 0, sizeof(exp.fh_to_dentry));
1556 AC_MSG_RESULT([yes])
1557 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1558 [kernel has .fh_to_dentry member in export_operations struct])
1564 # 2.6.24 removes long aged procfs entry -> deleted member
1565 AC_DEFUN([LC_PROCFS_DELETED],
1566 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1567 LB_LINUX_TRY_COMPILE([
1568 #include <linux/proc_fs.h>
1570 struct proc_dir_entry pde;
1572 pde.deleted = sizeof(pde);
1574 AC_MSG_RESULT([yes])
1575 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1576 [kernel has deleted member in procfs entry struct])
1582 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1583 AC_DEFUN([LC_EXPORT_BDI_INIT],
1584 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1585 [mm/backing-dev.c],[
1586 AC_DEFINE(HAVE_BDI_INIT, 1,
1587 [bdi_init/bdi_destroy functions are present])
1594 # 2.6.25 change define to inline
1595 AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
1596 [AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
1597 LB_LINUX_TRY_COMPILE([
1598 #include <linux/backing-dev.h>
1600 #ifndef mapping_cap_writeback_dirty
1601 mapping_cap_writeback_dirty(NULL);
1604 AC_MSG_RESULT([yes])
1605 AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
1606 [kernel have mapping_cap_writeback_dirty])
1614 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1615 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1616 [AC_MSG_CHECKING([fs_struct use path structure])
1617 LB_LINUX_TRY_COMPILE([
1618 #include <asm/atomic.h>
1619 #include <linux/spinlock.h>
1620 #include <linux/fs_struct.h>
1623 struct fs_struct fs;
1626 memset(&fs, 0, sizeof(fs));
1628 AC_MSG_RESULT([yes])
1629 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1630 [fs_struct use path structure])
1640 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1641 [AC_MSG_CHECKING([inode_operations->permission has two args])
1642 LB_LINUX_TRY_COMPILE([
1643 #include <linux/fs.h>
1645 struct inode *inode;
1646 inode->i_op->permission(NULL, 0);
1648 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1649 [inode_operations->permission has two args])
1650 AC_MSG_RESULT([yes])
1656 # 2.6.27 has file_remove_suid instead of remove_suid
1657 AC_DEFUN([LC_FILE_REMOVE_SUID],
1658 [AC_MSG_CHECKING([kernel has file_remove_suid])
1659 LB_LINUX_TRY_COMPILE([
1660 #include <linux/fs.h>
1662 file_remove_suid(NULL);
1664 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1665 [kernel have file_remove_suid])
1666 AC_MSG_RESULT([yes])
1672 # 2.6.27 have new page locking API
1673 AC_DEFUN([LC_TRYLOCKPAGE],
1674 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1675 LB_LINUX_TRY_COMPILE([
1676 #include <linux/pagemap.h>
1680 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1681 [kernel uses trylock_page for page lock])
1682 AC_MSG_RESULT([yes])
1688 # 2.6.27 removed the read_inode from super_operations.
1689 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1690 [AC_MSG_CHECKING([super_operations has a read_inode field])
1691 LB_LINUX_TRY_COMPILE([
1692 #include <linux/fs.h>
1694 struct super_operations *sop;
1695 sop->read_inode(NULL);
1697 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1698 [super_operations has a read_inode])
1699 AC_MSG_RESULT([yes])
1705 # 2.6.27 has inode_permission instead of permisson
1706 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1707 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1709 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1710 [inode_permission is exported by the kernel])
1715 # 2.6.27 use 5th parameter in quota_on for remount.
1716 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1717 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1718 LB_LINUX_TRY_COMPILE([
1719 #include <linux/quota.h>
1721 struct quotactl_ops *qop;
1722 qop->quota_on(NULL, 0, 0, NULL, 0);
1724 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1725 [quota_on needs 5 paramters])
1726 AC_MSG_RESULT([yes])
1732 # 2.6.27 use 3th parameter in quota_off for remount.
1733 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1734 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1735 LB_LINUX_TRY_COMPILE([
1736 #include <linux/quota.h>
1738 struct quotactl_ops *qop;
1739 qop->quota_off(NULL, 0, 0);
1741 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1742 [quota_off needs 3 paramters])
1743 AC_MSG_RESULT([yes])
1749 # 2.6.27 has vfs_dq_off inline function.
1750 AC_DEFUN([LC_VFS_DQ_OFF],
1751 [AC_MSG_CHECKING([vfs_dq_off is defined])
1752 LB_LINUX_TRY_COMPILE([
1753 #include <linux/quotaops.h>
1755 vfs_dq_off(NULL, 0);
1757 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1758 AC_MSG_RESULT([yes])
1764 # LC_LOCK_MAP_ACQUIRE
1765 # after 2.6.27 lock_map_acquire replaces lock_acquire
1766 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1767 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1768 LB_LINUX_TRY_COMPILE([
1769 #include <linux/lockdep.h>
1771 lock_map_acquire(NULL);
1774 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1775 [lock_map_acquire is defined])
1781 # 2.6.27.15-2 sles11
1783 # 2.6.27 sles11 remove the bi_hw_segments
1784 AC_DEFUN([LC_BI_HW_SEGMENTS],
1785 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1786 LB_LINUX_TRY_COMPILE([
1787 #include <linux/bio.h>
1790 io.bi_hw_segments = sizeof(io);
1792 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1793 [struct bio has a bi_hw_segments field])
1794 AC_MSG_RESULT([yes])
1801 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1802 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1803 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1804 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1805 AC_DEFINE(HAVE_QUOTAIO_H, 1,
1806 [kernel has include/linux/quotaio_v2.h])
1807 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1808 AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1809 [kernel has fs/quotaio_v1.h])
1810 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1811 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1812 [kernel has fs/quota/quotaio_v2.h])
1820 # sles10 sp2 need 5 parameter for vfs_symlink
1821 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
1822 [AC_MSG_CHECKING([vfs_symlink need 5 parameter])
1823 LB_LINUX_TRY_COMPILE([
1824 #include <linux/fs.h>
1826 struct inode *dir = NULL;
1827 struct dentry *dentry = NULL;
1828 struct vfsmount *mnt = NULL;
1829 const char * path = NULL;
1830 vfs_symlink(dir, dentry, mnt, path, 0);
1832 AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
1833 [vfs_symlink need 5 parameteres])
1834 AC_MSG_RESULT([yes])
1840 # 2.6.27 sles11 has sb_any_quota_active
1841 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1842 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1843 LB_LINUX_TRY_COMPILE([
1844 #include <linux/quotaops.h>
1846 sb_any_quota_active(NULL);
1848 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1849 [Kernel has a sb_any_quota_active])
1850 AC_MSG_RESULT([yes])
1856 # 2.6.27 sles11 has sb_has_quota_active
1857 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1858 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1859 LB_LINUX_TRY_COMPILE([
1860 #include <linux/quotaops.h>
1862 sb_has_quota_active(NULL, 0);
1864 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1865 [Kernel has a sb_has_quota_active])
1866 AC_MSG_RESULT([yes])
1872 # 2.6.27 exported add_to_page_cache_lru.
1873 AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
1874 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1876 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1877 [add_to_page_cache_lru functions are present])
1884 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
1885 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
1886 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
1887 [arch/$LINUX_ARCH/mm/numa.c],
1888 [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
1889 [node_to_cpumask_map is exported by
1890 the kernel])]) # x86_64
1893 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1894 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1895 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1896 LB_LINUX_TRY_COMPILE([
1897 #include <linux/blkdev.h>
1899 blk_queue_logical_block_size(NULL, 0);
1902 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1903 [blk_queue_logical_block_size is defined])
1911 # 2.6.32 add a limits member in struct request_queue.
1912 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1913 [AC_MSG_CHECKING([if request_queue has a limits field])
1914 LB_LINUX_TRY_COMPILE([
1915 #include <linux/blkdev.h>
1917 struct request_queue rq;
1918 rq.limits.io_min = 0;
1921 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1922 [request_queue has a limits field])
1928 # 2.6.32 has bdi_register() functions.
1929 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1930 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1931 [mm/backing-dev.c],[
1932 AC_DEFINE(HAVE_BDI_REGISTER, 1,
1933 [bdi_register function is present])
1938 # 2.6.32 add s_bdi for super block
1939 AC_DEFUN([LC_SB_BDI],
1940 [AC_MSG_CHECKING([if super_block has s_bdi field])
1941 LB_LINUX_TRY_COMPILE([
1942 #include <linux/fs.h>
1944 struct super_block sb;
1948 AC_DEFINE(HAVE_SB_BDI, 1,
1949 [super_block has s_bdi field])
1955 # 2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
1956 AC_DEFUN([LC_BDI_NAME],
1957 [AC_MSG_CHECKING([if backing_device_info has name field])
1958 LB_LINUX_TRY_COMPILE([
1959 #include <linux/blkkdev.h>
1961 struct backing_dev_info bdi;
1965 AC_DEFINE(HAVE_BDI_NAME, 1,
1966 [backing_device_info has name field])
1972 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1973 # check blk_queue_max_sectors and use it until disappear.
1974 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1975 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1976 LB_LINUX_TRY_COMPILE([
1977 #include <linux/blkdev.h>
1979 blk_queue_max_sectors(NULL, 0);
1982 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1983 [blk_queue_max_sectors is defined])
1989 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
1990 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1991 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1992 LB_LINUX_TRY_COMPILE([
1993 #include <linux/blkdev.h>
1995 blk_queue_max_segments(NULL, 0);
1998 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1999 [blk_queue_max_segments is defined])
2008 # Check if kernel has been patched for 64-bit quota limits support.
2009 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
2010 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
2011 # that in the absence of quotaio_v1.h in the kernel headers.
2013 AC_DEFUN([LC_QUOTA64],[
2014 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
2015 tmp_flags="$EXTRA_KCFLAGS"
2016 EXTRA_KCFLAGS="-I$LINUX/fs"
2017 LB_LINUX_TRY_COMPILE([
2018 #include <linux/kernel.h>
2019 #include <linux/fs.h>
2020 #ifdef HAVE_QUOTAIO_H
2021 # include <linux/quotaio_v2.h>
2022 int versions[] = V2_INITQVERSIONS_R1;
2023 struct v2_disk_dqblk_r1 dqblk_r1;
2024 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
2025 # include <quota/quotaio_v2.h>
2026 struct v2r1_disk_dqblk dqblk_r1;
2027 #elif defined(HAVE_FS_QUOTAIO_H)
2028 # include <quotaio_v2.h>
2029 struct v2r1_disk_dqblk dqblk_r1;
2031 #include <linux/quota.h>
2032 int ver = QFMT_VFS_V1;
2035 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
2036 AC_MSG_RESULT([yes])
2038 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
2039 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
2043 EXTRA_KCFLAGS=$tmp_flags
2046 # 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
2047 AC_DEFUN([LC_SET_CPUS_ALLOWED],
2048 [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
2049 LB_LINUX_TRY_COMPILE(
2050 [#include <linux/sched.h>],
2051 [struct task_struct *p = NULL;
2052 cpumask_t mask = { { 0 } };
2053 (void) set_cpus_allowed(p, mask);],
2054 [AC_MSG_RESULT([yes])
2055 AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
2056 [set_cpus_allowed is exported by the kernel])],
2057 [AC_MSG_RESULT([no])] )])
2061 # starting from 2.6.28 kernel replaces d_alloc_anon() with
2062 # d_obtain_alias() for getting anonymous dentries
2064 AC_DEFUN([LC_D_OBTAIN_ALIAS],
2065 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
2066 LB_LINUX_TRY_COMPILE([
2067 #include <linux/dcache.h>
2069 d_obtain_alias(NULL);
2071 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
2072 [d_obtain_alias exist in kernel])
2073 AC_MSG_RESULT([yes])
2080 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
2082 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
2083 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
2084 LB_LINUX_TRY_COMPILE([
2085 #include <asm/atomic.h>
2086 #include <linux/spinlock.h>
2087 #include <linux/fs_struct.h>
2089 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
2091 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
2092 [fs_struct.lock use rwlock])
2093 AC_MSG_RESULT([yes])
2100 # 2.6.36 super_operations add evict_inode method. it hybird of
2101 # delete_inode & clear_inode.
2103 AC_DEFUN([LC_SBOPS_EVICT_INODE],
2104 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
2105 LB_LINUX_TRY_COMPILE([
2106 #include <linux/fs.h>
2108 ((struct super_operations *)0)->evict_inode(NULL);
2110 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
2111 [super_operations.evict_inode() is exist in kernel])
2112 AC_MSG_RESULT([yes])
2119 # 2.6.35 file_operations.fsync taken 2 arguments.
2121 AC_DEFUN([LC_FILE_FSYNC],
2122 [AC_MSG_CHECKING([if file_operations.fsync taken 2 arguments])
2123 LB_LINUX_TRY_COMPILE([
2124 #include <linux/fs.h>
2126 ((struct file_operations *)0)->fsync(NULL, 0);
2128 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
2129 [file_operations.fsync taken 2 arguments])
2130 AC_MSG_RESULT([yes])
2137 # 2.6.38 export blkdev_get_by_dev
2139 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
2140 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
2142 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
2143 [blkdev_get_by_dev is exported by the kernel])
2149 # 2.6.38 vfsmount.mnt_count doesn't use atomic_t
2151 AC_DEFUN([LC_ATOMIC_MNT_COUNT],
2152 [AC_MSG_CHECKING([if vfsmount.mnt_count is atomic_t])
2153 LB_LINUX_TRY_COMPILE([
2154 #include <asm/atomic.h>
2155 #include <linux/fs.h>
2156 #include <linux/mount.h>
2158 ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
2160 AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
2161 [vfsmount.mnt_count is atomic_t])
2162 AC_MSG_RESULT([yes])
2169 # 2.6.38 use path as 4th parameter in quota_on.
2171 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
2172 [AC_MSG_CHECKING([quota_on use path as parameter])
2173 tmp_flags="$EXTRA_KCFLAGS"
2174 EXTRA_KCFLAGS="-Werror"
2175 LB_LINUX_TRY_COMPILE([
2176 #include <linux/fs.h>
2177 #include <linux/quota.h>
2179 ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
2181 AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
2182 [quota_on use path as 4th paramter])
2183 AC_MSG_RESULT([yes])
2187 EXTRA_KCFLAGS="$tmp_flags"
2191 # 2.6.39 remove unplug_fn from request_queue.
2193 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
2194 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
2195 LB_LINUX_TRY_COMPILE([
2196 #include <linux/blkdev.h>
2198 struct request_queue rq;
2199 memset(rq.unplug_fn, 0, sizeof(rq.unplug_fn));
2201 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
2202 [request_queue has unplug_fn field])
2203 AC_MSG_RESULT([yes])
2210 # 2.6.38 generic_permission taken 4 paremater.
2211 # in fact, it means rcu-walk aware permission bring.
2213 AC_DEFUN([LC_GENERIC_PERMISSION],
2214 [AC_MSG_CHECKING([if generic_permission take 4 arguments])
2215 LB_LINUX_TRY_COMPILE([
2216 #include <linux/fs.h>
2218 generic_permission(NULL, 0, 0, NULL);
2220 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
2221 [generic_permission taken 4 arguments])
2222 AC_MSG_RESULT([yes])
2231 # Lustre linux kernel checks
2233 AC_DEFUN([LC_PROG_LINUX],
2234 [LC_LUSTRE_VERSION_H
2237 LC_CONFIG_LIBLUSTRE_RECOVERY
2238 LC_CONFIG_HEALTH_CHECK_WRITE
2239 LC_CONFIG_LRU_RESIZE
2241 LC_LLITE_LLOOP_MODULE
2244 LC_EXPORT_TRUNCATE_COMPLETE
2245 LC_EXPORT_TRUNCATE_RANGE
2246 LC_EXPORT_D_REHASH_COND
2247 LC_EXPORT___D_REHASH
2248 LC_EXPORT_NODE_TO_CPUMASK
2250 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
2257 LC_POSIX_ACL_XATTR_H
2260 LC_STRUCT_INTENT_FILE
2265 LC_FUNC_HAVE_CAN_SLEEP_ARG
2268 LC_COOKIE_FOLLOW_LINK
2279 LC_EXPORT_SYNCHRONIZE_RCU
2285 LC_SECURITY_PLUG # for SLES10 SP2
2293 LC_STATFS_DENTRY_PARAM
2295 LC_INVALIDATEPAGE_RETURN_INT
2296 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2298 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
2300 if test x$enable_server = xyes ; then
2301 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2304 #2.6.18 + RHEL5 (fc6)
2315 LC_CANCEL_DIRTY_PAGE
2317 # raid5-zerocopy patch
2321 LC_INVALIDATE_BDEV_2ARG
2322 LC_ASYNC_BLOCK_CIPHER
2324 LC_STRUCT_BLKCIPHER_DESC
2325 LC_FS_RENAME_DOES_D_MOVE
2328 LC_UNREGISTER_BLKDEV_RETURN_INT
2329 LC_KERNEL_SPLICE_READ
2334 LC_EXPORTFS_DECODE_FH
2344 LC_MAPPING_CAP_WRITEBACK_DIRTY
2347 LC_FS_STRUCT_USE_PATH
2350 LC_INODE_PERMISION_2ARGS
2353 LC_READ_INODE_IN_SBOPS
2354 LC_EXPORT_INODE_PERMISSION
2360 # 2.6.27.15-2 sles11
2363 LC_VFS_SYMLINK_5ARGS
2365 LC_SB_ANY_QUOTA_ACTIVE
2366 LC_SB_HAS_QUOTA_ACTIVE
2367 LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
2370 LC_EXPORT_CPUMASK_OF_NODE
2373 LC_BLK_QUEUE_LOG_BLK_SIZE
2376 LC_REQUEST_QUEUE_LIMITS
2377 LC_EXPORT_BDI_REGISTER
2379 LC_BLK_QUEUE_MAX_SECTORS
2380 LC_BLK_QUEUE_MAX_SEGMENTS
2388 LC_SBOPS_EVICT_INODE
2392 LC_BLKDEV_GET_BY_DEV
2393 LC_GENERIC_PERMISSION
2394 LC_QUOTA_ON_USE_PATH
2397 LC_REQUEST_QUEUE_UNPLUG_FN
2400 if test x$enable_server = xyes ; then
2401 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2402 LC_FUNC_DEV_SET_RDONLY
2409 # LC_CONFIG_CLIENT_SERVER
2411 # Build client/server sides of Lustre
2413 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2414 [AC_MSG_CHECKING([whether to build Lustre server support])
2415 AC_ARG_ENABLE([server],
2416 AC_HELP_STRING([--disable-server],
2417 [disable Lustre server support]),
2418 [],[enable_server='yes'])
2419 AC_MSG_RESULT([$enable_server])
2421 AC_MSG_CHECKING([whether to build Lustre client support])
2422 AC_ARG_ENABLE([client],
2423 AC_HELP_STRING([--disable-client],
2424 [disable Lustre client support]),
2425 [],[enable_client='yes'])
2426 AC_MSG_RESULT([$enable_client])])
2429 # LC_CONFIG_LIBLUSTRE
2431 # whether to build liblustre
2433 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2434 [AC_MSG_CHECKING([whether to build Lustre library])
2435 AC_ARG_ENABLE([liblustre],
2436 AC_HELP_STRING([--disable-liblustre],
2437 [disable building of Lustre library]),
2438 [],[enable_liblustre=$with_sysio])
2439 AC_MSG_RESULT([$enable_liblustre])
2440 # only build sysio if liblustre is built
2441 with_sysio="$enable_liblustre"
2443 AC_MSG_CHECKING([whether to build liblustre tests])
2444 AC_ARG_ENABLE([liblustre-tests],
2445 AC_HELP_STRING([--enable-liblustre-tests],
2446 [enable liblustre tests, if --disable-tests is used]),
2447 [],[enable_liblustre_tests=$enable_tests])
2448 if test x$enable_liblustre != xyes ; then
2449 enable_liblustre_tests='no'
2451 AC_MSG_RESULT([$enable_liblustre_tests])
2453 AC_MSG_CHECKING([whether to enable liblustre acl])
2454 AC_ARG_ENABLE([liblustre-acl],
2455 AC_HELP_STRING([--disable-liblustre-acl],
2456 [disable ACL support for liblustre]),
2457 [],[enable_liblustre_acl=yes])
2458 AC_MSG_RESULT([$enable_liblustre_acl])
2459 if test x$enable_liblustre_acl = xyes ; then
2460 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2463 # 2.6.29 change prepare/commit_write to write_begin/end
2464 AC_DEFUN([LC_WRITE_BEGIN_END],
2465 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2466 LB_LINUX_TRY_COMPILE([
2467 #include <linux/fs.h>
2468 #include <linux/pagemap.h>
2469 #ifdef HAVE_LINUX_MMTYPES_H
2470 #include <linux/mm_types.h>
2473 struct address_space_operations aops;
2476 aops.write_begin = NULL;
2477 aops.write_end = NULL;
2478 page = grab_cache_page_write_begin(NULL, 0, 0);
2480 AC_MSG_RESULT([yes])
2481 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2482 [kernel has .write_begin/end])
2488 # 2.6.29 blkdev_put has 2 arguments
2489 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2490 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2491 LB_LINUX_TRY_COMPILE([
2492 #include <linux/fs.h>
2494 blkdev_put(NULL, 0);
2496 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2497 [blkdev_put needs 2 paramters])
2498 AC_MSG_RESULT([yes])
2504 # 2.6.29 dentry_open has 4 arguments
2505 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2506 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2507 LB_LINUX_TRY_COMPILE([
2508 #include <linux/fs.h>
2510 dentry_open(NULL, NULL, 0, NULL);
2512 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2513 [dentry_open needs 4 paramters])
2514 AC_MSG_RESULT([yes])
2520 # 2.6.29 split file and anonymous page queues
2521 AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
2522 [AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
2523 LB_LINUX_TRY_COMPILE([
2524 #include <linux/mm.h>
2525 #include <linux/pagevec.h>
2527 struct pagevec lru_pagevec;
2529 pagevec_init(&lru_pagevec, 0);
2530 pagevec_lru_add_file(&lru_pagevec);
2532 AC_MSG_RESULT([yes])
2533 AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
2534 [kernel has .pagevec_lru_add_file])
2543 AC_ARG_ENABLE(mpitests,
2544 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2545 [include mpi tests]),
2556 MPICC_WRAPPER=$enableval
2566 if test x$enable_mpitests != xno; then
2567 AC_MSG_CHECKING([whether mpitests can be built])
2575 MPI_Initialized(&flag);
2578 AC_MSG_RESULT([yes])
2585 AC_SUBST(MPICC_WRAPPER)
2587 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2588 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2591 LC_CONFIG_LIBLUSTRE_RECOVERY
2597 # whether to enable quota support global control
2599 AC_DEFUN([LC_CONFIG_QUOTA],
2600 [AC_ARG_ENABLE([quota],
2601 AC_HELP_STRING([--enable-quota],
2602 [enable quota support]),
2603 [],[enable_quota='yes'])
2606 AC_DEFUN([LC_QUOTA],
2610 AC_CHECK_HEADER(sys/quota.h,
2611 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2612 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2618 # whether to enable split support
2620 AC_DEFUN([LC_CONFIG_SPLIT],
2621 [AC_MSG_CHECKING([whether to enable split support])
2622 AC_ARG_ENABLE([split],
2623 AC_HELP_STRING([--enable-split],
2624 [enable split support]),
2625 [],[enable_split='no'])
2626 AC_MSG_RESULT([$enable_split])
2627 if test x$enable_split != xno; then
2628 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2632 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2633 [AC_MSG_CHECKING([tux_info])
2634 LB_LINUX_TRY_COMPILE([
2635 #include <linux/sched.h>
2637 struct task_struct task;
2640 AC_MSG_RESULT([yes])
2641 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2642 have_task_clenv_store='yes'
2649 # LC_LLITE_LLOOP_MODULE
2650 # lloop_llite.ko does not currently work with page sizes
2653 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2654 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2655 LB_LINUX_TRY_COMPILE([
2656 #include <asm/page.h>
2658 #if PAGE_SIZE >= 65536
2659 #error "PAGE_SIZE >= 65536"
2662 enable_llite_lloop_module='yes'
2663 AC_MSG_RESULT([yes])
2665 enable_llite_lloop_module='no'
2673 # other configure checks
2675 AC_DEFUN([LC_CONFIGURE],
2676 [LC_CONFIG_OBD_BUFFER_SIZE
2678 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2679 CFLAGS="$CFLAGS -Werror"
2682 # maximum MDS thread count
2685 # include/liblustre.h
2686 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2688 # liblustre/llite_lib.h
2689 AC_CHECK_HEADERS([xtio.h file.h])
2692 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2695 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2696 AC_CHECK_FUNCS([inet_ntoa])
2698 # libsysio/src/readlink.c
2701 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2702 AC_CHECK_HEADERS([linux/random.h], [], [],
2703 [#ifdef HAVE_LINUX_TYPES_H
2704 # include <linux/types.h>
2709 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2711 # check for -lz support
2715 [AC_CHECK_HEADERS([zlib.h],
2717 AC_DEFINE([HAVE_ADLER], 1,
2718 [support alder32 checksum type])],
2719 [AC_MSG_WARN([No zlib-devel package found,
2720 unable to use adler32 checksum])])],
2721 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2726 AC_ARG_ENABLE([mindf],
2727 AC_HELP_STRING([--enable-mindf],
2728 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2730 if test "$enable_mindf" = "yes" ; then
2731 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2734 AC_ARG_ENABLE([fail_alloc],
2735 AC_HELP_STRING([--disable-fail-alloc],
2736 [disable randomly alloc failure]),
2737 [],[enable_fail_alloc=yes])
2738 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2739 AC_MSG_RESULT([$enable_fail_alloc])
2740 if test x$enable_fail_alloc != xno ; then
2741 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2744 AC_ARG_ENABLE([invariants],
2745 AC_HELP_STRING([--enable-invariants],
2746 [enable invariant checking (cpu intensive)]),
2748 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2749 AC_MSG_RESULT([$enable_invariants])
2750 if test x$enable_invariants = xyes ; then
2751 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2754 AC_ARG_ENABLE([lu_ref],
2755 AC_HELP_STRING([--enable-lu_ref],
2756 [enable lu_ref reference tracking code]),
2758 AC_MSG_CHECKING([whether to track references with lu_ref])
2759 AC_MSG_RESULT([$enable_lu_ref])
2760 if test x$enable_lu_ref = xyes ; then
2761 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2764 AC_ARG_ENABLE([pgstate-track],
2765 AC_HELP_STRING([--enable-pgstate-track],
2766 [enable page state tracking]),
2767 [enable_pgstat_track='yes'],[])
2768 AC_MSG_CHECKING([whether to enable page state tracking])
2769 AC_MSG_RESULT([$enable_pgstat_track])
2770 if test x$enable_pgstat_track = xyes ; then
2771 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2772 [enable page state tracking code])
2779 LC_DENTRY_OPEN_4ARGS
2780 LC_PAGEVEC_LRU_ADD_FILE
2787 # AM_CONDITIONALS for lustre
2789 AC_DEFUN([LC_CONDITIONALS],
2790 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2791 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2792 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2793 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2794 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2795 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2796 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2797 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2798 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2799 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2800 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2801 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2802 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2803 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2804 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2810 # files that should be generated with AC_OUTPUT
2812 AC_DEFUN([LC_CONFIG_FILES],
2816 lustre/autoconf/Makefile
2817 lustre/conf/Makefile
2818 lustre/contrib/Makefile
2820 lustre/include/Makefile
2821 lustre/include/lustre_ver.h
2822 lustre/include/linux/Makefile
2823 lustre/include/lustre/Makefile
2824 lustre/kernel_patches/targets/2.6-rhel6.target
2825 lustre/kernel_patches/targets/2.6-rhel5.target
2826 lustre/kernel_patches/targets/2.6-sles10.target
2827 lustre/kernel_patches/targets/2.6-sles11.target
2828 lustre/kernel_patches/targets/2.6-oel5.target
2829 lustre/kernel_patches/targets/2.6-fc11.target
2830 lustre/kernel_patches/targets/2.6-fc12.target
2831 lustre/ldlm/Makefile
2833 lustre/fid/autoMakefile
2834 lustre/liblustre/Makefile
2835 lustre/liblustre/tests/Makefile
2836 lustre/liblustre/tests/mpi/Makefile
2837 lustre/llite/Makefile
2838 lustre/llite/autoMakefile
2839 lustre/lclient/Makefile
2841 lustre/lov/autoMakefile
2842 lustre/lvfs/Makefile
2843 lustre/lvfs/autoMakefile
2845 lustre/mdc/autoMakefile
2847 lustre/lmv/autoMakefile
2849 lustre/mds/autoMakefile
2851 lustre/mdt/autoMakefile
2853 lustre/cmm/autoMakefile
2855 lustre/mdd/autoMakefile
2857 lustre/fld/autoMakefile
2858 lustre/obdclass/Makefile
2859 lustre/obdclass/autoMakefile
2860 lustre/obdclass/linux/Makefile
2861 lustre/obdecho/Makefile
2862 lustre/obdecho/autoMakefile
2863 lustre/obdfilter/Makefile
2864 lustre/obdfilter/autoMakefile
2866 lustre/osc/autoMakefile
2868 lustre/ost/autoMakefile
2869 lustre/osd-ldiskfs/Makefile
2870 lustre/osd-ldiskfs/autoMakefile
2872 lustre/mgc/autoMakefile
2874 lustre/mgs/autoMakefile
2875 lustre/ptlrpc/Makefile
2876 lustre/ptlrpc/autoMakefile
2877 lustre/ptlrpc/gss/Makefile
2878 lustre/ptlrpc/gss/autoMakefile
2879 lustre/quota/Makefile
2880 lustre/quota/autoMakefile
2881 lustre/scripts/Makefile
2882 lustre/tests/Makefile
2883 lustre/tests/mpi/Makefile
2884 lustre/utils/Makefile
2885 lustre/utils/gss/Makefile
2886 lustre/obdclass/darwin/Makefile