Whamcloud - gitweb
LU-1337 build: add missing include dir
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
1 #
2 # LC_CONFIG_SRCDIR
3 #
4 # Wrapper for AC_CONFIG_SUBDIR
5 #
6 AC_DEFUN([LC_CONFIG_SRCDIR],
7 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
8 libcfs_is_module=yes
9 ldiskfs_is_ext4=yes
10 ])
11
12 #
13 # LC_PATH_DEFAULTS
14 #
15 # lustre specific paths
16 #
17 AC_DEFUN([LC_PATH_DEFAULTS],
18 [# ptlrpc kernel build requires this
19 LUSTRE="$PWD/lustre"
20 AC_SUBST(LUSTRE)
21
22 # mount.lustre
23 rootsbindir='/sbin'
24 AC_SUBST(rootsbindir)
25
26 demodir='$(docdir)/demo'
27 AC_SUBST(demodir)
28
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
31 ])
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(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=size],
125                         [define the maximum number of threads available on the MDS: (default=512)]),
126         [
127                 MDS_THREAD_COUNT=$with_mds_max_threads
128                 AC_DEFINE_UNQUOTED(MDT_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of mdt 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],[AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [support quota])],[
215         AC_MSG_ERROR([Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])
216 ])
217 ])
218
219 # truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
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],
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 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
238 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
239 [fs/dcache.c],[
240 AC_DEFINE(HAVE_D_REHASH_COND, 1,
241             [d_rehash_cond is exported by the kernel])
242 ],[
243 ])
244 ])
245
246 AC_DEFUN([LC_EXPORT___D_REHASH],
247 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
248 [fs/dcache.c],[
249 AC_DEFINE(HAVE___D_REHASH, 1,
250             [__d_rehash is exported by the kernel])
251 ],[
252 ])
253 ])
254
255 # The actual symbol exported varies among architectures, so we need
256 # to check many symbols (but only in the current architecture.)  No
257 # matter what symbol is exported, the kernel #defines node_to_cpumask
258 # to the appropriate function and that's what we use.
259 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
260          [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
261                                  [arch/$LINUX_ARCH/mm/numa.c],
262                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
263                                             [node_to_cpumask is exported by
264                                              the kernel])]) # x86_64
265           LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
266                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
267                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
268                                             [node_to_cpumask is exported by
269                                              the kernel])]) # ia64
270           LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
271                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
272                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
273                                             [node_to_cpumask is exported by
274                                              the kernel])]) # i386
275           ])
276
277 #
278 #
279 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
280 #
281 AC_DEFUN([LC_FILEMAP_POPULATE],
282 [AC_MSG_CHECKING([for exported filemap_populate])
283 LB_LINUX_TRY_COMPILE([
284         #include <asm/page.h>
285         #include <linux/mm.h>
286 ],[
287        filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
288 ],[
289         AC_MSG_RESULT([yes])
290         AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
291 ],[
292         AC_MSG_RESULT([no])
293 ])
294 ])
295
296 #
297 # added in 2.6.17
298 #
299 AC_DEFUN([LC_BIT_SPINLOCK_H],
300 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
301         AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
302         LB_LINUX_TRY_COMPILE([
303                 #include <asm/processor.h>
304                 #include <linux/spinlock.h>
305                 #include <linux/bit_spinlock.h>
306         ],[],[
307                 AC_MSG_RESULT([yes])
308                 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
309         ],[
310                 AC_MSG_RESULT([no])
311         ])
312 ],
313 [])
314 ])
315
316 #
317 # LC_CONST_ACL_SIZE
318 #
319 AC_DEFUN([LC_CONST_ACL_SIZE],
320 [AC_MSG_CHECKING([calc acl size])
321 tmp_flags="$CFLAGS"
322 CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`echo $target_cpu|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -include $AUTOCONF_HDIR/autoconf.h $EXTRA_KCFLAGS"
323 AC_TRY_RUN([
324         #define __KERNEL__
325         #include <linux/types.h>
326         #undef __KERNEL__
327         // block include
328         #define __LINUX_POSIX_ACL_H
329
330         #ifdef CONFIG_FS_POSIX_ACL
331         # include <linux/posix_acl_xattr.h>
332         #endif
333
334         #include <stdio.h>
335
336         int main(void)
337         {
338                 /* LUSTRE_POSIX_ACL_MAX_ENTRIES  = 32 */
339             int size = posix_acl_xattr_size(32);
340             FILE *f = fopen("acl.size","w+");
341             fprintf(f,"%d", size);
342             fclose(f);
343
344             return 0;
345         }
346 ],[
347         acl_size=`cat acl.size`
348         AC_MSG_RESULT([ACL size $acl_size])
349         AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
350 ],[
351         AC_ERROR([ACL size can't be computed])
352 ],[
353         AC_MSG_RESULT([can't check ACL size, make it 260])
354         AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
355 ])
356 CFLAGS="$tmp_flags"
357 ])
358
359 #
360 # LC_CAPA_CRYPTO
361 #
362 AC_DEFUN([LC_CAPA_CRYPTO],
363 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
364         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
365 ])
366 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
367         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
368 ])
369 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
370         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
371 ])
372 ])
373
374 #
375 # LC_CONFIG_RMTCLIENT
376 #
377 dnl FIXME
378 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
379 dnl FIXME
380 AC_DEFUN([LC_CONFIG_RMTCLIENT],
381 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
382         AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
383 ])
384 ])
385
386 #
387 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
388 #
389 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
390 [AC_MSG_CHECKING([whether to enable gss keyring backend])
391  AC_ARG_ENABLE([gss_keyring],
392                [AC_HELP_STRING([--disable-gss-keyring],
393                                [disable gss keyring backend])],
394                [],[enable_gss_keyring='yes'])
395  AC_MSG_RESULT([$enable_gss_keyring])
396
397  if test x$enable_gss_keyring != xno; then
398         LB_LINUX_CONFIG_IM([KEYS],[],
399                            [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
400
401         AC_CHECK_LIB([keyutils], [keyctl_search], [],
402                      [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
403
404         AC_DEFINE([HAVE_GSS_KEYRING], [1],
405                   [Define this if you enable gss keyring backend])
406  fi
407 ])
408
409 AC_DEFUN([LC_CONFIG_SUNRPC],
410 [LB_LINUX_CONFIG_IM([SUNRPC],[],
411                     [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
412 ])
413
414 #
415 # LC_CONFIG_GSS (default disabled)
416 #
417 # Build gss and related tools of Lustre. Currently both kernel and user space
418 # parts are depend on linux platform.
419 #
420 AC_DEFUN([LC_CONFIG_GSS],
421 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
422  AC_ARG_ENABLE([gss],
423                [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
424                [],[enable_gss='no'])
425  AC_MSG_RESULT([$enable_gss])
426
427  if test x$enable_gss == xyes; then
428         LC_CONFIG_GSS_KEYRING
429         LC_CONFIG_SUNRPC
430
431         AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
432
433         LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
434                            [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
435         LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
436                            [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
437         LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
438                            [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
439         LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
440                            [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
441
442         AC_CHECK_LIB([gssapi], [gss_init_sec_context],
443                      [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
444                      [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
445                                    [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
446                                    [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
447
448         AC_SUBST(GSSAPI_LIBS)
449
450         AC_KERBEROS_V5
451  fi
452 ])
453
454 AC_DEFUN([LC_TASK_CLENV_STORE],
455 [
456         AC_MSG_CHECKING([if we can store cl_env in task_struct])
457         if test x$have_task_clenv_store != xyes ; then
458                 LC_TASK_CLENV_TUX_INFO
459         fi
460 ])
461
462 # 2.6.12
463
464 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
465 # yet tree_lock is converted from rwlock to spin_lock since v2.6.26
466 AC_DEFUN([LC_RW_TREE_LOCK],
467 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
468 tmp_flags="$EXTRA_KCFLAGS"
469 EXTRA_KCFLAGS="-Werror"
470 LB_LINUX_TRY_COMPILE([
471         #include <linux/fs.h>
472 ],[
473         struct address_space a;
474
475         write_lock(&a.tree_lock);
476 ],[
477         AC_MSG_RESULT([yes])
478         AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
479 ],[
480         AC_MSG_RESULT([no])
481 ])
482 EXTRA_KCFLAGS="$tmp_flags"
483 ])
484
485 # 2.6.18
486
487 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
488 # 2.6.18~2.6.25 umount_begin has different parameters
489 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
490 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
491 tmp_flags="$EXTRA_KCFLAGS"
492 EXTRA_KCFLAGS="-Werror"
493 LB_LINUX_TRY_COMPILE([
494         #include <linux/fs.h>
495
496         struct vfsmount;
497         static void cfg_umount_begin (struct vfsmount *v, int flags)
498         {
499                 ;
500         }
501
502         static struct super_operations cfg_super_operations = {
503                 .umount_begin   = cfg_umount_begin,
504         };
505 ],[
506         cfg_super_operations.umount_begin(NULL,0);
507 ],[
508         AC_MSG_RESULT(yes)
509         AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
510                 [Define umount_begin need second argument])
511 ],[
512         AC_MSG_RESULT(no)
513 ])
514 EXTRA_KCFLAGS="$tmp_flags"
515 ])
516
517 #2.6.18 + RHEL5 (fc6)
518
519 #
520 # LC_LINUX_FIEMAP_H
521 #
522 # fiemap.h is added since v2.6.28
523 # RHEL5 2.6.18 has it, while SLES10 2.6.27 does not
524 #
525 AC_DEFUN([LC_LINUX_FIEMAP_H],
526 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
527         AC_MSG_CHECKING([if fiemap.h can be compiled])
528         LB_LINUX_TRY_COMPILE([
529                 #include <linux/types.h>
530                 #include <linux/fiemap.h>
531         ],[],[
532                 AC_MSG_RESULT([yes])
533                 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
534         ],[
535                 AC_MSG_RESULT([no])
536         ])
537 ],
538 [])
539 ])
540
541 # 2.6.19
542
543 # LC_FILE_WRITEV
544 # 2.6.19 replaced writev with aio_write
545 AC_DEFUN([LC_FILE_WRITEV],
546 [AC_MSG_CHECKING([writev in fops])
547 LB_LINUX_TRY_COMPILE([
548         #include <linux/fs.h>
549 ],[
550         struct file_operations *fops = NULL;
551         fops->writev = NULL;
552 ],[
553         AC_MSG_RESULT(yes)
554         AC_DEFINE(HAVE_FILE_WRITEV, 1,
555                 [use fops->writev])
556 ],[
557         AC_MSG_RESULT(no)
558 ])
559 ])
560
561 # LC_FILE_READV
562 # 2.6.19 replaced readv with aio_read
563 AC_DEFUN([LC_FILE_READV],
564 [AC_MSG_CHECKING([readv in fops])
565 LB_LINUX_TRY_COMPILE([
566         #include <linux/fs.h>
567 ],[
568         struct file_operations *fops = NULL;
569         fops->readv = NULL;
570 ],[
571         AC_MSG_RESULT(yes)
572         AC_DEFINE(HAVE_FILE_READV, 1,
573                 [use fops->readv])
574 ],[
575         AC_MSG_RESULT(no)
576 ])
577 ])
578
579 # 2.6.20
580
581 # LC_CANCEL_DIRTY_PAGE
582 # 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
583 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
584         [AC_MSG_CHECKING([kernel has cancel_dirty_page])
585         # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
586         # backport is broken, so ignore it
587         if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
588            test "$(sed -ne '/^static inline void cancel_dirty_page(struct page \*page, unsigned int account_size)$/,/^}$/p' $OFED_BACKPORT_PATH/linux/mm.h | md5sum)" = "c518cb32d6394760c5bca14cb7538d3e  -"; then
589                 AC_MSG_RESULT(no)
590         else
591                 LB_LINUX_TRY_COMPILE([
592                         #include <linux/mm.h>
593                         #include <linux/page-flags.h>
594 ],[
595                         cancel_dirty_page(NULL, 0);
596 ],[
597                         AC_MSG_RESULT(yes)
598                         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
599                                   [kernel has cancel_dirty_page instead of clear_page_dirty])
600 ],[
601                         AC_MSG_RESULT(no)
602 ])
603         fi
604 ])
605
606 # raid5-zerocopy patch
607
608 #
609 # LC_PAGE_CONSTANT
610 #
611 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
612 # it support constant page, which means the page won't be modified during the
613 # IO.
614 #
615 AC_DEFUN([LC_PAGE_CONSTANT],
616 [AC_MSG_CHECKING([if kernel have PageConstant defined])
617 LB_LINUX_TRY_COMPILE([
618         #include <linux/mm.h>
619         #include <linux/page-flags.h>
620 ],[
621         #ifndef PG_constant
622         #error "Have no raid5 zcopy patch"
623         #endif
624 ],[
625         AC_MSG_RESULT(yes)
626         AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
627 ],[
628         AC_MSG_RESULT(no);
629 ])
630 ])
631
632 # 2.6.22
633
634 # 2.6.22 lost second parameter for invalidate_bdev
635 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
636 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
637 LB_LINUX_TRY_COMPILE([
638         #include <linux/buffer_head.h>
639 ],[
640         invalidate_bdev(NULL,0);
641 ],[
642         AC_MSG_RESULT([yes])
643         AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
644                 [invalidate_bdev has second argument])
645 ],[
646         AC_MSG_RESULT([no])
647 ])
648 ])
649
650 #
651 # check for crypto API
652 #
653 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
654 [AC_MSG_CHECKING([if kernel has block cipher support])
655 LB_LINUX_TRY_COMPILE([
656         #include <linux/err.h>
657         #include <linux/crypto.h>
658 ],[
659         struct crypto_blkcipher *tfm;
660         tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
661 ],[
662         AC_MSG_RESULT([yes])
663         AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
664 ],[
665         AC_MSG_RESULT([no])
666 ])
667 ])
668
669 #
670 # check for struct hash_desc
671 #
672 AC_DEFUN([LC_STRUCT_HASH_DESC],
673 [AC_MSG_CHECKING([if kernel has struct hash_desc])
674 LB_LINUX_TRY_COMPILE([
675         #include <linux/err.h>
676         #include <linux/crypto.h>
677 ],[
678         struct hash_desc foo __attribute__ ((unused));
679 ],[
680         AC_MSG_RESULT([yes])
681         AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
682 ],[
683         AC_MSG_RESULT([no])
684 ])
685 ])
686
687 #
688 # check for struct blkcipher_desc
689 #
690 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
691 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
692 LB_LINUX_TRY_COMPILE([
693         #include <linux/err.h>
694         #include <linux/crypto.h>
695 ],[
696         struct blkcipher_desc foo __attribute__ ((unused));
697 ],[
698         AC_MSG_RESULT([yes])
699         AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
700 ],[
701         AC_MSG_RESULT([no])
702 ])
703 ])
704
705 #
706 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
707 #
708 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
709 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
710 LB_LINUX_TRY_COMPILE([
711         #include <linux/fs.h>
712 ],[
713         int v __attribute__ ((unused));
714         v = FS_RENAME_DOES_D_MOVE;
715 ],[
716         AC_MSG_RESULT([yes])
717         AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
718 ],[
719         AC_MSG_RESULT([no])
720 ])
721 ])
722
723 # 2.6.23
724
725 # 2.6.23 have return type 'void' for unregister_blkdev
726 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
727 [AC_MSG_CHECKING([if unregister_blkdev return int])
728 LB_LINUX_TRY_COMPILE([
729         #include <linux/fs.h>
730 ],[
731         int i __attribute__ ((unused));
732         i = unregister_blkdev(0,NULL);
733 ],[
734         AC_MSG_RESULT([yes])
735         AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
736                 [unregister_blkdev return int])
737 ],[
738         AC_MSG_RESULT([no])
739 ])
740 ])
741
742 # 2.6.23 change .sendfile to .splice_read
743 AC_DEFUN([LC_KERNEL_SPLICE_READ],
744 [AC_MSG_CHECKING([if kernel has .splice_read])
745 LB_LINUX_TRY_COMPILE([
746         #include <linux/fs.h>
747 ],[
748         struct file_operations file;
749
750         file.splice_read = NULL;
751 ], [
752         AC_MSG_RESULT([yes])
753         AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
754                 [kernel has .slice_read])
755 ],[
756         AC_MSG_RESULT([no])
757 ])
758 ])
759
760 # 2.6.23 change .sendfile to .splice_read
761 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
762 AC_DEFUN([LC_KERNEL_SENDFILE],
763 [AC_MSG_CHECKING([if kernel has .sendfile])
764 LB_LINUX_TRY_COMPILE([
765         #include <linux/fs.h>
766 ],[
767         struct file_operations file;
768
769         file.sendfile = NULL;
770 ], [
771         AC_MSG_RESULT([yes])
772         AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
773                 [kernel has .sendfile])
774 ],[
775         AC_MSG_RESULT([no])
776 ])
777 ])
778
779 # 2.6.23 extract nfs export related data into exportfs.h
780 AC_DEFUN([LC_HAVE_EXPORTFS_H],
781 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
782         AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
783                 [kernel has include/exportfs.h])
784 ],[
785         AC_MSG_RESULT([no])
786 ])
787 ])
788
789 # 2.6.23 has new page fault handling API
790 AC_DEFUN([LC_VM_OP_FAULT],
791 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
792 LB_LINUX_TRY_COMPILE([
793         #include <linux/mm.h>
794 ],[
795         struct vm_operations_struct op;
796
797         op.fault = NULL;
798 ], [
799         AC_MSG_RESULT([yes])
800         AC_DEFINE(HAVE_VM_OP_FAULT, 1,
801                 [kernel has .fault in vm_operation_struct])
802 ],[
803         AC_MSG_RESULT([no])
804 ])
805 ])
806
807 # 2.6.23 add code to wait other users to complete before removing procfs entry
808 AC_DEFUN([LC_PROCFS_USERS],
809 [AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
810 LB_LINUX_TRY_COMPILE([
811         #include <linux/proc_fs.h>
812 ],[
813         struct proc_dir_entry pde;
814
815         pde.pde_users   = 0;
816 ],[
817         AC_MSG_RESULT([yes])
818         AC_DEFINE(HAVE_PROCFS_USERS, 1,
819                 [kernel has pde_users member in procfs entry struct])
820 ],[
821         LB_LINUX_TRY_COMPILE([
822                 #include "$LINUX/fs/proc/internal.h"
823         ],[
824                 struct proc_dir_entry_aux pde_aux;
825
826                 pde_aux.pde_users = 0;
827         ],[
828                 AC_MSG_RESULT([yes])
829                 AC_DEFINE(HAVE_PROCFS_USERS, 1,
830                         [kernel has pde_users member in proc_dir_entry_aux])
831         ],[
832                 AC_MSG_RESULT([no])
833         ])
834 ])
835 ])
836
837 # 2.6.23 exports exportfs_decode_fh
838 AC_DEFUN([LC_EXPORTFS_DECODE_FH],
839 [LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
840 [fs/exportfs/expfs.c],[
841         AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
842                 [exportfs_decode_fh has been export])
843 ],[
844 ])
845 ])
846
847 # 2.6.24
848
849 # 2.6.24 need linux/mm_types.h included
850 AC_DEFUN([LC_HAVE_MMTYPES_H],
851 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
852         AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
853                 [kernel has include/mm_types.h])
854 ],[
855         AC_MSG_RESULT([no])
856 ])
857 ])
858
859 # 2.6.24 has bio_endio with 2 args
860 AC_DEFUN([LC_BIO_ENDIO_2ARG],
861 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
862 LB_LINUX_TRY_COMPILE([
863         #include <linux/bio.h>
864 ],[
865         bio_endio(NULL, 0);
866 ], [
867         AC_MSG_RESULT([yes])
868         AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
869                 [kernel has bio_endio with 2 args])
870 ],[
871         AC_MSG_RESULT([no])
872 ])
873 ])
874
875 # 2.6.24 has new members in exports struct.
876 AC_DEFUN([LC_FH_TO_DENTRY],
877 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
878 LB_LINUX_TRY_COMPILE([
879         #include <linux/fs.h>
880 #ifdef HAVE_LINUX_EXPORTFS_H
881         #include <linux/exportfs.h>
882 #endif
883 ],[
884         do{ }while(sizeof(((struct export_operations *)0)->fh_to_dentry));
885 ], [
886         AC_MSG_RESULT([yes])
887         AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
888                 [kernel has .fh_to_dentry member in export_operations struct])
889 ],[
890         AC_MSG_RESULT([no])
891 ])
892 ])
893
894 # 2.6.24 removes long aged procfs entry -> deleted member
895 AC_DEFUN([LC_PROCFS_DELETED],
896 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
897 LB_LINUX_TRY_COMPILE([
898         #include <linux/proc_fs.h>
899 ],[
900         struct proc_dir_entry pde;
901
902         pde.deleted = sizeof(pde);
903 ], [
904         AC_MSG_RESULT([yes])
905         AC_DEFINE(HAVE_PROCFS_DELETED, 1,
906                 [kernel has deleted member in procfs entry struct])
907 ],[
908         AC_MSG_RESULT([no])
909 ])
910 ])
911
912 # 2.6.24 has bdi_init()/bdi_destroy() functions.
913 AC_DEFUN([LC_EXPORT_BDI_INIT],
914 [LB_CHECK_SYMBOL_EXPORT([bdi_init],
915 [mm/backing-dev.c],[
916         AC_DEFINE(HAVE_BDI_INIT, 1,
917                 [bdi_init/bdi_destroy functions are present])
918 ],[
919 ])
920 ])
921
922 # 2.6.26
923
924 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
925 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
926 [AC_MSG_CHECKING([fs_struct use path structure])
927 LB_LINUX_TRY_COMPILE([
928         #include <asm/atomic.h>
929         #include <linux/spinlock.h>
930         #include <linux/fs_struct.h>
931 ],[
932         struct fs_struct fs;
933
934         fs.pwd = *((struct path *)sizeof(fs));
935 ], [
936         AC_MSG_RESULT([yes])
937         AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
938                 [fs_struct use path structure])
939 ],[
940         AC_MSG_RESULT([no])
941 ])
942 ])
943
944 #
945 # 2.6.27
946 #
947
948 # LC_SECURITY_PLUG  # for SLES10 SP2 (2.6.27)
949 # check security plug in sles10 sp2 kernel
950 AC_DEFUN([LC_SECURITY_PLUG],
951 [AC_MSG_CHECKING([If kernel has security plug support])
952 LB_LINUX_TRY_COMPILE([
953         #include <linux/fs.h>
954         #include <linux/stddef.h>
955 ],[
956         notify_change(NULL, NULL, NULL);
957 ],[
958         AC_MSG_RESULT(yes)
959         AC_DEFINE(HAVE_SECURITY_PLUG, 1,
960                 [SLES10 SP2 use extra parameter in vfs])
961 ],[
962         AC_MSG_RESULT(no)
963 ])
964 ])
965
966 AC_DEFUN([LC_PGMKWRITE_USE_VMFAULT],
967 [AC_MSG_CHECKING([kernel .page_mkwrite uses struct vm_fault *])
968 tmp_flags="$EXTRA_KCFLAGS"
969 EXTRA_KCFLAGS="-Werror"
970 LB_LINUX_TRY_COMPILE([
971         #include <linux/mm.h>
972 ],[
973         ((struct vm_operations_struct *)0)->page_mkwrite((struct vm_area_struct *)0, (struct vm_fault *)0);
974 ], [
975         AC_MSG_RESULT([yes])
976         AC_DEFINE(HAVE_PGMKWRITE_USE_VMFAULT, 1,
977                 [kernel vm_operation_struct.page_mkwrite uses struct vm_fault * as second parameter])
978 ],[
979         AC_MSG_RESULT([no])
980 ])
981 EXTRA_KCFLAGS="$tmp_flags"
982 ])
983
984 AC_DEFUN([LC_PGMKWRITE_COMPACT],
985 [AC_MSG_CHECKING([if kernel .page_mkwrite is located in vm_operation_struct._pmkw])
986 tmp_flags="$EXTRA_KCFLAGS"
987 EXTRA_KCFLAGS="-Werror"
988 LB_LINUX_TRY_COMPILE([
989         #include <linux/mm.h>
990 ],[
991         struct vm_operations_struct *vm_ops;
992
993         vm_ops = NULL;
994         vm_ops->_pmkw.page_mkwrite(NULL, NULL);
995 ], [
996         AC_MSG_RESULT([yes])
997         AC_DEFINE(HAVE_PGMKWRITE_COMPACT, 1,
998                 [kernel .page_mkwrite is located in vm_operation_struct._pmkw])
999 ],[
1000         AC_MSG_RESULT([no])
1001 ])
1002 EXTRA_KCFLAGS="$tmp_flags"
1003 ])
1004
1005 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1006 [AC_MSG_CHECKING([inode_operations->permission has two args])
1007 LB_LINUX_TRY_COMPILE([
1008         #include <linux/fs.h>
1009 ],[
1010         struct inode *inode __attribute__ ((unused));
1011
1012         inode = NULL;
1013         inode->i_op->permission(NULL, 0);
1014 ],[
1015         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
1016                   [inode_operations->permission has two args])
1017         AC_MSG_RESULT([yes])
1018 ],[
1019         AC_MSG_RESULT([no])
1020 ])
1021 ])
1022
1023 # 2.6.27 has file_remove_suid instead of remove_suid
1024 AC_DEFUN([LC_FILE_REMOVE_SUID],
1025 [AC_MSG_CHECKING([kernel has file_remove_suid])
1026 LB_LINUX_TRY_COMPILE([
1027         #include <linux/fs.h>
1028 ],[
1029         file_remove_suid(NULL);
1030 ],[
1031         AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1032                   [kernel have file_remove_suid])
1033         AC_MSG_RESULT([yes])
1034 ],[
1035         AC_MSG_RESULT([no])
1036 ])
1037 ])
1038
1039 # 2.6.27 have new page locking API
1040 AC_DEFUN([LC_TRYLOCKPAGE],
1041 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1042 LB_LINUX_TRY_COMPILE([
1043         #include <linux/pagemap.h>
1044 ],[
1045         trylock_page(NULL);
1046 ],[
1047         AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1048                   [kernel uses trylock_page for page lock])
1049         AC_MSG_RESULT([yes])
1050 ],[
1051         AC_MSG_RESULT([no])
1052 ])
1053 ])
1054
1055 # 2.6.27 removed the read_inode from super_operations.
1056 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1057 [AC_MSG_CHECKING([super_operations has a read_inode field])
1058 LB_LINUX_TRY_COMPILE([
1059         #include <linux/fs.h>
1060 ],[
1061         struct super_operations *sop;
1062         sop->read_inode(NULL);
1063 ],[
1064         AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1065                 [super_operations has a read_inode])
1066         AC_MSG_RESULT([yes])
1067 ],[
1068         AC_MSG_RESULT([no])
1069 ])
1070 ])
1071
1072 # 2.6.27 has inode_permission instead of permisson
1073 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1074 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1075 [fs/namei.c],[
1076 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1077             [inode_permission is exported by the kernel])
1078 ],[
1079 ])
1080 ])
1081
1082 # 2.6.27 use 5th parameter in quota_on for remount.
1083 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1084 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1085 LB_LINUX_TRY_COMPILE([
1086         #include <linux/fs.h>
1087         #include <linux/quota.h>
1088 ],[
1089         struct quotactl_ops *qop = NULL;
1090         qop->quota_on(NULL, 0, 0, NULL, 0);
1091 ],[
1092         AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1093                 [quota_on needs 5 paramters])
1094         AC_MSG_RESULT([yes])
1095 ],[
1096         AC_MSG_RESULT([no])
1097 ])
1098 ])
1099
1100 # 2.6.27 use 3th parameter in quota_off for remount.
1101 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1102 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1103 LB_LINUX_TRY_COMPILE([
1104         #include <linux/fs.h>
1105         #include <linux/quota.h>
1106 ],[
1107         struct quotactl_ops *qop = NULL;
1108         qop->quota_off(NULL, 0, 0);
1109 ],[
1110         AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1111                 [quota_off needs 3 paramters])
1112         AC_MSG_RESULT([yes])
1113 ],[
1114         AC_MSG_RESULT([no])
1115 ])
1116 ])
1117
1118 # 2.6.27 has vfs_dq_off inline function.
1119 AC_DEFUN([LC_VFS_DQ_OFF],
1120 [AC_MSG_CHECKING([vfs_dq_off is defined])
1121 LB_LINUX_TRY_COMPILE([
1122         #include <linux/quotaops.h>
1123 ],[
1124         vfs_dq_off(NULL, 0);
1125 ],[
1126         AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1127         AC_MSG_RESULT([yes])
1128 ],[
1129         AC_MSG_RESULT([no])
1130 ])
1131 ])
1132
1133 # LC_LOCK_MAP_ACQUIRE
1134 # after 2.6.27 lock_map_acquire replaces lock_acquire
1135 AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
1136 [AC_MSG_CHECKING([if lock_map_acquire is defined])
1137 LB_LINUX_TRY_COMPILE([
1138         #include <linux/lockdep.h>
1139 ],[
1140         lock_map_acquire(NULL);
1141 ],[
1142         AC_MSG_RESULT(yes)
1143         AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
1144                 [lock_map_acquire is defined])
1145 ],[
1146         AC_MSG_RESULT(no)
1147 ])
1148 ])
1149
1150 # 2.6.27.15-2 sles11
1151
1152 # 2.6.27 sles11 remove the bi_hw_segments
1153 AC_DEFUN([LC_BI_HW_SEGMENTS],
1154 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1155 LB_LINUX_TRY_COMPILE([
1156         #include <linux/bio.h>
1157 ],[
1158         struct bio io;
1159         io.bi_hw_segments = sizeof(io);
1160 ],[
1161         AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1162                 [struct bio has a bi_hw_segments field])
1163         AC_MSG_RESULT([yes])
1164 ],[
1165         AC_MSG_RESULT([no])
1166 ])
1167 ])
1168
1169 #
1170 # 2.6.27 sles11 move the quotaio_v1{2}.h from include/linux to fs
1171 # 2.6.32 move the quotaio_v1{2}.h from fs to fs/quota
1172 AC_DEFUN([LC_HAVE_QUOTAIO_H],
1173 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v2.h],[
1174         AC_DEFINE(HAVE_QUOTAIO_H, 1,
1175                 [kernel has include/linux/quotaio_v2.h])
1176 ],[LB_CHECK_FILE([$LINUX/fs/quotaio_v2.h],[
1177                AC_DEFINE(HAVE_FS_QUOTAIO_H, 1,
1178                 [kernel has fs/quotaio_v1.h])
1179 ],[LB_CHECK_FILE([$LINUX/fs/quota/quotaio_v2.h],[
1180                AC_DEFINE(HAVE_FS_QUOTA_QUOTAIO_H, 1,
1181                 [kernel has fs/quota/quotaio_v2.h])
1182 ],[
1183         AC_MSG_RESULT([no])
1184 ])
1185 ])
1186 ])
1187 ])
1188
1189 # 2.6.27 sles11 has sb_any_quota_active
1190 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1191 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1192 LB_LINUX_TRY_COMPILE([
1193         #include <linux/quotaops.h>
1194 ],[
1195         sb_any_quota_active(NULL);
1196 ],[
1197         AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1198                 [Kernel has a sb_any_quota_active])
1199         AC_MSG_RESULT([yes])
1200 ],[
1201         AC_MSG_RESULT([no])
1202 ])
1203 ])
1204
1205 # 2.6.27 sles11 has sb_has_quota_active
1206 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1207 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1208 LB_LINUX_TRY_COMPILE([
1209         #include <linux/quotaops.h>
1210 ],[
1211         sb_has_quota_active(NULL, 0);
1212 ],[
1213         AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1214                 [Kernel has a sb_has_quota_active])
1215         AC_MSG_RESULT([yes])
1216 ],[
1217         AC_MSG_RESULT([no])
1218 ])
1219 ])
1220
1221 # 2.6.27 exported add_to_page_cache_lru.
1222 AC_DEFUN([LC_EXPORT_ADD_TO_PAGE_CACHE_LRU],
1223 [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1224 [mm/filemap.c],[
1225         AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1226                 [add_to_page_cache_lru functions are present])
1227 ],[
1228 ])
1229 ])
1230
1231 #
1232 # 2.6.29 introduce sb_any_quota_loaded.
1233 #
1234 AC_DEFUN([LC_SB_ANY_QUOTA_LOADED],
1235 [AC_MSG_CHECKING([Kernel has sb_any_quota_loaded])
1236 LB_LINUX_TRY_COMPILE([
1237         #include <linux/quotaops.h>
1238 ],[
1239         sb_any_quota_loaded(NULL);
1240 ],[
1241         AC_DEFINE(HAVE_SB_ANY_QUOTA_LOADED, 1,
1242                 [Kernel has a sb_any_quota_loaded])
1243         AC_MSG_RESULT([yes])
1244 ],[
1245         AC_MSG_RESULT([no])
1246 ])
1247 ])
1248
1249 # 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
1250 AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
1251          [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
1252                                  [arch/$LINUX_ARCH/mm/numa.c],
1253                                  [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
1254                                             [node_to_cpumask_map is exported by
1255                                              the kernel])]) # x86_64
1256          ])
1257
1258 # 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
1259 AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
1260 [AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
1261 LB_LINUX_TRY_COMPILE([
1262         #include <linux/blkdev.h>
1263 ],[
1264         blk_queue_logical_block_size(NULL, 0);
1265 ],[
1266         AC_MSG_RESULT(yes)
1267         AC_DEFINE(HAVE_BLK_QUEUE_LOG_BLK_SIZE, 1,
1268                   [blk_queue_logical_block_size is defined])
1269 ],[
1270         AC_MSG_RESULT(no)
1271 ])
1272 ])
1273
1274 # 2.6.32
1275
1276 # 2.6.32 introduced inode_newsize_ok
1277 AC_DEFUN([LC_VFS_INODE_NEWSIZE_OK],
1278 [AC_MSG_CHECKING([if inode_newsize_ok is defined])
1279 LB_LINUX_TRY_COMPILE([
1280         #include <linux/fs.h>
1281 ],[
1282         return inode_newsize_ok(NULL, 0);
1283 ],[
1284         AC_MSG_RESULT(yes)
1285         AC_DEFINE(HAVE_VFS_INODE_NEWSIZE_OK, 1,
1286                   [inode_newsize_ok is defined])
1287 ],[
1288         AC_MSG_RESULT(no)
1289 ])
1290 ])
1291
1292 # 2.6.32 changes cache_detail's member cache_request to cache_upcall
1293 # in kernel commit bc74b4f5e63a09fb78e245794a0de1e5a2716bbe
1294 AC_DEFUN([LC_CACHE_UPCALL],
1295 [AC_MSG_CHECKING([if cache_detail has cache_upcall field])
1296         LB_LINUX_TRY_COMPILE([
1297                 #include <linux/sunrpc/cache.h>
1298         ],[
1299                 struct cache_detail cd;
1300                 cd.cache_upcall = NULL;
1301         ],[
1302                 AC_MSG_RESULT(yes)
1303                 AC_DEFINE(HAVE_CACHE_UPCALL, 1,
1304                           [cache_detail has cache_upcall field])
1305         ],[
1306                 AC_MSG_RESULT(no)
1307         ])
1308 ])
1309
1310 # 2.6.32 add a limits member in struct request_queue.
1311 AC_DEFUN([LC_REQUEST_QUEUE_LIMITS],
1312 [AC_MSG_CHECKING([if request_queue has a limits field])
1313 LB_LINUX_TRY_COMPILE([
1314         #include <linux/blkdev.h>
1315 ],[
1316         struct request_queue rq;
1317         rq.limits.io_min = 0;
1318 ],[
1319         AC_MSG_RESULT(yes)
1320         AC_DEFINE(HAVE_REQUEST_QUEUE_LIMITS, 1,
1321                   [request_queue has a limits field])
1322 ],[
1323         AC_MSG_RESULT(no)
1324 ])
1325 ])
1326
1327 # 2.6.32 has bdi_register() functions.
1328 AC_DEFUN([LC_EXPORT_BDI_REGISTER],
1329 [LB_CHECK_SYMBOL_EXPORT([bdi_register],
1330 [mm/backing-dev.c],[
1331         AC_DEFINE(HAVE_BDI_REGISTER, 1,
1332                 [bdi_register function is present])
1333 ],[
1334 ])
1335 ])
1336
1337 # 2.6.32 add s_bdi for super block
1338 AC_DEFUN([LC_SB_BDI],
1339 [AC_MSG_CHECKING([if super_block has s_bdi field])
1340 LB_LINUX_TRY_COMPILE([
1341         #include <linux/fs.h>
1342 ],[
1343         struct super_block sb;
1344         sb.s_bdi = NULL;
1345 ],[
1346         AC_MSG_RESULT(yes)
1347         AC_DEFINE(HAVE_SB_BDI, 1,
1348                   [super_block has s_bdi field])
1349 ],[
1350         AC_MSG_RESULT(no)
1351 ])
1352 ])
1353
1354 #  2.6.27.15-2 SuSE 11 sp0 kernels lack the name field for BDI
1355 AC_DEFUN([LC_BDI_NAME],
1356 [AC_MSG_CHECKING([if backing_device_info has name field])
1357 LB_LINUX_TRY_COMPILE([
1358         #include <linux/blkdev.h>
1359 ],[
1360         struct backing_dev_info bdi;
1361         bdi.name = NULL;
1362 ],[
1363         AC_MSG_RESULT(yes)
1364         AC_DEFINE(HAVE_BDI_NAME, 1,
1365                   [backing_device_info has name field])
1366 ],[
1367         AC_MSG_RESULT(no)
1368 ])
1369 ])  
1370
1371 # 2.6.32 removes blk_queue_max_sectors and add blk_queue_max_hw_sectors
1372 # check blk_queue_max_sectors and use it until disappear.
1373 AC_DEFUN([LC_BLK_QUEUE_MAX_SECTORS],
1374 [AC_MSG_CHECKING([if blk_queue_max_sectors is defined])
1375 LB_LINUX_TRY_COMPILE([
1376         #include <linux/blkdev.h>
1377 ],[
1378         blk_queue_max_sectors(NULL, 0);
1379 ],[
1380         AC_MSG_RESULT(yes)
1381         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SECTORS, 1,
1382                   [blk_queue_max_sectors is defined])
1383 ],[
1384         AC_MSG_RESULT(no)
1385 ])
1386 ])
1387
1388 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
1389 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
1390 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
1391 LB_LINUX_TRY_COMPILE([
1392         #include <linux/blkdev.h>
1393 ],[
1394         blk_queue_max_segments(NULL, 0);
1395 ],[
1396         AC_MSG_RESULT(yes)
1397         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
1398                   [blk_queue_max_segments is defined])
1399 ],[
1400         AC_MSG_RESULT(no)
1401 ])
1402 ])
1403
1404 #
1405 # LC_QUOTA64
1406 #
1407 # Check if kernel has been patched for 64-bit quota limits support.
1408 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
1409 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
1410 # that in the absence of quotaio_v1.h in the kernel headers.
1411 #
1412 AC_DEFUN([LC_QUOTA64],[
1413         AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
1414 tmp_flags="$EXTRA_KCFLAGS"
1415 EXTRA_KCFLAGS="-I$LINUX/fs"
1416         LB_LINUX_TRY_COMPILE([
1417                 #include <linux/kernel.h>
1418                 #include <linux/fs.h>
1419                 #ifdef HAVE_QUOTAIO_H
1420                 # include <linux/quotaio_v2.h>
1421                 int versions[] = V2_INITQVERSIONS_R1;
1422                 struct v2_disk_dqblk_r1 dqblk_r1;
1423                 #elif defined(HAVE_FS_QUOTA_QUOTAIO_H)
1424                 # include <quota/quotaio_v2.h>
1425                 struct v2r1_disk_dqblk dqblk_r1;
1426                 #elif defined(HAVE_FS_QUOTAIO_H)
1427                 # include <quotaio_v2.h>
1428                 struct v2r1_disk_dqblk dqblk_r1;
1429                 #else
1430                 #include <linux/quota.h>
1431                 int ver = QFMT_VFS_V1;
1432                 #endif
1433         ],[],[
1434                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
1435                 AC_MSG_RESULT([yes])
1436         ],[
1437                 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
1438                         AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
1439                 ],[])
1440                 AC_MSG_RESULT([no])
1441         ])
1442 EXTRA_KCFLAGS=$tmp_flags
1443 ])
1444
1445 # 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
1446 AC_DEFUN([LC_SET_CPUS_ALLOWED],
1447          [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
1448           LB_LINUX_TRY_COMPILE(
1449                 [#include <linux/sched.h>],
1450                 [struct task_struct *p = NULL;
1451                  cpumask_t mask = { { 0 } };
1452                  (void) set_cpus_allowed(p, mask);],
1453                 [AC_MSG_RESULT([yes])
1454                  AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
1455                            [set_cpus_allowed is exported by the kernel])],
1456                 [AC_MSG_RESULT([no])] )])
1457
1458 # 2.6.32 introduces selinux_is_enabled()
1459 AC_DEFUN([LC_SELINUX_IS_ENABLED],
1460 [AC_MSG_CHECKING([if selinux_is_enabled is available])
1461 LB_LINUX_TRY_COMPILE([
1462         #include <linux/selinux.h>
1463 ],[
1464         selinux_is_enabled();
1465 ],[
1466         AC_MSG_RESULT([yes])
1467         AC_DEFINE(HAVE_SELINUX_IS_ENABLED, 1,
1468                 [selinux_is_enabled is defined])
1469 ],[
1470         AC_MSG_RESULT([no])
1471 ])
1472 ])
1473
1474 #
1475 # LC_D_OBTAIN_ALIAS
1476 # starting from 2.6.28 kernel replaces d_alloc_anon() with
1477 # d_obtain_alias() for getting anonymous dentries
1478 # RHEL5(2.6.18) has d_obtain_alias but SLES11SP0(2.6.27) not
1479 #
1480 AC_DEFUN([LC_D_OBTAIN_ALIAS],
1481 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
1482 LB_LINUX_TRY_COMPILE([
1483         #include <linux/dcache.h>
1484 ],[
1485         d_obtain_alias(NULL);
1486 ],[
1487         AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
1488                 [d_obtain_alias exist in kernel])
1489         AC_MSG_RESULT([yes])
1490 ],[
1491         AC_MSG_RESULT([no])
1492 ])
1493 ])
1494
1495 #
1496 # LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
1497 #
1498 AC_DEFUN([LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE],
1499          [LB_CHECK_SYMBOL_EXPORT(
1500                         [generic_error_remove_page],
1501                         [mm/truncate.c],
1502                         [AC_DEFINE(HAS_GENERIC_ERROR_REMOVE_PAGE, 1,
1503                                 [kernel export generic_error_remove_page])],
1504                         [])
1505          ]
1506 )
1507
1508 # 2.6.32 if kernel export access_process_vm().
1509 AC_DEFUN([LC_EXPORT_ACCESS_PROCESS_VM],
1510         [LB_CHECK_SYMBOL_EXPORT([access_process_vm],
1511                         [mm/memory.c],
1512                         [AC_DEFINE(HAVE_ACCESS_PROCESS_VM, 1,
1513                                 [access_process_vm function is present])],
1514                         [])
1515         ]
1516 )
1517
1518 #
1519 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
1520 #
1521 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
1522 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
1523 LB_LINUX_TRY_COMPILE([
1524         #include <asm/atomic.h>
1525         #include <linux/spinlock.h>
1526         #include <linux/fs_struct.h>
1527 ],[
1528         ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
1529 ],[
1530         AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
1531                   [fs_struct.lock use rwlock])
1532         AC_MSG_RESULT([yes])
1533 ],[
1534         AC_MSG_RESULT([no])
1535 ])
1536 ])
1537
1538 #
1539 # 2.6.36 super_operations add evict_inode method. it hybird of
1540 # delete_inode & clear_inode.
1541 #
1542 AC_DEFUN([LC_SBOPS_EVICT_INODE],
1543 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
1544 LB_LINUX_TRY_COMPILE([
1545         #include <linux/fs.h>
1546 ],[
1547         ((struct super_operations *)0)->evict_inode(NULL);
1548 ],[
1549         AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
1550                 [super_operations.evict_inode() is exist in kernel])
1551         AC_MSG_RESULT([yes])
1552 ],[
1553         AC_MSG_RESULT([no])
1554 ])
1555 ])
1556
1557 #
1558 # 2.6.35 file_operations.fsync taken 2 arguments.
1559 # 3.0.0 file_operations.fsync takes 4 arguments.
1560 #
1561 AC_DEFUN([LC_FILE_FSYNC],
1562 [AC_MSG_CHECKING([if file_operations.fsync takes 4 or 2 arguments])
1563 LB_LINUX_TRY_COMPILE([
1564         #include <linux/fs.h>
1565 ],[
1566         ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
1567 ],[
1568         AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
1569                 [file_operations.fsync takes 4 arguments])
1570         AC_MSG_RESULT([yes, 4 args])
1571 ],[
1572         LB_LINUX_TRY_COMPILE([
1573                 #include <linux/fs.h>
1574         ],[
1575            ((struct file_operations *)0)->fsync(NULL, 0);
1576         ],[
1577                 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
1578                         [file_operations.fsync takes 2 arguments])
1579                 AC_MSG_RESULT([yes, 2 args])
1580         ],[
1581                 AC_MSG_RESULT([no])
1582         ])
1583 ])
1584 ])
1585
1586 #
1587 # 2.6.37 remove kernel_locked
1588 #
1589 AC_DEFUN([LC_KERNEL_LOCKED],
1590 [AC_MSG_CHECKING([if kernel_locked is defined])
1591 LB_LINUX_TRY_COMPILE([
1592         #include <linux/smp_lock.h>
1593 ],[
1594         kernel_locked();
1595 ],[
1596         AC_MSG_RESULT([yes])
1597         AC_DEFINE(HAVE_KERNEL_LOCKED, 1,
1598                 [kernel_locked is defined])
1599 ],[
1600         AC_MSG_RESULT([no])
1601 ])
1602 ])
1603
1604 #
1605 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
1606 #
1607 AC_DEFUN([LC_D_COMPARE_7ARGS],
1608 [AC_MSG_CHECKING([if d_compare taken 7 arguments])
1609 LB_LINUX_TRY_COMPILE([
1610         #include <linux/dcache.h>
1611 ],[
1612         ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
1613 ],[
1614         AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1,
1615                 [d_compare need 7 arguments])
1616         AC_MSG_RESULT([yes])
1617 ],[
1618         AC_MSG_RESULT([no])
1619 ])
1620 ])
1621
1622 #
1623 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
1624 #
1625 AC_DEFUN([LC_D_DELETE_CONST],
1626 [AC_MSG_CHECKING([if d_delete has const declare on first parameter])
1627 tmp_flags="$EXTRA_KCFLAGS"
1628 EXTRA_KCFLAGS="-Werror"
1629 LB_LINUX_TRY_COMPILE([
1630         #include <linux/dcache.h>
1631 ],[
1632         const struct dentry *d = NULL;
1633         ((struct dentry_operations*)0)->d_delete(d);
1634 ],[
1635         AC_DEFINE(HAVE_D_DELETE_CONST, const,
1636                 [d_delete first parameter declared const])
1637         AC_MSG_RESULT([yes])
1638 ],[
1639         AC_DEFINE(HAVE_D_DELETE_CONST, , [])
1640         AC_MSG_RESULT([no])
1641 ])
1642 EXTRA_KCFLAGS="$tmp_flags"
1643 ])
1644
1645 #
1646 # 2.6.38 dcache_lock removed. rcu-walk commited.
1647 #
1648 AC_DEFUN([LC_DCACHE_LOCK],
1649 [AC_MSG_CHECKING([if dcache_lock is exist])
1650 LB_LINUX_TRY_COMPILE([
1651         #include <linux/dcache.h>
1652 ],[
1653         spin_lock(&dcache_lock);
1654 ],[
1655         AC_DEFINE(HAVE_DCACHE_LOCK, 1,
1656                 [dcache_lock is exist])
1657         AC_MSG_RESULT([yes])
1658 ],[
1659         AC_MSG_RESULT([no])
1660 ])
1661 ])
1662
1663 #
1664 # 2.6.38 export blkdev_get_by_dev
1665 #
1666 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
1667 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
1668 [fs/block_dev.c],[
1669 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
1670             [blkdev_get_by_dev is exported by the kernel])
1671 ],[
1672 ])
1673 ])
1674
1675 #
1676 # 2.6.38 vfsmount.mnt_count doesn't use atomic_t
1677 #
1678 # 3.3 starts hiding vfsmount guts series (move from include/linux/mount.h to
1679 # fs/mount.h, see kernel commit 7d6fec45a5131918b51dcd76da52f2ec86a85be6)
1680 #
1681 AC_DEFUN([LC_ATOMIC_MNT_COUNT],
1682 [AC_MSG_CHECKING([if vfsmount guts is hidden, or vfsmount.mnt_count is atomic_t.])
1683 LB_LINUX_TRY_COMPILE([
1684         #include <linux/fs.h>
1685         #include <../fs/mount.h>
1686 ],[
1687         struct mount *mnt =  real_mount((struct vfsmount *)0);
1688 ],[
1689         AC_DEFINE(HAVE_HIDE_VFSMOUNT_GUTS, 1,
1690                   [hide vfsmount guts in fs/mount.h])
1691         AC_MSG_RESULT([yes, hide vfsmount guts in fs/mount.h])
1692 ],[
1693         LB_LINUX_TRY_COMPILE([
1694                 #include <asm/atomic.h>
1695                 #include <linux/fs.h>
1696                 #include <linux/mount.h>
1697         ],[
1698                 ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
1699         ],[
1700                 AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
1701                         [vfsmount.mnt_count is atomic_t])
1702                 AC_MSG_RESULT([yes, vfsmount.mnt_count is atomic_t])
1703         ],[
1704                 AC_MSG_RESULT([no])
1705         ])
1706 ])
1707 ])
1708
1709 #
1710 # 2.6.38 use path as 4th parameter in quota_on.
1711 #
1712 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
1713 [AC_MSG_CHECKING([quota_on use path as parameter])
1714 tmp_flags="$EXTRA_KCFLAGS"
1715 EXTRA_KCFLAGS="-Werror"
1716 LB_LINUX_TRY_COMPILE([
1717         #include <linux/fs.h>
1718         #include <linux/quota.h>
1719 ],[
1720         ((struct quotactl_ops *)0)->quota_on(NULL, 0, 0, ((struct path*)0));
1721 ],[
1722         AC_DEFINE(HAVE_QUOTA_ON_USE_PATH, 1,
1723                 [quota_on use path as 4th paramter])
1724         AC_MSG_RESULT([yes])
1725 ],[
1726         AC_MSG_RESULT([no])
1727 ])
1728 EXTRA_KCFLAGS="$tmp_flags"
1729 ])
1730
1731 #
1732 # 2.6.39 remove unplug_fn from request_queue.
1733 #
1734 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
1735 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
1736 LB_LINUX_TRY_COMPILE([
1737         #include <linux/blkdev.h>
1738 ],[
1739         do{ }while(sizeof(((struct request_queue *)0)->unplug_fn));
1740 ],[
1741         AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
1742                   [request_queue has unplug_fn field])
1743         AC_MSG_RESULT([yes])
1744 ],[
1745         AC_MSG_RESULT([no])
1746 ])
1747 ])
1748
1749 #
1750 # 2.6.39 replace get_sb with mount in struct file_system_type
1751 #
1752 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT],
1753 [AC_MSG_CHECKING([if file_system_type has mount field])
1754 LB_LINUX_TRY_COMPILE([
1755         #include <linux/fs.h>
1756 ],[
1757         struct file_system_type fst;
1758         void *i = (void *) fst.mount;
1759 ],[
1760         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
1761                 [struct file_system_type has mount field])
1762         AC_MSG_RESULT([yes])
1763 ],[
1764         AC_MSG_RESULT([no])
1765 ])
1766 ])
1767
1768 #
1769 # 2.6.38 generic_permission taken 4 parameters.
1770 # in fact, it means rcu-walk aware permission bring.
1771 #
1772 # 3.1 generic_permission taken 2 parameters.
1773 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
1774 #
1775 AC_DEFUN([LC_GENERIC_PERMISSION],
1776 [AC_MSG_CHECKING([if generic_permission take 2 or 4 arguments])
1777 LB_LINUX_TRY_COMPILE([
1778         #include <linux/fs.h>
1779 ],[
1780         generic_permission(NULL, 0);
1781 ],[
1782         AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
1783                   [generic_permission taken 2 arguments])
1784         AC_MSG_RESULT([yes, 2 args])
1785 ],[
1786         LB_LINUX_TRY_COMPILE([
1787                 #include <linux/fs.h>
1788         ],[
1789                 generic_permission(NULL, 0, 0, NULL);
1790         ],[
1791                 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
1792                           [generic_permission taken 4 arguments])
1793                 AC_MSG_RESULT([yes, 4 args])
1794         ],[
1795                 AC_MSG_RESULT([no])
1796         ])
1797 ])
1798 ])
1799
1800 #
1801 # 2.6.38 export simple_setattr
1802 #
1803 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
1804 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
1805 [fs/libfs.c],[
1806 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
1807             [simple_setattr is exported by the kernel])
1808 ],[
1809 ])
1810 ])
1811
1812 #
1813 # 3.3 introduces migrate_mode.h and migratepage has 4 args
1814 #
1815 AC_DEFUN([LC_HAVE_MIGRATE_HEADER],
1816 [LB_CHECK_FILE([$LINUX/include/linux/migrate.h],[
1817                 AC_DEFINE(HAVE_MIGRATE_H, 1,
1818                 [kernel has include/linux/migrate.h])
1819 ],[LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h],[
1820                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
1821                         [kernel has include/linux/migrate_mode.h])
1822 ],[
1823         AC_MSG_RESULT([no])
1824 ])
1825 ])
1826 ])
1827
1828 AC_DEFUN([LC_MIGRATEPAGE_4ARGS],
1829 [AC_MSG_CHECKING([if address_space_operations.migratepage has 4 args])
1830 LB_LINUX_TRY_COMPILE([
1831         #include <linux/fs.h>
1832 #ifdef HAVE_MIGRATE_H
1833         #include <linux/migrate.h>
1834 #elif defined(HAVE_MIGRATE_MODE_H)
1835         #include <linux/migrate_mode.h>
1836 #endif
1837 ],[
1838         struct address_space_operations aops;
1839
1840         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
1841 ],[
1842         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
1843                 [address_space_operations.migratepage has 4 args])
1844         AC_MSG_RESULT([yes])
1845 ],[
1846         AC_MSG_RESULT([no])
1847 ])
1848 ])
1849
1850 #
1851 # 3.1.1 has ext4_blocks_for_truncate
1852 #
1853 AC_DEFUN([LC_BLOCKS_FOR_TRUNCATE],
1854 [AC_MSG_CHECKING([if kernel has ext4_blocks_for_truncate])
1855 LB_LINUX_TRY_COMPILE([
1856         #include <linux/fs.h>
1857         #include "$LINUX/fs/ext4/ext4_jbd2.h"
1858         #include "$LINUX/fs/ext4/truncate.h"
1859 ],[
1860         ext4_blocks_for_truncate(NULL);
1861 ],[
1862         AC_MSG_RESULT([yes])
1863         AC_DEFINE(HAVE_BLOCKS_FOR_TRUNCATE, 1,
1864                   [kernel has ext4_blocks_for_truncate])
1865 ],[
1866         AC_MSG_RESULT([no])
1867 ])
1868 ])
1869
1870 #
1871 # LC_PROG_LINUX
1872 #
1873 # Lustre linux kernel checks
1874 #
1875 AC_DEFUN([LC_PROG_LINUX],
1876          [
1877          LC_CONFIG_PINGER
1878          LC_CONFIG_CHECKSUM
1879          LC_CONFIG_LIBLUSTRE_RECOVERY
1880          LC_CONFIG_HEALTH_CHECK_WRITE
1881          LC_CONFIG_LRU_RESIZE
1882          LC_LLITE_LLOOP_MODULE
1883
1884          # RHEL4 patches
1885          LC_EXPORT_TRUNCATE_COMPLETE
1886          LC_EXPORT_D_REHASH_COND
1887          LC_EXPORT___D_REHASH
1888          LC_EXPORT_NODE_TO_CPUMASK
1889
1890          LC_FILEMAP_POPULATE
1891          LC_BIT_SPINLOCK_H
1892
1893          LC_CONST_ACL_SIZE
1894
1895          LC_CAPA_CRYPTO
1896          LC_CONFIG_RMTCLIENT
1897          LC_CONFIG_GSS
1898          LC_TASK_CLENV_STORE
1899
1900          # 2.6.12
1901          LC_RW_TREE_LOCK
1902
1903          # 2.6.18
1904          LC_UMOUNTBEGIN_HAS_VFSMOUNT
1905
1906          #2.6.18 + RHEL5 (fc6)
1907          LC_LINUX_FIEMAP_H
1908
1909          # 2.6.19
1910          LC_FILE_WRITEV
1911          LC_FILE_READV
1912
1913          # 2.6.20
1914          LC_CANCEL_DIRTY_PAGE
1915
1916          # raid5-zerocopy patch
1917          LC_PAGE_CONSTANT
1918
1919          # 2.6.22
1920          LC_INVALIDATE_BDEV_2ARG
1921          LC_ASYNC_BLOCK_CIPHER
1922          LC_STRUCT_HASH_DESC
1923          LC_STRUCT_BLKCIPHER_DESC
1924          LC_FS_RENAME_DOES_D_MOVE
1925
1926          # 2.6.23
1927          LC_UNREGISTER_BLKDEV_RETURN_INT
1928          LC_KERNEL_SPLICE_READ
1929          LC_KERNEL_SENDFILE
1930          LC_HAVE_EXPORTFS_H
1931          LC_VM_OP_FAULT
1932          LC_PROCFS_USERS
1933          LC_EXPORTFS_DECODE_FH
1934
1935          # 2.6.24
1936          LC_HAVE_MMTYPES_H
1937          LC_BIO_ENDIO_2ARG
1938          LC_FH_TO_DENTRY
1939          LC_PROCFS_DELETED
1940          LC_EXPORT_BDI_INIT
1941
1942          # 2.6.26
1943          LC_FS_STRUCT_USE_PATH
1944
1945          # 2.6.27
1946          LC_SECURITY_PLUG  # for SLES10 SP2
1947          LC_PGMKWRITE_USE_VMFAULT
1948          LC_PGMKWRITE_COMPACT
1949          LC_INODE_PERMISION_2ARGS
1950          LC_FILE_REMOVE_SUID
1951          LC_TRYLOCKPAGE
1952          LC_READ_INODE_IN_SBOPS
1953          LC_EXPORT_INODE_PERMISSION
1954          LC_QUOTA_ON_5ARGS
1955          LC_QUOTA_OFF_3ARGS
1956          LC_VFS_DQ_OFF
1957          LC_LOCK_MAP_ACQUIRE
1958
1959          # 2.6.27.15-2 sles11
1960          LC_BI_HW_SEGMENTS
1961          LC_HAVE_QUOTAIO_H
1962          LC_BDI_NAME
1963          LC_SB_ANY_QUOTA_ACTIVE
1964          LC_SB_HAS_QUOTA_ACTIVE
1965          LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
1966
1967          # 2.6.29
1968          LC_SB_ANY_QUOTA_LOADED
1969
1970          # 2.6.30
1971          LC_EXPORT_CPUMASK_OF_NODE
1972
1973          # 2.6.31
1974          LC_BLK_QUEUE_LOG_BLK_SIZE
1975
1976          # 2.6.32
1977          LC_REQUEST_QUEUE_LIMITS
1978          LC_EXPORT_BDI_REGISTER
1979          LC_SB_BDI
1980          LC_BLK_QUEUE_MAX_SECTORS
1981          LC_BLK_QUEUE_MAX_SEGMENTS
1982          LC_SET_CPUS_ALLOWED
1983          LC_CACHE_UPCALL
1984          LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE
1985          LC_SELINUX_IS_ENABLED
1986          LC_EXPORT_ACCESS_PROCESS_VM
1987          LC_VFS_INODE_NEWSIZE_OK
1988
1989          # 2.6.35, 3.0.0
1990          LC_FILE_FSYNC
1991          LC_EXPORT_SIMPLE_SETATTR
1992
1993          # 2.6.36
1994          LC_FS_STRUCT_RWLOCK
1995          LC_SBOPS_EVICT_INODE
1996
1997          # 2.6.37
1998          LC_KERNEL_LOCKED
1999
2000          # 2.6.38
2001          LC_ATOMIC_MNT_COUNT
2002          LC_BLKDEV_GET_BY_DEV
2003          LC_GENERIC_PERMISSION
2004          LC_QUOTA_ON_USE_PATH
2005          LC_DCACHE_LOCK
2006          LC_D_COMPARE_7ARGS
2007          LC_D_DELETE_CONST
2008
2009          # 2.6.39
2010          LC_REQUEST_QUEUE_UNPLUG_FN
2011         LC_HAVE_FSTYPE_MOUNT
2012
2013         # 3.3
2014         LC_HAVE_MIGRATE_HEADER
2015         LC_MIGRATEPAGE_4ARGS
2016
2017          # 3.1.1
2018          LC_BLOCKS_FOR_TRUNCATE
2019
2020          #
2021          if test x$enable_server = xyes ; then
2022              AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
2023              LC_FUNC_DEV_SET_RDONLY
2024              LC_STACK_SIZE
2025              LC_QUOTA64
2026              LC_QUOTA_CONFIG
2027          fi
2028 ])
2029
2030 #
2031 # LC_CONFIG_CLIENT_SERVER
2032 #
2033 # Build client/server sides of Lustre
2034 #
2035 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
2036 [AC_MSG_CHECKING([whether to build Lustre server support])
2037 AC_ARG_ENABLE([server],
2038         AC_HELP_STRING([--disable-server],
2039                         [disable Lustre server support]),
2040         [],[enable_server='yes'])
2041 AC_MSG_RESULT([$enable_server])
2042
2043 AC_MSG_CHECKING([whether to build Lustre client support])
2044 AC_ARG_ENABLE([client],
2045         AC_HELP_STRING([--disable-client],
2046                         [disable Lustre client support]),
2047         [],[enable_client='yes'])
2048 AC_MSG_RESULT([$enable_client])])
2049
2050 #
2051 # LC_CONFIG_LIBLUSTRE
2052 #
2053 # whether to build liblustre
2054 #
2055 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
2056 [AC_MSG_CHECKING([whether to build Lustre library])
2057 AC_ARG_ENABLE([liblustre],
2058         AC_HELP_STRING([--disable-liblustre],
2059                         [disable building of Lustre library]),
2060         [],[enable_liblustre=$with_sysio])
2061 AC_MSG_RESULT([$enable_liblustre])
2062 # only build sysio if liblustre is built
2063 with_sysio="$enable_liblustre"
2064
2065 AC_MSG_CHECKING([whether to build liblustre tests])
2066 AC_ARG_ENABLE([liblustre-tests],
2067         AC_HELP_STRING([--enable-liblustre-tests],
2068                         [enable liblustre tests, if --disable-tests is used]),
2069         [],[enable_liblustre_tests=$enable_tests])
2070 if test x$enable_liblustre != xyes ; then
2071    enable_liblustre_tests='no'
2072 fi
2073 AC_MSG_RESULT([$enable_liblustre_tests])
2074
2075 AC_MSG_CHECKING([whether to enable liblustre acl])
2076 AC_ARG_ENABLE([liblustre-acl],
2077         AC_HELP_STRING([--disable-liblustre-acl],
2078                         [disable ACL support for liblustre]),
2079         [],[enable_liblustre_acl=yes])
2080 AC_MSG_RESULT([$enable_liblustre_acl])
2081 if test x$enable_liblustre_acl = xyes ; then
2082   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2083 fi
2084
2085 # 2.6.29 change prepare/commit_write to write_begin/end
2086 AC_DEFUN([LC_WRITE_BEGIN_END],
2087 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2088 LB_LINUX_TRY_COMPILE([
2089         #include <linux/fs.h>
2090         #include <linux/pagemap.h>
2091 #ifdef HAVE_LINUX_MMTYPES_H
2092         #include <linux/mm_types.h>
2093 #endif
2094 ],[
2095         struct address_space_operations aops;
2096         struct page *page;
2097
2098         aops.write_begin = NULL;
2099         aops.write_end = NULL;
2100         page = grab_cache_page_write_begin(NULL, 0, 0);
2101 ], [
2102         AC_MSG_RESULT([yes])
2103         AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2104                 [kernel has .write_begin/end])
2105 ],[
2106         AC_MSG_RESULT([no])
2107 ])
2108 ])
2109
2110 # 2.6.29 blkdev_put has 2 arguments
2111 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2112 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2113 LB_LINUX_TRY_COMPILE([
2114         #include <linux/fs.h>
2115 ],[
2116         blkdev_put(NULL, 0);
2117 ],[
2118         AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2119                 [blkdev_put needs 2 paramters])
2120         AC_MSG_RESULT([yes])
2121 ],[
2122         AC_MSG_RESULT([no])
2123 ])
2124 ])
2125
2126 # 2.6.29 dentry_open has 4 arguments
2127 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2128 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2129 LB_LINUX_TRY_COMPILE([
2130         #include <linux/fs.h>
2131 ],[
2132         dentry_open(NULL, NULL, 0, NULL);
2133 ],[
2134         AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2135                 [dentry_open needs 4 paramters])
2136         AC_MSG_RESULT([yes])
2137 ],[
2138         AC_MSG_RESULT([no])
2139 ])
2140 ])
2141
2142 # 2.6.29 split file and anonymous page queues
2143 AC_DEFUN([LC_PAGEVEC_LRU_ADD_FILE],
2144 [AC_MSG_CHECKING([if kernel has .pagevec_lru_add_file])
2145 LB_LINUX_TRY_COMPILE([
2146         #include <linux/mm.h>
2147         #include <linux/pagevec.h>
2148 ],[
2149         struct pagevec lru_pagevec;
2150
2151         pagevec_init(&lru_pagevec, 0);
2152         pagevec_lru_add_file(&lru_pagevec);
2153 ],[
2154         AC_MSG_RESULT([yes])
2155         AC_DEFINE(HAVE_PAGEVEC_LRU_ADD_FILE, 1,
2156                 [kernel has .pagevec_lru_add_file])
2157 ],[
2158         AC_MSG_RESULT([no])
2159 ])
2160 ])
2161
2162 #
2163 # --enable-mpitest
2164 #
2165 AC_ARG_ENABLE(mpitests,
2166         AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2167                            [include mpi tests]),
2168         [
2169          enable_mpitests=yes
2170          case $enableval in
2171          yes)
2172                 MPICC_WRAPPER=mpicc
2173                 ;;
2174          no)
2175                 enable_mpitests=no
2176                 ;;
2177          *)
2178                 MPICC_WRAPPER=$enableval
2179                  ;;
2180          esac
2181         ],
2182         [
2183         MPICC_WRAPPER=mpicc
2184         enable_mpitests=yes
2185         ]
2186 )
2187
2188 if test x$enable_mpitests != xno; then
2189         AC_MSG_CHECKING([whether mpitests can be built])
2190         oldcc=$CC
2191         CC=$MPICC_WRAPPER
2192         AC_LINK_IFELSE(
2193             [AC_LANG_PROGRAM([[
2194                     #include <mpi.h>
2195                 ]],[[
2196                     int flag;
2197                     MPI_Initialized(&flag);
2198                 ]])],
2199             [
2200                     AC_MSG_RESULT([yes])
2201             ],[
2202                     AC_MSG_RESULT([no])
2203                     enable_mpitests=no
2204         ])
2205         CC=$oldcc
2206 fi
2207 AC_SUBST(MPICC_WRAPPER)
2208
2209 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2210 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2211
2212 LC_CONFIG_PINGER
2213 LC_CONFIG_LIBLUSTRE_RECOVERY
2214 ])
2215
2216 #
2217 # LC_CONFIG_QUOTA
2218 #
2219 # whether to enable quota support global control
2220 #
2221 AC_DEFUN([LC_CONFIG_QUOTA],
2222 [AC_ARG_ENABLE([quota],
2223         AC_HELP_STRING([--enable-quota],
2224                         [enable quota support]),
2225         [],[enable_quota='yes'])
2226 ])
2227
2228 AC_DEFUN([LC_QUOTA],
2229 [#check global
2230 LC_CONFIG_QUOTA
2231 #check for utils
2232 AC_CHECK_HEADER(sys/quota.h,
2233                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2234                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2235 ])
2236
2237 #
2238 # LC_CONFIG_SPLIT
2239 #
2240 # whether to enable split support
2241 #
2242 AC_DEFUN([LC_CONFIG_SPLIT],
2243 [AC_MSG_CHECKING([whether to enable split support])
2244 AC_ARG_ENABLE([split],
2245         AC_HELP_STRING([--enable-split],
2246                         [enable split support]),
2247         [],[enable_split='no'])
2248 AC_MSG_RESULT([$enable_split])
2249 if test x$enable_split != xno; then
2250    AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2251 fi
2252 ])
2253
2254 # RHEL5(2.6.18) has tux_info
2255 AC_DEFUN([LC_TASK_CLENV_TUX_INFO],
2256 [AC_MSG_CHECKING([tux_info])
2257 LB_LINUX_TRY_COMPILE([
2258         #include <linux/sched.h>
2259 ],[
2260         struct task_struct task;
2261         &task.tux_info;
2262 ],[
2263         AC_MSG_RESULT([yes])
2264         AC_DEFINE(LL_TASK_CL_ENV, tux_info, [have tux_info])
2265         have_task_clenv_store='yes'
2266 ],[
2267         AC_MSG_RESULT([no])
2268 ])
2269 ])
2270
2271 #
2272 # LC_LLITE_LLOOP_MODULE
2273 # lloop_llite.ko does not currently work with page sizes
2274 # of 64k or larger.
2275 #
2276 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
2277 [AC_MSG_CHECKING([whether to enable llite_lloop module])
2278 LB_LINUX_TRY_COMPILE([
2279         #include <asm/page.h>
2280 ],[
2281         #if PAGE_SIZE >= 65536
2282         #error "PAGE_SIZE >= 65536"
2283         #endif
2284 ],[
2285         enable_llite_lloop_module='yes'
2286         AC_MSG_RESULT([yes])
2287 ],[
2288         enable_llite_lloop_module='no'
2289         AC_MSG_RESULT([no])
2290 ])
2291 ])
2292
2293 #
2294 # LC_CONFIGURE
2295 #
2296 # other configure checks
2297 #
2298 AC_DEFUN([LC_CONFIGURE],
2299 [LC_CONFIG_OBD_BUFFER_SIZE
2300
2301 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2302         CFLAGS="$CFLAGS -Werror"
2303 fi
2304
2305 # maximum MDS thread count
2306 LC_MDS_MAX_THREADS
2307
2308 # include/liblustre.h
2309 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2310
2311 # liblustre/llite_lib.h
2312 AC_CHECK_HEADERS([xtio.h file.h])
2313
2314 # liblustre/dir.c
2315 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2316
2317 # liblustre/lutil.c
2318 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2319 AC_CHECK_FUNCS([inet_ntoa])
2320
2321 # libsysio/src/readlink.c
2322 LC_READLINK_SSIZE_T
2323
2324 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2325 AC_CHECK_HEADERS([linux/random.h], [], [],
2326                  [#ifdef HAVE_LINUX_TYPES_H
2327                   # include <linux/types.h>
2328                   #endif
2329                  ])
2330
2331 # utils/llverfs.c
2332 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2333
2334 # check for -lz support
2335 ZLIB=""
2336 AC_CHECK_LIB([z],
2337              [adler32],
2338              [AC_CHECK_HEADERS([zlib.h],
2339                                [ZLIB="-lz"
2340                                 AC_DEFINE([HAVE_ADLER], 1,
2341                                           [support alder32 checksum type])],
2342                                [AC_MSG_WARN([No zlib-devel package found,
2343                                              unable to use adler32 checksum])])],
2344              [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2345 )
2346 AC_SUBST(ZLIB)
2347
2348 # Super safe df
2349 AC_ARG_ENABLE([mindf],
2350       AC_HELP_STRING([--enable-mindf],
2351                       [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2352       [],[])
2353 if test "$enable_mindf" = "yes" ;  then
2354       AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2355 fi
2356
2357 AC_ARG_ENABLE([fail_alloc],
2358         AC_HELP_STRING([--disable-fail-alloc],
2359                 [disable randomly alloc failure]),
2360         [],[enable_fail_alloc=yes])
2361 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2362 AC_MSG_RESULT([$enable_fail_alloc])
2363 if test x$enable_fail_alloc != xno ; then
2364         AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2365 fi
2366
2367 AC_ARG_ENABLE([invariants],
2368         AC_HELP_STRING([--enable-invariants],
2369                 [enable invariant checking (cpu intensive)]),
2370         [],[])
2371 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2372 AC_MSG_RESULT([$enable_invariants])
2373 if test x$enable_invariants = xyes ; then
2374         AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2375 fi
2376
2377 AC_ARG_ENABLE([lu_ref],
2378         AC_HELP_STRING([--enable-lu_ref],
2379                 [enable lu_ref reference tracking code]),
2380         [],[])
2381 AC_MSG_CHECKING([whether to track references with lu_ref])
2382 AC_MSG_RESULT([$enable_lu_ref])
2383 if test x$enable_lu_ref = xyes ; then
2384         AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2385 fi
2386
2387 AC_ARG_ENABLE([pgstate-track],
2388               AC_HELP_STRING([--enable-pgstate-track],
2389                              [enable page state tracking]),
2390               [enable_pgstat_track='yes'],[])
2391 AC_MSG_CHECKING([whether to enable page state tracking])
2392 AC_MSG_RESULT([$enable_pgstat_track])
2393 if test x$enable_pgstat_track = xyes ; then
2394         AC_DEFINE([LUSTRE_PAGESTATE_TRACKING], 1,
2395                   [enable page state tracking code])
2396 fi
2397
2398          #2.6.29
2399          LC_WRITE_BEGIN_END
2400          LC_D_OBTAIN_ALIAS
2401          LC_BLKDEV_PUT_2ARGS
2402          LC_DENTRY_OPEN_4ARGS
2403          LC_PAGEVEC_LRU_ADD_FILE
2404
2405 ])
2406
2407 #
2408 # LC_CONDITIONALS
2409 #
2410 # AM_CONDITIONALS for lustre
2411 #
2412 AC_DEFUN([LC_CONDITIONALS],
2413 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2414 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2415 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2416 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2417 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2418 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2419 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2420 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2421 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2422 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2423 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2424 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2425 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2426 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2427 ])
2428
2429 #
2430 # LC_CONFIG_FILES
2431 #
2432 # files that should be generated with AC_OUTPUT
2433 #
2434 AC_DEFUN([LC_CONFIG_FILES],
2435 [AC_CONFIG_FILES([
2436 lustre/Makefile
2437 lustre/autoMakefile
2438 lustre/autoconf/Makefile
2439 lustre/conf/Makefile
2440 lustre/contrib/Makefile
2441 lustre/doc/Makefile
2442 lustre/include/Makefile
2443 lustre/include/lustre_ver.h
2444 lustre/include/linux/Makefile
2445 lustre/include/darwin/Makefile
2446 lustre/include/lustre/Makefile
2447 lustre/kernel_patches/targets/2.6-rhel6.target
2448 lustre/kernel_patches/targets/2.6-rhel5.target
2449 lustre/kernel_patches/targets/2.6-sles10.target
2450 lustre/kernel_patches/targets/2.6-sles11.target
2451 lustre/kernel_patches/targets/2.6-oel5.target
2452 lustre/kernel_patches/targets/2.6-fc11.target
2453 lustre/kernel_patches/targets/2.6-fc12.target
2454 lustre/ldlm/Makefile
2455 lustre/fid/Makefile
2456 lustre/fid/autoMakefile
2457 lustre/liblustre/Makefile
2458 lustre/liblustre/tests/Makefile
2459 lustre/liblustre/tests/mpi/Makefile
2460 lustre/llite/Makefile
2461 lustre/llite/autoMakefile
2462 lustre/lclient/Makefile
2463 lustre/lov/Makefile
2464 lustre/lov/autoMakefile
2465 lustre/lvfs/Makefile
2466 lustre/lvfs/autoMakefile
2467 lustre/mdc/Makefile
2468 lustre/mdc/autoMakefile
2469 lustre/lmv/Makefile
2470 lustre/lmv/autoMakefile
2471 lustre/mds/Makefile
2472 lustre/mds/autoMakefile
2473 lustre/mdt/Makefile
2474 lustre/mdt/autoMakefile
2475 lustre/cmm/Makefile
2476 lustre/cmm/autoMakefile
2477 lustre/mdd/Makefile
2478 lustre/mdd/autoMakefile
2479 lustre/fld/Makefile
2480 lustre/fld/autoMakefile
2481 lustre/obdclass/Makefile
2482 lustre/obdclass/autoMakefile
2483 lustre/obdclass/linux/Makefile
2484 lustre/obdecho/Makefile
2485 lustre/obdecho/autoMakefile
2486 lustre/obdfilter/Makefile
2487 lustre/obdfilter/autoMakefile
2488 lustre/ofd/Makefile
2489 lustre/ofd/autoMakefile
2490 lustre/osc/Makefile
2491 lustre/osc/autoMakefile
2492 lustre/ost/Makefile
2493 lustre/ost/autoMakefile
2494 lustre/osd-ldiskfs/Makefile
2495 lustre/osd-ldiskfs/autoMakefile
2496 lustre/osd-zfs/Makefile
2497 lustre/osd-zfs/autoMakefile
2498 lustre/mgc/Makefile
2499 lustre/mgc/autoMakefile
2500 lustre/mgs/Makefile
2501 lustre/mgs/autoMakefile
2502 lustre/ptlrpc/Makefile
2503 lustre/ptlrpc/autoMakefile
2504 lustre/ptlrpc/gss/Makefile
2505 lustre/ptlrpc/gss/autoMakefile
2506 lustre/quota/Makefile
2507 lustre/quota/autoMakefile
2508 lustre/scripts/Makefile
2509 lustre/scripts/lustre
2510 lustre/tests/Makefile
2511 lustre/tests/mpi/Makefile
2512 lustre/utils/Makefile
2513 lustre/utils/gss/Makefile
2514 lustre/obdclass/darwin/Makefile
2515 ])
2516 ])