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