Whamcloud - gitweb
4e9850e48f71d40d1741b4ee8843c446c6d6225c
[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_CONFIG_OBD_BUFFER_SIZE
51 #
52 # the maximum buffer size of lctl ioctls
53 #
54 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE], [
55 AC_MSG_CHECKING([for maximum OBD ioctl size])
56 AC_ARG_WITH([obd-buffer-size],
57         AC_HELP_STRING([--with-obd-buffer-size=[size]],
58                 [set lctl ioctl maximum bytes (default=8192)]),
59         [OBD_BUFFER_SIZE=$with_obd_buffer_size],
60         [OBD_BUFFER_SIZE=8192])
61 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
62 AC_DEFINE_UNQUOTED(CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE,
63         [IOCTL Buffer Size])
64 ]) # LC_CONFIG_OBD_BUFFER_SIZE
65
66 #
67 # LC_GLIBC_SUPPORT_FHANDLES
68 #
69 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES], [
70 AC_CHECK_FUNCS([name_to_handle_at],
71         [AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
72                 [file handle and related syscalls are supported])],
73         [AC_MSG_WARN([file handle and related syscalls are not supported])])
74 ]) # LC_GLIBC_SUPPORT_FHANDLES
75
76 #
77 # LC_STACK_SIZE
78 #
79 # Ensure the stack size is at least 8k in Lustre server (all kernels)
80 #
81 AC_DEFUN([LC_STACK_SIZE], [
82 LB_CHECK_COMPILE([if stack size is at least 8k],
83 stack_size_8k, [
84         #include <linux/thread_info.h>
85 ], [
86         #if THREAD_SIZE < 8192
87         #error "stack size < 8192"
88         #endif
89 ], [], [AC_MSG_ERROR([
90
91 Lustre requires that Linux is configured with at least a 8KB stack.
92 ])])
93 ]) # LC_STACK_SIZE
94
95 #
96 # LC_MDS_MAX_THREADS
97 #
98 # Allow the user to set the MDS thread upper limit
99 #
100 AC_DEFUN([LC_MDS_MAX_THREADS], [
101 AC_MSG_CHECKING([for maximum number of MDS threads])
102 AC_ARG_WITH([mds_max_threads],
103         AC_HELP_STRING([--with-mds-max-threads=count],
104                 [maximum threads available on the MDS: (default=512)]),
105         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
106                 [maximum number of MDS threads])])
107 AC_MSG_RESULT([$with_mds_max_threads])
108 ]) # LC_MDS_MAX_THREADS
109
110 #
111 # LC_CONFIG_PINGER
112 #
113 # the pinger is temporary, until we have the recovery node in place
114 #
115 AC_DEFUN([LC_CONFIG_PINGER], [
116 AC_MSG_CHECKING([whether to enable Lustre pinger support])
117 AC_ARG_ENABLE([pinger],
118         AC_HELP_STRING([--disable-pinger],
119                 [disable recovery pinger support]),
120         [], [enable_pinger="yes"])
121 AC_MSG_RESULT([$enable_pinger])
122 AS_IF([test "x$enable_pinger" != xno],
123         [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
124 ]) # LC_CONFIG_PINGER
125
126 #
127 # LC_CONFIG_CHECKSUM
128 #
129 # do checksum of bulk data between client and OST
130 #
131 AC_DEFUN([LC_CONFIG_CHECKSUM], [
132 AC_MSG_CHECKING([whether to enable data checksum support])
133 AC_ARG_ENABLE([checksum],
134         AC_HELP_STRING([--disable-checksum],
135                 [disable data checksum support]),
136         [], [enable_checksum="yes"])
137 AC_MSG_RESULT([$enable_checksum])
138 AS_IF([test "x$enable_checksum" != xno],
139         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
140 ]) # LC_CONFIG_CHECKSUM
141
142 #
143 # LC_CONFIG_HEALTH_CHECK_WRITE
144 #
145 # Turn off the actual write to the disk
146 #
147 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
148 AC_MSG_CHECKING([whether to enable a write with the health check])
149 AC_ARG_ENABLE([health_write],
150         AC_HELP_STRING([--enable-health_write],
151                 [enable disk writes when doing health check]),
152         [], [enable_health_write="no"])
153 AC_MSG_RESULT([$enable_health_write])
154 AS_IF([test "x$enable_health_write" != xno],
155         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
156 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
157
158 #
159 # LC_CONFIG_LRU_RESIZE
160 #
161 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
162 AC_MSG_CHECKING([whether to enable lru self-adjusting])
163 AC_ARG_ENABLE([lru_resize],
164         AC_HELP_STRING([--enable-lru-resize],
165                 [enable lru resize support]),
166         [], [enable_lru_resize="yes"])
167 AC_MSG_RESULT([$enable_lru_resize])
168 AS_IF([test "x$enable_lru_resize" != xno],
169         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
170 ]) # LC_CONFIG_LRU_RESIZE
171
172 #
173 # LC_QUOTA_CONFIG
174 #
175 # Quota support. The kernel must support CONFIG_QUOTA.
176 #
177 AC_DEFUN([LC_QUOTA_CONFIG], [
178 LB_CHECK_CONFIG_IM([QUOTA], [],
179         [AC_MSG_ERROR([
180
181 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
182 ])])
183 ]) # LC_QUOTA_CONFIG
184
185 #
186 # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
187 #
188 # truncate_complete_page() has never been exported from an upstream kernel
189 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
190 # delete_from_page_cache() is exported from 2.6.39
191 #
192 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE], [
193 LB_CHECK_EXPORT([truncate_complete_page], [mm/truncate.c],
194         [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
195                 [kernel export truncate_complete_page])])
196 LB_CHECK_EXPORT([remove_from_page_cache], [mm/filemap.c],
197         [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
198                 [kernel export remove_from_page_cache])])
199 LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
200         [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
201                 [kernel export delete_from_page_cache])])
202 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
203
204 #
205 # LC_CONFIG_GSS_KEYRING
206 #
207 # default 'auto', tests for dependencies, if found, enables;
208 # only called if gss is enabled
209 #
210 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
211 AC_MSG_CHECKING([whether to enable gss keyring backend])
212 AC_ARG_ENABLE([gss_keyring],
213         [AC_HELP_STRING([--disable-gss-keyring],
214                 [disable gss keyring backend])],
215         [], [enable_gss_keyring="auto"])
216 AC_MSG_RESULT([$enable_gss_keyring])
217 AS_IF([test "x$enable_gss_keyring" != xno], [
218         LB_CHECK_CONFIG_IM([KEYS], [], [
219                 gss_keyring_conf_test="fail"
220                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
221
222         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
223                 gss_keyring_conf_test="fail"
224                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
225
226         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
227                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
228                         [Define this if you enable gss keyring backend])
229                 enable_gss_keyring="yes"
230         ], [
231                 AS_IF([test "x$enable_gss_keyring" = xyes], [
232                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
233                 ])
234         ])
235 ])
236 ]) # LC_CONFIG_GSS_KEYRING
237
238 #
239 # LC_HAVE_CRED_TGCRED
240 #
241 # rhel7 struct cred has no member tgcred
242 #
243 AC_DEFUN([LC_HAVE_CRED_TGCRED], [
244 LB_CHECK_COMPILE([if 'struct cred' has member 'tgcred'],
245 cred_tgcred, [
246         #include <linux/cred.h>
247 ],[
248         ((struct cred *)0)->tgcred = NULL;
249 ],[
250         AC_DEFINE(HAVE_CRED_TGCRED, 1,
251                 [struct cred has member tgcred])
252 ])
253 ]) # LC_HAVE_CRED_TGCRED
254
255 #
256 # LC_KEY_TYPE_INSTANTIATE_2ARGS
257 #
258 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
259 #
260 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
261 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
262 key_type_instantiate_2args, [
263         #include <linux/key-type.h>
264 ],[
265         ((struct key_type *)0)->instantiate(0, NULL);
266 ],[
267         AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
268                 [key_type->instantiate has two args])
269 ])
270 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
271
272 #
273 # LC_CONFIG_SUNRPC
274 #
275 AC_DEFUN([LC_CONFIG_SUNRPC], [
276 LB_CHECK_CONFIG_IM([SUNRPC], [], [
277         AS_IF([test "x$sunrpc_required" = xyes], [
278                 AC_MSG_ERROR([
279
280 kernel SUNRPC support is required by using GSS.
281 ])
282         ])])
283 ]) # LC_CONFIG_SUNRPC
284
285 #
286 # LC_HAVE_CRYPTO_HASH
287 #
288 # 4.6 kernel commit 896545098777564212b9e91af4c973f094649aa7
289 # removed crypto_hash support. Since GSS only works with
290 # crypto_hash it has to be disabled for newer distros.
291 #
292 AC_DEFUN([LC_HAVE_CRYPTO_HASH], [
293 LB_CHECK_COMPILE([if crypto_hash API is supported],
294 crypto_hash, [
295         #include <linux/crypto.h>
296 ],[
297         crypto_hash_digestsize(NULL);
298 ], [], [enable_gss="no"])
299 ])
300 ]) # LC_HAVE_CRYPTO_HASH
301
302 #
303 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
304 #
305 # Build gss and related tools of Lustre. Currently both kernel and user space
306 # parts are depend on linux platform.
307 #
308 AC_DEFUN([LC_CONFIG_GSS], [
309 AC_MSG_CHECKING([whether to enable gss support])
310 AC_ARG_ENABLE([gss],
311         [AC_HELP_STRING([--enable-gss], [enable gss support])],
312         [], [enable_gss="auto"])
313 AC_MSG_RESULT([$enable_gss])
314
315 AS_IF([test "x$enable_gss" != xno], [
316         LC_CONFIG_GSS_KEYRING
317         LC_HAVE_CRYPTO_HASH
318         LC_HAVE_CRED_TGCRED
319         LC_KEY_TYPE_INSTANTIATE_2ARGS
320         sunrpc_required=$enable_gss
321         LC_CONFIG_SUNRPC
322         sunrpc_required="no"
323
324         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
325                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
326         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
327                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
328         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
329                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
330         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
331                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
332
333         require_krb5=$enable_gss
334         AC_KERBEROS_V5
335         require_krb5="no"
336
337         AS_IF([test -n "$KRBDIR"], [
338                 gss_conf_test="success"
339         ], [
340                 gss_conf_test="failure"
341         ])
342
343         AS_IF([test "x$gss_conf_test" = xsuccess], [
344                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
345                 enable_gss="yes"
346         ], [
347                 enable_gss="no"
348         ])
349
350         enable_ssk=$enable_gss
351 ])
352 ]) # LC_CONFIG_GSS
353
354 # LC_OPENSSL_SSK
355 #
356 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
357 AC_DEFUN([LC_OPENSSL_SSK], [
358 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
359 AS_IF([test "x$enable_ssk" != xno], [
360 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
361         #include <openssl/hmac.h>
362         #include <openssl/evp.h>
363
364         int main(void) {
365                 int rc;
366                 HMAC_CTX ctx;
367                 HMAC_CTX_init(&ctx);
368                 rc = HMAC_Init_ex(&ctx, "test", 4, EVP_md_null(), NULL);
369         }
370 ])],[AC_DEFINE(HAVE_OPENSSL_SSK, 1,
371                [OpenSSL HMAC functions needed for SSK])],
372         [enable_ssk="no"])
373 ])
374 AC_MSG_RESULT([$enable_ssk])
375 ]) # LC_OPENSSL_SSK
376
377 # LC_INODE_PERMISION_2ARGS
378 #
379 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
380 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
381 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
382 # v3.1 onward have a 2 arg version (inode, mask)
383 #
384 AC_DEFUN([LC_INODE_PERMISION_2ARGS], [
385 LB_CHECK_COMPILE([if 'inode_operations->permission' has two args],
386 inode_ops_permission_2args, [
387         #include <linux/fs.h>
388 ],[
389         struct inode *inode __attribute__ ((unused));
390
391         inode = NULL;
392         inode->i_op->permission(NULL, 0);
393 ],[
394         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
395                 [inode_operations->permission has two args])
396 ])
397 ]) # LC_INODE_PERMISION_2ARGS
398
399 #
400 # LC_BLK_QUEUE_MAX_SEGMENTS
401 #
402 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
403 #
404 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS], [
405 LB_CHECK_COMPILE([if 'blk_queue_max_segments' is defined],
406 blk_queue_max_segments, [
407         #include <linux/blkdev.h>
408 ],[
409         blk_queue_max_segments(NULL, 0);
410 ],[
411         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
412                 [blk_queue_max_segments is defined])
413 ])
414 ]) # LC_BLK_QUEUE_MAX_SEGMENTS
415
416 #
417 # LC_HAVE_DQUOT_FS_DISK_QUOTA
418 #
419 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
420 #
421 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA], [
422 tmp_flags="$EXTRA_KCFLAGS"
423 EXTRA_KCFLAGS="-Werror"
424 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct fs_disk_quota],
425 fs_disk_quota, [
426         #include <linux/fs.h>
427         #include <linux/quota.h>
428 ],[
429         ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
430 ],[
431         AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
432                 [quotactl_ops.set_dqblk takes struct fs_disk_quota])
433 ],[
434         LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct kqid & fs_disk_quota],
435         kqid_fs_disk_quota, [
436                 #include <linux/fs.h>
437                 #include <linux/quota.h>
438         ],[
439                 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
440         ],[
441                 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
442                         [quotactl_ops.set_dqblk takes struct fs_disk_quota])
443                 AC_DEFINE(HAVE_DQUOT_KQID, 1,
444                         [quotactl_ops.set_dqblk takes struct kqid])
445         ])
446 ])
447 EXTRA_KCFLAGS="$tmp_flags"
448 ]) # LC_HAVE_DQUOT_FS_DISK_QUOTA
449
450 #
451 # LC_HAVE_DQUOT_SUSPEND
452 #
453 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
454 #
455 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND], [
456 LB_CHECK_COMPILE([if 'dquot_suspend' is defined],
457 dquot_suspend, [
458         #include <linux/quotaops.h>
459 ],[
460         dquot_suspend(NULL, -1);
461 ],[
462         AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
463 ])
464 ]) # LC_HAVE_DQUOT_SUSPEND
465
466 #
467 # LC_QUOTA64
468 #
469 # Check if kernel has been patched for 64-bit quota limits support.
470 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
471 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
472 # that in the absence of quotaio_v1.h in the kernel headers.
473 #
474 AC_DEFUN([LC_QUOTA64], [
475 tmp_flags="$EXTRA_KCFLAGS"
476 EXTRA_KCFLAGS="-I$LINUX/fs"
477 LB_CHECK_COMPILE([if kernel has 64-bit quota limits support],
478 quota64, [
479         #include <linux/kernel.h>
480         #include <linux/fs.h>
481         #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
482         #include <quota/quotaio_v2.h>
483         struct v2r1_disk_dqblk dqblk_r1;
484         #else
485         #include <linux/quota.h>
486         int ver = QFMT_VFS_V1;
487         #endif
488 ], [], [
489         AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
490 ],[
491         LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],
492                 [AC_MSG_ERROR([You have got no 64-bit kernel quota support.])])
493 ])
494 EXTRA_KCFLAGS=$tmp_flags
495 ]) # LC_QUOTA64
496
497 #
498 # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
499 #
500 # 2.6.34 adds __add_wait_queue_exclusive
501 #
502 AC_DEFUN([LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE], [
503 LB_CHECK_COMPILE([if '__add_wait_queue_exclusive' exists],
504 __add_wait_queue_exclusive, [
505         #include <linux/wait.h>
506 ],[
507         wait_queue_head_t queue;
508         wait_queue_t      wait;
509         __add_wait_queue_exclusive(&queue, &wait);
510 ],[
511         AC_DEFINE(HAVE___ADD_WAIT_QUEUE_EXCLUSIVE, 1,
512                   [__add_wait_queue_exclusive exists])
513 ])
514 ]) # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
515
516 #
517 # LC_FS_STRUCT_RWLOCK
518 #
519 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
520 #
521 AC_DEFUN([LC_FS_STRUCT_RWLOCK], [
522 LB_CHECK_COMPILE([if 'fs_struct.lock' use rwlock],
523 fs_struct_rwlock, [
524         #include <asm/atomic.h>
525         #include <linux/spinlock.h>
526         #include <linux/fs_struct.h>
527 ],[
528         ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
529 ],[
530         AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1, [fs_struct.lock use rwlock])
531 ])
532 ]) # LC_FS_STRUCT_RWLOCK
533
534 #
535 # LC_SBOPS_EVICT_INODE
536 #
537 # 2.6.36 super_operations add evict_inode method. it hybird of
538 # delete_inode & clear_inode.
539 #
540 AC_DEFUN([LC_SBOPS_EVICT_INODE], [
541 LB_CHECK_COMPILE([if 'super_operations.evict_inode' exist],
542 super_ops_evict_inode, [
543         #include <linux/fs.h>
544 ],[
545         ((struct super_operations *)0)->evict_inode(NULL);
546 ],[
547         AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
548                 [super_operations.evict_inode() is exist in kernel])
549 ])
550 ]) # LC_SBOPS_EVICT_INODE
551
552 #
553 # LC_FILE_FSYNC
554 #
555 # 2.6.35 file_operations.fsync taken 2 arguments.
556 # 3.0.0 file_operations.fsync takes 4 arguments.
557 #
558 AC_DEFUN([LC_FILE_FSYNC], [
559 LB_CHECK_COMPILE([if 'file_operations.fsync' takes 4 arguments],
560 file_ops_fsync_4args, [
561         #include <linux/fs.h>
562 ],[
563         ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
564 ],[
565         AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
566                 [file_operations.fsync takes 4 arguments])
567 ],[
568         LB_CHECK_COMPILE([if 'file_operations.fsync' takes 2 arguments],
569         file_ops_fsync_2args, [
570                 #include <linux/fs.h>
571         ],[
572                 ((struct file_operations *)0)->fsync(NULL, 0);
573         ],[
574                 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
575                         [file_operations.fsync takes 2 arguments])
576         ])
577 ])
578 ]) # LC_FILE_FSYNC
579
580 #
581 # LC_KERNEL_LOCKED
582 #
583 # 2.6.37 remove kernel_locked
584 #
585 AC_DEFUN([LC_KERNEL_LOCKED], [
586 LB_CHECK_COMPILE([if 'kernel_locked' is defined],
587 kernel_locked, [
588         #include <linux/smp_lock.h>
589 ],[
590         kernel_locked();
591 ],[
592         AC_DEFINE(HAVE_KERNEL_LOCKED, 1, [kernel_locked is defined])
593 ])
594 ]) # LC_KERNEL_LOCKED
595
596 #
597 # LC_D_COMPARE_7ARGS
598 #
599 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
600 #
601 AC_DEFUN([LC_D_COMPARE_7ARGS], [
602 LB_CHECK_COMPILE([if 'dentry_operations.d_compare()' taken 7 arguments],
603 dentry_ops_d_compare_7arg, [
604         #include <linux/dcache.h>
605 ],[
606         ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
607 ],[
608         AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1, [d_compare need 7 arguments])
609 ])
610 ]) # LC_D_COMPARE_7ARGS
611
612 #
613 # LC_D_DELETE_CONST
614 #
615 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
616 #
617 AC_DEFUN([LC_D_DELETE_CONST], [
618 tmp_flags="$EXTRA_KCFLAGS"
619 EXTRA_KCFLAGS="-Werror"
620 LB_CHECK_COMPILE([if 'dentry_operations.d_delete()' has const declare on first parameter],
621 dentry_ops_d_delete_1st_const, [
622         #include <linux/dcache.h>
623 ],[
624         const struct dentry *d = NULL;
625         ((struct dentry_operations*)0)->d_delete(d);
626 ],[
627         AC_DEFINE(HAVE_D_DELETE_CONST, const,
628                 [d_delete first parameter declared const])
629 ],[
630         AC_DEFINE(HAVE_D_DELETE_CONST, [],
631                 [d_delete first parameter declared is not const])
632 ])
633 EXTRA_KCFLAGS="$tmp_flags"
634 ]) # LC_D_DELETE_CONST
635
636 #
637 # LC_DCACHE_LOCK
638 #
639 # 2.6.38 dcache_lock removed. rcu-walk committed.
640 #
641 AC_DEFUN([LC_DCACHE_LOCK], [
642 LB_CHECK_COMPILE([if 'dcache_lock' is exist],
643 dcache_lock, [
644         #include <linux/dcache.h>
645 ],[
646         spin_lock(&dcache_lock);
647 ],[
648         AC_DEFINE(HAVE_DCACHE_LOCK, 1,
649                 [dcache_lock is exist])
650 ])
651 ]) # LC_DCACHE_LOCK
652
653 #
654 # LC_INODE_I_RCU
655 #
656 # 2.6.38 inode.i_rcu added.
657 #
658 AC_DEFUN([LC_INODE_I_RCU], [
659 LB_CHECK_COMPILE([if 'inode.i_rcu' exists],
660 inode_i_rcu, [
661         #include <linux/fs.h>
662 ],[
663         struct inode ino;
664         struct rcu_head rcu = {};
665         ino.i_rcu = rcu;
666 ],[
667         AC_DEFINE(HAVE_INODE_I_RCU, 1,
668                 [inode.i_rcu exists])
669 ])
670 ]) # LC_INODE_I_RCU
671
672 #
673 # LC_BLKDEV_GET_BY_DEV
674 #
675 # 2.6.38 export blkdev_get_by_dev
676 #
677 AC_DEFUN([LC_BLKDEV_GET_BY_DEV], [
678 LB_CHECK_EXPORT([blkdev_get_by_dev], [fs/block_dev.c],
679         [AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
680                 [blkdev_get_by_dev is exported by the kernel])])
681 ]) # LC_BLKDEV_GET_BY_DEV
682
683 #
684 # LC_EXPORT_SIMPLE_SETATTR
685 #
686 # 2.6.38 export simple_setattr
687 #
688 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR], [
689 LB_CHECK_EXPORT([simple_setattr], [fs/libfs.c],
690         [AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
691                 [simple_setattr is exported by the kernel])])
692 ]) # LC_EXPORT_SIMPLE_SETATTR
693
694 #
695 # LC_HAVE_BLK_PLUG
696 #
697 # 2.6.38 add struct blk_plug
698 #
699 AC_DEFUN([LC_HAVE_BLK_PLUG], [
700 LB_CHECK_COMPILE([if 'struct blk_plug' exists],
701 blk_plug, [
702         #include <linux/blkdev.h>
703 ],[
704         struct blk_plug plug;
705
706         blk_start_plug(&plug);
707         blk_finish_plug(&plug);
708 ],[
709         AC_DEFINE(HAVE_BLK_PLUG, 1,
710                 [blk_plug struct exists])
711 ])
712 ]) # LC_HAVE_BLK_PLUG
713
714 #
715 # LC_IOP_TRUNCATE
716 #
717 # truncate callback removed since 2.6.39
718 #
719 AC_DEFUN([LC_IOP_TRUNCATE], [
720 LB_CHECK_COMPILE([if 'inode_operations' has '.truncate' member function],
721 inode_ops_truncate, [
722         #include <linux/fs.h>
723 ],[
724         ((struct inode_operations *)0)->truncate(NULL);
725 ],[
726         AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
727                 [inode_operations has .truncate member function])
728 ])
729 ]) # LC_IOP_TRUNCATE
730
731 #
732 # LC_REQUEST_QUEUE_UNPLUG_FN
733 #
734 # 2.6.39 remove unplug_fn from request_queue.
735 #
736 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], [
737 LB_CHECK_COMPILE([if 'request_queue' has 'unplug_fn' field],
738 request_queue_unplug_fn, [
739         #include <linux/blkdev.h>
740 ],[
741         do {} while(sizeof(((struct request_queue *)0)->unplug_fn));
742 ],[
743         AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
744                 [request_queue has unplug_fn field])
745 ])
746 ]) # LC_REQUEST_QUEUE_UNPLUG_FN
747
748 #
749 # LC_HAVE_FSTYPE_MOUNT
750 #
751 # 2.6.39 replace get_sb with mount in struct file_system_type
752 #
753 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [
754 LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field],
755 file_system_type_mount, [
756         #include <linux/fs.h>
757 ],[
758         struct file_system_type fst;
759         void *i = (void *) fst.mount;
760 ],[
761         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
762                 [struct file_system_type has mount field])
763 ])
764 ]) # LC_HAVE_FSTYPE_MOUNT
765
766 #
767 # LC_HAVE_FHANDLE_SYSCALLS
768 #
769 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
770 # added to Linux kernel 2.6.39.
771 # Check if client supports these functions
772 #
773 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [
774 LB_CHECK_CONFIG_IM([FHANDLE],[
775         AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
776                 [kernel supports fhandles and related syscalls])
777         ])
778 ]) # LC_HAVE_FHANDLE_SYSCALLS
779
780 #
781 # LC_HAVE_INODE_OWNER_OR_CAPABLE
782 #
783 # 2.6.39 renames is_owner_or_cap to inode_owner_or_capable
784 #
785 AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [
786 LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist],
787 inode_owner_or_capable, [
788         #include <linux/fs.h>
789 ],[
790         inode_owner_or_capable(NULL);
791 ],[
792         AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
793                 [inode_owner_or_capable exist])
794 ])
795 ]) # LC_HAVE_INODE_OWNER_OR_CAPABLE
796
797 #
798 # LC_DIRTY_INODE_WITH_FLAG
799 #
800 # 3.0 dirty_inode() has a flag parameter
801 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
802 #
803 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [
804 LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag],
805 dirty_inode_super_operation_flag, [
806         #include <linux/fs.h>
807 ],[
808         struct inode *inode;
809         inode->i_sb->s_op->dirty_inode(NULL, 0);
810 ],[
811         AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
812                 [dirty_inode super_operation takes flag])
813 ])
814 ]) # LC_DIRTY_INODE_WITH_FLAG
815
816 #
817 # LC_SETNS
818 #
819 # 3.0 introduced setns
820 #
821 AC_DEFUN([LC_SETNS], [
822 AC_CHECK_HEADERS([sched.h], [], [],
823                  [#define _GNU_SOURCE
824                  ])
825 AC_CHECK_FUNCS([setns])
826 ]) # LC_SETNS
827
828 #
829 # LC_GENERIC_PERMISSION
830 #
831 # 2.6.38 generic_permission taken 4 parameters.
832 # in fact, it means rcu-walk aware permission bring.
833 #
834 # 3.1 generic_permission taken 2 parameters.
835 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
836 #
837 AC_DEFUN([LC_GENERIC_PERMISSION], [
838 LB_CHECK_COMPILE([if 'generic_permission' take 2 arguments],
839 generic_permission_2args, [
840         #include <linux/fs.h>
841 ],[
842         generic_permission(NULL, 0);
843 ],[
844         AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
845                 [generic_permission taken 2 arguments])
846 ],[
847         LB_CHECK_COMPILE([if 'generic_permission' take 4 arguments],
848         generic_permission_4args, [
849                 #include <linux/fs.h>
850         ],[
851                 generic_permission(NULL, 0, 0, NULL);
852         ],[
853                 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
854                         [generic_permission taken 4 arguments])
855         ])
856 ])
857 ]) # LC_GENERIC_PERMISSION
858
859 #
860 # LC_LM_XXX_LOCK_MANAGER_OPS
861 #
862 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
863 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
864 #
865 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [
866 LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'],
867 lock_manager_ops_lm_xxx, [
868         #include <linux/fs.h>
869 ],[
870         struct lock_manager_operations lm_ops;
871         lm_ops.lm_compare_owner = NULL;
872 ],[
873         AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
874                 [lock-manager ops renamed to lm_xxx])
875 ])
876 ]) # LC_LM_XXX_LOCK_MANAGER_OPS
877
878 #
879 # LC_INODE_DIO_WAIT
880 #
881 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait
882 #     instead.
883 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
884 #
885 AC_DEFUN([LC_INODE_DIO_WAIT], [
886 LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait],
887 inode_dio_wait, [
888         #include <linux/fs.h>
889 ],[
890         inode_dio_wait((struct inode *)0);
891 ],[
892         AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
893                 [inode->i_alloc_sem is killed and use inode_dio_wait])
894 ])
895 ]) # LC_INODE_DIO_WAIT
896
897 #
898 # LC_IOP_GET_ACL
899 #
900 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
901 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
902 #
903 AC_DEFUN([LC_IOP_GET_ACL], [
904 LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function],
905 inode_ops_get_acl, [
906         #include <linux/fs.h>
907 ],[
908         struct inode_operations iop;
909         iop.get_acl = NULL;
910 ],[
911         AC_DEFINE(HAVE_IOP_GET_ACL, 1,
912                 [inode_operations has .get_acl member function])
913 ])
914 ]) # LC_IOP_GET_ACL
915
916 #
917 # LC_FILE_LLSEEK_SIZE
918 #
919 # 3.1 introduced generic_file_llseek_size()
920 #
921 AC_DEFUN([LC_FILE_LLSEEK_SIZE], [
922 LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c],
923         [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
924                 [generic_file_llseek_size is exported by the kernel])])
925 ]) # LC_FILE_LLSEEK_SIZE
926
927 #
928 # LC_RADIX_EXCEPTION_ENTRY
929 # 3.1 adds radix_tree_exception_entry.
930 #
931 AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [
932 LB_CHECK_COMPILE([radix_tree_exceptional_entry exist],
933 radix_tree_exceptional_entry, [
934         #include <linux/radix-tree.h>
935 ],[
936         radix_tree_exceptional_entry(NULL);
937 ],[
938         AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1,
939                 [radix_tree_exceptional_entry exist])
940 ])
941 ]) # LC_RADIX_EXCEPTION_ENTRY
942
943 #
944 # LC_HAVE_VOID_MAKE_REQUEST_FN
945 #
946 # 3.2 request_queue.make_request_fn defined as function returns with void
947 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
948 #
949 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], [
950 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns void but not int],
951 make_request_fn_void, [
952         #include <linux/blkdev.h>
953 ],[
954         int ret;
955         make_request_fn *mrf;
956         ret = mrf(NULL, NULL);
957 ],[],[
958         AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
959                 [request_queue.make_request_fn returns void but not int])
960 ])
961 ]) # LC_HAVE_VOID_MAKE_REQUEST_FN
962
963 #
964 # LC_HAVE_PROTECT_I_NLINK
965 #
966 # 3.2 protects inode->i_nlink from direct modification
967 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
968 # at the same time adds set_nlink(), so checks set_nlink() for it.
969 #
970 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [
971 LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification],
972 inode_i_nlink_protected, [
973         #include <linux/fs.h>
974 ],[
975         struct inode i;
976         set_nlink(&i, 1);
977 ],[
978         AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
979                 [inode->i_nlink is protected from direct modification])
980 ])
981 ]) # LC_HAVE_PROTECT_I_NLINK
982
983 #
984 # 2.6.39 security_inode_init_security takes a 'struct qstr' parameter
985 #
986 # 3.2 security_inode_init_security takes a callback to set xattrs
987 #
988 AC_DEFUN([LC_HAVE_SECURITY_IINITSEC], [
989 LB_CHECK_COMPILE([if security_inode_init_security takes a callback],
990 security_inode_init_security_callback, [
991         #include <linux/security.h>
992 ],[
993         security_inode_init_security(NULL, NULL, NULL, (const initxattrs)NULL, NULL);
994 ],[
995         AC_DEFINE(HAVE_SECURITY_IINITSEC_CALLBACK, 1,
996                   [security_inode_init_security takes a callback to set xattrs])
997 ],[
998         LB_CHECK_COMPILE([if security_inode_init_security takes a 'struct qstr' parameter],
999         security_inode_init_security_qstr, [
1000                 #include <linux/security.h>
1001         ],[
1002                 security_inode_init_security(NULL, NULL, (struct qstr *)NULL, NULL, NULL, NULL);
1003         ],[
1004                 AC_DEFINE(HAVE_SECURITY_IINITSEC_QSTR, 1,
1005                           [security_inode_init_security takes a 'struct qstr' parameter])
1006         ])
1007 ])
1008 ]) # LC_HAVE_SECURITY_IINITSEC
1009
1010 #
1011 # LC_HAVE_MIGRATE_HEADER
1012 #
1013 # 3.3 introduces migrate_mode.h and migratepage has 4 args
1014 #
1015 AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [
1016 LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [
1017         AC_DEFINE(HAVE_MIGRATE_H, 1,
1018                 [kernel has include/linux/migrate.h])
1019 ],[
1020         LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [
1021                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
1022                         [kernel has include/linux/migrate_mode.h])
1023         ])
1024 ])
1025 ]) # LC_HAVE_MIGRATE_HEADER
1026
1027 #
1028 # LC_MIGRATEPAGE_4ARGS
1029 #
1030 AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [
1031 LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args],
1032 address_space_ops_migratepage_4args, [
1033         #include <linux/fs.h>
1034 #ifdef HAVE_MIGRATE_H
1035         #include <linux/migrate.h>
1036 #elif defined(HAVE_MIGRATE_MODE_H)
1037         #include <linux/migrate_mode.h>
1038 #endif
1039 ],[
1040         struct address_space_operations aops;
1041         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
1042 ],[
1043         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
1044                 [address_space_operations.migratepage has 4 args])
1045 ])
1046 ]) # LC_MIGRATEPAGE_4ARGS
1047
1048 #
1049 # LC_SUPEROPS_USE_DENTRY
1050 #
1051 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
1052 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
1053 #
1054 AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [
1055 tmp_flags="$EXTRA_KCFLAGS"
1056 EXTRA_KCFLAGS="-Werror"
1057 LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter],
1058 super_ops_dentry, [
1059         #include <linux/fs.h>
1060         int show_options(struct seq_file *seq, struct dentry *root) {
1061                 return 0;
1062         }
1063 ],[
1064         struct super_operations ops;
1065         ops.show_options = show_options;
1066 ],[
1067         AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
1068                 [super_operations use dentry as parameter])
1069 ])
1070 EXTRA_KCFLAGS="$tmp_flags"
1071 ]) # LC_SUPEROPS_USE_DENTRY
1072
1073 #
1074 # LC_INODEOPS_USE_UMODE_T
1075 #
1076 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
1077 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
1078 #
1079 AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [
1080 tmp_flags="$EXTRA_KCFLAGS"
1081 EXTRA_KCFLAGS="-Werror"
1082 LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter],
1083 inode_ops_umode_t, [
1084         #include <linux/fs.h>
1085         #include <linux/types.h>
1086         int my_mknod(struct inode *dir, struct dentry *dchild,
1087                      umode_t mode, dev_t dev)
1088         {
1089                 return 0;
1090         }
1091 ],[
1092         struct inode_operations ops;
1093         ops.mknod = my_mknod;
1094 ],[
1095         AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
1096                 [inode_operations use umode_t as parameter])
1097 ])
1098 EXTRA_KCFLAGS="$tmp_flags"
1099 ]) # LC_INODEOPS_USE_UMODE_T
1100
1101 #
1102 # LC_KMAP_ATOMIC_HAS_1ARG
1103 #
1104 # 3.4 kmap_atomic removes second argument
1105 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1106 #
1107 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [
1108 LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument],
1109 kmap_atomic_1arg, [
1110         #include <linux/highmem.h>
1111 ],[
1112         kmap_atomic(NULL);
1113 ],[
1114         AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1115                 [have kmap_atomic has only 1 argument])
1116 ])
1117 ]) # LC_KMAP_ATOMIC_HAS_1ARG
1118
1119 #
1120 # LC_HAVE_D_MAKE_ROOT
1121 #
1122 # 3.4 converts d_alloc_root to d_make_root
1123 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1124 #
1125 AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [
1126 LB_CHECK_COMPILE([if have 'd_make_root'],
1127 d_make_root, [
1128         #include <linux/fs.h>
1129 ],[
1130         d_make_root((struct inode *)NULL);
1131 ],[
1132         AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1133                 [have d_make_root])
1134 ])
1135 ]) # LC_HAVE_D_MAKE_ROOT
1136
1137 #
1138 # LC_HAVE_CACHE_REGISTER
1139 #
1140 # 3.4 cache_register/cache_unregister are removed
1141 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1142 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1143 # are defined, but not exported.
1144 # 3.3 cache_register_net/cache_unregister_net are
1145 # exported and replacing cache_register/cache_unregister in 3.4
1146 #
1147 AC_DEFUN([LC_HAVE_CACHE_REGISTER], [
1148 LB_CHECK_COMPILE([if have 'cache_register'],
1149 cache_register, [
1150         #include <linux/sunrpc/cache.h>
1151 ],[
1152         cache_register(NULL);
1153 ],[
1154         AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1155                 [have cache_register])
1156 ])
1157 ]) # LC_HAVE_CACHE_REGISTER
1158
1159 #
1160 # LC_HAVE_CLEAR_INODE
1161 #
1162 # 3.5 renames end_writeback() back to clear_inode()...
1163 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1164 #
1165 AC_DEFUN([LC_HAVE_CLEAR_INODE], [
1166 LB_CHECK_COMPILE([if have 'clear_inode'],
1167 clear_inode, [
1168         #include <linux/fs.h>
1169 ],[
1170         clear_inode((struct inode *)NULL);
1171 ],[
1172         AC_DEFINE(HAVE_CLEAR_INODE, 1,
1173                 [have clear_inode])
1174 ])
1175 ]) # LC_HAVE_CLEAR_INODE
1176
1177 #
1178 # LC_HAVE_ENCODE_FH_PARENT
1179 #
1180 # 3.5 encode_fh has parent inode passed in directly
1181 # see kernel commit b0b0382b
1182 #
1183 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [
1184 tmp_flags="$EXTRA_KCFLAGS"
1185 EXTRA_KCFLAGS="-Werror"
1186 LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter],
1187 encode_fh_parent_inode, [
1188         #include <linux/exportfs.h>
1189         #include <linux/fs.h>
1190         #include <linux/types.h>
1191         int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1192         {
1193                 return 0;
1194         }
1195 ],[
1196         struct export_operations exp_op;
1197         exp_op.encode_fh = ll_encode_fh;
1198 ],[
1199         AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1200                 [have parent inode as parameter])
1201 ])
1202 EXTRA_KCFLAGS="$tmp_flags"
1203 ]) # LC_HAVE_ENCODE_FH_PARENT
1204
1205 #
1206 # LC_FILE_LLSEEK_SIZE_5ARG
1207 #
1208 # 3.5 has generic_file_llseek_size with 5 args
1209 #
1210 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [
1211 LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args],
1212 generic_file_llseek_size_5args, [
1213         #include <linux/fs.h>
1214 ],[
1215         generic_file_llseek_size(NULL, 0, 0, 0, 0);
1216 ], [
1217         AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1218                 [kernel has generic_file_llseek_size with 5 args])
1219 ])
1220 ]) # LC_FILE_LLSEEK_SIZE_5ARG
1221
1222 #
1223 # LC_LLITE_DATA_IS_LIST
1224 #
1225 # 3.6 switch i_dentry/d_alias from list to hlist
1226 #
1227 # In the upstream kernels d_alias first changes
1228 # to a hlist and then in later version, 3.11, gets
1229 # moved to the union d_u. Due to some distros having
1230 # d_alias in the d_u union as a struct list, which
1231 # has never existed upstream stream, we can't test
1232 # if d_alias is a list or hlist directly. If ever
1233 # i_dentry and d_alias even up different combos then
1234 # the build will fail. In that case then we will need
1235 # to separate out the i_dentry and d_alias test below.
1236 #
1237 AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
1238 tmp_flags="$EXTRA_KCFLAGS"
1239 EXTRA_KCFLAGS="-Werror"
1240 LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
1241 i_dentry_d_alias_list, [
1242         #include <linux/fs.h>
1243 ],[
1244         struct inode inode;
1245         INIT_LIST_HEAD(&inode.i_dentry);
1246 ],[
1247         AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
1248                 [both i_dentry/d_alias uses list])
1249 ])
1250 EXTRA_KCFLAGS="$tmp_flags"
1251 ]) # LC_DATA_FOR_LLITE_IS_LIST
1252
1253 #
1254 # LC_DENTRY_OPEN_USE_PATH
1255 #
1256 # 3.6 dentry_open uses struct path as first argument
1257 # see kernel commit 765927b2
1258 #
1259 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [
1260 tmp_flags="$EXTRA_KCFLAGS"
1261 EXTRA_KCFLAGS="-Werror"
1262 LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument],
1263 dentry_open_path, [
1264         #include <linux/fs.h>
1265         #include <linux/path.h>
1266 ],[
1267         struct path path;
1268         dentry_open(&path, 0, NULL);
1269 ],[
1270         AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1271                 [dentry_open uses struct path as first argument])
1272 ])
1273 EXTRA_KCFLAGS="$tmp_flags"
1274 ]) # LC_DENTRY_OPEN_USE_PATH
1275
1276 #
1277 # LC_HAVE_IOP_ATOMIC_OPEN
1278 #
1279 # 3.6 vfs adds iop->atomic_open
1280 #
1281 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [
1282 LB_CHECK_COMPILE([if 'iop' has 'atomic_open'],
1283 inode_ops_atomic_open, [
1284         #include <linux/fs.h>
1285 ],[
1286         struct inode_operations iop;
1287         iop.atomic_open = NULL;
1288 ],[
1289         AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1290                 [have iop atomic_open])
1291 ])
1292 ]) # LC_HAVE_IOP_ATOMIC_OPEN
1293
1294 #
1295 # LC_HAVE_SB_START_WRITE
1296 #
1297 # RHEL6 2.6.32, 3.6 or newer support wrapped FS freeze functions
1298 #
1299 AC_DEFUN([LC_HAVE_SB_START_WRITE], [
1300 LB_CHECK_COMPILE([if kernel supports wrapped FS freeze functions],
1301 sb_start_write, [
1302         #include <linux/fs.h>
1303 ],[
1304         sb_start_write(NULL);
1305 ],[
1306         AC_DEFINE(HAVE_SB_START_WRITE, 1,
1307                 [kernel supports wrapped FS freeze functions])
1308 ])
1309 ]) # LC_HAVE_SB_START_WRITE
1310
1311 #
1312 # LC_HAVE_POSIXACL_USER_NS
1313 #
1314 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1315 #
1316 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [
1317 LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'],
1318 posix_acl_to_xattr_user_namespace, [
1319         #include <linux/fs.h>
1320         #include <linux/posix_acl_xattr.h>
1321 ],[
1322         posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1323 ],[
1324         AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1325                 [posix_acl_to_xattr takes struct user_namespace])
1326 ])
1327 ]) # LC_HAVE_POSIXACL_USER_NS
1328
1329 #
1330 # LC_HAVE_FILE_F_INODE
1331 #
1332 # 3.8 struct file has new member f_inode
1333 #
1334 AC_DEFUN([LC_HAVE_FILE_F_INODE], [
1335 LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'],
1336 file_f_inode, [
1337         #include <linux/fs.h>
1338 ],[
1339         ((struct file *)0)->f_inode = NULL;
1340 ],[
1341         AC_DEFINE(HAVE_FILE_F_INODE, 1,
1342                 [struct file has member f_inode])
1343 ])
1344 ]) # LC_HAVE_FILE_F_INODE
1345
1346 #
1347 # LC_HAVE_FILE_INODE
1348 #
1349 # 3.8 has introduced inline function file_inode
1350 #
1351 AC_DEFUN([LC_HAVE_FILE_INODE], [
1352 LB_CHECK_COMPILE([if file_inode() exists],
1353 file_inode, [
1354         #include <linux/fs.h>
1355 ],[
1356         file_inode(NULL);
1357 ],[
1358         AC_DEFINE(HAVE_FILE_INODE, 1,
1359                 [file_inode() has been defined])
1360 ])
1361 ]) # LC_HAVE_FILE_INODE
1362
1363 #
1364 # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1365 #
1366 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [
1367 LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args],
1368 sunrpc_cache_pipe_upcall_3args, [
1369         #include <linux/sunrpc/cache.h>
1370 ],[
1371         sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1372 ],[
1373         AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1374                 [sunrpc_cache_pipe_upcall takes 3 args])
1375 ])
1376 ]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1377
1378 #
1379 # LC_HAVE_HLIST_FOR_EACH_3ARG
1380 #
1381 # 3.9 uses hlist_for_each_entry with 3 args
1382 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1383 #
1384 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [
1385 LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args],
1386 hlist_for_each_entry_3args, [
1387         #include <linux/list.h>
1388         #include <linux/fs.h>
1389 ],[
1390         struct hlist_head *head = NULL;
1391         struct inode *inode;
1392
1393         hlist_for_each_entry(inode, head, i_hash) {
1394                 continue;
1395         }
1396 ],[
1397         AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1,
1398                 [hlist_for_each_entry has 3 args])
1399 ])
1400 ]) # LC_HAVE_HLIST_FOR_EACH_3ARG
1401
1402 #
1403 # LC_HAVE_BIO_END_SECTOR
1404 #
1405 # 3.9 introduces bio_end_sector macro
1406 # f73a1c7d117d07a96d89475066188a2b79e53c48
1407 #
1408 AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [
1409 LB_CHECK_COMPILE([if 'bio_end_sector' is defined],
1410 bio_end_sector, [
1411         #include <linux/bio.h>
1412 ],[
1413         struct bio bio;
1414
1415         bio_end_sector(&bio);
1416 ],[
1417         AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
1418                   [bio_end_sector is defined])
1419 ])
1420 ]) # LC_HAVE_BIO_END_SECTOR
1421
1422 #
1423 # 3.9 created is_sxid
1424 #
1425 AC_DEFUN([LC_HAVE_IS_SXID], [
1426 LB_CHECK_COMPILE([if 'is_sxid' is defined],
1427 is_sxid, [
1428         #include <linux/fs.h>
1429 ],[
1430         struct inode inode;
1431
1432         is_sxid(inode.i_mode);
1433 ],[
1434         AC_DEFINE(HAVE_IS_SXID, 1, [is_sxid is defined])
1435 ])
1436 ]) # LC_HAVE_IS_SXID
1437
1438 #
1439 # LC_HAVE_REMOVE_PROC_SUBTREE
1440 #
1441 # 3.10 introduced remove_proc_subtree
1442 #
1443 AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [
1444 LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined],
1445 remove_proc_subtree, [
1446         #include <linux/proc_fs.h>
1447 ],[
1448         remove_proc_subtree(NULL, NULL);
1449 ], [
1450         AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1,
1451                   [remove_proc_subtree is defined])
1452 ])
1453 ]) # LC_HAVE_REMOVE_PROC_SUBTREE
1454
1455 #
1456 # LC_HAVE_PROC_REMOVE
1457 #
1458 # 3.10 introduced proc_remove
1459 #
1460 AC_DEFUN([LC_HAVE_PROC_REMOVE], [
1461 LB_CHECK_COMPILE([if 'proc_remove' is defined],
1462 proc_remove, [
1463         #include <linux/proc_fs.h>
1464 ],[
1465         proc_remove(NULL);
1466 ], [
1467         AC_DEFINE(HAVE_PROC_REMOVE, 1,
1468                   [proc_remove is defined])
1469 ])
1470 ]) # LC_HAVE_PROC_REMOVE
1471
1472 #
1473 # LC_BLKDEV_RELEASE_RETURN_INT
1474 #
1475 # 3.10 release for block device doesn't return int
1476 #
1477 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT], [
1478 LB_CHECK_COMPILE([if 'block_device_operations' release returns 'int'],
1479 block_device_ops_release_return_int, [
1480         #include <linux/blkdev.h>
1481 ],[
1482         struct block_device_operations fops;
1483         int i __attribute__ ((unused));
1484
1485         i = fops.release(NULL, 0);
1486 ],[
1487         AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1488                 [block device release returns int])
1489 ])
1490 ]) # LC_BLKDEV_RELEASE_RETURN_INT
1491
1492 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
1493 LB_CHECK_COMPILE([if get_projid exists],
1494 get_projid, [
1495         #include <linux/quota.h>
1496 ],[
1497         struct dquot_operations ops;
1498
1499         ops.get_projid(NULL, NULL);
1500 ],[
1501         AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
1502                 [get_projid function exists])
1503 ])
1504 ]) # LC_HAVE_PROJECT_QUOTA
1505
1506
1507 #
1508 # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1509 #
1510 # 3.10 introduced security_dentry_init_security()
1511 #
1512 AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_SECURITY], [
1513 LB_CHECK_COMPILE([if 'security_dentry_init_security' is defined],
1514 security_dentry_init_security, [
1515         #include <linux/security.h>
1516 ],[
1517         security_dentry_init_security(NULL, 0, NULL, NULL, NULL);
1518 ],[
1519         AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_SECURITY, 1,
1520                 [security_dentry_init_security' is defined])
1521 ])
1522 ]) # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1523
1524 #
1525 # LC_INVALIDATE_RANGE
1526 #
1527 # 3.11 invalidatepage requires the length of the range to invalidate
1528 #
1529 AC_DEFUN([LC_INVALIDATE_RANGE], [
1530 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
1531 address_space_ops_invalidatepage_3args, [
1532         #include <linux/fs.h>
1533 ],[
1534         struct address_space_operations a_ops;
1535         a_ops.invalidatepage(NULL, 0, 0);
1536 ],[
1537         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
1538                 [address_space_operations.invalidatepage needs 3 arguments])
1539 ])
1540 ]) # LC_INVALIDATE_RANGE
1541
1542 #
1543 # LC_HAVE_DIR_CONTEXT
1544 #
1545 # 3.11 readdir now takes the new struct dir_context
1546 #
1547 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
1548 LB_CHECK_COMPILE([if 'dir_context' exist],
1549 dir_context, [
1550         #include <linux/fs.h>
1551 ],[
1552         struct dir_context ctx;
1553         ctx.pos = 0;
1554 ],[
1555         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
1556                 [dir_context exist])
1557 ])
1558 ]) # LC_HAVE_DIR_CONTEXT
1559
1560 #
1561 # LC_D_COMPARE_5ARGS
1562 #
1563 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1564 #
1565 AC_DEFUN([LC_D_COMPARE_5ARGS], [
1566 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
1567 d_compare_5args, [
1568         #include <linux/dcache.h>
1569 ],[
1570         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1571 ],[
1572         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1573                 [d_compare need 5 arguments])
1574 ])
1575 ]) # LC_D_COMPARE_5ARGS
1576
1577 #
1578 # LC_HAVE_DCOUNT
1579 #
1580 # 3.11 need to access d_count to get dentry reference count
1581 #
1582 AC_DEFUN([LC_HAVE_DCOUNT], [
1583 LB_CHECK_COMPILE([if 'd_count' exist],
1584 d_count, [
1585         #include <linux/dcache.h>
1586 ],[
1587         struct dentry de;
1588         d_count(&de);
1589 ],[
1590         AC_DEFINE(HAVE_D_COUNT, 1,
1591                 [d_count exist])
1592 ])
1593 ]) # LC_HAVE_DCOUNT
1594
1595 #
1596 # LC_PID_NS_FOR_CHILDREN
1597 #
1598 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
1599 #
1600 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
1601 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
1602 pid_ns_for_children, [
1603         #include <linux/nsproxy.h>
1604 ],[
1605         struct nsproxy ns;
1606         ns.pid_ns_for_children = NULL;
1607 ],[
1608         AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
1609                   ['struct nsproxy' has 'pid_ns_for_children'])
1610 ])
1611 ]) # LC_PID_NS_FOR_CHILDREN
1612
1613 #
1614 # LC_OLDSIZE_TRUNCATE_PAGECACHE
1615 #
1616 # 3.12 truncate_pagecache without oldsize parameter
1617 #
1618 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
1619 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
1620 truncate_pagecache_old_size, [
1621         #include <linux/mm.h>
1622 ],[
1623         truncate_pagecache(NULL, 0, 0);
1624 ],[
1625         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
1626                 [with oldsize])
1627 ])
1628 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
1629
1630 #
1631 # LC_HAVE_DENTRY_D_U_D_ALIAS
1632 #
1633 # 3.11 kernel moved d_alias to the union d_u in struct dentry
1634 #
1635 # Some distros move d_alias to d_u but it is still a struct list
1636 #
1637 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
1638 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
1639         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
1640         d_alias, [
1641                 #include <linux/list.h>
1642                 #include <linux/dcache.h>
1643         ],[
1644                 struct dentry de;
1645                 INIT_LIST_HEAD(&de.d_u.d_alias);
1646         ],[
1647                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1648                         [list dentry.d_u.d_alias exist])
1649         ])
1650 ],[
1651         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
1652         d_alias, [
1653                 #include <linux/list.h>
1654                 #include <linux/dcache.h>
1655         ],[
1656                 struct dentry de;
1657                 INIT_HLIST_NODE(&de.d_u.d_alias);
1658         ],[
1659                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1660                         [hlist dentry.d_u.d_alias exist])
1661         ])
1662 ])
1663 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
1664
1665 #
1666 # LC_HAVE_DENTRY_D_CHILD
1667 #
1668 # 3.11 kernel d_child has been moved out of the union d_u
1669 # in struct dentry
1670 #
1671 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
1672 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
1673 d_child, [
1674         #include <linux/list.h>
1675         #include <linux/dcache.h>
1676 ],[
1677         struct dentry de;
1678         INIT_LIST_HEAD(&de.d_child);
1679 ],[
1680         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
1681                 [dentry.d_child exist])
1682 ])
1683 ]) # LC_HAVE_DENTRY_D_CHILD
1684
1685 #
1686 # LC_KIOCB_KI_LEFT
1687 #
1688 # 3.12 ki_left removed from struct kiocb
1689 #
1690 AC_DEFUN([LC_KIOCB_KI_LEFT], [
1691 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
1692 kiocb_ki_left, [
1693         #include <linux/aio.h>
1694 ],[
1695         ((struct kiocb*)0)->ki_left = 0;
1696 ],[
1697         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
1698                 [ki_left exist])
1699 ])
1700 ]) # LC_KIOCB_KI_LEFT
1701
1702 #
1703 # LC_VFS_RENAME_5ARGS
1704 #
1705 # 3.13 has vfs_rename with 5 args
1706 #
1707 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
1708 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
1709 vfs_rename_5args, [
1710         #include <linux/fs.h>
1711 ],[
1712         vfs_rename(NULL, NULL, NULL, NULL, NULL);
1713 ], [
1714         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
1715                 [kernel has vfs_rename with 5 args])
1716 ])
1717 ]) # LC_VFS_RENAME_5ARGS
1718
1719 #
1720 # LC_VFS_UNLINK_3ARGS
1721 #
1722 # 3.13 has vfs_unlink with 3 args
1723 #
1724 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
1725 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
1726 vfs_unlink_3args, [
1727         #include <linux/fs.h>
1728 ],[
1729         vfs_unlink(NULL, NULL, NULL);
1730 ], [
1731         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
1732                 [kernel has vfs_unlink with 3 args])
1733 ])
1734 ]) # LC_VFS_UNLINK_3ARGS
1735
1736 #
1737 # LC_HAVE_BVEC_ITER
1738 #
1739 # 3.14 move some of its data in struct bio into the new
1740 # struct bvec_iter
1741 #
1742 AC_DEFUN([LC_HAVE_BVEC_ITER], [
1743 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
1744 have_bvec_iter, [
1745         #include <linux/bio.h>
1746 ],[
1747         struct bvec_iter iter;
1748         iter.bi_bvec_done = 0;
1749 ], [
1750         AC_DEFINE(HAVE_BVEC_ITER, 1,
1751                 [kernel has struct bvec_iter])
1752 ])
1753 ]) # LC_HAVE_BVEC_ITER
1754
1755 #
1756 # LC_HAVE_BI_CNT
1757 #
1758 # 4.4 redefined bi_cnt as __bi_cnt
1759 #
1760 AC_DEFUN([LC_HAVE_BI_CNT], [
1761 LB_CHECK_COMPILE([if Linux kernel has bi_cnt in struct bio],
1762 have_bi_cnt, [
1763         #include <asm/atomic.h>
1764         #include <linux/bio.h>
1765 ],[
1766         struct bio bio;
1767         int cnt;
1768         cnt = atomic_read(&bio.bi_cnt);
1769 ], [
1770         AC_DEFINE(HAVE_BI_CNT, 1,
1771                 [struct bio has bi_cnt])
1772 ])
1773 ]) # LC_HAVE_BI_CNT
1774
1775 #
1776 # LC_HAVE_TRUNCATE_IPAGE_FINAL
1777 #
1778 # 3.14 bring truncate_inode_pages_final for evict_inode
1779 #
1780 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
1781 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
1782 truncate_ipages_final, [
1783         #include <linux/mm.h>
1784 ],[
1785         truncate_inode_pages_final(NULL);
1786 ], [
1787         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
1788                 [kernel has truncate_inode_pages_final])
1789 ])
1790 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
1791
1792 #
1793 # LC_IOPS_RENAME_WITH_FLAGS
1794 #
1795 # 3.14 has inode_operations->rename with 5 args
1796 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
1797 #
1798 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
1799 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
1800 iops_rename_with_flags, [
1801         #include <linux/fs.h>
1802 ],[
1803         struct inode *i1 = NULL, *i2 = NULL;
1804         struct dentry *d1 = NULL, *d2 = NULL;
1805         int rc;
1806         rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
1807 ], [
1808         AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
1809                 [inode_operations->rename need flags as argument])
1810 ])
1811 ]) # LC_IOPS_RENAME_WITH_FLAGS
1812
1813 #
1814 # LC_VFS_RENAME_6ARGS
1815 #
1816 # 3.15 has vfs_rename with 6 args
1817 #
1818 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
1819 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
1820 vfs_rename_6args, [
1821         #include <linux/fs.h>
1822 ],[
1823         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
1824 ], [
1825         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
1826                 [kernel has vfs_rename with 6 args])
1827 ])
1828 ]) # LC_VFS_RENAME_6ARGS
1829
1830 #
1831 # LC_DIRECTIO_USE_ITER
1832 #
1833 # 3.16 kernel changes direct IO to use iov_iter
1834 #
1835 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
1836 LB_CHECK_COMPILE([if direct IO uses iov_iter],
1837 direct_io_iter, [
1838         #include <linux/fs.h>
1839 ],[
1840         struct address_space_operations ops;
1841         struct iov_iter *iter = NULL;
1842         loff_t offset = 0;
1843
1844         ops.direct_IO(0, NULL, iter, offset);
1845 ],[
1846         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
1847                 [direct IO uses iov_iter])
1848 ])
1849 ]) # LC_DIRECTIO_USE_ITER
1850
1851 #
1852 # LC_HAVE_IOV_ITER_INIT_DIRECTION
1853 #
1854 #
1855 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
1856 #      changed iov_iter_init api to start accepting a tag
1857 #      that defines if its a read or write operation
1858 #
1859 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
1860 tmp_flags="$EXTRA_KCFLAGS"
1861 EXTRA_KCFLAGS="-Werror"
1862 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
1863 iter_init, [
1864         #include <linux/uio.h>
1865         #include <linux/fs.h>
1866 ],[
1867         const struct iovec *iov = NULL;
1868
1869         iov_iter_init(NULL, READ, iov, 1, 0);
1870 ],[
1871         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
1872                 [iov_iter_init handles directional tag])
1873 ])
1874 EXTRA_KCFLAGS="$tmp_flags"
1875 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
1876
1877 #
1878 # LC_HAVE_IOV_ITER_TRUNCATE
1879 #
1880 #
1881 # 3.16 introduces a new API iov_iter_truncate()
1882 #
1883 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
1884 tmp_flags="$EXTRA_KCFLAGS"
1885 EXTRA_KCFLAGS="-Werror"
1886 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
1887 iter_truncate, [
1888         #include <linux/uio.h>
1889         #include <linux/fs.h>
1890 ],[
1891         struct iov_iter *i = NULL;
1892
1893         iov_iter_truncate(i, 0);
1894 ],[
1895         AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
1896 ])
1897 EXTRA_KCFLAGS="$tmp_flags"
1898 ]) # LC_HAVE_IOV_ITER_TRUNCATE
1899
1900 #
1901 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1902 #
1903 # 3.16 introduces [read|write]_iter to struct file_operations
1904 #
1905 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1906 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
1907 file_function_iter, [
1908         #include <linux/fs.h>
1909 ],[
1910         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
1911         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
1912 ],[
1913         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
1914                 [file_operations.[read|write]_iter functions exist])
1915 ])
1916 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1917
1918 #
1919 # LC_KEY_MATCH_DATA
1920 #
1921 # 3.17  replaces key_type::match with match_preparse
1922 #       and has new struct key_match_data
1923 #
1924 AC_DEFUN([LC_KEY_MATCH_DATA], [
1925 LB_CHECK_COMPILE([if struct key_match field exist],
1926 key_match, [
1927         #include <linux/key-type.h>
1928 ],[
1929         struct key_match_data data;
1930 ],[
1931         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
1932                 [struct key_match_data exist])
1933 ])
1934 ]) # LC_KEY_MATCH_DATA
1935
1936 #
1937 # LC_NFS_FILLDIR_USE_CTX
1938 #
1939 # 3.18 kernel moved from void cookie to struct dir_context
1940 #
1941 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1942 tmp_flags="$EXTRA_KCFLAGS"
1943 EXTRA_KCFLAGS="-Werror"
1944 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
1945 filldir_ctx, [
1946         #include <linux/fs.h>
1947 ],[
1948         int filldir(struct dir_context *ctx, const char* name,
1949                     int i, loff_t off, u64 tmp, unsigned temp)
1950         {
1951                 return 0;
1952         }
1953
1954         struct dir_context ctx = {
1955                 .actor = filldir,
1956         };
1957
1958         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1959 ],[
1960         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1961                 [filldir_t needs struct dir_context as argument])
1962 ])
1963 EXTRA_KCFLAGS="$tmp_flags"
1964 ]) # LC_NFS_FILLDIR_USE_CTX
1965
1966 #
1967 # LC_PERCPU_COUNTER_INIT
1968 #
1969 # 3.18  For kernels 3.18 and after percpu_counter_init starts
1970 #       to pass a GFP_* memory allocation flag for internal
1971 #       memory allocation purposes.
1972 #
1973 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1974 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1975 percpu_counter_init, [
1976         #include <linux/percpu_counter.h>
1977 ],[
1978         percpu_counter_init(NULL, 0, GFP_KERNEL);
1979 ],[
1980         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1981                 [percpu_counter_init uses GFP_* flag])
1982 ])
1983 ]) # LC_PERCPU_COUNTER_INIT
1984
1985 #
1986 # LC_KIOCB_HAS_NBYTES
1987 #
1988 # 3.19 kernel removed ki_nbytes from struct kiocb
1989 #
1990 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1991 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1992 ki_nbytes, [
1993         #include <linux/fs.h>
1994 ],[
1995         struct kiocb iocb;
1996
1997         iocb.ki_nbytes = 0;
1998 ],[
1999         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
2000 ])
2001 ]) # LC_KIOCB_HAS_NBYTES
2002
2003 #
2004 # LC_HAVE_DQUOT_QC_DQBLK
2005 #
2006 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
2007 # Added in commit 14bf61ffe
2008 #
2009 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
2010 tmp_flags="$EXTRA_KCFLAGS"
2011 EXTRA_KCFLAGS="-Werror"
2012 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
2013 qc_dqblk, [
2014         #include <linux/fs.h>
2015         #include <linux/quota.h>
2016 ],[
2017         ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
2018 ],[
2019         AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
2020                 [quotactl_ops.set_dqblk takes struct qc_dqblk])
2021         AC_DEFINE(HAVE_DQUOT_KQID, 1,
2022                 [quotactl_ops.set_dqblk takes struct kqid])
2023 ])
2024 EXTRA_KCFLAGS="$tmp_flags"
2025 ]) # LC_HAVE_DQUOT_QC_DQBLK
2026
2027 #
2028 # LC_BACKING_DEV_INFO_REMOVAL
2029 #
2030 # 3.20 kernel removed backing_dev_info from address_space
2031 #
2032 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
2033 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
2034 backing_dev_info, [
2035         #include <linux/fs.h>
2036 ],[
2037         struct address_space mapping;
2038
2039         mapping.backing_dev_info = NULL;
2040 ],[
2041         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
2042 ])
2043 ]) # LC_BACKING_DEV_INFO_REMOVAL
2044
2045 #
2046 # LC_HAVE_BDI_CAP_MAP_COPY
2047 #
2048 # 3.20  removed mmap handling for backing devices since
2049 #       it breaks on non-MMU systems. See kernel commit
2050 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
2051 #
2052 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
2053 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
2054 bdi_cap_map_copy, [
2055         #include <linux/backing-dev.h>
2056 ],[
2057         struct backing_dev_info info;
2058
2059         info.capabilities = BDI_CAP_MAP_COPY;
2060 ],[
2061         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
2062                 [BDI_CAP_MAP_COPY exist])
2063 ])
2064 ]) # LC_HAVE_BDI_CAP_MAP_COPY
2065
2066 #
2067 # LC_CANCEL_DIRTY_PAGE
2068 #
2069 # 4.0.0 kernel removed cancel_dirty_page
2070 #
2071 AC_DEFUN([LC_CANCEL_DIRTY_PAGE], [
2072 LB_CHECK_COMPILE([if cancel_dirty_page still exist],
2073 cancel_dirty_page, [
2074         #include <linux/mm.h>
2075 ],[
2076         cancel_dirty_page(NULL, PAGE_SIZE);
2077 ],[
2078         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
2079                 [cancel_dirty_page is still available])
2080 ])
2081 ]) # LC_CANCEL_DIRTY_PAGE
2082
2083 #
2084 # LC_IOV_ITER_RW
2085 #
2086 # 4.1 kernel has iov_iter_rw
2087 #
2088 AC_DEFUN([LC_IOV_ITER_RW], [
2089 LB_CHECK_COMPILE([if iov_iter_rw exist],
2090 iov_iter_rw, [
2091         #include <linux/fs.h>
2092         #include <linux/uio.h>
2093 ],[
2094         struct iov_iter *iter = NULL;
2095
2096         iov_iter_rw(iter);
2097 ],[
2098         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
2099                 [iov_iter_rw exist])
2100 ])
2101 ]) # LC_IOV_ITER_RW
2102
2103 #
2104 # LC_HAVE_SYNC_READ_WRITE
2105 #
2106 # 4.1 new_sync_[read|write] no longer exported
2107 #
2108 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
2109 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
2110         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
2111                         [new_sync_[read|write] is exported by the kernel])])
2112 ]) # LC_HAVE_SYNC_READ_WRITE
2113
2114 #
2115 # LC_NEW_CANCEL_DIRTY_PAGE
2116 #
2117 # 4.2 kernel has new cancel_dirty_page
2118 #
2119 AC_DEFUN([LC_NEW_CANCEL_DIRTY_PAGE], [
2120 LB_CHECK_COMPILE([if cancel_dirty_page with one argument exist],
2121 new_cancel_dirty_page, [
2122         #include <linux/mm.h>
2123 ],[
2124         cancel_dirty_page(NULL);
2125 ],[
2126         AC_DEFINE(HAVE_NEW_CANCEL_DIRTY_PAGE, 1,
2127                 [cancel_dirty_page with one arguement is available])
2128 ])
2129 ]) # LC_NEW_CANCEL_DIRTY_PAGE
2130
2131 #
2132 # LC_SYMLINK_OPS_USE_NAMEIDATA
2133 #
2134 # For the 4.2+ kernels the file system internal symlink api no
2135 # longer uses struct nameidata as a argument
2136 #
2137 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
2138 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
2139 symlink_use_nameidata, [
2140         #include <linux/namei.h>
2141         #include <linux/fs.h>
2142 ],[
2143         struct nameidata *nd = NULL;
2144
2145         ((struct inode_operations *)0)->follow_link(NULL, nd);
2146         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
2147 ],[
2148         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
2149                 [symlink inode operations need struct nameidata argument])
2150 ])
2151 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
2152
2153 #
2154 # LC_BIO_ENDIO_USES_ONE_ARG
2155 #
2156 # 4.2 kernel bio_endio now only takes one argument
2157 #
2158 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
2159 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
2160 bio_endio, [
2161         #include <linux/bio.h>
2162 ],[
2163         bio_endio(NULL);
2164 ],[
2165         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
2166                 [bio_endio takes only one argument])
2167 ])
2168 ]) # LC_BIO_ENDIO_USES_ONE_ARG
2169
2170 #
2171 # LC_HAVE_LOOP_CTL_GET_FREE
2172 #
2173 # 4.x kernel have moved userspace APIs to
2174 # the separate directory and all of them
2175 # support LOOP_CTL_GET_FREE
2176 #
2177 AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [
2178 LB_CHECK_FILE([$LINUX/include/linux/loop.h], [
2179         LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'],
2180         LOOP_CTL_GET_FREE, [
2181                 #include <linux/loop.h>
2182         ],[
2183                 int i;
2184
2185                 i = LOOP_CTL_GET_FREE;
2186         ],[
2187                 AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
2188                         [LOOP_CTL_GET_FREE exist])
2189         ])
2190 ],[
2191         AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
2192                 [kernel has LOOP_CTL_GET_FREE])
2193 ])
2194 ]) # LC_HAVE_LOOP_CTL_GET_FREE
2195
2196 #
2197 # LC_HAVE_CACHE_HEAD_HLIST
2198 #
2199 # 4.3 kernel swiched to hlist for cache_head
2200 #
2201 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
2202 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
2203 cache_head_has_hlist, [
2204         #include <linux/sunrpc/cache.h>
2205 ],[
2206         do {} while(sizeof(((struct cache_head *)0)->cache_list));
2207 ],[
2208         AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
2209                 [cache_head has hlist cache_list])
2210 ])
2211 ]) # LC_HAVE_CACHE_HEAD_HLIST
2212
2213 #
2214 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2215 #
2216 # 4.4 kernel have moved locks API users to
2217 # locks_lock_inode_wait()
2218 #
2219 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
2220 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
2221 locks_lock_file_wait, [
2222         #include <linux/fs.h>
2223 ],[
2224         locks_lock_file_wait(NULL, NULL);
2225 ],[
2226         AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
2227                 [kernel has locks_lock_file_wait])
2228 ])
2229 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2230
2231 #
2232 # LC_HAVE_QC_MAKE_REQUEST_FN
2233 #
2234 # 4.4 request_queue.make_request_fn defined as function returns with blk_qc_t
2235 # see kernel commit dece16353ef47d8d33f5302bc158072a9d65e26f
2236 #
2237 AC_DEFUN([LC_HAVE_QC_MAKE_REQUEST_FN], [
2238 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns blk_qc_t],
2239 make_request_fn_blk_qc_t, [
2240         #include <linux/blkdev.h>
2241 ],[
2242         blk_qc_t ret;
2243         make_request_fn *mrf;
2244         ret = mrf(NULL, NULL);
2245 ],[
2246         AC_DEFINE(HAVE_QC_MAKE_REQUEST_FN, 1,
2247                 [request_queue.make_request_fn returns blk_qc_t])
2248 ])
2249 ]) # LC_HAVE_QC_MAKE_REQUEST_FN
2250
2251 #
2252 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2253 #
2254 # 4.4 kernel merged type-specific data with the payload data for keys
2255 #
2256 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
2257 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
2258 key_payload_data_array, [
2259         #include <linux/key.h>
2260 ],[
2261         ((struct key *)0)->payload.data[0] = NULL;
2262 ],[
2263         AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
2264 ])
2265 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2266
2267 #
2268 # LC_HAVE_FILE_DENTRY
2269 #
2270 # 4.5 adds wrapper file_dentry
2271 #
2272 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
2273 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
2274 file_dentry, [
2275         #include <linux/fs.h>
2276 ],[
2277         file_dentry(NULL);
2278 ], [
2279         AC_DEFINE(HAVE_FILE_DENTRY, 1,
2280                 [kernel has file_dentry])
2281 ])
2282 ]) # LC_HAVE_FILE_DENTRY
2283
2284 #
2285 # LC_HAVE_INODE_LOCK
2286 #
2287 # 4.5 introduced inode_lock
2288 #
2289 AC_DEFUN([LC_HAVE_INODE_LOCK], [
2290 LB_CHECK_COMPILE([if 'inode_lock' is defined],
2291 inode_lock, [
2292         #include <linux/fs.h>
2293 ],[
2294         inode_lock(NULL);
2295 ], [
2296         AC_DEFINE(HAVE_INODE_LOCK, 1,
2297                   [inode_lock is defined])
2298 ])
2299 ]) # LC_HAVE_INODE_LOCK
2300
2301 #
2302 # LC_HAVE_IOP_GET_LINK
2303 #
2304 # 4.5 vfs replaced iop->follow_link with
2305 # iop->get_link
2306 #
2307 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
2308 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
2309 inode_ops_get_link, [
2310         #include <linux/fs.h>
2311 ],[
2312         struct inode_operations iop;
2313         iop.get_link = NULL;
2314 ],[
2315         AC_DEFINE(HAVE_IOP_GET_LINK, 1,
2316                 [have iop get_link])
2317 ])
2318 ]) # LC_HAVE_IOP_GET_LINK
2319
2320 #
2321 # LC_HAVE_IN_COMPAT_SYSCALL
2322 #
2323 # 4.6 renamed is_compat_task to in_compat_syscall
2324 #
2325 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
2326 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
2327 in_compat_syscall, [
2328         #include <linux/compat.h>
2329 ],[
2330         in_compat_syscall();
2331 ],[
2332         AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
2333                 [have in_compat_syscall])
2334 ])
2335 ]) # LC_HAVE_IN_COMPAT_SYSCALL
2336
2337 #
2338 # LC_DIRECTIO_2ARGS
2339 #
2340 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
2341 # direct-io: eliminate the offset argument to ->direct_IO
2342 #
2343 AC_DEFUN([LC_DIRECTIO_2ARGS], [
2344 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
2345 direct_io_2args, [
2346         #include <linux/fs.h>
2347 ],[
2348         struct address_space_operations ops;
2349         struct iov_iter *iter = NULL;
2350         struct kiocb *iocb = NULL;
2351         int rc;
2352         rc = ops.direct_IO(iocb, iter);
2353 ],[
2354         AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
2355                 [direct_IO need 2 arguments])
2356 ])
2357 ]) # LC_DIRECTIO_2ARGS
2358
2359 #
2360 # LC_GENERIC_WRITE_SYNC_2ARGS
2361 #
2362 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
2363 # direct-io: eliminate the offset argument to ->direct_IO
2364 #
2365 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
2366 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
2367 generic_write_sync_2args, [
2368         #include <linux/fs.h>
2369 ],[
2370         struct kiocb *iocb = NULL;
2371         ssize_t rc;
2372         rc = generic_write_sync(iocb, 0);
2373 ],[
2374         AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
2375                 [generic_write_sync need 2 arguments])
2376 ])
2377 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
2378
2379 #
2380 # LC_HAVE_POSIX_ACL_VALID_USER_NS
2381 #
2382 # 4.8 posix_acl_valid takes struct user_namespace
2383 #
2384 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
2385 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
2386 posix_acl_valid, [
2387         #include <linux/fs.h>
2388         #include <linux/posix_acl.h>
2389 ],[
2390         posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
2391 ],[
2392         AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
2393                 [posix_acl_valid takes struct user_namespace])
2394 ])
2395 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
2396
2397 #
2398 # LC_D_COMPARE_4ARGS
2399 #
2400 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
2401 # get rid of 'parent' argument of ->d_compare()
2402 #
2403 AC_DEFUN([LC_D_COMPARE_4ARGS], [
2404 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
2405 d_compare_4args, [
2406         #include <linux/dcache.h>
2407 ],[
2408         ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
2409 ],[
2410         AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
2411                 [d_compare need 4 arguments])
2412 ])
2413 ]) # LC_D_COMPARE_4ARGS
2414
2415 #
2416 # LC_FULL_NAME_HASH_3ARGS
2417 #
2418 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
2419 # vfs: make the string hashes salt the hash
2420 #
2421 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
2422 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
2423 full_name_hash_3args, [
2424         #include <linux/stringhash.h>
2425 ],[
2426         unsigned int hash;
2427         hash = full_name_hash(NULL,NULL,0);
2428 ],[
2429         AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
2430                 [full_name_hash need 3 arguments])
2431 ])
2432 ]) # LC_FULL_NAME_HASH_3ARGS
2433
2434 #
2435 # LC_GROUP_INFO_GID
2436 #
2437 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
2438 # cred: simpler, 1D supplementary groups
2439 #
2440 AC_DEFUN([LC_GROUP_INFO_GID], [
2441 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
2442 group_info_gid, [
2443         #include <linux/cred.h>
2444 ],[
2445         kgid_t *p;
2446         p = ((struct group_info *)0)->gid;
2447 ],[
2448         AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
2449                 [struct group_info has member gid])
2450 ])
2451 ]) # LC_GROUP_INFO_GID
2452
2453 #
2454 # LC_STRUCT_POSIX_ACL_XATTR
2455 #
2456 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
2457 # posix_acl: xattr representation cleanups
2458 #
2459 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
2460 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
2461 struct_posix_acl_xattr, [
2462         #include <linux/fs.h>
2463         #include <linux/posix_acl_xattr.h>
2464 ],[
2465         struct posix_acl_xattr_header *h = NULL;
2466         struct posix_acl_xattr_entry  *e;
2467         e = (void *)(h + 1);
2468 ],[
2469         AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
2470                 [struct posix_acl_xattr_{header,entry} defined])
2471 ])
2472 ]) # LC_STRUCT_POSIX_ACL_XATTR
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_PROG_LINUX
2514 #
2515 # Lustre linux kernel checks
2516 #
2517 AC_DEFUN([LC_PROG_LINUX], [
2518         AC_MSG_NOTICE([Lustre kernel checks
2519 ==============================================================================])
2520
2521         LC_CONFIG_PINGER
2522         LC_CONFIG_CHECKSUM
2523         LC_CONFIG_HEALTH_CHECK_WRITE
2524         LC_CONFIG_LRU_RESIZE
2525
2526         LC_GLIBC_SUPPORT_FHANDLES
2527         LC_CONFIG_GSS
2528         LC_OPENSSL_SSK
2529
2530         # 2.6.32
2531         LC_BLK_QUEUE_MAX_SEGMENTS
2532
2533         # 2.6.34
2534         LC_HAVE_DQUOT_FS_DISK_QUOTA
2535         LC_HAVE_DQUOT_SUSPEND
2536         LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
2537
2538         # 2.6.35, 3.0.0
2539         LC_FILE_FSYNC
2540         LC_EXPORT_SIMPLE_SETATTR
2541         LC_EXPORT_TRUNCATE_COMPLETE_PAGE
2542
2543         # 2.6.36
2544         LC_FS_STRUCT_RWLOCK
2545         LC_SBOPS_EVICT_INODE
2546
2547         # 2.6.37
2548         LC_KERNEL_LOCKED
2549
2550         # 2.6.38
2551         LC_BLKDEV_GET_BY_DEV
2552         LC_GENERIC_PERMISSION
2553         LC_DCACHE_LOCK
2554         LC_INODE_I_RCU
2555         LC_D_COMPARE_7ARGS
2556         LC_D_DELETE_CONST
2557         LC_HAVE_BLK_PLUG
2558
2559         # 2.6.39
2560         LC_REQUEST_QUEUE_UNPLUG_FN
2561         LC_HAVE_FHANDLE_SYSCALLS
2562         LC_HAVE_FSTYPE_MOUNT
2563         LC_IOP_TRUNCATE
2564         LC_HAVE_INODE_OWNER_OR_CAPABLE
2565         LC_HAVE_SECURITY_IINITSEC
2566
2567         # 3.0
2568         LC_DIRTY_INODE_WITH_FLAG
2569         LC_SETNS
2570
2571         # 3.1
2572         LC_LM_XXX_LOCK_MANAGER_OPS
2573         LC_INODE_DIO_WAIT
2574         LC_IOP_GET_ACL
2575         LC_FILE_LLSEEK_SIZE
2576         LC_INODE_PERMISION_2ARGS
2577         LC_RADIX_EXCEPTION_ENTRY
2578         LC_HAVE_LOOP_CTL_GET_FREE
2579
2580         # 3.2
2581         LC_HAVE_VOID_MAKE_REQUEST_FN
2582         LC_HAVE_PROTECT_I_NLINK
2583
2584         # 3.3
2585         LC_HAVE_MIGRATE_HEADER
2586         LC_MIGRATEPAGE_4ARGS
2587         LC_SUPEROPS_USE_DENTRY
2588         LC_INODEOPS_USE_UMODE_T
2589         LC_HAVE_CACHE_REGISTER
2590
2591         # 3.4
2592         LC_HAVE_D_MAKE_ROOT
2593         LC_KMAP_ATOMIC_HAS_1ARG
2594
2595         # 3.5
2596         LC_HAVE_CLEAR_INODE
2597         LC_HAVE_ENCODE_FH_PARENT
2598         LC_FILE_LLSEEK_SIZE_5ARG
2599
2600         # 3.6
2601         LC_DATA_FOR_LLITE_IS_LIST
2602         LC_DENTRY_OPEN_USE_PATH
2603         LC_HAVE_IOP_ATOMIC_OPEN
2604         LC_HAVE_SB_START_WRITE
2605
2606         # 3.7
2607         LC_HAVE_POSIXACL_USER_NS
2608
2609         # 3.8
2610         LC_HAVE_FILE_F_INODE
2611         LC_HAVE_FILE_INODE
2612         LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
2613
2614         # 3.9
2615         LC_HAVE_HLIST_FOR_EACH_3ARG
2616         LC_HAVE_BIO_END_SECTOR
2617         LC_HAVE_IS_SXID
2618
2619         # 3.10
2620         LC_BLKDEV_RELEASE_RETURN_INT
2621         LC_HAVE_REMOVE_PROC_SUBTREE
2622         LC_HAVE_PROC_REMOVE
2623         LC_HAVE_PROJECT_QUOTA
2624         LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
2625
2626         # 3.11
2627         LC_INVALIDATE_RANGE
2628         LC_HAVE_DIR_CONTEXT
2629         LC_D_COMPARE_5ARGS
2630         LC_HAVE_DCOUNT
2631         LC_HAVE_DENTRY_D_U_D_ALIAS
2632         LC_HAVE_DENTRY_D_CHILD
2633         LC_PID_NS_FOR_CHILDREN
2634
2635         # 3.12
2636         LC_OLDSIZE_TRUNCATE_PAGECACHE
2637         LC_KIOCB_KI_LEFT
2638
2639         # 3.13
2640         LC_VFS_RENAME_5ARGS
2641         LC_VFS_UNLINK_3ARGS
2642
2643         # 3.14
2644         LC_HAVE_BVEC_ITER
2645         LC_HAVE_TRUNCATE_IPAGES_FINAL
2646         LC_IOPS_RENAME_WITH_FLAGS
2647
2648         # 3.15
2649         LC_VFS_RENAME_6ARGS
2650
2651         # 3.16
2652         LC_DIRECTIO_USE_ITER
2653         LC_HAVE_IOV_ITER_INIT_DIRECTION
2654         LC_HAVE_IOV_ITER_TRUNCATE
2655         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2656
2657         # 3.17
2658         LC_KEY_MATCH_DATA
2659
2660         # 3.18
2661         LC_PERCPU_COUNTER_INIT
2662         LC_NFS_FILLDIR_USE_CTX
2663
2664         # 3.19
2665         LC_KIOCB_HAS_NBYTES
2666         LC_HAVE_DQUOT_QC_DQBLK
2667
2668         # 3.20
2669         LC_BACKING_DEV_INFO_REMOVAL
2670         LC_HAVE_BDI_CAP_MAP_COPY
2671
2672         # 4.0.0
2673         LC_CANCEL_DIRTY_PAGE
2674
2675         # 4.1.0
2676         LC_IOV_ITER_RW
2677         LC_HAVE_SYNC_READ_WRITE
2678
2679         # 4.2
2680         LC_NEW_CANCEL_DIRTY_PAGE
2681         LC_BIO_ENDIO_USES_ONE_ARG
2682         LC_SYMLINK_OPS_USE_NAMEIDATA
2683
2684         # 4.3
2685         LC_HAVE_CACHE_HEAD_HLIST
2686
2687         # 4.4
2688         LC_HAVE_LOCKS_LOCK_FILE_WAIT
2689         LC_HAVE_QC_MAKE_REQUEST_FN
2690         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2691         LC_HAVE_BI_CNT
2692
2693         # 4.5
2694         LC_HAVE_FILE_DENTRY
2695
2696         # 4.5
2697         LC_HAVE_INODE_LOCK
2698         LC_HAVE_IOP_GET_LINK
2699
2700         # 4.6
2701         LC_HAVE_IN_COMPAT_SYSCALL
2702
2703         # 4.7
2704         LC_DIRECTIO_2ARGS
2705         LC_GENERIC_WRITE_SYNC_2ARGS
2706
2707         # 4.8
2708         LC_HAVE_POSIX_ACL_VALID_USER_NS
2709         LC_D_COMPARE_4ARGS
2710         LC_FULL_NAME_HASH_3ARGS
2711         LC_STRUCT_POSIX_ACL_XATTR
2712
2713         # 4.9
2714         LC_GROUP_INFO_GID
2715
2716         # 4.10
2717         LC_IOP_GENERIC_READLINK
2718         LC_HAVE_VM_FAULT_ADDRESS
2719
2720         #
2721         AS_IF([test "x$enable_server" != xno], [
2722                 LC_STACK_SIZE
2723                 LC_QUOTA64
2724                 LC_QUOTA_CONFIG
2725         ])
2726 ]) # LC_PROG_LINUX
2727
2728 #
2729 # LC_CONFIG_CLIENT
2730 #
2731 # Check whether to build the client side of Lustre
2732 #
2733 AC_DEFUN([LC_CONFIG_CLIENT], [
2734 AC_MSG_CHECKING([whether to build Lustre client support])
2735 AC_ARG_ENABLE([client],
2736         AC_HELP_STRING([--disable-client],
2737                 [disable Lustre client support]),
2738         [], [enable_client="yes"])
2739 AC_MSG_RESULT([$enable_client])
2740 ]) # LC_CONFIG_CLIENT
2741
2742 #
2743 # --enable-mpitests
2744 #
2745 AC_DEFUN([LB_CONFIG_MPITESTS], [
2746 AC_ARG_ENABLE([mpitests],
2747         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2748                        [include mpi tests]), [
2749                 enable_mpitests="yes"
2750                 case $enableval in
2751                 yes)
2752                         MPICC_WRAPPER="mpicc"
2753                         ;;
2754                 no)
2755                         enable_mpitests="no"
2756                         ;;
2757                 *)
2758                         MPICC_WRAPPER=$enableval
2759                         ;;
2760                 esac
2761         ], [
2762                 enable_mpitests="yes"
2763                 MPICC_WRAPPER="mpicc"
2764         ])
2765
2766         if test "x$enable_mpitests" != "xno"; then
2767                 oldcc=$CC
2768                 CC=$MPICC_WRAPPER
2769                 AC_CACHE_CHECK([whether mpitests can be built],
2770                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2771                         #include <mpi.h>
2772                         int main(void) {
2773                                 int flag;
2774                                 MPI_Initialized(&flag);
2775                                 return 0;
2776                         }
2777                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
2778                 ])
2779                 enable_mpitests=$lb_cv_mpi_tests
2780                 CC=$oldcc
2781         fi
2782         AC_SUBST(MPICC_WRAPPER)
2783 ]) # LB_CONFIG_MPITESTS
2784
2785 #
2786 # LC_CONFIG_QUOTA
2787 #
2788 # whether to enable quota support global control
2789 #
2790 AC_DEFUN([LC_CONFIG_QUOTA], [
2791 AC_MSG_CHECKING([whether to enable quota support global control])
2792 AC_ARG_ENABLE([quota],
2793         AC_HELP_STRING([--enable-quota],
2794                 [enable quota support]),
2795         [], [enable_quota="yes"])
2796 AS_IF([test "x$enable_quota" = xyes],
2797         [AC_MSG_RESULT([yes])],
2798         [AC_MSG_RESULT([no])])
2799 ]) # LC_CONFIG_QUOTA
2800
2801 #
2802 # LC_QUOTA
2803 #
2804 AC_DEFUN([LC_QUOTA], [
2805 #check global
2806 LC_CONFIG_QUOTA
2807 #check for utils
2808 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
2809         AC_CHECK_HEADER([sys/quota.h],
2810                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
2811                         [Define to 1 if you have <sys/quota.h>.])],
2812                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2813 ])
2814 ]) # LC_QUOTA
2815
2816 #
2817 # LC_CONFIG_NODEMAP_PROC_DEBUG
2818 #
2819 # enable nodemap proc file debugging
2820 #
2821 AC_DEFUN([LC_NODEMAP_PROC_DEBUG], [
2822 AC_MSG_CHECKING([whether to enable nodemap proc debug])
2823 AC_ARG_ENABLE([nodemap_proc_debug],
2824         AC_HELP_STRING([--enable-nodemap-proc-debug],
2825                 [enable nodemap proc debug]),
2826         [], [enable_nodemap_proc_debug="no"])
2827 AC_MSG_RESULT([$enable_nodemap_proc_debug])
2828 AS_IF([test "x$enable_nodemap_proc_debug" != xno],
2829         [AC_DEFINE(NODEMAP_PROC_DEBUG, 1,
2830                 [enable nodemap proc debug support])])
2831 ]) # LC_NODEMAP_PROC_DEBUG
2832
2833 #
2834 # LC_OSD_ADDON
2835 #
2836 # configure support for optional OSD implementation
2837 #
2838 AC_DEFUN([LC_OSD_ADDON], [
2839 AC_MSG_CHECKING([whether to use OSD addon])
2840 AC_ARG_WITH([osd],
2841         AC_HELP_STRING([--with-osd=path],
2842                 [set path to optional osd]),
2843         [
2844         case "$with_osd" in
2845         no)
2846                 ENABLEOSDADDON=0
2847                 ;;
2848         *)
2849                 OSDADDON="$with_osd"
2850                 ENABLEOSDADDON=1
2851                 ;;
2852         esac
2853         ], [
2854                 ENABLEOSDADDON=0
2855         ])
2856 AS_IF([test $ENABLEOSDADDON -eq 0], [
2857         AC_MSG_RESULT([no])
2858         OSDADDON=""
2859 ], [
2860         OSDMODNAME=$(basename $OSDADDON)
2861         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
2862                 AC_MSG_RESULT([can't link])
2863                 OSDADDON=""
2864         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
2865                 AC_MSG_RESULT([$OSDMODNAME])
2866                 OSDADDON="subdir-m += $OSDMODNAME"
2867         ], [
2868                 AC_MSG_RESULT([can't link])
2869                 OSDADDON=""
2870         ])
2871 ])
2872 AC_SUBST(OSDADDON)
2873 ]) # LC_OSD_ADDON
2874
2875 #
2876 # LC_CONFIGURE
2877 #
2878 # other configure checks
2879 #
2880 AC_DEFUN([LC_CONFIGURE], [
2881 AC_MSG_NOTICE([Lustre core checks
2882 ==============================================================================])
2883
2884 LC_CONFIG_OBD_BUFFER_SIZE
2885
2886 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
2887         [CFLAGS="$CFLAGS -Wall -Werror"])
2888
2889 # maximum MDS thread count
2890 LC_MDS_MAX_THREADS
2891
2892 # lustre/utils/gss/gss_util.c
2893 # lustre/utils/gss/gssd_proc.c
2894 # lustre/utils/gss/krb5_util.c
2895 # lustre/utils/llog_reader.c
2896 # lustre/utils/create_iam.c
2897 # lustre/utils/libiam.c
2898 AC_CHECK_HEADERS([netdb.h endian.h])
2899 AC_CHECK_FUNCS([gethostbyname])
2900
2901 # lustre/utils/llverdev.c
2902 AC_CHECK_HEADERS([blkid/blkid.h])
2903
2904 # lustre/utils/llverfs.c
2905 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2906
2907 SELINUX=""
2908 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2909         [AC_CHECK_HEADERS([selinux/selinux.h],
2910                         [SELINUX="-lselinux"
2911                         AC_DEFINE([HAVE_SELINUX], 1,
2912                                 [support for selinux ])],
2913                         [AC_MSG_WARN([
2914
2915 No libselinux-devel package found, unable to build selinux enabled tools
2916 ])
2917 ])],
2918         [AC_MSG_WARN([
2919
2920 No selinux package found, unable to build selinux enabled tools
2921 ])
2922 ])
2923 AC_SUBST(SELINUX)
2924
2925 # Super safe df
2926 AC_MSG_CHECKING([whether to report minimum OST free space])
2927 AC_ARG_ENABLE([mindf],
2928         AC_HELP_STRING([--enable-mindf],
2929                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2930         [], [enable_mindf="no"])
2931 AC_MSG_RESULT([$enable_mindf])
2932 AS_IF([test "$enable_mindf" = "yes"],
2933         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2934
2935 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2936 AC_ARG_ENABLE([fail_alloc],
2937         AC_HELP_STRING([--disable-fail-alloc],
2938                 [disable randomly alloc failure]),
2939         [], [enable_fail_alloc="yes"])
2940 AC_MSG_RESULT([$enable_fail_alloc])
2941 AS_IF([test "x$enable_fail_alloc" != xno],
2942         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2943                 [enable randomly alloc failure])])
2944
2945 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2946 AC_ARG_ENABLE([invariants],
2947         AC_HELP_STRING([--enable-invariants],
2948                 [enable invariant checking (cpu intensive)]),
2949         [], [enable_invariants="no"])
2950 AC_MSG_RESULT([$enable_invariants])
2951 AS_IF([test "x$enable_invariants" = xyes],
2952         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2953                 [enable invariant checking])])
2954
2955 AC_MSG_CHECKING([whether to track references with lu_ref])
2956 AC_ARG_ENABLE([lu_ref],
2957         AC_HELP_STRING([--enable-lu_ref],
2958                 [enable lu_ref reference tracking code]),
2959         [], [enable_lu_ref="no"])
2960 AC_MSG_RESULT([$enable_lu_ref])
2961 AS_IF([test "x$enable_lu_ref" = xyes],
2962         [AC_DEFINE([USE_LU_REF], 1,
2963                 [enable lu_ref reference tracking code])])
2964
2965 AC_MSG_CHECKING([whether to enable page state tracking])
2966 AC_ARG_ENABLE([pgstate-track],
2967         AC_HELP_STRING([--enable-pgstate-track],
2968                 [enable page state tracking]),
2969         [], [enable_pgstat_track="no"])
2970 AC_MSG_RESULT([$enable_pgstat_track])
2971 AS_IF([test "x$enable_pgstat_track" = xyes],
2972         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2973                 [enable page state tracking code])])
2974
2975 PKG_PROG_PKG_CONFIG
2976 AC_MSG_CHECKING([systemd unit file directory])
2977 AC_ARG_WITH([systemdsystemunitdir],
2978         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
2979                 [Directory for systemd service files])],
2980         [], [with_systemdsystemunitdir=auto])
2981 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
2982         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
2983         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
2984                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
2985                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
2986                 with_systemdsystemunitdir=no],
2987         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
2988 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
2989         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
2990 AC_MSG_RESULT([$with_systemdsystemunitdir])
2991 ]) # LC_CONFIGURE
2992
2993 #
2994 # LC_CONDITIONALS
2995 #
2996 # AM_CONDITIONALS for lustre
2997 #
2998 AC_DEFUN([LC_CONDITIONALS], [
2999 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
3000 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
3001 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
3002 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
3003 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
3004 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
3005 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
3006 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
3007 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
3008 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
3009 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
3010 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
3011 ]) # LC_CONDITIONALS
3012
3013 #
3014 # LC_CONFIG_FILES
3015 #
3016 # files that should be generated with AC_OUTPUT
3017 #
3018 AC_DEFUN([LC_CONFIG_FILES],
3019 [AC_CONFIG_FILES([
3020 lustre/Makefile
3021 lustre/autoMakefile
3022 lustre/autoconf/Makefile
3023 lustre/conf/Makefile
3024 lustre/contrib/Makefile
3025 lustre/doc/Makefile
3026 lustre/include/Makefile
3027 lustre/include/lustre/Makefile
3028 lustre/include/uapi/linux/Makefile
3029 lustre/kernel_patches/targets/3.10-rhel7.target
3030 lustre/kernel_patches/targets/2.6-rhel6.9.target
3031 lustre/kernel_patches/targets/2.6-rhel6.8.target
3032 lustre/kernel_patches/targets/2.6-rhel6.7.target
3033 lustre/kernel_patches/targets/2.6-rhel6.6.target
3034 lustre/kernel_patches/targets/2.6-rhel6.target
3035 lustre/kernel_patches/targets/2.6-rhel5.target
3036 lustre/kernel_patches/targets/2.6-sles11.target
3037 lustre/kernel_patches/targets/3.0-sles11.target
3038 lustre/kernel_patches/targets/3.0-sles11sp3.target
3039 lustre/kernel_patches/targets/3.0-sles11sp4.target
3040 lustre/kernel_patches/targets/3.12-sles12.target
3041 lustre/kernel_patches/targets/4.4-sles12.target
3042 lustre/kernel_patches/targets/2.6-fc11.target
3043 lustre/kernel_patches/targets/2.6-fc12.target
3044 lustre/kernel_patches/targets/2.6-fc15.target
3045 lustre/kernel_patches/targets/3.x-fc18.target
3046 lustre/ldlm/Makefile
3047 lustre/fid/Makefile
3048 lustre/fid/autoMakefile
3049 lustre/llite/Makefile
3050 lustre/llite/autoMakefile
3051 lustre/lov/Makefile
3052 lustre/lov/autoMakefile
3053 lustre/mdc/Makefile
3054 lustre/mdc/autoMakefile
3055 lustre/lmv/Makefile
3056 lustre/lmv/autoMakefile
3057 lustre/lfsck/Makefile
3058 lustre/lfsck/autoMakefile
3059 lustre/mdt/Makefile
3060 lustre/mdt/autoMakefile
3061 lustre/mdd/Makefile
3062 lustre/mdd/autoMakefile
3063 lustre/fld/Makefile
3064 lustre/fld/autoMakefile
3065 lustre/obdclass/Makefile
3066 lustre/obdclass/autoMakefile
3067 lustre/obdclass/linux/Makefile
3068 lustre/obdecho/Makefile
3069 lustre/obdecho/autoMakefile
3070 lustre/ofd/Makefile
3071 lustre/ofd/autoMakefile
3072 lustre/osc/Makefile
3073 lustre/osc/autoMakefile
3074 lustre/ost/Makefile
3075 lustre/ost/autoMakefile
3076 lustre/osd-ldiskfs/Makefile
3077 lustre/osd-ldiskfs/autoMakefile
3078 lustre/osd-zfs/Makefile
3079 lustre/osd-zfs/autoMakefile
3080 lustre/mgc/Makefile
3081 lustre/mgc/autoMakefile
3082 lustre/mgs/Makefile
3083 lustre/mgs/autoMakefile
3084 lustre/target/Makefile
3085 lustre/ptlrpc/Makefile
3086 lustre/ptlrpc/autoMakefile
3087 lustre/ptlrpc/gss/Makefile
3088 lustre/ptlrpc/gss/autoMakefile
3089 lustre/quota/Makefile
3090 lustre/quota/autoMakefile
3091 lustre/scripts/Makefile
3092 lustre/scripts/systemd/Makefile
3093 lustre/tests/Makefile
3094 lustre/tests/mpi/Makefile
3095 lustre/tests/kernel/Makefile
3096 lustre/tests/kernel/autoMakefile
3097 lustre/utils/Makefile
3098 lustre/utils/gss/Makefile
3099 lustre/osp/Makefile
3100 lustre/osp/autoMakefile
3101 lustre/lod/Makefile
3102 lustre/lod/autoMakefile
3103 ])
3104 ]) # LC_CONFIG_FILES