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 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
243 [AC_MSG_CHECKING([if kernel defines register_cache()])
244 LB_LINUX_TRY_COMPILE([
245 #include <linux/list.h>
246 #include <linux/cache_def.h>
248 struct cache_definition cache;
251 AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
252 AC_MSG_CHECKING([if kernel expects return from cache shrink function])
253 HAVE_CACHE_RETURN_INT="`grep -c 'int.*shrink' $LINUX/include/linux/cache_def.h`"
254 if test "$HAVE_CACHE_RETURN_INT" != 0 ; then
255 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [kernel expects return from shrink_cache])
266 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
268 # check for our patched grab_cache_page_nowait_gfp() function
270 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
271 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
272 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
273 if test "$HAVE_GCPN_GFP" != 0 ; then
274 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
275 [kernel has grab_cache_page_nowait_gfp()])
283 # LC_FUNC_DEV_SET_RDONLY
285 # check for the old-style dev_set_rdonly which took an extra "devno" param
286 # and can only set a single device to discard writes at one time
288 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
289 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
290 LB_LINUX_TRY_COMPILE([
291 #include <linux/fs.h>
293 #ifndef HAVE_CLEAR_RDONLY_ON_PUT
294 #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
298 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
300 AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre
301 kernel patches from Lustre version 1.4.3 or above.])
306 # LC_CONFIG_BACKINGFS
308 # setup, check the backing filesystem
310 AC_DEFUN([LC_CONFIG_BACKINGFS],
314 if test x$with_ldiskfs = xno ; then
317 if test x$linux25$enable_server = xyesyes ; then
318 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
321 # --- Check that ext3 and ext3 xattr are enabled in the kernel
323 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
325 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
326 AC_MSG_WARN([This build may fail.])
330 LB_DEFINE_LDISKFS_OPTIONS
333 AC_MSG_CHECKING([which backing filesystem to use])
334 AC_MSG_RESULT([$BACKINGFS])
341 # the pinger is temporary, until we have the recovery node in place
343 AC_DEFUN([LC_CONFIG_PINGER],
344 [AC_MSG_CHECKING([whether to enable pinger support])
345 AC_ARG_ENABLE([pinger],
346 AC_HELP_STRING([--disable-pinger],
347 [disable recovery pinger support]),
348 [],[enable_pinger='yes'])
349 AC_MSG_RESULT([$enable_pinger])
350 if test x$enable_pinger != xno ; then
351 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
358 # do checksum of bulk data between client and OST
360 AC_DEFUN([LC_CONFIG_CHECKSUM],
361 [AC_MSG_CHECKING([whether to enable data checksum support])
362 AC_ARG_ENABLE([checksum],
363 AC_HELP_STRING([--disable-checksum],
364 [disable data checksum support]),
365 [],[enable_checksum='yes'])
366 AC_MSG_RESULT([$enable_checksum])
367 if test x$enable_checksum != xno ; then
368 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
373 # LC_CONFIG_HEALTH_CHECK_WRITE
375 # Turn off the actual write to the disk
377 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
378 [AC_MSG_CHECKING([whether to enable a write with the health check])
379 AC_ARG_ENABLE([health_write],
380 AC_HELP_STRING([--enable-health_write],
381 [enable disk writes when doing health check]),
382 [],[enable_health_write='no'])
383 AC_MSG_RESULT([$enable_health_write])
384 if test x$enable_health_write != xno ; then
385 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
390 # LC_CONFIG_LIBLUSTRE_RECOVERY
392 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
393 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
394 AC_ARG_ENABLE([liblustre-recovery],
395 AC_HELP_STRING([--disable-liblustre-recovery],
396 [disable liblustre recovery support]),
397 [],[enable_liblustre_recovery='yes'])
398 AC_MSG_RESULT([$enable_liblustre_recovery])
399 if test x$enable_liblustre_recovery != xno ; then
400 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
405 # LC_CONFIG_OBD_BUFFER_SIZE
407 # the maximum buffer size of lctl ioctls
409 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
410 [AC_MSG_CHECKING([maximum OBD ioctl size])
411 AC_ARG_WITH([obd-buffer-size],
412 AC_HELP_STRING([--with-obd-buffer-size=[size]],
413 [set lctl ioctl maximum bytes (default=8192)]),
415 OBD_BUFFER_SIZE=$with_obd_buffer_size
419 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
420 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
426 # AIX does not have statfs.f_namelen
428 AC_DEFUN([LC_STRUCT_STATFS],
429 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
430 LB_LINUX_TRY_COMPILE([
431 #include <linux/vfs.h>
437 AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
444 # LC_READLINK_SSIZE_T
446 AC_DEFUN([LC_READLINK_SSIZE_T],
447 [AC_MSG_CHECKING([if readlink returns ssize_t])
451 ssize_t readlink(const char *, char *, size_t);
454 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
460 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
461 [AC_MSG_CHECKING([if kernel offers page_mapped])
462 LB_LINUX_TRY_COMPILE([
463 #include <linux/mm.h>
468 AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
474 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
475 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
476 LB_LINUX_TRY_COMPILE([
477 #include <linux/fs.h>
479 struct file_operations fops;
480 &fops.unlocked_ioctl;
483 AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
489 AC_DEFUN([LC_FILEMAP_POPULATE],
490 [AC_MSG_CHECKING([for exported filemap_populate])
491 LB_LINUX_TRY_COMPILE([
492 #include <asm/page.h>
493 #include <linux/mm.h>
495 filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
498 AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
504 AC_DEFUN([LC_D_ADD_UNIQUE],
505 [AC_MSG_CHECKING([for d_add_unique])
506 LB_LINUX_TRY_COMPILE([
507 #include <linux/dcache.h>
509 d_add_unique(NULL, NULL);
512 AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
518 AC_DEFUN([LC_BIT_SPINLOCK_H],
519 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
520 AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
521 LB_LINUX_TRY_COMPILE([
522 #include <asm/processor.h>
523 #include <linux/spinlock.h>
524 #include <linux/bit_spinlock.h>
527 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
538 # If we have xattr_acl.h
540 AC_DEFUN([LC_XATTR_ACL],
541 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
542 AC_MSG_CHECKING([if xattr_acl.h can be compiled])
543 LB_LINUX_TRY_COMPILE([
544 #include <linux/xattr_acl.h>
547 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
555 AC_DEFUN([LC_STRUCT_INTENT_FILE],
556 [AC_MSG_CHECKING([if struct open_intent has a file field])
557 LB_LINUX_TRY_COMPILE([
558 #include <linux/fs.h>
559 #include <linux/namei.h>
561 struct open_intent intent;
565 AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
572 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
573 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
574 AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
575 LB_LINUX_TRY_COMPILE([
576 #include <linux/posix_acl_xattr.h>
579 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
592 # starting from 2.6.19 linux kernel exports __iget()
594 AC_DEFUN([LC_EXPORT___IGET],
595 [LB_CHECK_SYMBOL_EXPORT([__iget],
597 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
603 # LC_EXPORT_NR_FREE_BUFFER_PAGES
604 # starting from 2.6.23 linux kernel exports nr_free_buffer_pages()
606 AC_DEFUN([LC_EXPORT_NR_FREE_BUFFER_PAGES],
607 [LB_CHECK_SYMBOL_EXPORT([nr_free_buffer_pages],
609 AC_DEFINE(HAVE_EXPORT_NR_FREE_BUFFER_PAGES, 1, [kernel exports nr_free_buffer_pages])
611 if test x$enable_server = xyes ; then
612 AC_MSG_ERROR([lustre server needs this symbol to be exported.])
618 AC_DEFUN([LC_LUSTRE_VERSION_H],
619 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
620 rm -f "$LUSTRE/include/linux/lustre_version.h"
622 touch "$LUSTRE/include/linux/lustre_version.h"
623 if test x$enable_server = xyes ; then
624 AC_MSG_WARN([Unpatched kernel detected.])
625 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
626 AC_MSG_WARN([disabling server build])
632 AC_DEFUN([LC_FUNC_SET_FS_PWD],
633 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
635 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
643 AC_DEFUN([LC_CAPA_CRYPTO],
644 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
645 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
647 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
648 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
650 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
651 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
655 AC_DEFUN([LC_SUNRPC_CACHE],
656 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
657 LB_LINUX_TRY_COMPILE([
658 #include <linux/sunrpc/cache.h>
660 struct cache_head ch;
664 AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
670 AC_DEFUN([LC_CONFIG_SUNRPC],
671 [LB_LINUX_CONFIG_IM([SUNRPC],[],
672 [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
677 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
679 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
680 [AC_MSG_CHECKING([whether to enable gss keyring backend])
681 AC_ARG_ENABLE([gss_keyring],
682 [AC_HELP_STRING([--disable-gss-keyring],
683 [disable gss keyring backend])],
684 [],[enable_gss_keyring='yes'])
685 AC_MSG_RESULT([$enable_gss_keyring])
687 if test x$enable_gss_keyring != xno; then
688 LB_LINUX_CONFIG_IM([KEYS],[],
689 [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
691 AC_CHECK_LIB([keyutils], [keyctl_search], [],
692 [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
694 AC_DEFINE([HAVE_GSS_KEYRING], [1],
695 [Define this if you enable gss keyring backend])
699 m4_pattern_allow(AC_KERBEROS_V5)
702 # LC_CONFIG_GSS (default disabled)
704 # Build gss and related tools of Lustre. Currently both kernel and user space
705 # parts are depend on linux platform.
707 AC_DEFUN([LC_CONFIG_GSS],
708 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
710 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
711 [],[enable_gss='no'])
712 AC_MSG_RESULT([$enable_gss])
714 if test x$enable_gss == xyes; then
715 LC_CONFIG_GSS_KEYRING
718 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
719 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
720 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
721 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
722 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
723 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
724 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
725 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
726 LB_LINUX_CONFIG_IM([CRYPTO_WP512],[],
727 [AC_MSG_WARN([kernel WP512 support is recommended by using GSS.])])
728 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],
729 [AC_MSG_WARN([kernel ARC4 support is recommended by using GSS.])])
730 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],
731 [AC_MSG_WARN([kernel DES support is recommended by using GSS.])])
732 LB_LINUX_CONFIG_IM([CRYPTO_TWOFISH],[],
733 [AC_MSG_WARN([kernel TWOFISH support is recommended by using GSS.])])
734 LB_LINUX_CONFIG_IM([CRYPTO_CAST6],[],
735 [AC_MSG_WARN([kernel CAST6 support is recommended by using GSS.])])
737 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
739 LB_LINUX_CONFIG_IM([CRYPTO_AES],[],
740 [AC_MSG_WARN([kernel AES support is recommended by using GSS.])])
742 AC_CHECK_LIB([gssapi], [gss_init_sec_context],
743 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
744 [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
745 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
746 [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
748 AC_SUBST(GSSAPI_LIBS)
754 # LC_FUNC_MS_FLOCK_LOCK
756 # SLES9 kernel has MS_FLOCK_LOCK sb flag
758 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
759 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
760 LB_LINUX_TRY_COMPILE([
761 #include <linux/fs.h>
763 int flags = MS_FLOCK_LOCK;
765 AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
766 [kernel has MS_FLOCK_LOCK flag])
774 # LC_FUNC_HAVE_CAN_SLEEP_ARG
776 # SLES9 kernel has third arg can_sleep
777 # in fs/locks.c: flock_lock_file_wait()
779 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
780 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
781 LB_LINUX_TRY_COMPILE([
782 #include <linux/fs.h>
786 struct file_lock *file_lock;
787 flock_lock_file_wait(file, file_lock, cansleep);
789 AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
790 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
800 # rhel4.2 kernel has f_op->flock field
802 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
803 [AC_MSG_CHECKING([if struct file_operations has flock field])
804 LB_LINUX_TRY_COMPILE([
805 #include <linux/fs.h>
807 struct file_operations ll_file_operations_flock;
808 ll_file_operations_flock.flock = NULL;
810 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
811 [struct file_operations has flock field])
821 # task struct has p_pptr instead of parent
823 AC_DEFUN([LC_TASK_PPTR],
824 [AC_MSG_CHECKING([task p_pptr found])
825 LB_LINUX_TRY_COMPILE([
826 #include <linux/sched.h>
828 struct task_struct *p;
833 AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
842 # rhel4.2 kernel has f_op->flock field
844 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
845 [AC_MSG_CHECKING([if struct file_operations has flock field])
846 LB_LINUX_TRY_COMPILE([
847 #include <linux/fs.h>
849 struct file_operations ll_file_operations_flock;
850 ll_file_operations_flock.flock = NULL;
852 AC_DEFINE(HAVE_F_OP_FLOCK, 1,
853 [struct file_operations has flock field])
861 # after 2.6.15 inode have i_mutex intead of i_sem
862 AC_DEFUN([LC_INODE_I_MUTEX],
863 [AC_MSG_CHECKING([use inode have i_mutex ])
864 LB_LINUX_TRY_COMPILE([
865 #include <linux/mutex.h>
866 #include <linux/fs.h>
871 mutex_unlock(&i.i_mutex);
874 AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
875 [after 2.6.15 inode have i_mutex intead of i_sem])
882 # SLES 9 uses a different name for this file - unsure about vanilla kernels
883 # around this version, but it matters for servers only.
884 AC_DEFUN([LC_SYMVERFILE],
885 [AC_MSG_CHECKING([name of symverfile])
886 if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost ; then
887 SYMVERFILE=Modules.symvers
889 SYMVERFILE=Module.symvers
891 AC_MSG_RESULT($SYMVERFILE)
892 AC_SUBST(SYMVERFILE)])
895 # after 2.6.17 dquote use mutex instead if semaphore
896 AC_DEFUN([LC_DQUOTOFF_MUTEX],
897 [AC_MSG_CHECKING([use dqonoff_mutex])
898 LB_LINUX_TRY_COMPILE([
899 #include <linux/mutex.h>
900 #include <linux/fs.h>
901 #include <linux/quota.h>
903 struct quota_info dq;
905 mutex_unlock(&dq.dqonoff_mutex);
908 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
909 [after 2.6.17 dquote use mutex instead if semaphore])
916 # LC_STATFS_DENTRY_PARAM
917 # starting from 2.6.18 linux kernel uses dentry instead of
918 # super_block for first vfs_statfs argument
920 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
921 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
922 LB_LINUX_TRY_COMPILE([
923 #include <linux/fs.h>
925 int vfs_statfs(struct dentry *, struct kstatfs *);
927 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
928 [first parameter of vfs_statfs is dentry])
937 # starting from 2.6.18 kernel don't export do_kern_mount
938 # and want to use vfs_kern_mount instead.
940 AC_DEFUN([LC_VFS_KERN_MOUNT],
941 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
942 LB_LINUX_TRY_COMPILE([
943 #include <linux/mount.h>
945 vfs_kern_mount(NULL, 0, NULL, NULL);
947 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
948 [vfs_kern_mount exist in kernel])
956 # LC_INVALIDATEPAGE_RETURN_INT
957 # more 2.6 api changes. return type for the invalidatepage
958 # address_space_operation is 'void' in new kernels but 'int' in old
960 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
961 [AC_MSG_CHECKING([invalidatepage has return int])
962 LB_LINUX_TRY_COMPILE([
963 #include <linux/buffer_head.h>
965 int rc = block_invalidatepage(NULL, 0);
968 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
969 [Define if return type of invalidatepage should be int])
975 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
976 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
977 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
978 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
979 tmp_flags="$EXTRA_KCFLAGS"
980 EXTRA_KCFLAGS="-Werror"
981 LB_LINUX_TRY_COMPILE([
982 #include <linux/fs.h>
985 static void cfg_umount_begin (struct vfsmount *v, int flags)
990 static struct super_operations cfg_super_operations = {
991 .umount_begin = cfg_umount_begin,
994 cfg_super_operations.umount_begin(NULL,0);
997 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
998 [Define umount_begin need second argument])
1002 EXTRA_KCFLAGS="$tmp_flags"
1005 # 2.6.19 API changes
1006 # inode don't have i_blksize field
1007 AC_DEFUN([LC_INODE_BLKSIZE],
1008 [AC_MSG_CHECKING([inode has i_blksize field])
1009 LB_LINUX_TRY_COMPILE([
1010 #include <linux/fs.h>
1016 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1017 [struct inode has i_blksize field])
1023 # LC_VFS_READDIR_U64_INO
1024 # 2.6.19 use u64 for inode number instead of inode_t
1025 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1026 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1027 tmp_flags="$EXTRA_KCFLAGS"
1028 EXTRA_KCFLAGS="-Werror"
1029 LB_LINUX_TRY_COMPILE([
1030 #include <linux/fs.h>
1031 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1032 u64 ino, unsigned int d_type)
1039 filter = fillonedir;
1043 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1044 [if vfs_readdir need 64bit inode number])
1048 EXTRA_KCFLAGS="$tmp_flags"
1051 # LC_GENERIC_FILE_WRITE
1052 # 2.6.19 introduce do_sync_write instead of
1053 # generic_file_write
1054 AC_DEFUN([LC_GENERIC_FILE_WRITE],
1055 [AC_MSG_CHECKING([use generic_file_write])
1056 LB_LINUX_TRY_COMPILE([
1057 #include <linux/fs.h>
1059 int result = generic_file_read(NULL, NULL, 0, 0);
1062 AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1063 [use generic_file_write])
1069 # LC_GENERIC_FILE_READ
1070 # 2.6.19 need to use do_sync_read instead of
1072 AC_DEFUN([LC_GENERIC_FILE_READ],
1073 [AC_MSG_CHECKING([use generic_file_read])
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_READ, 1,
1081 [use generic_file_read])
1088 # 2.6.18 don't export nr_pagecahe
1089 AC_DEFUN([LC_NR_PAGECACHE],
1090 [AC_MSG_CHECKING([kernel export nr_pagecache])
1091 LB_LINUX_TRY_COMPILE([
1092 #include <linux/pagemap.h>
1094 return atomic_read(&nr_pagecache);
1097 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1098 [is kernel export nr_pagecache])
1104 # LC_CANCEL_DIRTY_PAGE
1105 # 2.6.20 introduse cancel_dirty_page instead of
1107 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1108 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1109 LB_LINUX_TRY_COMPILE([
1110 #include <linux/page-flags.h>
1112 cancel_dirty_page(NULL, 0);
1115 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1116 [kernel has cancel_dirty_page instead of clear_page_dirty])
1125 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1126 # it support constant page, which means the page won't be modified during the
1129 AC_DEFUN([LC_PAGE_CONSTANT],
1130 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1131 LB_LINUX_TRY_COMPILE([
1132 #include <linux/page-flags.h>
1135 #error "Have no raid5 zcopy patch"
1139 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1145 # RHEL5 in FS-cache patch rename PG_checked flag
1147 AC_DEFUN([LC_PG_FS_MISC],
1148 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1149 LB_LINUX_TRY_COMPILE([
1150 #include <linux/page-flags.h>
1153 #error PG_fs_misc not defined in kernel
1157 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1158 [is kernel have PG_fs_misc])
1164 # RHEL5 PageChecked and SetPageChecked defined
1165 AC_DEFUN([LC_PAGE_CHECKED],
1166 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1167 LB_LINUX_TRY_COMPILE([
1168 #include <linux/page-flags.h>
1171 #error PageChecked not defined in kernel
1173 #ifndef SetPageChecked
1174 #error SetPageChecked not defined in kernel
1178 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1179 [does kernel have PageChecked and SetPageChecked])
1185 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1186 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1188 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1189 [kernel export truncate_complete_page])
1194 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1195 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1197 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1198 [d_rehash_cond is exported by the kernel])
1203 AC_DEFUN([LC_EXPORT___D_REHASH],
1204 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1206 AC_DEFINE(HAVE___D_REHASH, 1,
1207 [__d_rehash is exported by the kernel])
1212 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1213 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1215 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1216 [d_move_locked is exported by the kernel])
1221 AC_DEFUN([LC_EXPORT___D_MOVE],
1222 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1224 AC_DEFINE(HAVE___D_MOVE, 1,
1225 [__d_move is exported by the kernel])
1230 # The actual symbol exported varies among architectures, so we need
1231 # to check many symbols (but only in the current architecture.) No
1232 # matter what symbol is exported, the kernel #defines node_to_cpumask
1233 # to the appropriate function and that's what we use.
1234 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1235 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1236 [arch/$LINUX_ARCH/mm/numa.c],
1237 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1238 [node_to_cpumask is exported by
1239 the kernel])]) # x86_64
1240 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1241 [arch/$LINUX_ARCH/kernel/smpboot.c],
1242 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1243 [node_to_cpumask is exported by
1244 the kernel])]) # ia64
1245 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1246 [arch/$LINUX_ARCH/kernel/smpboot.c],
1247 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1248 [node_to_cpumask is exported by
1249 the kernel])]) # i386
1252 # 2.6.22 lost second parameter for invalidate_bdev
1253 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1254 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1255 LB_LINUX_TRY_COMPILE([
1256 #include <linux/buffer_head.h>
1258 invalidate_bdev(NULL,0);
1260 AC_MSG_RESULT([yes])
1261 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1262 [invalidate_bdev has second argument])
1268 # 2.6.23 have return type 'void' for unregister_blkdev
1269 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1270 [AC_MSG_CHECKING([if unregister_blkdev return int])
1271 LB_LINUX_TRY_COMPILE([
1272 #include <linux/fs.h>
1274 int i = unregister_blkdev(0,NULL);
1276 AC_MSG_RESULT([yes])
1277 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1278 [unregister_blkdev return int])
1284 # 2.6.23 change .sendfile to .splice_read
1285 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1286 [AC_MSG_CHECKING([if kernel has .splice_read])
1287 LB_LINUX_TRY_COMPILE([
1288 #include <linux/fs.h>
1290 struct file_operations file;
1292 file.splice_read = NULL;
1294 AC_MSG_RESULT([yes])
1295 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1296 [kernel has .slice_read])
1302 # 2.6.23 extract nfs export related data into exportfs.h
1303 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1306 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1307 AC_CHECK_HEADERS([linux/exportfs.h])
1312 # LC_VFS_INTENT_PATCHES
1314 # check if the kernel has the VFS intent patches
1315 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1316 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1317 LB_LINUX_TRY_COMPILE([
1318 #include <linux/fs.h>
1319 #include <linux/namei.h>
1321 struct nameidata nd;
1322 struct lookup_intent *it;
1325 intent_init(it, IT_OPEN);
1326 it->d.lustre.it_disposition = 0;
1327 it->d.lustre.it_data = NULL;
1329 AC_MSG_RESULT([yes])
1330 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1336 AC_DEFUN([LC_S_TIME_GRAN],
1337 [AC_MSG_CHECKING([if super block has s_time_gran member])
1338 LB_LINUX_TRY_COMPILE([
1339 #include <linux/fs.h>
1341 struct super_block sb;
1343 return sb.s_time_gran;
1345 AC_MSG_RESULT([yes])
1346 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1352 AC_DEFUN([LC_SB_TIME_GRAN],
1353 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1354 LB_LINUX_TRY_COMPILE([
1355 #include <linux/fs.h>
1357 return get_sb_time_gran(NULL);
1359 AC_MSG_RESULT([yes])
1360 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1367 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1368 AC_DEFUN([LC_RW_TREE_LOCK],
1369 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1370 tmp_flags="$EXTRA_KCFLAGS"
1371 EXTRA_KCFLAGS="-Werror"
1372 LB_LINUX_TRY_COMPILE([
1373 #include <linux/fs.h>
1375 struct address_space a;
1377 write_lock(&a.tree_lock);
1379 AC_MSG_RESULT([yes])
1380 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1384 EXTRA_KCFLAGS="$tmp_flags"
1387 AC_DEFUN([LC_CONST_ACL_SIZE],
1388 [AC_MSG_CHECKING([calc acl size])
1390 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1393 #include <linux/autoconf.h>
1394 #include <linux/types.h>
1397 #define __LINUX_POSIX_ACL_H
1399 # ifdef CONFIG_FS_POSIX_ACL
1400 # ifdef HAVE_XATTR_ACL
1401 # include <linux/xattr_acl.h>
1403 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1404 # include <linux/posix_acl_xattr.h>
1408 #include <linux/lustre_acl.h>
1414 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1415 FILE *f = fopen("acl.size","w+");
1416 fprintf(f,"%d", size);
1423 acl_size=`cat acl.size`
1424 AC_MSG_RESULT([ACL size $acl_size])
1425 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1427 AC_ERROR([ACL size can't computed])
1433 # check for crypto API
1435 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1436 [AC_MSG_CHECKING([if kernel has block cipher support])
1437 LB_LINUX_TRY_COMPILE([
1438 #include <linux/crypto.h>
1440 int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1442 AC_MSG_RESULT([yes])
1443 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1450 # check for FS_RENAME_DOES_D_MOVE flag
1452 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1453 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1454 LB_LINUX_TRY_COMPILE([
1455 #include <linux/fs.h>
1457 int v = FS_RENAME_DOES_D_MOVE;
1459 AC_MSG_RESULT([yes])
1460 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1469 # Lustre linux kernel checks
1471 AC_DEFUN([LC_PROG_LINUX],
1472 [LC_LUSTRE_VERSION_H
1473 if test x$enable_server = xyes ; then
1474 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1479 LC_CONFIG_LIBLUSTRE_RECOVERY
1481 LC_CONFIG_HEALTH_CHECK_WRITE
1482 LC_CONFIG_LRU_RESIZE
1486 LC_EXPORT_TRUNCATE_COMPLETE
1487 LC_EXPORT_D_REHASH_COND
1488 LC_EXPORT___D_REHASH
1489 LC_EXPORT_D_MOVE_LOCKED
1491 LC_EXPORT_NODE_TO_CPUMASK
1494 LC_FUNC_COND_RESCHED
1495 LC_FUNC_ZAP_PAGE_RANGE
1500 LC_FUNC_REGISTER_CACHE
1501 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1502 LC_FUNC_DEV_SET_RDONLY
1503 LC_FUNC_FILEMAP_FDATAWRITE
1506 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1512 LC_POSIX_ACL_XATTR_H
1515 LC_STRUCT_INTENT_FILE
1520 LC_FUNC_MS_FLOCK_LOCK
1521 LC_FUNC_HAVE_CAN_SLEEP_ARG
1524 LC_COOKIE_FOLLOW_LINK
1527 # does the kernel have VFS intent patches?
1528 LC_VFS_INTENT_PATCHES
1540 # SLES 10 (at least)
1548 LC_STATFS_DENTRY_PARAM
1550 LC_INVALIDATEPAGE_RETURN_INT
1551 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1553 #2.6.18 + RHEL5 (fc6)
1559 LC_VFS_READDIR_U64_INO
1560 LC_GENERIC_FILE_READ
1561 LC_GENERIC_FILE_WRITE
1564 LC_CANCEL_DIRTY_PAGE
1566 # raid5-zerocopy patch
1570 LC_INVALIDATE_BDEV_2ARG
1571 LC_ASYNC_BLOCK_CIPHER
1572 LC_FS_RENAME_DOES_D_MOVE
1574 LC_UNREGISTER_BLKDEV_RETURN_INT
1575 LC_KERNEL_SPLICE_READ
1577 LC_EXPORT_NR_FREE_BUFFER_PAGES
1581 # LC_CONFIG_CLIENT_SERVER
1583 # Build client/server sides of Lustre
1585 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1586 [AC_MSG_CHECKING([whether to build Lustre server support])
1587 AC_ARG_ENABLE([server],
1588 AC_HELP_STRING([--disable-server],
1589 [disable Lustre server support]),
1590 [],[enable_server='yes'])
1591 AC_MSG_RESULT([$enable_server])
1593 AC_MSG_CHECKING([whether to build Lustre client support])
1594 AC_ARG_ENABLE([client],
1595 AC_HELP_STRING([--disable-client],
1596 [disable Lustre client support]),
1597 [],[enable_client='yes'])
1598 AC_MSG_RESULT([$enable_client])])
1601 # LC_CONFIG_LIBLUSTRE
1603 # whether to build liblustre
1605 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1606 [AC_MSG_CHECKING([whether to build Lustre library])
1607 AC_ARG_ENABLE([liblustre],
1608 AC_HELP_STRING([--disable-liblustre],
1609 [disable building of Lustre library]),
1610 [],[enable_liblustre=$with_sysio])
1611 AC_MSG_RESULT([$enable_liblustre])
1612 # only build sysio if liblustre is built
1613 with_sysio="$enable_liblustre"
1615 AC_MSG_CHECKING([whether to build liblustre tests])
1616 AC_ARG_ENABLE([liblustre-tests],
1617 AC_HELP_STRING([--enable-liblustre-tests],
1618 [enable liblustre tests, if --disable-tests is used]),
1619 [],[enable_liblustre_tests=$enable_tests])
1620 if test x$enable_liblustre != xyes ; then
1621 enable_liblustre_tests='no'
1623 AC_MSG_RESULT([$enable_liblustre_tests])
1625 AC_MSG_CHECKING([whether to enable liblustre acl])
1626 AC_ARG_ENABLE([liblustre-acl],
1627 AC_HELP_STRING([--disable-liblustre-acl],
1628 [disable ACL support for liblustre]),
1629 [],[enable_liblustre_acl=yes])
1630 if test x$enable_liblustre != xyes ; then
1631 enable_liblustre_acl='no'
1633 AC_MSG_RESULT([$enable_liblustre_acl])
1634 if test x$enable_liblustre_acl != xno ; then
1635 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1638 AC_MSG_CHECKING([whether to build mpitests])
1639 AC_ARG_ENABLE([mpitests],
1640 AC_HELP_STRING([--enable-mpitests],
1641 [build liblustre mpi tests]),
1642 [],[enable_mpitests=no])
1643 AC_MSG_RESULT([$enable_mpitests])
1645 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1646 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1649 LC_CONFIG_LIBLUSTRE_RECOVERY
1652 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1653 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1654 AC_ARG_ENABLE([lru_resize],
1655 AC_HELP_STRING([--enable-lru-resize],
1656 [enable lru resize support]),
1657 [],[enable_lru_resize='yes'])
1658 AC_MSG_RESULT([$enable_lru_resize])
1659 if test x$enable_lru_resize != xno; then
1660 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1667 # whether to enable quota support
1669 AC_DEFUN([LC_CONFIG_QUOTA],
1670 [AC_MSG_CHECKING([whether to disable quota support])
1671 AC_ARG_ENABLE([quota],
1672 AC_HELP_STRING([--disable-quota],
1673 [disable quota support]),
1674 [],[enable_quota='yes'])
1675 AC_MSG_RESULT([$enable_quota])
1676 if test x$linux25 != xyes; then
1679 if test x$enable_quota != xno; then
1680 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1687 # whether to enable split support
1689 AC_DEFUN([LC_CONFIG_SPLIT],
1690 [AC_MSG_CHECKING([whether to enable split support])
1691 AC_ARG_ENABLE([split],
1692 AC_HELP_STRING([--enable-split],
1693 [enable split support]),
1694 [],[enable_split='no'])
1695 AC_MSG_RESULT([$enable_split])
1696 if test x$enable_split != xno; then
1697 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1701 AC_DEFUN([LC_QUOTA_READ],
1702 [AC_MSG_CHECKING([if kernel supports quota_read])
1703 LB_LINUX_TRY_COMPILE([
1704 #include <linux/fs.h>
1706 struct super_operations sp;
1707 void *i = (void *)sp.quota_read;
1709 AC_MSG_RESULT([yes])
1710 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1717 # LC_COOKIE_FOLLOW_LINK
1719 # kernel 2.6.13+ ->follow_link returns a cookie
1722 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1723 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1724 LB_LINUX_TRY_COMPILE([
1725 #include <linux/fs.h>
1726 #include <linux/namei.h>
1728 struct dentry dentry;
1729 struct nameidata nd;
1731 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1733 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1734 AC_MSG_RESULT([yes])
1743 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1744 # call_rcu takes three parameters.
1746 AC_DEFUN([LC_FUNC_RCU],
1747 [AC_MSG_CHECKING([if kernel have RCU supported])
1748 LB_LINUX_TRY_COMPILE([
1749 #include <linux/rcupdate.h>
1751 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1752 AC_MSG_RESULT([yes])
1754 AC_MSG_CHECKING([if call_rcu takes three parameters])
1755 LB_LINUX_TRY_COMPILE([
1756 #include <linux/rcupdate.h>
1759 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1761 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1762 AC_MSG_RESULT([yes])
1774 # other configure checks
1776 AC_DEFUN([LC_CONFIGURE],
1777 [LC_CONFIG_OBD_BUFFER_SIZE
1779 # include/liblustre.h
1780 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1782 # include/lustre/lustre_user.h
1783 # See note there re: __ASM_X86_64_PROCESSOR_H
1784 AC_CHECK_HEADERS([linux/fs.h linux/quota.h])
1786 # liblustre/llite_lib.h
1787 AC_CHECK_HEADERS([xtio.h file.h])
1790 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1793 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1794 AC_CHECK_FUNCS([inet_ntoa])
1796 # libsysio/src/readlink.c
1799 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1800 AC_CHECK_HEADERS([linux/random.h], [], [],
1801 [#ifdef HAVE_LINUX_TYPES_H
1802 # include <linux/types.h>
1807 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1809 # check for -lz support
1813 [AC_CHECK_HEADERS([zlib.h],
1815 AC_DEFINE([HAVE_ADLER], 1,
1816 [support alder32 checksum type])],
1817 [AC_MSG_WARN([No zlib-devel package found,
1818 unable to use adler32 checksum])])],
1819 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1824 AC_ARG_ENABLE([mindf],
1825 AC_HELP_STRING([--enable-mindf],
1826 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1828 if test "$enable_mindf" = "yes" ; then
1829 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1832 AC_ARG_ENABLE([fail_alloc],
1833 AC_HELP_STRING([--disable-fail-alloc],
1834 [disable randomly alloc failure]),
1835 [],[enable_fail_alloc=yes])
1836 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1837 AC_MSG_RESULT([$enable_fail_alloc])
1838 if test x$enable_fail_alloc != xno ; then
1839 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1847 # AM_CONDITIONALS for lustre
1849 AC_DEFUN([LC_CONDITIONALS],
1850 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1851 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1852 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1853 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1854 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1855 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1856 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1857 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1858 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1859 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1860 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1861 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1862 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1863 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1869 # files that should be generated with AC_OUTPUT
1871 AC_DEFUN([LC_CONFIG_FILES],
1875 lustre/autoconf/Makefile
1876 lustre/contrib/Makefile
1878 lustre/include/Makefile
1879 lustre/include/lustre_ver.h
1880 lustre/include/linux/Makefile
1881 lustre/include/lustre/Makefile
1882 lustre/kernel_patches/targets/2.6-vanilla.target
1883 lustre/kernel_patches/targets/2.6-rhel4.target
1884 lustre/kernel_patches/targets/2.6-rhel5.target
1885 lustre/kernel_patches/targets/2.6-fc5.target
1886 lustre/kernel_patches/targets/2.6-patchless.target
1887 lustre/kernel_patches/targets/2.6-sles10.target
1888 lustre/ldlm/Makefile
1890 lustre/fid/autoMakefile
1891 lustre/liblustre/Makefile
1892 lustre/liblustre/tests/Makefile
1893 lustre/llite/Makefile
1894 lustre/llite/autoMakefile
1896 lustre/lov/autoMakefile
1897 lustre/lvfs/Makefile
1898 lustre/lvfs/autoMakefile
1900 lustre/mdc/autoMakefile
1902 lustre/lmv/autoMakefile
1904 lustre/mds/autoMakefile
1906 lustre/mdt/autoMakefile
1908 lustre/cmm/autoMakefile
1910 lustre/mdd/autoMakefile
1912 lustre/fld/autoMakefile
1913 lustre/obdclass/Makefile
1914 lustre/obdclass/autoMakefile
1915 lustre/obdclass/linux/Makefile
1916 lustre/obdecho/Makefile
1917 lustre/obdecho/autoMakefile
1918 lustre/obdfilter/Makefile
1919 lustre/obdfilter/autoMakefile
1921 lustre/osc/autoMakefile
1923 lustre/ost/autoMakefile
1925 lustre/osd/autoMakefile
1927 lustre/mgc/autoMakefile
1929 lustre/mgs/autoMakefile
1930 lustre/ptlrpc/Makefile
1931 lustre/ptlrpc/autoMakefile
1932 lustre/ptlrpc/gss/Makefile
1933 lustre/ptlrpc/gss/autoMakefile
1934 lustre/quota/Makefile
1935 lustre/quota/autoMakefile
1936 lustre/scripts/Makefile
1937 lustre/scripts/version_tag.pl
1938 lustre/tests/Makefile
1939 lustre/utils/Makefile
1940 lustre/utils/gss/Makefile
1942 case $lb_target_os in
1944 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])