1 #* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 #* vim:expandtab:shiftwidth=8:tabstop=8:
6 # Wrapper for AC_CONFIG_SUBDIR
8 AC_DEFUN([LC_CONFIG_SRCDIR],
9 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
17 # lustre specific paths
19 AC_DEFUN([LC_PATH_DEFAULTS],
20 [# ptlrpc kernel build requires this
28 demodir='$(docdir)/demo'
31 pkgexampledir='${pkgdatadir}/examples'
32 AC_SUBST(pkgexampledir)
38 # is the target os supported?
40 AC_DEFUN([LC_TARGET_SUPPORTED],
52 # LC_CONFIG_OBD_BUFFER_SIZE
54 # the maximum buffer size of lctl ioctls
56 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
57 [AC_MSG_CHECKING([maximum OBD ioctl size])
58 AC_ARG_WITH([obd-buffer-size],
59 AC_HELP_STRING([--with-obd-buffer-size=[size]],
60 [set lctl ioctl maximum bytes (default=8192)]),
62 OBD_BUFFER_SIZE=$with_obd_buffer_size
66 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
67 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
73 AC_DEFUN([LC_READLINK_SSIZE_T],
74 [AC_MSG_CHECKING([if readlink returns ssize_t])
78 ssize_t readlink(const char *, char *, size_t);
81 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
88 # only for Lustre-patched kernels
90 AC_DEFUN([LC_LUSTRE_VERSION_H],
91 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
92 rm -f "$LUSTRE/include/linux/lustre_version.h"
94 touch "$LUSTRE/include/linux/lustre_version.h"
95 if test x$enable_server = xyes ; then
96 AC_MSG_WARN([Unpatched kernel detected.])
97 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
98 AC_MSG_WARN([disabling server build])
105 # LC_FUNC_DEV_SET_RDONLY
107 # check for the old-style dev_set_rdonly which took an extra "devno" param
108 # and can only set a single device to discard writes at one time
110 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
111 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
112 LB_LINUX_TRY_COMPILE([
113 #include <linux/fs.h>
114 #include <linux/blkdev.h>
116 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
117 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
121 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
123 AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
124 kernel patches from Lustre version 1.4.3 or above.])
129 # Ensure stack size big than 8k in Lustre server (all kernels)
131 AC_DEFUN([LC_STACK_SIZE],
132 [AC_MSG_CHECKING([stack size big than 8k])
133 LB_LINUX_TRY_COMPILE([
134 #include <linux/thread_info.h>
136 #if THREAD_SIZE < 8192
137 #error "stack size < 8192"
142 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
147 # Allow the user to set the MDS thread upper limit
149 AC_DEFUN([LC_MDS_MAX_THREADS],
151 AC_ARG_WITH([mds_max_threads],
152 AC_HELP_STRING([--with-mds-max-threads=size],
153 [define the maximum number of threads available on the MDS: (default=512)]),
155 MDS_THREAD_COUNT=$with_mds_max_threads
156 AC_DEFINE_UNQUOTED(MDT_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of mdt threads])
163 # the pinger is temporary, until we have the recovery node in place
165 AC_DEFUN([LC_CONFIG_PINGER],
166 [AC_MSG_CHECKING([whether to enable pinger support])
167 AC_ARG_ENABLE([pinger],
168 AC_HELP_STRING([--disable-pinger],
169 [disable recovery pinger support]),
170 [],[enable_pinger='yes'])
171 AC_MSG_RESULT([$enable_pinger])
172 if test x$enable_pinger != xno ; then
173 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
180 # do checksum of bulk data between client and OST
182 AC_DEFUN([LC_CONFIG_CHECKSUM],
183 [AC_MSG_CHECKING([whether to enable data checksum support])
184 AC_ARG_ENABLE([checksum],
185 AC_HELP_STRING([--disable-checksum],
186 [disable data checksum support]),
187 [],[enable_checksum='yes'])
188 AC_MSG_RESULT([$enable_checksum])
189 if test x$enable_checksum != xno ; then
190 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
195 # LC_CONFIG_LIBLUSTRE_RECOVERY
197 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
198 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
199 AC_ARG_ENABLE([liblustre-recovery],
200 AC_HELP_STRING([--disable-liblustre-recovery],
201 [disable liblustre recovery support]),
202 [],[enable_liblustre_recovery='yes'])
203 AC_MSG_RESULT([$enable_liblustre_recovery])
204 if test x$enable_liblustre_recovery != xno ; then
205 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
210 # LC_CONFIG_HEALTH_CHECK_WRITE
212 # Turn off the actual write to the disk
214 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
215 [AC_MSG_CHECKING([whether to enable a write with the health check])
216 AC_ARG_ENABLE([health_write],
217 AC_HELP_STRING([--enable-health_write],
218 [enable disk writes when doing health check]),
219 [],[enable_health_write='no'])
220 AC_MSG_RESULT([$enable_health_write])
221 if test x$enable_health_write != xno ; then
222 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
226 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
227 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
228 AC_ARG_ENABLE([lru_resize],
229 AC_HELP_STRING([--enable-lru-resize],
230 [enable lru resize support]),
231 [],[enable_lru_resize='yes'])
232 AC_MSG_RESULT([$enable_lru_resize])
233 if test x$enable_lru_resize != xno; then
234 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
238 # whether to enable quota support(kernel modules)
239 AC_DEFUN([LC_QUOTA_MODULE],
240 [if test x$enable_quota != xno; then
241 LB_LINUX_CONFIG([QUOTA],[
242 enable_quota_module='yes'
243 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
245 enable_quota_module='no'
246 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
251 # truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
252 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
253 # delete_from_page_cache() is exported from 2.6.39
254 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
255 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
257 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
258 [kernel export truncate_complete_page])])
259 LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
261 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
262 [kernel export remove_from_page_cache])])
263 LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
265 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
266 [kernel export delete_from_page_cache])])
269 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
270 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
272 AC_DEFINE(HAVE_D_REHASH_COND, 1,
273 [d_rehash_cond is exported by the kernel])
278 AC_DEFUN([LC_EXPORT___D_REHASH],
279 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
281 AC_DEFINE(HAVE___D_REHASH, 1,
282 [__d_rehash is exported by the kernel])
287 # The actual symbol exported varies among architectures, so we need
288 # to check many symbols (but only in the current architecture.) No
289 # matter what symbol is exported, the kernel #defines node_to_cpumask
290 # to the appropriate function and that's what we use.
291 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
292 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
293 [arch/$LINUX_ARCH/mm/numa.c],
294 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
295 [node_to_cpumask is exported by
296 the kernel])]) # x86_64
297 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
298 [arch/$LINUX_ARCH/kernel/smpboot.c],
299 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
300 [node_to_cpumask is exported by
301 the kernel])]) # ia64
302 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
303 [arch/$LINUX_ARCH/kernel/smpboot.c],
304 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
305 [node_to_cpumask is exported by
306 the kernel])]) # i386
310 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
312 # Check for our patched grab_cache_page_nowait_gfp() function
313 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
315 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
316 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
318 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
319 [kernel exports grab_cache_page_nowait_gfp])
321 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
323 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
324 [kernel exports add_to_page_cache_lru])
332 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
334 AC_DEFUN([LC_FILEMAP_POPULATE],
335 [AC_MSG_CHECKING([for exported filemap_populate])
336 LB_LINUX_TRY_COMPILE([
337 #include <asm/page.h>
338 #include <linux/mm.h>
340 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
343 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
352 AC_DEFUN([LC_BIT_SPINLOCK_H],
353 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
354 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
355 LB_LINUX_TRY_COMPILE([
356 #include <asm/processor.h>
357 #include <linux/spinlock.h>
358 #include <linux/bit_spinlock.h>
361 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
372 AC_DEFUN([LC_CONST_ACL_SIZE],
373 [AC_MSG_CHECKING([calc acl size])
375 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"
378 #include <linux/types.h>
381 #define __LINUX_POSIX_ACL_H
383 #ifdef CONFIG_FS_POSIX_ACL
384 # include <linux/posix_acl_xattr.h>
391 /* LUSTRE_POSIX_ACL_MAX_ENTRIES = 32 */
392 int size = posix_acl_xattr_size(32);
393 FILE *f = fopen("acl.size","w+");
394 fprintf(f,"%d", size);
400 acl_size=`cat acl.size`
401 AC_MSG_RESULT([ACL size $acl_size])
402 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
404 AC_ERROR([ACL size can't be computed])
406 AC_MSG_RESULT([can't check ACL size, make it 260])
407 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
414 AC_DEFUN([LC_STRUCT_INTENT_FILE],
415 [AC_MSG_CHECKING([if struct open_intent has a file field])
416 LB_LINUX_TRY_COMPILE([
417 #include <linux/fs.h>
418 #include <linux/namei.h>
420 struct open_intent intent;
424 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
433 AC_DEFUN([LC_CAPA_CRYPTO],
434 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
435 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
437 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
438 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
440 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
441 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
446 # LC_CONFIG_RMTCLIENT
449 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
451 AC_DEFUN([LC_CONFIG_RMTCLIENT],
452 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
453 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
458 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
460 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
461 [AC_MSG_CHECKING([whether to enable gss keyring backend])
462 AC_ARG_ENABLE([gss_keyring],
463 [AC_HELP_STRING([--disable-gss-keyring],
464 [disable gss keyring backend])],
465 [],[enable_gss_keyring='yes'])
466 AC_MSG_RESULT([$enable_gss_keyring])
468 if test x$enable_gss_keyring != xno; then
469 LB_LINUX_CONFIG_IM([KEYS],[],
470 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
472 AC_CHECK_LIB([keyutils], [keyctl_search], [],
473 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
475 AC_DEFINE([HAVE_GSS_KEYRING], [1],
476 [Define this if you enable gss keyring backend])
480 AC_DEFUN([LC_SUNRPC_CACHE],
481 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
482 LB_LINUX_TRY_COMPILE([
483 #include <linux/sunrpc/cache.h>
485 struct cache_head ch;
489 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
495 AC_DEFUN([LC_CONFIG_SUNRPC],
496 [LB_LINUX_CONFIG_IM([SUNRPC],[],
497 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
502 # LC_CONFIG_GSS (default disabled)
504 # Build gss and related tools of Lustre. Currently both kernel and user space
505 # parts are depend on linux platform.
507 AC_DEFUN([LC_CONFIG_GSS],
508 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
510 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
511 [],[enable_gss='no'])
512 AC_MSG_RESULT([$enable_gss])
514 if test x$enable_gss == xyes; then
515 LC_CONFIG_GSS_KEYRING
518 AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
520 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
521 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
522 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
523 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
524 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
525 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
526 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
527 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
529 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
530 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
531 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
532 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
533 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
535 AC_SUBST(GSSAPI_LIBS)
542 # LC_FUNC_HAVE_CAN_SLEEP_ARG
544 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
546 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
547 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
548 LB_LINUX_TRY_COMPILE([
549 #include <linux/fs.h>
553 struct file_lock *file_lock;
554 flock_lock_file_wait(file, file_lock, cansleep);
556 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
557 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
567 # rhel4.2 kernel has f_op->flock field
569 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
570 [AC_MSG_CHECKING([if struct file_operations has flock field])
571 LB_LINUX_TRY_COMPILE([
572 #include <linux/fs.h>
574 struct file_operations ll_file_operations_flock;
575 ll_file_operations_flock.flock = NULL;
577 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
578 [struct file_operations has flock field])
585 AC_DEFUN([LC_QUOTA_READ],
586 [AC_MSG_CHECKING([if kernel supports quota_read])
587 LB_LINUX_TRY_COMPILE([
588 #include <linux/fs.h>
590 struct super_operations sp;
591 void *i = (void *)sp.quota_read;
594 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
601 # LC_COOKIE_FOLLOW_LINK
603 # kernel 2.6.13+ ->follow_link returns a cookie
606 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
607 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
608 LB_LINUX_TRY_COMPILE([
609 #include <linux/fs.h>
610 #include <linux/namei.h>
612 struct dentry dentry;
615 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
617 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
627 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
628 # call_rcu takes three parameters.
630 AC_DEFUN([LC_FUNC_RCU],
631 [AC_MSG_CHECKING([if kernel have RCU supported])
632 LB_LINUX_TRY_COMPILE([
633 #include <linux/rcupdate.h>
635 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
638 AC_MSG_CHECKING([if call_rcu takes three parameters])
639 LB_LINUX_TRY_COMPILE([
640 #include <linux/rcupdate.h>
643 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
645 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
656 AC_DEFUN([LC_PERCPU_COUNTER],
657 [AC_MSG_CHECKING([if have struct percpu_counter defined])
658 LB_LINUX_TRY_COMPILE([
659 #include <linux/percpu_counter.h>
661 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
664 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
665 LB_LINUX_TRY_COMPILE([
666 #include <linux/percpu_counter.h>
668 struct percpu_counter c;
669 percpu_counter_init(&c, 0);
671 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
682 AC_DEFUN([LC_TASK_CLENV_STORE],
684 AC_MSG_CHECKING([if we can store cl_env in task_struct])
685 if test x$have_task_clenv_store != xyes ; then
686 LC_TASK_CLENV_TUX_INFO
692 AC_DEFUN([LC_S_TIME_GRAN],
693 [AC_MSG_CHECKING([if super block has s_time_gran member])
694 LB_LINUX_TRY_COMPILE([
695 #include <linux/fs.h>
697 struct super_block sb;
699 return sb.s_time_gran;
702 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
708 AC_DEFUN([LC_SB_TIME_GRAN],
709 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
710 LB_LINUX_TRY_COMPILE([
711 #include <linux/fs.h>
713 return get_sb_time_gran(NULL);
716 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
724 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
725 AC_DEFUN([LC_RW_TREE_LOCK],
726 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
727 tmp_flags="$EXTRA_KCFLAGS"
728 EXTRA_KCFLAGS="-Werror"
729 LB_LINUX_TRY_COMPILE([
730 #include <linux/fs.h>
732 struct address_space a;
734 write_lock(&a.tree_lock);
737 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
741 EXTRA_KCFLAGS="$tmp_flags"
747 # after 2.6.15 inode have i_mutex intead of i_sem
748 AC_DEFUN([LC_INODE_I_MUTEX],
749 [AC_MSG_CHECKING([if inode has i_mutex ])
750 LB_LINUX_TRY_COMPILE([
751 #include <linux/mutex.h>
752 #include <linux/fs.h>
757 mutex_unlock(&i.i_mutex);
760 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
761 [after 2.6.15 inode have i_mutex intead of i_sem])
769 # LC_SECURITY_PLUG # for SLES10 SP2
770 # check security plug in sles10 sp2 kernel
771 AC_DEFUN([LC_SECURITY_PLUG],
772 [AC_MSG_CHECKING([If kernel has security plug support])
773 LB_LINUX_TRY_COMPILE([
774 #include <linux/fs.h>
776 struct dentry *dentry;
777 struct vfsmount *mnt;
780 notify_change(dentry, mnt, iattr);
783 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
784 [SLES10 SP2 use extra parameter in vfs])
792 # inode have i_private field since 2.6.17
793 AC_DEFUN([LC_INODE_IPRIVATE],
794 [AC_MSG_CHECKING([if inode has a i_private field])
795 LB_LINUX_TRY_COMPILE([
796 #include <linux/fs.h>
802 AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
803 [struct inode has i_private field])
810 # after 2.6.17 dquote use mutex instead if semaphore
811 AC_DEFUN([LC_DQUOTOFF_MUTEX],
812 [AC_MSG_CHECKING([use dqonoff_mutex])
813 LB_LINUX_TRY_COMPILE([
814 #include <linux/mutex.h>
815 #include <linux/fs.h>
816 #include <linux/quota.h>
818 struct quota_info dq;
820 mutex_unlock(&dq.dqonoff_mutex);
823 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
824 [after 2.6.17 dquote use mutex instead if semaphore])
833 # 2.6.18 don't export nr_pagecahe
834 AC_DEFUN([LC_NR_PAGECACHE],
835 [AC_MSG_CHECKING([kernel export nr_pagecache])
836 LB_LINUX_TRY_COMPILE([
837 #include <linux/pagemap.h>
839 return atomic_read(&nr_pagecache);
842 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
843 [is kernel export nr_pagecache])
850 # LC_STATFS_DENTRY_PARAM
851 # starting from 2.6.18 linux kernel uses dentry instead of super_block
852 # for the first parameter of the super_operations->statfs() callback.
855 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
856 [AC_MSG_CHECKING([if super_ops.statfs() first parameter is dentry])
857 tmp_flags="$EXTRA_KCFLAGS"
858 EXTRA_KCFLAGS="-Werror"
859 LB_LINUX_TRY_COMPILE([
860 #include <linux/fs.h>
862 ((struct super_operations *)0)->statfs((struct dentry *)0, (struct kstatfs*)0);
864 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
865 [super_ops.statfs() first parameter is dentry])
870 EXTRA_KCFLAGS="$tmp_flags"
875 # starting from 2.6.18 kernel don't export do_kern_mount
876 # and want to use vfs_kern_mount instead.
878 AC_DEFUN([LC_VFS_KERN_MOUNT],
879 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
880 LB_LINUX_TRY_COMPILE([
881 #include <linux/mount.h>
883 vfs_kern_mount(NULL, 0, NULL, NULL);
885 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
886 [vfs_kern_mount exist in kernel])
894 # LC_INVALIDATEPAGE_RETURN_INT
895 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
897 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
898 [AC_MSG_CHECKING([invalidatepage has return int])
899 LB_LINUX_TRY_COMPILE([
900 #include <linux/buffer_head.h>
902 int rc = block_invalidatepage(NULL, 0);
905 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
906 [Define if return type of invalidatepage should be int])
912 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
913 # after 2.6.18 umount_begin has different parameters
914 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
915 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
916 tmp_flags="$EXTRA_KCFLAGS"
917 EXTRA_KCFLAGS="-Werror"
918 LB_LINUX_TRY_COMPILE([
919 #include <linux/fs.h>
922 static void cfg_umount_begin (struct vfsmount *v, int flags)
927 static struct super_operations cfg_super_operations = {
928 .umount_begin = cfg_umount_begin,
931 cfg_super_operations.umount_begin(NULL,0);
934 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
935 [Define umount_begin need second argument])
939 EXTRA_KCFLAGS="$tmp_flags"
943 # after 2.6.18 seq_file has lock intead of sem
944 AC_DEFUN([LC_SEQ_LOCK],
945 [AC_MSG_CHECKING([if struct seq_file has lock field])
946 LB_LINUX_TRY_COMPILE([
947 #include <linux/seq_file.h>
951 mutex_unlock(&seq.lock);
954 AC_DEFINE(HAVE_SEQ_LOCK, 1,
955 [after 2.6.18 seq_file has lock intead of sem])
962 # LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
964 # No standard kernels export this
966 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
967 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
969 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
970 [filemap_fdatawrite_range is exported by the kernel])
976 # starting from 2.6.18 the file_operations .flush
977 # method has a new "fl_owner_t id" parameter
979 AC_DEFUN([LC_FLUSH_OWNER_ID],
980 [AC_MSG_CHECKING([if file_operations .flush has an fl_owner_t id])
981 LB_LINUX_TRY_COMPILE([
982 #include <linux/fs.h>
984 struct file_operations *fops = NULL;
988 i = fops->flush(NULL, id);
990 AC_DEFINE(HAVE_FLUSH_OWNER_ID, 1,
991 [file_operations .flush method has an fl_owner_t id])
999 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1001 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1002 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1004 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1005 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1006 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1007 [exported invalidate_mapping_pages])],
1008 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1009 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1010 [exported invalidate_inode_pages])], [
1011 AC_MSG_ERROR([no way to invalidate pages])
1016 #2.6.18 + RHEL5 (fc6)
1018 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
1019 AC_DEFUN([LC_PG_FS_MISC],
1020 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1021 LB_LINUX_TRY_COMPILE([
1022 #include <linux/mm.h>
1023 #include <linux/page-flags.h>
1026 #error PG_fs_misc not defined in kernel
1030 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1031 [is kernel have PG_fs_misc])
1037 # RHEL5 PageChecked and SetPageChecked defined
1038 AC_DEFUN([LC_PAGE_CHECKED],
1039 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1040 LB_LINUX_TRY_COMPILE([
1041 #include <linux/mm.h>
1042 #ifdef HAVE_LINUX_MMTYPES_H
1043 #include <linux/mm_types.h>
1045 #include <linux/page-flags.h>
1047 struct page *p = NULL;
1049 /* before 2.6.26 this define*/
1051 /* 2.6.26 use function instead of define for it */
1057 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1058 [does kernel have PageChecked and SetPageChecked])
1067 # If we have fiemap.h
1068 # after 2.6.27 use fiemap.h in include/linux
1070 AC_DEFUN([LC_LINUX_FIEMAP_H],
1071 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1072 AC_MSG_CHECKING([if fiemap.h can be compiled])
1073 LB_LINUX_TRY_COMPILE([
1074 #include <linux/types.h>
1075 #include <linux/fiemap.h>
1077 AC_MSG_RESULT([yes])
1078 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1088 # 2.6.19 API changes
1089 # inode don't have i_blksize field
1090 AC_DEFUN([LC_INODE_BLKSIZE],
1091 [AC_MSG_CHECKING([inode has i_blksize field])
1092 LB_LINUX_TRY_COMPILE([
1093 #include <linux/fs.h>
1099 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1100 [struct inode has i_blksize field])
1107 # 2.6.19 replaced writev with aio_write
1108 AC_DEFUN([LC_FILE_WRITEV],
1109 [AC_MSG_CHECKING([writev in fops])
1110 LB_LINUX_TRY_COMPILE([
1111 #include <linux/fs.h>
1113 struct file_operations *fops = NULL;
1114 fops->writev = NULL;
1117 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1125 # 2.6.19 replaced readv with aio_read
1126 AC_DEFUN([LC_FILE_READV],
1127 [AC_MSG_CHECKING([readv in fops])
1128 LB_LINUX_TRY_COMPILE([
1129 #include <linux/fs.h>
1131 struct file_operations *fops = NULL;
1135 AC_DEFINE(HAVE_FILE_READV, 1,
1144 # LC_CANCEL_DIRTY_PAGE
1145 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
1146 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1147 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1148 # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
1149 # backport is broken, so ignore it
1150 if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
1151 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
1154 LB_LINUX_TRY_COMPILE([
1155 #include <linux/mm.h>
1156 #include <linux/page-flags.h>
1158 cancel_dirty_page(NULL, 0);
1161 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1162 [kernel has cancel_dirty_page instead of clear_page_dirty])
1169 # raid5-zerocopy patch
1174 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1175 # it support constant page, which means the page won't be modified during the
1178 AC_DEFUN([LC_PAGE_CONSTANT],
1179 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1180 LB_LINUX_TRY_COMPILE([
1181 #include <linux/mm.h>
1182 #include <linux/page-flags.h>
1185 #error "Have no raid5 zcopy patch"
1189 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1197 # 2.6.22 lost second parameter for invalidate_bdev
1198 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1199 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1200 LB_LINUX_TRY_COMPILE([
1201 #include <linux/buffer_head.h>
1203 invalidate_bdev(NULL,0);
1205 AC_MSG_RESULT([yes])
1206 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1207 [invalidate_bdev has second argument])
1214 # check for crypto API
1216 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1217 [AC_MSG_CHECKING([if kernel has block cipher support])
1218 LB_LINUX_TRY_COMPILE([
1219 #include <linux/err.h>
1220 #include <linux/crypto.h>
1222 struct crypto_blkcipher *tfm;
1223 tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
1225 AC_MSG_RESULT([yes])
1226 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1233 # check for struct hash_desc
1235 AC_DEFUN([LC_STRUCT_HASH_DESC],
1236 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1237 LB_LINUX_TRY_COMPILE([
1238 #include <linux/err.h>
1239 #include <linux/crypto.h>
1241 struct hash_desc foo;
1243 AC_MSG_RESULT([yes])
1244 AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1251 # check for struct blkcipher_desc
1253 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1254 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1255 LB_LINUX_TRY_COMPILE([
1256 #include <linux/err.h>
1257 #include <linux/crypto.h>
1259 struct blkcipher_desc foo;
1261 AC_MSG_RESULT([yes])
1262 AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1269 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1271 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1272 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1273 LB_LINUX_TRY_COMPILE([
1274 #include <linux/fs.h>
1276 int v = FS_RENAME_DOES_D_MOVE;
1278 AC_MSG_RESULT([yes])
1279 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1287 # 2.6.23 have return type 'void' for unregister_blkdev
1288 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1289 [AC_MSG_CHECKING([if unregister_blkdev return int])
1290 LB_LINUX_TRY_COMPILE([
1291 #include <linux/fs.h>
1293 int i = unregister_blkdev(0,NULL);
1295 AC_MSG_RESULT([yes])
1296 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1297 [unregister_blkdev return int])
1303 # 2.6.23 change .sendfile to .splice_read
1304 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1305 [AC_MSG_CHECKING([if kernel has .splice_read])
1306 LB_LINUX_TRY_COMPILE([
1307 #include <linux/fs.h>
1309 struct file_operations file;
1311 file.splice_read = NULL;
1313 AC_MSG_RESULT([yes])
1314 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1315 [kernel has .slice_read])
1321 # 2.6.23 change .sendfile to .splice_read
1322 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1323 AC_DEFUN([LC_KERNEL_SENDFILE],
1324 [AC_MSG_CHECKING([if kernel has .sendfile])
1325 LB_LINUX_TRY_COMPILE([
1326 #include <linux/fs.h>
1328 struct file_operations file;
1330 file.sendfile = NULL;
1332 AC_MSG_RESULT([yes])
1333 AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1334 [kernel has .sendfile])
1340 # 2.6.23 extract nfs export related data into exportfs.h
1341 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1342 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1343 AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1344 [kernel has include/exportfs.h])
1350 # 2.6.23 has new page fault handling API
1351 AC_DEFUN([LC_VM_OP_FAULT],
1352 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1353 LB_LINUX_TRY_COMPILE([
1354 #include <linux/mm.h>
1356 struct vm_operations_struct op;
1360 AC_MSG_RESULT([yes])
1361 AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1362 [kernel has .fault in vm_operation_struct])
1368 # 2.6.23 add code to wait other users to complete before removing procfs entry
1369 AC_DEFUN([LC_PROCFS_USERS],
1370 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
1371 LB_LINUX_TRY_COMPILE([
1372 #include <linux/proc_fs.h>
1374 struct proc_dir_entry pde;
1378 AC_MSG_RESULT([yes])
1379 AC_DEFINE(HAVE_PROCFS_USERS, 1,
1380 [kernel has pde_users member in procfs entry struct])
1386 # 2.6.23 exports exportfs_decode_fh
1387 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
1388 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
1389 [fs/exportfs/expfs.c],[
1390 AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
1391 [exportfs_decode_fh has been export])
1398 # 2.6.24 need linux/mm_types.h included
1399 AC_DEFUN([LC_HAVE_MMTYPES_H],
1400 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1401 AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1402 [kernel has include/mm_types.h])
1408 # 2.6.24 has bio_endio with 2 args
1409 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1410 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1411 LB_LINUX_TRY_COMPILE([
1412 #include <linux/bio.h>
1416 AC_MSG_RESULT([yes])
1417 AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1418 [kernel has bio_endio with 2 args])
1424 # 2.6.24 has new members in exports struct.
1425 AC_DEFUN([LC_FH_TO_DENTRY],
1426 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1427 LB_LINUX_TRY_COMPILE([
1428 #include <linux/fs.h>
1429 #ifdef HAVE_LINUX_EXPORTFS_H
1430 #include <linux/exportfs.h>
1433 struct export_operations exp;
1434 memset(exp.fh_to_dentry, 0, sizeof(exp.fh_to_dentry));
1436 AC_MSG_RESULT([yes])
1437 AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1438 [kernel has .fh_to_dentry member in export_operations struct])
1444 # 2.6.24 removes long aged procfs entry -> deleted member
1445 AC_DEFUN([LC_PROCFS_DELETED],
1446 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1447 LB_LINUX_TRY_COMPILE([
1448 #include <linux/proc_fs.h>
1450 struct proc_dir_entry pde;
1452 pde.deleted = sizeof(pde);
1454 AC_MSG_RESULT([yes])
1455 AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1456 [kernel has deleted member in procfs entry struct])
1462 # 2.6.24 has bdi_init()/bdi_destroy() functions.
1463 AC_DEFUN([LC_EXPORT_BDI_INIT],
1464 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
1465 [mm/backing-dev.c],[
1466 AC_DEFINE(HAVE_BDI_INIT, 1,
1467 [bdi_init/bdi_destroy functions are present])
1474 # 2.6.25 change define to inline
1475 AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
1476 [AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
1477 LB_LINUX_TRY_COMPILE([
1478 #include <linux/backing-dev.h>
1480 #ifndef mapping_cap_writeback_dirty
1481 mapping_cap_writeback_dirty(NULL);
1484 AC_MSG_RESULT([yes])
1485 AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
1486 [kernel have mapping_cap_writeback_dirty])
1494 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1495 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1496 [AC_MSG_CHECKING([fs_struct use path structure])
1497 LB_LINUX_TRY_COMPILE([
1498 #include <asm/atomic.h>
1499 #include <linux/spinlock.h>
1500 #include <linux/fs_struct.h>
1503 struct fs_struct fs;
1506 memset(&fs, 0, sizeof(fs));
1508 AC_MSG_RESULT([yes])
1509 AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1510 [fs_struct use path structure])
1520 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1521 [AC_MSG_CHECKING([inode_operations->permission has two args])
1522 LB_LINUX_TRY_COMPILE([
1523 #include <linux/fs.h>
1525 struct inode *inode;
1526 inode->i_op->permission(NULL, 0);
1528 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1529 [inode_operations->permission has two args])
1530 AC_MSG_RESULT([yes])
1536 # 2.6.27 has file_remove_suid instead of remove_suid
1537 AC_DEFUN([LC_FILE_REMOVE_SUID],
1538 [AC_MSG_CHECKING([kernel has file_remove_suid])
1539 LB_LINUX_TRY_COMPILE([
1540 #include <linux/fs.h>
1542 file_remove_suid(NULL);
1544 AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1545 [kernel have file_remove_suid])
1546 AC_MSG_RESULT([yes])
1552 # 2.6.27 have new page locking API
1553 AC_DEFUN([LC_TRYLOCKPAGE],
1554 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1555 LB_LINUX_TRY_COMPILE([
1556 #include <linux/pagemap.h>
1560 AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1561 [kernel uses trylock_page for page lock])
1562 AC_MSG_RESULT([yes])
1568 # 2.6.27 removed the read_inode from super_operations.
1569 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1570 [AC_MSG_CHECKING([super_operations has a read_inode field])
1571 LB_LINUX_TRY_COMPILE([
1572 #include <linux/fs.h>
1574 struct super_operations *sop;
1575 sop->read_inode(NULL);
1577 AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1578 [super_operations has a read_inode])
1579 AC_MSG_RESULT([yes])
1585 # 2.6.27 has inode_permission instead of permisson
1586 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1587 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1589 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1590 [inode_permission is exported by the kernel])
1595 # 2.6.27 use 5th parameter in quota_on for remount.
1596 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1597 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1598 LB_LINUX_TRY_COMPILE([
1599 #include <linux/quota.h>
1601 struct quotactl_ops *qop;
1602 qop->quota_on(NULL, 0, 0, NULL, 0);
1604 AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1605 [quota_on needs 5 paramters])
1606 AC_MSG_RESULT([yes])
1612 # 2.6.27 use 3th parameter in quota_off for remount.
1613 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1614 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1615 LB_LINUX_TRY_COMPILE([
1616 #include <linux/quota.h>
1618 struct quotactl_ops *qop;
1619 qop->quota_off(NULL, 0, 0);
1621 AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1622 [quota_off needs 3 paramters])
1623 AC_MSG_RESULT([yes])
1629 # 2.6.27 has vfs_dq_off inline function.
1630 AC_DEFUN([LC_VFS_DQ_OFF],
1631 [AC_MSG_CHECKING([vfs_dq_off is defined])
1632 LB_LINUX_TRY_COMPILE([
1633 #include <linux/quotaops.h>
1635 vfs_dq_off(NULL, 0);
1637 AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1638 AC_MSG_RESULT([yes])
1644 # LC_LOCK_MAP_ACQUIRE
1645 # after 2.6.27 lock_map_acquire replaces lock_acquire
1646 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1647 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1648 LB_LINUX_TRY_COMPILE([
1649 #include <linux/lockdep.h>
1651 lock_map_acquire(NULL);
1654 AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1655 [lock_map_acquire is defined])
1661 # 2.6.27.15-2 sles11
1663 # 2.6.27 sles11 remove the bi_hw_segments
1664 AC_DEFUN([LC_BI_HW_SEGMENTS],
1665 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1666 LB_LINUX_TRY_COMPILE([
1667 #include <linux/bio.h>
1670 io.bi_hw_segments = sizeof(io);
1672 AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1673 [struct bio has a bi_hw_segments field])
1674 AC_MSG_RESULT([yes])
1681 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1682 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1683 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1684 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1685 AC_DEFINE(HAVE_QUOTAIO_H, 1,
1686 [kernel has include/linux/quotaio_v2.h])
1687 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1688 AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1689 [kernel has fs/quotaio_v1.h])
1690 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1691 AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1692 [kernel has fs/quota/quotaio_v2.h])
1700 # sles10 sp2 need 5 parameter for vfs_symlink
1701 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
1702 [AC_MSG_CHECKING([vfs_symlink need 5 parameter])
1703 LB_LINUX_TRY_COMPILE([
1704 #include <linux/fs.h>
1706 struct inode *dir = NULL;
1707 struct dentry *dentry = NULL;
1708 struct vfsmount *mnt = NULL;
1709 const char * path = NULL;
1710 vfs_symlink(dir, dentry, mnt, path, 0);
1712 AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
1713 [vfs_symlink need 5 parameteres])
1714 AC_MSG_RESULT([yes])
1720 # 2.6.27 sles11 has sb_any_quota_active
1721 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1722 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1723 LB_LINUX_TRY_COMPILE([
1724 #include <linux/quotaops.h>
1726 sb_any_quota_active(NULL);
1728 AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1729 [Kernel has a sb_any_quota_active])
1730 AC_MSG_RESULT([yes])
1736 # 2.6.27 sles11 has sb_has_quota_active
1737 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1738 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1739 LB_LINUX_TRY_COMPILE([
1740 #include <linux/quotaops.h>
1742 sb_has_quota_active(NULL, 0);
1744 AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1745 [Kernel has a sb_has_quota_active])
1746 AC_MSG_RESULT([yes])
1752 # 2.6.27 exported add_to_page_cache_lru.
1753 AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
1754 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1756 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1757 [add_to_page_cache_lru functions are present])
1763 # 2.6.29 introduce sb_any_quota_loaded.
1765 AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
1766 [AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
1767 LB_LINUX_TRY_COMPILE([
1768 #include <linux/quotaops.h>
1770 sb_any_quota_loaded(NULL);
1772 AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
1773 [Kernel has a sb_any_quota_loaded])
1774 AC_MSG_RESULT([yes])
1780 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
1781 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
1782 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
1783 [arch/$LINUX_ARCH/mm/numa.c],
1784 [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
1785 [node_to_cpumask_map is exported by
1786 the kernel])]) # x86_64
1789 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1790 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1791 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1792 LB_LINUX_TRY_COMPILE([
1793 #include <linux/blkdev.h>
1795 blk_queue_logical_block_size(NULL, 0);
1798 AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1799 [blk_queue_logical_block_size is defined])
1807 # 2.6.32 changes cache_detail's member cache_request to cache_upcall
1808 # in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
1809 AC_DEFUN([LC_CACHE_UPCALL],
1810 [AC_MSG_CHECKING([if cache_detail has cache_upcall field])
1811 LB_LINUX_TRY_COMPILE([
1812 #include <linux/sunrpc/cache.h>
1814 struct cache_detail cd;
1815 cd.cache_upcall = NULL;
1818 AC_DEFINE(HAVE_CACHE_UPCALL, 1,
1819 [cache_detail has cache_upcall field])
1825 # 2.6.32 add a limits member in struct request_queue.
1826 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1827 [AC_MSG_CHECKING([if request_queue has a limits field])
1828 LB_LINUX_TRY_COMPILE([
1829 #include <linux/blkdev.h>
1831 struct request_queue rq;
1832 rq.limits.io_min = 0;
1835 AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1836 [request_queue has a limits field])
1842 # 2.6.32 has bdi_register() functions.
1843 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1844 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1845 [mm/backing-dev.c],[
1846 AC_DEFINE(HAVE_BDI_REGISTER, 1,
1847 [bdi_register function is present])
1852 # 2.6.32 add s_bdi for super block
1853 AC_DEFUN([LC_SB_BDI],
1854 [AC_MSG_CHECKING([if super_block has s_bdi field])
1855 LB_LINUX_TRY_COMPILE([
1856 #include <linux/fs.h>
1858 struct super_block sb;
1862 AC_DEFINE(HAVE_SB_BDI, 1,
1863 [super_block has s_bdi field])
1869 # 2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
1870 AC_DEFUN([LC_BDI_NAME],
1871 [AC_MSG_CHECKING([if backing_device_info has name field])
1872 LB_LINUX_TRY_COMPILE([
1873 #include <linux/blkkdev.h>
1875 struct backing_dev_info bdi;
1879 AC_DEFINE(HAVE_BDI_NAME, 1,
1880 [backing_device_info has name field])
1886 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1887 # check blk_queue_max_sectors and use it until disappear.
1888 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1889 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1890 LB_LINUX_TRY_COMPILE([
1891 #include <linux/blkdev.h>
1893 blk_queue_max_sectors(NULL, 0);
1896 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1897 [blk_queue_max_sectors is defined])
1903 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
1904 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1905 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1906 LB_LINUX_TRY_COMPILE([
1907 #include <linux/blkdev.h>
1909 blk_queue_max_segments(NULL, 0);
1912 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1913 [blk_queue_max_segments is defined])
1922 # Check if kernel has been patched for 64-bit quota limits support.
1923 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
1924 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
1925 # that in the absence of quotaio_v1.h in the kernel headers.
1927 AC_DEFUN([LC_QUOTA64],[
1928 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1929 tmp_flags="$EXTRA_KCFLAGS"
1930 EXTRA_KCFLAGS="-I$LINUX/fs"
1931 LB_LINUX_TRY_COMPILE([
1932 #include <linux/kernel.h>
1933 #include <linux/fs.h>
1934 #ifdef HAVE_QUOTAIO_H
1935 # include <linux/quotaio_v2.h>
1936 int versions[] = V2_INITQVERSIONS_R1;
1937 struct v2_disk_dqblk_r1 dqblk_r1;
1938 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
1939 # include <quota/quotaio_v2.h>
1940 struct v2r1_disk_dqblk dqblk_r1;
1941 #elif defined(HAVE_FS_QUOTAIO_H)
1942 # include <quotaio_v2.h>
1943 struct v2r1_disk_dqblk dqblk_r1;
1945 #include <linux/quota.h>
1946 int ver = QFMT_VFS_V1;
1949 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1950 AC_MSG_RESULT([yes])
1952 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1953 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1957 EXTRA_KCFLAGS=$tmp_flags
1960 # 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
1961 AC_DEFUN([LC_SET_CPUS_ALLOWED],
1962 [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
1963 LB_LINUX_TRY_COMPILE(
1964 [#include <linux/sched.h>],
1965 [struct task_struct *p = NULL;
1966 cpumask_t mask = { { 0 } };
1967 (void) set_cpus_allowed(p, mask);],
1968 [AC_MSG_RESULT([yes])
1969 AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
1970 [set_cpus_allowed is exported by the kernel])],
1971 [AC_MSG_RESULT([no])] )])
1975 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1976 # d_obtain_alias() for getting anonymous dentries
1978 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1979 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1980 LB_LINUX_TRY_COMPILE([
1981 #include <linux/dcache.h>
1983 d_obtain_alias(NULL);
1985 AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1986 [d_obtain_alias exist in kernel])
1987 AC_MSG_RESULT([yes])
1994 # LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
1996 AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
1997 [LB_CHECK_SYMBOL_EXPORT(
1998 [generic_error_remove_page],
2000 [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
2001 [kernel export generic_error_remove_page])],
2007 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
2009 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
2010 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
2011 LB_LINUX_TRY_COMPILE([
2012 #include <asm/atomic.h>
2013 #include <linux/spinlock.h>
2014 #include <linux/fs_struct.h>
2016 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
2018 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
2019 [fs_struct.lock use rwlock])
2020 AC_MSG_RESULT([yes])
2027 # 2.6.36 super_operations add evict_inode method. it hybird of
2028 # delete_inode & clear_inode.
2030 AC_DEFUN([LC_SBOPS_EVICT_INODE],
2031 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
2032 LB_LINUX_TRY_COMPILE([
2033 #include <linux/fs.h>
2035 ((struct super_operations *)0)->evict_inode(NULL);
2037 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
2038 [super_operations.evict_inode() is exist in kernel])
2039 AC_MSG_RESULT([yes])
2046 # 2.6.35 file_operations.fsync taken 2 arguments.
2048 AC_DEFUN([LC_FILE_FSYNC],
2049 [AC_MSG_CHECKING([if file_operations.fsync taken 2 arguments])
2050 LB_LINUX_TRY_COMPILE([
2051 #include <linux/fs.h>
2053 ((struct file_operations *)0)->fsync(NULL, 0);
2055 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
2056 [file_operations.fsync taken 2 arguments])
2057 AC_MSG_RESULT([yes])
2064 # 2.6.38 export blkdev_get_by_dev
2066 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
2067 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
2069 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
2070 [blkdev_get_by_dev is exported by the kernel])
2076 # 2.6.38 vfsmount.mnt_count doesn't use atomic_t
2078 AC_DEFUN([LC_ATOMIC_MNT_COUNT],
2079 [AC_MSG_CHECKING([if vfsmount.mnt_count is atomic_t])
2080 LB_LINUX_TRY_COMPILE([
2081 #include <asm/atomic.h>
2082 #include <linux/fs.h>
2083 #include <linux/mount.h>
2085 ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
2087 AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
2088 [vfsmount.mnt_count is atomic_t])
2089 AC_MSG_RESULT([yes])
2096 # 2.6.38 use path as 4th parameter in quota_on.
2098 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
2099 [AC_MSG_CHECKING([quota_on use path as parameter])
2100 tmp_flags="$EXTRA_KCFLAGS"
2101 EXTRA_KCFLAGS="-Werror"
2102 LB_LINUX_TRY_COMPILE([
2103 #include <linux/fs.h>
2104 #include <linux/quota.h>
2106 ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
2108 AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
2109 [quota_on use path as 4th paramter])
2110 AC_MSG_RESULT([yes])
2114 EXTRA_KCFLAGS="$tmp_flags"
2118 # 2.6.39 remove unplug_fn from request_queue.
2120 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
2121 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
2122 LB_LINUX_TRY_COMPILE([
2123 #include <linux/blkdev.h>
2125 struct request_queue rq;
2126 memset(rq.unplug_fn, 0, sizeof(rq.unplug_fn));
2128 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
2129 [request_queue has unplug_fn field])
2130 AC_MSG_RESULT([yes])
2137 # 2.6.38 generic_permission taken 4 paremater.
2138 # in fact, it means rcu-walk aware permission bring.
2140 AC_DEFUN([LC_GENERIC_PERMISSION],
2141 [AC_MSG_CHECKING([if generic_permission take 4 arguments])
2142 LB_LINUX_TRY_COMPILE([
2143 #include <linux/fs.h>
2145 generic_permission(NULL, 0, 0, NULL);
2147 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
2148 [generic_permission taken 4 arguments])
2149 AC_MSG_RESULT([yes])
2156 # 2.6.38 export simple_setattr
2158 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
2159 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
2161 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
2162 [simple_setattr is exported by the kernel])
2170 # Lustre linux kernel checks
2172 AC_DEFUN([LC_PROG_LINUX],
2173 [LC_LUSTRE_VERSION_H
2176 LC_CONFIG_LIBLUSTRE_RECOVERY
2177 LC_CONFIG_HEALTH_CHECK_WRITE
2178 LC_CONFIG_LRU_RESIZE
2180 LC_LLITE_LLOOP_MODULE
2183 LC_EXPORT_TRUNCATE_COMPLETE
2184 LC_EXPORT_D_REHASH_COND
2185 LC_EXPORT___D_REHASH
2186 LC_EXPORT_NODE_TO_CPUMASK
2188 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
2194 LC_STRUCT_INTENT_FILE
2199 LC_FUNC_HAVE_CAN_SLEEP_ARG
2202 LC_COOKIE_FOLLOW_LINK
2213 LC_EXPORT_SYNCHRONIZE_RCU
2219 LC_SECURITY_PLUG # for SLES10 SP2
2227 LC_STATFS_DENTRY_PARAM
2229 LC_INVALIDATEPAGE_RETURN_INT
2230 LC_UMOUNTBEGIN_HAS_VFSMOUNT
2232 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
2234 if test x$enable_server = xyes ; then
2235 LC_EXPORT_INVALIDATE_MAPPING_PAGES
2238 #2.6.18 + RHEL5 (fc6)
2249 LC_CANCEL_DIRTY_PAGE
2251 # raid5-zerocopy patch
2255 LC_INVALIDATE_BDEV_2ARG
2256 LC_ASYNC_BLOCK_CIPHER
2258 LC_STRUCT_BLKCIPHER_DESC
2259 LC_FS_RENAME_DOES_D_MOVE
2262 LC_UNREGISTER_BLKDEV_RETURN_INT
2263 LC_KERNEL_SPLICE_READ
2268 LC_EXPORTFS_DECODE_FH
2278 LC_MAPPING_CAP_WRITEBACK_DIRTY
2281 LC_FS_STRUCT_USE_PATH
2284 LC_INODE_PERMISION_2ARGS
2287 LC_READ_INODE_IN_SBOPS
2288 LC_EXPORT_INODE_PERMISSION
2294 # 2.6.27.15-2 sles11
2297 LC_VFS_SYMLINK_5ARGS
2299 LC_SB_ANY_QUOTA_ACTIVE
2300 LC_SB_HAS_QUOTA_ACTIVE
2301 LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
2304 LC_SB_ANY_QUOTA_LOADED
2307 LC_EXPORT_CPUMASK_OF_NODE
2310 LC_BLK_QUEUE_LOG_BLK_SIZE
2313 LC_REQUEST_QUEUE_LIMITS
2314 LC_EXPORT_BDI_REGISTER
2316 LC_BLK_QUEUE_MAX_SECTORS
2317 LC_BLK_QUEUE_MAX_SEGMENTS
2320 LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
2324 LC_EXPORT_SIMPLE_SETATTR
2328 LC_SBOPS_EVICT_INODE
2332 LC_BLKDEV_GET_BY_DEV
2333 LC_GENERIC_PERMISSION
2334 LC_QUOTA_ON_USE_PATH
2337 LC_REQUEST_QUEUE_UNPLUG_FN
2340 if test x$enable_server = xyes ; then
2341 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2342 LC_FUNC_DEV_SET_RDONLY
2349 # LC_CONFIG_CLIENT_SERVER
2351 # Build client/server sides of Lustre
2353 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2354 [AC_MSG_CHECKING([whether to build Lustre server support])
2355 AC_ARG_ENABLE([server],
2356 AC_HELP_STRING([--disable-server],
2357 [disable Lustre server support]),
2358 [],[enable_server='yes'])
2359 AC_MSG_RESULT([$enable_server])
2361 AC_MSG_CHECKING([whether to build Lustre client support])
2362 AC_ARG_ENABLE([client],
2363 AC_HELP_STRING([--disable-client],
2364 [disable Lustre client support]),
2365 [],[enable_client='yes'])
2366 AC_MSG_RESULT([$enable_client])])
2369 # LC_CONFIG_LIBLUSTRE
2371 # whether to build liblustre
2373 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2374 [AC_MSG_CHECKING([whether to build Lustre library])
2375 AC_ARG_ENABLE([liblustre],
2376 AC_HELP_STRING([--disable-liblustre],
2377 [disable building of Lustre library]),
2378 [],[enable_liblustre=$with_sysio])
2379 AC_MSG_RESULT([$enable_liblustre])
2380 # only build sysio if liblustre is built
2381 with_sysio="$enable_liblustre"
2383 AC_MSG_CHECKING([whether to build liblustre tests])
2384 AC_ARG_ENABLE([liblustre-tests],
2385 AC_HELP_STRING([--enable-liblustre-tests],
2386 [enable liblustre tests, if --disable-tests is used]),
2387 [],[enable_liblustre_tests=$enable_tests])
2388 if test x$enable_liblustre != xyes ; then
2389 enable_liblustre_tests='no'
2391 AC_MSG_RESULT([$enable_liblustre_tests])
2393 AC_MSG_CHECKING([whether to enable liblustre acl])
2394 AC_ARG_ENABLE([liblustre-acl],
2395 AC_HELP_STRING([--disable-liblustre-acl],
2396 [disable ACL support for liblustre]),
2397 [],[enable_liblustre_acl=yes])
2398 AC_MSG_RESULT([$enable_liblustre_acl])
2399 if test x$enable_liblustre_acl = xyes ; then
2400 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2403 # 2.6.29 change prepare/commit_write to write_begin/end
2404 AC_DEFUN([LC_WRITE_BEGIN_END],
2405 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2406 LB_LINUX_TRY_COMPILE([
2407 #include <linux/fs.h>
2408 #include <linux/pagemap.h>
2409 #ifdef HAVE_LINUX_MMTYPES_H
2410 #include <linux/mm_types.h>
2413 struct address_space_operations aops;
2416 aops.write_begin = NULL;
2417 aops.write_end = NULL;
2418 page = grab_cache_page_write_begin(NULL, 0, 0);
2420 AC_MSG_RESULT([yes])
2421 AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2422 [kernel has .write_begin/end])
2428 # 2.6.29 blkdev_put has 2 arguments
2429 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2430 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2431 LB_LINUX_TRY_COMPILE([
2432 #include <linux/fs.h>
2434 blkdev_put(NULL, 0);
2436 AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2437 [blkdev_put needs 2 paramters])
2438 AC_MSG_RESULT([yes])
2444 # 2.6.29 dentry_open has 4 arguments
2445 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2446 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2447 LB_LINUX_TRY_COMPILE([
2448 #include <linux/fs.h>
2450 dentry_open(NULL, NULL, 0, NULL);
2452 AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2453 [dentry_open needs 4 paramters])
2454 AC_MSG_RESULT([yes])
2460 # 2.6.29 split file and anonymous page queues
2461 AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
2462 [AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
2463 LB_LINUX_TRY_COMPILE([
2464 #include <linux/mm.h>
2465 #include <linux/pagevec.h>
2467 struct pagevec lru_pagevec;
2469 pagevec_init(&lru_pagevec, 0);
2470 pagevec_lru_add_file(&lru_pagevec);
2472 AC_MSG_RESULT([yes])
2473 AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
2474 [kernel has .pagevec_lru_add_file])
2483 AC_ARG_ENABLE(mpitests,
2484 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2485 [include mpi tests]),
2496 MPICC_WRAPPER=$enableval
2506 if test x$enable_mpitests != xno; then
2507 AC_MSG_CHECKING([whether mpitests can be built])
2515 MPI_Initialized(&flag);
2518 AC_MSG_RESULT([yes])
2525 AC_SUBST(MPICC_WRAPPER)
2527 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2528 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2531 LC_CONFIG_LIBLUSTRE_RECOVERY
2537 # whether to enable quota support global control
2539 AC_DEFUN([LC_CONFIG_QUOTA],
2540 [AC_ARG_ENABLE([quota],
2541 AC_HELP_STRING([--enable-quota],
2542 [enable quota support]),
2543 [],[enable_quota='yes'])
2546 AC_DEFUN([LC_QUOTA],
2550 AC_CHECK_HEADER(sys/quota.h,
2551 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2552 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2558 # whether to enable split support
2560 AC_DEFUN([LC_CONFIG_SPLIT],
2561 [AC_MSG_CHECKING([whether to enable split support])
2562 AC_ARG_ENABLE([split],
2563 AC_HELP_STRING([--enable-split],
2564 [enable split support]),
2565 [],[enable_split='no'])
2566 AC_MSG_RESULT([$enable_split])
2567 if test x$enable_split != xno; then
2568 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2572 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2573 [AC_MSG_CHECKING([tux_info])
2574 LB_LINUX_TRY_COMPILE([
2575 #include <linux/sched.h>
2577 struct task_struct task;
2580 AC_MSG_RESULT([yes])
2581 AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2582 have_task_clenv_store='yes'
2589 # LC_LLITE_LLOOP_MODULE
2590 # lloop_llite.ko does not currently work with page sizes
2593 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2594 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2595 LB_LINUX_TRY_COMPILE([
2596 #include <asm/page.h>
2598 #if PAGE_SIZE >= 65536
2599 #error "PAGE_SIZE >= 65536"
2602 enable_llite_lloop_module='yes'
2603 AC_MSG_RESULT([yes])
2605 enable_llite_lloop_module='no'
2613 # other configure checks
2615 AC_DEFUN([LC_CONFIGURE],
2616 [LC_CONFIG_OBD_BUFFER_SIZE
2618 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2619 CFLAGS="$CFLAGS -Werror"
2622 # maximum MDS thread count
2625 # include/liblustre.h
2626 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2628 # liblustre/llite_lib.h
2629 AC_CHECK_HEADERS([xtio.h file.h])
2632 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2635 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2636 AC_CHECK_FUNCS([inet_ntoa])
2638 # libsysio/src/readlink.c
2641 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2642 AC_CHECK_HEADERS([linux/random.h], [], [],
2643 [#ifdef HAVE_LINUX_TYPES_H
2644 # include <linux/types.h>
2649 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2651 # check for -lz support
2655 [AC_CHECK_HEADERS([zlib.h],
2657 AC_DEFINE([HAVE_ADLER], 1,
2658 [support alder32 checksum type])],
2659 [AC_MSG_WARN([No zlib-devel package found,
2660 unable to use adler32 checksum])])],
2661 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2666 AC_ARG_ENABLE([mindf],
2667 AC_HELP_STRING([--enable-mindf],
2668 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2670 if test "$enable_mindf" = "yes" ; then
2671 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2674 AC_ARG_ENABLE([fail_alloc],
2675 AC_HELP_STRING([--disable-fail-alloc],
2676 [disable randomly alloc failure]),
2677 [],[enable_fail_alloc=yes])
2678 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2679 AC_MSG_RESULT([$enable_fail_alloc])
2680 if test x$enable_fail_alloc != xno ; then
2681 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2684 AC_ARG_ENABLE([invariants],
2685 AC_HELP_STRING([--enable-invariants],
2686 [enable invariant checking (cpu intensive)]),
2688 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2689 AC_MSG_RESULT([$enable_invariants])
2690 if test x$enable_invariants = xyes ; then
2691 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2694 AC_ARG_ENABLE([lu_ref],
2695 AC_HELP_STRING([--enable-lu_ref],
2696 [enable lu_ref reference tracking code]),
2698 AC_MSG_CHECKING([whether to track references with lu_ref])
2699 AC_MSG_RESULT([$enable_lu_ref])
2700 if test x$enable_lu_ref = xyes ; then
2701 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2704 AC_ARG_ENABLE([pgstate-track],
2705 AC_HELP_STRING([--enable-pgstate-track],
2706 [enable page state tracking]),
2707 [enable_pgstat_track='yes'],[])
2708 AC_MSG_CHECKING([whether to enable page state tracking])
2709 AC_MSG_RESULT([$enable_pgstat_track])
2710 if test x$enable_pgstat_track = xyes ; then
2711 AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2712 [enable page state tracking code])
2719 LC_DENTRY_OPEN_4ARGS
2720 LC_PAGEVEC_LRU_ADD_FILE
2727 # AM_CONDITIONALS for lustre
2729 AC_DEFUN([LC_CONDITIONALS],
2730 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2731 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2732 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2733 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2734 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2735 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2736 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2737 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2738 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2739 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2740 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2741 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2742 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2743 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2744 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2750 # files that should be generated with AC_OUTPUT
2752 AC_DEFUN([LC_CONFIG_FILES],
2756 lustre/autoconf/Makefile
2757 lustre/conf/Makefile
2758 lustre/contrib/Makefile
2760 lustre/include/Makefile
2761 lustre/include/lustre_ver.h
2762 lustre/include/linux/Makefile
2763 lustre/include/lustre/Makefile
2764 lustre/kernel_patches/targets/2.6-rhel6.target
2765 lustre/kernel_patches/targets/2.6-rhel5.target
2766 lustre/kernel_patches/targets/2.6-sles10.target
2767 lustre/kernel_patches/targets/2.6-sles11.target
2768 lustre/kernel_patches/targets/2.6-oel5.target
2769 lustre/kernel_patches/targets/2.6-fc11.target
2770 lustre/kernel_patches/targets/2.6-fc12.target
2771 lustre/ldlm/Makefile
2773 lustre/fid/autoMakefile
2774 lustre/liblustre/Makefile
2775 lustre/liblustre/tests/Makefile
2776 lustre/liblustre/tests/mpi/Makefile
2777 lustre/llite/Makefile
2778 lustre/llite/autoMakefile
2779 lustre/lclient/Makefile
2781 lustre/lov/autoMakefile
2782 lustre/lvfs/Makefile
2783 lustre/lvfs/autoMakefile
2785 lustre/mdc/autoMakefile
2787 lustre/lmv/autoMakefile
2789 lustre/mds/autoMakefile
2791 lustre/mdt/autoMakefile
2793 lustre/cmm/autoMakefile
2795 lustre/mdd/autoMakefile
2797 lustre/fld/autoMakefile
2798 lustre/obdclass/Makefile
2799 lustre/obdclass/autoMakefile
2800 lustre/obdclass/linux/Makefile
2801 lustre/obdecho/Makefile
2802 lustre/obdecho/autoMakefile
2803 lustre/obdfilter/Makefile
2804 lustre/obdfilter/autoMakefile
2806 lustre/osc/autoMakefile
2808 lustre/ost/autoMakefile
2809 lustre/osd-ldiskfs/Makefile
2810 lustre/osd-ldiskfs/autoMakefile
2812 lustre/mgc/autoMakefile
2814 lustre/mgs/autoMakefile
2815 lustre/ptlrpc/Makefile
2816 lustre/ptlrpc/autoMakefile
2817 lustre/ptlrpc/gss/Makefile
2818 lustre/ptlrpc/gss/autoMakefile
2819 lustre/quota/Makefile
2820 lustre/quota/autoMakefile
2821 lustre/scripts/Makefile
2822 lustre/tests/Makefile
2823 lustre/tests/mpi/Makefile
2824 lustre/utils/Makefile
2825 lustre/utils/gss/Makefile
2826 lustre/obdclass/darwin/Makefile