Whamcloud - gitweb
LU-10973 lnet: initial LUTF C infrastructure
[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 ldiskfs_is_ext4="yes"
9 ])
10
11 #
12 # LC_PATH_DEFAULTS
13 #
14 # lustre specific paths
15 #
16 AC_DEFUN([LC_PATH_DEFAULTS], [
17 # ptlrpc kernel build requires this
18 LUSTRE="$PWD/lustre"
19 AC_SUBST(LUSTRE)
20
21 # mount.lustre
22 rootsbindir='/sbin'
23 AC_SUBST(rootsbindir)
24
25 demodir='$(docdir)/demo'
26 AC_SUBST(demodir)
27
28 pkgexampledir='${pkgdatadir}/examples'
29 AC_SUBST(pkgexampledir)
30 ]) # LC_PATH_DEFAULTS
31
32 #
33 # LC_TARGET_SUPPORTED
34 #
35 # is the target os supported?
36 #
37 AC_DEFUN([LC_TARGET_SUPPORTED], [
38 case $target_os in
39         linux*)
40 $1
41                 ;;
42         *)
43 $2
44                 ;;
45 esac
46 ]) # LC_TARGET_SUPPORTED
47
48 #
49 # LC_GLIBC_SUPPORT_FHANDLES
50 #
51 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES], [
52 AC_CHECK_FUNCS([name_to_handle_at],
53         [AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
54                 [file handle and related syscalls are supported])],
55         [AC_MSG_WARN([file handle and related syscalls are not supported])])
56 ]) # LC_GLIBC_SUPPORT_FHANDLES
57
58 #
59 # LC_GLIBC_SUPPORT_COPY_FILE_RANGE
60 #
61 AC_DEFUN([LC_GLIBC_SUPPORT_COPY_FILE_RANGE], [
62 AC_CHECK_FUNCS([copy_file_range],
63         [AC_DEFINE(HAVE_COPY_FILE_RANGE, 1,
64                 [copy_file_range() is supported])],
65         [AC_MSG_WARN([copy_file_range() is not supported])])
66 ]) # LC_GLIBC_SUPPORT_COPY_FILE_RANGE
67
68 #
69 # LC_STACK_SIZE
70 #
71 # Ensure the stack size is at least 8k in Lustre server (all kernels)
72 #
73 AC_DEFUN([LC_STACK_SIZE], [
74 LB_CHECK_COMPILE([if stack size is at least 8k],
75 stack_size_8k, [
76         #include <linux/thread_info.h>
77 ], [
78         #if THREAD_SIZE < 8192
79         #error "stack size < 8192"
80         #endif
81 ], [], [AC_MSG_ERROR([
82
83 Lustre requires that Linux is configured with at least a 8KB stack.
84 ])])
85 ]) # LC_STACK_SIZE
86
87 #
88 # LC_MDS_MAX_THREADS
89 #
90 # Allow the user to set the MDS thread upper limit
91 #
92 AC_DEFUN([LC_MDS_MAX_THREADS], [
93 AC_MSG_CHECKING([for maximum number of MDS threads])
94 AC_ARG_WITH([mds_max_threads],
95         AC_HELP_STRING([--with-mds-max-threads=count],
96                 [maximum threads available on the MDS: (default=512)]),
97         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
98                 [maximum number of MDS threads])])
99 AC_MSG_RESULT([$with_mds_max_threads])
100 ]) # LC_MDS_MAX_THREADS
101
102 #
103 # LC_CONFIG_PINGER
104 #
105 # the pinger is temporary, until we have the recovery node in place
106 #
107 AC_DEFUN([LC_CONFIG_PINGER], [
108 AC_MSG_CHECKING([whether to enable Lustre pinger support])
109 AC_ARG_ENABLE([pinger],
110         AC_HELP_STRING([--disable-pinger],
111                 [disable recovery pinger support]),
112         [], [enable_pinger="yes"])
113 AC_MSG_RESULT([$enable_pinger])
114 AS_IF([test "x$enable_pinger" != xno],
115         [AC_DEFINE(CONFIG_LUSTRE_FS_PINGER, 1,[Use the Pinger])])
116 ]) # LC_CONFIG_PINGER
117
118 #
119 # LC_CONFIG_CHECKSUM
120 #
121 # do checksum of bulk data between client and OST
122 #
123 AC_DEFUN([LC_CONFIG_CHECKSUM], [
124 AC_MSG_CHECKING([whether to enable data checksum support])
125 AC_ARG_ENABLE([checksum],
126         AC_HELP_STRING([--disable-checksum],
127                 [disable data checksum support]),
128         [], [enable_checksum="yes"])
129 AC_MSG_RESULT([$enable_checksum])
130 AS_IF([test "x$enable_checksum" != xno],
131         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
132 ]) # LC_CONFIG_CHECKSUM
133
134 #
135 # LC_CONFIG_FLOCK
136 #
137 # enable distributed flock by default
138 #
139 AC_DEFUN([LC_CONFIG_FLOCK], [
140 AC_MSG_CHECKING([whether to enable flock by default])
141 AC_ARG_ENABLE([flock],
142         AC_HELP_STRING([--disable-flock],
143                 [disable flock by default]),
144         [], [enable_flock="yes"])
145 AC_MSG_RESULT([$enable_flock])
146 AS_IF([test "x$enable_flock" != xno],
147         [AC_DEFINE(ENABLE_FLOCK, 1, [enable flock by default])])
148 ]) # LC_CONFIG_FLOCK
149
150 #
151 # LC_CONFIG_HEALTH_CHECK_WRITE
152 #
153 # Turn off the actual write to the disk
154 #
155 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
156 AC_MSG_CHECKING([whether to enable a write with the health check])
157 AC_ARG_ENABLE([health_write],
158         AC_HELP_STRING([--enable-health_write],
159                 [enable disk writes when doing health check]),
160         [], [enable_health_write="no"])
161 AC_MSG_RESULT([$enable_health_write])
162 AS_IF([test "x$enable_health_write" != xno],
163         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
164 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
165
166 #
167 # LC_CONFIG_LRU_RESIZE
168 #
169 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
170 AC_MSG_CHECKING([whether to enable lru self-adjusting])
171 AC_ARG_ENABLE([lru_resize],
172         AC_HELP_STRING([--enable-lru-resize],
173                 [enable lru resize support]),
174         [], [enable_lru_resize="yes"])
175 AC_MSG_RESULT([$enable_lru_resize])
176 AS_IF([test "x$enable_lru_resize" != xno],
177         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
178 ]) # LC_CONFIG_LRU_RESIZE
179
180 #
181 # LC_QUOTA_CONFIG
182 #
183 # Quota support. The kernel must support CONFIG_QUOTA.
184 #
185 AC_DEFUN([LC_QUOTA_CONFIG], [
186 LB_CHECK_CONFIG_IM([QUOTA], [],
187         [AC_MSG_ERROR([
188
189 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
190 ])])
191 ]) # LC_QUOTA_CONFIG
192
193 #
194 # LC_CONFIG_FHANDLE
195 #
196 # fhandle kernel support for open_by_handle_at() and name_to_handle_at()
197 # system calls. The kernel must support CONFIG_FHANDLE.
198 #
199 AC_DEFUN([LC_CONFIG_FHANDLE], [
200 LB_CHECK_CONFIG_IM([FHANDLE], [],
201         [AC_MSG_ERROR([
202
203 Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.
204 ])])
205 ]) # LC_CONFIG_FHANDLE
206
207 #
208 # LC_POSIX_ACL_CONFIG
209 #
210 # POSIX ACL support.
211 #
212 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
213 LB_CHECK_CONFIG_IM([FS_POSIX_ACL],
214         [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])
215 ], [ ])
216 ]) # LC_POSIX_ACL_CONFIG
217
218 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
219                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
220
221 #
222 # LC_CONFIG_GSS_KEYRING
223 #
224 # default 'auto', tests for dependencies, if found, enables;
225 # only called if gss is enabled
226 #
227 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
228 AC_MSG_CHECKING([whether to enable gss keyring backend])
229 AC_ARG_ENABLE([gss_keyring],
230         [AC_HELP_STRING([--disable-gss-keyring],
231                 [disable gss keyring backend])],
232         [], [enable_gss_keyring="auto"])
233 AC_MSG_RESULT([$enable_gss_keyring])
234 AS_IF([test "x$enable_gss_keyring" != xno], [
235         LB_CHECK_CONFIG_IM([KEYS], [], [
236                 gss_keyring_conf_test="fail"
237                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
238
239         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
240                 gss_keyring_conf_test="fail"
241                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
242
243         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
244                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
245                         [Define this if you enable gss keyring backend])
246                 enable_gss_keyring="yes"
247         ], [
248                 AS_IF([test "x$enable_gss_keyring" = xyes], [
249                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
250                 ])
251         ])
252 ])
253 ]) # LC_CONFIG_GSS_KEYRING
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 AC_ARG_VAR([TEST_JOBS],
299     [simultaneous jobs during configure (defaults to $(nproc))])
300 if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
301         TEST_JOBS=${TEST_JOBS:-$(nproc)}
302 fi
303 AC_SUBST(TEST_JOBS)
304
305 AC_ARG_VAR([TEST_DIR],
306     [location of temporary parallel configure tests (defaults to $PWD/lb2)])
307         TEST_DIR=${TEST_DIR:-$PWD/_lpb}
308 AC_SUBST(TEST_DIR)
309
310 AS_IF([test "x$enable_gss" != xno], [
311         LC_CONFIG_GSS_KEYRING
312         LC_KEY_TYPE_INSTANTIATE_2ARGS
313         sunrpc_required=$enable_gss
314         LC_CONFIG_SUNRPC
315         sunrpc_required="no"
316
317         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
318                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
319         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
320                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
321         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
322                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
323         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
324                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
325
326         require_krb5=$enable_gss
327         AC_KERBEROS_V5
328         require_krb5="no"
329
330         AS_IF([test -n "$KRBDIR"], [
331                 gss_conf_test="success"
332         ], [
333                 gss_conf_test="failure"
334         ])
335
336         AS_IF([test "x$gss_conf_test" = xsuccess && test "x$enable_gss" != xno], [
337                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
338                 enable_gss="yes"
339         ], [
340                 enable_gss_keyring="no"
341                 enable_gss="no"
342         ])
343
344         enable_ssk=$enable_gss
345 ], [
346         enable_gss_keyring="no"
347 ])
348 ]) # LC_CONFIG_GSS
349
350 # LC_OPENSSL_SSK
351 #
352 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
353 AC_DEFUN([LC_OPENSSL_SSK], [
354 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
355 AS_IF([test "x$enable_ssk" != xno], [
356 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
357         #include <openssl/hmac.h>
358         #include <openssl/evp.h>
359
360         int main(void) {
361                 int rc;
362                 rc = HMAC_Init_ex(NULL, "test", 4, EVP_md_null(), NULL);
363         }
364 ])],[AC_DEFINE(HAVE_OPENSSL_SSK, 1,
365                [OpenSSL HMAC functions needed for SSK])],
366         [enable_ssk="no"])
367 ])
368 AC_MSG_RESULT([$enable_ssk])
369 ]) # LC_OPENSSL_SSK
370
371 # LC_OPENSSL_GETSEPOL
372 #
373 # OpenSSL is needed for l_getsepol
374 AC_DEFUN([LC_OPENSSL_GETSEPOL], [
375 AC_MSG_CHECKING([whether openssl-devel is present])
376 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
377         #include <openssl/evp.h>
378
379         int main(void) {
380                 EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
381         }
382 ])],[
383         AC_DEFINE(HAVE_OPENSSL_GETSEPOL, 1, [openssl-devel is present])
384         enable_getsepol="yes"
385
386 ],[
387         enable_getsepol="no"
388         AC_MSG_WARN([
389
390 No openssl-devel headers found, unable to build l_getsepol and SELinux status checking
391 ])
392 ])
393 AC_MSG_RESULT([$enable_getsepol])
394 ]) # LC_OPENSSL_GETSEPOL
395
396 # LC_HAVE_LIBAIO
397 AC_DEFUN([LC_HAVE_LIBAIO], [
398         AC_CHECK_HEADER([libaio.h],
399                 enable_libaio="yes",
400                 AC_MSG_WARN([libaio is not installed in the system]))
401 ]) # LC_HAVE_LIBAIO
402
403 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
404 LB_CHECK_COMPILE([if get_projid exists],
405 get_projid, [
406         struct inode;
407         #include <linux/quota.h>
408 ],[
409         struct dquot_operations ops = { };
410
411         ops.get_projid(NULL, NULL);
412 ],[
413         AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
414                 [get_projid function exists])
415 ])
416 ]) # LC_HAVE_PROJECT_QUOTA
417
418 #
419 # LC_INVALIDATE_RANGE
420 #
421 # 3.11 invalidatepage requires the length of the range to invalidate
422 #
423 AC_DEFUN([LC_INVALIDATE_RANGE], [
424 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
425 address_space_ops_invalidatepage_3args, [
426         #include <linux/fs.h>
427 ],[
428         struct address_space_operations a_ops;
429         a_ops.invalidatepage(NULL, 0, 0);
430 ],[
431         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
432                 [address_space_operations.invalidatepage needs 3 arguments])
433 ])
434 ]) # LC_INVALIDATE_RANGE
435
436 #
437 # LC_HAVE_DIR_CONTEXT
438 #
439 # 3.11 readdir now takes the new struct dir_context
440 #
441 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
442 LB_CHECK_COMPILE([if 'dir_context' exist],
443 dir_context, [
444         #include <linux/fs.h>
445 ],[
446 #ifdef FMODE_KABI_ITERATE
447 #error "back to use readdir in kabi_extand mode"
448 #else
449         struct dir_context ctx;
450
451         ctx.pos = 0;
452 #endif
453 ],[
454         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
455                 [dir_context exist])
456 ])
457 ]) # LC_HAVE_DIR_CONTEXT
458
459 #
460 # LC_D_COMPARE_5ARGS
461 #
462 # 3.11 dentry_operations.d_compare() taken 5 arguments.
463 #
464 AC_DEFUN([LC_D_COMPARE_5ARGS], [
465 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
466 d_compare_5args, [
467         #include <linux/dcache.h>
468 ],[
469         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
470 ],[
471         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
472                 [d_compare need 5 arguments])
473 ])
474 ]) # LC_D_COMPARE_5ARGS
475
476 #
477 # LC_HAVE_DCOUNT
478 #
479 # 3.11 need to access d_count to get dentry reference count
480 #
481 AC_DEFUN([LC_HAVE_DCOUNT], [
482 LB_CHECK_COMPILE([if 'd_count' exists],
483 d_count, [
484         #include <linux/dcache.h>
485 ],[
486         struct dentry de = { };
487         int count;
488
489         count = d_count(&de);
490 ],[
491         AC_DEFINE(HAVE_D_COUNT, 1,
492                 [d_count exist])
493 ])
494 ]) # LC_HAVE_DCOUNT
495
496 #
497 # LC_PID_NS_FOR_CHILDREN
498 #
499 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
500 #
501 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
502 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
503 pid_ns_for_children, [
504         #include <linux/nsproxy.h>
505 ],[
506         struct nsproxy ns;
507         ns.pid_ns_for_children = NULL;
508 ],[
509         AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
510                   ['struct nsproxy' has 'pid_ns_for_children'])
511 ])
512 ]) # LC_PID_NS_FOR_CHILDREN
513
514 #
515 # LC_OLDSIZE_TRUNCATE_PAGECACHE
516 #
517 # 3.12 truncate_pagecache without oldsize parameter
518 #
519 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
520 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
521 truncate_pagecache_old_size, [
522         #include <linux/mm.h>
523 ],[
524         truncate_pagecache(NULL, 0, 0);
525 ],[
526         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
527                 [with oldsize])
528 ])
529 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
530
531 #
532 # LC_PTR_ERR_OR_ZERO
533 #
534 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
535 # It was added to linux kernel 3.12
536 #
537 AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
538 LB_CHECK_COMPILE([if 'PTR_ERR_OR_ZERO' is missing],
539 is_err_or_null, [
540         #include <linux/err.h>
541 ],[
542         if (PTR_ERR_OR_ZERO(NULL)) return 0;
543 ],[
544         AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
545                 ['PTR_ERR_OR_ZERO' exist])
546 ])
547 ]) # LC_PTR_ERR_OR_ZERO_MISSING
548
549 #
550 # LC_HAVE_DENTRY_D_U_D_ALIAS
551 #
552 # 3.11 kernel moved d_alias to the union d_u in struct dentry
553 #
554 # Some distros move d_alias to d_u but it is still a struct list
555 #
556 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
557 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
558         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
559         d_alias, [
560                 #include <linux/list.h>
561                 #include <linux/dcache.h>
562         ],[
563                 struct dentry de;
564                 INIT_LIST_HEAD(&de.d_u.d_alias);
565         ],[
566                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
567                         [list dentry.d_u.d_alias exist])
568         ])
569 ],[
570         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
571         d_alias, [
572                 #include <linux/list.h>
573                 #include <linux/dcache.h>
574         ],[
575                 struct dentry de;
576                 INIT_HLIST_NODE(&de.d_u.d_alias);
577         ],[
578                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
579                         [hlist dentry.d_u.d_alias exist])
580         ])
581 ])
582 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
583
584 #
585 # LC_HAVE_DENTRY_D_CHILD
586 #
587 # 3.11 kernel d_child has been moved out of the union d_u
588 # in struct dentry
589 #
590 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
591 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
592 d_child, [
593         #include <linux/list.h>
594         #include <linux/dcache.h>
595 ],[
596         struct dentry de;
597         INIT_LIST_HEAD(&de.d_child);
598 ],[
599         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
600                 [dentry.d_child exist])
601 ])
602 ]) # LC_HAVE_DENTRY_D_CHILD
603
604 #
605 # LC_KIOCB_KI_LEFT
606 #
607 # 3.12 ki_left removed from struct kiocb
608 #
609 AC_DEFUN([LC_KIOCB_KI_LEFT], [
610 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
611 kiocb_ki_left, [
612         #include <linux/aio.h>
613 ],[
614         ((struct kiocb*)0)->ki_left = 0;
615 ],[
616         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
617                 [ki_left exist])
618 ])
619 ]) # LC_KIOCB_KI_LEFT
620
621 #
622 # LC_REGISTER_SHRINKER_RET
623 #
624 # v3.11-8748-g1d3d4437eae1 register_shrinker returns a status
625 #
626 AC_DEFUN([LC_REGISTER_SHRINKER_RET], [
627 LB_CHECK_COMPILE([if register_shrinker() returns status],
628 register_shrinker_ret, [
629         #include <linux/mm.h>
630 ],[
631         if (register_shrinker(NULL))
632                 unregister_shrinker(NULL);
633 ],[
634         AC_DEFINE(HAVE_REGISTER_SHRINKER_RET, 1,
635                 [register_shrinker() returns status])
636 ])
637 ]) # LC_REGISTER_SHRINKER_RET
638
639 #
640 # LC_VFS_RENAME_5ARGS
641 #
642 # 3.13 has vfs_rename with 5 args
643 #
644 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
645 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
646 vfs_rename_5args, [
647         #include <linux/fs.h>
648 ],[
649         vfs_rename(NULL, NULL, NULL, NULL, NULL);
650 ], [
651         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
652                 [kernel has vfs_rename with 5 args])
653 ])
654 ]) # LC_VFS_RENAME_5ARGS
655
656 #
657 # LC_VFS_UNLINK_3ARGS
658 #
659 # 3.13 has vfs_unlink with 3 args
660 #
661 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
662 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
663 vfs_unlink_3args, [
664         #include <linux/fs.h>
665 ],[
666         vfs_unlink(NULL, NULL, NULL);
667 ], [
668         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
669                 [kernel has vfs_unlink with 3 args])
670 ])
671 ]) # LC_VFS_UNLINK_3ARGS
672
673 # LC_HAVE_D_IS_POSITIVE
674 #
675 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
676 # d_is_positive is added
677 #
678 AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
679 LB_CHECK_COMPILE([if 'd_is_positive' exist],
680 d_is_positive, [
681         #include <linux/dcache.h>
682 ],[
683         d_is_positive(NULL);
684 ],[
685         AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
686                 ['d_is_positive' is available])
687 ])
688 ]) # LC_HAVE_D_IS_POSITIVE
689
690 #
691 # LC_HAVE_BVEC_ITER
692 #
693 # 3.14 move some of its data in struct bio into the new
694 # struct bvec_iter
695 #
696 AC_DEFUN([LC_HAVE_BVEC_ITER], [
697 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
698 have_bvec_iter, [
699         #include <linux/bio.h>
700 ],[
701         struct bvec_iter iter;
702
703         iter.bi_bvec_done = 0;
704 ], [
705         AC_DEFINE(HAVE_BVEC_ITER, 1,
706                 [kernel has struct bvec_iter])
707 ])
708 ]) # LC_HAVE_BVEC_ITER
709
710 #
711 # LC_IOP_SET_ACL
712 #
713 # 3.14 adds set_acl method to inode_operations
714 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
715 #
716 AC_DEFUN([LC_IOP_SET_ACL], [
717 LB_CHECK_COMPILE([if 'inode_operations' has '.set_acl' member function],
718 inode_ops_set_acl, [
719         #include <linux/fs.h>
720 ],[
721         struct inode_operations iop;
722         iop.set_acl = NULL;
723 ],[
724         AC_DEFINE(HAVE_IOP_SET_ACL, 1,
725                 [inode_operations has .set_acl member function])
726 ])
727 ]) # LC_IOP_SET_ACL
728
729 #
730 # LC_HAVE_TRUNCATE_IPAGE_FINAL
731 #
732 # 3.14 bring truncate_inode_pages_final for evict_inode
733 #
734 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
735 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
736 truncate_ipages_final, [
737         #include <linux/mm.h>
738 ],[
739         truncate_inode_pages_final(NULL);
740 ], [
741         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
742                 [kernel has truncate_inode_pages_final])
743 ])
744 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
745
746 #
747 # LC_IOPS_RENAME_WITH_FLAGS
748 #
749 # 3.14 has inode_operations->rename with 5 args
750 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
751 #
752 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
753 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
754 iops_rename_with_flags, [
755         #include <linux/fs.h>
756 ],[
757         struct inode *i1 = NULL, *i2 = NULL;
758         struct dentry *d1 = NULL, *d2 = NULL;
759         int rc;
760         rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
761 ], [
762         AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
763                 [inode_operations->rename need flags as argument])
764 ])
765 ]) # LC_IOPS_RENAME_WITH_FLAGS
766
767 #
768 # LC_VFS_RENAME_6ARGS
769 #
770 # 3.15 has vfs_rename with 6 args
771 #
772 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
773 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
774 vfs_rename_6args, [
775         #include <linux/fs.h>
776 ],[
777         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
778 ], [
779         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
780                 [kernel has vfs_rename with 6 args])
781 ])
782 ]) # LC_VFS_RENAME_6ARGS
783
784 #
785 # LC_DIRECTIO_USE_ITER
786 #
787 # 3.16 kernel changes direct IO to use iov_iter
788 #
789 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
790 LB_CHECK_COMPILE([if direct IO uses iov_iter],
791 direct_io_iter, [
792         #include <linux/fs.h>
793 ],[
794         struct address_space_operations ops = { };
795         struct iov_iter *iter = NULL;
796         loff_t offset = 0;
797
798         ops.direct_IO(0, NULL, iter, offset);
799 ],[
800         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
801                 [direct IO uses iov_iter])
802 ])
803 ]) # LC_DIRECTIO_USE_ITER
804
805 #
806 # LC_HAVE_IOV_ITER_INIT_DIRECTION
807 #
808 #
809 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
810 #      changed iov_iter_init api to start accepting a tag
811 #      that defines if its a read or write operation
812 #
813 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
814 tmp_flags="$EXTRA_KCFLAGS"
815 EXTRA_KCFLAGS="-Werror"
816 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
817 iter_init, [
818         #include <linux/uio.h>
819         #include <linux/fs.h>
820 ],[
821         const struct iovec *iov = NULL;
822
823         iov_iter_init(NULL, READ, iov, 1, 0);
824 ],[
825         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
826                 [iov_iter_init handles directional tag])
827 ])
828 EXTRA_KCFLAGS="$tmp_flags"
829 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
830
831 #
832 # LC_HAVE_IOV_ITER_TRUNCATE
833 #
834 #
835 # 3.16 introduces a new API iov_iter_truncate()
836 #
837 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
838 tmp_flags="$EXTRA_KCFLAGS"
839 EXTRA_KCFLAGS="-Werror"
840 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
841 iter_truncate, [
842         #include <linux/uio.h>
843         #include <linux/fs.h>
844 ],[
845         struct iov_iter *i = NULL;
846
847         iov_iter_truncate(i, 0);
848 ],[
849         AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
850 ])
851 EXTRA_KCFLAGS="$tmp_flags"
852 ]) # LC_HAVE_IOV_ITER_TRUNCATE
853
854 #
855 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
856 #
857 # 3.16 introduces [read|write]_iter to struct file_operations
858 #
859 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
860 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
861 file_function_iter, [
862         #include <linux/fs.h>
863 ],[
864         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
865         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
866 ],[
867         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
868                 [file_operations.[read|write]_iter functions exist])
869 ])
870 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
871
872 #
873 # LC_HAVE_INTERVAL_BLK_INTEGRITY
874 #
875 # 3.17 replace sector_size with interval in struct blk_integrity
876 #
877 AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
878 LB_CHECK_COMPILE([if 'blk_integrity.interval' exist],
879 interval_blk_integrity, [
880         #include <linux/blkdev.h>
881 ],[
882         ((struct blk_integrity *)0)->interval = 0;
883 ],[
884         AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
885                 [blk_integrity.interval exist])
886 ])
887 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
888
889 #
890 # LC_KEY_MATCH_DATA
891 #
892 # 3.17  replaces key_type::match with match_preparse
893 #       and has new struct key_match_data
894 #
895 AC_DEFUN([LC_KEY_MATCH_DATA], [
896 LB_CHECK_COMPILE([if struct key_match field exist],
897 key_match, [
898         #include <linux/key-type.h>
899 ],[
900         struct key_match_data data;
901
902         data.raw_data = NULL;
903 ],[
904         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
905                 [struct key_match_data exist])
906 ])
907 ]) # LC_KEY_MATCH_DATA
908
909 #
910 # LC_NFS_FILLDIR_USE_CTX
911 #
912 # 3.18 kernel moved from void cookie to struct dir_context
913 #
914 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
915 tmp_flags="$EXTRA_KCFLAGS"
916 EXTRA_KCFLAGS="-Werror"
917 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
918 filldir_ctx, [
919         #include <linux/fs.h>
920 ],[
921         int filldir(struct dir_context *ctx, const char* name,
922                     int i, loff_t off, u64 tmp, unsigned temp)
923         {
924                 return 0;
925         }
926
927         struct dir_context ctx = {
928                 .actor = filldir,
929         };
930
931         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
932 ],[
933         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
934                 [filldir_t needs struct dir_context as argument])
935 ])
936 EXTRA_KCFLAGS="$tmp_flags"
937 ]) # LC_NFS_FILLDIR_USE_CTX
938
939 #
940 # LC_PERCPU_COUNTER_INIT
941 #
942 # 3.18  For kernels 3.18 and after percpu_counter_init starts
943 #       to pass a GFP_* memory allocation flag for internal
944 #       memory allocation purposes.
945 #
946 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
947 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
948 percpu_counter_init, [
949         #include <linux/percpu_counter.h>
950 ],[
951         percpu_counter_init(NULL, 0, GFP_KERNEL);
952 ],[
953         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
954                 [percpu_counter_init uses GFP_* flag])
955 ])
956 ]) # LC_PERCPU_COUNTER_INIT
957
958 #
959 # LC_KIOCB_HAS_NBYTES
960 #
961 # 3.19 kernel removed ki_nbytes from struct kiocb
962 #
963 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
964 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
965 ki_nbytes, [
966         #include <linux/fs.h>
967 ],[
968         struct kiocb iocb = { };
969
970         iocb.ki_nbytes = 0;
971 ],[
972         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
973 ])
974 ]) # LC_KIOCB_HAS_NBYTES
975
976 #
977 # LC_HAVE_DQUOT_QC_DQBLK
978 #
979 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
980 # Added in commit 14bf61ffe
981 #
982 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
983 tmp_flags="$EXTRA_KCFLAGS"
984 EXTRA_KCFLAGS="-Werror"
985 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
986 qc_dqblk, [
987         #include <linux/fs.h>
988         #include <linux/quota.h>
989 ],[
990         ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
991 ],[
992         AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
993                 [quotactl_ops.set_dqblk takes struct qc_dqblk])
994         AC_DEFINE(HAVE_DQUOT_KQID, 1,
995                 [quotactl_ops.set_dqblk takes struct kqid])
996 ])
997 EXTRA_KCFLAGS="$tmp_flags"
998 ]) # LC_HAVE_DQUOT_QC_DQBLK
999
1000 #
1001 # LC_HAVE_AIO_COMPLETE
1002 #
1003 # 3.19 kernel makes aio_complete() static
1004 #
1005 AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
1006 LB_CHECK_COMPILE([if kernel has exported aio_complete() ],
1007 aio_complete, [
1008         #include <linux/aio.h>
1009 ],[
1010         aio_complete(NULL, 0, 0);
1011 ],[
1012         AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
1013 ])
1014 ]) # LC_HAVE_AIO_COMPLETE
1015
1016 #
1017 # LC_HAVE_IS_ROOT_INODE
1018 #
1019 # 3.19 kernel adds is_root_inode()
1020 # Commit a7400222e3eb ("new helper: is_root_inode()")
1021 #
1022 AC_DEFUN([LC_HAVE_IS_ROOT_INODE], [
1023 LB_CHECK_COMPILE([if kernel has is_root_inode() ],
1024 is_root_inode, [
1025         #include <linux/fs.h>
1026 ],[
1027         is_root_inode(NULL);
1028 ],[
1029         AC_DEFINE(HAVE_IS_ROOT_INODE, 1, [is_root_inode defined])
1030 ])
1031 ]) # LC_HAVE_IS_ROOT_INODE
1032
1033 #
1034 # LC_BACKING_DEV_INFO_REMOVAL
1035 #
1036 # 3.20 kernel removed backing_dev_info from address_space
1037 #
1038 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1039 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
1040 backing_dev_info, [
1041         #include <linux/fs.h>
1042 ],[
1043         struct address_space mapping;
1044
1045         mapping.backing_dev_info = NULL;
1046 ],[
1047         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1048 ])
1049 ]) # LC_BACKING_DEV_INFO_REMOVAL
1050
1051 #
1052 # LC_HAVE_BDI_CAP_MAP_COPY
1053 #
1054 # 3.20  removed mmap handling for backing devices since
1055 #       it breaks on non-MMU systems. See kernel commit
1056 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
1057 #
1058 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1059 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
1060 bdi_cap_map_copy, [
1061         #include <linux/backing-dev.h>
1062 ],[
1063         struct backing_dev_info info;
1064
1065         info.capabilities = BDI_CAP_MAP_COPY;
1066 ],[
1067         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1068                 [BDI_CAP_MAP_COPY exist])
1069 ])
1070 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1071
1072 #
1073 # LC_IOV_ITER_RW
1074 #
1075 # 4.1 kernel has iov_iter_rw
1076 #
1077 AC_DEFUN([LC_IOV_ITER_RW], [
1078 LB_CHECK_COMPILE([if iov_iter_rw exist],
1079 iov_iter_rw, [
1080         #include <linux/fs.h>
1081         #include <linux/uio.h>
1082 ],[
1083         struct iov_iter *iter = NULL;
1084
1085         iov_iter_rw(iter);
1086 ],[
1087         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1088                 [iov_iter_rw exist])
1089 ])
1090 ]) # LC_IOV_ITER_RW
1091
1092 #
1093 # LC_HAVE_SYNC_READ_WRITE
1094 #
1095 # 4.1 new_sync_[read|write] no longer exported
1096 #
1097 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1098 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1099         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1100                         [new_sync_[read|write] is exported by the kernel])])
1101 ]) # LC_HAVE_SYNC_READ_WRITE
1102
1103 #
1104 # LC_HAVE___BI_CNT
1105 #
1106 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
1107 #
1108 AC_DEFUN([LC_HAVE___BI_CNT], [
1109 LB_CHECK_COMPILE([if Linux kernel has __bi_cnt in struct bio],
1110 have___bi_cnt, [
1111         #include <asm/atomic.h>
1112         #include <linux/bio.h>
1113         #include <linux/blk_types.h>
1114 ],[
1115         struct bio bio = { };
1116         int cnt;
1117         cnt = atomic_read(&bio.__bi_cnt);
1118 ], [
1119         AC_DEFINE(HAVE___BI_CNT, 1,
1120                 [struct bio has __bi_cnt])
1121 ])
1122 ]) # LC_HAVE___BI_CNT
1123
1124 #
1125 # LC_SYMLINK_OPS_USE_NAMEIDATA
1126 #
1127 # For the 4.2+ kernels the file system internal symlink api no
1128 # longer uses struct nameidata as a argument
1129 #
1130 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1131 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
1132 symlink_use_nameidata, [
1133         #include <linux/namei.h>
1134         #include <linux/fs.h>
1135 ],[
1136         struct nameidata *nd = NULL;
1137
1138         ((struct inode_operations *)0)->follow_link(NULL, nd);
1139         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1140 ],[
1141         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1142                 [symlink inode operations need struct nameidata argument])
1143 ])
1144 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1145
1146 #
1147 # LC_BIO_ENDIO_USES_ONE_ARG
1148 #
1149 # 4.2 kernel bio_endio now only takes one argument
1150 #
1151 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1152 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
1153 bio_endio, [
1154         #include <linux/bio.h>
1155 ],[
1156         bio_endio(NULL);
1157 ],[
1158         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1159                 [bio_endio takes only one argument])
1160 ])
1161 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1162
1163 #
1164 # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1165 #
1166 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
1167 #
1168 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1169 LB_CHECK_COMPILE([if 'account_page_dirtied' with 3 args exists],
1170 account_page_dirtied, [
1171         #include <linux/mm.h>
1172 ],[
1173         account_page_dirtied(NULL, NULL, NULL);
1174 ],[
1175         AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
1176                 [account_page_dirtied takes three arguments])
1177 ])
1178 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1179
1180 #
1181 # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1182 #
1183 # Kernel version 4.12 commit 7a7ffe65c8c5
1184 # introduced crypto_alloc_skcipher().
1185 #
1186 AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
1187 LB_CHECK_COMPILE([if crypto_alloc_skcipher is defined],
1188 crypto_alloc_skcipher, [
1189         #include <crypto/skcipher.h>
1190 ],[
1191         crypto_alloc_skcipher(NULL, 0, 0);
1192 ],[
1193         AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
1194                 [crypto_alloc_skcipher is defined])
1195 ])
1196 ]) # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1197
1198 #
1199 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1200 #
1201 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
1202 # 'struct blk_integrity_profile' is also added in this version,
1203 # thus use this to determine whether 'struct blk_integrity' has profile
1204 #
1205 AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1206 LB_CHECK_COMPILE([if 'blk_integrity.interval_exp' exist],
1207 blk_integrity_interval_exp, [
1208         #include <linux/blkdev.h>
1209 ],[
1210         ((struct blk_integrity *)0)->interval_exp = 0;
1211 ],[
1212         AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
1213                 [blk_integrity.interval_exp exist])
1214 ])
1215 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1216
1217 #
1218 # LC_HAVE_CACHE_HEAD_HLIST
1219 #
1220 # 4.3 kernel swiched to hlist for cache_head
1221 #
1222 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
1223 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
1224 cache_head_has_hlist, [
1225         #include <linux/sunrpc/cache.h>
1226 ],[
1227         do {} while(sizeof(((struct cache_head *)0)->cache_list));
1228 ],[
1229         AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
1230                 [cache_head has hlist cache_list])
1231 ])
1232 ]) # LC_HAVE_CACHE_HEAD_HLIST
1233
1234 #
1235 # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1236 #
1237 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
1238 # simplified xattr_handler handling by passing in the handler pointer
1239 #
1240 AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1241 tmp_flags="$EXTRA_KCFLAGS"
1242 EXTRA_KCFLAGS="-Werror"
1243 LB_CHECK_COMPILE([if 'struct xattr_handler' functions pass in handler pointer],
1244 xattr_handler_simplified, [
1245         #include <linux/xattr.h>
1246 ],[
1247         struct xattr_handler handler;
1248
1249         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
1250         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
1251 ],[
1252         AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1, [handler pointer is parameter])
1253 ])
1254 EXTRA_KCFLAGS="$tmp_flags"
1255 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1256
1257 #
1258 # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1259 #
1260 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
1261 #
1262 AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1263 LB_CHECK_COMPILE([if 'bio_integrity_payload.bip_iter' exist],
1264 bio_integrity_payload_bip_iter, [
1265         #include <linux/bio.h>
1266 ],[
1267         ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
1268 ],[
1269         AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
1270                 [bio_integrity_payload.bip_iter exist])
1271 ])
1272 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1273
1274 #
1275 # LC_BIO_INTEGRITY_PREP_FN
1276 #
1277 # Lustre kernel patch extents bio_integrity_prep to accept optional
1278 # generate/verify_fn as extra args.
1279 #
1280 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
1281 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' exists],
1282 bio_integrity_prep_fn, [
1283         #include <linux/bio.h>
1284 ],[
1285         bio_integrity_prep_fn(NULL, NULL, NULL);
1286 ],[
1287         AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
1288                 [kernel has bio_integrity_prep_fn])
1289         AC_SUBST(PATCHED_INTEGRITY_INTF)
1290 ],[
1291         AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
1292 ])
1293 ]) # LC_BIO_INTEGRITY_PREP_FN
1294
1295 #
1296 # LC_HAVE_BI_OPF
1297 #
1298 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
1299 #
1300 AC_DEFUN([LC_HAVE_BI_OPF], [
1301 LB_CHECK_COMPILE([if Linux kernel has bi_opf in struct bio],
1302 have_bi_opf, [
1303         #include <linux/bio.h>
1304 ],[
1305         struct bio bio;
1306
1307         bio.bi_opf = 0;
1308 ], [
1309         AC_DEFINE(HAVE_BI_OPF, 1,
1310                 [struct bio has bi_opf])
1311 ])
1312 ]) # LC_HAVE_BI_OPF
1313
1314 #
1315 # LC_HAVE_SUBMIT_BIO_2ARGS
1316 #
1317 # 4.4 removed an argument from submit_bio
1318 #
1319 AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
1320 LB_CHECK_COMPILE([if submit_bio takes two arguments],
1321 have_submit_bio_2args, [
1322         #include <linux/bio.h>
1323 ],[
1324         struct bio bio;
1325         submit_bio(READ, &bio);
1326 ], [
1327         AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
1328                 [submit_bio takes two arguments])
1329 ])
1330 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
1331
1332 #
1333 # LC_HAVE_CLEAN_BDEV_ALIASES
1334 #
1335 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
1336 # (SLES12/kernel commit 29f3ad7d8380364c)
1337 #
1338 AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
1339 LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
1340 have_clean_bdev_aliases, [
1341         #include <linux/buffer_head.h>
1342 ],[
1343         clean_bdev_aliases(NULL,1,1);
1344 ], [
1345         AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
1346                 [kernel has clean_bdev_aliases])
1347 ])
1348 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
1349
1350 #
1351 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1352 #
1353 # 4.4 kernel have moved locks API users to
1354 # locks_lock_inode_wait()
1355 #
1356 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
1357 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
1358 locks_lock_file_wait, [
1359         #include <linux/fs.h>
1360 ],[
1361         locks_lock_file_wait(NULL, NULL);
1362 ],[
1363         AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
1364                 [kernel has locks_lock_file_wait])
1365 ])
1366 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1367
1368 #
1369 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1370 #
1371 # 4.4 kernel merged type-specific data with the payload data for keys
1372 #
1373 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
1374 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
1375 key_payload_data_array, [
1376         #include <linux/key.h>
1377 ],[
1378         struct key key = { };
1379
1380         key.payload.data[0] = NULL;
1381 ],[
1382         AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
1383 ])
1384 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1385
1386 #
1387 # LC_HAVE_XATTR_HANDLER_NAME
1388 #
1389 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
1390 # add a name member to struct xattr_handler
1391 #
1392 AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
1393 tmp_flags="$EXTRA_KCFLAGS"
1394 EXTRA_KCFLAGS="-Werror"
1395 LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
1396 xattr_handler_name, [
1397         #include <linux/xattr.h>
1398 ],[
1399         ((struct xattr_handler *)NULL)->name = NULL;
1400 ],[
1401         AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
1402 ])
1403 EXTRA_KCFLAGS="$tmp_flags"
1404 ]) # LC_HAVE_XATTR_HANDLER_NAME
1405
1406 #
1407 # LC_HAVE_FILE_DENTRY
1408 #
1409 # 4.5 adds wrapper file_dentry
1410 #
1411 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
1412 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
1413 file_dentry, [
1414         #include <linux/fs.h>
1415 ],[
1416         file_dentry(NULL);
1417 ], [
1418         AC_DEFINE(HAVE_FILE_DENTRY, 1,
1419                 [kernel has file_dentry])
1420 ])
1421 ]) # LC_HAVE_FILE_DENTRY
1422
1423 #
1424 # LC_HAVE_INODE_LOCK
1425 #
1426 # 4.5 introduced inode_lock
1427 #
1428 AC_DEFUN([LC_HAVE_INODE_LOCK], [
1429 LB_CHECK_COMPILE([if 'inode_lock' is defined],
1430 inode_lock, [
1431         #include <linux/fs.h>
1432 ],[
1433         inode_lock(NULL);
1434 ], [
1435         AC_DEFINE(HAVE_INODE_LOCK, 1,
1436                   [inode_lock is defined])
1437 ])
1438 ]) # LC_HAVE_INODE_LOCK
1439
1440 #
1441 # LC_HAVE_IOP_GET_LINK
1442 #
1443 # 4.5 vfs replaced iop->follow_link with
1444 # iop->get_link
1445 #
1446 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
1447 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
1448 inode_ops_get_link, [
1449         #include <linux/fs.h>
1450 ],[
1451         struct inode_operations iop;
1452         iop.get_link = NULL;
1453 ],[
1454         AC_DEFINE(HAVE_IOP_GET_LINK, 1,
1455                 [have iop get_link])
1456 ])
1457 ]) # LC_HAVE_IOP_GET_LINK
1458
1459 #
1460 # LC_HAVE_IN_COMPAT_SYSCALL
1461 #
1462 # 4.6 renamed is_compat_task to in_compat_syscall
1463 #
1464 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
1465 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
1466 in_compat_syscall, [
1467         #include <linux/compat.h>
1468 ],[
1469         in_compat_syscall();
1470 ],[
1471         AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
1472                 [have in_compat_syscall])
1473 ])
1474 ]) # LC_HAVE_IN_COMPAT_SYSCALL
1475
1476 #
1477 # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1478 #
1479 # Kernel version 4.6 commit b296821a7c42fa58baa17513b2b7b30ae66f3336
1480 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
1481 # to xattr_handler functions
1482 #
1483 AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
1484 tmp_flags="$EXTRA_KCFLAGS"
1485 EXTRA_KCFLAGS="-Werror"
1486 LB_CHECK_COMPILE([if 'struct xattr_handler' functions have inode parameter],
1487 xattr_handler_inode_param, [
1488         #include <linux/xattr.h>
1489 ],[
1490         const struct xattr_handler handler;
1491
1492         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
1493         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
1494 ],[
1495         AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
1496 ])
1497 EXTRA_KCFLAGS="$tmp_flags"
1498 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1499
1500 #
1501 # LC_D_IN_LOOKUP
1502 #
1503 # Kernel version 4.6 commit 85c7f81041d57cfe9dc97f4680d5586b54534a39
1504 # introduced parallel lookups in the VFS layer. The inline function
1505 # d_in_lookup was added to notify when the same item was being queried
1506 # at the same time.
1507 #
1508 AC_DEFUN([LC_D_IN_LOOKUP], [
1509 tmp_flags="$EXTRA_KCFLAGS"
1510 EXTRA_KCFLAGS="-Werror"
1511 LB_CHECK_COMPILE([if 'd_in_lookup' is defined],
1512 d_in_lookup, [
1513         #include <linux/dcache.h>
1514 ],[
1515         d_in_lookup(NULL);
1516 ],[
1517         AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
1518 ])
1519 EXTRA_KCFLAGS="$tmp_flags"
1520 ]) # LC_D_IN_LOOKUP
1521
1522 #
1523 # LC_LOCK_PAGE_MEMCG
1524 #
1525 # Kernel version 4.6 adds lock_page_memcg
1526 #
1527 AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
1528 LB_CHECK_COMPILE([if 'lock_page_memcg' is defined],
1529 lock_page_memcg, [
1530         #include <linux/memcontrol.h>
1531 ],[
1532         lock_page_memcg(NULL);
1533 ],[
1534         AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1,
1535                 [lock_page_memcg is defined])
1536 ])
1537 ]) # LC_LOCK_PAGE_MEMCG
1538
1539 #
1540 # LC_DIRECTIO_2ARGS
1541 #
1542 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
1543 # direct-io: eliminate the offset argument to ->direct_IO
1544 #
1545 AC_DEFUN([LC_DIRECTIO_2ARGS], [
1546 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
1547 direct_io_2args, [
1548         #include <linux/fs.h>
1549 ],[
1550         struct address_space_operations ops = { };
1551         struct iov_iter *iter = NULL;
1552         struct kiocb *iocb = NULL;
1553         int rc;
1554
1555         rc = ops.direct_IO(iocb, iter);
1556 ],[
1557         AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
1558                 [direct_IO need 2 arguments])
1559 ])
1560 ]) # LC_DIRECTIO_2ARGS
1561
1562 #
1563 # LC_GENERIC_WRITE_SYNC_2ARGS
1564 #
1565 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
1566 # fs: add IOCB_SYNC and IOCB_DSYNC
1567 #
1568 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
1569 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
1570 generic_write_sync_2args, [
1571         #include <linux/fs.h>
1572 ],[
1573         struct kiocb *iocb = NULL;
1574         ssize_t rc;
1575
1576         rc = generic_write_sync(iocb, 0);
1577 ],[
1578         AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
1579                 [generic_write_sync need 2 arguments])
1580 ])
1581 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
1582
1583 #
1584 # LC_FOP_ITERATE_SHARED
1585 #
1586 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
1587 #
1588 AC_DEFUN([LC_FOP_ITERATE_SHARED], [
1589 LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'],
1590 fop_iterate_shared, [
1591         #include <linux/fs.h>
1592 ],[
1593         struct file_operations fop;
1594         fop.iterate_shared = NULL;
1595 ],[
1596         AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
1597                 [file_operations has iterate_shared])
1598 ])
1599 ]) # LC_FOP_ITERATE_SHARED
1600
1601 #
1602 # LC_EXPORT_DEFAULT_FILE_SPLICE_READ
1603 #
1604 # 4.8-rc8 commit 82c156f853840645604acd7c2cebcb75ed1b6652 switched
1605 # generic_file_splice_read() to using ->read_iter. We can test this
1606 # change since default_file_splice_read() is no longer exported.
1607 #
1608 AC_DEFUN([LC_EXPORT_DEFAULT_FILE_SPLICE_READ], [
1609 LB_CHECK_EXPORT([default_file_splice_read], [fs/splice.c],
1610         [AC_DEFINE(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT, 1,
1611                         [default_file_splice_read is exported])])
1612 ]) # LC_EXPORT_DEFAULT_FILE_SPLCE_READ
1613
1614 #
1615 # LC_HAVE_POSIX_ACL_VALID_USER_NS
1616 #
1617 # 4.8 posix_acl_valid takes struct user_namespace
1618 #
1619 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
1620 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
1621 posix_acl_valid, [
1622         #include <linux/fs.h>
1623         #include <linux/posix_acl.h>
1624 ],[
1625         posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
1626 ],[
1627         AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
1628                 [posix_acl_valid takes struct user_namespace])
1629 ])
1630 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
1631
1632 #
1633 # LC_D_COMPARE_4ARGS
1634 #
1635 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
1636 # get rid of 'parent' argument of ->d_compare()
1637 #
1638 AC_DEFUN([LC_D_COMPARE_4ARGS], [
1639 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
1640 d_compare_4args, [
1641         #include <linux/dcache.h>
1642 ],[
1643         ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
1644 ],[
1645         AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
1646                 [d_compare need 4 arguments])
1647 ])
1648 ]) # LC_D_COMPARE_4ARGS
1649
1650 #
1651 # LC_FULL_NAME_HASH_3ARGS
1652 #
1653 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
1654 # vfs: make the string hashes salt the hash
1655 #
1656 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
1657 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
1658 full_name_hash_3args, [
1659         #include <linux/stringhash.h>
1660 ],[
1661         unsigned int hash;
1662         hash = full_name_hash(NULL,NULL,0);
1663 ],[
1664         AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
1665                 [full_name_hash need 3 arguments])
1666 ])
1667 ]) # LC_FULL_NAME_HASH_3ARGS
1668
1669 #
1670 # LC_STRUCT_POSIX_ACL_XATTR
1671 #
1672 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
1673 # posix_acl: xattr representation cleanups
1674 #
1675 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
1676 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
1677 struct_posix_acl_xattr, [
1678         #include <linux/fs.h>
1679         #include <linux/posix_acl_xattr.h>
1680 ],[
1681         struct posix_acl_xattr_header *h = NULL;
1682         struct posix_acl_xattr_entry  *e;
1683         e = (void *)(h + 1);
1684 ],[
1685         AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
1686                 [struct posix_acl_xattr_{header,entry} defined])
1687 ])
1688 ]) # LC_STRUCT_POSIX_ACL_XATTR
1689
1690 #
1691 # LC_IOP_XATTR
1692 #
1693 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
1694 # removed {get,set,remove}xattr inode operations
1695 #
1696 AC_DEFUN([LC_IOP_XATTR], [
1697 LB_CHECK_COMPILE([if 'inode_operations' has {get,set,remove}xattr members],
1698 inode_ops_xattr, [
1699         #include <linux/fs.h>
1700 ],[
1701         struct inode_operations iop;
1702         iop.setxattr = NULL;
1703         iop.getxattr = NULL;
1704         iop.removexattr = NULL;
1705 ],[
1706         AC_DEFINE(HAVE_IOP_XATTR, 1,
1707                 [inode_operations has {get,set,remove}xattr members])
1708 ])
1709 ]) # LC_IOP_XATTR
1710
1711 #
1712 # LC_GROUP_INFO_GID
1713 #
1714 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
1715 # cred: simpler, 1D supplementary groups
1716 #
1717 AC_DEFUN([LC_GROUP_INFO_GID], [
1718 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
1719 group_info_gid, [
1720         #include <linux/cred.h>
1721 ],[
1722         kgid_t *p;
1723         p = ((struct group_info *)0)->gid;
1724 ],[
1725         AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
1726                 [struct group_info has member gid])
1727 ])
1728 ]) # LC_GROUP_INFO_GID
1729
1730 #
1731 # LC_VFS_SETXATTR
1732 #
1733 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
1734 # added __vfs_{get,set,remove}xattr helpers
1735 #
1736 AC_DEFUN([LC_VFS_SETXATTR], [
1737 LB_CHECK_COMPILE([if '__vfs_setxattr' helper is available],
1738 vfs_setxattr, [
1739         #include <linux/xattr.h>
1740 ],[
1741         __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
1742 ],[
1743         AC_DEFINE(HAVE_VFS_SETXATTR, 1,
1744                 ['__vfs_setxattr is available])
1745 ])
1746 ]) # LC_VFS_SETXATTR
1747
1748 #
1749 # LC_POSIX_ACL_UPDATE_MODE
1750 #
1751 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
1752 # posix_acl: Clear SGID bit when setting file permissions
1753 #
1754 AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
1755 LB_CHECK_COMPILE([if 'posix_acl_update_mode' exists],
1756 posix_acl_update_mode, [
1757         #include <linux/fs.h>
1758         #include <linux/posix_acl.h>
1759 ],[
1760         posix_acl_update_mode(NULL, NULL, NULL);
1761 ],[
1762         AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
1763                 ['posix_acl_update_mode' is available])
1764 ])
1765 ]) # LC_POSIX_ACL_UPDATE_MODE
1766
1767 #
1768 # LC_IOP_GENERIC_READLINK
1769 #
1770 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
1771 # removed generic_readlink from individual file systems
1772 #
1773 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
1774 LB_CHECK_COMPILE([if 'generic_readlink' still exist],
1775 inode_ops_readlink, [
1776         #include <linux/fs.h>
1777 ],[
1778         struct inode_operations iop;
1779         iop.readlink = generic_readlink;
1780 ],[
1781         AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
1782                 [generic_readlink has been removed])
1783 ])
1784 ]) # LC_IOP_GENERIC_READLINK
1785
1786 #
1787 # LC_HAVE_VM_FAULT_ADDRESS
1788 #
1789 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
1790 # removed virtual_address field. Need to use address field instead
1791 #
1792 AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
1793 LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field],
1794 vm_fault_address, [
1795         #include <linux/mm.h>
1796 ],[
1797         struct vm_fault vmf;
1798         vmf.address = NULL;
1799 ],[
1800         AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
1801                 [virtual_address has been replaced by address field])
1802 ])
1803 ]) # LC_HAVE_VM_FAULT_ADDRESS
1804
1805 #
1806 # LC_INODEOPS_ENHANCED_GETATTR
1807 #
1808 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
1809 # expanded getattr to be able to get more stat information.
1810 #
1811 AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
1812 LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
1813 getattr_path, [
1814         #include <linux/fs.h>
1815 ],[
1816         struct path path;
1817
1818         ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
1819 ],[
1820         AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
1821                 [inode_operations .getattr member function can gather advance stats])
1822 ])
1823 ]) # LC_INODEOPS_ENHANCED_GETATTR
1824
1825 #
1826 # LC_VM_OPERATIONS_REMOVE_VMF_ARG
1827 #
1828 # Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
1829 # removed struct vm_area_struct as an argument for vm_operations since
1830 # in the same kernel version struct vma_area_struct was folded into
1831 # struct vm_fault.
1832 #
1833 AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
1834 LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
1835 vm_operations_no_vm_area_struct, [
1836         #include <linux/mm.h>
1837 ],[
1838         struct vm_fault vmf;
1839
1840         ((struct vm_operations_struct *)0)->fault(&vmf);
1841         ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
1842 ],[
1843         AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
1844                 ['struct vm_operations' remove struct vm_area_struct argument])
1845 ])
1846 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
1847
1848 #
1849 # LC_HAVE_KEY_USAGE_REFCOUNT
1850 #
1851 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
1852 # converted key.usage from atomic_t to refcount_t.
1853 #
1854 AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
1855 LB_CHECK_COMPILE([if 'key.usage' is refcount_t],
1856 key_usage_refcount, [
1857         #include <linux/key.h>
1858 ],[
1859         struct key key = { };
1860
1861         refcount_read(&key.usage);
1862 ],[
1863         AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1, [key.usage is of type refcount_t])
1864 ])
1865 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
1866
1867 #
1868 # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
1869 #
1870 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
1871 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
1872 #
1873 AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
1874 LB_CHECK_COMPILE([if 'CRYPTO_MAX_ALG_NAME' is 128],
1875 crypto_max_alg_name, [
1876         #include <linux/crypto.h>
1877 ],[
1878         #if CRYPTO_MAX_ALG_NAME != 128
1879         exit(1);
1880         #endif
1881 ],[
1882         AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
1883                 ['CRYPTO_MAX_ALG_NAME' is 128])
1884 ])
1885 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
1886
1887 #
1888 # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876
1889 # CURRENT_TIME is not 64 bit time safe so it was replaced with
1890 # current_time()
1891 #
1892 AC_DEFUN([LC_CURRENT_TIME], [
1893 LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
1894 current_time, [
1895         #include <linux/fs.h>
1896 ],[
1897         struct iattr attr;
1898
1899         attr.ia_atime = current_time(NULL);
1900 ],[
1901         AC_DEFINE(HAVE_CURRENT_TIME, 1,
1902                 [current_time() has replaced CURRENT_TIME])
1903 ])
1904 ]) # LIBCFS_CURRENT_TIME
1905
1906 #
1907 # Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
1908 # changed struct super_block s_uuid into a proper uuid_t
1909 #
1910 AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
1911 LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
1912 super_block_s_uuid, [
1913         #include <linux/fs.h>
1914 ],[
1915         struct super_block sb;
1916
1917         uuid_parse(NULL, &sb.s_uuid);
1918 ],[
1919         AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
1920 ])
1921 ]) # LC_SUPER_BLOCK_S_UUID
1922
1923 #
1924 # LC_SUPER_SETUP_BDI_NAME
1925 #
1926 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
1927 # unified bdi handling
1928 #
1929 AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
1930 LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
1931 super_setup_bdi_name, [
1932         #include <linux/fs.h>
1933 ],[
1934         super_setup_bdi_name(NULL, "lustre");
1935 ],[
1936         AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
1937                 ['super_setup_bdi_name' is available])
1938 ])
1939 ]) # LC_SUPER_SETUP_BDI_NAME
1940
1941 #
1942 # LC_BI_STATUS
1943 #
1944 # 4.12 replace bi_error to bi_status
1945 #
1946 AC_DEFUN([LC_BI_STATUS], [
1947 LB_CHECK_COMPILE([if 'bi_status' exist],
1948 bi_status, [
1949         #include <linux/blk_types.h>
1950 ],[
1951         ((struct bio *)0)->bi_status = 0;
1952 ],[
1953         AC_DEFINE(HAVE_BI_STATUS, 1,
1954                 ['bi_status' is available])
1955 ])
1956 ]) # LC_BI_STATUS
1957
1958 #
1959 # LC_BIO_INTEGRITY_ENABLED
1960 #
1961 # 4.13 removed bio_integrity_enabled
1962 #
1963 AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
1964 LB_CHECK_COMPILE([if 'bio_integrity_enabled' exist],
1965 bio_integrity_enabled, [
1966         #include <linux/bio.h>
1967 ],[
1968         bio_integrity_enabled(NULL);
1969 ],[
1970         AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
1971                 ['bio_integrity_enabled' is available])
1972 ])
1973 ]) # LC_BIO_INTEGRITY_ENABLED
1974
1975 #
1976 # LC_PAGEVEC_INIT_ONE_PARAM
1977 #
1978 # 4.14 pagevec_init takes one parameter
1979 #
1980 AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
1981 LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter],
1982 pagevec_init, [
1983         #include <linux/pagevec.h>
1984 ],[
1985         pagevec_init(NULL);
1986 ],[
1987         AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
1988                 ['pagevec_init' takes one parameter])
1989 ])
1990 ]) # LC_PAGEVEC_INIT_ONE_PARAM
1991
1992 #
1993 # LC_BI_BDEV
1994 #
1995 # 4.14 replaced bi_bdev to bi_disk
1996 #
1997 AC_DEFUN([LC_BI_BDEV], [
1998 LB_CHECK_COMPILE([if 'bi_bdev' exist],
1999 bi_bdev, [
2000         #include <linux/bio.h>
2001 ],[
2002         ((struct bio *)0)->bi_bdev = NULL;
2003 ],[
2004         AC_DEFINE(HAVE_BI_BDEV, 1,
2005                 ['bi_bdev' is available])
2006 ])
2007 ]) # LC_BI_BDEV
2008
2009 #
2010 # LC_INTERVAL_TREE_CACHED
2011 #
2012 # 4.14 f808c13fd3738948e10196496959871130612b61
2013 # switched INTERVAL_TREE_DEFINE to use cached RB_Trees.
2014 #
2015 AC_DEFUN([LC_INTERVAL_TREE_CACHED], [
2016 tmp_flags="$EXTRA_KCFLAGS"
2017 EXTRA_KCFLAGS="-Werror"
2018 LB_CHECK_COMPILE([if interval_trees use rb_tree_cached],
2019 itree_cached, [
2020         #include <linux/interval_tree_generic.h>
2021         struct foo { struct rb_node rb; int last; int a,b;};
2022         #define START(n) ((n)->a)
2023         #define LAST(n) ((n)->b)
2024         struct rb_root_cached tree;
2025         INTERVAL_TREE_DEFINE(struct foo, rb, int, last,
2026                 START, LAST, , foo);
2027 ],[
2028         foo_insert(NULL, &tree);
2029 ],[
2030         AC_DEFINE(HAVE_INTERVAL_TREE_CACHED, 1,
2031                 [interval trees use rb_tree_cached])
2032 ])
2033 EXTRA_KCFLAGS="$tmp_flags"
2034 ]) # LC_INTERVAL_TREE_CACHED
2035
2036 #
2037 # LC_IS_ENCRYPTED
2038 #
2039 # 4.14 introduced IS_ENCRYPTED and S_ENCRYPTED
2040 #
2041 AC_DEFUN([LC_IS_ENCRYPTED], [
2042 LB_CHECK_COMPILE([if IS_ENCRYPTED is defined],
2043 is_encrypted, [
2044         #include <linux/fs.h>
2045 ],[
2046         IS_ENCRYPTED((struct inode *)0);
2047 ],[
2048         has_is_encrypted="yes"
2049 ])
2050 ]) # LC_IS_ENCRYPTED
2051
2052 #
2053 # LC_I_PAGES
2054 #
2055 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
2056 #
2057 AC_DEFUN([LC_I_PAGES], [
2058 LB_CHECK_COMPILE([if struct address_space has i_pages],
2059 i_pages, [
2060         #include <linux/fs.h>
2061 ],[
2062         struct address_space mapping = {};
2063         void *i_pages;
2064
2065         i_pages = &mapping.i_pages;
2066 ],[
2067         AC_DEFINE(HAVE_I_PAGES, 1,
2068                 [struct address_space has i_pages])
2069 ])
2070 ]) # LC_I_PAGES
2071
2072 #
2073 # LC_VM_FAULT_T
2074 #
2075 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2076 # mm: create the new vm_fault_t type
2077 #
2078 AC_DEFUN([LC_VM_FAULT_T], [
2079 LB_CHECK_COMPILE([if vm_fault_t type exists],
2080 vm_fault_t, [
2081         #include <linux/mm_types.h>
2082 ],[
2083         vm_fault_t x = VM_FAULT_SIGBUS;
2084         (void)x
2085 ],[
2086         AC_DEFINE(HAVE_VM_FAULT_T, 1,
2087                 [if vm_fault_t type exists])
2088 ])
2089 ]) # LC_VM_FAULT_T
2090
2091 #
2092 # LC_VM_FAULT_RETRY
2093 #
2094 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2095 # mm: VM_FAULT_RETRY is defined in enum vm_fault_reason
2096 #
2097 AC_DEFUN([LC_VM_FAULT_RETRY], [
2098 LB_CHECK_COMPILE([if VM_FAULT_RETRY is defined],
2099 VM_FAULT_RETRY, [
2100         #include <linux/mm.h>
2101 ],[
2102         #ifndef VM_FAULT_RETRY
2103                 vm_fault_t x;
2104                 x = VM_FAULT_RETRY;
2105         #endif
2106 ],[
2107         AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
2108                 [if VM_FAULT_RETRY is defined])
2109 ])
2110 ]) # LC_VM_FAULT_RETRY
2111
2112 #
2113 # LC_INODE_TIMESPEC64
2114 #
2115 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
2116 # fs: add timespec64_truncate()
2117 # kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
2118 # inode timestamps switched to timespec64
2119 # kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
2120 # y2038: remove unused time interfaces
2121 # ...
2122 #  timespec_trunc
2123 # ...
2124 # When inode times are timespec64 stop using the deprecated
2125 # time interfaces.
2126 #
2127 # kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
2128 # fs: Delete timespec64_trunc()
2129 #
2130 AC_DEFUN([LC_INODE_TIMESPEC64], [
2131 tmp_flags="$EXTRA_KCFLAGS"
2132 EXTRA_KCFLAGS="-Werror"
2133 LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
2134 inode_timespec64, [
2135         #include <linux/fs.h>
2136 ],[
2137         struct inode *inode = NULL;
2138         struct timespec64 ts = {0, 1};
2139
2140         inode->i_atime = ts;
2141         (void)inode;
2142 ],[
2143         AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
2144                 [inode times are using timespec64])
2145 ])
2146 EXTRA_KCFLAGS="$tmp_flags"
2147 ]) # LC_INODE_TIMESPEC64
2148
2149 #
2150 # LC___XA_SET_MARK
2151 #
2152 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
2153 # xarray: Add XArray marks - replaced radix_tree_tag_set
2154 #
2155 AC_DEFUN([LC___XA_SET_MARK], [
2156 tmp_flags="$EXTRA_KCFLAGS"
2157 EXTRA_KCFLAGS="-Werror"
2158 LB_CHECK_COMPILE([if '__xa_set_mark' exists],
2159 __xa_set_mark, [
2160         #include <linux/fs.h>
2161         #include <linux/radix-tree.h>
2162 ],[
2163         radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
2164 ],[
2165         AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
2166                 [__xa_set_mark exists])
2167 ])
2168 EXTRA_KCFLAGS="$tmp_flags"
2169 ]) # LC___XA_SET_MARK
2170
2171 #
2172 # LC_UAPI_LINUX_MOUNT_H
2173 #
2174 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
2175 # vfs: Suppress MS_* flag defs within the kernel ...
2176 #
2177 AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
2178 tmp_flags="$EXTRA_KCFLAGS"
2179 EXTRA_KCFLAGS="-Werror"
2180 LB_CHECK_COMPILE([if MS_RDONLY was moved to uapi/linux/mount.h],
2181 uapi_linux_mount, [
2182         #include <uapi/linux/mount.h>
2183 ],[
2184         int x = MS_RDONLY;
2185         (void)x;
2186 ],[
2187         AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
2188                 [if MS_RDONLY was moved to uapi/linux/mount.h])
2189 ])
2190 EXTRA_KCFLAGS="$tmp_flags"
2191 ]) # LC_UAPI_LINUX_MOUNT_H
2192
2193 #
2194 # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2195 #
2196 # kernel 4.20 commit 1863d77f15da0addcd293a1719fa5d3ef8cde3ca
2197 # SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock
2198 #
2199 # Now that the reader functions are all RCU protected, use a regular
2200 # spinlock rather than a reader/writer lock.
2201 #
2202 AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2203 tmp_flags="$EXTRA_KCFLAGS"
2204 EXTRA_KCFLAGS="-Werror"
2205 LB_CHECK_COMPILE([if cache_detail->hash_lock is a spinlock],
2206 hash_lock_isa_spinlock_t, [
2207         #include <linux/sunrpc/cache.h>
2208 ],[
2209         spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
2210         spin_lock(lock);
2211 ],[
2212         AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
2213                 [if cache_detail->hash_lock is a spinlock])
2214 ])
2215 EXTRA_KCFLAGS="$tmp_flags"
2216 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2217
2218 #
2219 # LC_HAS_LINUX_SELINUX_ENABLED
2220 #
2221 # kernel 5.1 commit 3d252529480c68bfd6a6774652df7c8968b28e41
2222 # SELinux: Remove unused selinux_is_enabled
2223 #
2224 AC_DEFUN([LC_HAS_LINUX_SELINUX_ENABLED], [
2225 tmp_flags="$EXTRA_KCFLAGS"
2226 EXTRA_KCFLAGS="-Werror"
2227 LB_CHECK_COMPILE([if linux/selinux.h exists],
2228 selinux_is_enabled, [
2229         #include <linux/selinux.h>
2230 ],[
2231         bool has_selinux = selinux_is_enabled();
2232         (void)has_selinux;
2233 ],[
2234         AC_DEFINE(HAVE_LINUX_SELINUX_IS_ENABLED, 1,
2235                 [if linux/selinux.h exists])
2236 ])
2237 EXTRA_KCFLAGS="$tmp_flags"
2238 ]) # LC_HAS_LINUX_SELINUX_ENABLED
2239
2240 #
2241 # LB_HAVE_BVEC_ITER_ALL
2242 #
2243 # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
2244 # block: allow bio_for_each_segment_all() to iterate over multi-page bvec
2245 #
2246 AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
2247 tmp_flags="$EXTRA_KCFLAGS"
2248 EXTRA_KCFLAGS="-Werror"
2249 LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
2250 ext4fs_dirhash, [
2251         #include <linux/bvec.h>
2252 ],[
2253         struct bvec_iter_all iter;
2254         (void)iter;
2255 ],[
2256         AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
2257                 [if bvec_iter_all exists for multi-page bvec iternation])
2258 ])
2259 EXTRA_KCFLAGS="$tmp_flags"
2260 ]) # LB_HAVE_BVEC_ITER_ALL
2261
2262 #
2263 # LC_ACCOUNT_PAGE_DIRTIED
2264 #
2265 # After 5.2 kernel page dirtied is not exported
2266 #
2267 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
2268 LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
2269         [AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT, 1,
2270                         [account_page_dirtied is exported])])
2271 ]) # LC_ACCOUNT_PAGE_DIRTIED
2272
2273 #
2274 # LC_KEYRING_SEARCH_4ARGS
2275 #
2276 # Kernel 5.2 commit dcf49dbc8077
2277 # keys: Add a 'recurse' flag for keyring searches
2278 #
2279 AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
2280 LB_CHECK_COMPILE([if 'keyring_search' has 4 args],
2281 keyring_search_4args, [
2282         #include <linux/key.h>
2283 ],[
2284         key_ref_t keyring;
2285         keyring_search(keyring, NULL, NULL, false);
2286 ],[
2287         AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
2288                 [keyring_search has 4 args])
2289 ])
2290 ]) # LC_KEYRING_SEARCH_4ARGS
2291
2292 #
2293 # LC_BIO_BI_PHYS_SEGMENTS
2294 #
2295 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
2296 # block: remove the bi_phys_segments field in struct bio
2297 #
2298 AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
2299 tmp_flags="$EXTRA_KCFLAGS"
2300 EXTRA_KCFLAGS="-Werror"
2301 LB_CHECK_COMPILE([if struct bio has bi_phys_segments member],
2302 bye_bio_bi_phys_segments, [
2303         #include <linux/bio.h>
2304 ],[
2305         struct bio *bio = NULL;
2306         bio->bi_phys_segments++;
2307 ],[
2308         AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
2309                 [struct bio has bi_phys_segments member])
2310 ])
2311 EXTRA_KCFLAGS="$tmp_flags"
2312 ]) # LC_BIO_BI_PHYS_SEGMENTS
2313
2314 #
2315 # LC_LM_COMPARE_OWNER_EXISTS
2316 #
2317 # kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
2318 # locks: Cleanup lm_compare_owner and lm_owner_key
2319 # removed lm_compare_owner
2320 #
2321 AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
2322 tmp_flags="$EXTRA_KCFLAGS"
2323 EXTRA_KCFLAGS="-Werror"
2324 LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
2325 lock_manager_ops_lm_compare_owner, [
2326         #include <linux/fs.h>
2327 ],[
2328         struct lock_manager_operations lm_ops;
2329         lm_ops.lm_compare_owner = NULL;
2330 ],[
2331         AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
2332                 [lock_manager_operations has lm_compare_owner])
2333 ])
2334 EXTRA_KCFLAGS="$tmp_flags"
2335 ]) # LC_LM_COMPARE_OWNER_EXISTS
2336
2337 AC_DEFUN([LC_PROG_LINUX_SRC], [])
2338 AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
2339
2340 #
2341 # LC_FSCRYPT_SUPPORT
2342 #
2343 # 5.4 introduced fscrypt encryption policies v2
2344 #
2345 AC_DEFUN([LC_FSCRYPT_SUPPORT], [
2346 LB_CHECK_COMPILE([for fscrypt in-kernel support],
2347 fscrypt_support, [
2348         #define __FS_HAS_ENCRYPTION 0
2349         #include <linux/fscrypt.h>
2350 ],[
2351         fscrypt_ioctl_get_policy_ex(NULL, NULL);
2352 ],[
2353         dnl When Lustre supports file name encryption, restore "yes" value
2354         dnl for has_fscrypt_support and remove warning message.
2355         has_fscrypt_support="no"
2356         AC_MSG_WARN([
2357 This version of Lustre lacks file name encryption support,
2358 so it cannot make use of in-kernel fscrypt.
2359 Will use embedded llcrypt if possible.])
2360 ])
2361 ]) # LC_FSCRYPT_SUPPORT
2362
2363 #
2364 # LC_PROG_LINUX
2365 #
2366 # Lustre linux kernel checks
2367 #
2368 AC_DEFUN([LC_PROG_LINUX], [
2369         AC_MSG_NOTICE([Lustre kernel checks
2370 ==============================================================================])
2371
2372         LC_CONFIG_PINGER
2373         LC_CONFIG_CHECKSUM
2374         LC_CONFIG_FLOCK
2375         LC_CONFIG_HEALTH_CHECK_WRITE
2376         LC_CONFIG_LRU_RESIZE
2377         LC_CONFIG_FHANDLE
2378         LC_CONFIG_GSS
2379
2380         # 3.10
2381         LC_HAVE_PROJECT_QUOTA
2382
2383         # 3.11
2384         LC_INVALIDATE_RANGE
2385         LC_HAVE_DIR_CONTEXT
2386         LC_D_COMPARE_5ARGS
2387         LC_HAVE_DCOUNT
2388         LC_HAVE_DENTRY_D_U_D_ALIAS
2389         LC_HAVE_DENTRY_D_CHILD
2390         LC_PID_NS_FOR_CHILDREN
2391
2392         # 3.12
2393         LC_OLDSIZE_TRUNCATE_PAGECACHE
2394         LC_PTR_ERR_OR_ZERO_MISSING
2395         LC_KIOCB_KI_LEFT
2396         LC_REGISTER_SHRINKER_RET
2397
2398         # 3.13
2399         LC_VFS_RENAME_5ARGS
2400         LC_VFS_UNLINK_3ARGS
2401         LC_HAVE_D_IS_POSITIVE
2402
2403         # 3.14
2404         LC_HAVE_BVEC_ITER
2405         LC_HAVE_TRUNCATE_IPAGES_FINAL
2406         LC_IOPS_RENAME_WITH_FLAGS
2407         LC_IOP_SET_ACL
2408
2409         # 3.15
2410         LC_VFS_RENAME_6ARGS
2411
2412         # 3.16
2413         LC_DIRECTIO_USE_ITER
2414         LC_HAVE_IOV_ITER_INIT_DIRECTION
2415         LC_HAVE_IOV_ITER_TRUNCATE
2416         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2417
2418         # 3.17
2419         LC_HAVE_INTERVAL_BLK_INTEGRITY
2420         LC_KEY_MATCH_DATA
2421
2422         # 3.18
2423         LC_PERCPU_COUNTER_INIT
2424         LC_NFS_FILLDIR_USE_CTX
2425
2426         # 3.19
2427         LC_KIOCB_HAS_NBYTES
2428         LC_HAVE_DQUOT_QC_DQBLK
2429         LC_HAVE_AIO_COMPLETE
2430         LC_HAVE_IS_ROOT_INODE
2431
2432         # 3.20
2433         LC_BACKING_DEV_INFO_REMOVAL
2434         LC_HAVE_BDI_CAP_MAP_COPY
2435
2436         # 4.1.0
2437         LC_IOV_ITER_RW
2438         LC_HAVE_SYNC_READ_WRITE
2439         LC_HAVE___BI_CNT
2440
2441         # 4.2
2442         LC_BIO_ENDIO_USES_ONE_ARG
2443         LC_SYMLINK_OPS_USE_NAMEIDATA
2444         LC_ACCOUNT_PAGE_DIRTIED_3ARGS
2445         LC_HAVE_CRYPTO_ALLOC_SKCIPHER
2446
2447         # 4.3
2448         LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
2449         LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
2450         LC_HAVE_CACHE_HEAD_HLIST
2451         LC_HAVE_XATTR_HANDLER_SIMPLIFIED
2452
2453         # 4.4
2454         LC_HAVE_LOCKS_LOCK_FILE_WAIT
2455         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2456         LC_HAVE_XATTR_HANDLER_NAME
2457         LC_HAVE_BI_OPF
2458         LC_HAVE_SUBMIT_BIO_2ARGS
2459         LC_HAVE_CLEAN_BDEV_ALIASES
2460
2461         # 4.5
2462         LC_HAVE_FILE_DENTRY
2463
2464         # 4.5
2465         LC_HAVE_INODE_LOCK
2466         LC_HAVE_IOP_GET_LINK
2467
2468         # 4.6
2469         LC_HAVE_IN_COMPAT_SYSCALL
2470         LC_HAVE_XATTR_HANDLER_INODE_PARAM
2471         LC_LOCK_PAGE_MEMCG
2472
2473         # 4.7
2474         LC_D_IN_LOOKUP
2475         LC_DIRECTIO_2ARGS
2476         LC_GENERIC_WRITE_SYNC_2ARGS
2477         LC_FOP_ITERATE_SHARED
2478
2479         # 4.8
2480         LC_EXPORT_DEFAULT_FILE_SPLICE_READ
2481         LC_HAVE_POSIX_ACL_VALID_USER_NS
2482         LC_D_COMPARE_4ARGS
2483         LC_FULL_NAME_HASH_3ARGS
2484         LC_STRUCT_POSIX_ACL_XATTR
2485         LC_IOP_XATTR
2486
2487         # 4.9
2488         LC_GROUP_INFO_GID
2489         LC_VFS_SETXATTR
2490         LC_POSIX_ACL_UPDATE_MODE
2491
2492         # 4.10
2493         LC_IOP_GENERIC_READLINK
2494         LC_HAVE_VM_FAULT_ADDRESS
2495
2496         # 4.11
2497         LC_INODEOPS_ENHANCED_GETATTR
2498         LC_VM_OPERATIONS_REMOVE_VMF_ARG
2499         LC_HAVE_KEY_USAGE_REFCOUNT
2500         LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2501
2502         # 4.12
2503         LC_CURRENT_TIME
2504         LC_SUPER_BLOCK_S_UUID
2505         LC_SUPER_SETUP_BDI_NAME
2506         LC_BI_STATUS
2507
2508         # 4.13
2509         LC_BIO_INTEGRITY_ENABLED
2510
2511         # 4.14
2512         LC_PAGEVEC_INIT_ONE_PARAM
2513         LC_BI_BDEV
2514         LC_INTERVAL_TREE_CACHED
2515
2516         # 4.17
2517         LC_VM_FAULT_T
2518         LC_VM_FAULT_RETRY
2519         LC_I_PAGES
2520
2521         # 4.18
2522         LC_INODE_TIMESPEC64
2523
2524         # 4.20
2525         LC___XA_SET_MARK
2526         LC_UAPI_LINUX_MOUNT_H
2527         LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2528
2529         # 5.1
2530         LC_HAS_LINUX_SELINUX_ENABLED
2531         LB_HAVE_BVEC_ITER_ALL
2532
2533         # 5.2
2534         LC_ACCOUNT_PAGE_DIRTIED
2535         LC_KEYRING_SEARCH_4ARGS
2536
2537         # 5.3
2538         LC_BIO_BI_PHYS_SEGMENTS
2539         LC_LM_COMPARE_OWNER_EXISTS
2540
2541         # kernel patch to extend integrity interface
2542         LC_BIO_INTEGRITY_PREP_FN
2543
2544         #
2545         AS_IF([test "x$enable_server" != xno], [
2546                 LC_STACK_SIZE
2547                 LC_QUOTA_CONFIG
2548         ])
2549         LC_POSIX_ACL_CONFIG
2550 ]) # LC_PROG_LINUX
2551
2552 #
2553 # LC_CONFIG_CLIENT
2554 #
2555 # Check whether to build the client side of Lustre
2556 #
2557 AC_DEFUN([LC_CONFIG_CLIENT], [
2558 AC_MSG_CHECKING([whether to build Lustre client support])
2559 AC_ARG_ENABLE([client],
2560         AC_HELP_STRING([--disable-client],
2561                 [disable Lustre client support]),
2562         [], [enable_client="yes"])
2563 AC_MSG_RESULT([$enable_client])
2564 ]) # LC_CONFIG_CLIENT
2565
2566 #
2567 # --enable-mpitests
2568 #
2569 AC_DEFUN([LB_CONFIG_MPITESTS], [
2570 AC_ARG_ENABLE([mpitests],
2571         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2572                        [include mpi tests]), [
2573                 enable_mpitests="yes"
2574                 case $enableval in
2575                 yes)
2576                         MPICC_WRAPPER="mpicc"
2577                         MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
2578                         ;;
2579                 no)
2580                         enable_mpitests="no"
2581                         MPI_BIN=""
2582                         ;;
2583                 *)
2584                         MPICC_WRAPPER=$enableval
2585                         MPI_BIN=$(eval echo $MPICC_WRAPPER | xargs dirname)
2586                         ;;
2587                 esac
2588         ], [
2589                 enable_mpitests="yes"
2590                 MPICC_WRAPPER="mpicc"
2591                 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
2592         ])
2593
2594         if test "x$enable_mpitests" != "xno"; then
2595                 oldcc=$CC
2596                 CC=$MPICC_WRAPPER
2597                 AC_CACHE_CHECK([whether mpitests can be built],
2598                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2599                         #include <mpi.h>
2600                         int main(void) {
2601                                 int flag;
2602                                 MPI_Initialized(&flag);
2603                                 return 0;
2604                         }
2605                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
2606                 ])
2607                 enable_mpitests=$lb_cv_mpi_tests
2608                 CC=$oldcc
2609         fi
2610         AC_SUBST(MPI_BIN)
2611         AC_SUBST(MPICC_WRAPPER)
2612 ]) # LB_CONFIG_MPITESTS
2613
2614 #
2615 # LC_CONFIG_QUOTA
2616 #
2617 # whether to enable quota support global control
2618 #
2619 AC_DEFUN([LC_CONFIG_QUOTA], [
2620 AC_MSG_CHECKING([whether to enable quota support global control])
2621 AC_ARG_ENABLE([quota],
2622         AC_HELP_STRING([--enable-quota],
2623                 [enable quota support]),
2624         [], [enable_quota="yes"])
2625 AS_IF([test "x$enable_quota" = xyes],
2626         [AC_MSG_RESULT([yes])],
2627         [AC_MSG_RESULT([no])])
2628 ]) # LC_CONFIG_QUOTA
2629
2630 #
2631 # LC_QUOTA
2632 #
2633 AC_DEFUN([LC_QUOTA], [
2634 #check global
2635 LC_CONFIG_QUOTA
2636 #check for utils
2637 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
2638         AC_CHECK_HEADER([sys/quota.h],
2639                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
2640                         [Define to 1 if you have <sys/quota.h>.])],
2641                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2642 ])
2643 ]) # LC_QUOTA
2644
2645 #
2646 # LC_OSD_ADDON
2647 #
2648 # configure support for optional OSD implementation
2649 #
2650 AC_DEFUN([LC_OSD_ADDON], [
2651 AC_MSG_CHECKING([whether to use OSD addon])
2652 AC_ARG_WITH([osd],
2653         AC_HELP_STRING([--with-osd=path],
2654                 [set path to optional osd]),
2655         [
2656         case "$with_osd" in
2657         no)
2658                 ENABLEOSDADDON=0
2659                 ;;
2660         *)
2661                 OSDADDON="$with_osd"
2662                 ENABLEOSDADDON=1
2663                 ;;
2664         esac
2665         ], [
2666                 ENABLEOSDADDON=0
2667         ])
2668 AS_IF([test $ENABLEOSDADDON -eq 0], [
2669         AC_MSG_RESULT([no])
2670         OSDADDON=""
2671 ], [
2672         OSDMODNAME=$(basename $OSDADDON)
2673         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
2674                 AC_MSG_RESULT([can't link])
2675                 OSDADDON=""
2676         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
2677                 AC_MSG_RESULT([$OSDMODNAME])
2678                 OSDADDON="obj-m += $OSDMODNAME/"
2679         ], [
2680                 AC_MSG_RESULT([can't link])
2681                 OSDADDON=""
2682         ])
2683 ])
2684 AC_SUBST(OSDADDON)
2685 ]) # LC_OSD_ADDON
2686
2687 #
2688 # LC_CONFIG_CRYPTO
2689 #
2690 # Check whether to enable Lustre client crypto
2691 #
2692 AC_DEFUN([LC_CONFIG_CRYPTO], [
2693 AC_MSG_CHECKING([whether to enable Lustre client crypto])
2694 AC_ARG_ENABLE([crypto],
2695         AC_HELP_STRING([--enable-crypto],
2696                 [enable Lustre client crypto]),
2697         [], [enable_crypto="auto"])
2698 AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno], [
2699         AC_MSG_RESULT(
2700         )
2701         LC_IS_ENCRYPTED
2702         LC_FSCRYPT_SUPPORT])
2703 AS_IF([test "x$has_fscrypt_support" = xyes], [
2704         AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via in-kernel fscrypt])
2705         enable_crypto=yes],
2706         [AS_IF([test "x$has_is_encrypted" = xyes], [
2707               AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via embedded llcrypt])
2708               AC_DEFINE(CONFIG_LL_ENCRYPTION, 1, [embedded llcrypt])
2709               enable_crypto=yes
2710               enable_llcrypt=yes], [
2711               AS_IF([test "x$enable_crypto" = xyes],
2712                     [AC_MSG_ERROR([Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.])])
2713               AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno],
2714                     [AC_MSG_WARN(Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.)])
2715               enable_crypto=no])])
2716 AS_IF([test "x$enable_dist" != xno], [
2717         enable_crypto=yes
2718         enable_llcrypt=yes])
2719 AC_MSG_RESULT([$enable_crypto])
2720 ]) # LC_CONFIG_CRYPTO
2721
2722 #
2723 # LC_CONFIGURE
2724 #
2725 # other configure checks
2726 #
2727 AC_DEFUN([LC_CONFIGURE], [
2728 AC_MSG_NOTICE([Lustre core checks
2729 ==============================================================================])
2730
2731 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
2732         [CFLAGS="$CFLAGS -Wall -Werror"])
2733
2734 # maximum MDS thread count
2735 LC_MDS_MAX_THREADS
2736
2737 # lustre/utils/gss/gss_util.c
2738 # lustre/utils/gss/gssd_proc.c
2739 # lustre/utils/gss/krb5_util.c
2740 # lustre/utils/llog_reader.c
2741 # lustre/utils/create_iam.c
2742 # lustre/utils/libiam.c
2743 AC_CHECK_HEADERS([netdb.h endian.h])
2744 AC_CHECK_FUNCS([gethostbyname])
2745
2746 # lustre/utils/llverfs.c lustre/utils/libmount_utils_ldiskfs.c
2747 AC_CHECK_HEADERS([ext2fs/ext2fs.h], [], [
2748         AS_IF([test "x$enable_utils" = xyes -a "x$enable_ldiskfs" = xyes], [
2749                 AC_MSG_ERROR([
2750 ext2fs.h not found. Please install e2fsprogs development package.
2751                 ])
2752         ])
2753 ])
2754
2755 # lustre/tests/statx_test.c
2756 AC_CHECK_FUNCS([statx])
2757
2758 # lustre/utils/lfs.c
2759 AS_IF([test "$enable_dist" = "no"], [
2760                 AC_CHECK_LIB([z], [crc32], [
2761                                  AC_CHECK_HEADER([zlib.h], [], [
2762                                                  AC_MSG_ERROR([zlib.h not found.])])
2763                                  ], [
2764                                  AC_MSG_ERROR([
2765                 zlib library not found. Please install zlib development package.])
2766                 ])
2767 ])
2768
2769 SELINUX=""
2770
2771 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2772         [AC_CHECK_HEADERS([selinux/selinux.h],
2773                         [SELINUX="-lselinux"
2774                         AC_DEFINE([HAVE_SELINUX], 1,
2775                                 [support for selinux ])],
2776                         [AC_MSG_WARN([
2777
2778 No libselinux-devel package found, unable to build selinux enabled tools
2779 ])
2780 ])],
2781         [AC_MSG_WARN([
2782
2783 No selinux package found, unable to build selinux enabled tools
2784 ])
2785 ])
2786 AC_SUBST(SELINUX)
2787
2788 AC_CHECK_LIB([keyutils], [add_key])
2789
2790 # Super safe df
2791 AC_MSG_CHECKING([whether to report minimum OST free space])
2792 AC_ARG_ENABLE([mindf],
2793         AC_HELP_STRING([--enable-mindf],
2794                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2795         [], [enable_mindf="no"])
2796 AC_MSG_RESULT([$enable_mindf])
2797 AS_IF([test "$enable_mindf" = "yes"],
2798         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2799
2800 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2801 AC_ARG_ENABLE([fail_alloc],
2802         AC_HELP_STRING([--disable-fail-alloc],
2803                 [disable randomly alloc failure]),
2804         [], [enable_fail_alloc="yes"])
2805 AC_MSG_RESULT([$enable_fail_alloc])
2806 AS_IF([test "x$enable_fail_alloc" != xno],
2807         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2808                 [enable randomly alloc failure])])
2809
2810 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2811 AC_ARG_ENABLE([invariants],
2812         AC_HELP_STRING([--enable-invariants],
2813                 [enable invariant checking (cpu intensive)]),
2814         [], [enable_invariants="no"])
2815 AC_MSG_RESULT([$enable_invariants])
2816 AS_IF([test "x$enable_invariants" = xyes],
2817         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2818                 [enable invariant checking])])
2819
2820 AC_MSG_CHECKING([whether to track references with lu_ref])
2821 AC_ARG_ENABLE([lu_ref],
2822         AC_HELP_STRING([--enable-lu_ref],
2823                 [enable lu_ref reference tracking code]),
2824         [], [enable_lu_ref="no"])
2825 AC_MSG_RESULT([$enable_lu_ref])
2826 AS_IF([test "x$enable_lu_ref" = xyes],
2827         [AC_DEFINE([USE_LU_REF], 1,
2828                 [enable lu_ref reference tracking code])])
2829
2830 AC_MSG_CHECKING([whether to enable page state tracking])
2831 AC_ARG_ENABLE([pgstate-track],
2832         AC_HELP_STRING([--enable-pgstate-track],
2833                 [enable page state tracking]),
2834         [], [enable_pgstat_track="no"])
2835 AC_MSG_RESULT([$enable_pgstat_track])
2836 AS_IF([test "x$enable_pgstat_track" = xyes],
2837         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2838                 [enable page state tracking code])])
2839
2840 PKG_PROG_PKG_CONFIG
2841 AC_MSG_CHECKING([systemd unit file directory])
2842 AC_ARG_WITH([systemdsystemunitdir],
2843         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
2844                 [Directory for systemd service files])],
2845         [], [with_systemdsystemunitdir=auto])
2846 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
2847         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
2848         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
2849                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
2850                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
2851                 with_systemdsystemunitdir=no],
2852         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
2853 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
2854         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
2855 AC_MSG_RESULT([$with_systemdsystemunitdir])
2856
2857 AC_MSG_CHECKING([bash-completion directory])
2858 AC_ARG_WITH([bash-completion-dir],
2859         AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
2860                 [Install the bash auto-completion script in this directory.]),
2861         [],
2862         [with_bash_completion_dir=yes])
2863 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
2864         BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
2865         AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
2866                 [BASH_COMPLETION_DIR="/usr/share/bash-completion/completions"]
2867         ])
2868 ], [
2869         BASH_COMPLETION_DIR="$with_bash_completion_dir"
2870 ])
2871 AC_SUBST([BASH_COMPLETION_DIR])
2872 AC_MSG_RESULT([$BASH_COMPLETION_DIR])
2873 ]) # LC_CONFIGURE
2874
2875 #
2876 # LC_CONDITIONALS
2877 #
2878 # AM_CONDITIONALS for lustre
2879 #
2880 AC_DEFUN([LC_CONDITIONALS], [
2881 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2882 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2883 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2884 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2885 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2886 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2887 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2888 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2889 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
2890 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2891 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
2892 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno")
2893 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
2894 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
2895 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
2896 AM_CONDITIONAL(LLCRYPT, test x$enable_llcrypt = xyes)
2897 AM_CONDITIONAL(LIBAIO, test x$enable_libaio = xyes)
2898 ]) # LC_CONDITIONALS
2899
2900 #
2901 # LC_CONFIG_FILES
2902 #
2903 # files that should be generated with AC_OUTPUT
2904 #
2905 AC_DEFUN([LC_CONFIG_FILES],
2906 [AC_CONFIG_FILES([
2907 lustre/Makefile
2908 lustre/autoMakefile
2909 lustre/autoconf/Makefile
2910 lustre/conf/Makefile
2911 lustre/conf/resource/Makefile
2912 lustre/contrib/Makefile
2913 lustre/doc/Makefile
2914 lustre/include/Makefile
2915 lustre/include/lustre/Makefile
2916 lustre/include/uapi/linux/lustre/Makefile
2917 lustre/kernel_patches/targets/4.18-rhel8.3.target
2918 lustre/kernel_patches/targets/4.18-rhel8.2.target
2919 lustre/kernel_patches/targets/4.18-rhel8.1.target
2920 lustre/kernel_patches/targets/4.18-rhel8.target
2921 lustre/kernel_patches/targets/3.10-rhel7.9.target
2922 lustre/kernel_patches/targets/3.10-rhel7.8.target
2923 lustre/kernel_patches/targets/3.10-rhel7.7.target
2924 lustre/kernel_patches/targets/3.10-rhel7.6.target
2925 lustre/kernel_patches/targets/3.10-rhel7.5.target
2926 lustre/kernel_patches/targets/4.14-rhel7.5.target
2927 lustre/kernel_patches/targets/4.14-rhel7.6.target
2928 lustre/kernel_patches/targets/4.12-sles12sp4.target
2929 lustre/kernel_patches/targets/4.12-sles12sp5.target
2930 lustre/kernel_patches/targets/4.12-sles15sp1.target
2931 lustre/kernel_patches/targets/4.12-sles15sp2.target
2932 lustre/kernel_patches/targets/3.x-fc18.target
2933 lustre/ldlm/Makefile
2934 lustre/fid/Makefile
2935 lustre/fid/autoMakefile
2936 lustre/llite/Makefile
2937 lustre/llite/autoMakefile
2938 lustre/lov/Makefile
2939 lustre/lov/autoMakefile
2940 lustre/mdc/Makefile
2941 lustre/mdc/autoMakefile
2942 lustre/lmv/Makefile
2943 lustre/lmv/autoMakefile
2944 lustre/lfsck/Makefile
2945 lustre/lfsck/autoMakefile
2946 lustre/mdt/Makefile
2947 lustre/mdt/autoMakefile
2948 lustre/mdd/Makefile
2949 lustre/mdd/autoMakefile
2950 lustre/fld/Makefile
2951 lustre/fld/autoMakefile
2952 lustre/obdclass/Makefile
2953 lustre/obdclass/autoMakefile
2954 lustre/obdecho/Makefile
2955 lustre/obdecho/autoMakefile
2956 lustre/ofd/Makefile
2957 lustre/ofd/autoMakefile
2958 lustre/osc/Makefile
2959 lustre/osc/autoMakefile
2960 lustre/ost/Makefile
2961 lustre/ost/autoMakefile
2962 lustre/osd-ldiskfs/Makefile
2963 lustre/osd-ldiskfs/autoMakefile
2964 lustre/osd-zfs/Makefile
2965 lustre/osd-zfs/autoMakefile
2966 lustre/mgc/Makefile
2967 lustre/mgc/autoMakefile
2968 lustre/mgs/Makefile
2969 lustre/mgs/autoMakefile
2970 lustre/target/Makefile
2971 lustre/ptlrpc/Makefile
2972 lustre/ptlrpc/autoMakefile
2973 lustre/ptlrpc/gss/Makefile
2974 lustre/ptlrpc/gss/autoMakefile
2975 lustre/quota/Makefile
2976 lustre/quota/autoMakefile
2977 lustre/scripts/Makefile
2978 lustre/scripts/systemd/Makefile
2979 lustre/tests/Makefile
2980 lustre/tests/mpi/Makefile
2981 lustre/tests/lutf/Makefile
2982 lustre/tests/lutf/src/Makefile
2983 lustre/tests/kernel/Makefile
2984 lustre/tests/kernel/autoMakefile
2985 lustre/utils/Makefile
2986 lustre/utils/gss/Makefile
2987 lustre/osp/Makefile
2988 lustre/osp/autoMakefile
2989 lustre/lod/Makefile
2990 lustre/lod/autoMakefile
2991 ])
2992 ]) # LC_CONFIG_FILES