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.])
89 # rh 2.4.18 has iobuf->dovary, but other kernels do not
91 AC_DEFUN([LC_STRUCT_KIOBUF],
92 [AC_MSG_CHECKING([if struct kiobuf has a dovary field])
93 LB_LINUX_TRY_COMPILE([
94 #include <linux/iobuf.h>
100 AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
107 # LC_FUNC_COND_RESCHED
109 # cond_resched() was introduced in 2.4.20
111 AC_DEFUN([LC_FUNC_COND_RESCHED],
112 [AC_MSG_CHECKING([if kernel offers cond_resched])
113 LB_LINUX_TRY_COMPILE([
114 #include <linux/sched.h>
119 AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
126 # LC_FUNC_RELEASEPAGE_WITH_INT
128 # if ->releasepage() takes an int arg in 2.6.9
129 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
130 # while others either don't have gfp_t or pass gfp_t as the parameter.
132 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_INT],
133 [AC_MSG_CHECKING([if releasepage has a int parameter])
134 RELEASEPAGE_WITH_INT="`grep -c 'releasepage.*int' $LINUX/include/linux/fs.h`"
135 if test "$RELEASEPAGE_WITH_INT" != 0 ; then
136 AC_DEFINE(HAVE_RELEASEPAGE_WITH_INT, 1,
137 [releasepage with int parameter])
146 # LC_FUNC_ZAP_PAGE_RANGE
148 # if zap_page_range() takes a vma arg
150 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
151 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
152 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
153 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
154 AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
164 # if proc_fs.h defines PDE()
166 AC_DEFUN([LC_FUNC_PDE],
167 [AC_MSG_CHECKING([if kernel defines PDE])
168 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
169 if test "$HAVE_PDE" != 0 ; then
170 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
178 # LC_FUNC_FILEMAP_FDATASYNC
180 # if filemap_fdatasync() exists
182 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
183 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
184 LB_LINUX_TRY_COMPILE([
185 #include <linux/fs.h>
187 int (*foo)(struct address_space *)= filemap_fdatawrite;
190 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
199 # if direct_IO takes a struct file argument
201 AC_DEFUN([LC_FUNC_DIRECT_IO],
202 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
203 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
204 if test "$HAVE_DIO_FILE" != 0 ; then
205 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
213 # LC_HEADER_MM_INLINE
215 # RHEL kernels define page_count in mm_inline.h
217 AC_DEFUN([LC_HEADER_MM_INLINE],
218 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
219 LB_LINUX_TRY_COMPILE([
220 #include <linux/mm_inline.h>
223 #error mm_inline.h does not define page_count
227 AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
236 # if inode->i_alloc_sem exists
238 AC_DEFUN([LC_STRUCT_INODE],
239 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
240 LB_LINUX_TRY_COMPILE([
241 #include <linux/fs.h>
242 #include <linux/version.h>
244 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
245 #error "down_read_trylock broken before 2.4.24"
248 return (char *)&i.i_alloc_sem - (char *)&i;
251 AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
258 # LC_FUNC_REGISTER_CACHE
260 # if register_cache() is defined by kernel
262 # There are two ways to shrink one customized cache in linux kernels. For the
263 # kernels are prior than 2.6.5(?), register_cache() is used, and for latest
264 # kernels, set_shrinker() is used instead.
266 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
267 [AC_MSG_CHECKING([if kernel defines cache pressure hook])
268 LB_LINUX_TRY_COMPILE([
269 #include <linux/mm.h>
273 set_shrinker(1, shrinker);
275 AC_MSG_RESULT([set_shrinker])
276 AC_DEFINE(HAVE_SHRINKER_CACHE, 1, [shrinker_cache found])
277 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [shrinkers should return int])
279 LB_LINUX_TRY_COMPILE([
280 #include <linux/list.h>
281 #include <linux/cache_def.h>
283 struct cache_definition cache;
285 AC_MSG_RESULT([register_cache])
286 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
287 AC_MSG_CHECKING([if kernel expects return from cache shrink ])
288 tmp_flags="$EXTRA_KCFLAGS"
289 EXTRA_KCFLAGS="-Werror"
290 LB_LINUX_TRY_COMPILE([
291 #include <linux/list.h>
292 #include <linux/cache_def.h>
294 struct cache_definition c;
295 c.shrinker = (int (*)(int, unsigned int))1;
297 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1,
298 [kernel expects return from shrink_cache])
303 EXTRA_KCFLAGS="$tmp_flags"
311 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
313 # check for our patched grab_cache_page_nowait_gfp() function
315 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
316 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
317 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
318 if test "$HAVE_GCPN_GFP" != 0 ; then
319 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
320 [kernel has grab_cache_page_nowait_gfp()])
328 # LC_FUNC_DEV_SET_RDONLY
330 # check for the old-style dev_set_rdonly which took an extra "devno" param
331 # and can only set a single device to discard writes at one time
333 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
334 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
335 LB_LINUX_TRY_COMPILE([
336 #include <linux/fs.h>
338 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
339 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
343 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
345 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
346 kernel patches from Lustre version 1.4.3 or above.])
351 # LC_CONFIG_BACKINGFS
353 # setup, check the backing filesystem
355 AC_DEFUN([LC_CONFIG_BACKINGFS],
359 if test x$with_ldiskfs = xno ; then
362 if test x$linux25$enable_server = xyesyes ; then
363 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
366 # --- Check that ext3 and ext3 xattr are enabled in the kernel
368 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
370 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
371 AC_MSG_WARN([This build may fail.])
375 LB_DEFINE_LDISKFS_OPTIONS
378 AC_MSG_CHECKING([which backing filesystem to use])
379 AC_MSG_RESULT([$BACKINGFS])
386 # the pinger is temporary, until we have the recovery node in place
388 AC_DEFUN([LC_CONFIG_PINGER],
389 [AC_MSG_CHECKING([whether to enable pinger support])
390 AC_ARG_ENABLE([pinger],
391 AC_HELP_STRING([--disable-pinger],
392 [disable recovery pinger support]),
393 [],[enable_pinger='yes'])
394 AC_MSG_RESULT([$enable_pinger])
395 if test x$enable_pinger != xno ; then
396 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
403 # do checksum of bulk data between client and OST
405 AC_DEFUN([LC_CONFIG_CHECKSUM],
406 [AC_MSG_CHECKING([whether to enable data checksum support])
407 AC_ARG_ENABLE([checksum],
408 AC_HELP_STRING([--disable-checksum],
409 [disable data checksum support]),
410 [],[enable_checksum='yes'])
411 AC_MSG_RESULT([$enable_checksum])
412 if test x$enable_checksum != xno ; then
413 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
418 # LC_CONFIG_HEALTH_CHECK_WRITE
420 # Turn off the actual write to the disk
422 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
423 [AC_MSG_CHECKING([whether to enable a write with the health check])
424 AC_ARG_ENABLE([health_write],
425 AC_HELP_STRING([--enable-health_write],
426 [enable disk writes when doing health check]),
427 [],[enable_health_write='no'])
428 AC_MSG_RESULT([$enable_health_write])
429 if test x$enable_health_write != xno ; then
430 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
435 # LC_CONFIG_LIBLUSTRE_RECOVERY
437 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
438 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
439 AC_ARG_ENABLE([liblustre-recovery],
440 AC_HELP_STRING([--disable-liblustre-recovery],
441 [disable liblustre recovery support]),
442 [],[enable_liblustre_recovery='yes'])
443 AC_MSG_RESULT([$enable_liblustre_recovery])
444 if test x$enable_liblustre_recovery != xno ; then
445 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
450 # LC_CONFIG_OBD_BUFFER_SIZE
452 # the maximum buffer size of lctl ioctls
454 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
455 [AC_MSG_CHECKING([maximum OBD ioctl size])
456 AC_ARG_WITH([obd-buffer-size],
457 AC_HELP_STRING([--with-obd-buffer-size=[size]],
458 [set lctl ioctl maximum bytes (default=8192)]),
460 OBD_BUFFER_SIZE=$with_obd_buffer_size
464 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
465 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
471 # AIX does not have statfs.f_namelen
473 AC_DEFUN([LC_STRUCT_STATFS],
474 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
475 LB_LINUX_TRY_COMPILE([
476 #include <linux/vfs.h>
482 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
489 # LC_READLINK_SSIZE_T
491 AC_DEFUN([LC_READLINK_SSIZE_T],
492 [AC_MSG_CHECKING([if readlink returns ssize_t])
496 ssize_t readlink(const char *, char *, size_t);
499 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
505 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
506 [AC_MSG_CHECKING([if kernel offers page_mapped])
507 LB_LINUX_TRY_COMPILE([
508 #include <linux/mm.h>
513 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
519 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
520 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
521 LB_LINUX_TRY_COMPILE([
522 #include <linux/fs.h>
524 struct file_operations fops;
525 &fops.unlocked_ioctl;
528 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
534 AC_DEFUN([LC_FILEMAP_POPULATE],
535 [AC_MSG_CHECKING([for exported filemap_populate])
536 LB_LINUX_TRY_COMPILE([
537 #include <asm/page.h>
538 #include <linux/mm.h>
540 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
543 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
549 AC_DEFUN([LC_D_ADD_UNIQUE],
550 [AC_MSG_CHECKING([for d_add_unique])
551 LB_LINUX_TRY_COMPILE([
552 #include <linux/dcache.h>
554 d_add_unique(NULL, NULL);
557 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
563 AC_DEFUN([LC_BIT_SPINLOCK_H],
564 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
565 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
566 LB_LINUX_TRY_COMPILE([
567 #include <asm/processor.h>
568 #include <linux/spinlock.h>
569 #include <linux/bit_spinlock.h>
572 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
583 # If we have xattr_acl.h
585 AC_DEFUN([LC_XATTR_ACL],
586 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
587 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
588 LB_LINUX_TRY_COMPILE([
589 #include <linux/xattr_acl.h>
592 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
603 # If we have fiemap.h
604 # after 2.6.27 use fiemap.h in include/linux
606 AC_DEFUN([LC_LINUX_FIEMAP_H],
607 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
608 AC_MSG_CHECKING([if fiemap.h can be compiled])
609 LB_LINUX_TRY_COMPILE([
610 #include <linux/fiemap.h>
613 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
622 AC_DEFUN([LC_STRUCT_INTENT_FILE],
623 [AC_MSG_CHECKING([if struct open_intent has a file field])
624 LB_LINUX_TRY_COMPILE([
625 #include <linux/fs.h>
626 #include <linux/namei.h>
628 struct open_intent intent;
632 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
639 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
640 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
641 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
642 LB_LINUX_TRY_COMPILE([
643 #include <linux/posix_acl_xattr.h>
646 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
659 # starting from 2.6.19 linux kernel exports __iget()
661 AC_DEFUN([LC_EXPORT___IGET],
662 [LB_CHECK_SYMBOL_EXPORT([__iget],
664 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
669 AC_DEFUN([LC_LUSTRE_VERSION_H],
670 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
671 rm -f "$LUSTRE/include/linux/lustre_version.h"
673 touch "$LUSTRE/include/linux/lustre_version.h"
674 if test x$enable_server = xyes ; then
675 AC_MSG_WARN([Unpatched kernel detected.])
676 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
677 AC_MSG_WARN([disabling server build])
683 AC_DEFUN([LC_FUNC_SET_FS_PWD],
684 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
686 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
694 AC_DEFUN([LC_CAPA_CRYPTO],
695 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
696 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
698 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
699 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
701 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
702 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
706 AC_DEFUN([LC_SUNRPC_CACHE],
707 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
708 LB_LINUX_TRY_COMPILE([
709 #include <linux/sunrpc/cache.h>
711 struct cache_head ch;
715 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
721 AC_DEFUN([LC_CONFIG_SUNRPC],
722 [LB_LINUX_CONFIG_IM([SUNRPC],[],
723 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
728 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
730 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
731 [AC_MSG_CHECKING([whether to enable gss keyring backend])
732 AC_ARG_ENABLE([gss_keyring],
733 [AC_HELP_STRING([--disable-gss-keyring],
734 [disable gss keyring backend])],
735 [],[enable_gss_keyring='yes'])
736 AC_MSG_RESULT([$enable_gss_keyring])
738 if test x$enable_gss_keyring != xno; then
739 LB_LINUX_CONFIG_IM([KEYS],[],
740 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
742 AC_CHECK_LIB([keyutils], [keyctl_search], [],
743 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
745 AC_DEFINE([HAVE_GSS_KEYRING], [1],
746 [Define this if you enable gss keyring backend])
750 m4_pattern_allow(AC_KERBEROS_V5)
753 # LC_CONFIG_GSS (default disabled)
755 # Build gss and related tools of Lustre. Currently both kernel and user space
756 # parts are depend on linux platform.
758 AC_DEFUN([LC_CONFIG_GSS],
759 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
761 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
762 [],[enable_gss='no'])
763 AC_MSG_RESULT([$enable_gss])
765 if test x$enable_gss == xyes; then
766 LC_CONFIG_GSS_KEYRING
769 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
770 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
771 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
772 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
773 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
774 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
775 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
776 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
777 LB_LINUX_CONFIG_IM([CRYPTO_WP512],[],
778 [AC_MSG_WARN([kernel WP512 support is recommended by using GSS.])])
779 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],
780 [AC_MSG_WARN([kernel ARC4 support is recommended by using GSS.])])
781 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],
782 [AC_MSG_WARN([kernel DES support is recommended by using GSS.])])
783 LB_LINUX_CONFIG_IM([CRYPTO_TWOFISH],[],
784 [AC_MSG_WARN([kernel TWOFISH support is recommended by using GSS.])])
785 LB_LINUX_CONFIG_IM([CRYPTO_CAST6],[],
786 [AC_MSG_WARN([kernel CAST6 support is recommended by using GSS.])])
788 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
790 LB_LINUX_CONFIG_IM([CRYPTO_AES],[],
791 [AC_MSG_WARN([kernel AES support is recommended by using GSS.])])
793 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
794 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
795 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
796 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
797 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
799 AC_SUBST(GSSAPI_LIBS)
805 # LC_FUNC_MS_FLOCK_LOCK
807 # SLES9 kernel has MS_FLOCK_LOCK sb flag
809 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
810 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
811 LB_LINUX_TRY_COMPILE([
812 #include <linux/fs.h>
814 int flags = MS_FLOCK_LOCK;
816 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
817 [kernel has MS_FLOCK_LOCK flag])
825 # LC_FUNC_HAVE_CAN_SLEEP_ARG
827 # SLES9 kernel has third arg can_sleep
828 # in fs/locks.c: flock_lock_file_wait()
830 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
831 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
832 LB_LINUX_TRY_COMPILE([
833 #include <linux/fs.h>
837 struct file_lock *file_lock;
838 flock_lock_file_wait(file, file_lock, cansleep);
840 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
841 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
851 # rhel4.2 kernel has f_op->flock field
853 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
854 [AC_MSG_CHECKING([if struct file_operations has flock field])
855 LB_LINUX_TRY_COMPILE([
856 #include <linux/fs.h>
858 struct file_operations ll_file_operations_flock;
859 ll_file_operations_flock.flock = NULL;
861 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
862 [struct file_operations has flock field])
872 # task struct has p_pptr instead of parent
874 AC_DEFUN([LC_TASK_PPTR],
875 [AC_MSG_CHECKING([task p_pptr found])
876 LB_LINUX_TRY_COMPILE([
877 #include <linux/sched.h>
879 struct task_struct *p;
884 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
893 # rhel4.2 kernel has f_op->flock field
895 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
896 [AC_MSG_CHECKING([if struct file_operations has flock field])
897 LB_LINUX_TRY_COMPILE([
898 #include <linux/fs.h>
900 struct file_operations ll_file_operations_flock;
901 ll_file_operations_flock.flock = NULL;
903 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
904 [struct file_operations has flock field])
912 # after 2.6.15 inode have i_mutex intead of i_sem
913 AC_DEFUN([LC_INODE_I_MUTEX],
914 [AC_MSG_CHECKING([if inode has i_mutex ])
915 LB_LINUX_TRY_COMPILE([
916 #include <linux/mutex.h>
917 #include <linux/fs.h>
922 mutex_unlock(&i.i_mutex);
925 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
926 [after 2.6.15 inode have i_mutex intead of i_sem])
933 # after 2.6.17 dquote use mutex instead if semaphore
934 AC_DEFUN([LC_DQUOTOFF_MUTEX],
935 [AC_MSG_CHECKING([use dqonoff_mutex])
936 LB_LINUX_TRY_COMPILE([
937 #include <linux/mutex.h>
938 #include <linux/fs.h>
939 #include <linux/quota.h>
941 struct quota_info dq;
943 mutex_unlock(&dq.dqonoff_mutex);
946 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
947 [after 2.6.17 dquote use mutex instead if semaphore])
954 # LC_STATFS_DENTRY_PARAM
955 # starting from 2.6.18 linux kernel uses dentry instead of
956 # super_block for first vfs_statfs argument
958 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
959 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
960 LB_LINUX_TRY_COMPILE([
961 #include <linux/fs.h>
963 int vfs_statfs(struct dentry *, struct kstatfs *);
965 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
966 [first parameter of vfs_statfs is dentry])
975 # starting from 2.6.18 kernel don't export do_kern_mount
976 # and want to use vfs_kern_mount instead.
978 AC_DEFUN([LC_VFS_KERN_MOUNT],
979 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
980 LB_LINUX_TRY_COMPILE([
981 #include <linux/mount.h>
983 vfs_kern_mount(NULL, 0, NULL, NULL);
985 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
986 [vfs_kern_mount exist in kernel])
994 # LC_INVALIDATEPAGE_RETURN_INT
995 # more 2.6 api changes. return type for the invalidatepage
996 # address_space_operation is 'void' in new kernels but 'int' in old
998 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
999 [AC_MSG_CHECKING([invalidatepage has return int])
1000 LB_LINUX_TRY_COMPILE([
1001 #include <linux/buffer_head.h>
1003 int rc = block_invalidatepage(NULL, 0);
1006 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
1007 [Define if return type of invalidatepage should be int])
1013 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
1014 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
1015 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
1016 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
1017 tmp_flags="$EXTRA_KCFLAGS"
1018 EXTRA_KCFLAGS="-Werror"
1019 LB_LINUX_TRY_COMPILE([
1020 #include <linux/fs.h>
1023 static void cfg_umount_begin (struct vfsmount *v, int flags)
1028 static struct super_operations cfg_super_operations = {
1029 .umount_begin = cfg_umount_begin,
1032 cfg_super_operations.umount_begin(NULL,0);
1035 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
1036 [Define umount_begin need second argument])
1040 EXTRA_KCFLAGS="$tmp_flags"
1043 # 2.6.19 API changes
1044 # inode don't have i_blksize field
1045 AC_DEFUN([LC_INODE_BLKSIZE],
1046 [AC_MSG_CHECKING([inode has i_blksize field])
1047 LB_LINUX_TRY_COMPILE([
1048 #include <linux/fs.h>
1054 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1055 [struct inode has i_blksize field])
1061 # LC_VFS_READDIR_U64_INO
1062 # 2.6.19 use u64 for inode number instead of inode_t
1063 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1064 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1065 tmp_flags="$EXTRA_KCFLAGS"
1066 EXTRA_KCFLAGS="-Werror"
1067 LB_LINUX_TRY_COMPILE([
1068 #include <linux/fs.h>
1069 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1070 u64 ino, unsigned int d_type)
1077 filter = fillonedir;
1081 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1082 [if vfs_readdir need 64bit inode number])
1086 EXTRA_KCFLAGS="$tmp_flags"
1090 # 2.6.19 replaced writev with aio_write
1091 AC_DEFUN([LC_FILE_WRITEV],
1092 [AC_MSG_CHECKING([writev in fops])
1093 LB_LINUX_TRY_COMPILE([
1094 #include <linux/fs.h>
1096 struct file_operations *fops;
1097 fops->writev = NULL;
1100 AC_DEFINE(HAVE_FILE_WRITEV, 1,
1107 # LC_GENERIC_FILE_READ
1108 # 2.6.19 replaced readv with aio_read
1109 AC_DEFUN([LC_FILE_READV],
1110 [AC_MSG_CHECKING([readv in fops])
1111 LB_LINUX_TRY_COMPILE([
1112 #include <linux/fs.h>
1114 struct file_operations *fops;
1118 AC_DEFINE(HAVE_FILE_READV, 1,
1126 # 2.6.18 don't export nr_pagecahe
1127 AC_DEFUN([LC_NR_PAGECACHE],
1128 [AC_MSG_CHECKING([kernel export nr_pagecache])
1129 LB_LINUX_TRY_COMPILE([
1130 #include <linux/pagemap.h>
1132 return atomic_read(&nr_pagecache);
1135 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1136 [is kernel export nr_pagecache])
1142 # LC_CANCEL_DIRTY_PAGE
1143 # 2.6.20 introduse cancel_dirty_page instead of
1145 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1146 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1147 LB_LINUX_TRY_COMPILE([
1148 #include <linux/mm.h>
1149 #include <linux/page-flags.h>
1151 cancel_dirty_page(NULL, 0);
1154 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1155 [kernel has cancel_dirty_page instead of clear_page_dirty])
1164 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1165 # it support constant page, which means the page won't be modified during the
1168 AC_DEFUN([LC_PAGE_CONSTANT],
1169 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1170 LB_LINUX_TRY_COMPILE([
1171 #include <linux/mm.h>
1172 #include <linux/page-flags.h>
1175 #error "Have no raid5 zcopy patch"
1179 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1185 # RHEL5 in FS-cache patch rename PG_checked flag
1187 AC_DEFUN([LC_PG_FS_MISC],
1188 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1189 LB_LINUX_TRY_COMPILE([
1190 #include <linux/mm.h>
1191 #include <linux/page-flags.h>
1194 #error PG_fs_misc not defined in kernel
1198 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1199 [is kernel have PG_fs_misc])
1205 # RHEL5 PageChecked and SetPageChecked defined
1206 AC_DEFUN([LC_PAGE_CHECKED],
1207 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1208 LB_LINUX_TRY_COMPILE([
1209 #include <linux/mm.h>
1210 #include <linux/page-flags.h>
1213 #error PageChecked not defined in kernel
1215 #ifndef SetPageChecked
1216 #error SetPageChecked not defined in kernel
1220 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1221 [does kernel have PageChecked and SetPageChecked])
1227 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1228 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1230 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1231 [kernel export truncate_complete_page])
1236 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1237 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1239 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1240 [d_rehash_cond is exported by the kernel])
1245 AC_DEFUN([LC_EXPORT___D_REHASH],
1246 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1248 AC_DEFINE(HAVE___D_REHASH, 1,
1249 [__d_rehash is exported by the kernel])
1254 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1255 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1257 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1258 [d_move_locked is exported by the kernel])
1263 AC_DEFUN([LC_EXPORT___D_MOVE],
1264 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1266 AC_DEFINE(HAVE___D_MOVE, 1,
1267 [__d_move is exported by the kernel])
1273 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1275 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1276 # SLES10 2.6.16 does not, for some reason. For filter cache invalidation.
1278 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1279 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1280 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1281 [exported invalidate_mapping_pages])],
1282 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1283 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1284 [exported invalidate_inode_pages])], [
1285 AC_MSG_ERROR([no way to invalidate pages])
1291 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
1293 # No standard kernels export this
1295 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1296 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1298 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1299 [filemap_fdatawrite_range is exported by the kernel])
1304 # The actual symbol exported varies among architectures, so we need
1305 # to check many symbols (but only in the current architecture.) No
1306 # matter what symbol is exported, the kernel #defines node_to_cpumask
1307 # to the appropriate function and that's what we use.
1308 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1309 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1310 [arch/$LINUX_ARCH/mm/numa.c],
1311 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1312 [node_to_cpumask is exported by
1313 the kernel])]) # x86_64
1314 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1315 [arch/$LINUX_ARCH/kernel/smpboot.c],
1316 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1317 [node_to_cpumask is exported by
1318 the kernel])]) # ia64
1319 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1320 [arch/$LINUX_ARCH/kernel/smpboot.c],
1321 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1322 [node_to_cpumask is exported by
1323 the kernel])]) # i386
1326 # 2.6.22 lost second parameter for invalidate_bdev
1327 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1328 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1329 LB_LINUX_TRY_COMPILE([
1330 #include <linux/buffer_head.h>
1332 invalidate_bdev(NULL,0);
1334 AC_MSG_RESULT([yes])
1335 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1336 [invalidate_bdev has second argument])
1342 # 2.6.23 have return type 'void' for unregister_blkdev
1343 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1344 [AC_MSG_CHECKING([if unregister_blkdev return int])
1345 LB_LINUX_TRY_COMPILE([
1346 #include <linux/fs.h>
1348 int i = unregister_blkdev(0,NULL);
1350 AC_MSG_RESULT([yes])
1351 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1352 [unregister_blkdev return int])
1358 # 2.6.23 change .sendfile to .splice_read
1359 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1360 [AC_MSG_CHECKING([if kernel has .splice_read])
1361 LB_LINUX_TRY_COMPILE([
1362 #include <linux/fs.h>
1364 struct file_operations file;
1366 file.splice_read = NULL;
1368 AC_MSG_RESULT([yes])
1369 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1370 [kernel has .slice_read])
1376 # 2.6.23 extract nfs export related data into exportfs.h
1377 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1380 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1381 AC_CHECK_HEADERS([linux/exportfs.h])
1386 # LC_VFS_INTENT_PATCHES
1388 # check if the kernel has the VFS intent patches
1389 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1390 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1391 LB_LINUX_TRY_COMPILE([
1392 #include <linux/fs.h>
1393 #include <linux/namei.h>
1395 struct nameidata nd;
1396 struct lookup_intent *it;
1399 intent_init(it, IT_OPEN);
1400 it->d.lustre.it_disposition = 0;
1401 it->d.lustre.it_data = NULL;
1403 AC_MSG_RESULT([yes])
1404 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1410 AC_DEFUN([LC_S_TIME_GRAN],
1411 [AC_MSG_CHECKING([if super block has s_time_gran member])
1412 LB_LINUX_TRY_COMPILE([
1413 #include <linux/fs.h>
1415 struct super_block sb;
1417 return sb.s_time_gran;
1419 AC_MSG_RESULT([yes])
1420 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1426 AC_DEFUN([LC_SB_TIME_GRAN],
1427 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1428 LB_LINUX_TRY_COMPILE([
1429 #include <linux/fs.h>
1431 return get_sb_time_gran(NULL);
1433 AC_MSG_RESULT([yes])
1434 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1441 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1442 AC_DEFUN([LC_RW_TREE_LOCK],
1443 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1444 tmp_flags="$EXTRA_KCFLAGS"
1445 EXTRA_KCFLAGS="-Werror"
1446 LB_LINUX_TRY_COMPILE([
1447 #include <linux/fs.h>
1449 struct address_space a;
1451 write_lock(&a.tree_lock);
1453 AC_MSG_RESULT([yes])
1454 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1458 EXTRA_KCFLAGS="$tmp_flags"
1461 AC_DEFUN([LC_CONST_ACL_SIZE],
1462 [AC_MSG_CHECKING([calc acl size])
1464 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1467 #include <linux/autoconf.h>
1468 #include <linux/types.h>
1471 #define __LINUX_POSIX_ACL_H
1473 # ifdef CONFIG_FS_POSIX_ACL
1474 # ifdef HAVE_XATTR_ACL
1475 # include <linux/xattr_acl.h>
1477 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1478 # include <linux/posix_acl_xattr.h>
1482 #include <lustre_acl.h>
1488 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1489 FILE *f = fopen("acl.size","w+");
1490 fprintf(f,"%d", size);
1497 acl_size=`cat acl.size`
1498 AC_MSG_RESULT([ACL size $acl_size])
1499 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1501 AC_ERROR([ACL size can't computed])
1507 # check for crypto API
1509 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1510 [AC_MSG_CHECKING([if kernel has block cipher support])
1511 LB_LINUX_TRY_COMPILE([
1512 #include <linux/crypto.h>
1514 int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1516 AC_MSG_RESULT([yes])
1517 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1524 # check for FS_RENAME_DOES_D_MOVE flag
1526 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1527 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1528 LB_LINUX_TRY_COMPILE([
1529 #include <linux/fs.h>
1531 int v = FS_RENAME_DOES_D_MOVE;
1533 AC_MSG_RESULT([yes])
1534 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1543 # Lustre linux kernel checks
1545 AC_DEFUN([LC_PROG_LINUX],
1546 [LC_LUSTRE_VERSION_H
1547 if test x$enable_server = xyes ; then
1548 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1553 LC_CONFIG_LIBLUSTRE_RECOVERY
1555 LC_CONFIG_HEALTH_CHECK_WRITE
1556 LC_CONFIG_LRU_RESIZE
1560 LC_EXPORT_TRUNCATE_COMPLETE
1561 LC_EXPORT_D_REHASH_COND
1562 LC_EXPORT___D_REHASH
1563 LC_EXPORT_D_MOVE_LOCKED
1565 LC_EXPORT_NODE_TO_CPUMASK
1568 LC_FUNC_COND_RESCHED
1569 LC_FUNC_RELEASEPAGE_WITH_INT
1570 LC_FUNC_ZAP_PAGE_RANGE
1575 LC_FUNC_REGISTER_CACHE
1576 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1577 LC_FUNC_DEV_SET_RDONLY
1578 LC_FUNC_FILEMAP_FDATAWRITE
1581 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1587 LC_POSIX_ACL_XATTR_H
1590 LC_STRUCT_INTENT_FILE
1595 LC_FUNC_MS_FLOCK_LOCK
1596 LC_FUNC_HAVE_CAN_SLEEP_ARG
1599 LC_COOKIE_FOLLOW_LINK
1603 # does the kernel have VFS intent patches?
1604 LC_VFS_INTENT_PATCHES
1617 LC_SECURITY_PLUG # for SLES10 SP2
1624 LC_STATFS_DENTRY_PARAM
1626 LC_INVALIDATEPAGE_RETURN_INT
1627 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1628 if test x$enable_server = xyes ; then
1629 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1630 LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1633 #2.6.18 + RHEL5 (fc6)
1639 LC_VFS_READDIR_U64_INO
1644 LC_CANCEL_DIRTY_PAGE
1646 # raid5-zerocopy patch
1650 LC_INVALIDATE_BDEV_2ARG
1651 LC_ASYNC_BLOCK_CIPHER
1652 LC_FS_RENAME_DOES_D_MOVE
1654 LC_UNREGISTER_BLKDEV_RETURN_INT
1655 LC_KERNEL_SPLICE_READ
1660 # LC_CONFIG_CLIENT_SERVER
1662 # Build client/server sides of Lustre
1664 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1665 [AC_MSG_CHECKING([whether to build Lustre server support])
1666 AC_ARG_ENABLE([server],
1667 AC_HELP_STRING([--disable-server],
1668 [disable Lustre server support]),
1669 [],[enable_server='yes'])
1670 AC_MSG_RESULT([$enable_server])
1672 AC_MSG_CHECKING([whether to build Lustre client support])
1673 AC_ARG_ENABLE([client],
1674 AC_HELP_STRING([--disable-client],
1675 [disable Lustre client support]),
1676 [],[enable_client='yes'])
1677 AC_MSG_RESULT([$enable_client])])
1680 # LC_CONFIG_LIBLUSTRE
1682 # whether to build liblustre
1684 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1685 [AC_MSG_CHECKING([whether to build Lustre library])
1686 AC_ARG_ENABLE([liblustre],
1687 AC_HELP_STRING([--disable-liblustre],
1688 [disable building of Lustre library]),
1689 [],[enable_liblustre=$with_sysio])
1690 AC_MSG_RESULT([$enable_liblustre])
1691 # only build sysio if liblustre is built
1692 with_sysio="$enable_liblustre"
1694 AC_MSG_CHECKING([whether to build liblustre tests])
1695 AC_ARG_ENABLE([liblustre-tests],
1696 AC_HELP_STRING([--enable-liblustre-tests],
1697 [enable liblustre tests, if --disable-tests is used]),
1698 [],[enable_liblustre_tests=$enable_tests])
1699 if test x$enable_liblustre != xyes ; then
1700 enable_liblustre_tests='no'
1702 AC_MSG_RESULT([$enable_liblustre_tests])
1704 AC_MSG_CHECKING([whether to enable liblustre acl])
1705 AC_ARG_ENABLE([liblustre-acl],
1706 AC_HELP_STRING([--disable-liblustre-acl],
1707 [disable ACL support for liblustre]),
1708 [],[enable_liblustre_acl=yes])
1709 AC_MSG_RESULT([$enable_liblustre_acl])
1710 if test x$enable_liblustre_acl = xyes ; then
1711 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1717 AC_ARG_ENABLE(mpitests,
1718 AC_HELP_STRING([--enable-mpitest=yes|no|mpich directory],
1719 [include mpi tests]),
1725 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1726 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1731 [[\\/$]]* | ?:[[\\/]]* )
1733 LDFLAGS="$LDFLAGS -L$with_mpi/lib"
1734 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1737 AC_MSG_ERROR([expected absolute directory name for --enable-mpitests or yes or no])
1743 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1744 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1750 if test x$enable_mpitests != xno; then
1751 AC_MSG_CHECKING([whether to mpitests can be built])
1752 AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
1753 [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
1754 [enable_mpitests=no])
1756 AC_MSG_RESULT([$enable_mpitests])
1759 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1760 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1763 LC_CONFIG_LIBLUSTRE_RECOVERY
1766 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1767 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1768 AC_ARG_ENABLE([lru_resize],
1769 AC_HELP_STRING([--enable-lru-resize],
1770 [enable lru resize support]),
1771 [],[enable_lru_resize='yes'])
1772 AC_MSG_RESULT([$enable_lru_resize])
1773 if test x$enable_lru_resize != xno; then
1774 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1781 # whether to enable quota support
1783 AC_DEFUN([LC_CONFIG_QUOTA],
1784 [AC_ARG_ENABLE([quota],
1785 AC_HELP_STRING([--enable-quota],
1786 [enable quota support]),
1787 [],[enable_quota='default'])
1788 if test x$linux25 != xyes; then
1791 LB_LINUX_CONFIG([QUOTA],[
1792 if test x$enable_quota = xdefault; then
1796 if test x$enable_quota = xdefault; then
1798 AC_MSG_WARN([quota is not enabled because the kernel lacks quota support])
1800 if test x$enable_quota = xyes; then
1801 AC_MSG_ERROR([cannot enable quota because the kernel lacks quota support])
1805 if test x$enable_quota != xno; then
1806 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1813 # whether to enable split support
1815 AC_DEFUN([LC_CONFIG_SPLIT],
1816 [AC_MSG_CHECKING([whether to enable split support])
1817 AC_ARG_ENABLE([split],
1818 AC_HELP_STRING([--enable-split],
1819 [enable split support]),
1820 [],[enable_split='no'])
1821 AC_MSG_RESULT([$enable_split])
1822 if test x$enable_split != xno; then
1823 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1827 AC_DEFUN([LC_QUOTA_READ],
1828 [AC_MSG_CHECKING([if kernel supports quota_read])
1829 LB_LINUX_TRY_COMPILE([
1830 #include <linux/fs.h>
1832 struct super_operations sp;
1833 void *i = (void *)sp.quota_read;
1835 AC_MSG_RESULT([yes])
1836 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1843 # LC_COOKIE_FOLLOW_LINK
1845 # kernel 2.6.13+ ->follow_link returns a cookie
1848 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1849 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1850 LB_LINUX_TRY_COMPILE([
1851 #include <linux/fs.h>
1852 #include <linux/namei.h>
1854 struct dentry dentry;
1855 struct nameidata nd;
1857 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1859 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1860 AC_MSG_RESULT([yes])
1869 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1870 # call_rcu takes three parameters.
1872 AC_DEFUN([LC_FUNC_RCU],
1873 [AC_MSG_CHECKING([if kernel have RCU supported])
1874 LB_LINUX_TRY_COMPILE([
1875 #include <linux/rcupdate.h>
1877 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1878 AC_MSG_RESULT([yes])
1880 AC_MSG_CHECKING([if call_rcu takes three parameters])
1881 LB_LINUX_TRY_COMPILE([
1882 #include <linux/rcupdate.h>
1885 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1887 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1888 AC_MSG_RESULT([yes])
1897 # LC_SECURITY_PLUG # for SLES10 SP2
1898 # check security plug in sles10 sp2 kernel
1899 AC_DEFUN([LC_SECURITY_PLUG],
1900 [AC_MSG_CHECKING([If kernel has security plug support])
1901 LB_LINUX_TRY_COMPILE([
1902 #include <linux/fs.h>
1904 struct dentry *dentry;
1905 struct vfsmount *mnt;
1906 struct iattr *iattr;
1908 notify_change(dentry, mnt, iattr);
1911 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
1912 [SLES10 SP2 use extra parameter in vfs])
1918 AC_DEFUN([LC_PERCPU_COUNTER],
1919 [AC_MSG_CHECKING([if have struct percpu_counter defined])
1920 LB_LINUX_TRY_COMPILE([
1921 #include <linux/percpu_counter.h>
1923 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
1924 AC_MSG_RESULT([yes])
1926 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
1927 LB_LINUX_TRY_COMPILE([
1928 #include <linux/percpu_counter.h>
1930 struct percpu_counter c;
1931 percpu_counter_init(&c, 0);
1933 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
1935 AC_MSG_RESULT([yes])
1947 # other configure checks
1949 AC_DEFUN([LC_CONFIGURE],
1950 [LC_CONFIG_OBD_BUFFER_SIZE
1952 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1953 CFLAGS="$CFLAGS -Werror"
1956 # include/liblustre.h
1957 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1959 # liblustre/llite_lib.h
1960 AC_CHECK_HEADERS([xtio.h file.h])
1963 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1966 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1967 AC_CHECK_FUNCS([inet_ntoa])
1969 # libsysio/src/readlink.c
1972 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1973 AC_CHECK_HEADERS([linux/random.h], [], [],
1974 [#ifdef HAVE_LINUX_TYPES_H
1975 # include <linux/types.h>
1980 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1982 # check for -lz support
1986 [AC_CHECK_HEADERS([zlib.h],
1988 AC_DEFINE([HAVE_ADLER], 1,
1989 [support alder32 checksum type])],
1990 [AC_MSG_WARN([No zlib-devel package found,
1991 unable to use adler32 checksum])])],
1992 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1997 AC_ARG_ENABLE([mindf],
1998 AC_HELP_STRING([--enable-mindf],
1999 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2001 if test "$enable_mindf" = "yes" ; then
2002 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2005 AC_ARG_ENABLE([fail_alloc],
2006 AC_HELP_STRING([--disable-fail-alloc],
2007 [disable randomly alloc failure]),
2008 [],[enable_fail_alloc=yes])
2009 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2010 AC_MSG_RESULT([$enable_fail_alloc])
2011 if test x$enable_fail_alloc != xno ; then
2012 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2015 AC_ARG_ENABLE([invariants],
2016 AC_HELP_STRING([--enable-invariants],
2017 [enable invariant checking (cpu intensive)]),
2019 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2020 AC_MSG_RESULT([$enable_invariants])
2021 if test x$enable_invariants = xyes ; then
2022 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2025 AC_ARG_ENABLE([lu_ref],
2026 AC_HELP_STRING([--enable-lu_ref],
2027 [enable lu_ref reference tracking code]),
2029 AC_MSG_CHECKING([whether to track references with lu_ref])
2030 AC_MSG_RESULT([$enable_lu_ref])
2031 if test x$enable_lu_ref = xyes ; then
2032 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2040 # AM_CONDITIONALS for lustre
2042 AC_DEFUN([LC_CONDITIONALS],
2043 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2044 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2045 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2046 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2047 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2048 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2049 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
2050 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2051 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2052 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2053 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2054 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2055 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2056 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2062 # files that should be generated with AC_OUTPUT
2064 AC_DEFUN([LC_CONFIG_FILES],
2068 lustre/autoconf/Makefile
2069 lustre/contrib/Makefile
2071 lustre/include/Makefile
2072 lustre/include/lustre_ver.h
2073 lustre/include/linux/Makefile
2074 lustre/include/lustre/Makefile
2075 lustre/kernel_patches/targets/2.6-vanilla.target
2076 lustre/kernel_patches/targets/2.6-rhel4.target
2077 lustre/kernel_patches/targets/2.6-rhel5.target
2078 lustre/kernel_patches/targets/2.6-fc5.target
2079 lustre/kernel_patches/targets/2.6-patchless.target
2080 lustre/kernel_patches/targets/2.6-sles10.target
2081 lustre/ldlm/Makefile
2083 lustre/fid/autoMakefile
2084 lustre/liblustre/Makefile
2085 lustre/liblustre/tests/Makefile
2086 lustre/llite/Makefile
2087 lustre/llite/autoMakefile
2088 lustre/lclient/Makefile
2090 lustre/lov/autoMakefile
2091 lustre/lvfs/Makefile
2092 lustre/lvfs/autoMakefile
2094 lustre/mdc/autoMakefile
2096 lustre/lmv/autoMakefile
2098 lustre/mds/autoMakefile
2100 lustre/mdt/autoMakefile
2102 lustre/cmm/autoMakefile
2104 lustre/mdd/autoMakefile
2106 lustre/fld/autoMakefile
2107 lustre/obdclass/Makefile
2108 lustre/obdclass/autoMakefile
2109 lustre/obdclass/linux/Makefile
2110 lustre/obdecho/Makefile
2111 lustre/obdecho/autoMakefile
2112 lustre/obdfilter/Makefile
2113 lustre/obdfilter/autoMakefile
2115 lustre/osc/autoMakefile
2117 lustre/ost/autoMakefile
2119 lustre/osd/autoMakefile
2121 lustre/mgc/autoMakefile
2123 lustre/mgs/autoMakefile
2124 lustre/ptlrpc/Makefile
2125 lustre/ptlrpc/autoMakefile
2126 lustre/ptlrpc/gss/Makefile
2127 lustre/ptlrpc/gss/autoMakefile
2128 lustre/quota/Makefile
2129 lustre/quota/autoMakefile
2130 lustre/scripts/Makefile
2131 lustre/scripts/version_tag.pl
2132 lustre/tests/Makefile
2133 lustre/utils/Makefile
2134 lustre/utils/gss/Makefile
2136 case $lb_target_os in
2138 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])