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