Whamcloud - gitweb
24c1f1b70b7c8958a9dcf0848708049fa4a6282c
[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 libcfs_is_module="yes"
9 ldiskfs_is_ext4="yes"
10 ])
11
12 #
13 # LC_PATH_DEFAULTS
14 #
15 # lustre specific paths
16 #
17 AC_DEFUN([LC_PATH_DEFAULTS], [
18 # ptlrpc kernel build requires this
19 LUSTRE="$PWD/lustre"
20 AC_SUBST(LUSTRE)
21
22 # mount.lustre
23 rootsbindir='/sbin'
24 AC_SUBST(rootsbindir)
25
26 demodir='$(docdir)/demo'
27 AC_SUBST(demodir)
28
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
31 ]) # LC_PATH_DEFAULTS
32
33 #
34 # LC_TARGET_SUPPORTED
35 #
36 # is the target os supported?
37 #
38 AC_DEFUN([LC_TARGET_SUPPORTED], [
39 case $target_os in
40         linux*)
41 $1
42                 ;;
43         *)
44 $2
45                 ;;
46 esac
47 ]) # LC_TARGET_SUPPORTED
48
49 #
50 # LC_GLIBC_SUPPORT_FHANDLES
51 #
52 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES], [
53 AC_CHECK_FUNCS([name_to_handle_at],
54         [AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
55                 [file handle and related syscalls are supported])],
56         [AC_MSG_WARN([file handle and related syscalls are not supported])])
57 ]) # LC_GLIBC_SUPPORT_FHANDLES
58
59 #
60 # LC_STACK_SIZE
61 #
62 # Ensure the stack size is at least 8k in Lustre server (all kernels)
63 #
64 AC_DEFUN([LC_STACK_SIZE], [
65 LB_CHECK_COMPILE([if stack size is at least 8k],
66 stack_size_8k, [
67         #include <linux/thread_info.h>
68 ], [
69         #if THREAD_SIZE < 8192
70         #error "stack size < 8192"
71         #endif
72 ], [], [AC_MSG_ERROR([
73
74 Lustre requires that Linux is configured with at least a 8KB stack.
75 ])])
76 ]) # LC_STACK_SIZE
77
78 #
79 # LC_MDS_MAX_THREADS
80 #
81 # Allow the user to set the MDS thread upper limit
82 #
83 AC_DEFUN([LC_MDS_MAX_THREADS], [
84 AC_MSG_CHECKING([for maximum number of MDS threads])
85 AC_ARG_WITH([mds_max_threads],
86         AC_HELP_STRING([--with-mds-max-threads=count],
87                 [maximum threads available on the MDS: (default=512)]),
88         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
89                 [maximum number of MDS threads])])
90 AC_MSG_RESULT([$with_mds_max_threads])
91 ]) # LC_MDS_MAX_THREADS
92
93 #
94 # LC_CONFIG_PINGER
95 #
96 # the pinger is temporary, until we have the recovery node in place
97 #
98 AC_DEFUN([LC_CONFIG_PINGER], [
99 AC_MSG_CHECKING([whether to enable Lustre pinger support])
100 AC_ARG_ENABLE([pinger],
101         AC_HELP_STRING([--disable-pinger],
102                 [disable recovery pinger support]),
103         [], [enable_pinger="yes"])
104 AC_MSG_RESULT([$enable_pinger])
105 AS_IF([test "x$enable_pinger" != xno],
106         [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
107 ]) # LC_CONFIG_PINGER
108
109 #
110 # LC_CONFIG_CHECKSUM
111 #
112 # do checksum of bulk data between client and OST
113 #
114 AC_DEFUN([LC_CONFIG_CHECKSUM], [
115 AC_MSG_CHECKING([whether to enable data checksum support])
116 AC_ARG_ENABLE([checksum],
117         AC_HELP_STRING([--disable-checksum],
118                 [disable data checksum support]),
119         [], [enable_checksum="yes"])
120 AC_MSG_RESULT([$enable_checksum])
121 AS_IF([test "x$enable_checksum" != xno],
122         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
123 ]) # LC_CONFIG_CHECKSUM
124
125 #
126 # LC_CONFIG_FLOCK
127 #
128 # enable distributed flock by default
129 #
130 AC_DEFUN([LC_CONFIG_FLOCK], [
131 AC_MSG_CHECKING([whether to enable flock by default])
132 AC_ARG_ENABLE([flock],
133         AC_HELP_STRING([--disable-flock],
134                 [disable flock by default]),
135         [], [enable_flock="yes"])
136 AC_MSG_RESULT([$enable_flock])
137 AS_IF([test "x$enable_flock" != xno],
138         [AC_DEFINE(ENABLE_FLOCK, 1, [enable flock by default])])
139 ]) # LC_CONFIG_FLOCK
140
141 #
142 # LC_CONFIG_HEALTH_CHECK_WRITE
143 #
144 # Turn off the actual write to the disk
145 #
146 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
147 AC_MSG_CHECKING([whether to enable a write with the health check])
148 AC_ARG_ENABLE([health_write],
149         AC_HELP_STRING([--enable-health_write],
150                 [enable disk writes when doing health check]),
151         [], [enable_health_write="no"])
152 AC_MSG_RESULT([$enable_health_write])
153 AS_IF([test "x$enable_health_write" != xno],
154         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
155 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
156
157 #
158 # LC_CONFIG_LRU_RESIZE
159 #
160 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
161 AC_MSG_CHECKING([whether to enable lru self-adjusting])
162 AC_ARG_ENABLE([lru_resize],
163         AC_HELP_STRING([--enable-lru-resize],
164                 [enable lru resize support]),
165         [], [enable_lru_resize="yes"])
166 AC_MSG_RESULT([$enable_lru_resize])
167 AS_IF([test "x$enable_lru_resize" != xno],
168         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
169 ]) # LC_CONFIG_LRU_RESIZE
170
171 #
172 # LC_QUOTA_CONFIG
173 #
174 # Quota support. The kernel must support CONFIG_QUOTA.
175 #
176 AC_DEFUN([LC_QUOTA_CONFIG], [
177 LB_CHECK_CONFIG_IM([QUOTA], [],
178         [AC_MSG_ERROR([
179
180 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
181 ])])
182 ]) # LC_QUOTA_CONFIG
183
184
185 #[AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])])
186 #
187 # LC_POSIX_ACL_CONFIG
188 #
189 # POSIX ACL support.
190 #
191 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
192 LB_CHECK_CONFIG_IM([FS_POSIX_ACL],
193         [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])
194 ], [ ])
195 ]) # LC_POSIX_ACL_CONFIG
196
197 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
198                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
199
200 #
201 # LC_CONFIG_GSS_KEYRING
202 #
203 # default 'auto', tests for dependencies, if found, enables;
204 # only called if gss is enabled
205 #
206 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
207 AC_MSG_CHECKING([whether to enable gss keyring backend])
208 AC_ARG_ENABLE([gss_keyring],
209         [AC_HELP_STRING([--disable-gss-keyring],
210                 [disable gss keyring backend])],
211         [], [enable_gss_keyring="auto"])
212 AC_MSG_RESULT([$enable_gss_keyring])
213 AS_IF([test "x$enable_gss_keyring" != xno], [
214         LB_CHECK_CONFIG_IM([KEYS], [], [
215                 gss_keyring_conf_test="fail"
216                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
217
218         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
219                 gss_keyring_conf_test="fail"
220                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
221
222         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
223                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
224                         [Define this if you enable gss keyring backend])
225                 enable_gss_keyring="yes"
226         ], [
227                 AS_IF([test "x$enable_gss_keyring" = xyes], [
228                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
229                 ])
230         ])
231 ])
232 ]) # LC_CONFIG_GSS_KEYRING
233
234 #
235 # LC_KEY_TYPE_INSTANTIATE_2ARGS
236 #
237 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
238 #
239 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
240 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
241 key_type_instantiate_2args, [
242         #include <linux/key-type.h>
243 ],[
244         ((struct key_type *)0)->instantiate(0, NULL);
245 ],[
246         AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
247                 [key_type->instantiate has two args])
248 ])
249 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
250
251 #
252 # LC_CONFIG_SUNRPC
253 #
254 AC_DEFUN([LC_CONFIG_SUNRPC], [
255 LB_CHECK_CONFIG_IM([SUNRPC], [], [
256         AS_IF([test "x$sunrpc_required" = xyes], [
257                 AC_MSG_ERROR([
258
259 kernel SUNRPC support is required by using GSS.
260 ])
261         ])])
262 ]) # LC_CONFIG_SUNRPC
263
264 #
265 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
266 #
267 # Build gss and related tools of Lustre. Currently both kernel and user space
268 # parts are depend on linux platform.
269 #
270 AC_DEFUN([LC_CONFIG_GSS], [
271 AC_MSG_CHECKING([whether to enable gss support])
272 AC_ARG_ENABLE([gss],
273         [AC_HELP_STRING([--enable-gss], [enable gss support])],
274         [], [enable_gss="auto"])
275 AC_MSG_RESULT([$enable_gss])
276
277 AS_IF([test "x$enable_gss" != xno], [
278         LC_CONFIG_GSS_KEYRING
279         LC_KEY_TYPE_INSTANTIATE_2ARGS
280         sunrpc_required=$enable_gss
281         LC_CONFIG_SUNRPC
282         sunrpc_required="no"
283
284         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
285                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
286         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
287                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
288         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
289                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
290         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
291                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
292
293         require_krb5=$enable_gss
294         AC_KERBEROS_V5
295         require_krb5="no"
296
297         AS_IF([test -n "$KRBDIR"], [
298                 gss_conf_test="success"
299         ], [
300                 gss_conf_test="failure"
301         ])
302
303         AS_IF([test "x$gss_conf_test" = xsuccess && test "x$enable_gss" != xno], [
304                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
305                 enable_gss="yes"
306         ], [
307                 enable_gss_keyring="no"
308                 enable_gss="no"
309         ])
310
311         enable_ssk=$enable_gss
312 ], [
313         enable_gss_keyring="no"
314 ])
315 ]) # LC_CONFIG_GSS
316
317 # LC_OPENSSL_SSK
318 #
319 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
320 AC_DEFUN([LC_OPENSSL_SSK], [
321 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
322 AS_IF([test "x$enable_ssk" != xno], [
323 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
324         #include <openssl/hmac.h>
325         #include <openssl/evp.h>
326
327         int main(void) {
328                 int rc;
329                 rc = HMAC_Init_ex(NULL, "test", 4, EVP_md_null(), NULL);
330         }
331 ])],[AC_DEFINE(HAVE_OPENSSL_SSK, 1,
332                [OpenSSL HMAC functions needed for SSK])],
333         [enable_ssk="no"])
334 ])
335 AC_MSG_RESULT([$enable_ssk])
336 ]) # LC_OPENSSL_SSK
337
338 # LC_OPENSSL_GETSEPOL
339 #
340 # OpenSSL is needed for l_getsepol
341 AC_DEFUN([LC_OPENSSL_GETSEPOL], [
342 AC_MSG_CHECKING([whether openssl-devel is present])
343 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
344         #include <openssl/evp.h>
345
346         int main(void) {
347                 EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
348         }
349 ])],[
350         AC_DEFINE(HAVE_OPENSSL_GETSEPOL, 1, [openssl-devel is present])
351         enable_getsepol="yes"
352
353 ],[
354         enable_getsepol="no"
355         AC_MSG_WARN([
356
357 No openssk-devel headers found, unable to build l_getsepol and SELinux status checking
358 ])
359 ])
360 AC_MSG_RESULT([$enable_getsepol])
361 ]) # LC_OPENSSL_GETSEPOL
362
363 # LC_INODE_PERMISION_2ARGS
364 #
365 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
366 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
367 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
368 # v3.1 onward have a 2 arg version (inode, mask)
369 #
370 AC_DEFUN([LC_INODE_PERMISION_2ARGS], [
371 LB_CHECK_COMPILE([if 'inode_operations->permission' has two args],
372 inode_ops_permission_2args, [
373         #include <linux/fs.h>
374 ],[
375         struct inode *inode __attribute__ ((unused));
376
377         inode = NULL;
378         inode->i_op->permission(NULL, 0);
379 ],[
380         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
381                 [inode_operations->permission has two args])
382 ])
383 ]) # LC_INODE_PERMISION_2ARGS
384
385 #
386 # LC_HAVE_FSTYPE_MOUNT
387 #
388 # 2.6.39 replace get_sb with mount in struct file_system_type
389 #
390 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [
391 LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field],
392 file_system_type_mount, [
393         #include <linux/fs.h>
394 ],[
395         struct file_system_type fst = { };
396         void *mount;
397
398         mount = (void *)fst.mount;
399 ],[
400         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
401                 [struct file_system_type has mount field])
402 ])
403 ]) # LC_HAVE_FSTYPE_MOUNT
404
405 #
406 # LC_HAVE_FHANDLE_SYSCALLS
407 #
408 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
409 # added to Linux kernel 2.6.39.
410 # Check if client supports these functions
411 #
412 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [
413 LB_CHECK_CONFIG_IM([FHANDLE],[
414         AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
415                 [kernel supports fhandles and related syscalls])
416         ])
417 ]) # LC_HAVE_FHANDLE_SYSCALLS
418
419 #
420 # LC_HAVE_INODE_OWNER_OR_CAPABLE
421 #
422 # 2.6.39 renames is_owner_or_cap to inode_owner_or_capable
423 #
424 AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [
425 LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist],
426 inode_owner_or_capable, [
427         #include <linux/fs.h>
428 ],[
429         inode_owner_or_capable(NULL);
430 ],[
431         AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
432                 [inode_owner_or_capable exist])
433 ])
434 ]) # LC_HAVE_INODE_OWNER_OR_CAPABLE
435
436 #
437 # LC_DIRTY_INODE_WITH_FLAG
438 #
439 # 3.0 dirty_inode() has a flag parameter
440 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
441 #
442 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [
443 LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag],
444 dirty_inode_super_operation_flag, [
445         #include <linux/fs.h>
446 ],[
447         struct inode *inode = NULL;
448         inode->i_sb->s_op->dirty_inode(NULL, 0);
449 ],[
450         AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
451                 [dirty_inode super_operation takes flag])
452 ])
453 ]) # LC_DIRTY_INODE_WITH_FLAG
454
455 #
456 # LC_SETNS
457 #
458 # 3.0 introduced setns
459 #
460 AC_DEFUN([LC_SETNS], [
461 AC_CHECK_HEADERS([sched.h], [], [],
462                  [#define _GNU_SOURCE
463                  ])
464 AC_CHECK_FUNCS([setns])
465 ]) # LC_SETNS
466
467 #
468 # LC_LM_XXX_LOCK_MANAGER_OPS
469 #
470 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
471 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
472 #
473 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [
474 LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'],
475 lock_manager_ops_lm_xxx, [
476         #include <linux/fs.h>
477 ],[
478         struct lock_manager_operations lm_ops;
479         lm_ops.lm_notify = NULL;
480 ],[
481         AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
482                 [lock-manager ops renamed to lm_xxx])
483 ])
484 ]) # LC_LM_XXX_LOCK_MANAGER_OPS
485
486 #
487 # LC_INODE_DIO_WAIT
488 #
489 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait
490 #     instead.
491 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
492 #
493 AC_DEFUN([LC_INODE_DIO_WAIT], [
494 LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait],
495 inode_dio_wait, [
496         #include <linux/fs.h>
497 ],[
498         inode_dio_wait((struct inode *)0);
499 ],[
500         AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
501                 [inode->i_alloc_sem is killed and use inode_dio_wait])
502 ])
503 ]) # LC_INODE_DIO_WAIT
504
505 #
506 # LC_IOP_GET_ACL
507 #
508 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
509 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
510 #
511 AC_DEFUN([LC_IOP_GET_ACL], [
512 LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function],
513 inode_ops_get_acl, [
514         #include <linux/fs.h>
515 ],[
516         struct inode_operations iop;
517         iop.get_acl = NULL;
518 ],[
519         AC_DEFINE(HAVE_IOP_GET_ACL, 1,
520                 [inode_operations has .get_acl member function])
521 ])
522 ]) # LC_IOP_GET_ACL
523
524 #
525 # LC_FILE_LLSEEK_SIZE
526 #
527 # 3.1 introduced generic_file_llseek_size()
528 #
529 AC_DEFUN([LC_FILE_LLSEEK_SIZE], [
530 LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c],
531         [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
532                 [generic_file_llseek_size is exported by the kernel])])
533 ]) # LC_FILE_LLSEEK_SIZE
534
535 #
536 # LC_RADIX_EXCEPTION_ENTRY
537 # 3.1 adds radix_tree_exception_entry.
538 #
539 AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [
540 LB_CHECK_COMPILE([radix_tree_exceptional_entry exist],
541 radix_tree_exceptional_entry, [
542         #include <linux/radix-tree.h>
543 ],[
544         radix_tree_exceptional_entry(NULL);
545 ],[
546         AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1,
547                 [radix_tree_exceptional_entry exist])
548 ])
549 ]) # LC_RADIX_EXCEPTION_ENTRY
550
551 #
552 # LC_HAVE_PROTECT_I_NLINK
553 #
554 # 3.2 protects inode->i_nlink from direct modification
555 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
556 # at the same time adds set_nlink(), so checks set_nlink() for it.
557 #
558 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [
559 LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification],
560 inode_i_nlink_protected, [
561         #include <linux/fs.h>
562 ],[
563         struct inode i;
564         set_nlink(&i, 1);
565 ],[
566         AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
567                 [inode->i_nlink is protected from direct modification])
568 ])
569 ]) # LC_HAVE_PROTECT_I_NLINK
570
571 #
572 # 2.6.39 security_inode_init_security takes a 'struct qstr' parameter
573 #
574 # 3.2 security_inode_init_security takes a callback to set xattrs
575 #
576 AC_DEFUN([LC_HAVE_SECURITY_IINITSEC], [
577 LB_CHECK_COMPILE([if security_inode_init_security takes a callback],
578 security_inode_init_security_callback, [
579         #include <linux/security.h>
580 ],[
581         security_inode_init_security(NULL, NULL, NULL, (const initxattrs)NULL, NULL);
582 ],[
583         AC_DEFINE(HAVE_SECURITY_IINITSEC_CALLBACK, 1,
584                   [security_inode_init_security takes a callback to set xattrs])
585 ],[
586         LB_CHECK_COMPILE([if security_inode_init_security takes a 'struct qstr' parameter],
587         security_inode_init_security_qstr, [
588                 #include <linux/security.h>
589         ],[
590                 security_inode_init_security(NULL, NULL, (struct qstr *)NULL, NULL, NULL, NULL);
591         ],[
592                 AC_DEFINE(HAVE_SECURITY_IINITSEC_QSTR, 1,
593                           [security_inode_init_security takes a 'struct qstr' parameter])
594         ])
595 ])
596 ]) # LC_HAVE_SECURITY_IINITSEC
597
598 #
599 # 2.6.39 vfs_create takes a 'struct nameidata' parameter
600 #
601 AC_DEFUN([LC_VFS_CREATE_USE_NAMEIDATA], [
602 LB_CHECK_COMPILE([if vfs_create takes a struct nameidata parameter],
603 vfs_create, [
604         #include <linux/namei.h>
605         #include <linux/fs.h>
606 ],[
607         struct nameidata *nd;
608         vfs_create(NULL, NULL, 0, nd);
609 ],[
610         AC_DEFINE(HAVE_VFS_CREATE_USE_NAMEIDATA, 1,
611                 [vfs_create use nameidata as parameter])
612 ])
613 ]) # LC_VFS_CREATE_USE_NAMEIDATA
614
615 #
616 # LC_HAVE_MIGRATE_HEADER
617 #
618 # 3.3 introduces migrate_mode.h and migratepage has 4 args
619 #
620 AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [
621 LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [
622         AC_DEFINE(HAVE_MIGRATE_H, 1,
623                 [kernel has include/linux/migrate.h])
624 ],[
625         LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [
626                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
627                         [kernel has include/linux/migrate_mode.h])
628         ])
629 ])
630 ]) # LC_HAVE_MIGRATE_HEADER
631
632 #
633 # LC_MIGRATEPAGE_4ARGS
634 #
635 AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [
636 LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args],
637 address_space_ops_migratepage_4args, [
638         #include <linux/fs.h>
639 #ifdef HAVE_MIGRATE_H
640         #include <linux/migrate.h>
641 #elif defined(HAVE_MIGRATE_MODE_H)
642         #include <linux/migrate_mode.h>
643 #endif
644 ],[
645         struct address_space_operations aops = { };
646         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
647 ],[
648         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
649                 [address_space_operations.migratepage has 4 args])
650 ])
651 ]) # LC_MIGRATEPAGE_4ARGS
652
653 #
654 # LC_SUPEROPS_USE_DENTRY
655 #
656 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
657 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
658 #
659 AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [
660 tmp_flags="$EXTRA_KCFLAGS"
661 EXTRA_KCFLAGS="-Werror"
662 LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter],
663 super_ops_dentry, [
664         #include <linux/fs.h>
665         int show_options(struct seq_file *seq, struct dentry *root) {
666                 return 0;
667         }
668 ],[
669         struct super_operations ops;
670         ops.show_options = show_options;
671 ],[
672         AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
673                 [super_operations use dentry as parameter])
674 ])
675 EXTRA_KCFLAGS="$tmp_flags"
676 ]) # LC_SUPEROPS_USE_DENTRY
677
678 #
679 # LC_INODEOPS_USE_UMODE_T
680 #
681 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
682 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
683 #
684 AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [
685 tmp_flags="$EXTRA_KCFLAGS"
686 EXTRA_KCFLAGS="-Werror"
687 LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter],
688 inode_ops_umode_t, [
689         #include <linux/fs.h>
690         #include <linux/types.h>
691         int my_mknod(struct inode *dir, struct dentry *dchild,
692                      umode_t mode, dev_t dev)
693         {
694                 return 0;
695         }
696 ],[
697         struct inode_operations ops;
698         ops.mknod = my_mknod;
699 ],[
700         AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
701                 [inode_operations use umode_t as parameter])
702 ])
703 EXTRA_KCFLAGS="$tmp_flags"
704 ]) # LC_INODEOPS_USE_UMODE_T
705
706 #
707 # LC_KMAP_ATOMIC_HAS_1ARG
708 #
709 # 3.4 kmap_atomic removes second argument
710 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
711 #
712 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [
713 LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument],
714 kmap_atomic_1arg, [
715         #include <linux/highmem.h>
716 ],[
717         kmap_atomic(NULL);
718 ],[
719         AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
720                 [have kmap_atomic has only 1 argument])
721 ])
722 ]) # LC_KMAP_ATOMIC_HAS_1ARG
723
724 #
725 # LC_HAVE_D_MAKE_ROOT
726 #
727 # 3.4 converts d_alloc_root to d_make_root
728 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
729 #
730 AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [
731 LB_CHECK_COMPILE([if have 'd_make_root'],
732 d_make_root, [
733         #include <linux/fs.h>
734 ],[
735         d_make_root((struct inode *)NULL);
736 ],[
737         AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
738                 [have d_make_root])
739 ])
740 ]) # LC_HAVE_D_MAKE_ROOT
741
742 #
743 # LC_HAVE_CACHE_REGISTER
744 #
745 # 3.4 cache_register/cache_unregister are removed
746 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
747 # Note, since 2.6.37 cache_register_net/cache_unregister_net
748 # are defined, but not exported.
749 # 3.3 cache_register_net/cache_unregister_net are
750 # exported and replacing cache_register/cache_unregister in 3.4
751 #
752 AC_DEFUN([LC_HAVE_CACHE_REGISTER], [
753 LB_CHECK_COMPILE([if have 'cache_register'],
754 cache_register, [
755         #include <linux/sunrpc/cache.h>
756 ],[
757         cache_register(NULL);
758 ],[
759         AC_DEFINE(HAVE_CACHE_REGISTER, 1,
760                 [have cache_register])
761 ])
762 ]) # LC_HAVE_CACHE_REGISTER
763
764 #
765 # LC_HAVE_CLEAR_INODE
766 #
767 # 3.5 renames end_writeback() back to clear_inode()...
768 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
769 #
770 AC_DEFUN([LC_HAVE_CLEAR_INODE], [
771 LB_CHECK_COMPILE([if have 'clear_inode'],
772 clear_inode, [
773         #include <linux/fs.h>
774 ],[
775         clear_inode((struct inode *)NULL);
776 ],[
777         AC_DEFINE(HAVE_CLEAR_INODE, 1,
778                 [have clear_inode])
779 ])
780 ]) # LC_HAVE_CLEAR_INODE
781
782 #
783 # LC_HAVE_ENCODE_FH_PARENT
784 #
785 # 3.5 encode_fh has parent inode passed in directly
786 # see kernel commit b0b0382b
787 #
788 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [
789 tmp_flags="$EXTRA_KCFLAGS"
790 EXTRA_KCFLAGS="-Werror"
791 LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter],
792 encode_fh_parent_inode, [
793         #include <linux/exportfs.h>
794         #include <linux/fs.h>
795         #include <linux/types.h>
796         int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
797         {
798                 return 0;
799         }
800 ],[
801         struct export_operations exp_op;
802         exp_op.encode_fh = ll_encode_fh;
803 ],[
804         AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
805                 [have parent inode as parameter])
806 ])
807 EXTRA_KCFLAGS="$tmp_flags"
808 ]) # LC_HAVE_ENCODE_FH_PARENT
809
810 #
811 # LC_FILE_LLSEEK_SIZE_5ARG
812 #
813 # 3.5 has generic_file_llseek_size with 5 args
814 #
815 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [
816 LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args],
817 generic_file_llseek_size_5args, [
818         #include <linux/fs.h>
819 ],[
820         generic_file_llseek_size(NULL, 0, 0, 0, 0);
821 ], [
822         AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
823                 [kernel has generic_file_llseek_size with 5 args])
824 ])
825 ]) # LC_FILE_LLSEEK_SIZE_5ARG
826
827 #
828 # LC_LLITE_DATA_IS_LIST
829 #
830 # 3.6 switch i_dentry/d_alias from list to hlist
831 #
832 # In the upstream kernels d_alias first changes
833 # to a hlist and then in later version, 3.11, gets
834 # moved to the union d_u. Due to some distros having
835 # d_alias in the d_u union as a struct list, which
836 # has never existed upstream stream, we can't test
837 # if d_alias is a list or hlist directly. If ever
838 # i_dentry and d_alias even up different combos then
839 # the build will fail. In that case then we will need
840 # to separate out the i_dentry and d_alias test below.
841 #
842 AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
843 tmp_flags="$EXTRA_KCFLAGS"
844 EXTRA_KCFLAGS="-Werror"
845 LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
846 i_dentry_d_alias_list, [
847         #include <linux/fs.h>
848 ],[
849         struct inode inode;
850         INIT_LIST_HEAD(&inode.i_dentry);
851 ],[
852         AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
853                 [both i_dentry/d_alias uses list])
854 ])
855 EXTRA_KCFLAGS="$tmp_flags"
856 ]) # LC_DATA_FOR_LLITE_IS_LIST
857
858 #
859 # LC_DENTRY_OPEN_USE_PATH
860 #
861 # 3.6 dentry_open uses struct path as first argument
862 # see kernel commit 765927b2
863 #
864 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [
865 tmp_flags="$EXTRA_KCFLAGS"
866 EXTRA_KCFLAGS="-Werror"
867 LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument],
868 dentry_open_path, [
869         #include <linux/fs.h>
870         #include <linux/path.h>
871 ],[
872         struct path path;
873         dentry_open(&path, 0, NULL);
874 ],[
875         AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
876                 [dentry_open uses struct path as first argument])
877 ])
878 EXTRA_KCFLAGS="$tmp_flags"
879 ]) # LC_DENTRY_OPEN_USE_PATH
880
881 #
882 # LC_HAVE_IOP_ATOMIC_OPEN
883 #
884 # 3.6 vfs adds iop->atomic_open
885 #
886 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [
887 LB_CHECK_COMPILE([if 'iop' has 'atomic_open'],
888 inode_ops_atomic_open, [
889         #include <linux/fs.h>
890 ],[
891         struct inode_operations iop;
892         iop.atomic_open = NULL;
893 ],[
894         AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
895                 [have iop atomic_open])
896 ])
897 ]) # LC_HAVE_IOP_ATOMIC_OPEN
898
899 #
900 # LC_HAVE_SB_START_WRITE
901 #
902 # RHEL6 2.6.32, 3.6 or newer support wrapped FS freeze functions
903 #
904 AC_DEFUN([LC_HAVE_SB_START_WRITE], [
905 LB_CHECK_COMPILE([if kernel supports wrapped FS freeze functions],
906 sb_start_write, [
907         #include <linux/fs.h>
908 ],[
909         sb_start_write(NULL);
910 ],[
911         AC_DEFINE(HAVE_SB_START_WRITE, 1,
912                 [kernel supports wrapped FS freeze functions])
913 ])
914 ]) # LC_HAVE_SB_START_WRITE
915
916 #
917 # LC_HAVE_POSIXACL_USER_NS
918 #
919 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
920 #
921 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [
922 LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'],
923 posix_acl_to_xattr_user_namespace, [
924         #include <linux/fs.h>
925         #include <linux/posix_acl_xattr.h>
926 ],[
927         posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
928 ],[
929         AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
930                 [posix_acl_to_xattr takes struct user_namespace])
931 ])
932 ]) # LC_HAVE_POSIXACL_USER_NS
933
934 #
935 # LC_HAVE_FILE_F_INODE
936 #
937 # 3.8 struct file has new member f_inode
938 #
939 AC_DEFUN([LC_HAVE_FILE_F_INODE], [
940 LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'],
941 file_f_inode, [
942         #include <linux/fs.h>
943 ],[
944         ((struct file *)0)->f_inode = NULL;
945 ],[
946         AC_DEFINE(HAVE_FILE_F_INODE, 1,
947                 [struct file has member f_inode])
948 ])
949 ]) # LC_HAVE_FILE_F_INODE
950
951 #
952 # LC_HAVE_FILE_INODE
953 #
954 # 3.8 has introduced inline function file_inode
955 #
956 AC_DEFUN([LC_HAVE_FILE_INODE], [
957 LB_CHECK_COMPILE([if file_inode() exists],
958 file_inode, [
959         #include <linux/fs.h>
960 ],[
961         file_inode(NULL);
962 ],[
963         AC_DEFINE(HAVE_FILE_INODE, 1,
964                 [file_inode() has been defined])
965 ])
966 ]) # LC_HAVE_FILE_INODE
967
968 #
969 # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
970 #
971 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [
972 LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args],
973 sunrpc_cache_pipe_upcall_3args, [
974         #include <linux/sunrpc/cache.h>
975 ],[
976         sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
977 ],[
978         AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
979                 [sunrpc_cache_pipe_upcall takes 3 args])
980 ])
981 ]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
982
983 #
984 # LC_HAVE_HLIST_FOR_EACH_3ARG
985 #
986 # 3.9 uses hlist_for_each_entry with 3 args
987 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
988 #
989 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [
990 LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args],
991 hlist_for_each_entry_3args, [
992         #include <linux/list.h>
993         #include <linux/fs.h>
994 ],[
995         struct hlist_head *head = NULL;
996         struct inode *inode;
997
998         hlist_for_each_entry(inode, head, i_hash) {
999                 continue;
1000         }
1001 ],[
1002         AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1,
1003                 [hlist_for_each_entry has 3 args])
1004 ])
1005 ]) # LC_HAVE_HLIST_FOR_EACH_3ARG
1006
1007 #
1008 # LC_HAVE_BIO_END_SECTOR
1009 #
1010 # 3.9 introduces bio_end_sector macro
1011 # f73a1c7d117d07a96d89475066188a2b79e53c48
1012 #
1013 AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [
1014 LB_CHECK_COMPILE([if 'bio_end_sector' is defined],
1015 bio_end_sector, [
1016         #include <linux/bio.h>
1017 ],[
1018         struct bio bio = { };
1019         unsigned long long end;
1020
1021         end = bio_end_sector(&bio);
1022 ],[
1023         AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
1024                   [bio_end_sector is defined])
1025 ])
1026 ]) # LC_HAVE_BIO_END_SECTOR
1027
1028 #
1029 # 3.9 created is_sxid
1030 #
1031 AC_DEFUN([LC_HAVE_IS_SXID], [
1032 LB_CHECK_COMPILE([if 'is_sxid' is defined],
1033 is_sxid, [
1034         #include <linux/fs.h>
1035 ],[
1036         struct inode inode = { };
1037
1038         is_sxid(inode.i_mode);
1039 ],[
1040         AC_DEFINE(HAVE_IS_SXID, 1, [is_sxid is defined])
1041 ])
1042 ]) # LC_HAVE_IS_SXID
1043
1044 #
1045 # LC_HAVE_VFS_GETATTR_2ARGS
1046 #
1047 AC_DEFUN([LC_HAVE_VFS_GETATTR_2ARGS], [
1048 LB_CHECK_COMPILE([if vfs_getattr takes 2 args],
1049 vfs_getattr, [
1050         #include <linux/fs.h>
1051 ],[
1052         struct path path;
1053
1054         vfs_getattr(&path, NULL);
1055 ],[
1056         AC_DEFINE(HAVE_VFS_GETATTR_2ARGS, 1,
1057                 [vfs_getattr takes 2 args])
1058 ])
1059 ]) # LC_HAVE_VFS_GETATTR_2ARGS
1060
1061 #
1062 # LC_HAVE_REMOVE_PROC_SUBTREE
1063 #
1064 # 3.10 introduced remove_proc_subtree
1065 #
1066 AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [
1067 LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined],
1068 remove_proc_subtree, [
1069         #include <linux/proc_fs.h>
1070 ],[
1071         remove_proc_subtree(NULL, NULL);
1072 ], [
1073         AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1,
1074                   [remove_proc_subtree is defined])
1075 ])
1076 ]) # LC_HAVE_REMOVE_PROC_SUBTREE
1077
1078 #
1079 # LC_HAVE_PROC_REMOVE
1080 #
1081 # 3.10 introduced proc_remove
1082 #
1083 AC_DEFUN([LC_HAVE_PROC_REMOVE], [
1084 LB_CHECK_COMPILE([if 'proc_remove' is defined],
1085 proc_remove, [
1086         #include <linux/proc_fs.h>
1087 ],[
1088         proc_remove(NULL);
1089 ], [
1090         AC_DEFINE(HAVE_PROC_REMOVE, 1,
1091                   [proc_remove is defined])
1092 ])
1093 ]) # LC_HAVE_PROC_REMOVE
1094
1095 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
1096 LB_CHECK_COMPILE([if get_projid exists],
1097 get_projid, [
1098         struct inode;
1099         #include <linux/quota.h>
1100 ],[
1101         struct dquot_operations ops = { };
1102
1103         ops.get_projid(NULL, NULL);
1104 ],[
1105         AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
1106                 [get_projid function exists])
1107 ])
1108 ]) # LC_HAVE_PROJECT_QUOTA
1109
1110
1111 #
1112 # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1113 #
1114 # 3.10 introduced security_dentry_init_security()
1115 #
1116 AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_SECURITY], [
1117 LB_CHECK_COMPILE([if 'security_dentry_init_security' is defined],
1118 security_dentry_init_security, [
1119         #include <linux/security.h>
1120 ],[
1121         security_dentry_init_security(NULL, 0, NULL, NULL, NULL);
1122 ],[
1123         AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_SECURITY, 1,
1124                 [security_dentry_init_security' is defined])
1125 ])
1126 ]) # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1127
1128 #
1129 # 3.10 exports security_inode_listsecurity
1130 #
1131 AC_DEFUN([LC_HAVE_SECURITY_INODE_LISTSECURITY], [
1132 LB_CHECK_COMPILE([if security_inode_listsecurity() is available/exported],
1133 security_inode_listsecurity, [
1134         #include <linux/security.h>
1135 ],[
1136         security_inode_listsecurity(NULL, NULL, 0);
1137 ],[
1138         AC_DEFINE(HAVE_SECURITY_INODE_LISTSECURITY, 1,
1139                   [security_inode_listsecurity() is available/exported])
1140 ])
1141 ]) # LC_HAVE_SECURITY_INODE_LISTSECURITY
1142
1143 #
1144 # LC_INVALIDATE_RANGE
1145 #
1146 # 3.11 invalidatepage requires the length of the range to invalidate
1147 #
1148 AC_DEFUN([LC_INVALIDATE_RANGE], [
1149 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
1150 address_space_ops_invalidatepage_3args, [
1151         #include <linux/fs.h>
1152 ],[
1153         struct address_space_operations a_ops;
1154         a_ops.invalidatepage(NULL, 0, 0);
1155 ],[
1156         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
1157                 [address_space_operations.invalidatepage needs 3 arguments])
1158 ])
1159 ]) # LC_INVALIDATE_RANGE
1160
1161 #
1162 # LC_HAVE_DIR_CONTEXT
1163 #
1164 # 3.11 readdir now takes the new struct dir_context
1165 #
1166 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
1167 LB_CHECK_COMPILE([if 'dir_context' exist],
1168 dir_context, [
1169         #include <linux/fs.h>
1170 ],[
1171 #ifdef FMODE_KABI_ITERATE
1172 #error "back to use readdir in kabi_extand mode"
1173 #else
1174         struct dir_context ctx;
1175
1176         ctx.pos = 0;
1177 #endif
1178 ],[
1179         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
1180                 [dir_context exist])
1181 ])
1182 ]) # LC_HAVE_DIR_CONTEXT
1183
1184 #
1185 # LC_D_COMPARE_5ARGS
1186 #
1187 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1188 #
1189 AC_DEFUN([LC_D_COMPARE_5ARGS], [
1190 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
1191 d_compare_5args, [
1192         #include <linux/dcache.h>
1193 ],[
1194         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1195 ],[
1196         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1197                 [d_compare need 5 arguments])
1198 ])
1199 ]) # LC_D_COMPARE_5ARGS
1200
1201 #
1202 # LC_HAVE_DCOUNT
1203 #
1204 # 3.11 need to access d_count to get dentry reference count
1205 #
1206 AC_DEFUN([LC_HAVE_DCOUNT], [
1207 LB_CHECK_COMPILE([if 'd_count' exists],
1208 d_count, [
1209         #include <linux/dcache.h>
1210 ],[
1211         struct dentry de = { };
1212         int count;
1213
1214         count = d_count(&de);
1215 ],[
1216         AC_DEFINE(HAVE_D_COUNT, 1,
1217                 [d_count exist])
1218 ])
1219 ]) # LC_HAVE_DCOUNT
1220
1221 #
1222 # LC_PID_NS_FOR_CHILDREN
1223 #
1224 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
1225 #
1226 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
1227 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
1228 pid_ns_for_children, [
1229         #include <linux/nsproxy.h>
1230 ],[
1231         struct nsproxy ns;
1232         ns.pid_ns_for_children = NULL;
1233 ],[
1234         AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
1235                   ['struct nsproxy' has 'pid_ns_for_children'])
1236 ])
1237 ]) # LC_PID_NS_FOR_CHILDREN
1238
1239 #
1240 # LC_OLDSIZE_TRUNCATE_PAGECACHE
1241 #
1242 # 3.12 truncate_pagecache without oldsize parameter
1243 #
1244 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
1245 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
1246 truncate_pagecache_old_size, [
1247         #include <linux/mm.h>
1248 ],[
1249         truncate_pagecache(NULL, 0, 0);
1250 ],[
1251         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
1252                 [with oldsize])
1253 ])
1254 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
1255
1256 #
1257 # LC_PTR_ERR_OR_ZERO
1258 #
1259 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
1260 # It was added to linux kernel 3.12
1261 #
1262 AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
1263 LB_CHECK_COMPILE([if 'PTR_ERR_OR_ZERO' is missing],
1264 is_err_or_null, [
1265         #include <linux/err.h>
1266 ],[
1267         if (PTR_ERR_OR_ZERO(NULL)) return 0;
1268 ],[
1269         AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
1270                 ['PTR_ERR_OR_ZERO' exist])
1271 ])
1272 ]) # LC_PTR_ERR_OR_ZERO_MISSING
1273
1274 #
1275 # LC_HAVE_DENTRY_D_U_D_ALIAS
1276 #
1277 # 3.11 kernel moved d_alias to the union d_u in struct dentry
1278 #
1279 # Some distros move d_alias to d_u but it is still a struct list
1280 #
1281 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
1282 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
1283         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
1284         d_alias, [
1285                 #include <linux/list.h>
1286                 #include <linux/dcache.h>
1287         ],[
1288                 struct dentry de;
1289                 INIT_LIST_HEAD(&de.d_u.d_alias);
1290         ],[
1291                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1292                         [list dentry.d_u.d_alias exist])
1293         ])
1294 ],[
1295         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
1296         d_alias, [
1297                 #include <linux/list.h>
1298                 #include <linux/dcache.h>
1299         ],[
1300                 struct dentry de;
1301                 INIT_HLIST_NODE(&de.d_u.d_alias);
1302         ],[
1303                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1304                         [hlist dentry.d_u.d_alias exist])
1305         ])
1306 ])
1307 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
1308
1309 #
1310 # LC_HAVE_DENTRY_D_CHILD
1311 #
1312 # 3.11 kernel d_child has been moved out of the union d_u
1313 # in struct dentry
1314 #
1315 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
1316 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
1317 d_child, [
1318         #include <linux/list.h>
1319         #include <linux/dcache.h>
1320 ],[
1321         struct dentry de;
1322         INIT_LIST_HEAD(&de.d_child);
1323 ],[
1324         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
1325                 [dentry.d_child exist])
1326 ])
1327 ]) # LC_HAVE_DENTRY_D_CHILD
1328
1329 #
1330 # LC_KIOCB_KI_LEFT
1331 #
1332 # 3.12 ki_left removed from struct kiocb
1333 #
1334 AC_DEFUN([LC_KIOCB_KI_LEFT], [
1335 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
1336 kiocb_ki_left, [
1337         #include <linux/aio.h>
1338 ],[
1339         ((struct kiocb*)0)->ki_left = 0;
1340 ],[
1341         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
1342                 [ki_left exist])
1343 ])
1344 ]) # LC_KIOCB_KI_LEFT
1345
1346 #
1347 # LC_INIT_LIST_HEAD_RCU
1348 #
1349 # 3.12 added INIT_LIST_HEAD_RCU in commit 2a855b644c310d5db5
1350 # which is unfortunately an inline function and not a macro
1351 # that can be tested directly, so it needs a configure check.
1352 #
1353 AC_DEFUN([LC_INIT_LIST_HEAD_RCU], [
1354 LB_CHECK_COMPILE([if 'INIT_LIST_HEAD_RCU' exists],
1355 init_list_head_rcu, [
1356         #include <linux/list.h>
1357         #include <linux/rculist.h>
1358 ],[
1359         struct list_head list;
1360         INIT_LIST_HEAD_RCU(&list);
1361 ],[
1362         AC_DEFINE(HAVE_INIT_LIST_HEAD_RCU, 1,
1363                   [INIT_LIST_HEAD_RCU exists])
1364 ])
1365 ]) # LC_INIT_LIST_HEAD_RCU
1366
1367 #
1368 # LC_VFS_RENAME_5ARGS
1369 #
1370 # 3.13 has vfs_rename with 5 args
1371 #
1372 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
1373 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
1374 vfs_rename_5args, [
1375         #include <linux/fs.h>
1376 ],[
1377         vfs_rename(NULL, NULL, NULL, NULL, NULL);
1378 ], [
1379         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
1380                 [kernel has vfs_rename with 5 args])
1381 ])
1382 ]) # LC_VFS_RENAME_5ARGS
1383
1384 #
1385 # LC_VFS_UNLINK_3ARGS
1386 #
1387 # 3.13 has vfs_unlink with 3 args
1388 #
1389 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
1390 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
1391 vfs_unlink_3args, [
1392         #include <linux/fs.h>
1393 ],[
1394         vfs_unlink(NULL, NULL, NULL);
1395 ], [
1396         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
1397                 [kernel has vfs_unlink with 3 args])
1398 ])
1399 ]) # LC_VFS_UNLINK_3ARGS
1400
1401 # LC_HAVE_D_IS_POSITIVE
1402 #
1403 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
1404 # d_is_positive is added
1405 #
1406 AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
1407 LB_CHECK_COMPILE([if 'd_is_positive' exist],
1408 d_is_positive, [
1409         #include <linux/dcache.h>
1410 ],[
1411         d_is_positive(NULL);
1412 ],[
1413         AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
1414                 ['d_is_positive' is available])
1415 ])
1416 ]) # LC_HAVE_D_IS_POSITIVE
1417
1418 #
1419 # LC_HAVE_BVEC_ITER
1420 #
1421 # 3.14 move some of its data in struct bio into the new
1422 # struct bvec_iter
1423 #
1424 AC_DEFUN([LC_HAVE_BVEC_ITER], [
1425 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
1426 have_bvec_iter, [
1427         #include <linux/bio.h>
1428 ],[
1429         struct bvec_iter iter;
1430
1431         iter.bi_bvec_done = 0;
1432 ], [
1433         AC_DEFINE(HAVE_BVEC_ITER, 1,
1434                 [kernel has struct bvec_iter])
1435 ])
1436 ]) # LC_HAVE_BVEC_ITER
1437
1438 #
1439 # LC_IOP_SET_ACL
1440 #
1441 # 3.14 adds set_acl method to inode_operations
1442 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
1443 #
1444 AC_DEFUN([LC_IOP_SET_ACL], [
1445 LB_CHECK_COMPILE([if 'inode_operations' has '.set_acl' member function],
1446 inode_ops_set_acl, [
1447         #include <linux/fs.h>
1448 ],[
1449         struct inode_operations iop;
1450         iop.set_acl = NULL;
1451 ],[
1452         AC_DEFINE(HAVE_IOP_SET_ACL, 1,
1453                 [inode_operations has .set_acl member function])
1454 ])
1455 ]) # LC_IOP_SET_ACL
1456
1457 #
1458 # LC_HAVE_TRUNCATE_IPAGE_FINAL
1459 #
1460 # 3.14 bring truncate_inode_pages_final for evict_inode
1461 #
1462 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
1463 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
1464 truncate_ipages_final, [
1465         #include <linux/mm.h>
1466 ],[
1467         truncate_inode_pages_final(NULL);
1468 ], [
1469         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
1470                 [kernel has truncate_inode_pages_final])
1471 ])
1472 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
1473
1474 #
1475 # LC_IOPS_RENAME_WITH_FLAGS
1476 #
1477 # 3.14 has inode_operations->rename with 5 args
1478 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
1479 #
1480 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
1481 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
1482 iops_rename_with_flags, [
1483         #include <linux/fs.h>
1484 ],[
1485         struct inode *i1 = NULL, *i2 = NULL;
1486         struct dentry *d1 = NULL, *d2 = NULL;
1487         int rc;
1488         rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
1489 ], [
1490         AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
1491                 [inode_operations->rename need flags as argument])
1492 ])
1493 ]) # LC_IOPS_RENAME_WITH_FLAGS
1494
1495 #
1496 # LC_VFS_RENAME_6ARGS
1497 #
1498 # 3.15 has vfs_rename with 6 args
1499 #
1500 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
1501 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
1502 vfs_rename_6args, [
1503         #include <linux/fs.h>
1504 ],[
1505         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
1506 ], [
1507         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
1508                 [kernel has vfs_rename with 6 args])
1509 ])
1510 ]) # LC_VFS_RENAME_6ARGS
1511
1512 #
1513 # LC_DIRECTIO_USE_ITER
1514 #
1515 # 3.16 kernel changes direct IO to use iov_iter
1516 #
1517 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
1518 LB_CHECK_COMPILE([if direct IO uses iov_iter],
1519 direct_io_iter, [
1520         #include <linux/fs.h>
1521 ],[
1522         struct address_space_operations ops = { };
1523         struct iov_iter *iter = NULL;
1524         loff_t offset = 0;
1525
1526         ops.direct_IO(0, NULL, iter, offset);
1527 ],[
1528         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
1529                 [direct IO uses iov_iter])
1530 ])
1531 ]) # LC_DIRECTIO_USE_ITER
1532
1533 #
1534 # LC_HAVE_IOV_ITER_INIT_DIRECTION
1535 #
1536 #
1537 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
1538 #      changed iov_iter_init api to start accepting a tag
1539 #      that defines if its a read or write operation
1540 #
1541 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
1542 tmp_flags="$EXTRA_KCFLAGS"
1543 EXTRA_KCFLAGS="-Werror"
1544 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
1545 iter_init, [
1546         #include <linux/uio.h>
1547         #include <linux/fs.h>
1548 ],[
1549         const struct iovec *iov = NULL;
1550
1551         iov_iter_init(NULL, READ, iov, 1, 0);
1552 ],[
1553         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
1554                 [iov_iter_init handles directional tag])
1555 ])
1556 EXTRA_KCFLAGS="$tmp_flags"
1557 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
1558
1559 #
1560 # LC_HAVE_IOV_ITER_TRUNCATE
1561 #
1562 #
1563 # 3.16 introduces a new API iov_iter_truncate()
1564 #
1565 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
1566 tmp_flags="$EXTRA_KCFLAGS"
1567 EXTRA_KCFLAGS="-Werror"
1568 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
1569 iter_truncate, [
1570         #include <linux/uio.h>
1571         #include <linux/fs.h>
1572 ],[
1573         struct iov_iter *i = NULL;
1574
1575         iov_iter_truncate(i, 0);
1576 ],[
1577         AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
1578 ])
1579 EXTRA_KCFLAGS="$tmp_flags"
1580 ]) # LC_HAVE_IOV_ITER_TRUNCATE
1581
1582 #
1583 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1584 #
1585 # 3.16 introduces [read|write]_iter to struct file_operations
1586 #
1587 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1588 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
1589 file_function_iter, [
1590         #include <linux/fs.h>
1591 ],[
1592         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
1593         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
1594 ],[
1595         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
1596                 [file_operations.[read|write]_iter functions exist])
1597 ])
1598 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1599
1600 #
1601 # LC_HAVE_INTERVAL_BLK_INTEGRITY
1602 #
1603 # 3.17 replace sector_size with interval in struct blk_integrity
1604 #
1605 AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
1606 LB_CHECK_COMPILE([if 'blk_integrity.interval' exist],
1607 interval_blk_integrity, [
1608         #include <linux/blkdev.h>
1609 ],[
1610         ((struct blk_integrity *)0)->interval = 0;
1611 ],[
1612         AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
1613                 [blk_integrity.interval exist])
1614 ])
1615 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
1616
1617 #
1618 # LC_KEY_MATCH_DATA
1619 #
1620 # 3.17  replaces key_type::match with match_preparse
1621 #       and has new struct key_match_data
1622 #
1623 AC_DEFUN([LC_KEY_MATCH_DATA], [
1624 LB_CHECK_COMPILE([if struct key_match field exist],
1625 key_match, [
1626         #include <linux/key-type.h>
1627 ],[
1628         struct key_match_data data;
1629
1630         data.raw_data = NULL;
1631 ],[
1632         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
1633                 [struct key_match_data exist])
1634 ])
1635 ]) # LC_KEY_MATCH_DATA
1636
1637 #
1638 # LC_NFS_FILLDIR_USE_CTX
1639 #
1640 # 3.18 kernel moved from void cookie to struct dir_context
1641 #
1642 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1643 tmp_flags="$EXTRA_KCFLAGS"
1644 EXTRA_KCFLAGS="-Werror"
1645 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
1646 filldir_ctx, [
1647         #include <linux/fs.h>
1648 ],[
1649         int filldir(struct dir_context *ctx, const char* name,
1650                     int i, loff_t off, u64 tmp, unsigned temp)
1651         {
1652                 return 0;
1653         }
1654
1655         struct dir_context ctx = {
1656                 .actor = filldir,
1657         };
1658
1659         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1660 ],[
1661         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1662                 [filldir_t needs struct dir_context as argument])
1663 ])
1664 EXTRA_KCFLAGS="$tmp_flags"
1665 ]) # LC_NFS_FILLDIR_USE_CTX
1666
1667 #
1668 # LC_PERCPU_COUNTER_INIT
1669 #
1670 # 3.18  For kernels 3.18 and after percpu_counter_init starts
1671 #       to pass a GFP_* memory allocation flag for internal
1672 #       memory allocation purposes.
1673 #
1674 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1675 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1676 percpu_counter_init, [
1677         #include <linux/percpu_counter.h>
1678 ],[
1679         percpu_counter_init(NULL, 0, GFP_KERNEL);
1680 ],[
1681         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1682                 [percpu_counter_init uses GFP_* flag])
1683 ])
1684 ]) # LC_PERCPU_COUNTER_INIT
1685
1686 #
1687 # LC_KIOCB_HAS_NBYTES
1688 #
1689 # 3.19 kernel removed ki_nbytes from struct kiocb
1690 #
1691 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1692 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1693 ki_nbytes, [
1694         #include <linux/fs.h>
1695 ],[
1696         struct kiocb iocb = { };
1697
1698         iocb.ki_nbytes = 0;
1699 ],[
1700         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1701 ])
1702 ]) # LC_KIOCB_HAS_NBYTES
1703
1704 #
1705 # LC_HAVE_DQUOT_QC_DQBLK
1706 #
1707 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
1708 # Added in commit 14bf61ffe
1709 #
1710 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
1711 tmp_flags="$EXTRA_KCFLAGS"
1712 EXTRA_KCFLAGS="-Werror"
1713 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
1714 qc_dqblk, [
1715         #include <linux/fs.h>
1716         #include <linux/quota.h>
1717 ],[
1718         ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
1719 ],[
1720         AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
1721                 [quotactl_ops.set_dqblk takes struct qc_dqblk])
1722         AC_DEFINE(HAVE_DQUOT_KQID, 1,
1723                 [quotactl_ops.set_dqblk takes struct kqid])
1724 ])
1725 EXTRA_KCFLAGS="$tmp_flags"
1726 ]) # LC_HAVE_DQUOT_QC_DQBLK
1727
1728 #
1729 # LC_HAVE_AIO_COMPLETE
1730 #
1731 # 3.19 kernel makes aio_complete() static
1732 #
1733 AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
1734 LB_CHECK_COMPILE([if kernel has exported aio_complete() ],
1735 aio_complete, [
1736         #include <linux/aio.h>
1737 ],[
1738         aio_complete(NULL, 0, 0);
1739 ],[
1740         AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
1741 ])
1742 ]) # LC_HAVE_AIO_COMPLETE
1743
1744 #
1745 # LC_BACKING_DEV_INFO_REMOVAL
1746 #
1747 # 3.20 kernel removed backing_dev_info from address_space
1748 #
1749 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1750 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
1751 backing_dev_info, [
1752         #include <linux/fs.h>
1753 ],[
1754         struct address_space mapping;
1755
1756         mapping.backing_dev_info = NULL;
1757 ],[
1758         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1759 ])
1760 ]) # LC_BACKING_DEV_INFO_REMOVAL
1761
1762 #
1763 # LC_HAVE_BDI_CAP_MAP_COPY
1764 #
1765 # 3.20  removed mmap handling for backing devices since
1766 #       it breaks on non-MMU systems. See kernel commit
1767 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
1768 #
1769 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1770 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
1771 bdi_cap_map_copy, [
1772         #include <linux/backing-dev.h>
1773 ],[
1774         struct backing_dev_info info;
1775
1776         info.capabilities = BDI_CAP_MAP_COPY;
1777 ],[
1778         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1779                 [BDI_CAP_MAP_COPY exist])
1780 ])
1781 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1782
1783 #
1784 # LC_IOV_ITER_RW
1785 #
1786 # 4.1 kernel has iov_iter_rw
1787 #
1788 AC_DEFUN([LC_IOV_ITER_RW], [
1789 LB_CHECK_COMPILE([if iov_iter_rw exist],
1790 iov_iter_rw, [
1791         #include <linux/fs.h>
1792         #include <linux/uio.h>
1793 ],[
1794         struct iov_iter *iter = NULL;
1795
1796         iov_iter_rw(iter);
1797 ],[
1798         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1799                 [iov_iter_rw exist])
1800 ])
1801 ]) # LC_IOV_ITER_RW
1802
1803 #
1804 # LC_HAVE_SYNC_READ_WRITE
1805 #
1806 # 4.1 new_sync_[read|write] no longer exported
1807 #
1808 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1809 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1810         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1811                         [new_sync_[read|write] is exported by the kernel])])
1812 ]) # LC_HAVE_SYNC_READ_WRITE
1813
1814 #
1815 # LC_HAVE___BI_CNT
1816 #
1817 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
1818 #
1819 AC_DEFUN([LC_HAVE___BI_CNT], [
1820 LB_CHECK_COMPILE([if Linux kernel has __bi_cnt in struct bio],
1821 have___bi_cnt, [
1822         #include <asm/atomic.h>
1823         #include <linux/bio.h>
1824         #include <linux/blk_types.h>
1825 ],[
1826         struct bio bio = { };
1827         int cnt;
1828         cnt = atomic_read(&bio.__bi_cnt);
1829 ], [
1830         AC_DEFINE(HAVE___BI_CNT, 1,
1831                 [struct bio has __bi_cnt])
1832 ])
1833 ]) # LC_HAVE___BI_CNT
1834
1835 #
1836 # LC_SYMLINK_OPS_USE_NAMEIDATA
1837 #
1838 # For the 4.2+ kernels the file system internal symlink api no
1839 # longer uses struct nameidata as a argument
1840 #
1841 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1842 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
1843 symlink_use_nameidata, [
1844         #include <linux/namei.h>
1845         #include <linux/fs.h>
1846 ],[
1847         struct nameidata *nd = NULL;
1848
1849         ((struct inode_operations *)0)->follow_link(NULL, nd);
1850         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1851 ],[
1852         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1853                 [symlink inode operations need struct nameidata argument])
1854 ])
1855 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1856
1857 #
1858 # LC_BIO_ENDIO_USES_ONE_ARG
1859 #
1860 # 4.2 kernel bio_endio now only takes one argument
1861 #
1862 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1863 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
1864 bio_endio, [
1865         #include <linux/bio.h>
1866 ],[
1867         bio_endio(NULL);
1868 ],[
1869         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1870                 [bio_endio takes only one argument])
1871 ])
1872 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1873
1874 #
1875 # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1876 #
1877 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
1878 #
1879 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1880 LB_CHECK_COMPILE([if 'account_page_dirtied' with 3 args exists],
1881 account_page_dirtied, [
1882         #include <linux/mm.h>
1883 ],[
1884         account_page_dirtied(NULL, NULL, NULL);
1885 ],[
1886         AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
1887                 [account_page_dirtied takes three arguments])
1888 ])
1889 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1890
1891 #
1892 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1893 #
1894 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
1895 # 'struct blk_integrity_profile' is also added in this version,
1896 # thus use this to determine whether 'struct blk_integrity' has profile
1897 #
1898 AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1899 LB_CHECK_COMPILE([if 'blk_integrity.interval_exp' exist],
1900 blk_integrity_interval_exp, [
1901         #include <linux/blkdev.h>
1902 ],[
1903         ((struct blk_integrity *)0)->interval_exp = 0;
1904 ],[
1905         AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
1906                 [blk_integrity.interval_exp exist])
1907 ])
1908 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1909
1910 #
1911 # LC_HAVE_LOOP_CTL_GET_FREE
1912 #
1913 # 4.x kernel have moved userspace APIs to
1914 # the separate directory and all of them
1915 # support LOOP_CTL_GET_FREE
1916 #
1917 AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [
1918 LB_CHECK_FILE([$LINUX/include/linux/loop.h], [
1919         LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'],
1920         LOOP_CTL_GET_FREE, [
1921                 #include <linux/loop.h>
1922         ],[
1923                 int i;
1924
1925                 i = LOOP_CTL_GET_FREE;
1926         ],[
1927                 AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
1928                         [LOOP_CTL_GET_FREE exist])
1929         ])
1930 ],[
1931         AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
1932                 [kernel has LOOP_CTL_GET_FREE])
1933 ])
1934 ]) # LC_HAVE_LOOP_CTL_GET_FREE
1935
1936 #
1937 # LC_HAVE_CACHE_HEAD_HLIST
1938 #
1939 # 4.3 kernel swiched to hlist for cache_head
1940 #
1941 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
1942 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
1943 cache_head_has_hlist, [
1944         #include <linux/sunrpc/cache.h>
1945 ],[
1946         do {} while(sizeof(((struct cache_head *)0)->cache_list));
1947 ],[
1948         AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
1949                 [cache_head has hlist cache_list])
1950 ])
1951 ]) # LC_HAVE_CACHE_HEAD_HLIST
1952
1953 #
1954 # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1955 #
1956 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
1957 # simplified xattr_handler handling by passing in the handler pointer
1958 #
1959 AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1960 tmp_flags="$EXTRA_KCFLAGS"
1961 EXTRA_KCFLAGS="-Werror"
1962 LB_CHECK_COMPILE([if 'struct xattr_handler' functions pass in handler pointer],
1963 xattr_handler_simplified, [
1964         #include <linux/xattr.h>
1965 ],[
1966         struct xattr_handler handler;
1967
1968         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
1969         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
1970 ],[
1971         AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1, [handler pointer is parameter])
1972 ])
1973 EXTRA_KCFLAGS="$tmp_flags"
1974 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1975
1976 #
1977 # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1978 #
1979 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
1980 #
1981 AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1982 LB_CHECK_COMPILE([if 'bio_integrity_payload.bip_iter' exist],
1983 bio_integrity_payload_bip_iter, [
1984         #include <linux/bio.h>
1985 ],[
1986         ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
1987 ],[
1988         AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
1989                 [bio_integrity_payload.bip_iter exist])
1990 ])
1991 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1992
1993 #
1994 # LC_BIO_INTEGRITY_PREP_FN
1995 #
1996 # Lustre kernel patch extents bio_integrity_prep to accept optional
1997 # generate/verify_fn as extra args.
1998 #
1999 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
2000 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' exists],
2001 bio_integrity_prep_fn, [
2002         #include <linux/bio.h>
2003 ],[
2004         bio_integrity_prep_fn(NULL, NULL, NULL);
2005 ],[
2006         AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
2007                 [kernel has bio_integrity_prep_fn])
2008         AC_SUBST(PATCHED_INTEGRITY_INTF)
2009 ],[
2010         AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
2011 ])
2012 ]) # LC_BIO_INTEGRITY_PREP_FN
2013
2014 #
2015 # LC_HAVE_BI_OPF
2016 #
2017 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
2018 #
2019 AC_DEFUN([LC_HAVE_BI_OPF], [
2020 LB_CHECK_COMPILE([if Linux kernel has bi_opf in struct bio],
2021 have_bi_opf, [
2022         #include <linux/bio.h>
2023 ],[
2024         struct bio bio;
2025
2026         bio.bi_opf = 0;
2027 ], [
2028         AC_DEFINE(HAVE_BI_OPF, 1,
2029                 [struct bio has bi_opf])
2030 ])
2031 ]) # LC_HAVE_BI_OPF
2032
2033 #
2034 # LC_HAVE_SUBMIT_BIO_2ARGS
2035 #
2036 # 4.4 removed an argument from submit_bio
2037 #
2038 AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
2039 LB_CHECK_COMPILE([if submit_bio takes two arguments],
2040 have_submit_bio_2args, [
2041         #include <linux/bio.h>
2042 ],[
2043         struct bio bio;
2044         submit_bio(READ, &bio);
2045 ], [
2046         AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
2047                 [submit_bio takes two arguments])
2048 ])
2049 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
2050
2051 #
2052 # LC_HAVE_CLEAN_BDEV_ALIASES
2053 #
2054 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
2055 # (SLES12/kernel commit 29f3ad7d8380364c)
2056 #
2057 AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
2058 LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
2059 have_clean_bdev_aliases, [
2060         #include <linux/buffer_head.h>
2061 ],[
2062         struct block_device bdev;
2063         clean_bdev_aliases(&bdev,1,1);
2064 ], [
2065         AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
2066                 [kernel has clean_bdev_aliases])
2067 ])
2068 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
2069
2070 #
2071 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2072 #
2073 # 4.4 kernel have moved locks API users to
2074 # locks_lock_inode_wait()
2075 #
2076 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
2077 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
2078 locks_lock_file_wait, [
2079         #include <linux/fs.h>
2080 ],[
2081         locks_lock_file_wait(NULL, NULL);
2082 ],[
2083         AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
2084                 [kernel has locks_lock_file_wait])
2085 ])
2086 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2087
2088 #
2089 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2090 #
2091 # 4.4 kernel merged type-specific data with the payload data for keys
2092 #
2093 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
2094 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
2095 key_payload_data_array, [
2096         #include <linux/key.h>
2097 ],[
2098         struct key key = { };
2099
2100         key.payload.data[0] = NULL;
2101 ],[
2102         AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
2103 ])
2104 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2105
2106 #
2107 # LC_HAVE_XATTR_HANDLER_NAME
2108 #
2109 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
2110 # add a name member to struct xattr_handler
2111 #
2112 AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
2113 tmp_flags="$EXTRA_KCFLAGS"
2114 EXTRA_KCFLAGS="-Werror"
2115 LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
2116 xattr_handler_name, [
2117         #include <linux/xattr.h>
2118 ],[
2119         ((struct xattr_handler *)NULL)->name = NULL;
2120 ],[
2121         AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
2122 ])
2123 EXTRA_KCFLAGS="$tmp_flags"
2124 ]) # LC_HAVE_XATTR_HANDLER_NAME
2125
2126 #
2127 # LC_HAVE_FILE_DENTRY
2128 #
2129 # 4.5 adds wrapper file_dentry
2130 #
2131 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
2132 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
2133 file_dentry, [
2134         #include <linux/fs.h>
2135 ],[
2136         file_dentry(NULL);
2137 ], [
2138         AC_DEFINE(HAVE_FILE_DENTRY, 1,
2139                 [kernel has file_dentry])
2140 ])
2141 ]) # LC_HAVE_FILE_DENTRY
2142
2143 #
2144 # LC_HAVE_INODE_LOCK
2145 #
2146 # 4.5 introduced inode_lock
2147 #
2148 AC_DEFUN([LC_HAVE_INODE_LOCK], [
2149 LB_CHECK_COMPILE([if 'inode_lock' is defined],
2150 inode_lock, [
2151         #include <linux/fs.h>
2152 ],[
2153         inode_lock(NULL);
2154 ], [
2155         AC_DEFINE(HAVE_INODE_LOCK, 1,
2156                   [inode_lock is defined])
2157 ])
2158 ]) # LC_HAVE_INODE_LOCK
2159
2160 #
2161 # LC_HAVE_IOP_GET_LINK
2162 #
2163 # 4.5 vfs replaced iop->follow_link with
2164 # iop->get_link
2165 #
2166 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
2167 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
2168 inode_ops_get_link, [
2169         #include <linux/fs.h>
2170 ],[
2171         struct inode_operations iop;
2172         iop.get_link = NULL;
2173 ],[
2174         AC_DEFINE(HAVE_IOP_GET_LINK, 1,
2175                 [have iop get_link])
2176 ])
2177 ]) # LC_HAVE_IOP_GET_LINK
2178
2179 #
2180 # LC_HAVE_IN_COMPAT_SYSCALL
2181 #
2182 # 4.6 renamed is_compat_task to in_compat_syscall
2183 #
2184 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
2185 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
2186 in_compat_syscall, [
2187         #include <linux/compat.h>
2188 ],[
2189         in_compat_syscall();
2190 ],[
2191         AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
2192                 [have in_compat_syscall])
2193 ])
2194 ]) # LC_HAVE_IN_COMPAT_SYSCALL
2195
2196 #
2197 # LC_HAVE_XATTR_HANDLER_INODE_PARAM
2198 #
2199 # Kernel version 4.6 commit b296821a7c42fa58baa17513b2b7b30ae66f3336
2200 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
2201 # to xattr_handler functions
2202 #
2203 AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
2204 tmp_flags="$EXTRA_KCFLAGS"
2205 EXTRA_KCFLAGS="-Werror"
2206 LB_CHECK_COMPILE([if 'struct xattr_handler' functions have inode parameter],
2207 xattr_handler_inode_param, [
2208         #include <linux/xattr.h>
2209 ],[
2210         const struct xattr_handler handler;
2211
2212         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
2213         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
2214 ],[
2215         AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
2216 ])
2217 EXTRA_KCFLAGS="$tmp_flags"
2218 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
2219
2220 #
2221 # LC_D_IN_LOOKUP
2222 #
2223 # Kernel version 4.6 commit 85c7f81041d57cfe9dc97f4680d5586b54534a39
2224 # introduced parallel lookups in the VFS layer. The inline function
2225 # d_in_lookup was added to notify when the same item was being queried
2226 # at the same time.
2227 #
2228 AC_DEFUN([LC_D_IN_LOOKUP], [
2229 tmp_flags="$EXTRA_KCFLAGS"
2230 EXTRA_KCFLAGS="-Werror"
2231 LB_CHECK_COMPILE([if 'd_in_lookup' is defined],
2232 d_in_lookup, [
2233         #include <linux/dcache.h>
2234 ],[
2235         d_in_lookup(NULL);
2236 ],[
2237         AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
2238 ])
2239 EXTRA_KCFLAGS="$tmp_flags"
2240 ]) # LC_D_IN_LOOKUP
2241
2242 #
2243 # LC_LOCK_PAGE_MEMCG
2244 #
2245 # Kernel version 4.6 adds lock_page_memcg
2246 #
2247 AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
2248 LB_CHECK_COMPILE([if 'lock_page_memcg' is defined],
2249 lock_page_memcg, [
2250         #include <linux/memcontrol.h>
2251 ],[
2252         lock_page_memcg(NULL);
2253 ],[
2254         AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1,
2255                 [lock_page_memcg is defined])
2256 ])
2257 ]) # LC_LOCK_PAGE_MEMCG
2258
2259 #
2260 # LC_DIRECTIO_2ARGS
2261 #
2262 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
2263 # direct-io: eliminate the offset argument to ->direct_IO
2264 #
2265 AC_DEFUN([LC_DIRECTIO_2ARGS], [
2266 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
2267 direct_io_2args, [
2268         #include <linux/fs.h>
2269 ],[
2270         struct address_space_operations ops = { };
2271         struct iov_iter *iter = NULL;
2272         struct kiocb *iocb = NULL;
2273         int rc;
2274
2275         rc = ops.direct_IO(iocb, iter);
2276 ],[
2277         AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
2278                 [direct_IO need 2 arguments])
2279 ])
2280 ]) # LC_DIRECTIO_2ARGS
2281
2282 #
2283 # LC_GENERIC_WRITE_SYNC_2ARGS
2284 #
2285 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
2286 # fs: add IOCB_SYNC and IOCB_DSYNC
2287 #
2288 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
2289 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
2290 generic_write_sync_2args, [
2291         #include <linux/fs.h>
2292 ],[
2293         struct kiocb *iocb = NULL;
2294         ssize_t rc;
2295
2296         rc = generic_write_sync(iocb, 0);
2297 ],[
2298         AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
2299                 [generic_write_sync need 2 arguments])
2300 ])
2301 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
2302
2303 #
2304 # LC_FOP_ITERATE_SHARED
2305 #
2306 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
2307 #
2308 AC_DEFUN([LC_FOP_ITERATE_SHARED], [
2309 LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'],
2310 fop_iterate_shared, [
2311         #include <linux/fs.h>
2312 ],[
2313         struct file_operations fop;
2314         fop.iterate_shared = NULL;
2315 ],[
2316         AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
2317                 [file_operations has iterate_shared])
2318 ])
2319 ]) # LC_FOP_ITERATE_SHARED
2320
2321 #
2322 # LC_HAVE_POSIX_ACL_VALID_USER_NS
2323 #
2324 # 4.8 posix_acl_valid takes struct user_namespace
2325 #
2326 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
2327 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
2328 posix_acl_valid, [
2329         #include <linux/fs.h>
2330         #include <linux/posix_acl.h>
2331 ],[
2332         posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
2333 ],[
2334         AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
2335                 [posix_acl_valid takes struct user_namespace])
2336 ])
2337 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
2338
2339 #
2340 # LC_D_COMPARE_4ARGS
2341 #
2342 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
2343 # get rid of 'parent' argument of ->d_compare()
2344 #
2345 AC_DEFUN([LC_D_COMPARE_4ARGS], [
2346 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
2347 d_compare_4args, [
2348         #include <linux/dcache.h>
2349 ],[
2350         ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
2351 ],[
2352         AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
2353                 [d_compare need 4 arguments])
2354 ])
2355 ]) # LC_D_COMPARE_4ARGS
2356
2357 #
2358 # LC_FULL_NAME_HASH_3ARGS
2359 #
2360 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
2361 # vfs: make the string hashes salt the hash
2362 #
2363 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
2364 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
2365 full_name_hash_3args, [
2366         #include <linux/stringhash.h>
2367 ],[
2368         unsigned int hash;
2369         hash = full_name_hash(NULL,NULL,0);
2370 ],[
2371         AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
2372                 [full_name_hash need 3 arguments])
2373 ])
2374 ]) # LC_FULL_NAME_HASH_3ARGS
2375
2376 #
2377 # LC_STRUCT_POSIX_ACL_XATTR
2378 #
2379 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
2380 # posix_acl: xattr representation cleanups
2381 #
2382 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
2383 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
2384 struct_posix_acl_xattr, [
2385         #include <linux/fs.h>
2386         #include <linux/posix_acl_xattr.h>
2387 ],[
2388         struct posix_acl_xattr_header *h = NULL;
2389         struct posix_acl_xattr_entry  *e;
2390         e = (void *)(h + 1);
2391 ],[
2392         AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
2393                 [struct posix_acl_xattr_{header,entry} defined])
2394 ])
2395 ]) # LC_STRUCT_POSIX_ACL_XATTR
2396
2397 #
2398 # LC_IOP_XATTR
2399 #
2400 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
2401 # removed {get,set,remove}xattr inode operations
2402 #
2403 AC_DEFUN([LC_IOP_XATTR], [
2404 LB_CHECK_COMPILE([if 'inode_operations' has {get,set,remove}xattr members],
2405 inode_ops_xattr, [
2406         #include <linux/fs.h>
2407 ],[
2408         struct inode_operations iop;
2409         iop.setxattr = NULL;
2410         iop.getxattr = NULL;
2411         iop.removexattr = NULL;
2412 ],[
2413         AC_DEFINE(HAVE_IOP_XATTR, 1,
2414                 [inode_operations has {get,set,remove}xattr members])
2415 ])
2416 ]) # LC_IOP_XATTR
2417
2418 #
2419 # LC_GROUP_INFO_GID
2420 #
2421 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
2422 # cred: simpler, 1D supplementary groups
2423 #
2424 AC_DEFUN([LC_GROUP_INFO_GID], [
2425 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
2426 group_info_gid, [
2427         #include <linux/cred.h>
2428 ],[
2429         kgid_t *p;
2430         p = ((struct group_info *)0)->gid;
2431 ],[
2432         AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
2433                 [struct group_info has member gid])
2434 ])
2435 ]) # LC_GROUP_INFO_GID
2436
2437 #
2438 # LC_VFS_SETXATTR
2439 #
2440 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
2441 # added __vfs_{get,set,remove}xattr helpers
2442 #
2443 AC_DEFUN([LC_VFS_SETXATTR], [
2444 LB_CHECK_COMPILE([if '__vfs_setxattr' helper is available],
2445 vfs_setxattr, [
2446         #include <linux/xattr.h>
2447 ],[
2448         __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
2449 ],[
2450         AC_DEFINE(HAVE_VFS_SETXATTR, 1,
2451                 ['__vfs_setxattr is available])
2452 ])
2453 ]) # LC_VFS_SETXATTR
2454
2455 #
2456 # LC_POSIX_ACL_UPDATE_MODE
2457 #
2458 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
2459 # posix_acl: Clear SGID bit when setting file permissions
2460 #
2461 AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
2462 LB_CHECK_COMPILE([if 'posix_acl_update_mode' exists],
2463 posix_acl_update_mode, [
2464         #include <linux/fs.h>
2465         #include <linux/posix_acl.h>
2466 ],[
2467         posix_acl_update_mode(NULL, NULL, NULL);
2468 ],[
2469         AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
2470                 ['posix_acl_update_mode' is available])
2471 ])
2472 ]) # LC_POSIX_ACL_UPDATE_MODE
2473
2474 #
2475 # LC_IOP_GENERIC_READLINK
2476 #
2477 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
2478 # removed generic_readlink from individual file systems
2479 #
2480 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
2481 LB_CHECK_COMPILE([if 'generic_readlink' still exist],
2482 inode_ops_readlink, [
2483         #include <linux/fs.h>
2484 ],[
2485         struct inode_operations iop;
2486         iop.readlink = generic_readlink;
2487 ],[
2488         AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
2489                 [generic_readlink has been removed])
2490 ])
2491 ]) # LC_IOP_GENERIC_READLINK
2492
2493 #
2494 # LC_HAVE_VM_FAULT_ADDRESS
2495 #
2496 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
2497 # removed virtual_address field. Need to use address field instead
2498 #
2499 AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
2500 LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field],
2501 vm_fault_address, [
2502         #include <linux/mm.h>
2503 ],[
2504         struct vm_fault vmf;
2505         vmf.address = NULL;
2506 ],[
2507         AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
2508                 [virtual_address has been replaced by address field])
2509 ])
2510 ]) # LC_HAVE_VM_FAULT_ADDRESS
2511
2512 #
2513 # LC_INODEOPS_ENHANCED_GETATTR
2514 #
2515 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
2516 # expanded getattr to be able to get more stat information.
2517 #
2518 AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
2519 LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
2520 getattr_path, [
2521         #include <linux/fs.h>
2522 ],[
2523         struct path path;
2524
2525         ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
2526 ],[
2527         AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
2528                 [inode_operations .getattr member function can gather advance stats])
2529 ])
2530 ]) # LC_INODEOPS_ENHANCED_GETATTR
2531
2532 #
2533 # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2534 #
2535 # Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
2536 # removed struct vm_area_struct as an argument for vm_operations since
2537 # in the same kernel version struct vma_area_struct was folded into
2538 # struct vm_fault.
2539 #
2540 AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
2541 LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
2542 vm_operations_no_vm_area_struct, [
2543         #include <linux/mm.h>
2544 ],[
2545         struct vm_fault vmf;
2546
2547         ((struct vm_operations_struct *)0)->fault(&vmf);
2548         ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
2549 ],[
2550         AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
2551                 ['struct vm_operations' remove struct vm_area_struct argument])
2552 ])
2553 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2554
2555 #
2556 # LC_HAVE_KEY_USAGE_REFCOUNT
2557 #
2558 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
2559 # converted key.usage from atomic_t to refcount_t.
2560 #
2561 AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
2562 LB_CHECK_COMPILE([if 'key.usage' is refcount_t],
2563 key_usage_refcount, [
2564         #include <linux/key.h>
2565 ],[
2566         struct key key = { };
2567
2568         refcount_read(&key.usage);
2569 ],[
2570         AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1, [key.usage is of type refcount_t])
2571 ])
2572 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
2573
2574 #
2575 # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2576 #
2577 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
2578 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
2579 #
2580 AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
2581 LB_CHECK_COMPILE([if 'CRYPTO_MAX_ALG_NAME' is 128],
2582 crypto_max_alg_name, [
2583         #include <linux/crypto.h>
2584 ],[
2585         #if CRYPTO_MAX_ALG_NAME != 128
2586         exit(1);
2587         #endif
2588 ],[
2589         AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
2590                 ['CRYPTO_MAX_ALG_NAME' is 128])
2591 ])
2592 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2593
2594 #
2595 # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876
2596 # CURRENT_TIME is not 64 bit time safe so it was replaced with
2597 # current_time()
2598 #
2599 AC_DEFUN([LC_CURRENT_TIME], [
2600 LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
2601 current_time, [
2602         #include <linux/fs.h>
2603 ],[
2604         struct iattr attr;
2605
2606         attr.ia_atime = current_time(NULL);
2607 ],[
2608         AC_DEFINE(HAVE_CURRENT_TIME, 1,
2609                 [current_time() has replaced CURRENT_TIME])
2610 ])
2611 ]) # LIBCFS_CURRENT_TIME
2612
2613 #
2614 # Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
2615 # changed struct super_block s_uuid into a proper uuid_t
2616 #
2617 AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
2618 LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
2619 super_block_s_uuid, [
2620         #include <linux/fs.h>
2621 ],[
2622         struct super_block sb;
2623
2624         uuid_parse(NULL, &sb.s_uuid);
2625 ],[
2626         AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
2627 ])
2628 ]) # LC_SUPER_BLOCK_S_UUID
2629
2630 #
2631 # LC_SUPER_SETUP_BDI_NAME
2632 #
2633 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
2634 # unified bdi handling
2635 #
2636 AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
2637 LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
2638 super_setup_bdi_name, [
2639         #include <linux/fs.h>
2640 ],[
2641         super_setup_bdi_name(NULL, "lustre");
2642 ],[
2643         AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
2644                 ['super_setup_bdi_name' is available])
2645 ])
2646 ]) # LC_SUPER_SETUP_BDI_NAME
2647
2648 #
2649 # LC_BI_STATUS
2650 #
2651 # 4.12 replace bi_error to bi_status
2652 #
2653 AC_DEFUN([LC_BI_STATUS], [
2654 LB_CHECK_COMPILE([if 'bi_status' exist],
2655 bi_status, [
2656         #include <linux/blk_types.h>
2657 ],[
2658         ((struct bio *)0)->bi_status = 0;
2659 ],[
2660         AC_DEFINE(HAVE_BI_STATUS, 1,
2661                 ['bi_status' is available])
2662 ])
2663 ]) # LC_BI_STATUS
2664
2665 #
2666 # LC_BIO_INTEGRITY_ENABLED
2667 #
2668 # 4.13 removed bio_integrity_enabled
2669 #
2670 AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
2671 LB_CHECK_COMPILE([if 'bio_integrity_enabled' exist],
2672 bio_integrity_enabled, [
2673         #include <linux/bio.h>
2674 ],[
2675         bio_integrity_enabled(NULL);
2676 ],[
2677         AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
2678                 ['bio_integrity_enabled' is available])
2679 ])
2680 ]) # LC_BIO_INTEGRITY_ENABLED
2681
2682 #
2683 # LC_PAGEVEC_INIT_ONE_PARAM
2684 #
2685 # 4.14 pagevec_init takes one parameter
2686 #
2687 AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
2688 LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter],
2689 pagevec_init, [
2690         #include <linux/pagevec.h>
2691 ],[
2692         pagevec_init(NULL);
2693 ],[
2694         AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
2695                 ['pagevec_init' takes one parameter])
2696 ])
2697 ]) # LC_PAGEVEC_INIT_ONE_PARAM
2698
2699 #
2700 # LC_BI_BDEV
2701 #
2702 # 4.14 replaced bi_bdev to bi_disk
2703 #
2704 AC_DEFUN([LC_BI_BDEV], [
2705 LB_CHECK_COMPILE([if 'bi_bdev' exist],
2706 bi_bdev, [
2707         #include <linux/bio.h>
2708 ],[
2709         ((struct bio *)0)->bi_bdev = NULL;
2710 ],[
2711         AC_DEFINE(HAVE_BI_BDEV, 1,
2712                 ['bi_bdev' is available])
2713 ])
2714 ]) # LC_BI_BDEV
2715
2716 #
2717 # LC_I_PAGES
2718 #
2719 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
2720 #
2721 AC_DEFUN([LC_I_PAGES], [
2722 LB_CHECK_COMPILE([if struct address_space has i_pages],
2723 i_pages, [
2724         #include <linux/fs.h>
2725 ],[
2726         struct address_space mapping = {};
2727         void *i_pages;
2728
2729         i_pages = &mapping.i_pages;
2730 ],[
2731         AC_DEFINE(HAVE_I_PAGES, 1,
2732                 [struct address_space has i_pages])
2733 ])
2734 ]) # LC_I_PAGES
2735
2736 #
2737 # LC_VM_FAULT_T
2738 #
2739 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2740 # mm: create the new vm_fault_t type
2741 #
2742 AC_DEFUN([LC_VM_FAULT_T], [
2743 LB_CHECK_COMPILE([if vm_fault_t type exists],
2744 vm_fault_t, [
2745         #include <linux/mm_types.h>
2746 ],[
2747         vm_fault_t x = VM_FAULT_SIGBUS;
2748         (void)x
2749 ],[
2750         AC_DEFINE(HAVE_VM_FAULT_T, 1,
2751                 [if vm_fault_t type exists])
2752 ])
2753 ]) # LC_VM_FAULT_T
2754
2755 #
2756 # LC_INODE_TIMESPEC64
2757 #
2758 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
2759 # fs: add timespec64_truncate()
2760 # kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
2761 # inode timestamps switched to timespec64
2762 # kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
2763 # y2038: remove unused time interfaces
2764 # ...
2765 #  timespec_trunc
2766 # ...
2767 # When inode times are timespec64 stop using the deprecated
2768 # time interfaces.
2769 #
2770 AC_DEFUN([LC_INODE_TIMESPEC64], [
2771 tmp_flags="$EXTRA_KCFLAGS"
2772 EXTRA_KCFLAGS="-Werror"
2773 LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
2774 inode_timespec64, [
2775         #include <linux/fs.h>
2776 ],[
2777         struct inode *inode = NULL;
2778         struct timespec64 ts = {};
2779
2780         inode->i_atime = timespec64_trunc(ts, 1);
2781         (void)inode;
2782 ],[
2783         AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
2784                 [inode times are using timespec64])
2785 ])
2786 EXTRA_KCFLAGS="$tmp_flags"
2787 ]) # LC_INODE_TIMESPEC64
2788
2789 #
2790 # LC_XA_IS_VALUE
2791 # kernel 4.19-rc6 commit 3159f943aafdbacb2f94c38fdaadabf2bbde2a14
2792 # xarray: Replace exceptional entries
2793 # adds xa_is_value
2794 #
2795 AC_DEFUN([LC_XA_IS_VALUE], [
2796 LB_CHECK_COMPILE([xa_is_value exist],
2797 xa_is_value, [
2798         #include <linux/xarray.h>
2799 ],[
2800         xa_is_value(NULL);
2801 ],[
2802         AC_DEFINE(HAVE_XA_IS_VALUE, 1, [xa_is_value exist])
2803 ])
2804 ]) # LC_XA_IS_VALUE
2805
2806 #
2807 # LC___XA_SET_MARK
2808 #
2809 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
2810 # xarray: Add XArray marks
2811 #
2812 AC_DEFUN([LC___XA_SET_MARK], [
2813 LB_CHECK_COMPILE([if '__xa_set_mark' exists],
2814 __xa_set_mark, [
2815         #include <linux/xarray.h>
2816         #include <linux/fs.h>
2817 ],[
2818         struct xarray *xa = NULL;
2819
2820         __xa_set_mark(xa, 0, PAGECACHE_TAG_DIRTY);
2821 ],[
2822         AC_DEFINE(HAVE___XA_SET_MARK, 1,
2823                 [__xa_set_mark exists])
2824 ])
2825 ]) # LC___XA_SET_MARK
2826
2827 #
2828 # LC_UAPI_LINUX_MOUNT_H
2829 #
2830 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
2831 # vfs: Suppress MS_* flag defs within the kernel ...
2832 #
2833 AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
2834 tmp_flags="$EXTRA_KCFLAGS"
2835 EXTRA_KCFLAGS="-Werror"
2836 LB_CHECK_COMPILE([if MS_RDONLY was moved to uapi/linux/mount.h],
2837 uapi_linux_mount, [
2838         #include <uapi/linux/mount.h>
2839 ],[
2840         int x = MS_RDONLY;
2841         (void)x;
2842 ],[
2843         AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
2844                 [if MS_RDONLY was moved to uapi/linux/mount.h])
2845 ])
2846 EXTRA_KCFLAGS="$tmp_flags"
2847 ]) # LC_UAPI_LINUX_MOUNT_H
2848
2849 #
2850 # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2851 #
2852 # kernel 4.20 commit 1863d77f15da0addcd293a1719fa5d3ef8cde3ca
2853 # SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock
2854 #
2855 # Now that the reader functions are all RCU protected, use a regular
2856 # spinlock rather than a reader/writer lock.
2857 #
2858 AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2859 tmp_flags="$EXTRA_KCFLAGS"
2860 EXTRA_KCFLAGS="-Werror"
2861 LB_CHECK_COMPILE([if cache_detail->hash_lock is a spinlock],
2862 hash_lock_isa_spinlock_t, [
2863         #include <linux/sunrpc/cache.h>
2864 ],[
2865         spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
2866         spin_lock(lock);
2867 ],[
2868         AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
2869                 [if cache_detail->hash_lock is a spinlock])
2870 ])
2871 EXTRA_KCFLAGS="$tmp_flags"
2872 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2873
2874 #
2875 # LC_HAS_LINUX_SELINUX_ENABLED
2876 #
2877 # kernel 5.1 commit 3d252529480c68bfd6a6774652df7c8968b28e41
2878 # SELinux: Remove unused selinux_is_enabled
2879 #
2880 AC_DEFUN([LC_HAS_LINUX_SELINUX_ENABLED], [
2881 tmp_flags="$EXTRA_KCFLAGS"
2882 EXTRA_KCFLAGS="-Werror"
2883 LB_CHECK_COMPILE([if linux/selinux.h exists],
2884 selinux_is_enabled, [
2885         #include <linux/selinux.h>
2886 ],[
2887         bool has_selinux = selinux_is_enabled();
2888         (void)has_selinux;
2889 ],[
2890         AC_DEFINE(HAVE_LINUX_SELINUX_IS_ENABLED, 1,
2891                 [if linux/selinux.h exists])
2892 ])
2893 EXTRA_KCFLAGS="$tmp_flags"
2894 ]) # LC_HAS_LINUX_SELINUX_ENABLED
2895
2896 #
2897 # LC_ACCOUNT_PAGE_DIRTIED
2898 #
2899 # After 5.2 kernel page dirtied is not exported
2900 #
2901 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
2902 LB_CHECK_COMPILE([if 'account_page_dirtied' is exported],
2903 account_page_dirtied, [
2904         #include <linux/mm.h>
2905 ],[
2906         account_page_dirtied(NULL, NULL);
2907 ],[
2908         AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED, 1,
2909                 [account_page_dirtied is available])
2910 ])
2911 ]) # LC_ACCOUNT_PAGE_DIRTIED
2912
2913 #
2914 # LC_BIO_BI_PHYS_SEGMENTS
2915 #
2916 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
2917 # block: remove the bi_phys_segments field in struct bio
2918 #
2919 AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
2920 tmp_flags="$EXTRA_KCFLAGS"
2921 EXTRA_KCFLAGS="-Werror"
2922 LB_CHECK_COMPILE([if struct bio has bi_phys_segments member],
2923 bye_bio_bi_phys_segments, [
2924         #include <linux/bio.h>
2925 ],[
2926         struct bio *bio = NULL;
2927         bio->bi_phys_segments++;
2928 ],[
2929         AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
2930                 [struct bio has bi_phys_segments member])
2931 ])
2932 EXTRA_KCFLAGS="$tmp_flags"
2933 ]) # LC_BIO_BI_PHYS_SEGMENTS
2934
2935 #
2936 # LC_LM_COMPARE_OWNER_EXISTS
2937 #
2938 # kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
2939 # locks: Cleanup lm_compare_owner and lm_owner_key
2940 # removed lm_compare_owner
2941 #
2942 AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
2943 tmp_flags="$EXTRA_KCFLAGS"
2944 EXTRA_KCFLAGS="-Werror"
2945 LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
2946 lock_manager_ops_lm_compare_owner, [
2947         #include <linux/fs.h>
2948 ],[
2949         struct lock_manager_operations lm_ops;
2950         lm_ops.lm_compare_owner = NULL;
2951 ],[
2952         AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
2953                 [lock_manager_operations has lm_compare_owner])
2954 ])
2955 EXTRA_KCFLAGS="$tmp_flags"
2956 ]) # LC_LM_COMPARE_OWNER_EXISTS
2957
2958 #
2959 # LC_PROG_LINUX
2960 #
2961 # Lustre linux kernel checks
2962 #
2963 AC_DEFUN([LC_PROG_LINUX], [
2964         AC_MSG_NOTICE([Lustre kernel checks
2965 ==============================================================================])
2966
2967         LC_CONFIG_PINGER
2968         LC_CONFIG_CHECKSUM
2969         LC_CONFIG_FLOCK
2970         LC_CONFIG_HEALTH_CHECK_WRITE
2971         LC_CONFIG_LRU_RESIZE
2972
2973         LC_GLIBC_SUPPORT_FHANDLES
2974         LC_CONFIG_GSS
2975         LC_OPENSSL_SSK
2976         LC_OPENSSL_GETSEPOL
2977
2978         # 2.6.39
2979         LC_HAVE_FHANDLE_SYSCALLS
2980         LC_HAVE_FSTYPE_MOUNT
2981         LC_HAVE_INODE_OWNER_OR_CAPABLE
2982         LC_HAVE_SECURITY_IINITSEC
2983         LC_VFS_CREATE_USE_NAMEIDATA
2984
2985         # 3.0
2986         LC_DIRTY_INODE_WITH_FLAG
2987         LC_SETNS
2988
2989         # 3.1
2990         LC_LM_XXX_LOCK_MANAGER_OPS
2991         LC_INODE_DIO_WAIT
2992         LC_IOP_GET_ACL
2993         LC_FILE_LLSEEK_SIZE
2994         LC_INODE_PERMISION_2ARGS
2995         LC_RADIX_EXCEPTION_ENTRY
2996         LC_HAVE_LOOP_CTL_GET_FREE
2997
2998         # 3.2
2999         LC_HAVE_PROTECT_I_NLINK
3000
3001         # 3.3
3002         LC_HAVE_MIGRATE_HEADER
3003         LC_MIGRATEPAGE_4ARGS
3004         LC_SUPEROPS_USE_DENTRY
3005         LC_INODEOPS_USE_UMODE_T
3006         LC_HAVE_CACHE_REGISTER
3007
3008         # 3.4
3009         LC_HAVE_D_MAKE_ROOT
3010         LC_KMAP_ATOMIC_HAS_1ARG
3011
3012         # 3.5
3013         LC_HAVE_CLEAR_INODE
3014         LC_HAVE_ENCODE_FH_PARENT
3015         LC_FILE_LLSEEK_SIZE_5ARG
3016
3017         # 3.6
3018         LC_DATA_FOR_LLITE_IS_LIST
3019         LC_DENTRY_OPEN_USE_PATH
3020         LC_HAVE_IOP_ATOMIC_OPEN
3021         LC_HAVE_SB_START_WRITE
3022
3023         # 3.7
3024         LC_HAVE_POSIXACL_USER_NS
3025
3026         # 3.8
3027         LC_HAVE_FILE_F_INODE
3028         LC_HAVE_FILE_INODE
3029         LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
3030
3031         # 3.9
3032         LC_HAVE_HLIST_FOR_EACH_3ARG
3033         LC_HAVE_BIO_END_SECTOR
3034         LC_HAVE_IS_SXID
3035         LC_HAVE_VFS_GETATTR_2ARGS
3036
3037         # 3.10
3038         LC_HAVE_REMOVE_PROC_SUBTREE
3039         LC_HAVE_PROC_REMOVE
3040         LC_HAVE_PROJECT_QUOTA
3041         LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
3042         LC_HAVE_SECURITY_INODE_LISTSECURITY
3043
3044         # 3.11
3045         LC_INVALIDATE_RANGE
3046         LC_HAVE_DIR_CONTEXT
3047         LC_D_COMPARE_5ARGS
3048         LC_HAVE_DCOUNT
3049         LC_HAVE_DENTRY_D_U_D_ALIAS
3050         LC_HAVE_DENTRY_D_CHILD
3051         LC_PID_NS_FOR_CHILDREN
3052
3053         # 3.12
3054         LC_OLDSIZE_TRUNCATE_PAGECACHE
3055         LC_PTR_ERR_OR_ZERO_MISSING
3056         LC_KIOCB_KI_LEFT
3057         LC_INIT_LIST_HEAD_RCU
3058
3059         # 3.13
3060         LC_VFS_RENAME_5ARGS
3061         LC_VFS_UNLINK_3ARGS
3062         LC_HAVE_D_IS_POSITIVE
3063
3064         # 3.14
3065         LC_HAVE_BVEC_ITER
3066         LC_HAVE_TRUNCATE_IPAGES_FINAL
3067         LC_IOPS_RENAME_WITH_FLAGS
3068         LC_IOP_SET_ACL
3069
3070         # 3.15
3071         LC_VFS_RENAME_6ARGS
3072
3073         # 3.16
3074         LC_DIRECTIO_USE_ITER
3075         LC_HAVE_IOV_ITER_INIT_DIRECTION
3076         LC_HAVE_IOV_ITER_TRUNCATE
3077         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
3078
3079         # 3.17
3080         LC_HAVE_INTERVAL_BLK_INTEGRITY
3081         LC_KEY_MATCH_DATA
3082
3083         # 3.18
3084         LC_PERCPU_COUNTER_INIT
3085         LC_NFS_FILLDIR_USE_CTX
3086
3087         # 3.19
3088         LC_KIOCB_HAS_NBYTES
3089         LC_HAVE_DQUOT_QC_DQBLK
3090         LC_HAVE_AIO_COMPLETE
3091
3092         # 3.20
3093         LC_BACKING_DEV_INFO_REMOVAL
3094         LC_HAVE_BDI_CAP_MAP_COPY
3095
3096         # 4.1.0
3097         LC_IOV_ITER_RW
3098         LC_HAVE_SYNC_READ_WRITE
3099         LC_HAVE___BI_CNT
3100
3101         # 4.2
3102         LC_BIO_ENDIO_USES_ONE_ARG
3103         LC_SYMLINK_OPS_USE_NAMEIDATA
3104         LC_ACCOUNT_PAGE_DIRTIED_3ARGS
3105
3106         # 4.3
3107         LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
3108         LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
3109         LC_HAVE_CACHE_HEAD_HLIST
3110         LC_HAVE_XATTR_HANDLER_SIMPLIFIED
3111
3112         # 4.4
3113         LC_HAVE_LOCKS_LOCK_FILE_WAIT
3114         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
3115         LC_HAVE_XATTR_HANDLER_NAME
3116         LC_HAVE_BI_OPF
3117         LC_HAVE_SUBMIT_BIO_2ARGS
3118         LC_HAVE_CLEAN_BDEV_ALIASES
3119
3120         # 4.5
3121         LC_HAVE_FILE_DENTRY
3122
3123         # 4.5
3124         LC_HAVE_INODE_LOCK
3125         LC_HAVE_IOP_GET_LINK
3126
3127         # 4.6
3128         LC_HAVE_IN_COMPAT_SYSCALL
3129         LC_HAVE_XATTR_HANDLER_INODE_PARAM
3130         LC_LOCK_PAGE_MEMCG
3131
3132         # 4.7
3133         LC_D_IN_LOOKUP
3134         LC_DIRECTIO_2ARGS
3135         LC_GENERIC_WRITE_SYNC_2ARGS
3136         LC_FOP_ITERATE_SHARED
3137
3138         # 4.8
3139         LC_HAVE_POSIX_ACL_VALID_USER_NS
3140         LC_D_COMPARE_4ARGS
3141         LC_FULL_NAME_HASH_3ARGS
3142         LC_STRUCT_POSIX_ACL_XATTR
3143         LC_IOP_XATTR
3144
3145         # 4.9
3146         LC_GROUP_INFO_GID
3147         LC_VFS_SETXATTR
3148         LC_POSIX_ACL_UPDATE_MODE
3149
3150         # 4.10
3151         LC_IOP_GENERIC_READLINK
3152         LC_HAVE_VM_FAULT_ADDRESS
3153
3154         # 4.11
3155         LC_INODEOPS_ENHANCED_GETATTR
3156         LC_VM_OPERATIONS_REMOVE_VMF_ARG
3157         LC_HAVE_KEY_USAGE_REFCOUNT
3158         LC_HAVE_CRYPTO_MAX_ALG_NAME_128
3159
3160         # 4.12
3161         LC_CURRENT_TIME
3162         LC_SUPER_BLOCK_S_UUID
3163         LC_SUPER_SETUP_BDI_NAME
3164         LC_BI_STATUS
3165
3166         # 4.13
3167         LC_BIO_INTEGRITY_ENABLED
3168
3169         # 4.14
3170         LC_PAGEVEC_INIT_ONE_PARAM
3171         LC_BI_BDEV
3172
3173         # 4.17
3174         LC_VM_FAULT_T
3175         LC_I_PAGES
3176
3177         # 4.18
3178         LC_INODE_TIMESPEC64
3179         LC_XA_IS_VALUE
3180
3181         # 4.20
3182         LC___XA_SET_MARK
3183         LC_UAPI_LINUX_MOUNT_H
3184         LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
3185
3186         # 5.1
3187         LC_HAS_LINUX_SELINUX_ENABLED
3188
3189         # 5.2
3190         LC_ACCOUNT_PAGE_DIRTIED
3191
3192         # 5.3
3193         LC_BIO_BI_PHYS_SEGMENTS
3194         LC_LM_COMPARE_OWNER_EXISTS
3195
3196         # kernel patch to extend integrity interface
3197         LC_BIO_INTEGRITY_PREP_FN
3198
3199         #
3200         AS_IF([test "x$enable_server" != xno], [
3201                 LC_STACK_SIZE
3202                 LC_QUOTA_CONFIG
3203         ])
3204         LC_POSIX_ACL_CONFIG
3205 ]) # LC_PROG_LINUX
3206
3207 #
3208 # LC_CONFIG_CLIENT
3209 #
3210 # Check whether to build the client side of Lustre
3211 #
3212 AC_DEFUN([LC_CONFIG_CLIENT], [
3213 AC_MSG_CHECKING([whether to build Lustre client support])
3214 AC_ARG_ENABLE([client],
3215         AC_HELP_STRING([--disable-client],
3216                 [disable Lustre client support]),
3217         [], [enable_client="yes"])
3218 AC_MSG_RESULT([$enable_client])
3219 ]) # LC_CONFIG_CLIENT
3220
3221 #
3222 # --enable-mpitests
3223 #
3224 AC_DEFUN([LB_CONFIG_MPITESTS], [
3225 AC_ARG_ENABLE([mpitests],
3226         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
3227                        [include mpi tests]), [
3228                 enable_mpitests="yes"
3229                 case $enableval in
3230                 yes)
3231                         MPICC_WRAPPER="mpicc"
3232                         MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
3233                         ;;
3234                 no)
3235                         enable_mpitests="no"
3236                         MPI_BIN=""
3237                         ;;
3238                 *)
3239                         MPICC_WRAPPER=$enableval
3240                         MPI_BIN=$(eval echo $MPICC_WRAPPER | xargs dirname)
3241                         ;;
3242                 esac
3243         ], [
3244                 enable_mpitests="yes"
3245                 MPICC_WRAPPER="mpicc"
3246                 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
3247         ])
3248
3249         if test "x$enable_mpitests" != "xno"; then
3250                 oldcc=$CC
3251                 CC=$MPICC_WRAPPER
3252                 AC_CACHE_CHECK([whether mpitests can be built],
3253                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
3254                         #include <mpi.h>
3255                         int main(void) {
3256                                 int flag;
3257                                 MPI_Initialized(&flag);
3258                                 return 0;
3259                         }
3260                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
3261                 ])
3262                 enable_mpitests=$lb_cv_mpi_tests
3263                 CC=$oldcc
3264         fi
3265         AC_SUBST(MPI_BIN)
3266         AC_SUBST(MPICC_WRAPPER)
3267 ]) # LB_CONFIG_MPITESTS
3268
3269 #
3270 # LC_CONFIG_QUOTA
3271 #
3272 # whether to enable quota support global control
3273 #
3274 AC_DEFUN([LC_CONFIG_QUOTA], [
3275 AC_MSG_CHECKING([whether to enable quota support global control])
3276 AC_ARG_ENABLE([quota],
3277         AC_HELP_STRING([--enable-quota],
3278                 [enable quota support]),
3279         [], [enable_quota="yes"])
3280 AS_IF([test "x$enable_quota" = xyes],
3281         [AC_MSG_RESULT([yes])],
3282         [AC_MSG_RESULT([no])])
3283 ]) # LC_CONFIG_QUOTA
3284
3285 #
3286 # LC_QUOTA
3287 #
3288 AC_DEFUN([LC_QUOTA], [
3289 #check global
3290 LC_CONFIG_QUOTA
3291 #check for utils
3292 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
3293         AC_CHECK_HEADER([sys/quota.h],
3294                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
3295                         [Define to 1 if you have <sys/quota.h>.])],
3296                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
3297 ])
3298 ]) # LC_QUOTA
3299
3300 #
3301 # LC_OSD_ADDON
3302 #
3303 # configure support for optional OSD implementation
3304 #
3305 AC_DEFUN([LC_OSD_ADDON], [
3306 AC_MSG_CHECKING([whether to use OSD addon])
3307 AC_ARG_WITH([osd],
3308         AC_HELP_STRING([--with-osd=path],
3309                 [set path to optional osd]),
3310         [
3311         case "$with_osd" in
3312         no)
3313                 ENABLEOSDADDON=0
3314                 ;;
3315         *)
3316                 OSDADDON="$with_osd"
3317                 ENABLEOSDADDON=1
3318                 ;;
3319         esac
3320         ], [
3321                 ENABLEOSDADDON=0
3322         ])
3323 AS_IF([test $ENABLEOSDADDON -eq 0], [
3324         AC_MSG_RESULT([no])
3325         OSDADDON=""
3326 ], [
3327         OSDMODNAME=$(basename $OSDADDON)
3328         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
3329                 AC_MSG_RESULT([can't link])
3330                 OSDADDON=""
3331         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
3332                 AC_MSG_RESULT([$OSDMODNAME])
3333                 OSDADDON="obj-m += $OSDMODNAME/"
3334         ], [
3335                 AC_MSG_RESULT([can't link])
3336                 OSDADDON=""
3337         ])
3338 ])
3339 AC_SUBST(OSDADDON)
3340 ]) # LC_OSD_ADDON
3341
3342 #
3343 # LC_CONFIGURE
3344 #
3345 # other configure checks
3346 #
3347 AC_DEFUN([LC_CONFIGURE], [
3348 AC_MSG_NOTICE([Lustre core checks
3349 ==============================================================================])
3350
3351 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
3352         [CFLAGS="$CFLAGS -Wall -Werror"])
3353
3354 # maximum MDS thread count
3355 LC_MDS_MAX_THREADS
3356
3357 # lustre/utils/gss/gss_util.c
3358 # lustre/utils/gss/gssd_proc.c
3359 # lustre/utils/gss/krb5_util.c
3360 # lustre/utils/llog_reader.c
3361 # lustre/utils/create_iam.c
3362 # lustre/utils/libiam.c
3363 AC_CHECK_HEADERS([netdb.h endian.h])
3364 AC_CHECK_FUNCS([gethostbyname])
3365
3366 # lustre/utils/llverfs.c
3367 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
3368
3369 # lustre/utils/lfs.c
3370 AS_IF([test "$enable_dist" = "no"], [
3371                 AC_CHECK_LIB([z], [crc32], [
3372                                  AC_CHECK_HEADER([zlib.h], [], [
3373                                                  AC_MSG_ERROR([zlib.h not found.])])
3374                                  ], [
3375                                  AC_MSG_ERROR([
3376                 zlib library not found. Please install zlib development package.])
3377                 ])
3378 ])
3379
3380 SELINUX=""
3381
3382 AC_CHECK_LIB([selinux], [is_selinux_enabled],
3383         [AC_CHECK_HEADERS([selinux/selinux.h],
3384                         [SELINUX="-lselinux"
3385                         AC_DEFINE([HAVE_SELINUX], 1,
3386                                 [support for selinux ])],
3387                         [AC_MSG_WARN([
3388
3389 No libselinux-devel package found, unable to build selinux enabled tools
3390 ])
3391 ])],
3392         [AC_MSG_WARN([
3393
3394 No selinux package found, unable to build selinux enabled tools
3395 ])
3396 ])
3397 AC_SUBST(SELINUX)
3398
3399 # Super safe df
3400 AC_MSG_CHECKING([whether to report minimum OST free space])
3401 AC_ARG_ENABLE([mindf],
3402         AC_HELP_STRING([--enable-mindf],
3403                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
3404         [], [enable_mindf="no"])
3405 AC_MSG_RESULT([$enable_mindf])
3406 AS_IF([test "$enable_mindf" = "yes"],
3407         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
3408
3409 AC_MSG_CHECKING([whether to randomly failing memory alloc])
3410 AC_ARG_ENABLE([fail_alloc],
3411         AC_HELP_STRING([--disable-fail-alloc],
3412                 [disable randomly alloc failure]),
3413         [], [enable_fail_alloc="yes"])
3414 AC_MSG_RESULT([$enable_fail_alloc])
3415 AS_IF([test "x$enable_fail_alloc" != xno],
3416         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
3417                 [enable randomly alloc failure])])
3418
3419 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
3420 AC_ARG_ENABLE([invariants],
3421         AC_HELP_STRING([--enable-invariants],
3422                 [enable invariant checking (cpu intensive)]),
3423         [], [enable_invariants="no"])
3424 AC_MSG_RESULT([$enable_invariants])
3425 AS_IF([test "x$enable_invariants" = xyes],
3426         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
3427                 [enable invariant checking])])
3428
3429 AC_MSG_CHECKING([whether to track references with lu_ref])
3430 AC_ARG_ENABLE([lu_ref],
3431         AC_HELP_STRING([--enable-lu_ref],
3432                 [enable lu_ref reference tracking code]),
3433         [], [enable_lu_ref="no"])
3434 AC_MSG_RESULT([$enable_lu_ref])
3435 AS_IF([test "x$enable_lu_ref" = xyes],
3436         [AC_DEFINE([USE_LU_REF], 1,
3437                 [enable lu_ref reference tracking code])])
3438
3439 AC_MSG_CHECKING([whether to enable page state tracking])
3440 AC_ARG_ENABLE([pgstate-track],
3441         AC_HELP_STRING([--enable-pgstate-track],
3442                 [enable page state tracking]),
3443         [], [enable_pgstat_track="no"])
3444 AC_MSG_RESULT([$enable_pgstat_track])
3445 AS_IF([test "x$enable_pgstat_track" = xyes],
3446         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
3447                 [enable page state tracking code])])
3448
3449 PKG_PROG_PKG_CONFIG
3450 AC_MSG_CHECKING([systemd unit file directory])
3451 AC_ARG_WITH([systemdsystemunitdir],
3452         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
3453                 [Directory for systemd service files])],
3454         [], [with_systemdsystemunitdir=auto])
3455 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
3456         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
3457         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
3458                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
3459                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
3460                 with_systemdsystemunitdir=no],
3461         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
3462 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
3463         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
3464 AC_MSG_RESULT([$with_systemdsystemunitdir])
3465
3466 AC_MSG_CHECKING([bash-completion directory])
3467 AC_ARG_WITH([bash-completion-dir],
3468         AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
3469                 [Install the bash auto-completion script in this directory.]),
3470         [],
3471         [with_bash_completion_dir=yes])
3472 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
3473         BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
3474         AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
3475                 [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]
3476         ])
3477 ], [
3478         BASH_COMPLETION_DIR="$with_bash_completion_dir"
3479 ])
3480 AC_SUBST([BASH_COMPLETION_DIR])
3481 AC_MSG_RESULT([$BASH_COMPLETION_DIR])
3482 ]) # LC_CONFIGURE
3483
3484 #
3485 # LC_CONDITIONALS
3486 #
3487 # AM_CONDITIONALS for lustre
3488 #
3489 AC_DEFUN([LC_CONDITIONALS], [
3490 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
3491 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
3492 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
3493 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
3494 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
3495 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
3496 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
3497 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
3498 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
3499 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
3500 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
3501 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno")
3502 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
3503 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
3504 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
3505 ]) # LC_CONDITIONALS
3506
3507 #
3508 # LC_CONFIG_FILES
3509 #
3510 # files that should be generated with AC_OUTPUT
3511 #
3512 AC_DEFUN([LC_CONFIG_FILES],
3513 [AC_CONFIG_FILES([
3514 lustre/Makefile
3515 lustre/autoMakefile
3516 lustre/autoconf/Makefile
3517 lustre/conf/Makefile
3518 lustre/conf/resource/Makefile
3519 lustre/contrib/Makefile
3520 lustre/doc/Makefile
3521 lustre/include/Makefile
3522 lustre/include/lustre/Makefile
3523 lustre/include/uapi/linux/lustre/Makefile
3524 lustre/kernel_patches/targets/4.18-rhel8.1.target
3525 lustre/kernel_patches/targets/4.18-rhel8.target
3526 lustre/kernel_patches/targets/3.10-rhel7.7.target
3527 lustre/kernel_patches/targets/3.10-rhel7.6.target
3528 lustre/kernel_patches/targets/3.10-rhel7.5.target
3529 lustre/kernel_patches/targets/4.14-rhel7.5.target
3530 lustre/kernel_patches/targets/4.14-rhel7.6.target
3531 lustre/kernel_patches/targets/3.0-sles11.target
3532 lustre/kernel_patches/targets/3.0-sles11sp3.target
3533 lustre/kernel_patches/targets/3.0-sles11sp4.target
3534 lustre/kernel_patches/targets/3.12-sles12.target
3535 lustre/kernel_patches/targets/4.4-sles12.target
3536 lustre/kernel_patches/targets/4.4-sles12sp3.target
3537 lustre/kernel_patches/targets/4.12-sles12sp4.target
3538 lustre/kernel_patches/targets/3.x-fc18.target
3539 lustre/ldlm/Makefile
3540 lustre/fid/Makefile
3541 lustre/fid/autoMakefile
3542 lustre/llite/Makefile
3543 lustre/llite/autoMakefile
3544 lustre/lov/Makefile
3545 lustre/lov/autoMakefile
3546 lustre/mdc/Makefile
3547 lustre/mdc/autoMakefile
3548 lustre/lmv/Makefile
3549 lustre/lmv/autoMakefile
3550 lustre/lfsck/Makefile
3551 lustre/lfsck/autoMakefile
3552 lustre/mdt/Makefile
3553 lustre/mdt/autoMakefile
3554 lustre/mdd/Makefile
3555 lustre/mdd/autoMakefile
3556 lustre/fld/Makefile
3557 lustre/fld/autoMakefile
3558 lustre/obdclass/Makefile
3559 lustre/obdclass/autoMakefile
3560 lustre/obdecho/Makefile
3561 lustre/obdecho/autoMakefile
3562 lustre/ofd/Makefile
3563 lustre/ofd/autoMakefile
3564 lustre/osc/Makefile
3565 lustre/osc/autoMakefile
3566 lustre/ost/Makefile
3567 lustre/ost/autoMakefile
3568 lustre/osd-ldiskfs/Makefile
3569 lustre/osd-ldiskfs/autoMakefile
3570 lustre/osd-zfs/Makefile
3571 lustre/osd-zfs/autoMakefile
3572 lustre/mgc/Makefile
3573 lustre/mgc/autoMakefile
3574 lustre/mgs/Makefile
3575 lustre/mgs/autoMakefile
3576 lustre/target/Makefile
3577 lustre/ptlrpc/Makefile
3578 lustre/ptlrpc/autoMakefile
3579 lustre/ptlrpc/gss/Makefile
3580 lustre/ptlrpc/gss/autoMakefile
3581 lustre/quota/Makefile
3582 lustre/quota/autoMakefile
3583 lustre/scripts/Makefile
3584 lustre/scripts/systemd/Makefile
3585 lustre/tests/Makefile
3586 lustre/tests/mpi/Makefile
3587 lustre/tests/kernel/Makefile
3588 lustre/tests/kernel/autoMakefile
3589 lustre/utils/Makefile
3590 lustre/utils/gss/Makefile
3591 lustre/osp/Makefile
3592 lustre/osp/autoMakefile
3593 lustre/lod/Makefile
3594 lustre/lod/autoMakefile
3595 ])
3596 ]) # LC_CONFIG_FILES