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 switchs touch_atime to struct path
1025 # see kernel commit 68ac1234fb949b66941d94dce4157742799fc581
1027 AC_DEFUN([LC_TOUCH_ATIME_1ARG],
1028 [AC_MSG_CHECKING([if touch_atime use one argument])
1029 LB_LINUX_TRY_COMPILE([
1030 #include <linux/fs.h>
1032 touch_atime((struct path *)NULL);
1034 AC_DEFINE(HAVE_TOUCH_ATIME_1ARG, 1,
1035 [touch_atime use one argument])
1036 AC_MSG_RESULT([yes])
1043 # 3.4 converts d_alloc_root to d_make_root
1044 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1046 AC_DEFUN([LC_HAVE_D_MAKE_ROOT],
1047 [AC_MSG_CHECKING([if have d_make_root])
1048 LB_LINUX_TRY_COMPILE([
1049 #include <linux/fs.h>
1051 d_make_root((struct inode *)NULL);
1053 AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1055 AC_MSG_RESULT([yes])
1062 # 3.4 cache_register/cache_unregister are removed
1063 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1064 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1065 # are defined, but not exported.
1066 # 3.3 cache_register_net/cache_unregister_net are
1067 # exported and replacing cache_register/cache_unregister in 3.4
1069 AC_DEFUN([LC_HAVE_CACHE_REGISTER],
1070 [AC_MSG_CHECKING([if have cache_register])
1071 LB_LINUX_TRY_COMPILE([
1072 #include <linux/sunrpc/cache.h>
1074 cache_register(NULL);
1076 AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1077 [have cache_register])
1078 AC_MSG_RESULT([yes])
1085 # 3.5 renames end_writeback() back to clear_inode()...
1086 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1088 AC_DEFUN([LC_HAVE_CLEAR_INODE],
1089 [AC_MSG_CHECKING([if have clear_inode])
1090 LB_LINUX_TRY_COMPILE([
1091 #include <linux/fs.h>
1093 clear_inode((struct inode *)NULL);
1095 AC_DEFINE(HAVE_CLEAR_INODE, 1,
1097 AC_MSG_RESULT([yes])
1104 # 3.5 encode_fh has parent inode passed in directly
1105 # see kernel commit b0b0382b
1107 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT],
1108 [AC_MSG_CHECKING([if encode_fh have parent inode as parameter])
1109 tmp_flags="$EXTRA_KCFLAGS"
1110 EXTRA_KCFLAGS="-Werror"
1111 LB_LINUX_TRY_COMPILE([
1112 #include <linux/exportfs.h>
1113 #include <linux/fs.h>
1114 #include <linux/types.h>
1115 int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1120 struct export_operations exp_op;
1121 exp_op.encode_fh = ll_encode_fh;
1123 AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1124 [have parent inode as parameter])
1125 AC_MSG_RESULT([yes])
1129 EXTRA_KCFLAGS="$tmp_flags"
1132 # 3.5 has generic_file_llseek_size with 5 args
1133 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG],
1134 [AC_MSG_CHECKING([if kernel has generic_file_llseek_size with 5 args])
1135 LB_LINUX_TRY_COMPILE([
1136 #include <linux/fs.h>
1138 generic_file_llseek_size(NULL, 0, 0, 0, 0);
1140 AC_MSG_RESULT([yes])
1141 AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1142 [kernel has generic_file_llseek_size with 5 args])
1149 # 3.6 switch i_dentry/d_alias from list to hlist
1151 AC_DEFUN([LC_HAVE_DENTRY_D_ALIAS_HLIST],
1152 [AC_MSG_CHECKING([if i_dentry/d_alias uses hlist])
1153 tmp_flags="$EXTRA_KCFLAGS"
1154 EXTRA_KCFLAGS="-Werror"
1155 LB_LINUX_TRY_COMPILE([
1156 #include <linux/fs.h>
1157 #include <linux/list.h>
1160 struct dentry dentry;
1161 struct hlist_head head;
1162 struct hlist_node node;
1163 inode.i_dentry = head;
1164 dentry.d_alias = node;
1166 AC_DEFINE(HAVE_DENTRY_D_ALIAS_HLIST, 1,
1167 [have i_dentry/d_alias uses hlist])
1168 AC_MSG_RESULT([yes])
1172 EXTRA_KCFLAGS="$tmp_flags"
1176 # 3.6 dentry_open uses struct path as first argument
1177 # see kernel commit 765927b2
1179 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH],
1180 [AC_MSG_CHECKING([if dentry_open uses struct path as first argument])
1181 tmp_flags="$EXTRA_KCFLAGS"
1182 EXTRA_KCFLAGS="-Werror"
1183 LB_LINUX_TRY_COMPILE([
1184 #include <linux/fs.h>
1185 #include <linux/path.h>
1188 dentry_open(&path, 0, NULL);
1190 AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1191 [dentry_open uses struct path as first argument])
1192 AC_MSG_RESULT([yes])
1196 EXTRA_KCFLAGS="$tmp_flags"
1200 # 3.6 vfs adds iop->atomic_open
1202 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN],
1203 [AC_MSG_CHECKING([if iop has atomic_open])
1204 LB_LINUX_TRY_COMPILE([
1205 #include <linux/fs.h>
1207 struct inode_operations iop;
1208 iop.atomic_open = NULL;
1210 AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1211 [have iop atomic_open])
1212 AC_MSG_RESULT([yes])
1219 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1221 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS],
1222 [AC_MSG_CHECKING([if posix_acl_to_xattr takes struct user_namespace])
1223 LB_LINUX_TRY_COMPILE([
1224 #include <linux/fs.h>
1225 #include <linux/posix_acl_xattr.h>
1227 posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1229 AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1230 [posix_acl_to_xattr takes struct user_namespace])
1231 AC_MSG_RESULT([yes])
1238 # 3.8 struct file has new member f_inode
1240 AC_DEFUN([LC_HAVE_FILE_F_INODE],
1241 [AC_MSG_CHECKING([if struct file has memeber f_inode])
1242 LB_LINUX_TRY_COMPILE([
1243 #include <linux/fs.h>
1245 ((struct file *)0)->f_inode = NULL;
1247 AC_DEFINE(HAVE_FILE_F_INODE, 1,
1248 [struct file has memeber f_inode])
1249 AC_MSG_RESULT([yes])
1255 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS],
1256 [AC_MSG_CHECKING([if sunrpc_cache_pipe_upcall takes 3 args])
1257 LB_LINUX_TRY_COMPILE([
1258 #include <linux/sunrpc/cache.h>
1260 sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1262 AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1263 [sunrpc_cache_pipe_upcall takes 3 args])
1264 AC_MSG_RESULT([yes])
1271 # 3.9 uses hlist_for_each_entry with 3 args
1272 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1274 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG],
1275 [AC_MSG_CHECKING([if hlist_for_each_entry has 3 args])
1276 LB_LINUX_TRY_COMPILE([
1277 #include <linux/list.h>
1278 #include <linux/fs.h>
1280 struct inode *inode;
1281 struct dentry *dentry;
1282 hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
1286 AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1, [3 args])
1287 AC_MSG_RESULT([yes])
1294 # 3.9 killed f_vfsmnt by
1295 # 182be684784334598eee1d90274e7f7aa0063616
1296 # replacement is f_path.mnt
1298 AC_DEFUN([LC_HAVE_F_PATH_MNT],
1299 [AC_MSG_CHECKING([if struct file has f_path.mnt])
1300 LB_LINUX_TRY_COMPILE([
1301 #include <linux/fs.h>
1303 struct file *fp = NULL;
1306 path.mnt = fp->f_path.mnt;
1308 AC_DEFINE(HAVE_F_PATH_MNT,1,[yes])
1309 AC_MSG_RESULT([yes])
1316 # 3.10+ only supports procfs seq_files handling
1318 AC_DEFUN([LC_HAVE_ONLY_PROCFS_SEQ],
1319 [AC_MSG_CHECKING([if procfs only supports using seq_files])
1320 LB_LINUX_TRY_COMPILE([
1321 #include <linux/proc_fs.h>
1323 ((struct proc_dir_entry *)0)->write_proc(NULL, NULL, 0, NULL);
1327 AC_DEFINE(HAVE_ONLY_PROCFS_SEQ, 1, [only seq_files supported])
1328 AC_MSG_RESULT([yes])
1332 # 3.10 release for block device doesn't return int
1333 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT],
1334 [AC_MSG_CHECKING([if block_device_operations release returns int])
1335 LB_LINUX_TRY_COMPILE([
1336 #include <linux/blkdev.h>
1338 struct block_device_operations fops;
1339 int i __attribute__ ((unused));
1341 i = fops.release(NULL,0);
1343 AC_MSG_RESULT([yes])
1344 AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1345 [block device release returns int])
1352 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1354 AC_DEFUN([LC_D_COMPARE_5ARGS],
1355 [AC_MSG_CHECKING([if d_compare taken 5 arguments])
1356 LB_LINUX_TRY_COMPILE([
1357 #include <linux/dcache.h>
1359 ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1361 AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1362 [d_compare need 5 arguments])
1363 AC_MSG_RESULT([yes])
1370 # 3.11 need to access d_count to get dentry reference count
1372 AC_DEFUN([LC_HAVE_DCOUNT],
1373 [AC_MSG_CHECKING([if d_count exist])
1374 LB_LINUX_TRY_COMPILE([
1375 #include <linux/dcache.h>
1381 AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
1382 AC_MSG_RESULT([yes])
1389 # 3.12 truncate_pagecache without oldsize parameter
1391 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE],
1392 [AC_MSG_CHECKING([if truncate_pagecache with old_size parameter])
1393 LB_LINUX_TRY_COMPILE([
1394 #include <linux/mm.h>
1396 truncate_pagecache(NULL, 0, 0);
1398 AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1, [with oldsize])
1399 AC_MSG_RESULT([yes])
1406 # 3.12 ki_left removed from struct kiocb
1408 AC_DEFUN([LC_KIOCB_KI_LEFT],
1409 [AC_MSG_CHECKING([if struct kiocb with ki_left member])
1410 LB_LINUX_TRY_COMPILE([
1411 #include <linux/aio.h>
1413 ((struct kiocb*)0)->ki_left = 0;
1415 AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1, [ki_left exist])
1416 AC_MSG_RESULT([yes])
1425 # Lustre linux kernel checks
1427 AC_DEFUN([LC_PROG_LINUX],
1431 LC_CONFIG_LIBLUSTRE_RECOVERY
1432 LC_CONFIG_HEALTH_CHECK_WRITE
1433 LC_CONFIG_LRU_RESIZE
1434 LC_LLITE_LLOOP_MODULE
1436 LC_GLIBC_SUPPORT_FHANDLES
1442 LC_BLK_QUEUE_MAX_SEGMENTS
1445 LC_HAVE_DQUOT_FS_DISK_QUOTA
1446 LC_HAVE_DQUOT_SUSPEND
1450 LC_EXPORT_SIMPLE_SETATTR
1451 LC_EXPORT_TRUNCATE_COMPLETE_PAGE
1455 LC_SBOPS_EVICT_INODE
1461 LC_BLKDEV_GET_BY_DEV
1462 LC_GENERIC_PERMISSION
1469 LC_REQUEST_QUEUE_UNPLUG_FN
1470 LC_HAVE_FHANDLE_SYSCALLS
1471 LC_HAVE_FSTYPE_MOUNT
1475 LC_DIRTY_INODE_WITH_FLAG
1478 LC_LM_XXX_LOCK_MANAGER_OPS
1482 LC_INODE_PERMISION_2ARGS
1485 LC_HAVE_VOID_MAKE_REQUEST_FN
1486 LC_HAVE_PROTECT_I_NLINK
1489 LC_HAVE_MIGRATE_HEADER
1490 LC_MIGRATEPAGE_4ARGS
1491 LC_SUPEROPS_USE_DENTRY
1492 LC_INODEOPS_USE_UMODE_T
1493 LC_HAVE_CACHE_REGISTER
1498 LC_KMAP_ATOMIC_HAS_1ARG
1502 LC_HAVE_ENCODE_FH_PARENT
1503 LC_FILE_LLSEEK_SIZE_5ARG
1506 LC_HAVE_DENTRY_D_ALIAS_HLIST
1507 LC_DENTRY_OPEN_USE_PATH
1508 LC_HAVE_IOP_ATOMIC_OPEN
1511 LC_HAVE_POSIXACL_USER_NS
1514 LC_HAVE_FILE_F_INODE
1515 LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1518 LC_HAVE_HLIST_FOR_EACH_3ARG
1522 LC_HAVE_ONLY_PROCFS_SEQ
1523 LC_BLKDEV_RELEASE_RETURN_INT
1530 LC_OLDSIZE_TRUNCATE_PAGECACHE
1534 if test x$enable_server != xno ; then
1535 LC_FUNC_DEV_SET_RDONLY
1545 # Check whether to build the client side of Lustre
1547 AC_DEFUN([LC_CONFIG_CLIENT],
1548 [AC_MSG_CHECKING([whether to build Lustre client support])
1549 AC_ARG_ENABLE([client],
1550 AC_HELP_STRING([--disable-client],
1551 [disable Lustre client support]),
1552 [],[enable_client='yes'])
1553 AC_MSG_RESULT([$enable_client])
1557 # LC_CONFIG_LIBLUSTRE
1559 # whether to build liblustre
1561 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1562 [AC_MSG_CHECKING([whether to build Lustre library])
1563 AC_ARG_ENABLE([liblustre],
1564 AC_HELP_STRING([--disable-liblustre],
1565 [disable building of Lustre library]),
1566 [],[enable_liblustre=$with_sysio])
1567 AC_MSG_RESULT([$enable_liblustre])
1568 # only build sysio if liblustre is built
1569 with_sysio="$enable_liblustre"
1571 AC_MSG_CHECKING([whether to build liblustre tests])
1572 AC_ARG_ENABLE([liblustre-tests],
1573 AC_HELP_STRING([--enable-liblustre-tests],
1574 [enable liblustre tests, if --disable-tests is used]),
1575 [],[enable_liblustre_tests=$enable_tests])
1576 if test x$enable_liblustre != xyes ; then
1577 enable_liblustre_tests='no'
1579 AC_MSG_RESULT([$enable_liblustre_tests])
1581 AC_MSG_CHECKING([whether to enable liblustre acl])
1582 AC_ARG_ENABLE([liblustre-acl],
1583 AC_HELP_STRING([--disable-liblustre-acl],
1584 [disable ACL support for liblustre]),
1585 [],[enable_liblustre_acl=yes])
1586 AC_MSG_RESULT([$enable_liblustre_acl])
1587 if test x$enable_liblustre_acl = xyes ; then
1588 AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1594 AC_ARG_ENABLE(mpitests,
1595 AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
1596 [include mpi tests]),
1607 MPICC_WRAPPER=$enableval
1617 if test x$enable_mpitests != xno; then
1618 AC_MSG_CHECKING([whether mpitests can be built])
1626 MPI_Initialized(&flag);
1629 AC_MSG_RESULT([yes])
1636 AC_SUBST(MPICC_WRAPPER)
1638 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1639 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1642 LC_CONFIG_LIBLUSTRE_RECOVERY
1648 # whether to enable quota support global control
1650 AC_DEFUN([LC_CONFIG_QUOTA],
1651 [AC_ARG_ENABLE([quota],
1652 AC_HELP_STRING([--enable-quota],
1653 [enable quota support]),
1654 [],[enable_quota='yes'])
1657 AC_DEFUN([LC_QUOTA],
1661 if test x$enable_quota != xno -a x$enable_utils != xno; then
1662 AC_CHECK_HEADER(sys/quota.h,
1663 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
1664 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
1671 # whether to enable split support
1673 AC_DEFUN([LC_CONFIG_SPLIT],
1674 [AC_MSG_CHECKING([whether to enable split support])
1675 AC_ARG_ENABLE([split],
1676 AC_HELP_STRING([--enable-split],
1677 [enable split support]),
1678 [],[enable_split='no'])
1679 AC_MSG_RESULT([$enable_split])
1680 if test x$enable_split != xno; then
1681 AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1686 # LC_CONFIG_NODEMAP_PROC_DEBUG
1688 # enable nodemap proc file debugging
1690 AC_DEFUN([LC_NODEMAP_PROC_DEBUG],
1691 [AC_MSG_CHECKING([whether to enable nodemap proc debug])
1692 AC_ARG_ENABLE([nodemap_proc_debug],
1693 AC_HELP_STRING([--enable-nodemap-proc-debug],
1694 [enable nodemap proc debug]),
1695 [],[enable_nodemap_proc_debug='no'])
1696 AC_MSG_RESULT([$enable_nodemap_proc_debug])
1697 if test x$enable_nodemap_proc_debug != xno; then
1698 AC_DEFINE(NODEMAP_PROC_DEBUG, 1, [enable nodemap proc debug support])
1703 # LC_LLITE_LLOOP_MODULE
1704 # lloop_llite.ko does not currently work with page sizes
1707 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
1708 [AC_MSG_CHECKING([whether to enable llite_lloop module])
1709 LB_LINUX_TRY_COMPILE([
1710 #include <asm/page.h>
1712 #if PAGE_SIZE >= 65536
1713 #error "PAGE_SIZE >= 65536"
1716 enable_llite_lloop_module='yes'
1717 AC_MSG_RESULT([yes])
1719 enable_llite_lloop_module='no'
1727 # configure support for optional OSD implementation
1729 AC_DEFUN([LC_OSD_ADDON],
1730 [AC_MSG_CHECKING([for osd])
1732 AC_HELP_STRING([--with-osd=path],
1733 [set path to optional osd]),
1736 no) ENABLEOSDADDON=0
1738 *) OSDADDON="${with_osd}"
1745 if test $ENABLEOSDADDON -eq 0; then
1749 OSDMODNAME=`basename $OSDADDON`
1750 if test -e $LUSTRE/$OSDMODNAME; then
1751 AC_MSG_RESULT([can't link])
1753 elif ln -s $OSDADDON $LUSTRE/$OSDMODNAME; then
1754 AC_MSG_RESULT([$OSDMODNAME])
1755 OSDADDON="subdir-m += $OSDMODNAME"
1757 AC_MSG_RESULT([can't link])
1767 # other configure checks
1769 AC_DEFUN([LC_CONFIGURE],
1770 [LC_CONFIG_OBD_BUFFER_SIZE
1772 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1773 CFLAGS="$CFLAGS -Werror"
1776 # maximum MDS thread count
1779 # include/liblustre.h
1780 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1782 # liblustre/llite_lib.h
1783 AC_CHECK_HEADERS([xtio.h file.h])
1786 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1789 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1790 AC_CHECK_FUNCS([inet_ntoa])
1792 # libsysio/src/readlink.c
1795 # libcfs prng.c - depends on linux/types.h from liblustre/dir.c
1796 AC_CHECK_HEADERS([linux/random.h], [], [],
1797 [#ifdef HAVE_LINUX_TYPES_H
1798 # include <linux/types.h>
1803 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1805 # check for -lz support
1809 [AC_CHECK_HEADERS([zlib.h],
1811 AC_DEFINE([HAVE_ADLER], 1,
1812 [support alder32 checksum type])],
1813 [AC_MSG_WARN([No zlib-devel package found,
1814 unable to use adler32 checksum])])],
1815 [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1820 AC_CHECK_LIB([selinux],
1821 [is_selinux_enabled],
1822 [AC_CHECK_HEADERS([selinux.h],
1823 [SELINUX="-lselinux"
1824 AC_DEFINE([HAVE_SELINUX], 1,
1825 [support for selinux ])],
1826 [AC_MSG_WARN([No selinux-devel package found,
1827 unable to build selinux enabled
1829 [AC_MSG_WARN([No selinux package found, unable to build selinux
1835 AC_ARG_ENABLE([mindf],
1836 AC_HELP_STRING([--enable-mindf],
1837 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1839 if test "$enable_mindf" = "yes" ; then
1840 AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1843 AC_ARG_ENABLE([fail_alloc],
1844 AC_HELP_STRING([--disable-fail-alloc],
1845 [disable randomly alloc failure]),
1846 [],[enable_fail_alloc=yes])
1847 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1848 AC_MSG_RESULT([$enable_fail_alloc])
1849 if test x$enable_fail_alloc != xno ; then
1850 AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1853 AC_ARG_ENABLE([invariants],
1854 AC_HELP_STRING([--enable-invariants],
1855 [enable invariant checking (cpu intensive)]),
1857 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
1858 AC_MSG_RESULT([$enable_invariants])
1859 if test x$enable_invariants = xyes ; then
1860 AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1, [enable invariant checking])
1863 AC_ARG_ENABLE([lu_ref],
1864 AC_HELP_STRING([--enable-lu_ref],
1865 [enable lu_ref reference tracking code]),
1867 AC_MSG_CHECKING([whether to track references with lu_ref])
1868 AC_MSG_RESULT([$enable_lu_ref])
1869 if test x$enable_lu_ref = xyes ; then
1870 AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
1873 AC_ARG_ENABLE([pgstate-track],
1874 AC_HELP_STRING([--enable-pgstate-track],
1875 [enable page state tracking]),
1876 [enable_pgstat_track='yes'],[])
1877 AC_MSG_CHECKING([whether to enable page state tracking])
1878 AC_MSG_RESULT([$enable_pgstat_track])
1879 if test x$enable_pgstat_track = xyes ; then
1880 AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
1881 [enable page state tracking code])
1888 # AM_CONDITIONALS for lustre
1890 AC_DEFUN([LC_CONDITIONALS],
1891 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1892 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1893 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1894 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1895 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1896 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1897 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1898 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1899 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1900 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1901 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1902 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1903 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
1909 # files that should be generated with AC_OUTPUT
1911 AC_DEFUN([LC_CONFIG_FILES],
1915 lustre/autoconf/Makefile
1916 lustre/conf/Makefile
1917 lustre/contrib/Makefile
1919 lustre/include/Makefile
1920 lustre/include/lustre_ver.h
1921 lustre/include/linux/Makefile
1922 lustre/include/darwin/Makefile
1923 lustre/include/lustre/Makefile
1924 lustre/kernel_patches/targets/2.6-rhel6.target
1925 lustre/kernel_patches/targets/2.6-rhel5.target
1926 lustre/kernel_patches/targets/2.6-sles11.target
1927 lustre/kernel_patches/targets/3.0-sles11.target
1928 lustre/kernel_patches/targets/3.0-sles11sp3.target
1929 lustre/kernel_patches/targets/2.6-fc11.target
1930 lustre/kernel_patches/targets/2.6-fc12.target
1931 lustre/kernel_patches/targets/2.6-fc15.target
1932 lustre/kernel_patches/targets/3.x-fc18.target
1933 lustre/ldlm/Makefile
1935 lustre/fid/autoMakefile
1936 lustre/liblustre/Makefile
1937 lustre/liblustre/tests/Makefile
1938 lustre/liblustre/tests/mpi/Makefile
1939 lustre/llite/Makefile
1940 lustre/llite/autoMakefile
1941 lustre/lclient/Makefile
1943 lustre/lov/autoMakefile
1945 lustre/mdc/autoMakefile
1947 lustre/lmv/autoMakefile
1948 lustre/lfsck/Makefile
1949 lustre/lfsck/autoMakefile
1951 lustre/mdt/autoMakefile
1952 lustre/nodemap/Makefile
1953 lustre/nodemap/autoMakefile
1955 lustre/mdd/autoMakefile
1957 lustre/fld/autoMakefile
1958 lustre/obdclass/Makefile
1959 lustre/obdclass/autoMakefile
1960 lustre/obdclass/linux/Makefile
1961 lustre/obdecho/Makefile
1962 lustre/obdecho/autoMakefile
1964 lustre/ofd/autoMakefile
1966 lustre/osc/autoMakefile
1968 lustre/ost/autoMakefile
1969 lustre/osd-ldiskfs/Makefile
1970 lustre/osd-ldiskfs/autoMakefile
1971 lustre/osd-zfs/Makefile
1972 lustre/osd-zfs/autoMakefile
1974 lustre/mgc/autoMakefile
1976 lustre/mgs/autoMakefile
1977 lustre/target/Makefile
1978 lustre/ptlrpc/Makefile
1979 lustre/ptlrpc/autoMakefile
1980 lustre/ptlrpc/gss/Makefile
1981 lustre/ptlrpc/gss/autoMakefile
1982 lustre/quota/Makefile
1983 lustre/quota/autoMakefile
1984 lustre/scripts/Makefile
1985 lustre/tests/Makefile
1986 lustre/tests/mpi/Makefile
1987 lustre/utils/Makefile
1988 lustre/utils/gss/Makefile
1990 lustre/osp/autoMakefile
1992 lustre/lod/autoMakefile
1993 lustre/obdclass/darwin/Makefile