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_GFP
128 # if ->releasepage() takes a gfp_t 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_GFP],
133 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
134 RELEASEPAGE_WITH_GFP="`grep -c 'releasepage.*gfp_t'
135 $LINUX/include/linux/fs.h`"
136 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
137 AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
138 [releasepage with gfp_t parameter])
147 # LC_FUNC_ZAP_PAGE_RANGE
149 # if zap_page_range() takes a vma arg
151 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
152 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
153 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
154 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
155 AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
165 # if proc_fs.h defines PDE()
167 AC_DEFUN([LC_FUNC_PDE],
168 [AC_MSG_CHECKING([if kernel defines PDE])
169 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
170 if test "$HAVE_PDE" != 0 ; then
171 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
179 # LC_FUNC_FILEMAP_FDATASYNC
181 # if filemap_fdatasync() exists
183 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
184 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
185 LB_LINUX_TRY_COMPILE([
186 #include <linux/fs.h>
188 int (*foo)(struct address_space *)= filemap_fdatawrite;
191 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
200 # if direct_IO takes a struct file argument
202 AC_DEFUN([LC_FUNC_DIRECT_IO],
203 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
204 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
205 if test "$HAVE_DIO_FILE" != 0 ; then
206 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
214 # LC_HEADER_MM_INLINE
216 # RHEL kernels define page_count in mm_inline.h
218 AC_DEFUN([LC_HEADER_MM_INLINE],
219 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
220 LB_LINUX_TRY_COMPILE([
221 #include <linux/mm_inline.h>
224 #error mm_inline.h does not define page_count
228 AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
237 # if inode->i_alloc_sem exists
239 AC_DEFUN([LC_STRUCT_INODE],
240 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
241 LB_LINUX_TRY_COMPILE([
242 #include <linux/fs.h>
243 #include <linux/version.h>
245 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
246 #error "down_read_trylock broken before 2.4.24"
249 return (char *)&i.i_alloc_sem - (char *)&i;
252 AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
259 # LC_FUNC_REGISTER_CACHE
261 # if register_cache() is defined by kernel
263 # There are two ways to shrink one customized cache in linux kernels. For the
264 # kernels are prior than 2.6.5(?), register_cache() is used, and for latest
265 # kernels, set_shrinker() is used instead.
267 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
268 [AC_MSG_CHECKING([if kernel defines cache pressure hook])
269 LB_LINUX_TRY_COMPILE([
270 #include <linux/mm.h>
274 set_shrinker(1, shrinker);
276 AC_MSG_RESULT([set_shrinker])
277 AC_DEFINE(HAVE_SHRINKER_CACHE, 1, [shrinker_cache found])
278 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [shrinkers should return int])
280 LB_LINUX_TRY_COMPILE([
281 #include <linux/list.h>
282 #include <linux/cache_def.h>
284 struct cache_definition cache;
286 AC_MSG_RESULT([register_cache])
287 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
288 AC_MSG_CHECKING([if kernel expects return from cache shrink ])
289 tmp_flags="$EXTRA_KCFLAGS"
290 EXTRA_KCFLAGS="-Werror"
291 LB_LINUX_TRY_COMPILE([
292 #include <linux/list.h>
293 #include <linux/cache_def.h>
295 struct cache_definition c;
296 c.shrinker = (int (*)(int, unsigned int))1;
298 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1,
299 [kernel expects return from shrink_cache])
304 EXTRA_KCFLAGS="$tmp_flags"
312 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
314 # check for our patched grab_cache_page_nowait_gfp() function
316 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
317 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
318 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
319 if test "$HAVE_GCPN_GFP" != 0 ; then
320 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
321 [kernel has grab_cache_page_nowait_gfp()])
329 # LC_FUNC_DEV_SET_RDONLY
331 # check for the old-style dev_set_rdonly which took an extra "devno" param
332 # and can only set a single device to discard writes at one time
334 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
335 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
336 LB_LINUX_TRY_COMPILE([
337 #include <linux/fs.h>
339 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
340 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
344 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
346 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
347 kernel patches from Lustre version 1.4.3 or above.])
352 # LC_CONFIG_BACKINGFS
354 # setup, check the backing filesystem
356 AC_DEFUN([LC_CONFIG_BACKINGFS],
360 if test x$with_ldiskfs = xno ; then
363 if test x$linux25$enable_server = xyesyes ; then
364 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
367 # --- Check that ext3 and ext3 xattr are enabled in the kernel
369 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
371 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
372 AC_MSG_WARN([This build may fail.])
376 LB_DEFINE_LDISKFS_OPTIONS
379 AC_MSG_CHECKING([which backing filesystem to use])
380 AC_MSG_RESULT([$BACKINGFS])
387 # the pinger is temporary, until we have the recovery node in place
389 AC_DEFUN([LC_CONFIG_PINGER],
390 [AC_MSG_CHECKING([whether to enable pinger support])
391 AC_ARG_ENABLE([pinger],
392 AC_HELP_STRING([--disable-pinger],
393 [disable recovery pinger support]),
394 [],[enable_pinger='yes'])
395 AC_MSG_RESULT([$enable_pinger])
396 if test x$enable_pinger != xno ; then
397 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
404 # do checksum of bulk data between client and OST
406 AC_DEFUN([LC_CONFIG_CHECKSUM],
407 [AC_MSG_CHECKING([whether to enable data checksum support])
408 AC_ARG_ENABLE([checksum],
409 AC_HELP_STRING([--disable-checksum],
410 [disable data checksum support]),
411 [],[enable_checksum='yes'])
412 AC_MSG_RESULT([$enable_checksum])
413 if test x$enable_checksum != xno ; then
414 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
419 # LC_CONFIG_HEALTH_CHECK_WRITE
421 # Turn off the actual write to the disk
423 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
424 [AC_MSG_CHECKING([whether to enable a write with the health check])
425 AC_ARG_ENABLE([health_write],
426 AC_HELP_STRING([--enable-health_write],
427 [enable disk writes when doing health check]),
428 [],[enable_health_write='no'])
429 AC_MSG_RESULT([$enable_health_write])
430 if test x$enable_health_write != xno ; then
431 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
436 # LC_CONFIG_LIBLUSTRE_RECOVERY
438 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
439 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
440 AC_ARG_ENABLE([liblustre-recovery],
441 AC_HELP_STRING([--disable-liblustre-recovery],
442 [disable liblustre recovery support]),
443 [],[enable_liblustre_recovery='yes'])
444 AC_MSG_RESULT([$enable_liblustre_recovery])
445 if test x$enable_liblustre_recovery != xno ; then
446 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
451 # LC_CONFIG_OBD_BUFFER_SIZE
453 # the maximum buffer size of lctl ioctls
455 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
456 [AC_MSG_CHECKING([maximum OBD ioctl size])
457 AC_ARG_WITH([obd-buffer-size],
458 AC_HELP_STRING([--with-obd-buffer-size=[size]],
459 [set lctl ioctl maximum bytes (default=8192)]),
461 OBD_BUFFER_SIZE=$with_obd_buffer_size
465 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
466 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
472 # AIX does not have statfs.f_namelen
474 AC_DEFUN([LC_STRUCT_STATFS],
475 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
476 LB_LINUX_TRY_COMPILE([
477 #include <linux/vfs.h>
483 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
490 # LC_READLINK_SSIZE_T
492 AC_DEFUN([LC_READLINK_SSIZE_T],
493 [AC_MSG_CHECKING([if readlink returns ssize_t])
497 ssize_t readlink(const char *, char *, size_t);
500 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
506 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
507 [AC_MSG_CHECKING([if kernel offers page_mapped])
508 LB_LINUX_TRY_COMPILE([
509 #include <linux/mm.h>
514 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
520 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
521 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
522 LB_LINUX_TRY_COMPILE([
523 #include <linux/fs.h>
525 struct file_operations fops;
526 &fops.unlocked_ioctl;
529 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
535 AC_DEFUN([LC_FILEMAP_POPULATE],
536 [AC_MSG_CHECKING([for exported filemap_populate])
537 LB_LINUX_TRY_COMPILE([
538 #include <asm/page.h>
539 #include <linux/mm.h>
541 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
544 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
550 AC_DEFUN([LC_D_ADD_UNIQUE],
551 [AC_MSG_CHECKING([for d_add_unique])
552 LB_LINUX_TRY_COMPILE([
553 #include <linux/dcache.h>
555 d_add_unique(NULL, NULL);
558 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
564 AC_DEFUN([LC_BIT_SPINLOCK_H],
565 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
566 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
567 LB_LINUX_TRY_COMPILE([
568 #include <asm/processor.h>
569 #include <linux/spinlock.h>
570 #include <linux/bit_spinlock.h>
573 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
584 # If we have xattr_acl.h
586 AC_DEFUN([LC_XATTR_ACL],
587 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
588 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
589 LB_LINUX_TRY_COMPILE([
590 #include <linux/xattr_acl.h>
593 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
604 # If we have fiemap.h
605 # after 2.6.27 use fiemap.h in include/linux
607 AC_DEFUN([LC_LINUX_FIEMAP_H],
608 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
609 AC_MSG_CHECKING([if fiemap.h can be compiled])
610 LB_LINUX_TRY_COMPILE([
611 #include <linux/fiemap.h>
614 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
623 AC_DEFUN([LC_STRUCT_INTENT_FILE],
624 [AC_MSG_CHECKING([if struct open_intent has a file field])
625 LB_LINUX_TRY_COMPILE([
626 #include <linux/fs.h>
627 #include <linux/namei.h>
629 struct open_intent intent;
633 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
640 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
641 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
642 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
643 LB_LINUX_TRY_COMPILE([
644 #include <linux/posix_acl_xattr.h>
647 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
660 # starting from 2.6.19 linux kernel exports __iget()
662 AC_DEFUN([LC_EXPORT___IGET],
663 [LB_CHECK_SYMBOL_EXPORT([__iget],
665 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
670 AC_DEFUN([LC_LUSTRE_VERSION_H],
671 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
672 rm -f "$LUSTRE/include/linux/lustre_version.h"
674 touch "$LUSTRE/include/linux/lustre_version.h"
675 if test x$enable_server = xyes ; then
676 AC_MSG_WARN([Unpatched kernel detected.])
677 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
678 AC_MSG_WARN([disabling server build])
684 AC_DEFUN([LC_FUNC_SET_FS_PWD],
685 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
687 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
695 AC_DEFUN([LC_CAPA_CRYPTO],
696 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
697 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
699 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
700 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
702 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
703 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
707 AC_DEFUN([LC_SUNRPC_CACHE],
708 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
709 LB_LINUX_TRY_COMPILE([
710 #include <linux/sunrpc/cache.h>
712 struct cache_head ch;
716 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
722 AC_DEFUN([LC_CONFIG_SUNRPC],
723 [LB_LINUX_CONFIG_IM([SUNRPC],[],
724 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
729 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
731 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
732 [AC_MSG_CHECKING([whether to enable gss keyring backend])
733 AC_ARG_ENABLE([gss_keyring],
734 [AC_HELP_STRING([--disable-gss-keyring],
735 [disable gss keyring backend])],
736 [],[enable_gss_keyring='yes'])
737 AC_MSG_RESULT([$enable_gss_keyring])
739 if test x$enable_gss_keyring != xno; then
740 LB_LINUX_CONFIG_IM([KEYS],[],
741 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
743 AC_CHECK_LIB([keyutils], [keyctl_search], [],
744 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
746 AC_DEFINE([HAVE_GSS_KEYRING], [1],
747 [Define this if you enable gss keyring backend])
751 m4_pattern_allow(AC_KERBEROS_V5)
754 # LC_CONFIG_GSS (default disabled)
756 # Build gss and related tools of Lustre. Currently both kernel and user space
757 # parts are depend on linux platform.
759 AC_DEFUN([LC_CONFIG_GSS],
760 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
762 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
763 [],[enable_gss='no'])
764 AC_MSG_RESULT([$enable_gss])
766 if test x$enable_gss == xyes; then
767 LC_CONFIG_GSS_KEYRING
770 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
771 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
772 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
773 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
774 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
775 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
776 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
777 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
778 LB_LINUX_CONFIG_IM([CRYPTO_WP512],[],
779 [AC_MSG_WARN([kernel WP512 support is recommended by using GSS.])])
780 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],
781 [AC_MSG_WARN([kernel ARC4 support is recommended by using GSS.])])
782 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],
783 [AC_MSG_WARN([kernel DES support is recommended by using GSS.])])
784 LB_LINUX_CONFIG_IM([CRYPTO_TWOFISH],[],
785 [AC_MSG_WARN([kernel TWOFISH support is recommended by using GSS.])])
786 LB_LINUX_CONFIG_IM([CRYPTO_CAST6],[],
787 [AC_MSG_WARN([kernel CAST6 support is recommended by using GSS.])])
789 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
791 LB_LINUX_CONFIG_IM([CRYPTO_AES],[],
792 [AC_MSG_WARN([kernel AES support is recommended by using GSS.])])
794 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
795 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
796 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
797 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
798 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
800 AC_SUBST(GSSAPI_LIBS)
806 # LC_FUNC_MS_FLOCK_LOCK
808 # SLES9 kernel has MS_FLOCK_LOCK sb flag
810 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
811 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
812 LB_LINUX_TRY_COMPILE([
813 #include <linux/fs.h>
815 int flags = MS_FLOCK_LOCK;
817 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
818 [kernel has MS_FLOCK_LOCK flag])
826 # LC_FUNC_HAVE_CAN_SLEEP_ARG
828 # SLES9 kernel has third arg can_sleep
829 # in fs/locks.c: flock_lock_file_wait()
831 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
832 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
833 LB_LINUX_TRY_COMPILE([
834 #include <linux/fs.h>
838 struct file_lock *file_lock;
839 flock_lock_file_wait(file, file_lock, cansleep);
841 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
842 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
852 # rhel4.2 kernel has f_op->flock field
854 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
855 [AC_MSG_CHECKING([if struct file_operations has flock field])
856 LB_LINUX_TRY_COMPILE([
857 #include <linux/fs.h>
859 struct file_operations ll_file_operations_flock;
860 ll_file_operations_flock.flock = NULL;
862 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
863 [struct file_operations has flock field])
873 # task struct has p_pptr instead of parent
875 AC_DEFUN([LC_TASK_PPTR],
876 [AC_MSG_CHECKING([task p_pptr found])
877 LB_LINUX_TRY_COMPILE([
878 #include <linux/sched.h>
880 struct task_struct *p;
885 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
894 # rhel4.2 kernel has f_op->flock field
896 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
897 [AC_MSG_CHECKING([if struct file_operations has flock field])
898 LB_LINUX_TRY_COMPILE([
899 #include <linux/fs.h>
901 struct file_operations ll_file_operations_flock;
902 ll_file_operations_flock.flock = NULL;
904 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
905 [struct file_operations has flock field])
913 # after 2.6.15 inode have i_mutex intead of i_sem
914 AC_DEFUN([LC_INODE_I_MUTEX],
915 [AC_MSG_CHECKING([if inode has i_mutex ])
916 LB_LINUX_TRY_COMPILE([
917 #include <linux/mutex.h>
918 #include <linux/fs.h>
923 mutex_unlock(&i.i_mutex);
926 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
927 [after 2.6.15 inode have i_mutex intead of i_sem])
934 # after 2.6.17 dquote use mutex instead if semaphore
935 AC_DEFUN([LC_DQUOTOFF_MUTEX],
936 [AC_MSG_CHECKING([use dqonoff_mutex])
937 LB_LINUX_TRY_COMPILE([
938 #include <linux/mutex.h>
939 #include <linux/fs.h>
940 #include <linux/quota.h>
942 struct quota_info dq;
944 mutex_unlock(&dq.dqonoff_mutex);
947 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
948 [after 2.6.17 dquote use mutex instead if semaphore])
955 # LC_STATFS_DENTRY_PARAM
956 # starting from 2.6.18 linux kernel uses dentry instead of
957 # super_block for first vfs_statfs argument
959 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
960 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
961 LB_LINUX_TRY_COMPILE([
962 #include <linux/fs.h>
964 int vfs_statfs(struct dentry *, struct kstatfs *);
966 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
967 [first parameter of vfs_statfs is dentry])
976 # starting from 2.6.18 kernel don't export do_kern_mount
977 # and want to use vfs_kern_mount instead.
979 AC_DEFUN([LC_VFS_KERN_MOUNT],
980 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
981 LB_LINUX_TRY_COMPILE([
982 #include <linux/mount.h>
984 vfs_kern_mount(NULL, 0, NULL, NULL);
986 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
987 [vfs_kern_mount exist in kernel])
995 # LC_INVALIDATEPAGE_RETURN_INT
996 # more 2.6 api changes. return type for the invalidatepage
997 # address_space_operation is 'void' in new kernels but 'int' in old
999 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
1000 [AC_MSG_CHECKING([invalidatepage has return int])
1001 LB_LINUX_TRY_COMPILE([
1002 #include <linux/buffer_head.h>
1004 int rc = block_invalidatepage(NULL, 0);
1007 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
1008 [Define if return type of invalidatepage should be int])
1014 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
1015 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
1016 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
1017 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
1018 tmp_flags="$EXTRA_KCFLAGS"
1019 EXTRA_KCFLAGS="-Werror"
1020 LB_LINUX_TRY_COMPILE([
1021 #include <linux/fs.h>
1024 static void cfg_umount_begin (struct vfsmount *v, int flags)
1029 static struct super_operations cfg_super_operations = {
1030 .umount_begin = cfg_umount_begin,
1033 cfg_super_operations.umount_begin(NULL,0);
1036 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
1037 [Define umount_begin need second argument])
1041 EXTRA_KCFLAGS="$tmp_flags"
1044 # 2.6.19 API changes
1045 # inode don't have i_blksize field
1046 AC_DEFUN([LC_INODE_BLKSIZE],
1047 [AC_MSG_CHECKING([inode has i_blksize field])
1048 LB_LINUX_TRY_COMPILE([
1049 #include <linux/fs.h>
1055 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1056 [struct inode has i_blksize field])
1062 # LC_VFS_READDIR_U64_INO
1063 # 2.6.19 use u64 for inode number instead of inode_t
1064 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1065 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1066 tmp_flags="$EXTRA_KCFLAGS"
1067 EXTRA_KCFLAGS="-Werror"
1068 LB_LINUX_TRY_COMPILE([
1069 #include <linux/fs.h>
1070 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1071 u64 ino, unsigned int d_type)
1078 filter = fillonedir;
1082 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1083 [if vfs_readdir need 64bit inode number])
1087 EXTRA_KCFLAGS="$tmp_flags"
1090 # LC_GENERIC_FILE_WRITE
1091 # 2.6.19 introduce do_sync_write instead of
1092 # generic_file_write
1093 AC_DEFUN([LC_GENERIC_FILE_WRITE],
1094 [AC_MSG_CHECKING([use generic_file_write])
1095 LB_LINUX_TRY_COMPILE([
1096 #include <linux/fs.h>
1098 int result = generic_file_read(NULL, NULL, 0, 0);
1101 AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1102 [use generic_file_write])
1108 # LC_GENERIC_FILE_READ
1109 # 2.6.19 need to use do_sync_read instead of
1111 AC_DEFUN([LC_GENERIC_FILE_READ],
1112 [AC_MSG_CHECKING([use generic_file_read])
1113 LB_LINUX_TRY_COMPILE([
1114 #include <linux/fs.h>
1116 int result = generic_file_read(NULL, NULL, 0, 0);
1119 AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
1120 [use generic_file_read])
1127 # 2.6.18 don't export nr_pagecahe
1128 AC_DEFUN([LC_NR_PAGECACHE],
1129 [AC_MSG_CHECKING([kernel export nr_pagecache])
1130 LB_LINUX_TRY_COMPILE([
1131 #include <linux/pagemap.h>
1133 return atomic_read(&nr_pagecache);
1136 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1137 [is kernel export nr_pagecache])
1143 # LC_CANCEL_DIRTY_PAGE
1144 # 2.6.20 introduse cancel_dirty_page instead of
1146 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1147 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1148 LB_LINUX_TRY_COMPILE([
1149 #include <linux/mm.h>
1150 #include <linux/page-flags.h>
1152 cancel_dirty_page(NULL, 0);
1155 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1156 [kernel has cancel_dirty_page instead of clear_page_dirty])
1165 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1166 # it support constant page, which means the page won't be modified during the
1169 AC_DEFUN([LC_PAGE_CONSTANT],
1170 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1171 LB_LINUX_TRY_COMPILE([
1172 #include <linux/mm.h>
1173 #include <linux/page-flags.h>
1176 #error "Have no raid5 zcopy patch"
1180 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1186 # RHEL5 in FS-cache patch rename PG_checked flag
1188 AC_DEFUN([LC_PG_FS_MISC],
1189 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1190 LB_LINUX_TRY_COMPILE([
1191 #include <linux/mm.h>
1192 #include <linux/page-flags.h>
1195 #error PG_fs_misc not defined in kernel
1199 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1200 [is kernel have PG_fs_misc])
1206 # RHEL5 PageChecked and SetPageChecked defined
1207 AC_DEFUN([LC_PAGE_CHECKED],
1208 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1209 LB_LINUX_TRY_COMPILE([
1210 #include <linux/mm.h>
1211 #include <linux/page-flags.h>
1214 #error PageChecked not defined in kernel
1216 #ifndef SetPageChecked
1217 #error SetPageChecked not defined in kernel
1221 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1222 [does kernel have PageChecked and SetPageChecked])
1228 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1229 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1231 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1232 [kernel export truncate_complete_page])
1237 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1238 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1240 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1241 [d_rehash_cond is exported by the kernel])
1246 AC_DEFUN([LC_EXPORT___D_REHASH],
1247 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1249 AC_DEFINE(HAVE___D_REHASH, 1,
1250 [__d_rehash is exported by the kernel])
1255 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1256 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1258 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1259 [d_move_locked is exported by the kernel])
1264 AC_DEFUN([LC_EXPORT___D_MOVE],
1265 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1267 AC_DEFINE(HAVE___D_MOVE, 1,
1268 [__d_move is exported by the kernel])
1274 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1275 [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1276 AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1277 [exported invalidate_mapping_pages])],
1278 [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1279 AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1280 [exported invalidate_inode_pages])], [
1281 AC_MSG_ERROR([no way to invalidate pages])
1286 # The actual symbol exported varies among architectures, so we need
1287 # to check many symbols (but only in the current architecture.) No
1288 # matter what symbol is exported, the kernel #defines node_to_cpumask
1289 # to the appropriate function and that's what we use.
1290 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1291 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1292 [arch/$LINUX_ARCH/mm/numa.c],
1293 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1294 [node_to_cpumask is exported by
1295 the kernel])]) # x86_64
1296 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1297 [arch/$LINUX_ARCH/kernel/smpboot.c],
1298 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1299 [node_to_cpumask is exported by
1300 the kernel])]) # ia64
1301 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1302 [arch/$LINUX_ARCH/kernel/smpboot.c],
1303 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1304 [node_to_cpumask is exported by
1305 the kernel])]) # i386
1308 # 2.6.22 lost second parameter for invalidate_bdev
1309 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1310 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1311 LB_LINUX_TRY_COMPILE([
1312 #include <linux/buffer_head.h>
1314 invalidate_bdev(NULL,0);
1316 AC_MSG_RESULT([yes])
1317 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1318 [invalidate_bdev has second argument])
1324 # 2.6.23 have return type 'void' for unregister_blkdev
1325 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1326 [AC_MSG_CHECKING([if unregister_blkdev return int])
1327 LB_LINUX_TRY_COMPILE([
1328 #include <linux/fs.h>
1330 int i = unregister_blkdev(0,NULL);
1332 AC_MSG_RESULT([yes])
1333 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1334 [unregister_blkdev return int])
1340 # 2.6.23 change .sendfile to .splice_read
1341 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1342 [AC_MSG_CHECKING([if kernel has .splice_read])
1343 LB_LINUX_TRY_COMPILE([
1344 #include <linux/fs.h>
1346 struct file_operations file;
1348 file.splice_read = NULL;
1350 AC_MSG_RESULT([yes])
1351 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1352 [kernel has .slice_read])
1358 # 2.6.23 extract nfs export related data into exportfs.h
1359 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1362 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1363 AC_CHECK_HEADERS([linux/exportfs.h])
1368 # LC_VFS_INTENT_PATCHES
1370 # check if the kernel has the VFS intent patches
1371 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1372 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1373 LB_LINUX_TRY_COMPILE([
1374 #include <linux/fs.h>
1375 #include <linux/namei.h>
1377 struct nameidata nd;
1378 struct lookup_intent *it;
1381 intent_init(it, IT_OPEN);
1382 it->d.lustre.it_disposition = 0;
1383 it->d.lustre.it_data = NULL;
1385 AC_MSG_RESULT([yes])
1386 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1392 AC_DEFUN([LC_S_TIME_GRAN],
1393 [AC_MSG_CHECKING([if super block has s_time_gran member])
1394 LB_LINUX_TRY_COMPILE([
1395 #include <linux/fs.h>
1397 struct super_block sb;
1399 return sb.s_time_gran;
1401 AC_MSG_RESULT([yes])
1402 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1408 AC_DEFUN([LC_SB_TIME_GRAN],
1409 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1410 LB_LINUX_TRY_COMPILE([
1411 #include <linux/fs.h>
1413 return get_sb_time_gran(NULL);
1415 AC_MSG_RESULT([yes])
1416 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1423 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1424 AC_DEFUN([LC_RW_TREE_LOCK],
1425 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1426 tmp_flags="$EXTRA_KCFLAGS"
1427 EXTRA_KCFLAGS="-Werror"
1428 LB_LINUX_TRY_COMPILE([
1429 #include <linux/fs.h>
1431 struct address_space a;
1433 write_lock(&a.tree_lock);
1435 AC_MSG_RESULT([yes])
1436 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1440 EXTRA_KCFLAGS="$tmp_flags"
1443 AC_DEFUN([LC_CONST_ACL_SIZE],
1444 [AC_MSG_CHECKING([calc acl size])
1446 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1449 #include <linux/autoconf.h>
1450 #include <linux/types.h>
1453 #define __LINUX_POSIX_ACL_H
1455 # ifdef CONFIG_FS_POSIX_ACL
1456 # ifdef HAVE_XATTR_ACL
1457 # include <linux/xattr_acl.h>
1459 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1460 # include <linux/posix_acl_xattr.h>
1464 #include <lustre_acl.h>
1470 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1471 FILE *f = fopen("acl.size","w+");
1472 fprintf(f,"%d", size);
1479 acl_size=`cat acl.size`
1480 AC_MSG_RESULT([ACL size $acl_size])
1481 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1483 AC_ERROR([ACL size can't computed])
1489 # check for crypto API
1491 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1492 [AC_MSG_CHECKING([if kernel has block cipher support])
1493 LB_LINUX_TRY_COMPILE([
1494 #include <linux/crypto.h>
1496 int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1498 AC_MSG_RESULT([yes])
1499 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1506 # check for FS_RENAME_DOES_D_MOVE flag
1508 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1509 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1510 LB_LINUX_TRY_COMPILE([
1511 #include <linux/fs.h>
1513 int v = FS_RENAME_DOES_D_MOVE;
1515 AC_MSG_RESULT([yes])
1516 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1525 # Lustre linux kernel checks
1527 AC_DEFUN([LC_PROG_LINUX],
1528 [LC_LUSTRE_VERSION_H
1529 if test x$enable_server = xyes ; then
1530 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1535 LC_CONFIG_LIBLUSTRE_RECOVERY
1537 LC_CONFIG_HEALTH_CHECK_WRITE
1538 LC_CONFIG_LRU_RESIZE
1542 LC_EXPORT_TRUNCATE_COMPLETE
1543 LC_EXPORT_D_REHASH_COND
1544 LC_EXPORT___D_REHASH
1545 LC_EXPORT_D_MOVE_LOCKED
1547 LC_EXPORT_NODE_TO_CPUMASK
1550 LC_FUNC_COND_RESCHED
1551 LC_FUNC_ZAP_PAGE_RANGE
1556 LC_FUNC_REGISTER_CACHE
1557 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1558 LC_FUNC_DEV_SET_RDONLY
1559 LC_FUNC_FILEMAP_FDATAWRITE
1562 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1568 LC_POSIX_ACL_XATTR_H
1571 LC_STRUCT_INTENT_FILE
1576 LC_FUNC_MS_FLOCK_LOCK
1577 LC_FUNC_HAVE_CAN_SLEEP_ARG
1580 LC_COOKIE_FOLLOW_LINK
1584 # does the kernel have VFS intent patches?
1585 LC_VFS_INTENT_PATCHES
1598 LC_SECURITY_PLUG # for SLES10 SP2
1605 LC_STATFS_DENTRY_PARAM
1607 LC_INVALIDATEPAGE_RETURN_INT
1608 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1609 if test x$enable_server = xyes ; then
1610 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1613 #2.6.18 + RHEL5 (fc6)
1619 LC_VFS_READDIR_U64_INO
1620 LC_GENERIC_FILE_READ
1621 LC_GENERIC_FILE_WRITE
1624 LC_CANCEL_DIRTY_PAGE
1626 # raid5-zerocopy patch
1630 LC_INVALIDATE_BDEV_2ARG
1631 LC_ASYNC_BLOCK_CIPHER
1632 LC_FS_RENAME_DOES_D_MOVE
1634 LC_UNREGISTER_BLKDEV_RETURN_INT
1635 LC_KERNEL_SPLICE_READ
1640 # LC_CONFIG_CLIENT_SERVER
1642 # Build client/server sides of Lustre
1644 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1645 [AC_MSG_CHECKING([whether to build Lustre server support])
1646 AC_ARG_ENABLE([server],
1647 AC_HELP_STRING([--disable-server],
1648 [disable Lustre server support]),
1649 [],[enable_server='yes'])
1650 AC_MSG_RESULT([$enable_server])
1652 AC_MSG_CHECKING([whether to build Lustre client support])
1653 AC_ARG_ENABLE([client],
1654 AC_HELP_STRING([--disable-client],
1655 [disable Lustre client support]),
1656 [],[enable_client='yes'])
1657 AC_MSG_RESULT([$enable_client])])
1660 # LC_CONFIG_LIBLUSTRE
1662 # whether to build liblustre
1664 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1665 [AC_MSG_CHECKING([whether to build Lustre library])
1666 AC_ARG_ENABLE([liblustre],
1667 AC_HELP_STRING([--disable-liblustre],
1668 [disable building of Lustre library]),
1669 [],[enable_liblustre=$with_sysio])
1670 AC_MSG_RESULT([$enable_liblustre])
1671 # only build sysio if liblustre is built
1672 with_sysio="$enable_liblustre"
1674 AC_MSG_CHECKING([whether to build liblustre tests])
1675 AC_ARG_ENABLE([liblustre-tests],
1676 AC_HELP_STRING([--enable-liblustre-tests],
1677 [enable liblustre tests, if --disable-tests is used]),
1678 [],[enable_liblustre_tests=$enable_tests])
1679 if test x$enable_liblustre != xyes ; then
1680 enable_liblustre_tests='no'
1682 AC_MSG_RESULT([$enable_liblustre_tests])
1684 AC_MSG_CHECKING([whether to enable liblustre acl])
1685 AC_ARG_ENABLE([liblustre-acl],
1686 AC_HELP_STRING([--disable-liblustre-acl],
1687 [disable ACL support for liblustre]),
1688 [],[enable_liblustre_acl=yes])
1689 AC_MSG_RESULT([$enable_liblustre_acl])
1690 if test x$enable_liblustre_acl = xyes ; then
1691 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1697 AC_ARG_ENABLE(mpitests,
1698 AC_HELP_STRING([--enable-mpitest=yes|no|mpich directory],
1699 [include mpi tests]),
1705 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1706 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1711 [[\\/$]]* | ?:[[\\/]]* )
1713 LDFLAGS="$LDFLAGS -L$with_mpi/lib"
1714 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1717 AC_MSG_ERROR([expected absolute directory name for --enable-mpitests or yes or no])
1723 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1724 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1730 if test x$enable_mpitests != xno; then
1731 AC_MSG_CHECKING([whether to mpitests can be built])
1732 AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
1733 [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
1734 [enable_mpitests=no])
1736 AC_MSG_RESULT([$enable_mpitests])
1739 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1740 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1743 LC_CONFIG_LIBLUSTRE_RECOVERY
1746 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1747 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1748 AC_ARG_ENABLE([lru_resize],
1749 AC_HELP_STRING([--enable-lru-resize],
1750 [enable lru resize support]),
1751 [],[enable_lru_resize='yes'])
1752 AC_MSG_RESULT([$enable_lru_resize])
1753 if test x$enable_lru_resize != xno; then
1754 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1761 # whether to enable quota support
1763 AC_DEFUN([LC_CONFIG_QUOTA],
1764 [AC_ARG_ENABLE([quota],
1765 AC_HELP_STRING([--enable-quota],
1766 [enable quota support]),
1767 [],[enable_quota='default'])
1768 if test x$linux25 != xyes; then
1771 LB_LINUX_CONFIG([QUOTA],[
1772 if test x$enable_quota = xdefault; then
1776 if test x$enable_quota = xdefault; then
1778 AC_MSG_WARN([quota is not enabled because the kernel lacks quota support])
1780 if test x$enable_quota = xyes; then
1781 AC_MSG_ERROR([cannot enable quota because the kernel lacks quota support])
1785 if test x$enable_quota != xno; then
1786 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1793 # whether to enable split support
1795 AC_DEFUN([LC_CONFIG_SPLIT],
1796 [AC_MSG_CHECKING([whether to enable split support])
1797 AC_ARG_ENABLE([split],
1798 AC_HELP_STRING([--enable-split],
1799 [enable split support]),
1800 [],[enable_split='no'])
1801 AC_MSG_RESULT([$enable_split])
1802 if test x$enable_split != xno; then
1803 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1807 AC_DEFUN([LC_QUOTA_READ],
1808 [AC_MSG_CHECKING([if kernel supports quota_read])
1809 LB_LINUX_TRY_COMPILE([
1810 #include <linux/fs.h>
1812 struct super_operations sp;
1813 void *i = (void *)sp.quota_read;
1815 AC_MSG_RESULT([yes])
1816 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1823 # LC_COOKIE_FOLLOW_LINK
1825 # kernel 2.6.13+ ->follow_link returns a cookie
1828 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1829 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1830 LB_LINUX_TRY_COMPILE([
1831 #include <linux/fs.h>
1832 #include <linux/namei.h>
1834 struct dentry dentry;
1835 struct nameidata nd;
1837 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1839 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1840 AC_MSG_RESULT([yes])
1849 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1850 # call_rcu takes three parameters.
1852 AC_DEFUN([LC_FUNC_RCU],
1853 [AC_MSG_CHECKING([if kernel have RCU supported])
1854 LB_LINUX_TRY_COMPILE([
1855 #include <linux/rcupdate.h>
1857 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1858 AC_MSG_RESULT([yes])
1860 AC_MSG_CHECKING([if call_rcu takes three parameters])
1861 LB_LINUX_TRY_COMPILE([
1862 #include <linux/rcupdate.h>
1865 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1867 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1868 AC_MSG_RESULT([yes])
1877 # LC_SECURITY_PLUG # for SLES10 SP2
1878 # check security plug in sles10 sp2 kernel
1879 AC_DEFUN([LC_SECURITY_PLUG],
1880 [AC_MSG_CHECKING([If kernel has security plug support])
1881 LB_LINUX_TRY_COMPILE([
1882 #include <linux/fs.h>
1884 struct dentry *dentry;
1885 struct vfsmount *mnt;
1886 struct iattr *iattr;
1888 notify_change(dentry, mnt, iattr);
1891 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
1892 [SLES10 SP2 use extra parameter in vfs])
1898 AC_DEFUN([LC_PERCPU_COUNTER],
1899 [AC_MSG_CHECKING([if have struct percpu_counter defined])
1900 LB_LINUX_TRY_COMPILE([
1901 #include <linux/percpu_counter.h>
1903 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
1904 AC_MSG_RESULT([yes])
1906 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
1907 LB_LINUX_TRY_COMPILE([
1908 #include <linux/percpu_counter.h>
1910 struct percpu_counter c;
1911 percpu_counter_init(&c, 0);
1913 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
1915 AC_MSG_RESULT([yes])
1927 # other configure checks
1929 AC_DEFUN([LC_CONFIGURE],
1930 [LC_CONFIG_OBD_BUFFER_SIZE
1932 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1933 CFLAGS="$CFLAGS -Werror"
1936 # include/liblustre.h
1937 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1939 # liblustre/llite_lib.h
1940 AC_CHECK_HEADERS([xtio.h file.h])
1943 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1946 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1947 AC_CHECK_FUNCS([inet_ntoa])
1949 # libsysio/src/readlink.c
1952 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1953 AC_CHECK_HEADERS([linux/random.h], [], [],
1954 [#ifdef HAVE_LINUX_TYPES_H
1955 # include <linux/types.h>
1960 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1962 # check for -lz support
1966 [AC_CHECK_HEADERS([zlib.h],
1968 AC_DEFINE([HAVE_ADLER], 1,
1969 [support alder32 checksum type])],
1970 [AC_MSG_WARN([No zlib-devel package found,
1971 unable to use adler32 checksum])])],
1972 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1977 AC_ARG_ENABLE([mindf],
1978 AC_HELP_STRING([--enable-mindf],
1979 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1981 if test "$enable_mindf" = "yes" ; then
1982 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1985 AC_ARG_ENABLE([fail_alloc],
1986 AC_HELP_STRING([--disable-fail-alloc],
1987 [disable randomly alloc failure]),
1988 [],[enable_fail_alloc=yes])
1989 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1990 AC_MSG_RESULT([$enable_fail_alloc])
1991 if test x$enable_fail_alloc != xno ; then
1992 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1995 AC_ARG_ENABLE([invariants],
1996 AC_HELP_STRING([--enable-invariants],
1997 [enable invariant checking (cpu intensive)]),
1999 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2000 AC_MSG_RESULT([$enable_invariants])
2001 if test x$enable_invariants = xyes ; then
2002 AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2005 AC_ARG_ENABLE([lu_ref],
2006 AC_HELP_STRING([--enable-lu_ref],
2007 [enable lu_ref reference tracking code]),
2009 AC_MSG_CHECKING([whether to track references with lu_ref])
2010 AC_MSG_RESULT([$enable_lu_ref])
2011 if test x$enable_lu_ref = xyes ; then
2012 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2020 # AM_CONDITIONALS for lustre
2022 AC_DEFUN([LC_CONDITIONALS],
2023 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2024 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2025 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2026 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2027 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2028 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2029 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
2030 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2031 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2032 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2033 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2034 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2035 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2036 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2042 # files that should be generated with AC_OUTPUT
2044 AC_DEFUN([LC_CONFIG_FILES],
2048 lustre/autoconf/Makefile
2049 lustre/contrib/Makefile
2051 lustre/include/Makefile
2052 lustre/include/lustre_ver.h
2053 lustre/include/linux/Makefile
2054 lustre/include/lustre/Makefile
2055 lustre/kernel_patches/targets/2.6-vanilla.target
2056 lustre/kernel_patches/targets/2.6-rhel4.target
2057 lustre/kernel_patches/targets/2.6-rhel5.target
2058 lustre/kernel_patches/targets/2.6-fc5.target
2059 lustre/kernel_patches/targets/2.6-patchless.target
2060 lustre/kernel_patches/targets/2.6-sles10.target
2061 lustre/ldlm/Makefile
2063 lustre/fid/autoMakefile
2064 lustre/liblustre/Makefile
2065 lustre/liblustre/tests/Makefile
2066 lustre/llite/Makefile
2067 lustre/llite/autoMakefile
2069 lustre/lov/autoMakefile
2070 lustre/lvfs/Makefile
2071 lustre/lvfs/autoMakefile
2073 lustre/mdc/autoMakefile
2075 lustre/lmv/autoMakefile
2077 lustre/mds/autoMakefile
2079 lustre/mdt/autoMakefile
2081 lustre/cmm/autoMakefile
2083 lustre/mdd/autoMakefile
2085 lustre/fld/autoMakefile
2086 lustre/obdclass/Makefile
2087 lustre/obdclass/autoMakefile
2088 lustre/obdclass/linux/Makefile
2089 lustre/obdecho/Makefile
2090 lustre/obdecho/autoMakefile
2091 lustre/obdfilter/Makefile
2092 lustre/obdfilter/autoMakefile
2094 lustre/osc/autoMakefile
2096 lustre/ost/autoMakefile
2098 lustre/osd/autoMakefile
2100 lustre/mgc/autoMakefile
2102 lustre/mgs/autoMakefile
2103 lustre/ptlrpc/Makefile
2104 lustre/ptlrpc/autoMakefile
2105 lustre/ptlrpc/gss/Makefile
2106 lustre/ptlrpc/gss/autoMakefile
2107 lustre/quota/Makefile
2108 lustre/quota/autoMakefile
2109 lustre/scripts/Makefile
2110 lustre/scripts/version_tag.pl
2111 lustre/tests/Makefile
2112 lustre/utils/Makefile
2113 lustre/utils/gss/Makefile
2115 case $lb_target_os in
2117 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])