Whamcloud - gitweb
4b65c126ddb09a599b5686118c448e111663158d
[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='$(CROSS_PATH)/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_FUNC_DEV_SET_RDONLY
78 #
79 # check whether dev_set_rdonly is exported.  This is needed until we
80 # have another mechanism to fence IO from the underlying device.
81 #
82 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY], [
83 LB_CHECK_EXPORT([dev_set_rdonly], [block/ll_rw_block.c block/blk-core.c],
84         [AC_DEFINE(HAVE_DEV_SET_RDONLY, 1,
85                 [kernel exports dev_set_rdonly])],
86         [AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])])
87 ]) # LC_FUNC_DEV_SET_RDONLY
88
89 #
90 # LC_STACK_SIZE
91 #
92 # Ensure stack size big than 8k in Lustre server (all kernels)
93 #
94 AC_DEFUN([LC_STACK_SIZE], [
95 LB_CHECK_COMPILE([if stack size big than 8k],
96 stack_size_8k, [
97         #include <linux/thread_info.h>
98 ], [
99         #if THREAD_SIZE < 8192
100         #error "stack size < 8192"
101         #endif
102 ], [], [AC_MSG_ERROR([
103
104 Lustre requires that Linux is configured with at least a 8KB stack.
105 ])])
106 ]) # LC_STACK_SIZE
107
108 #
109 # LC_MDS_MAX_THREADS
110 #
111 # Allow the user to set the MDS thread upper limit
112 #
113 AC_DEFUN([LC_MDS_MAX_THREADS], [
114 AC_MSG_CHECKING([for maximum number of MDS threads])
115 AC_ARG_WITH([mds_max_threads],
116         AC_HELP_STRING([--with-mds-max-threads=count],
117                 [maximum threads available on the MDS: (default=512)]),
118         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
119                 [maximum number of MDS threads])])
120 AC_MSG_RESULT([$with_mds_max_threads])
121 ]) # LC_MDS_MAX_THREADS
122
123 #
124 # LC_CONFIG_PINGER
125 #
126 # the pinger is temporary, until we have the recovery node in place
127 #
128 AC_DEFUN([LC_CONFIG_PINGER], [
129 AC_MSG_CHECKING([whether to enable Lustre pinger support])
130 AC_ARG_ENABLE([pinger],
131         AC_HELP_STRING([--disable-pinger],
132                 [disable recovery pinger support]),
133         [], [enable_pinger="yes"])
134 AC_MSG_RESULT([$enable_pinger])
135 AS_IF([test "x$enable_pinger" != xno],
136         [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
137 ]) # LC_CONFIG_PINGER
138
139 #
140 # LC_CONFIG_CHECKSUM
141 #
142 # do checksum of bulk data between client and OST
143 #
144 AC_DEFUN([LC_CONFIG_CHECKSUM], [
145 AC_MSG_CHECKING([whether to enable data checksum support])
146 AC_ARG_ENABLE([checksum],
147         AC_HELP_STRING([--disable-checksum],
148                 [disable data checksum support]),
149         [], [enable_checksum="yes"])
150 AC_MSG_RESULT([$enable_checksum])
151 AS_IF([test "x$enable_checksum" != xno],
152         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
153 ]) # LC_CONFIG_CHECKSUM
154
155 #
156 # LC_CONFIG_HEALTH_CHECK_WRITE
157 #
158 # Turn off the actual write to the disk
159 #
160 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
161 AC_MSG_CHECKING([whether to enable a write with the health check])
162 AC_ARG_ENABLE([health_write],
163         AC_HELP_STRING([--enable-health_write],
164                 [enable disk writes when doing health check]),
165         [], [enable_health_write="no"])
166 AC_MSG_RESULT([$enable_health_write])
167 AS_IF([test "x$enable_health_write" != xno],
168         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
169 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
170
171 #
172 # LC_CONFIG_LRU_RESIZE
173 #
174 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
175 AC_MSG_CHECKING([whether to enable lru self-adjusting])
176 AC_ARG_ENABLE([lru_resize],
177         AC_HELP_STRING([--enable-lru-resize],
178                 [enable lru resize support]),
179         [], [enable_lru_resize="yes"])
180 AC_MSG_RESULT([$enable_lru_resize])
181 AS_IF([test "x$enable_lru_resize" != xno],
182         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
183 ]) # LC_CONFIG_LRU_RESIZE
184
185 #
186 # LC_QUOTA_CONFIG
187 #
188 # Quota support. The kernel must support CONFIG_QUOTA.
189 #
190 AC_DEFUN([LC_QUOTA_CONFIG], [
191 LB_CHECK_CONFIG_IM([QUOTA], [],
192         [AC_MSG_ERROR([
193
194 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
195 ])])
196 ]) # LC_QUOTA_CONFIG
197
198 #
199 # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
200 #
201 # truncate_complete_page() has never been exported from an upstream kernel
202 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
203 # delete_from_page_cache() is exported from 2.6.39
204 #
205 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE], [
206 LB_CHECK_EXPORT([truncate_complete_page], [mm/truncate.c],
207         [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
208                 [kernel export truncate_complete_page])])
209 LB_CHECK_EXPORT([remove_from_page_cache], [mm/filemap.c],
210         [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
211                 [kernel export remove_from_page_cache])])
212 LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
213         [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
214                 [kernel export delete_from_page_cache])])
215 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
216
217 #
218 # LC_CAPA_CRYPTO
219 #
220 AC_DEFUN([LC_CAPA_CRYPTO], [
221 LB_CHECK_CONFIG_IM([CRYPTO], [],
222         [AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])])
223 LB_CHECK_CONFIG_IM([CRYPTO_HMAC], [],
224         [AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])])
225 LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
226         [AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])])
227 ]) # LC_CAPA_CRYPTO
228
229 #
230 # LC_CONFIG_RMTCLIENT
231 #
232 dnl FIXME
233 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
234 dnl FIXME
235 AC_DEFUN([LC_CONFIG_RMTCLIENT], [
236 LB_CHECK_CONFIG_IM([CRYPTO_AES], [],
237         [AC_MSG_WARN([
238
239 Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.
240 ])])
241 ]) # LC_CONFIG_RMTCLIENT
242
243 #
244 # LC_CONFIG_GSS_KEYRING
245 #
246 # default 'auto', tests for dependencies, if found, enables;
247 # only called if gss is enabled
248 #
249 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
250 AC_MSG_CHECKING([whether to enable gss keyring backend])
251 AC_ARG_ENABLE([gss_keyring],
252         [AC_HELP_STRING([--disable-gss-keyring],
253                 [disable gss keyring backend])],
254         [], [enable_gss_keyring="auto"])
255 AC_MSG_RESULT([$enable_gss_keyring])
256 AS_IF([test "x$enable_gss_keyring" != xno], [
257         LB_CHECK_CONFIG_IM([KEYS], [], [
258                 gss_keyring_conf_test="fail"
259                 AC_MSG_WARN([
260
261 GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.
262 ])])
263
264         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
265                 gss_keyring_conf_test="fail"
266                 AC_MSG_WARN([
267
268 libkeyutils is not found, which is required by gss keyring backend
269 ])])
270
271         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
272                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
273                         [Define this if you enable gss keyring backend])
274                 enable_gss_keyring="yes"
275         ], [
276                 AS_IF([test "x$enable_gss_keyring" = xyes], [
277                         AC_MSG_ERROR([
278
279 Cannot enable gss_keyring. See above for details.
280 ])
281                 ], [
282                         AC_MSG_WARN([
283
284 Cannot enable gss keyring. See above for details.
285 ])
286                 ])
287         ])
288 ])
289 ]) # LC_CONFIG_GSS_KEYRING
290
291 #
292 # LC_CONFIG_SUNRPC
293 #
294 AC_DEFUN([LC_CONFIG_SUNRPC], [
295 LB_CHECK_CONFIG_IM([SUNRPC], [], [
296         AS_IF([test "x$sunrpc_required" = xyes], [
297                 AC_MSG_ERROR([
298
299 kernel SUNRPC support is required by using GSS.
300 ])
301         ])])
302 ]) # LC_CONFIG_SUNRPC
303
304 #
305 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
306 #
307 # Build gss and related tools of Lustre. Currently both kernel and user space
308 # parts are depend on linux platform.
309 #
310 AC_DEFUN([LC_CONFIG_GSS], [
311 AC_MSG_CHECKING([whether to enable gss/krb5 support])
312 AC_ARG_ENABLE([gss],
313         [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
314         [], [enable_gss="auto"])
315 AC_MSG_RESULT([$enable_gss])
316
317 AS_IF([test "x$enable_gss" != xno], [
318         LC_CONFIG_GSS_KEYRING
319         sunrpc_required=$enable_gss
320         LC_CONFIG_SUNRPC
321         sunrpc_required="no"
322
323         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
324                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
325         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
326                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
327         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
328                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
329         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
330                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
331
332         require_krb5=$enable_gss
333         AC_KERBEROS_V5
334         require_krb5="no"
335
336         AS_IF([test -n "$KRBDIR"], [
337                 AC_CHECK_LIB([gssapi], [gss_export_lucid_sec_context], [
338                         GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"
339                         gss_conf_test="success"
340                 ], [
341                         AC_CHECK_LIB([gssglue], [gss_export_lucid_sec_context], [
342                                 GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"
343                                 gss_conf_test="success"
344                         ], [
345                                 AS_IF([test "x$enable_gss" = xyes], [
346                                         AC_MSG_ERROR([
347
348 libgssapi or libgssglue is not found, which is required by GSS.
349 ])
350                                 ], [
351                                         AC_MSG_WARN([
352
353 libgssapi or libgssglue is not found, which is required by GSS.
354 ])
355                                 ])
356                         ])
357                 ])
358                 AC_SUBST(GSSAPI_LIBS)
359         ])
360
361         AS_IF([test "x$gss_conf_test" = xsuccess], [
362                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
363                 enable_gss="yes"
364         ])
365 ])
366 ]) # LC_CONFIG_GSS
367
368 #
369 # LC_INODE_PERMISION_2ARGS
370 #
371 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
372 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
373 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
374 # v3.1 onward have a 2 arg version (inode, mask)
375 #
376 AC_DEFUN([LC_INODE_PERMISION_2ARGS], [
377 LB_CHECK_COMPILE([if 'inode_operations->permission' has two args],
378 inode_ops_permission_2args, [
379         #include <linux/fs.h>
380 ],[
381         struct inode *inode __attribute__ ((unused));
382
383         inode = NULL;
384         inode->i_op->permission(NULL, 0);
385 ],[
386         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
387                 [inode_operations->permission has two args])
388 ])
389 ]) # LC_INODE_PERMISION_2ARGS
390
391 #
392 # LC_BLK_QUEUE_MAX_SEGMENTS
393 #
394 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
395 #
396 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS], [
397 LB_CHECK_COMPILE([if 'blk_queue_max_segments' is defined],
398 blk_queue_max_segments, [
399         #include <linux/blkdev.h>
400 ],[
401         blk_queue_max_segments(NULL, 0);
402 ],[
403         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
404                 [blk_queue_max_segments is defined])
405 ])
406 ]) # LC_BLK_QUEUE_MAX_SEGMENTS
407
408 #
409 # LC_HAVE_DQUOT_FS_DISK_QUOTA
410 #
411 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
412 #
413 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA], [
414 tmp_flags="$EXTRA_KCFLAGS"
415 EXTRA_KCFLAGS="-Werror"
416 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct fs_disk_quota],
417 fs_disk_quota, [
418         #include <linux/fs.h>
419         #include <linux/quota.h>
420 ],[
421         ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
422 ],[
423         AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
424                 [quotactl_ops.set_dqblk takes struct fs_disk_quota])
425 ],[
426         LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct kqid & fs_disk_quota],
427         kqid_fs_disk_quota, [
428                 #include <linux/fs.h>
429                 #include <linux/quota.h>
430         ],[
431                 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
432         ],[
433                 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
434                         [quotactl_ops.set_dqblk takes struct fs_disk_quota])
435                 AC_DEFINE(HAVE_DQUOT_KQID, 1,
436                         [quotactl_ops.set_dqblk takes struct kqid])
437         ])
438 ])
439 EXTRA_KCFLAGS="$tmp_flags"
440 ]) # LC_HAVE_DQUOT_FS_DISK_QUOTA
441
442 #
443 # LC_HAVE_DQUOT_SUSPEND
444 #
445 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
446 #
447 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND], [
448 LB_CHECK_COMPILE([if 'dquot_suspend' is defined],
449 dquot_suspend, [
450         #include <linux/quotaops.h>
451 ],[
452         dquot_suspend(NULL, -1);
453 ],[
454         AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
455 ])
456 ]) # LC_HAVE_DQUOT_SUSPEND
457
458 #
459 # LC_QUOTA64
460 #
461 # Check if kernel has been patched for 64-bit quota limits support.
462 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
463 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
464 # that in the absence of quotaio_v1.h in the kernel headers.
465 #
466 AC_DEFUN([LC_QUOTA64], [
467 tmp_flags="$EXTRA_KCFLAGS"
468 EXTRA_KCFLAGS="-I$LINUX/fs"
469 LB_CHECK_COMPILE([if kernel has 64-bit quota limits support],
470 quota64, [
471         #include <linux/kernel.h>
472         #include <linux/fs.h>
473         #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
474         #include <quota/quotaio_v2.h>
475         struct v2r1_disk_dqblk dqblk_r1;
476         #else
477         #include <linux/quota.h>
478         int ver = QFMT_VFS_V1;
479         #endif
480 ], [], [
481         AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
482 ],[
483         LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],
484                 [AC_MSG_ERROR([You have got no 64-bit kernel quota support.])])
485 ])
486 EXTRA_KCFLAGS=$tmp_flags
487 ]) # LC_QUOTA64
488
489 #
490 # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
491 #
492 # 2.6.34 adds __add_wait_queue_exclusive
493 #
494 AC_DEFUN([LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE], [
495 LB_CHECK_COMPILE([if '__add_wait_queue_exclusive' exists],
496 __add_wait_queue_exclusive, [
497         #include <linux/wait.h>
498 ],[
499         wait_queue_head_t queue;
500         wait_queue_t      wait;
501         __add_wait_queue_exclusive(&queue, &wait);
502 ],[
503         AC_DEFINE(HAVE___ADD_WAIT_QUEUE_EXCLUSIVE, 1,
504                   [__add_wait_queue_exclusive exists])
505 ])
506 ]) # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
507
508 #
509 # LC_FS_STRUCT_RWLOCK
510 #
511 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
512 #
513 AC_DEFUN([LC_FS_STRUCT_RWLOCK], [
514 LB_CHECK_COMPILE([if 'fs_struct.lock' use rwlock],
515 fs_struct_rwlock, [
516         #include <asm/atomic.h>
517         #include <linux/spinlock.h>
518         #include <linux/fs_struct.h>
519 ],[
520         ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
521 ],[
522         AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1, [fs_struct.lock use rwlock])
523 ])
524 ]) # LC_FS_STRUCT_RWLOCK
525
526 #
527 # LC_SBOPS_EVICT_INODE
528 #
529 # 2.6.36 super_operations add evict_inode method. it hybird of
530 # delete_inode & clear_inode.
531 #
532 AC_DEFUN([LC_SBOPS_EVICT_INODE], [
533 LB_CHECK_COMPILE([if 'super_operations.evict_inode' exist],
534 super_ops_evict_inode, [
535         #include <linux/fs.h>
536 ],[
537         ((struct super_operations *)0)->evict_inode(NULL);
538 ],[
539         AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
540                 [super_operations.evict_inode() is exist in kernel])
541 ])
542 ]) # LC_SBOPS_EVICT_INODE
543
544 #
545 # LC_FILE_FSYNC
546 #
547 # 2.6.35 file_operations.fsync taken 2 arguments.
548 # 3.0.0 file_operations.fsync takes 4 arguments.
549 #
550 AC_DEFUN([LC_FILE_FSYNC], [
551 LB_CHECK_COMPILE([if 'file_operations.fsync' takes 4 arguments],
552 file_ops_fsync_4args, [
553         #include <linux/fs.h>
554 ],[
555         ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
556 ],[
557         AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
558                 [file_operations.fsync takes 4 arguments])
559 ],[
560         LB_CHECK_COMPILE([if 'file_operations.fsync' takes 2 arguments],
561         file_ops_fsync_2args, [
562                 #include <linux/fs.h>
563         ],[
564                 ((struct file_operations *)0)->fsync(NULL, 0);
565         ],[
566                 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
567                         [file_operations.fsync takes 2 arguments])
568         ])
569 ])
570 ]) # LC_FILE_FSYNC
571
572 #
573 # LC_KERNEL_LOCKED
574 #
575 # 2.6.37 remove kernel_locked
576 #
577 AC_DEFUN([LC_KERNEL_LOCKED], [
578 LB_CHECK_COMPILE([if 'kernel_locked' is defined],
579 kernel_locked, [
580         #include <linux/smp_lock.h>
581 ],[
582         kernel_locked();
583 ],[
584         AC_DEFINE(HAVE_KERNEL_LOCKED, 1, [kernel_locked is defined])
585 ])
586 ]) # LC_KERNEL_LOCKED
587
588 #
589 # LC_D_COMPARE_7ARGS
590 #
591 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
592 #
593 AC_DEFUN([LC_D_COMPARE_7ARGS], [
594 LB_CHECK_COMPILE([if 'dentry_operations.d_compare()' taken 7 arguments],
595 dentry_ops_d_compare_7arg, [
596         #include <linux/dcache.h>
597 ],[
598         ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
599 ],[
600         AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1, [d_compare need 7 arguments])
601 ])
602 ]) # LC_D_COMPARE_7ARGS
603
604 #
605 # LC_D_DELETE_CONST
606 #
607 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
608 #
609 AC_DEFUN([LC_D_DELETE_CONST], [
610 tmp_flags="$EXTRA_KCFLAGS"
611 EXTRA_KCFLAGS="-Werror"
612 LB_CHECK_COMPILE([if 'dentry_operations.d_delete()' has const declare on first parameter],
613 dentry_ops_d_delete_1st_const, [
614         #include <linux/dcache.h>
615 ],[
616         const struct dentry *d = NULL;
617         ((struct dentry_operations*)0)->d_delete(d);
618 ],[
619         AC_DEFINE(HAVE_D_DELETE_CONST, const,
620                 [d_delete first parameter declared const])
621 ],[
622         AC_DEFINE(HAVE_D_DELETE_CONST, [],
623                 [d_delete first parameter declared is not const])
624 ])
625 EXTRA_KCFLAGS="$tmp_flags"
626 ]) # LC_D_DELETE_CONST
627
628 #
629 # LC_DCACHE_LOCK
630 #
631 # 2.6.38 dcache_lock removed. rcu-walk commited.
632 #
633 AC_DEFUN([LC_DCACHE_LOCK], [
634 LB_CHECK_COMPILE([if 'dcache_lock' is exist],
635 dcache_lock, [
636         #include <linux/dcache.h>
637 ],[
638         spin_lock(&dcache_lock);
639 ],[
640         AC_DEFINE(HAVE_DCACHE_LOCK, 1,
641                 [dcache_lock is exist])
642 ])
643 ]) # LC_DCACHE_LOCK
644
645 #
646 # LC_INODE_I_RCU
647 #
648 # 2.6.38 inode.i_rcu added.
649 #
650 AC_DEFUN([LC_INODE_I_RCU], [
651 LB_CHECK_COMPILE([if 'inode.i_rcu' exists],
652 inode_i_rcu, [
653         #include <linux/fs.h>
654 ],[
655         struct inode ino;
656         struct rcu_head rcu = {};
657         ino.i_rcu = rcu;
658 ],[
659         AC_DEFINE(HAVE_INODE_I_RCU, 1,
660                 [inode.i_rcu exists])
661 ])
662 ]) # LC_INODE_I_RCU
663
664 #
665 # LC_BLKDEV_GET_BY_DEV
666 #
667 # 2.6.38 export blkdev_get_by_dev
668 #
669 AC_DEFUN([LC_BLKDEV_GET_BY_DEV], [
670 LB_CHECK_EXPORT([blkdev_get_by_dev], [fs/block_dev.c],
671         [AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
672                 [blkdev_get_by_dev is exported by the kernel])])
673 ]) # LC_BLKDEV_GET_BY_DEV
674
675 #
676 # LC_EXPORT_SIMPLE_SETATTR
677 #
678 # 2.6.38 export simple_setattr
679 #
680 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR], [
681 LB_CHECK_EXPORT([simple_setattr], [fs/libfs.c],
682         [AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
683                 [simple_setattr is exported by the kernel])])
684 ]) # LC_EXPORT_SIMPLE_SETATTR
685
686 #
687 # LC_IOP_TRUNCATE
688 #
689 # truncate callback removed since 2.6.39
690 #
691 AC_DEFUN([LC_IOP_TRUNCATE], [
692 LB_CHECK_COMPILE([if 'inode_operations' has '.truncate' member function],
693 inode_ops_truncate, [
694         #include <linux/fs.h>
695 ],[
696         ((struct inode_operations *)0)->truncate(NULL);
697 ],[
698         AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
699                 [inode_operations has .truncate member function])
700 ])
701 ]) # LC_IOP_TRUNCATE
702
703 #
704 # LC_REQUEST_QUEUE_UNPLUG_FN
705 #
706 # 2.6.39 remove unplug_fn from request_queue.
707 #
708 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], [
709 LB_CHECK_COMPILE([if 'request_queue' has 'unplug_fn' field],
710 request_queue_unplug_fn, [
711         #include <linux/blkdev.h>
712 ],[
713         do {} while(sizeof(((struct request_queue *)0)->unplug_fn));
714 ],[
715         AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
716                 [request_queue has unplug_fn field])
717 ])
718 ]) # LC_REQUEST_QUEUE_UNPLUG_FN
719
720 #
721 # LC_HAVE_FSTYPE_MOUNT
722 #
723 # 2.6.39 replace get_sb with mount in struct file_system_type
724 #
725 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [
726 LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field],
727 file_system_type_mount, [
728         #include <linux/fs.h>
729 ],[
730         struct file_system_type fst;
731         void *i = (void *) fst.mount;
732 ],[
733         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
734                 [struct file_system_type has mount field])
735 ])
736 ]) # LC_HAVE_FSTYPE_MOUNT
737
738 #
739 # LC_HAVE_FHANDLE_SYSCALLS
740 #
741 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
742 # added to Linux kernel 2.6.39.
743 # Check if client supports these functions
744 #
745 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [
746 LB_CHECK_CONFIG_IM([FHANDLE],[
747         AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
748                 [kernel supports fhandles and related syscalls])
749         ])
750 ]) # LC_HAVE_FHANDLE_SYSCALLS
751
752 #
753 # LC_HAVE_INODE_OWNER_OR_CAPABLE
754 #
755 # 2.6.39 renames is_owner_or_cap to inode_owner_or_capable
756 #
757 AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [
758 LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist],
759 inode_owner_or_capable, [
760         #include <linux/fs.h>
761 ],[
762         inode_owner_or_capable(NULL);
763 ],[
764         AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
765                 [inode_owner_or_capable exist])
766 ])
767 ]) # LC_HAVE_INODE_OWNER_OR_CAPABLE
768
769 #
770 # LC_DIRTY_INODE_WITH_FLAG
771 #
772 # 3.0 dirty_inode() has a flag parameter
773 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
774 #
775 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [
776 LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag],
777 dirty_inode_super_operation_flag, [
778         #include <linux/fs.h>
779 ],[
780         struct inode *inode;
781         inode->i_sb->s_op->dirty_inode(NULL, 0);
782 ],[
783         AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
784                 [dirty_inode super_operation takes flag])
785 ])
786 ]) # LC_DIRTY_INODE_WITH_FLAG
787
788 #
789 # LC_GENERIC_PERMISSION
790 #
791 # 2.6.38 generic_permission taken 4 parameters.
792 # in fact, it means rcu-walk aware permission bring.
793 #
794 # 3.1 generic_permission taken 2 parameters.
795 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
796 #
797 AC_DEFUN([LC_GENERIC_PERMISSION], [
798 LB_CHECK_COMPILE([if 'generic_permission' take 2 arguments],
799 generic_permission_2args, [
800         #include <linux/fs.h>
801 ],[
802         generic_permission(NULL, 0);
803 ],[
804         AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
805                 [generic_permission taken 2 arguments])
806 ],[
807         LB_CHECK_COMPILE([if 'generic_permission' take 4 arguments],
808         generic_permission_4args, [
809                 #include <linux/fs.h>
810         ],[
811                 generic_permission(NULL, 0, 0, NULL);
812         ],[
813                 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
814                         [generic_permission taken 4 arguments])
815         ])
816 ])
817 ]) # LC_GENERIC_PERMISSION
818
819 #
820 # LC_LM_XXX_LOCK_MANAGER_OPS
821 #
822 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
823 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
824 #
825 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [
826 LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'],
827 lock_manager_ops_lm_xxx, [
828         #include <linux/fs.h>
829 ],[
830         struct lock_manager_operations lm_ops;
831         lm_ops.lm_compare_owner = NULL;
832 ],[
833         AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
834                 [lock-manager ops renamed to lm_xxx])
835 ])
836 ]) # LC_LM_XXX_LOCK_MANAGER_OPS
837
838 #
839 # LC_INODE_DIO_WAIT
840 #
841 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait
842 #     instead.
843 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
844 #
845 AC_DEFUN([LC_INODE_DIO_WAIT], [
846 LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait],
847 inode_dio_wait, [
848         #include <linux/fs.h>
849 ],[
850         inode_dio_wait((struct inode *)0);
851 ],[
852         AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
853                 [inode->i_alloc_sem is killed and use inode_dio_wait])
854 ])
855 ]) # LC_INODE_DIO_WAIT
856
857 #
858 # LC_IOP_GET_ACL
859 #
860 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
861 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
862 #
863 AC_DEFUN([LC_IOP_GET_ACL], [
864 LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function],
865 inode_ops_get_acl, [
866         #include <linux/fs.h>
867 ],[
868         struct inode_operations iop;
869         iop.get_acl = NULL;
870 ],[
871         AC_DEFINE(HAVE_IOP_GET_ACL, 1,
872                 [inode_operations has .get_acl member function])
873 ])
874 ]) # LC_IOP_GET_ACL
875
876 #
877 # LC_FILE_LLSEEK_SIZE
878 #
879 # 3.1 introduced generic_file_llseek_size()
880 #
881 AC_DEFUN([LC_FILE_LLSEEK_SIZE], [
882 LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c],
883         [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
884                 [generic_file_llseek_size is exported by the kernel])])
885 ]) # LC_FILE_LLSEEK_SIZE
886
887 #
888 # LC_RADIX_EXCEPTION_ENTRY
889 # 3.1 adds radix_tree_exception_entry.
890 #
891 AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [
892 LB_CHECK_COMPILE([radix_tree_exceptional_entry exist],
893 radix_tree_exceptional_entry, [
894         #include <linux/radix-tree.h>
895 ],[
896         radix_tree_exceptional_entry(NULL);
897 ],[
898         AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1,
899                 [radix_tree_exceptional_entry exist])
900 ])
901 ]) # LC_RADIX_EXCEPTION_ENTRY
902
903 #
904 # LC_HAVE_VOID_MAKE_REQUEST_FN
905 #
906 # 3.2 request_queue.make_request_fn defined as function returns with void
907 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
908 #
909 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], [
910 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns void but not int],
911 make_request_fn_void, [
912         #include <linux/blkdev.h>
913 ],[
914         int ret;
915         make_request_fn *mrf;
916         ret = mrf(NULL, NULL);
917 ],[],[
918         AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
919                 [request_queue.make_request_fn returns void but not int])
920 ])
921 ]) # LC_HAVE_VOID_MAKE_REQUEST_FN
922
923 #
924 # LC_HAVE_PROTECT_I_NLINK
925 #
926 # 3.2 protects inode->i_nlink from direct modification
927 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
928 # at the same time adds set_nlink(), so checks set_nlink() for it.
929 #
930 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [
931 LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification],
932 inode_i_nlink_protected, [
933         #include <linux/fs.h>
934 ],[
935         struct inode i;
936         set_nlink(&i, 1);
937 ],[
938         AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
939                 [inode->i_nlink is protected from direct modification])
940 ])
941 ]) # LC_HAVE_PROTECT_I_NLINK
942
943 #
944 # LC_HAVE_MIGRATE_HEADER
945 #
946 # 3.3 introduces migrate_mode.h and migratepage has 4 args
947 #
948 AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [
949 LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [
950         AC_DEFINE(HAVE_MIGRATE_H, 1,
951                 [kernel has include/linux/migrate.h])
952 ],[
953         LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [
954                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
955                         [kernel has include/linux/migrate_mode.h])
956         ])
957 ])
958 ]) # LC_HAVE_MIGRATE_HEADER
959
960 #
961 # LC_MIGRATEPAGE_4ARGS
962 #
963 AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [
964 LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args],
965 address_space_ops_migratepage_4args, [
966         #include <linux/fs.h>
967 #ifdef HAVE_MIGRATE_H
968         #include <linux/migrate.h>
969 #elif defined(HAVE_MIGRATE_MODE_H)
970         #include <linux/migrate_mode.h>
971 #endif
972 ],[
973         struct address_space_operations aops;
974         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
975 ],[
976         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
977                 [address_space_operations.migratepage has 4 args])
978 ])
979 ]) # LC_MIGRATEPAGE_4ARGS
980
981 #
982 # LC_SUPEROPS_USE_DENTRY
983 #
984 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
985 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
986 #
987 AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [
988 tmp_flags="$EXTRA_KCFLAGS"
989 EXTRA_KCFLAGS="-Werror"
990 LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter],
991 super_ops_dentry, [
992         #include <linux/fs.h>
993         int show_options(struct seq_file *seq, struct dentry *root) {
994                 return 0;
995         }
996 ],[
997         struct super_operations ops;
998         ops.show_options = show_options;
999 ],[
1000         AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
1001                 [super_operations use dentry as parameter])
1002 ])
1003 EXTRA_KCFLAGS="$tmp_flags"
1004 ]) # LC_SUPEROPS_USE_DENTRY
1005
1006 #
1007 # LC_INODEOPS_USE_UMODE_T
1008 #
1009 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
1010 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
1011 #
1012 AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [
1013 tmp_flags="$EXTRA_KCFLAGS"
1014 EXTRA_KCFLAGS="-Werror"
1015 LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter],
1016 inode_ops_umode_t, [
1017         #include <linux/fs.h>
1018         #include <linux/types.h>
1019         int my_mknod(struct inode *dir, struct dentry *dchild,
1020                      umode_t mode, dev_t dev)
1021         {
1022                 return 0;
1023         }
1024 ],[
1025         struct inode_operations ops;
1026         ops.mknod = my_mknod;
1027 ],[
1028         AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
1029                 [inode_operations use umode_t as parameter])
1030 ])
1031 EXTRA_KCFLAGS="$tmp_flags"
1032 ]) # LC_INODEOPS_USE_UMODE_T
1033
1034 #
1035 # LC_KMAP_ATOMIC_HAS_1ARG
1036 #
1037 # 3.4 kmap_atomic removes second argument
1038 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1039 #
1040 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [
1041 LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument],
1042 kmap_atomic_1arg, [
1043         #include <linux/highmem.h>
1044 ],[
1045         kmap_atomic(NULL);
1046 ],[
1047         AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1048                 [have kmap_atomic has only 1 argument])
1049 ])
1050 ]) # LC_KMAP_ATOMIC_HAS_1ARG
1051
1052 #
1053 # LC_HAVE_D_MAKE_ROOT
1054 #
1055 # 3.4 converts d_alloc_root to d_make_root
1056 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1057 #
1058 AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [
1059 LB_CHECK_COMPILE([if have 'd_make_root'],
1060 d_make_root, [
1061         #include <linux/fs.h>
1062 ],[
1063         d_make_root((struct inode *)NULL);
1064 ],[
1065         AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1066                 [have d_make_root])
1067 ])
1068 ]) # LC_HAVE_D_MAKE_ROOT
1069
1070 #
1071 # LC_HAVE_CACHE_REGISTER
1072 #
1073 # 3.4 cache_register/cache_unregister are removed
1074 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1075 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1076 # are defined, but not exported.
1077 # 3.3 cache_register_net/cache_unregister_net are
1078 # exported and replacing cache_register/cache_unregister in 3.4
1079 #
1080 AC_DEFUN([LC_HAVE_CACHE_REGISTER], [
1081 LB_CHECK_COMPILE([if have 'cache_register'],
1082 cache_register, [
1083         #include <linux/sunrpc/cache.h>
1084 ],[
1085         cache_register(NULL);
1086 ],[
1087         AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1088                 [have cache_register])
1089 ])
1090 ]) # LC_HAVE_CACHE_REGISTER
1091
1092 #
1093 # LC_HAVE_CLEAR_INODE
1094 #
1095 # 3.5 renames end_writeback() back to clear_inode()...
1096 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1097 #
1098 AC_DEFUN([LC_HAVE_CLEAR_INODE], [
1099 LB_CHECK_COMPILE([if have 'clear_inode'],
1100 clear_inode, [
1101         #include <linux/fs.h>
1102 ],[
1103         clear_inode((struct inode *)NULL);
1104 ],[
1105         AC_DEFINE(HAVE_CLEAR_INODE, 1,
1106                 [have clear_inode])
1107 ])
1108 ]) # LC_HAVE_CLEAR_INODE
1109
1110 #
1111 # LC_HAVE_ENCODE_FH_PARENT
1112 #
1113 # 3.5 encode_fh has parent inode passed in directly
1114 # see kernel commit b0b0382b
1115 #
1116 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [
1117 tmp_flags="$EXTRA_KCFLAGS"
1118 EXTRA_KCFLAGS="-Werror"
1119 LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter],
1120 encode_fh_parent_inode, [
1121         #include <linux/exportfs.h>
1122         #include <linux/fs.h>
1123         #include <linux/types.h>
1124         int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1125         {
1126                 return 0;
1127         }
1128 ],[
1129         struct export_operations exp_op;
1130         exp_op.encode_fh = ll_encode_fh;
1131 ],[
1132         AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1133                 [have parent inode as parameter])
1134 ])
1135 EXTRA_KCFLAGS="$tmp_flags"
1136 ]) # LC_HAVE_ENCODE_FH_PARENT
1137
1138 #
1139 # LC_FILE_LLSEEK_SIZE_5ARG
1140 #
1141 # 3.5 has generic_file_llseek_size with 5 args
1142 #
1143 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [
1144 LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args],
1145 generic_file_llseek_size_5args, [
1146         #include <linux/fs.h>
1147 ],[
1148         generic_file_llseek_size(NULL, 0, 0, 0, 0);
1149 ], [
1150         AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1151                 [kernel has generic_file_llseek_size with 5 args])
1152 ])
1153 ]) # LC_FILE_LLSEEK_SIZE_5ARG
1154
1155 #
1156 # LC_LLITE_DATA_IS_LIST
1157 #
1158 # 3.6 switch i_dentry/d_alias from list to hlist
1159 #
1160 # In the upstream kernels d_alias first changes
1161 # to a hlist and then in later version, 3.11, gets
1162 # moved to the union d_u. Due to some distros having
1163 # d_alias in the d_u union as a struct list, which
1164 # has never existed upstream stream, we can't test
1165 # if d_alias is a list or hlist directly. If ever
1166 # i_dentry and d_alias even up different combos then
1167 # the build will fail. In that case then we will need
1168 # to separate out the i_dentry and d_alias test below.
1169 #
1170 AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
1171 tmp_flags="$EXTRA_KCFLAGS"
1172 EXTRA_KCFLAGS="-Werror"
1173 LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
1174 i_dentry_d_alias_list, [
1175         #include <linux/fs.h>
1176 ],[
1177         struct inode inode;
1178         INIT_LIST_HEAD(&inode.i_dentry);
1179 ],[
1180         AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
1181                 [both i_dentry/d_alias uses list])
1182 ])
1183 EXTRA_KCFLAGS="$tmp_flags"
1184 ]) # LC_DATA_FOR_LLITE_IS_LIST
1185
1186 #
1187 # LC_DENTRY_OPEN_USE_PATH
1188 #
1189 # 3.6 dentry_open uses struct path as first argument
1190 # see kernel commit 765927b2
1191 #
1192 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [
1193 tmp_flags="$EXTRA_KCFLAGS"
1194 EXTRA_KCFLAGS="-Werror"
1195 LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument],
1196 dentry_open_path, [
1197         #include <linux/fs.h>
1198         #include <linux/path.h>
1199 ],[
1200         struct path path;
1201         dentry_open(&path, 0, NULL);
1202 ],[
1203         AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1204                 [dentry_open uses struct path as first argument])
1205 ])
1206 EXTRA_KCFLAGS="$tmp_flags"
1207 ]) # LC_DENTRY_OPEN_USE_PATH
1208
1209 #
1210 # LC_HAVE_IOP_ATOMIC_OPEN
1211 #
1212 # 3.6 vfs adds iop->atomic_open
1213 #
1214 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [
1215 LB_CHECK_COMPILE([if 'iop' has 'atomic_open'],
1216 inode_ops_atomic_open, [
1217         #include <linux/fs.h>
1218 ],[
1219         struct inode_operations iop;
1220         iop.atomic_open = NULL;
1221 ],[
1222         AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1223                 [have iop atomic_open])
1224 ])
1225 ]) # LC_HAVE_IOP_ATOMIC_OPEN
1226
1227 #
1228 # LC_HAVE_POSIXACL_USER_NS
1229 #
1230 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1231 #
1232 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [
1233 LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'],
1234 posix_acl_to_xattr_user_namespace, [
1235         #include <linux/fs.h>
1236         #include <linux/posix_acl_xattr.h>
1237 ],[
1238         posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1239 ],[
1240         AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1241                 [posix_acl_to_xattr takes struct user_namespace])
1242 ])
1243 ]) # LC_HAVE_POSIXACL_USER_NS
1244
1245 #
1246 # LC_HAVE_FILE_F_INODE
1247 #
1248 # 3.8 struct file has new member f_inode
1249 #
1250 AC_DEFUN([LC_HAVE_FILE_F_INODE], [
1251 LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'],
1252 file_f_inode, [
1253         #include <linux/fs.h>
1254 ],[
1255         ((struct file *)0)->f_inode = NULL;
1256 ],[
1257         AC_DEFINE(HAVE_FILE_F_INODE, 1,
1258                 [struct file has member f_inode])
1259 ])
1260 ]) # LC_HAVE_FILE_F_INODE
1261
1262 #
1263 # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1264 #
1265 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [
1266 LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args],
1267 sunrpc_cache_pipe_upcall_3args, [
1268         #include <linux/sunrpc/cache.h>
1269 ],[
1270         sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1271 ],[
1272         AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1273                 [sunrpc_cache_pipe_upcall takes 3 args])
1274 ])
1275 ]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1276
1277 #
1278 # LC_HAVE_HLIST_FOR_EACH_3ARG
1279 #
1280 # 3.9 uses hlist_for_each_entry with 3 args
1281 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1282 #
1283 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [
1284 LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args],
1285 hlist_for_each_entry_3args, [
1286         #include <linux/list.h>
1287         #include <linux/fs.h>
1288 ],[
1289         struct hlist_head *head = NULL;
1290         struct inode *inode;
1291
1292         hlist_for_each_entry(inode, head, i_hash) {
1293                 continue;
1294         }
1295 ],[
1296         AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1,
1297                 [hlist_for_each_entry has 3 args])
1298 ])
1299 ]) # LC_HAVE_HLIST_FOR_EACH_3ARG
1300
1301 #
1302 # LC_HAVE_BIO_END_SECTOR
1303 #
1304 # 3.9 introduces bio_end_sector macro
1305 # f73a1c7d117d07a96d89475066188a2b79e53c48
1306 #
1307 AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [
1308 LB_CHECK_COMPILE([if 'bio_end_sector' is defined],
1309 bio_end_sector, [
1310         #include <linux/bio.h>
1311 ],[
1312         struct bio bio;
1313
1314         bio_end_sector(&bio);
1315 ],[
1316         AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
1317                   [bio_end_sector is defined])
1318 ])
1319 ]) # LC_HAVE_BIO_END_SECTOR
1320
1321 #
1322 # LC_HAVE_REMOVE_PROC_SUBTREE
1323 #
1324 # 3.10 introduced remove_proc_subtree
1325 #
1326 AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [
1327 LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined],
1328 remove_proc_subtree, [
1329         #include <linux/proc_fs.h>
1330 ],[
1331         remove_proc_subtree(NULL, NULL);
1332 ], [
1333         AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1,
1334                   [remove_proc_subtree is defined])
1335 ])
1336 ]) # LC_HAVE_REMOVE_PROC_SUBTREE
1337
1338 #
1339 # LC_HAVE_PROC_REMOVE
1340 #
1341 # 3.10 introduced proc_remove
1342 #
1343 AC_DEFUN([LC_HAVE_PROC_REMOVE], [
1344 LB_CHECK_COMPILE([if 'proc_remove' is defined],
1345 proc_remove, [
1346         #include <linux/proc_fs.h>
1347 ],[
1348         proc_remove(NULL);
1349 ], [
1350         AC_DEFINE(HAVE_PROC_REMOVE, 1,
1351                   [proc_remove is defined])
1352 ])
1353 ]) # LC_HAVE_PROC_REMOVE
1354
1355 #
1356 # LC_BLKDEV_RELEASE_RETURN_INT
1357 #
1358 # 3.10 release for block device doesn't return int
1359 #
1360 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT], [
1361 LB_CHECK_COMPILE([if 'block_device_operations' release returns 'int'],
1362 block_device_ops_release_return_int, [
1363         #include <linux/blkdev.h>
1364 ],[
1365         struct block_device_operations fops;
1366         int i __attribute__ ((unused));
1367
1368         i = fops.release(NULL, 0);
1369 ],[
1370         AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1371                 [block device release returns int])
1372 ])
1373 ]) # LC_BLKDEV_RELEASE_RETURN_INT
1374
1375 #
1376 # LC_INVALIDATE_RANGE
1377 #
1378 # 3.11 invalidatepage requires the length of the range to invalidate
1379 #
1380 AC_DEFUN([LC_INVALIDATE_RANGE], [
1381 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
1382 address_space_ops_invalidatepage_3args, [
1383         #include <linux/fs.h>
1384 ],[
1385         struct address_space_operations a_ops;
1386         a_ops.invalidatepage(NULL, 0, 0);
1387 ],[
1388         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
1389                 [address_space_operations.invalidatepage needs 3 arguments])
1390 ])
1391 ]) # LC_INVALIDATE_RANGE
1392
1393 #
1394 # LC_HAVE_DIR_CONTEXT
1395 #
1396 # 3.11 readdir now takes the new struct dir_context
1397 #
1398 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
1399 LB_CHECK_COMPILE([if 'dir_context' exist],
1400 dir_context, [
1401         #include <linux/fs.h>
1402 ],[
1403         struct dir_context ctx;
1404         ctx.pos = 0;
1405 ],[
1406         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
1407                 [dir_context exist])
1408 ])
1409 ]) # LC_HAVE_DIR_CONTEXT
1410
1411 #
1412 # LC_D_COMPARE_5ARGS
1413 #
1414 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1415 #
1416 AC_DEFUN([LC_D_COMPARE_5ARGS], [
1417 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
1418 d_compare_5args, [
1419         #include <linux/dcache.h>
1420 ],[
1421         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1422 ],[
1423         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1424                 [d_compare need 5 arguments])
1425 ])
1426 ]) # LC_D_COMPARE_5ARGS
1427
1428 #
1429 # LC_HAVE_DCOUNT
1430 #
1431 # 3.11 need to access d_count to get dentry reference count
1432 #
1433 AC_DEFUN([LC_HAVE_DCOUNT], [
1434 LB_CHECK_COMPILE([if 'd_count' exist],
1435 d_count, [
1436         #include <linux/dcache.h>
1437 ],[
1438         struct dentry de;
1439         d_count(&de);
1440 ],[
1441         AC_DEFINE(HAVE_D_COUNT, 1,
1442                 [d_count exist])
1443 ])
1444 ]) # LC_HAVE_DCOUNT
1445
1446 #
1447 # LC_OLDSIZE_TRUNCATE_PAGECACHE
1448 #
1449 # 3.12 truncate_pagecache without oldsize parameter
1450 #
1451 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
1452 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
1453 truncate_pagecache_old_size, [
1454         #include <linux/mm.h>
1455 ],[
1456         truncate_pagecache(NULL, 0, 0);
1457 ],[
1458         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
1459                 [with oldsize])
1460 ])
1461 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
1462
1463 #
1464 # LC_HAVE_DENTRY_D_U_D_ALIAS
1465 #
1466 # 3.11 kernel moved d_alias to the union d_u in struct dentry
1467 #
1468 # Some distros move d_alias to d_u but it is still a struct list
1469 #
1470 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
1471 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
1472         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
1473         d_alias, [
1474                 #include <linux/list.h>
1475                 #include <linux/dcache.h>
1476         ],[
1477                 struct dentry de;
1478                 INIT_LIST_HEAD(&de.d_u.d_alias);
1479         ],[
1480                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1481                         [list dentry.d_u.d_alias exist])
1482         ])
1483 ],[
1484         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
1485         d_alias, [
1486                 #include <linux/list.h>
1487                 #include <linux/dcache.h>
1488         ],[
1489                 struct dentry de;
1490                 INIT_HLIST_NODE(&de.d_u.d_alias);
1491         ],[
1492                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1493                         [hlist dentry.d_u.d_alias exist])
1494         ])
1495 ])
1496 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
1497
1498 #
1499 # LC_HAVE_DENTRY_D_CHILD
1500 #
1501 # 3.11 kernel d_child has been moved out of the union d_u
1502 # in struct dentry
1503 #
1504 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
1505 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
1506 d_child, [
1507         #include <linux/list.h>
1508         #include <linux/dcache.h>
1509 ],[
1510         struct dentry de;
1511         INIT_LIST_HEAD(&de.d_child);
1512 ],[
1513         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
1514                 [dentry.d_child exist])
1515 ])
1516 ]) # LC_HAVE_DENTRY_D_CHILD
1517
1518 #
1519 # LC_KIOCB_KI_LEFT
1520 #
1521 # 3.12 ki_left removed from struct kiocb
1522 #
1523 AC_DEFUN([LC_KIOCB_KI_LEFT], [
1524 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
1525 kiocb_ki_left, [
1526         #include <linux/aio.h>
1527 ],[
1528         ((struct kiocb*)0)->ki_left = 0;
1529 ],[
1530         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
1531                 [ki_left exist])
1532 ])
1533 ]) # LC_KIOCB_KI_LEFT
1534
1535 #
1536 # LC_VFS_RENAME_5ARGS
1537 #
1538 # 3.13 has vfs_rename with 5 args
1539 #
1540 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
1541 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
1542 vfs_rename_5args, [
1543         #include <linux/fs.h>
1544 ],[
1545         vfs_rename(NULL, NULL, NULL, NULL, NULL);
1546 ], [
1547         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
1548                 [kernel has vfs_rename with 5 args])
1549 ])
1550 ]) # LC_VFS_RENAME_5ARGS
1551
1552 #
1553 # LC_VFS_UNLINK_3ARGS
1554 #
1555 # 3.13 has vfs_unlink with 3 args
1556 #
1557 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
1558 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
1559 vfs_unlink_3args, [
1560         #include <linux/fs.h>
1561 ],[
1562         vfs_unlink(NULL, NULL, NULL);
1563 ], [
1564         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
1565                 [kernel has vfs_unlink with 3 args])
1566 ])
1567 ]) # LC_VFS_UNLINK_3ARGS
1568
1569 #
1570 # LC_HAVE_BVEC_ITER
1571 #
1572 # 3.14 move some of its data in struct bio into the new
1573 # struct bvec_iter
1574 #
1575 AC_DEFUN([LC_HAVE_BVEC_ITER], [
1576 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
1577 have_bvec_iter, [
1578         #include <linux/bio.h>
1579 ],[
1580         struct bvec_iter iter;
1581         iter.bi_bvec_done = 0;
1582 ], [
1583         AC_DEFINE(HAVE_BVEC_ITER, 1,
1584                 [kernel has struct bvec_iter])
1585 ])
1586 ]) # LC_HAVE_BVEC_ITER
1587
1588 #
1589 # LC_HAVE_TRUNCATE_IPAGE_FINAL
1590 #
1591 # 3.14 bring truncate_inode_pages_final for evict_inode
1592 #
1593 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
1594 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
1595 truncate_ipages_final, [
1596         #include <linux/mm.h>
1597 ],[
1598         truncate_inode_pages_final(NULL);
1599 ], [
1600         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
1601                 [kernel has truncate_inode_pages_final])
1602 ])
1603 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
1604
1605 #
1606 # LC_VFS_RENAME_6ARGS
1607 #
1608 # 3.15 has vfs_rename with 6 args
1609 #
1610 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
1611 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
1612 vfs_rename_6args, [
1613         #include <linux/fs.h>
1614 ],[
1615         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
1616 ], [
1617         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
1618                 [kernel has vfs_rename with 6 args])
1619 ])
1620 ]) # LC_VFS_RENAME_6ARGS
1621
1622 #
1623 # LC_DIRECTIO_USE_ITER
1624 #
1625 # 3.16 kernel changes direct IO to use iov_iter
1626 #
1627 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
1628 LB_CHECK_COMPILE([if direct IO uses iov_iter],
1629 direct_io_iter, [
1630         #include <linux/fs.h>
1631 ],[
1632         struct address_space_operations ops;
1633         struct iov_iter *iter = NULL;
1634         loff_t offset = 0;
1635
1636         ops.direct_IO(0, NULL, iter, offset);
1637 ],[
1638         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
1639                 [direct IO uses iov_iter])
1640 ])
1641 ]) # LC_DIRECTIO_USE_ITER
1642
1643 #
1644 # LC_IOV_ITER_RW
1645 #
1646 # 4.1 kernel has iov_iter_rw
1647 #
1648 AC_DEFUN([LC_IOV_ITER_RW], [
1649 LB_CHECK_COMPILE([if iov_iter_rw exist],
1650 iov_iter_rw, [
1651         #include <linux/fs.h>
1652         #include <linux/uio.h>
1653 ],[
1654         struct iov_iter *iter = NULL;
1655
1656         iov_iter_rw(iter);
1657 ],[
1658         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1659                 [iov_iter_rw exist])
1660 ])
1661 ]) # LC_IOV_ITER_RW
1662
1663 #
1664 # LC_PROG_LINUX
1665 #
1666 # Lustre linux kernel checks
1667 #
1668 AC_DEFUN([LC_PROG_LINUX], [
1669         AC_MSG_NOTICE([Lustre kernel checks
1670 ==============================================================================])
1671
1672         LC_CONFIG_PINGER
1673         LC_CONFIG_CHECKSUM
1674         LC_CONFIG_HEALTH_CHECK_WRITE
1675         LC_CONFIG_LRU_RESIZE
1676         LC_LLITE_LLOOP_MODULE
1677
1678         LC_GLIBC_SUPPORT_FHANDLES
1679         LC_CAPA_CRYPTO
1680         LC_CONFIG_RMTCLIENT
1681         LC_CONFIG_GSS
1682
1683         # 2.6.32
1684         LC_BLK_QUEUE_MAX_SEGMENTS
1685
1686         # 2.6.34
1687         LC_HAVE_DQUOT_FS_DISK_QUOTA
1688         LC_HAVE_DQUOT_SUSPEND
1689         LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
1690
1691         # 2.6.35, 3.0.0
1692         LC_FILE_FSYNC
1693         LC_EXPORT_SIMPLE_SETATTR
1694         LC_EXPORT_TRUNCATE_COMPLETE_PAGE
1695
1696         # 2.6.36
1697         LC_FS_STRUCT_RWLOCK
1698         LC_SBOPS_EVICT_INODE
1699
1700         # 2.6.37
1701         LC_KERNEL_LOCKED
1702
1703         # 2.6.38
1704         LC_BLKDEV_GET_BY_DEV
1705         LC_GENERIC_PERMISSION
1706         LC_DCACHE_LOCK
1707         LC_INODE_I_RCU
1708         LC_D_COMPARE_7ARGS
1709         LC_D_DELETE_CONST
1710
1711         # 2.6.39
1712         LC_REQUEST_QUEUE_UNPLUG_FN
1713         LC_HAVE_FHANDLE_SYSCALLS
1714         LC_HAVE_FSTYPE_MOUNT
1715         LC_IOP_TRUNCATE
1716         LC_HAVE_INODE_OWNER_OR_CAPABLE
1717
1718         # 3.0
1719         LC_DIRTY_INODE_WITH_FLAG
1720
1721         # 3.1
1722         LC_LM_XXX_LOCK_MANAGER_OPS
1723         LC_INODE_DIO_WAIT
1724         LC_IOP_GET_ACL
1725         LC_FILE_LLSEEK_SIZE
1726         LC_INODE_PERMISION_2ARGS
1727         LC_RADIX_EXCEPTION_ENTRY
1728
1729         # 3.2
1730         LC_HAVE_VOID_MAKE_REQUEST_FN
1731         LC_HAVE_PROTECT_I_NLINK
1732
1733         # 3.3
1734         LC_HAVE_MIGRATE_HEADER
1735         LC_MIGRATEPAGE_4ARGS
1736         LC_SUPEROPS_USE_DENTRY
1737         LC_INODEOPS_USE_UMODE_T
1738         LC_HAVE_CACHE_REGISTER
1739
1740         # 3.4
1741         LC_HAVE_D_MAKE_ROOT
1742         LC_KMAP_ATOMIC_HAS_1ARG
1743
1744         # 3.5
1745         LC_HAVE_CLEAR_INODE
1746         LC_HAVE_ENCODE_FH_PARENT
1747         LC_FILE_LLSEEK_SIZE_5ARG
1748
1749         # 3.6
1750         LC_DATA_FOR_LLITE_IS_LIST
1751         LC_DENTRY_OPEN_USE_PATH
1752         LC_HAVE_IOP_ATOMIC_OPEN
1753
1754         # 3.7
1755         LC_HAVE_POSIXACL_USER_NS
1756
1757         # 3.8
1758         LC_HAVE_FILE_F_INODE
1759         LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1760
1761         # 3.9
1762         LC_HAVE_HLIST_FOR_EACH_3ARG
1763         LC_HAVE_BIO_END_SECTOR
1764
1765         # 3.10
1766         LC_BLKDEV_RELEASE_RETURN_INT
1767         LC_HAVE_REMOVE_PROC_SUBTREE
1768         LC_HAVE_PROC_REMOVE
1769
1770         # 3.11
1771         LC_INVALIDATE_RANGE
1772         LC_HAVE_DIR_CONTEXT
1773         LC_D_COMPARE_5ARGS
1774         LC_HAVE_DCOUNT
1775         LC_HAVE_DENTRY_D_U_D_ALIAS
1776         LC_HAVE_DENTRY_D_CHILD
1777
1778         # 3.12
1779         LC_OLDSIZE_TRUNCATE_PAGECACHE
1780         LC_KIOCB_KI_LEFT
1781
1782         # 3.13
1783         LC_VFS_RENAME_5ARGS
1784         LC_VFS_UNLINK_3ARGS
1785
1786         # 3.14
1787         LC_HAVE_BVEC_ITER
1788         LC_HAVE_TRUNCATE_IPAGES_FINAL
1789
1790         # 3.15
1791         LC_VFS_RENAME_6ARGS
1792
1793         # 3.16
1794         LC_DIRECTIO_USE_ITER
1795
1796         # 4.1.0
1797         LC_IOV_ITER_RW
1798
1799         #
1800         AS_IF([test "x$enable_server" != xno], [
1801                 LC_FUNC_DEV_SET_RDONLY
1802                 LC_STACK_SIZE
1803                 LC_QUOTA64
1804                 LC_QUOTA_CONFIG
1805         ])
1806 ]) # LC_PROG_LINUX
1807
1808 #
1809 # LC_CONFIG_CLIENT
1810 #
1811 # Check whether to build the client side of Lustre
1812 #
1813 AC_DEFUN([LC_CONFIG_CLIENT], [
1814 AC_MSG_CHECKING([whether to build Lustre client support])
1815 AC_ARG_ENABLE([client],
1816         AC_HELP_STRING([--disable-client],
1817                 [disable Lustre client support]),
1818         [], [enable_client="yes"])
1819 AC_MSG_RESULT([$enable_client])
1820 ]) # LC_CONFIG_CLIENT
1821
1822 #
1823 # --enable-mpitests
1824 #
1825 AC_DEFUN([LB_CONFIG_MPITESTS], [
1826 AC_ARG_ENABLE([mpitests],
1827         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
1828                        [include mpi tests]), [
1829                 enable_mpitests="yes"
1830                 case $enableval in
1831                 yes)
1832                         MPICC_WRAPPER="mpicc"
1833                         ;;
1834                 no)
1835                         enable_mpitests="no"
1836                         ;;
1837                 *)
1838                         MPICC_WRAPPER=$enableval
1839                         ;;
1840                 esac
1841         ], [
1842                 enable_mpitests="yes"
1843                 MPICC_WRAPPER="mpicc"
1844         ])
1845
1846         if test "x$enable_mpitests" != "xno"; then
1847                 oldcc=$CC
1848                 CC=$MPICC_WRAPPER
1849                 AC_CACHE_CHECK([whether mpitests can be built],
1850                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
1851                         #include <mpi.h>
1852                         int main(void) {
1853                                 int flag;
1854                                 MPI_Initialized(&flag);
1855                                 return 0;
1856                         }
1857                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
1858                 ])
1859                 enable_mpitests=$lb_cv_mpi_tests
1860                 CC=$oldcc
1861         fi
1862         AC_SUBST(MPICC_WRAPPER)
1863 ]) # LB_CONFIG_MPITESTS
1864
1865 #
1866 # LC_CONFIG_QUOTA
1867 #
1868 # whether to enable quota support global control
1869 #
1870 AC_DEFUN([LC_CONFIG_QUOTA], [
1871 AC_MSG_CHECKING([whether to enable quota support global control])
1872 AC_ARG_ENABLE([quota],
1873         AC_HELP_STRING([--enable-quota],
1874                 [enable quota support]),
1875         [], [enable_quota="yes"])
1876 AS_IF([test "x$enable_quota" = xyes],
1877         [AC_MSG_RESULT([yes])],
1878         [AC_MSG_RESULT([no])])
1879 ]) # LC_CONFIG_QUOTA
1880
1881 #
1882 # LC_QUOTA
1883 #
1884 AC_DEFUN([LC_QUOTA], [
1885 #check global
1886 LC_CONFIG_QUOTA
1887 #check for utils
1888 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
1889         AC_CHECK_HEADER([sys/quota.h],
1890                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
1891                         [Define to 1 if you have <sys/quota.h>.])],
1892                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
1893 ])
1894 ]) # LC_QUOTA
1895
1896 #
1897 # LC_CONFIG_NODEMAP_PROC_DEBUG
1898 #
1899 # enable nodemap proc file debugging
1900 #
1901 AC_DEFUN([LC_NODEMAP_PROC_DEBUG], [
1902 AC_MSG_CHECKING([whether to enable nodemap proc debug])
1903 AC_ARG_ENABLE([nodemap_proc_debug],
1904         AC_HELP_STRING([--enable-nodemap-proc-debug],
1905                 [enable nodemap proc debug]),
1906         [], [enable_nodemap_proc_debug="no"])
1907 AC_MSG_RESULT([$enable_nodemap_proc_debug])
1908 AS_IF([test "x$enable_nodemap_proc_debug" != xno],
1909         [AC_DEFINE(NODEMAP_PROC_DEBUG, 1,
1910                 [enable nodemap proc debug support])])
1911 ]) # LC_NODEMAP_PROC_DEBUG
1912
1913 #
1914 # LC_LLITE_LLOOP_MODULE
1915 #
1916 # lloop_llite.ko does not currently work with page sizes
1917 # of 64k or larger.
1918 #
1919 AC_DEFUN([LC_LLITE_LLOOP_MODULE], [
1920 LB_CHECK_COMPILE([whether to enable 'llite_lloop' module],
1921 enable_llite_lloop_module, [
1922         #include <asm/page.h>
1923 ],[
1924         #if PAGE_SIZE >= 65536
1925         #error "PAGE_SIZE >= 65536"
1926         #endif
1927 ],
1928         [enable_llite_lloop_module="yes"],
1929         [enable_llite_lloop_module="no"])
1930 ]) # LC_LLITE_LLOOP_MODULE
1931
1932 #
1933 # LC_OSD_ADDON
1934 #
1935 # configure support for optional OSD implementation
1936 #
1937 AC_DEFUN([LC_OSD_ADDON], [
1938 AC_MSG_CHECKING([whether to use OSD addon])
1939 AC_ARG_WITH([osd],
1940         AC_HELP_STRING([--with-osd=path],
1941                 [set path to optional osd]),
1942         [
1943         case "$with_osd" in
1944         no)
1945                 ENABLEOSDADDON=0
1946                 ;;
1947         *)
1948                 OSDADDON="$with_osd"
1949                 ENABLEOSDADDON=1
1950                 ;;
1951         esac
1952         ], [
1953                 ENABLEOSDADDON=0
1954         ])
1955 AS_IF([test $ENABLEOSDADDON -eq 0], [
1956         AC_MSG_RESULT([no])
1957         OSDADDON=""
1958 ], [
1959         OSDMODNAME=$(basename $OSDADDON)
1960         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
1961                 AC_MSG_RESULT([can't link])
1962                 OSDADDON=""
1963         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
1964                 AC_MSG_RESULT([$OSDMODNAME])
1965                 OSDADDON="subdir-m += $OSDMODNAME"
1966         ], [
1967                 AC_MSG_RESULT([can't link])
1968                 OSDADDON=""
1969         ])
1970 ])
1971 AC_SUBST(OSDADDON)
1972 ]) # LC_OSD_ADDON
1973
1974 #
1975 # LC_CONFIGURE
1976 #
1977 # other configure checks
1978 #
1979 AC_DEFUN([LC_CONFIGURE], [
1980 AC_MSG_NOTICE([Lustre core checks
1981 ==============================================================================])
1982
1983 LC_CONFIG_OBD_BUFFER_SIZE
1984
1985 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
1986         [CFLAGS="$CFLAGS -Werror"])
1987
1988 # maximum MDS thread count
1989 LC_MDS_MAX_THREADS
1990
1991 # lustre/utils/gss/gss_util.c
1992 # lustre/utils/gss/gssd_proc.c
1993 # lustre/utils/gss/krb5_util.c
1994 # lustre/utils/llog_reader.c
1995 # lustre/utils/create_iam.c
1996 # lustre/utils/libiam.c
1997 AC_CHECK_HEADERS([netdb.h endian.h])
1998 AC_CHECK_FUNCS([gethostbyname])
1999
2000 # lustre/utils/llverdev.c
2001 AC_CHECK_HEADERS([blkid/blkid.h])
2002
2003 # lustre/utils/llverfs.c
2004 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2005
2006 SELINUX=""
2007 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2008         [AC_CHECK_HEADERS([selinux/selinux.h],
2009                         [SELINUX="-lselinux"
2010                         AC_DEFINE([HAVE_SELINUX], 1,
2011                                 [support for selinux ])],
2012                         [AC_MSG_WARN([
2013
2014 No libselinux-devel package found, unable to build selinux enabled tools
2015 ])
2016 ])],
2017         [AC_MSG_WARN([
2018
2019 No selinux package found, unable to build selinux enabled tools
2020 ])
2021 ])
2022 AC_SUBST(SELINUX)
2023
2024 # Super safe df
2025 AC_MSG_CHECKING([whether to report minimum OST free space])
2026 AC_ARG_ENABLE([mindf],
2027         AC_HELP_STRING([--enable-mindf],
2028                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2029         [], [enable_mindf="no"])
2030 AC_MSG_RESULT([$enable_mindf])
2031 AS_IF([test "$enable_mindf" = "yes"],
2032         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2033
2034 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2035 AC_ARG_ENABLE([fail_alloc],
2036         AC_HELP_STRING([--disable-fail-alloc],
2037                 [disable randomly alloc failure]),
2038         [], [enable_fail_alloc="yes"])
2039 AC_MSG_RESULT([$enable_fail_alloc])
2040 AS_IF([test "x$enable_fail_alloc" != xno],
2041         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2042                 [enable randomly alloc failure])])
2043
2044 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2045 AC_ARG_ENABLE([invariants],
2046         AC_HELP_STRING([--enable-invariants],
2047                 [enable invariant checking (cpu intensive)]),
2048         [], [enable_invariants="no"])
2049 AC_MSG_RESULT([$enable_invariants])
2050 AS_IF([test "x$enable_invariants" = xyes],
2051         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2052                 [enable invariant checking])])
2053
2054 AC_MSG_CHECKING([whether to track references with lu_ref])
2055 AC_ARG_ENABLE([lu_ref],
2056         AC_HELP_STRING([--enable-lu_ref],
2057                 [enable lu_ref reference tracking code]),
2058         [], [enable_lu_ref="no"])
2059 AC_MSG_RESULT([$enable_lu_ref])
2060 AS_IF([test "x$enable_lu_ref" = xyes],
2061         [AC_DEFINE([USE_LU_REF], 1,
2062                 [enable lu_ref reference tracking code])])
2063
2064 AC_MSG_CHECKING([whether to enable page state tracking])
2065 AC_ARG_ENABLE([pgstate-track],
2066         AC_HELP_STRING([--enable-pgstate-track],
2067                 [enable page state tracking]),
2068         [], [enable_pgstat_track="no"])
2069 AC_MSG_RESULT([$enable_pgstat_track])
2070 AS_IF([test "x$enable_pgstat_track" = xyes],
2071         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2072                 [enable page state tracking code])])
2073 ]) # LC_CONFIGURE
2074
2075 #
2076 # LC_CONDITIONALS
2077 #
2078 # AM_CONDITIONALS for lustre
2079 #
2080 AC_DEFUN([LC_CONDITIONALS], [
2081 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2082 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2083 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2084 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2085 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2086 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2087 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2088 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2089 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2090 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2091 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2092 ]) # LC_CONDITIONALS
2093
2094 #
2095 # LC_CONFIG_FILES
2096 #
2097 # files that should be generated with AC_OUTPUT
2098 #
2099 AC_DEFUN([LC_CONFIG_FILES],
2100 [AC_CONFIG_FILES([
2101 lustre/Makefile
2102 lustre/autoMakefile
2103 lustre/autoconf/Makefile
2104 lustre/conf/Makefile
2105 lustre/contrib/Makefile
2106 lustre/doc/Makefile
2107 lustre/include/Makefile
2108 lustre/include/lustre_ver.h
2109 lustre/include/lustre/Makefile
2110 lustre/kernel_patches/targets/3.10-rhel7.target
2111 lustre/kernel_patches/targets/2.6-rhel6.6.target
2112 lustre/kernel_patches/targets/2.6-rhel6.target
2113 lustre/kernel_patches/targets/2.6-rhel5.target
2114 lustre/kernel_patches/targets/2.6-sles11.target
2115 lustre/kernel_patches/targets/3.0-sles11.target
2116 lustre/kernel_patches/targets/3.0-sles11sp3.target
2117 lustre/kernel_patches/targets/3.12-sles12.target
2118 lustre/kernel_patches/targets/2.6-fc11.target
2119 lustre/kernel_patches/targets/2.6-fc12.target
2120 lustre/kernel_patches/targets/2.6-fc15.target
2121 lustre/kernel_patches/targets/3.x-fc18.target
2122 lustre/ldlm/Makefile
2123 lustre/fid/Makefile
2124 lustre/fid/autoMakefile
2125 lustre/llite/Makefile
2126 lustre/llite/autoMakefile
2127 lustre/lov/Makefile
2128 lustre/lov/autoMakefile
2129 lustre/mdc/Makefile
2130 lustre/mdc/autoMakefile
2131 lustre/lmv/Makefile
2132 lustre/lmv/autoMakefile
2133 lustre/lfsck/Makefile
2134 lustre/lfsck/autoMakefile
2135 lustre/mdt/Makefile
2136 lustre/mdt/autoMakefile
2137 lustre/mdd/Makefile
2138 lustre/mdd/autoMakefile
2139 lustre/fld/Makefile
2140 lustre/fld/autoMakefile
2141 lustre/obdclass/Makefile
2142 lustre/obdclass/autoMakefile
2143 lustre/obdclass/linux/Makefile
2144 lustre/obdecho/Makefile
2145 lustre/obdecho/autoMakefile
2146 lustre/ofd/Makefile
2147 lustre/ofd/autoMakefile
2148 lustre/osc/Makefile
2149 lustre/osc/autoMakefile
2150 lustre/ost/Makefile
2151 lustre/ost/autoMakefile
2152 lustre/osd-ldiskfs/Makefile
2153 lustre/osd-ldiskfs/autoMakefile
2154 lustre/osd-zfs/Makefile
2155 lustre/osd-zfs/autoMakefile
2156 lustre/mgc/Makefile
2157 lustre/mgc/autoMakefile
2158 lustre/mgs/Makefile
2159 lustre/mgs/autoMakefile
2160 lustre/target/Makefile
2161 lustre/ptlrpc/Makefile
2162 lustre/ptlrpc/autoMakefile
2163 lustre/ptlrpc/gss/Makefile
2164 lustre/ptlrpc/gss/autoMakefile
2165 lustre/quota/Makefile
2166 lustre/quota/autoMakefile
2167 lustre/scripts/Makefile
2168 lustre/tests/Makefile
2169 lustre/tests/mpi/Makefile
2170 lustre/utils/Makefile
2171 lustre/utils/gss/Makefile
2172 lustre/osp/Makefile
2173 lustre/osp/autoMakefile
2174 lustre/lod/Makefile
2175 lustre/lod/autoMakefile
2176 ])
2177 ]) # LC_CONFIG_FILES