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_ZAP_PAGE_RANGE
127 # if zap_page_range() takes a vma arg
129 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
130 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
131 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
132 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
133 AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
143 # if proc_fs.h defines PDE()
145 AC_DEFUN([LC_FUNC_PDE],
146 [AC_MSG_CHECKING([if kernel defines PDE])
147 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
148 if test "$HAVE_PDE" != 0 ; then
149 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
157 # LC_FUNC_FILEMAP_FDATASYNC
159 # if filemap_fdatasync() exists
161 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
162 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
163 LB_LINUX_TRY_COMPILE([
164 #include <linux/fs.h>
166 int (*foo)(struct address_space *)= filemap_fdatawrite;
169 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
178 # if direct_IO takes a struct file argument
180 AC_DEFUN([LC_FUNC_DIRECT_IO],
181 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
182 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
183 if test "$HAVE_DIO_FILE" != 0 ; then
184 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
192 # LC_HEADER_MM_INLINE
194 # RHEL kernels define page_count in mm_inline.h
196 AC_DEFUN([LC_HEADER_MM_INLINE],
197 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
198 LB_LINUX_TRY_COMPILE([
199 #include <linux/mm_inline.h>
202 #error mm_inline.h does not define page_count
206 AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
215 # if inode->i_alloc_sem exists
217 AC_DEFUN([LC_STRUCT_INODE],
218 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
219 LB_LINUX_TRY_COMPILE([
220 #include <linux/fs.h>
221 #include <linux/version.h>
223 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
224 #error "down_read_trylock broken before 2.4.24"
227 return (char *)&i.i_alloc_sem - (char *)&i;
230 AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
237 # LC_FUNC_REGISTER_CACHE
239 # if register_cache() is defined by kernel
241 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
242 [AC_MSG_CHECKING([if kernel defines register_cache()])
243 LB_LINUX_TRY_COMPILE([
244 #include <linux/list.h>
245 #include <linux/cache_def.h>
247 struct cache_definition cache;
250 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
251 AC_MSG_CHECKING([if kernel expects return from cache shrink function])
252 HAVE_CACHE_RETURN_INT="`grep -c 'int.*shrink' $LINUX/include/linux/cache_def.h`"
253 if test "$HAVE_CACHE_RETURN_INT" != 0 ; then
254 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [kernel expects return from shrink_cache])
265 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
267 # check for our patched grab_cache_page_nowait_gfp() function
269 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
270 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
271 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
272 if test "$HAVE_GCPN_GFP" != 0 ; then
273 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
274 [kernel has grab_cache_page_nowait_gfp()])
282 # LC_FUNC_DEV_SET_RDONLY
284 # check for the old-style dev_set_rdonly which took an extra "devno" param
285 # and can only set a single device to discard writes at one time
287 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
288 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
289 LB_LINUX_TRY_COMPILE([
290 #include <linux/fs.h>
292 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
293 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
297 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
299 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
300 kernel patches from Lustre version 1.4.3 or above.])
305 # LC_CONFIG_BACKINGFS
307 # setup, check the backing filesystem
309 AC_DEFUN([LC_CONFIG_BACKINGFS],
313 if test x$with_ldiskfs = xno ; then
316 if test x$linux25$enable_server = xyesyes ; then
317 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
320 # --- Check that ext3 and ext3 xattr are enabled in the kernel
322 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
324 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
325 AC_MSG_WARN([This build may fail.])
329 LB_DEFINE_LDISKFS_OPTIONS
332 AC_MSG_CHECKING([which backing filesystem to use])
333 AC_MSG_RESULT([$BACKINGFS])
340 # the pinger is temporary, until we have the recovery node in place
342 AC_DEFUN([LC_CONFIG_PINGER],
343 [AC_MSG_CHECKING([whether to enable pinger support])
344 AC_ARG_ENABLE([pinger],
345 AC_HELP_STRING([--disable-pinger],
346 [disable recovery pinger support]),
347 [],[enable_pinger='yes'])
348 AC_MSG_RESULT([$enable_pinger])
349 if test x$enable_pinger != xno ; then
350 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
355 # LC_CONFIG_HEALTH_CHECK_WRITE
357 # Turn off the actual write to the disk
359 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
360 [AC_MSG_CHECKING([whether to enable a write with the health check])
361 AC_ARG_ENABLE([health_write],
362 AC_HELP_STRING([--enable-health_write],
363 [enable disk writes when doing health check]),
364 [],[enable_health_write='no'])
365 AC_MSG_RESULT([$enable_health_write])
366 if test x$enable_health_write != xno ; then
367 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
372 # LC_CONFIG_LIBLUSTRE_RECOVERY
374 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
375 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
376 AC_ARG_ENABLE([liblustre-recovery],
377 AC_HELP_STRING([--disable-liblustre-recovery],
378 [disable liblustre recovery support]),
379 [],[enable_liblustre_recovery='yes'])
380 AC_MSG_RESULT([$enable_liblustre_recovery])
381 if test x$enable_liblustre_recovery != xno ; then
382 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
387 # LC_CONFIG_OBD_BUFFER_SIZE
389 # the maximum buffer size of lctl ioctls
391 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
392 [AC_MSG_CHECKING([maximum OBD ioctl size])
393 AC_ARG_WITH([obd-buffer-size],
394 AC_HELP_STRING([--with-obd-buffer-size=[size]],
395 [set lctl ioctl maximum bytes (default=8192)]),
397 OBD_BUFFER_SIZE=$with_obd_buffer_size
401 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
402 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
408 # AIX does not have statfs.f_namelen
410 AC_DEFUN([LC_STRUCT_STATFS],
411 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
412 LB_LINUX_TRY_COMPILE([
413 #include <linux/vfs.h>
419 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
426 # LC_READLINK_SSIZE_T
428 AC_DEFUN([LC_READLINK_SSIZE_T],
429 [AC_MSG_CHECKING([if readlink returns ssize_t])
433 ssize_t readlink(const char *, char *, size_t);
436 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
442 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
443 [AC_MSG_CHECKING([if kernel offers page_mapped])
444 LB_LINUX_TRY_COMPILE([
445 #include <linux/mm.h>
450 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
456 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
457 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
458 LB_LINUX_TRY_COMPILE([
459 #include <linux/fs.h>
461 struct file_operations fops;
462 &fops.unlocked_ioctl;
465 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
471 AC_DEFUN([LC_FILEMAP_POPULATE],
472 [AC_MSG_CHECKING([for exported filemap_populate])
473 LB_LINUX_TRY_COMPILE([
474 #include <asm/page.h>
475 #include <linux/mm.h>
477 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
480 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
486 AC_DEFUN([LC_D_ADD_UNIQUE],
487 [AC_MSG_CHECKING([for d_add_unique])
488 LB_LINUX_TRY_COMPILE([
489 #include <linux/dcache.h>
491 d_add_unique(NULL, NULL);
494 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
500 AC_DEFUN([LC_BIT_SPINLOCK_H],
501 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
502 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
503 LB_LINUX_TRY_COMPILE([
504 #include <asm/processor.h>
505 #include <linux/spinlock.h>
506 #include <linux/bit_spinlock.h>
509 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
520 # If we have xattr_acl.h
522 AC_DEFUN([LC_XATTR_ACL],
523 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
524 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
525 LB_LINUX_TRY_COMPILE([
526 #include <linux/xattr_acl.h>
529 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
537 AC_DEFUN([LC_STRUCT_INTENT_FILE],
538 [AC_MSG_CHECKING([if struct open_intent has a file field])
539 LB_LINUX_TRY_COMPILE([
540 #include <linux/fs.h>
541 #include <linux/namei.h>
543 struct open_intent intent;
547 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
554 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
555 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
556 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
557 LB_LINUX_TRY_COMPILE([
558 #include <linux/posix_acl_xattr.h>
561 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
574 # starting from 2.6.19 linux kernel exports __iget()
576 AC_DEFUN([LC_EXPORT___IGET],
577 [LB_CHECK_SYMBOL_EXPORT([__iget],
579 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
585 AC_DEFUN([LC_LUSTRE_VERSION_H],
586 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
587 rm -f "$LUSTRE/include/linux/lustre_version.h"
589 touch "$LUSTRE/include/linux/lustre_version.h"
590 if test x$enable_server = xyes ; then
591 AC_MSG_WARN([Unpatched kernel detected.])
592 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
593 AC_MSG_WARN([disabling server build])
599 AC_DEFUN([LC_FUNC_SET_FS_PWD],
600 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
602 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
610 AC_DEFUN([LC_CAPA_CRYPTO],
611 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
612 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
614 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
615 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
617 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
618 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
622 m4_pattern_allow(AC_KERBEROS_V5)
627 # Build gss and related tools of Lustre. Currently both kernel and user space
628 # parts are depend on linux platform.
630 AC_DEFUN([LC_CONFIG_GSS],
631 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
633 AC_HELP_STRING([--enable-gss], [enable gss/krb5 support]),
634 [],[enable_gss='no'])
635 AC_MSG_RESULT([$enable_gss])
637 if test x$enable_gss == xyes; then
638 LB_LINUX_CONFIG_IM([SUNRPC],[],[
639 AC_MSG_ERROR([GSS require that CONFIG_SUNRPC is enabled in your kernel.])
641 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],[
642 AC_MSG_WARN([DES support is recommended by using GSS.])
644 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],[
645 AC_MSG_WARN([MD5 support is recommended by using GSS.])
647 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],[
648 AC_MSG_WARN([SHA256 support is recommended by using GSS.])
650 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],[
651 AC_MSG_WARN([SHA512 support is recommended by using GSS.])
653 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],[
654 AC_MSG_WARN([ARC4 support is recommended by using GSS.])
657 # AES symbol is uncertain (optimized & depend on arch)
660 AC_CHECK_LIB(gssapi, gss_init_sec_context, [
661 GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"
663 AC_MSG_ERROR([libgssapi is not found, consider --disable-gss.])
667 AC_SUBST(GSSAPI_LIBS)
672 # LC_FUNC_MS_FLOCK_LOCK
674 # SLES9 kernel has MS_FLOCK_LOCK sb flag
676 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
677 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
678 LB_LINUX_TRY_COMPILE([
679 #include <linux/fs.h>
681 int flags = MS_FLOCK_LOCK;
683 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
684 [kernel has MS_FLOCK_LOCK flag])
692 # LC_FUNC_HAVE_CAN_SLEEP_ARG
694 # SLES9 kernel has third arg can_sleep
695 # in fs/locks.c: flock_lock_file_wait()
697 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
698 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
699 LB_LINUX_TRY_COMPILE([
700 #include <linux/fs.h>
704 struct file_lock *file_lock;
705 flock_lock_file_wait(file, file_lock, cansleep);
707 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
708 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
718 # rhel4.2 kernel has f_op->flock field
720 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
721 [AC_MSG_CHECKING([if struct file_operations has flock field])
722 LB_LINUX_TRY_COMPILE([
723 #include <linux/fs.h>
725 struct file_operations ll_file_operations_flock;
726 ll_file_operations_flock.flock = NULL;
728 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
729 [struct file_operations has flock field])
739 # task struct has p_pptr instead of parent
741 AC_DEFUN([LC_TASK_PPTR],
742 [AC_MSG_CHECKING([task p_pptr found])
743 LB_LINUX_TRY_COMPILE([
744 #include <linux/sched.h>
746 struct task_struct *p;
751 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
760 # rhel4.2 kernel has f_op->flock field
762 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
763 [AC_MSG_CHECKING([if struct file_operations has flock field])
764 LB_LINUX_TRY_COMPILE([
765 #include <linux/fs.h>
767 struct file_operations ll_file_operations_flock;
768 ll_file_operations_flock.flock = NULL;
770 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
771 [struct file_operations has flock field])
779 # after 2.6.15 inode have i_mutex intead of i_sem
780 AC_DEFUN([LC_INODE_I_MUTEX],
781 [AC_MSG_CHECKING([use inode have i_mutex ])
782 LB_LINUX_TRY_COMPILE([
783 #include <linux/mutex.h>
784 #include <linux/fs.h>
788 mutex_unlock(&i.i_mutex);
791 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
792 [after 2.6.15 inode have i_mutex intead of i_sem])
800 # after 2.6.17 dquote use mutex instead if semaphore
801 AC_DEFUN([LC_DQUOTOFF_MUTEX],
802 [AC_MSG_CHECKING([use dqonoff_mutex])
803 LB_LINUX_TRY_COMPILE([
804 #include <linux/mutex.h>
805 #include <linux/fs.h>
806 #include <linux/quota.h>
808 struct quota_info dq;
810 mutex_unlock(&dq.dqonoff_mutex);
813 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
814 [after 2.6.17 dquote use mutex instead if semaphore])
821 # LC_STATFS_DENTRY_PARAM
822 # starting from 2.6.18 linux kernel uses dentry instead of
823 # super_block for first vfs_statfs argument
825 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
826 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
827 LB_LINUX_TRY_COMPILE([
828 #include <linux/fs.h>
830 int vfs_statfs(struct dentry *, struct kstatfs *);
832 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
833 [first parameter of vfs_statfs is dentry])
842 # starting from 2.6.18 kernel don't export do_kern_mount
843 # and want to use vfs_kern_mount instead.
845 AC_DEFUN([LC_VFS_KERN_MOUNT],
846 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
847 LB_LINUX_TRY_COMPILE([
848 #include <linux/mount.h>
850 vfs_kern_mount(NULL, 0, NULL, NULL);
852 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
853 [vfs_kern_mount exist in kernel])
861 # LC_INVALIDATEPAGE_RETURN_INT
862 # more 2.6 api changes. return type for the invalidatepage
863 # address_space_operation is 'void' in new kernels but 'int' in old
865 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
866 [AC_MSG_CHECKING([invalidatepage has return int])
867 LB_LINUX_TRY_COMPILE([
868 #include <linux/buffer_head.h>
870 int rc = block_invalidatepage(NULL, 0);
873 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
874 [Define if return type of invalidatepage should be int])
880 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
881 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
882 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
883 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
884 tmp_flags="$EXTRA_KCFLAGS"
885 EXTRA_KCFLAGS="-Werror"
886 LB_LINUX_TRY_COMPILE([
887 #include <linux/fs.h>
890 static void cfg_umount_begin (struct vfsmount *v, int flags)
895 static struct super_operations cfg_super_operations = {
896 .umount_begin = cfg_umount_begin,
899 cfg_super_operations.umount_begin(NULL,0);
902 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
903 [Define umount_begin need second argument])
907 EXTRA_KCFLAGS="$tmp_flags"
911 # inode don't have i_blksize field
912 AC_DEFUN([LC_INODE_BLKSIZE],
913 [AC_MSG_CHECKING([inode has i_blksize field])
914 LB_LINUX_TRY_COMPILE([
915 #include <linux/fs.h>
921 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
922 [struct inode has i_blksize field])
928 # LC_VFS_READDIR_U64_INO
929 # 2.6.19 use u64 for inode number instead of inode_t
930 AC_DEFUN([LC_VFS_READDIR_U64_INO],
931 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
932 tmp_flags="$EXTRA_KCFLAGS"
933 EXTRA_KCFLAGS="-Werror"
934 LB_LINUX_TRY_COMPILE([
935 #include <linux/fs.h>
936 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
937 u64 ino, unsigned int d_type)
948 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
949 [if vfs_readdir need 64bit inode number])
953 EXTRA_KCFLAGS="$tmp_flags"
956 # LC_GENERIC_FILE_WRITE
957 # 2.6.19 introduce do_sync_write instead of
959 AC_DEFUN([LC_GENERIC_FILE_WRITE],
960 [AC_MSG_CHECKING([use generic_file_write])
961 LB_LINUX_TRY_COMPILE([
962 #include <linux/fs.h>
964 int result = generic_file_read(NULL, NULL, 0, 0);
967 AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
968 [use generic_file_write])
974 # LC_GENERIC_FILE_READ
975 # 2.6.19 need to use do_sync_read instead of
977 AC_DEFUN([LC_GENERIC_FILE_READ],
978 [AC_MSG_CHECKING([use generic_file_read])
979 LB_LINUX_TRY_COMPILE([
980 #include <linux/fs.h>
982 int result = generic_file_read(NULL, NULL, 0, 0);
985 AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
986 [use generic_file_read])
993 # 2.6.18 don't export nr_pagecahe
994 AC_DEFUN([LC_NR_PAGECACHE],
995 [AC_MSG_CHECKING([kernel export nr_pagecache])
996 LB_LINUX_TRY_COMPILE([
997 #include <linux/pagemap.h>
999 return atomic_read(&nr_pagecache);
1002 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1003 [is kernel export nr_pagecache])
1009 # LC_CANCEL_DIRTY_PAGE
1010 # 2.6.20 introduse cancel_dirty_page instead of
1012 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1013 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1014 LB_LINUX_TRY_COMPILE([
1015 #include <linux/page-flags.h>
1017 cancel_dirty_page(NULL, 0);
1020 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1021 [kernel has cancel_dirty_page instead of clear_page_dirty])
1030 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1031 # it support constant page, which means the page won't be modified during the
1034 AC_DEFUN([LC_PAGE_CONSTANT],
1035 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1036 LB_LINUX_TRY_COMPILE([
1037 #include <linux/page-flags.h>
1040 #error "Have no raid5 zcopy patch"
1044 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1050 # RHEL5 in FS-cache patch rename PG_checked flag
1052 AC_DEFUN([LC_PG_FS_MISC],
1053 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1054 LB_LINUX_TRY_COMPILE([
1055 #include <linux/page-flags.h>
1058 #error PG_fs_misc not defined in kernel
1062 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1063 [is kernel have PG_fs_misc])
1069 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1070 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1072 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1073 [kernel export truncate_complete_page])
1078 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1079 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1081 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1082 [d_rehash_cond is exported by the kernel])
1087 AC_DEFUN([LC_EXPORT___D_REHASH],
1088 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1090 AC_DEFINE(HAVE___D_REHASH, 1,
1091 [__d_rehash is exported by the kernel])
1097 # LC_VFS_INTENT_PATCHES
1099 # check if the kernel has the VFS intent patches
1100 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1101 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1102 LB_LINUX_TRY_COMPILE([
1103 #include <linux/fs.h>
1104 #include <linux/namei.h>
1106 struct nameidata nd;
1107 struct lookup_intent *it;
1110 intent_init(it, IT_OPEN);
1111 it->d.lustre.it_disposition = 0;
1112 it->d.lustre.it_data = NULL;
1114 AC_MSG_RESULT([yes])
1115 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1124 # Lustre linux kernel checks
1126 AC_DEFUN([LC_PROG_LINUX],
1127 [ LC_LUSTRE_VERSION_H
1128 if test x$enable_server = xyes ; then
1132 LC_CONFIG_LIBLUSTRE_RECOVERY
1134 LC_CONFIG_HEALTH_CHECK_WRITE
1138 LC_EXPORT_TRUNCATE_COMPLETE
1139 LC_EXPORT_D_REHASH_COND
1140 LC_EXPORT___D_REHASH
1143 LC_FUNC_COND_RESCHED
1144 LC_FUNC_ZAP_PAGE_RANGE
1149 LC_FUNC_REGISTER_CACHE
1150 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1151 LC_FUNC_DEV_SET_RDONLY
1152 LC_FUNC_FILEMAP_FDATAWRITE
1155 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1160 LC_STRUCT_INTENT_FILE
1161 LC_POSIX_ACL_XATTR_H
1165 LC_FUNC_MS_FLOCK_LOCK
1166 LC_FUNC_HAVE_CAN_SLEEP_ARG
1169 LC_COOKIE_FOLLOW_LINK
1172 # does the kernel have VFS intent patches?
1173 LC_VFS_INTENT_PATCHES
1183 LC_STATFS_DENTRY_PARAM
1185 LC_INVALIDATEPAGE_RETURN_INT
1186 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1188 #2.6.18 + RHEL5 (fc6)
1193 LC_VFS_READDIR_U64_INO
1194 LC_GENERIC_FILE_READ
1195 LC_GENERIC_FILE_WRITE
1198 LC_CANCEL_DIRTY_PAGE
1200 # raid5-zerocopy patch
1205 # LC_CONFIG_CLIENT_SERVER
1207 # Build client/server sides of Lustre
1209 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1210 [AC_MSG_CHECKING([whether to build Lustre server support])
1211 AC_ARG_ENABLE([server],
1212 AC_HELP_STRING([--disable-server],
1213 [disable Lustre server support]),
1214 [],[enable_server='yes'])
1215 AC_MSG_RESULT([$enable_server])
1217 AC_MSG_CHECKING([whether to build Lustre client support])
1218 AC_ARG_ENABLE([client],
1219 AC_HELP_STRING([--disable-client],
1220 [disable Lustre client support]),
1221 [],[enable_client='yes'])
1222 AC_MSG_RESULT([$enable_client])])
1225 # LC_CONFIG_LIBLUSTRE
1227 # whether to build liblustre
1229 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1230 [AC_MSG_CHECKING([whether to build Lustre library])
1231 AC_ARG_ENABLE([liblustre],
1232 AC_HELP_STRING([--disable-liblustre],
1233 [disable building of Lustre library]),
1234 [],[enable_liblustre=$with_sysio])
1235 AC_MSG_RESULT([$enable_liblustre])
1236 # only build sysio if liblustre is built
1237 with_sysio="$enable_liblustre"
1239 AC_MSG_CHECKING([whether to build liblustre tests])
1240 AC_ARG_ENABLE([liblustre-tests],
1241 AC_HELP_STRING([--enable-liblustre-tests],
1242 [enable liblustre tests, if --disable-tests is used]),
1243 [],[enable_liblustre_tests=$enable_tests])
1244 if test x$enable_liblustre != xyes ; then
1245 enable_liblustre_tests='no'
1247 AC_MSG_RESULT([$enable_liblustre_tests])
1249 AC_MSG_CHECKING([whether to build mpitests])
1250 AC_ARG_ENABLE([mpitests],
1251 AC_HELP_STRING([--enable-mpitests],
1252 [build liblustre mpi tests]),
1253 [],[enable_mpitests=no])
1254 AC_MSG_RESULT([$enable_mpitests])
1256 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1257 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1260 LC_CONFIG_LIBLUSTRE_RECOVERY
1266 # whether to enable quota support
1268 AC_DEFUN([LC_CONFIG_QUOTA],
1269 [AC_MSG_CHECKING([whether to disable quota support])
1270 AC_ARG_ENABLE([quota],
1271 AC_HELP_STRING([--disable-quota],
1272 [disable quota support]),
1273 [],[enable_quota='yes'])
1274 AC_MSG_RESULT([$enable_quota])
1275 if test x$linux25 != xyes; then
1278 if test x$enable_quota != xno; then
1279 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1286 # whether to enable split support
1288 AC_DEFUN([LC_CONFIG_SPLIT],
1289 [AC_MSG_CHECKING([whether to enable split support])
1290 AC_ARG_ENABLE([split],
1291 AC_HELP_STRING([--enable-split],
1292 [enable split support]),
1293 [],[enable_split='no'])
1294 AC_MSG_RESULT([$enable_split])
1295 if test x$enable_split != xno; then
1296 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1300 AC_DEFUN([LC_QUOTA_READ],
1301 [AC_MSG_CHECKING([if kernel supports quota_read])
1302 LB_LINUX_TRY_COMPILE([
1303 #include <linux/fs.h>
1305 struct super_operations sp;
1306 void *i = (void *)sp.quota_read;
1308 AC_MSG_RESULT([yes])
1309 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1316 # LC_COOKIE_FOLLOW_LINK
1318 # kernel 2.6.13+ ->follow_link returns a cookie
1321 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1322 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1323 LB_LINUX_TRY_COMPILE([
1324 #include <linux/fs.h>
1325 #include <linux/namei.h>
1327 struct dentry dentry;
1328 struct nameidata nd;
1330 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1332 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1333 AC_MSG_RESULT([yes])
1342 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1343 # call_rcu takes three parameters.
1345 AC_DEFUN([LC_FUNC_RCU],
1346 [AC_MSG_CHECKING([if kernel have RCU supported])
1347 LB_LINUX_TRY_COMPILE([
1348 #include <linux/rcupdate.h>
1350 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1351 AC_MSG_RESULT([yes])
1353 AC_MSG_CHECKING([if call_rcu takes three parameters])
1354 LB_LINUX_TRY_COMPILE([
1355 #include <linux/rcupdate.h>
1358 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1360 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1361 AC_MSG_RESULT([yes])
1373 # other configure checks
1375 AC_DEFUN([LC_CONFIGURE],
1376 [LC_CONFIG_OBD_BUFFER_SIZE
1378 # include/liblustre.h
1379 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1381 # include/lustre/lustre_user.h
1382 # See note there re: __ASM_X86_64_PROCESSOR_H
1383 AC_CHECK_HEADERS([linux/quota.h])
1385 # liblustre/llite_lib.h
1386 AC_CHECK_HEADERS([xtio.h file.h])
1389 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1392 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1393 AC_CHECK_FUNCS([inet_ntoa])
1395 # libsysio/src/readlink.c
1399 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1402 AC_ARG_ENABLE([mindf],
1403 AC_HELP_STRING([--enable-mindf],
1404 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1406 if test "$enable_mindf" = "yes" ; then
1407 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1410 AC_ARG_ENABLE([fail_alloc],
1411 AC_HELP_STRING([--disable-fail-alloc],
1412 [disable randomly alloc failure]),
1413 [],[enable_fail_alloc=yes])
1414 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1415 AC_MSG_RESULT([$enable_fail_alloc])
1416 if test x$enable_fail_alloc != xno ; then
1417 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1425 # AM_CONDITIONALS for lustre
1427 AC_DEFUN([LC_CONDITIONALS],
1428 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1429 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1430 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1431 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1432 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1433 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1434 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1435 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1436 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1437 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1438 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1439 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1445 # files that should be generated with AC_OUTPUT
1447 AC_DEFUN([LC_CONFIG_FILES],
1451 lustre/autoconf/Makefile
1452 lustre/contrib/Makefile
1454 lustre/include/Makefile
1455 lustre/include/lustre_ver.h
1456 lustre/include/linux/Makefile
1457 lustre/include/lustre/Makefile
1458 lustre/kernel_patches/targets/2.6-suse.target
1459 lustre/kernel_patches/targets/2.6-vanilla.target
1460 lustre/kernel_patches/targets/2.6-rhel4.target
1461 lustre/kernel_patches/targets/2.6-fc5.target
1462 lustre/kernel_patches/targets/2.6-patchless.target
1463 lustre/kernel_patches/targets/2.6-sles10.target
1464 lustre/ldlm/Makefile
1466 lustre/fid/autoMakefile
1467 lustre/liblustre/Makefile
1468 lustre/liblustre/tests/Makefile
1469 lustre/llite/Makefile
1470 lustre/llite/autoMakefile
1472 lustre/lov/autoMakefile
1473 lustre/lvfs/Makefile
1474 lustre/lvfs/autoMakefile
1476 lustre/mdc/autoMakefile
1478 lustre/lmv/autoMakefile
1480 lustre/mds/autoMakefile
1482 lustre/mdt/autoMakefile
1484 lustre/cmm/autoMakefile
1486 lustre/mdd/autoMakefile
1488 lustre/fld/autoMakefile
1489 lustre/obdclass/Makefile
1490 lustre/obdclass/autoMakefile
1491 lustre/obdclass/linux/Makefile
1492 lustre/obdecho/Makefile
1493 lustre/obdecho/autoMakefile
1494 lustre/obdfilter/Makefile
1495 lustre/obdfilter/autoMakefile
1497 lustre/osc/autoMakefile
1499 lustre/ost/autoMakefile
1501 lustre/osd/autoMakefile
1503 lustre/mgc/autoMakefile
1505 lustre/mgs/autoMakefile
1506 lustre/ptlrpc/Makefile
1507 lustre/ptlrpc/autoMakefile
1508 lustre/ptlrpc/gss/Makefile
1509 lustre/ptlrpc/gss/autoMakefile
1510 lustre/quota/Makefile
1511 lustre/quota/autoMakefile
1512 lustre/scripts/Makefile
1513 lustre/scripts/version_tag.pl
1514 lustre/tests/Makefile
1515 lustre/utils/Makefile
1516 lustre/utils/gss/Makefile
1518 case $lb_target_os in
1520 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])