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