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])
15 # lustre specific paths
17 AC_DEFUN([LC_PATH_DEFAULTS],
18 [# ptlrpc kernel build requires this
26 demodir='$(docdir)/demo'
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
36 # is the target os supported?
38 AC_DEFUN([LC_TARGET_SUPPORTED],
52 # that ext3 is enabled in the kernel
54 AC_DEFUN([LC_CONFIG_EXT3],
55 [LB_LINUX_CONFIG([EXT3_FS],[],[
56 LB_LINUX_CONFIG([EXT3_FS_MODULE],[],[$2])
58 LB_LINUX_CONFIG([EXT3_FS_XATTR],[$1],[$3])
64 # If we have (and can build) fshooks.h
66 AC_DEFUN([LC_FSHOOKS],
67 [LB_CHECK_FILE([$LINUX/include/linux/fshooks.h],[
68 AC_MSG_CHECKING([if fshooks.h can be compiled])
69 LB_LINUX_TRY_COMPILE([
70 #include <linux/fshooks.h>
75 AC_MSG_WARN([You might have better luck with gcc 3.3.x.])
76 AC_MSG_WARN([You can set CC=gcc33 before running configure.])
77 AC_MSG_ERROR([Your compiler cannot build fshooks.h.])
88 # rh 2.4.18 has iobuf->dovary, but other kernels do not
90 AC_DEFUN([LC_STRUCT_KIOBUF],
91 [AC_MSG_CHECKING([if struct kiobuf has a dovary field])
92 LB_LINUX_TRY_COMPILE([
93 #include <linux/iobuf.h>
99 AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
106 # LC_FUNC_COND_RESCHED
108 # cond_resched() was introduced in 2.4.20
110 AC_DEFUN([LC_FUNC_COND_RESCHED],
111 [AC_MSG_CHECKING([if kernel offers cond_resched])
112 LB_LINUX_TRY_COMPILE([
113 #include <linux/sched.h>
118 AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
125 # LC_FUNC_RELEASEPAGE_WITH_GFP
127 # if ->releasepage() takes a gfp_t arg in 2.6.9
128 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
129 # while others either don't have gfp_t or pass gfp_t as the parameter.
131 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
132 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
133 RELEASEPAGE_WITH_GFP="`grep -c 'releasepage.*gfp_t' $LINUX/include/linux/fs.h`"
134 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
135 AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
136 [releasepage with gfp_t parameter])
145 # LC_FUNC_ZAP_PAGE_RANGE
147 # if zap_page_range() takes a vma arg
149 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
150 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
151 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
152 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
153 AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
163 # if proc_fs.h defines PDE()
165 AC_DEFUN([LC_FUNC_PDE],
166 [AC_MSG_CHECKING([if kernel defines PDE])
167 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
168 if test "$HAVE_PDE" != 0 ; then
169 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
177 # LC_FUNC_FILEMAP_FDATASYNC
179 # if filemap_fdatasync() exists
181 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
182 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
183 LB_LINUX_TRY_COMPILE([
184 #include <linux/fs.h>
186 int (*foo)(struct address_space *)= filemap_fdatawrite;
189 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
198 # if direct_IO takes a struct file argument
200 AC_DEFUN([LC_FUNC_DIRECT_IO],
201 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
202 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
203 if test "$HAVE_DIO_FILE" != 0 ; then
204 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
212 # LC_HEADER_MM_INLINE
214 # RHEL kernels define page_count in mm_inline.h
216 AC_DEFUN([LC_HEADER_MM_INLINE],
217 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
218 LB_LINUX_TRY_COMPILE([
219 #include <linux/mm_inline.h>
222 #error mm_inline.h does not define page_count
226 AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
235 # if inode->i_alloc_sem exists
237 AC_DEFUN([LC_STRUCT_INODE],
238 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
239 LB_LINUX_TRY_COMPILE([
240 #include <linux/fs.h>
241 #include <linux/version.h>
244 return (char *)&i.i_alloc_sem - (char *)&i;
247 AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
254 # LC_FUNC_REGISTER_CACHE
256 # if register_cache() is defined by kernel
258 # There are two ways to shrink one customized cache in linux kernels. For the
259 # kernels are prior than 2.6.5(?), register_cache() is used, and for latest
260 # kernels, set_shrinker() is used instead.
262 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
263 [AC_MSG_CHECKING([if kernel defines cache pressure hook])
264 LB_LINUX_TRY_COMPILE([
265 #include <linux/mm.h>
269 set_shrinker(1, shrinker);
271 AC_MSG_RESULT([set_shrinker])
272 AC_DEFINE(HAVE_SHRINKER_CACHE, 1, [shrinker_cache found])
273 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [shrinkers should return int])
275 LB_LINUX_TRY_COMPILE([
276 #include <linux/list.h>
277 #include <linux/cache_def.h>
279 struct cache_definition cache;
281 AC_MSG_RESULT([register_cache])
282 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
283 AC_MSG_CHECKING([if kernel expects return from cache shrink ])
284 tmp_flags="$EXTRA_KCFLAGS"
285 EXTRA_KCFLAGS="-Werror"
286 LB_LINUX_TRY_COMPILE([
287 #include <linux/list.h>
288 #include <linux/cache_def.h>
290 struct cache_definition c;
291 c.shrinker = (int (*)(int, unsigned int))1;
293 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1,
294 [kernel expects return from shrink_cache])
299 EXTRA_KCFLAGS="$tmp_flags"
307 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
309 # check for our patched grab_cache_page_nowait_gfp() function
311 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
312 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
313 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
314 if test "$HAVE_GCPN_GFP" != 0 ; then
315 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
316 [kernel has grab_cache_page_nowait_gfp()])
324 # LC_FUNC_DEV_SET_RDONLY
326 # check for the old-style dev_set_rdonly which took an extra "devno" param
327 # and can only set a single device to discard writes at one time
329 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
330 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
331 LB_LINUX_TRY_COMPILE([
332 #include <linux/fs.h>
334 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
335 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
339 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
341 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
342 kernel patches from Lustre version 1.4.3 or above.])
347 # LC_CONFIG_BACKINGFS
349 # setup, check the backing filesystem
351 AC_DEFUN([LC_CONFIG_BACKINGFS],
355 if test x$with_ldiskfs = xno ; then
358 if test x$linux25$enable_server = xyesyes ; then
359 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
362 # --- Check that ext3 and ext3 xattr are enabled in the kernel
364 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
366 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
367 AC_MSG_WARN([This build may fail.])
371 LB_DEFINE_LDISKFS_OPTIONS
374 AC_MSG_CHECKING([which backing filesystem to use])
375 AC_MSG_RESULT([$BACKINGFS])
382 # the pinger is temporary, until we have the recovery node in place
384 AC_DEFUN([LC_CONFIG_PINGER],
385 [AC_MSG_CHECKING([whether to enable pinger support])
386 AC_ARG_ENABLE([pinger],
387 AC_HELP_STRING([--disable-pinger],
388 [disable recovery pinger support]),
389 [],[enable_pinger='yes'])
390 AC_MSG_RESULT([$enable_pinger])
391 if test x$enable_pinger != xno ; then
392 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
399 # do checksum of bulk data between client and OST
401 AC_DEFUN([LC_CONFIG_CHECKSUM],
402 [AC_MSG_CHECKING([whether to enable data checksum support])
403 AC_ARG_ENABLE([checksum],
404 AC_HELP_STRING([--disable-checksum],
405 [disable data checksum support]),
406 [],[enable_checksum='yes'])
407 AC_MSG_RESULT([$enable_checksum])
408 if test x$enable_checksum != xno ; then
409 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
414 # LC_CONFIG_HEALTH_CHECK_WRITE
416 # Turn on the actual write to the disk
418 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
419 [AC_MSG_CHECKING([whether to enable a write with the health check])
420 AC_ARG_ENABLE([health-write],
421 AC_HELP_STRING([--enable-health-write],
422 [enable disk writes when doing health check]),
423 [],[enable_health_write='no'])
424 AC_MSG_RESULT([$enable_health_write])
425 if test x$enable_health_write == xyes ; then
426 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
431 # LC_CONFIG_LIBLUSTRE_RECOVERY
433 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
434 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
435 AC_ARG_ENABLE([liblustre-recovery],
436 AC_HELP_STRING([--disable-liblustre-recovery],
437 [disable liblustre recovery support]),
438 [],[enable_liblustre_recovery='yes'])
439 AC_MSG_RESULT([$enable_liblustre_recovery])
440 if test x$enable_liblustre_recovery != xno ; then
441 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
446 # LC_CONFIG_OBD_BUFFER_SIZE
448 # the maximum buffer size of lctl ioctls
450 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
451 [AC_MSG_CHECKING([maximum OBD ioctl size])
452 AC_ARG_WITH([obd-buffer-size],
453 AC_HELP_STRING([--with-obd-buffer-size=[size]],
454 [set lctl ioctl maximum bytes (default=8192)]),
456 OBD_BUFFER_SIZE=$with_obd_buffer_size
460 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
461 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
467 # AIX does not have statfs.f_namelen
469 AC_DEFUN([LC_STRUCT_STATFS],
470 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
471 LB_LINUX_TRY_COMPILE([
472 #include <linux/vfs.h>
478 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
485 # LC_READLINK_SSIZE_T
487 AC_DEFUN([LC_READLINK_SSIZE_T],
488 [AC_MSG_CHECKING([if readlink returns ssize_t])
492 ssize_t readlink(const char *, char *, size_t);
495 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
501 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
502 [AC_MSG_CHECKING([if kernel offers page_mapped])
503 LB_LINUX_TRY_COMPILE([
504 #include <linux/mm.h>
509 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
515 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
516 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
517 LB_LINUX_TRY_COMPILE([
518 #include <linux/fs.h>
520 struct file_operations fops;
521 &fops.unlocked_ioctl;
524 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
530 AC_DEFUN([LC_FILEMAP_POPULATE],
531 [AC_MSG_CHECKING([for exported filemap_populate])
532 LB_LINUX_TRY_COMPILE([
533 #include <asm/page.h>
534 #include <linux/mm.h>
536 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
539 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
545 AC_DEFUN([LC_D_ADD_UNIQUE],
546 [AC_MSG_CHECKING([for d_add_unique])
547 LB_LINUX_TRY_COMPILE([
548 #include <linux/dcache.h>
550 d_add_unique(NULL, NULL);
553 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
559 AC_DEFUN([LC_BIT_SPINLOCK_H],
560 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
561 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
562 LB_LINUX_TRY_COMPILE([
563 #include <asm/processor.h>
564 #include <linux/spinlock.h>
565 #include <linux/bit_spinlock.h>
568 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
579 # If we have xattr_acl.h
581 AC_DEFUN([LC_XATTR_ACL],
582 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
583 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
584 LB_LINUX_TRY_COMPILE([
585 #include <linux/xattr_acl.h>
588 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
599 # If we have fiemap.h
600 # after 2.6.27 use fiemap.h in include/linux
602 AC_DEFUN([LC_LINUX_FIEMAP_H],
603 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
604 AC_MSG_CHECKING([if fiemap.h can be compiled])
605 LB_LINUX_TRY_COMPILE([
606 #include <linux/fiemap.h>
609 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
618 AC_DEFUN([LC_STRUCT_INTENT_FILE],
619 [AC_MSG_CHECKING([if struct open_intent has a file field])
620 LB_LINUX_TRY_COMPILE([
621 #include <linux/fs.h>
622 #include <linux/namei.h>
624 struct open_intent intent;
628 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
635 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
636 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
637 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
638 LB_LINUX_TRY_COMPILE([
639 #include <linux/posix_acl_xattr.h>
642 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
655 # starting from 2.6.19 linux kernel exports __iget()
657 AC_DEFUN([LC_EXPORT___IGET],
658 [LB_CHECK_SYMBOL_EXPORT([__iget],
660 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
666 AC_DEFUN([LC_LUSTRE_VERSION_H],
667 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
668 rm -f "$LUSTRE/include/linux/lustre_version.h"
670 touch "$LUSTRE/include/linux/lustre_version.h"
671 if test x$enable_server = xyes ; then
672 AC_MSG_WARN([Unpatched kernel detected.])
673 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
674 AC_MSG_WARN([disabling server build])
680 AC_DEFUN([LC_FUNC_SET_FS_PWD],
681 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
683 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
689 # check for FS_RENAME_DOES_D_MOVE flag
691 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
692 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
693 LB_LINUX_TRY_COMPILE([
694 #include <linux/fs.h>
696 int v = FS_RENAME_DOES_D_MOVE;
699 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
706 # LC_FUNC_MS_FLOCK_LOCK
708 # SLES9 kernel has MS_FLOCK_LOCK sb flag
710 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
711 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
712 LB_LINUX_TRY_COMPILE([
713 #include <linux/fs.h>
715 int flags = MS_FLOCK_LOCK;
717 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
718 [kernel has MS_FLOCK_LOCK flag])
726 # LC_FUNC_HAVE_CAN_SLEEP_ARG
728 # SLES9 kernel has third arg can_sleep
729 # in fs/locks.c: flock_lock_file_wait()
731 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
732 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
733 LB_LINUX_TRY_COMPILE([
734 #include <linux/fs.h>
738 struct file_lock *file_lock;
739 flock_lock_file_wait(file, file_lock, cansleep);
741 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
742 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
752 # rhel4.2 kernel has f_op->flock field
754 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
755 [AC_MSG_CHECKING([if struct file_operations has flock field])
756 LB_LINUX_TRY_COMPILE([
757 #include <linux/fs.h>
759 struct file_operations ll_file_operations_flock;
760 ll_file_operations_flock.flock = NULL;
762 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
763 [struct file_operations has flock field])
771 # LC_FUNC_MS_FLOCK_LOCK
773 # SLES9 kernel has MS_FLOCK_LOCK sb flag
775 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
776 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
777 LB_LINUX_TRY_COMPILE([
778 #include <linux/fs.h>
780 int flags = MS_FLOCK_LOCK;
782 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
783 [kernel has MS_FLOCK_LOCK flag])
791 # LC_FUNC_HAVE_CAN_SLEEP_ARG
793 # SLES9 kernel has third arg can_sleep
794 # in fs/locks.c: flock_lock_file_wait()
796 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
797 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
798 LB_LINUX_TRY_COMPILE([
799 #include <linux/fs.h>
803 struct file_lock *file_lock;
804 flock_lock_file_wait(file, file_lock, cansleep);
806 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
807 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
817 # task struct has p_pptr instead of parent
819 AC_DEFUN([LC_TASK_PPTR],
820 [AC_MSG_CHECKING([task p_pptr found])
821 LB_LINUX_TRY_COMPILE([
822 #include <linux/sched.h>
824 struct task_struct *p;
829 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
838 # rhel4.2 kernel has f_op->flock field
840 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
841 [AC_MSG_CHECKING([if struct file_operations has flock field])
842 LB_LINUX_TRY_COMPILE([
843 #include <linux/fs.h>
845 struct file_operations ll_file_operations_flock;
846 ll_file_operations_flock.flock = NULL;
848 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
849 [struct file_operations has flock field])
857 # after 2.6.15 inode have i_mutex intead of i_sem
858 AC_DEFUN([LC_INODE_I_MUTEX],
859 [AC_MSG_CHECKING([if inode has i_mutex ])
860 LB_LINUX_TRY_COMPILE([
861 #include <linux/mutex.h>
862 #include <linux/fs.h>
867 mutex_unlock(&i.i_mutex);
870 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
871 [after 2.6.15 inode have i_mutex intead of i_sem])
878 # after 2.6.17 dquote use mutex instead if semaphore
879 AC_DEFUN([LC_DQUOTOFF_MUTEX],
880 [AC_MSG_CHECKING([use dqonoff_mutex])
881 LB_LINUX_TRY_COMPILE([
882 #include <linux/mutex.h>
883 #include <linux/fs.h>
884 #include <linux/quota.h>
886 struct quota_info dq;
888 mutex_unlock(&dq.dqonoff_mutex);
891 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
892 [after 2.6.17 dquote use mutex instead if semaphore])
899 # LC_STATFS_DENTRY_PARAM
900 # starting from 2.6.18 linux kernel uses dentry instead of
901 # super_block for first vfs_statfs argument
903 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
904 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
905 LB_LINUX_TRY_COMPILE([
906 #include <linux/fs.h>
908 int vfs_statfs(struct dentry *, struct kstatfs *);
910 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
911 [first parameter of vfs_statfs is dentry])
920 # starting from 2.6.18 kernel don't export do_kern_mount
921 # and want to use vfs_kern_mount instead.
923 AC_DEFUN([LC_VFS_KERN_MOUNT],
924 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
925 LB_LINUX_TRY_COMPILE([
926 #include <linux/mount.h>
928 vfs_kern_mount(NULL, 0, NULL, NULL);
930 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
931 [vfs_kern_mount exist in kernel])
939 # LC_INVALIDATEPAGE_RETURN_INT
940 # more 2.6 api changes. return type for the invalidatepage
941 # address_space_operation is 'void' in new kernels but 'int' in old
943 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
944 [AC_MSG_CHECKING([invalidatepage has return int])
945 LB_LINUX_TRY_COMPILE([
946 #include <linux/buffer_head.h>
948 int rc = block_invalidatepage(NULL, 0);
951 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
952 [Define if return type of invalidatepage should be int])
958 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
959 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
960 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
961 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
962 tmp_flags="$EXTRA_KCFLAGS"
963 EXTRA_KCFLAGS="-Werror"
964 LB_LINUX_TRY_COMPILE([
965 #include <linux/fs.h>
968 static void cfg_umount_begin (struct vfsmount *v, int flags)
973 static struct super_operations cfg_super_operations = {
974 .umount_begin = cfg_umount_begin,
977 cfg_super_operations.umount_begin(NULL,0);
980 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
981 [Define umount_begin need second argument])
985 EXTRA_KCFLAGS="$tmp_flags"
989 # inode don't have i_blksize field
990 AC_DEFUN([LC_INODE_BLKSIZE],
991 [AC_MSG_CHECKING([inode has i_blksize field])
992 LB_LINUX_TRY_COMPILE([
993 #include <linux/fs.h>
999 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1000 [struct inode has i_blksize field])
1006 # LC_VFS_READDIR_U64_INO
1007 # 2.6.19 use u64 for inode number instead of inode_t
1008 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1009 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1010 tmp_flags="$EXTRA_KCFLAGS"
1011 EXTRA_KCFLAGS="-Werror"
1012 LB_LINUX_TRY_COMPILE([
1013 #include <linux/fs.h>
1014 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1015 u64 ino, unsigned int d_type)
1022 filter = fillonedir;
1026 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1027 [if vfs_readdir need 64bit inode number])
1031 EXTRA_KCFLAGS="$tmp_flags"
1035 # 2.6.19 replaced writev with aio_write
1036 AC_DEFUN([LC_FILE_WRITEV],
1037 [AC_MSG_CHECKING([writev in fops])
1038 LB_LINUX_TRY_COMPILE([
1039 #include <linux/fs.h>
1041 struct file_operations *fops = NULL;
1042 fops->writev = NULL;
1045 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1052 # LC_GENERIC_FILE_READ
1053 # 2.6.19 replaced readv with aio_read
1054 AC_DEFUN([LC_FILE_READV],
1055 [AC_MSG_CHECKING([readv in fops])
1056 LB_LINUX_TRY_COMPILE([
1057 #include <linux/fs.h>
1059 struct file_operations *fops = NULL;
1063 AC_DEFINE(HAVE_FILE_READV, 1,
1071 # 2.6.18 don't export nr_pagecahe
1072 AC_DEFUN([LC_NR_PAGECACHE],
1073 [AC_MSG_CHECKING([kernel export nr_pagecache])
1074 LB_LINUX_TRY_COMPILE([
1075 #include <linux/pagemap.h>
1077 return atomic_read(&nr_pagecache);
1080 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1081 [is kernel export nr_pagecache])
1087 # LC_CANCEL_DIRTY_PAGE
1088 # 2.6.20 introduse cancel_dirty_page instead of
1090 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1091 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1092 LB_LINUX_TRY_COMPILE([
1093 #include <linux/mm.h>
1094 #include <linux/page-flags.h>
1096 cancel_dirty_page(NULL, 0);
1099 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1100 [kernel has cancel_dirty_page instead of clear_page_dirty])
1109 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1110 # it support constant page, which means the page won't be modified during the
1113 AC_DEFUN([LC_PAGE_CONSTANT],
1114 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1115 LB_LINUX_TRY_COMPILE([
1116 #include <linux/mm.h>
1117 #include <linux/page-flags.h>
1120 #error "Have no raid5 zcopy patch"
1124 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1130 # RHEL5 in FS-cache patch rename PG_checked flag
1132 AC_DEFUN([LC_PG_FS_MISC],
1133 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1134 LB_LINUX_TRY_COMPILE([
1135 #include <linux/mm.h>
1136 #include <linux/page-flags.h>
1139 #error PG_fs_misc not defined in kernel
1143 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1144 [is kernel have PG_fs_misc])
1150 # RHEL5 PageChecked and SetPageChecked defined
1151 AC_DEFUN([LC_PAGE_CHECKED],
1152 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1153 LB_LINUX_TRY_COMPILE([
1154 #include <linux/mm.h>
1155 #include <linux/page-flags.h>
1158 #error PageChecked not defined in kernel
1160 #ifndef SetPageChecked
1161 #error SetPageChecked not defined in kernel
1165 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1166 [does kernel have PageChecked and SetPageChecked])
1172 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1173 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1175 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1176 [kernel export truncate_complete_page])
1181 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1182 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1184 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1185 [d_rehash_cond is exported by the kernel])
1190 AC_DEFUN([LC_EXPORT___D_REHASH],
1191 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1193 AC_DEFINE(HAVE___D_REHASH, 1,
1194 [__d_rehash is exported by the kernel])
1199 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1200 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1202 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1203 [d_move_locked is exported by the kernel])
1208 AC_DEFUN([LC_EXPORT___D_MOVE],
1209 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1211 AC_DEFINE(HAVE___D_MOVE, 1,
1212 [__d_move is exported by the kernel])
1218 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1220 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1221 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1223 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1224 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1225 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1226 [exported invalidate_mapping_pages])],
1227 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1228 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1229 [exported invalidate_inode_pages])], [
1230 AC_MSG_ERROR([no way to invalidate pages])
1236 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
1238 # No standard kernels export this
1240 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1241 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1243 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1244 [filemap_fdatawrite_range is exported by the kernel])
1249 # The actual symbol exported varies among architectures, so we need
1250 # to check many symbols (but only in the current architecture.) No
1251 # matter what symbol is exported, the kernel #defines node_to_cpumask
1252 # to the appropriate function and that's what we use.
1253 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1254 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1255 [arch/$LINUX_ARCH/mm/numa.c],
1256 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1257 [node_to_cpumask is exported by
1258 the kernel])]) # x86_64
1259 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1260 [arch/$LINUX_ARCH/kernel/smpboot.c],
1261 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1262 [node_to_cpumask is exported by
1263 the kernel])]) # ia64
1264 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1265 [arch/$LINUX_ARCH/kernel/smpboot.c],
1266 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1267 [node_to_cpumask is exported by
1268 the kernel])]) # i386
1272 # LC_VFS_INTENT_PATCHES
1274 # check if the kernel has the VFS intent patches
1275 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1276 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1277 LB_LINUX_TRY_COMPILE([
1278 #include <linux/fs.h>
1279 #include <linux/namei.h>
1281 struct nameidata nd;
1282 struct lookup_intent *it;
1285 intent_init(it, IT_OPEN);
1286 it->d.lustre.it_disposition = 0;
1287 it->d.lustre.it_data = NULL;
1289 AC_MSG_RESULT([yes])
1290 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1296 # 2.6.22 lost second parameter for invalidate_bdev
1297 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1298 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1299 LB_LINUX_TRY_COMPILE([
1300 #include <linux/buffer_head.h>
1302 invalidate_bdev(NULL,0);
1304 AC_MSG_RESULT([yes])
1305 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1306 [invalidate_bdev has second argument])
1312 # 2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1313 AC_DEFUN([LC_RW_TREE_LOCK],
1314 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1315 tmp_flags="$EXTRA_KCFLAGS"
1316 EXTRA_KCFLAGS="-Werror"
1317 LB_LINUX_TRY_COMPILE([
1318 #include <linux/fs.h>
1320 struct address_space a;
1322 write_lock(&a.tree_lock);
1324 AC_MSG_RESULT([yes])
1325 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1329 EXTRA_KCFLAGS="$tmp_flags"
1332 # 2.6.23 have return type 'void' for unregister_blkdev
1333 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1334 [AC_MSG_CHECKING([if unregister_blkdev return int])
1335 LB_LINUX_TRY_COMPILE([
1336 #include <linux/fs.h>
1338 int i = unregister_blkdev(0,NULL);
1340 AC_MSG_RESULT([yes])
1341 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1342 [unregister_blkdev return int])
1348 # 2.6.23 change .sendfile to .splice_read
1349 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1350 [AC_MSG_CHECKING([if kernel has .splice_read])
1351 LB_LINUX_TRY_COMPILE([
1352 #include <linux/fs.h>
1354 struct file_operations file;
1356 file.splice_read = NULL;
1358 AC_MSG_RESULT([yes])
1359 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1360 [kernel has .slice_read])
1366 # 2.6.23 extract nfs export related data into exportfs.h
1367 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1370 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1371 AC_CHECK_HEADERS([linux/exportfs.h])
1378 # Lustre linux kernel checks
1380 AC_DEFUN([LC_PROG_LINUX],
1381 [LC_LUSTRE_VERSION_H
1382 if test x$enable_server = xyes ; then
1387 LC_CONFIG_LIBLUSTRE_RECOVERY
1388 LC_CONFIG_HEALTH_CHECK_WRITE
1389 LC_CONFIG_LRU_RESIZE
1390 LC_CONFIG_ADAPTIVE_TIMEOUTS
1391 LC_CONFIG_DELAYED_RECOVERY
1396 LC_EXPORT_TRUNCATE_COMPLETE
1397 LC_EXPORT_D_REHASH_COND
1398 LC_EXPORT___D_REHASH
1399 LC_EXPORT_D_MOVE_LOCKED
1401 LC_EXPORT_NODE_TO_CPUMASK
1404 LC_FUNC_COND_RESCHED
1405 LC_FUNC_RELEASEPAGE_WITH_GFP
1406 LC_FUNC_ZAP_PAGE_RANGE
1411 LC_FUNC_REGISTER_CACHE
1412 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1413 LC_FUNC_DEV_SET_RDONLY
1414 LC_FUNC_FILEMAP_FDATAWRITE
1417 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1422 LC_STRUCT_INTENT_FILE
1423 LC_POSIX_ACL_XATTR_H
1426 LC_FUNC_MS_FLOCK_LOCK
1427 LC_FUNC_HAVE_CAN_SLEEP_ARG
1430 LC_COOKIE_FOLLOW_LINK
1435 # does the kernel have VFS intent patches?
1436 LC_VFS_INTENT_PATCHES
1445 LC_SECURITY_PLUG # for SLES10 SP2
1452 LC_STATFS_DENTRY_PARAM
1454 LC_INVALIDATEPAGE_RETURN_INT
1455 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1456 if test x$enable_server = xyes ; then
1457 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1458 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1461 #2.6.18 + RHEL5 (fc6)
1467 LC_VFS_READDIR_U64_INO
1472 LC_CANCEL_DIRTY_PAGE
1474 # raid5-zerocopy patch
1478 LC_INVALIDATE_BDEV_2ARG
1479 LC_FS_RENAME_DOES_D_MOVE
1481 LC_UNREGISTER_BLKDEV_RETURN_INT
1482 LC_KERNEL_SPLICE_READ
1487 # LC_CONFIG_CLIENT_SERVER
1489 # Build client/server sides of Lustre
1491 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1492 [AC_MSG_CHECKING([whether to build Lustre server support])
1493 AC_ARG_ENABLE([server],
1494 AC_HELP_STRING([--disable-server],
1495 [disable Lustre server support]),
1496 [],[enable_server='yes'])
1497 AC_MSG_RESULT([$enable_server])
1499 AC_MSG_CHECKING([whether to build Lustre client support])
1500 AC_ARG_ENABLE([client],
1501 AC_HELP_STRING([--disable-client],
1502 [disable Lustre client support]),
1503 [],[enable_client='yes'])
1504 AC_MSG_RESULT([$enable_client])])
1507 # LC_CONFIG_LIBLUSTRE
1509 # whether to build liblustre
1511 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1512 [AC_MSG_CHECKING([whether to build Lustre library])
1513 AC_ARG_ENABLE([liblustre],
1514 AC_HELP_STRING([--disable-liblustre],
1515 [disable building of Lustre library]),
1516 [],[enable_liblustre=$with_sysio])
1517 AC_MSG_RESULT([$enable_liblustre])
1518 # only build sysio if liblustre is built
1519 with_sysio="$enable_liblustre"
1521 AC_MSG_CHECKING([whether to build liblustre tests])
1522 AC_ARG_ENABLE([liblustre-tests],
1523 AC_HELP_STRING([--enable-liblustre-tests],
1524 [enable liblustre tests, if --disable-tests is used]),
1525 [],[enable_liblustre_tests=$enable_tests])
1526 if test x$enable_liblustre != xyes ; then
1527 enable_liblustre_tests='no'
1529 AC_MSG_RESULT([$enable_liblustre_tests])
1531 AC_MSG_CHECKING([whether to enable liblustre acl])
1532 AC_ARG_ENABLE([liblustre-acl],
1533 AC_HELP_STRING([--disable-liblustre-acl],
1534 [disable ACL support for liblustre]),
1535 [],[enable_liblustre_acl=yes])
1536 AC_MSG_RESULT([$enable_liblustre_acl])
1537 if test x$enable_liblustre_acl = xyes ; then
1538 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1544 AC_ARG_ENABLE(mpitests,
1545 AC_HELP_STRING([--enable-mpitest=yes|no|mpich directory],
1546 [include mpi tests]),
1552 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1553 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1558 [[\\/$]]* | ?:[[\\/]]* )
1560 LDFLAGS="$LDFLAGS -L$with_mpi/lib"
1561 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1564 AC_MSG_ERROR([expected absolute directory name for --enable-mpitests or yes or no])
1570 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1571 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1577 if test x$enable_mpitests != xno; then
1578 AC_MSG_CHECKING([whether to mpitests can be built])
1579 AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
1580 [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
1581 [enable_mpitests=no])
1583 AC_MSG_RESULT([$enable_mpitests])
1586 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1587 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1590 LC_CONFIG_LIBLUSTRE_RECOVERY
1593 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1594 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1595 AC_ARG_ENABLE([lru_resize],
1596 AC_HELP_STRING([--enable-lru-resize],
1597 [enable lru resize support]),
1598 [],[enable_lru_resize='yes'])
1599 AC_MSG_RESULT([$enable_lru_resize])
1600 if test x$enable_lru_resize != xno; then
1601 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1605 AC_DEFUN([LC_CONFIG_ADAPTIVE_TIMEOUTS],
1606 [AC_MSG_CHECKING([whether to enable ptlrpc adaptive timeouts support])
1607 AC_ARG_ENABLE([adaptive_timeouts],
1608 AC_HELP_STRING([--disable-adaptive-timeouts],
1609 [disable ptlrpc adaptive timeouts support]),
1610 [],[enable_adaptive_timeouts='yes'])
1611 AC_MSG_RESULT([$enable_adaptive_timeouts])
1612 if test x$enable_adaptive_timeouts == xyes; then
1613 AC_DEFINE(HAVE_AT_SUPPORT, 1, [Enable adaptive timeouts support])
1617 # config delayed recovery
1618 AC_DEFUN([LC_CONFIG_DELAYED_RECOVERY],
1619 [AC_MSG_CHECKING([whether to enable delayed recovery support])
1620 AC_ARG_ENABLE([delayed-recovery],
1621 AC_HELP_STRING([--enable-delayed-recovery],
1622 [enable late recovery after main one]),
1623 [],[enable_delayed_recovery='no'])
1624 AC_MSG_RESULT([$enable_delayed_recovery])
1625 if test x$enable_delayed_recovery == xyes; then
1626 AC_DEFINE(HAVE_DELAYED_RECOVERY, 1, [Enable delayed recovery support])
1633 # whether to enable quota support global control
1635 AC_DEFUN([LC_CONFIG_QUOTA],
1636 [AC_ARG_ENABLE([quota],
1637 AC_HELP_STRING([--enable-quota],
1638 [enable quota support]),
1639 [],[enable_quota='yes'])
1642 # whether to enable quota support(kernel modules)
1643 AC_DEFUN([LC_QUOTA_MODULE],
1644 [if test x$enable_quota != xno; then
1645 LB_LINUX_CONFIG([QUOTA],[
1646 enable_quota_module='yes'
1647 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1649 enable_quota_module='no'
1650 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
1655 AC_DEFUN([LC_QUOTA],
1659 AC_CHECK_HEADER(sys/quota.h,
1660 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
1661 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
1664 AC_DEFUN([LC_QUOTA_READ],
1665 [AC_MSG_CHECKING([if kernel supports quota_read])
1666 LB_LINUX_TRY_COMPILE([
1667 #include <linux/fs.h>
1669 struct super_operations sp;
1670 void *i = (void *)sp.quota_read;
1672 AC_MSG_RESULT([yes])
1673 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1680 # LC_COOKIE_FOLLOW_LINK
1682 # kernel 2.6.13+ ->follow_link returns a cookie
1685 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1686 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1687 LB_LINUX_TRY_COMPILE([
1688 #include <linux/fs.h>
1689 #include <linux/namei.h>
1691 struct dentry dentry;
1692 struct nameidata nd;
1694 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1696 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1697 AC_MSG_RESULT([yes])
1706 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1707 # call_rcu takes three parameters.
1709 AC_DEFUN([LC_FUNC_RCU],
1710 [AC_MSG_CHECKING([if kernel have RCU supported])
1711 LB_LINUX_TRY_COMPILE([
1712 #include <linux/rcupdate.h>
1714 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1715 AC_MSG_RESULT([yes])
1717 AC_MSG_CHECKING([if call_rcu takes three parameters])
1718 LB_LINUX_TRY_COMPILE([
1719 #include <linux/rcupdate.h>
1722 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1724 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1725 AC_MSG_RESULT([yes])
1736 # linux kernel may have 64-bit limits support
1738 AC_DEFUN([LC_QUOTA64],
1739 [AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1740 LB_LINUX_TRY_COMPILE([
1741 #include <linux/kernel.h>
1742 #include <linux/fs.h>
1743 #include <linux/quotaio_v2.h>
1744 int versions[] = V2_INITQVERSIONS_R1;
1745 struct v2_disk_dqblk_r1 dqblk_r1;
1747 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1748 AC_MSG_RESULT([yes])
1751 AC_MSG_WARN([You have got no 64-bit kernel quota support.])
1752 AC_MSG_WARN([Continuing with limited quota support.])
1753 AC_MSG_WARN([quotacheck is needed for filesystems with recent quota versions.])
1758 # LC_SECURITY_PLUG # for SLES10 SP2
1759 # check security plug in sles10 sp2 kernel
1760 AC_DEFUN([LC_SECURITY_PLUG],
1761 [AC_MSG_CHECKING([If kernel has security plug support])
1762 LB_LINUX_TRY_COMPILE([
1763 #include <linux/fs.h>
1765 struct dentry *dentry;
1766 struct vfsmount *mnt;
1767 struct iattr *iattr;
1769 notify_change(dentry, mnt, iattr);
1772 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
1773 [SLES10 SP2 use extra parameter in vfs])
1779 AC_DEFUN([LC_PERCPU_COUNTER],
1780 [AC_MSG_CHECKING([if have struct percpu_counter defined])
1781 LB_LINUX_TRY_COMPILE([
1782 #include <linux/percpu_counter.h>
1784 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
1785 AC_MSG_RESULT([yes])
1787 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
1788 LB_LINUX_TRY_COMPILE([
1789 #include <linux/percpu_counter.h>
1791 struct percpu_counter c;
1792 percpu_counter_init(&c, 0);
1794 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
1796 AC_MSG_RESULT([yes])
1808 # other configure checks
1810 AC_DEFUN([LC_CONFIGURE],
1811 [LC_CONFIG_OBD_BUFFER_SIZE
1813 # include/liblustre.h
1814 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1816 # liblustre/llite_lib.h
1817 AC_CHECK_HEADERS([xtio.h file.h])
1820 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1823 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1824 AC_CHECK_FUNCS([inet_ntoa])
1826 # libsysio/src/readlink.c
1829 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1830 AC_CHECK_HEADERS([linux/random.h], [], [],
1831 [#ifdef HAVE_LINUX_TYPES_H
1832 # include <linux/types.h>
1837 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1839 # check for -lz support
1843 [AC_CHECK_HEADERS([zlib.h],
1845 AC_DEFINE([HAVE_ADLER], 1,
1846 [support alder32 checksum type])],
1847 [AC_MSG_WARN([No zlib-devel package found,
1848 unable to use adler32 checksum])])],
1849 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1854 AC_ARG_ENABLE([mindf],
1855 AC_HELP_STRING([--enable-mindf],
1856 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1858 if test "$enable_mindf" = "yes" ; then
1859 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1862 AC_ARG_ENABLE([fail_alloc],
1863 AC_HELP_STRING([--disable-fail-alloc],
1864 [disable randomly alloc failure]),
1865 [],[enable_fail_alloc=yes])
1866 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1867 AC_MSG_RESULT([$enable_fail_alloc])
1868 if test x$enable_fail_alloc != xno ; then
1869 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1877 # AM_CONDITIONALS for lustre
1879 AC_DEFUN([LC_CONDITIONALS],
1880 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1881 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1882 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1883 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1884 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1885 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1886 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
1887 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1888 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1889 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1895 # files that should be generated with AC_OUTPUT
1897 AC_DEFUN([LC_CONFIG_FILES],
1901 lustre/autoconf/Makefile
1902 lustre/contrib/Makefile
1904 lustre/include/Makefile
1905 lustre/include/lustre_ver.h
1906 lustre/include/linux/Makefile
1907 lustre/include/lustre/Makefile
1908 lustre/kernel_patches/targets/2.6-suse.target
1909 lustre/kernel_patches/targets/2.6-vanilla.target
1910 lustre/kernel_patches/targets/2.6-rhel4.target
1911 lustre/kernel_patches/targets/2.6-rhel5.target
1912 lustre/kernel_patches/targets/2.6-fc5.target
1913 lustre/kernel_patches/targets/2.6-patchless.target
1914 lustre/kernel_patches/targets/2.6-sles10.target
1915 lustre/kernel_patches/targets/hp_pnnl-2.4.target
1916 lustre/kernel_patches/targets/rh-2.4.target
1917 lustre/kernel_patches/targets/rhel-2.4.target
1918 lustre/kernel_patches/targets/suse-2.4.21-2.target
1919 lustre/kernel_patches/targets/sles-2.4.target
1920 lustre/ldlm/Makefile
1921 lustre/liblustre/Makefile
1922 lustre/liblustre/tests/Makefile
1923 lustre/llite/Makefile
1924 lustre/llite/autoMakefile
1926 lustre/lov/autoMakefile
1927 lustre/lvfs/Makefile
1928 lustre/lvfs/autoMakefile
1930 lustre/mdc/autoMakefile
1932 lustre/mds/autoMakefile
1933 lustre/obdclass/Makefile
1934 lustre/obdclass/autoMakefile
1935 lustre/obdclass/linux/Makefile
1936 lustre/obdecho/Makefile
1937 lustre/obdecho/autoMakefile
1938 lustre/obdfilter/Makefile
1939 lustre/obdfilter/autoMakefile
1941 lustre/osc/autoMakefile
1943 lustre/ost/autoMakefile
1945 lustre/mgc/autoMakefile
1947 lustre/mgs/autoMakefile
1948 lustre/ptlrpc/Makefile
1949 lustre/ptlrpc/autoMakefile
1950 lustre/quota/Makefile
1951 lustre/quota/autoMakefile
1952 lustre/scripts/Makefile
1953 lustre/scripts/version_tag.pl
1954 lustre/tests/Makefile
1955 lustre/utils/Makefile
1957 case $lb_target_os in
1959 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])