Whamcloud - gitweb
493a35a36f354640caa29934554c5d7802103dd9
[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_SYMVERFILE
882 # SLES 9 uses a different name for this file - unsure about vanilla kernels
883 # around this version, but it matters for servers only.
884 AC_DEFUN([LC_SYMVERFILE],
885          [AC_MSG_CHECKING([name of symverfile])
886           if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost ; then
887               SYMVERFILE=Modules.symvers
888           else
889               SYMVERFILE=Module.symvers
890           fi
891           AC_MSG_RESULT($SYMVERFILE)
892           AC_SUBST(SYMVERFILE)])
893
894 # LC_DQUOTOFF_MUTEX
895 # after 2.6.17 dquote use mutex instead if semaphore
896 AC_DEFUN([LC_DQUOTOFF_MUTEX],
897 [AC_MSG_CHECKING([use dqonoff_mutex])
898 LB_LINUX_TRY_COMPILE([
899         #include <linux/mutex.h>
900         #include <linux/fs.h>
901         #include <linux/quota.h>
902 ],[
903         struct quota_info dq;
904
905         mutex_unlock(&dq.dqonoff_mutex);
906 ],[
907         AC_MSG_RESULT(yes)
908         AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
909                 [after 2.6.17 dquote use mutex instead if semaphore])
910 ],[
911         AC_MSG_RESULT(NO)
912 ])
913 ])
914  
915 #
916 # LC_STATFS_DENTRY_PARAM
917 # starting from 2.6.18 linux kernel uses dentry instead of
918 # super_block for first vfs_statfs argument
919 #
920 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
921 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
922 LB_LINUX_TRY_COMPILE([
923         #include <linux/fs.h>
924 ],[
925         int vfs_statfs(struct dentry *, struct kstatfs *);
926 ],[
927         AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
928                 [first parameter of vfs_statfs is dentry])
929         AC_MSG_RESULT([yes])
930 ],[
931         AC_MSG_RESULT([no])
932 ])
933 ])
934
935 #
936 # LC_VFS_KERN_MOUNT
937 # starting from 2.6.18 kernel don't export do_kern_mount
938 # and want to use vfs_kern_mount instead.
939 #
940 AC_DEFUN([LC_VFS_KERN_MOUNT],
941 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
942 LB_LINUX_TRY_COMPILE([
943         #include <linux/mount.h>
944 ],[
945         vfs_kern_mount(NULL, 0, NULL, NULL);
946 ],[
947         AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
948                 [vfs_kern_mount exist in kernel])
949         AC_MSG_RESULT([yes])
950 ],[
951         AC_MSG_RESULT([no])
952 ])
953 ])
954
955
956 # LC_INVALIDATEPAGE_RETURN_INT
957 # more 2.6 api changes.  return type for the invalidatepage
958 # address_space_operation is 'void' in new kernels but 'int' in old
959 #
960 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
961 [AC_MSG_CHECKING([invalidatepage has return int])
962 LB_LINUX_TRY_COMPILE([
963         #include <linux/buffer_head.h>
964 ],[
965         int rc = block_invalidatepage(NULL, 0);
966 ],[
967         AC_MSG_RESULT(yes)
968         AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
969                 [Define if return type of invalidatepage should be int])
970 ],[
971         AC_MSG_RESULT(NO)
972 ])
973 ])
974
975 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
976 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
977 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
978 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
979 tmp_flags="$EXTRA_KCFLAGS"
980 EXTRA_KCFLAGS="-Werror"
981 LB_LINUX_TRY_COMPILE([
982         #include <linux/fs.h>
983
984         struct vfsmount;
985         static void cfg_umount_begin (struct vfsmount *v, int flags)
986         {
987                 ;
988         }
989
990         static struct super_operations cfg_super_operations = {
991                 .umount_begin   = cfg_umount_begin,
992         };
993 ],[
994         cfg_super_operations.umount_begin(NULL,0);
995 ],[
996         AC_MSG_RESULT(yes)
997         AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
998                 [Define umount_begin need second argument])
999 ],[
1000         AC_MSG_RESULT(NO)
1001 ])
1002 EXTRA_KCFLAGS="$tmp_flags"
1003 ])
1004
1005 # 2.6.19 API changes
1006 # inode don't have i_blksize field
1007 AC_DEFUN([LC_INODE_BLKSIZE],
1008 [AC_MSG_CHECKING([inode has i_blksize field])
1009 LB_LINUX_TRY_COMPILE([
1010 #include <linux/fs.h>
1011 ],[
1012         struct inode i;
1013         i.i_blksize = 0; 
1014 ],[
1015         AC_MSG_RESULT(yes)
1016         AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
1017                 [struct inode has i_blksize field])
1018 ],[
1019         AC_MSG_RESULT(NO)
1020 ])
1021 ])
1022
1023 # LC_VFS_READDIR_U64_INO
1024 # 2.6.19 use u64 for inode number instead of inode_t
1025 AC_DEFUN([LC_VFS_READDIR_U64_INO],
1026 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
1027 tmp_flags="$EXTRA_KCFLAGS"
1028 EXTRA_KCFLAGS="-Werror"
1029 LB_LINUX_TRY_COMPILE([
1030 #include <linux/fs.h>
1031         int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
1032                       u64 ino, unsigned int d_type)
1033         {
1034                 return 0;
1035         }
1036 ],[
1037         filldir_t filter;
1038
1039         filter = fillonedir;
1040         return 1;
1041 ],[
1042         AC_MSG_RESULT(yes)
1043         AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
1044                 [if vfs_readdir need 64bit inode number])
1045 ],[
1046         AC_MSG_RESULT(NO)
1047 ])
1048 EXTRA_KCFLAGS="$tmp_flags"
1049 ])
1050
1051 # LC_GENERIC_FILE_WRITE
1052 # 2.6.19 introduce do_sync_write instead of
1053 # generic_file_write
1054 AC_DEFUN([LC_GENERIC_FILE_WRITE],
1055 [AC_MSG_CHECKING([use generic_file_write])
1056 LB_LINUX_TRY_COMPILE([
1057         #include <linux/fs.h>
1058 ],[
1059         int result = generic_file_read(NULL, NULL, 0, 0);
1060 ],[
1061         AC_MSG_RESULT(yes)
1062         AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1063                 [use generic_file_write])
1064 ],[
1065         AC_MSG_RESULT(NO)
1066 ])
1067 ])
1068
1069 # LC_GENERIC_FILE_READ
1070 # 2.6.19 need to use do_sync_read instead of
1071 # generic_file_read
1072 AC_DEFUN([LC_GENERIC_FILE_READ],
1073 [AC_MSG_CHECKING([use generic_file_read])
1074 LB_LINUX_TRY_COMPILE([
1075         #include <linux/fs.h>
1076 ],[
1077         int result = generic_file_read(NULL, NULL, 0, 0);
1078 ],[
1079         AC_MSG_RESULT(yes)
1080         AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
1081                 [use generic_file_read])
1082 ],[
1083         AC_MSG_RESULT(NO)
1084 ])
1085 ])
1086
1087 # LC_NR_PAGECACHE
1088 # 2.6.18 don't export nr_pagecahe
1089 AC_DEFUN([LC_NR_PAGECACHE],
1090 [AC_MSG_CHECKING([kernel export nr_pagecache])
1091 LB_LINUX_TRY_COMPILE([
1092         #include <linux/pagemap.h>
1093 ],[
1094         return atomic_read(&nr_pagecache);
1095 ],[
1096         AC_MSG_RESULT(yes)
1097         AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1098                 [is kernel export nr_pagecache])
1099 ],[
1100         AC_MSG_RESULT(NO)
1101 ])
1102 ])
1103
1104 # LC_CANCEL_DIRTY_PAGE
1105 # 2.6.20 introduse cancel_dirty_page instead of 
1106 # clear_page_dirty.
1107 AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
1108 [AC_MSG_CHECKING([kernel has cancel_dirty_page])
1109 LB_LINUX_TRY_COMPILE([
1110         #include <linux/page-flags.h>
1111 ],[
1112         cancel_dirty_page(NULL, 0);
1113 ],[
1114         AC_MSG_RESULT(yes)
1115         AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1116                   [kernel has cancel_dirty_page instead of clear_page_dirty])
1117 ],[
1118         AC_MSG_RESULT(NO)
1119 ])
1120 ])
1121
1122 #
1123 # LC_PAGE_CONSTANT
1124 #
1125 # In order to support raid5 zerocopy patch, we have to patch the kernel to make
1126 # it support constant page, which means the page won't be modified during the
1127 # IO.
1128 #
1129 AC_DEFUN([LC_PAGE_CONSTANT],
1130 [AC_MSG_CHECKING([if kernel have PageConstant defined])
1131 LB_LINUX_TRY_COMPILE([
1132         #include <linux/page-flags.h>
1133 ],[
1134         #ifndef PG_constant
1135         #error "Have no raid5 zcopy patch"
1136         #endif
1137 ],[
1138         AC_MSG_RESULT(yes)
1139         AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
1140 ],[
1141         AC_MSG_RESULT(no);
1142 ])
1143 ])
1144
1145 # RHEL5 in FS-cache patch rename PG_checked flag
1146 # into PG_fs_misc
1147 AC_DEFUN([LC_PG_FS_MISC],
1148 [AC_MSG_CHECKING([kernel has PG_fs_misc])
1149 LB_LINUX_TRY_COMPILE([
1150         #include <linux/page-flags.h>
1151 ],[
1152         #ifndef PG_fs_misc
1153         #error PG_fs_misc not defined in kernel
1154         #endif
1155 ],[
1156         AC_MSG_RESULT(yes)
1157         AC_DEFINE(HAVE_PG_FS_MISC, 1,
1158                   [is kernel have PG_fs_misc])
1159 ],[
1160         AC_MSG_RESULT(NO)
1161 ])
1162 ])
1163
1164 # RHEL5 PageChecked and SetPageChecked defined
1165 AC_DEFUN([LC_PAGE_CHECKED],
1166 [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
1167 LB_LINUX_TRY_COMPILE([
1168         #include <linux/page-flags.h>
1169 ],[
1170         #ifndef PageChecked
1171         #error PageChecked not defined in kernel
1172         #endif
1173         #ifndef SetPageChecked
1174         #error SetPageChecked not defined in kernel
1175         #endif
1176 ],[
1177         AC_MSG_RESULT(yes)
1178         AC_DEFINE(HAVE_PAGE_CHECKED, 1,
1179                   [does kernel have PageChecked and SetPageChecked])
1180 ],[
1181         AC_MSG_RESULT(NO)
1182 ])
1183 ])
1184
1185 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
1186 [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
1187 [mm/truncate.c],[
1188 AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
1189             [kernel export truncate_complete_page])
1190 ],[
1191 ])
1192 ])
1193
1194 AC_DEFUN([LC_EXPORT_D_REHASH_COND],
1195 [LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
1196 [fs/dcache.c],[
1197 AC_DEFINE(HAVE_D_REHASH_COND, 1,
1198             [d_rehash_cond is exported by the kernel])
1199 ],[
1200 ])
1201 ])
1202
1203 AC_DEFUN([LC_EXPORT___D_REHASH],
1204 [LB_CHECK_SYMBOL_EXPORT([__d_rehash],
1205 [fs/dcache.c],[
1206 AC_DEFINE(HAVE___D_REHASH, 1,
1207             [__d_rehash is exported by the kernel])
1208 ],[
1209 ])
1210 ])
1211
1212 AC_DEFUN([LC_EXPORT_D_MOVE_LOCKED],
1213 [LB_CHECK_SYMBOL_EXPORT([d_move_locked],
1214 [fs/dcache.c],[
1215 AC_DEFINE(HAVE_D_MOVE_LOCKED, 1,
1216             [d_move_locked is exported by the kernel])
1217 ],[
1218 ])
1219 ])
1220
1221 AC_DEFUN([LC_EXPORT___D_MOVE],
1222 [LB_CHECK_SYMBOL_EXPORT([__d_move],
1223 [fs/dcache.c],[
1224 AC_DEFINE(HAVE___D_MOVE, 1,
1225             [__d_move is exported by the kernel])
1226 ],[
1227 ])
1228 ])
1229
1230 # The actual symbol exported varies among architectures, so we need
1231 # to check many symbols (but only in the current architecture.)  No
1232 # matter what symbol is exported, the kernel #defines node_to_cpumask
1233 # to the appropriate function and that's what we use.
1234 AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
1235          [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
1236                                  [arch/$LINUX_ARCH/mm/numa.c],
1237                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1238                                             [node_to_cpumask is exported by
1239                                              the kernel])]) # x86_64
1240           LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
1241                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
1242                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1243                                             [node_to_cpumask is exported by
1244                                              the kernel])]) # ia64
1245           LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
1246                                  [arch/$LINUX_ARCH/kernel/smpboot.c],
1247                                  [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
1248                                             [node_to_cpumask is exported by
1249                                              the kernel])]) # i386
1250           ])
1251
1252 # 2.6.22 lost second parameter for invalidate_bdev
1253 AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
1254 [AC_MSG_CHECKING([if invalidate_bdev has second argument])
1255 LB_LINUX_TRY_COMPILE([
1256         #include <linux/buffer_head.h>
1257 ],[
1258         invalidate_bdev(NULL,0);
1259 ],[
1260         AC_MSG_RESULT([yes])
1261         AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
1262                 [invalidate_bdev has second argument])
1263 ],[
1264         AC_MSG_RESULT([no])
1265 ])
1266 ])
1267
1268 # 2.6.23 have return type 'void' for unregister_blkdev
1269 AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
1270 [AC_MSG_CHECKING([if unregister_blkdev return int])
1271 LB_LINUX_TRY_COMPILE([
1272         #include <linux/fs.h>
1273 ],[
1274         int i = unregister_blkdev(0,NULL);
1275 ],[
1276         AC_MSG_RESULT([yes])
1277         AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1, 
1278                 [unregister_blkdev return int])
1279 ],[
1280         AC_MSG_RESULT([no])
1281 ])
1282 ])
1283
1284 # 2.6.23 change .sendfile to .splice_read
1285 AC_DEFUN([LC_KERNEL_SPLICE_READ],
1286 [AC_MSG_CHECKING([if kernel has .splice_read])
1287 LB_LINUX_TRY_COMPILE([
1288         #include <linux/fs.h>
1289 ],[
1290         struct file_operations file;
1291
1292         file.splice_read = NULL;
1293 ], [
1294         AC_MSG_RESULT([yes])
1295         AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
1296                 [kernel has .slice_read])
1297 ],[
1298         AC_MSG_RESULT([no])
1299 ])
1300 ])
1301
1302 # 2.6.23 extract nfs export related data into exportfs.h
1303 AC_DEFUN([LC_HAVE_EXPORTFS_H],
1304 [
1305 tmpfl="$CFLAGS"
1306 CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
1307 AC_CHECK_HEADERS([linux/exportfs.h])
1308 CFLAGS="$tmpfl"
1309 ])
1310
1311 #
1312 # LC_VFS_INTENT_PATCHES
1313 #
1314 # check if the kernel has the VFS intent patches
1315 AC_DEFUN([LC_VFS_INTENT_PATCHES],
1316 [AC_MSG_CHECKING([if the kernel has the VFS intent patches])
1317 LB_LINUX_TRY_COMPILE([
1318         #include <linux/fs.h>
1319         #include <linux/namei.h>
1320 ],[
1321         struct nameidata nd;
1322         struct lookup_intent *it;
1323
1324         it = &nd.intent;
1325         intent_init(it, IT_OPEN);
1326         it->d.lustre.it_disposition = 0;
1327         it->d.lustre.it_data = NULL;
1328 ],[
1329         AC_MSG_RESULT([yes])
1330         AC_DEFINE(HAVE_VFS_INTENT_PATCHES, 1, [VFS intent patches are applied])
1331 ],[
1332         AC_MSG_RESULT([no])
1333 ])
1334 ])
1335
1336 AC_DEFUN([LC_S_TIME_GRAN],
1337 [AC_MSG_CHECKING([if super block has s_time_gran member])
1338 LB_LINUX_TRY_COMPILE([
1339         #include <linux/fs.h>
1340 ],[
1341         struct super_block sb;
1342
1343         return sb.s_time_gran;
1344 ],[
1345         AC_MSG_RESULT([yes])
1346         AC_DEFINE(HAVE_S_TIME_GRAN, 1, [super block has s_time_gran member])
1347 ],[
1348         AC_MSG_RESULT([no])
1349 ])
1350 ])
1351
1352 AC_DEFUN([LC_SB_TIME_GRAN],
1353 [AC_MSG_CHECKING([if kernel has old get_sb_time_gran])
1354 LB_LINUX_TRY_COMPILE([
1355         #include <linux/fs.h>
1356 ],[
1357         return get_sb_time_gran(NULL);
1358 ],[
1359         AC_MSG_RESULT([yes])
1360         AC_DEFINE(HAVE_SB_TIME_GRAN, 1, [kernel has old get_sb_time_gran])
1361 ],[
1362         AC_MSG_RESULT([no])
1363 ])
1364 ])
1365
1366
1367 # ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
1368 AC_DEFUN([LC_RW_TREE_LOCK],
1369 [AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
1370 tmp_flags="$EXTRA_KCFLAGS"
1371 EXTRA_KCFLAGS="-Werror"
1372 LB_LINUX_TRY_COMPILE([
1373         #include <linux/fs.h>
1374 ],[
1375         struct address_space a;
1376
1377         write_lock(&a.tree_lock);
1378 ],[
1379         AC_MSG_RESULT([yes])
1380         AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
1381 ],[
1382         AC_MSG_RESULT([no])
1383 ])
1384 EXTRA_KCFLAGS="$tmp_flags"
1385 ])
1386
1387 AC_DEFUN([LC_CONST_ACL_SIZE],
1388 [AC_MSG_CHECKING([calc acl size])
1389 tmp_flags="$CFLAGS"
1390 CFLAGS="$CFLAGS -I $LINUX_OBJ/include $EXTRA_KCFLAGS"
1391 AC_TRY_RUN([
1392 #define __KERNEL__
1393 #include <linux/autoconf.h>
1394 #include <linux/types.h>
1395 #undef __KERNEL__
1396 // block include 
1397 #define __LINUX_POSIX_ACL_H
1398
1399 # ifdef CONFIG_FS_POSIX_ACL
1400 #  ifdef HAVE_XATTR_ACL
1401 #   include <linux/xattr_acl.h>
1402 #  endif
1403 #  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
1404 #   include <linux/posix_acl_xattr.h>
1405 #  endif
1406 # endif
1407
1408 #include <linux/lustre_acl.h>
1409
1410 #include <stdio.h>
1411
1412 int main(void)
1413 {
1414     int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
1415     FILE *f = fopen("acl.size","w+");
1416     fprintf(f,"%d", size);
1417     fclose(f);
1418
1419     return 0;
1420 }
1421
1422 ],[
1423         acl_size=`cat acl.size`
1424         AC_MSG_RESULT([ACL size $acl_size])
1425         AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
1426 ],[
1427         AC_ERROR([ACL size can't computed])
1428 ])
1429 CFLAGS="$tmp_flags"
1430 ])
1431
1432 #
1433 # check for crypto API 
1434 #
1435 AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
1436 [AC_MSG_CHECKING([if kernel has block cipher support])
1437 LB_LINUX_TRY_COMPILE([
1438         #include <linux/crypto.h>
1439 ],[
1440         int v = CRYPTO_ALG_TYPE_BLKCIPHER;
1441 ],[
1442         AC_MSG_RESULT([yes])
1443         AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
1444 ],[
1445         AC_MSG_RESULT([no])
1446 ])
1447 ])
1448
1449 #
1450 # check for FS_RENAME_DOES_D_MOVE flag
1451 #
1452 AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
1453 [AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
1454 LB_LINUX_TRY_COMPILE([
1455         #include <linux/fs.h>
1456 ],[
1457         int v = FS_RENAME_DOES_D_MOVE;
1458 ],[
1459         AC_MSG_RESULT([yes])
1460         AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
1461 ],[
1462         AC_MSG_RESULT([no])
1463 ])
1464 ])
1465
1466 #
1467 # LC_PROG_LINUX
1468 #
1469 # Lustre linux kernel checks
1470 #
1471 AC_DEFUN([LC_PROG_LINUX],
1472          [LC_LUSTRE_VERSION_H
1473          if test x$enable_server = xyes ; then
1474              AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
1475              LC_CONFIG_BACKINGFS
1476          fi
1477          LC_CONFIG_PINGER
1478          LC_CONFIG_CHECKSUM
1479          LC_CONFIG_LIBLUSTRE_RECOVERY
1480          LC_CONFIG_QUOTA
1481          LC_CONFIG_HEALTH_CHECK_WRITE
1482          LC_CONFIG_LRU_RESIZE
1483
1484          LC_TASK_PPTR
1485          # RHEL4 patches
1486          LC_EXPORT_TRUNCATE_COMPLETE
1487          LC_EXPORT_D_REHASH_COND
1488          LC_EXPORT___D_REHASH
1489          LC_EXPORT_D_MOVE_LOCKED
1490          LC_EXPORT___D_MOVE
1491          LC_EXPORT_NODE_TO_CPUMASK
1492
1493          LC_STRUCT_KIOBUF
1494          LC_FUNC_COND_RESCHED
1495          LC_FUNC_ZAP_PAGE_RANGE
1496          LC_FUNC_PDE
1497          LC_FUNC_DIRECT_IO
1498          LC_HEADER_MM_INLINE
1499          LC_STRUCT_INODE
1500          LC_FUNC_REGISTER_CACHE
1501          LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1502          LC_FUNC_DEV_SET_RDONLY
1503          LC_FUNC_FILEMAP_FDATAWRITE
1504          LC_STRUCT_STATFS
1505          LC_FUNC_PAGE_MAPPED
1506          LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1507          LC_FILEMAP_POPULATE
1508          LC_D_ADD_UNIQUE
1509          LC_BIT_SPINLOCK_H
1510
1511          LC_XATTR_ACL
1512          LC_POSIX_ACL_XATTR_H
1513          LC_CONST_ACL_SIZE
1514
1515          LC_STRUCT_INTENT_FILE
1516
1517          LC_FUNC_SET_FS_PWD
1518          LC_CAPA_CRYPTO
1519          LC_CONFIG_GSS
1520          LC_FUNC_MS_FLOCK_LOCK
1521          LC_FUNC_HAVE_CAN_SLEEP_ARG
1522          LC_FUNC_F_OP_FLOCK
1523          LC_QUOTA_READ
1524          LC_COOKIE_FOLLOW_LINK
1525          LC_FUNC_RCU
1526
1527          # does the kernel have VFS intent patches?
1528          LC_VFS_INTENT_PATCHES
1529
1530          # ~2.6.11
1531          LC_S_TIME_GRAN
1532          LC_SB_TIME_GRAN
1533
1534          # 2.6.12
1535          LC_RW_TREE_LOCK
1536
1537          # 2.6.15
1538          LC_INODE_I_MUTEX
1539
1540           # SLES 10 (at least)
1541           LC_SYMVERFILE
1542
1543          # 2.6.17
1544          LC_DQUOTOFF_MUTEX
1545
1546          # 2.6.18
1547          LC_NR_PAGECACHE
1548          LC_STATFS_DENTRY_PARAM
1549          LC_VFS_KERN_MOUNT
1550          LC_INVALIDATEPAGE_RETURN_INT
1551          LC_UMOUNTBEGIN_HAS_VFSMOUNT
1552
1553          #2.6.18 + RHEL5 (fc6)
1554          LC_PG_FS_MISC
1555          LC_PAGE_CHECKED
1556
1557          # 2.6.19
1558          LC_INODE_BLKSIZE
1559          LC_VFS_READDIR_U64_INO
1560          LC_GENERIC_FILE_READ
1561          LC_GENERIC_FILE_WRITE
1562
1563          # 2.6.20
1564          LC_CANCEL_DIRTY_PAGE
1565
1566          # raid5-zerocopy patch
1567          LC_PAGE_CONSTANT
1568                   
1569          # 2.6.22
1570          LC_INVALIDATE_BDEV_2ARG
1571          LC_ASYNC_BLOCK_CIPHER
1572          LC_FS_RENAME_DOES_D_MOVE
1573          # 2.6.23
1574          LC_UNREGISTER_BLKDEV_RETURN_INT
1575          LC_KERNEL_SPLICE_READ
1576          LC_HAVE_EXPORTFS_H
1577          LC_EXPORT_NR_FREE_BUFFER_PAGES
1578 ])
1579
1580 #
1581 # LC_CONFIG_CLIENT_SERVER
1582 #
1583 # Build client/server sides of Lustre
1584 #
1585 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1586 [AC_MSG_CHECKING([whether to build Lustre server support])
1587 AC_ARG_ENABLE([server],
1588         AC_HELP_STRING([--disable-server],
1589                         [disable Lustre server support]),
1590         [],[enable_server='yes'])
1591 AC_MSG_RESULT([$enable_server])
1592
1593 AC_MSG_CHECKING([whether to build Lustre client support])
1594 AC_ARG_ENABLE([client],
1595         AC_HELP_STRING([--disable-client],
1596                         [disable Lustre client support]),
1597         [],[enable_client='yes'])
1598 AC_MSG_RESULT([$enable_client])])
1599
1600 #
1601 # LC_CONFIG_LIBLUSTRE
1602 #
1603 # whether to build liblustre
1604 #
1605 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1606 [AC_MSG_CHECKING([whether to build Lustre library])
1607 AC_ARG_ENABLE([liblustre],
1608         AC_HELP_STRING([--disable-liblustre],
1609                         [disable building of Lustre library]),
1610         [],[enable_liblustre=$with_sysio])
1611 AC_MSG_RESULT([$enable_liblustre])
1612 # only build sysio if liblustre is built
1613 with_sysio="$enable_liblustre"
1614
1615 AC_MSG_CHECKING([whether to build liblustre tests])
1616 AC_ARG_ENABLE([liblustre-tests],
1617         AC_HELP_STRING([--enable-liblustre-tests],
1618                         [enable liblustre tests, if --disable-tests is used]),
1619         [],[enable_liblustre_tests=$enable_tests])
1620 if test x$enable_liblustre != xyes ; then
1621    enable_liblustre_tests='no'
1622 fi
1623 AC_MSG_RESULT([$enable_liblustre_tests])
1624
1625 AC_MSG_CHECKING([whether to enable liblustre acl])
1626 AC_ARG_ENABLE([liblustre-acl],
1627         AC_HELP_STRING([--disable-liblustre-acl],
1628                         [disable ACL support for liblustre]),
1629         [],[enable_liblustre_acl=yes])
1630 AC_MSG_RESULT([$enable_liblustre_acl])
1631 if test x$enable_liblustre_acl = xyes ; then
1632   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1633 fi
1634
1635 AC_MSG_CHECKING([whether to build mpitests])
1636 AC_ARG_ENABLE([mpitests],
1637         AC_HELP_STRING([--enable-mpitests],
1638                         [build liblustre mpi tests]),
1639         [],[enable_mpitests=no])
1640 AC_MSG_RESULT([$enable_mpitests])
1641
1642 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1643 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1644
1645 LC_CONFIG_PINGER
1646 LC_CONFIG_LIBLUSTRE_RECOVERY
1647 ])
1648
1649 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
1650 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
1651 AC_ARG_ENABLE([lru_resize], 
1652         AC_HELP_STRING([--enable-lru-resize],
1653                         [enable lru resize support]),
1654         [],[enable_lru_resize='yes'])
1655 AC_MSG_RESULT([$enable_lru_resize])
1656 if test x$enable_lru_resize != xno; then
1657    AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
1658 fi
1659 ])
1660
1661 #
1662 # LC_CONFIG_QUOTA
1663 #
1664 # whether to enable quota support
1665 #
1666 AC_DEFUN([LC_CONFIG_QUOTA],
1667 [AC_MSG_CHECKING([whether to disable quota support])
1668 AC_ARG_ENABLE([quota], 
1669         AC_HELP_STRING([--disable-quota],
1670                         [disable quota support]),
1671         [],[enable_quota='yes'])
1672 AC_MSG_RESULT([$enable_quota])
1673 if test x$linux25 != xyes; then
1674    enable_quota='no'
1675 fi
1676 if test x$enable_quota != xno; then
1677    AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1678 fi
1679 ])
1680  
1681 #
1682 # LC_CONFIG_SPLIT
1683 #
1684 # whether to enable split support
1685 #
1686 AC_DEFUN([LC_CONFIG_SPLIT],
1687 [AC_MSG_CHECKING([whether to enable split support])
1688 AC_ARG_ENABLE([split], 
1689         AC_HELP_STRING([--enable-split],
1690                         [enable split support]),
1691         [],[enable_split='no'])
1692 AC_MSG_RESULT([$enable_split])
1693 if test x$enable_split != xno; then
1694    AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1695 fi
1696 ])
1697  
1698 AC_DEFUN([LC_QUOTA_READ],
1699 [AC_MSG_CHECKING([if kernel supports quota_read])
1700 LB_LINUX_TRY_COMPILE([
1701         #include <linux/fs.h>
1702 ],[
1703         struct super_operations sp;
1704         void *i = (void *)sp.quota_read;
1705 ],[
1706         AC_MSG_RESULT([yes])
1707         AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1708 ],[
1709         AC_MSG_RESULT([no])
1710 ])
1711 ])
1712
1713 #
1714 # LC_COOKIE_FOLLOW_LINK
1715 #
1716 # kernel 2.6.13+ ->follow_link returns a cookie
1717 #
1718
1719 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1720 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1721 LB_LINUX_TRY_COMPILE([
1722         #include <linux/fs.h>
1723         #include <linux/namei.h>
1724 ],[
1725         struct dentry dentry;
1726         struct nameidata nd;
1727
1728         dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1729 ],[
1730         AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1731         AC_MSG_RESULT([yes])
1732 ],[
1733         AC_MSG_RESULT([no])
1734 ])
1735 ])
1736
1737 #
1738 # LC_FUNC_RCU
1739 #
1740 # kernels prior than 2.6.0(?) have no RCU supported; in kernel 2.6.5(SUSE), 
1741 # call_rcu takes three parameters.
1742 #
1743 AC_DEFUN([LC_FUNC_RCU],
1744 [AC_MSG_CHECKING([if kernel have RCU supported])
1745 LB_LINUX_TRY_COMPILE([
1746         #include <linux/rcupdate.h>
1747 ],[],[
1748         AC_DEFINE(HAVE_RCU, 1, [have RCU defined])
1749         AC_MSG_RESULT([yes])
1750
1751         AC_MSG_CHECKING([if call_rcu takes three parameters])
1752         LB_LINUX_TRY_COMPILE([
1753                 #include <linux/rcupdate.h>
1754         ],[
1755                 struct rcu_head rh;
1756                 call_rcu(&rh, (void (*)(struct rcu_head *))1, NULL);
1757         ],[
1758                 AC_DEFINE(HAVE_CALL_RCU_PARAM, 1, [call_rcu takes three parameters])
1759                 AC_MSG_RESULT([yes])
1760         ],[
1761                 AC_MSG_RESULT([no]) 
1762         ])
1763 ],[
1764         AC_MSG_RESULT([no])
1765 ])
1766 ])
1767
1768 #
1769 # LC_CONFIGURE
1770 #
1771 # other configure checks
1772 #
1773 AC_DEFUN([LC_CONFIGURE],
1774 [LC_CONFIG_OBD_BUFFER_SIZE
1775
1776 # include/liblustre.h
1777 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1778
1779 # include/lustre/lustre_user.h
1780 # See note there re: __ASM_X86_64_PROCESSOR_H
1781 AC_CHECK_HEADERS([linux/fs.h linux/quota.h])
1782
1783 # liblustre/llite_lib.h
1784 AC_CHECK_HEADERS([xtio.h file.h])
1785
1786 # liblustre/dir.c
1787 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1788
1789 # liblustre/lutil.c
1790 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1791 AC_CHECK_FUNCS([inet_ntoa])
1792
1793 # libsysio/src/readlink.c
1794 LC_READLINK_SSIZE_T
1795
1796 # lvfs/prng.c - depends on linux/types.h from liblustre/dir.c
1797 AC_CHECK_HEADERS([linux/random.h], [], [],
1798                  [#ifdef HAVE_LINUX_TYPES_H
1799                   # include <linux/types.h>
1800                   #endif
1801                  ])
1802
1803 # utils/llverfs.c
1804 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1805
1806 # check for -lz support
1807 ZLIB=""
1808 AC_CHECK_LIB([z],
1809              [adler32],
1810              [AC_CHECK_HEADERS([zlib.h],
1811                                [ZLIB="-lz"
1812                                 AC_DEFINE([HAVE_ADLER], 1,
1813                                           [support alder32 checksum type])],
1814                                [AC_MSG_WARN([No zlib-devel package found,
1815                                              unable to use adler32 checksum])])],
1816              [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1817 )
1818 AC_SUBST(ZLIB)
1819
1820 # Super safe df
1821 AC_ARG_ENABLE([mindf],
1822       AC_HELP_STRING([--enable-mindf],
1823                       [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1824       [],[])
1825 if test "$enable_mindf" = "yes" ;  then
1826       AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1827 fi
1828
1829 AC_ARG_ENABLE([fail_alloc],
1830         AC_HELP_STRING([--disable-fail-alloc],
1831                 [disable randomly alloc failure]),
1832         [],[enable_fail_alloc=yes])
1833 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1834 AC_MSG_RESULT([$enable_fail_alloc])
1835 if test x$enable_fail_alloc != xno ; then
1836         AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1837 fi
1838
1839 ])
1840
1841 #
1842 # LC_CONDITIONALS
1843 #
1844 # AM_CONDITIONALS for lustre
1845 #
1846 AC_DEFUN([LC_CONDITIONALS],
1847 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1848 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1849 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1850 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1851 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1852 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1853 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1854 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1855 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1856 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1857 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1858 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1859 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1860 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1861 ])
1862
1863 #
1864 # LC_CONFIG_FILES
1865 #
1866 # files that should be generated with AC_OUTPUT
1867 #
1868 AC_DEFUN([LC_CONFIG_FILES],
1869 [AC_CONFIG_FILES([
1870 lustre/Makefile
1871 lustre/autoMakefile
1872 lustre/autoconf/Makefile
1873 lustre/contrib/Makefile
1874 lustre/doc/Makefile
1875 lustre/include/Makefile
1876 lustre/include/lustre_ver.h
1877 lustre/include/linux/Makefile
1878 lustre/include/lustre/Makefile
1879 lustre/kernel_patches/targets/2.6-vanilla.target
1880 lustre/kernel_patches/targets/2.6-rhel4.target
1881 lustre/kernel_patches/targets/2.6-rhel5.target
1882 lustre/kernel_patches/targets/2.6-fc5.target
1883 lustre/kernel_patches/targets/2.6-patchless.target
1884 lustre/kernel_patches/targets/2.6-sles10.target
1885 lustre/ldlm/Makefile
1886 lustre/fid/Makefile
1887 lustre/fid/autoMakefile
1888 lustre/liblustre/Makefile
1889 lustre/liblustre/tests/Makefile
1890 lustre/llite/Makefile
1891 lustre/llite/autoMakefile
1892 lustre/lov/Makefile
1893 lustre/lov/autoMakefile
1894 lustre/lvfs/Makefile
1895 lustre/lvfs/autoMakefile
1896 lustre/mdc/Makefile
1897 lustre/mdc/autoMakefile
1898 lustre/lmv/Makefile
1899 lustre/lmv/autoMakefile
1900 lustre/mds/Makefile
1901 lustre/mds/autoMakefile
1902 lustre/mdt/Makefile
1903 lustre/mdt/autoMakefile
1904 lustre/cmm/Makefile
1905 lustre/cmm/autoMakefile
1906 lustre/mdd/Makefile
1907 lustre/mdd/autoMakefile
1908 lustre/fld/Makefile
1909 lustre/fld/autoMakefile
1910 lustre/obdclass/Makefile
1911 lustre/obdclass/autoMakefile
1912 lustre/obdclass/linux/Makefile
1913 lustre/obdecho/Makefile
1914 lustre/obdecho/autoMakefile
1915 lustre/obdfilter/Makefile
1916 lustre/obdfilter/autoMakefile
1917 lustre/osc/Makefile
1918 lustre/osc/autoMakefile
1919 lustre/ost/Makefile
1920 lustre/ost/autoMakefile
1921 lustre/osd/Makefile
1922 lustre/osd/autoMakefile
1923 lustre/mgc/Makefile
1924 lustre/mgc/autoMakefile
1925 lustre/mgs/Makefile
1926 lustre/mgs/autoMakefile
1927 lustre/ptlrpc/Makefile
1928 lustre/ptlrpc/autoMakefile
1929 lustre/ptlrpc/gss/Makefile
1930 lustre/ptlrpc/gss/autoMakefile
1931 lustre/quota/Makefile
1932 lustre/quota/autoMakefile
1933 lustre/scripts/Makefile
1934 lustre/scripts/version_tag.pl
1935 lustre/tests/Makefile
1936 lustre/utils/Makefile
1937 lustre/utils/gss/Makefile
1938 ])
1939 case $lb_target_os in
1940         darwin)
1941                 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])
1942                 ;;
1943 esac
1944
1945 ])