Whamcloud - gitweb
Branch HEAD
[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 ])
12
13 #
14 # LC_PATH_DEFAULTS
15 #
16 # lustre specific paths
17 #
18 AC_DEFUN([LC_PATH_DEFAULTS],
19 [# ptlrpc kernel build requires this
20 LUSTRE="$PWD/lustre"
21 AC_SUBST(LUSTRE)
22
23 # mount.lustre
24 rootsbindir='/sbin'
25 AC_SUBST(rootsbindir)
26
27 demodir='$(docdir)/demo'
28 AC_SUBST(demodir)
29
30 pkgexampledir='${pkgdatadir}/examples'
31 AC_SUBST(pkgexampledir)
32 ])
33
34 #
35 # LC_TARGET_SUPPORTED
36 #
37 # is the target os supported?
38 #
39 AC_DEFUN([LC_TARGET_SUPPORTED],
40 [case $target_os in
41         linux* | darwin*)
42 $1
43                 ;;
44         *)
45 $2
46                 ;;
47 esac
48 ])
49
50 #
51 # LC_CONFIG_EXT3
52 #
53 # that ext3 is enabled in the kernel
54 #
55 AC_DEFUN([LC_CONFIG_EXT3],
56 [LB_LINUX_CONFIG([EXT3_FS],[],[
57         LB_LINUX_CONFIG([EXT3_FS_MODULE],[],[$2])
58 ])
59 LB_LINUX_CONFIG([EXT3_FS_XATTR],[$1],[$3])
60 ])
61
62 #
63 # LC_FSHOOKS
64 #
65 # If we have (and can build) fshooks.h
66 #
67 AC_DEFUN([LC_FSHOOKS],
68 [LB_CHECK_FILE([$LINUX/include/linux/fshooks.h],[
69         AC_MSG_CHECKING([if fshooks.h can be compiled])
70         LB_LINUX_TRY_COMPILE([
71                 #include <linux/fshooks.h>
72         ],[],[
73                 AC_MSG_RESULT([yes])
74         ],[
75                 AC_MSG_RESULT([no])
76                 AC_MSG_WARN([You might have better luck with gcc 3.3.x.])
77                 AC_MSG_WARN([You can set CC=gcc33 before running configure.])
78                 AC_MSG_ERROR([Your compiler cannot build fshooks.h.])
79         ])
80 $1
81 ],[
82 $2
83 ])
84 ])
85
86 #
87 # LC_STRUCT_KIOBUF
88 #
89 # rh 2.4.18 has iobuf->dovary, but other kernels do not
90 #
91 AC_DEFUN([LC_STRUCT_KIOBUF],
92 [AC_MSG_CHECKING([if struct kiobuf has a dovary field])
93 LB_LINUX_TRY_COMPILE([
94         #include <linux/iobuf.h>
95 ],[
96         struct kiobuf iobuf;
97         iobuf.dovary = 1;
98 ],[
99         AC_MSG_RESULT([yes])
100         AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
101 ],[
102         AC_MSG_RESULT([no])
103 ])
104 ])
105
106 #
107 # LC_FUNC_COND_RESCHED
108 #
109 # cond_resched() was introduced in 2.4.20
110 #
111 AC_DEFUN([LC_FUNC_COND_RESCHED],
112 [AC_MSG_CHECKING([if kernel offers cond_resched])
113 LB_LINUX_TRY_COMPILE([
114         #include <linux/sched.h>
115 ],[
116         cond_resched();
117 ],[
118         AC_MSG_RESULT([yes])
119         AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
120 ],[
121         AC_MSG_RESULT([no])
122 ])
123 ])
124
125 #
126 # LC_FUNC_ZAP_PAGE_RANGE
127 #
128 # if zap_page_range() takes a vma arg
129 #
130 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
131 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
132 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
133 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
134         AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
135         AC_MSG_RESULT([yes])
136 else
137         AC_MSG_RESULT([no])
138 fi
139 ])
140
141 #
142 # LC_FUNC_PDE
143 #
144 # if proc_fs.h defines PDE()
145 #
146 AC_DEFUN([LC_FUNC_PDE],
147 [AC_MSG_CHECKING([if kernel defines PDE])
148 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
149 if test "$HAVE_PDE" != 0 ; then
150         AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
151         AC_MSG_RESULT([yes])
152 else
153         AC_MSG_RESULT([no])
154 fi
155 ])
156
157 #
158 # LC_FUNC_FILEMAP_FDATASYNC
159 #
160 # if filemap_fdatasync() exists
161 #
162 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
163 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
164 LB_LINUX_TRY_COMPILE([
165         #include <linux/fs.h>
166 ],[
167         int (*foo)(struct address_space *)= filemap_fdatawrite;
168 ],[
169         AC_MSG_RESULT([yes])
170         AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
171 ],[
172         AC_MSG_RESULT([no])
173 ])
174 ])
175
176 #
177 # LC_FUNC_DIRECT_IO
178 #
179 # if direct_IO takes a struct file argument
180 #
181 AC_DEFUN([LC_FUNC_DIRECT_IO],
182 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
183 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
184 if test "$HAVE_DIO_FILE" != 0 ; then
185         AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
186         AC_MSG_RESULT(yes)
187 else
188         AC_MSG_RESULT(no)
189 fi
190 ])
191
192 #
193 # LC_HEADER_MM_INLINE
194 #
195 # RHEL kernels define page_count in mm_inline.h
196 #
197 AC_DEFUN([LC_HEADER_MM_INLINE],
198 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
199 LB_LINUX_TRY_COMPILE([
200         #include <linux/mm_inline.h>
201 ],[
202         #ifndef page_count
203         #error mm_inline.h does not define page_count
204         #endif
205 ],[
206         AC_MSG_RESULT([yes])
207         AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
208 ],[
209         AC_MSG_RESULT([no])
210 ])
211 ])
212
213 #
214 # LC_STRUCT_INODE
215 #
216 # if inode->i_alloc_sem exists
217 #
218 AC_DEFUN([LC_STRUCT_INODE],
219 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
220 LB_LINUX_TRY_COMPILE([
221         #include <linux/fs.h>
222         #include <linux/version.h>
223 ],[
224         #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
225         #error "down_read_trylock broken before 2.4.24"
226         #endif
227         struct inode i;
228         return (char *)&i.i_alloc_sem - (char *)&i;
229 ],[
230         AC_MSG_RESULT([yes])
231         AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
232 ],[
233         AC_MSG_RESULT([no])
234 ])
235 ])
236
237 #
238 # LC_FUNC_REGISTER_CACHE
239 #
240 # if register_cache() is defined by kernel
241 #
242 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
243 [AC_MSG_CHECKING([if kernel defines register_cache()])
244 LB_LINUX_TRY_COMPILE([
245         #include <linux/list.h>
246         #include <linux/cache_def.h>
247 ],[
248         struct cache_definition cache;
249 ],[
250         AC_MSG_RESULT([yes])
251         AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
252         AC_MSG_CHECKING([if kernel expects return from cache shrink function])
253         HAVE_CACHE_RETURN_INT="`grep -c 'int.*shrink' $LINUX/include/linux/cache_def.h`"
254         if test "$HAVE_CACHE_RETURN_INT" != 0 ; then
255                 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [kernel expects return from shrink_cache])
256                 AC_MSG_RESULT(yes)
257         else
258                 AC_MSG_RESULT(no)
259         fi
260 ],[
261         AC_MSG_RESULT([no])
262 ])
263 ])
264
265 #
266 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
267 #
268 # check for our patched grab_cache_page_nowait_gfp() function
269 #
270 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
271 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
272 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
273 if test "$HAVE_GCPN_GFP" != 0 ; then
274         AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
275                 [kernel has grab_cache_page_nowait_gfp()])
276         AC_MSG_RESULT(yes)
277 else
278         AC_MSG_RESULT(no)
279 fi
280 ])
281
282 #
283 # LC_FUNC_DEV_SET_RDONLY
284 #
285 # check for the old-style dev_set_rdonly which took an extra "devno" param
286 # and can only set a single device to discard writes at one time
287 #
288 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
289 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
290 LB_LINUX_TRY_COMPILE([
291         #include <linux/fs.h>
292 ],[
293         #ifndef HAVE_CLEAR_RDONLY_ON_PUT
294         #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
295         #endif
296 ],[
297         AC_MSG_RESULT([yes])
298         AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
299 ],[
300         AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre 
301 kernel patches from Lustre version 1.4.3 or above.])
302 ])
303 ])
304
305 #
306 # LC_CONFIG_BACKINGFS
307 #
308 # setup, check the backing filesystem
309 #
310 AC_DEFUN([LC_CONFIG_BACKINGFS],
311 [
312 BACKINGFS="ldiskfs"
313
314 if test x$with_ldiskfs = xno ; then
315         BACKINGFS="ext3"
316
317         if test x$linux25$enable_server = xyesyes ; then
318                 AC_MSG_ERROR([ldiskfs is required for 2.6-based servers.])
319         fi
320
321         # --- Check that ext3 and ext3 xattr are enabled in the kernel
322         LC_CONFIG_EXT3([],[
323                 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
324         ],[
325                 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
326                 AC_MSG_WARN([This build may fail.])
327         ])
328 else
329         # ldiskfs is enabled
330         LB_DEFINE_LDISKFS_OPTIONS
331 fi #ldiskfs
332
333 AC_MSG_CHECKING([which backing filesystem to use])
334 AC_MSG_RESULT([$BACKINGFS])
335 AC_SUBST(BACKINGFS)
336 ])
337
338 #
339 # LC_CONFIG_PINGER
340 #
341 # the pinger is temporary, until we have the recovery node in place
342 #
343 AC_DEFUN([LC_CONFIG_PINGER],
344 [AC_MSG_CHECKING([whether to enable pinger support])
345 AC_ARG_ENABLE([pinger],
346         AC_HELP_STRING([--disable-pinger],
347                         [disable recovery pinger support]),
348         [],[enable_pinger='yes'])
349 AC_MSG_RESULT([$enable_pinger])
350 if test x$enable_pinger != xno ; then
351   AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
352 fi
353 ])
354
355 #
356 # LC_CONFIG_CHECKSUM
357 #
358 # do checksum of bulk data between client and OST
359 #
360 AC_DEFUN([LC_CONFIG_CHECKSUM],
361 [AC_MSG_CHECKING([whether to enable data checksum support])
362 AC_ARG_ENABLE([checksum],
363        AC_HELP_STRING([--disable-checksum],
364                        [disable data checksum support]),
365        [],[enable_checksum='yes'])
366 AC_MSG_RESULT([$enable_checksum])
367 if test x$enable_checksum != xno ; then
368   AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
369 fi
370 ])
371
372 #
373 # LC_CONFIG_HEALTH_CHECK_WRITE
374 #
375 # Turn off the actual write to the disk
376 #
377 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
378 [AC_MSG_CHECKING([whether to enable a write with the health check])
379 AC_ARG_ENABLE([health_write],
380         AC_HELP_STRING([--enable-health_write],
381                         [enable disk writes when doing health check]),
382         [],[enable_health_write='no'])
383 AC_MSG_RESULT([$enable_health_write])
384 if test x$enable_health_write != xno ; then
385   AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
386 fi
387 ])
388
389 #
390 # LC_CONFIG_LIBLUSTRE_RECOVERY
391 #
392 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
393 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
394 AC_ARG_ENABLE([liblustre-recovery],
395         AC_HELP_STRING([--disable-liblustre-recovery],
396                         [disable liblustre recovery support]),
397         [],[enable_liblustre_recovery='yes'])
398 AC_MSG_RESULT([$enable_liblustre_recovery])
399 if test x$enable_liblustre_recovery != xno ; then
400   AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
401 fi
402 ])
403
404 #
405 # LC_CONFIG_OBD_BUFFER_SIZE
406 #
407 # the maximum buffer size of lctl ioctls
408 #
409 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
410 [AC_MSG_CHECKING([maximum OBD ioctl size])
411 AC_ARG_WITH([obd-buffer-size],
412         AC_HELP_STRING([--with-obd-buffer-size=[size]],
413                         [set lctl ioctl maximum bytes (default=8192)]),
414         [
415                 OBD_BUFFER_SIZE=$with_obd_buffer_size
416         ],[
417                 OBD_BUFFER_SIZE=8192
418         ])
419 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
420 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
421 ])
422
423 #
424 # LC_STRUCT_STATFS
425 #
426 # AIX does not have statfs.f_namelen
427 #
428 AC_DEFUN([LC_STRUCT_STATFS],
429 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
430 LB_LINUX_TRY_COMPILE([
431         #include <linux/vfs.h>
432 ],[
433         struct statfs sfs;
434         sfs.f_namelen = 1;
435 ],[
436         AC_MSG_RESULT([yes])
437         AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
438 ],[
439         AC_MSG_RESULT([no])
440 ])
441 ])
442
443 #
444 # LC_READLINK_SSIZE_T
445 #
446 AC_DEFUN([LC_READLINK_SSIZE_T],
447 [AC_MSG_CHECKING([if readlink returns ssize_t])
448 AC_TRY_COMPILE([
449         #include <unistd.h>
450 ],[
451         ssize_t readlink(const char *, char *, size_t);
452 ],[
453         AC_MSG_RESULT([yes])
454         AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
455 ],[
456         AC_MSG_RESULT([no])
457 ])
458 ])
459
460 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
461 [AC_MSG_CHECKING([if kernel offers page_mapped])
462 LB_LINUX_TRY_COMPILE([
463         #include <linux/mm.h>
464 ],[
465         page_mapped(NULL);
466 ],[
467         AC_MSG_RESULT([yes])
468         AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
469 ],[
470         AC_MSG_RESULT([no])
471 ])
472 ])
473
474 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
475 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
476 LB_LINUX_TRY_COMPILE([
477         #include <linux/fs.h>
478 ],[
479         struct file_operations fops;
480         &fops.unlocked_ioctl;
481 ],[
482         AC_MSG_RESULT([yes])
483         AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
484 ],[
485         AC_MSG_RESULT([no])
486 ])
487 ])
488
489 AC_DEFUN([LC_FILEMAP_POPULATE],
490 [AC_MSG_CHECKING([for exported filemap_populate])
491 LB_LINUX_TRY_COMPILE([
492         #include <asm/page.h>
493         #include <linux/mm.h>
494 ],[
495        filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
496 ],[
497         AC_MSG_RESULT([yes])
498         AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
499 ],[
500         AC_MSG_RESULT([no])
501 ])
502 ])
503
504 AC_DEFUN([LC_D_ADD_UNIQUE],
505 [AC_MSG_CHECKING([for d_add_unique])
506 LB_LINUX_TRY_COMPILE([
507         #include <linux/dcache.h>
508 ],[
509        d_add_unique(NULL, NULL);
510 ],[
511         AC_MSG_RESULT([yes])
512         AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
513 ],[
514         AC_MSG_RESULT([no])
515 ])
516 ])
517
518 AC_DEFUN([LC_BIT_SPINLOCK_H],
519 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
520         AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
521         LB_LINUX_TRY_COMPILE([
522                 #include <asm/processor.h>
523                 #include <linux/spinlock.h>
524                 #include <linux/bit_spinlock.h>
525         ],[],[
526                 AC_MSG_RESULT([yes])
527                 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
528         ],[
529                 AC_MSG_RESULT([no])
530         ])
531 ],
532 [])
533 ])
534
535 #
536 # LC_POSIX_ACL_XATTR
537 #
538 # If we have xattr_acl.h 
539 #
540 AC_DEFUN([LC_XATTR_ACL],
541 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
542         AC_MSG_CHECKING([if xattr_acl.h can be compiled])
543         LB_LINUX_TRY_COMPILE([
544                 #include <linux/xattr_acl.h>
545         ],[],[
546                 AC_MSG_RESULT([yes])
547                 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
548         ],[
549                 AC_MSG_RESULT([no])
550         ])
551 ],
552 [])
553 ])
554
555 AC_DEFUN([LC_STRUCT_INTENT_FILE],
556 [AC_MSG_CHECKING([if struct open_intent has a file field])
557 LB_LINUX_TRY_COMPILE([
558         #include <linux/fs.h>
559         #include <linux/namei.h>
560 ],[
561         struct open_intent intent;
562         &intent.file;
563 ],[
564         AC_MSG_RESULT([yes])
565         AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
566 ],[
567         AC_MSG_RESULT([no])
568 ])
569 ])
570
571
572 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
573 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
574         AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
575         LB_LINUX_TRY_COMPILE([
576                 #include <linux/posix_acl_xattr.h>
577         ],[],[
578                 AC_MSG_RESULT([yes])
579                 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
580
581         ],[
582                 AC_MSG_RESULT([no])
583         ])
584 $1
585 ],[
586 AC_MSG_RESULT([no])
587 ])
588 ])
589
590 #
591 # LC_EXPORT___IGET
592 # starting from 2.6.19 linux kernel exports __iget()
593 #
594 AC_DEFUN([LC_EXPORT___IGET],
595 [LB_CHECK_SYMBOL_EXPORT([__iget],
596 [fs/inode.c],[
597         AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
598 ],[
599 ])
600 ])
601
602 #
603 # LC_EXPORT_NR_FREE_BUFFER_PAGES
604 # starting from 2.6.23 linux kernel exports nr_free_buffer_pages()
605 #
606 AC_DEFUN([LC_EXPORT_NR_FREE_BUFFER_PAGES],
607 [LB_CHECK_SYMBOL_EXPORT([nr_free_buffer_pages],
608 [mm/page_alloc.c],[
609         AC_DEFINE(HAVE_EXPORT_NR_FREE_BUFFER_PAGES, 1, [kernel exports nr_free_buffer_pages])
610 ],[
611         if test x$enable_server = xyes ; then
612                 AC_MSG_ERROR([lustre server needs this symbol to be exported.])
613         fi
614 ])
615 ])
616
617
618 AC_DEFUN([LC_LUSTRE_VERSION_H],
619 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
620         rm -f "$LUSTRE/include/linux/lustre_version.h"
621 ],[
622         touch "$LUSTRE/include/linux/lustre_version.h"
623         if test x$enable_server = xyes ; then
624                 AC_MSG_WARN([Unpatched kernel detected.])
625                 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
626                 AC_MSG_WARN([disabling server build])
627                 enable_server='no'
628         fi
629 ])
630 ])
631
632 AC_DEFUN([LC_FUNC_SET_FS_PWD],
633 [LB_CHECK_SYMBOL_EXPORT([set_fs_pwd],
634 [fs/namespace.c],[
635         AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
636 ],[
637 ])
638 ])
639
640 #
641 # LC_CAPA_CRYPTO
642 #
643 AC_DEFUN([LC_CAPA_CRYPTO],
644 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
645         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
646 ])
647 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
648         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
649 ])
650 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
651         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
652 ])
653 ])
654
655 AC_DEFUN([LC_SUNRPC_CACHE],
656 [AC_MSG_CHECKING([if sunrpc struct cache_head uses kref])
657 LB_LINUX_TRY_COMPILE([
658         #include <linux/sunrpc/cache.h>
659 ],[
660         struct cache_head ch;
661         &ch.ref.refcount;
662 ],[
663         AC_MSG_RESULT([yes])
664         AC_DEFINE(HAVE_SUNRPC_CACHE_V2, 1, [sunrpc cache facility v2])
665 ],[
666         AC_MSG_RESULT([no])
667 ])
668 ])
669
670 AC_DEFUN([LC_CONFIG_SUNRPC],
671 [LB_LINUX_CONFIG_IM([SUNRPC],[],
672                     [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
673  LC_SUNRPC_CACHE
674 ])
675
676 #
677 # LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
678 #
679 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
680 [AC_MSG_CHECKING([whether to enable gss keyring backend])
681  AC_ARG_ENABLE([gss_keyring], 
682                [AC_HELP_STRING([--disable-gss-keyring],
683                                [disable gss keyring backend])],
684                [],[enable_gss_keyring='yes'])
685  AC_MSG_RESULT([$enable_gss_keyring])
686
687  if test x$enable_gss_keyring != xno; then
688         LB_LINUX_CONFIG_IM([KEYS],[],
689                            [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
690
691         AC_CHECK_LIB([keyutils], [keyctl_search], [],
692                      [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
693
694         AC_DEFINE([HAVE_GSS_KEYRING], [1],
695                   [Define this if you enable gss keyring backend])
696  fi
697 ])
698
699 m4_pattern_allow(AC_KERBEROS_V5)
700
701 #
702 # LC_CONFIG_GSS (default disabled)
703 #
704 # Build gss and related tools of Lustre. Currently both kernel and user space
705 # parts are depend on linux platform.
706 #
707 AC_DEFUN([LC_CONFIG_GSS],
708 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
709  AC_ARG_ENABLE([gss], 
710                [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
711                [],[enable_gss='no'])
712  AC_MSG_RESULT([$enable_gss])
713
714  if test x$enable_gss == xyes; then
715         LC_CONFIG_GSS_KEYRING
716         LC_CONFIG_SUNRPC
717
718         LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
719                            [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
720         LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
721                            [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
722         LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
723                            [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
724         LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
725                            [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
726         LB_LINUX_CONFIG_IM([CRYPTO_WP512],[],
727                            [AC_MSG_WARN([kernel WP512 support is recommended by using GSS.])])
728         LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],
729                            [AC_MSG_WARN([kernel ARC4 support is recommended by using GSS.])])
730         LB_LINUX_CONFIG_IM([CRYPTO_DES],[],
731                            [AC_MSG_WARN([kernel DES support is recommended by using GSS.])])
732         LB_LINUX_CONFIG_IM([CRYPTO_TWOFISH],[],
733                            [AC_MSG_WARN([kernel TWOFISH support is recommended by using GSS.])])
734         LB_LINUX_CONFIG_IM([CRYPTO_CAST6],[],
735                            [AC_MSG_WARN([kernel CAST6 support is recommended by using GSS.])])
736         dnl FIXME
737         dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
738         dnl FIXME
739         LB_LINUX_CONFIG_IM([CRYPTO_AES],[],
740                            [AC_MSG_WARN([kernel AES support is recommended by using GSS.])])
741
742         AC_CHECK_LIB([gssapi], [gss_init_sec_context],
743                      [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
744                      [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
745                                    [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
746                                    [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
747
748         AC_SUBST(GSSAPI_LIBS)
749
750         AC_KERBEROS_V5
751  fi
752 ])
753
754 # LC_FUNC_MS_FLOCK_LOCK
755 #
756 # SLES9 kernel has MS_FLOCK_LOCK sb flag
757 #
758 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
759 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
760 LB_LINUX_TRY_COMPILE([
761         #include <linux/fs.h>
762 ],[
763         int flags = MS_FLOCK_LOCK;
764 ],[
765         AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
766                 [kernel has MS_FLOCK_LOCK flag])
767         AC_MSG_RESULT([yes])
768 ],[
769         AC_MSG_RESULT([no])
770 ])
771 ])
772
773 #
774 # LC_FUNC_HAVE_CAN_SLEEP_ARG
775 #
776 # SLES9 kernel has third arg can_sleep
777 # in fs/locks.c: flock_lock_file_wait()
778 #
779 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
780 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
781 LB_LINUX_TRY_COMPILE([
782         #include <linux/fs.h>
783 ],[
784         int cansleep;
785         struct file *file;
786         struct file_lock *file_lock;
787         flock_lock_file_wait(file, file_lock, cansleep);
788 ],[
789         AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
790                 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
791         AC_MSG_RESULT([yes])
792 ],[
793         AC_MSG_RESULT([no])
794 ])
795 ])
796
797 #
798 # LC_FUNC_F_OP_FLOCK
799 #
800 # rhel4.2 kernel has f_op->flock field
801 #
802 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
803 [AC_MSG_CHECKING([if struct file_operations has flock field])
804 LB_LINUX_TRY_COMPILE([
805         #include <linux/fs.h>
806 ],[
807         struct file_operations ll_file_operations_flock;
808         ll_file_operations_flock.flock = NULL;
809 ],[
810         AC_DEFINE(HAVE_F_OP_FLOCK, 1,
811                 [struct file_operations has flock field])
812         AC_MSG_RESULT([yes])
813 ],[
814         AC_MSG_RESULT([no])
815 ])
816 ])
817
818 #
819 # LC_TASK_PPTR
820 #
821 # task struct has p_pptr instead of parent
822 #
823 AC_DEFUN([LC_TASK_PPTR],
824 [AC_MSG_CHECKING([task p_pptr found])
825 LB_LINUX_TRY_COMPILE([
826         #include <linux/sched.h>
827 ],[
828         struct task_struct *p;
829         
830         p = p->p_pptr;
831 ],[
832         AC_MSG_RESULT([yes])
833         AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
834 ],[
835         AC_MSG_RESULT([no])
836 ])
837 ])
838
839 #
840 # LC_FUNC_F_OP_FLOCK
841 #
842 # rhel4.2 kernel has f_op->flock field
843 #
844 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
845 [AC_MSG_CHECKING([if struct file_operations has flock field])
846 LB_LINUX_TRY_COMPILE([
847         #include <linux/fs.h>
848 ],[
849         struct file_operations ll_file_operations_flock;
850         ll_file_operations_flock.flock = NULL;
851 ],[
852         AC_DEFINE(HAVE_F_OP_FLOCK, 1,
853                 [struct file_operations has flock field])
854         AC_MSG_RESULT([yes])
855 ],[
856         AC_MSG_RESULT([no])
857 ])
858 ])
859
860 # LC_INODE_I_MUTEX
861 # after 2.6.15 inode have i_mutex intead of i_sem
862 AC_DEFUN([LC_INODE_I_MUTEX],
863 [AC_MSG_CHECKING([use inode have i_mutex ])
864 LB_LINUX_TRY_COMPILE([
865         #include <linux/mutex.h>
866         #include <linux/fs.h>
867         #undef i_mutex
868 ],[
869         struct inode i;
870
871         mutex_unlock(&i.i_mutex);
872 ],[
873         AC_MSG_RESULT(yes)
874         AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
875                 [after 2.6.15 inode have i_mutex intead of i_sem])
876 ],[
877         AC_MSG_RESULT(NO)
878 ])
879 ])
880
881 # LC_DQUOTOFF_MUTEX
882 # after 2.6.17 dquote use mutex instead if semaphore
883 AC_DEFUN([LC_DQUOTOFF_MUTEX],
884 [AC_MSG_CHECKING([use dqonoff_mutex])
885 LB_LINUX_TRY_COMPILE([
886         #include <linux/mutex.h>
887         #include <linux/fs.h>
888         #include <linux/quota.h>
889 ],[
890         struct quota_info dq;
891
892         mutex_unlock(&dq.dqonoff_mutex);
893 ],[
894         AC_MSG_RESULT(yes)
895         AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
896                 [after 2.6.17 dquote use mutex instead if semaphore])
897 ],[
898         AC_MSG_RESULT(NO)
899 ])
900 ])
901  
902 #
903 # LC_STATFS_DENTRY_PARAM
904 # starting from 2.6.18 linux kernel uses dentry instead of
905 # super_block for first vfs_statfs argument
906 #
907 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
908 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
909 LB_LINUX_TRY_COMPILE([
910         #include <linux/fs.h>
911 ],[
912         int vfs_statfs(struct dentry *, struct kstatfs *);
913 ],[
914         AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
915                 [first parameter of vfs_statfs is dentry])
916         AC_MSG_RESULT([yes])
917 ],[
918         AC_MSG_RESULT([no])
919 ])
920 ])
921
922 #
923 # LC_VFS_KERN_MOUNT
924 # starting from 2.6.18 kernel don't export do_kern_mount
925 # and want to use vfs_kern_mount instead.
926 #
927 AC_DEFUN([LC_VFS_KERN_MOUNT],
928 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
929 LB_LINUX_TRY_COMPILE([
930         #include <linux/mount.h>
931 ],[
932         vfs_kern_mount(NULL, 0, NULL, NULL);
933 ],[
934         AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
935                 [vfs_kern_mount exist in kernel])
936         AC_MSG_RESULT([yes])
937 ],[
938         AC_MSG_RESULT([no])
939 ])
940 ])
941
942
943 # LC_INVALIDATEPAGE_RETURN_INT
944 # more 2.6 api changes.  return type for the invalidatepage
945 # address_space_operation is 'void' in new kernels but 'int' in old
946 #
947 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
948 [AC_MSG_CHECKING([invalidatepage has return int])
949 LB_LINUX_TRY_COMPILE([
950         #include <linux/buffer_head.h>
951 ],[
952         int rc = block_invalidatepage(NULL, 0);
953 ],[
954         AC_MSG_RESULT(yes)
955         AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
956                 [Define if return type of invalidatepage should be int])
957 ],[
958         AC_MSG_RESULT(NO)
959 ])
960 ])
961
962 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
963 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
964 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
965 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
966 tmp_flags="$EXTRA_KCFLAGS"
967 EXTRA_KCFLAGS="-Werror"
968 LB_LINUX_TRY_COMPILE([
969         #include <linux/fs.h>
970
971         struct vfsmount;
972         static void cfg_umount_begin (struct vfsmount *v, int flags)
973         {
974                 ;
975         }
976
977         static struct super_operations cfg_super_operations = {
978                 .umount_begin   = cfg_umount_begin,
979         };
980 ],[
981         cfg_super_operations.umount_begin(NULL,0);
982 ],[
983         AC_MSG_RESULT(yes)
984         AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
985                 [Define umount_begin need second argument])
986 ],[
987         AC_MSG_RESULT(NO)
988 ])
989 EXTRA_KCFLAGS="$tmp_flags"
990 ])
991
992 # 2.6.19 API changes
993 # inode don't have i_blksize field
994 AC_DEFUN([LC_INODE_BLKSIZE],
995 [AC_MSG_CHECKING([inode has i_blksize field])
996 LB_LINUX_TRY_COMPILE([
997 #include <linux/fs.h>
998 ],[
999         struct inode i;
1000         i.i_blksize = 0; 
1001 ],[
1002         AC_MSG_RESULT(yes)
1003         AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1004                 [struct inode has i_blksize field])
1005 ],[
1006         AC_MSG_RESULT(NO)
1007 ])
1008 ])
1009
1010 # LC_VFS_READDIR_U64_INO
1011 # 2.6.19 use u64 for inode number instead of inode_t
1012 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1013 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1014 tmp_flags="$EXTRA_KCFLAGS"
1015 EXTRA_KCFLAGS="-Werror"
1016 LB_LINUX_TRY_COMPILE([
1017 #include <linux/fs.h>
1018         int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1019                       u64 ino, unsigned int d_type)
1020         {
1021                 return 0;
1022         }
1023 ],[
1024         filldir_t filter;
1025
1026         filter = fillonedir;
1027         return 1;
1028 ],[
1029         AC_MSG_RESULT(yes)
1030         AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1031                 [if vfs_readdir need 64bit inode number])
1032 ],[
1033         AC_MSG_RESULT(NO)
1034 ])
1035 EXTRA_KCFLAGS="$tmp_flags"
1036 ])
1037
1038 # LC_GENERIC_FILE_WRITE
1039 # 2.6.19 introduce do_sync_write instead of
1040 # generic_file_write
1041 AC_DEFUN([LC_GENERIC_FILE_WRITE],
1042 [AC_MSG_CHECKING([use generic_file_write])
1043 LB_LINUX_TRY_COMPILE([
1044         #include <linux/fs.h>
1045 ],[
1046         int result = generic_file_read(NULL, NULL, 0, 0);
1047 ],[
1048         AC_MSG_RESULT(yes)
1049         AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1050                 [use generic_file_write])
1051 ],[
1052         AC_MSG_RESULT(NO)
1053 ])
1054 ])
1055
1056 # LC_GENERIC_FILE_READ
1057 # 2.6.19 need to use do_sync_read instead of
1058 # generic_file_read
1059 AC_DEFUN([LC_GENERIC_FILE_READ],
1060 [AC_MSG_CHECKING([use generic_file_read])
1061 LB_LINUX_TRY_COMPILE([
1062         #include <linux/fs.h>
1063 ],[
1064         int result = generic_file_read(NULL, NULL, 0, 0);
1065 ],[
1066         AC_MSG_RESULT(yes)
1067         AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
1068                 [use generic_file_read])
1069 ],[
1070         AC_MSG_RESULT(NO)
1071 ])
1072 ])
1073
1074 # LC_NR_PAGECACHE
1075 # 2.6.18 don't export nr_pagecahe
1076 AC_DEFUN([LC_NR_PAGECACHE],
1077 [AC_MSG_CHECKING([kernel export nr_pagecache])
1078 LB_LINUX_TRY_COMPILE([
1079         #include <linux/pagemap.h>
1080 ],[
1081         return atomic_read(&nr_pagecache);
1082 ],[
1083         AC_MSG_RESULT(yes)
1084         AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1085                 [is kernel export nr_pagecache])
1086 ],[
1087         AC_MSG_RESULT(NO)
1088 ])
1089 ])
1090
1091 # LC_CANCEL_DIRTY_PAGE
1092 # 2.6.20 introduse cancel_dirty_page instead of 
1093 # clear_page_dirty.
1094 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1095 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1096 LB_LINUX_TRY_COMPILE([
1097         #include <linux/page-flags.h>
1098 ],[
1099         cancel_dirty_page(NULL, 0);
1100 ],[
1101         AC_MSG_RESULT(yes)
1102         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1103                   [kernel has cancel_dirty_page instead of clear_page_dirty])
1104 ],[
1105         AC_MSG_RESULT(NO)
1106 ])
1107 ])
1108
1109 #
1110 # LC_PAGE_CONSTANT
1111 #
1112 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1113 # it support constant page, which means the page won't be modified during the
1114 # IO.
1115 #
1116 AC_DEFUN([LC_PAGE_CONSTANT],
1117 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1118 LB_LINUX_TRY_COMPILE([
1119         #include <linux/page-flags.h>
1120 ],[
1121         #ifndef PG_constant
1122         #error "Have no raid5 zcopy patch"
1123         #endif
1124 ],[
1125         AC_MSG_RESULT(yes)
1126         AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1127 ],[
1128         AC_MSG_RESULT(no);
1129 ])
1130 ])
1131
1132 # RHEL5 in FS-cache patch rename PG_checked flag
1133 # into PG_fs_misc
1134 AC_DEFUN([LC_PG_FS_MISC],
1135 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1136 LB_LINUX_TRY_COMPILE([
1137         #include <linux/page-flags.h>
1138 ],[
1139         #ifndef PG_fs_misc
1140         #error PG_fs_misc not defined in kernel
1141         #endif
1142 ],[
1143         AC_MSG_RESULT(yes)
1144         AC_DEFINE(HAVE_PG_FS_MISC, 1,
1145                   [is kernel have PG_fs_misc])
1146 ],[
1147         AC_MSG_RESULT(NO)
1148 ])
1149 ])
1150
1151 # RHEL5 PageChecked and SetPageChecked defined
1152 AC_DEFUN([LC_PAGE_CHECKED],
1153 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1154 LB_LINUX_TRY_COMPILE([
1155         #include <linux/page-flags.h>
1156 ],[
1157         #ifndef PageChecked
1158         #error PageChecked not defined in kernel
1159         #endif
1160         #ifndef SetPageChecked
1161         #error SetPageChecked not defined in kernel
1162         #endif
1163 ],[
1164         AC_MSG_RESULT(yes)
1165         AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1166                   [does kernel have PageChecked and SetPageChecked])
1167 ],[
1168         AC_MSG_RESULT(NO)
1169 ])
1170 ])
1171
1172 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1173 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1174 [mm/truncate.c],[
1175 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1176             [kernel export truncate_complete_page])
1177 ],[
1178 ])
1179 ])
1180
1181 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1182 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1183 [fs/dcache.c],[
1184 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1185             [d_rehash_cond is exported by the kernel])
1186 ],[
1187 ])
1188 ])
1189
1190 AC_DEFUN([LC_EXPORT___D_REHASH],
1191 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1192 [fs/dcache.c],[
1193 AC_DEFINE(HAVE___D_REHASH, 1,
1194             [__d_rehash is exported by the kernel])
1195 ],[
1196 ])
1197 ])
1198
1199 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1200 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1201 [fs/dcache.c],[
1202 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1203             [d_move_locked is exported by the kernel])
1204 ],[
1205 ])
1206 ])
1207
1208 AC_DEFUN([LC_EXPORT___D_MOVE],
1209 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1210 [fs/dcache.c],[
1211 AC_DEFINE(HAVE___D_MOVE, 1,
1212             [__d_move is exported by the kernel])
1213 ],[
1214 ])
1215 ])
1216
1217 # The actual symbol exported varies among architectures, so we need
1218 # to check many symbols (but only in the current architecture.)  No
1219 # matter what symbol is exported, the kernel #defines node_to_cpumask
1220 # to the appropriate function and that's what we use.
1221 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1222          [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1223                                  [arch/$LINUX_ARCH/mm/numa.c],
1224                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1225                                             [node_to_cpumask is exported by
1226                                              the kernel])]) # x86_64
1227           LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1228                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
1229                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1230                                             [node_to_cpumask is exported by
1231                                              the kernel])]) # ia64
1232           LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1233                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
1234                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1235                                             [node_to_cpumask is exported by
1236                                              the kernel])]) # i386
1237           ])
1238
1239 # 2.6.22 lost second parameter for invalidate_bdev
1240 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1241 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1242 LB_LINUX_TRY_COMPILE([
1243         #include <linux/buffer_head.h>
1244 ],[
1245         invalidate_bdev(NULL,0);
1246 ],[
1247         AC_MSG_RESULT([yes])
1248         AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1249                 [invalidate_bdev has second argument])
1250 ],[
1251         AC_MSG_RESULT([no])
1252 ])
1253 ])
1254
1255 # 2.6.23 have return type 'void' for unregister_blkdev
1256 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1257 [AC_MSG_CHECKING([if unregister_blkdev return int])
1258 LB_LINUX_TRY_COMPILE([
1259         #include <linux/fs.h>
1260 ],[
1261         int i = unregister_blkdev(0,NULL);
1262 ],[
1263         AC_MSG_RESULT([yes])
1264         AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1, 
1265                 [unregister_blkdev return int])
1266 ],[
1267         AC_MSG_RESULT([no])
1268 ])
1269 ])
1270
1271 # 2.6.23 change .sendfile to .splice_read
1272 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1273 [AC_MSG_CHECKING([if kernel has .splice_read])
1274 LB_LINUX_TRY_COMPILE([
1275         #include <linux/fs.h>
1276 ],[
1277         struct file_operations file;
1278
1279         file.splice_read = NULL;
1280 ], [
1281         AC_MSG_RESULT([yes])
1282         AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1283                 [kernel has .slice_read])
1284 ],[
1285         AC_MSG_RESULT([no])
1286 ])
1287 ])
1288
1289 # 2.6.23 extract nfs export related data into exportfs.h
1290 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1291 [
1292 tmpfl="$CFLAGS"
1293 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1294 AC_CHECK_HEADERS([linux/exportfs.h])
1295 CFLAGS="$tmpfl"
1296 ])
1297
1298 #
1299 # LC_VFS_INTENT_PATCHES
1300 #
1301 # check if the kernel has the VFS intent patches
1302 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1303 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1304 LB_LINUX_TRY_COMPILE([
1305         #include <linux/fs.h>
1306         #include <linux/namei.h>
1307 ],[
1308         struct nameidata nd;
1309         struct lookup_intent *it;
1310
1311         it = &nd.intent;
1312         intent_init(it, IT_OPEN);
1313         it->d.lustre.it_disposition = 0;
1314         it->d.lustre.it_data = NULL;
1315 ],[
1316         AC_MSG_RESULT([yes])
1317         AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1318 ],[
1319         AC_MSG_RESULT([no])
1320 ])
1321 ])
1322
1323 AC_DEFUN([LC_S_TIME_GRAN],
1324 [AC_MSG_CHECKING([if super block has s_time_gran member])
1325 LB_LINUX_TRY_COMPILE([
1326         #include <linux/fs.h>
1327 ],[
1328         struct super_block sb;
1329
1330         return sb.s_time_gran;
1331 ],[
1332         AC_MSG_RESULT([yes])
1333         AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1334 ],[
1335         AC_MSG_RESULT([no])
1336 ])
1337 ])
1338
1339 AC_DEFUN([LC_SB_TIME_GRAN],
1340 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1341 LB_LINUX_TRY_COMPILE([
1342         #include <linux/fs.h>
1343 ],[
1344         return get_sb_time_gran(NULL);
1345 ],[
1346         AC_MSG_RESULT([yes])
1347         AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1348 ],[
1349         AC_MSG_RESULT([no])
1350 ])
1351 ])
1352
1353
1354 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1355 AC_DEFUN([LC_RW_TREE_LOCK],
1356 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1357 tmp_flags="$EXTRA_KCFLAGS"
1358 EXTRA_KCFLAGS="-Werror"
1359 LB_LINUX_TRY_COMPILE([
1360         #include <linux/fs.h>
1361 ],[
1362         struct address_space a;
1363
1364         write_lock(&a.tree_lock);
1365 ],[
1366         AC_MSG_RESULT([yes])
1367         AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1368 ],[
1369         AC_MSG_RESULT([no])
1370 ])
1371 EXTRA_KCFLAGS="$tmp_flags"
1372 ])
1373
1374 AC_DEFUN([LC_CONST_ACL_SIZE],
1375 [AC_MSG_CHECKING([calc acl size])
1376 tmp_flags="$CFLAGS"
1377 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1378 AC_TRY_RUN([
1379 #define __KERNEL__
1380 #include <linux/autoconf.h>
1381 #include <linux/types.h>
1382 #undef __KERNEL__
1383 // block include 
1384 #define __LINUX_POSIX_ACL_H
1385
1386 # ifdef CONFIG_FS_POSIX_ACL
1387 #  ifdef HAVE_XATTR_ACL
1388 #   include <linux/xattr_acl.h>
1389 #  endif
1390 #  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1391 #   include <linux/posix_acl_xattr.h>
1392 #  endif
1393 # endif
1394
1395 #include <linux/lustre_acl.h>
1396
1397 #include <stdio.h>
1398
1399 int main(void)
1400 {
1401     int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1402     FILE *f = fopen("acl.size","w+");
1403     fprintf(f,"%d", size);
1404     fclose(f);
1405
1406     return 0;
1407 }
1408
1409 ],[
1410         acl_size=`cat acl.size`
1411         AC_MSG_RESULT([ACL size $acl_size])
1412         AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1413 ],[
1414         AC_ERROR([ACL size can't computed])
1415 ])
1416 CFLAGS="$tmp_flags"
1417 ])
1418
1419 #
1420 # check for crypto API 
1421 #
1422 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1423 [AC_MSG_CHECKING([if kernel has block cipher support])
1424 LB_LINUX_TRY_COMPILE([
1425         #include <linux/crypto.h>
1426 ],[
1427         int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1428 ],[
1429         AC_MSG_RESULT([yes])
1430         AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1431 ],[
1432         AC_MSG_RESULT([no])
1433 ])
1434 ])
1435
1436 #
1437 # check for FS_RENAME_DOES_D_MOVE flag
1438 #
1439 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1440 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1441 LB_LINUX_TRY_COMPILE([
1442         #include <linux/fs.h>
1443 ],[
1444         int v = FS_RENAME_DOES_D_MOVE;
1445 ],[
1446         AC_MSG_RESULT([yes])
1447         AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1448 ],[
1449         AC_MSG_RESULT([no])
1450 ])
1451 ])
1452
1453 #
1454 # LC_PROG_LINUX
1455 #
1456 # Lustre linux kernel checks
1457 #
1458 AC_DEFUN([LC_PROG_LINUX],
1459          [LC_LUSTRE_VERSION_H
1460          if test x$enable_server = xyes ; then
1461              AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1462              LC_CONFIG_BACKINGFS
1463          fi
1464          LC_CONFIG_PINGER
1465          LC_CONFIG_CHECKSUM
1466          LC_CONFIG_LIBLUSTRE_RECOVERY
1467          LC_CONFIG_QUOTA
1468          LC_CONFIG_HEALTH_CHECK_WRITE
1469          LC_CONFIG_LRU_RESIZE
1470
1471          LC_TASK_PPTR
1472          # RHEL4 patches
1473          LC_EXPORT_TRUNCATE_COMPLETE
1474          LC_EXPORT_D_REHASH_COND
1475          LC_EXPORT___D_REHASH
1476          LC_EXPORT_D_MOVE_LOCKED
1477          LC_EXPORT___D_MOVE
1478          LC_EXPORT_NODE_TO_CPUMASK
1479
1480          LC_STRUCT_KIOBUF
1481          LC_FUNC_COND_RESCHED
1482          LC_FUNC_ZAP_PAGE_RANGE
1483          LC_FUNC_PDE
1484          LC_FUNC_DIRECT_IO
1485          LC_HEADER_MM_INLINE
1486          LC_STRUCT_INODE
1487          LC_FUNC_REGISTER_CACHE
1488          LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1489          LC_FUNC_DEV_SET_RDONLY
1490          LC_FUNC_FILEMAP_FDATAWRITE
1491          LC_STRUCT_STATFS
1492          LC_FUNC_PAGE_MAPPED
1493          LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1494          LC_FILEMAP_POPULATE
1495          LC_D_ADD_UNIQUE
1496          LC_BIT_SPINLOCK_H
1497
1498          LC_XATTR_ACL
1499          LC_POSIX_ACL_XATTR_H
1500          LC_CONST_ACL_SIZE
1501
1502          LC_STRUCT_INTENT_FILE
1503
1504          LC_FUNC_SET_FS_PWD
1505          LC_CAPA_CRYPTO
1506          LC_CONFIG_GSS
1507          LC_FUNC_MS_FLOCK_LOCK
1508          LC_FUNC_HAVE_CAN_SLEEP_ARG
1509          LC_FUNC_F_OP_FLOCK
1510          LC_QUOTA_READ
1511          LC_COOKIE_FOLLOW_LINK
1512          LC_FUNC_RCU
1513
1514          # does the kernel have VFS intent patches?
1515          LC_VFS_INTENT_PATCHES
1516
1517          # ~2.6.11
1518          LC_S_TIME_GRAN
1519          LC_SB_TIME_GRAN
1520
1521          # 2.6.12
1522          LC_RW_TREE_LOCK
1523
1524          # 2.6.15
1525          LC_INODE_I_MUTEX
1526
1527          # 2.6.17
1528          LC_DQUOTOFF_MUTEX
1529
1530          # 2.6.18
1531          LC_NR_PAGECACHE
1532          LC_STATFS_DENTRY_PARAM
1533          LC_VFS_KERN_MOUNT
1534          LC_INVALIDATEPAGE_RETURN_INT
1535          LC_UMOUNTBEGIN_HAS_VFSMOUNT
1536
1537          #2.6.18 + RHEL5 (fc6)
1538          LC_PG_FS_MISC
1539          LC_PAGE_CHECKED
1540
1541          # 2.6.19
1542          LC_INODE_BLKSIZE
1543          LC_VFS_READDIR_U64_INO
1544          LC_GENERIC_FILE_READ
1545          LC_GENERIC_FILE_WRITE
1546
1547          # 2.6.20
1548          LC_CANCEL_DIRTY_PAGE
1549
1550          # raid5-zerocopy patch
1551          LC_PAGE_CONSTANT
1552                   
1553          # 2.6.22
1554          LC_INVALIDATE_BDEV_2ARG
1555          LC_ASYNC_BLOCK_CIPHER
1556          LC_FS_RENAME_DOES_D_MOVE
1557          # 2.6.23
1558          LC_UNREGISTER_BLKDEV_RETURN_INT
1559          LC_KERNEL_SPLICE_READ
1560          LC_HAVE_EXPORTFS_H
1561          LC_EXPORT_NR_FREE_BUFFER_PAGES
1562 ])
1563
1564 #
1565 # LC_CONFIG_CLIENT_SERVER
1566 #
1567 # Build client/server sides of Lustre
1568 #
1569 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1570 [AC_MSG_CHECKING([whether to build Lustre server support])
1571 AC_ARG_ENABLE([server],
1572         AC_HELP_STRING([--disable-server],
1573                         [disable Lustre server support]),
1574         [],[enable_server='yes'])
1575 AC_MSG_RESULT([$enable_server])
1576
1577 AC_MSG_CHECKING([whether to build Lustre client support])
1578 AC_ARG_ENABLE([client],
1579         AC_HELP_STRING([--disable-client],
1580                         [disable Lustre client support]),
1581         [],[enable_client='yes'])
1582 AC_MSG_RESULT([$enable_client])])
1583
1584 #
1585 # LC_CONFIG_LIBLUSTRE
1586 #
1587 # whether to build liblustre
1588 #
1589 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1590 [AC_MSG_CHECKING([whether to build Lustre library])
1591 AC_ARG_ENABLE([liblustre],
1592         AC_HELP_STRING([--disable-liblustre],
1593                         [disable building of Lustre library]),
1594         [],[enable_liblustre=$with_sysio])
1595 AC_MSG_RESULT([$enable_liblustre])
1596 # only build sysio if liblustre is built
1597 with_sysio="$enable_liblustre"
1598
1599 AC_MSG_CHECKING([whether to build liblustre tests])
1600 AC_ARG_ENABLE([liblustre-tests],
1601         AC_HELP_STRING([--enable-liblustre-tests],
1602                         [enable liblustre tests, if --disable-tests is used]),
1603         [],[enable_liblustre_tests=$enable_tests])
1604 if test x$enable_liblustre != xyes ; then
1605    enable_liblustre_tests='no'
1606 fi
1607 AC_MSG_RESULT([$enable_liblustre_tests])
1608
1609 AC_MSG_CHECKING([whether to enable liblustre acl])
1610 AC_ARG_ENABLE([liblustre-acl],
1611         AC_HELP_STRING([--disable-liblustre-acl],
1612                         [disable ACL support for liblustre]),
1613         [],[enable_liblustre_acl=yes])
1614 AC_MSG_RESULT([$enable_liblustre_acl])
1615 if test x$enable_liblustre_acl = xyes ; then
1616   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1617 fi
1618
1619 AC_MSG_CHECKING([whether to build mpitests])
1620 AC_ARG_ENABLE([mpitests],
1621         AC_HELP_STRING([--enable-mpitests],
1622                         [build liblustre mpi tests]),
1623         [],[enable_mpitests=no])
1624 AC_MSG_RESULT([$enable_mpitests])
1625
1626 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1627 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1628
1629 LC_CONFIG_PINGER
1630 LC_CONFIG_LIBLUSTRE_RECOVERY
1631 ])
1632
1633 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1634 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1635 AC_ARG_ENABLE([lru_resize], 
1636         AC_HELP_STRING([--enable-lru-resize],
1637                         [enable lru resize support]),
1638         [],[enable_lru_resize='yes'])
1639 AC_MSG_RESULT([$enable_lru_resize])
1640 if test x$enable_lru_resize != xno; then
1641    AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1642 fi
1643 ])
1644
1645 #
1646 # LC_CONFIG_QUOTA
1647 #
1648 # whether to enable quota support
1649 #
1650 AC_DEFUN([LC_CONFIG_QUOTA],
1651 [AC_MSG_CHECKING([whether to disable quota support])
1652 AC_ARG_ENABLE([quota], 
1653         AC_HELP_STRING([--disable-quota],
1654                         [disable quota support]),
1655         [],[enable_quota='yes'])
1656 AC_MSG_RESULT([$enable_quota])
1657 if test x$linux25 != xyes; then
1658    enable_quota='no'
1659 fi
1660 if test x$enable_quota != xno; then
1661    AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1662 fi
1663 ])
1664  
1665 #
1666 # LC_CONFIG_SPLIT
1667 #
1668 # whether to enable split support
1669 #
1670 AC_DEFUN([LC_CONFIG_SPLIT],
1671 [AC_MSG_CHECKING([whether to enable split support])
1672 AC_ARG_ENABLE([split], 
1673         AC_HELP_STRING([--enable-split],
1674                         [enable split support]),
1675         [],[enable_split='no'])
1676 AC_MSG_RESULT([$enable_split])
1677 if test x$enable_split != xno; then
1678    AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1679 fi
1680 ])
1681  
1682 AC_DEFUN([LC_QUOTA_READ],
1683 [AC_MSG_CHECKING([if kernel supports quota_read])
1684 LB_LINUX_TRY_COMPILE([
1685         #include <linux/fs.h>
1686 ],[
1687         struct super_operations sp;
1688         void *i = (void *)sp.quota_read;
1689 ],[
1690         AC_MSG_RESULT([yes])
1691         AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1692 ],[
1693         AC_MSG_RESULT([no])
1694 ])
1695 ])
1696
1697 #
1698 # LC_COOKIE_FOLLOW_LINK
1699 #
1700 # kernel 2.6.13+ ->follow_link returns a cookie
1701 #
1702
1703 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1704 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1705 LB_LINUX_TRY_COMPILE([
1706         #include <linux/fs.h>
1707         #include <linux/namei.h>
1708 ],[
1709         struct dentry dentry;
1710         struct nameidata nd;
1711
1712         dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1713 ],[
1714         AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1715         AC_MSG_RESULT([yes])
1716 ],[
1717         AC_MSG_RESULT([no])
1718 ])
1719 ])
1720
1721 #
1722 # LC_FUNC_RCU
1723 #
1724 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE), 
1725 # call_rcu takes three parameters.
1726 #
1727 AC_DEFUN([LC_FUNC_RCU],
1728 [AC_MSG_CHECKING([if kernel have RCU supported])
1729 LB_LINUX_TRY_COMPILE([
1730         #include <linux/rcupdate.h>
1731 ],[],[
1732         AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1733         AC_MSG_RESULT([yes])
1734
1735         AC_MSG_CHECKING([if call_rcu takes three parameters])
1736         LB_LINUX_TRY_COMPILE([
1737                 #include <linux/rcupdate.h>
1738         ],[
1739                 struct rcu_head rh;
1740                 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1741         ],[
1742                 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1743                 AC_MSG_RESULT([yes])
1744         ],[
1745                 AC_MSG_RESULT([no]) 
1746         ])
1747 ],[
1748         AC_MSG_RESULT([no])
1749 ])
1750 ])
1751
1752 #
1753 # LC_CONFIGURE
1754 #
1755 # other configure checks
1756 #
1757 AC_DEFUN([LC_CONFIGURE],
1758 [LC_CONFIG_OBD_BUFFER_SIZE
1759
1760 # include/liblustre.h
1761 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1762
1763 # include/lustre/lustre_user.h
1764 # See note there re: __ASM_X86_64_PROCESSOR_H
1765 AC_CHECK_HEADERS([linux/fs.h linux/quota.h])
1766
1767 # liblustre/llite_lib.h
1768 AC_CHECK_HEADERS([xtio.h file.h])
1769
1770 # liblustre/dir.c
1771 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1772
1773 # liblustre/lutil.c
1774 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1775 AC_CHECK_FUNCS([inet_ntoa])
1776
1777 # libsysio/src/readlink.c
1778 LC_READLINK_SSIZE_T
1779
1780 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1781 AC_CHECK_HEADERS([linux/random.h], [], [],
1782                  [#ifdef HAVE_LINUX_TYPES_H
1783                   # include <linux/types.h>
1784                   #endif
1785                  ])
1786
1787 # utils/llverfs.c
1788 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1789
1790 # check for -lz support
1791 ZLIB=""
1792 AC_CHECK_LIB([z],
1793              [adler32],
1794              [AC_CHECK_HEADERS([zlib.h],
1795                                [ZLIB="-lz"
1796                                 AC_DEFINE([HAVE_ADLER], 1,
1797                                           [support alder32 checksum type])],
1798                                [AC_MSG_WARN([No zlib-devel package found,
1799                                              unable to use adler32 checksum])])],
1800              [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1801 )
1802 AC_SUBST(ZLIB)
1803
1804 # Super safe df
1805 AC_ARG_ENABLE([mindf],
1806       AC_HELP_STRING([--enable-mindf],
1807                       [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1808       [],[])
1809 if test "$enable_mindf" = "yes" ;  then
1810       AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1811 fi
1812
1813 AC_ARG_ENABLE([fail_alloc],
1814         AC_HELP_STRING([--disable-fail-alloc],
1815                 [disable randomly alloc failure]),
1816         [],[enable_fail_alloc=yes])
1817 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1818 AC_MSG_RESULT([$enable_fail_alloc])
1819 if test x$enable_fail_alloc != xno ; then
1820         AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1821 fi
1822
1823 ])
1824
1825 #
1826 # LC_CONDITIONALS
1827 #
1828 # AM_CONDITIONALS for lustre
1829 #
1830 AC_DEFUN([LC_CONDITIONALS],
1831 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1832 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1833 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1834 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1835 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1836 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1837 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1838 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1839 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1840 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1841 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1842 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1843 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1844 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1845 ])
1846
1847 #
1848 # LC_CONFIG_FILES
1849 #
1850 # files that should be generated with AC_OUTPUT
1851 #
1852 AC_DEFUN([LC_CONFIG_FILES],
1853 [AC_CONFIG_FILES([
1854 lustre/Makefile
1855 lustre/autoMakefile
1856 lustre/autoconf/Makefile
1857 lustre/contrib/Makefile
1858 lustre/doc/Makefile
1859 lustre/include/Makefile
1860 lustre/include/lustre_ver.h
1861 lustre/include/linux/Makefile
1862 lustre/include/lustre/Makefile
1863 lustre/kernel_patches/targets/2.6-vanilla.target
1864 lustre/kernel_patches/targets/2.6-rhel4.target
1865 lustre/kernel_patches/targets/2.6-rhel5.target
1866 lustre/kernel_patches/targets/2.6-fc5.target
1867 lustre/kernel_patches/targets/2.6-patchless.target
1868 lustre/kernel_patches/targets/2.6-sles10.target
1869 lustre/ldlm/Makefile
1870 lustre/fid/Makefile
1871 lustre/fid/autoMakefile
1872 lustre/liblustre/Makefile
1873 lustre/liblustre/tests/Makefile
1874 lustre/llite/Makefile
1875 lustre/llite/autoMakefile
1876 lustre/lov/Makefile
1877 lustre/lov/autoMakefile
1878 lustre/lvfs/Makefile
1879 lustre/lvfs/autoMakefile
1880 lustre/mdc/Makefile
1881 lustre/mdc/autoMakefile
1882 lustre/lmv/Makefile
1883 lustre/lmv/autoMakefile
1884 lustre/mds/Makefile
1885 lustre/mds/autoMakefile
1886 lustre/mdt/Makefile
1887 lustre/mdt/autoMakefile
1888 lustre/cmm/Makefile
1889 lustre/cmm/autoMakefile
1890 lustre/mdd/Makefile
1891 lustre/mdd/autoMakefile
1892 lustre/fld/Makefile
1893 lustre/fld/autoMakefile
1894 lustre/obdclass/Makefile
1895 lustre/obdclass/autoMakefile
1896 lustre/obdclass/linux/Makefile
1897 lustre/obdecho/Makefile
1898 lustre/obdecho/autoMakefile
1899 lustre/obdfilter/Makefile
1900 lustre/obdfilter/autoMakefile
1901 lustre/osc/Makefile
1902 lustre/osc/autoMakefile
1903 lustre/ost/Makefile
1904 lustre/ost/autoMakefile
1905 lustre/osd/Makefile
1906 lustre/osd/autoMakefile
1907 lustre/mgc/Makefile
1908 lustre/mgc/autoMakefile
1909 lustre/mgs/Makefile
1910 lustre/mgs/autoMakefile
1911 lustre/ptlrpc/Makefile
1912 lustre/ptlrpc/autoMakefile
1913 lustre/ptlrpc/gss/Makefile
1914 lustre/ptlrpc/gss/autoMakefile
1915 lustre/quota/Makefile
1916 lustre/quota/autoMakefile
1917 lustre/scripts/Makefile
1918 lustre/scripts/version_tag.pl
1919 lustre/tests/Makefile
1920 lustre/utils/Makefile
1921 lustre/utils/gss/Makefile
1922 ])
1923 case $lb_target_os in
1924         darwin)
1925                 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])
1926                 ;;
1927 esac
1928
1929 ])