Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
1 #* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 #
3 # LC_CONFIG_SRCDIR
4 #
5 # Wrapper for AC_CONFIG_SUBDIR
6 #
7 AC_DEFUN([LC_CONFIG_SRCDIR],
8 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
9 ])
10
11 #
12 # LC_PATH_DEFAULTS
13 #
14 # lustre specific paths
15 #
16 AC_DEFUN([LC_PATH_DEFAULTS],
17 [# ptlrpc kernel build requires this
18 LUSTRE="$PWD/lustre"
19 AC_SUBST(LUSTRE)
20
21 # mount.lustre
22 rootsbindir='/sbin'
23 AC_SUBST(rootsbindir)
24
25 demodir='$(docdir)/demo'
26 AC_SUBST(demodir)
27
28 pkgexampledir='${pkgdatadir}/examples'
29 AC_SUBST(pkgexampledir)
30 ])
31
32 #
33 # LC_TARGET_SUPPORTED
34 #
35 # is the target os supported?
36 #
37 AC_DEFUN([LC_TARGET_SUPPORTED],
38 [case $target_os in
39         linux* | darwin*)
40 $1
41                 ;;
42         *)
43 $2
44                 ;;
45 esac
46 ])
47
48 #
49 # LC_CONFIG_EXT3
50 #
51 # that ext3 is enabled in the kernel
52 #
53 AC_DEFUN([LC_CONFIG_EXT3],
54 [LB_LINUX_CONFIG([EXT3_FS],[],[
55         LB_LINUX_CONFIG([EXT3_FS_MODULE],[],[$2])
56 ])
57 LB_LINUX_CONFIG([EXT3_FS_XATTR],[$1],[$3])
58 ])
59
60 #
61 # LC_FSHOOKS
62 #
63 # If we have (and can build) fshooks.h
64 #
65 AC_DEFUN([LC_FSHOOKS],
66 [LB_CHECK_FILE([$LINUX/include/linux/fshooks.h],[
67         AC_MSG_CHECKING([if fshooks.h can be compiled])
68         LB_LINUX_TRY_COMPILE([
69                 #include <linux/fshooks.h>
70         ],[],[
71                 AC_MSG_RESULT([yes])
72         ],[
73                 AC_MSG_RESULT([no])
74                 AC_MSG_WARN([You might have better luck with gcc 3.3.x.])
75                 AC_MSG_WARN([You can set CC=gcc33 before running configure.])
76                 AC_MSG_ERROR([Your compiler cannot build fshooks.h.])
77         ])
78 $1
79 ],[
80 $2
81 ])
82 ])
83
84 #
85 # LC_STRUCT_KIOBUF
86 #
87 # rh 2.4.18 has iobuf->dovary, but other kernels do not
88 #
89 AC_DEFUN([LC_STRUCT_KIOBUF],
90 [AC_MSG_CHECKING([if struct kiobuf has a dovary field])
91 LB_LINUX_TRY_COMPILE([
92         #include <linux/iobuf.h>
93 ],[
94         struct kiobuf iobuf;
95         iobuf.dovary = 1;
96 ],[
97         AC_MSG_RESULT([yes])
98         AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
99 ],[
100         AC_MSG_RESULT([no])
101 ])
102 ])
103
104 #
105 # LC_FUNC_COND_RESCHED
106 #
107 # cond_resched() was introduced in 2.4.20
108 #
109 AC_DEFUN([LC_FUNC_COND_RESCHED],
110 [AC_MSG_CHECKING([if kernel offers cond_resched])
111 LB_LINUX_TRY_COMPILE([
112         #include <linux/sched.h>
113 ],[
114         cond_resched();
115 ],[
116         AC_MSG_RESULT([yes])
117         AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
118 ],[
119         AC_MSG_RESULT([no])
120 ])
121 ])
122
123 #
124 # LC_FUNC_ZAP_PAGE_RANGE
125 #
126 # if zap_page_range() takes a vma arg
127 #
128 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
129 [AC_MSG_CHECKING([if zap_page_range with vma parameter])
130 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
131 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
132         AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
133         AC_MSG_RESULT([yes])
134 else
135         AC_MSG_RESULT([no])
136 fi
137 ])
138
139 #
140 # LC_FUNC_PDE
141 #
142 # if proc_fs.h defines PDE()
143 #
144 AC_DEFUN([LC_FUNC_PDE],
145 [AC_MSG_CHECKING([if kernel defines PDE])
146 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
147 if test "$HAVE_PDE" != 0 ; then
148         AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
149         AC_MSG_RESULT([yes])
150 else
151         AC_MSG_RESULT([no])
152 fi
153 ])
154
155 #
156 # LC_FUNC_FILEMAP_FDATASYNC
157 #
158 # if filemap_fdatasync() exists
159 #
160 AC_DEFUN([LC_FUNC_FILEMAP_FDATAWRITE],
161 [AC_MSG_CHECKING([whether filemap_fdatawrite() is defined])
162 LB_LINUX_TRY_COMPILE([
163         #include <linux/fs.h>
164 ],[
165         int (*foo)(struct address_space *)= filemap_fdatawrite;
166 ],[
167         AC_MSG_RESULT([yes])
168         AC_DEFINE(HAVE_FILEMAP_FDATAWRITE, 1, [filemap_fdatawrite() found])
169 ],[
170         AC_MSG_RESULT([no])
171 ])
172 ])
173
174 #
175 # LC_FUNC_DIRECT_IO
176 #
177 # if direct_IO takes a struct file argument
178 #
179 AC_DEFUN([LC_FUNC_DIRECT_IO],
180 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
181 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
182 if test "$HAVE_DIO_FILE" != 0 ; then
183         AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
184         AC_MSG_RESULT(yes)
185 else
186         AC_MSG_RESULT(no)
187 fi
188 ])
189
190 #
191 # LC_HEADER_MM_INLINE
192 #
193 # RHEL kernels define page_count in mm_inline.h
194 #
195 AC_DEFUN([LC_HEADER_MM_INLINE],
196 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
197 LB_LINUX_TRY_COMPILE([
198         #include <linux/mm_inline.h>
199 ],[
200         #ifndef page_count
201         #error mm_inline.h does not define page_count
202         #endif
203 ],[
204         AC_MSG_RESULT([yes])
205         AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
206 ],[
207         AC_MSG_RESULT([no])
208 ])
209 ])
210
211 #
212 # LC_STRUCT_INODE
213 #
214 # if inode->i_alloc_sem exists
215 #
216 AC_DEFUN([LC_STRUCT_INODE],
217 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
218 LB_LINUX_TRY_COMPILE([
219         #include <linux/fs.h>
220         #include <linux/version.h>
221 ],[
222         #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
223         #error "down_read_trylock broken before 2.4.24"
224         #endif
225         struct inode i;
226         return (char *)&i.i_alloc_sem - (char *)&i;
227 ],[
228         AC_MSG_RESULT([yes])
229         AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
230 ],[
231         AC_MSG_RESULT([no])
232 ])
233 ])
234
235 #
236 # LC_FUNC_REGISTER_CACHE
237 #
238 # if register_cache() is defined by kernel
239 #
240 AC_DEFUN([LC_FUNC_REGISTER_CACHE],
241 [AC_MSG_CHECKING([if kernel defines register_cache()])
242 LB_LINUX_TRY_COMPILE([
243         #include <linux/list.h>
244         #include <linux/cache_def.h>
245 ],[
246         struct cache_definition cache;
247 ],[
248         AC_MSG_RESULT([yes])
249         AC_DEFINE(HAVE_REGISTER_CACHE, 1, [register_cache found])
250         AC_MSG_CHECKING([if kernel expects return from cache shrink function])
251         HAVE_CACHE_RETURN_INT="`grep -c 'int.*shrink' $LINUX/include/linux/cache_def.h`"
252         if test "$HAVE_CACHE_RETURN_INT" != 0 ; then
253                 AC_DEFINE(HAVE_CACHE_RETURN_INT, 1, [kernel expects return from shrink_cache])
254                 AC_MSG_RESULT(yes)
255         else
256                 AC_MSG_RESULT(no)
257         fi
258 ],[
259         AC_MSG_RESULT([no])
260 ])
261 ])
262
263 #
264 # LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
265 #
266 # check for our patched grab_cache_page_nowait_gfp() function
267 #
268 AC_DEFUN([LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP],
269 [AC_MSG_CHECKING([if kernel defines grab_cache_page_nowait_gfp()])
270 HAVE_GCPN_GFP="`grep -c 'grab_cache_page_nowait_gfp' $LINUX/include/linux/pagemap.h`"
271 if test "$HAVE_GCPN_GFP" != 0 ; then
272         AC_DEFINE(HAVE_GRAB_CACHE_PAGE_NOWAIT_GFP, 1,
273                 [kernel has grab_cache_page_nowait_gfp()])
274         AC_MSG_RESULT(yes)
275 else
276         AC_MSG_RESULT(no)
277 fi
278 ])
279
280 #
281 # LC_FUNC_DEV_SET_RDONLY
282 #
283 # check for the old-style dev_set_rdonly which took an extra "devno" param
284 # and can only set a single device to discard writes at one time
285 #
286 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
287 [AC_MSG_CHECKING([if kernel has new dev_set_rdonly])
288 LB_LINUX_TRY_COMPILE([
289         #include <linux/fs.h>
290 ],[
291         #ifndef HAVE_CLEAR_RDONLY_ON_PUT
292         #error needs to be patched by lustre kernel patches from Lustre version 1.4.3 or above.
293         #endif
294 ],[
295         AC_MSG_RESULT([yes])
296         AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel has new dev_set_rdonly])
297 ],[
298         AC_MSG_RESULT([no, Linux kernel source needs to be patches by lustre 
299 kernel patches from Lustre version 1.4.3 or above.])
300 ])
301 ])
302
303 #
304 # LC_CONFIG_BACKINGFS
305 #
306 # whether to use ldiskfs instead of ext3
307 #
308 AC_DEFUN([LC_CONFIG_BACKINGFS],
309 [
310 BACKINGFS='ext3'
311
312 # 2.6 gets ldiskfs
313 AC_MSG_CHECKING([whether to enable ldiskfs])
314 AC_ARG_ENABLE([ldiskfs],
315         AC_HELP_STRING([--enable-ldiskfs],
316                         [use ldiskfs for the Lustre backing FS]),
317         [],[enable_ldiskfs="$linux25"])
318 AC_MSG_RESULT([$enable_ldiskfs])
319
320 if test x$enable_ldiskfs = xyes ; then
321         BACKINGFS="ldiskfs"
322
323         AC_MSG_CHECKING([whether to enable quilt for making ldiskfs])
324         AC_ARG_ENABLE([quilt],
325                         AC_HELP_STRING([--disable-quilt],[disable use of quilt for ldiskfs]),
326                         [],[enable_quilt='yes'])
327         AC_MSG_RESULT([$enable_quilt])
328
329         AC_PATH_PROG(PATCH, patch, [no])
330
331         if test x$enable_quilt = xno ; then
332             QUILT="no"
333         else
334             AC_PATH_PROG(QUILT, quilt, [no])
335         fi
336
337         if test x$enable_ldiskfs$PATCH$QUILT = xyesnono ; then
338                 AC_MSG_ERROR([Quilt or patch are needed to build the ldiskfs module (for Linux 2.6)])
339         fi
340
341         AC_DEFINE(CONFIG_LDISKFS_FS_MODULE, 1, [build ldiskfs as a module])
342         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
343         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [enable posix acls for ldiskfs])
344         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security for ldiskfs])
345
346         AC_DEFINE(CONFIG_LDISKFS2_FS_XATTR, 1, [enable extended attributes for ldiskfs2])
347         AC_DEFINE(CONFIG_LDISKFS2_FS_POSIX_ACL, 1, [enable posix acls for ldiskfs2])
348         AC_DEFINE(CONFIG_LDISKFS2_FS_SECURITY, 1, [enable fs security for ldiskfs2])
349 fi
350
351 AC_MSG_CHECKING([which backing filesystem to use])
352 AC_MSG_RESULT([$BACKINGFS])
353 AC_SUBST(BACKINGFS)
354
355 case $BACKINGFS in
356         ext3)
357                 # --- Check that ext3 and ext3 xattr are enabled in the kernel
358                 LC_CONFIG_EXT3([],[
359                         AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
360                 ],[
361                         AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
362                         AC_MSG_WARN([This build may fail.])
363                 ])
364                 ;;
365         ldiskfs)
366                 AC_MSG_CHECKING([which ldiskfs series to use])
367                 case $LINUXRELEASE in
368                 2.6.5*) LDISKFS_SERIES="2.6-suse.series" ;;
369                 2.6.9*) LDISKFS_SERIES="2.6-rhel4.series" ;;
370                 2.6.10-ac*) LDISKFS_SERIES="2.6-fc3.series" ;;
371                 2.6.10*) LDISKFS_SERIES="2.6-rhel4.series" ;;
372                 2.6.12*) LDISKFS_SERIES="2.6.12-vanilla.series" ;;
373                 2.6.15*) LDISKFS_SERIES="2.6-fc5.series";;
374                 2.6.16*) LDISKFS_SERIES="2.6-sles10.series";;
375                 2.6.18*) LDISKFS_SERIES="2.6.18-vanilla.series";;
376                 *) AC_MSG_WARN([Unknown kernel version $LINUXRELEASE, fix lustre/autoconf/lustre-core.m4])
377                 esac
378                 AC_MSG_RESULT([$LDISKFS_SERIES])
379                 AC_SUBST(LDISKFS_SERIES)
380                 ;;
381 esac # $BACKINGFS
382 ])
383
384 #
385 # LC_CONFIG_PINGER
386 #
387 # the pinger is temporary, until we have the recovery node in place
388 #
389 AC_DEFUN([LC_CONFIG_PINGER],
390 [AC_MSG_CHECKING([whether to enable pinger support])
391 AC_ARG_ENABLE([pinger],
392         AC_HELP_STRING([--disable-pinger],
393                         [disable recovery pinger support]),
394         [],[enable_pinger='yes'])
395 AC_MSG_RESULT([$enable_pinger])
396 if test x$enable_pinger != xno ; then
397   AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
398 fi
399 ])
400
401 #
402 # LC_CONFIG_HEALTH_CHECK_WRITE
403 #
404 # Turn on the actual write to the disk
405 #
406 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
407 [AC_MSG_CHECKING([whether to enable a write with the health check])
408 AC_ARG_ENABLE([health-write],
409         AC_HELP_STRING([--enable-health-write],
410                         [enable disk writes when doing health check]),
411         [],[enable_health_write='no'])
412 AC_MSG_RESULT([$enable_health_write])
413 if test x$enable_health_write == xyes ; then
414   AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
415 fi
416 ])
417
418 #
419 # LC_CONFIG_LIBLUSTRE_RECOVERY
420 #
421 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
422 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
423 AC_ARG_ENABLE([liblustre-recovery],
424         AC_HELP_STRING([--disable-liblustre-recovery],
425                         [disable liblustre recovery support]),
426         [],[enable_liblustre_recovery='yes'])
427 AC_MSG_RESULT([$enable_liblustre_recovery])
428 if test x$enable_liblustre_recovery != xno ; then
429   AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
430 fi
431 ])
432
433 #
434 # LC_CONFIG_OBD_BUFFER_SIZE
435 #
436 # the maximum buffer size of lctl ioctls
437 #
438 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
439 [AC_MSG_CHECKING([maximum OBD ioctl size])
440 AC_ARG_WITH([obd-buffer-size],
441         AC_HELP_STRING([--with-obd-buffer-size=[size]],
442                         [set lctl ioctl maximum bytes (default=8192)]),
443         [
444                 OBD_BUFFER_SIZE=$with_obd_buffer_size
445         ],[
446                 OBD_BUFFER_SIZE=8192
447         ])
448 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
449 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
450 ])
451
452 #
453 # LC_STRUCT_STATFS
454 #
455 # AIX does not have statfs.f_namelen
456 #
457 AC_DEFUN([LC_STRUCT_STATFS],
458 [AC_MSG_CHECKING([if struct statfs has a f_namelen field])
459 LB_LINUX_TRY_COMPILE([
460         #include <linux/vfs.h>
461 ],[
462         struct statfs sfs;
463         sfs.f_namelen = 1;
464 ],[
465         AC_MSG_RESULT([yes])
466         AC_DEFINE(HAVE_STATFS_NAMELEN, 1, [struct statfs has a namelen field])
467 ],[
468         AC_MSG_RESULT([no])
469 ])
470 ])
471
472 #
473 # LC_READLINK_SSIZE_T
474 #
475 AC_DEFUN([LC_READLINK_SSIZE_T],
476 [AC_MSG_CHECKING([if readlink returns ssize_t])
477 AC_TRY_COMPILE([
478         #include <unistd.h>
479 ],[
480         ssize_t readlink(const char *, char *, size_t);
481 ],[
482         AC_MSG_RESULT([yes])
483         AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
484 ],[
485         AC_MSG_RESULT([no])
486 ])
487 ])
488
489 AC_DEFUN([LC_FUNC_PAGE_MAPPED],
490 [AC_MSG_CHECKING([if kernel offers page_mapped])
491 LB_LINUX_TRY_COMPILE([
492         #include <linux/mm.h>
493 ],[
494         page_mapped(NULL);
495 ],[
496         AC_MSG_RESULT([yes])
497         AC_DEFINE(HAVE_PAGE_MAPPED, 1, [page_mapped found])
498 ],[
499         AC_MSG_RESULT([no])
500 ])
501 ])
502
503 AC_DEFUN([LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL],
504 [AC_MSG_CHECKING([if struct file_operations has an unlocked_ioctl field])
505 LB_LINUX_TRY_COMPILE([
506         #include <linux/fs.h>
507 ],[
508         struct file_operations fops;
509         &fops.unlocked_ioctl;
510 ],[
511         AC_MSG_RESULT([yes])
512         AC_DEFINE(HAVE_UNLOCKED_IOCTL, 1, [struct file_operations has an unlock ed_ioctl field])
513 ],[
514         AC_MSG_RESULT([no])
515 ])
516 ])
517
518 AC_DEFUN([LC_FILEMAP_POPULATE],
519 [AC_MSG_CHECKING([for exported filemap_populate])
520 LB_LINUX_TRY_COMPILE([
521         #include <asm/page.h>
522         #include <linux/mm.h>
523 ],[
524         filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
525 ],[
526         AC_MSG_RESULT([yes])
527         AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
528 ],[
529         AC_MSG_RESULT([no])
530 ])
531 ])
532
533 AC_DEFUN([LC_D_ADD_UNIQUE],
534 [AC_MSG_CHECKING([for d_add_unique])
535 LB_LINUX_TRY_COMPILE([
536         #include <linux/dcache.h>
537 ],[
538        d_add_unique(NULL, NULL);
539 ],[
540         AC_MSG_RESULT([yes])
541         AC_DEFINE(HAVE_D_ADD_UNIQUE, 1, [Kernel has d_add_unique])
542 ],[
543         AC_MSG_RESULT([no])
544 ])
545 ])
546
547 AC_DEFUN([LC_BIT_SPINLOCK_H],
548 [LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
549         AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
550         LB_LINUX_TRY_COMPILE([
551                 #include <asm/processor.h>
552                 #include <linux/spinlock.h>
553                 #include <linux/bit_spinlock.h>
554         ],[],[
555                 AC_MSG_RESULT([yes])
556                 AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
557         ],[
558                 AC_MSG_RESULT([no])
559         ])
560 ],
561 [])
562 ])
563
564 #
565 # LC_POSIX_ACL_XATTR
566 #
567 # If we have xattr_acl.h 
568 #
569 AC_DEFUN([LC_XATTR_ACL],
570 [LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
571         AC_MSG_CHECKING([if xattr_acl.h can be compiled])
572         LB_LINUX_TRY_COMPILE([
573                 #include <linux/xattr_acl.h>
574         ],[],[
575                 AC_MSG_RESULT([yes])
576                 AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
577         ],[
578                 AC_MSG_RESULT([no])
579         ])
580 ],
581 [])
582 ])
583
584 AC_DEFUN([LC_STRUCT_INTENT_FILE],
585 [AC_MSG_CHECKING([if struct open_intent has a file field])
586 LB_LINUX_TRY_COMPILE([
587         #include <linux/fs.h>
588         #include <linux/namei.h>
589 ],[
590         struct open_intent intent;
591         &intent.file;
592 ],[
593         AC_MSG_RESULT([yes])
594         AC_DEFINE(HAVE_FILE_IN_STRUCT_INTENT, 1, [struct open_intent has a file field])
595 ],[
596         AC_MSG_RESULT([no])
597 ])
598 ])
599
600
601 AC_DEFUN([LC_POSIX_ACL_XATTR_H],
602 [LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
603         AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
604         LB_LINUX_TRY_COMPILE([
605                 #include <linux/posix_acl_xattr.h>
606         ],[],[
607                 AC_MSG_RESULT([yes])
608                 AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
609
610         ],[
611                 AC_MSG_RESULT([no])
612         ])
613 $1
614 ],[
615 AC_MSG_RESULT([no])
616 ])
617
618 #
619 # LC_EXPORT___IGET
620 # starting from 2.6.19 linux kernel exports __iget()
621 #
622 AC_DEFUN([LC_EXPORT___IGET],
623 [AC_MSG_CHECKING([if kernel exports __iget])
624         if grep -q "EXPORT_SYMBOL(__iget)" $LINUX/fs/inode.c 2>/dev/null ; then
625                 AC_DEFINE(HAVE_EXPORT___IGET, 1, [kernel exports __iget])
626                 AC_MSG_RESULT([yes])
627         else
628                 AC_MSG_RESULT([no])
629         fi
630 ])
631 ])
632
633 AC_DEFUN([LC_LUSTRE_VERSION_H],
634 [LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
635         rm -f "$LUSTRE/include/linux/lustre_version.h"
636 ],[
637         touch "$LUSTRE/include/linux/lustre_version.h"
638         if test x$enable_server = xyes ; then
639                 AC_MSG_WARN([Unpatched kernel detected.])
640                 AC_MSG_WARN([Lustre servers cannot be built with an unpatched kernel;])
641                 AC_MSG_WARN([disabling server build])
642                 enable_server='no'
643         fi
644 ])
645 ])
646
647 AC_DEFUN([LC_FUNC_SET_FS_PWD],
648 [AC_MSG_CHECKING([if kernel exports show_task])
649 have_show_task=0
650         if grep -q "EXPORT_SYMBOL(show_task)" \
651                  "$LINUX/fs/namespace.c" 2>/dev/null ; then
652                 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd is exported])
653                 AC_MSG_RESULT([yes])
654         else
655                 AC_MSG_RESULT([no])
656         fi
657 ])
658
659
660 #
661 # LC_FUNC_MS_FLOCK_LOCK
662 #
663 # SLES9 kernel has MS_FLOCK_LOCK sb flag
664 #
665 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
666 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
667 LB_LINUX_TRY_COMPILE([
668         #include <linux/fs.h>
669 ],[
670         int flags = MS_FLOCK_LOCK;
671 ],[
672         AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
673                 [kernel has MS_FLOCK_LOCK flag])
674         AC_MSG_RESULT([yes])
675 ],[
676         AC_MSG_RESULT([no])
677 ])
678 ])
679
680 #
681 # LC_FUNC_HAVE_CAN_SLEEP_ARG
682 #
683 # SLES9 kernel has third arg can_sleep
684 # in fs/locks.c: flock_lock_file_wait()
685 #
686 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
687 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
688 LB_LINUX_TRY_COMPILE([
689         #include <linux/fs.h>
690 ],[
691         int cansleep;
692         struct file *file;
693         struct file_lock *file_lock;
694         flock_lock_file_wait(file, file_lock, cansleep);
695 ],[
696         AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
697                 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
698         AC_MSG_RESULT([yes])
699 ],[
700         AC_MSG_RESULT([no])
701 ])
702 ])
703
704 #
705 # LC_FUNC_F_OP_FLOCK
706 #
707 # rhel4.2 kernel has f_op->flock field
708 #
709 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
710 [AC_MSG_CHECKING([if struct file_operations has flock field])
711 LB_LINUX_TRY_COMPILE([
712         #include <linux/fs.h>
713 ],[
714         struct file_operations ll_file_operations_flock;
715         ll_file_operations_flock.flock = NULL;
716 ],[
717         AC_DEFINE(HAVE_F_OP_FLOCK, 1,
718                 [struct file_operations has flock field])
719         AC_MSG_RESULT([yes])
720 ],[
721         AC_MSG_RESULT([no])
722 ])
723 ])
724
725 #
726 # LC_FUNC_MS_FLOCK_LOCK
727 #
728 # SLES9 kernel has MS_FLOCK_LOCK sb flag
729 #
730 AC_DEFUN([LC_FUNC_MS_FLOCK_LOCK],
731 [AC_MSG_CHECKING([if kernel has MS_FLOCK_LOCK sb flag])
732 LB_LINUX_TRY_COMPILE([
733         #include <linux/fs.h>
734 ],[
735         int flags = MS_FLOCK_LOCK;
736 ],[
737         AC_DEFINE(HAVE_MS_FLOCK_LOCK, 1,
738                 [kernel has MS_FLOCK_LOCK flag])
739         AC_MSG_RESULT([yes])
740 ],[
741         AC_MSG_RESULT([no])
742 ])
743 ])
744
745 #
746 # LC_FUNC_HAVE_CAN_SLEEP_ARG
747 #
748 # SLES9 kernel has third arg can_sleep
749 # in fs/locks.c: flock_lock_file_wait()
750 #
751 AC_DEFUN([LC_FUNC_HAVE_CAN_SLEEP_ARG],
752 [AC_MSG_CHECKING([if kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
753 LB_LINUX_TRY_COMPILE([
754         #include <linux/fs.h>
755 ],[
756         int cansleep;
757         struct file *file;
758         struct file_lock *file_lock;
759         flock_lock_file_wait(file, file_lock, cansleep);
760 ],[
761         AC_DEFINE(HAVE_CAN_SLEEP_ARG, 1,
762                 [kernel has third arg can_sleep in fs/locks.c: flock_lock_file_wait()])
763         AC_MSG_RESULT([yes])
764 ],[
765         AC_MSG_RESULT([no])
766 ])
767 ])
768
769 #
770 # LC_TASK_PPTR
771 #
772 # task struct has p_pptr instead of parent
773 #
774 AC_DEFUN([LC_TASK_PPTR],
775 [AC_MSG_CHECKING([task p_pptr found])
776 LB_LINUX_TRY_COMPILE([
777         #include <linux/sched.h>
778 ],[
779         struct task_struct *p;
780         
781         p = p->p_pptr;
782 ],[
783         AC_MSG_RESULT([yes])
784         AC_DEFINE(HAVE_TASK_PPTR, 1, [task p_pptr found])
785 ],[
786         AC_MSG_RESULT([no])
787 ])
788 ])
789
790 #
791 # LC_FUNC_F_OP_FLOCK
792 #
793 # rhel4.2 kernel has f_op->flock field
794 #
795 AC_DEFUN([LC_FUNC_F_OP_FLOCK],
796 [AC_MSG_CHECKING([if struct file_operations has flock field])
797 LB_LINUX_TRY_COMPILE([
798         #include <linux/fs.h>
799 ],[
800         struct file_operations ll_file_operations_flock;
801         ll_file_operations_flock.flock = NULL;
802 ],[
803         AC_DEFINE(HAVE_F_OP_FLOCK, 1,
804                 [struct file_operations has flock field])
805         AC_MSG_RESULT([yes])
806 ],[
807         AC_MSG_RESULT([no])
808 ])
809 ])
810
811 # LC_INODE_I_MUTEX
812 # after 2.6.15 inode have i_mutex intead of i_sem
813 AC_DEFUN([LC_INODE_I_MUTEX],
814 [AC_MSG_CHECKING([use inode have i_mutex ])
815 LB_LINUX_TRY_COMPILE([
816         #include <linux/mutex.h>
817         #include <linux/fs.h>
818 ],[
819         struct inode i;
820
821         mutex_unlock(&i.i_mutex);
822 ],[
823         AC_MSG_RESULT(yes)
824         AC_DEFINE(HAVE_INODE_I_MUTEX, 1,
825                 [after 2.6.15 inode have i_mutex intead of i_sem])
826 ],[
827         AC_MSG_RESULT(NO)
828 ])
829 ])
830
831
832 # LC_DQUOTOFF_MUTEX
833 # after 2.6.17 dquote use mutex instead if semaphore
834 AC_DEFUN([LC_DQUOTOFF_MUTEX],
835 [AC_MSG_CHECKING([use dqonoff_mutex])
836 LB_LINUX_TRY_COMPILE([
837         #include <linux/mutex.h>
838         #include <linux/fs.h>
839         #include <linux/quota.h>
840 ],[
841         struct quota_info dq;
842
843         mutex_unlock(&dq.dqonoff_mutex);
844 ],[
845         AC_MSG_RESULT(yes)
846         AC_DEFINE(HAVE_DQUOTOFF_MUTEX, 1,
847                 [after 2.6.17 dquote use mutex instead if semaphore])
848 ],[
849         AC_MSG_RESULT(NO)
850 ])
851 ])
852
853 #
854 # LC_STATFS_DENTRY_PARAM
855 # starting from 2.6.18 linux kernel uses dentry instead of
856 # super_block for first vfs_statfs argument
857 #
858 AC_DEFUN([LC_STATFS_DENTRY_PARAM],
859 [AC_MSG_CHECKING([first vfs_statfs parameter is dentry])
860 LB_LINUX_TRY_COMPILE([
861         #include <linux/fs.h>
862 ],[
863         int vfs_statfs(struct dentry *, struct kstatfs *);
864 ],[
865         AC_DEFINE(HAVE_STATFS_DENTRY_PARAM, 1,
866                 [first parameter of vfs_statfs is dentry])
867         AC_MSG_RESULT([yes])
868 ],[
869         AC_MSG_RESULT([no])
870 ])
871 ])
872
873 #
874 # LC_VFS_KERN_MOUNT
875 # starting from 2.6.18 kernel don`t export do_kern_mount
876 # and want to use vfs_kern_mount instead.
877 #
878 AC_DEFUN([LC_VFS_KERN_MOUNT],
879 [AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
880 LB_LINUX_TRY_COMPILE([
881         #include <linux/mount.h>
882 ],[
883         vfs_kern_mount(NULL, 0, NULL, NULL);
884 ],[
885         AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
886                 [vfs_kern_mount exist in kernel])
887         AC_MSG_RESULT([yes])
888 ],[
889         AC_MSG_RESULT([no])
890 ])
891 ])
892
893
894 # LC_INVALIDATEPAGE_RETURN_INT
895 # more 2.6 api changes.  return type for the invalidatepage
896 # address_space_operation is 'void' in new kernels but 'int' in old
897 #
898 AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
899 [AC_MSG_CHECKING([invalidatepage has return int])
900 LB_LINUX_TRY_COMPILE([
901         #include <linux/buffer_head.h>
902 ],[
903         int rc = block_invalidatepage(NULL, 0);
904 ],[
905         AC_MSG_RESULT(yes)
906         AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
907                 [Define if return type of invalidatepage should be int])
908 ],[
909         AC_MSG_RESULT(NO)
910 ])
911 ])
912
913 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
914 # more 2.6 API changes. 2.6.18 umount_begin has different parameters
915 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
916 [AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
917 tmp_flags="$EXTRA_KCFLAGS"
918 EXTRA_KCFLAGS="-Werror"
919 LB_LINUX_TRY_COMPILE([
920         #include <linux/fs.h>
921
922         struct vfsmount;
923         static void cfg_umount_begin (struct vfsmount *v, int flags)
924         {
925                 ;
926         }
927
928         static struct super_operations cfg_super_operations = {
929                 .umount_begin   = cfg_umount_begin,
930         };
931 ],[
932         cfg_super_operations.umount_begin(NULL,0);
933 ],[
934         AC_MSG_RESULT(yes)
935         AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
936                 [Define umount_begin need second argument])
937 ],[
938         AC_MSG_RESULT(NO)
939 ])
940 EXTRA_KCFLAGS="$tmp_flags"
941 ])
942
943 # 2.6.19 API changes
944 # inode don`t have i_blksize field
945 AC_DEFUN([LC_INODE_BLKSIZE],
946 [AC_MSG_CHECKING([inode has i_blksize field])
947 LB_LINUX_TRY_COMPILE([
948 #include <linux/fs.h>
949 ],[
950         struct inode i;
951         i.i_blksize = 0; 
952 ],[
953         AC_MSG_RESULT(yes)
954         AC_DEFINE(HAVE_INODE_BLKSIZE, 1,
955                 [struct inode has i_blksize field])
956 ],[
957         AC_MSG_RESULT(NO)
958 ])
959 ])
960
961 # LC_VFS_READDIR_U64_INO
962 # 2.6.19 use u64 for inode number instead of inode_t
963 AC_DEFUN([LC_VFS_READDIR_U64_INO],
964 [AC_MSG_CHECKING([check vfs_readdir need 64bit inode number])
965 tmp_flags="$EXTRA_KCFLAGS"
966 EXTRA_KCFLAGS="-Werror"
967 LB_LINUX_TRY_COMPILE([
968 #include <linux/fs.h>
969         int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
970                       u64 ino, unsigned int d_type)
971         {
972                 return 0;
973         }
974 ],[
975         filldir_t filter;
976
977         filter = fillonedir;
978         return 1;
979 ],[
980         AC_MSG_RESULT(yes)
981         AC_DEFINE(HAVE_VFS_READDIR_U64_INO, 1,
982                 [if vfs_readdir need 64bit inode number])
983 ],[
984         AC_MSG_RESULT(NO)
985 ])
986 EXTRA_KCFLAGS="$tmp_flags"
987 ])
988
989 # LC_GENERIC_FILE_WRITE
990 # 2.6.19 introduce do_sync_write instead of
991 # generic_file_write
992 AC_DEFUN([LC_GENERIC_FILE_WRITE],
993 [AC_MSG_CHECKING([use generic_file_write])
994 LB_LINUX_TRY_COMPILE([
995         #include <linux/fs.h>
996 ],[
997         int result = generic_file_read(NULL, NULL, 0, 0);
998 ],[
999         AC_MSG_RESULT(yes)
1000         AC_DEFINE(HAVE_GENERIC_FILE_WRITE, 1,
1001                 [use generic_file_write])
1002 ],[
1003         AC_MSG_RESULT(NO)
1004 ])
1005 ])
1006
1007 # LC_GENERIC_FILE_READ
1008 # 2.6.19 need to use do_sync_read instead of
1009 # generic_file_read
1010 AC_DEFUN([LC_GENERIC_FILE_READ],
1011 [AC_MSG_CHECKING([use generic_file_read])
1012 LB_LINUX_TRY_COMPILE([
1013         #include <linux/fs.h>
1014 ],[
1015         int result = generic_file_read(NULL, NULL, 0, 0);
1016 ],[
1017         AC_MSG_RESULT(yes)
1018         AC_DEFINE(HAVE_GENERIC_FILE_READ, 1,
1019                 [use generic_file_read])
1020 ],[
1021         AC_MSG_RESULT(NO)
1022 ])
1023 ])
1024
1025 # LC_NR_PAGECACHE
1026 # 2.6.18 don`t export nr_pagecahe
1027 AC_DEFUN([LC_NR_PAGECACHE],
1028 [AC_MSG_CHECKING([kernel export nr_pagecache])
1029 LB_LINUX_TRY_COMPILE([
1030         #include <linux/pagemap.h>
1031 ],[
1032         return atomic_read(&nr_pagecache);
1033 ],[
1034         AC_MSG_RESULT(yes)
1035         AC_DEFINE(HAVE_NR_PAGECACHE, 1,
1036                 [is kernel export nr_pagecache])
1037 ],[
1038         AC_MSG_RESULT(NO)
1039 ])
1040 ])
1041
1042 # LC_WB_RANGE_START
1043 # 2.6.20 rename struct writeback fields
1044 AC_DEFUN([LC_WB_RANGE_START],
1045 [AC_MSG_CHECKING([kernel has range_start in struct writeback_control])
1046 LB_LINUX_TRY_COMPILE([
1047         #include <linux/fs.h>
1048         #include <linux/sched.h>
1049         #include <linux/writeback.h>
1050 ],[
1051         struct writeback_control wb;
1052
1053         wb.range_start = 0;
1054 ],[
1055         AC_MSG_RESULT(yes)
1056         AC_DEFINE(HAVE_WB_RANGE_START, 1,
1057                   [writeback control has range_start field])
1058 ],[
1059         AC_MSG_RESULT(NO)
1060 ])
1061 ])
1062
1063 #
1064 # LC_PROG_LINUX
1065 #
1066 # Lustre linux kernel checks
1067 #
1068 AC_DEFUN([LC_PROG_LINUX],
1069 [ LC_LUSTRE_VERSION_H
1070 if test x$enable_server = xyes ; then
1071         LC_CONFIG_BACKINGFS
1072 fi
1073 LC_CONFIG_PINGER
1074 LC_CONFIG_LIBLUSTRE_RECOVERY
1075 LC_CONFIG_QUOTA
1076 LC_CONFIG_HEALTH_CHECK_WRITE
1077
1078 LC_TASK_PPTR
1079
1080 LC_STRUCT_KIOBUF
1081 LC_FUNC_COND_RESCHED
1082 LC_FUNC_ZAP_PAGE_RANGE
1083 LC_FUNC_PDE
1084 LC_FUNC_DIRECT_IO
1085 LC_HEADER_MM_INLINE
1086 LC_STRUCT_INODE
1087 LC_FUNC_REGISTER_CACHE
1088 LC_FUNC_GRAB_CACHE_PAGE_NOWAIT_GFP
1089 LC_FUNC_DEV_SET_RDONLY
1090 LC_FUNC_FILEMAP_FDATAWRITE
1091 LC_STRUCT_STATFS
1092 LC_FUNC_PAGE_MAPPED
1093 LC_STRUCT_FILE_OPS_UNLOCKED_IOCTL
1094 LC_FILEMAP_POPULATE
1095 LC_D_ADD_UNIQUE
1096 LC_BIT_SPINLOCK_H
1097 LC_XATTR_ACL
1098 LC_STRUCT_INTENT_FILE
1099 LC_POSIX_ACL_XATTR_H
1100 LC_EXPORT___IGET
1101 LC_FUNC_SET_FS_PWD
1102 LC_FUNC_MS_FLOCK_LOCK
1103 LC_FUNC_HAVE_CAN_SLEEP_ARG
1104 LC_FUNC_F_OP_FLOCK
1105 LC_QUOTA_READ
1106 LC_COOKIE_FOLLOW_LINK
1107
1108 # 2.6.15
1109 LC_INODE_I_MUTEX
1110
1111 # 2.6.17
1112 LC_DQUOTOFF_MUTEX
1113
1114 # 2.6.18
1115 LC_NR_PAGECACHE
1116 LC_STATFS_DENTRY_PARAM
1117 LC_VFS_KERN_MOUNT
1118 LC_INVALIDATEPAGE_RETURN_INT
1119 LC_UMOUNTBEGIN_HAS_VFSMOUNT
1120 LC_WB_RANGE_START
1121
1122 # 2.6.19
1123 LC_INODE_BLKSIZE
1124 LC_VFS_READDIR_U64_INO
1125 LC_GENERIC_FILE_READ
1126 LC_GENERIC_FILE_WRITE
1127 ])
1128
1129 #
1130 # LC_CONFIG_CLIENT_SERVER
1131 #
1132 # Build client/server sides of Lustre
1133 #
1134 AC_DEFUN([LC_CONFIG_CLIENT_SERVER],
1135 [AC_MSG_CHECKING([whether to build Lustre server support])
1136 AC_ARG_ENABLE([server],
1137         AC_HELP_STRING([--disable-server],
1138                         [disable Lustre server support]),
1139         [],[enable_server='yes'])
1140 AC_MSG_RESULT([$enable_server])
1141
1142 AC_MSG_CHECKING([whether to build Lustre client support])
1143 AC_ARG_ENABLE([client],
1144         AC_HELP_STRING([--disable-client],
1145                         [disable Lustre client support]),
1146         [],[enable_client='yes'])
1147 AC_MSG_RESULT([$enable_client])])
1148
1149 #
1150 # LC_CONFIG_LIBLUSTRE
1151 #
1152 # whether to build liblustre
1153 #
1154 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1155 [AC_MSG_CHECKING([whether to build Lustre library])
1156 AC_ARG_ENABLE([liblustre],
1157         AC_HELP_STRING([--disable-liblustre],
1158                         [disable building of Lustre library]),
1159         [],[enable_liblustre=$with_sysio])
1160 AC_MSG_RESULT([$enable_liblustre])
1161 # only build sysio if liblustre is built
1162 with_sysio="$enable_liblustre"
1163
1164 AC_MSG_CHECKING([whether to build liblustre tests])
1165 AC_ARG_ENABLE([liblustre-tests],
1166         AC_HELP_STRING([--enable-liblustre-tests],
1167                         [enable liblustre tests, if --disable-tests is used]),
1168         [],[enable_liblustre_tests=$enable_tests])
1169 if test x$enable_liblustre != xyes ; then
1170    enable_liblustre_tests='no'
1171 fi
1172 AC_MSG_RESULT([$enable_liblustre_tests])
1173
1174 AC_MSG_CHECKING([whether to build mpitests])
1175 AC_ARG_ENABLE([mpitests],
1176         AC_HELP_STRING([--enable-mpitests],
1177                         [build liblustre mpi tests]),
1178         [],[enable_mpitests=no])
1179 AC_MSG_RESULT([$enable_mpitests])
1180
1181 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1182 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1183
1184 LC_CONFIG_PINGER
1185 LC_CONFIG_LIBLUSTRE_RECOVERY
1186 ])
1187
1188 #
1189 # LC_CONFIG_QUOTA
1190 #
1191 # whether to enable quota support
1192 #
1193 AC_DEFUN([LC_CONFIG_QUOTA],
1194 [AC_MSG_CHECKING([whether to enable quota support])
1195 AC_ARG_ENABLE([quota], 
1196         AC_HELP_STRING([--enable-quota],
1197                         [enable quota support]),
1198         [],[enable_quota='yes'])
1199 AC_MSG_RESULT([$enable_quota])
1200 if test x$linux25 != xyes; then
1201    enable_quota='no'
1202 fi
1203 if test x$enable_quota != xno; then
1204    AC_DEFINE(HAVE_QUOTA_SUPPORT, 1, [Enable quota support])
1205 fi
1206 ])
1207   
1208 AC_DEFUN([LC_QUOTA_READ],
1209 [AC_MSG_CHECKING([if kernel supports quota_read])
1210 LB_LINUX_TRY_COMPILE([
1211         #include <linux/fs.h>
1212 ],[
1213         struct super_operations sp;
1214         void *i = (void *)sp.quota_read;
1215 ],[
1216         AC_MSG_RESULT([yes])
1217         AC_DEFINE(KERNEL_SUPPORTS_QUOTA_READ, 1, [quota_read found])
1218 ],[
1219         AC_MSG_RESULT([no])
1220 ])
1221 ])
1222
1223 #
1224 # LC_COOKIE_FOLLOW_LINK
1225 #
1226 # kernel 2.6.13+ ->follow_link returns a cookie
1227 #
1228
1229 AC_DEFUN([LC_COOKIE_FOLLOW_LINK],
1230 [AC_MSG_CHECKING([if inode_operations->follow_link returns a cookie])
1231 LB_LINUX_TRY_COMPILE([
1232         #include <linux/fs.h>
1233         #include <linux/namei.h>
1234 ],[
1235         struct dentry dentry;
1236         struct nameidata nd;
1237
1238         dentry.d_inode->i_op->put_link(&dentry, &nd, NULL);
1239 ],[
1240         AC_DEFINE(HAVE_COOKIE_FOLLOW_LINK, 1, [inode_operations->follow_link returns a cookie])
1241         AC_MSG_RESULT([yes])
1242 ],[
1243         AC_MSG_RESULT([no])
1244 ])
1245 ])
1246
1247 #
1248 # LC_CONFIGURE
1249 #
1250 # other configure checks
1251 #
1252 AC_DEFUN([LC_CONFIGURE],
1253 [LC_CONFIG_OBD_BUFFER_SIZE
1254
1255 # include/liblustre.h
1256 AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1257
1258 # include/lustre/lustre_user.h
1259 # See note there re: __ASM_X86_64_PROCESSOR_H
1260 AC_CHECK_HEADERS([linux/quota.h])
1261
1262 # liblustre/llite_lib.h
1263 AC_CHECK_HEADERS([xtio.h file.h])
1264
1265 # liblustre/dir.c
1266 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1267
1268 # liblustre/lutil.c
1269 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1270 AC_CHECK_FUNCS([inet_ntoa])
1271
1272 # libsysio/src/readlink.c
1273 LC_READLINK_SSIZE_T
1274
1275 # utils/llverfs.c
1276 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1277
1278 # Super safe df
1279 AC_ARG_ENABLE([mindf],
1280       AC_HELP_STRING([--enable-mindf],
1281                       [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1282       [],[])
1283 if test "$enable_mindf" = "yes" ;  then
1284       AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1285 fi
1286
1287 ])
1288
1289 #
1290 # LC_CONDITIONALS
1291 #
1292 # AM_CONDITIONALS for lustre
1293 #
1294 AC_DEFUN([LC_CONDITIONALS],
1295 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1296 AM_CONDITIONAL(LDISKFS, test x$enable_ldiskfs = xyes)
1297 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
1298 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1299 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1300 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1301 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1302 AM_CONDITIONAL(QUOTA, test x$enable_quota = xyes)
1303 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1304 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1305 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1306 ])
1307
1308 #
1309 # LC_CONFIG_FILES
1310 #
1311 # files that should be generated with AC_OUTPUT
1312 #
1313 AC_DEFUN([LC_CONFIG_FILES],
1314 [AC_CONFIG_FILES([
1315 lustre/Makefile
1316 lustre/autoMakefile
1317 lustre/autoconf/Makefile
1318 lustre/contrib/Makefile
1319 lustre/doc/Makefile
1320 lustre/include/Makefile
1321 lustre/include/lustre_ver.h
1322 lustre/include/linux/Makefile
1323 lustre/include/lustre/Makefile
1324 lustre/kernel_patches/targets/2.6-suse.target
1325 lustre/kernel_patches/targets/2.6-vanilla.target
1326 lustre/kernel_patches/targets/2.6-rhel4.target
1327 lustre/kernel_patches/targets/2.6-fc5.target
1328 lustre/kernel_patches/targets/2.6-patchless.target
1329 lustre/kernel_patches/targets/2.6-sles10.target
1330 lustre/kernel_patches/targets/hp_pnnl-2.4.target
1331 lustre/kernel_patches/targets/rh-2.4.target
1332 lustre/kernel_patches/targets/rhel-2.4.target
1333 lustre/kernel_patches/targets/suse-2.4.21-2.target
1334 lustre/kernel_patches/targets/sles-2.4.target
1335 lustre/ldiskfs/Makefile
1336 lustre/ldiskfs/autoMakefile
1337 lustre/ldiskfs2/Makefile
1338 lustre/ldiskfs2/autoMakefile
1339 lustre/ldlm/Makefile
1340 lustre/liblustre/Makefile
1341 lustre/liblustre/tests/Makefile
1342 lustre/llite/Makefile
1343 lustre/llite/autoMakefile
1344 lustre/lov/Makefile
1345 lustre/lov/autoMakefile
1346 lustre/lvfs/Makefile
1347 lustre/lvfs/autoMakefile
1348 lustre/mdc/Makefile
1349 lustre/mdc/autoMakefile
1350 lustre/mds/Makefile
1351 lustre/mds/autoMakefile
1352 lustre/obdclass/Makefile
1353 lustre/obdclass/autoMakefile
1354 lustre/obdclass/linux/Makefile
1355 lustre/obdecho/Makefile
1356 lustre/obdecho/autoMakefile
1357 lustre/obdfilter/Makefile
1358 lustre/obdfilter/autoMakefile
1359 lustre/osc/Makefile
1360 lustre/osc/autoMakefile
1361 lustre/ost/Makefile
1362 lustre/ost/autoMakefile
1363 lustre/mgc/Makefile
1364 lustre/mgc/autoMakefile
1365 lustre/mgs/Makefile
1366 lustre/mgs/autoMakefile
1367 lustre/ptlrpc/Makefile
1368 lustre/ptlrpc/autoMakefile
1369 lustre/quota/Makefile
1370 lustre/quota/autoMakefile
1371 lustre/scripts/Makefile
1372 lustre/scripts/version_tag.pl
1373 lustre/tests/Makefile
1374 lustre/utils/Makefile
1375 ])
1376 case $lb_target_os in
1377         darwin)
1378                 AC_CONFIG_FILES([ lustre/obdclass/darwin/Makefile ])
1379                 ;;
1380 esac
1381
1382 ])