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