Whamcloud - gitweb
63861c45bcdd36ed8e68830663291162fca43b63
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
1 #* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 #* vim:expandtab:shiftwidth=8:tabstop=8:
3 #
4 # LC_CONFIG_SRCDIR
5 #
6 # Wrapper for AC_CONFIG_SUBDIR
7 #
8 AC_DEFUN([LC_CONFIG_SRCDIR],
9 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
10 libcfs_is_module=yes
11 ldiskfs_is_ext4=yes
12 ])
13
14 #
15 # LC_PATH_DEFAULTS
16 #
17 # lustre specific paths
18 #
19 AC_DEFUN([LC_PATH_DEFAULTS],
20 [# ptlrpc kernel build requires this
21 LUSTRE="$PWD/lustre"
22 AC_SUBST(LUSTRE)
23
24 # mount.lustre
25 rootsbindir='/sbin'
26 AC_SUBST(rootsbindir)
27
28 demodir='$(docdir)/demo'
29 AC_SUBST(demodir)
30
31 pkgexampledir='${pkgdatadir}/examples'
32 AC_SUBST(pkgexampledir)
33 ])
34
35 #
36 # LC_TARGET_SUPPORTED
37 #
38 # is the target os supported?
39 #
40 AC_DEFUN([LC_TARGET_SUPPORTED],
41 [case $target_os in
42         linux* | darwin*)
43 $1
44                 ;;
45         *)
46 $2
47                 ;;
48 esac
49 ])
50
51 #
52 # Ensure stack size big than 8k in Lustre server (all kernels)
53 #
54 AC_DEFUN([LC_STACK_SIZE],
55 [AC_MSG_CHECKING([stack size big than 8k])
56 LB_LINUX_TRY_COMPILE([
57         #include <linux/thread_info.h>
58 ],[
59         #if THREAD_SIZE < 8192
60         #error "stack size < 8192"
61         #endif
62 ],[
63         AC_MSG_RESULT(yes)
64 ],[
65         AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
66 ])
67 ])
68
69 #
70 # LC_FUNC_DEV_SET_RDONLY
71 #
72 # check for the old-style dev_set_rdonly which took an extra "devno" param
73 # and can only set a single device to discard writes at one time
74 #
75 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
76 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
77 LB_LINUX_TRY_COMPILE([
78         #include <linux/fs.h>
79         #include <linux/blkdev.h>
80 ],[
81         #ifndef HAVE_CLEAR_RDONLY_ON_PUT
82         #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
83         #endif
84 ],[
85         AC_MSG_RESULT([yes])
86         AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
87 ],[
88         AC_MSG_ERROR([no, Linux kernel source needs to be patches by lustre
89 kernel patches from Lustre version 1.4.3 or above.])
90 ])
91 ])
92
93 #
94 # LC_CONFIG_BACKINGFS
95 #
96 # setup, check the backing filesystem
97 #
98 AC_DEFUN([LC_CONFIG_BACKINGFS],
99 [
100 BACKINGFS="ldiskfs"
101
102 if test x$with_ldiskfs = xno ; then
103         if test x$linux25$enable_server = xyesyes ; then
104                 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
105         fi
106 else
107         # ldiskfs is enabled
108         LB_DEFINE_LDISKFS_OPTIONS
109 fi #ldiskfs
110
111 AC_MSG_CHECKING([which backing filesystem to use])
112 AC_MSG_RESULT([$BACKINGFS])
113 AC_SUBST(BACKINGFS)
114 ])
115
116 #
117 # LC_CONFIG_PINGER
118 #
119 # the pinger is temporary, until we have the recovery node in place
120 #
121 AC_DEFUN([LC_CONFIG_PINGER],
122 [AC_MSG_CHECKING([whether to enable pinger support])
123 AC_ARG_ENABLE([pinger],
124         AC_HELP_STRING([--disable-pinger],
125                         [disable recovery pinger support]),
126         [],[enable_pinger='yes'])
127 AC_MSG_RESULT([$enable_pinger])
128 if test x$enable_pinger != xno ; then
129   AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
130 fi
131 ])
132
133 #
134 # LC_CONFIG_CHECKSUM
135 #
136 # do checksum of bulk data between client and OST
137 #
138 AC_DEFUN([LC_CONFIG_CHECKSUM],
139 [AC_MSG_CHECKING([whether to enable data checksum support])
140 AC_ARG_ENABLE([checksum],
141        AC_HELP_STRING([--disable-checksum],
142                        [disable data checksum support]),
143        [],[enable_checksum='yes'])
144 AC_MSG_RESULT([$enable_checksum])
145 if test x$enable_checksum != xno ; then
146   AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
147 fi
148 ])
149
150 #
151 # LC_HEADER_LDISKFS_XATTR
152 #
153 # CHAOS kernel-devel package will not include fs/ldiskfs/xattr.h
154 #
155 AC_DEFUN([LC_HEADER_LDISKFS_XATTR],
156 [AC_MSG_CHECKING([if ldiskfs has xattr.h header])
157 tmp_flags="$EXTRA_KCFLAGS"
158 EXTRA_KCFLAGS="-I$LINUX/fs -I$LDISKFS_DIR -I$LDISKFS_DIR/ldiskfs"
159 LB_LINUX_TRY_COMPILE([
160         #include <ldiskfs/xattr.h>
161 ],[
162         ldiskfs_xattr_get(NULL, 0, "", NULL, 0);
163         ldiskfs_xattr_set_handle(NULL, NULL, 0, "", NULL, 0, 0);
164
165 ],[
166         AC_MSG_RESULT([yes])
167         AC_DEFINE(HAVE_LDISKFS_XATTR_H, 1, [ldiskfs/xattr.h found])
168 ],[
169         AC_MSG_RESULT([no])
170 ])
171 EXTRA_KCFLAGS="$tmp_flags"
172 ])
173
174 #
175 # LC_CONFIG_HEALTH_CHECK_WRITE
176 #
177 # Turn off the actual write to the disk
178 #
179 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
180 [AC_MSG_CHECKING([whether to enable a write with the health check])
181 AC_ARG_ENABLE([health_write],
182         AC_HELP_STRING([--enable-health_write],
183                         [enable disk writes when doing health check]),
184         [],[enable_health_write='no'])
185 AC_MSG_RESULT([$enable_health_write])
186 if test x$enable_health_write != xno ; then
187   AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
188 fi
189 ])
190
191 #
192 # LC_CONFIG_LIBLUSTRE_RECOVERY
193 #
194 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
195 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
196 AC_ARG_ENABLE([liblustre-recovery],
197         AC_HELP_STRING([--disable-liblustre-recovery],
198                         [disable liblustre recovery support]),
199         [],[enable_liblustre_recovery='yes'])
200 AC_MSG_RESULT([$enable_liblustre_recovery])
201 if test x$enable_liblustre_recovery != xno ; then
202   AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
203 fi
204 ])
205
206 #
207 # LC_CONFIG_OBD_BUFFER_SIZE
208 #
209 # the maximum buffer size of lctl ioctls
210 #
211 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
212 [AC_MSG_CHECKING([maximum OBD ioctl size])
213 AC_ARG_WITH([obd-buffer-size],
214         AC_HELP_STRING([--with-obd-buffer-size=[size]],
215                         [set lctl ioctl maximum bytes (default=8192)]),
216         [
217                 OBD_BUFFER_SIZE=$with_obd_buffer_size
218         ],[
219                 OBD_BUFFER_SIZE=8192
220         ])
221 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
222 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
223 ])
224
225 #
226 # LC_STRUCT_STATFS
227 #
228 # AIX does not have statfs.f_namelen
229 #
230 AC_DEFUN([LC_STRUCT_STATFS],
231 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
232 LB_LINUX_TRY_COMPILE([
233         #include <linux/vfs.h>
234 ],[
235         struct statfs sfs;
236         sfs.f_namelen = 1;
237 ],[
238         AC_MSG_RESULT([yes])
239         AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
240 ],[
241         AC_MSG_RESULT([no])
242 ])
243 ])
244
245 #
246 # LC_READLINK_SSIZE_T
247 #
248 AC_DEFUN([LC_READLINK_SSIZE_T],
249 [AC_MSG_CHECKING([if readlink returns ssize_t])
250 AC_TRY_COMPILE([
251         #include <unistd.h>
252 ],[
253         ssize_t readlink(const char *, char *, size_t);
254 ],[
255         AC_MSG_RESULT([yes])
256         AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
257 ],[
258         AC_MSG_RESULT([no])
259 ])
260 ])
261
262 #
263 # LC_FUNC_MS_FLOCK_LOCK
264 #
265 # 2.6.5 kernel has MS_FLOCK_LOCK sb flag
266 #
267 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
268 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
269 LB_LINUX_TRY_COMPILE([
270         #include <linux/fs.h>
271 ],[
272         int flags = MS_FLOCK_LOCK;
273 ],[
274         AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
275                 [kernel has MS_FLOCK_LOCK flag])
276         AC_MSG_RESULT([yes])
277 ],[
278         AC_MSG_RESULT([no])
279 ])
280 ])
281
282 #
283 # LC_FUNC_HAVE_CAN_SLEEP_ARG
284 #
285 # 2.6.5 kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()
286 #
287 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
288 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
289 LB_LINUX_TRY_COMPILE([
290         #include <linux/fs.h>
291 ],[
292         int cansleep;
293         struct file *file;
294         struct file_lock *file_lock;
295         flock_lock_file_wait(file, file_lock, cansleep);
296 ],[
297         AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
298                 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
299         AC_MSG_RESULT([yes])
300 ],[
301         AC_MSG_RESULT([no])
302 ])
303 ])
304
305 #
306 # LC_FUNC_RELEASEPAGE_WITH_GFP
307 #
308 # 2.6.9 ->releasepage() takes a gfp_t arg
309 # This kernel defines gfp_t (HAS_GFP_T) but doesn't use it for this function,
310 # while others either don't have gfp_t or pass gfp_t as the parameter.
311 #
312 AC_DEFUN([LC_FUNC_RELEASEPAGE_WITH_GFP],
313 [AC_MSG_CHECKING([if releasepage has a gfp_t parameter])
314 RELEASEPAGE_WITH_GFP="$(grep -c 'releasepage.*gfp_t' $LINUX/include/linux/fs.h)"
315 if test "$RELEASEPAGE_WITH_GFP" != 0 ; then
316         AC_DEFINE(HAVE_RELEASEPAGE_WITH_GFP, 1,
317                   [releasepage with gfp_t parameter])
318         AC_MSG_RESULT([yes])
319 else
320         AC_MSG_RESULT([no])
321 fi
322 ])
323
324 #
325 # between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
326 #
327 AC_DEFUN([LC_FILEMAP_POPULATE],
328 [AC_MSG_CHECKING([for exported filemap_populate])
329 LB_LINUX_TRY_COMPILE([
330         #include <asm/page.h>
331         #include <linux/mm.h>
332 ],[
333        filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
334 ],[
335         AC_MSG_RESULT([yes])
336         AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
337 ],[
338         AC_MSG_RESULT([no])
339 ])
340 ])
341
342 #
343 # added in 2.6.15
344 #
345 AC_DEFUN([LC_D_ADD_UNIQUE],
346 [AC_MSG_CHECKING([for d_add_unique])
347 LB_LINUX_TRY_COMPILE([
348         #include <linux/dcache.h>
349 ],[
350        d_add_unique(NULL, NULL);
351 ],[
352         AC_MSG_RESULT([yes])
353         AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
354 ],[
355         AC_MSG_RESULT([no])
356 ])
357 ])
358
359 #
360 # added in 2.6.17
361 #
362 AC_DEFUN([LC_BIT_SPINLOCK_H],
363 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
364         AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
365         LB_LINUX_TRY_COMPILE([
366                 #include <asm/processor.h>
367                 #include <linux/spinlock.h>
368                 #include <linux/bit_spinlock.h>
369         ],[],[
370                 AC_MSG_RESULT([yes])
371                 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
372         ],[
373                 AC_MSG_RESULT([no])
374         ])
375 ],
376 [])
377 ])
378
379 #
380 # After 2.6.26 we no longer have xattr_acl.h
381 #
382 AC_DEFUN([LC_XATTR_ACL],
383 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
384         AC_MSG_CHECKING([if xattr_acl.h can be compiled])
385         LB_LINUX_TRY_COMPILE([
386                 #include <linux/xattr_acl.h>
387         ],[],[
388                 AC_MSG_RESULT([yes])
389                 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
390         ],[
391                 AC_MSG_RESULT([no])
392         ])
393 ],
394 [])
395 ])
396
397
398 # added in 2.6.16
399 #
400 AC_DEFUN([LC_STRUCT_INTENT_FILE],
401 [AC_MSG_CHECKING([if struct open_intent has a file field])
402 LB_LINUX_TRY_COMPILE([
403         #include <linux/fs.h>
404         #include <linux/namei.h>
405 ],[
406         struct open_intent intent;
407         &intent.file;
408 ],[
409         AC_MSG_RESULT([yes])
410         AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
411 ],[
412         AC_MSG_RESULT([no])
413 ])
414 ])
415
416
417 #
418 # After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
419 #
420 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
421 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
422         AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
423         LB_LINUX_TRY_COMPILE([
424                 #include <linux/posix_acl_xattr.h>
425         ],[],[
426                 AC_MSG_RESULT([yes])
427                 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
428
429         ],[
430                 AC_MSG_RESULT([no])
431         ])
432 $1
433 ],[
434 AC_MSG_RESULT([no])
435 ])
436 ])
437
438 #
439 # LC_EXPORT___IGET
440 # starting from 2.6.19 linux kernel exports __iget()
441 #
442 AC_DEFUN([LC_EXPORT___IGET],
443 [LB_CHECK_SYMBOL_EXPORT([__iget],
444 [fs/inode.c],[
445         AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
446 ],[
447 ])
448 ])
449
450 #
451 # only for Lustre-patched kernels
452 #
453 AC_DEFUN([LC_LUSTRE_VERSION_H],
454 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
455         rm -f "$LUSTRE/include/linux/lustre_version.h"
456 ],[
457         touch "$LUSTRE/include/linux/lustre_version.h"
458         if test x$enable_server = xyes ; then
459                 AC_MSG_WARN([Unpatched kernel detected.])
460                 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
461                 AC_MSG_WARN([disabling server build])
462                 enable_server='no'
463         fi
464 ])
465 ])
466
467 #
468 # LC_CAPA_CRYPTO
469 #
470 AC_DEFUN([LC_CAPA_CRYPTO],
471 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
472         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
473 ])
474 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
475         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
476 ])
477 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
478         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
479 ])
480 ])
481
482 #
483 # LC_CONFIG_RMTCLIENT
484 #
485 dnl FIXME
486 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
487 dnl FIXME
488 AC_DEFUN([LC_CONFIG_RMTCLIENT],
489 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
490         AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
491 ])
492 ])
493
494 AC_DEFUN([LC_SUNRPC_CACHE],
495 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
496 LB_LINUX_TRY_COMPILE([
497         #include <linux/sunrpc/cache.h>
498 ],[
499         struct cache_head ch;
500         &ch.ref.refcount;
501 ],[
502         AC_MSG_RESULT([yes])
503         AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
504 ],[
505         AC_MSG_RESULT([no])
506 ])
507 ])
508
509 AC_DEFUN([LC_CONFIG_SUNRPC],
510 [LB_LINUX_CONFIG_IM([SUNRPC],[],
511                     [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
512  LC_SUNRPC_CACHE
513 ])
514
515 #
516 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
517 #
518 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
519 [AC_MSG_CHECKING([whether to enable gss keyring backend])
520  AC_ARG_ENABLE([gss_keyring],
521                [AC_HELP_STRING([--disable-gss-keyring],
522                                [disable gss keyring backend])],
523                [],[enable_gss_keyring='yes'])
524  AC_MSG_RESULT([$enable_gss_keyring])
525
526  if test x$enable_gss_keyring != xno; then
527         LB_LINUX_CONFIG_IM([KEYS],[],
528                            [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
529
530         AC_CHECK_LIB([keyutils], [keyctl_search], [],
531                      [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
532
533         AC_DEFINE([HAVE_GSS_KEYRING], [1],
534                   [Define this if you enable gss keyring backend])
535  fi
536 ])
537
538 #
539 # LC_CONFIG_GSS (default disabled)
540 #
541 # Build gss and related tools of Lustre. Currently both kernel and user space
542 # parts are depend on linux platform.
543 #
544 AC_DEFUN([LC_CONFIG_GSS],
545 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
546  AC_ARG_ENABLE([gss],
547                [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
548                [],[enable_gss='no'])
549  AC_MSG_RESULT([$enable_gss])
550
551  if test x$enable_gss == xyes; then
552         LC_CONFIG_GSS_KEYRING
553         LC_CONFIG_SUNRPC
554
555         AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
556
557         LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
558                            [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
559         LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
560                            [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
561         LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
562                            [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
563         LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
564                            [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
565
566         AC_CHECK_LIB([gssapi], [gss_init_sec_context],
567                      [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
568                      [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
569                                    [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
570                                    [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
571
572         AC_SUBST(GSSAPI_LIBS)
573
574         AC_KERBEROS_V5
575  fi
576 ])
577
578 # LC_EXPORT_SYNCHRONIZE_RCU
579 # after 2.6.12 synchronize_rcu is preferred over synchronize_kernel
580 AC_DEFUN([LC_EXPORT_SYNCHRONIZE_RCU],
581 [LB_CHECK_SYMBOL_EXPORT([synchronize_rcu],
582 [kernel/rcupdate.c],[
583         AC_DEFINE(HAVE_SYNCHRONIZE_RCU, 1,
584                 [in 2.6.12 synchronize_rcu preferred over synchronize_kernel])
585 ],[
586 ])
587 ])
588
589 # LC_INODE_I_MUTEX
590 # after 2.6.15 inode have i_mutex intead of i_sem
591 AC_DEFUN([LC_INODE_I_MUTEX],
592 [AC_MSG_CHECKING([if inode has i_mutex ])
593 LB_LINUX_TRY_COMPILE([
594         #include <linux/mutex.h>
595         #include <linux/fs.h>
596         #undef i_mutex
597 ],[
598         struct inode i;
599
600         mutex_unlock(&i.i_mutex);
601 ],[
602         AC_MSG_RESULT(yes)
603         AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
604                 [after 2.6.15 inode have i_mutex intead of i_sem])
605 ],[
606         AC_MSG_RESULT(no)
607 ])
608 ])
609
610 # LC_SEQ_LOCK
611 # after 2.6.18 seq_file has lock intead of sem
612 AC_DEFUN([LC_SEQ_LOCK],
613 [AC_MSG_CHECKING([if struct seq_file has lock field])
614 LB_LINUX_TRY_COMPILE([
615         #include <linux/seq_file.h>
616 ],[
617         struct seq_file seq;
618
619         mutex_unlock(&seq.lock);
620 ],[
621         AC_MSG_RESULT(yes)
622         AC_DEFINE(HAVE_SEQ_LOCK, 1,
623                 [after 2.6.18 seq_file has lock intead of sem])
624 ],[
625         AC_MSG_RESULT(NO)
626 ])
627 ])
628
629 # LC_DQUOTOFF_MUTEX
630 # after 2.6.17 dquote use mutex instead if semaphore
631 AC_DEFUN([LC_DQUOTOFF_MUTEX],
632 [AC_MSG_CHECKING([use dqonoff_mutex])
633 LB_LINUX_TRY_COMPILE([
634         #include <linux/mutex.h>
635         #include <linux/fs.h>
636         #include <linux/quota.h>
637 ],[
638         struct quota_info dq;
639
640         mutex_unlock(&dq.dqonoff_mutex);
641 ],[
642         AC_MSG_RESULT(yes)
643         AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
644                 [after 2.6.17 dquote use mutex instead if semaphore])
645 ],[
646         AC_MSG_RESULT(no)
647 ])
648 ])
649
650 #
651 # LC_STATFS_DENTRY_PARAM
652 # starting from 2.6.18 linux kernel uses dentry instead of
653 # super_block for first vfs_statfs argument
654 #
655 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
656 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
657 LB_LINUX_TRY_COMPILE([
658         #include <linux/fs.h>
659 ],[
660         int vfs_statfs(struct dentry *, struct kstatfs *);
661 ],[
662         AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
663                 [first parameter of vfs_statfs is dentry])
664         AC_MSG_RESULT([yes])
665 ],[
666         AC_MSG_RESULT([no])
667 ])
668 ])
669
670 #
671 # LC_VFS_KERN_MOUNT
672 # starting from 2.6.18 kernel don't export do_kern_mount
673 # and want to use vfs_kern_mount instead.
674 #
675 AC_DEFUN([LC_VFS_KERN_MOUNT],
676 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
677 LB_LINUX_TRY_COMPILE([
678         #include <linux/mount.h>
679 ],[
680         vfs_kern_mount(NULL, 0, NULL, NULL);
681 ],[
682         AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
683                 [vfs_kern_mount exist in kernel])
684         AC_MSG_RESULT([yes])
685 ],[
686         AC_MSG_RESULT([no])
687 ])
688 ])
689
690 #
691 # LC_D_OBTAIN_ALIAS
692 # starting from 2.6.18 kernel don't export do_kern_mount
693 # and want to use vfs_kern_mount instead.
694 #
695 AC_DEFUN([LC_D_OBTAIN_ALIAS],
696 [AC_MSG_CHECKING([d_obtain_alias exist in kernel])
697 LB_LINUX_TRY_COMPILE([
698         #include <linux/dcache.h>
699 ],[
700         d_obtain_alias(NULL);
701 ],[
702         AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
703                 [d_obtain_alias exist in kernel])
704         AC_MSG_RESULT([yes])
705 ],[
706         AC_MSG_RESULT([no])
707 ])
708 ])
709
710 #
711 # LC_INVALIDATEPAGE_RETURN_INT
712 # 2.6.17 changes return type for invalidatepage to 'void' from 'int'
713 #
714 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
715 [AC_MSG_CHECKING([invalidatepage has return int])
716 LB_LINUX_TRY_COMPILE([
717         #include <linux/buffer_head.h>
718 ],[
719         int rc = block_invalidatepage(NULL, 0);
720 ],[
721         AC_MSG_RESULT(yes)
722         AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
723                 [Define if return type of invalidatepage should be int])
724 ],[
725         AC_MSG_RESULT(no)
726 ])
727 ])
728
729 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
730 # after 2.6.18 umount_begin has different parameters
731 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
732 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
733 tmp_flags="$EXTRA_KCFLAGS"
734 EXTRA_KCFLAGS="-Werror"
735 LB_LINUX_TRY_COMPILE([
736         #include <linux/fs.h>
737
738         struct vfsmount;
739         static void cfg_umount_begin (struct vfsmount *v, int flags)
740         {
741                 ;
742         }
743
744         static struct super_operations cfg_super_operations = {
745                 .umount_begin   = cfg_umount_begin,
746         };
747 ],[
748         cfg_super_operations.umount_begin(NULL,0);
749 ],[
750         AC_MSG_RESULT(yes)
751         AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
752                 [Define umount_begin need second argument])
753 ],[
754         AC_MSG_RESULT(no)
755 ])
756 EXTRA_KCFLAGS="$tmp_flags"
757 ])
758
759 # inode have i_private field since 2.6.17
760 AC_DEFUN([LC_INODE_IPRIVATE],
761 [AC_MSG_CHECKING([if inode has a i_private field])
762 LB_LINUX_TRY_COMPILE([
763 #include <linux/fs.h>
764 ],[
765         struct inode i;
766         i.i_private = NULL; 
767 ],[
768         AC_MSG_RESULT(yes)
769         AC_DEFINE(HAVE_INODE_IPRIVATE, 1,
770                 [struct inode has i_private field])
771 ],[
772         AC_MSG_RESULT(no)
773 ])
774 ])
775
776 # 2.6.19 API changes
777 # inode don't have i_blksize field
778 AC_DEFUN([LC_INODE_BLKSIZE],
779 [AC_MSG_CHECKING([inode has i_blksize field])
780 LB_LINUX_TRY_COMPILE([
781 #include <linux/fs.h>
782 ],[
783         struct inode i;
784         i.i_blksize = 0;
785 ],[
786         AC_MSG_RESULT(yes)
787         AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
788                 [struct inode has i_blksize field])
789 ],[
790         AC_MSG_RESULT(no)
791 ])
792 ])
793
794 # LC_VFS_READDIR_U64_INO
795 # 2.6.19 use u64 for inode number instead of inode_t
796 AC_DEFUN([LC_VFS_READDIR_U64_INO],
797 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
798 tmp_flags="$EXTRA_KCFLAGS"
799 EXTRA_KCFLAGS="-Werror"
800 LB_LINUX_TRY_COMPILE([
801 #include <linux/fs.h>
802         int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
803                       u64 ino, unsigned int d_type)
804         {
805                 return 0;
806         }
807 ],[
808         filldir_t filter;
809
810         filter = fillonedir;
811         return 1;
812 ],[
813         AC_MSG_RESULT(yes)
814         AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
815                 [if vfs_readdir need 64bit inode number])
816 ],[
817         AC_MSG_RESULT(no)
818 ])
819 EXTRA_KCFLAGS="$tmp_flags"
820 ])
821
822 # LC_FILE_WRITEV
823 # 2.6.19 replaced writev with aio_write
824 AC_DEFUN([LC_FILE_WRITEV],
825 [AC_MSG_CHECKING([writev in fops])
826 LB_LINUX_TRY_COMPILE([
827         #include <linux/fs.h>
828 ],[
829         struct file_operations *fops = NULL;
830         fops->writev = NULL;
831 ],[
832         AC_MSG_RESULT(yes)
833         AC_DEFINE(HAVE_FILE_WRITEV, 1,
834                 [use fops->writev])
835 ],[
836         AC_MSG_RESULT(no)
837 ])
838 ])
839
840 # LC_GENERIC_FILE_READ
841 # 2.6.19 replaced readv with aio_read
842 AC_DEFUN([LC_FILE_READV],
843 [AC_MSG_CHECKING([readv in fops])
844 LB_LINUX_TRY_COMPILE([
845         #include <linux/fs.h>
846 ],[
847         struct file_operations *fops = NULL;
848         fops->readv = NULL;
849 ],[
850         AC_MSG_RESULT(yes)
851         AC_DEFINE(HAVE_FILE_READV, 1,
852                 [use fops->readv])
853 ],[
854         AC_MSG_RESULT(no)
855 ])
856 ])
857
858 # LC_NR_PAGECACHE
859 # 2.6.18 don't export nr_pagecahe
860 AC_DEFUN([LC_NR_PAGECACHE],
861 [AC_MSG_CHECKING([kernel export nr_pagecache])
862 LB_LINUX_TRY_COMPILE([
863         #include <linux/pagemap.h>
864 ],[
865         return atomic_read(&nr_pagecache);
866 ],[
867         AC_MSG_RESULT(yes)
868         AC_DEFINE(HAVE_NR_PAGECACHE, 1,
869                 [is kernel export nr_pagecache])
870 ],[
871         AC_MSG_RESULT(no)
872 ])
873 ])
874
875 # LC_CANCEL_DIRTY_PAGE
876 # 2.6.20 introduse cancel_dirty_page instead of
877 # clear_page_dirty.
878 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
879 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
880 LB_LINUX_TRY_COMPILE([
881         #include <linux/mm.h>
882         #include <linux/page-flags.h>
883 ],[
884         /* tmp workaround for broken OFED 1.4.1 at SLES10 */
885         #if defined(CONFIG_SLE_VERSION) && CONFIG_SLE_VERSION == 10 && defined(_BACKPORT_LINUX_MM_H_)
886         #error badly implementation of cancel_dirty_pages
887         #endif
888         cancel_dirty_page(NULL, 0);
889 ],[
890         AC_MSG_RESULT(yes)
891         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
892                   [kernel has cancel_dirty_page instead of clear_page_dirty])
893 ],[
894         AC_MSG_RESULT(no)
895 ])
896 ])
897
898 #
899 # LC_PAGE_CONSTANT
900 #
901 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
902 # it support constant page, which means the page won't be modified during the
903 # IO.
904 #
905 AC_DEFUN([LC_PAGE_CONSTANT],
906 [AC_MSG_CHECKING([if kernel have PageConstant defined])
907 LB_LINUX_TRY_COMPILE([
908         #include <linux/mm.h>
909         #include <linux/page-flags.h>
910 ],[
911         #ifndef PG_constant
912         #error "Have no raid5 zcopy patch"
913         #endif
914 ],[
915         AC_MSG_RESULT(yes)
916         AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
917 ],[
918         AC_MSG_RESULT(no);
919 ])
920 ])
921
922 # RHEL5 in FS-cache patch rename PG_checked flag into PG_fs_misc
923 AC_DEFUN([LC_PG_FS_MISC],
924 [AC_MSG_CHECKING([kernel has PG_fs_misc])
925 LB_LINUX_TRY_COMPILE([
926         #include <linux/mm.h>
927         #include <linux/page-flags.h>
928 ],[
929         #ifndef PG_fs_misc
930         #error PG_fs_misc not defined in kernel
931         #endif
932 ],[
933         AC_MSG_RESULT(yes)
934         AC_DEFINE(HAVE_PG_FS_MISC, 1,
935                   [is kernel have PG_fs_misc])
936 ],[
937         AC_MSG_RESULT(no)
938 ])
939 ])
940
941 # RHEL5 PageChecked and SetPageChecked defined
942 AC_DEFUN([LC_PAGE_CHECKED],
943 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
944 LB_LINUX_TRY_COMPILE([
945         #include <linux/autoconf.h>
946 #ifdef HAVE_LINUX_MMTYPES_H
947         #include <linux/mm_types.h>
948 #endif
949         #include <linux/page-flags.h>
950 ],[
951         struct page *p;
952
953         /* before 2.6.26 this define*/
954         #ifndef PageChecked     
955         /* 2.6.26 use function instead of define for it */
956         SetPageChecked(p);
957         PageChecked(p);
958         #endif
959 ],[
960         AC_MSG_RESULT(yes)
961         AC_DEFINE(HAVE_PAGE_CHECKED, 1,
962                   [does kernel have PageChecked and SetPageChecked])
963 ],[
964         AC_MSG_RESULT(no)
965 ])
966 ])
967
968 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
969 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
970 [mm/truncate.c],[
971 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
972             [kernel export truncate_complete_page])
973 ],[
974 ])
975 ])
976
977 AC_DEFUN([LC_EXPORT_TRUNCATE_RANGE],
978 [LB_CHECK_SYMBOL_EXPORT([truncate_inode_pages_range],
979 [mm/truncate.c],[
980 AC_DEFINE(HAVE_TRUNCATE_RANGE, 1,
981             [kernel export truncate_inode_pages_range])
982 ],[
983 ])
984 ])
985
986 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
987 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
988 [fs/dcache.c],[
989 AC_DEFINE(HAVE_D_REHASH_COND, 1,
990             [d_rehash_cond is exported by the kernel])
991 ],[
992 ])
993 ])
994
995 AC_DEFUN([LC_EXPORT___D_REHASH],
996 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
997 [fs/dcache.c],[
998 AC_DEFINE(HAVE___D_REHASH, 1,
999             [__d_rehash is exported by the kernel])
1000 ],[
1001 ])
1002 ])
1003
1004 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1005 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1006 [fs/dcache.c],[
1007 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1008             [d_move_locked is exported by the kernel])
1009 ],[
1010 ])
1011 ])
1012
1013 AC_DEFUN([LC_EXPORT___D_MOVE],
1014 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1015 [fs/dcache.c],[
1016 AC_DEFINE(HAVE___D_MOVE, 1,
1017             [__d_move is exported by the kernel])
1018 ],[
1019 ])
1020 ])
1021
1022 #
1023 # LC_EXPORT_INVALIDATE_MAPPING_PAGES
1024 #
1025 # SLES9, RHEL4, RHEL5, vanilla 2.6.24 export invalidate_mapping_pages() but
1026 # SLES10 2.6.16 does not, for some reason.  For filter cache invalidation.
1027 #
1028 AC_DEFUN([LC_EXPORT_INVALIDATE_MAPPING_PAGES],
1029     [LB_CHECK_SYMBOL_EXPORT([invalidate_mapping_pages], [mm/truncate.c], [
1030          AC_DEFINE(HAVE_INVALIDATE_MAPPING_PAGES, 1,
1031                         [exported invalidate_mapping_pages])],
1032     [LB_CHECK_SYMBOL_EXPORT([invalidate_inode_pages], [mm/truncate.c], [
1033          AC_DEFINE(HAVE_INVALIDATE_INODE_PAGES, 1,
1034                         [exported invalidate_inode_pages])], [
1035        AC_MSG_ERROR([no way to invalidate pages])
1036   ])
1037     ],[])
1038 ])
1039
1040 #
1041 # LC_EXPORT_FILEMAP_FDATASYNC_RANGE
1042 #
1043 # No standard kernels export this
1044 #
1045 AC_DEFUN([LC_EXPORT_FILEMAP_FDATAWRITE_RANGE],
1046 [LB_CHECK_SYMBOL_EXPORT([filemap_fdatawrite_range],
1047 [mm/filemap.c],[
1048 AC_DEFINE(HAVE_FILEMAP_FDATAWRITE_RANGE, 1,
1049             [filemap_fdatawrite_range is exported by the kernel])
1050 ],[
1051 ])
1052 ])
1053
1054 # The actual symbol exported varies among architectures, so we need
1055 # to check many symbols (but only in the current architecture.)  No
1056 # matter what symbol is exported, the kernel #defines node_to_cpumask
1057 # to the appropriate function and that's what we use.
1058 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1059          [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1060                                  [arch/$LINUX_ARCH/mm/numa.c],
1061                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1062                                             [node_to_cpumask is exported by
1063                                              the kernel])]) # x86_64
1064           LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1065                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
1066                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1067                                             [node_to_cpumask is exported by
1068                                              the kernel])]) # ia64
1069           LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1070                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
1071                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1072                                             [node_to_cpumask is exported by
1073                                              the kernel])]) # i386
1074           ])
1075
1076 # 2.6.22 lost second parameter for invalidate_bdev
1077 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1078 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1079 LB_LINUX_TRY_COMPILE([
1080         #include <linux/buffer_head.h>
1081 ],[
1082         invalidate_bdev(NULL,0);
1083 ],[
1084         AC_MSG_RESULT([yes])
1085         AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1086                 [invalidate_bdev has second argument])
1087 ],[
1088         AC_MSG_RESULT([no])
1089 ])
1090 ])
1091
1092 # 2.6.18
1093
1094
1095 # 2.6.23 have return type 'void' for unregister_blkdev
1096 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1097 [AC_MSG_CHECKING([if unregister_blkdev return int])
1098 LB_LINUX_TRY_COMPILE([
1099         #include <linux/fs.h>
1100 ],[
1101         int i = unregister_blkdev(0,NULL);
1102 ],[
1103         AC_MSG_RESULT([yes])
1104         AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
1105                 [unregister_blkdev return int])
1106 ],[
1107         AC_MSG_RESULT([no])
1108 ])
1109 ])
1110
1111 # 2.6.23 change .sendfile to .splice_read
1112 # RHEL4 (-92 kernel) have both sendfile and .splice_read API
1113 AC_DEFUN([LC_KERNEL_SENDFILE],
1114 [AC_MSG_CHECKING([if kernel has .sendfile])
1115 LB_LINUX_TRY_COMPILE([
1116         #include <linux/fs.h>
1117 ],[
1118         struct file_operations file;
1119
1120         file.sendfile = NULL;
1121 ], [
1122         AC_MSG_RESULT([yes])
1123         AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
1124                 [kernel has .sendfile])
1125 ],[
1126         AC_MSG_RESULT([no])
1127 ])
1128 ])
1129
1130 # 2.6.23 change .sendfile to .splice_read
1131 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1132 [AC_MSG_CHECKING([if kernel has .splice_read])
1133 LB_LINUX_TRY_COMPILE([
1134         #include <linux/fs.h>
1135 ],[
1136         struct file_operations file;
1137
1138         file.splice_read = NULL;
1139 ], [
1140         AC_MSG_RESULT([yes])
1141         AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1142                 [kernel has .slice_read])
1143 ],[
1144         AC_MSG_RESULT([no])
1145 ])
1146 ])
1147
1148 # 2.6.23 extract nfs export related data into exportfs.h
1149 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1150 [LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
1151         AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
1152                 [kernel has include/exportfs.h])
1153 ],[
1154         AC_MSG_RESULT([no])
1155 ])
1156 ])
1157
1158 # 2.6.23 has new page fault handling API
1159 AC_DEFUN([LC_VM_OP_FAULT],
1160 [AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
1161 LB_LINUX_TRY_COMPILE([
1162         #include <linux/mm.h>
1163 ],[
1164         struct vm_operations_struct op;
1165
1166         op.fault = NULL;
1167 ], [
1168         AC_MSG_RESULT([yes])
1169         AC_DEFINE(HAVE_VM_OP_FAULT, 1,
1170                 [kernel has .fault in vm_operation_struct])
1171 ],[
1172         AC_MSG_RESULT([no])
1173 ])
1174 ])
1175
1176 #2.6.23 has new shrinker API
1177 AC_DEFUN([LC_REGISTER_SHRINKER],
1178 [AC_MSG_CHECKING([if kernel has register_shrinker])
1179 LB_LINUX_TRY_COMPILE([
1180         #include <linux/mm.h>
1181 ],[
1182         register_shrinker(NULL);
1183 ], [
1184         AC_MSG_RESULT([yes])
1185         AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
1186                 [kernel has register_shrinker])
1187 ],[
1188         AC_MSG_RESULT([no])
1189 ])
1190 ])
1191
1192 # 2.6.24 has bio_endio with 2 args
1193 AC_DEFUN([LC_BIO_ENDIO_2ARG],
1194 [AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
1195 LB_LINUX_TRY_COMPILE([
1196         #include <linux/bio.h>
1197 ],[
1198         bio_endio(NULL, 0);
1199 ], [
1200         AC_MSG_RESULT([yes])
1201         AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
1202                 [kernel has bio_endio with 2 args])
1203 ],[
1204         AC_MSG_RESULT([no])
1205 ])
1206 ])
1207
1208 # 2.6.24 has new members in exports struct.
1209 AC_DEFUN([LC_FH_TO_DENTRY],
1210 [AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
1211 LB_LINUX_TRY_COMPILE([
1212 #ifdef HAVE_LINUX_EXPORTFS_H
1213         #include <linux/exportfs.h>
1214 #else
1215         #include <linux/fs.h>
1216 #endif
1217 ],[
1218         struct export_operations exp;
1219
1220         exp.fh_to_dentry   = NULL;
1221 ], [
1222         AC_MSG_RESULT([yes])
1223         AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
1224                 [kernel has .fh_to_dentry member in export_operations struct])
1225 ],[
1226         AC_MSG_RESULT([no])
1227 ])
1228 ])
1229
1230 # 2.6.24 need linux/mm_types.h included
1231 AC_DEFUN([LC_HAVE_MMTYPES_H],
1232 [LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
1233         AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
1234                 [kernel has include/mm_types.h])
1235 ],[
1236         AC_MSG_RESULT([no])
1237 ])
1238 ])
1239
1240 # 2.6.24 removes long aged procfs entry -> deleted member
1241 AC_DEFUN([LC_PROCFS_DELETED],
1242 [AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
1243 LB_LINUX_TRY_COMPILE([
1244         #include <linux/proc_fs.h>
1245 ],[
1246         struct proc_dir_entry pde;
1247
1248         pde.deleted   = NULL;
1249 ], [
1250         AC_MSG_RESULT([yes])
1251         AC_DEFINE(HAVE_PROCFS_DELETED, 1,
1252                 [kernel has deleted member in procfs entry struct])
1253 ],[
1254         AC_MSG_RESULT([no])
1255 ])
1256 ])
1257
1258 # 2.6.25 change define to inline
1259 AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
1260 [AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
1261 LB_LINUX_TRY_COMPILE([
1262         #include <linux/backing-dev.h>
1263 ],[
1264         #ifndef mapping_cap_writeback_dirty
1265         mapping_cap_writeback_dirty(NULL);
1266         #endif
1267 ],[
1268         AC_MSG_RESULT([yes])
1269         AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
1270                 [kernel have mapping_cap_writeback_dirty])
1271 ],[
1272         AC_MSG_RESULT([no])
1273 ])
1274 ])
1275
1276
1277
1278 # 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
1279 AC_DEFUN([LC_FS_STRUCT_USE_PATH],
1280 [AC_MSG_CHECKING([fs_struct use path structure])
1281 LB_LINUX_TRY_COMPILE([
1282         #include <asm/atomic.h>
1283         #include <linux/spinlock.h>
1284         #include <linux/fs_struct.h>
1285 ],[
1286         struct path path;
1287         struct fs_struct fs;
1288
1289         fs.pwd = path;
1290 ], [
1291         AC_MSG_RESULT([yes])
1292         AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
1293                 [fs_struct use path structure])
1294 ],[
1295         AC_MSG_RESULT([no])
1296 ])
1297 ])
1298
1299 #
1300 # LC_VFS_INTENT_PATCHES
1301 #
1302 # check if the kernel has the VFS intent patches
1303 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1304 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1305 LB_LINUX_TRY_COMPILE([
1306         #include <linux/fs.h>
1307         #include <linux/namei.h>
1308 ],[
1309         struct nameidata nd;
1310         struct lookup_intent *it;
1311
1312         it = &nd.intent;
1313         intent_init(it, IT_OPEN);
1314         it->d.lustre.it_disposition = 0;
1315         it->d.lustre.it_data = NULL;
1316 ],[
1317         AC_MSG_RESULT([yes])
1318         AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1319 ],[
1320         AC_MSG_RESULT([no])
1321 ])
1322 ])
1323
1324 AC_DEFUN([LC_S_TIME_GRAN],
1325 [AC_MSG_CHECKING([if super block has s_time_gran member])
1326 LB_LINUX_TRY_COMPILE([
1327         #include <linux/fs.h>
1328 ],[
1329         struct super_block sb;
1330
1331         return sb.s_time_gran;
1332 ],[
1333         AC_MSG_RESULT([yes])
1334         AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1335 ],[
1336         AC_MSG_RESULT([no])
1337 ])
1338 ])
1339
1340 AC_DEFUN([LC_SB_TIME_GRAN],
1341 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1342 LB_LINUX_TRY_COMPILE([
1343         #include <linux/fs.h>
1344 ],[
1345         return get_sb_time_gran(NULL);
1346 ],[
1347         AC_MSG_RESULT([yes])
1348         AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1349 ],[
1350         AC_MSG_RESULT([no])
1351 ])
1352 ])
1353
1354 #
1355 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1356 #
1357 # Check for our patched grab_cache_page_nowait_gfp() function
1358 # after 2.6.29 we can emulate this using add_to_page_cache_lru()
1359 #
1360 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
1361 [LB_CHECK_SYMBOL_EXPORT([grab_cache_page_nowait_gfp],
1362 [mm/filemap.c],[
1363         AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
1364                   [kernel exports grab_cache_page_nowait_gfp])
1365         ],
1366         [LB_CHECK_SYMBOL_EXPORT([add_to_page_cache_lru],
1367         [mm/filemap.c],[
1368                 AC_DEFINE(HAVE_ADD_TO_PAGE_CACHE_LRU, 1,
1369                         [kernel exports add_to_page_cache_lru])
1370         ],[
1371         ])
1372         ])
1373 ])
1374
1375 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1376 AC_DEFUN([LC_RW_TREE_LOCK],
1377 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1378 tmp_flags="$EXTRA_KCFLAGS"
1379 EXTRA_KCFLAGS="-Werror"
1380 LB_LINUX_TRY_COMPILE([
1381         #include <linux/fs.h>
1382 ],[
1383         struct address_space a;
1384
1385         write_lock(&a.tree_lock);
1386 ],[
1387         AC_MSG_RESULT([yes])
1388         AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1389 ],[
1390         AC_MSG_RESULT([no])
1391 ])
1392 EXTRA_KCFLAGS="$tmp_flags"
1393 ])
1394
1395 AC_DEFUN([LC_CONST_ACL_SIZE],
1396 [AC_MSG_CHECKING([calc acl size])
1397 tmp_flags="$CFLAGS"
1398 CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 $EXTRA_KCFLAGS"
1399 AC_TRY_RUN([
1400 #define __KERNEL__
1401 #include <linux/autoconf.h>
1402 #include <linux/types.h>
1403 #undef __KERNEL__
1404 // block include
1405 #define __LINUX_POSIX_ACL_H
1406
1407 # ifdef CONFIG_FS_POSIX_ACL
1408 #  ifdef HAVE_XATTR_ACL
1409 #   include <linux/xattr_acl.h>
1410 #  endif
1411 #  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1412 #   include <linux/posix_acl_xattr.h>
1413 #  endif
1414 # endif
1415
1416 #include <lustre_acl.h>
1417
1418 #include <stdio.h>
1419
1420 int main(void)
1421 {
1422     int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1423     FILE *f = fopen("acl.size","w+");
1424     fprintf(f,"%d", size);
1425     fclose(f);
1426
1427     return 0;
1428 }
1429
1430 ],[
1431         acl_size=`cat acl.size`
1432         AC_MSG_RESULT([ACL size $acl_size])
1433         AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1434 ],[
1435         AC_ERROR([ACL size can't computed])
1436 ])
1437 CFLAGS="$tmp_flags"
1438 ])
1439
1440 #
1441 # check for crypto API
1442 #
1443 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1444 [AC_MSG_CHECKING([if kernel has block cipher support])
1445 LB_LINUX_TRY_COMPILE([
1446         #include <linux/err.h>
1447         #include <linux/crypto.h>
1448 ],[
1449         struct crypto_blkcipher *tfm;
1450         tfm = crypto_alloc_blkcipher("aes", 0, 0 );
1451 ],[
1452         AC_MSG_RESULT([yes])
1453         AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1454 ],[
1455         AC_MSG_RESULT([no])
1456 ])
1457 ])
1458
1459 #
1460 # check for struct hash_desc
1461 #
1462 AC_DEFUN([LC_STRUCT_HASH_DESC],
1463 [AC_MSG_CHECKING([if kernel has struct hash_desc])
1464 LB_LINUX_TRY_COMPILE([
1465         #include <linux/err.h>
1466         #include <linux/crypto.h>
1467 ],[
1468         struct hash_desc foo;
1469 ],[
1470         AC_MSG_RESULT([yes])
1471         AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
1472 ],[
1473         AC_MSG_RESULT([no])
1474 ])
1475 ])
1476
1477 #
1478 # check for struct blkcipher_desc
1479 #
1480 AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
1481 [AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
1482 LB_LINUX_TRY_COMPILE([
1483         #include <linux/err.h>
1484         #include <linux/crypto.h>
1485 ],[
1486         struct blkcipher_desc foo;
1487 ],[
1488         AC_MSG_RESULT([yes])
1489         AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
1490 ],[
1491         AC_MSG_RESULT([no])
1492 ])
1493 ])
1494
1495 #
1496 # 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
1497 #
1498 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1499 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1500 LB_LINUX_TRY_COMPILE([
1501         #include <linux/fs.h>
1502 ],[
1503         int v = FS_RENAME_DOES_D_MOVE;
1504 ],[
1505         AC_MSG_RESULT([yes])
1506         AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1507 ],[
1508         AC_MSG_RESULT([no])
1509 ])
1510 ])
1511
1512 #
1513 # LC_FUNC_F_OP_FLOCK
1514 #
1515 # rhel4.2 kernel has f_op->flock field
1516 #
1517 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
1518 [AC_MSG_CHECKING([if struct file_operations has flock field])
1519 LB_LINUX_TRY_COMPILE([
1520         #include <linux/fs.h>
1521 ],[
1522         struct file_operations ll_file_operations_flock;
1523         ll_file_operations_flock.flock = NULL;
1524 ],[
1525         AC_DEFINE(HAVE_F_OP_FLOCK, 1,
1526                 [struct file_operations has flock field])
1527         AC_MSG_RESULT([yes])
1528 ],[
1529         AC_MSG_RESULT([no])
1530 ])
1531 ])
1532
1533 # vfs_symlink seems to have started out with 3 args until 2.6.7 where a
1534 # "mode" argument was added, but then again, in some later version it was
1535 # removed
1536 AC_DEFUN([LC_4ARGS_VFS_SYMLINK],
1537 [AC_MSG_CHECKING([if vfs_symlink wants 4 args])
1538 LB_LINUX_TRY_COMPILE([
1539         #include <linux/fs.h>
1540 ],[
1541         struct inode *dir;
1542         struct dentry *dentry;
1543         const char *oldname = NULL;
1544         int mode = 0;
1545
1546         vfs_symlink(dir, dentry, oldname, mode);
1547 ],[
1548         AC_MSG_RESULT(yes)
1549         AC_DEFINE(HAVE_4ARGS_VFS_SYMLINK, 1,
1550                   [vfs_symlink wants 4 args])
1551 ],[
1552         AC_MSG_RESULT(no)
1553 ])
1554 ])
1555
1556 # 2.6.23 has new shrinker API
1557 AC_DEFUN([LC_REGISTER_SHRINKER],
1558 [LB_CHECK_SYMBOL_EXPORT([register_shrinker],
1559 [mm/vmscan.c],[
1560         AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
1561                   [kernel exports register_shrinker])
1562 ],[
1563 ])
1564 ])
1565
1566 #2.6.27
1567 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
1568 [AC_MSG_CHECKING([inode_operations->permission has two args])
1569 LB_LINUX_TRY_COMPILE([
1570         #include <linux/fs.h>
1571 ],[
1572         struct inode *inode;
1573
1574         inode->i_op->permission(NULL,0);
1575 ],[
1576         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1, 
1577                   [inode_operations->permission has two args])
1578         AC_MSG_RESULT([yes])
1579 ],[
1580         AC_MSG_RESULT([no])
1581 ])
1582 ])
1583
1584 # 2.6.27 has file_remove_suid instead of remove_suid
1585 AC_DEFUN([LC_FILE_REMOVE_SUID],
1586 [AC_MSG_CHECKING([kernel has file_remove_suid])
1587 LB_LINUX_TRY_COMPILE([
1588         #include <linux/fs.h>
1589 ],[
1590         file_remove_suid(NULL);
1591 ],[
1592         AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
1593                   [kernel have file_remove_suid])
1594         AC_MSG_RESULT([yes])
1595 ],[
1596         AC_MSG_RESULT([no])
1597 ])
1598 ])
1599
1600 # 2.6.27 have new page locking API
1601 AC_DEFUN([LC_TRYLOCKPAGE],
1602 [AC_MSG_CHECKING([kernel uses trylock_page for page lock])
1603 LB_LINUX_TRY_COMPILE([
1604         #include <linux/pagemap.h>
1605 ],[
1606         trylock_page(NULL);
1607 ],[
1608         AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
1609                   [kernel uses trylock_page for page lock])
1610         AC_MSG_RESULT([yes])
1611 ],[
1612         AC_MSG_RESULT([no])
1613 ])
1614 ])
1615
1616 # vfs_symlink seems to have started out with 3 args until 2.6.7 where a
1617 # "mode" argument was added, but then again, in some later version it was
1618 # removed
1619 AC_DEFUN([LC_4ARGS_VFS_SYMLINK],
1620 [AC_MSG_CHECKING([if vfs_symlink wants 4 args])
1621 LB_LINUX_TRY_COMPILE([
1622         #include <linux/fs.h>
1623 ],[
1624         struct inode *dir;
1625         struct dentry *dentry;
1626         const char *oldname = NULL;
1627         int mode = 0;
1628
1629         vfs_symlink(dir, dentry, oldname, mode);
1630 ],[
1631         AC_MSG_RESULT(yes)
1632         AC_DEFINE(HAVE_4ARGS_VFS_SYMLINK, 1,
1633                   [vfs_symlink wants 4 args])
1634 ],[
1635         AC_MSG_RESULT(no)
1636 ])
1637 ])
1638
1639 # 2.6.27 sles11 remove the bi_hw_segments
1640 AC_DEFUN([LC_BI_HW_SEGMENTS],
1641 [AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
1642 LB_LINUX_TRY_COMPILE([
1643         #include <linux/bio.h>
1644 ],[
1645         struct bio io;
1646         io.bi_hw_segments = 0;
1647 ],[
1648         AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
1649                 [struct bio has a bi_hw_segments field])
1650         AC_MSG_RESULT([yes])
1651 ],[
1652         AC_MSG_RESULT([no])
1653 ])
1654 ])
1655
1656 # 2.6.27 sles11 move the quotaio_v1.h to fs
1657 AC_DEFUN([LC_HAVE_QUOTAIO_V1_H],
1658 [LB_CHECK_FILE([$LINUX/include/linux/quotaio_v1.h],[
1659         AC_DEFINE(HAVE_QUOTAIO_V1_H, 1,
1660                 [kernel has include/linux/quotaio_v1.h])
1661 ],[
1662         AC_MSG_RESULT([no])
1663 ])
1664 ])
1665
1666 # sles10 sp2 need 5 parameter for vfs_symlink
1667 AC_DEFUN([LC_VFS_SYMLINK_5ARGS],
1668 [AC_MSG_CHECKING([vfs_symlink need 5 parameter])
1669 LB_LINUX_TRY_COMPILE([
1670         #include <linux/fs.h>
1671 ],[
1672         struct inode *dir = NULL;
1673         struct dentry *dentry = NULL;
1674         struct vfsmount *mnt = NULL;
1675         const char * path = NULL;
1676         vfs_symlink(dir, dentry, mnt, path, 0);
1677 ],[
1678         AC_DEFINE(HAVE_VFS_SYMLINK_5ARGS, 1,
1679                 [vfs_symlink need 5 parameteres])
1680         AC_MSG_RESULT([yes])
1681 ],[
1682         AC_MSG_RESULT([no])
1683 ])
1684 ])
1685
1686 # 2.6.27 removed the read_inode from super_operations.
1687 AC_DEFUN([LC_READ_INODE_IN_SBOPS],
1688 [AC_MSG_CHECKING([super_operations has a read_inode field])
1689 LB_LINUX_TRY_COMPILE([
1690         #include <linux/fs.h>
1691 ],[
1692         struct super_operations *sop;
1693         sop->read_inode(NULL);
1694 ],[
1695         AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
1696                 [super_operations has a read_inode])
1697         AC_MSG_RESULT([yes])
1698 ],[
1699         AC_MSG_RESULT([no])
1700 ])
1701 ])
1702
1703 # 2.6.27 sles11 has sb_any_quota_active
1704 AC_DEFUN([LC_SB_ANY_QUOTA_ACTIVE],
1705 [AC_MSG_CHECKING([Kernel has sb_any_quota_active])
1706 LB_LINUX_TRY_COMPILE([
1707         #include <linux/quotaops.h>
1708 ],[
1709         sb_any_quota_active(NULL);
1710 ],[
1711         AC_DEFINE(HAVE_SB_ANY_QUOTA_ACTIVE, 1,
1712                 [Kernel has a sb_any_quota_active])
1713         AC_MSG_RESULT([yes])
1714 ],[
1715         AC_MSG_RESULT([no])
1716 ])
1717 ])
1718
1719 # 2.6.27 sles11 has sb_has_quota_active
1720 AC_DEFUN([LC_SB_HAS_QUOTA_ACTIVE],
1721 [AC_MSG_CHECKING([Kernel has sb_has_quota_active])
1722 LB_LINUX_TRY_COMPILE([
1723         #include <linux/quotaops.h>
1724 ],[
1725         sb_has_quota_active(NULL, 0);
1726 ],[
1727         AC_DEFINE(HAVE_SB_HAS_QUOTA_ACTIVE, 1,
1728                 [Kernel has a sb_has_quota_active])
1729         AC_MSG_RESULT([yes])
1730 ],[
1731         AC_MSG_RESULT([no])
1732 ])
1733 ])
1734
1735 # 2.6.27 has inode_permission instead of permisson
1736 AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
1737 [LB_CHECK_SYMBOL_EXPORT([inode_permission],
1738 [fs/namei.c],[
1739 AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
1740             [inode_permission is exported by the kernel])
1741 ],[
1742 ])
1743 ])
1744
1745 # 2.6.27 use 5th parameter in quota_on for remount.
1746 AC_DEFUN([LC_QUOTA_ON_5ARGS],
1747 [AC_MSG_CHECKING([quota_on needs 5 parameters])
1748 LB_LINUX_TRY_COMPILE([
1749         #include <linux/quota.h>
1750 ],[
1751         struct quotactl_ops *qop;
1752         qop->quota_on(NULL, 0, 0, NULL, 0);
1753 ],[
1754         AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
1755                 [quota_on needs 5 paramters])
1756         AC_MSG_RESULT([yes])
1757 ],[
1758         AC_MSG_RESULT([no])
1759 ])
1760 ])
1761
1762 # 2.6.27 use 3th parameter in quota_off for remount.
1763 AC_DEFUN([LC_QUOTA_OFF_3ARGS],
1764 [AC_MSG_CHECKING([quota_off needs 3 parameters])
1765 LB_LINUX_TRY_COMPILE([
1766         #include <linux/quota.h>
1767 ],[
1768         struct quotactl_ops *qop;
1769         qop->quota_off(NULL, 0, 0);
1770 ],[
1771         AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
1772                 [quota_off needs 3 paramters])
1773         AC_MSG_RESULT([yes])
1774 ],[
1775         AC_MSG_RESULT([no])
1776 ])
1777 ])
1778
1779 # 2.6.27 has vfs_dq_off inline function.
1780 AC_DEFUN([LC_VFS_DQ_OFF],
1781 [AC_MSG_CHECKING([vfs_dq_off is defined])
1782 LB_LINUX_TRY_COMPILE([
1783         #include <linux/quotaops.h>
1784 ],[
1785         vfs_dq_off(NULL, 0);
1786 ],[
1787         AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
1788         AC_MSG_RESULT([yes])
1789 ],[
1790         AC_MSG_RESULT([no])
1791 ])
1792 ])
1793
1794 #
1795 # LC_LINUX_FIEMAP_H
1796 #
1797 # If we have fiemap.h
1798 # after 2.6.27 use fiemap.h in include/linux
1799 #
1800 AC_DEFUN([LC_LINUX_FIEMAP_H],
1801 [LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
1802         AC_MSG_CHECKING([if fiemap.h can be compiled])
1803         LB_LINUX_TRY_COMPILE([
1804                 #include <linux/types.h>
1805                 #include <linux/fiemap.h>
1806         ],[],[
1807                 AC_MSG_RESULT([yes])
1808                 AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
1809         ],[
1810                 AC_MSG_RESULT([no])
1811         ])
1812 ],
1813 [])
1814 ])
1815
1816 #
1817 # LC_PROG_LINUX
1818 #
1819 # Lustre linux kernel checks
1820 #
1821 AC_DEFUN([LC_PROG_LINUX],
1822          [LC_LUSTRE_VERSION_H
1823          if test x$enable_server = xyes ; then
1824              AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1825              LC_FUNC_DEV_SET_RDONLY
1826              LC_STACK_SIZE
1827              LC_CONFIG_BACKINGFS
1828          fi
1829          LC_CONFIG_PINGER
1830          LC_CONFIG_CHECKSUM
1831          LC_CONFIG_LIBLUSTRE_RECOVERY
1832          LC_CONFIG_HEALTH_CHECK_WRITE
1833          LC_CONFIG_LRU_RESIZE
1834          LC_QUOTA_MODULE
1835
1836          # RHEL4 patches
1837          LC_EXPORT_TRUNCATE_COMPLETE
1838          LC_EXPORT_TRUNCATE_RANGE
1839          LC_EXPORT_D_REHASH_COND
1840          LC_EXPORT___D_REHASH
1841          LC_EXPORT_D_MOVE_LOCKED
1842          LC_EXPORT___D_MOVE
1843          LC_EXPORT_NODE_TO_CPUMASK
1844
1845          LC_HEADER_LDISKFS_XATTR
1846          LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1847          LC_STRUCT_STATFS
1848          LC_FILEMAP_POPULATE
1849          LC_D_ADD_UNIQUE
1850          LC_BIT_SPINLOCK_H
1851
1852          LC_XATTR_ACL
1853          LC_POSIX_ACL_XATTR_H
1854          LC_CONST_ACL_SIZE
1855
1856          LC_STRUCT_INTENT_FILE
1857
1858          LC_CAPA_CRYPTO
1859          LC_CONFIG_RMTCLIENT
1860          LC_CONFIG_GSS
1861          LC_FUNC_MS_FLOCK_LOCK
1862          LC_FUNC_HAVE_CAN_SLEEP_ARG
1863          LC_FUNC_F_OP_FLOCK
1864          LC_QUOTA_READ
1865          LC_COOKIE_FOLLOW_LINK
1866          LC_FUNC_RCU
1867          LC_PERCPU_COUNTER
1868          LC_QUOTA64
1869          LC_4ARGS_VFS_SYMLINK
1870
1871          # does the kernel have VFS intent patches?
1872          LC_VFS_INTENT_PATCHES
1873
1874          # ~2.6.11
1875          LC_S_TIME_GRAN
1876          LC_SB_TIME_GRAN
1877
1878          # 2.6.12
1879          LC_RW_TREE_LOCK
1880          LC_EXPORT_SYNCHRONIZE_RCU
1881
1882          # 2.6.15
1883          LC_INODE_I_MUTEX
1884
1885          # 2.6.16
1886          LC_SECURITY_PLUG  # for SLES10 SP2
1887
1888          # 2.6.17
1889          LC_INODE_IPRIVATE
1890          LC_DQUOTOFF_MUTEX
1891
1892          # 2.6.18
1893          LC_NR_PAGECACHE
1894          LC_STATFS_DENTRY_PARAM
1895          LC_VFS_KERN_MOUNT
1896          LC_INVALIDATEPAGE_RETURN_INT
1897          LC_UMOUNTBEGIN_HAS_VFSMOUNT
1898          LC_SEQ_LOCK
1899          LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
1900          if test x$enable_server = xyes ; then
1901                 LC_EXPORT_INVALIDATE_MAPPING_PAGES
1902          fi
1903
1904          #2.6.18 + RHEL5 (fc6)
1905          LC_PG_FS_MISC
1906          LC_PAGE_CHECKED
1907          LC_LINUX_FIEMAP_H
1908
1909          # 2.6.19
1910          LC_INODE_BLKSIZE
1911          LC_VFS_READDIR_U64_INO
1912          LC_FILE_WRITEV
1913          LC_FILE_READV
1914
1915          # 2.6.20
1916          LC_CANCEL_DIRTY_PAGE
1917
1918          # raid5-zerocopy patch
1919          LC_PAGE_CONSTANT
1920
1921          # 2.6.22
1922          LC_INVALIDATE_BDEV_2ARG
1923          LC_ASYNC_BLOCK_CIPHER
1924          LC_STRUCT_HASH_DESC
1925          LC_STRUCT_BLKCIPHER_DESC
1926          LC_FS_RENAME_DOES_D_MOVE
1927          # 2.6.23
1928          LC_UNREGISTER_BLKDEV_RETURN_INT
1929          LC_KERNEL_SPLICE_READ
1930          LC_KERNEL_SENDFILE
1931          LC_HAVE_EXPORTFS_H
1932          LC_VM_OP_FAULT
1933          LC_REGISTER_SHRINKER
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
1941          #2.6.25
1942          LC_MAPPING_CAP_WRITEBACK_DIRTY
1943   
1944          # 2.6.26
1945          LC_FS_STRUCT_USE_PATH
1946
1947          # 2.6.27
1948          LC_INODE_PERMISION_2ARGS
1949          LC_FILE_REMOVE_SUID
1950          LC_TRYLOCKPAGE
1951          LC_READ_INODE_IN_SBOPS
1952          LC_EXPORT_INODE_PERMISSION
1953          LC_QUOTA_ON_5ARGS
1954          LC_QUOTA_OFF_3ARGS
1955          LC_VFS_DQ_OFF
1956
1957          # 2.6.27.15-2 sles11
1958          LC_BI_HW_SEGMENTS
1959          LC_HAVE_QUOTAIO_V1_H
1960          LC_VFS_SYMLINK_5ARGS
1961          LC_SB_ANY_QUOTA_ACTIVE
1962          LC_SB_HAS_QUOTA_ACTIVE
1963 ])
1964
1965 #
1966 # LC_CONFIG_CLIENT_SERVER
1967 #
1968 # Build client/server sides of Lustre
1969 #
1970 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1971 [AC_MSG_CHECKING([whether to build Lustre server support])
1972 AC_ARG_ENABLE([server],
1973         AC_HELP_STRING([--disable-server],
1974                         [disable Lustre server support]),
1975         [],[enable_server='yes'])
1976 AC_MSG_RESULT([$enable_server])
1977
1978 AC_MSG_CHECKING([whether to build Lustre client support])
1979 AC_ARG_ENABLE([client],
1980         AC_HELP_STRING([--disable-client],
1981                         [disable Lustre client support]),
1982         [],[enable_client='yes'])
1983 AC_MSG_RESULT([$enable_client])])
1984
1985 #
1986 # LC_CONFIG_LIBLUSTRE
1987 #
1988 # whether to build liblustre
1989 #
1990 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1991 [AC_MSG_CHECKING([whether to build Lustre library])
1992 AC_ARG_ENABLE([liblustre],
1993         AC_HELP_STRING([--disable-liblustre],
1994                         [disable building of Lustre library]),
1995         [],[enable_liblustre=$with_sysio])
1996 AC_MSG_RESULT([$enable_liblustre])
1997 # only build sysio if liblustre is built
1998 with_sysio="$enable_liblustre"
1999
2000 AC_MSG_CHECKING([whether to build liblustre tests])
2001 AC_ARG_ENABLE([liblustre-tests],
2002         AC_HELP_STRING([--enable-liblustre-tests],
2003                         [enable liblustre tests, if --disable-tests is used]),
2004         [],[enable_liblustre_tests=$enable_tests])
2005 if test x$enable_liblustre != xyes ; then
2006    enable_liblustre_tests='no'
2007 fi
2008 AC_MSG_RESULT([$enable_liblustre_tests])
2009
2010 AC_MSG_CHECKING([whether to enable liblustre acl])
2011 AC_ARG_ENABLE([liblustre-acl],
2012         AC_HELP_STRING([--disable-liblustre-acl],
2013                         [disable ACL support for liblustre]),
2014         [],[enable_liblustre_acl=yes])
2015 AC_MSG_RESULT([$enable_liblustre_acl])
2016 if test x$enable_liblustre_acl = xyes ; then
2017   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
2018 fi
2019
2020 # 2.6.29 change prepare/commit_write to write_begin/end
2021 AC_DEFUN([LC_WRITE_BEGIN_END],
2022 [AC_MSG_CHECKING([if kernel has .write_begin/end])
2023 LB_LINUX_TRY_COMPILE([
2024         #include <linux/fs.h>
2025         #include <linux/pagemap.h>
2026 #ifdef HAVE_LINUX_MMTYPES_H
2027         #include <linux/mm_types.h>
2028 #endif
2029 ],[
2030         struct address_space_operations aops;
2031         struct page *page;
2032
2033         aops.write_begin = NULL;
2034         aops.write_end = NULL;
2035         page = grab_cache_page_write_begin(NULL, 0, 0);
2036 ], [
2037         AC_MSG_RESULT([yes])
2038         AC_DEFINE(HAVE_KERNEL_WRITE_BEGIN_END, 1,
2039                 [kernel has .write_begin/end])
2040 ],[
2041         AC_MSG_RESULT([no])
2042 ])
2043 ])
2044
2045 # 2.6.29 blkdev_put has 2 arguments
2046 AC_DEFUN([LC_BLKDEV_PUT_2ARGS],
2047 [AC_MSG_CHECKING([blkdev_put needs 2 parameters])
2048 LB_LINUX_TRY_COMPILE([
2049         #include <linux/fs.h>
2050 ],[
2051         blkdev_put(NULL, 0);
2052 ],[
2053         AC_DEFINE(HAVE_BLKDEV_PUT_2ARGS, 1,
2054                 [blkdev_put needs 2 paramters])
2055         AC_MSG_RESULT([yes])
2056 ],[
2057         AC_MSG_RESULT([no])
2058 ])
2059 ])
2060
2061 # 2.6.29 dentry_open has 4 arguments
2062 AC_DEFUN([LC_DENTRY_OPEN_4ARGS],
2063 [AC_MSG_CHECKING([dentry_open needs 4 parameters])
2064 LB_LINUX_TRY_COMPILE([
2065         #include <linux/fs.h>
2066 ],[
2067         dentry_open(NULL, NULL, 0, NULL);
2068 ],[
2069         AC_DEFINE(HAVE_DENTRY_OPEN_4ARGS, 1,
2070                 [dentry_open needs 4 paramters])
2071         AC_MSG_RESULT([yes])
2072 ],[
2073         AC_MSG_RESULT([no])
2074 ])
2075 ])
2076
2077 #
2078 # --enable-mpitest
2079 #
2080 AC_ARG_ENABLE(mpitests,
2081         AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
2082                            [include mpi tests]),
2083         [
2084          enable_mpitests=yes
2085          case $enableval in
2086          yes)
2087                 MPICC_WRAPPER=mpicc
2088                 ;;
2089          no)
2090                 enable_mpitests=no
2091                 ;;
2092          *)
2093                 MPICC_WRAPPER=$enableval
2094                  ;;
2095          esac
2096         ],
2097         [
2098         MPICC_WRAPPER=mpicc
2099         enable_mpitests=yes
2100         ]
2101 )
2102
2103 if test x$enable_mpitests != xno; then
2104         AC_MSG_CHECKING([whether mpitests can be built])
2105         oldcc=$CC
2106         CC=$MPICC_WRAPPER
2107         AC_LINK_IFELSE(
2108             [AC_LANG_PROGRAM([[
2109                     #include <mpi.h>
2110                 ]],[[
2111                     int flag;
2112                     MPI_Initialized(&flag);
2113                 ]])],
2114             [
2115                     AC_MSG_RESULT([yes])
2116             ],[
2117                     AC_MSG_RESULT([no])
2118                     enable_mpitests=no
2119         ])
2120         CC=$oldcc
2121 fi
2122 AC_SUBST(MPICC_WRAPPER)
2123
2124 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
2125 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
2126
2127 LC_CONFIG_PINGER
2128 LC_CONFIG_LIBLUSTRE_RECOVERY
2129 ])
2130
2131 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
2132 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
2133 AC_ARG_ENABLE([lru_resize],
2134         AC_HELP_STRING([--enable-lru-resize],
2135                         [enable lru resize support]),
2136         [],[enable_lru_resize='yes'])
2137 AC_MSG_RESULT([$enable_lru_resize])
2138 if test x$enable_lru_resize != xno; then
2139    AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
2140 fi
2141 ])
2142
2143 #
2144 # LC_CONFIG_QUOTA
2145 #
2146 # whether to enable quota support global control
2147 #
2148 AC_DEFUN([LC_CONFIG_QUOTA],
2149 [AC_ARG_ENABLE([quota],
2150         AC_HELP_STRING([--enable-quota],
2151                         [enable quota support]),
2152         [],[enable_quota='yes'])
2153 ])
2154
2155 # whether to enable quota support(kernel modules)
2156 AC_DEFUN([LC_QUOTA_MODULE],
2157 [if test x$enable_quota != xno; then
2158     LB_LINUX_CONFIG([QUOTA],[
2159         enable_quota_module='yes'
2160         AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
2161     ],[
2162         enable_quota_module='no'
2163         AC_MSG_WARN([quota is not enabled because the kernel - lacks quota support])
2164     ])
2165 fi
2166 ])
2167
2168 AC_DEFUN([LC_QUOTA],
2169 [#check global
2170 LC_CONFIG_QUOTA
2171 #check for utils
2172 AC_CHECK_HEADER(sys/quota.h,
2173                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
2174                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2175 ])
2176
2177 AC_DEFUN([LC_QUOTA_READ],
2178 [AC_MSG_CHECKING([if kernel supports quota_read])
2179 LB_LINUX_TRY_COMPILE([
2180         #include <linux/fs.h>
2181 ],[
2182         struct super_operations sp;
2183         void *i = (void *)sp.quota_read;
2184 ],[
2185         AC_MSG_RESULT([yes])
2186         AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
2187 ],[
2188         AC_MSG_RESULT([no])
2189 ])
2190 ])
2191
2192 #
2193 # LC_CONFIG_SPLIT
2194 #
2195 # whether to enable split support
2196 #
2197 AC_DEFUN([LC_CONFIG_SPLIT],
2198 [AC_MSG_CHECKING([whether to enable split support])
2199 AC_ARG_ENABLE([split],
2200         AC_HELP_STRING([--enable-split],
2201                         [enable split support]),
2202         [],[enable_split='no'])
2203 AC_MSG_RESULT([$enable_split])
2204 if test x$enable_split != xno; then
2205    AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
2206 fi
2207 ])
2208
2209 #
2210 # LC_COOKIE_FOLLOW_LINK
2211 #
2212 # kernel 2.6.13+ ->follow_link returns a cookie
2213 #
2214
2215 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
2216 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
2217 LB_LINUX_TRY_COMPILE([
2218         #include <linux/fs.h>
2219         #include <linux/namei.h>
2220 ],[
2221         struct dentry dentry;
2222         struct nameidata nd;
2223
2224         dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
2225 ],[
2226         AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
2227         AC_MSG_RESULT([yes])
2228 ],[
2229         AC_MSG_RESULT([no])
2230 ])
2231 ])
2232
2233 #
2234 # LC_FUNC_RCU
2235 #
2236 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE),
2237 # call_rcu takes three parameters.
2238 #
2239 AC_DEFUN([LC_FUNC_RCU],
2240 [AC_MSG_CHECKING([if kernel have RCU supported])
2241 LB_LINUX_TRY_COMPILE([
2242         #include <linux/rcupdate.h>
2243 ],[],[
2244         AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
2245         AC_MSG_RESULT([yes])
2246
2247         AC_MSG_CHECKING([if call_rcu takes three parameters])
2248         LB_LINUX_TRY_COMPILE([
2249                 #include <linux/rcupdate.h>
2250         ],[
2251                 struct rcu_head rh;
2252                 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
2253         ],[
2254                 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
2255                 AC_MSG_RESULT([yes])
2256         ],[
2257                 AC_MSG_RESULT([no])
2258         ])
2259
2260 ],[
2261         AC_MSG_RESULT([no])
2262 ])
2263 ])
2264
2265 #
2266 # LC_QUOTA64
2267 # linux kernel have 64-bit limits support
2268 #
2269 AC_DEFUN([LC_QUOTA64],
2270 [if test x$enable_quota_module = xyes -a x$enable_server = xyes ; then
2271         AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
2272         LB_LINUX_TRY_COMPILE([
2273                 #include <linux/kernel.h>
2274                 #include <linux/fs.h>
2275                 #include <linux/quotaio_v2.h>
2276                 int versions[] = V2_INITQVERSIONS_R1;
2277                 struct v2_disk_dqblk_r1 dqblk_r1;
2278         ],[],[
2279                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
2280                 AC_MSG_RESULT([yes])
2281         ],[
2282         tmp_flags="$EXTRA_KCFLAGS"
2283         EXTRA_KCFLAGS="-I $LINUX/fs"
2284         LB_LINUX_TRY_COMPILE([
2285                 #include <linux/kernel.h>
2286                 #include <linux/fs.h>
2287                 #include <quotaio_v2.h>
2288                 struct v2r1_disk_dqblk dqblk_r1;
2289         ],[],[
2290                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
2291                 AC_MSG_RESULT([yes])
2292         ],[
2293                 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
2294                         AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
2295                 ],[])
2296                 AC_MSG_RESULT([no])
2297         ])
2298         EXTRA_KCFLAGS=$tmp_flags
2299         ])
2300 fi
2301 ])
2302
2303 # LC_SECURITY_PLUG  # for SLES10 SP2
2304 # check security plug in sles10 sp2 kernel
2305 AC_DEFUN([LC_SECURITY_PLUG],
2306 [AC_MSG_CHECKING([If kernel has security plug support])
2307 LB_LINUX_TRY_COMPILE([
2308         #include <linux/fs.h>
2309 ],[
2310         struct dentry   *dentry;
2311         struct vfsmount *mnt;
2312         struct iattr    *iattr;
2313
2314         notify_change(dentry, mnt, iattr);
2315 ],[
2316         AC_MSG_RESULT(yes)
2317         AC_DEFINE(HAVE_SECURITY_PLUG, 1,
2318                 [SLES10 SP2 use extra parameter in vfs])
2319 ],[
2320         AC_MSG_RESULT(no)
2321 ])
2322 ])
2323
2324 AC_DEFUN([LC_PERCPU_COUNTER],
2325 [AC_MSG_CHECKING([if have struct percpu_counter defined])
2326 LB_LINUX_TRY_COMPILE([
2327         #include <linux/percpu_counter.h>
2328 ],[],[
2329         AC_DEFINE(HAVE_PERCPU_COUNTER, 1, [percpu_counter found])
2330         AC_MSG_RESULT([yes])
2331
2332         AC_MSG_CHECKING([if percpu_counter_inc takes the 2nd argument])
2333         LB_LINUX_TRY_COMPILE([
2334                 #include <linux/percpu_counter.h>
2335         ],[
2336                 struct percpu_counter c;
2337                 percpu_counter_init(&c, 0);
2338         ],[
2339                 AC_DEFINE(HAVE_PERCPU_2ND_ARG, 1, [percpu_counter_init has two
2340                                                    arguments])
2341                 AC_MSG_RESULT([yes])
2342         ],[
2343                 AC_MSG_RESULT([no])
2344         ])
2345 ],[
2346         AC_MSG_RESULT([no])
2347 ])
2348 ])
2349
2350 #
2351 # LC_CONFIGURE
2352 #
2353 # other configure checks
2354 #
2355 AC_DEFUN([LC_CONFIGURE],
2356 [LC_CONFIG_OBD_BUFFER_SIZE
2357
2358 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
2359         CFLAGS="$CFLAGS -Werror"
2360 fi
2361
2362 # include/liblustre.h
2363 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
2364
2365 # liblustre/llite_lib.h
2366 AC_CHECK_HEADERS([xtio.h file.h])
2367
2368 # liblustre/dir.c
2369 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
2370
2371 # liblustre/lutil.c
2372 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
2373 AC_CHECK_FUNCS([inet_ntoa])
2374
2375 # libsysio/src/readlink.c
2376 LC_READLINK_SSIZE_T
2377
2378 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
2379 AC_CHECK_HEADERS([linux/random.h], [], [],
2380                  [#ifdef HAVE_LINUX_TYPES_H
2381                   # include <linux/types.h>
2382                   #endif
2383                  ])
2384
2385 # utils/llverfs.c
2386 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2387
2388 # check for -lz support
2389 ZLIB=""
2390 AC_CHECK_LIB([z],
2391              [adler32],
2392              [AC_CHECK_HEADERS([zlib.h],
2393                                [ZLIB="-lz"
2394                                 AC_DEFINE([HAVE_ADLER], 1,
2395                                           [support alder32 checksum type])],
2396                                [AC_MSG_WARN([No zlib-devel package found,
2397                                              unable to use adler32 checksum])])],
2398              [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
2399 )
2400 AC_SUBST(ZLIB)
2401
2402 # Super safe df
2403 AC_ARG_ENABLE([mindf],
2404       AC_HELP_STRING([--enable-mindf],
2405                       [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2406       [],[])
2407 if test "$enable_mindf" = "yes" ;  then
2408       AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
2409 fi
2410
2411 AC_ARG_ENABLE([fail_alloc],
2412         AC_HELP_STRING([--disable-fail-alloc],
2413                 [disable randomly alloc failure]),
2414         [],[enable_fail_alloc=yes])
2415 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2416 AC_MSG_RESULT([$enable_fail_alloc])
2417 if test x$enable_fail_alloc != xno ; then
2418         AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
2419 fi
2420
2421 AC_ARG_ENABLE([invariants],
2422         AC_HELP_STRING([--enable-invariants],
2423                 [enable invariant checking (cpu intensive)]),
2424         [],[])
2425 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2426 AC_MSG_RESULT([$enable_invariants])
2427 if test x$enable_invariants = xyes ; then
2428         AC_DEFINE([INVARIANT_CHECK], 1, [enable invariant checking])
2429 fi
2430
2431 AC_ARG_ENABLE([lu_ref],
2432         AC_HELP_STRING([--enable-lu_ref],
2433                 [enable lu_ref reference tracking code]),
2434         [],[])
2435 AC_MSG_CHECKING([whether to track references with lu_ref])
2436 AC_MSG_RESULT([$enable_lu_ref])
2437 if test x$enable_lu_ref = xyes ; then
2438         AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
2439 fi
2440
2441          #2.6.29
2442          LC_WRITE_BEGIN_END
2443          LC_D_OBTAIN_ALIAS
2444          LC_BLKDEV_PUT_2ARGS
2445          LC_DENTRY_OPEN_4ARGS
2446
2447 ])
2448
2449 #
2450 # LC_CONDITIONALS
2451 #
2452 # AM_CONDITIONALS for lustre
2453 #
2454 AC_DEFUN([LC_CONDITIONALS],
2455 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
2456 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
2457 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
2458 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2459 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2460 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2461 AM_CONDITIONAL(QUOTA, test x$enable_quota_module = xyes)
2462 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2463 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2464 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2465 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2466 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2467 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2468 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2469 ])
2470
2471 #
2472 # LC_CONFIG_FILES
2473 #
2474 # files that should be generated with AC_OUTPUT
2475 #
2476 AC_DEFUN([LC_CONFIG_FILES],
2477 [AC_CONFIG_FILES([
2478 lustre/Makefile
2479 lustre/autoMakefile
2480 lustre/autoconf/Makefile
2481 lustre/contrib/Makefile
2482 lustre/doc/Makefile
2483 lustre/include/Makefile
2484 lustre/include/lustre_ver.h
2485 lustre/include/linux/Makefile
2486 lustre/include/lustre/Makefile
2487 lustre/kernel_patches/targets/2.6-vanilla.target
2488 lustre/kernel_patches/targets/2.6-rhel4.target
2489 lustre/kernel_patches/targets/2.6-rhel5.target
2490 lustre/kernel_patches/targets/2.6-fc5.target
2491 lustre/kernel_patches/targets/2.6-patchless.target
2492 lustre/kernel_patches/targets/2.6-sles10.target
2493 lustre/kernel_patches/targets/2.6-sles11.target
2494 lustre/kernel_patches/targets/2.6-oel5.target
2495 lustre/kernel_patches/targets/2.6-fc11.target
2496 lustre/ldlm/Makefile
2497 lustre/fid/Makefile
2498 lustre/fid/autoMakefile
2499 lustre/liblustre/Makefile
2500 lustre/liblustre/tests/Makefile
2501 lustre/liblustre/tests/mpi/Makefile
2502 lustre/llite/Makefile
2503 lustre/llite/autoMakefile
2504 lustre/lclient/Makefile
2505 lustre/lov/Makefile
2506 lustre/lov/autoMakefile
2507 lustre/lvfs/Makefile
2508 lustre/lvfs/autoMakefile
2509 lustre/mdc/Makefile
2510 lustre/mdc/autoMakefile
2511 lustre/lmv/Makefile
2512 lustre/lmv/autoMakefile
2513 lustre/mds/Makefile
2514 lustre/mds/autoMakefile
2515 lustre/mdt/Makefile
2516 lustre/mdt/autoMakefile
2517 lustre/cmm/Makefile
2518 lustre/cmm/autoMakefile
2519 lustre/mdd/Makefile
2520 lustre/mdd/autoMakefile
2521 lustre/fld/Makefile
2522 lustre/fld/autoMakefile
2523 lustre/obdclass/Makefile
2524 lustre/obdclass/autoMakefile
2525 lustre/obdclass/linux/Makefile
2526 lustre/obdecho/Makefile
2527 lustre/obdecho/autoMakefile
2528 lustre/obdfilter/Makefile
2529 lustre/obdfilter/autoMakefile
2530 lustre/osc/Makefile
2531 lustre/osc/autoMakefile
2532 lustre/ost/Makefile
2533 lustre/ost/autoMakefile
2534 lustre/osd/Makefile
2535 lustre/osd/autoMakefile
2536 lustre/mgc/Makefile
2537 lustre/mgc/autoMakefile
2538 lustre/mgs/Makefile
2539 lustre/mgs/autoMakefile
2540 lustre/ptlrpc/Makefile
2541 lustre/ptlrpc/autoMakefile
2542 lustre/ptlrpc/gss/Makefile
2543 lustre/ptlrpc/gss/autoMakefile
2544 lustre/quota/Makefile
2545 lustre/quota/autoMakefile
2546 lustre/scripts/Makefile
2547 lustre/tests/Makefile
2548 lustre/tests/mpi/Makefile
2549 lustre/utils/Makefile
2550 lustre/utils/gss/Makefile
2551 ])
2552 case $lb_target_os in
2553         darwin)
2554                 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])
2555                 ;;
2556 esac
2557
2558 ])