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