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