4 # Wrapper for AC_CONFIG_SUBDIR
6 AC_DEFUN([LC_CONFIG_SRCDIR],
7 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
15 # lustre specific paths
17 AC_DEFUN([LC_PATH_DEFAULTS],
18 [# ptlrpc kernel build requires this
23 rootsbindir='$(CROSS_PATH)/sbin'
26 demodir='$(docdir)/demo'
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
36 # is the target os supported?
38 AC_DEFUN([LC_TARGET_SUPPORTED],
50 # LC_CONFIG_OBD_BUFFER_SIZE
52 # the maximum buffer size of lctl ioctls
54 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
55 [AC_MSG_CHECKING([maximum OBD ioctl size])
56 AC_ARG_WITH([obd-buffer-size],
57 AC_HELP_STRING([--with-obd-buffer-size=[size]],
58 [set lctl ioctl maximum bytes (default=8192)]),
60 OBD_BUFFER_SIZE=$with_obd_buffer_size
64 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
65 AC_DEFINE_UNQUOTED(CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
71 AC_DEFUN([LC_READLINK_SSIZE_T],
72 [AC_MSG_CHECKING([if readlink returns ssize_t])
76 ssize_t readlink(const char *, char *, size_t);
79 AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
85 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES],
86 [AC_MSG_CHECKING([if file handle and related syscalls are supported by glibc])
87 AC_CHECK_FUNCS([name_to_handle_at
90 AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
91 [file handle and related syscalls are supported])
98 # LC_FUNC_DEV_SET_RDONLY
100 # check whether dev_set_rdonly is exported. This is needed until we
101 # have another mechanism to fence IO from the underlying device.
103 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
104 [LB_CHECK_SYMBOL_EXPORT([dev_set_rdonly],
105 [block/ll_rw_block.c,block/blk-core.c],[
106 AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel exports dev_set_rdonly])
108 AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])
113 # Ensure stack size big than 8k in Lustre server (all kernels)
115 AC_DEFUN([LC_STACK_SIZE],
116 [AC_MSG_CHECKING([stack size big than 8k])
117 LB_LINUX_TRY_COMPILE([
118 #include <linux/thread_info.h>
120 #if THREAD_SIZE < 8192
121 #error "stack size < 8192"
126 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
131 # Allow the user to set the MDS thread upper limit
133 AC_DEFUN([LC_MDS_MAX_THREADS],
135 AC_ARG_WITH([mds_max_threads],
136 AC_HELP_STRING([--with-mds-max-threads=count],
137 [maximum threads available on the MDS: (default=512)]),
139 MDS_THREAD_COUNT=$with_mds_max_threads
140 AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of MDS threads])
147 # the pinger is temporary, until we have the recovery node in place
149 AC_DEFUN([LC_CONFIG_PINGER],
150 [AC_MSG_CHECKING([whether to enable pinger support])
151 AC_ARG_ENABLE([pinger],
152 AC_HELP_STRING([--disable-pinger],
153 [disable recovery pinger support]),
154 [],[enable_pinger='yes'])
155 AC_MSG_RESULT([$enable_pinger])
156 if test x$enable_pinger != xno ; then
157 AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
164 # do checksum of bulk data between client and OST
166 AC_DEFUN([LC_CONFIG_CHECKSUM],
167 [AC_MSG_CHECKING([whether to enable data checksum support])
168 AC_ARG_ENABLE([checksum],
169 AC_HELP_STRING([--disable-checksum],
170 [disable data checksum support]),
171 [],[enable_checksum='yes'])
172 AC_MSG_RESULT([$enable_checksum])
173 if test x$enable_checksum != xno ; then
174 AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
179 # LC_CONFIG_LIBLUSTRE_RECOVERY
181 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
182 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
183 AC_ARG_ENABLE([liblustre-recovery],
184 AC_HELP_STRING([--disable-liblustre-recovery],
185 [disable liblustre recovery support]),
186 [],[enable_liblustre_recovery='yes'])
187 AC_MSG_RESULT([$enable_liblustre_recovery])
188 if test x$enable_liblustre_recovery != xno ; then
189 AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
194 # LC_CONFIG_HEALTH_CHECK_WRITE
196 # Turn off the actual write to the disk
198 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
199 [AC_MSG_CHECKING([whether to enable a write with the health check])
200 AC_ARG_ENABLE([health_write],
201 AC_HELP_STRING([--enable-health_write],
202 [enable disk writes when doing health check]),
203 [],[enable_health_write='no'])
204 AC_MSG_RESULT([$enable_health_write])
205 if test x$enable_health_write != xno ; then
206 AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
210 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
211 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
212 AC_ARG_ENABLE([lru_resize],
213 AC_HELP_STRING([--enable-lru-resize],
214 [enable lru resize support]),
215 [],[enable_lru_resize='yes'])
216 AC_MSG_RESULT([$enable_lru_resize])
217 if test x$enable_lru_resize != xno; then
218 AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
223 # Quota support. The kernel must support CONFIG_QUOTA.
225 AC_DEFUN([LC_QUOTA_CONFIG],
226 [LB_LINUX_CONFIG_IM([QUOTA],[],[
227 AC_MSG_ERROR([Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])
231 # truncate_complete_page() has never been exported from an upstream kernel
232 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
233 # delete_from_page_cache() is exported from 2.6.39
234 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE],
235 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
237 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
238 [kernel export truncate_complete_page])])
239 LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
241 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
242 [kernel export remove_from_page_cache])])
243 LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
245 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
246 [kernel export delete_from_page_cache])])
252 AC_DEFUN([LC_CAPA_CRYPTO],
253 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
254 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
256 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
257 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
259 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
260 AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
265 # LC_CONFIG_RMTCLIENT
268 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
270 AC_DEFUN([LC_CONFIG_RMTCLIENT],
271 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
272 AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
277 # LC_CONFIG_GSS_KEYRING (default 'auto', tests for dependencies, if found, enables; only called if gss is enabled)
279 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
280 [AC_MSG_CHECKING([whether to enable gss keyring backend])
281 AC_ARG_ENABLE([gss_keyring],
282 [AC_HELP_STRING([--disable-gss-keyring],
283 [disable gss keyring backend])],
284 [],[enable_gss_keyring='auto'])
285 AC_MSG_RESULT([$enable_gss_keyring])
287 if test x$enable_gss_keyring != xno; then
288 LB_LINUX_CONFIG_IM([KEYS],[],
289 [gss_keyring_conf_test='fail';
290 AC_MSG_WARN([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
292 AC_CHECK_LIB([keyutils], [keyctl_search], [],
293 [gss_keyring_conf_test='fail';
294 AC_MSG_WARN([libkeyutils is not found, which is required by gss keyring backend])],)
296 if test x$gss_keyring_conf_test != xfail; then
297 AC_DEFINE([HAVE_GSS_KEYRING], [1], [Define this if you enable gss keyring backend])
298 enable_gss_keyring='yes'
300 if test x$enable_gss_keyring == xyes; then
301 AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
303 AC_MSG_WARN([Cannot enable gss keyring. See above for details.])
309 AC_DEFUN([LC_CONFIG_SUNRPC],
310 [LB_LINUX_CONFIG_IM([SUNRPC],[],
311 [if test x$sunrpc_required == xyes; then
312 AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])
317 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
319 # Build gss and related tools of Lustre. Currently both kernel and user space
320 # parts are depend on linux platform.
322 AC_DEFUN([LC_CONFIG_GSS],
323 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
325 [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
326 [],[enable_gss='auto'])
327 AC_MSG_RESULT([$enable_gss])
329 if test x$enable_gss != xno; then
330 LC_CONFIG_GSS_KEYRING
331 sunrpc_required=$enable_gss
335 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
336 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
337 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
338 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
339 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
340 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
341 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
342 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
344 require_krb5=$enable_gss
348 if test x$KRBDIR != x; then
349 AC_CHECK_LIB([gssapi], [gss_export_lucid_sec_context],
350 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi";
351 gss_conf_test='success'],
352 [AC_CHECK_LIB([gssglue], [gss_export_lucid_sec_context],
353 [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue";
354 gss_conf_test='success'],
355 [if test x$enable_gss == xyes; then
356 AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])
358 AC_MSG_WARN([libgssapi or libgssglue is not found, which is required by GSS.])
360 AC_SUBST(GSSAPI_LIBS)
363 if test x$gss_conf_test == xsuccess; then
364 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
371 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
372 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
373 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
374 # v3.1 onward have a 2 arg version (inode, mask)
375 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
376 [AC_MSG_CHECKING([inode_operations->permission has two args])
377 LB_LINUX_TRY_COMPILE([
378 #include <linux/fs.h>
380 struct inode *inode __attribute__ ((unused));
383 inode->i_op->permission(NULL, 0);
385 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
386 [inode_operations->permission has two args])
393 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
394 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
395 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
396 LB_LINUX_TRY_COMPILE([
397 #include <linux/blkdev.h>
399 blk_queue_max_segments(NULL, 0);
402 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
403 [blk_queue_max_segments is defined])
409 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
410 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA],
411 tmp_flags="$EXTRA_KCFLAGS"
412 EXTRA_KCFLAGS="-Werror"
413 [AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct fs_disk_quota])
414 LB_LINUX_TRY_COMPILE([
415 #include <linux/fs.h>
416 #include <linux/quota.h>
418 ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
420 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota])
424 AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct kqid & fs_disk_quota])
425 LB_LINUX_TRY_COMPILE([
426 #include <linux/fs.h>
427 #include <linux/quota.h>
429 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
431 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota])
432 AC_DEFINE(HAVE_DQUOT_KQID, 1, [quotactl_ops.set_dqblk takes struct kqid])
436 AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct kqid&fs_disk_quota])
439 EXTRA_KCFLAGS="$tmp_flags"
442 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
443 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND],
444 [AC_MSG_CHECKING([if dquot_suspend is defined])
445 LB_LINUX_TRY_COMPILE([
446 #include <linux/quotaops.h>
448 dquot_suspend(NULL, -1);
450 AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
460 # Check if kernel has been patched for 64-bit quota limits support.
461 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
462 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
463 # that in the absence of quotaio_v1.h in the kernel headers.
465 AC_DEFUN([LC_QUOTA64],[
466 AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
467 tmp_flags="$EXTRA_KCFLAGS"
468 EXTRA_KCFLAGS="-I$LINUX/fs"
469 LB_LINUX_TRY_COMPILE([
470 #include <linux/kernel.h>
471 #include <linux/fs.h>
472 #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
473 # include <quota/quotaio_v2.h>
474 struct v2r1_disk_dqblk dqblk_r1;
476 #include <linux/quota.h>
477 int ver = QFMT_VFS_V1;
480 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
483 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
484 AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
488 EXTRA_KCFLAGS=$tmp_flags
492 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
494 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
495 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
496 LB_LINUX_TRY_COMPILE([
497 #include <asm/atomic.h>
498 #include <linux/spinlock.h>
499 #include <linux/fs_struct.h>
501 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
503 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
504 [fs_struct.lock use rwlock])
512 # 2.6.36 super_operations add evict_inode method. it hybird of
513 # delete_inode & clear_inode.
515 AC_DEFUN([LC_SBOPS_EVICT_INODE],
516 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
517 LB_LINUX_TRY_COMPILE([
518 #include <linux/fs.h>
520 ((struct super_operations *)0)->evict_inode(NULL);
522 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
523 [super_operations.evict_inode() is exist in kernel])
531 # 2.6.35 file_operations.fsync taken 2 arguments.
532 # 3.0.0 file_operations.fsync takes 4 arguments.
534 AC_DEFUN([LC_FILE_FSYNC],
535 [AC_MSG_CHECKING([if file_operations.fsync takes 4 or 2 arguments])
536 LB_LINUX_TRY_COMPILE([
537 #include <linux/fs.h>
539 ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
541 AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
542 [file_operations.fsync takes 4 arguments])
543 AC_MSG_RESULT([yes, 4 args])
545 LB_LINUX_TRY_COMPILE([
546 #include <linux/fs.h>
548 ((struct file_operations *)0)->fsync(NULL, 0);
550 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
551 [file_operations.fsync takes 2 arguments])
552 AC_MSG_RESULT([yes, 2 args])
560 # 2.6.37 remove kernel_locked
562 AC_DEFUN([LC_KERNEL_LOCKED],
563 [AC_MSG_CHECKING([if kernel_locked is defined])
564 LB_LINUX_TRY_COMPILE([
565 #include <linux/smp_lock.h>
570 AC_DEFINE(HAVE_KERNEL_LOCKED, 1,
571 [kernel_locked is defined])
578 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
580 AC_DEFUN([LC_D_COMPARE_7ARGS],
581 [AC_MSG_CHECKING([if d_compare taken 7 arguments])
582 LB_LINUX_TRY_COMPILE([
583 #include <linux/dcache.h>
585 ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
587 AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1,
588 [d_compare need 7 arguments])
596 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
598 AC_DEFUN([LC_D_DELETE_CONST],
599 [AC_MSG_CHECKING([if d_delete has const declare on first parameter])
600 tmp_flags="$EXTRA_KCFLAGS"
601 EXTRA_KCFLAGS="-Werror"
602 LB_LINUX_TRY_COMPILE([
603 #include <linux/dcache.h>
605 const struct dentry *d = NULL;
606 ((struct dentry_operations*)0)->d_delete(d);
608 AC_DEFINE(HAVE_D_DELETE_CONST, const,
609 [d_delete first parameter declared const])
612 AC_DEFINE(HAVE_D_DELETE_CONST, , [])
615 EXTRA_KCFLAGS="$tmp_flags"
619 # 2.6.38 dcache_lock removed. rcu-walk commited.
621 AC_DEFUN([LC_DCACHE_LOCK],
622 [AC_MSG_CHECKING([if dcache_lock is exist])
623 LB_LINUX_TRY_COMPILE([
624 #include <linux/dcache.h>
626 spin_lock(&dcache_lock);
628 AC_DEFINE(HAVE_DCACHE_LOCK, 1,
629 [dcache_lock is exist])
637 # 2.6.38 inode.i_rcu added.
639 AC_DEFUN([LC_INODE_I_RCU],
640 [AC_MSG_CHECKING([if inode.i_rcu exists])
641 LB_LINUX_TRY_COMPILE([
642 #include <linux/fs.h>
645 struct rcu_head rcu = {};
648 AC_DEFINE(HAVE_INODE_I_RCU, 1,
649 [inode.i_rcu exists])
657 # 2.6.38 export blkdev_get_by_dev
659 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
660 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
662 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
663 [blkdev_get_by_dev is exported by the kernel])
669 # 2.6.38 export simple_setattr
671 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
672 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
674 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
675 [simple_setattr is exported by the kernel])
681 # truncate callback removed since 2.6.39
683 AC_DEFUN([LC_IOP_TRUNCATE],
684 [AC_MSG_CHECKING([inode_operations has .truncate member function])
685 LB_LINUX_TRY_COMPILE([
686 #include <linux/fs.h>
688 ((struct inode_operations *)0)->truncate(NULL);
690 AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
691 [inode_operations has .truncate member function])
699 # 2.6.39 remove unplug_fn from request_queue.
701 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
702 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
703 LB_LINUX_TRY_COMPILE([
704 #include <linux/blkdev.h>
706 do{ }while(sizeof(((struct request_queue *)0)->unplug_fn));
708 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
709 [request_queue has unplug_fn field])
717 # 2.6.39 replace get_sb with mount in struct file_system_type
719 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT],
720 [AC_MSG_CHECKING([if file_system_type has mount field])
721 LB_LINUX_TRY_COMPILE([
722 #include <linux/fs.h>
724 struct file_system_type fst;
725 void *i = (void *) fst.mount;
727 AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
728 [struct file_system_type has mount field])
736 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
737 # added to Linux kernel 2.6.39.
738 # Check if client supports these functions
740 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS],
741 [LB_LINUX_CONFIG_IM([FHANDLE],[
742 AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
743 [kernel supports fhandles and related syscalls])
748 # 3.0 dirty_inode() has a flag parameter
749 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
751 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG],
752 [AC_MSG_CHECKING([if dirty_inode super_operation takes flag])
753 LB_LINUX_TRY_COMPILE([
754 #include <linux/fs.h>
757 inode->i_sb->s_op->dirty_inode(NULL, 0);
759 AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
760 [dirty_inode super_operation takes flag])
768 # 2.6.38 generic_permission taken 4 parameters.
769 # in fact, it means rcu-walk aware permission bring.
771 # 3.1 generic_permission taken 2 parameters.
772 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
774 AC_DEFUN([LC_GENERIC_PERMISSION],
775 [AC_MSG_CHECKING([if generic_permission take 2 or 4 arguments])
776 LB_LINUX_TRY_COMPILE([
777 #include <linux/fs.h>
779 generic_permission(NULL, 0);
781 AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
782 [generic_permission taken 2 arguments])
783 AC_MSG_RESULT([yes, 2 args])
785 LB_LINUX_TRY_COMPILE([
786 #include <linux/fs.h>
788 generic_permission(NULL, 0, 0, NULL);
790 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
791 [generic_permission taken 4 arguments])
792 AC_MSG_RESULT([yes, 4 args])
800 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
801 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
803 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS],
804 [AC_MSG_CHECKING([if lock-manager ops renamed to lm_xxx])
805 LB_LINUX_TRY_COMPILE([
806 #include <linux/fs.h>
808 struct lock_manager_operations lm_ops;
809 lm_ops.lm_compare_owner = NULL;
811 AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
812 [lock-manager ops renamed to lm_xxx])
820 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait/
821 # inode_dio_done instead.
822 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
824 AC_DEFUN([LC_INODE_DIO_WAIT],
825 [AC_MSG_CHECKING([if inode->i_alloc_sem is killed and use inode_dio_wait/done.])
826 LB_LINUX_TRY_COMPILE([
827 #include <linux/fs.h>
829 inode_dio_wait((struct inode *)0);
830 inode_dio_done((struct inode *)0);
832 AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
833 [inode->i_alloc_sem is killed and use inode_dio_wait/done])
841 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
842 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
844 AC_DEFUN([LC_IOP_GET_ACL],
845 [AC_MSG_CHECKING([inode_operations has .get_acl member function])
846 LB_LINUX_TRY_COMPILE([
847 #include <linux/fs.h>
849 struct inode_operations iop;
852 AC_DEFINE(HAVE_IOP_GET_ACL, 1,
853 [inode_operations has .get_acl member function])
861 # 3.1 introduced generic_file_llseek_size()
863 AC_DEFUN([LC_FILE_LLSEEK_SIZE],
864 [LB_CHECK_SYMBOL_EXPORT([generic_file_llseek_size],
866 [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
867 [generic_file_llseek_size is exported by the kernel])])
871 # 3.2 request_queue.make_request_fn defined as function returns with void
872 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
874 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN],
875 [AC_MSG_CHECKING([if request_queue.make_request_fn returns void but not int])
876 LB_LINUX_TRY_COMPILE([
877 #include <linux/blkdev.h>
880 make_request_fn *mrf;
881 ret = mrf(NULL, NULL);
885 AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
886 [request_queue.make_request_fn returns void but not int])
892 # 3.2 protects inode->i_nlink from direct modification
893 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
894 # at the same time adds set_nlink(), so checks set_nlink() for it.
896 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK],
897 [AC_MSG_CHECKING([if inode->i_nlink is protected from direct modification])
898 LB_LINUX_TRY_COMPILE([
899 #include <linux/fs.h>
904 AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
905 [inode->i_nlink is protected from direct modification])
913 # 3.3 introduces migrate_mode.h and migratepage has 4 args
915 AC_DEFUN([LC_HAVE_MIGRATE_HEADER],
916 [LB_CHECK_FILE([$LINUX/include/linux/migrate.h],[
917 AC_DEFINE(HAVE_MIGRATE_H, 1,
918 [kernel has include/linux/migrate.h])
919 ],[LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h],[
920 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
921 [kernel has include/linux/migrate_mode.h])
928 AC_DEFUN([LC_MIGRATEPAGE_4ARGS],
929 [AC_MSG_CHECKING([if address_space_operations.migratepage has 4 args])
930 LB_LINUX_TRY_COMPILE([
931 #include <linux/fs.h>
932 #ifdef HAVE_MIGRATE_H
933 #include <linux/migrate.h>
934 #elif defined(HAVE_MIGRATE_MODE_H)
935 #include <linux/migrate_mode.h>
938 struct address_space_operations aops;
940 aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
942 AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
943 [address_space_operations.migratepage has 4 args])
951 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
952 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
954 AC_DEFUN([LC_SUPEROPS_USE_DENTRY],
955 [AC_MSG_CHECKING([if super_operations use dentry as parameter])
956 tmp_flags="$EXTRA_KCFLAGS"
957 EXTRA_KCFLAGS="-Werror"
958 LB_LINUX_TRY_COMPILE([
959 #include <linux/fs.h>
960 int show_options(struct seq_file *seq, struct dentry *root){
964 struct super_operations ops;
965 ops.show_options = show_options;
967 AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
968 [super_operations use dentry as parameter])
973 EXTRA_KCFLAGS="$tmp_flags"
977 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
978 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
980 AC_DEFUN([LC_INODEOPS_USE_UMODE_T],
981 [AC_MSG_CHECKING([if inode_operations use umode_t as parameter])
982 tmp_flags="$EXTRA_KCFLAGS"
983 EXTRA_KCFLAGS="-Werror"
984 LB_LINUX_TRY_COMPILE([
985 #include <linux/fs.h>
986 #include <linux/types.h>
987 int my_mknod(struct inode *dir, struct dentry *dchild,
988 umode_t mode, dev_t dev)
993 struct inode_operations ops;
994 ops.mknod = my_mknod;
996 AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
997 [inode_operations use umode_t as parameter])
1002 EXTRA_KCFLAGS="$tmp_flags"
1005 # 3.4 kmap_atomic removes second argument
1006 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1008 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG],
1009 [AC_MSG_CHECKING([if kmap_atomic has only 1 argument])
1010 LB_LINUX_TRY_COMPILE([
1011 #include <linux/highmem.h>
1015 AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1016 [have kmap_atomic has only 1 argument])
1017 AC_MSG_RESULT([yes])
1024 # 3.4 converts d_alloc_root to d_make_root
1025 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1027 AC_DEFUN([LC_HAVE_D_MAKE_ROOT],
1028 [AC_MSG_CHECKING([if have d_make_root])
1029 LB_LINUX_TRY_COMPILE([
1030 #include <linux/fs.h>
1032 d_make_root((struct inode *)NULL);
1034 AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1036 AC_MSG_RESULT([yes])
1043 # 3.4 cache_register/cache_unregister are removed
1044 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1045 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1046 # are defined, but not exported.
1047 # 3.3 cache_register_net/cache_unregister_net are
1048 # exported and replacing cache_register/cache_unregister in 3.4
1050 AC_DEFUN([LC_HAVE_CACHE_REGISTER],
1051 [AC_MSG_CHECKING([if have cache_register])
1052 LB_LINUX_TRY_COMPILE([
1053 #include <linux/sunrpc/cache.h>
1055 cache_register(NULL);
1057 AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1058 [have cache_register])
1059 AC_MSG_RESULT([yes])
1066 # 3.5 renames end_writeback() back to clear_inode()...
1067 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1069 AC_DEFUN([LC_HAVE_CLEAR_INODE],
1070 [AC_MSG_CHECKING([if have clear_inode])
1071 LB_LINUX_TRY_COMPILE([
1072 #include <linux/fs.h>
1074 clear_inode((struct inode *)NULL);
1076 AC_DEFINE(HAVE_CLEAR_INODE, 1,
1078 AC_MSG_RESULT([yes])
1085 # 3.5 encode_fh has parent inode passed in directly
1086 # see kernel commit b0b0382b
1088 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT],
1089 [AC_MSG_CHECKING([if encode_fh have parent inode as parameter])
1090 tmp_flags="$EXTRA_KCFLAGS"
1091 EXTRA_KCFLAGS="-Werror"
1092 LB_LINUX_TRY_COMPILE([
1093 #include <linux/exportfs.h>
1094 #include <linux/fs.h>
1095 #include <linux/types.h>
1096 int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1101 struct export_operations exp_op;
1102 exp_op.encode_fh = ll_encode_fh;
1104 AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1105 [have parent inode as parameter])
1106 AC_MSG_RESULT([yes])
1110 EXTRA_KCFLAGS="$tmp_flags"
1113 # 3.5 has generic_file_llseek_size with 5 args
1114 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG],
1115 [AC_MSG_CHECKING([if kernel has generic_file_llseek_size with 5 args])
1116 LB_LINUX_TRY_COMPILE([
1117 #include <linux/fs.h>
1119 generic_file_llseek_size(NULL, 0, 0, 0, 0);
1121 AC_MSG_RESULT([yes])
1122 AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1123 [kernel has generic_file_llseek_size with 5 args])
1130 # 3.6 switch i_dentry/d_alias from list to hlist
1132 AC_DEFUN([LC_HAVE_DENTRY_D_ALIAS_HLIST],
1133 [AC_MSG_CHECKING([if i_dentry/d_alias uses hlist])
1134 tmp_flags="$EXTRA_KCFLAGS"
1135 EXTRA_KCFLAGS="-Werror"
1136 LB_LINUX_TRY_COMPILE([
1137 #include <linux/fs.h>
1138 #include <linux/list.h>
1141 struct dentry dentry;
1142 struct hlist_head head;
1143 struct hlist_node node;
1144 inode.i_dentry = head;
1145 dentry.d_alias = node;
1147 AC_DEFINE(HAVE_DENTRY_D_ALIAS_HLIST, 1,
1148 [have i_dentry/d_alias uses hlist])
1149 AC_MSG_RESULT([yes])
1153 EXTRA_KCFLAGS="$tmp_flags"
1157 # 3.6 dentry_open uses struct path as first argument
1158 # see kernel commit 765927b2
1160 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH],
1161 [AC_MSG_CHECKING([if dentry_open uses struct path as first argument])
1162 tmp_flags="$EXTRA_KCFLAGS"
1163 EXTRA_KCFLAGS="-Werror"
1164 LB_LINUX_TRY_COMPILE([
1165 #include <linux/fs.h>
1166 #include <linux/path.h>
1169 dentry_open(&path, 0, NULL);
1171 AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1172 [dentry_open uses struct path as first argument])
1173 AC_MSG_RESULT([yes])
1177 EXTRA_KCFLAGS="$tmp_flags"
1181 # 3.6 vfs adds iop->atomic_open
1183 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN],
1184 [AC_MSG_CHECKING([if iop has atomic_open])
1185 LB_LINUX_TRY_COMPILE([
1186 #include <linux/fs.h>
1188 struct inode_operations iop;
1189 iop.atomic_open = NULL;
1191 AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1192 [have iop atomic_open])
1193 AC_MSG_RESULT([yes])
1200 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1202 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS],
1203 [AC_MSG_CHECKING([if posix_acl_to_xattr takes struct user_namespace])
1204 LB_LINUX_TRY_COMPILE([
1205 #include <linux/fs.h>
1206 #include <linux/posix_acl_xattr.h>
1208 posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1210 AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1211 [posix_acl_to_xattr takes struct user_namespace])
1212 AC_MSG_RESULT([yes])
1219 # 3.8 struct file has new member f_inode
1221 AC_DEFUN([LC_HAVE_FILE_F_INODE],
1222 [AC_MSG_CHECKING([if struct file has memeber f_inode])
1223 LB_LINUX_TRY_COMPILE([
1224 #include <linux/fs.h>
1226 ((struct file *)0)->f_inode = NULL;
1228 AC_DEFINE(HAVE_FILE_F_INODE, 1,
1229 [struct file has memeber f_inode])
1230 AC_MSG_RESULT([yes])
1236 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS],
1237 [AC_MSG_CHECKING([if sunrpc_cache_pipe_upcall takes 3 args])
1238 LB_LINUX_TRY_COMPILE([
1239 #include <linux/sunrpc/cache.h>
1241 sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1243 AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1244 [sunrpc_cache_pipe_upcall takes 3 args])
1245 AC_MSG_RESULT([yes])
1252 # 3.9 uses hlist_for_each_entry with 3 args
1253 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1255 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG],
1256 [AC_MSG_CHECKING([if hlist_for_each_entry has 3 args])
1257 LB_LINUX_TRY_COMPILE([
1258 #include <linux/list.h>
1259 #include <linux/fs.h>
1261 struct inode *inode;
1262 struct dentry *dentry;
1263 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
1267 AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1, [3 args])
1268 AC_MSG_RESULT([yes])
1275 # 3.10+ only supports procfs seq_files handling
1277 AC_DEFUN([LC_HAVE_ONLY_PROCFS_SEQ],
1278 [AC_MSG_CHECKING([if procfs only supports using seq_files])
1279 LB_LINUX_TRY_COMPILE([
1280 #include <linux/proc_fs.h>
1282 ((struct proc_dir_entry *)0)->write_proc(NULL, NULL, 0, NULL);
1286 AC_DEFINE(HAVE_ONLY_PROCFS_SEQ, 1, [only seq_files supported])
1287 AC_MSG_RESULT([yes])
1291 # 3.10 release for block device doesn't return int
1292 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT],
1293 [AC_MSG_CHECKING([if block_device_operations release returns int])
1294 LB_LINUX_TRY_COMPILE([
1295 #include <linux/blkdev.h>
1297 struct block_device_operations fops;
1298 int i __attribute__ ((unused));
1300 i = fops.release(NULL,0);
1302 AC_MSG_RESULT([yes])
1303 AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1304 [block device release returns int])
1311 # 3.11 invalidatepage requires the length of the range to invalidate
1313 AC_DEFUN([LC_INVALIDATE_RANGE],
1314 [AC_MSG_CHECKING([if address_space_operations.invalidatepage requires 3 arguments])
1315 LB_LINUX_TRY_COMPILE([
1316 #include <linux/fs.h>
1318 struct address_space_operations a_ops;
1320 a_ops.invalidatepage(NULL,0,0);
1322 AC_DEFINE(HAVE_INVALIDATE_RANGE, 1, [address_space_operations.invalidatepage needs 3 arguments])
1323 AC_MSG_RESULT([yes])
1330 # 3.11 readdir now takes the new struct dir_context
1332 AC_DEFUN([LC_HAVE_DIR_CONTEXT],
1333 [AC_MSG_CHECKING([if dir_context exist])
1334 LB_LINUX_TRY_COMPILE([
1335 #include <linux/fs.h>
1337 struct dir_context ctx;
1341 AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist])
1342 AC_MSG_RESULT([yes])
1349 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1351 AC_DEFUN([LC_D_COMPARE_5ARGS],
1352 [AC_MSG_CHECKING([if d_compare taken 5 arguments])
1353 LB_LINUX_TRY_COMPILE([
1354 #include <linux/dcache.h>
1356 ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1358 AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1359 [d_compare need 5 arguments])
1360 AC_MSG_RESULT([yes])
1367 # 3.11 need to access d_count to get dentry reference count
1369 AC_DEFUN([LC_HAVE_DCOUNT],
1370 [AC_MSG_CHECKING([if d_count exist])
1371 LB_LINUX_TRY_COMPILE([
1372 #include <linux/dcache.h>
1378 AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
1379 AC_MSG_RESULT([yes])
1386 # 3.12 truncate_pagecache without oldsize parameter
1388 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE],
1389 [AC_MSG_CHECKING([if truncate_pagecache with old_size parameter])
1390 LB_LINUX_TRY_COMPILE([
1391 #include <linux/mm.h>
1393 truncate_pagecache(NULL, 0, 0);
1395 AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1, [with oldsize])
1396 AC_MSG_RESULT([yes])
1403 # 3.12 ki_left removed from struct kiocb
1405 AC_DEFUN([LC_KIOCB_KI_LEFT],
1406 [AC_MSG_CHECKING([if struct kiocb with ki_left member])
1407 LB_LINUX_TRY_COMPILE([
1408 #include <linux/aio.h>
1410 ((struct kiocb*)0)->ki_left = 0;
1412 AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1, [ki_left exist])
1413 AC_MSG_RESULT([yes])
1422 # Lustre linux kernel checks
1424 AC_DEFUN([LC_PROG_LINUX],
1428 LC_CONFIG_LIBLUSTRE_RECOVERY
1429 LC_CONFIG_HEALTH_CHECK_WRITE
1430 LC_CONFIG_LRU_RESIZE
1431 LC_LLITE_LLOOP_MODULE
1433 LC_GLIBC_SUPPORT_FHANDLES
1439 LC_BLK_QUEUE_MAX_SEGMENTS
1442 LC_HAVE_DQUOT_FS_DISK_QUOTA
1443 LC_HAVE_DQUOT_SUSPEND
1447 LC_EXPORT_SIMPLE_SETATTR
1448 LC_EXPORT_TRUNCATE_COMPLETE_PAGE
1452 LC_SBOPS_EVICT_INODE
1458 LC_BLKDEV_GET_BY_DEV
1459 LC_GENERIC_PERMISSION
1466 LC_REQUEST_QUEUE_UNPLUG_FN
1467 LC_HAVE_FHANDLE_SYSCALLS
1468 LC_HAVE_FSTYPE_MOUNT
1472 LC_DIRTY_INODE_WITH_FLAG
1475 LC_LM_XXX_LOCK_MANAGER_OPS
1479 LC_INODE_PERMISION_2ARGS
1482 LC_HAVE_VOID_MAKE_REQUEST_FN
1483 LC_HAVE_PROTECT_I_NLINK
1486 LC_HAVE_MIGRATE_HEADER
1487 LC_MIGRATEPAGE_4ARGS
1488 LC_SUPEROPS_USE_DENTRY
1489 LC_INODEOPS_USE_UMODE_T
1490 LC_HAVE_CACHE_REGISTER
1494 LC_KMAP_ATOMIC_HAS_1ARG
1498 LC_HAVE_ENCODE_FH_PARENT
1499 LC_FILE_LLSEEK_SIZE_5ARG
1502 LC_HAVE_DENTRY_D_ALIAS_HLIST
1503 LC_DENTRY_OPEN_USE_PATH
1504 LC_HAVE_IOP_ATOMIC_OPEN
1507 LC_HAVE_POSIXACL_USER_NS
1510 LC_HAVE_FILE_F_INODE
1511 LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1514 LC_HAVE_HLIST_FOR_EACH_3ARG
1517 LC_HAVE_ONLY_PROCFS_SEQ
1518 LC_BLKDEV_RELEASE_RETURN_INT
1527 LC_OLDSIZE_TRUNCATE_PAGECACHE
1531 if test x$enable_server != xno ; then
1532 LC_FUNC_DEV_SET_RDONLY
1542 # Check whether to build the client side of Lustre
1544 AC_DEFUN([LC_CONFIG_CLIENT],
1545 [AC_MSG_CHECKING([whether to build Lustre client support])
1546 AC_ARG_ENABLE([client],
1547 AC_HELP_STRING([--disable-client],
1548 [disable Lustre client support]),
1549 [],[enable_client='yes'])
1550 AC_MSG_RESULT([$enable_client])
1554 # LC_CONFIG_LIBLUSTRE
1556 # whether to build liblustre
1558 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1559 [AC_MSG_CHECKING([whether to build Lustre library])
1560 AC_ARG_ENABLE([liblustre],
1561 AC_HELP_STRING([--disable-liblustre],
1562 [disable building of Lustre library]),
1563 [],[enable_liblustre=$with_sysio])
1564 AC_MSG_RESULT([$enable_liblustre])
1565 # only build sysio if liblustre is built
1566 with_sysio="$enable_liblustre"
1568 AC_MSG_CHECKING([whether to build liblustre tests])
1569 AC_ARG_ENABLE([liblustre-tests],
1570 AC_HELP_STRING([--enable-liblustre-tests],
1571 [enable liblustre tests, if --disable-tests is used]),
1572 [],[enable_liblustre_tests=$enable_tests])
1573 if test x$enable_liblustre != xyes ; then
1574 enable_liblustre_tests='no'
1576 AC_MSG_RESULT([$enable_liblustre_tests])
1578 AC_MSG_CHECKING([whether to enable liblustre acl])
1579 AC_ARG_ENABLE([liblustre-acl],
1580 AC_HELP_STRING([--disable-liblustre-acl],
1581 [disable ACL support for liblustre]),
1582 [],[enable_liblustre_acl=yes])
1583 AC_MSG_RESULT([$enable_liblustre_acl])
1584 if test x$enable_liblustre_acl = xyes ; then
1585 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1591 AC_ARG_ENABLE(mpitests,
1592 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
1593 [include mpi tests]),
1604 MPICC_WRAPPER=$enableval
1614 if test x$enable_mpitests != xno; then
1615 AC_MSG_CHECKING([whether mpitests can be built])
1623 MPI_Initialized(&flag);
1626 AC_MSG_RESULT([yes])
1633 AC_SUBST(MPICC_WRAPPER)
1635 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1636 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1639 LC_CONFIG_LIBLUSTRE_RECOVERY
1645 # whether to enable quota support global control
1647 AC_DEFUN([LC_CONFIG_QUOTA],
1648 [AC_ARG_ENABLE([quota],
1649 AC_HELP_STRING([--enable-quota],
1650 [enable quota support]),
1651 [],[enable_quota='yes'])
1654 AC_DEFUN([LC_QUOTA],
1658 if test x$enable_quota != xno -a x$enable_utils != xno; then
1659 AC_CHECK_HEADER(sys/quota.h,
1660 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
1661 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
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])
1683 # LC_CONFIG_NODEMAP_PROC_DEBUG
1685 # enable nodemap proc file debugging
1687 AC_DEFUN([LC_NODEMAP_PROC_DEBUG],
1688 [AC_MSG_CHECKING([whether to enable nodemap proc debug])
1689 AC_ARG_ENABLE([nodemap_proc_debug],
1690 AC_HELP_STRING([--enable-nodemap-proc-debug],
1691 [enable nodemap proc debug]),
1692 [],[enable_nodemap_proc_debug='no'])
1693 AC_MSG_RESULT([$enable_nodemap_proc_debug])
1694 if test x$enable_nodemap_proc_debug != xno; then
1695 AC_DEFINE(NODEMAP_PROC_DEBUG, 1, [enable nodemap proc debug support])
1700 # LC_LLITE_LLOOP_MODULE
1701 # lloop_llite.ko does not currently work with page sizes
1704 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
1705 [AC_MSG_CHECKING([whether to enable llite_lloop module])
1706 LB_LINUX_TRY_COMPILE([
1707 #include <asm/page.h>
1709 #if PAGE_SIZE >= 65536
1710 #error "PAGE_SIZE >= 65536"
1713 enable_llite_lloop_module='yes'
1714 AC_MSG_RESULT([yes])
1716 enable_llite_lloop_module='no'
1724 # configure support for optional OSD implementation
1726 AC_DEFUN([LC_OSD_ADDON],
1727 [AC_MSG_CHECKING([for osd])
1729 AC_HELP_STRING([--with-osd=path],
1730 [set path to optional osd]),
1733 no) ENABLEOSDADDON=0
1735 *) OSDADDON="${with_osd}"
1742 if test $ENABLEOSDADDON -eq 0; then
1746 OSDMODNAME=`basename $OSDADDON`
1747 if test -e $LUSTRE/$OSDMODNAME; then
1748 AC_MSG_RESULT([can't link])
1750 elif ln -s $OSDADDON $LUSTRE/$OSDMODNAME; then
1751 AC_MSG_RESULT([$OSDMODNAME])
1752 OSDADDON="subdir-m += $OSDMODNAME"
1754 AC_MSG_RESULT([can't link])
1764 # other configure checks
1766 AC_DEFUN([LC_CONFIGURE],
1767 [LC_CONFIG_OBD_BUFFER_SIZE
1769 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1770 CFLAGS="$CFLAGS -Werror"
1773 # maximum MDS thread count
1776 # include/liblustre.h
1777 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1779 # liblustre/llite_lib.h
1780 AC_CHECK_HEADERS([xtio.h file.h])
1783 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1786 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1787 AC_CHECK_FUNCS([inet_ntoa])
1789 # libsysio/src/readlink.c
1792 # libcfs prng.c - depends on linux/types.h from liblustre/dir.c
1793 AC_CHECK_HEADERS([linux/random.h], [], [],
1794 [#ifdef HAVE_LINUX_TYPES_H
1795 # include <linux/types.h>
1800 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1802 # check for -lz support
1806 [AC_CHECK_HEADERS([zlib.h],
1808 AC_DEFINE([HAVE_ADLER], 1,
1809 [support alder32 checksum type])],
1810 [AC_MSG_WARN([No zlib-devel package found,
1811 unable to use adler32 checksum])])],
1812 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1817 AC_CHECK_LIB([selinux],
1818 [is_selinux_enabled],
1819 [AC_CHECK_HEADERS([selinux.h],
1820 [SELINUX="-lselinux"
1821 AC_DEFINE([HAVE_SELINUX], 1,
1822 [support for selinux ])],
1823 [AC_MSG_WARN([No selinux-devel package found,
1824 unable to build selinux enabled
1826 [AC_MSG_WARN([No selinux package found, unable to build selinux
1832 AC_ARG_ENABLE([mindf],
1833 AC_HELP_STRING([--enable-mindf],
1834 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1836 if test "$enable_mindf" = "yes" ; then
1837 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1840 AC_ARG_ENABLE([fail_alloc],
1841 AC_HELP_STRING([--disable-fail-alloc],
1842 [disable randomly alloc failure]),
1843 [],[enable_fail_alloc=yes])
1844 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1845 AC_MSG_RESULT([$enable_fail_alloc])
1846 if test x$enable_fail_alloc != xno ; then
1847 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1850 AC_ARG_ENABLE([invariants],
1851 AC_HELP_STRING([--enable-invariants],
1852 [enable invariant checking (cpu intensive)]),
1854 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
1855 AC_MSG_RESULT([$enable_invariants])
1856 if test x$enable_invariants = xyes ; then
1857 AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1, [enable invariant checking])
1860 AC_ARG_ENABLE([lu_ref],
1861 AC_HELP_STRING([--enable-lu_ref],
1862 [enable lu_ref reference tracking code]),
1864 AC_MSG_CHECKING([whether to track references with lu_ref])
1865 AC_MSG_RESULT([$enable_lu_ref])
1866 if test x$enable_lu_ref = xyes ; then
1867 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
1870 AC_ARG_ENABLE([pgstate-track],
1871 AC_HELP_STRING([--enable-pgstate-track],
1872 [enable page state tracking]),
1873 [enable_pgstat_track='yes'],[])
1874 AC_MSG_CHECKING([whether to enable page state tracking])
1875 AC_MSG_RESULT([$enable_pgstat_track])
1876 if test x$enable_pgstat_track = xyes ; then
1877 AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
1878 [enable page state tracking code])
1885 # AM_CONDITIONALS for lustre
1887 AC_DEFUN([LC_CONDITIONALS],
1888 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1889 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1890 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1891 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1892 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1893 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1894 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1895 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1896 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1897 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1898 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1899 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1900 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
1906 # files that should be generated with AC_OUTPUT
1908 AC_DEFUN([LC_CONFIG_FILES],
1912 lustre/autoconf/Makefile
1913 lustre/conf/Makefile
1914 lustre/contrib/Makefile
1916 lustre/include/Makefile
1917 lustre/include/lustre_ver.h
1918 lustre/include/linux/Makefile
1919 lustre/include/darwin/Makefile
1920 lustre/include/lustre/Makefile
1921 lustre/kernel_patches/targets/2.6-rhel6.target
1922 lustre/kernel_patches/targets/2.6-rhel5.target
1923 lustre/kernel_patches/targets/2.6-sles11.target
1924 lustre/kernel_patches/targets/3.0-sles11.target
1925 lustre/kernel_patches/targets/3.0-sles11sp3.target
1926 lustre/kernel_patches/targets/2.6-fc11.target
1927 lustre/kernel_patches/targets/2.6-fc12.target
1928 lustre/kernel_patches/targets/2.6-fc15.target
1929 lustre/kernel_patches/targets/3.x-fc18.target
1930 lustre/ldlm/Makefile
1932 lustre/fid/autoMakefile
1933 lustre/liblustre/Makefile
1934 lustre/liblustre/tests/Makefile
1935 lustre/liblustre/tests/mpi/Makefile
1936 lustre/llite/Makefile
1937 lustre/llite/autoMakefile
1938 lustre/lclient/Makefile
1940 lustre/lov/autoMakefile
1942 lustre/mdc/autoMakefile
1944 lustre/lmv/autoMakefile
1945 lustre/lfsck/Makefile
1946 lustre/lfsck/autoMakefile
1948 lustre/mdt/autoMakefile
1949 lustre/nodemap/Makefile
1950 lustre/nodemap/autoMakefile
1952 lustre/mdd/autoMakefile
1954 lustre/fld/autoMakefile
1955 lustre/obdclass/Makefile
1956 lustre/obdclass/autoMakefile
1957 lustre/obdclass/linux/Makefile
1958 lustre/obdecho/Makefile
1959 lustre/obdecho/autoMakefile
1961 lustre/ofd/autoMakefile
1963 lustre/osc/autoMakefile
1965 lustre/ost/autoMakefile
1966 lustre/osd-ldiskfs/Makefile
1967 lustre/osd-ldiskfs/autoMakefile
1968 lustre/osd-zfs/Makefile
1969 lustre/osd-zfs/autoMakefile
1971 lustre/mgc/autoMakefile
1973 lustre/mgs/autoMakefile
1974 lustre/target/Makefile
1975 lustre/ptlrpc/Makefile
1976 lustre/ptlrpc/autoMakefile
1977 lustre/ptlrpc/gss/Makefile
1978 lustre/ptlrpc/gss/autoMakefile
1979 lustre/quota/Makefile
1980 lustre/quota/autoMakefile
1981 lustre/scripts/Makefile
1982 lustre/tests/Makefile
1983 lustre/tests/mpi/Makefile
1984 lustre/utils/Makefile
1985 lustre/utils/gss/Makefile
1987 lustre/osp/autoMakefile
1989 lustre/lod/autoMakefile
1990 lustre/obdclass/darwin/Makefile