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