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