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])
16 # lustre specific paths
18 AC_DEFUN([LC_PATH_DEFAULTS],
19 [# ptlrpc kernel build requires this
27 demodir='$(docdir)/demo'
30 pkgexampledir='${pkgdatadir}/examples'
31 AC_SUBST(pkgexampledir)
37 # is the target os supported?
39 AC_DEFUN([LC_TARGET_SUPPORTED],
53 # that ext3 is enabled in the kernel
55 AC_DEFUN([LC_CONFIG_EXT3],
56 [LB_LINUX_CONFIG([EXT3_FS],[],[
57 LB_LINUX_CONFIG([EXT3_FS_MODULE],[],[$2])
59 LB_LINUX_CONFIG([EXT3_FS_XATTR],[$1],[$3])
65 # If we have (and can build) fshooks.h
67 AC_DEFUN([LC_FSHOOKS],
68 [LB_CHECK_FILE([$LINUX/include/linux/fshooks.h],[
69 AC_MSG_CHECKING([if fshooks.h can be compiled])
70 LB_LINUX_TRY_COMPILE([
71 #include <linux/fshooks.h>
76 AC_MSG_WARN([You might have better luck with gcc 3.3.x.])
77 AC_MSG_WARN([You can set CC=gcc33 before running configure.])
78 AC_MSG_ERROR([Your compiler cannot build fshooks.h.])
87 # LC_FUNC_RELEASEPAGE_WITH_INT
89 # if ->releasepage() takes an int arg in 2.6.9
90 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
91 # while others either don't have gfp_t or pass gfp_t as the parameter.
93 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_INT],
94 [AC_MSG_CHECKING([if releasepage has a int parameter])
95 RELEASEPAGE_WITH_INT="`grep -c 'releasepage.*int' $LINUX/include/linux/fs.h`"
96 if test "$RELEASEPAGE_WITH_INT" != 0 ; then
97 AC_DEFINE(HAVE_RELEASEPAGE_WITH_INT, 1,
98 [releasepage with int parameter])
106 # LC_FUNC_FILEMAP_FDATASYNC
108 # if filemap_fdatasync() exists
110 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
111 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
112 LB_LINUX_TRY_COMPILE([
113 #include <linux/fs.h>
115 int (*foo)(struct address_space *)= filemap_fdatawrite;
118 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
125 # LC_HEADER_MM_INLINE
127 # RHEL kernels define page_count in mm_inline.h
129 AC_DEFUN([LC_HEADER_MM_INLINE],
130 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
131 LB_LINUX_TRY_COMPILE([
132 #include <linux/mm_inline.h>
135 #error mm_inline.h does not define page_count
139 AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
148 # if inode->i_alloc_sem exists
150 AC_DEFUN([LC_STRUCT_INODE],
151 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
152 LB_LINUX_TRY_COMPILE([
153 #include <linux/fs.h>
154 #include <linux/version.h>
156 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
157 #error "down_read_trylock broken before 2.4.24"
160 return (char *)&i.i_alloc_sem - (char *)&i;
163 AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
170 # LC_FUNC_REGISTER_CACHE
172 # if register_cache() is defined by kernel
174 # There are two ways to shrink one customized cache in linux kernels. For the
175 # kernels are prior than 2.6.5(?), register_cache() is used, and for latest
176 # kernels, set_shrinker() is used instead.
178 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
179 [AC_MSG_CHECKING([if kernel defines cache pressure hook])
180 LB_LINUX_TRY_COMPILE([
181 #include <linux/mm.h>
185 set_shrinker(1, shrinker);
187 AC_MSG_RESULT([set_shrinker])
188 AC_DEFINE(HAVE_SHRINKER_CACHE, 1, [shrinker_cache found])
189 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [shrinkers should return int])
191 LB_LINUX_TRY_COMPILE([
192 #include <linux/list.h>
193 #include <linux/cache_def.h>
195 struct cache_definition cache;
197 AC_MSG_RESULT([register_cache])
198 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
199 AC_MSG_CHECKING([if kernel expects return from cache shrink ])
200 tmp_flags="$EXTRA_KCFLAGS"
201 EXTRA_KCFLAGS="-Werror"
202 LB_LINUX_TRY_COMPILE([
203 #include <linux/list.h>
204 #include <linux/cache_def.h>
206 struct cache_definition c;
207 c.shrinker = (int (*)(int, unsigned int))1;
209 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1,
210 [kernel expects return from shrink_cache])
215 EXTRA_KCFLAGS="$tmp_flags"
223 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
225 # check for our patched grab_cache_page_nowait_gfp() function
227 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
228 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
229 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
230 if test "$HAVE_GCPN_GFP" != 0 ; then
231 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
232 [kernel has grab_cache_page_nowait_gfp()])
240 # LC_FUNC_DEV_SET_RDONLY
242 # check for the old-style dev_set_rdonly which took an extra "devno" param
243 # and can only set a single device to discard writes at one time
245 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
246 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
247 LB_LINUX_TRY_COMPILE([
248 #include <linux/fs.h>
250 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
251 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
255 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
257 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
258 kernel patches from Lustre version 1.4.3 or above.])
263 # LC_CONFIG_BACKINGFS
265 # setup, check the backing filesystem
267 AC_DEFUN([LC_CONFIG_BACKINGFS],
271 if test x$with_ldiskfs = xno ; then
274 if test x$linux25$enable_server = xyesyes ; then
275 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
278 # --- Check that ext3 and ext3 xattr are enabled in the kernel
280 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
282 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
283 AC_MSG_WARN([This build may fail.])
287 LB_DEFINE_LDISKFS_OPTIONS
290 AC_MSG_CHECKING([which backing filesystem to use])
291 AC_MSG_RESULT([$BACKINGFS])
298 # the pinger is temporary, until we have the recovery node in place
300 AC_DEFUN([LC_CONFIG_PINGER],
301 [AC_MSG_CHECKING([whether to enable pinger support])
302 AC_ARG_ENABLE([pinger],
303 AC_HELP_STRING([--disable-pinger],
304 [disable recovery pinger support]),
305 [],[enable_pinger='yes'])
306 AC_MSG_RESULT([$enable_pinger])
307 if test x$enable_pinger != xno ; then
308 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
315 # do checksum of bulk data between client and OST
317 AC_DEFUN([LC_CONFIG_CHECKSUM],
318 [AC_MSG_CHECKING([whether to enable data checksum support])
319 AC_ARG_ENABLE([checksum],
320 AC_HELP_STRING([--disable-checksum],
321 [disable data checksum support]),
322 [],[enable_checksum='yes'])
323 AC_MSG_RESULT([$enable_checksum])
324 if test x$enable_checksum != xno ; then
325 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
330 # LC_CONFIG_HEALTH_CHECK_WRITE
332 # Turn off the actual write to the disk
334 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
335 [AC_MSG_CHECKING([whether to enable a write with the health check])
336 AC_ARG_ENABLE([health_write],
337 AC_HELP_STRING([--enable-health_write],
338 [enable disk writes when doing health check]),
339 [],[enable_health_write='no'])
340 AC_MSG_RESULT([$enable_health_write])
341 if test x$enable_health_write != xno ; then
342 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
347 # LC_CONFIG_LIBLUSTRE_RECOVERY
349 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
350 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
351 AC_ARG_ENABLE([liblustre-recovery],
352 AC_HELP_STRING([--disable-liblustre-recovery],
353 [disable liblustre recovery support]),
354 [],[enable_liblustre_recovery='yes'])
355 AC_MSG_RESULT([$enable_liblustre_recovery])
356 if test x$enable_liblustre_recovery != xno ; then
357 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
362 # LC_CONFIG_OBD_BUFFER_SIZE
364 # the maximum buffer size of lctl ioctls
366 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
367 [AC_MSG_CHECKING([maximum OBD ioctl size])
368 AC_ARG_WITH([obd-buffer-size],
369 AC_HELP_STRING([--with-obd-buffer-size=[size]],
370 [set lctl ioctl maximum bytes (default=8192)]),
372 OBD_BUFFER_SIZE=$with_obd_buffer_size
376 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
377 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
383 # AIX does not have statfs.f_namelen
385 AC_DEFUN([LC_STRUCT_STATFS],
386 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
387 LB_LINUX_TRY_COMPILE([
388 #include <linux/vfs.h>
394 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
401 # LC_READLINK_SSIZE_T
403 AC_DEFUN([LC_READLINK_SSIZE_T],
404 [AC_MSG_CHECKING([if readlink returns ssize_t])
408 ssize_t readlink(const char *, char *, size_t);
411 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
417 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
418 [AC_MSG_CHECKING([if kernel offers page_mapped])
419 LB_LINUX_TRY_COMPILE([
420 #include <linux/mm.h>
425 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
431 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
432 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
433 LB_LINUX_TRY_COMPILE([
434 #include <linux/fs.h>
436 struct file_operations fops;
437 &fops.unlocked_ioctl;
440 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
446 AC_DEFUN([LC_FILEMAP_POPULATE],
447 [AC_MSG_CHECKING([for exported filemap_populate])
448 LB_LINUX_TRY_COMPILE([
449 #include <asm/page.h>
450 #include <linux/mm.h>
452 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
455 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
461 AC_DEFUN([LC_D_ADD_UNIQUE],
462 [AC_MSG_CHECKING([for d_add_unique])
463 LB_LINUX_TRY_COMPILE([
464 #include <linux/dcache.h>
466 d_add_unique(NULL, NULL);
469 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
475 AC_DEFUN([LC_BIT_SPINLOCK_H],
476 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
477 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
478 LB_LINUX_TRY_COMPILE([
479 #include <asm/processor.h>
480 #include <linux/spinlock.h>
481 #include <linux/bit_spinlock.h>
484 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
495 # If we have xattr_acl.h
497 AC_DEFUN([LC_XATTR_ACL],
498 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
499 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
500 LB_LINUX_TRY_COMPILE([
501 #include <linux/xattr_acl.h>
504 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
515 # If we have fiemap.h
516 # after 2.6.27 use fiemap.h in include/linux
518 AC_DEFUN([LC_LINUX_FIEMAP_H],
519 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
520 AC_MSG_CHECKING([if fiemap.h can be compiled])
521 LB_LINUX_TRY_COMPILE([
522 #include <linux/fiemap.h>
525 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
534 AC_DEFUN([LC_STRUCT_INTENT_FILE],
535 [AC_MSG_CHECKING([if struct open_intent has a file field])
536 LB_LINUX_TRY_COMPILE([
537 #include <linux/fs.h>
538 #include <linux/namei.h>
540 struct open_intent intent;
544 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
551 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
552 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
553 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
554 LB_LINUX_TRY_COMPILE([
555 #include <linux/posix_acl_xattr.h>
558 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
571 # starting from 2.6.19 linux kernel exports __iget()
573 AC_DEFUN([LC_EXPORT___IGET],
574 [LB_CHECK_SYMBOL_EXPORT([__iget],
576 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
581 AC_DEFUN([LC_LUSTRE_VERSION_H],
582 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
583 rm -f "$LUSTRE/include/linux/lustre_version.h"
585 touch "$LUSTRE/include/linux/lustre_version.h"
586 if test x$enable_server = xyes ; then
587 AC_MSG_WARN([Unpatched kernel detected.])
588 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
589 AC_MSG_WARN([disabling server build])
595 AC_DEFUN([LC_FUNC_SET_FS_PWD],
596 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
598 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
606 AC_DEFUN([LC_CAPA_CRYPTO],
607 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
608 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
610 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
611 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
613 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
614 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
619 # LC_CONFIG_RMTCLIENT
622 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
624 AC_DEFUN([LC_CONFIG_RMTCLIENT],
625 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
626 AC_MSG_ERROR([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
630 AC_DEFUN([LC_SUNRPC_CACHE],
631 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
632 LB_LINUX_TRY_COMPILE([
633 #include <linux/sunrpc/cache.h>
635 struct cache_head ch;
639 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
645 AC_DEFUN([LC_CONFIG_SUNRPC],
646 [LB_LINUX_CONFIG_IM([SUNRPC],[],
647 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
652 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
654 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
655 [AC_MSG_CHECKING([whether to enable gss keyring backend])
656 AC_ARG_ENABLE([gss_keyring],
657 [AC_HELP_STRING([--disable-gss-keyring],
658 [disable gss keyring backend])],
659 [],[enable_gss_keyring='yes'])
660 AC_MSG_RESULT([$enable_gss_keyring])
662 if test x$enable_gss_keyring != xno; then
663 LB_LINUX_CONFIG_IM([KEYS],[],
664 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
666 AC_CHECK_LIB([keyutils], [keyctl_search], [],
667 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
669 AC_DEFINE([HAVE_GSS_KEYRING], [1],
670 [Define this if you enable gss keyring backend])
675 # LC_CONFIG_GSS (default disabled)
677 # Build gss and related tools of Lustre. Currently both kernel and user space
678 # parts are depend on linux platform.
680 AC_DEFUN([LC_CONFIG_GSS],
681 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
683 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
684 [],[enable_gss='no'])
685 AC_MSG_RESULT([$enable_gss])
687 if test x$enable_gss == xyes; then
688 LC_CONFIG_GSS_KEYRING
691 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
692 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
693 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
694 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
695 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
696 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
697 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
698 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
699 LB_LINUX_CONFIG_IM([CRYPTO_WP512],[],
700 [AC_MSG_WARN([kernel WP512 support is recommended by using GSS.])])
701 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],
702 [AC_MSG_WARN([kernel ARC4 support is recommended by using GSS.])])
703 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],
704 [AC_MSG_WARN([kernel DES support is recommended by using GSS.])])
705 LB_LINUX_CONFIG_IM([CRYPTO_TWOFISH],[],
706 [AC_MSG_WARN([kernel TWOFISH support is recommended by using GSS.])])
707 LB_LINUX_CONFIG_IM([CRYPTO_CAST6],[],
708 [AC_MSG_WARN([kernel CAST6 support is recommended by using GSS.])])
710 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
711 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
712 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
713 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
714 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
716 AC_SUBST(GSSAPI_LIBS)
722 # LC_FUNC_MS_FLOCK_LOCK
724 # SLES9 kernel has MS_FLOCK_LOCK sb flag
726 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
727 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
728 LB_LINUX_TRY_COMPILE([
729 #include <linux/fs.h>
731 int flags = MS_FLOCK_LOCK;
733 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
734 [kernel has MS_FLOCK_LOCK flag])
742 # LC_FUNC_HAVE_CAN_SLEEP_ARG
744 # SLES9 kernel has third arg can_sleep
745 # in fs/locks.c: flock_lock_file_wait()
747 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
748 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
749 LB_LINUX_TRY_COMPILE([
750 #include <linux/fs.h>
754 struct file_lock *file_lock;
755 flock_lock_file_wait(file, file_lock, cansleep);
757 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
758 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
768 # rhel4.2 kernel has f_op->flock field
770 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
771 [AC_MSG_CHECKING([if struct file_operations has flock field])
772 LB_LINUX_TRY_COMPILE([
773 #include <linux/fs.h>
775 struct file_operations ll_file_operations_flock;
776 ll_file_operations_flock.flock = NULL;
778 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
779 [struct file_operations has flock field])
789 # task struct has p_pptr instead of parent
791 AC_DEFUN([LC_TASK_PPTR],
792 [AC_MSG_CHECKING([task p_pptr found])
793 LB_LINUX_TRY_COMPILE([
794 #include <linux/sched.h>
796 struct task_struct *p;
801 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
810 # rhel4.2 kernel has f_op->flock field
812 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
813 [AC_MSG_CHECKING([if struct file_operations has flock field])
814 LB_LINUX_TRY_COMPILE([
815 #include <linux/fs.h>
817 struct file_operations ll_file_operations_flock;
818 ll_file_operations_flock.flock = NULL;
820 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
821 [struct file_operations has flock field])
829 # after 2.6.15 inode have i_mutex intead of i_sem
830 AC_DEFUN([LC_INODE_I_MUTEX],
831 [AC_MSG_CHECKING([if inode has i_mutex ])
832 LB_LINUX_TRY_COMPILE([
833 #include <linux/mutex.h>
834 #include <linux/fs.h>
839 mutex_unlock(&i.i_mutex);
842 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
843 [after 2.6.15 inode have i_mutex intead of i_sem])
850 # after 2.6.18 seq_file has lock intead of sem
851 AC_DEFUN([LC_SEQ_LOCK],
852 [AC_MSG_CHECKING([if struct seq_file has lock field])
853 LB_LINUX_TRY_COMPILE([
854 #include <linux/seq_file.h>
858 mutex_unlock(&seq.lock);
861 AC_DEFINE(HAVE_SEQ_LOCK, 1,
862 [after 2.6.18 seq_file has lock intead of sem])
869 # after 2.6.17 dquote use mutex instead if semaphore
870 AC_DEFUN([LC_DQUOTOFF_MUTEX],
871 [AC_MSG_CHECKING([use dqonoff_mutex])
872 LB_LINUX_TRY_COMPILE([
873 #include <linux/mutex.h>
874 #include <linux/fs.h>
875 #include <linux/quota.h>
877 struct quota_info dq;
879 mutex_unlock(&dq.dqonoff_mutex);
882 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
883 [after 2.6.17 dquote use mutex instead if semaphore])
890 # LC_STATFS_DENTRY_PARAM
891 # starting from 2.6.18 linux kernel uses dentry instead of
892 # super_block for first vfs_statfs argument
894 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
895 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
896 LB_LINUX_TRY_COMPILE([
897 #include <linux/fs.h>
899 int vfs_statfs(struct dentry *, struct kstatfs *);
901 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
902 [first parameter of vfs_statfs is dentry])
911 # starting from 2.6.18 kernel don't export do_kern_mount
912 # and want to use vfs_kern_mount instead.
914 AC_DEFUN([LC_VFS_KERN_MOUNT],
915 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
916 LB_LINUX_TRY_COMPILE([
917 #include <linux/mount.h>
919 vfs_kern_mount(NULL, 0, NULL, NULL);
921 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
922 [vfs_kern_mount exist in kernel])
930 # LC_INVALIDATEPAGE_RETURN_INT
931 # more 2.6 api changes. return type for the invalidatepage
932 # address_space_operation is 'void' in new kernels but 'int' in old
934 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
935 [AC_MSG_CHECKING([invalidatepage has return int])
936 LB_LINUX_TRY_COMPILE([
937 #include <linux/buffer_head.h>
939 int rc = block_invalidatepage(NULL, 0);
942 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
943 [Define if return type of invalidatepage should be int])
949 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
950 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
951 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
952 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
953 tmp_flags="$EXTRA_KCFLAGS"
954 EXTRA_KCFLAGS="-Werror"
955 LB_LINUX_TRY_COMPILE([
956 #include <linux/fs.h>
959 static void cfg_umount_begin (struct vfsmount *v, int flags)
964 static struct super_operations cfg_super_operations = {
965 .umount_begin = cfg_umount_begin,
968 cfg_super_operations.umount_begin(NULL,0);
971 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
972 [Define umount_begin need second argument])
976 EXTRA_KCFLAGS="$tmp_flags"
980 # inode don't have i_blksize field
981 AC_DEFUN([LC_INODE_BLKSIZE],
982 [AC_MSG_CHECKING([inode has i_blksize field])
983 LB_LINUX_TRY_COMPILE([
984 #include <linux/fs.h>
990 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
991 [struct inode has i_blksize field])
997 # LC_VFS_READDIR_U64_INO
998 # 2.6.19 use u64 for inode number instead of inode_t
999 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1000 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1001 tmp_flags="$EXTRA_KCFLAGS"
1002 EXTRA_KCFLAGS="-Werror"
1003 LB_LINUX_TRY_COMPILE([
1004 #include <linux/fs.h>
1005 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1006 u64 ino, unsigned int d_type)
1013 filter = fillonedir;
1017 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1018 [if vfs_readdir need 64bit inode number])
1022 EXTRA_KCFLAGS="$tmp_flags"
1026 # 2.6.19 replaced writev with aio_write
1027 AC_DEFUN([LC_FILE_WRITEV],
1028 [AC_MSG_CHECKING([writev in fops])
1029 LB_LINUX_TRY_COMPILE([
1030 #include <linux/fs.h>
1032 struct file_operations *fops = NULL;
1033 fops->writev = NULL;
1036 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1043 # LC_GENERIC_FILE_READ
1044 # 2.6.19 replaced readv with aio_read
1045 AC_DEFUN([LC_FILE_READV],
1046 [AC_MSG_CHECKING([readv in fops])
1047 LB_LINUX_TRY_COMPILE([
1048 #include <linux/fs.h>
1050 struct file_operations *fops = NULL;
1054 AC_DEFINE(HAVE_FILE_READV, 1,
1062 # 2.6.18 don't export nr_pagecahe
1063 AC_DEFUN([LC_NR_PAGECACHE],
1064 [AC_MSG_CHECKING([kernel export nr_pagecache])
1065 LB_LINUX_TRY_COMPILE([
1066 #include <linux/pagemap.h>
1068 return atomic_read(&nr_pagecache);
1071 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1072 [is kernel export nr_pagecache])
1078 # LC_CANCEL_DIRTY_PAGE
1079 # 2.6.20 introduse cancel_dirty_page instead of
1081 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1082 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1083 LB_LINUX_TRY_COMPILE([
1084 #include <linux/mm.h>
1085 #include <linux/page-flags.h>
1087 cancel_dirty_page(NULL, 0);
1090 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1091 [kernel has cancel_dirty_page instead of clear_page_dirty])
1100 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1101 # it support constant page, which means the page won't be modified during the
1104 AC_DEFUN([LC_PAGE_CONSTANT],
1105 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1106 LB_LINUX_TRY_COMPILE([
1107 #include <linux/mm.h>
1108 #include <linux/page-flags.h>
1111 #error "Have no raid5 zcopy patch"
1115 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1121 # RHEL5 in FS-cache patch rename PG_checked flag
1123 AC_DEFUN([LC_PG_FS_MISC],
1124 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1125 LB_LINUX_TRY_COMPILE([
1126 #include <linux/mm.h>
1127 #include <linux/page-flags.h>
1130 #error PG_fs_misc not defined in kernel
1134 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1135 [is kernel have PG_fs_misc])
1141 # RHEL5 PageChecked and SetPageChecked defined
1142 AC_DEFUN([LC_PAGE_CHECKED],
1143 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1144 LB_LINUX_TRY_COMPILE([
1145 #include <linux/mm.h>
1146 #include <linux/page-flags.h>
1149 #error PageChecked not defined in kernel
1151 #ifndef SetPageChecked
1152 #error SetPageChecked not defined in kernel
1156 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1157 [does kernel have PageChecked and SetPageChecked])
1163 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1164 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1166 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1167 [kernel export truncate_complete_page])
1172 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1173 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1175 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1176 [d_rehash_cond is exported by the kernel])
1181 AC_DEFUN([LC_EXPORT___D_REHASH],
1182 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1184 AC_DEFINE(HAVE___D_REHASH, 1,
1185 [__d_rehash is exported by the kernel])
1190 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1191 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1193 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1194 [d_move_locked is exported by the kernel])
1199 AC_DEFUN([LC_EXPORT___D_MOVE],
1200 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1202 AC_DEFINE(HAVE___D_MOVE, 1,
1203 [__d_move is exported by the kernel])
1209 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1211 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1212 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1214 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1215 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1216 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1217 [exported invalidate_mapping_pages])],
1218 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1219 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1220 [exported invalidate_inode_pages])], [
1221 AC_MSG_ERROR([no way to invalidate pages])
1227 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
1229 # No standard kernels export this
1231 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1232 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1234 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1235 [filemap_fdatawrite_range is exported by the kernel])
1240 # The actual symbol exported varies among architectures, so we need
1241 # to check many symbols (but only in the current architecture.) No
1242 # matter what symbol is exported, the kernel #defines node_to_cpumask
1243 # to the appropriate function and that's what we use.
1244 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1245 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1246 [arch/$LINUX_ARCH/mm/numa.c],
1247 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1248 [node_to_cpumask is exported by
1249 the kernel])]) # x86_64
1250 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1251 [arch/$LINUX_ARCH/kernel/smpboot.c],
1252 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1253 [node_to_cpumask is exported by
1254 the kernel])]) # ia64
1255 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1256 [arch/$LINUX_ARCH/kernel/smpboot.c],
1257 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1258 [node_to_cpumask is exported by
1259 the kernel])]) # i386
1262 # 2.6.22 lost second parameter for invalidate_bdev
1263 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1264 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1265 LB_LINUX_TRY_COMPILE([
1266 #include <linux/buffer_head.h>
1268 invalidate_bdev(NULL,0);
1270 AC_MSG_RESULT([yes])
1271 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1272 [invalidate_bdev has second argument])
1278 # 2.6.23 have return type 'void' for unregister_blkdev
1279 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1280 [AC_MSG_CHECKING([if unregister_blkdev return int])
1281 LB_LINUX_TRY_COMPILE([
1282 #include <linux/fs.h>
1284 int i = unregister_blkdev(0,NULL);
1286 AC_MSG_RESULT([yes])
1287 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1288 [unregister_blkdev return int])
1294 # 2.6.23 change .sendfile to .splice_read
1295 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1296 [AC_MSG_CHECKING([if kernel has .splice_read])
1297 LB_LINUX_TRY_COMPILE([
1298 #include <linux/fs.h>
1300 struct file_operations file;
1302 file.splice_read = NULL;
1304 AC_MSG_RESULT([yes])
1305 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1306 [kernel has .slice_read])
1312 # 2.6.23 extract nfs export related data into exportfs.h
1313 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1316 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1317 AC_CHECK_HEADERS([linux/exportfs.h])
1322 # LC_VFS_INTENT_PATCHES
1324 # check if the kernel has the VFS intent patches
1325 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1326 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1327 LB_LINUX_TRY_COMPILE([
1328 #include <linux/fs.h>
1329 #include <linux/namei.h>
1331 struct nameidata nd;
1332 struct lookup_intent *it;
1335 intent_init(it, IT_OPEN);
1336 it->d.lustre.it_disposition = 0;
1337 it->d.lustre.it_data = NULL;
1339 AC_MSG_RESULT([yes])
1340 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1346 AC_DEFUN([LC_S_TIME_GRAN],
1347 [AC_MSG_CHECKING([if super block has s_time_gran member])
1348 LB_LINUX_TRY_COMPILE([
1349 #include <linux/fs.h>
1351 struct super_block sb;
1353 return sb.s_time_gran;
1355 AC_MSG_RESULT([yes])
1356 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1362 AC_DEFUN([LC_SB_TIME_GRAN],
1363 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1364 LB_LINUX_TRY_COMPILE([
1365 #include <linux/fs.h>
1367 return get_sb_time_gran(NULL);
1369 AC_MSG_RESULT([yes])
1370 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1377 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1378 AC_DEFUN([LC_RW_TREE_LOCK],
1379 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1380 tmp_flags="$EXTRA_KCFLAGS"
1381 EXTRA_KCFLAGS="-Werror"
1382 LB_LINUX_TRY_COMPILE([
1383 #include <linux/fs.h>
1385 struct address_space a;
1387 write_lock(&a.tree_lock);
1389 AC_MSG_RESULT([yes])
1390 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1394 EXTRA_KCFLAGS="$tmp_flags"
1397 AC_DEFUN([LC_CONST_ACL_SIZE],
1398 [AC_MSG_CHECKING([calc acl size])
1400 CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 $EXTRA_KCFLAGS"
1403 #include <linux/autoconf.h>
1404 #include <linux/types.h>
1407 #define __LINUX_POSIX_ACL_H
1409 # ifdef CONFIG_FS_POSIX_ACL
1410 # ifdef HAVE_XATTR_ACL
1411 # include <linux/xattr_acl.h>
1413 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1414 # include <linux/posix_acl_xattr.h>
1418 #include <lustre_acl.h>
1424 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1425 FILE *f = fopen("acl.size","w+");
1426 fprintf(f,"%d", size);
1433 acl_size=`cat acl.size`
1434 AC_MSG_RESULT([ACL size $acl_size])
1435 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1437 AC_ERROR([ACL size can't computed])
1443 # check for crypto API
1445 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1446 [AC_MSG_CHECKING([if kernel has block cipher support])
1447 LB_LINUX_TRY_COMPILE([
1448 #include <linux/crypto.h>
1450 int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1452 AC_MSG_RESULT([yes])
1453 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1460 # check for FS_RENAME_DOES_D_MOVE flag
1462 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1463 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1464 LB_LINUX_TRY_COMPILE([
1465 #include <linux/fs.h>
1467 int v = FS_RENAME_DOES_D_MOVE;
1469 AC_MSG_RESULT([yes])
1470 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1479 # Lustre linux kernel checks
1481 AC_DEFUN([LC_PROG_LINUX],
1482 [LC_LUSTRE_VERSION_H
1483 if test x$enable_server = xyes ; then
1484 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1489 LC_CONFIG_LIBLUSTRE_RECOVERY
1490 LC_CONFIG_HEALTH_CHECK_WRITE
1491 LC_CONFIG_LRU_RESIZE
1496 LC_EXPORT_TRUNCATE_COMPLETE
1497 LC_EXPORT_D_REHASH_COND
1498 LC_EXPORT___D_REHASH
1499 LC_EXPORT_D_MOVE_LOCKED
1501 LC_EXPORT_NODE_TO_CPUMASK
1503 LC_FUNC_RELEASEPAGE_WITH_INT
1506 LC_FUNC_REGISTER_CACHE
1507 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1508 LC_FUNC_DEV_SET_RDONLY
1509 LC_FUNC_FILEMAP_FDATAWRITE
1512 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1518 LC_POSIX_ACL_XATTR_H
1521 LC_STRUCT_INTENT_FILE
1527 LC_FUNC_MS_FLOCK_LOCK
1528 LC_FUNC_HAVE_CAN_SLEEP_ARG
1531 LC_COOKIE_FOLLOW_LINK
1536 # does the kernel have VFS intent patches?
1537 LC_VFS_INTENT_PATCHES
1550 LC_SECURITY_PLUG # for SLES10 SP2
1557 LC_STATFS_DENTRY_PARAM
1559 LC_INVALIDATEPAGE_RETURN_INT
1560 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1562 if test x$enable_server = xyes ; then
1563 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1564 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1567 #2.6.18 + RHEL5 (fc6)
1573 LC_VFS_READDIR_U64_INO
1578 LC_CANCEL_DIRTY_PAGE
1580 # raid5-zerocopy patch
1584 LC_INVALIDATE_BDEV_2ARG
1585 LC_ASYNC_BLOCK_CIPHER
1586 LC_FS_RENAME_DOES_D_MOVE
1588 LC_UNREGISTER_BLKDEV_RETURN_INT
1589 LC_KERNEL_SPLICE_READ
1594 # LC_CONFIG_CLIENT_SERVER
1596 # Build client/server sides of Lustre
1598 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1599 [AC_MSG_CHECKING([whether to build Lustre server support])
1600 AC_ARG_ENABLE([server],
1601 AC_HELP_STRING([--disable-server],
1602 [disable Lustre server support]),
1603 [],[enable_server='yes'])
1604 AC_MSG_RESULT([$enable_server])
1606 AC_MSG_CHECKING([whether to build Lustre client support])
1607 AC_ARG_ENABLE([client],
1608 AC_HELP_STRING([--disable-client],
1609 [disable Lustre client support]),
1610 [],[enable_client='yes'])
1611 AC_MSG_RESULT([$enable_client])])
1614 # LC_CONFIG_LIBLUSTRE
1616 # whether to build liblustre
1618 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1619 [AC_MSG_CHECKING([whether to build Lustre library])
1620 AC_ARG_ENABLE([liblustre],
1621 AC_HELP_STRING([--disable-liblustre],
1622 [disable building of Lustre library]),
1623 [],[enable_liblustre=$with_sysio])
1624 AC_MSG_RESULT([$enable_liblustre])
1625 # only build sysio if liblustre is built
1626 with_sysio="$enable_liblustre"
1628 AC_MSG_CHECKING([whether to build liblustre tests])
1629 AC_ARG_ENABLE([liblustre-tests],
1630 AC_HELP_STRING([--enable-liblustre-tests],
1631 [enable liblustre tests, if --disable-tests is used]),
1632 [],[enable_liblustre_tests=$enable_tests])
1633 if test x$enable_liblustre != xyes ; then
1634 enable_liblustre_tests='no'
1636 AC_MSG_RESULT([$enable_liblustre_tests])
1638 AC_MSG_CHECKING([whether to enable liblustre acl])
1639 AC_ARG_ENABLE([liblustre-acl],
1640 AC_HELP_STRING([--disable-liblustre-acl],
1641 [disable ACL support for liblustre]),
1642 [],[enable_liblustre_acl=yes])
1643 AC_MSG_RESULT([$enable_liblustre_acl])
1644 if test x$enable_liblustre_acl = xyes ; then
1645 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1651 AC_ARG_ENABLE(mpitests,
1652 AC_HELP_STRING([--enable-mpitest=yes|no|mpich directory],
1653 [include mpi tests]),
1659 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1660 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1665 [[\\/$]]* | ?:[[\\/]]* )
1667 LDFLAGS="$LDFLAGS -L$with_mpi/lib"
1668 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1671 AC_MSG_ERROR([expected absolute directory name for --enable-mpitests or yes or no])
1677 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1678 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1684 if test x$enable_mpitests != xno; then
1685 AC_MSG_CHECKING([whether to mpitests can be built])
1686 AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
1687 [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
1688 [enable_mpitests=no])
1690 AC_MSG_RESULT([$enable_mpitests])
1693 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1694 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1697 LC_CONFIG_LIBLUSTRE_RECOVERY
1700 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1701 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1702 AC_ARG_ENABLE([lru_resize],
1703 AC_HELP_STRING([--enable-lru-resize],
1704 [enable lru resize support]),
1705 [],[enable_lru_resize='yes'])
1706 AC_MSG_RESULT([$enable_lru_resize])
1707 if test x$enable_lru_resize != xno; then
1708 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1715 # whether to enable quota support global control
1717 AC_DEFUN([LC_CONFIG_QUOTA],
1718 [AC_ARG_ENABLE([quota],
1719 AC_HELP_STRING([--enable-quota],
1720 [enable quota support]),
1721 [],[enable_quota='yes'])
1724 # whether to enable quota support(kernel modules)
1725 AC_DEFUN([LC_QUOTA_MODULE],
1726 [if test x$enable_quota != xno; then
1727 LB_LINUX_CONFIG([QUOTA],[
1728 enable_quota_module='yes'
1729 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1731 enable_quota_module='no'
1732 AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
1737 AC_DEFUN([LC_QUOTA],
1741 AC_CHECK_HEADER(sys/quota.h,
1742 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
1743 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
1746 AC_DEFUN([LC_QUOTA_READ],
1747 [AC_MSG_CHECKING([if kernel supports quota_read])
1748 LB_LINUX_TRY_COMPILE([
1749 #include <linux/fs.h>
1751 struct super_operations sp;
1752 void *i = (void *)sp.quota_read;
1754 AC_MSG_RESULT([yes])
1755 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1764 # whether to enable split support
1766 AC_DEFUN([LC_CONFIG_SPLIT],
1767 [AC_MSG_CHECKING([whether to enable split support])
1768 AC_ARG_ENABLE([split],
1769 AC_HELP_STRING([--enable-split],
1770 [enable split support]),
1771 [],[enable_split='no'])
1772 AC_MSG_RESULT([$enable_split])
1773 if test x$enable_split != xno; then
1774 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1779 # LC_COOKIE_FOLLOW_LINK
1781 # kernel 2.6.13+ ->follow_link returns a cookie
1784 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1785 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1786 LB_LINUX_TRY_COMPILE([
1787 #include <linux/fs.h>
1788 #include <linux/namei.h>
1790 struct dentry dentry;
1791 struct nameidata nd;
1793 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1795 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1796 AC_MSG_RESULT([yes])
1805 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1806 # call_rcu takes three parameters.
1808 AC_DEFUN([LC_FUNC_RCU],
1809 [AC_MSG_CHECKING([if kernel have RCU supported])
1810 LB_LINUX_TRY_COMPILE([
1811 #include <linux/rcupdate.h>
1813 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1814 AC_MSG_RESULT([yes])
1816 AC_MSG_CHECKING([if call_rcu takes three parameters])
1817 LB_LINUX_TRY_COMPILE([
1818 #include <linux/rcupdate.h>
1821 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1823 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1824 AC_MSG_RESULT([yes])
1833 # LC_SECURITY_PLUG # for SLES10 SP2
1834 # check security plug in sles10 sp2 kernel
1835 AC_DEFUN([LC_SECURITY_PLUG],
1836 [AC_MSG_CHECKING([If kernel has security plug support])
1837 LB_LINUX_TRY_COMPILE([
1838 #include <linux/fs.h>
1840 struct dentry *dentry;
1841 struct vfsmount *mnt;
1842 struct iattr *iattr;
1844 notify_change(dentry, mnt, iattr);
1847 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
1848 [SLES10 SP2 use extra parameter in vfs])
1854 AC_DEFUN([LC_PERCPU_COUNTER],
1855 [AC_MSG_CHECKING([if have struct percpu_counter defined])
1856 LB_LINUX_TRY_COMPILE([
1857 #include <linux/percpu_counter.h>
1859 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
1860 AC_MSG_RESULT([yes])
1862 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
1863 LB_LINUX_TRY_COMPILE([
1864 #include <linux/percpu_counter.h>
1866 struct percpu_counter c;
1867 percpu_counter_init(&c, 0);
1869 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
1871 AC_MSG_RESULT([yes])
1882 # linux kernel have 64-bit limits support
1884 AC_DEFUN([LC_QUOTA64],
1885 [if test x$enable_quota_module = xyes; then
1886 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1887 LB_LINUX_TRY_COMPILE([
1888 #include <linux/kernel.h>
1889 #include <linux/fs.h>
1890 #include <linux/quotaio_v2.h>
1891 int versions[] = V2_INITQVERSIONS_R1;
1892 struct v2_disk_dqblk_r1 dqblk_r1;
1894 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1895 AC_MSG_RESULT([yes])
1897 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1898 if test x$enable_server = xyes ; then
1899 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1910 # other configure checks
1912 AC_DEFUN([LC_CONFIGURE],
1913 [LC_CONFIG_OBD_BUFFER_SIZE
1915 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1916 CFLAGS="$CFLAGS -Werror"
1919 # include/liblustre.h
1920 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1922 # liblustre/llite_lib.h
1923 AC_CHECK_HEADERS([xtio.h file.h])
1926 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1929 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1930 AC_CHECK_FUNCS([inet_ntoa])
1932 # libsysio/src/readlink.c
1935 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1936 AC_CHECK_HEADERS([linux/random.h], [], [],
1937 [#ifdef HAVE_LINUX_TYPES_H
1938 # include <linux/types.h>
1943 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1945 # check for -lz support
1949 [AC_CHECK_HEADERS([zlib.h],
1951 AC_DEFINE([HAVE_ADLER], 1,
1952 [support alder32 checksum type])],
1953 [AC_MSG_WARN([No zlib-devel package found,
1954 unable to use adler32 checksum])])],
1955 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1960 AC_ARG_ENABLE([mindf],
1961 AC_HELP_STRING([--enable-mindf],
1962 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1964 if test "$enable_mindf" = "yes" ; then
1965 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1968 AC_ARG_ENABLE([fail_alloc],
1969 AC_HELP_STRING([--disable-fail-alloc],
1970 [disable randomly alloc failure]),
1971 [],[enable_fail_alloc=yes])
1972 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1973 AC_MSG_RESULT([$enable_fail_alloc])
1974 if test x$enable_fail_alloc != xno ; then
1975 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1978 AC_ARG_ENABLE([invariants],
1979 AC_HELP_STRING([--enable-invariants],
1980 [enable invariant checking (cpu intensive)]),
1982 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
1983 AC_MSG_RESULT([$enable_invariants])
1984 if test x$enable_invariants = xyes ; then
1985 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
1988 AC_ARG_ENABLE([lu_ref],
1989 AC_HELP_STRING([--enable-lu_ref],
1990 [enable lu_ref reference tracking code]),
1992 AC_MSG_CHECKING([whether to track references with lu_ref])
1993 AC_MSG_RESULT([$enable_lu_ref])
1994 if test x$enable_lu_ref = xyes ; then
1995 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2003 # AM_CONDITIONALS for lustre
2005 AC_DEFUN([LC_CONDITIONALS],
2006 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2007 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2008 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2009 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2010 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2011 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2012 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2013 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2014 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2015 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2016 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2017 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2018 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2019 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2025 # files that should be generated with AC_OUTPUT
2027 AC_DEFUN([LC_CONFIG_FILES],
2031 lustre/autoconf/Makefile
2032 lustre/contrib/Makefile
2034 lustre/include/Makefile
2035 lustre/include/lustre_ver.h
2036 lustre/include/linux/Makefile
2037 lustre/include/lustre/Makefile
2038 lustre/kernel_patches/targets/2.6-vanilla.target
2039 lustre/kernel_patches/targets/2.6-rhel4.target
2040 lustre/kernel_patches/targets/2.6-rhel5.target
2041 lustre/kernel_patches/targets/2.6-fc5.target
2042 lustre/kernel_patches/targets/2.6-patchless.target
2043 lustre/kernel_patches/targets/2.6-sles10.target
2044 lustre/ldlm/Makefile
2046 lustre/fid/autoMakefile
2047 lustre/liblustre/Makefile
2048 lustre/liblustre/tests/Makefile
2049 lustre/llite/Makefile
2050 lustre/llite/autoMakefile
2051 lustre/lclient/Makefile
2053 lustre/lov/autoMakefile
2054 lustre/lvfs/Makefile
2055 lustre/lvfs/autoMakefile
2057 lustre/mdc/autoMakefile
2059 lustre/lmv/autoMakefile
2061 lustre/mds/autoMakefile
2063 lustre/mdt/autoMakefile
2065 lustre/cmm/autoMakefile
2067 lustre/mdd/autoMakefile
2069 lustre/fld/autoMakefile
2070 lustre/obdclass/Makefile
2071 lustre/obdclass/autoMakefile
2072 lustre/obdclass/linux/Makefile
2073 lustre/obdecho/Makefile
2074 lustre/obdecho/autoMakefile
2075 lustre/obdfilter/Makefile
2076 lustre/obdfilter/autoMakefile
2078 lustre/osc/autoMakefile
2080 lustre/ost/autoMakefile
2082 lustre/osd/autoMakefile
2084 lustre/mgc/autoMakefile
2086 lustre/mgs/autoMakefile
2087 lustre/ptlrpc/Makefile
2088 lustre/ptlrpc/autoMakefile
2089 lustre/ptlrpc/gss/Makefile
2090 lustre/ptlrpc/gss/autoMakefile
2091 lustre/quota/Makefile
2092 lustre/quota/autoMakefile
2093 lustre/scripts/Makefile
2094 lustre/scripts/version_tag.pl
2095 lustre/tests/Makefile
2096 lustre/utils/Makefile
2097 lustre/utils/gss/Makefile
2099 case $lb_target_os in
2101 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])