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 # after 2.6.17 dquote use mutex instead if semaphore
883 AC_DEFUN([LC_DQUOTOFF_MUTEX],
884 [AC_MSG_CHECKING([use dqonoff_mutex])
885 LB_LINUX_TRY_COMPILE([
886 #include <linux/mutex.h>
887 #include <linux/fs.h>
888 #include <linux/quota.h>
890 struct quota_info dq;
892 mutex_unlock(&dq.dqonoff_mutex);
895 AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
896 [after 2.6.17 dquote use mutex instead if semaphore])
903 # LC_STATFS_DENTRY_PARAM
904 # starting from 2.6.18 linux kernel uses dentry instead of
905 # super_block for first vfs_statfs argument
907 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
908 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
909 LB_LINUX_TRY_COMPILE([
910 #include <linux/fs.h>
912 int vfs_statfs(struct dentry *, struct kstatfs *);
914 AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
915 [first parameter of vfs_statfs is dentry])
924 # starting from 2.6.18 kernel don't export do_kern_mount
925 # and want to use vfs_kern_mount instead.
927 AC_DEFUN([LC_VFS_KERN_MOUNT],
928 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
929 LB_LINUX_TRY_COMPILE([
930 #include <linux/mount.h>
932 vfs_kern_mount(NULL, 0, NULL, NULL);
934 AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
935 [vfs_kern_mount exist in kernel])
943 # LC_INVALIDATEPAGE_RETURN_INT
944 # more 2.6 api changes. return type for the invalidatepage
945 # address_space_operation is 'void' in new kernels but 'int' in old
947 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
948 [AC_MSG_CHECKING([invalidatepage has return int])
949 LB_LINUX_TRY_COMPILE([
950 #include <linux/buffer_head.h>
952 int rc = block_invalidatepage(NULL, 0);
955 AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
956 [Define if return type of invalidatepage should be int])
962 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
963 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
964 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
965 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
966 tmp_flags="$EXTRA_KCFLAGS"
967 EXTRA_KCFLAGS="-Werror"
968 LB_LINUX_TRY_COMPILE([
969 #include <linux/fs.h>
972 static void cfg_umount_begin (struct vfsmount *v, int flags)
977 static struct super_operations cfg_super_operations = {
978 .umount_begin = cfg_umount_begin,
981 cfg_super_operations.umount_begin(NULL,0);
984 AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
985 [Define umount_begin need second argument])
989 EXTRA_KCFLAGS="$tmp_flags"
993 # inode don't have i_blksize field
994 AC_DEFUN([LC_INODE_BLKSIZE],
995 [AC_MSG_CHECKING([inode has i_blksize field])
996 LB_LINUX_TRY_COMPILE([
997 #include <linux/fs.h>
1003 AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1004 [struct inode has i_blksize field])
1010 # LC_VFS_READDIR_U64_INO
1011 # 2.6.19 use u64 for inode number instead of inode_t
1012 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1013 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1014 tmp_flags="$EXTRA_KCFLAGS"
1015 EXTRA_KCFLAGS="-Werror"
1016 LB_LINUX_TRY_COMPILE([
1017 #include <linux/fs.h>
1018 int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1019 u64 ino, unsigned int d_type)
1026 filter = fillonedir;
1030 AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1031 [if vfs_readdir need 64bit inode number])
1035 EXTRA_KCFLAGS="$tmp_flags"
1038 # LC_GENERIC_FILE_WRITE
1039 # 2.6.19 introduce do_sync_write instead of
1040 # generic_file_write
1041 AC_DEFUN([LC_GENERIC_FILE_WRITE],
1042 [AC_MSG_CHECKING([use generic_file_write])
1043 LB_LINUX_TRY_COMPILE([
1044 #include <linux/fs.h>
1046 int result = generic_file_read(NULL, NULL, 0, 0);
1049 AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1050 [use generic_file_write])
1056 # LC_GENERIC_FILE_READ
1057 # 2.6.19 need to use do_sync_read instead of
1059 AC_DEFUN([LC_GENERIC_FILE_READ],
1060 [AC_MSG_CHECKING([use generic_file_read])
1061 LB_LINUX_TRY_COMPILE([
1062 #include <linux/fs.h>
1064 int result = generic_file_read(NULL, NULL, 0, 0);
1067 AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
1068 [use generic_file_read])
1075 # 2.6.18 don't export nr_pagecahe
1076 AC_DEFUN([LC_NR_PAGECACHE],
1077 [AC_MSG_CHECKING([kernel export nr_pagecache])
1078 LB_LINUX_TRY_COMPILE([
1079 #include <linux/pagemap.h>
1081 return atomic_read(&nr_pagecache);
1084 AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1085 [is kernel export nr_pagecache])
1091 # LC_CANCEL_DIRTY_PAGE
1092 # 2.6.20 introduse cancel_dirty_page instead of
1094 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1095 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1096 LB_LINUX_TRY_COMPILE([
1097 #include <linux/page-flags.h>
1099 cancel_dirty_page(NULL, 0);
1102 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1103 [kernel has cancel_dirty_page instead of clear_page_dirty])
1112 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1113 # it support constant page, which means the page won't be modified during the
1116 AC_DEFUN([LC_PAGE_CONSTANT],
1117 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1118 LB_LINUX_TRY_COMPILE([
1119 #include <linux/page-flags.h>
1122 #error "Have no raid5 zcopy patch"
1126 AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1132 # RHEL5 in FS-cache patch rename PG_checked flag
1134 AC_DEFUN([LC_PG_FS_MISC],
1135 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1136 LB_LINUX_TRY_COMPILE([
1137 #include <linux/page-flags.h>
1140 #error PG_fs_misc not defined in kernel
1144 AC_DEFINE(HAVE_PG_FS_MISC, 1,
1145 [is kernel have PG_fs_misc])
1151 # RHEL5 PageChecked and SetPageChecked defined
1152 AC_DEFUN([LC_PAGE_CHECKED],
1153 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1154 LB_LINUX_TRY_COMPILE([
1155 #include <linux/page-flags.h>
1158 #error PageChecked not defined in kernel
1160 #ifndef SetPageChecked
1161 #error SetPageChecked not defined in kernel
1165 AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1166 [does kernel have PageChecked and SetPageChecked])
1172 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1173 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1175 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1176 [kernel export truncate_complete_page])
1181 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1182 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1184 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1185 [d_rehash_cond is exported by the kernel])
1190 AC_DEFUN([LC_EXPORT___D_REHASH],
1191 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1193 AC_DEFINE(HAVE___D_REHASH, 1,
1194 [__d_rehash is exported by the kernel])
1199 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1200 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1202 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1203 [d_move_locked is exported by the kernel])
1208 AC_DEFUN([LC_EXPORT___D_MOVE],
1209 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1211 AC_DEFINE(HAVE___D_MOVE, 1,
1212 [__d_move is exported by the kernel])
1217 # The actual symbol exported varies among architectures, so we need
1218 # to check many symbols (but only in the current architecture.) No
1219 # matter what symbol is exported, the kernel #defines node_to_cpumask
1220 # to the appropriate function and that's what we use.
1221 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1222 [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1223 [arch/$LINUX_ARCH/mm/numa.c],
1224 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1225 [node_to_cpumask is exported by
1226 the kernel])]) # x86_64
1227 LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1228 [arch/$LINUX_ARCH/kernel/smpboot.c],
1229 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1230 [node_to_cpumask is exported by
1231 the kernel])]) # ia64
1232 LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1233 [arch/$LINUX_ARCH/kernel/smpboot.c],
1234 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1235 [node_to_cpumask is exported by
1236 the kernel])]) # i386
1239 # 2.6.22 lost second parameter for invalidate_bdev
1240 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1241 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1242 LB_LINUX_TRY_COMPILE([
1243 #include <linux/buffer_head.h>
1245 invalidate_bdev(NULL,0);
1247 AC_MSG_RESULT([yes])
1248 AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1249 [invalidate_bdev has second argument])
1255 # 2.6.23 have return type 'void' for unregister_blkdev
1256 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1257 [AC_MSG_CHECKING([if unregister_blkdev return int])
1258 LB_LINUX_TRY_COMPILE([
1259 #include <linux/fs.h>
1261 int i = unregister_blkdev(0,NULL);
1263 AC_MSG_RESULT([yes])
1264 AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1265 [unregister_blkdev return int])
1271 # 2.6.23 change .sendfile to .splice_read
1272 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1273 [AC_MSG_CHECKING([if kernel has .splice_read])
1274 LB_LINUX_TRY_COMPILE([
1275 #include <linux/fs.h>
1277 struct file_operations file;
1279 file.splice_read = NULL;
1281 AC_MSG_RESULT([yes])
1282 AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1283 [kernel has .slice_read])
1289 # 2.6.23 extract nfs export related data into exportfs.h
1290 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1293 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1294 AC_CHECK_HEADERS([linux/exportfs.h])
1299 # LC_VFS_INTENT_PATCHES
1301 # check if the kernel has the VFS intent patches
1302 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1303 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1304 LB_LINUX_TRY_COMPILE([
1305 #include <linux/fs.h>
1306 #include <linux/namei.h>
1308 struct nameidata nd;
1309 struct lookup_intent *it;
1312 intent_init(it, IT_OPEN);
1313 it->d.lustre.it_disposition = 0;
1314 it->d.lustre.it_data = NULL;
1316 AC_MSG_RESULT([yes])
1317 AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1323 AC_DEFUN([LC_S_TIME_GRAN],
1324 [AC_MSG_CHECKING([if super block has s_time_gran member])
1325 LB_LINUX_TRY_COMPILE([
1326 #include <linux/fs.h>
1328 struct super_block sb;
1330 return sb.s_time_gran;
1332 AC_MSG_RESULT([yes])
1333 AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1339 AC_DEFUN([LC_SB_TIME_GRAN],
1340 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1341 LB_LINUX_TRY_COMPILE([
1342 #include <linux/fs.h>
1344 return get_sb_time_gran(NULL);
1346 AC_MSG_RESULT([yes])
1347 AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1354 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1355 AC_DEFUN([LC_RW_TREE_LOCK],
1356 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1357 tmp_flags="$EXTRA_KCFLAGS"
1358 EXTRA_KCFLAGS="-Werror"
1359 LB_LINUX_TRY_COMPILE([
1360 #include <linux/fs.h>
1362 struct address_space a;
1364 write_lock(&a.tree_lock);
1366 AC_MSG_RESULT([yes])
1367 AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1371 EXTRA_KCFLAGS="$tmp_flags"
1374 AC_DEFUN([LC_CONST_ACL_SIZE],
1375 [AC_MSG_CHECKING([calc acl size])
1377 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1380 #include <linux/autoconf.h>
1381 #include <linux/types.h>
1384 #define __LINUX_POSIX_ACL_H
1386 # ifdef CONFIG_FS_POSIX_ACL
1387 # ifdef HAVE_XATTR_ACL
1388 # include <linux/xattr_acl.h>
1390 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1391 # include <linux/posix_acl_xattr.h>
1395 #include <linux/lustre_acl.h>
1401 int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1402 FILE *f = fopen("acl.size","w+");
1403 fprintf(f,"%d", size);
1410 acl_size=`cat acl.size`
1411 AC_MSG_RESULT([ACL size $acl_size])
1412 AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1414 AC_ERROR([ACL size can't computed])
1420 # check for crypto API
1422 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1423 [AC_MSG_CHECKING([if kernel has block cipher support])
1424 LB_LINUX_TRY_COMPILE([
1425 #include <linux/crypto.h>
1427 int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1429 AC_MSG_RESULT([yes])
1430 AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1437 # check for FS_RENAME_DOES_D_MOVE flag
1439 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1440 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1441 LB_LINUX_TRY_COMPILE([
1442 #include <linux/fs.h>
1444 int v = FS_RENAME_DOES_D_MOVE;
1446 AC_MSG_RESULT([yes])
1447 AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1456 # Lustre linux kernel checks
1458 AC_DEFUN([LC_PROG_LINUX],
1459 [LC_LUSTRE_VERSION_H
1460 if test x$enable_server = xyes ; then
1461 AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1466 LC_CONFIG_LIBLUSTRE_RECOVERY
1468 LC_CONFIG_HEALTH_CHECK_WRITE
1469 LC_CONFIG_LRU_RESIZE
1473 LC_EXPORT_TRUNCATE_COMPLETE
1474 LC_EXPORT_D_REHASH_COND
1475 LC_EXPORT___D_REHASH
1476 LC_EXPORT_D_MOVE_LOCKED
1478 LC_EXPORT_NODE_TO_CPUMASK
1481 LC_FUNC_COND_RESCHED
1482 LC_FUNC_ZAP_PAGE_RANGE
1487 LC_FUNC_REGISTER_CACHE
1488 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1489 LC_FUNC_DEV_SET_RDONLY
1490 LC_FUNC_FILEMAP_FDATAWRITE
1493 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1499 LC_POSIX_ACL_XATTR_H
1502 LC_STRUCT_INTENT_FILE
1507 LC_FUNC_MS_FLOCK_LOCK
1508 LC_FUNC_HAVE_CAN_SLEEP_ARG
1511 LC_COOKIE_FOLLOW_LINK
1514 # does the kernel have VFS intent patches?
1515 LC_VFS_INTENT_PATCHES
1532 LC_STATFS_DENTRY_PARAM
1534 LC_INVALIDATEPAGE_RETURN_INT
1535 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1537 #2.6.18 + RHEL5 (fc6)
1543 LC_VFS_READDIR_U64_INO
1544 LC_GENERIC_FILE_READ
1545 LC_GENERIC_FILE_WRITE
1548 LC_CANCEL_DIRTY_PAGE
1550 # raid5-zerocopy patch
1554 LC_INVALIDATE_BDEV_2ARG
1555 LC_ASYNC_BLOCK_CIPHER
1556 LC_FS_RENAME_DOES_D_MOVE
1558 LC_UNREGISTER_BLKDEV_RETURN_INT
1559 LC_KERNEL_SPLICE_READ
1561 LC_EXPORT_NR_FREE_BUFFER_PAGES
1565 # LC_CONFIG_CLIENT_SERVER
1567 # Build client/server sides of Lustre
1569 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1570 [AC_MSG_CHECKING([whether to build Lustre server support])
1571 AC_ARG_ENABLE([server],
1572 AC_HELP_STRING([--disable-server],
1573 [disable Lustre server support]),
1574 [],[enable_server='yes'])
1575 AC_MSG_RESULT([$enable_server])
1577 AC_MSG_CHECKING([whether to build Lustre client support])
1578 AC_ARG_ENABLE([client],
1579 AC_HELP_STRING([--disable-client],
1580 [disable Lustre client support]),
1581 [],[enable_client='yes'])
1582 AC_MSG_RESULT([$enable_client])])
1585 # LC_CONFIG_LIBLUSTRE
1587 # whether to build liblustre
1589 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1590 [AC_MSG_CHECKING([whether to build Lustre library])
1591 AC_ARG_ENABLE([liblustre],
1592 AC_HELP_STRING([--disable-liblustre],
1593 [disable building of Lustre library]),
1594 [],[enable_liblustre=$with_sysio])
1595 AC_MSG_RESULT([$enable_liblustre])
1596 # only build sysio if liblustre is built
1597 with_sysio="$enable_liblustre"
1599 AC_MSG_CHECKING([whether to build liblustre tests])
1600 AC_ARG_ENABLE([liblustre-tests],
1601 AC_HELP_STRING([--enable-liblustre-tests],
1602 [enable liblustre tests, if --disable-tests is used]),
1603 [],[enable_liblustre_tests=$enable_tests])
1604 if test x$enable_liblustre != xyes ; then
1605 enable_liblustre_tests='no'
1607 AC_MSG_RESULT([$enable_liblustre_tests])
1609 AC_MSG_CHECKING([whether to enable liblustre acl])
1610 AC_ARG_ENABLE([liblustre-acl],
1611 AC_HELP_STRING([--disable-liblustre-acl],
1612 [disable ACL support for liblustre]),
1613 [],[enable_liblustre_acl=yes])
1614 AC_MSG_RESULT([$enable_liblustre_acl])
1615 if test x$enable_liblustre_acl = xyes ; then
1616 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1619 AC_MSG_CHECKING([whether to build mpitests])
1620 AC_ARG_ENABLE([mpitests],
1621 AC_HELP_STRING([--enable-mpitests],
1622 [build liblustre mpi tests]),
1623 [],[enable_mpitests=no])
1624 AC_MSG_RESULT([$enable_mpitests])
1626 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1627 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1630 LC_CONFIG_LIBLUSTRE_RECOVERY
1633 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1634 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1635 AC_ARG_ENABLE([lru_resize],
1636 AC_HELP_STRING([--enable-lru-resize],
1637 [enable lru resize support]),
1638 [],[enable_lru_resize='yes'])
1639 AC_MSG_RESULT([$enable_lru_resize])
1640 if test x$enable_lru_resize != xno; then
1641 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1648 # whether to enable quota support
1650 AC_DEFUN([LC_CONFIG_QUOTA],
1651 [AC_MSG_CHECKING([whether to disable quota support])
1652 AC_ARG_ENABLE([quota],
1653 AC_HELP_STRING([--disable-quota],
1654 [disable quota support]),
1655 [],[enable_quota='yes'])
1656 AC_MSG_RESULT([$enable_quota])
1657 if test x$linux25 != xyes; then
1660 if test x$enable_quota != xno; then
1661 AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1668 # whether to enable split support
1670 AC_DEFUN([LC_CONFIG_SPLIT],
1671 [AC_MSG_CHECKING([whether to enable split support])
1672 AC_ARG_ENABLE([split],
1673 AC_HELP_STRING([--enable-split],
1674 [enable split support]),
1675 [],[enable_split='no'])
1676 AC_MSG_RESULT([$enable_split])
1677 if test x$enable_split != xno; then
1678 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1682 AC_DEFUN([LC_QUOTA_READ],
1683 [AC_MSG_CHECKING([if kernel supports quota_read])
1684 LB_LINUX_TRY_COMPILE([
1685 #include <linux/fs.h>
1687 struct super_operations sp;
1688 void *i = (void *)sp.quota_read;
1690 AC_MSG_RESULT([yes])
1691 AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1698 # LC_COOKIE_FOLLOW_LINK
1700 # kernel 2.6.13+ ->follow_link returns a cookie
1703 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1704 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1705 LB_LINUX_TRY_COMPILE([
1706 #include <linux/fs.h>
1707 #include <linux/namei.h>
1709 struct dentry dentry;
1710 struct nameidata nd;
1712 dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1714 AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1715 AC_MSG_RESULT([yes])
1724 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
1725 # call_rcu takes three parameters.
1727 AC_DEFUN([LC_FUNC_RCU],
1728 [AC_MSG_CHECKING([if kernel have RCU supported])
1729 LB_LINUX_TRY_COMPILE([
1730 #include <linux/rcupdate.h>
1732 AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1733 AC_MSG_RESULT([yes])
1735 AC_MSG_CHECKING([if call_rcu takes three parameters])
1736 LB_LINUX_TRY_COMPILE([
1737 #include <linux/rcupdate.h>
1740 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1742 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1743 AC_MSG_RESULT([yes])
1755 # other configure checks
1757 AC_DEFUN([LC_CONFIGURE],
1758 [LC_CONFIG_OBD_BUFFER_SIZE
1760 # include/liblustre.h
1761 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1763 # include/lustre/lustre_user.h
1764 # See note there re: __ASM_X86_64_PROCESSOR_H
1765 AC_CHECK_HEADERS([linux/fs.h linux/quota.h])
1767 # liblustre/llite_lib.h
1768 AC_CHECK_HEADERS([xtio.h file.h])
1771 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1774 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1775 AC_CHECK_FUNCS([inet_ntoa])
1777 # libsysio/src/readlink.c
1780 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1781 AC_CHECK_HEADERS([linux/random.h], [], [],
1782 [#ifdef HAVE_LINUX_TYPES_H
1783 # include <linux/types.h>
1788 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1790 # check for -lz support
1794 [AC_CHECK_HEADERS([zlib.h],
1796 AC_DEFINE([HAVE_ADLER], 1,
1797 [support alder32 checksum type])],
1798 [AC_MSG_WARN([No zlib-devel package found,
1799 unable to use adler32 checksum])])],
1800 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1805 AC_ARG_ENABLE([mindf],
1806 AC_HELP_STRING([--enable-mindf],
1807 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1809 if test "$enable_mindf" = "yes" ; then
1810 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1813 AC_ARG_ENABLE([fail_alloc],
1814 AC_HELP_STRING([--disable-fail-alloc],
1815 [disable randomly alloc failure]),
1816 [],[enable_fail_alloc=yes])
1817 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1818 AC_MSG_RESULT([$enable_fail_alloc])
1819 if test x$enable_fail_alloc != xno ; then
1820 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1828 # AM_CONDITIONALS for lustre
1830 AC_DEFUN([LC_CONDITIONALS],
1831 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1832 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1833 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1834 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1835 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1836 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1837 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1838 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1839 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1840 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1841 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1842 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1843 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1844 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1850 # files that should be generated with AC_OUTPUT
1852 AC_DEFUN([LC_CONFIG_FILES],
1856 lustre/autoconf/Makefile
1857 lustre/contrib/Makefile
1859 lustre/include/Makefile
1860 lustre/include/lustre_ver.h
1861 lustre/include/linux/Makefile
1862 lustre/include/lustre/Makefile
1863 lustre/kernel_patches/targets/2.6-vanilla.target
1864 lustre/kernel_patches/targets/2.6-rhel4.target
1865 lustre/kernel_patches/targets/2.6-rhel5.target
1866 lustre/kernel_patches/targets/2.6-fc5.target
1867 lustre/kernel_patches/targets/2.6-patchless.target
1868 lustre/kernel_patches/targets/2.6-sles10.target
1869 lustre/ldlm/Makefile
1871 lustre/fid/autoMakefile
1872 lustre/liblustre/Makefile
1873 lustre/liblustre/tests/Makefile
1874 lustre/llite/Makefile
1875 lustre/llite/autoMakefile
1877 lustre/lov/autoMakefile
1878 lustre/lvfs/Makefile
1879 lustre/lvfs/autoMakefile
1881 lustre/mdc/autoMakefile
1883 lustre/lmv/autoMakefile
1885 lustre/mds/autoMakefile
1887 lustre/mdt/autoMakefile
1889 lustre/cmm/autoMakefile
1891 lustre/mdd/autoMakefile
1893 lustre/fld/autoMakefile
1894 lustre/obdclass/Makefile
1895 lustre/obdclass/autoMakefile
1896 lustre/obdclass/linux/Makefile
1897 lustre/obdecho/Makefile
1898 lustre/obdecho/autoMakefile
1899 lustre/obdfilter/Makefile
1900 lustre/obdfilter/autoMakefile
1902 lustre/osc/autoMakefile
1904 lustre/ost/autoMakefile
1906 lustre/osd/autoMakefile
1908 lustre/mgc/autoMakefile
1910 lustre/mgs/autoMakefile
1911 lustre/ptlrpc/Makefile
1912 lustre/ptlrpc/autoMakefile
1913 lustre/ptlrpc/gss/Makefile
1914 lustre/ptlrpc/gss/autoMakefile
1915 lustre/quota/Makefile
1916 lustre/quota/autoMakefile
1917 lustre/scripts/Makefile
1918 lustre/scripts/version_tag.pl
1919 lustre/tests/Makefile
1920 lustre/utils/Makefile
1921 lustre/utils/gss/Makefile
1923 case $lb_target_os in
1925 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])