Whamcloud - gitweb
LU-3344 tests: Verify file handle system calls
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
1 #
2 # LC_CONFIG_SRCDIR
3 #
4 # Wrapper for AC_CONFIG_SUBDIR
5 #
6 AC_DEFUN([LC_CONFIG_SRCDIR],
7 [AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
8 libcfs_is_module=yes
9 ldiskfs_is_ext4=yes
10 ])
11
12 #
13 # LC_PATH_DEFAULTS
14 #
15 # lustre specific paths
16 #
17 AC_DEFUN([LC_PATH_DEFAULTS],
18 [# ptlrpc kernel build requires this
19 LUSTRE="$PWD/lustre"
20 AC_SUBST(LUSTRE)
21
22 # mount.lustre
23 rootsbindir='$(CROSS_PATH)/sbin'
24 AC_SUBST(rootsbindir)
25
26 demodir='$(docdir)/demo'
27 AC_SUBST(demodir)
28
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
31 ])
32
33 #
34 # LC_TARGET_SUPPORTED
35 #
36 # is the target os supported?
37 #
38 AC_DEFUN([LC_TARGET_SUPPORTED],
39 [case $target_os in
40         linux* | darwin*)
41 $1
42                 ;;
43         *)
44 $2
45                 ;;
46 esac
47 ])
48
49 #
50 # LC_CONFIG_OBD_BUFFER_SIZE
51 #
52 # the maximum buffer size of lctl ioctls
53 #
54 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
55 [AC_MSG_CHECKING([maximum OBD ioctl size])
56 AC_ARG_WITH([obd-buffer-size],
57         AC_HELP_STRING([--with-obd-buffer-size=[size]],
58                         [set lctl ioctl maximum bytes (default=8192)]),
59         [
60                 OBD_BUFFER_SIZE=$with_obd_buffer_size
61         ],[
62                 OBD_BUFFER_SIZE=8192
63         ])
64 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
65 AC_DEFINE_UNQUOTED(CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
66 ])
67
68 #
69 # LC_READLINK_SSIZE_T
70 #
71 AC_DEFUN([LC_READLINK_SSIZE_T],
72 [AC_MSG_CHECKING([if readlink returns ssize_t])
73 AC_TRY_COMPILE([
74         #include <unistd.h>
75 ],[
76         ssize_t readlink(const char *, char *, size_t);
77 ],[
78         AC_MSG_RESULT([yes])
79         AC_DEFINE(HAVE_POSIX_1003_READLINK, 1, [readlink returns ssize_t])
80 ],[
81         AC_MSG_RESULT([no])
82 ])
83 ])
84
85 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES],
86 [AC_MSG_CHECKING([if file handle and related syscalls are supported by glibc])
87 AC_CHECK_FUNCS([name_to_handle_at
88 ],[
89         AC_MSG_RESULT([yes])
90         AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
91                 [file handle and related syscalls are supported])
92 ],[
93         AC_MSG_RESULT([no])
94 ])
95 ])
96
97 #
98 # LC_FUNC_DEV_SET_RDONLY
99 #
100 # check whether dev_set_rdonly is exported.  This is needed until we
101 # have another mechanism to fence IO from the underlying device.
102 #
103 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY],
104 [LB_CHECK_SYMBOL_EXPORT([dev_set_rdonly],
105 [block/ll_rw_block.c,block/blk-core.c],[
106         AC_DEFINE(HAVE_DEV_SET_RDONLY, 1, [kernel exports dev_set_rdonly])
107 ],[
108         AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])
109 ])
110 ])
111
112 #
113 # Ensure stack size big than 8k in Lustre server (all kernels)
114 #
115 AC_DEFUN([LC_STACK_SIZE],
116 [AC_MSG_CHECKING([stack size big than 8k])
117 LB_LINUX_TRY_COMPILE([
118         #include <linux/thread_info.h>
119 ],[
120         #if THREAD_SIZE < 8192
121         #error "stack size < 8192"
122         #endif
123 ],[
124         AC_MSG_RESULT(yes)
125 ],[
126         AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 8KB stack.])
127 ])
128 ])
129
130 #
131 # Allow the user to set the MDS thread upper limit
132 #
133 AC_DEFUN([LC_MDS_MAX_THREADS],
134 [
135         AC_ARG_WITH([mds_max_threads],
136         AC_HELP_STRING([--with-mds-max-threads=count],
137                        [maximum threads available on the MDS: (default=512)]),
138         [
139                 MDS_THREAD_COUNT=$with_mds_max_threads
140                 AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $MDS_THREAD_COUNT, [maximum number of MDS threads])
141         ])
142 ])
143
144 #
145 # LC_CONFIG_PINGER
146 #
147 # the pinger is temporary, until we have the recovery node in place
148 #
149 AC_DEFUN([LC_CONFIG_PINGER],
150 [AC_MSG_CHECKING([whether to enable pinger support])
151 AC_ARG_ENABLE([pinger],
152         AC_HELP_STRING([--disable-pinger],
153                         [disable recovery pinger support]),
154         [],[enable_pinger='yes'])
155 AC_MSG_RESULT([$enable_pinger])
156 if test x$enable_pinger != xno ; then
157   AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
158 fi
159 ])
160
161 #
162 # LC_CONFIG_CHECKSUM
163 #
164 # do checksum of bulk data between client and OST
165 #
166 AC_DEFUN([LC_CONFIG_CHECKSUM],
167 [AC_MSG_CHECKING([whether to enable data checksum support])
168 AC_ARG_ENABLE([checksum],
169        AC_HELP_STRING([--disable-checksum],
170                        [disable data checksum support]),
171        [],[enable_checksum='yes'])
172 AC_MSG_RESULT([$enable_checksum])
173 if test x$enable_checksum != xno ; then
174   AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
175 fi
176 ])
177
178 #
179 # LC_CONFIG_LIBLUSTRE_RECOVERY
180 #
181 AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
182 [AC_MSG_CHECKING([whether to enable liblustre recovery support])
183 AC_ARG_ENABLE([liblustre-recovery],
184         AC_HELP_STRING([--disable-liblustre-recovery],
185                         [disable liblustre recovery support]),
186         [],[enable_liblustre_recovery='yes'])
187 AC_MSG_RESULT([$enable_liblustre_recovery])
188 if test x$enable_liblustre_recovery != xno ; then
189   AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
190 fi
191 ])
192
193 #
194 # LC_CONFIG_HEALTH_CHECK_WRITE
195 #
196 # Turn off the actual write to the disk
197 #
198 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
199 [AC_MSG_CHECKING([whether to enable a write with the health check])
200 AC_ARG_ENABLE([health_write],
201         AC_HELP_STRING([--enable-health_write],
202                         [enable disk writes when doing health check]),
203         [],[enable_health_write='no'])
204 AC_MSG_RESULT([$enable_health_write])
205 if test x$enable_health_write != xno ; then
206   AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
207 fi
208 ])
209
210 AC_DEFUN([LC_CONFIG_LRU_RESIZE],
211 [AC_MSG_CHECKING([whether to enable lru self-adjusting])
212 AC_ARG_ENABLE([lru_resize],
213         AC_HELP_STRING([--enable-lru-resize],
214                         [enable lru resize support]),
215         [],[enable_lru_resize='yes'])
216 AC_MSG_RESULT([$enable_lru_resize])
217 if test x$enable_lru_resize != xno; then
218    AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
219 fi
220 ])
221
222 #
223 # Quota support. The kernel must support CONFIG_QUOTA.
224 #
225 AC_DEFUN([LC_QUOTA_CONFIG],
226 [LB_LINUX_CONFIG_IM([QUOTA],[],[
227         AC_MSG_ERROR([Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])
228         ])
229 ])
230
231 # truncate_complete_page() has never been exported from an upstream kernel
232 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
233 # delete_from_page_cache() is exported from 2.6.39
234 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE],
235          [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
236                                  [mm/truncate.c],
237                                  [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
238                                             [kernel export truncate_complete_page])])
239           LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
240                                  [mm/filemap.c],
241                                  [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
242                                             [kernel export remove_from_page_cache])])
243           LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
244                                  [mm/filemap.c],
245                                  [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
246                                             [kernel export delete_from_page_cache])])
247          ])
248
249 #
250 # LC_CAPA_CRYPTO
251 #
252 AC_DEFUN([LC_CAPA_CRYPTO],
253 [LB_LINUX_CONFIG_IM([CRYPTO],[],[
254         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
255 ])
256 LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
257         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
258 ])
259 LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
260         AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
261 ])
262 ])
263
264 #
265 # LC_CONFIG_RMTCLIENT
266 #
267 dnl FIXME
268 dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
269 dnl FIXME
270 AC_DEFUN([LC_CONFIG_RMTCLIENT],
271 [LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
272         AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
273 ])
274 ])
275
276 #
277 # LC_CONFIG_GSS_KEYRING (default 'auto', tests for dependencies, if found, enables; only called if gss is enabled)
278 #
279 AC_DEFUN([LC_CONFIG_GSS_KEYRING],
280 [AC_MSG_CHECKING([whether to enable gss keyring backend])
281  AC_ARG_ENABLE([gss_keyring],
282                [AC_HELP_STRING([--disable-gss-keyring],
283                                [disable gss keyring backend])],
284                [],[enable_gss_keyring='auto'])
285  AC_MSG_RESULT([$enable_gss_keyring])
286
287  if test x$enable_gss_keyring != xno; then
288         LB_LINUX_CONFIG_IM([KEYS],[],
289                            [gss_keyring_conf_test='fail';
290                             AC_MSG_WARN([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
291
292         AC_CHECK_LIB([keyutils], [keyctl_search], [],
293                      [gss_keyring_conf_test='fail';
294                       AC_MSG_WARN([libkeyutils is not found, which is required by gss keyring backend])],)
295
296         if test x$gss_keyring_conf_test != xfail; then
297                 AC_DEFINE([HAVE_GSS_KEYRING], [1], [Define this if you enable gss keyring backend])
298                 enable_gss_keyring='yes'
299         else
300                 if test x$enable_gss_keyring == xyes; then
301                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
302                 else
303                         AC_MSG_WARN([Cannot enable gss keyring.  See above for details.])
304                 fi
305         fi
306  fi
307 ])
308
309 AC_DEFUN([LC_CONFIG_SUNRPC],
310 [LB_LINUX_CONFIG_IM([SUNRPC],[],
311                     [if test x$sunrpc_required == xyes; then
312                          AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])
313                      fi])
314 ])
315
316 #
317 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
318 #
319 # Build gss and related tools of Lustre. Currently both kernel and user space
320 # parts are depend on linux platform.
321 #
322 AC_DEFUN([LC_CONFIG_GSS],
323 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
324  AC_ARG_ENABLE([gss],
325                [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
326                [],[enable_gss='auto'])
327  AC_MSG_RESULT([$enable_gss])
328
329  if test x$enable_gss != xno; then
330         LC_CONFIG_GSS_KEYRING
331         sunrpc_required=$enable_gss
332         LC_CONFIG_SUNRPC
333         sunrpc_required=no
334
335         LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
336                            [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
337         LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
338                            [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
339         LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
340                            [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
341         LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
342                            [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
343
344         require_krb5=$enable_gss
345         AC_KERBEROS_V5
346         require_krb5=no
347
348         if test x$KRBDIR != x; then
349                 AC_CHECK_LIB([gssapi], [gss_export_lucid_sec_context],
350                              [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi";
351                               gss_conf_test='success'],
352                              [AC_CHECK_LIB([gssglue], [gss_export_lucid_sec_context],
353                                            [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue";
354                                             gss_conf_test='success'],
355                                            [if test x$enable_gss == xyes; then
356                                                 AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])
357                                             else
358                                                 AC_MSG_WARN([libgssapi or libgssglue is not found, which is required by GSS.])
359                                             fi])],)
360                 AC_SUBST(GSSAPI_LIBS)
361         fi
362
363         if test x$gss_conf_test == xsuccess; then
364                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
365                 enable_gss='yes'
366         fi
367
368  fi
369 ])
370
371 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
372 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
373 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
374 # v3.1 onward have a 2 arg version (inode, mask)
375 AC_DEFUN([LC_INODE_PERMISION_2ARGS],
376 [AC_MSG_CHECKING([inode_operations->permission has two args])
377 LB_LINUX_TRY_COMPILE([
378         #include <linux/fs.h>
379 ],[
380         struct inode *inode __attribute__ ((unused));
381
382         inode = NULL;
383         inode->i_op->permission(NULL, 0);
384 ],[
385         AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
386                   [inode_operations->permission has two args])
387         AC_MSG_RESULT([yes])
388 ],[
389         AC_MSG_RESULT([no])
390 ])
391 ])
392
393 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
394 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS],
395 [AC_MSG_CHECKING([if blk_queue_max_segments is defined])
396 LB_LINUX_TRY_COMPILE([
397         #include <linux/blkdev.h>
398 ],[
399         blk_queue_max_segments(NULL, 0);
400 ],[
401         AC_MSG_RESULT(yes)
402         AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
403                   [blk_queue_max_segments is defined])
404 ],[
405         AC_MSG_RESULT(no)
406 ])
407 ])
408
409 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
410 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA],
411 tmp_flags="$EXTRA_KCFLAGS"
412 EXTRA_KCFLAGS="-Werror"
413 [AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct fs_disk_quota])
414 LB_LINUX_TRY_COMPILE([
415         #include <linux/fs.h>
416         #include <linux/quota.h>
417 ],[
418         ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
419 ],[
420         AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota])
421         AC_MSG_RESULT([yes])
422 ],[
423         AC_MSG_RESULT([no])
424         AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct kqid & fs_disk_quota])
425         LB_LINUX_TRY_COMPILE([
426                 #include <linux/fs.h>
427                 #include <linux/quota.h>
428         ],[
429                 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
430         ],[
431                 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota])
432                 AC_DEFINE(HAVE_DQUOT_KQID, 1, [quotactl_ops.set_dqblk takes struct kqid])
433                 AC_MSG_RESULT([yes])
434         ],[
435                 AC_MSG_RESULT([no])
436                 AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct kqid&fs_disk_quota])
437         ])
438 ])
439 EXTRA_KCFLAGS="$tmp_flags"
440 ])
441
442 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
443 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND],
444 [AC_MSG_CHECKING([if dquot_suspend is defined])
445 LB_LINUX_TRY_COMPILE([
446         #include <linux/quotaops.h>
447 ],[
448         dquot_suspend(NULL, -1);
449 ],[
450         AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
451         AC_MSG_RESULT([yes])
452 ],[
453         AC_MSG_RESULT([no])
454 ])
455 ])
456
457 #
458 # LC_QUOTA64
459 #
460 # Check if kernel has been patched for 64-bit quota limits support.
461 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
462 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
463 # that in the absence of quotaio_v1.h in the kernel headers.
464 #
465 AC_DEFUN([LC_QUOTA64],[
466         AC_MSG_CHECKING([if kernel has 64-bit quota limits support])
467 tmp_flags="$EXTRA_KCFLAGS"
468 EXTRA_KCFLAGS="-I$LINUX/fs"
469         LB_LINUX_TRY_COMPILE([
470                 #include <linux/kernel.h>
471                 #include <linux/fs.h>
472                 #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
473                 # include <quota/quotaio_v2.h>
474                 struct v2r1_disk_dqblk dqblk_r1;
475                 #else
476                 #include <linux/quota.h>
477                 int ver = QFMT_VFS_V1;
478                 #endif
479         ],[],[
480                 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
481                 AC_MSG_RESULT([yes])
482         ],[
483                 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],[
484                         AC_MSG_ERROR([You have got no 64-bit kernel quota support.])
485                 ],[])
486                 AC_MSG_RESULT([no])
487         ])
488 EXTRA_KCFLAGS=$tmp_flags
489 ])
490
491 #
492 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
493 #
494 AC_DEFUN([LC_FS_STRUCT_RWLOCK],
495 [AC_MSG_CHECKING([if fs_struct.lock use rwlock])
496 LB_LINUX_TRY_COMPILE([
497         #include <asm/atomic.h>
498         #include <linux/spinlock.h>
499         #include <linux/fs_struct.h>
500 ],[
501         ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
502 ],[
503         AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1,
504                   [fs_struct.lock use rwlock])
505         AC_MSG_RESULT([yes])
506 ],[
507         AC_MSG_RESULT([no])
508 ])
509 ])
510
511 #
512 # 2.6.36 super_operations add evict_inode method. it hybird of
513 # delete_inode & clear_inode.
514 #
515 AC_DEFUN([LC_SBOPS_EVICT_INODE],
516 [AC_MSG_CHECKING([if super_operations.evict_inode exist])
517 LB_LINUX_TRY_COMPILE([
518         #include <linux/fs.h>
519 ],[
520         ((struct super_operations *)0)->evict_inode(NULL);
521 ],[
522         AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
523                 [super_operations.evict_inode() is exist in kernel])
524         AC_MSG_RESULT([yes])
525 ],[
526         AC_MSG_RESULT([no])
527 ])
528 ])
529
530 #
531 # 2.6.35 file_operations.fsync taken 2 arguments.
532 # 3.0.0 file_operations.fsync takes 4 arguments.
533 #
534 AC_DEFUN([LC_FILE_FSYNC],
535 [AC_MSG_CHECKING([if file_operations.fsync takes 4 or 2 arguments])
536 LB_LINUX_TRY_COMPILE([
537         #include <linux/fs.h>
538 ],[
539         ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
540 ],[
541         AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
542                 [file_operations.fsync takes 4 arguments])
543         AC_MSG_RESULT([yes, 4 args])
544 ],[
545         LB_LINUX_TRY_COMPILE([
546                 #include <linux/fs.h>
547         ],[
548            ((struct file_operations *)0)->fsync(NULL, 0);
549         ],[
550                 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
551                         [file_operations.fsync takes 2 arguments])
552                 AC_MSG_RESULT([yes, 2 args])
553         ],[
554                 AC_MSG_RESULT([no])
555         ])
556 ])
557 ])
558
559 #
560 # 2.6.37 remove kernel_locked
561 #
562 AC_DEFUN([LC_KERNEL_LOCKED],
563 [AC_MSG_CHECKING([if kernel_locked is defined])
564 LB_LINUX_TRY_COMPILE([
565         #include <linux/smp_lock.h>
566 ],[
567         kernel_locked();
568 ],[
569         AC_MSG_RESULT([yes])
570         AC_DEFINE(HAVE_KERNEL_LOCKED, 1,
571                 [kernel_locked is defined])
572 ],[
573         AC_MSG_RESULT([no])
574 ])
575 ])
576
577 #
578 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
579 #
580 AC_DEFUN([LC_D_COMPARE_7ARGS],
581 [AC_MSG_CHECKING([if d_compare taken 7 arguments])
582 LB_LINUX_TRY_COMPILE([
583         #include <linux/dcache.h>
584 ],[
585         ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
586 ],[
587         AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1,
588                 [d_compare need 7 arguments])
589         AC_MSG_RESULT([yes])
590 ],[
591         AC_MSG_RESULT([no])
592 ])
593 ])
594
595 #
596 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
597 #
598 AC_DEFUN([LC_D_DELETE_CONST],
599 [AC_MSG_CHECKING([if d_delete has const declare on first parameter])
600 tmp_flags="$EXTRA_KCFLAGS"
601 EXTRA_KCFLAGS="-Werror"
602 LB_LINUX_TRY_COMPILE([
603         #include <linux/dcache.h>
604 ],[
605         const struct dentry *d = NULL;
606         ((struct dentry_operations*)0)->d_delete(d);
607 ],[
608         AC_DEFINE(HAVE_D_DELETE_CONST, const,
609                 [d_delete first parameter declared const])
610         AC_MSG_RESULT([yes])
611 ],[
612         AC_DEFINE(HAVE_D_DELETE_CONST, , [])
613         AC_MSG_RESULT([no])
614 ])
615 EXTRA_KCFLAGS="$tmp_flags"
616 ])
617
618 #
619 # 2.6.38 dcache_lock removed. rcu-walk commited.
620 #
621 AC_DEFUN([LC_DCACHE_LOCK],
622 [AC_MSG_CHECKING([if dcache_lock is exist])
623 LB_LINUX_TRY_COMPILE([
624         #include <linux/dcache.h>
625 ],[
626         spin_lock(&dcache_lock);
627 ],[
628         AC_DEFINE(HAVE_DCACHE_LOCK, 1,
629                 [dcache_lock is exist])
630         AC_MSG_RESULT([yes])
631 ],[
632         AC_MSG_RESULT([no])
633 ])
634 ])
635
636 #
637 # 2.6.38 inode.i_rcu added.
638 #
639 AC_DEFUN([LC_INODE_I_RCU],
640 [AC_MSG_CHECKING([if inode.i_rcu exists])
641 LB_LINUX_TRY_COMPILE([
642         #include <linux/fs.h>
643 ],[
644         struct inode ino;
645         struct rcu_head rcu = {};
646         ino.i_rcu = rcu;
647 ],[
648         AC_DEFINE(HAVE_INODE_I_RCU, 1,
649                 [inode.i_rcu exists])
650         AC_MSG_RESULT([yes])
651 ],[
652         AC_MSG_RESULT([no])
653 ])
654 ])
655
656 #
657 # 2.6.38 export blkdev_get_by_dev
658 #
659 AC_DEFUN([LC_BLKDEV_GET_BY_DEV],
660 [LB_CHECK_SYMBOL_EXPORT([blkdev_get_by_dev],
661 [fs/block_dev.c],[
662 AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
663             [blkdev_get_by_dev is exported by the kernel])
664 ],[
665 ])
666 ])
667
668 #
669 # 2.6.38 export simple_setattr
670 #
671 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
672 [LB_CHECK_SYMBOL_EXPORT([simple_setattr],
673 [fs/libfs.c],[
674 AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
675             [simple_setattr is exported by the kernel])
676 ],[
677 ])
678 ])
679
680 #
681 # truncate callback removed since 2.6.39
682 #
683 AC_DEFUN([LC_IOP_TRUNCATE],
684 [AC_MSG_CHECKING([inode_operations has .truncate member function])
685 LB_LINUX_TRY_COMPILE([
686         #include <linux/fs.h>
687 ],[
688         ((struct inode_operations *)0)->truncate(NULL);
689 ],[
690         AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
691                   [inode_operations has .truncate member function])
692         AC_MSG_RESULT([yes])
693 ],[
694         AC_MSG_RESULT([no])
695 ])
696 ])
697
698 #
699 # 2.6.39 remove unplug_fn from request_queue.
700 #
701 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
702 [AC_MSG_CHECKING([if request_queue has unplug_fn field])
703 LB_LINUX_TRY_COMPILE([
704         #include <linux/blkdev.h>
705 ],[
706         do{ }while(sizeof(((struct request_queue *)0)->unplug_fn));
707 ],[
708         AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
709                   [request_queue has unplug_fn field])
710         AC_MSG_RESULT([yes])
711 ],[
712         AC_MSG_RESULT([no])
713 ])
714 ])
715
716 #
717 # 2.6.39 replace get_sb with mount in struct file_system_type
718 #
719 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT],
720 [AC_MSG_CHECKING([if file_system_type has mount field])
721 LB_LINUX_TRY_COMPILE([
722         #include <linux/fs.h>
723 ],[
724         struct file_system_type fst;
725         void *i = (void *) fst.mount;
726 ],[
727         AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
728                 [struct file_system_type has mount field])
729         AC_MSG_RESULT([yes])
730 ],[
731         AC_MSG_RESULT([no])
732 ])
733 ])
734
735 #
736 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
737 # added to Linux kernel 2.6.39.
738 # Check if client supports these functions
739 #
740 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS],
741 [LB_LINUX_CONFIG_IM([FHANDLE],[
742         AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
743                 [kernel supports fhandles and related syscalls])
744 ],[])
745 ])
746
747 #
748 # 3.0 dirty_inode() has a flag parameter
749 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
750 #
751 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG],
752 [AC_MSG_CHECKING([if dirty_inode super_operation takes flag])
753 LB_LINUX_TRY_COMPILE([
754         #include <linux/fs.h>
755 ],[
756         struct inode *inode;
757         inode->i_sb->s_op->dirty_inode(NULL, 0);
758 ],[
759         AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
760                   [dirty_inode super_operation takes flag])
761         AC_MSG_RESULT([yes])
762 ],[
763         AC_MSG_RESULT([no])
764 ])
765 ])
766
767 #
768 # 2.6.38 generic_permission taken 4 parameters.
769 # in fact, it means rcu-walk aware permission bring.
770 #
771 # 3.1 generic_permission taken 2 parameters.
772 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
773 #
774 AC_DEFUN([LC_GENERIC_PERMISSION],
775 [AC_MSG_CHECKING([if generic_permission take 2 or 4 arguments])
776 LB_LINUX_TRY_COMPILE([
777         #include <linux/fs.h>
778 ],[
779         generic_permission(NULL, 0);
780 ],[
781         AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
782                   [generic_permission taken 2 arguments])
783         AC_MSG_RESULT([yes, 2 args])
784 ],[
785         LB_LINUX_TRY_COMPILE([
786                 #include <linux/fs.h>
787         ],[
788                 generic_permission(NULL, 0, 0, NULL);
789         ],[
790                 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
791                           [generic_permission taken 4 arguments])
792                 AC_MSG_RESULT([yes, 4 args])
793         ],[
794                 AC_MSG_RESULT([no])
795         ])
796 ])
797 ])
798
799 #
800 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
801 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
802 #
803 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS],
804 [AC_MSG_CHECKING([if lock-manager ops renamed to lm_xxx])
805 LB_LINUX_TRY_COMPILE([
806         #include <linux/fs.h>
807 ],[
808         struct lock_manager_operations lm_ops;
809         lm_ops.lm_compare_owner = NULL;
810 ],[
811         AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
812                   [lock-manager ops renamed to lm_xxx])
813         AC_MSG_RESULT([yes])
814 ],[
815         AC_MSG_RESULT([no])
816 ])
817 ])
818
819 #
820 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait/
821 #     inode_dio_done instead.
822 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
823 #
824 AC_DEFUN([LC_INODE_DIO_WAIT],
825 [AC_MSG_CHECKING([if inode->i_alloc_sem is killed and use inode_dio_wait/done.])
826 LB_LINUX_TRY_COMPILE([
827         #include <linux/fs.h>
828 ],[
829         inode_dio_wait((struct inode *)0);
830         inode_dio_done((struct inode *)0);
831 ],[
832         AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
833                   [inode->i_alloc_sem is killed and use inode_dio_wait/done])
834         AC_MSG_RESULT([yes])
835 ],[
836         AC_MSG_RESULT([no])
837 ])
838 ])
839
840 #
841 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
842 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
843 #
844 AC_DEFUN([LC_IOP_GET_ACL],
845 [AC_MSG_CHECKING([inode_operations has .get_acl member function])
846 LB_LINUX_TRY_COMPILE([
847         #include <linux/fs.h>
848 ],[
849         struct inode_operations iop;
850         iop.get_acl = NULL;
851 ],[
852         AC_DEFINE(HAVE_IOP_GET_ACL, 1,
853                   [inode_operations has .get_acl member function])
854         AC_MSG_RESULT([yes])
855 ],[
856         AC_MSG_RESULT([no])
857 ])
858 ])
859
860 #
861 # 3.1 introduced generic_file_llseek_size()
862 #
863 AC_DEFUN([LC_FILE_LLSEEK_SIZE],
864         [LB_CHECK_SYMBOL_EXPORT([generic_file_llseek_size],
865         [fs/read_write.c],
866         [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
867                    [generic_file_llseek_size is exported by the kernel])])
868 ])
869
870 #
871 # 3.2 request_queue.make_request_fn defined as function returns with void
872 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
873 #
874 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN],
875 [AC_MSG_CHECKING([if request_queue.make_request_fn returns void but not int])
876 LB_LINUX_TRY_COMPILE([
877         #include <linux/blkdev.h>
878 ],[
879         int ret;
880         make_request_fn         *mrf;
881         ret = mrf(NULL, NULL);
882 ],[
883         AC_MSG_RESULT([no])
884 ],[
885         AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
886                   [request_queue.make_request_fn returns void but not int])
887         AC_MSG_RESULT([yes])
888 ])
889 ])
890
891 #
892 # 3.2 protects inode->i_nlink from direct modification
893 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
894 # at the same time adds set_nlink(), so checks set_nlink() for it.
895 #
896 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK],
897 [AC_MSG_CHECKING([if inode->i_nlink is protected from direct modification])
898 LB_LINUX_TRY_COMPILE([
899         #include <linux/fs.h>
900 ],[
901         struct inode i;
902         set_nlink(&i, 1);
903 ],[
904         AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
905                   [inode->i_nlink is protected from direct modification])
906         AC_MSG_RESULT([yes])
907 ],[
908         AC_MSG_RESULT([no])
909 ])
910 ])
911
912 #
913 # 3.3 introduces migrate_mode.h and migratepage has 4 args
914 #
915 AC_DEFUN([LC_HAVE_MIGRATE_HEADER],
916 [LB_CHECK_FILE([$LINUX/include/linux/migrate.h],[
917                 AC_DEFINE(HAVE_MIGRATE_H, 1,
918                 [kernel has include/linux/migrate.h])
919 ],[LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h],[
920                 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
921                         [kernel has include/linux/migrate_mode.h])
922 ],[
923         AC_MSG_RESULT([no])
924 ])
925 ])
926 ])
927
928 AC_DEFUN([LC_MIGRATEPAGE_4ARGS],
929 [AC_MSG_CHECKING([if address_space_operations.migratepage has 4 args])
930 LB_LINUX_TRY_COMPILE([
931         #include <linux/fs.h>
932 #ifdef HAVE_MIGRATE_H
933         #include <linux/migrate.h>
934 #elif defined(HAVE_MIGRATE_MODE_H)
935         #include <linux/migrate_mode.h>
936 #endif
937 ],[
938         struct address_space_operations aops;
939
940         aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
941 ],[
942         AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
943                 [address_space_operations.migratepage has 4 args])
944         AC_MSG_RESULT([yes])
945 ],[
946         AC_MSG_RESULT([no])
947 ])
948 ])
949
950 #
951 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
952 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
953 #
954 AC_DEFUN([LC_SUPEROPS_USE_DENTRY],
955 [AC_MSG_CHECKING([if super_operations use dentry as parameter])
956 tmp_flags="$EXTRA_KCFLAGS"
957 EXTRA_KCFLAGS="-Werror"
958 LB_LINUX_TRY_COMPILE([
959         #include <linux/fs.h>
960         int show_options(struct seq_file *seq, struct dentry *root){
961                 return 0;
962         }
963 ],[
964         struct super_operations ops;
965         ops.show_options = show_options;
966 ],[
967         AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
968                   [super_operations use dentry as parameter])
969         AC_MSG_RESULT([yes])
970 ],[
971         AC_MSG_RESULT([no])
972 ])
973 EXTRA_KCFLAGS="$tmp_flags"
974 ])
975
976 #
977 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
978 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
979 #
980 AC_DEFUN([LC_INODEOPS_USE_UMODE_T],
981 [AC_MSG_CHECKING([if inode_operations use umode_t as parameter])
982 tmp_flags="$EXTRA_KCFLAGS"
983 EXTRA_KCFLAGS="-Werror"
984 LB_LINUX_TRY_COMPILE([
985         #include <linux/fs.h>
986         #include <linux/types.h>
987         int my_mknod(struct inode *dir, struct dentry *dchild,
988                      umode_t mode, dev_t dev)
989         {
990                 return 0;
991         }
992 ],[
993         struct inode_operations ops;
994         ops.mknod = my_mknod;
995 ],[
996         AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
997                   [inode_operations use umode_t as parameter])
998         AC_MSG_RESULT([yes])
999 ],[
1000         AC_MSG_RESULT([no])
1001 ])
1002 EXTRA_KCFLAGS="$tmp_flags"
1003 ])
1004
1005 # 3.4 kmap_atomic removes second argument
1006 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1007 #
1008 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG],
1009 [AC_MSG_CHECKING([if kmap_atomic has only 1 argument])
1010 LB_LINUX_TRY_COMPILE([
1011         #include <linux/highmem.h>
1012 ],[
1013         kmap_atomic(NULL);
1014 ],[
1015         AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1016                   [have kmap_atomic has only 1 argument])
1017         AC_MSG_RESULT([yes])
1018 ],[
1019         AC_MSG_RESULT([no])
1020 ])
1021 ])
1022
1023 #
1024 # 3.4 switchs touch_atime to struct path
1025 # see kernel commit 68ac1234fb949b66941d94dce4157742799fc581
1026 #
1027 AC_DEFUN([LC_TOUCH_ATIME_1ARG],
1028 [AC_MSG_CHECKING([if touch_atime use one argument])
1029 LB_LINUX_TRY_COMPILE([
1030         #include <linux/fs.h>
1031 ],[
1032         touch_atime((struct path *)NULL);
1033 ],[
1034         AC_DEFINE(HAVE_TOUCH_ATIME_1ARG, 1,
1035                   [touch_atime use one argument])
1036         AC_MSG_RESULT([yes])
1037 ],[
1038         AC_MSG_RESULT([no])
1039 ])
1040 ])
1041
1042 #
1043 # 3.4 converts d_alloc_root to d_make_root
1044 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1045 #
1046 AC_DEFUN([LC_HAVE_D_MAKE_ROOT],
1047 [AC_MSG_CHECKING([if have d_make_root])
1048 LB_LINUX_TRY_COMPILE([
1049         #include <linux/fs.h>
1050 ],[
1051         d_make_root((struct inode *)NULL);
1052 ],[
1053         AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1054                   [have d_make_root])
1055         AC_MSG_RESULT([yes])
1056 ],[
1057         AC_MSG_RESULT([no])
1058 ])
1059 ])
1060
1061 #
1062 # 3.4 cache_register/cache_unregister are removed
1063 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1064 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1065 # are defined, but not exported.
1066 # 3.3 cache_register_net/cache_unregister_net are
1067 # exported and replacing cache_register/cache_unregister in 3.4
1068 #
1069 AC_DEFUN([LC_HAVE_CACHE_REGISTER],
1070 [AC_MSG_CHECKING([if have cache_register])
1071 LB_LINUX_TRY_COMPILE([
1072         #include <linux/sunrpc/cache.h>
1073 ],[
1074         cache_register(NULL);
1075 ],[
1076         AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1077                   [have cache_register])
1078         AC_MSG_RESULT([yes])
1079 ],[
1080         AC_MSG_RESULT([no])
1081 ])
1082 ])
1083
1084 #
1085 # 3.5 renames end_writeback() back to clear_inode()...
1086 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1087 #
1088 AC_DEFUN([LC_HAVE_CLEAR_INODE],
1089 [AC_MSG_CHECKING([if have clear_inode])
1090 LB_LINUX_TRY_COMPILE([
1091         #include <linux/fs.h>
1092 ],[
1093         clear_inode((struct inode *)NULL);
1094 ],[
1095         AC_DEFINE(HAVE_CLEAR_INODE, 1,
1096                   [have clear_inode])
1097         AC_MSG_RESULT([yes])
1098 ],[
1099         AC_MSG_RESULT([no])
1100 ])
1101 ])
1102
1103 #
1104 # 3.5 encode_fh has parent inode passed in directly
1105 # see kernel commit b0b0382b
1106 #
1107 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT],
1108 [AC_MSG_CHECKING([if encode_fh have parent inode as parameter])
1109 tmp_flags="$EXTRA_KCFLAGS"
1110 EXTRA_KCFLAGS="-Werror"
1111 LB_LINUX_TRY_COMPILE([
1112         #include <linux/exportfs.h>
1113         #include <linux/fs.h>
1114         #include <linux/types.h>
1115         int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1116         {
1117                 return 0;
1118         }
1119 ],[
1120         struct export_operations exp_op;
1121         exp_op.encode_fh = ll_encode_fh;
1122 ],[
1123         AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1124                   [have parent inode as parameter])
1125         AC_MSG_RESULT([yes])
1126 ],[
1127         AC_MSG_RESULT([no])
1128 ])
1129 EXTRA_KCFLAGS="$tmp_flags"
1130 ])
1131
1132 # 3.5 has generic_file_llseek_size with 5 args
1133 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG],
1134 [AC_MSG_CHECKING([if kernel has generic_file_llseek_size with 5 args])
1135 LB_LINUX_TRY_COMPILE([
1136         #include <linux/fs.h>
1137 ],[
1138         generic_file_llseek_size(NULL, 0, 0, 0, 0);
1139 ], [
1140         AC_MSG_RESULT([yes])
1141         AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1142                 [kernel has generic_file_llseek_size with 5 args])
1143 ],[
1144         AC_MSG_RESULT([no])
1145 ])
1146 ])
1147
1148 #
1149 # 3.6 switch i_dentry/d_alias from list to hlist
1150 #
1151 AC_DEFUN([LC_HAVE_DENTRY_D_ALIAS_HLIST],
1152 [AC_MSG_CHECKING([if i_dentry/d_alias uses hlist])
1153 tmp_flags="$EXTRA_KCFLAGS"
1154 EXTRA_KCFLAGS="-Werror"
1155 LB_LINUX_TRY_COMPILE([
1156         #include <linux/fs.h>
1157         #include <linux/list.h>
1158 ],[
1159         struct inode inode;
1160         struct dentry dentry;
1161         struct hlist_head head;
1162         struct hlist_node node;
1163         inode.i_dentry = head;
1164         dentry.d_alias = node;
1165 ],[
1166         AC_DEFINE(HAVE_DENTRY_D_ALIAS_HLIST, 1,
1167                   [have i_dentry/d_alias uses hlist])
1168         AC_MSG_RESULT([yes])
1169 ],[
1170         AC_MSG_RESULT([no])
1171 ])
1172 EXTRA_KCFLAGS="$tmp_flags"
1173 ])
1174
1175 #
1176 # 3.6 dentry_open uses struct path as first argument
1177 # see kernel commit 765927b2
1178 #
1179 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH],
1180 [AC_MSG_CHECKING([if dentry_open uses struct path as first argument])
1181 tmp_flags="$EXTRA_KCFLAGS"
1182 EXTRA_KCFLAGS="-Werror"
1183 LB_LINUX_TRY_COMPILE([
1184         #include <linux/fs.h>
1185         #include <linux/path.h>
1186 ],[
1187         struct path path;
1188         dentry_open(&path, 0, NULL);
1189 ],[
1190         AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1191                   [dentry_open uses struct path as first argument])
1192         AC_MSG_RESULT([yes])
1193 ],[
1194         AC_MSG_RESULT([no])
1195 ])
1196 EXTRA_KCFLAGS="$tmp_flags"
1197 ])
1198
1199 #
1200 # 3.6 vfs adds iop->atomic_open
1201 #
1202 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN],
1203 [AC_MSG_CHECKING([if iop has atomic_open])
1204 LB_LINUX_TRY_COMPILE([
1205         #include <linux/fs.h>
1206 ],[
1207         struct inode_operations iop;
1208         iop.atomic_open = NULL;
1209 ],[
1210         AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1211                   [have iop atomic_open])
1212         AC_MSG_RESULT([yes])
1213 ],[
1214         AC_MSG_RESULT([no])
1215 ])
1216 ])
1217
1218 #
1219 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1220 #
1221 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS],
1222 [AC_MSG_CHECKING([if posix_acl_to_xattr takes struct user_namespace])
1223 LB_LINUX_TRY_COMPILE([
1224         #include <linux/fs.h>
1225         #include <linux/posix_acl_xattr.h>
1226 ],[
1227         posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1228 ],[
1229         AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1230                   [posix_acl_to_xattr takes struct user_namespace])
1231         AC_MSG_RESULT([yes])
1232 ],[
1233         AC_MSG_RESULT([no])
1234 ])
1235 ])
1236
1237 #
1238 # 3.8 struct file has new member f_inode
1239 #
1240 AC_DEFUN([LC_HAVE_FILE_F_INODE],
1241 [AC_MSG_CHECKING([if struct file has memeber f_inode])
1242 LB_LINUX_TRY_COMPILE([
1243         #include <linux/fs.h>
1244 ],[
1245         ((struct file *)0)->f_inode = NULL;
1246 ],[
1247         AC_DEFINE(HAVE_FILE_F_INODE, 1,
1248                   [struct file has memeber f_inode])
1249         AC_MSG_RESULT([yes])
1250 ],[
1251         AC_MSG_RESULT([no])
1252 ])
1253 ])
1254
1255 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS],
1256 [AC_MSG_CHECKING([if sunrpc_cache_pipe_upcall takes 3 args])
1257 LB_LINUX_TRY_COMPILE([
1258         #include <linux/sunrpc/cache.h>
1259 ],[
1260         sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1261 ],[
1262         AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1263                 [sunrpc_cache_pipe_upcall takes 3 args])
1264         AC_MSG_RESULT([yes])
1265 ],[
1266         AC_MSG_RESULT([no])
1267 ])
1268 ])
1269
1270 #
1271 # 3.9 uses hlist_for_each_entry with 3 args
1272 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1273 #
1274 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG],
1275 [AC_MSG_CHECKING([if hlist_for_each_entry has 3 args])
1276 LB_LINUX_TRY_COMPILE([
1277         #include <linux/list.h>
1278         #include <linux/fs.h>
1279 ],[
1280         struct inode *inode;
1281         struct dentry *dentry;
1282         hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) {
1283                 continue;
1284         }
1285 ],[
1286         AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1, [3 args])
1287         AC_MSG_RESULT([yes])
1288 ],[
1289         AC_MSG_RESULT([no])
1290 ])
1291 ])
1292
1293 #
1294 # 3.9 killed f_vfsmnt by
1295 # 182be684784334598eee1d90274e7f7aa0063616
1296 # replacement is f_path.mnt
1297 #
1298 AC_DEFUN([LC_HAVE_F_PATH_MNT],
1299 [AC_MSG_CHECKING([if struct file has f_path.mnt])
1300 LB_LINUX_TRY_COMPILE([
1301         #include <linux/fs.h>
1302 ],[
1303         struct file *fp = NULL;
1304         struct path  path;
1305
1306         path.mnt = fp->f_path.mnt;
1307 ],[
1308         AC_DEFINE(HAVE_F_PATH_MNT,1,[yes])
1309         AC_MSG_RESULT([yes])
1310 ],[
1311         AC_MSG_RESULT([no])
1312 ])
1313 ])
1314
1315 #
1316 # 3.10+ only supports procfs seq_files handling
1317 #
1318 AC_DEFUN([LC_HAVE_ONLY_PROCFS_SEQ],
1319 [AC_MSG_CHECKING([if procfs only supports using seq_files])
1320 LB_LINUX_TRY_COMPILE([
1321         #include <linux/proc_fs.h>
1322 ],[
1323         ((struct proc_dir_entry *)0)->write_proc(NULL, NULL, 0, NULL);
1324 ],[
1325         AC_MSG_RESULT([no])
1326 ],[
1327         AC_DEFINE(HAVE_ONLY_PROCFS_SEQ, 1, [only seq_files supported])
1328         AC_MSG_RESULT([yes])
1329 ])
1330 ])
1331
1332 # 3.10 release for block device doesn't return int
1333 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT],
1334 [AC_MSG_CHECKING([if block_device_operations release returns int])
1335 LB_LINUX_TRY_COMPILE([
1336         #include <linux/blkdev.h>
1337 ],[
1338         struct block_device_operations fops;
1339         int i __attribute__ ((unused));
1340
1341         i = fops.release(NULL,0);
1342 ],[
1343         AC_MSG_RESULT([yes])
1344         AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1345                   [block device release returns int])
1346 ],[
1347         AC_MSG_RESULT([no])
1348 ])
1349 ])
1350
1351 #
1352 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1353 #
1354 AC_DEFUN([LC_D_COMPARE_5ARGS],
1355 [AC_MSG_CHECKING([if d_compare taken 5 arguments])
1356 LB_LINUX_TRY_COMPILE([
1357         #include <linux/dcache.h>
1358 ],[
1359         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1360 ],[
1361         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1362                 [d_compare need 5 arguments])
1363         AC_MSG_RESULT([yes])
1364 ],[
1365         AC_MSG_RESULT([no])
1366 ])
1367 ])
1368
1369 #
1370 # 3.11 need to access d_count to get dentry reference count
1371 #
1372 AC_DEFUN([LC_HAVE_DCOUNT],
1373 [AC_MSG_CHECKING([if d_count exist])
1374 LB_LINUX_TRY_COMPILE([
1375         #include <linux/dcache.h>
1376 ],[
1377         struct dentry de;
1378
1379         d_count(&de);
1380 ],[
1381         AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
1382         AC_MSG_RESULT([yes])
1383 ],[
1384         AC_MSG_RESULT([no])
1385 ])
1386 ])
1387
1388 #
1389 # 3.12 truncate_pagecache without oldsize parameter
1390 #
1391 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE],
1392 [AC_MSG_CHECKING([if truncate_pagecache with old_size parameter])
1393 LB_LINUX_TRY_COMPILE([
1394         #include <linux/mm.h>
1395 ],[
1396         truncate_pagecache(NULL, 0, 0);
1397 ],[
1398         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1, [with oldsize])
1399         AC_MSG_RESULT([yes])
1400 ],[
1401         AC_MSG_RESULT([no])
1402 ])
1403 ])
1404
1405 #
1406 # 3.12 ki_left removed from struct kiocb
1407 #
1408 AC_DEFUN([LC_KIOCB_KI_LEFT],
1409 [AC_MSG_CHECKING([if struct kiocb with ki_left member])
1410 LB_LINUX_TRY_COMPILE([
1411         #include <linux/aio.h>
1412 ],[
1413         ((struct kiocb*)0)->ki_left = 0;
1414 ],[
1415         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1, [ki_left exist])
1416         AC_MSG_RESULT([yes])
1417 ],[
1418         AC_MSG_RESULT([no])
1419 ])
1420 ])
1421
1422 #
1423 # LC_PROG_LINUX
1424 #
1425 # Lustre linux kernel checks
1426 #
1427 AC_DEFUN([LC_PROG_LINUX],
1428          [
1429          LC_CONFIG_PINGER
1430          LC_CONFIG_CHECKSUM
1431          LC_CONFIG_LIBLUSTRE_RECOVERY
1432          LC_CONFIG_HEALTH_CHECK_WRITE
1433          LC_CONFIG_LRU_RESIZE
1434          LC_LLITE_LLOOP_MODULE
1435
1436          LC_GLIBC_SUPPORT_FHANDLES
1437          LC_CAPA_CRYPTO
1438          LC_CONFIG_RMTCLIENT
1439          LC_CONFIG_GSS
1440
1441          # 2.6.32
1442          LC_BLK_QUEUE_MAX_SEGMENTS
1443
1444          # 2.6.34
1445          LC_HAVE_DQUOT_FS_DISK_QUOTA
1446          LC_HAVE_DQUOT_SUSPEND
1447
1448          # 2.6.35, 3.0.0
1449          LC_FILE_FSYNC
1450          LC_EXPORT_SIMPLE_SETATTR
1451          LC_EXPORT_TRUNCATE_COMPLETE_PAGE
1452
1453          # 2.6.36
1454          LC_FS_STRUCT_RWLOCK
1455          LC_SBOPS_EVICT_INODE
1456
1457          # 2.6.37
1458          LC_KERNEL_LOCKED
1459
1460          # 2.6.38
1461          LC_BLKDEV_GET_BY_DEV
1462          LC_GENERIC_PERMISSION
1463          LC_DCACHE_LOCK
1464          LC_INODE_I_RCU
1465          LC_D_COMPARE_7ARGS
1466          LC_D_DELETE_CONST
1467
1468          # 2.6.39
1469          LC_REQUEST_QUEUE_UNPLUG_FN
1470          LC_HAVE_FHANDLE_SYSCALLS
1471          LC_HAVE_FSTYPE_MOUNT
1472          LC_IOP_TRUNCATE
1473
1474          # 3.0
1475          LC_DIRTY_INODE_WITH_FLAG
1476
1477          # 3.1
1478          LC_LM_XXX_LOCK_MANAGER_OPS
1479          LC_INODE_DIO_WAIT
1480          LC_IOP_GET_ACL
1481          LC_FILE_LLSEEK_SIZE
1482          LC_INODE_PERMISION_2ARGS
1483
1484          # 3.2
1485          LC_HAVE_VOID_MAKE_REQUEST_FN
1486          LC_HAVE_PROTECT_I_NLINK
1487
1488          # 3.3
1489          LC_HAVE_MIGRATE_HEADER
1490          LC_MIGRATEPAGE_4ARGS
1491          LC_SUPEROPS_USE_DENTRY
1492          LC_INODEOPS_USE_UMODE_T
1493          LC_HAVE_CACHE_REGISTER
1494
1495          # 3.4
1496          LC_TOUCH_ATIME_1ARG
1497          LC_HAVE_D_MAKE_ROOT
1498          LC_KMAP_ATOMIC_HAS_1ARG
1499
1500          # 3.5
1501          LC_HAVE_CLEAR_INODE
1502          LC_HAVE_ENCODE_FH_PARENT
1503          LC_FILE_LLSEEK_SIZE_5ARG
1504
1505          # 3.6
1506          LC_HAVE_DENTRY_D_ALIAS_HLIST
1507          LC_DENTRY_OPEN_USE_PATH
1508          LC_HAVE_IOP_ATOMIC_OPEN
1509
1510          # 3.7
1511          LC_HAVE_POSIXACL_USER_NS
1512
1513          # 3.8
1514          LC_HAVE_FILE_F_INODE
1515          LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1516
1517          # 3.9
1518          LC_HAVE_HLIST_FOR_EACH_3ARG
1519          LC_HAVE_F_PATH_MNT
1520
1521          # 3.10
1522          LC_HAVE_ONLY_PROCFS_SEQ
1523          LC_BLKDEV_RELEASE_RETURN_INT
1524
1525          # 3.11
1526          LC_D_COMPARE_5ARGS
1527          LC_HAVE_DCOUNT
1528
1529          # 3.12
1530          LC_OLDSIZE_TRUNCATE_PAGECACHE
1531          LC_KIOCB_KI_LEFT
1532
1533          #
1534          if test x$enable_server != xno ; then
1535                 LC_FUNC_DEV_SET_RDONLY
1536                 LC_STACK_SIZE
1537                 LC_QUOTA64
1538                 LC_QUOTA_CONFIG
1539          fi
1540 ])
1541
1542 #
1543 # LC_CONFIG_CLIENT
1544 #
1545 # Check whether to build the client side of Lustre
1546 #
1547 AC_DEFUN([LC_CONFIG_CLIENT],
1548 [AC_MSG_CHECKING([whether to build Lustre client support])
1549 AC_ARG_ENABLE([client],
1550         AC_HELP_STRING([--disable-client],
1551                         [disable Lustre client support]),
1552         [],[enable_client='yes'])
1553 AC_MSG_RESULT([$enable_client])
1554 ])
1555
1556 #
1557 # LC_CONFIG_LIBLUSTRE
1558 #
1559 # whether to build liblustre
1560 #
1561 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
1562 [AC_MSG_CHECKING([whether to build Lustre library])
1563 AC_ARG_ENABLE([liblustre],
1564         AC_HELP_STRING([--disable-liblustre],
1565                         [disable building of Lustre library]),
1566         [],[enable_liblustre=$with_sysio])
1567 AC_MSG_RESULT([$enable_liblustre])
1568 # only build sysio if liblustre is built
1569 with_sysio="$enable_liblustre"
1570
1571 AC_MSG_CHECKING([whether to build liblustre tests])
1572 AC_ARG_ENABLE([liblustre-tests],
1573         AC_HELP_STRING([--enable-liblustre-tests],
1574                         [enable liblustre tests, if --disable-tests is used]),
1575         [],[enable_liblustre_tests=$enable_tests])
1576 if test x$enable_liblustre != xyes ; then
1577    enable_liblustre_tests='no'
1578 fi
1579 AC_MSG_RESULT([$enable_liblustre_tests])
1580
1581 AC_MSG_CHECKING([whether to enable liblustre acl])
1582 AC_ARG_ENABLE([liblustre-acl],
1583         AC_HELP_STRING([--disable-liblustre-acl],
1584                         [disable ACL support for liblustre]),
1585         [],[enable_liblustre_acl=yes])
1586 AC_MSG_RESULT([$enable_liblustre_acl])
1587 if test x$enable_liblustre_acl = xyes ; then
1588   AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
1589 fi
1590
1591 #
1592 # --enable-mpitest
1593 #
1594 AC_ARG_ENABLE(mpitests,
1595         AC_HELP_STRING([--enable-mpitests=yes|no|mpicc wrapper],
1596                            [include mpi tests]),
1597         [
1598          enable_mpitests=yes
1599          case $enableval in
1600          yes)
1601                 MPICC_WRAPPER=mpicc
1602                 ;;
1603          no)
1604                 enable_mpitests=no
1605                 ;;
1606          *)
1607                 MPICC_WRAPPER=$enableval
1608                  ;;
1609          esac
1610         ],
1611         [
1612         MPICC_WRAPPER=mpicc
1613         enable_mpitests=yes
1614         ]
1615 )
1616
1617 if test x$enable_mpitests != xno; then
1618         AC_MSG_CHECKING([whether mpitests can be built])
1619         oldcc=$CC
1620         CC=$MPICC_WRAPPER
1621         AC_LINK_IFELSE(
1622             [AC_LANG_PROGRAM([[
1623                     #include <mpi.h>
1624                 ]],[[
1625                     int flag;
1626                     MPI_Initialized(&flag);
1627                 ]])],
1628             [
1629                     AC_MSG_RESULT([yes])
1630             ],[
1631                     AC_MSG_RESULT([no])
1632                     enable_mpitests=no
1633         ])
1634         CC=$oldcc
1635 fi
1636 AC_SUBST(MPICC_WRAPPER)
1637
1638 AC_MSG_NOTICE([Enabling Lustre configure options for libsysio])
1639 ac_configure_args="$ac_configure_args --with-lustre-hack --with-sockets"
1640
1641 LC_CONFIG_PINGER
1642 LC_CONFIG_LIBLUSTRE_RECOVERY
1643 ])
1644
1645 #
1646 # LC_CONFIG_QUOTA
1647 #
1648 # whether to enable quota support global control
1649 #
1650 AC_DEFUN([LC_CONFIG_QUOTA],
1651 [AC_ARG_ENABLE([quota],
1652         AC_HELP_STRING([--enable-quota],
1653                         [enable quota support]),
1654         [],[enable_quota='yes'])
1655 ])
1656
1657 AC_DEFUN([LC_QUOTA],
1658 [#check global
1659 LC_CONFIG_QUOTA
1660 #check for utils
1661 if test x$enable_quota != xno -a x$enable_utils != xno; then
1662 AC_CHECK_HEADER(sys/quota.h,
1663                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1, [Define to 1 if you have <sys/quota.h>.])],
1664                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
1665 fi
1666 ])
1667
1668 #
1669 # LC_CONFIG_SPLIT
1670 #
1671 # whether to enable split support
1672 #
1673 AC_DEFUN([LC_CONFIG_SPLIT],
1674 [AC_MSG_CHECKING([whether to enable split support])
1675 AC_ARG_ENABLE([split],
1676         AC_HELP_STRING([--enable-split],
1677                         [enable split support]),
1678         [],[enable_split='no'])
1679 AC_MSG_RESULT([$enable_split])
1680 if test x$enable_split != xno; then
1681    AC_DEFINE(HAVE_SPLIT_SUPPORT, 1, [enable split support])
1682 fi
1683 ])
1684
1685 #
1686 # LC_CONFIG_NODEMAP_PROC_DEBUG
1687 #
1688 # enable nodemap proc file debugging
1689 #
1690 AC_DEFUN([LC_NODEMAP_PROC_DEBUG],
1691 [AC_MSG_CHECKING([whether to enable nodemap proc debug])
1692 AC_ARG_ENABLE([nodemap_proc_debug],
1693         AC_HELP_STRING([--enable-nodemap-proc-debug],
1694                         [enable nodemap proc debug]),
1695         [],[enable_nodemap_proc_debug='no'])
1696 AC_MSG_RESULT([$enable_nodemap_proc_debug])
1697 if test x$enable_nodemap_proc_debug != xno; then
1698    AC_DEFINE(NODEMAP_PROC_DEBUG, 1, [enable nodemap proc debug support])
1699 fi
1700 ])
1701
1702 #
1703 # LC_LLITE_LLOOP_MODULE
1704 # lloop_llite.ko does not currently work with page sizes
1705 # of 64k or larger.
1706 #
1707 AC_DEFUN([LC_LLITE_LLOOP_MODULE],
1708 [AC_MSG_CHECKING([whether to enable llite_lloop module])
1709 LB_LINUX_TRY_COMPILE([
1710         #include <asm/page.h>
1711 ],[
1712         #if PAGE_SIZE >= 65536
1713         #error "PAGE_SIZE >= 65536"
1714         #endif
1715 ],[
1716         enable_llite_lloop_module='yes'
1717         AC_MSG_RESULT([yes])
1718 ],[
1719         enable_llite_lloop_module='no'
1720         AC_MSG_RESULT([no])
1721 ])
1722 ])
1723
1724 #
1725 # LC_OSD_ADDON
1726 #
1727 # configure support for optional OSD implementation
1728 #
1729 AC_DEFUN([LC_OSD_ADDON],
1730 [AC_MSG_CHECKING([for osd])
1731 AC_ARG_WITH([osd],
1732         AC_HELP_STRING([--with-osd=path],
1733                        [set path to optional osd]),
1734         [
1735                 case $with_osd in
1736                         no)     ENABLEOSDADDON=0
1737                                 ;;
1738                         *)      OSDADDON="${with_osd}"
1739                                 ENABLEOSDADDON=1
1740                                 ;;
1741                 esac
1742         ], [
1743                 ENABLEOSDADDON=0
1744         ])
1745 if test $ENABLEOSDADDON -eq 0; then
1746         AC_MSG_RESULT([no])
1747         OSDADDON=
1748 else
1749         OSDMODNAME=`basename $OSDADDON`
1750         if test -e $LUSTRE/$OSDMODNAME; then
1751                 AC_MSG_RESULT([can't link])
1752                 OSDADDON=
1753         elif ln -s $OSDADDON $LUSTRE/$OSDMODNAME; then
1754                 AC_MSG_RESULT([$OSDMODNAME])
1755                 OSDADDON="subdir-m += $OSDMODNAME"
1756         else
1757                 AC_MSG_RESULT([can't link])
1758                 OSDADDON=
1759         fi
1760 fi
1761 AC_SUBST(OSDADDON)
1762 ])
1763
1764 #
1765 # LC_CONFIGURE
1766 #
1767 # other configure checks
1768 #
1769 AC_DEFUN([LC_CONFIGURE],
1770 [LC_CONFIG_OBD_BUFFER_SIZE
1771
1772 if test $target_cpu == "i686" -o $target_cpu == "x86_64"; then
1773         CFLAGS="$CFLAGS -Werror"
1774 fi
1775
1776 # maximum MDS thread count
1777 LC_MDS_MAX_THREADS
1778
1779 # include/liblustre.h
1780 AC_CHECK_HEADERS([sys/user.h sys/vfs.h stdint.h blkid/blkid.h])
1781
1782 # liblustre/llite_lib.h
1783 AC_CHECK_HEADERS([xtio.h file.h])
1784
1785 # liblustre/dir.c
1786 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
1787
1788 # liblustre/lutil.c
1789 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
1790 AC_CHECK_FUNCS([inet_ntoa])
1791
1792 # libsysio/src/readlink.c
1793 LC_READLINK_SSIZE_T
1794
1795 # libcfs prng.c - depends on linux/types.h from liblustre/dir.c
1796 AC_CHECK_HEADERS([linux/random.h], [], [],
1797                  [#ifdef HAVE_LINUX_TYPES_H
1798                   # include <linux/types.h>
1799                   #endif
1800                  ])
1801
1802 # utils/llverfs.c
1803 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
1804
1805 # check for -lz support
1806 ZLIB=""
1807 AC_CHECK_LIB([z],
1808              [adler32],
1809              [AC_CHECK_HEADERS([zlib.h],
1810                                [ZLIB="-lz"
1811                                 AC_DEFINE([HAVE_ADLER], 1,
1812                                           [support alder32 checksum type])],
1813                                [AC_MSG_WARN([No zlib-devel package found,
1814                                              unable to use adler32 checksum])])],
1815              [AC_MSG_WARN([No zlib package found, unable to use adler32 checksum])]
1816 )
1817 AC_SUBST(ZLIB)
1818
1819 SELINUX=""
1820 AC_CHECK_LIB([selinux],
1821                 [is_selinux_enabled],
1822                 [AC_CHECK_HEADERS([selinux.h],
1823                                 [SELINUX="-lselinux"
1824                                 AC_DEFINE([HAVE_SELINUX], 1,
1825                                                 [support for selinux ])],
1826                                 [AC_MSG_WARN([No selinux-devel package found,
1827                                                 unable to build selinux enabled
1828                                                 tools])])],
1829                 [AC_MSG_WARN([No selinux package found, unable to build selinux
1830                                 enabled tools])]
1831 )
1832 AC_SUBST(SELINUX)
1833
1834 # Super safe df
1835 AC_ARG_ENABLE([mindf],
1836       AC_HELP_STRING([--enable-mindf],
1837                       [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
1838       [],[])
1839 if test "$enable_mindf" = "yes" ;  then
1840       AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
1841 fi
1842
1843 AC_ARG_ENABLE([fail_alloc],
1844         AC_HELP_STRING([--disable-fail-alloc],
1845                 [disable randomly alloc failure]),
1846         [],[enable_fail_alloc=yes])
1847 AC_MSG_CHECKING([whether to randomly failing memory alloc])
1848 AC_MSG_RESULT([$enable_fail_alloc])
1849 if test x$enable_fail_alloc != xno ; then
1850         AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
1851 fi
1852
1853 AC_ARG_ENABLE([invariants],
1854         AC_HELP_STRING([--enable-invariants],
1855                 [enable invariant checking (cpu intensive)]),
1856         [],[])
1857 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
1858 AC_MSG_RESULT([$enable_invariants])
1859 if test x$enable_invariants = xyes ; then
1860         AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1, [enable invariant checking])
1861 fi
1862
1863 AC_ARG_ENABLE([lu_ref],
1864         AC_HELP_STRING([--enable-lu_ref],
1865                 [enable lu_ref reference tracking code]),
1866         [],[])
1867 AC_MSG_CHECKING([whether to track references with lu_ref])
1868 AC_MSG_RESULT([$enable_lu_ref])
1869 if test x$enable_lu_ref = xyes ; then
1870         AC_DEFINE([USE_LU_REF], 1, [enable lu_ref reference tracking code])
1871 fi
1872
1873 AC_ARG_ENABLE([pgstate-track],
1874               AC_HELP_STRING([--enable-pgstate-track],
1875                              [enable page state tracking]),
1876               [enable_pgstat_track='yes'],[])
1877 AC_MSG_CHECKING([whether to enable page state tracking])
1878 AC_MSG_RESULT([$enable_pgstat_track])
1879 if test x$enable_pgstat_track = xyes ; then
1880         AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
1881                   [enable page state tracking code])
1882 fi
1883 ])
1884
1885 #
1886 # LC_CONDITIONALS
1887 #
1888 # AM_CONDITIONALS for lustre
1889 #
1890 AC_DEFUN([LC_CONDITIONALS],
1891 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
1892 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
1893 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
1894 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
1895 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
1896 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
1897 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
1898 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
1899 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
1900 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
1901 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
1902 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
1903 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
1904 ])
1905
1906 #
1907 # LC_CONFIG_FILES
1908 #
1909 # files that should be generated with AC_OUTPUT
1910 #
1911 AC_DEFUN([LC_CONFIG_FILES],
1912 [AC_CONFIG_FILES([
1913 lustre/Makefile
1914 lustre/autoMakefile
1915 lustre/autoconf/Makefile
1916 lustre/conf/Makefile
1917 lustre/contrib/Makefile
1918 lustre/doc/Makefile
1919 lustre/include/Makefile
1920 lustre/include/lustre_ver.h
1921 lustre/include/linux/Makefile
1922 lustre/include/darwin/Makefile
1923 lustre/include/lustre/Makefile
1924 lustre/kernel_patches/targets/2.6-rhel6.target
1925 lustre/kernel_patches/targets/2.6-rhel5.target
1926 lustre/kernel_patches/targets/2.6-sles11.target
1927 lustre/kernel_patches/targets/3.0-sles11.target
1928 lustre/kernel_patches/targets/3.0-sles11sp3.target
1929 lustre/kernel_patches/targets/2.6-fc11.target
1930 lustre/kernel_patches/targets/2.6-fc12.target
1931 lustre/kernel_patches/targets/2.6-fc15.target
1932 lustre/kernel_patches/targets/3.x-fc18.target
1933 lustre/ldlm/Makefile
1934 lustre/fid/Makefile
1935 lustre/fid/autoMakefile
1936 lustre/liblustre/Makefile
1937 lustre/liblustre/tests/Makefile
1938 lustre/liblustre/tests/mpi/Makefile
1939 lustre/llite/Makefile
1940 lustre/llite/autoMakefile
1941 lustre/lclient/Makefile
1942 lustre/lov/Makefile
1943 lustre/lov/autoMakefile
1944 lustre/mdc/Makefile
1945 lustre/mdc/autoMakefile
1946 lustre/lmv/Makefile
1947 lustre/lmv/autoMakefile
1948 lustre/lfsck/Makefile
1949 lustre/lfsck/autoMakefile
1950 lustre/mdt/Makefile
1951 lustre/mdt/autoMakefile
1952 lustre/nodemap/Makefile
1953 lustre/nodemap/autoMakefile
1954 lustre/mdd/Makefile
1955 lustre/mdd/autoMakefile
1956 lustre/fld/Makefile
1957 lustre/fld/autoMakefile
1958 lustre/obdclass/Makefile
1959 lustre/obdclass/autoMakefile
1960 lustre/obdclass/linux/Makefile
1961 lustre/obdecho/Makefile
1962 lustre/obdecho/autoMakefile
1963 lustre/ofd/Makefile
1964 lustre/ofd/autoMakefile
1965 lustre/osc/Makefile
1966 lustre/osc/autoMakefile
1967 lustre/ost/Makefile
1968 lustre/ost/autoMakefile
1969 lustre/osd-ldiskfs/Makefile
1970 lustre/osd-ldiskfs/autoMakefile
1971 lustre/osd-zfs/Makefile
1972 lustre/osd-zfs/autoMakefile
1973 lustre/mgc/Makefile
1974 lustre/mgc/autoMakefile
1975 lustre/mgs/Makefile
1976 lustre/mgs/autoMakefile
1977 lustre/target/Makefile
1978 lustre/ptlrpc/Makefile
1979 lustre/ptlrpc/autoMakefile
1980 lustre/ptlrpc/gss/Makefile
1981 lustre/ptlrpc/gss/autoMakefile
1982 lustre/quota/Makefile
1983 lustre/quota/autoMakefile
1984 lustre/scripts/Makefile
1985 lustre/tests/Makefile
1986 lustre/tests/mpi/Makefile
1987 lustre/utils/Makefile
1988 lustre/utils/gss/Makefile
1989 lustre/osp/Makefile
1990 lustre/osp/autoMakefile
1991 lustre/lod/Makefile
1992 lustre/lod/autoMakefile
1993 lustre/obdclass/darwin/Makefile
1994 ])
1995 ])