Whamcloud - gitweb
b9b8a6d741f1597abdc0224f677b4df13b0050ff
[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='/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_STACK_SIZE
78 #
79 # Ensure the stack size is at least 8k in Lustre server (all kernels)
80 #
81 AC_DEFUN([LC_STACK_SIZE], [
82 LB_CHECK_COMPILE([if stack size is at least 8k],
83 stack_size_8k, [
84         #include <linux/thread_info.h>
85 ], [
86         #if THREAD_SIZE < 8192
87         #error "stack size < 8192"
88         #endif
89 ], [], [AC_MSG_ERROR([
90
91 Lustre requires that Linux is configured with at least a 8KB stack.
92 ])])
93 ]) # LC_STACK_SIZE
94
95 #
96 # LC_MDS_MAX_THREADS
97 #
98 # Allow the user to set the MDS thread upper limit
99 #
100 AC_DEFUN([LC_MDS_MAX_THREADS], [
101 AC_MSG_CHECKING([for maximum number of MDS threads])
102 AC_ARG_WITH([mds_max_threads],
103         AC_HELP_STRING([--with-mds-max-threads=count],
104                 [maximum threads available on the MDS: (default=512)]),
105         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
106                 [maximum number of MDS threads])])
107 AC_MSG_RESULT([$with_mds_max_threads])
108 ]) # LC_MDS_MAX_THREADS
109
110 #
111 # LC_CONFIG_PINGER
112 #
113 # the pinger is temporary, until we have the recovery node in place
114 #
115 AC_DEFUN([LC_CONFIG_PINGER], [
116 AC_MSG_CHECKING([whether to enable Lustre pinger support])
117 AC_ARG_ENABLE([pinger],
118         AC_HELP_STRING([--disable-pinger],
119                 [disable recovery pinger support]),
120         [], [enable_pinger="yes"])
121 AC_MSG_RESULT([$enable_pinger])
122 AS_IF([test "x$enable_pinger" != xno],
123         [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
124 ]) # LC_CONFIG_PINGER
125
126 #
127 # LC_CONFIG_CHECKSUM
128 #
129 # do checksum of bulk data between client and OST
130 #
131 AC_DEFUN([LC_CONFIG_CHECKSUM], [
132 AC_MSG_CHECKING([whether to enable data checksum support])
133 AC_ARG_ENABLE([checksum],
134         AC_HELP_STRING([--disable-checksum],
135                 [disable data checksum support]),
136         [], [enable_checksum="yes"])
137 AC_MSG_RESULT([$enable_checksum])
138 AS_IF([test "x$enable_checksum" != xno],
139         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
140 ]) # LC_CONFIG_CHECKSUM
141
142 #
143 # LC_CONFIG_HEALTH_CHECK_WRITE
144 #
145 # Turn off the actual write to the disk
146 #
147 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
148 AC_MSG_CHECKING([whether to enable a write with the health check])
149 AC_ARG_ENABLE([health_write],
150         AC_HELP_STRING([--enable-health_write],
151                 [enable disk writes when doing health check]),
152         [], [enable_health_write="no"])
153 AC_MSG_RESULT([$enable_health_write])
154 AS_IF([test "x$enable_health_write" != xno],
155         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
156 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
157
158 #
159 # LC_CONFIG_LRU_RESIZE
160 #
161 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
162 AC_MSG_CHECKING([whether to enable lru self-adjusting])
163 AC_ARG_ENABLE([lru_resize],
164         AC_HELP_STRING([--enable-lru-resize],
165                 [enable lru resize support]),
166         [], [enable_lru_resize="yes"])
167 AC_MSG_RESULT([$enable_lru_resize])
168 AS_IF([test "x$enable_lru_resize" != xno],
169         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
170 ]) # LC_CONFIG_LRU_RESIZE
171
172 #
173 # LC_QUOTA_CONFIG
174 #
175 # Quota support. The kernel must support CONFIG_QUOTA.
176 #
177 AC_DEFUN([LC_QUOTA_CONFIG], [
178 LB_CHECK_CONFIG_IM([QUOTA], [],
179         [AC_MSG_ERROR([
180
181 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
182 ])])
183 ]) # LC_QUOTA_CONFIG
184
185 #
186 # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
187 #
188 # truncate_complete_page() has never been exported from an upstream kernel
189 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
190 # delete_from_page_cache() is exported from 2.6.39
191 #
192 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE], [
193 LB_CHECK_EXPORT([truncate_complete_page], [mm/truncate.c],
194         [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
195                 [kernel export truncate_complete_page])])
196 LB_CHECK_EXPORT([remove_from_page_cache], [mm/filemap.c],
197         [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
198                 [kernel export remove_from_page_cache])])
199 LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
200         [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
201                 [kernel export delete_from_page_cache])])
202 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
203
204 #
205 # LC_CONFIG_GSS_KEYRING
206 #
207 # default 'auto', tests for dependencies, if found, enables;
208 # only called if gss is enabled
209 #
210 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
211 AC_MSG_CHECKING([whether to enable gss keyring backend])
212 AC_ARG_ENABLE([gss_keyring],
213         [AC_HELP_STRING([--disable-gss-keyring],
214                 [disable gss keyring backend])],
215         [], [enable_gss_keyring="auto"])
216 AC_MSG_RESULT([$enable_gss_keyring])
217 AS_IF([test "x$enable_gss_keyring" != xno], [
218         LB_CHECK_CONFIG_IM([KEYS], [], [
219                 gss_keyring_conf_test="fail"
220                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
221
222         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
223                 gss_keyring_conf_test="fail"
224                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
225
226         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
227                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
228                         [Define this if you enable gss keyring backend])
229                 enable_gss_keyring="yes"
230         ], [
231                 AS_IF([test "x$enable_gss_keyring" = xyes], [
232                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
233                 ])
234         ])
235 ])
236 ]) # LC_CONFIG_GSS_KEYRING
237
238 #
239 # LC_HAVE_CRED_TGCRED
240 #
241 # rhel7 struct cred has no member tgcred
242 #
243 AC_DEFUN([LC_HAVE_CRED_TGCRED], [
244 LB_CHECK_COMPILE([if 'struct cred' has member 'tgcred'],
245 cred_tgcred, [
246         #include <linux/cred.h>
247 ],[
248         ((struct cred *)0)->tgcred = NULL;
249 ],[
250         AC_DEFINE(HAVE_CRED_TGCRED, 1,
251                 [struct cred has member tgcred])
252 ])
253 ]) # LC_HAVE_CRED_TGCRED
254
255 #
256 # LC_KEY_TYPE_INSTANTIATE_2ARGS
257 #
258 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
259 #
260 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
261 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
262 key_type_instantiate_2args, [
263         #include <linux/key-type.h>
264 ],[
265         ((struct key_type *)0)->instantiate(0, NULL);
266 ],[
267         AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
268                 [key_type->instantiate has two args])
269 ])
270 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
271
272 #
273 # LC_CONFIG_SUNRPC
274 #
275 AC_DEFUN([LC_CONFIG_SUNRPC], [
276 LB_CHECK_CONFIG_IM([SUNRPC], [], [
277         AS_IF([test "x$sunrpc_required" = xyes], [
278                 AC_MSG_ERROR([
279
280 kernel SUNRPC support is required by using GSS.
281 ])
282         ])])
283 ]) # LC_CONFIG_SUNRPC
284
285 #
286 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
287 #
288 # Build gss and related tools of Lustre. Currently both kernel and user space
289 # parts are depend on linux platform.
290 #
291 AC_DEFUN([LC_CONFIG_GSS], [
292 AC_MSG_CHECKING([whether to enable gss support])
293 AC_ARG_ENABLE([gss],
294         [AC_HELP_STRING([--enable-gss], [enable gss support])],
295         [], [enable_gss="auto"])
296 AC_MSG_RESULT([$enable_gss])
297
298 AS_IF([test "x$enable_gss" != xno], [
299         LC_CONFIG_GSS_KEYRING
300         LC_HAVE_CRED_TGCRED
301         LC_KEY_TYPE_INSTANTIATE_2ARGS
302         sunrpc_required=$enable_gss
303         LC_CONFIG_SUNRPC
304         sunrpc_required="no"
305
306         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
307                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
308         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
309                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
310         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
311                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
312         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
313                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
314
315         require_krb5=$enable_gss
316         AC_KERBEROS_V5
317         require_krb5="no"
318
319         AS_IF([test -n "$KRBDIR"], [
320                 gss_conf_test="success"
321         ], [
322                 gss_conf_test="failure"
323         ])
324
325         AS_IF([test "x$gss_conf_test" = xsuccess], [
326                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
327                 enable_gss="yes"
328         ], [
329                 enable_gss="no"
330         ])
331
332         enable_ssk=$enable_gss
333 ])
334 ]) # LC_CONFIG_GSS
335
336 # LC_OPENSSL_SSK
337 #
338 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
339 AC_DEFUN([LC_OPENSSL_SSK], [
340 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
341 AS_IF([test "x$enable_ssk" != xno], [
342 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
343         #include <openssl/hmac.h>
344         #include <openssl/evp.h>
345
346         int main(void) {
347                 int rc;
348                 HMAC_CTX ctx;
349                 HMAC_CTX_init(&ctx);
350                 rc = HMAC_Init_ex(&ctx, "test", 4, EVP_md_null(), NULL);
351         }
352 ])],[AC_DEFINE(HAVE_OPENSSL_SSK, 1,
353                [OpenSSL HMAC functions needed for SSK])],
354         [enable_ssk="no"])
355 ])
356 AC_MSG_RESULT([$enable_ssk])
357 ]) # LC_OPENSSL_SSK
358
359 # LC_INODE_PERMISION_2ARGS
360 #
361 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
362 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
363 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
364 # v3.1 onward have a 2 arg version (inode, mask)
365 #
366 AC_DEFUN([LC_INODE_PERMISION_2ARGS], [
367 LB_CHECK_COMPILE([if 'inode_operations->permission' has two args],
368 inode_ops_permission_2args, [
369         #include <linux/fs.h>
370 ],[
371         struct inode *inode __attribute__ ((unused));
372
373         inode = NULL;
374         inode->i_op->permission(NULL, 0);
375 ],[
376         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
377                 [inode_operations->permission has two args])
378 ])
379 ]) # LC_INODE_PERMISION_2ARGS
380
381 #
382 # LC_BLK_QUEUE_MAX_SEGMENTS
383 #
384 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
385 #
386 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS], [
387 LB_CHECK_COMPILE([if 'blk_queue_max_segments' is defined],
388 blk_queue_max_segments, [
389         #include <linux/blkdev.h>
390 ],[
391         blk_queue_max_segments(NULL, 0);
392 ],[
393         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
394                 [blk_queue_max_segments is defined])
395 ])
396 ]) # LC_BLK_QUEUE_MAX_SEGMENTS
397
398 #
399 # LC_HAVE_DQUOT_FS_DISK_QUOTA
400 #
401 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
402 #
403 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA], [
404 tmp_flags="$EXTRA_KCFLAGS"
405 EXTRA_KCFLAGS="-Werror"
406 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct fs_disk_quota],
407 fs_disk_quota, [
408         #include <linux/fs.h>
409         #include <linux/quota.h>
410 ],[
411         ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
412 ],[
413         AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
414                 [quotactl_ops.set_dqblk takes struct fs_disk_quota])
415 ],[
416         LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct kqid & fs_disk_quota],
417         kqid_fs_disk_quota, [
418                 #include <linux/fs.h>
419                 #include <linux/quota.h>
420         ],[
421                 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
422         ],[
423                 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
424                         [quotactl_ops.set_dqblk takes struct fs_disk_quota])
425                 AC_DEFINE(HAVE_DQUOT_KQID, 1,
426                         [quotactl_ops.set_dqblk takes struct kqid])
427         ])
428 ])
429 EXTRA_KCFLAGS="$tmp_flags"
430 ]) # LC_HAVE_DQUOT_FS_DISK_QUOTA
431
432 #
433 # LC_HAVE_DQUOT_SUSPEND
434 #
435 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
436 #
437 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND], [
438 LB_CHECK_COMPILE([if 'dquot_suspend' is defined],
439 dquot_suspend, [
440         #include <linux/quotaops.h>
441 ],[
442         dquot_suspend(NULL, -1);
443 ],[
444         AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
445 ])
446 ]) # LC_HAVE_DQUOT_SUSPEND
447
448 #
449 # LC_QUOTA64
450 #
451 # Check if kernel has been patched for 64-bit quota limits support.
452 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
453 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
454 # that in the absence of quotaio_v1.h in the kernel headers.
455 #
456 AC_DEFUN([LC_QUOTA64], [
457 tmp_flags="$EXTRA_KCFLAGS"
458 EXTRA_KCFLAGS="-I$LINUX/fs"
459 LB_CHECK_COMPILE([if kernel has 64-bit quota limits support],
460 quota64, [
461         #include <linux/kernel.h>
462         #include <linux/fs.h>
463         #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
464         #include <quota/quotaio_v2.h>
465         struct v2r1_disk_dqblk dqblk_r1;
466         #else
467         #include <linux/quota.h>
468         int ver = QFMT_VFS_V1;
469         #endif
470 ], [], [
471         AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
472 ],[
473         LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],
474                 [AC_MSG_ERROR([You have got no 64-bit kernel quota support.])])
475 ])
476 EXTRA_KCFLAGS=$tmp_flags
477 ]) # LC_QUOTA64
478
479 #
480 # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
481 #
482 # 2.6.34 adds __add_wait_queue_exclusive
483 #
484 AC_DEFUN([LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE], [
485 LB_CHECK_COMPILE([if '__add_wait_queue_exclusive' exists],
486 __add_wait_queue_exclusive, [
487         #include <linux/wait.h>
488 ],[
489         wait_queue_head_t queue;
490         wait_queue_t      wait;
491         __add_wait_queue_exclusive(&queue, &wait);
492 ],[
493         AC_DEFINE(HAVE___ADD_WAIT_QUEUE_EXCLUSIVE, 1,
494                   [__add_wait_queue_exclusive exists])
495 ])
496 ]) # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
497
498 #
499 # LC_FS_STRUCT_RWLOCK
500 #
501 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
502 #
503 AC_DEFUN([LC_FS_STRUCT_RWLOCK], [
504 LB_CHECK_COMPILE([if 'fs_struct.lock' use rwlock],
505 fs_struct_rwlock, [
506         #include <asm/atomic.h>
507         #include <linux/spinlock.h>
508         #include <linux/fs_struct.h>
509 ],[
510         ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
511 ],[
512         AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1, [fs_struct.lock use rwlock])
513 ])
514 ]) # LC_FS_STRUCT_RWLOCK
515
516 #
517 # LC_SBOPS_EVICT_INODE
518 #
519 # 2.6.36 super_operations add evict_inode method. it hybird of
520 # delete_inode & clear_inode.
521 #
522 AC_DEFUN([LC_SBOPS_EVICT_INODE], [
523 LB_CHECK_COMPILE([if 'super_operations.evict_inode' exist],
524 super_ops_evict_inode, [
525         #include <linux/fs.h>
526 ],[
527         ((struct super_operations *)0)->evict_inode(NULL);
528 ],[
529         AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
530                 [super_operations.evict_inode() is exist in kernel])
531 ])
532 ]) # LC_SBOPS_EVICT_INODE
533
534 #
535 # LC_FILE_FSYNC
536 #
537 # 2.6.35 file_operations.fsync taken 2 arguments.
538 # 3.0.0 file_operations.fsync takes 4 arguments.
539 #
540 AC_DEFUN([LC_FILE_FSYNC], [
541 LB_CHECK_COMPILE([if 'file_operations.fsync' takes 4 arguments],
542 file_ops_fsync_4args, [
543         #include <linux/fs.h>
544 ],[
545         ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
546 ],[
547         AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
548                 [file_operations.fsync takes 4 arguments])
549 ],[
550         LB_CHECK_COMPILE([if 'file_operations.fsync' takes 2 arguments],
551         file_ops_fsync_2args, [
552                 #include <linux/fs.h>
553         ],[
554                 ((struct file_operations *)0)->fsync(NULL, 0);
555         ],[
556                 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
557                         [file_operations.fsync takes 2 arguments])
558         ])
559 ])
560 ]) # LC_FILE_FSYNC
561
562 #
563 # LC_KERNEL_LOCKED
564 #
565 # 2.6.37 remove kernel_locked
566 #
567 AC_DEFUN([LC_KERNEL_LOCKED], [
568 LB_CHECK_COMPILE([if 'kernel_locked' is defined],
569 kernel_locked, [
570         #include <linux/smp_lock.h>
571 ],[
572         kernel_locked();
573 ],[
574         AC_DEFINE(HAVE_KERNEL_LOCKED, 1, [kernel_locked is defined])
575 ])
576 ]) # LC_KERNEL_LOCKED
577
578 #
579 # LC_D_COMPARE_7ARGS
580 #
581 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
582 #
583 AC_DEFUN([LC_D_COMPARE_7ARGS], [
584 LB_CHECK_COMPILE([if 'dentry_operations.d_compare()' taken 7 arguments],
585 dentry_ops_d_compare_7arg, [
586         #include <linux/dcache.h>
587 ],[
588         ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
589 ],[
590         AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1, [d_compare need 7 arguments])
591 ])
592 ]) # LC_D_COMPARE_7ARGS
593
594 #
595 # LC_D_DELETE_CONST
596 #
597 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
598 #
599 AC_DEFUN([LC_D_DELETE_CONST], [
600 tmp_flags="$EXTRA_KCFLAGS"
601 EXTRA_KCFLAGS="-Werror"
602 LB_CHECK_COMPILE([if 'dentry_operations.d_delete()' has const declare on first parameter],
603 dentry_ops_d_delete_1st_const, [
604         #include <linux/dcache.h>
605 ],[
606         const struct dentry *d = NULL;
607         ((struct dentry_operations*)0)->d_delete(d);
608 ],[
609         AC_DEFINE(HAVE_D_DELETE_CONST, const,
610                 [d_delete first parameter declared const])
611 ],[
612         AC_DEFINE(HAVE_D_DELETE_CONST, [],
613                 [d_delete first parameter declared is not const])
614 ])
615 EXTRA_KCFLAGS="$tmp_flags"
616 ]) # LC_D_DELETE_CONST
617
618 #
619 # LC_DCACHE_LOCK
620 #
621 # 2.6.38 dcache_lock removed. rcu-walk committed.
622 #
623 AC_DEFUN([LC_DCACHE_LOCK], [
624 LB_CHECK_COMPILE([if 'dcache_lock' is exist],
625 dcache_lock, [
626         #include <linux/dcache.h>
627 ],[
628         spin_lock(&dcache_lock);
629 ],[
630         AC_DEFINE(HAVE_DCACHE_LOCK, 1,
631                 [dcache_lock is exist])
632 ])
633 ]) # LC_DCACHE_LOCK
634
635 #
636 # LC_INODE_I_RCU
637 #
638 # 2.6.38 inode.i_rcu added.
639 #
640 AC_DEFUN([LC_INODE_I_RCU], [
641 LB_CHECK_COMPILE([if 'inode.i_rcu' exists],
642 inode_i_rcu, [
643         #include <linux/fs.h>
644 ],[
645         struct inode ino;
646         struct rcu_head rcu = {};
647         ino.i_rcu = rcu;
648 ],[
649         AC_DEFINE(HAVE_INODE_I_RCU, 1,
650                 [inode.i_rcu exists])
651 ])
652 ]) # LC_INODE_I_RCU
653
654 #
655 # LC_BLKDEV_GET_BY_DEV
656 #
657 # 2.6.38 export blkdev_get_by_dev
658 #
659 AC_DEFUN([LC_BLKDEV_GET_BY_DEV], [
660 LB_CHECK_EXPORT([blkdev_get_by_dev], [fs/block_dev.c],
661         [AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
662                 [blkdev_get_by_dev is exported by the kernel])])
663 ]) # LC_BLKDEV_GET_BY_DEV
664
665 #
666 # LC_EXPORT_SIMPLE_SETATTR
667 #
668 # 2.6.38 export simple_setattr
669 #
670 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR], [
671 LB_CHECK_EXPORT([simple_setattr], [fs/libfs.c],
672         [AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
673                 [simple_setattr is exported by the kernel])])
674 ]) # LC_EXPORT_SIMPLE_SETATTR
675
676 #
677 # LC_HAVE_BLK_PLUG
678 #
679 # 2.6.38 add struct blk_plug
680 #
681 AC_DEFUN([LC_HAVE_BLK_PLUG], [
682 LB_CHECK_COMPILE([if 'struct blk_plug' exists],
683 blk_plug, [
684         #include <linux/blkdev.h>
685 ],[
686         struct blk_plug plug;
687
688         blk_start_plug(&plug);
689         blk_finish_plug(&plug);
690 ],[
691         AC_DEFINE(HAVE_BLK_PLUG, 1,
692                 [blk_plug struct exists])
693 ])
694 ]) # LC_HAVE_BLK_PLUG
695
696 #
697 # LC_IOP_TRUNCATE
698 #
699 # truncate callback removed since 2.6.39
700 #
701 AC_DEFUN([LC_IOP_TRUNCATE], [
702 LB_CHECK_COMPILE([if 'inode_operations' has '.truncate' member function],
703 inode_ops_truncate, [
704         #include <linux/fs.h>
705 ],[
706         ((struct inode_operations *)0)->truncate(NULL);
707 ],[
708         AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
709                 [inode_operations has .truncate member function])
710 ])
711 ]) # LC_IOP_TRUNCATE
712
713 #
714 # LC_REQUEST_QUEUE_UNPLUG_FN
715 #
716 # 2.6.39 remove unplug_fn from request_queue.
717 #
718 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], [
719 LB_CHECK_COMPILE([if 'request_queue' has 'unplug_fn' field],
720 request_queue_unplug_fn, [
721         #include <linux/blkdev.h>
722 ],[
723         do {} while(sizeof(((struct request_queue *)0)->unplug_fn));
724 ],[
725         AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
726                 [request_queue has unplug_fn field])
727 ])
728 ]) # LC_REQUEST_QUEUE_UNPLUG_FN
729
730 #
731 # LC_HAVE_FSTYPE_MOUNT
732 #
733 # 2.6.39 replace get_sb with mount in struct file_system_type
734 #
735 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [
736 LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field],
737 file_system_type_mount, [
738         #include <linux/fs.h>
739 ],[
740         struct file_system_type fst;
741         void *i = (void *) fst.mount;
742 ],[
743         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
744                 [struct file_system_type has mount field])
745 ])
746 ]) # LC_HAVE_FSTYPE_MOUNT
747
748 #
749 # LC_HAVE_FHANDLE_SYSCALLS
750 #
751 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
752 # added to Linux kernel 2.6.39.
753 # Check if client supports these functions
754 #
755 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [
756 LB_CHECK_CONFIG_IM([FHANDLE],[
757         AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
758                 [kernel supports fhandles and related syscalls])
759         ])
760 ]) # LC_HAVE_FHANDLE_SYSCALLS
761
762 #
763 # LC_HAVE_INODE_OWNER_OR_CAPABLE
764 #
765 # 2.6.39 renames is_owner_or_cap to inode_owner_or_capable
766 #
767 AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [
768 LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist],
769 inode_owner_or_capable, [
770         #include <linux/fs.h>
771 ],[
772         inode_owner_or_capable(NULL);
773 ],[
774         AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
775                 [inode_owner_or_capable exist])
776 ])
777 ]) # LC_HAVE_INODE_OWNER_OR_CAPABLE
778
779 #
780 # LC_DIRTY_INODE_WITH_FLAG
781 #
782 # 3.0 dirty_inode() has a flag parameter
783 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
784 #
785 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [
786 LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag],
787 dirty_inode_super_operation_flag, [
788         #include <linux/fs.h>
789 ],[
790         struct inode *inode;
791         inode->i_sb->s_op->dirty_inode(NULL, 0);
792 ],[
793         AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
794                 [dirty_inode super_operation takes flag])
795 ])
796 ]) # LC_DIRTY_INODE_WITH_FLAG
797
798 #
799 # LC_SETNS
800 #
801 # 3.0 introduced setns
802 #
803 AC_DEFUN([LC_SETNS], [
804 AC_CHECK_HEADERS([sched.h], [], [],
805                  [#define _GNU_SOURCE
806                  ])
807 AC_CHECK_FUNCS([setns])
808 ]) # LC_SETNS
809
810 #
811 # LC_GENERIC_PERMISSION
812 #
813 # 2.6.38 generic_permission taken 4 parameters.
814 # in fact, it means rcu-walk aware permission bring.
815 #
816 # 3.1 generic_permission taken 2 parameters.
817 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
818 #
819 AC_DEFUN([LC_GENERIC_PERMISSION], [
820 LB_CHECK_COMPILE([if 'generic_permission' take 2 arguments],
821 generic_permission_2args, [
822         #include <linux/fs.h>
823 ],[
824         generic_permission(NULL, 0);
825 ],[
826         AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
827                 [generic_permission taken 2 arguments])
828 ],[
829         LB_CHECK_COMPILE([if 'generic_permission' take 4 arguments],
830         generic_permission_4args, [
831                 #include <linux/fs.h>
832         ],[
833                 generic_permission(NULL, 0, 0, NULL);
834         ],[
835                 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
836                         [generic_permission taken 4 arguments])
837         ])
838 ])
839 ]) # LC_GENERIC_PERMISSION
840
841 #
842 # LC_LM_XXX_LOCK_MANAGER_OPS
843 #
844 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
845 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
846 #
847 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [
848 LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'],
849 lock_manager_ops_lm_xxx, [
850         #include <linux/fs.h>
851 ],[
852         struct lock_manager_operations lm_ops;
853         lm_ops.lm_compare_owner = NULL;
854 ],[
855         AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
856                 [lock-manager ops renamed to lm_xxx])
857 ])
858 ]) # LC_LM_XXX_LOCK_MANAGER_OPS
859
860 #
861 # LC_INODE_DIO_WAIT
862 #
863 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait
864 #     instead.
865 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
866 #
867 AC_DEFUN([LC_INODE_DIO_WAIT], [
868 LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait],
869 inode_dio_wait, [
870         #include <linux/fs.h>
871 ],[
872         inode_dio_wait((struct inode *)0);
873 ],[
874         AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
875                 [inode->i_alloc_sem is killed and use inode_dio_wait])
876 ])
877 ]) # LC_INODE_DIO_WAIT
878
879 #
880 # LC_IOP_GET_ACL
881 #
882 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
883 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
884 #
885 AC_DEFUN([LC_IOP_GET_ACL], [
886 LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function],
887 inode_ops_get_acl, [
888         #include <linux/fs.h>
889 ],[
890         struct inode_operations iop;
891         iop.get_acl = NULL;
892 ],[
893         AC_DEFINE(HAVE_IOP_GET_ACL, 1,
894                 [inode_operations has .get_acl member function])
895 ])
896 ]) # LC_IOP_GET_ACL
897
898 #
899 # LC_FILE_LLSEEK_SIZE
900 #
901 # 3.1 introduced generic_file_llseek_size()
902 #
903 AC_DEFUN([LC_FILE_LLSEEK_SIZE], [
904 LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c],
905         [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
906                 [generic_file_llseek_size is exported by the kernel])])
907 ]) # LC_FILE_LLSEEK_SIZE
908
909 #
910 # LC_RADIX_EXCEPTION_ENTRY
911 # 3.1 adds radix_tree_exception_entry.
912 #
913 AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [
914 LB_CHECK_COMPILE([radix_tree_exceptional_entry exist],
915 radix_tree_exceptional_entry, [
916         #include <linux/radix-tree.h>
917 ],[
918         radix_tree_exceptional_entry(NULL);
919 ],[
920         AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1,
921                 [radix_tree_exceptional_entry exist])
922 ])
923 ]) # LC_RADIX_EXCEPTION_ENTRY
924
925 #
926 # LC_HAVE_VOID_MAKE_REQUEST_FN
927 #
928 # 3.2 request_queue.make_request_fn defined as function returns with void
929 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
930 #
931 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], [
932 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns void but not int],
933 make_request_fn_void, [
934         #include <linux/blkdev.h>
935 ],[
936         int ret;
937         make_request_fn *mrf;
938         ret = mrf(NULL, NULL);
939 ],[],[
940         AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
941                 [request_queue.make_request_fn returns void but not int])
942 ])
943 ]) # LC_HAVE_VOID_MAKE_REQUEST_FN
944
945 #
946 # LC_HAVE_PROTECT_I_NLINK
947 #
948 # 3.2 protects inode->i_nlink from direct modification
949 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
950 # at the same time adds set_nlink(), so checks set_nlink() for it.
951 #
952 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [
953 LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification],
954 inode_i_nlink_protected, [
955         #include <linux/fs.h>
956 ],[
957         struct inode i;
958         set_nlink(&i, 1);
959 ],[
960         AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
961                 [inode->i_nlink is protected from direct modification])
962 ])
963 ]) # LC_HAVE_PROTECT_I_NLINK
964
965 #
966 # 2.6.39 security_inode_init_security takes a 'struct qstr' parameter
967 #
968 # 3.2 security_inode_init_security takes a callback to set xattrs
969 #
970 AC_DEFUN([LC_HAVE_SECURITY_IINITSEC], [
971 LB_CHECK_COMPILE([if security_inode_init_security takes a callback],
972 security_inode_init_security_callback, [
973         #include <linux/security.h>
974 ],[
975         security_inode_init_security(NULL, NULL, NULL, (const initxattrs)NULL, NULL);
976 ],[
977         AC_DEFINE(HAVE_SECURITY_IINITSEC_CALLBACK, 1,
978                   [security_inode_init_security takes a callback to set xattrs])
979 ],[
980         LB_CHECK_COMPILE([if security_inode_init_security takes a 'struct qstr' parameter],
981         security_inode_init_security_qstr, [
982                 #include <linux/security.h>
983         ],[
984                 security_inode_init_security(NULL, NULL, (struct qstr *)NULL, NULL, NULL, NULL);
985         ],[
986                 AC_DEFINE(HAVE_SECURITY_IINITSEC_QSTR, 1,
987                           [security_inode_init_security takes a 'struct qstr' parameter])
988         ])
989 ])
990 ]) # LC_HAVE_SECURITY_IINITSEC
991
992 #
993 # LC_HAVE_MIGRATE_HEADER
994 #
995 # 3.3 introduces migrate_mode.h and migratepage has 4 args
996 #
997 AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [
998 LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [
999         AC_DEFINE(HAVE_MIGRATE_H, 1,
1000                 [kernel has include/linux/migrate.h])
1001 ],[
1002         LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [
1003                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
1004                         [kernel has include/linux/migrate_mode.h])
1005         ])
1006 ])
1007 ]) # LC_HAVE_MIGRATE_HEADER
1008
1009 #
1010 # LC_MIGRATEPAGE_4ARGS
1011 #
1012 AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [
1013 LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args],
1014 address_space_ops_migratepage_4args, [
1015         #include <linux/fs.h>
1016 #ifdef HAVE_MIGRATE_H
1017         #include <linux/migrate.h>
1018 #elif defined(HAVE_MIGRATE_MODE_H)
1019         #include <linux/migrate_mode.h>
1020 #endif
1021 ],[
1022         struct address_space_operations aops;
1023         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
1024 ],[
1025         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
1026                 [address_space_operations.migratepage has 4 args])
1027 ])
1028 ]) # LC_MIGRATEPAGE_4ARGS
1029
1030 #
1031 # LC_SUPEROPS_USE_DENTRY
1032 #
1033 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
1034 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
1035 #
1036 AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [
1037 tmp_flags="$EXTRA_KCFLAGS"
1038 EXTRA_KCFLAGS="-Werror"
1039 LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter],
1040 super_ops_dentry, [
1041         #include <linux/fs.h>
1042         int show_options(struct seq_file *seq, struct dentry *root) {
1043                 return 0;
1044         }
1045 ],[
1046         struct super_operations ops;
1047         ops.show_options = show_options;
1048 ],[
1049         AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
1050                 [super_operations use dentry as parameter])
1051 ])
1052 EXTRA_KCFLAGS="$tmp_flags"
1053 ]) # LC_SUPEROPS_USE_DENTRY
1054
1055 #
1056 # LC_INODEOPS_USE_UMODE_T
1057 #
1058 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
1059 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
1060 #
1061 AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [
1062 tmp_flags="$EXTRA_KCFLAGS"
1063 EXTRA_KCFLAGS="-Werror"
1064 LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter],
1065 inode_ops_umode_t, [
1066         #include <linux/fs.h>
1067         #include <linux/types.h>
1068         int my_mknod(struct inode *dir, struct dentry *dchild,
1069                      umode_t mode, dev_t dev)
1070         {
1071                 return 0;
1072         }
1073 ],[
1074         struct inode_operations ops;
1075         ops.mknod = my_mknod;
1076 ],[
1077         AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
1078                 [inode_operations use umode_t as parameter])
1079 ])
1080 EXTRA_KCFLAGS="$tmp_flags"
1081 ]) # LC_INODEOPS_USE_UMODE_T
1082
1083 #
1084 # LC_KMAP_ATOMIC_HAS_1ARG
1085 #
1086 # 3.4 kmap_atomic removes second argument
1087 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1088 #
1089 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [
1090 LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument],
1091 kmap_atomic_1arg, [
1092         #include <linux/highmem.h>
1093 ],[
1094         kmap_atomic(NULL);
1095 ],[
1096         AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1097                 [have kmap_atomic has only 1 argument])
1098 ])
1099 ]) # LC_KMAP_ATOMIC_HAS_1ARG
1100
1101 #
1102 # LC_HAVE_D_MAKE_ROOT
1103 #
1104 # 3.4 converts d_alloc_root to d_make_root
1105 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1106 #
1107 AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [
1108 LB_CHECK_COMPILE([if have 'd_make_root'],
1109 d_make_root, [
1110         #include <linux/fs.h>
1111 ],[
1112         d_make_root((struct inode *)NULL);
1113 ],[
1114         AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1115                 [have d_make_root])
1116 ])
1117 ]) # LC_HAVE_D_MAKE_ROOT
1118
1119 #
1120 # LC_HAVE_CACHE_REGISTER
1121 #
1122 # 3.4 cache_register/cache_unregister are removed
1123 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1124 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1125 # are defined, but not exported.
1126 # 3.3 cache_register_net/cache_unregister_net are
1127 # exported and replacing cache_register/cache_unregister in 3.4
1128 #
1129 AC_DEFUN([LC_HAVE_CACHE_REGISTER], [
1130 LB_CHECK_COMPILE([if have 'cache_register'],
1131 cache_register, [
1132         #include <linux/sunrpc/cache.h>
1133 ],[
1134         cache_register(NULL);
1135 ],[
1136         AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1137                 [have cache_register])
1138 ])
1139 ]) # LC_HAVE_CACHE_REGISTER
1140
1141 #
1142 # LC_HAVE_CLEAR_INODE
1143 #
1144 # 3.5 renames end_writeback() back to clear_inode()...
1145 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1146 #
1147 AC_DEFUN([LC_HAVE_CLEAR_INODE], [
1148 LB_CHECK_COMPILE([if have 'clear_inode'],
1149 clear_inode, [
1150         #include <linux/fs.h>
1151 ],[
1152         clear_inode((struct inode *)NULL);
1153 ],[
1154         AC_DEFINE(HAVE_CLEAR_INODE, 1,
1155                 [have clear_inode])
1156 ])
1157 ]) # LC_HAVE_CLEAR_INODE
1158
1159 #
1160 # LC_HAVE_ENCODE_FH_PARENT
1161 #
1162 # 3.5 encode_fh has parent inode passed in directly
1163 # see kernel commit b0b0382b
1164 #
1165 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [
1166 tmp_flags="$EXTRA_KCFLAGS"
1167 EXTRA_KCFLAGS="-Werror"
1168 LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter],
1169 encode_fh_parent_inode, [
1170         #include <linux/exportfs.h>
1171         #include <linux/fs.h>
1172         #include <linux/types.h>
1173         int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1174         {
1175                 return 0;
1176         }
1177 ],[
1178         struct export_operations exp_op;
1179         exp_op.encode_fh = ll_encode_fh;
1180 ],[
1181         AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1182                 [have parent inode as parameter])
1183 ])
1184 EXTRA_KCFLAGS="$tmp_flags"
1185 ]) # LC_HAVE_ENCODE_FH_PARENT
1186
1187 #
1188 # LC_FILE_LLSEEK_SIZE_5ARG
1189 #
1190 # 3.5 has generic_file_llseek_size with 5 args
1191 #
1192 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [
1193 LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args],
1194 generic_file_llseek_size_5args, [
1195         #include <linux/fs.h>
1196 ],[
1197         generic_file_llseek_size(NULL, 0, 0, 0, 0);
1198 ], [
1199         AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1200                 [kernel has generic_file_llseek_size with 5 args])
1201 ])
1202 ]) # LC_FILE_LLSEEK_SIZE_5ARG
1203
1204 #
1205 # LC_LLITE_DATA_IS_LIST
1206 #
1207 # 3.6 switch i_dentry/d_alias from list to hlist
1208 #
1209 # In the upstream kernels d_alias first changes
1210 # to a hlist and then in later version, 3.11, gets
1211 # moved to the union d_u. Due to some distros having
1212 # d_alias in the d_u union as a struct list, which
1213 # has never existed upstream stream, we can't test
1214 # if d_alias is a list or hlist directly. If ever
1215 # i_dentry and d_alias even up different combos then
1216 # the build will fail. In that case then we will need
1217 # to separate out the i_dentry and d_alias test below.
1218 #
1219 AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
1220 tmp_flags="$EXTRA_KCFLAGS"
1221 EXTRA_KCFLAGS="-Werror"
1222 LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
1223 i_dentry_d_alias_list, [
1224         #include <linux/fs.h>
1225 ],[
1226         struct inode inode;
1227         INIT_LIST_HEAD(&inode.i_dentry);
1228 ],[
1229         AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
1230                 [both i_dentry/d_alias uses list])
1231 ])
1232 EXTRA_KCFLAGS="$tmp_flags"
1233 ]) # LC_DATA_FOR_LLITE_IS_LIST
1234
1235 #
1236 # LC_DENTRY_OPEN_USE_PATH
1237 #
1238 # 3.6 dentry_open uses struct path as first argument
1239 # see kernel commit 765927b2
1240 #
1241 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [
1242 tmp_flags="$EXTRA_KCFLAGS"
1243 EXTRA_KCFLAGS="-Werror"
1244 LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument],
1245 dentry_open_path, [
1246         #include <linux/fs.h>
1247         #include <linux/path.h>
1248 ],[
1249         struct path path;
1250         dentry_open(&path, 0, NULL);
1251 ],[
1252         AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1253                 [dentry_open uses struct path as first argument])
1254 ])
1255 EXTRA_KCFLAGS="$tmp_flags"
1256 ]) # LC_DENTRY_OPEN_USE_PATH
1257
1258 #
1259 # LC_HAVE_IOP_ATOMIC_OPEN
1260 #
1261 # 3.6 vfs adds iop->atomic_open
1262 #
1263 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [
1264 LB_CHECK_COMPILE([if 'iop' has 'atomic_open'],
1265 inode_ops_atomic_open, [
1266         #include <linux/fs.h>
1267 ],[
1268         struct inode_operations iop;
1269         iop.atomic_open = NULL;
1270 ],[
1271         AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1272                 [have iop atomic_open])
1273 ])
1274 ]) # LC_HAVE_IOP_ATOMIC_OPEN
1275
1276 #
1277 # LC_HAVE_SB_START_WRITE
1278 #
1279 # RHEL6 2.6.32, 3.6 or newer support wrapped FS freeze functions
1280 #
1281 AC_DEFUN([LC_HAVE_SB_START_WRITE], [
1282 LB_CHECK_COMPILE([if kernel supports wrapped FS freeze functions],
1283 sb_start_write, [
1284         #include <linux/fs.h>
1285 ],[
1286         sb_start_write(NULL);
1287 ],[
1288         AC_DEFINE(HAVE_SB_START_WRITE, 1,
1289                 [kernel supports wrapped FS freeze functions])
1290 ])
1291 ]) # LC_HAVE_SB_START_WRITE
1292
1293 #
1294 # LC_HAVE_POSIXACL_USER_NS
1295 #
1296 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1297 #
1298 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [
1299 LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'],
1300 posix_acl_to_xattr_user_namespace, [
1301         #include <linux/fs.h>
1302         #include <linux/posix_acl_xattr.h>
1303 ],[
1304         posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1305 ],[
1306         AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1307                 [posix_acl_to_xattr takes struct user_namespace])
1308 ])
1309 ]) # LC_HAVE_POSIXACL_USER_NS
1310
1311 #
1312 # LC_HAVE_FILE_F_INODE
1313 #
1314 # 3.8 struct file has new member f_inode
1315 #
1316 AC_DEFUN([LC_HAVE_FILE_F_INODE], [
1317 LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'],
1318 file_f_inode, [
1319         #include <linux/fs.h>
1320 ],[
1321         ((struct file *)0)->f_inode = NULL;
1322 ],[
1323         AC_DEFINE(HAVE_FILE_F_INODE, 1,
1324                 [struct file has member f_inode])
1325 ])
1326 ]) # LC_HAVE_FILE_F_INODE
1327
1328 #
1329 # LC_HAVE_FILE_INODE
1330 #
1331 # 3.8 has introduced inline function file_inode
1332 #
1333 AC_DEFUN([LC_HAVE_FILE_INODE], [
1334 LB_CHECK_COMPILE([if file_inode() exists],
1335 file_inode, [
1336         #include <linux/fs.h>
1337 ],[
1338         file_inode(NULL);
1339 ],[
1340         AC_DEFINE(HAVE_FILE_INODE, 1,
1341                 [file_inode() has been defined])
1342 ])
1343 ]) # LC_HAVE_FILE_INODE
1344
1345 #
1346 # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1347 #
1348 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [
1349 LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args],
1350 sunrpc_cache_pipe_upcall_3args, [
1351         #include <linux/sunrpc/cache.h>
1352 ],[
1353         sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1354 ],[
1355         AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1356                 [sunrpc_cache_pipe_upcall takes 3 args])
1357 ])
1358 ]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1359
1360 #
1361 # LC_HAVE_HLIST_FOR_EACH_3ARG
1362 #
1363 # 3.9 uses hlist_for_each_entry with 3 args
1364 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1365 #
1366 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [
1367 LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args],
1368 hlist_for_each_entry_3args, [
1369         #include <linux/list.h>
1370         #include <linux/fs.h>
1371 ],[
1372         struct hlist_head *head = NULL;
1373         struct inode *inode;
1374
1375         hlist_for_each_entry(inode, head, i_hash) {
1376                 continue;
1377         }
1378 ],[
1379         AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1,
1380                 [hlist_for_each_entry has 3 args])
1381 ])
1382 ]) # LC_HAVE_HLIST_FOR_EACH_3ARG
1383
1384 #
1385 # LC_HAVE_BIO_END_SECTOR
1386 #
1387 # 3.9 introduces bio_end_sector macro
1388 # f73a1c7d117d07a96d89475066188a2b79e53c48
1389 #
1390 AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [
1391 LB_CHECK_COMPILE([if 'bio_end_sector' is defined],
1392 bio_end_sector, [
1393         #include <linux/bio.h>
1394 ],[
1395         struct bio bio;
1396
1397         bio_end_sector(&bio);
1398 ],[
1399         AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
1400                   [bio_end_sector is defined])
1401 ])
1402 ]) # LC_HAVE_BIO_END_SECTOR
1403
1404 #
1405 # 3.9 created is_sxid
1406 #
1407 AC_DEFUN([LC_HAVE_IS_SXID], [
1408 LB_CHECK_COMPILE([if 'is_sxid' is defined],
1409 is_sxid, [
1410         #include <linux/fs.h>
1411 ],[
1412         struct inode inode;
1413
1414         is_sxid(inode.i_mode);
1415 ],[
1416         AC_DEFINE(HAVE_IS_SXID, 1, [is_sxid is defined])
1417 ])
1418 ]) # LC_HAVE_IS_SXID
1419
1420 #
1421 # LC_HAVE_REMOVE_PROC_SUBTREE
1422 #
1423 # 3.10 introduced remove_proc_subtree
1424 #
1425 AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [
1426 LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined],
1427 remove_proc_subtree, [
1428         #include <linux/proc_fs.h>
1429 ],[
1430         remove_proc_subtree(NULL, NULL);
1431 ], [
1432         AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1,
1433                   [remove_proc_subtree is defined])
1434 ])
1435 ]) # LC_HAVE_REMOVE_PROC_SUBTREE
1436
1437 #
1438 # LC_HAVE_PROC_REMOVE
1439 #
1440 # 3.10 introduced proc_remove
1441 #
1442 AC_DEFUN([LC_HAVE_PROC_REMOVE], [
1443 LB_CHECK_COMPILE([if 'proc_remove' is defined],
1444 proc_remove, [
1445         #include <linux/proc_fs.h>
1446 ],[
1447         proc_remove(NULL);
1448 ], [
1449         AC_DEFINE(HAVE_PROC_REMOVE, 1,
1450                   [proc_remove is defined])
1451 ])
1452 ]) # LC_HAVE_PROC_REMOVE
1453
1454 #
1455 # LC_BLKDEV_RELEASE_RETURN_INT
1456 #
1457 # 3.10 release for block device doesn't return int
1458 #
1459 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT], [
1460 LB_CHECK_COMPILE([if 'block_device_operations' release returns 'int'],
1461 block_device_ops_release_return_int, [
1462         #include <linux/blkdev.h>
1463 ],[
1464         struct block_device_operations fops;
1465         int i __attribute__ ((unused));
1466
1467         i = fops.release(NULL, 0);
1468 ],[
1469         AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1470                 [block device release returns int])
1471 ])
1472 ]) # LC_BLKDEV_RELEASE_RETURN_INT
1473
1474 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
1475 LB_CHECK_COMPILE([if get_projid exists],
1476 get_projid, [
1477         #include <linux/quota.h>
1478 ],[
1479         struct dquot_operations ops;
1480
1481         ops.get_projid(NULL, NULL);
1482 ],[
1483         AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
1484                 [get_projid function exists])
1485 ])
1486 ]) # LC_HAVE_PROJECT_QUOTA
1487
1488
1489 #
1490 # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1491 #
1492 # 3.10 introduced security_dentry_init_security()
1493 #
1494 AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_SECURITY], [
1495 LB_CHECK_COMPILE([if 'security_dentry_init_security' is defined],
1496 security_dentry_init_security, [
1497         #include <linux/security.h>
1498 ],[
1499         security_dentry_init_security(NULL, 0, NULL, NULL, NULL);
1500 ],[
1501         AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_SECURITY, 1,
1502                 [security_dentry_init_security' is defined])
1503 ])
1504 ]) # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1505
1506 #
1507 # LC_INVALIDATE_RANGE
1508 #
1509 # 3.11 invalidatepage requires the length of the range to invalidate
1510 #
1511 AC_DEFUN([LC_INVALIDATE_RANGE], [
1512 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
1513 address_space_ops_invalidatepage_3args, [
1514         #include <linux/fs.h>
1515 ],[
1516         struct address_space_operations a_ops;
1517         a_ops.invalidatepage(NULL, 0, 0);
1518 ],[
1519         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
1520                 [address_space_operations.invalidatepage needs 3 arguments])
1521 ])
1522 ]) # LC_INVALIDATE_RANGE
1523
1524 #
1525 # LC_HAVE_DIR_CONTEXT
1526 #
1527 # 3.11 readdir now takes the new struct dir_context
1528 #
1529 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
1530 LB_CHECK_COMPILE([if 'dir_context' exist],
1531 dir_context, [
1532         #include <linux/fs.h>
1533 ],[
1534         struct dir_context ctx;
1535         ctx.pos = 0;
1536 ],[
1537         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
1538                 [dir_context exist])
1539 ])
1540 ]) # LC_HAVE_DIR_CONTEXT
1541
1542 #
1543 # LC_D_COMPARE_5ARGS
1544 #
1545 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1546 #
1547 AC_DEFUN([LC_D_COMPARE_5ARGS], [
1548 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
1549 d_compare_5args, [
1550         #include <linux/dcache.h>
1551 ],[
1552         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1553 ],[
1554         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1555                 [d_compare need 5 arguments])
1556 ])
1557 ]) # LC_D_COMPARE_5ARGS
1558
1559 #
1560 # LC_HAVE_DCOUNT
1561 #
1562 # 3.11 need to access d_count to get dentry reference count
1563 #
1564 AC_DEFUN([LC_HAVE_DCOUNT], [
1565 LB_CHECK_COMPILE([if 'd_count' exist],
1566 d_count, [
1567         #include <linux/dcache.h>
1568 ],[
1569         struct dentry de;
1570         d_count(&de);
1571 ],[
1572         AC_DEFINE(HAVE_D_COUNT, 1,
1573                 [d_count exist])
1574 ])
1575 ]) # LC_HAVE_DCOUNT
1576
1577 #
1578 # LC_PID_NS_FOR_CHILDREN
1579 #
1580 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
1581 #
1582 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
1583 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
1584 pid_ns_for_children, [
1585         #include <linux/nsproxy.h>
1586 ],[
1587         struct nsproxy ns;
1588         ns.pid_ns_for_children = NULL;
1589 ],[
1590         AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
1591                   ['struct nsproxy' has 'pid_ns_for_children'])
1592 ])
1593 ]) # LC_PID_NS_FOR_CHILDREN
1594
1595 #
1596 # LC_OLDSIZE_TRUNCATE_PAGECACHE
1597 #
1598 # 3.12 truncate_pagecache without oldsize parameter
1599 #
1600 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
1601 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
1602 truncate_pagecache_old_size, [
1603         #include <linux/mm.h>
1604 ],[
1605         truncate_pagecache(NULL, 0, 0);
1606 ],[
1607         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
1608                 [with oldsize])
1609 ])
1610 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
1611
1612 #
1613 # LC_HAVE_DENTRY_D_U_D_ALIAS
1614 #
1615 # 3.11 kernel moved d_alias to the union d_u in struct dentry
1616 #
1617 # Some distros move d_alias to d_u but it is still a struct list
1618 #
1619 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
1620 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
1621         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
1622         d_alias, [
1623                 #include <linux/list.h>
1624                 #include <linux/dcache.h>
1625         ],[
1626                 struct dentry de;
1627                 INIT_LIST_HEAD(&de.d_u.d_alias);
1628         ],[
1629                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1630                         [list dentry.d_u.d_alias exist])
1631         ])
1632 ],[
1633         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
1634         d_alias, [
1635                 #include <linux/list.h>
1636                 #include <linux/dcache.h>
1637         ],[
1638                 struct dentry de;
1639                 INIT_HLIST_NODE(&de.d_u.d_alias);
1640         ],[
1641                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1642                         [hlist dentry.d_u.d_alias exist])
1643         ])
1644 ])
1645 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
1646
1647 #
1648 # LC_HAVE_DENTRY_D_CHILD
1649 #
1650 # 3.11 kernel d_child has been moved out of the union d_u
1651 # in struct dentry
1652 #
1653 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
1654 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
1655 d_child, [
1656         #include <linux/list.h>
1657         #include <linux/dcache.h>
1658 ],[
1659         struct dentry de;
1660         INIT_LIST_HEAD(&de.d_child);
1661 ],[
1662         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
1663                 [dentry.d_child exist])
1664 ])
1665 ]) # LC_HAVE_DENTRY_D_CHILD
1666
1667 #
1668 # LC_KIOCB_KI_LEFT
1669 #
1670 # 3.12 ki_left removed from struct kiocb
1671 #
1672 AC_DEFUN([LC_KIOCB_KI_LEFT], [
1673 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
1674 kiocb_ki_left, [
1675         #include <linux/aio.h>
1676 ],[
1677         ((struct kiocb*)0)->ki_left = 0;
1678 ],[
1679         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
1680                 [ki_left exist])
1681 ])
1682 ]) # LC_KIOCB_KI_LEFT
1683
1684 #
1685 # LC_VFS_RENAME_5ARGS
1686 #
1687 # 3.13 has vfs_rename with 5 args
1688 #
1689 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
1690 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
1691 vfs_rename_5args, [
1692         #include <linux/fs.h>
1693 ],[
1694         vfs_rename(NULL, NULL, NULL, NULL, NULL);
1695 ], [
1696         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
1697                 [kernel has vfs_rename with 5 args])
1698 ])
1699 ]) # LC_VFS_RENAME_5ARGS
1700
1701 #
1702 # LC_VFS_UNLINK_3ARGS
1703 #
1704 # 3.13 has vfs_unlink with 3 args
1705 #
1706 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
1707 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
1708 vfs_unlink_3args, [
1709         #include <linux/fs.h>
1710 ],[
1711         vfs_unlink(NULL, NULL, NULL);
1712 ], [
1713         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
1714                 [kernel has vfs_unlink with 3 args])
1715 ])
1716 ]) # LC_VFS_UNLINK_3ARGS
1717
1718 #
1719 # LC_HAVE_BVEC_ITER
1720 #
1721 # 3.14 move some of its data in struct bio into the new
1722 # struct bvec_iter
1723 #
1724 AC_DEFUN([LC_HAVE_BVEC_ITER], [
1725 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
1726 have_bvec_iter, [
1727         #include <linux/bio.h>
1728 ],[
1729         struct bvec_iter iter;
1730         iter.bi_bvec_done = 0;
1731 ], [
1732         AC_DEFINE(HAVE_BVEC_ITER, 1,
1733                 [kernel has struct bvec_iter])
1734 ])
1735 ]) # LC_HAVE_BVEC_ITER
1736
1737 #
1738 # LC_HAVE_BI_CNT
1739 #
1740 # 4.4 redefined bi_cnt as __bi_cnt
1741 #
1742 AC_DEFUN([LC_HAVE_BI_CNT], [
1743 LB_CHECK_COMPILE([if Linux kernel has bi_cnt in struct bio],
1744 have_bi_cnt, [
1745         #include <asm/atomic.h>
1746         #include <linux/bio.h>
1747 ],[
1748         struct bio bio;
1749         int cnt;
1750         cnt = atomic_read(&bio.bi_cnt);
1751 ], [
1752         AC_DEFINE(HAVE_BI_CNT, 1,
1753                 [struct bio has bi_cnt])
1754 ])
1755 ]) # LC_HAVE_BI_CNT
1756
1757 #
1758 # LC_HAVE_TRUNCATE_IPAGE_FINAL
1759 #
1760 # 3.14 bring truncate_inode_pages_final for evict_inode
1761 #
1762 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
1763 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
1764 truncate_ipages_final, [
1765         #include <linux/mm.h>
1766 ],[
1767         truncate_inode_pages_final(NULL);
1768 ], [
1769         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
1770                 [kernel has truncate_inode_pages_final])
1771 ])
1772 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
1773
1774 #
1775 # LC_IOPS_RENAME_WITH_FLAGS
1776 #
1777 # 3.14 has inode_operations->rename with 5 args
1778 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
1779 #
1780 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
1781 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
1782 iops_rename_with_flags, [
1783         #include <linux/fs.h>
1784 ],[
1785         struct inode *i1 = NULL, *i2 = NULL;
1786         struct dentry *d1 = NULL, *d2 = NULL;
1787         int rc;
1788         rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
1789 ], [
1790         AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
1791                 [inode_operations->rename need flags as argument])
1792 ])
1793 ]) # LC_IOPS_RENAME_WITH_FLAGS
1794
1795 #
1796 # LC_VFS_RENAME_6ARGS
1797 #
1798 # 3.15 has vfs_rename with 6 args
1799 #
1800 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
1801 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
1802 vfs_rename_6args, [
1803         #include <linux/fs.h>
1804 ],[
1805         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
1806 ], [
1807         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
1808                 [kernel has vfs_rename with 6 args])
1809 ])
1810 ]) # LC_VFS_RENAME_6ARGS
1811
1812 #
1813 # LC_DIRECTIO_USE_ITER
1814 #
1815 # 3.16 kernel changes direct IO to use iov_iter
1816 #
1817 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
1818 LB_CHECK_COMPILE([if direct IO uses iov_iter],
1819 direct_io_iter, [
1820         #include <linux/fs.h>
1821 ],[
1822         struct address_space_operations ops;
1823         struct iov_iter *iter = NULL;
1824         loff_t offset = 0;
1825
1826         ops.direct_IO(0, NULL, iter, offset);
1827 ],[
1828         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
1829                 [direct IO uses iov_iter])
1830 ])
1831 ]) # LC_DIRECTIO_USE_ITER
1832
1833 #
1834 # LC_HAVE_IOV_ITER_INIT_DIRECTION
1835 #
1836 #
1837 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
1838 #      changed iov_iter_init api to start accepting a tag
1839 #      that defines if its a read or write operation
1840 #
1841 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
1842 tmp_flags="$EXTRA_KCFLAGS"
1843 EXTRA_KCFLAGS="-Werror"
1844 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
1845 iter_init, [
1846         #include <linux/uio.h>
1847         #include <linux/fs.h>
1848 ],[
1849         const struct iovec *iov = NULL;
1850
1851         iov_iter_init(NULL, READ, iov, 1, 0);
1852 ],[
1853         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
1854                 [iov_iter_init handles directional tag])
1855 ])
1856 EXTRA_KCFLAGS="$tmp_flags"
1857 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
1858
1859 #
1860 # LC_HAVE_IOV_ITER_TRUNCATE
1861 #
1862 #
1863 # 3.16 introduces a new API iov_iter_truncate()
1864 #
1865 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
1866 tmp_flags="$EXTRA_KCFLAGS"
1867 EXTRA_KCFLAGS="-Werror"
1868 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
1869 iter_truncate, [
1870         #include <linux/uio.h>
1871         #include <linux/fs.h>
1872 ],[
1873         struct iov_iter *i = NULL;
1874
1875         iov_iter_truncate(i, 0);
1876 ],[
1877         AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
1878 ])
1879 EXTRA_KCFLAGS="$tmp_flags"
1880 ]) # LC_HAVE_IOV_ITER_TRUNCATE
1881
1882 #
1883 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1884 #
1885 # 3.16 introduces [read|write]_iter to struct file_operations
1886 #
1887 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1888 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
1889 file_function_iter, [
1890         #include <linux/fs.h>
1891 ],[
1892         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
1893         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
1894 ],[
1895         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
1896                 [file_operations.[read|write]_iter functions exist])
1897 ])
1898 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1899
1900 #
1901 # LC_KEY_MATCH_DATA
1902 #
1903 # 3.17  replaces key_type::match with match_preparse
1904 #       and has new struct key_match_data
1905 #
1906 AC_DEFUN([LC_KEY_MATCH_DATA], [
1907 LB_CHECK_COMPILE([if struct key_match field exist],
1908 key_match, [
1909         #include <linux/key-type.h>
1910 ],[
1911         struct key_match_data data;
1912 ],[
1913         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
1914                 [struct key_match_data exist])
1915 ])
1916 ]) # LC_KEY_MATCH_DATA
1917
1918 #
1919 # LC_NFS_FILLDIR_USE_CTX
1920 #
1921 # 3.18 kernel moved from void cookie to struct dir_context
1922 #
1923 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1924 tmp_flags="$EXTRA_KCFLAGS"
1925 EXTRA_KCFLAGS="-Werror"
1926 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
1927 filldir_ctx, [
1928         #include <linux/fs.h>
1929 ],[
1930         int filldir(struct dir_context *ctx, const char* name,
1931                     int i, loff_t off, u64 tmp, unsigned temp)
1932         {
1933                 return 0;
1934         }
1935
1936         struct dir_context ctx = {
1937                 .actor = filldir,
1938         };
1939
1940         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1941 ],[
1942         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1943                 [filldir_t needs struct dir_context as argument])
1944 ])
1945 EXTRA_KCFLAGS="$tmp_flags"
1946 ]) # LC_NFS_FILLDIR_USE_CTX
1947
1948 #
1949 # LC_PERCPU_COUNTER_INIT
1950 #
1951 # 3.18  For kernels 3.18 and after percpu_counter_init starts
1952 #       to pass a GFP_* memory allocation flag for internal
1953 #       memory allocation purposes.
1954 #
1955 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1956 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1957 percpu_counter_init, [
1958         #include <linux/percpu_counter.h>
1959 ],[
1960         percpu_counter_init(NULL, 0, GFP_KERNEL);
1961 ],[
1962         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1963                 [percpu_counter_init uses GFP_* flag])
1964 ])
1965 ]) # LC_PERCPU_COUNTER_INIT
1966
1967 #
1968 # LC_KIOCB_HAS_NBYTES
1969 #
1970 # 3.19 kernel removed ki_nbytes from struct kiocb
1971 #
1972 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1973 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1974 ki_nbytes, [
1975         #include <linux/fs.h>
1976 ],[
1977         struct kiocb iocb;
1978
1979         iocb.ki_nbytes = 0;
1980 ],[
1981         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1982 ])
1983 ]) # LC_KIOCB_HAS_NBYTES
1984
1985 #
1986 # LC_HAVE_DQUOT_QC_DQBLK
1987 #
1988 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
1989 # Added in commit 14bf61ffe
1990 #
1991 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
1992 tmp_flags="$EXTRA_KCFLAGS"
1993 EXTRA_KCFLAGS="-Werror"
1994 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
1995 qc_dqblk, [
1996         #include <linux/fs.h>
1997         #include <linux/quota.h>
1998 ],[
1999         ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
2000 ],[
2001         AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
2002                 [quotactl_ops.set_dqblk takes struct qc_dqblk])
2003         AC_DEFINE(HAVE_DQUOT_KQID, 1,
2004                 [quotactl_ops.set_dqblk takes struct kqid])
2005 ])
2006 EXTRA_KCFLAGS="$tmp_flags"
2007 ]) # LC_HAVE_DQUOT_QC_DQBLK
2008
2009 #
2010 # LC_BACKING_DEV_INFO_REMOVAL
2011 #
2012 # 3.20 kernel removed backing_dev_info from address_space
2013 #
2014 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
2015 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
2016 backing_dev_info, [
2017         #include <linux/fs.h>
2018 ],[
2019         struct address_space mapping;
2020
2021         mapping.backing_dev_info = NULL;
2022 ],[
2023         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
2024 ])
2025 ]) # LC_BACKING_DEV_INFO_REMOVAL
2026
2027 #
2028 # LC_HAVE_BDI_CAP_MAP_COPY
2029 #
2030 # 3.20  removed mmap handling for backing devices since
2031 #       it breaks on non-MMU systems. See kernel commit
2032 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
2033 #
2034 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
2035 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
2036 bdi_cap_map_copy, [
2037         #include <linux/backing-dev.h>
2038 ],[
2039         struct backing_dev_info info;
2040
2041         info.capabilities = BDI_CAP_MAP_COPY;
2042 ],[
2043         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
2044                 [BDI_CAP_MAP_COPY exist])
2045 ])
2046 ]) # LC_HAVE_BDI_CAP_MAP_COPY
2047
2048 #
2049 # LC_CANCEL_DIRTY_PAGE
2050 #
2051 # 4.0.0 kernel removed cancel_dirty_page
2052 #
2053 AC_DEFUN([LC_CANCEL_DIRTY_PAGE], [
2054 LB_CHECK_COMPILE([if cancel_dirty_page still exist],
2055 cancel_dirty_page, [
2056         #include <linux/mm.h>
2057 ],[
2058         cancel_dirty_page(NULL, PAGE_SIZE);
2059 ],[
2060         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
2061                 [cancel_dirty_page is still available])
2062 ])
2063 ]) # LC_CANCEL_DIRTY_PAGE
2064
2065 #
2066 # LC_IOV_ITER_RW
2067 #
2068 # 4.1 kernel has iov_iter_rw
2069 #
2070 AC_DEFUN([LC_IOV_ITER_RW], [
2071 LB_CHECK_COMPILE([if iov_iter_rw exist],
2072 iov_iter_rw, [
2073         #include <linux/fs.h>
2074         #include <linux/uio.h>
2075 ],[
2076         struct iov_iter *iter = NULL;
2077
2078         iov_iter_rw(iter);
2079 ],[
2080         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
2081                 [iov_iter_rw exist])
2082 ])
2083 ]) # LC_IOV_ITER_RW
2084
2085 #
2086 # LC_HAVE_SYNC_READ_WRITE
2087 #
2088 # 4.1 new_sync_[read|write] no longer exported
2089 #
2090 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
2091 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
2092         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
2093                         [new_sync_[read|write] is exported by the kernel])])
2094 ]) # LC_HAVE_SYNC_READ_WRITE
2095
2096 #
2097 # LC_NEW_CANCEL_DIRTY_PAGE
2098 #
2099 # 4.2 kernel has new cancel_dirty_page
2100 #
2101 AC_DEFUN([LC_NEW_CANCEL_DIRTY_PAGE], [
2102 LB_CHECK_COMPILE([if cancel_dirty_page with one argument exist],
2103 new_cancel_dirty_page, [
2104         #include <linux/mm.h>
2105 ],[
2106         cancel_dirty_page(NULL);
2107 ],[
2108         AC_DEFINE(HAVE_NEW_CANCEL_DIRTY_PAGE, 1,
2109                 [cancel_dirty_page with one arguement is available])
2110 ])
2111 ]) # LC_NEW_CANCEL_DIRTY_PAGE
2112
2113 #
2114 # LC_SYMLINK_OPS_USE_NAMEIDATA
2115 #
2116 # For the 4.2+ kernels the file system internal symlink api no
2117 # longer uses struct nameidata as a argument
2118 #
2119 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
2120 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
2121 symlink_use_nameidata, [
2122         #include <linux/namei.h>
2123         #include <linux/fs.h>
2124 ],[
2125         struct nameidata *nd = NULL;
2126
2127         ((struct inode_operations *)0)->follow_link(NULL, nd);
2128         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
2129 ],[
2130         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
2131                 [symlink inode operations need struct nameidata argument])
2132 ])
2133 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
2134
2135 #
2136 # LC_BIO_ENDIO_USES_ONE_ARG
2137 #
2138 # 4.2 kernel bio_endio now only takes one argument
2139 #
2140 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
2141 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
2142 bio_endio, [
2143         #include <linux/bio.h>
2144 ],[
2145         bio_endio(NULL);
2146 ],[
2147         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
2148                 [bio_endio takes only one argument])
2149 ])
2150 ]) # LC_BIO_ENDIO_USES_ONE_ARG
2151
2152 #
2153 # LC_HAVE_LOOP_CTL_GET_FREE
2154 #
2155 # 4.x kernel have moved userspace APIs to
2156 # the separate directory and all of them
2157 # support LOOP_CTL_GET_FREE
2158 #
2159 AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [
2160 LB_CHECK_FILE([$LINUX/include/linux/loop.h], [
2161         LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'],
2162         LOOP_CTL_GET_FREE, [
2163                 #include <linux/loop.h>
2164         ],[
2165                 int i;
2166
2167                 i = LOOP_CTL_GET_FREE;
2168         ],[
2169                 AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
2170                         [LOOP_CTL_GET_FREE exist])
2171         ])
2172 ],[
2173         AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
2174                 [kernel has LOOP_CTL_GET_FREE])
2175 ])
2176 ]) # LC_HAVE_LOOP_CTL_GET_FREE
2177
2178 #
2179 # LC_HAVE_CACHE_HEAD_HLIST
2180 #
2181 # 4.3 kernel swiched to hlist for cache_head
2182 #
2183 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
2184 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
2185 cache_head_has_hlist, [
2186         #include <linux/sunrpc/cache.h>
2187 ],[
2188         do {} while(sizeof(((struct cache_head *)0)->cache_list));
2189 ],[
2190         AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
2191                 [cache_head has hlist cache_list])
2192 ])
2193 ]) # LC_HAVE_CACHE_HEAD_HLIST
2194
2195 #
2196 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2197 #
2198 # 4.4 kernel have moved locks API users to
2199 # locks_lock_inode_wait()
2200 #
2201 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
2202 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
2203 locks_lock_file_wait, [
2204         #include <linux/fs.h>
2205 ],[
2206         locks_lock_file_wait(NULL, NULL);
2207 ],[
2208         AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
2209                 [kernel has locks_lock_file_wait])
2210 ])
2211 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2212
2213 #
2214 # LC_HAVE_QC_MAKE_REQUEST_FN
2215 #
2216 # 4.4 request_queue.make_request_fn defined as function returns with blk_qc_t
2217 # see kernel commit dece16353ef47d8d33f5302bc158072a9d65e26f
2218 #
2219 AC_DEFUN([LC_HAVE_QC_MAKE_REQUEST_FN], [
2220 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns blk_qc_t],
2221 make_request_fn_blk_qc_t, [
2222         #include <linux/blkdev.h>
2223 ],[
2224         blk_qc_t ret;
2225         make_request_fn *mrf;
2226         ret = mrf(NULL, NULL);
2227 ],[
2228         AC_DEFINE(HAVE_QC_MAKE_REQUEST_FN, 1,
2229                 [request_queue.make_request_fn returns blk_qc_t])
2230 ])
2231 ]) # LC_HAVE_QC_MAKE_REQUEST_FN
2232
2233 #
2234 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2235 #
2236 # 4.4 kernel merged type-specific data with the payload data for keys
2237 #
2238 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
2239 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
2240 key_payload_data_array, [
2241         #include <linux/key.h>
2242 ],[
2243         ((struct key *)0)->payload.data[0] = NULL;
2244 ],[
2245         AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
2246 ])
2247 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2248
2249 #
2250 # LC_HAVE_FILE_DENTRY
2251 #
2252 # 4.5 adds wrapper file_dentry
2253 #
2254 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
2255 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
2256 file_dentry, [
2257         #include <linux/fs.h>
2258 ],[
2259         file_dentry(NULL);
2260 ], [
2261         AC_DEFINE(HAVE_FILE_DENTRY, 1,
2262                 [kernel has file_dentry])
2263 ])
2264 ]) # LC_HAVE_FILE_DENTRY
2265
2266 #
2267 # LC_HAVE_INODE_LOCK
2268 #
2269 # 4.5 introduced inode_lock
2270 #
2271 AC_DEFUN([LC_HAVE_INODE_LOCK], [
2272 LB_CHECK_COMPILE([if 'inode_lock' is defined],
2273 inode_lock, [
2274         #include <linux/fs.h>
2275 ],[
2276         inode_lock(NULL);
2277 ], [
2278         AC_DEFINE(HAVE_INODE_LOCK, 1,
2279                   [inode_lock is defined])
2280 ])
2281 ]) # LC_HAVE_INODE_LOCK
2282
2283 #
2284 # LC_HAVE_IOP_GET_LINK
2285 #
2286 # 4.5 vfs replaced iop->follow_link with
2287 # iop->get_link
2288 #
2289 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
2290 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
2291 inode_ops_get_link, [
2292         #include <linux/fs.h>
2293 ],[
2294         struct inode_operations iop;
2295         iop.get_link = NULL;
2296 ],[
2297         AC_DEFINE(HAVE_IOP_GET_LINK, 1,
2298                 [have iop get_link])
2299 ])
2300 ]) # LC_HAVE_IOP_GET_LINK
2301
2302 #
2303 # LC_HAVE_IN_COMPAT_SYSCALL
2304 #
2305 # 4.6 renamed is_compat_task to in_compat_syscall
2306 #
2307 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
2308 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
2309 in_compat_syscall, [
2310         #include <linux/compat.h>
2311 ],[
2312         in_compat_syscall();
2313 ],[
2314         AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
2315                 [have in_compat_syscall])
2316 ])
2317 ]) # LC_HAVE_IN_COMPAT_SYSCALL
2318
2319 #
2320 # LC_DIRECTIO_2ARGS
2321 #
2322 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
2323 # direct-io: eliminate the offset argument to ->direct_IO
2324 #
2325 AC_DEFUN([LC_DIRECTIO_2ARGS], [
2326 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
2327 direct_io_2args, [
2328         #include <linux/fs.h>
2329 ],[
2330         struct address_space_operations ops;
2331         struct iov_iter *iter = NULL;
2332         struct kiocb *iocb = NULL;
2333         int rc;
2334         rc = ops.direct_IO(iocb, iter);
2335 ],[
2336         AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
2337                 [direct_IO need 2 arguments])
2338 ])
2339 ]) # LC_DIRECTIO_2ARGS
2340
2341 #
2342 # LC_GENERIC_WRITE_SYNC_2ARGS
2343 #
2344 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
2345 # direct-io: eliminate the offset argument to ->direct_IO
2346 #
2347 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
2348 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
2349 generic_write_sync_2args, [
2350         #include <linux/fs.h>
2351 ],[
2352         struct kiocb *iocb = NULL;
2353         ssize_t rc;
2354         rc = generic_write_sync(iocb, 0);
2355 ],[
2356         AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
2357                 [generic_write_sync need 2 arguments])
2358 ])
2359 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
2360
2361 #
2362 # LC_HAVE_POSIX_ACL_VALID_USER_NS
2363 #
2364 # 4.8 posix_acl_valid takes struct user_namespace
2365 #
2366 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
2367 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
2368 posix_acl_valid, [
2369         #include <linux/fs.h>
2370         #include <linux/posix_acl.h>
2371 ],[
2372         posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
2373 ],[
2374         AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
2375                 [posix_acl_valid takes struct user_namespace])
2376 ])
2377 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
2378
2379 #
2380 # LC_D_COMPARE_4ARGS
2381 #
2382 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
2383 # get rid of 'parent' argument of ->d_compare()
2384 #
2385 AC_DEFUN([LC_D_COMPARE_4ARGS], [
2386 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
2387 d_compare_4args, [
2388         #include <linux/dcache.h>
2389 ],[
2390         ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
2391 ],[
2392         AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
2393                 [d_compare need 4 arguments])
2394 ])
2395 ]) # LC_D_COMPARE_4ARGS
2396
2397 #
2398 # LC_FULL_NAME_HASH_3ARGS
2399 #
2400 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
2401 # vfs: make the string hashes salt the hash
2402 #
2403 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
2404 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
2405 full_name_hash_3args, [
2406         #include <linux/stringhash.h>
2407 ],[
2408         unsigned int hash;
2409         hash = full_name_hash(NULL,NULL,0);
2410 ],[
2411         AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
2412                 [full_name_hash need 3 arguments])
2413 ])
2414 ]) # LC_FULL_NAME_HASH_3ARGS
2415
2416 #
2417 # LC_GROUP_INFO_GID
2418 #
2419 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
2420 # cred: simpler, 1D supplementary groups
2421 #
2422 AC_DEFUN([LC_GROUP_INFO_GID], [
2423 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
2424 group_info_gid, [
2425         #include <linux/cred.h>
2426 ],[
2427         kgid_t *p;
2428         p = ((struct group_info *)0)->gid;
2429 ],[
2430         AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
2431                 [struct group_info has member gid])
2432 ])
2433 ]) # LC_GROUP_INFO_GID
2434
2435 #
2436 # LC_STRUCT_POSIX_ACL_XATTR
2437 #
2438 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
2439 # posix_acl: xattr representation cleanups
2440 #
2441 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
2442 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
2443 struct_posix_acl_xattr, [
2444         #include <linux/fs.h>
2445         #include <linux/posix_acl_xattr.h>
2446 ],[
2447         struct posix_acl_xattr_header *h = NULL;
2448         struct posix_acl_xattr_entry  *e;
2449         e = (void *)(h + 1);
2450 ],[
2451         AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
2452                 [struct posix_acl_xattr_{header,entry} defined])
2453 ])
2454 ]) # LC_STRUCT_POSIX_ACL_XATTR
2455
2456 #
2457 # LC_IOP_GENERIC_READLINK
2458 #
2459 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
2460 # removed generic_readlink from individual file systems
2461 #
2462 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
2463 LB_CHECK_COMPILE([if 'generic_readlink' still exist],
2464 inode_ops_readlink, [
2465         #include <linux/fs.h>
2466 ],[
2467         struct inode_operations iop;
2468         iop.readlink = generic_readlink;
2469 ],[
2470         AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
2471                 [generic_readlink has been removed])
2472 ])
2473 ]) # LC_IOP_GENERIC_READLINK
2474
2475 #
2476 # LC_PROG_LINUX
2477 #
2478 # Lustre linux kernel checks
2479 #
2480 AC_DEFUN([LC_PROG_LINUX], [
2481         AC_MSG_NOTICE([Lustre kernel checks
2482 ==============================================================================])
2483
2484         LC_CONFIG_PINGER
2485         LC_CONFIG_CHECKSUM
2486         LC_CONFIG_HEALTH_CHECK_WRITE
2487         LC_CONFIG_LRU_RESIZE
2488
2489         LC_GLIBC_SUPPORT_FHANDLES
2490         LC_CONFIG_GSS
2491         LC_OPENSSL_SSK
2492
2493         # 2.6.32
2494         LC_BLK_QUEUE_MAX_SEGMENTS
2495
2496         # 2.6.34
2497         LC_HAVE_DQUOT_FS_DISK_QUOTA
2498         LC_HAVE_DQUOT_SUSPEND
2499         LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
2500
2501         # 2.6.35, 3.0.0
2502         LC_FILE_FSYNC
2503         LC_EXPORT_SIMPLE_SETATTR
2504         LC_EXPORT_TRUNCATE_COMPLETE_PAGE
2505
2506         # 2.6.36
2507         LC_FS_STRUCT_RWLOCK
2508         LC_SBOPS_EVICT_INODE
2509
2510         # 2.6.37
2511         LC_KERNEL_LOCKED
2512
2513         # 2.6.38
2514         LC_BLKDEV_GET_BY_DEV
2515         LC_GENERIC_PERMISSION
2516         LC_DCACHE_LOCK
2517         LC_INODE_I_RCU
2518         LC_D_COMPARE_7ARGS
2519         LC_D_DELETE_CONST
2520         LC_HAVE_BLK_PLUG
2521
2522         # 2.6.39
2523         LC_REQUEST_QUEUE_UNPLUG_FN
2524         LC_HAVE_FHANDLE_SYSCALLS
2525         LC_HAVE_FSTYPE_MOUNT
2526         LC_IOP_TRUNCATE
2527         LC_HAVE_INODE_OWNER_OR_CAPABLE
2528         LC_HAVE_SECURITY_IINITSEC
2529
2530         # 3.0
2531         LC_DIRTY_INODE_WITH_FLAG
2532         LC_SETNS
2533
2534         # 3.1
2535         LC_LM_XXX_LOCK_MANAGER_OPS
2536         LC_INODE_DIO_WAIT
2537         LC_IOP_GET_ACL
2538         LC_FILE_LLSEEK_SIZE
2539         LC_INODE_PERMISION_2ARGS
2540         LC_RADIX_EXCEPTION_ENTRY
2541         LC_HAVE_LOOP_CTL_GET_FREE
2542
2543         # 3.2
2544         LC_HAVE_VOID_MAKE_REQUEST_FN
2545         LC_HAVE_PROTECT_I_NLINK
2546
2547         # 3.3
2548         LC_HAVE_MIGRATE_HEADER
2549         LC_MIGRATEPAGE_4ARGS
2550         LC_SUPEROPS_USE_DENTRY
2551         LC_INODEOPS_USE_UMODE_T
2552         LC_HAVE_CACHE_REGISTER
2553
2554         # 3.4
2555         LC_HAVE_D_MAKE_ROOT
2556         LC_KMAP_ATOMIC_HAS_1ARG
2557
2558         # 3.5
2559         LC_HAVE_CLEAR_INODE
2560         LC_HAVE_ENCODE_FH_PARENT
2561         LC_FILE_LLSEEK_SIZE_5ARG
2562
2563         # 3.6
2564         LC_DATA_FOR_LLITE_IS_LIST
2565         LC_DENTRY_OPEN_USE_PATH
2566         LC_HAVE_IOP_ATOMIC_OPEN
2567         LC_HAVE_SB_START_WRITE
2568
2569         # 3.7
2570         LC_HAVE_POSIXACL_USER_NS
2571
2572         # 3.8
2573         LC_HAVE_FILE_F_INODE
2574         LC_HAVE_FILE_INODE
2575         LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
2576
2577         # 3.9
2578         LC_HAVE_HLIST_FOR_EACH_3ARG
2579         LC_HAVE_BIO_END_SECTOR
2580         LC_HAVE_IS_SXID
2581
2582         # 3.10
2583         LC_BLKDEV_RELEASE_RETURN_INT
2584         LC_HAVE_REMOVE_PROC_SUBTREE
2585         LC_HAVE_PROC_REMOVE
2586         LC_HAVE_PROJECT_QUOTA
2587         LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
2588
2589         # 3.11
2590         LC_INVALIDATE_RANGE
2591         LC_HAVE_DIR_CONTEXT
2592         LC_D_COMPARE_5ARGS
2593         LC_HAVE_DCOUNT
2594         LC_HAVE_DENTRY_D_U_D_ALIAS
2595         LC_HAVE_DENTRY_D_CHILD
2596         LC_PID_NS_FOR_CHILDREN
2597
2598         # 3.12
2599         LC_OLDSIZE_TRUNCATE_PAGECACHE
2600         LC_KIOCB_KI_LEFT
2601
2602         # 3.13
2603         LC_VFS_RENAME_5ARGS
2604         LC_VFS_UNLINK_3ARGS
2605
2606         # 3.14
2607         LC_HAVE_BVEC_ITER
2608         LC_HAVE_TRUNCATE_IPAGES_FINAL
2609         LC_IOPS_RENAME_WITH_FLAGS
2610
2611         # 3.15
2612         LC_VFS_RENAME_6ARGS
2613
2614         # 3.16
2615         LC_DIRECTIO_USE_ITER
2616         LC_HAVE_IOV_ITER_INIT_DIRECTION
2617         LC_HAVE_IOV_ITER_TRUNCATE
2618         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2619
2620         # 3.17
2621         LC_KEY_MATCH_DATA
2622
2623         # 3.18
2624         LC_PERCPU_COUNTER_INIT
2625         LC_NFS_FILLDIR_USE_CTX
2626
2627         # 3.19
2628         LC_KIOCB_HAS_NBYTES
2629         LC_HAVE_DQUOT_QC_DQBLK
2630
2631         # 3.20
2632         LC_BACKING_DEV_INFO_REMOVAL
2633         LC_HAVE_BDI_CAP_MAP_COPY
2634
2635         # 4.0.0
2636         LC_CANCEL_DIRTY_PAGE
2637
2638         # 4.1.0
2639         LC_IOV_ITER_RW
2640         LC_HAVE_SYNC_READ_WRITE
2641
2642         # 4.2
2643         LC_NEW_CANCEL_DIRTY_PAGE
2644         LC_BIO_ENDIO_USES_ONE_ARG
2645         LC_SYMLINK_OPS_USE_NAMEIDATA
2646
2647         # 4.3
2648         LC_HAVE_CACHE_HEAD_HLIST
2649
2650         # 4.4
2651         LC_HAVE_LOCKS_LOCK_FILE_WAIT
2652         LC_HAVE_QC_MAKE_REQUEST_FN
2653         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2654         LC_HAVE_BI_CNT
2655
2656         # 4.5
2657         LC_HAVE_FILE_DENTRY
2658
2659         # 4.5
2660         LC_HAVE_INODE_LOCK
2661         LC_HAVE_IOP_GET_LINK
2662
2663         # 4.6
2664         LC_HAVE_IN_COMPAT_SYSCALL
2665
2666         # 4.7
2667         LC_DIRECTIO_2ARGS
2668         LC_GENERIC_WRITE_SYNC_2ARGS
2669
2670         # 4.8
2671         LC_HAVE_POSIX_ACL_VALID_USER_NS
2672         LC_D_COMPARE_4ARGS
2673         LC_FULL_NAME_HASH_3ARGS
2674         LC_STRUCT_POSIX_ACL_XATTR
2675
2676         # 4.9
2677         LC_GROUP_INFO_GID
2678
2679         # 4.10
2680         LC_IOP_GENERIC_READLINK
2681
2682         #
2683         AS_IF([test "x$enable_server" != xno], [
2684                 LC_STACK_SIZE
2685                 LC_QUOTA64
2686                 LC_QUOTA_CONFIG
2687         ])
2688 ]) # LC_PROG_LINUX
2689
2690 #
2691 # LC_CONFIG_CLIENT
2692 #
2693 # Check whether to build the client side of Lustre
2694 #
2695 AC_DEFUN([LC_CONFIG_CLIENT], [
2696 AC_MSG_CHECKING([whether to build Lustre client support])
2697 AC_ARG_ENABLE([client],
2698         AC_HELP_STRING([--disable-client],
2699                 [disable Lustre client support]),
2700         [], [enable_client="yes"])
2701 AC_MSG_RESULT([$enable_client])
2702 ]) # LC_CONFIG_CLIENT
2703
2704 #
2705 # --enable-mpitests
2706 #
2707 AC_DEFUN([LB_CONFIG_MPITESTS], [
2708 AC_ARG_ENABLE([mpitests],
2709         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2710                        [include mpi tests]), [
2711                 enable_mpitests="yes"
2712                 case $enableval in
2713                 yes)
2714                         MPICC_WRAPPER="mpicc"
2715                         ;;
2716                 no)
2717                         enable_mpitests="no"
2718                         ;;
2719                 *)
2720                         MPICC_WRAPPER=$enableval
2721                         ;;
2722                 esac
2723         ], [
2724                 enable_mpitests="yes"
2725                 MPICC_WRAPPER="mpicc"
2726         ])
2727
2728         if test "x$enable_mpitests" != "xno"; then
2729                 oldcc=$CC
2730                 CC=$MPICC_WRAPPER
2731                 AC_CACHE_CHECK([whether mpitests can be built],
2732                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2733                         #include <mpi.h>
2734                         int main(void) {
2735                                 int flag;
2736                                 MPI_Initialized(&flag);
2737                                 return 0;
2738                         }
2739                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
2740                 ])
2741                 enable_mpitests=$lb_cv_mpi_tests
2742                 CC=$oldcc
2743         fi
2744         AC_SUBST(MPICC_WRAPPER)
2745 ]) # LB_CONFIG_MPITESTS
2746
2747 #
2748 # LC_CONFIG_QUOTA
2749 #
2750 # whether to enable quota support global control
2751 #
2752 AC_DEFUN([LC_CONFIG_QUOTA], [
2753 AC_MSG_CHECKING([whether to enable quota support global control])
2754 AC_ARG_ENABLE([quota],
2755         AC_HELP_STRING([--enable-quota],
2756                 [enable quota support]),
2757         [], [enable_quota="yes"])
2758 AS_IF([test "x$enable_quota" = xyes],
2759         [AC_MSG_RESULT([yes])],
2760         [AC_MSG_RESULT([no])])
2761 ]) # LC_CONFIG_QUOTA
2762
2763 #
2764 # LC_QUOTA
2765 #
2766 AC_DEFUN([LC_QUOTA], [
2767 #check global
2768 LC_CONFIG_QUOTA
2769 #check for utils
2770 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
2771         AC_CHECK_HEADER([sys/quota.h],
2772                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
2773                         [Define to 1 if you have <sys/quota.h>.])],
2774                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2775 ])
2776 ]) # LC_QUOTA
2777
2778 #
2779 # LC_CONFIG_NODEMAP_PROC_DEBUG
2780 #
2781 # enable nodemap proc file debugging
2782 #
2783 AC_DEFUN([LC_NODEMAP_PROC_DEBUG], [
2784 AC_MSG_CHECKING([whether to enable nodemap proc debug])
2785 AC_ARG_ENABLE([nodemap_proc_debug],
2786         AC_HELP_STRING([--enable-nodemap-proc-debug],
2787                 [enable nodemap proc debug]),
2788         [], [enable_nodemap_proc_debug="no"])
2789 AC_MSG_RESULT([$enable_nodemap_proc_debug])
2790 AS_IF([test "x$enable_nodemap_proc_debug" != xno],
2791         [AC_DEFINE(NODEMAP_PROC_DEBUG, 1,
2792                 [enable nodemap proc debug support])])
2793 ]) # LC_NODEMAP_PROC_DEBUG
2794
2795 #
2796 # LC_OSD_ADDON
2797 #
2798 # configure support for optional OSD implementation
2799 #
2800 AC_DEFUN([LC_OSD_ADDON], [
2801 AC_MSG_CHECKING([whether to use OSD addon])
2802 AC_ARG_WITH([osd],
2803         AC_HELP_STRING([--with-osd=path],
2804                 [set path to optional osd]),
2805         [
2806         case "$with_osd" in
2807         no)
2808                 ENABLEOSDADDON=0
2809                 ;;
2810         *)
2811                 OSDADDON="$with_osd"
2812                 ENABLEOSDADDON=1
2813                 ;;
2814         esac
2815         ], [
2816                 ENABLEOSDADDON=0
2817         ])
2818 AS_IF([test $ENABLEOSDADDON -eq 0], [
2819         AC_MSG_RESULT([no])
2820         OSDADDON=""
2821 ], [
2822         OSDMODNAME=$(basename $OSDADDON)
2823         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
2824                 AC_MSG_RESULT([can't link])
2825                 OSDADDON=""
2826         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
2827                 AC_MSG_RESULT([$OSDMODNAME])
2828                 OSDADDON="subdir-m += $OSDMODNAME"
2829         ], [
2830                 AC_MSG_RESULT([can't link])
2831                 OSDADDON=""
2832         ])
2833 ])
2834 AC_SUBST(OSDADDON)
2835 ]) # LC_OSD_ADDON
2836
2837 #
2838 # LC_CONFIGURE
2839 #
2840 # other configure checks
2841 #
2842 AC_DEFUN([LC_CONFIGURE], [
2843 AC_MSG_NOTICE([Lustre core checks
2844 ==============================================================================])
2845
2846 LC_CONFIG_OBD_BUFFER_SIZE
2847
2848 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
2849         [CFLAGS="$CFLAGS -Wall -Werror"])
2850
2851 # maximum MDS thread count
2852 LC_MDS_MAX_THREADS
2853
2854 # lustre/utils/gss/gss_util.c
2855 # lustre/utils/gss/gssd_proc.c
2856 # lustre/utils/gss/krb5_util.c
2857 # lustre/utils/llog_reader.c
2858 # lustre/utils/create_iam.c
2859 # lustre/utils/libiam.c
2860 AC_CHECK_HEADERS([netdb.h endian.h])
2861 AC_CHECK_FUNCS([gethostbyname])
2862
2863 # lustre/utils/llverdev.c
2864 AC_CHECK_HEADERS([blkid/blkid.h])
2865
2866 # lustre/utils/llverfs.c
2867 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2868
2869 SELINUX=""
2870 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2871         [AC_CHECK_HEADERS([selinux/selinux.h],
2872                         [SELINUX="-lselinux"
2873                         AC_DEFINE([HAVE_SELINUX], 1,
2874                                 [support for selinux ])],
2875                         [AC_MSG_WARN([
2876
2877 No libselinux-devel package found, unable to build selinux enabled tools
2878 ])
2879 ])],
2880         [AC_MSG_WARN([
2881
2882 No selinux package found, unable to build selinux enabled tools
2883 ])
2884 ])
2885 AC_SUBST(SELINUX)
2886
2887 # Super safe df
2888 AC_MSG_CHECKING([whether to report minimum OST free space])
2889 AC_ARG_ENABLE([mindf],
2890         AC_HELP_STRING([--enable-mindf],
2891                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2892         [], [enable_mindf="no"])
2893 AC_MSG_RESULT([$enable_mindf])
2894 AS_IF([test "$enable_mindf" = "yes"],
2895         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2896
2897 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2898 AC_ARG_ENABLE([fail_alloc],
2899         AC_HELP_STRING([--disable-fail-alloc],
2900                 [disable randomly alloc failure]),
2901         [], [enable_fail_alloc="yes"])
2902 AC_MSG_RESULT([$enable_fail_alloc])
2903 AS_IF([test "x$enable_fail_alloc" != xno],
2904         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2905                 [enable randomly alloc failure])])
2906
2907 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2908 AC_ARG_ENABLE([invariants],
2909         AC_HELP_STRING([--enable-invariants],
2910                 [enable invariant checking (cpu intensive)]),
2911         [], [enable_invariants="no"])
2912 AC_MSG_RESULT([$enable_invariants])
2913 AS_IF([test "x$enable_invariants" = xyes],
2914         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2915                 [enable invariant checking])])
2916
2917 AC_MSG_CHECKING([whether to track references with lu_ref])
2918 AC_ARG_ENABLE([lu_ref],
2919         AC_HELP_STRING([--enable-lu_ref],
2920                 [enable lu_ref reference tracking code]),
2921         [], [enable_lu_ref="no"])
2922 AC_MSG_RESULT([$enable_lu_ref])
2923 AS_IF([test "x$enable_lu_ref" = xyes],
2924         [AC_DEFINE([USE_LU_REF], 1,
2925                 [enable lu_ref reference tracking code])])
2926
2927 AC_MSG_CHECKING([whether to enable page state tracking])
2928 AC_ARG_ENABLE([pgstate-track],
2929         AC_HELP_STRING([--enable-pgstate-track],
2930                 [enable page state tracking]),
2931         [], [enable_pgstat_track="no"])
2932 AC_MSG_RESULT([$enable_pgstat_track])
2933 AS_IF([test "x$enable_pgstat_track" = xyes],
2934         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2935                 [enable page state tracking code])])
2936
2937 PKG_PROG_PKG_CONFIG
2938 AC_MSG_CHECKING([systemd unit file directory])
2939 AC_ARG_WITH([systemdsystemunitdir],
2940         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
2941                 [Directory for systemd service files])],
2942         [], [with_systemdsystemunitdir=auto])
2943 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
2944         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
2945         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
2946                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
2947                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
2948                 with_systemdsystemunitdir=no],
2949         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
2950 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
2951         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
2952 AC_MSG_RESULT([$with_systemdsystemunitdir])
2953 ]) # LC_CONFIGURE
2954
2955 #
2956 # LC_CONDITIONALS
2957 #
2958 # AM_CONDITIONALS for lustre
2959 #
2960 AC_DEFUN([LC_CONDITIONALS], [
2961 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2962 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2963 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2964 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2965 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2966 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2967 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2968 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2969 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2970 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
2971 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2972 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
2973 ]) # LC_CONDITIONALS
2974
2975 #
2976 # LC_CONFIG_FILES
2977 #
2978 # files that should be generated with AC_OUTPUT
2979 #
2980 AC_DEFUN([LC_CONFIG_FILES],
2981 [AC_CONFIG_FILES([
2982 lustre/Makefile
2983 lustre/autoMakefile
2984 lustre/autoconf/Makefile
2985 lustre/conf/Makefile
2986 lustre/contrib/Makefile
2987 lustre/doc/Makefile
2988 lustre/include/Makefile
2989 lustre/include/lustre/Makefile
2990 lustre/include/uapi/linux/Makefile
2991 lustre/kernel_patches/targets/3.10-rhel7.target
2992 lustre/kernel_patches/targets/2.6-rhel6.9.target
2993 lustre/kernel_patches/targets/2.6-rhel6.8.target
2994 lustre/kernel_patches/targets/2.6-rhel6.7.target
2995 lustre/kernel_patches/targets/2.6-rhel6.6.target
2996 lustre/kernel_patches/targets/2.6-rhel6.target
2997 lustre/kernel_patches/targets/2.6-rhel5.target
2998 lustre/kernel_patches/targets/2.6-sles11.target
2999 lustre/kernel_patches/targets/3.0-sles11.target
3000 lustre/kernel_patches/targets/3.0-sles11sp3.target
3001 lustre/kernel_patches/targets/3.0-sles11sp4.target
3002 lustre/kernel_patches/targets/3.12-sles12.target
3003 lustre/kernel_patches/targets/4.4-sles12.target
3004 lustre/kernel_patches/targets/2.6-fc11.target
3005 lustre/kernel_patches/targets/2.6-fc12.target
3006 lustre/kernel_patches/targets/2.6-fc15.target
3007 lustre/kernel_patches/targets/3.x-fc18.target
3008 lustre/ldlm/Makefile
3009 lustre/fid/Makefile
3010 lustre/fid/autoMakefile
3011 lustre/llite/Makefile
3012 lustre/llite/autoMakefile
3013 lustre/lov/Makefile
3014 lustre/lov/autoMakefile
3015 lustre/mdc/Makefile
3016 lustre/mdc/autoMakefile
3017 lustre/lmv/Makefile
3018 lustre/lmv/autoMakefile
3019 lustre/lfsck/Makefile
3020 lustre/lfsck/autoMakefile
3021 lustre/mdt/Makefile
3022 lustre/mdt/autoMakefile
3023 lustre/mdd/Makefile
3024 lustre/mdd/autoMakefile
3025 lustre/fld/Makefile
3026 lustre/fld/autoMakefile
3027 lustre/obdclass/Makefile
3028 lustre/obdclass/autoMakefile
3029 lustre/obdclass/linux/Makefile
3030 lustre/obdecho/Makefile
3031 lustre/obdecho/autoMakefile
3032 lustre/ofd/Makefile
3033 lustre/ofd/autoMakefile
3034 lustre/osc/Makefile
3035 lustre/osc/autoMakefile
3036 lustre/ost/Makefile
3037 lustre/ost/autoMakefile
3038 lustre/osd-ldiskfs/Makefile
3039 lustre/osd-ldiskfs/autoMakefile
3040 lustre/osd-zfs/Makefile
3041 lustre/osd-zfs/autoMakefile
3042 lustre/mgc/Makefile
3043 lustre/mgc/autoMakefile
3044 lustre/mgs/Makefile
3045 lustre/mgs/autoMakefile
3046 lustre/target/Makefile
3047 lustre/ptlrpc/Makefile
3048 lustre/ptlrpc/autoMakefile
3049 lustre/ptlrpc/gss/Makefile
3050 lustre/ptlrpc/gss/autoMakefile
3051 lustre/quota/Makefile
3052 lustre/quota/autoMakefile
3053 lustre/scripts/Makefile
3054 lustre/scripts/systemd/Makefile
3055 lustre/tests/Makefile
3056 lustre/tests/mpi/Makefile
3057 lustre/tests/kernel/Makefile
3058 lustre/tests/kernel/autoMakefile
3059 lustre/utils/Makefile
3060 lustre/utils/gss/Makefile
3061 lustre/osp/Makefile
3062 lustre/osp/autoMakefile
3063 lustre/lod/Makefile
3064 lustre/lod/autoMakefile
3065 ])
3066 ]) # LC_CONFIG_FILES