Whamcloud - gitweb
dbd055b08d4138f61c47c8bd9f75023df3cc254f
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
1 #
2 # LC_CONFIG_SRCDIR
3 #
4 # Wrapper for AC_CONFIG_SUBDIR
5 #
6 AC_DEFUN([LC_CONFIG_SRCDIR], [
7 AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
8 libcfs_is_module="yes"
9 ldiskfs_is_ext4="yes"
10 ])
11
12 #
13 # LC_PATH_DEFAULTS
14 #
15 # lustre specific paths
16 #
17 AC_DEFUN([LC_PATH_DEFAULTS], [
18 # ptlrpc kernel build requires this
19 LUSTRE="$PWD/lustre"
20 AC_SUBST(LUSTRE)
21
22 # mount.lustre
23 rootsbindir='$(CROSS_PATH)/sbin'
24 AC_SUBST(rootsbindir)
25
26 demodir='$(docdir)/demo'
27 AC_SUBST(demodir)
28
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
31 ]) # LC_PATH_DEFAULTS
32
33 #
34 # LC_TARGET_SUPPORTED
35 #
36 # is the target os supported?
37 #
38 AC_DEFUN([LC_TARGET_SUPPORTED], [
39 case $target_os in
40         linux*)
41 $1
42                 ;;
43         *)
44 $2
45                 ;;
46 esac
47 ]) # LC_TARGET_SUPPORTED
48
49 #
50 # LC_CONFIG_OBD_BUFFER_SIZE
51 #
52 # the maximum buffer size of lctl ioctls
53 #
54 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE], [
55 AC_MSG_CHECKING([for 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)]),
59         [OBD_BUFFER_SIZE=$with_obd_buffer_size],
60         [OBD_BUFFER_SIZE=8192])
61 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
62 AC_DEFINE_UNQUOTED(CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE,
63         [IOCTL Buffer Size])
64 ]) # LC_CONFIG_OBD_BUFFER_SIZE
65
66 #
67 # LC_GLIBC_SUPPORT_FHANDLES
68 #
69 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES], [
70 AC_CHECK_FUNCS([name_to_handle_at],
71         [AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
72                 [file handle and related syscalls are supported])],
73         [AC_MSG_WARN([file handle and related syscalls are not supported])])
74 ]) # LC_GLIBC_SUPPORT_FHANDLES
75
76 #
77 # LC_FUNC_DEV_SET_RDONLY
78 #
79 # check whether dev_set_rdonly is exported.  This is needed until we
80 # have another mechanism to fence IO from the underlying device.
81 #
82 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY], [
83 LB_CHECK_EXPORT([dev_set_rdonly], [block/ll_rw_block.c block/blk-core.c],
84         [AC_DEFINE(HAVE_DEV_SET_RDONLY, 1,
85                 [kernel exports dev_set_rdonly])],
86         [AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])])
87 ]) # LC_FUNC_DEV_SET_RDONLY
88
89 #
90 # LC_STACK_SIZE
91 #
92 # Ensure stack size big than 8k in Lustre server (all kernels)
93 #
94 AC_DEFUN([LC_STACK_SIZE], [
95 LB_CHECK_COMPILE([if stack size big than 8k],
96 stack_size_8k, [
97         #include <linux/thread_info.h>
98 ], [
99         #if THREAD_SIZE < 8192
100         #error "stack size < 8192"
101         #endif
102 ], [], [AC_MSG_ERROR([
103
104 Lustre requires that Linux is configured with at least a 8KB stack.
105 ])])
106 ]) # LC_STACK_SIZE
107
108 #
109 # LC_MDS_MAX_THREADS
110 #
111 # Allow the user to set the MDS thread upper limit
112 #
113 AC_DEFUN([LC_MDS_MAX_THREADS], [
114 AC_MSG_CHECKING([for maximum number of MDS threads])
115 AC_ARG_WITH([mds_max_threads],
116         AC_HELP_STRING([--with-mds-max-threads=count],
117                 [maximum threads available on the MDS: (default=512)]),
118         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
119                 [maximum number of MDS threads])])
120 AC_MSG_RESULT([$with_mds_max_threads])
121 ]) # LC_MDS_MAX_THREADS
122
123 #
124 # LC_CONFIG_PINGER
125 #
126 # the pinger is temporary, until we have the recovery node in place
127 #
128 AC_DEFUN([LC_CONFIG_PINGER], [
129 AC_MSG_CHECKING([whether to enable Lustre pinger support])
130 AC_ARG_ENABLE([pinger],
131         AC_HELP_STRING([--disable-pinger],
132                 [disable recovery pinger support]),
133         [], [enable_pinger="yes"])
134 AC_MSG_RESULT([$enable_pinger])
135 AS_IF([test "x$enable_pinger" != xno],
136         [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
137 ]) # LC_CONFIG_PINGER
138
139 #
140 # LC_CONFIG_CHECKSUM
141 #
142 # do checksum of bulk data between client and OST
143 #
144 AC_DEFUN([LC_CONFIG_CHECKSUM], [
145 AC_MSG_CHECKING([whether to enable data checksum support])
146 AC_ARG_ENABLE([checksum],
147         AC_HELP_STRING([--disable-checksum],
148                 [disable data checksum support]),
149         [], [enable_checksum="yes"])
150 AC_MSG_RESULT([$enable_checksum])
151 AS_IF([test "x$enable_checksum" != xno],
152         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
153 ]) # LC_CONFIG_CHECKSUM
154
155 #
156 # LC_CONFIG_HEALTH_CHECK_WRITE
157 #
158 # Turn off the actual write to the disk
159 #
160 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
161 AC_MSG_CHECKING([whether to enable a write with the health check])
162 AC_ARG_ENABLE([health_write],
163         AC_HELP_STRING([--enable-health_write],
164                 [enable disk writes when doing health check]),
165         [], [enable_health_write="no"])
166 AC_MSG_RESULT([$enable_health_write])
167 AS_IF([test "x$enable_health_write" != xno],
168         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
169 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
170
171 #
172 # LC_CONFIG_LRU_RESIZE
173 #
174 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
175 AC_MSG_CHECKING([whether to enable lru self-adjusting])
176 AC_ARG_ENABLE([lru_resize],
177         AC_HELP_STRING([--enable-lru-resize],
178                 [enable lru resize support]),
179         [], [enable_lru_resize="yes"])
180 AC_MSG_RESULT([$enable_lru_resize])
181 AS_IF([test "x$enable_lru_resize" != xno],
182         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
183 ]) # LC_CONFIG_LRU_RESIZE
184
185 #
186 # LC_QUOTA_CONFIG
187 #
188 # Quota support. The kernel must support CONFIG_QUOTA.
189 #
190 AC_DEFUN([LC_QUOTA_CONFIG], [
191 LB_CHECK_CONFIG_IM([QUOTA], [],
192         [AC_MSG_ERROR([
193
194 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
195 ])])
196 ]) # LC_QUOTA_CONFIG
197
198 #
199 # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
200 #
201 # truncate_complete_page() has never been exported from an upstream kernel
202 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
203 # delete_from_page_cache() is exported from 2.6.39
204 #
205 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE], [
206 LB_CHECK_EXPORT([truncate_complete_page], [mm/truncate.c],
207         [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
208                 [kernel export truncate_complete_page])])
209 LB_CHECK_EXPORT([remove_from_page_cache], [mm/filemap.c],
210         [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
211                 [kernel export remove_from_page_cache])])
212 LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
213         [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
214                 [kernel export delete_from_page_cache])])
215 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
216
217 #
218 # LC_CONFIG_RMTCLIENT
219 #
220 dnl FIXME
221 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
222 dnl FIXME
223 AC_DEFUN([LC_CONFIG_RMTCLIENT], [
224 LB_CHECK_CONFIG_IM([CRYPTO_AES], [],
225         [AC_MSG_WARN([
226
227 Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.
228 ])])
229 ]) # LC_CONFIG_RMTCLIENT
230
231 #
232 # LC_CONFIG_GSS_KEYRING
233 #
234 # default 'auto', tests for dependencies, if found, enables;
235 # only called if gss is enabled
236 #
237 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
238 AC_MSG_CHECKING([whether to enable gss keyring backend])
239 AC_ARG_ENABLE([gss_keyring],
240         [AC_HELP_STRING([--disable-gss-keyring],
241                 [disable gss keyring backend])],
242         [], [enable_gss_keyring="auto"])
243 AC_MSG_RESULT([$enable_gss_keyring])
244 AS_IF([test "x$enable_gss_keyring" != xno], [
245         LB_CHECK_CONFIG_IM([KEYS], [], [
246                 gss_keyring_conf_test="fail"
247                 AC_MSG_WARN([
248
249 GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.
250 ])])
251
252         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
253                 gss_keyring_conf_test="fail"
254                 AC_MSG_WARN([
255
256 libkeyutils is not found, which is required by gss keyring backend
257 ])])
258
259         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
260                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
261                         [Define this if you enable gss keyring backend])
262                 enable_gss_keyring="yes"
263         ], [
264                 AS_IF([test "x$enable_gss_keyring" = xyes], [
265                         AC_MSG_ERROR([
266
267 Cannot enable gss_keyring. See above for details.
268 ])
269                 ], [
270                         AC_MSG_WARN([
271
272 Cannot enable gss keyring. See above for details.
273 ])
274                 ])
275         ])
276 ])
277 ]) # LC_CONFIG_GSS_KEYRING
278
279 #
280 # LC_HAVE_CRED_TGCRED
281 #
282 # rhel7 struct cred has no member tgcred
283 #
284 AC_DEFUN([LC_HAVE_CRED_TGCRED], [
285 LB_CHECK_COMPILE([if 'struct cred' has member 'tgcred'],
286 cred_tgcred, [
287         #include <linux/cred.h>
288 ],[
289         ((struct cred *)0)->tgcred = NULL;
290 ],[
291         AC_DEFINE(HAVE_CRED_TGCRED, 1,
292                 [struct cred has member tgcred])
293 ])
294 ]) # LC_HAVE_CRED_TGCRED
295
296 #
297 # LC_KEY_TYPE_INSTANTIATE_2ARGS
298 #
299 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
300 #
301 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
302 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
303 key_type_instantiate_2args, [
304         #include <linux/key-type.h>
305 ],[
306         ((struct key_type *)0)->instantiate(0, NULL);
307 ],[
308         AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
309                 [key_type->instantiate has two args])
310 ])
311 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
312
313 #
314 # LC_CONFIG_SUNRPC
315 #
316 AC_DEFUN([LC_CONFIG_SUNRPC], [
317 LB_CHECK_CONFIG_IM([SUNRPC], [], [
318         AS_IF([test "x$sunrpc_required" = xyes], [
319                 AC_MSG_ERROR([
320
321 kernel SUNRPC support is required by using GSS.
322 ])
323         ])])
324 ]) # LC_CONFIG_SUNRPC
325
326 #
327 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
328 #
329 # Build gss and related tools of Lustre. Currently both kernel and user space
330 # parts are depend on linux platform.
331 #
332 AC_DEFUN([LC_CONFIG_GSS], [
333 AC_MSG_CHECKING([whether to enable gss/krb5 support])
334 AC_ARG_ENABLE([gss],
335         [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
336         [], [enable_gss="auto"])
337 AC_MSG_RESULT([$enable_gss])
338
339 AS_IF([test "x$enable_gss" != xno], [
340         LC_CONFIG_GSS_KEYRING
341         LC_HAVE_CRED_TGCRED
342         LC_KEY_TYPE_INSTANTIATE_2ARGS
343         sunrpc_required=$enable_gss
344         LC_CONFIG_SUNRPC
345         sunrpc_required="no"
346
347         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
348                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
349         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
350                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
351         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
352                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
353         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
354                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
355
356         require_krb5=$enable_gss
357         AC_KERBEROS_V5
358         require_krb5="no"
359
360         AS_IF([test -n "$KRBDIR"], [
361                 gss_conf_test="success"
362         ], [
363                 AC_MSG_WARN([not found!])
364                 gss_conf_test="failure"
365         ])
366
367         AS_IF([test "x$gss_conf_test" = xsuccess], [
368                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
369                 enable_gss="yes"
370         ], [
371                 enable_gss="no"
372         ])
373 ])
374 ]) # LC_CONFIG_GSS
375
376 #
377 # LC_INODE_PERMISION_2ARGS
378 #
379 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
380 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
381 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
382 # v3.1 onward have a 2 arg version (inode, mask)
383 #
384 AC_DEFUN([LC_INODE_PERMISION_2ARGS], [
385 LB_CHECK_COMPILE([if 'inode_operations->permission' has two args],
386 inode_ops_permission_2args, [
387         #include <linux/fs.h>
388 ],[
389         struct inode *inode __attribute__ ((unused));
390
391         inode = NULL;
392         inode->i_op->permission(NULL, 0);
393 ],[
394         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
395                 [inode_operations->permission has two args])
396 ])
397 ]) # LC_INODE_PERMISION_2ARGS
398
399 #
400 # LC_BLK_QUEUE_MAX_SEGMENTS
401 #
402 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
403 #
404 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS], [
405 LB_CHECK_COMPILE([if 'blk_queue_max_segments' is defined],
406 blk_queue_max_segments, [
407         #include <linux/blkdev.h>
408 ],[
409         blk_queue_max_segments(NULL, 0);
410 ],[
411         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
412                 [blk_queue_max_segments is defined])
413 ])
414 ]) # LC_BLK_QUEUE_MAX_SEGMENTS
415
416 #
417 # LC_HAVE_DQUOT_FS_DISK_QUOTA
418 #
419 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
420 #
421 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA], [
422 tmp_flags="$EXTRA_KCFLAGS"
423 EXTRA_KCFLAGS="-Werror"
424 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct fs_disk_quota],
425 fs_disk_quota, [
426         #include <linux/fs.h>
427         #include <linux/quota.h>
428 ],[
429         ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
430 ],[
431         AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
432                 [quotactl_ops.set_dqblk takes struct fs_disk_quota])
433 ],[
434         LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct kqid & fs_disk_quota],
435         kqid_fs_disk_quota, [
436                 #include <linux/fs.h>
437                 #include <linux/quota.h>
438         ],[
439                 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
440         ],[
441                 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
442                         [quotactl_ops.set_dqblk takes struct fs_disk_quota])
443                 AC_DEFINE(HAVE_DQUOT_KQID, 1,
444                         [quotactl_ops.set_dqblk takes struct kqid])
445         ])
446 ])
447 EXTRA_KCFLAGS="$tmp_flags"
448 ]) # LC_HAVE_DQUOT_FS_DISK_QUOTA
449
450 #
451 # LC_HAVE_DQUOT_SUSPEND
452 #
453 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
454 #
455 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND], [
456 LB_CHECK_COMPILE([if 'dquot_suspend' is defined],
457 dquot_suspend, [
458         #include <linux/quotaops.h>
459 ],[
460         dquot_suspend(NULL, -1);
461 ],[
462         AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
463 ])
464 ]) # LC_HAVE_DQUOT_SUSPEND
465
466 #
467 # LC_QUOTA64
468 #
469 # Check if kernel has been patched for 64-bit quota limits support.
470 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
471 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
472 # that in the absence of quotaio_v1.h in the kernel headers.
473 #
474 AC_DEFUN([LC_QUOTA64], [
475 tmp_flags="$EXTRA_KCFLAGS"
476 EXTRA_KCFLAGS="-I$LINUX/fs"
477 LB_CHECK_COMPILE([if kernel has 64-bit quota limits support],
478 quota64, [
479         #include <linux/kernel.h>
480         #include <linux/fs.h>
481         #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
482         #include <quota/quotaio_v2.h>
483         struct v2r1_disk_dqblk dqblk_r1;
484         #else
485         #include <linux/quota.h>
486         int ver = QFMT_VFS_V1;
487         #endif
488 ], [], [
489         AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
490 ],[
491         LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],
492                 [AC_MSG_ERROR([You have got no 64-bit kernel quota support.])])
493 ])
494 EXTRA_KCFLAGS=$tmp_flags
495 ]) # LC_QUOTA64
496
497 #
498 # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
499 #
500 # 2.6.34 adds __add_wait_queue_exclusive
501 #
502 AC_DEFUN([LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE], [
503 LB_CHECK_COMPILE([if '__add_wait_queue_exclusive' exists],
504 __add_wait_queue_exclusive, [
505         #include <linux/wait.h>
506 ],[
507         wait_queue_head_t queue;
508         wait_queue_t      wait;
509         __add_wait_queue_exclusive(&queue, &wait);
510 ],[
511         AC_DEFINE(HAVE___ADD_WAIT_QUEUE_EXCLUSIVE, 1,
512                   [__add_wait_queue_exclusive exists])
513 ])
514 ]) # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
515
516 #
517 # LC_FS_STRUCT_RWLOCK
518 #
519 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
520 #
521 AC_DEFUN([LC_FS_STRUCT_RWLOCK], [
522 LB_CHECK_COMPILE([if 'fs_struct.lock' use rwlock],
523 fs_struct_rwlock, [
524         #include <asm/atomic.h>
525         #include <linux/spinlock.h>
526         #include <linux/fs_struct.h>
527 ],[
528         ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
529 ],[
530         AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1, [fs_struct.lock use rwlock])
531 ])
532 ]) # LC_FS_STRUCT_RWLOCK
533
534 #
535 # LC_SBOPS_EVICT_INODE
536 #
537 # 2.6.36 super_operations add evict_inode method. it hybird of
538 # delete_inode & clear_inode.
539 #
540 AC_DEFUN([LC_SBOPS_EVICT_INODE], [
541 LB_CHECK_COMPILE([if 'super_operations.evict_inode' exist],
542 super_ops_evict_inode, [
543         #include <linux/fs.h>
544 ],[
545         ((struct super_operations *)0)->evict_inode(NULL);
546 ],[
547         AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
548                 [super_operations.evict_inode() is exist in kernel])
549 ])
550 ]) # LC_SBOPS_EVICT_INODE
551
552 #
553 # LC_FILE_FSYNC
554 #
555 # 2.6.35 file_operations.fsync taken 2 arguments.
556 # 3.0.0 file_operations.fsync takes 4 arguments.
557 #
558 AC_DEFUN([LC_FILE_FSYNC], [
559 LB_CHECK_COMPILE([if 'file_operations.fsync' takes 4 arguments],
560 file_ops_fsync_4args, [
561         #include <linux/fs.h>
562 ],[
563         ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
564 ],[
565         AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
566                 [file_operations.fsync takes 4 arguments])
567 ],[
568         LB_CHECK_COMPILE([if 'file_operations.fsync' takes 2 arguments],
569         file_ops_fsync_2args, [
570                 #include <linux/fs.h>
571         ],[
572                 ((struct file_operations *)0)->fsync(NULL, 0);
573         ],[
574                 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
575                         [file_operations.fsync takes 2 arguments])
576         ])
577 ])
578 ]) # LC_FILE_FSYNC
579
580 #
581 # LC_KERNEL_LOCKED
582 #
583 # 2.6.37 remove kernel_locked
584 #
585 AC_DEFUN([LC_KERNEL_LOCKED], [
586 LB_CHECK_COMPILE([if 'kernel_locked' is defined],
587 kernel_locked, [
588         #include <linux/smp_lock.h>
589 ],[
590         kernel_locked();
591 ],[
592         AC_DEFINE(HAVE_KERNEL_LOCKED, 1, [kernel_locked is defined])
593 ])
594 ]) # LC_KERNEL_LOCKED
595
596 #
597 # LC_D_COMPARE_7ARGS
598 #
599 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
600 #
601 AC_DEFUN([LC_D_COMPARE_7ARGS], [
602 LB_CHECK_COMPILE([if 'dentry_operations.d_compare()' taken 7 arguments],
603 dentry_ops_d_compare_7arg, [
604         #include <linux/dcache.h>
605 ],[
606         ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
607 ],[
608         AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1, [d_compare need 7 arguments])
609 ])
610 ]) # LC_D_COMPARE_7ARGS
611
612 #
613 # LC_D_DELETE_CONST
614 #
615 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
616 #
617 AC_DEFUN([LC_D_DELETE_CONST], [
618 tmp_flags="$EXTRA_KCFLAGS"
619 EXTRA_KCFLAGS="-Werror"
620 LB_CHECK_COMPILE([if 'dentry_operations.d_delete()' has const declare on first parameter],
621 dentry_ops_d_delete_1st_const, [
622         #include <linux/dcache.h>
623 ],[
624         const struct dentry *d = NULL;
625         ((struct dentry_operations*)0)->d_delete(d);
626 ],[
627         AC_DEFINE(HAVE_D_DELETE_CONST, const,
628                 [d_delete first parameter declared const])
629 ],[
630         AC_DEFINE(HAVE_D_DELETE_CONST, [],
631                 [d_delete first parameter declared is not const])
632 ])
633 EXTRA_KCFLAGS="$tmp_flags"
634 ]) # LC_D_DELETE_CONST
635
636 #
637 # LC_DCACHE_LOCK
638 #
639 # 2.6.38 dcache_lock removed. rcu-walk commited.
640 #
641 AC_DEFUN([LC_DCACHE_LOCK], [
642 LB_CHECK_COMPILE([if 'dcache_lock' is exist],
643 dcache_lock, [
644         #include <linux/dcache.h>
645 ],[
646         spin_lock(&dcache_lock);
647 ],[
648         AC_DEFINE(HAVE_DCACHE_LOCK, 1,
649                 [dcache_lock is exist])
650 ])
651 ]) # LC_DCACHE_LOCK
652
653 #
654 # LC_INODE_I_RCU
655 #
656 # 2.6.38 inode.i_rcu added.
657 #
658 AC_DEFUN([LC_INODE_I_RCU], [
659 LB_CHECK_COMPILE([if 'inode.i_rcu' exists],
660 inode_i_rcu, [
661         #include <linux/fs.h>
662 ],[
663         struct inode ino;
664         struct rcu_head rcu = {};
665         ino.i_rcu = rcu;
666 ],[
667         AC_DEFINE(HAVE_INODE_I_RCU, 1,
668                 [inode.i_rcu exists])
669 ])
670 ]) # LC_INODE_I_RCU
671
672 #
673 # LC_BLKDEV_GET_BY_DEV
674 #
675 # 2.6.38 export blkdev_get_by_dev
676 #
677 AC_DEFUN([LC_BLKDEV_GET_BY_DEV], [
678 LB_CHECK_EXPORT([blkdev_get_by_dev], [fs/block_dev.c],
679         [AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
680                 [blkdev_get_by_dev is exported by the kernel])])
681 ]) # LC_BLKDEV_GET_BY_DEV
682
683 #
684 # LC_EXPORT_SIMPLE_SETATTR
685 #
686 # 2.6.38 export simple_setattr
687 #
688 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR], [
689 LB_CHECK_EXPORT([simple_setattr], [fs/libfs.c],
690         [AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
691                 [simple_setattr is exported by the kernel])])
692 ]) # LC_EXPORT_SIMPLE_SETATTR
693
694 #
695 # LC_IOP_TRUNCATE
696 #
697 # truncate callback removed since 2.6.39
698 #
699 AC_DEFUN([LC_IOP_TRUNCATE], [
700 LB_CHECK_COMPILE([if 'inode_operations' has '.truncate' member function],
701 inode_ops_truncate, [
702         #include <linux/fs.h>
703 ],[
704         ((struct inode_operations *)0)->truncate(NULL);
705 ],[
706         AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
707                 [inode_operations has .truncate member function])
708 ])
709 ]) # LC_IOP_TRUNCATE
710
711 #
712 # LC_REQUEST_QUEUE_UNPLUG_FN
713 #
714 # 2.6.39 remove unplug_fn from request_queue.
715 #
716 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], [
717 LB_CHECK_COMPILE([if 'request_queue' has 'unplug_fn' field],
718 request_queue_unplug_fn, [
719         #include <linux/blkdev.h>
720 ],[
721         do {} while(sizeof(((struct request_queue *)0)->unplug_fn));
722 ],[
723         AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
724                 [request_queue has unplug_fn field])
725 ])
726 ]) # LC_REQUEST_QUEUE_UNPLUG_FN
727
728 #
729 # LC_HAVE_FSTYPE_MOUNT
730 #
731 # 2.6.39 replace get_sb with mount in struct file_system_type
732 #
733 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [
734 LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field],
735 file_system_type_mount, [
736         #include <linux/fs.h>
737 ],[
738         struct file_system_type fst;
739         void *i = (void *) fst.mount;
740 ],[
741         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
742                 [struct file_system_type has mount field])
743 ])
744 ]) # LC_HAVE_FSTYPE_MOUNT
745
746 #
747 # LC_HAVE_FHANDLE_SYSCALLS
748 #
749 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
750 # added to Linux kernel 2.6.39.
751 # Check if client supports these functions
752 #
753 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [
754 LB_CHECK_CONFIG_IM([FHANDLE],[
755         AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
756                 [kernel supports fhandles and related syscalls])
757         ])
758 ]) # LC_HAVE_FHANDLE_SYSCALLS
759
760 #
761 # LC_HAVE_INODE_OWNER_OR_CAPABLE
762 #
763 # 2.6.39 renames is_owner_or_cap to inode_owner_or_capable
764 #
765 AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [
766 LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist],
767 inode_owner_or_capable, [
768         #include <linux/fs.h>
769 ],[
770         inode_owner_or_capable(NULL);
771 ],[
772         AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
773                 [inode_owner_or_capable exist])
774 ])
775 ]) # LC_HAVE_INODE_OWNER_OR_CAPABLE
776
777 #
778 # LC_DIRTY_INODE_WITH_FLAG
779 #
780 # 3.0 dirty_inode() has a flag parameter
781 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
782 #
783 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [
784 LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag],
785 dirty_inode_super_operation_flag, [
786         #include <linux/fs.h>
787 ],[
788         struct inode *inode;
789         inode->i_sb->s_op->dirty_inode(NULL, 0);
790 ],[
791         AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
792                 [dirty_inode super_operation takes flag])
793 ])
794 ]) # LC_DIRTY_INODE_WITH_FLAG
795
796 #
797 # LC_GENERIC_PERMISSION
798 #
799 # 2.6.38 generic_permission taken 4 parameters.
800 # in fact, it means rcu-walk aware permission bring.
801 #
802 # 3.1 generic_permission taken 2 parameters.
803 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
804 #
805 AC_DEFUN([LC_GENERIC_PERMISSION], [
806 LB_CHECK_COMPILE([if 'generic_permission' take 2 arguments],
807 generic_permission_2args, [
808         #include <linux/fs.h>
809 ],[
810         generic_permission(NULL, 0);
811 ],[
812         AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
813                 [generic_permission taken 2 arguments])
814 ],[
815         LB_CHECK_COMPILE([if 'generic_permission' take 4 arguments],
816         generic_permission_4args, [
817                 #include <linux/fs.h>
818         ],[
819                 generic_permission(NULL, 0, 0, NULL);
820         ],[
821                 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
822                         [generic_permission taken 4 arguments])
823         ])
824 ])
825 ]) # LC_GENERIC_PERMISSION
826
827 #
828 # LC_LM_XXX_LOCK_MANAGER_OPS
829 #
830 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
831 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
832 #
833 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [
834 LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'],
835 lock_manager_ops_lm_xxx, [
836         #include <linux/fs.h>
837 ],[
838         struct lock_manager_operations lm_ops;
839         lm_ops.lm_compare_owner = NULL;
840 ],[
841         AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
842                 [lock-manager ops renamed to lm_xxx])
843 ])
844 ]) # LC_LM_XXX_LOCK_MANAGER_OPS
845
846 #
847 # LC_INODE_DIO_WAIT
848 #
849 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait
850 #     instead.
851 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
852 #
853 AC_DEFUN([LC_INODE_DIO_WAIT], [
854 LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait],
855 inode_dio_wait, [
856         #include <linux/fs.h>
857 ],[
858         inode_dio_wait((struct inode *)0);
859 ],[
860         AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
861                 [inode->i_alloc_sem is killed and use inode_dio_wait])
862 ])
863 ]) # LC_INODE_DIO_WAIT
864
865 #
866 # LC_IOP_GET_ACL
867 #
868 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
869 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
870 #
871 AC_DEFUN([LC_IOP_GET_ACL], [
872 LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function],
873 inode_ops_get_acl, [
874         #include <linux/fs.h>
875 ],[
876         struct inode_operations iop;
877         iop.get_acl = NULL;
878 ],[
879         AC_DEFINE(HAVE_IOP_GET_ACL, 1,
880                 [inode_operations has .get_acl member function])
881 ])
882 ]) # LC_IOP_GET_ACL
883
884 #
885 # LC_FILE_LLSEEK_SIZE
886 #
887 # 3.1 introduced generic_file_llseek_size()
888 #
889 AC_DEFUN([LC_FILE_LLSEEK_SIZE], [
890 LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c],
891         [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
892                 [generic_file_llseek_size is exported by the kernel])])
893 ]) # LC_FILE_LLSEEK_SIZE
894
895 #
896 # LC_RADIX_EXCEPTION_ENTRY
897 # 3.1 adds radix_tree_exception_entry.
898 #
899 AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [
900 LB_CHECK_COMPILE([radix_tree_exceptional_entry exist],
901 radix_tree_exceptional_entry, [
902         #include <linux/radix-tree.h>
903 ],[
904         radix_tree_exceptional_entry(NULL);
905 ],[
906         AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1,
907                 [radix_tree_exceptional_entry exist])
908 ])
909 ]) # LC_RADIX_EXCEPTION_ENTRY
910
911 #
912 # LC_HAVE_VOID_MAKE_REQUEST_FN
913 #
914 # 3.2 request_queue.make_request_fn defined as function returns with void
915 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
916 #
917 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], [
918 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns void but not int],
919 make_request_fn_void, [
920         #include <linux/blkdev.h>
921 ],[
922         int ret;
923         make_request_fn *mrf;
924         ret = mrf(NULL, NULL);
925 ],[],[
926         AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
927                 [request_queue.make_request_fn returns void but not int])
928 ])
929 ]) # LC_HAVE_VOID_MAKE_REQUEST_FN
930
931 #
932 # LC_HAVE_PROTECT_I_NLINK
933 #
934 # 3.2 protects inode->i_nlink from direct modification
935 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
936 # at the same time adds set_nlink(), so checks set_nlink() for it.
937 #
938 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [
939 LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification],
940 inode_i_nlink_protected, [
941         #include <linux/fs.h>
942 ],[
943         struct inode i;
944         set_nlink(&i, 1);
945 ],[
946         AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
947                 [inode->i_nlink is protected from direct modification])
948 ])
949 ]) # LC_HAVE_PROTECT_I_NLINK
950
951 #
952 # 2.6.39 security_inode_init_security takes a 'struct qstr' parameter
953 #
954 # 3.2 security_inode_init_security takes a callback to set xattrs
955 #
956 AC_DEFUN([LC_HAVE_SECURITY_IINITSEC], [
957 LB_CHECK_COMPILE([if security_inode_init_security takes a callback],
958 security_inode_init_security_callback, [
959         #include <linux/security.h>
960 ],[
961         security_inode_init_security(NULL, NULL, NULL, (const initxattrs)NULL, NULL);
962 ],[
963         AC_DEFINE(HAVE_SECURITY_IINITSEC_CALLBACK, 1,
964                   [security_inode_init_security takes a callback to set xattrs])
965 ],[
966         LB_CHECK_COMPILE([if security_inode_init_security takes a 'struct qstr' parameter],
967         security_inode_init_security_qstr, [
968                 #include <linux/security.h>
969         ],[
970                 security_inode_init_security(NULL, NULL, (struct qstr *)NULL, NULL, NULL, NULL);
971         ],[
972                 AC_DEFINE(HAVE_SECURITY_IINITSEC_QSTR, 1,
973                           [security_inode_init_security takes a 'struct qstr' parameter])
974         ])
975 ])
976 ]) # LC_HAVE_SECURITY_IINITSEC
977
978 #
979 # LC_HAVE_MIGRATE_HEADER
980 #
981 # 3.3 introduces migrate_mode.h and migratepage has 4 args
982 #
983 AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [
984 LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [
985         AC_DEFINE(HAVE_MIGRATE_H, 1,
986                 [kernel has include/linux/migrate.h])
987 ],[
988         LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [
989                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
990                         [kernel has include/linux/migrate_mode.h])
991         ])
992 ])
993 ]) # LC_HAVE_MIGRATE_HEADER
994
995 #
996 # LC_MIGRATEPAGE_4ARGS
997 #
998 AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [
999 LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args],
1000 address_space_ops_migratepage_4args, [
1001         #include <linux/fs.h>
1002 #ifdef HAVE_MIGRATE_H
1003         #include <linux/migrate.h>
1004 #elif defined(HAVE_MIGRATE_MODE_H)
1005         #include <linux/migrate_mode.h>
1006 #endif
1007 ],[
1008         struct address_space_operations aops;
1009         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
1010 ],[
1011         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
1012                 [address_space_operations.migratepage has 4 args])
1013 ])
1014 ]) # LC_MIGRATEPAGE_4ARGS
1015
1016 #
1017 # LC_SUPEROPS_USE_DENTRY
1018 #
1019 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
1020 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
1021 #
1022 AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [
1023 tmp_flags="$EXTRA_KCFLAGS"
1024 EXTRA_KCFLAGS="-Werror"
1025 LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter],
1026 super_ops_dentry, [
1027         #include <linux/fs.h>
1028         int show_options(struct seq_file *seq, struct dentry *root) {
1029                 return 0;
1030         }
1031 ],[
1032         struct super_operations ops;
1033         ops.show_options = show_options;
1034 ],[
1035         AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
1036                 [super_operations use dentry as parameter])
1037 ])
1038 EXTRA_KCFLAGS="$tmp_flags"
1039 ]) # LC_SUPEROPS_USE_DENTRY
1040
1041 #
1042 # LC_INODEOPS_USE_UMODE_T
1043 #
1044 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
1045 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
1046 #
1047 AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [
1048 tmp_flags="$EXTRA_KCFLAGS"
1049 EXTRA_KCFLAGS="-Werror"
1050 LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter],
1051 inode_ops_umode_t, [
1052         #include <linux/fs.h>
1053         #include <linux/types.h>
1054         int my_mknod(struct inode *dir, struct dentry *dchild,
1055                      umode_t mode, dev_t dev)
1056         {
1057                 return 0;
1058         }
1059 ],[
1060         struct inode_operations ops;
1061         ops.mknod = my_mknod;
1062 ],[
1063         AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
1064                 [inode_operations use umode_t as parameter])
1065 ])
1066 EXTRA_KCFLAGS="$tmp_flags"
1067 ]) # LC_INODEOPS_USE_UMODE_T
1068
1069 #
1070 # LC_KMAP_ATOMIC_HAS_1ARG
1071 #
1072 # 3.4 kmap_atomic removes second argument
1073 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1074 #
1075 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [
1076 LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument],
1077 kmap_atomic_1arg, [
1078         #include <linux/highmem.h>
1079 ],[
1080         kmap_atomic(NULL);
1081 ],[
1082         AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1083                 [have kmap_atomic has only 1 argument])
1084 ])
1085 ]) # LC_KMAP_ATOMIC_HAS_1ARG
1086
1087 #
1088 # LC_HAVE_D_MAKE_ROOT
1089 #
1090 # 3.4 converts d_alloc_root to d_make_root
1091 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1092 #
1093 AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [
1094 LB_CHECK_COMPILE([if have 'd_make_root'],
1095 d_make_root, [
1096         #include <linux/fs.h>
1097 ],[
1098         d_make_root((struct inode *)NULL);
1099 ],[
1100         AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1101                 [have d_make_root])
1102 ])
1103 ]) # LC_HAVE_D_MAKE_ROOT
1104
1105 #
1106 # LC_HAVE_CACHE_REGISTER
1107 #
1108 # 3.4 cache_register/cache_unregister are removed
1109 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1110 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1111 # are defined, but not exported.
1112 # 3.3 cache_register_net/cache_unregister_net are
1113 # exported and replacing cache_register/cache_unregister in 3.4
1114 #
1115 AC_DEFUN([LC_HAVE_CACHE_REGISTER], [
1116 LB_CHECK_COMPILE([if have 'cache_register'],
1117 cache_register, [
1118         #include <linux/sunrpc/cache.h>
1119 ],[
1120         cache_register(NULL);
1121 ],[
1122         AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1123                 [have cache_register])
1124 ])
1125 ]) # LC_HAVE_CACHE_REGISTER
1126
1127 #
1128 # LC_HAVE_CLEAR_INODE
1129 #
1130 # 3.5 renames end_writeback() back to clear_inode()...
1131 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1132 #
1133 AC_DEFUN([LC_HAVE_CLEAR_INODE], [
1134 LB_CHECK_COMPILE([if have 'clear_inode'],
1135 clear_inode, [
1136         #include <linux/fs.h>
1137 ],[
1138         clear_inode((struct inode *)NULL);
1139 ],[
1140         AC_DEFINE(HAVE_CLEAR_INODE, 1,
1141                 [have clear_inode])
1142 ])
1143 ]) # LC_HAVE_CLEAR_INODE
1144
1145 #
1146 # LC_HAVE_ENCODE_FH_PARENT
1147 #
1148 # 3.5 encode_fh has parent inode passed in directly
1149 # see kernel commit b0b0382b
1150 #
1151 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [
1152 tmp_flags="$EXTRA_KCFLAGS"
1153 EXTRA_KCFLAGS="-Werror"
1154 LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter],
1155 encode_fh_parent_inode, [
1156         #include <linux/exportfs.h>
1157         #include <linux/fs.h>
1158         #include <linux/types.h>
1159         int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1160         {
1161                 return 0;
1162         }
1163 ],[
1164         struct export_operations exp_op;
1165         exp_op.encode_fh = ll_encode_fh;
1166 ],[
1167         AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1168                 [have parent inode as parameter])
1169 ])
1170 EXTRA_KCFLAGS="$tmp_flags"
1171 ]) # LC_HAVE_ENCODE_FH_PARENT
1172
1173 #
1174 # LC_FILE_LLSEEK_SIZE_5ARG
1175 #
1176 # 3.5 has generic_file_llseek_size with 5 args
1177 #
1178 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [
1179 LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args],
1180 generic_file_llseek_size_5args, [
1181         #include <linux/fs.h>
1182 ],[
1183         generic_file_llseek_size(NULL, 0, 0, 0, 0);
1184 ], [
1185         AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1186                 [kernel has generic_file_llseek_size with 5 args])
1187 ])
1188 ]) # LC_FILE_LLSEEK_SIZE_5ARG
1189
1190 #
1191 # LC_LLITE_DATA_IS_LIST
1192 #
1193 # 3.6 switch i_dentry/d_alias from list to hlist
1194 #
1195 # In the upstream kernels d_alias first changes
1196 # to a hlist and then in later version, 3.11, gets
1197 # moved to the union d_u. Due to some distros having
1198 # d_alias in the d_u union as a struct list, which
1199 # has never existed upstream stream, we can't test
1200 # if d_alias is a list or hlist directly. If ever
1201 # i_dentry and d_alias even up different combos then
1202 # the build will fail. In that case then we will need
1203 # to separate out the i_dentry and d_alias test below.
1204 #
1205 AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
1206 tmp_flags="$EXTRA_KCFLAGS"
1207 EXTRA_KCFLAGS="-Werror"
1208 LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
1209 i_dentry_d_alias_list, [
1210         #include <linux/fs.h>
1211 ],[
1212         struct inode inode;
1213         INIT_LIST_HEAD(&inode.i_dentry);
1214 ],[
1215         AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
1216                 [both i_dentry/d_alias uses list])
1217 ])
1218 EXTRA_KCFLAGS="$tmp_flags"
1219 ]) # LC_DATA_FOR_LLITE_IS_LIST
1220
1221 #
1222 # LC_DENTRY_OPEN_USE_PATH
1223 #
1224 # 3.6 dentry_open uses struct path as first argument
1225 # see kernel commit 765927b2
1226 #
1227 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [
1228 tmp_flags="$EXTRA_KCFLAGS"
1229 EXTRA_KCFLAGS="-Werror"
1230 LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument],
1231 dentry_open_path, [
1232         #include <linux/fs.h>
1233         #include <linux/path.h>
1234 ],[
1235         struct path path;
1236         dentry_open(&path, 0, NULL);
1237 ],[
1238         AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1239                 [dentry_open uses struct path as first argument])
1240 ])
1241 EXTRA_KCFLAGS="$tmp_flags"
1242 ]) # LC_DENTRY_OPEN_USE_PATH
1243
1244 #
1245 # LC_HAVE_IOP_ATOMIC_OPEN
1246 #
1247 # 3.6 vfs adds iop->atomic_open
1248 #
1249 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [
1250 LB_CHECK_COMPILE([if 'iop' has 'atomic_open'],
1251 inode_ops_atomic_open, [
1252         #include <linux/fs.h>
1253 ],[
1254         struct inode_operations iop;
1255         iop.atomic_open = NULL;
1256 ],[
1257         AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1258                 [have iop atomic_open])
1259 ])
1260 ]) # LC_HAVE_IOP_ATOMIC_OPEN
1261
1262 #
1263 # LC_HAVE_POSIXACL_USER_NS
1264 #
1265 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1266 #
1267 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [
1268 LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'],
1269 posix_acl_to_xattr_user_namespace, [
1270         #include <linux/fs.h>
1271         #include <linux/posix_acl_xattr.h>
1272 ],[
1273         posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1274 ],[
1275         AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1276                 [posix_acl_to_xattr takes struct user_namespace])
1277 ])
1278 ]) # LC_HAVE_POSIXACL_USER_NS
1279
1280 #
1281 # LC_HAVE_FILE_F_INODE
1282 #
1283 # 3.8 struct file has new member f_inode
1284 #
1285 AC_DEFUN([LC_HAVE_FILE_F_INODE], [
1286 LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'],
1287 file_f_inode, [
1288         #include <linux/fs.h>
1289 ],[
1290         ((struct file *)0)->f_inode = NULL;
1291 ],[
1292         AC_DEFINE(HAVE_FILE_F_INODE, 1,
1293                 [struct file has member f_inode])
1294 ])
1295 ]) # LC_HAVE_FILE_F_INODE
1296
1297 #
1298 # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1299 #
1300 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [
1301 LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args],
1302 sunrpc_cache_pipe_upcall_3args, [
1303         #include <linux/sunrpc/cache.h>
1304 ],[
1305         sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1306 ],[
1307         AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1308                 [sunrpc_cache_pipe_upcall takes 3 args])
1309 ])
1310 ]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1311
1312 #
1313 # LC_HAVE_HLIST_FOR_EACH_3ARG
1314 #
1315 # 3.9 uses hlist_for_each_entry with 3 args
1316 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1317 #
1318 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [
1319 LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args],
1320 hlist_for_each_entry_3args, [
1321         #include <linux/list.h>
1322         #include <linux/fs.h>
1323 ],[
1324         struct hlist_head *head = NULL;
1325         struct inode *inode;
1326
1327         hlist_for_each_entry(inode, head, i_hash) {
1328                 continue;
1329         }
1330 ],[
1331         AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1,
1332                 [hlist_for_each_entry has 3 args])
1333 ])
1334 ]) # LC_HAVE_HLIST_FOR_EACH_3ARG
1335
1336 #
1337 # LC_HAVE_BIO_END_SECTOR
1338 #
1339 # 3.9 introduces bio_end_sector macro
1340 # f73a1c7d117d07a96d89475066188a2b79e53c48
1341 #
1342 AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [
1343 LB_CHECK_COMPILE([if 'bio_end_sector' is defined],
1344 bio_end_sector, [
1345         #include <linux/bio.h>
1346 ],[
1347         struct bio bio;
1348
1349         bio_end_sector(&bio);
1350 ],[
1351         AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
1352                   [bio_end_sector is defined])
1353 ])
1354 ]) # LC_HAVE_BIO_END_SECTOR
1355
1356 #
1357 # LC_HAVE_REMOVE_PROC_SUBTREE
1358 #
1359 # 3.10 introduced remove_proc_subtree
1360 #
1361 AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [
1362 LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined],
1363 remove_proc_subtree, [
1364         #include <linux/proc_fs.h>
1365 ],[
1366         remove_proc_subtree(NULL, NULL);
1367 ], [
1368         AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1,
1369                   [remove_proc_subtree is defined])
1370 ])
1371 ]) # LC_HAVE_REMOVE_PROC_SUBTREE
1372
1373 #
1374 # LC_HAVE_PROC_REMOVE
1375 #
1376 # 3.10 introduced proc_remove
1377 #
1378 AC_DEFUN([LC_HAVE_PROC_REMOVE], [
1379 LB_CHECK_COMPILE([if 'proc_remove' is defined],
1380 proc_remove, [
1381         #include <linux/proc_fs.h>
1382 ],[
1383         proc_remove(NULL);
1384 ], [
1385         AC_DEFINE(HAVE_PROC_REMOVE, 1,
1386                   [proc_remove is defined])
1387 ])
1388 ]) # LC_HAVE_PROC_REMOVE
1389
1390 #
1391 # LC_BLKDEV_RELEASE_RETURN_INT
1392 #
1393 # 3.10 release for block device doesn't return int
1394 #
1395 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT], [
1396 LB_CHECK_COMPILE([if 'block_device_operations' release returns 'int'],
1397 block_device_ops_release_return_int, [
1398         #include <linux/blkdev.h>
1399 ],[
1400         struct block_device_operations fops;
1401         int i __attribute__ ((unused));
1402
1403         i = fops.release(NULL, 0);
1404 ],[
1405         AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1406                 [block device release returns int])
1407 ])
1408 ]) # LC_BLKDEV_RELEASE_RETURN_INT
1409
1410 #
1411 # LC_INVALIDATE_RANGE
1412 #
1413 # 3.11 invalidatepage requires the length of the range to invalidate
1414 #
1415 AC_DEFUN([LC_INVALIDATE_RANGE], [
1416 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
1417 address_space_ops_invalidatepage_3args, [
1418         #include <linux/fs.h>
1419 ],[
1420         struct address_space_operations a_ops;
1421         a_ops.invalidatepage(NULL, 0, 0);
1422 ],[
1423         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
1424                 [address_space_operations.invalidatepage needs 3 arguments])
1425 ])
1426 ]) # LC_INVALIDATE_RANGE
1427
1428 #
1429 # LC_HAVE_DIR_CONTEXT
1430 #
1431 # 3.11 readdir now takes the new struct dir_context
1432 #
1433 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
1434 LB_CHECK_COMPILE([if 'dir_context' exist],
1435 dir_context, [
1436         #include <linux/fs.h>
1437 ],[
1438         struct dir_context ctx;
1439         ctx.pos = 0;
1440 ],[
1441         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
1442                 [dir_context exist])
1443 ])
1444 ]) # LC_HAVE_DIR_CONTEXT
1445
1446 #
1447 # LC_D_COMPARE_5ARGS
1448 #
1449 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1450 #
1451 AC_DEFUN([LC_D_COMPARE_5ARGS], [
1452 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
1453 d_compare_5args, [
1454         #include <linux/dcache.h>
1455 ],[
1456         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1457 ],[
1458         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1459                 [d_compare need 5 arguments])
1460 ])
1461 ]) # LC_D_COMPARE_5ARGS
1462
1463 #
1464 # LC_HAVE_DCOUNT
1465 #
1466 # 3.11 need to access d_count to get dentry reference count
1467 #
1468 AC_DEFUN([LC_HAVE_DCOUNT], [
1469 LB_CHECK_COMPILE([if 'd_count' exist],
1470 d_count, [
1471         #include <linux/dcache.h>
1472 ],[
1473         struct dentry de;
1474         d_count(&de);
1475 ],[
1476         AC_DEFINE(HAVE_D_COUNT, 1,
1477                 [d_count exist])
1478 ])
1479 ]) # LC_HAVE_DCOUNT
1480
1481 #
1482 # LC_OLDSIZE_TRUNCATE_PAGECACHE
1483 #
1484 # 3.12 truncate_pagecache without oldsize parameter
1485 #
1486 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
1487 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
1488 truncate_pagecache_old_size, [
1489         #include <linux/mm.h>
1490 ],[
1491         truncate_pagecache(NULL, 0, 0);
1492 ],[
1493         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
1494                 [with oldsize])
1495 ])
1496 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
1497
1498 #
1499 # LC_HAVE_DENTRY_D_U_D_ALIAS
1500 #
1501 # 3.11 kernel moved d_alias to the union d_u in struct dentry
1502 #
1503 # Some distros move d_alias to d_u but it is still a struct list
1504 #
1505 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
1506 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
1507         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
1508         d_alias, [
1509                 #include <linux/list.h>
1510                 #include <linux/dcache.h>
1511         ],[
1512                 struct dentry de;
1513                 INIT_LIST_HEAD(&de.d_u.d_alias);
1514         ],[
1515                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1516                         [list dentry.d_u.d_alias exist])
1517         ])
1518 ],[
1519         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
1520         d_alias, [
1521                 #include <linux/list.h>
1522                 #include <linux/dcache.h>
1523         ],[
1524                 struct dentry de;
1525                 INIT_HLIST_NODE(&de.d_u.d_alias);
1526         ],[
1527                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1528                         [hlist dentry.d_u.d_alias exist])
1529         ])
1530 ])
1531 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
1532
1533 #
1534 # LC_HAVE_DENTRY_D_CHILD
1535 #
1536 # 3.11 kernel d_child has been moved out of the union d_u
1537 # in struct dentry
1538 #
1539 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
1540 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
1541 d_child, [
1542         #include <linux/list.h>
1543         #include <linux/dcache.h>
1544 ],[
1545         struct dentry de;
1546         INIT_LIST_HEAD(&de.d_child);
1547 ],[
1548         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
1549                 [dentry.d_child exist])
1550 ])
1551 ]) # LC_HAVE_DENTRY_D_CHILD
1552
1553 #
1554 # LC_KIOCB_KI_LEFT
1555 #
1556 # 3.12 ki_left removed from struct kiocb
1557 #
1558 AC_DEFUN([LC_KIOCB_KI_LEFT], [
1559 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
1560 kiocb_ki_left, [
1561         #include <linux/aio.h>
1562 ],[
1563         ((struct kiocb*)0)->ki_left = 0;
1564 ],[
1565         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
1566                 [ki_left exist])
1567 ])
1568 ]) # LC_KIOCB_KI_LEFT
1569
1570 #
1571 # LC_VFS_RENAME_5ARGS
1572 #
1573 # 3.13 has vfs_rename with 5 args
1574 #
1575 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
1576 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
1577 vfs_rename_5args, [
1578         #include <linux/fs.h>
1579 ],[
1580         vfs_rename(NULL, NULL, NULL, NULL, NULL);
1581 ], [
1582         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
1583                 [kernel has vfs_rename with 5 args])
1584 ])
1585 ]) # LC_VFS_RENAME_5ARGS
1586
1587 #
1588 # LC_VFS_UNLINK_3ARGS
1589 #
1590 # 3.13 has vfs_unlink with 3 args
1591 #
1592 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
1593 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
1594 vfs_unlink_3args, [
1595         #include <linux/fs.h>
1596 ],[
1597         vfs_unlink(NULL, NULL, NULL);
1598 ], [
1599         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
1600                 [kernel has vfs_unlink with 3 args])
1601 ])
1602 ]) # LC_VFS_UNLINK_3ARGS
1603
1604 #
1605 # LC_HAVE_BVEC_ITER
1606 #
1607 # 3.14 move some of its data in struct bio into the new
1608 # struct bvec_iter
1609 #
1610 AC_DEFUN([LC_HAVE_BVEC_ITER], [
1611 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
1612 have_bvec_iter, [
1613         #include <linux/bio.h>
1614 ],[
1615         struct bvec_iter iter;
1616         iter.bi_bvec_done = 0;
1617 ], [
1618         AC_DEFINE(HAVE_BVEC_ITER, 1,
1619                 [kernel has struct bvec_iter])
1620 ])
1621 ]) # LC_HAVE_BVEC_ITER
1622
1623 #
1624 # LC_HAVE_TRUNCATE_IPAGE_FINAL
1625 #
1626 # 3.14 bring truncate_inode_pages_final for evict_inode
1627 #
1628 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
1629 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
1630 truncate_ipages_final, [
1631         #include <linux/mm.h>
1632 ],[
1633         truncate_inode_pages_final(NULL);
1634 ], [
1635         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
1636                 [kernel has truncate_inode_pages_final])
1637 ])
1638 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
1639
1640 #
1641 # LC_VFS_RENAME_6ARGS
1642 #
1643 # 3.15 has vfs_rename with 6 args
1644 #
1645 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
1646 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
1647 vfs_rename_6args, [
1648         #include <linux/fs.h>
1649 ],[
1650         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
1651 ], [
1652         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
1653                 [kernel has vfs_rename with 6 args])
1654 ])
1655 ]) # LC_VFS_RENAME_6ARGS
1656
1657 #
1658 # LC_DIRECTIO_USE_ITER
1659 #
1660 # 3.16 kernel changes direct IO to use iov_iter
1661 #
1662 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
1663 LB_CHECK_COMPILE([if direct IO uses iov_iter],
1664 direct_io_iter, [
1665         #include <linux/fs.h>
1666 ],[
1667         struct address_space_operations ops;
1668         struct iov_iter *iter = NULL;
1669         loff_t offset = 0;
1670
1671         ops.direct_IO(0, NULL, iter, offset);
1672 ],[
1673         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
1674                 [direct IO uses iov_iter])
1675 ])
1676 ]) # LC_DIRECTIO_USE_ITER
1677
1678 #
1679 # LC_HAVE_IOV_ITER_INIT_DIRECTION
1680 #
1681 #
1682 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
1683 #      changed iov_iter_init api to start accepting a tag
1684 #      that defines if its a read or write operation
1685 #
1686 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
1687 tmp_flags="$EXTRA_KCFLAGS"
1688 EXTRA_KCFLAGS="-Werror"
1689 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
1690 iter_init, [
1691         #include <linux/uio.h>
1692         #include <linux/fs.h>
1693 ],[
1694         const struct iovec *iov = NULL;
1695
1696         iov_iter_init(NULL, READ, iov, 1, 0);
1697 ],[
1698         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
1699                 [iov_iter_init handles directional tag])
1700 ])
1701 EXTRA_KCFLAGS="$tmp_flags"
1702 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
1703
1704 #
1705 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1706 #
1707 # 3.16 introduces [read|write]_iter to struct file_operations
1708 #
1709 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1710 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
1711 file_function_iter, [
1712         #include <linux/fs.h>
1713 ],[
1714         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
1715         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
1716 ],[
1717         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
1718                 [file_operations.[read|write]_iter functions exist])
1719 ])
1720 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1721
1722 #
1723 # LC_KEY_MATCH_DATA
1724 #
1725 # 3.17  replaces key_type::match with match_preparse
1726 #       and has new struct key_match_data
1727 #
1728 AC_DEFUN([LC_KEY_MATCH_DATA], [
1729 LB_CHECK_COMPILE([if struct key_match field exist],
1730 key_match, [
1731         #include <linux/key-type.h>
1732 ],[
1733         struct key_match_data data;
1734 ],[
1735         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
1736                 [struct key_match_data exist])
1737 ])
1738 ]) # LC_KEY_MATCH_DATA
1739
1740 #
1741 # LC_NFS_FILLDIR_USE_CTX
1742 #
1743 # 3.18 kernel moved from void cookie to struct dir_context
1744 #
1745 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1746 tmp_flags="$EXTRA_KCFLAGS"
1747 EXTRA_KCFLAGS="-Werror"
1748 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
1749 filldir_ctx, [
1750         #include <linux/fs.h>
1751 ],[
1752         int filldir(struct dir_context *ctx, const char* name,
1753                     int i, loff_t off, u64 tmp, unsigned temp)
1754         {
1755                 return 0;
1756         }
1757
1758         struct dir_context ctx = {
1759                 .actor = filldir,
1760         };
1761
1762         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1763 ],[
1764         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1765                 [filldir_t needs struct dir_context as argument])
1766 ])
1767 EXTRA_KCFLAGS="$tmp_flags"
1768 ]) # LC_NFS_FILLDIR_USE_CTX
1769
1770 #
1771 # LC_PERCPU_COUNTER_INIT
1772 #
1773 # 3.18  For kernels 3.18 and after percpu_counter_init starts
1774 #       to pass a GFP_* memory allocation flag for internal
1775 #       memory allocation purposes.
1776 #
1777 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1778 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1779 percpu_counter_init, [
1780         #include <linux/percpu_counter.h>
1781 ],[
1782         percpu_counter_init(NULL, 0, GFP_KERNEL);
1783 ],[
1784         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1785                 [percpu_counter_init uses GFP_* flag])
1786 ])
1787 ]) # LC_PERCPU_COUNTER_INIT
1788
1789 #
1790 # LC_KIOCB_HAS_NBYTES
1791 #
1792 # 3.19 kernel removed ki_nbytes from struct kiocb
1793 #
1794 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1795 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1796 ki_nbytes, [
1797         #include <linux/fs.h>
1798 ],[
1799         struct kiocb iocb;
1800
1801         iocb.ki_nbytes = 0;
1802 ],[
1803         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1804 ])
1805 ]) # LC_KIOCB_HAS_NBYTES
1806
1807 #
1808 # LC_BACKING_DEV_INFO_REMOVAL
1809 #
1810 # 3.20 kernel removed backing_dev_info from address_space
1811 #
1812 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1813 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
1814 backing_dev_info, [
1815         #include <linux/fs.h>
1816 ],[
1817         struct address_space mapping;
1818
1819         mapping.backing_dev_info = NULL;
1820 ],[
1821         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1822 ])
1823 ]) # LC_BACKING_DEV_INFO_REMOVAL
1824
1825 #
1826 # LC_HAVE_BDI_CAP_MAP_COPY
1827 #
1828 # 3.20  removed mmap handling for backing devices since
1829 #       it breaks on non-MMU systems. See kernel commit
1830 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
1831 #
1832 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1833 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
1834 bdi_cap_map_copy, [
1835         #include <linux/backing-dev.h>
1836 ],[
1837         struct backing_dev_info info;
1838
1839         info.capabilities = BDI_CAP_MAP_COPY;
1840 ],[
1841         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1842                 [BDI_CAP_MAP_COPY exist])
1843 ])
1844 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1845
1846 #
1847 # LC_CANCEL_DIRTY_PAGE
1848 #
1849 # 4.0.0 kernel removed cancel_dirty_page
1850 #
1851 AC_DEFUN([LC_CANCEL_DIRTY_PAGE], [
1852 LB_CHECK_COMPILE([if cancel_dirty_page still exist],
1853 cancel_dirty_page, [
1854         #include <linux/mm.h>
1855 ],[
1856         cancel_dirty_page(NULL, PAGE_SIZE);
1857 ],[
1858         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1859                 [cancel_dirty_page is still available])
1860 ])
1861 ]) # LC_CANCEL_DIRTY_PAGE
1862
1863 #
1864 # LC_IOV_ITER_RW
1865 #
1866 # 4.1 kernel has iov_iter_rw
1867 #
1868 AC_DEFUN([LC_IOV_ITER_RW], [
1869 LB_CHECK_COMPILE([if iov_iter_rw exist],
1870 iov_iter_rw, [
1871         #include <linux/fs.h>
1872         #include <linux/uio.h>
1873 ],[
1874         struct iov_iter *iter = NULL;
1875
1876         iov_iter_rw(iter);
1877 ],[
1878         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1879                 [iov_iter_rw exist])
1880 ])
1881 ]) # LC_IOV_ITER_RW
1882
1883 #
1884 # LC_HAVE_SYNC_READ_WRITE
1885 #
1886 # 4.1 new_sync_[read|write] no longer exported
1887 #
1888 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1889 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1890         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1891                         [new_sync_[read|write] is exported by the kernel])])
1892 ]) # LC_HAVE_SYNC_READ_WRITE
1893
1894 #
1895 # LC_NEW_CANCEL_DIRTY_PAGE
1896 #
1897 # 4.2 kernel has new cancel_dirty_page
1898 #
1899 AC_DEFUN([LC_NEW_CANCEL_DIRTY_PAGE], [
1900 LB_CHECK_COMPILE([if cancel_dirty_page with one argument exist],
1901 new_cancel_dirty_page, [
1902         #include <linux/mm.h>
1903 ],[
1904         cancel_dirty_page(NULL);
1905 ],[
1906         AC_DEFINE(HAVE_NEW_CANCEL_DIRTY_PAGE, 1,
1907                 [cancel_dirty_page with one arguement is available])
1908 ])
1909 ]) # LC_NEW_CANCEL_DIRTY_PAGE
1910
1911 #
1912 # LC_SYMLINK_OPS_USE_NAMEIDATA
1913 #
1914 # For the 4.2+ kernels the file system internal symlink api no
1915 # longer uses struct nameidata as a argument
1916 #
1917 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1918 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
1919 symlink_use_nameidata, [
1920         #include <linux/namei.h>
1921         #include <linux/fs.h>
1922 ],[
1923         struct nameidata *nd = NULL;
1924
1925         ((struct inode_operations *)0)->follow_link(NULL, nd);
1926         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1927 ],[
1928         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1929                 [symlink inode operations need struct nameidata argument])
1930 ])
1931 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1932
1933 #
1934 # LC_BIO_ENDIO_USES_ONE_ARG
1935 #
1936 # 4.2 kernel bio_endio now only takes one argument
1937 #
1938 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1939 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
1940 bio_endio, [
1941         #include <linux/bio.h>
1942 ],[
1943         bio_endio(NULL);
1944 ],[
1945         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1946                 [bio_endio takes only one argument])
1947 ])
1948 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1949
1950 #
1951 # LC_PROG_LINUX
1952 #
1953 # Lustre linux kernel checks
1954 #
1955 AC_DEFUN([LC_PROG_LINUX], [
1956         AC_MSG_NOTICE([Lustre kernel checks
1957 ==============================================================================])
1958
1959         LC_CONFIG_PINGER
1960         LC_CONFIG_CHECKSUM
1961         LC_CONFIG_HEALTH_CHECK_WRITE
1962         LC_CONFIG_LRU_RESIZE
1963         LC_LLITE_LLOOP_MODULE
1964
1965         LC_GLIBC_SUPPORT_FHANDLES
1966         LC_CONFIG_RMTCLIENT
1967         LC_CONFIG_GSS
1968
1969         # 2.6.32
1970         LC_BLK_QUEUE_MAX_SEGMENTS
1971
1972         # 2.6.34
1973         LC_HAVE_DQUOT_FS_DISK_QUOTA
1974         LC_HAVE_DQUOT_SUSPEND
1975         LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
1976
1977         # 2.6.35, 3.0.0
1978         LC_FILE_FSYNC
1979         LC_EXPORT_SIMPLE_SETATTR
1980         LC_EXPORT_TRUNCATE_COMPLETE_PAGE
1981
1982         # 2.6.36
1983         LC_FS_STRUCT_RWLOCK
1984         LC_SBOPS_EVICT_INODE
1985
1986         # 2.6.37
1987         LC_KERNEL_LOCKED
1988
1989         # 2.6.38
1990         LC_BLKDEV_GET_BY_DEV
1991         LC_GENERIC_PERMISSION
1992         LC_DCACHE_LOCK
1993         LC_INODE_I_RCU
1994         LC_D_COMPARE_7ARGS
1995         LC_D_DELETE_CONST
1996
1997         # 2.6.39
1998         LC_REQUEST_QUEUE_UNPLUG_FN
1999         LC_HAVE_FHANDLE_SYSCALLS
2000         LC_HAVE_FSTYPE_MOUNT
2001         LC_IOP_TRUNCATE
2002         LC_HAVE_INODE_OWNER_OR_CAPABLE
2003         LC_HAVE_SECURITY_IINITSEC
2004
2005         # 3.0
2006         LC_DIRTY_INODE_WITH_FLAG
2007
2008         # 3.1
2009         LC_LM_XXX_LOCK_MANAGER_OPS
2010         LC_INODE_DIO_WAIT
2011         LC_IOP_GET_ACL
2012         LC_FILE_LLSEEK_SIZE
2013         LC_INODE_PERMISION_2ARGS
2014         LC_RADIX_EXCEPTION_ENTRY
2015
2016         # 3.2
2017         LC_HAVE_VOID_MAKE_REQUEST_FN
2018         LC_HAVE_PROTECT_I_NLINK
2019
2020         # 3.3
2021         LC_HAVE_MIGRATE_HEADER
2022         LC_MIGRATEPAGE_4ARGS
2023         LC_SUPEROPS_USE_DENTRY
2024         LC_INODEOPS_USE_UMODE_T
2025         LC_HAVE_CACHE_REGISTER
2026
2027         # 3.4
2028         LC_HAVE_D_MAKE_ROOT
2029         LC_KMAP_ATOMIC_HAS_1ARG
2030
2031         # 3.5
2032         LC_HAVE_CLEAR_INODE
2033         LC_HAVE_ENCODE_FH_PARENT
2034         LC_FILE_LLSEEK_SIZE_5ARG
2035
2036         # 3.6
2037         LC_DATA_FOR_LLITE_IS_LIST
2038         LC_DENTRY_OPEN_USE_PATH
2039         LC_HAVE_IOP_ATOMIC_OPEN
2040
2041         # 3.7
2042         LC_HAVE_POSIXACL_USER_NS
2043
2044         # 3.8
2045         LC_HAVE_FILE_F_INODE
2046         LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
2047
2048         # 3.9
2049         LC_HAVE_HLIST_FOR_EACH_3ARG
2050         LC_HAVE_BIO_END_SECTOR
2051
2052         # 3.10
2053         LC_BLKDEV_RELEASE_RETURN_INT
2054         LC_HAVE_REMOVE_PROC_SUBTREE
2055         LC_HAVE_PROC_REMOVE
2056
2057         # 3.11
2058         LC_INVALIDATE_RANGE
2059         LC_HAVE_DIR_CONTEXT
2060         LC_D_COMPARE_5ARGS
2061         LC_HAVE_DCOUNT
2062         LC_HAVE_DENTRY_D_U_D_ALIAS
2063         LC_HAVE_DENTRY_D_CHILD
2064
2065         # 3.12
2066         LC_OLDSIZE_TRUNCATE_PAGECACHE
2067         LC_KIOCB_KI_LEFT
2068
2069         # 3.13
2070         LC_VFS_RENAME_5ARGS
2071         LC_VFS_UNLINK_3ARGS
2072
2073         # 3.14
2074         LC_HAVE_BVEC_ITER
2075         LC_HAVE_TRUNCATE_IPAGES_FINAL
2076
2077         # 3.15
2078         LC_VFS_RENAME_6ARGS
2079
2080         # 3.16
2081         LC_DIRECTIO_USE_ITER
2082         LC_HAVE_IOV_ITER_INIT_DIRECTION
2083         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2084
2085         # 3.17
2086         LC_KEY_MATCH_DATA
2087
2088         # 3.18
2089         LC_PERCPU_COUNTER_INIT
2090         LC_NFS_FILLDIR_USE_CTX
2091
2092         # 3.19
2093         LC_KIOCB_HAS_NBYTES
2094
2095         # 3.20
2096         LC_BACKING_DEV_INFO_REMOVAL
2097         LC_HAVE_BDI_CAP_MAP_COPY
2098
2099         # 4.0.0
2100         LC_CANCEL_DIRTY_PAGE
2101
2102         # 4.1.0
2103         LC_IOV_ITER_RW
2104         LC_HAVE_SYNC_READ_WRITE
2105
2106         # 4.2
2107         LC_NEW_CANCEL_DIRTY_PAGE
2108         LC_BIO_ENDIO_USES_ONE_ARG
2109         LC_SYMLINK_OPS_USE_NAMEIDATA
2110
2111         #
2112         AS_IF([test "x$enable_server" != xno], [
2113                 LC_FUNC_DEV_SET_RDONLY
2114                 LC_STACK_SIZE
2115                 LC_QUOTA64
2116                 LC_QUOTA_CONFIG
2117         ])
2118 ]) # LC_PROG_LINUX
2119
2120 #
2121 # LC_CONFIG_CLIENT
2122 #
2123 # Check whether to build the client side of Lustre
2124 #
2125 AC_DEFUN([LC_CONFIG_CLIENT], [
2126 AC_MSG_CHECKING([whether to build Lustre client support])
2127 AC_ARG_ENABLE([client],
2128         AC_HELP_STRING([--disable-client],
2129                 [disable Lustre client support]),
2130         [], [enable_client="yes"])
2131 AC_MSG_RESULT([$enable_client])
2132 ]) # LC_CONFIG_CLIENT
2133
2134 #
2135 # --enable-mpitests
2136 #
2137 AC_DEFUN([LB_CONFIG_MPITESTS], [
2138 AC_ARG_ENABLE([mpitests],
2139         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2140                        [include mpi tests]), [
2141                 enable_mpitests="yes"
2142                 case $enableval in
2143                 yes)
2144                         MPICC_WRAPPER="mpicc"
2145                         ;;
2146                 no)
2147                         enable_mpitests="no"
2148                         ;;
2149                 *)
2150                         MPICC_WRAPPER=$enableval
2151                         ;;
2152                 esac
2153         ], [
2154                 enable_mpitests="yes"
2155                 MPICC_WRAPPER="mpicc"
2156         ])
2157
2158         if test "x$enable_mpitests" != "xno"; then
2159                 oldcc=$CC
2160                 CC=$MPICC_WRAPPER
2161                 AC_CACHE_CHECK([whether mpitests can be built],
2162                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2163                         #include <mpi.h>
2164                         int main(void) {
2165                                 int flag;
2166                                 MPI_Initialized(&flag);
2167                                 return 0;
2168                         }
2169                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
2170                 ])
2171                 enable_mpitests=$lb_cv_mpi_tests
2172                 CC=$oldcc
2173         fi
2174         AC_SUBST(MPICC_WRAPPER)
2175 ]) # LB_CONFIG_MPITESTS
2176
2177 #
2178 # LC_CONFIG_QUOTA
2179 #
2180 # whether to enable quota support global control
2181 #
2182 AC_DEFUN([LC_CONFIG_QUOTA], [
2183 AC_MSG_CHECKING([whether to enable quota support global control])
2184 AC_ARG_ENABLE([quota],
2185         AC_HELP_STRING([--enable-quota],
2186                 [enable quota support]),
2187         [], [enable_quota="yes"])
2188 AS_IF([test "x$enable_quota" = xyes],
2189         [AC_MSG_RESULT([yes])],
2190         [AC_MSG_RESULT([no])])
2191 ]) # LC_CONFIG_QUOTA
2192
2193 #
2194 # LC_QUOTA
2195 #
2196 AC_DEFUN([LC_QUOTA], [
2197 #check global
2198 LC_CONFIG_QUOTA
2199 #check for utils
2200 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
2201         AC_CHECK_HEADER([sys/quota.h],
2202                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
2203                         [Define to 1 if you have <sys/quota.h>.])],
2204                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2205 ])
2206 ]) # LC_QUOTA
2207
2208 #
2209 # LC_CONFIG_NODEMAP_PROC_DEBUG
2210 #
2211 # enable nodemap proc file debugging
2212 #
2213 AC_DEFUN([LC_NODEMAP_PROC_DEBUG], [
2214 AC_MSG_CHECKING([whether to enable nodemap proc debug])
2215 AC_ARG_ENABLE([nodemap_proc_debug],
2216         AC_HELP_STRING([--enable-nodemap-proc-debug],
2217                 [enable nodemap proc debug]),
2218         [], [enable_nodemap_proc_debug="no"])
2219 AC_MSG_RESULT([$enable_nodemap_proc_debug])
2220 AS_IF([test "x$enable_nodemap_proc_debug" != xno],
2221         [AC_DEFINE(NODEMAP_PROC_DEBUG, 1,
2222                 [enable nodemap proc debug support])])
2223 ]) # LC_NODEMAP_PROC_DEBUG
2224
2225 #
2226 # LC_LLITE_LLOOP_MODULE
2227 #
2228 # lloop_llite.ko does not currently work with page sizes
2229 # of 64k or larger.
2230 #
2231 AC_DEFUN([LC_LLITE_LLOOP_MODULE], [
2232 LB_CHECK_COMPILE([whether to enable 'llite_lloop' module],
2233 enable_llite_lloop_module, [
2234         #include <asm/page.h>
2235 ],[
2236         #if PAGE_SIZE >= 65536
2237         #error "PAGE_SIZE >= 65536"
2238         #endif
2239 ],
2240         [enable_llite_lloop_module="yes"],
2241         [enable_llite_lloop_module="no"])
2242 ]) # LC_LLITE_LLOOP_MODULE
2243
2244 #
2245 # LC_OSD_ADDON
2246 #
2247 # configure support for optional OSD implementation
2248 #
2249 AC_DEFUN([LC_OSD_ADDON], [
2250 AC_MSG_CHECKING([whether to use OSD addon])
2251 AC_ARG_WITH([osd],
2252         AC_HELP_STRING([--with-osd=path],
2253                 [set path to optional osd]),
2254         [
2255         case "$with_osd" in
2256         no)
2257                 ENABLEOSDADDON=0
2258                 ;;
2259         *)
2260                 OSDADDON="$with_osd"
2261                 ENABLEOSDADDON=1
2262                 ;;
2263         esac
2264         ], [
2265                 ENABLEOSDADDON=0
2266         ])
2267 AS_IF([test $ENABLEOSDADDON -eq 0], [
2268         AC_MSG_RESULT([no])
2269         OSDADDON=""
2270 ], [
2271         OSDMODNAME=$(basename $OSDADDON)
2272         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
2273                 AC_MSG_RESULT([can't link])
2274                 OSDADDON=""
2275         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
2276                 AC_MSG_RESULT([$OSDMODNAME])
2277                 OSDADDON="subdir-m += $OSDMODNAME"
2278         ], [
2279                 AC_MSG_RESULT([can't link])
2280                 OSDADDON=""
2281         ])
2282 ])
2283 AC_SUBST(OSDADDON)
2284 ]) # LC_OSD_ADDON
2285
2286 #
2287 # LC_CONFIGURE
2288 #
2289 # other configure checks
2290 #
2291 AC_DEFUN([LC_CONFIGURE], [
2292 AC_MSG_NOTICE([Lustre core checks
2293 ==============================================================================])
2294
2295 LC_CONFIG_OBD_BUFFER_SIZE
2296
2297 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
2298         [CFLAGS="$CFLAGS -Wall -Werror"])
2299
2300 # maximum MDS thread count
2301 LC_MDS_MAX_THREADS
2302
2303 # lustre/utils/gss/gss_util.c
2304 # lustre/utils/gss/gssd_proc.c
2305 # lustre/utils/gss/krb5_util.c
2306 # lustre/utils/llog_reader.c
2307 # lustre/utils/create_iam.c
2308 # lustre/utils/libiam.c
2309 AC_CHECK_HEADERS([netdb.h endian.h])
2310 AC_CHECK_FUNCS([gethostbyname])
2311
2312 # lustre/utils/llverdev.c
2313 AC_CHECK_HEADERS([blkid/blkid.h])
2314
2315 # lustre/utils/llverfs.c
2316 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2317
2318 SELINUX=""
2319 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2320         [AC_CHECK_HEADERS([selinux/selinux.h],
2321                         [SELINUX="-lselinux"
2322                         AC_DEFINE([HAVE_SELINUX], 1,
2323                                 [support for selinux ])],
2324                         [AC_MSG_WARN([
2325
2326 No libselinux-devel package found, unable to build selinux enabled tools
2327 ])
2328 ])],
2329         [AC_MSG_WARN([
2330
2331 No selinux package found, unable to build selinux enabled tools
2332 ])
2333 ])
2334 AC_SUBST(SELINUX)
2335
2336 # Super safe df
2337 AC_MSG_CHECKING([whether to report minimum OST free space])
2338 AC_ARG_ENABLE([mindf],
2339         AC_HELP_STRING([--enable-mindf],
2340                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2341         [], [enable_mindf="no"])
2342 AC_MSG_RESULT([$enable_mindf])
2343 AS_IF([test "$enable_mindf" = "yes"],
2344         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2345
2346 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2347 AC_ARG_ENABLE([fail_alloc],
2348         AC_HELP_STRING([--disable-fail-alloc],
2349                 [disable randomly alloc failure]),
2350         [], [enable_fail_alloc="yes"])
2351 AC_MSG_RESULT([$enable_fail_alloc])
2352 AS_IF([test "x$enable_fail_alloc" != xno],
2353         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2354                 [enable randomly alloc failure])])
2355
2356 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2357 AC_ARG_ENABLE([invariants],
2358         AC_HELP_STRING([--enable-invariants],
2359                 [enable invariant checking (cpu intensive)]),
2360         [], [enable_invariants="no"])
2361 AC_MSG_RESULT([$enable_invariants])
2362 AS_IF([test "x$enable_invariants" = xyes],
2363         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2364                 [enable invariant checking])])
2365
2366 AC_MSG_CHECKING([whether to track references with lu_ref])
2367 AC_ARG_ENABLE([lu_ref],
2368         AC_HELP_STRING([--enable-lu_ref],
2369                 [enable lu_ref reference tracking code]),
2370         [], [enable_lu_ref="no"])
2371 AC_MSG_RESULT([$enable_lu_ref])
2372 AS_IF([test "x$enable_lu_ref" = xyes],
2373         [AC_DEFINE([USE_LU_REF], 1,
2374                 [enable lu_ref reference tracking code])])
2375
2376 AC_MSG_CHECKING([whether to enable page state tracking])
2377 AC_ARG_ENABLE([pgstate-track],
2378         AC_HELP_STRING([--enable-pgstate-track],
2379                 [enable page state tracking]),
2380         [], [enable_pgstat_track="no"])
2381 AC_MSG_RESULT([$enable_pgstat_track])
2382 AS_IF([test "x$enable_pgstat_track" = xyes],
2383         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2384                 [enable page state tracking code])])
2385 ]) # LC_CONFIGURE
2386
2387 #
2388 # LC_CONDITIONALS
2389 #
2390 # AM_CONDITIONALS for lustre
2391 #
2392 AC_DEFUN([LC_CONDITIONALS], [
2393 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2394 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2395 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2396 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2397 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2398 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2399 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2400 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2401 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2402 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2403 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2404 ]) # LC_CONDITIONALS
2405
2406 #
2407 # LC_CONFIG_FILES
2408 #
2409 # files that should be generated with AC_OUTPUT
2410 #
2411 AC_DEFUN([LC_CONFIG_FILES],
2412 [AC_CONFIG_FILES([
2413 lustre/Makefile
2414 lustre/autoMakefile
2415 lustre/autoconf/Makefile
2416 lustre/conf/Makefile
2417 lustre/contrib/Makefile
2418 lustre/doc/Makefile
2419 lustre/include/Makefile
2420 lustre/include/lustre_ver.h
2421 lustre/include/lustre/Makefile
2422 lustre/kernel_patches/targets/3.10-rhel7.target
2423 lustre/kernel_patches/targets/2.6-rhel6.7.target
2424 lustre/kernel_patches/targets/2.6-rhel6.6.target
2425 lustre/kernel_patches/targets/2.6-rhel6.target
2426 lustre/kernel_patches/targets/2.6-rhel5.target
2427 lustre/kernel_patches/targets/2.6-sles11.target
2428 lustre/kernel_patches/targets/3.0-sles11.target
2429 lustre/kernel_patches/targets/3.0-sles11sp3.target
2430 lustre/kernel_patches/targets/3.12-sles12.target
2431 lustre/kernel_patches/targets/2.6-fc11.target
2432 lustre/kernel_patches/targets/2.6-fc12.target
2433 lustre/kernel_patches/targets/2.6-fc15.target
2434 lustre/kernel_patches/targets/3.x-fc18.target
2435 lustre/ldlm/Makefile
2436 lustre/fid/Makefile
2437 lustre/fid/autoMakefile
2438 lustre/llite/Makefile
2439 lustre/llite/autoMakefile
2440 lustre/lov/Makefile
2441 lustre/lov/autoMakefile
2442 lustre/mdc/Makefile
2443 lustre/mdc/autoMakefile
2444 lustre/lmv/Makefile
2445 lustre/lmv/autoMakefile
2446 lustre/lfsck/Makefile
2447 lustre/lfsck/autoMakefile
2448 lustre/mdt/Makefile
2449 lustre/mdt/autoMakefile
2450 lustre/mdd/Makefile
2451 lustre/mdd/autoMakefile
2452 lustre/fld/Makefile
2453 lustre/fld/autoMakefile
2454 lustre/obdclass/Makefile
2455 lustre/obdclass/autoMakefile
2456 lustre/obdclass/linux/Makefile
2457 lustre/obdecho/Makefile
2458 lustre/obdecho/autoMakefile
2459 lustre/ofd/Makefile
2460 lustre/ofd/autoMakefile
2461 lustre/osc/Makefile
2462 lustre/osc/autoMakefile
2463 lustre/ost/Makefile
2464 lustre/ost/autoMakefile
2465 lustre/osd-ldiskfs/Makefile
2466 lustre/osd-ldiskfs/autoMakefile
2467 lustre/osd-zfs/Makefile
2468 lustre/osd-zfs/autoMakefile
2469 lustre/mgc/Makefile
2470 lustre/mgc/autoMakefile
2471 lustre/mgs/Makefile
2472 lustre/mgs/autoMakefile
2473 lustre/target/Makefile
2474 lustre/ptlrpc/Makefile
2475 lustre/ptlrpc/autoMakefile
2476 lustre/ptlrpc/gss/Makefile
2477 lustre/ptlrpc/gss/autoMakefile
2478 lustre/quota/Makefile
2479 lustre/quota/autoMakefile
2480 lustre/scripts/Makefile
2481 lustre/tests/Makefile
2482 lustre/tests/mpi/Makefile
2483 lustre/utils/Makefile
2484 lustre/utils/gss/Makefile
2485 lustre/osp/Makefile
2486 lustre/osp/autoMakefile
2487 lustre/lod/Makefile
2488 lustre/lod/autoMakefile
2489 ])
2490 ]) # LC_CONFIG_FILES