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