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_ZAP_PAGE_RANGE
128 # if zap_page_range() takes a vma arg
130 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
131 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
132 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
133 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
134 AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
144 # if proc_fs.h defines PDE()
146 AC_DEFUN([LC_FUNC_PDE],
147 [AC_MSG_CHECKING([if kernel defines PDE])
148 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
149 if test "$HAVE_PDE" != 0 ; then
150 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
158 # LC_FUNC_FILEMAP_FDATASYNC
160 # if filemap_fdatasync() exists
162 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
163 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
164 LB_LINUX_TRY_COMPILE([
165 #include <linux/fs.h>
167 int (*foo)(struct address_space *)= filemap_fdatawrite;
170 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
179 # if direct_IO takes a struct file argument
181 AC_DEFUN([LC_FUNC_DIRECT_IO],
182 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
183 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
184 if test "$HAVE_DIO_FILE" != 0 ; then
185 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
193 # LC_HEADER_MM_INLINE
195 # RHEL kernels define page_count in mm_inline.h
197 AC_DEFUN([LC_HEADER_MM_INLINE],
198 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
199 LB_LINUX_TRY_COMPILE([
200 #include <linux/mm_inline.h>
203 #error mm_inline.h does not define page_count
207 AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
216 # if inode->i_alloc_sem exists
218 AC_DEFUN([LC_STRUCT_INODE],
219 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
220 LB_LINUX_TRY_COMPILE([
221 #include <linux/fs.h>
222 #include <linux/version.h>
224 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
225 #error "down_read_trylock broken before 2.4.24"
228 return (char *)&i.i_alloc_sem - (char *)&i;
231 AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
238 # LC_FUNC_REGISTER_CACHE
240 # if register_cache() is defined by kernel
242 # There are two ways to shrink one customized cache in linux kernels. For the
243 # kernels are prior than 2.6.5(?), register_cache() is used, and for latest
244 # kernels, set_shrinker() is used instead.
246 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
247 [AC_MSG_CHECKING([if kernel defines cache pressure hook])
248 LB_LINUX_TRY_COMPILE([
249 #include <linux/mm.h>
253 set_shrinker(1, shrinker);
255 AC_MSG_RESULT([set_shrinker])
256 AC_DEFINE(HAVE_SHRINKER_CACHE, 1, [shrinker_cache found])
257 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [shrinkers should return int])
259 LB_LINUX_TRY_COMPILE([
260 #include <linux/list.h>
261 #include <linux/cache_def.h>
263 struct cache_definition cache;
265 AC_MSG_RESULT([register_cache])
266 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
267 AC_MSG_CHECKING([if kernel expects return from cache shrink ])
268 tmp_flags="$EXTRA_KCFLAGS"
269 EXTRA_KCFLAGS="-Werror"
270 LB_LINUX_TRY_COMPILE([
271 #include <linux/list.h>
272 #include <linux/cache_def.h>
274 struct cache_definition c;
275 c.shrinker = (int (*)(int, unsigned int))1;
277 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1,
278 [kernel expects return from shrink_cache])
283 EXTRA_KCFLAGS="$tmp_flags"
291 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
293 # check for our patched grab_cache_page_nowait_gfp() function
295 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
296 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
297 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
298 if test "$HAVE_GCPN_GFP" != 0 ; then
299 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
300 [kernel has grab_cache_page_nowait_gfp()])
308 # LC_FUNC_DEV_SET_RDONLY
310 # check for the old-style dev_set_rdonly which took an extra "devno" param
311 # and can only set a single device to discard writes at one time
313 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
314 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
315 LB_LINUX_TRY_COMPILE([
316 #include <linux/fs.h>
318 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
319 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
323 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
325 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
326 kernel patches from Lustre version 1.4.3 or above.])
331 # LC_CONFIG_BACKINGFS
333 # setup, check the backing filesystem
335 AC_DEFUN([LC_CONFIG_BACKINGFS],
339 if test x$with_ldiskfs = xno ; then
342 if test x$linux25$enable_server = xyesyes ; then
343 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
346 # --- Check that ext3 and ext3 xattr are enabled in the kernel
348 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
350 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
351 AC_MSG_WARN([This build may fail.])
355 LB_DEFINE_LDISKFS_OPTIONS
358 AC_MSG_CHECKING([which backing filesystem to use])
359 AC_MSG_RESULT([$BACKINGFS])
366 # the pinger is temporary, until we have the recovery node in place
368 AC_DEFUN([LC_CONFIG_PINGER],
369 [AC_MSG_CHECKING([whether to enable pinger support])
370 AC_ARG_ENABLE([pinger],
371 AC_HELP_STRING([--disable-pinger],
372 [disable recovery pinger support]),
373 [],[enable_pinger='yes'])
374 AC_MSG_RESULT([$enable_pinger])
375 if test x$enable_pinger != xno ; then
376 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
383 # do checksum of bulk data between client and OST
385 AC_DEFUN([LC_CONFIG_CHECKSUM],
386 [AC_MSG_CHECKING([whether to enable data checksum support])
387 AC_ARG_ENABLE([checksum],
388 AC_HELP_STRING([--disable-checksum],
389 [disable data checksum support]),
390 [],[enable_checksum='yes'])
391 AC_MSG_RESULT([$enable_checksum])
392 if test x$enable_checksum != xno ; then
393 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
398 # LC_CONFIG_HEALTH_CHECK_WRITE
400 # Turn off the actual write to the disk
402 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
403 [AC_MSG_CHECKING([whether to enable a write with the health check])
404 AC_ARG_ENABLE([health_write],
405 AC_HELP_STRING([--enable-health_write],
406 [enable disk writes when doing health check]),
407 [],[enable_health_write='no'])
408 AC_MSG_RESULT([$enable_health_write])
409 if test x$enable_health_write != xno ; then
410 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
415 # LC_CONFIG_LIBLUSTRE_RECOVERY
417 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
418 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
419 AC_ARG_ENABLE([liblustre-recovery],
420 AC_HELP_STRING([--disable-liblustre-recovery],
421 [disable liblustre recovery support]),
422 [],[enable_liblustre_recovery='yes'])
423 AC_MSG_RESULT([$enable_liblustre_recovery])
424 if test x$enable_liblustre_recovery != xno ; then
425 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
430 # LC_CONFIG_OBD_BUFFER_SIZE
432 # the maximum buffer size of lctl ioctls
434 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
435 [AC_MSG_CHECKING([maximum OBD ioctl size])
436 AC_ARG_WITH([obd-buffer-size],
437 AC_HELP_STRING([--with-obd-buffer-size=[size]],
438 [set lctl ioctl maximum bytes (default=8192)]),
440 OBD_BUFFER_SIZE=$with_obd_buffer_size
444 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
445 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
451 # AIX does not have statfs.f_namelen
453 AC_DEFUN([LC_STRUCT_STATFS],
454 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
455 LB_LINUX_TRY_COMPILE([
456 #include <linux/vfs.h>
462 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
469 # LC_READLINK_SSIZE_T
471 AC_DEFUN([LC_READLINK_SSIZE_T],
472 [AC_MSG_CHECKING([if readlink returns ssize_t])
476 ssize_t readlink(const char *, char *, size_t);
479 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
485 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
486 [AC_MSG_CHECKING([if kernel offers page_mapped])
487 LB_LINUX_TRY_COMPILE([
488 #include <linux/mm.h>
493 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
499 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
500 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
501 LB_LINUX_TRY_COMPILE([
502 #include <linux/fs.h>
504 struct file_operations fops;
505 &fops.unlocked_ioctl;
508 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
514 AC_DEFUN([LC_FILEMAP_POPULATE],
515 [AC_MSG_CHECKING([for exported filemap_populate])
516 LB_LINUX_TRY_COMPILE([
517 #include <asm/page.h>
518 #include <linux/mm.h>
520 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
523 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
529 AC_DEFUN([LC_D_ADD_UNIQUE],
530 [AC_MSG_CHECKING([for d_add_unique])
531 LB_LINUX_TRY_COMPILE([
532 #include <linux/dcache.h>
534 d_add_unique(NULL, NULL);
537 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
543 AC_DEFUN([LC_BIT_SPINLOCK_H],
544 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
545 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
546 LB_LINUX_TRY_COMPILE([
547 #include <asm/processor.h>
548 #include <linux/spinlock.h>
549 #include <linux/bit_spinlock.h>
552 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
563 # If we have xattr_acl.h
565 AC_DEFUN([LC_XATTR_ACL],
566 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
567 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
568 LB_LINUX_TRY_COMPILE([
569 #include <linux/xattr_acl.h>
572 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
583 # If we have fiemap.h
584 # after 2.6.27 use fiemap.h in include/linux
586 AC_DEFUN([LC_LINUX_FIEMAP_H],
587 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
588 AC_MSG_CHECKING([if fiemap.h can be compiled])
589 LB_LINUX_TRY_COMPILE([
590 #include <linux/fiemap.h>
593 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
602 AC_DEFUN([LC_STRUCT_INTENT_FILE],
603 [AC_MSG_CHECKING([if struct open_intent has a file field])
604 LB_LINUX_TRY_COMPILE([
605 #include <linux/fs.h>
606 #include <linux/namei.h>
608 struct open_intent intent;
612 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
619 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
620 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
621 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
622 LB_LINUX_TRY_COMPILE([
623 #include <linux/posix_acl_xattr.h>
626 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
639 # starting from 2.6.19 linux kernel exports __iget()
641 AC_DEFUN([LC_EXPORT___IGET],
642 [LB_CHECK_SYMBOL_EXPORT([__iget],
644 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
649 AC_DEFUN([LC_LUSTRE_VERSION_H],
650 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
651 rm -f "$LUSTRE/include/linux/lustre_version.h"
653 touch "$LUSTRE/include/linux/lustre_version.h"
654 if test x$enable_server = xyes ; then
655 AC_MSG_WARN([Unpatched kernel detected.])
656 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
657 AC_MSG_WARN([disabling server build])
663 AC_DEFUN([LC_FUNC_SET_FS_PWD],
664 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
666 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
674 AC_DEFUN([LC_CAPA_CRYPTO],
675 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
676 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
678 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
679 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
681 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
682 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
686 AC_DEFUN([LC_SUNRPC_CACHE],
687 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
688 LB_LINUX_TRY_COMPILE([
689 #include <linux/sunrpc/cache.h>
691 struct cache_head ch;
695 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
701 AC_DEFUN([LC_CONFIG_SUNRPC],
702 [LB_LINUX_CONFIG_IM([SUNRPC],[],
703 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
708 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
710 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
711 [AC_MSG_CHECKING([whether to enable gss keyring backend])
712 AC_ARG_ENABLE([gss_keyring],
713 [AC_HELP_STRING([--disable-gss-keyring],
714 [disable gss keyring backend])],
715 [],[enable_gss_keyring='yes'])
716 AC_MSG_RESULT([$enable_gss_keyring])
718 if test x$enable_gss_keyring != xno; then
719 LB_LINUX_CONFIG_IM([KEYS],[],
720 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
722 AC_CHECK_LIB([keyutils], [keyctl_search], [],
723 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
725 AC_DEFINE([HAVE_GSS_KEYRING], [1],
726 [Define this if you enable gss keyring backend])
730 m4_pattern_allow(AC_KERBEROS_V5)
733 # LC_CONFIG_GSS (default disabled)
735 # Build gss and related tools of Lustre. Currently both kernel and user space
736 # parts are depend on linux platform.
738 AC_DEFUN([LC_CONFIG_GSS],
739 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
741 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
742 [],[enable_gss='no'])
743 AC_MSG_RESULT([$enable_gss])
745 if test x$enable_gss == xyes; then
746 LC_CONFIG_GSS_KEYRING
749 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
750 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
751 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
752 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
753 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
754 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
755 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
756 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
757 LB_LINUX_CONFIG_IM([CRYPTO_WP512],[],
758 [AC_MSG_WARN([kernel WP512 support is recommended by using GSS.])])
759 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],
760 [AC_MSG_WARN([kernel ARC4 support is recommended by using GSS.])])
761 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],
762 [AC_MSG_WARN([kernel DES support is recommended by using GSS.])])
763 LB_LINUX_CONFIG_IM([CRYPTO_TWOFISH],[],
764 [AC_MSG_WARN([kernel TWOFISH support is recommended by using GSS.])])
765 LB_LINUX_CONFIG_IM([CRYPTO_CAST6],[],
766 [AC_MSG_WARN([kernel CAST6 support is recommended by using GSS.])])
768 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
770 LB_LINUX_CONFIG_IM([CRYPTO_AES],[],
771 [AC_MSG_WARN([kernel AES support is recommended by using GSS.])])
773 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
774 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
775 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
776 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
777 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
779 AC_SUBST(GSSAPI_LIBS)
785 # LC_FUNC_MS_FLOCK_LOCK
787 # SLES9 kernel has MS_FLOCK_LOCK sb flag
789 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
790 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
791 LB_LINUX_TRY_COMPILE([
792 #include <linux/fs.h>
794 int flags = MS_FLOCK_LOCK;
796 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
797 [kernel has MS_FLOCK_LOCK flag])
805 # LC_FUNC_HAVE_CAN_SLEEP_ARG
807 # SLES9 kernel has third arg can_sleep
808 # in fs/locks.c: flock_lock_file_wait()
810 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
811 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
812 LB_LINUX_TRY_COMPILE([
813 #include <linux/fs.h>
817 struct file_lock *file_lock;
818 flock_lock_file_wait(file, file_lock, cansleep);
820 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
821 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
831 # rhel4.2 kernel has f_op->flock field
833 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
834 [AC_MSG_CHECKING([if struct file_operations has flock field])
835 LB_LINUX_TRY_COMPILE([
836 #include <linux/fs.h>
838 struct file_operations ll_file_operations_flock;
839 ll_file_operations_flock.flock = NULL;
841 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
842 [struct file_operations has flock field])
852 # task struct has p_pptr instead of parent
854 AC_DEFUN([LC_TASK_PPTR],
855 [AC_MSG_CHECKING([task p_pptr found])
856 LB_LINUX_TRY_COMPILE([
857 #include <linux/sched.h>
859 struct task_struct *p;
864 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
873 # rhel4.2 kernel has f_op->flock field
875 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
876 [AC_MSG_CHECKING([if struct file_operations has flock field])
877 LB_LINUX_TRY_COMPILE([
878 #include <linux/fs.h>
880 struct file_operations ll_file_operations_flock;
881 ll_file_operations_flock.flock = NULL;
883 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
884 [struct file_operations has flock field])
892 # after 2.6.15 inode have i_mutex intead of i_sem
893 AC_DEFUN([LC_INODE_I_MUTEX],
894 [AC_MSG_CHECKING([use inode have i_mutex ])
895 LB_LINUX_TRY_COMPILE([
896 #include <linux/mutex.h>
897 #include <linux/fs.h>
902 mutex_unlock(&i.i_mutex);
905 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
906 [after 2.6.15 inode have i_mutex intead of i_sem])
913 # after 2.6.17 dquote use mutex instead if semaphore
914 AC_DEFUN([LC_DQUOTOFF_MUTEX],
915 [AC_MSG_CHECKING([use dqonoff_mutex])
916 LB_LINUX_TRY_COMPILE([
917 #include <linux/mutex.h>
918 #include <linux/fs.h>
919 #include <linux/quota.h>
921 struct quota_info dq;
923 mutex_unlock(&dq.dqonoff_mutex);
926 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
927 [after 2.6.17 dquote use mutex instead if semaphore])
934 # LC_STATFS_DENTRY_PARAM
935 # starting from 2.6.18 linux kernel uses dentry instead of
936 # super_block for first vfs_statfs argument
938 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
939 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
940 LB_LINUX_TRY_COMPILE([
941 #include <linux/fs.h>
943 int vfs_statfs(struct dentry *, struct kstatfs *);
945 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
946 [first parameter of vfs_statfs is dentry])
955 # starting from 2.6.18 kernel don't export do_kern_mount
956 # and want to use vfs_kern_mount instead.
958 AC_DEFUN([LC_VFS_KERN_MOUNT],
959 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
960 LB_LINUX_TRY_COMPILE([
961 #include <linux/mount.h>
963 vfs_kern_mount(NULL, 0, NULL, NULL);
965 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
966 [vfs_kern_mount exist in kernel])
974 # LC_INVALIDATEPAGE_RETURN_INT
975 # more 2.6 api changes. return type for the invalidatepage
976 # address_space_operation is 'void' in new kernels but 'int' in old
978 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
979 [AC_MSG_CHECKING([invalidatepage has return int])
980 LB_LINUX_TRY_COMPILE([
981 #include <linux/buffer_head.h>
983 int rc = block_invalidatepage(NULL, 0);
986 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
987 [Define if return type of invalidatepage should be int])
993 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
994 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
995 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
996 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
997 tmp_flags="$EXTRA_KCFLAGS"
998 EXTRA_KCFLAGS="-Werror"
999 LB_LINUX_TRY_COMPILE([
1000 #include <linux/fs.h>
1003 static void cfg_umount_begin (struct vfsmount *v, int flags)
1008 static struct super_operations cfg_super_operations = {
1009 .umount_begin = cfg_umount_begin,
1012 cfg_super_operations.umount_begin(NULL,0);
1015 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
1016 [Define umount_begin need second argument])
1020 EXTRA_KCFLAGS="$tmp_flags"
1023 # 2.6.19 API changes
1024 # inode don't have i_blksize field
1025 AC_DEFUN([LC_INODE_BLKSIZE],
1026 [AC_MSG_CHECKING([inode has i_blksize field])
1027 LB_LINUX_TRY_COMPILE([
1028 #include <linux/fs.h>
1034 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1035 [struct inode has i_blksize field])
1041 # LC_VFS_READDIR_U64_INO
1042 # 2.6.19 use u64 for inode number instead of inode_t
1043 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1044 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1045 tmp_flags="$EXTRA_KCFLAGS"
1046 EXTRA_KCFLAGS="-Werror"
1047 LB_LINUX_TRY_COMPILE([
1048 #include <linux/fs.h>
1049 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1050 u64 ino, unsigned int d_type)
1057 filter = fillonedir;
1061 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1062 [if vfs_readdir need 64bit inode number])
1066 EXTRA_KCFLAGS="$tmp_flags"
1069 # LC_GENERIC_FILE_WRITE
1070 # 2.6.19 introduce do_sync_write instead of
1071 # generic_file_write
1072 AC_DEFUN([LC_GENERIC_FILE_WRITE],
1073 [AC_MSG_CHECKING([use generic_file_write])
1074 LB_LINUX_TRY_COMPILE([
1075 #include <linux/fs.h>
1077 int result = generic_file_read(NULL, NULL, 0, 0);
1080 AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1081 [use generic_file_write])
1087 # LC_GENERIC_FILE_READ
1088 # 2.6.19 need to use do_sync_read instead of
1090 AC_DEFUN([LC_GENERIC_FILE_READ],
1091 [AC_MSG_CHECKING([use generic_file_read])
1092 LB_LINUX_TRY_COMPILE([
1093 #include <linux/fs.h>
1095 int result = generic_file_read(NULL, NULL, 0, 0);
1098 AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
1099 [use generic_file_read])
1106 # 2.6.18 don't export nr_pagecahe
1107 AC_DEFUN([LC_NR_PAGECACHE],
1108 [AC_MSG_CHECKING([kernel export nr_pagecache])
1109 LB_LINUX_TRY_COMPILE([
1110 #include <linux/pagemap.h>
1112 return atomic_read(&nr_pagecache);
1115 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1116 [is kernel export nr_pagecache])
1122 # LC_CANCEL_DIRTY_PAGE
1123 # 2.6.20 introduse cancel_dirty_page instead of
1125 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1126 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1127 LB_LINUX_TRY_COMPILE([
1128 #include <linux/mm.h>
1129 #include <linux/page-flags.h>
1131 cancel_dirty_page(NULL, 0);
1134 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1135 [kernel has cancel_dirty_page instead of clear_page_dirty])
1144 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1145 # it support constant page, which means the page won't be modified during the
1148 AC_DEFUN([LC_PAGE_CONSTANT],
1149 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1150 LB_LINUX_TRY_COMPILE([
1151 #include <linux/mm.h>
1152 #include <linux/page-flags.h>
1155 #error "Have no raid5 zcopy patch"
1159 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1165 # RHEL5 in FS-cache patch rename PG_checked flag
1167 AC_DEFUN([LC_PG_FS_MISC],
1168 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1169 LB_LINUX_TRY_COMPILE([
1170 #include <linux/mm.h>
1171 #include <linux/page-flags.h>
1174 #error PG_fs_misc not defined in kernel
1178 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1179 [is kernel have PG_fs_misc])
1185 # RHEL5 PageChecked and SetPageChecked defined
1186 AC_DEFUN([LC_PAGE_CHECKED],
1187 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1188 LB_LINUX_TRY_COMPILE([
1189 #include <linux/mm.h>
1190 #include <linux/page-flags.h>
1193 #error PageChecked not defined in kernel
1195 #ifndef SetPageChecked
1196 #error SetPageChecked not defined in kernel
1200 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1201 [does kernel have PageChecked and SetPageChecked])
1207 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1208 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1210 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1211 [kernel export truncate_complete_page])
1216 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1217 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1219 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1220 [d_rehash_cond is exported by the kernel])
1225 AC_DEFUN([LC_EXPORT___D_REHASH],
1226 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1228 AC_DEFINE(HAVE___D_REHASH, 1,
1229 [__d_rehash is exported by the kernel])
1234 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1235 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1237 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1238 [d_move_locked is exported by the kernel])
1243 AC_DEFUN([LC_EXPORT___D_MOVE],
1244 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1246 AC_DEFINE(HAVE___D_MOVE, 1,
1247 [__d_move is exported by the kernel])
1252 # The actual symbol exported varies among architectures, so we need
1253 # to check many symbols (but only in the current architecture.) No
1254 # matter what symbol is exported, the kernel #defines node_to_cpumask
1255 # to the appropriate function and that's what we use.
1256 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1257 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1258 [arch/$LINUX_ARCH/mm/numa.c],
1259 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1260 [node_to_cpumask is exported by
1261 the kernel])]) # x86_64
1262 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1263 [arch/$LINUX_ARCH/kernel/smpboot.c],
1264 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1265 [node_to_cpumask is exported by
1266 the kernel])]) # ia64
1267 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1268 [arch/$LINUX_ARCH/kernel/smpboot.c],
1269 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1270 [node_to_cpumask is exported by
1271 the kernel])]) # i386
1274 # 2.6.22 lost second parameter for invalidate_bdev
1275 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1276 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1277 LB_LINUX_TRY_COMPILE([
1278 #include <linux/buffer_head.h>
1280 invalidate_bdev(NULL,0);
1282 AC_MSG_RESULT([yes])
1283 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1284 [invalidate_bdev has second argument])
1290 # 2.6.23 have return type 'void' for unregister_blkdev
1291 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1292 [AC_MSG_CHECKING([if unregister_blkdev return int])
1293 LB_LINUX_TRY_COMPILE([
1294 #include <linux/fs.h>
1296 int i = unregister_blkdev(0,NULL);
1298 AC_MSG_RESULT([yes])
1299 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1300 [unregister_blkdev return int])
1306 # 2.6.23 change .sendfile to .splice_read
1307 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1308 [AC_MSG_CHECKING([if kernel has .splice_read])
1309 LB_LINUX_TRY_COMPILE([
1310 #include <linux/fs.h>
1312 struct file_operations file;
1314 file.splice_read = NULL;
1316 AC_MSG_RESULT([yes])
1317 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1318 [kernel has .slice_read])
1324 # 2.6.23 extract nfs export related data into exportfs.h
1325 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1328 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1329 AC_CHECK_HEADERS([linux/exportfs.h])
1334 # LC_VFS_INTENT_PATCHES
1336 # check if the kernel has the VFS intent patches
1337 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1338 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1339 LB_LINUX_TRY_COMPILE([
1340 #include <linux/fs.h>
1341 #include <linux/namei.h>
1343 struct nameidata nd;
1344 struct lookup_intent *it;
1347 intent_init(it, IT_OPEN);
1348 it->d.lustre.it_disposition = 0;
1349 it->d.lustre.it_data = NULL;
1351 AC_MSG_RESULT([yes])
1352 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1358 AC_DEFUN([LC_S_TIME_GRAN],
1359 [AC_MSG_CHECKING([if super block has s_time_gran member])
1360 LB_LINUX_TRY_COMPILE([
1361 #include <linux/fs.h>
1363 struct super_block sb;
1365 return sb.s_time_gran;
1367 AC_MSG_RESULT([yes])
1368 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1374 AC_DEFUN([LC_SB_TIME_GRAN],
1375 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1376 LB_LINUX_TRY_COMPILE([
1377 #include <linux/fs.h>
1379 return get_sb_time_gran(NULL);
1381 AC_MSG_RESULT([yes])
1382 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1389 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1390 AC_DEFUN([LC_RW_TREE_LOCK],
1391 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1392 tmp_flags="$EXTRA_KCFLAGS"
1393 EXTRA_KCFLAGS="-Werror"
1394 LB_LINUX_TRY_COMPILE([
1395 #include <linux/fs.h>
1397 struct address_space a;
1399 write_lock(&a.tree_lock);
1401 AC_MSG_RESULT([yes])
1402 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1406 EXTRA_KCFLAGS="$tmp_flags"
1409 AC_DEFUN([LC_CONST_ACL_SIZE],
1410 [AC_MSG_CHECKING([calc acl size])
1412 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1415 #include <linux/autoconf.h>
1416 #include <linux/types.h>
1419 #define __LINUX_POSIX_ACL_H
1421 # ifdef CONFIG_FS_POSIX_ACL
1422 # ifdef HAVE_XATTR_ACL
1423 # include <linux/xattr_acl.h>
1425 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1426 # include <linux/posix_acl_xattr.h>
1430 #include <lustre_acl.h>
1436 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1437 FILE *f = fopen("acl.size","w+");
1438 fprintf(f,"%d", size);
1445 acl_size=`cat acl.size`
1446 AC_MSG_RESULT([ACL size $acl_size])
1447 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1449 AC_ERROR([ACL size can't computed])
1455 # check for crypto API
1457 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1458 [AC_MSG_CHECKING([if kernel has block cipher support])
1459 LB_LINUX_TRY_COMPILE([
1460 #include <linux/crypto.h>
1462 int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1464 AC_MSG_RESULT([yes])
1465 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1472 # check for FS_RENAME_DOES_D_MOVE flag
1474 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1475 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1476 LB_LINUX_TRY_COMPILE([
1477 #include <linux/fs.h>
1479 int v = FS_RENAME_DOES_D_MOVE;
1481 AC_MSG_RESULT([yes])
1482 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1491 # Lustre linux kernel checks
1493 AC_DEFUN([LC_PROG_LINUX],
1494 [LC_LUSTRE_VERSION_H
1495 if test x$enable_server = xyes ; then
1496 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1501 LC_CONFIG_LIBLUSTRE_RECOVERY
1503 LC_CONFIG_HEALTH_CHECK_WRITE
1504 LC_CONFIG_LRU_RESIZE
1508 LC_EXPORT_TRUNCATE_COMPLETE
1509 LC_EXPORT_D_REHASH_COND
1510 LC_EXPORT___D_REHASH
1511 LC_EXPORT_D_MOVE_LOCKED
1513 LC_EXPORT_NODE_TO_CPUMASK
1516 LC_FUNC_COND_RESCHED
1517 LC_FUNC_ZAP_PAGE_RANGE
1522 LC_FUNC_REGISTER_CACHE
1523 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1524 LC_FUNC_DEV_SET_RDONLY
1525 LC_FUNC_FILEMAP_FDATAWRITE
1528 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1534 LC_POSIX_ACL_XATTR_H
1537 LC_STRUCT_INTENT_FILE
1542 LC_FUNC_MS_FLOCK_LOCK
1543 LC_FUNC_HAVE_CAN_SLEEP_ARG
1546 LC_COOKIE_FOLLOW_LINK
1550 # does the kernel have VFS intent patches?
1551 LC_VFS_INTENT_PATCHES
1564 LC_SECURITY_PLUG # for SLES10 SP2
1571 LC_STATFS_DENTRY_PARAM
1573 LC_INVALIDATEPAGE_RETURN_INT
1574 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1576 #2.6.18 + RHEL5 (fc6)
1582 LC_VFS_READDIR_U64_INO
1583 LC_GENERIC_FILE_READ
1584 LC_GENERIC_FILE_WRITE
1587 LC_CANCEL_DIRTY_PAGE
1589 # raid5-zerocopy patch
1593 LC_INVALIDATE_BDEV_2ARG
1594 LC_ASYNC_BLOCK_CIPHER
1595 LC_FS_RENAME_DOES_D_MOVE
1597 LC_UNREGISTER_BLKDEV_RETURN_INT
1598 LC_KERNEL_SPLICE_READ
1603 # LC_CONFIG_CLIENT_SERVER
1605 # Build client/server sides of Lustre
1607 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1608 [AC_MSG_CHECKING([whether to build Lustre server support])
1609 AC_ARG_ENABLE([server],
1610 AC_HELP_STRING([--disable-server],
1611 [disable Lustre server support]),
1612 [],[enable_server='yes'])
1613 AC_MSG_RESULT([$enable_server])
1615 AC_MSG_CHECKING([whether to build Lustre client support])
1616 AC_ARG_ENABLE([client],
1617 AC_HELP_STRING([--disable-client],
1618 [disable Lustre client support]),
1619 [],[enable_client='yes'])
1620 AC_MSG_RESULT([$enable_client])])
1623 # LC_CONFIG_LIBLUSTRE
1625 # whether to build liblustre
1627 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1628 [AC_MSG_CHECKING([whether to build Lustre library])
1629 AC_ARG_ENABLE([liblustre],
1630 AC_HELP_STRING([--disable-liblustre],
1631 [disable building of Lustre library]),
1632 [],[enable_liblustre=$with_sysio])
1633 AC_MSG_RESULT([$enable_liblustre])
1634 # only build sysio if liblustre is built
1635 with_sysio="$enable_liblustre"
1637 AC_MSG_CHECKING([whether to build liblustre tests])
1638 AC_ARG_ENABLE([liblustre-tests],
1639 AC_HELP_STRING([--enable-liblustre-tests],
1640 [enable liblustre tests, if --disable-tests is used]),
1641 [],[enable_liblustre_tests=$enable_tests])
1642 if test x$enable_liblustre != xyes ; then
1643 enable_liblustre_tests='no'
1645 AC_MSG_RESULT([$enable_liblustre_tests])
1647 AC_MSG_CHECKING([whether to enable liblustre acl])
1648 AC_ARG_ENABLE([liblustre-acl],
1649 AC_HELP_STRING([--disable-liblustre-acl],
1650 [disable ACL support for liblustre]),
1651 [],[enable_liblustre_acl=yes])
1652 AC_MSG_RESULT([$enable_liblustre_acl])
1653 if test x$enable_liblustre_acl = xyes ; then
1654 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1660 AC_ARG_ENABLE(mpitests,
1661 AC_HELP_STRING([--enable-mpitest=yes|no|mpich directory],
1662 [include mpi tests]),
1668 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1669 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1674 [[\\/$]]* | ?:[[\\/]]* )
1676 LDFLAGS="$LDFLAGS -L$with_mpi/lib"
1677 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1680 AC_MSG_ERROR([expected absolute directory name for --enable-mpitests or yes or no])
1686 LDFLAGS="$LDFLAGS -L$MPI_ROOT/ch-p4/lib -L$MPI_ROOT/ch-p4/lib64"
1687 CFLAGS="$CFLAGS -I$MPI_ROOT/include"
1693 if test x$enable_mpitests != xno; then
1694 AC_MSG_CHECKING([whether to mpitests can be built])
1695 AC_CHECK_FILE([$MPI_ROOT/include/mpi.h],
1696 [AC_CHECK_LIB([mpich],[MPI_Start],[enable_mpitests=yes],[enable_mpitests=no])],
1697 [enable_mpitests=no])
1699 AC_MSG_RESULT([$enable_mpitests])
1702 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1703 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1706 LC_CONFIG_LIBLUSTRE_RECOVERY
1709 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1710 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1711 AC_ARG_ENABLE([lru_resize],
1712 AC_HELP_STRING([--enable-lru-resize],
1713 [enable lru resize support]),
1714 [],[enable_lru_resize='yes'])
1715 AC_MSG_RESULT([$enable_lru_resize])
1716 if test x$enable_lru_resize != xno; then
1717 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1724 # whether to enable quota support
1726 AC_DEFUN([LC_CONFIG_QUOTA],
1727 [AC_ARG_ENABLE([quota],
1728 AC_HELP_STRING([--enable-quota],
1729 [enable quota support]),
1730 [],[enable_quota='default'])
1731 if test x$linux25 != xyes; then
1734 LB_LINUX_CONFIG([QUOTA],[
1735 if test x$enable_quota = xdefault; then
1739 if test x$enable_quota = xdefault; then
1741 AC_MSG_WARN([quota is not enabled because the kernel lacks quota support])
1743 if test x$enable_quota = xyes; then
1744 AC_MSG_ERROR([cannot enable quota because the kernel lacks quota support])
1748 if test x$enable_quota != xno; then
1749 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1756 # whether to enable split support
1758 AC_DEFUN([LC_CONFIG_SPLIT],
1759 [AC_MSG_CHECKING([whether to enable split support])
1760 AC_ARG_ENABLE([split],
1761 AC_HELP_STRING([--enable-split],
1762 [enable split support]),
1763 [],[enable_split='no'])
1764 AC_MSG_RESULT([$enable_split])
1765 if test x$enable_split != xno; then
1766 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1770 AC_DEFUN([LC_QUOTA_READ],
1771 [AC_MSG_CHECKING([if kernel supports quota_read])
1772 LB_LINUX_TRY_COMPILE([
1773 #include <linux/fs.h>
1775 struct super_operations sp;
1776 void *i = (void *)sp.quota_read;
1778 AC_MSG_RESULT([yes])
1779 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1786 # LC_COOKIE_FOLLOW_LINK
1788 # kernel 2.6.13+ ->follow_link returns a cookie
1791 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1792 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1793 LB_LINUX_TRY_COMPILE([
1794 #include <linux/fs.h>
1795 #include <linux/namei.h>
1797 struct dentry dentry;
1798 struct nameidata nd;
1800 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1802 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1803 AC_MSG_RESULT([yes])
1812 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1813 # call_rcu takes three parameters.
1815 AC_DEFUN([LC_FUNC_RCU],
1816 [AC_MSG_CHECKING([if kernel have RCU supported])
1817 LB_LINUX_TRY_COMPILE([
1818 #include <linux/rcupdate.h>
1820 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1821 AC_MSG_RESULT([yes])
1823 AC_MSG_CHECKING([if call_rcu takes three parameters])
1824 LB_LINUX_TRY_COMPILE([
1825 #include <linux/rcupdate.h>
1828 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1830 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1831 AC_MSG_RESULT([yes])
1840 # LC_SECURITY_PLUG # for SLES10 SP2
1841 # check security plug in sles10 sp2 kernel
1842 AC_DEFUN([LC_SECURITY_PLUG],
1843 [AC_MSG_CHECKING([If kernel has security plug support])
1844 LB_LINUX_TRY_COMPILE([
1845 #include <linux/fs.h>
1847 struct dentry *dentry;
1848 struct vfsmount *mnt;
1849 struct iattr *iattr;
1851 notify_change(dentry, mnt, iattr);
1854 AC_DEFINE(HAVE_SECURITY_PLUG, 1,
1855 [SLES10 SP2 use extra parameter in vfs])
1861 AC_DEFUN([LC_PERCPU_COUNTER],
1862 [AC_MSG_CHECKING([if have struct percpu_counter defined])
1863 LB_LINUX_TRY_COMPILE([
1864 #include <linux/percpu_counter.h>
1866 AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
1867 AC_MSG_RESULT([yes])
1869 AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
1870 LB_LINUX_TRY_COMPILE([
1871 #include <linux/percpu_counter.h>
1873 struct percpu_counter c;
1874 percpu_counter_init(&c, 0);
1876 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
1878 AC_MSG_RESULT([yes])
1890 # other configure checks
1892 AC_DEFUN([LC_CONFIGURE],
1893 [LC_CONFIG_OBD_BUFFER_SIZE
1895 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1896 CFLAGS="$CFLAGS -Werror"
1899 # include/liblustre.h
1900 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1902 # liblustre/llite_lib.h
1903 AC_CHECK_HEADERS([xtio.h file.h])
1906 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1909 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1910 AC_CHECK_FUNCS([inet_ntoa])
1912 # libsysio/src/readlink.c
1915 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1916 AC_CHECK_HEADERS([linux/random.h], [], [],
1917 [#ifdef HAVE_LINUX_TYPES_H
1918 # include <linux/types.h>
1923 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1925 # check for -lz support
1929 [AC_CHECK_HEADERS([zlib.h],
1931 AC_DEFINE([HAVE_ADLER], 1,
1932 [support alder32 checksum type])],
1933 [AC_MSG_WARN([No zlib-devel package found,
1934 unable to use adler32 checksum])])],
1935 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1940 AC_ARG_ENABLE([mindf],
1941 AC_HELP_STRING([--enable-mindf],
1942 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1944 if test "$enable_mindf" = "yes" ; then
1945 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1948 AC_ARG_ENABLE([fail_alloc],
1949 AC_HELP_STRING([--disable-fail-alloc],
1950 [disable randomly alloc failure]),
1951 [],[enable_fail_alloc=yes])
1952 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1953 AC_MSG_RESULT([$enable_fail_alloc])
1954 if test x$enable_fail_alloc != xno ; then
1955 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1963 # AM_CONDITIONALS for lustre
1965 AC_DEFUN([LC_CONDITIONALS],
1966 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1967 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1968 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1969 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1970 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1971 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1972 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1973 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1974 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1975 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1976 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1977 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1978 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1979 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1985 # files that should be generated with AC_OUTPUT
1987 AC_DEFUN([LC_CONFIG_FILES],
1991 lustre/autoconf/Makefile
1992 lustre/contrib/Makefile
1994 lustre/include/Makefile
1995 lustre/include/lustre_ver.h
1996 lustre/include/linux/Makefile
1997 lustre/include/lustre/Makefile
1998 lustre/kernel_patches/targets/2.6-vanilla.target
1999 lustre/kernel_patches/targets/2.6-rhel4.target
2000 lustre/kernel_patches/targets/2.6-rhel5.target
2001 lustre/kernel_patches/targets/2.6-fc5.target
2002 lustre/kernel_patches/targets/2.6-patchless.target
2003 lustre/kernel_patches/targets/2.6-sles10.target
2004 lustre/ldlm/Makefile
2006 lustre/fid/autoMakefile
2007 lustre/liblustre/Makefile
2008 lustre/liblustre/tests/Makefile
2009 lustre/llite/Makefile
2010 lustre/llite/autoMakefile
2012 lustre/lov/autoMakefile
2013 lustre/lvfs/Makefile
2014 lustre/lvfs/autoMakefile
2016 lustre/mdc/autoMakefile
2018 lustre/lmv/autoMakefile
2020 lustre/mds/autoMakefile
2022 lustre/mdt/autoMakefile
2024 lustre/cmm/autoMakefile
2026 lustre/mdd/autoMakefile
2028 lustre/fld/autoMakefile
2029 lustre/obdclass/Makefile
2030 lustre/obdclass/autoMakefile
2031 lustre/obdclass/linux/Makefile
2032 lustre/obdecho/Makefile
2033 lustre/obdecho/autoMakefile
2034 lustre/obdfilter/Makefile
2035 lustre/obdfilter/autoMakefile
2037 lustre/osc/autoMakefile
2039 lustre/ost/autoMakefile
2041 lustre/osd/autoMakefile
2043 lustre/mgc/autoMakefile
2045 lustre/mgs/autoMakefile
2046 lustre/ptlrpc/Makefile
2047 lustre/ptlrpc/autoMakefile
2048 lustre/ptlrpc/gss/Makefile
2049 lustre/ptlrpc/gss/autoMakefile
2050 lustre/quota/Makefile
2051 lustre/quota/autoMakefile
2052 lustre/scripts/Makefile
2053 lustre/scripts/version_tag.pl
2054 lustre/tests/Makefile
2055 lustre/utils/Makefile
2056 lustre/utils/gss/Makefile
2058 case $lb_target_os in
2060 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])