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