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