Whamcloud - gitweb
Branch: HEAD
[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 ])
9
10 #
11 # LC_PATH_DEFAULTS
12 #
13 # lustre specific paths
14 #
15 AC_DEFUN([LC_PATH_DEFAULTS],
16 [# ptlrpc kernel build requires this
17 LUSTRE="$PWD/lustre"
18 AC_SUBST(LUSTRE)
19
20 # mount.lustre
21 rootsbindir='/sbin'
22 AC_SUBST(rootsbindir)
23
24 demodir='$(docdir)/demo'
25 AC_SUBST(demodir)
26
27 pkgexampledir='${pkgdatadir}/examples'
28 AC_SUBST(pkgexampledir)
29
30 pymoddir='${pkglibdir}/python/Lustre'
31 AC_SUBST(pymoddir)
32 ])
33
34 #
35 # LC_TARGET_SUPPORTED
36 #
37 # is the target os supported?
38 #
39 AC_DEFUN([LC_TARGET_SUPPORTED],
40 [case $target_os in
41         linux*)
42 $1
43                 ;;
44         *)
45 $2
46                 ;;
47 esac
48 ])
49
50 #
51 # LC_CONFIG_EXT3
52 #
53 # that ext3 is enabled in the kernel
54 #
55 AC_DEFUN([LC_CONFIG_EXT3],
56 [LB_LINUX_CONFIG([EXT3_FS],[],[
57         LB_LINUX_CONFIG([EXT3_FS_MODULE],[],[$2])
58 ])
59 LB_LINUX_CONFIG([EXT3_FS_XATTR],[$1],[$3])
60 ])
61
62
63 #
64 # LC_FSHOOKS
65 #
66 # If we have (and can build) fshooks.h
67 #
68 AC_DEFUN([LC_FSHOOKS],
69 [AC_CHECK_FILE([$LINUX/include/linux/fshooks.h],[
70         AC_MSG_CHECKING([if fshooks.h can be compiled])
71         LB_LINUX_TRY_COMPILE([
72                 #include <linux/fshooks.h>
73         ],[],[
74                 AC_MSG_RESULT([yes])
75         ],[
76                 AC_MSG_RESULT([no])
77                 AC_MSG_WARN([You might have better luck with gcc 3.3.x.])
78                 AC_MSG_WARN([You can set CC=gcc33 before running configure.])
79                 AC_MSG_ERROR([Your compiler cannot build fshooks.h.])
80         ])
81 $1
82 ],[
83 LB_LINUX_TRY_COMPILE([
84         #include <linux/version.h>
85 ],[
86         #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
87         #error "linux version < 2.6.10, only support 2.6.7"
88         #endif
89 ],[
90 $2
91 ],[
92 $3 
93 ])
94 ])
95 ])
96
97 #
98 # LC_STRUCT_KIOBUF
99 #
100 # rh 2.4.18 has iobuf->dovary, but other kernels do not
101 #
102 AC_DEFUN([LC_STRUCT_KIOBUF],
103 [AC_MSG_CHECKING([if struct kiobuf has a dovary field])
104 LB_LINUX_TRY_COMPILE([
105         #include <linux/iobuf.h>
106 ],[
107         struct kiobuf iobuf;
108         iobuf.dovary = 1;
109 ],[
110         AC_MSG_RESULT([yes])
111         AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
112 ],[
113         AC_MSG_RESULT([no])
114 ])
115 ])
116
117 #
118 # LC_FUNC_COND_RESCHED
119 #
120 # cond_resched() was introduced in 2.4.20
121 #
122 AC_DEFUN([LC_FUNC_COND_RESCHED],
123 [AC_MSG_CHECKING([if kernel offers cond_resched])
124 LB_LINUX_TRY_COMPILE([
125         #include <linux/sched.h>
126 ],[
127         cond_resched();
128 ],[
129         AC_MSG_RESULT([yes])
130         AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
131 ],[
132         AC_MSG_RESULT([no])
133 ])
134 ])
135
136 #
137 # LC_FUNC_ZAP_PAGE_RANGE
138 #
139 # if zap_page_range() takes a vma arg
140 #
141 AC_DEFUN([LC_FUNC_ZAP_PAGE_RANGE],
142 [AC_MSG_CHECKING([if zap_pag_range with vma parameter])
143 ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
144 if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
145         AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
146         AC_MSG_RESULT([yes])
147 else
148         AC_MSG_RESULT([no])
149 fi
150 ])
151
152 #
153 # LC_FUNC_PDE
154 #
155 # if proc_fs.h defines PDE()
156 #
157 AC_DEFUN([LC_FUNC_PDE],
158 [AC_MSG_CHECKING([if kernel defines PDE])
159 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
160 if test "$HAVE_PDE" != 0 ; then
161         AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
162         AC_MSG_RESULT([yes])
163 else
164         AC_MSG_RESULT([no])
165 fi
166 ])
167
168 #
169 # LC_FUNC_DIRECT_IO
170 #
171 # if direct_IO takes a struct file argument
172 #
173 AC_DEFUN([LC_FUNC_DIRECT_IO],
174 [AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
175 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
176 if test "$HAVE_DIO_FILE" != 0 ; then
177         AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
178         AC_MSG_RESULT(yes)
179 else
180         AC_MSG_RESULT(no)
181 fi
182 ])
183
184 #
185 # LC_HEADER_MM_INLINE
186 #
187 # RHEL kernels define page_count in mm_inline.h
188 #
189 AC_DEFUN([LC_HEADER_MM_INLINE],
190 [AC_MSG_CHECKING([if kernel has mm_inline.h header])
191 LB_LINUX_TRY_COMPILE([
192         #include <linux/mm_inline.h>
193 ],[
194         #ifndef page_count
195         #error mm_inline.h does not define page_count
196         #endif
197 ],[
198         AC_MSG_RESULT([yes])
199         AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
200 ],[
201         AC_MSG_RESULT([no])
202 ])
203 ])
204
205 #
206 # LC_STRUCT_INODE
207 #
208 # if inode->i_alloc_sem exists
209 #
210 AC_DEFUN([LC_STRUCT_INODE],
211 [AC_MSG_CHECKING([if struct inode has i_alloc_sem])
212 LB_LINUX_TRY_COMPILE([
213         #include <linux/fs.h>
214         #include <linux/version.h>
215 ],[
216         #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
217         #error "down_read_trylock broken before 2.4.24"
218         #endif
219         struct inode i;
220         return (char *)&i.i_alloc_sem - (char *)&i;
221 ],[
222         AC_MSG_RESULT([yes])
223         AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
224 ],[
225         AC_MSG_RESULT([no])
226 ])
227 ])
228
229 #
230 # LC_CONFIG_BACKINGFS
231 #
232 # whether to use extN or ldiskfs instead of ext3
233 #
234 AC_DEFUN([LC_CONFIG_BACKINGFS],
235 [
236 BACKINGFS='ext3'
237
238 # LLNL patches their ext3 and calls it extN
239 AC_MSG_CHECKING([whether to use extN])
240 AC_ARG_ENABLE([extN],
241         AC_HELP_STRING([--enable-extN],
242                         [use extN instead of ext3 for lustre backend]),
243         [BACKINGFS='extN'],[enable_extN='no'])
244 AC_MSG_RESULT([$enable_extN])
245
246 # SuSE gets ldiskfs
247 AC_MSG_CHECKING([whether to enable ldiskfs])
248 AC_ARG_ENABLE([ldiskfs],
249         AC_HELP_STRING([--enable-ldiskfs],
250                         [use ldiskfs for the Lustre backing FS]),
251         [],[enable_ldiskfs="$linux25"])
252 AC_MSG_RESULT([$enable_ldiskfs])
253
254 if test x$enable_ldiskfs = xyes ; then
255         BACKINGFS="ldiskfs"
256
257         AC_PATH_PROG(PATCH, patch, [no])
258         AC_PATH_PROG(QUILT, quilt, [no])
259
260         if test x$enable_ldiskfs$PATCH$QUILT = xyesnono ; then
261                 AC_MSG_ERROR([Quilt or patch are needed to build the ldiskfs module (for Linux 2.6)])
262         fi
263
264         AC_DEFINE(CONFIG_LDISKFS_FS_MODULE, 1, [build ldiskfs as a module])
265         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
266         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [enable posix acls])
267         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security])
268 fi
269
270 AC_MSG_CHECKING([which backing filesystem to use])
271 AC_MSG_RESULT([$BACKINGFS])
272 AC_SUBST(BACKINGFS)
273
274 case $BACKINGFS in
275         ext3)
276                 # --- Check that ext3 and ext3 xattr are enabled in the kernel
277                 LC_CONFIG_EXT3([],[
278                         AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel])
279                 ],[
280                         AC_MSG_ERROR([Lustre requires that extended attributes for ext3 are enabled in the kernel])
281                 ])
282                 ;;
283         ldiskfs)
284                 LC_FSHOOKS([
285                         LDISKFS_SERIES="2.6-suse.series"
286                 ],[
287                         LDISKFS_SERIES="2.6-fc3.series"
288                 ],[
289                         LDISKFS_SERIES="2.6-vanilla.series"             
290                 ]
291                 )
292                 AC_SUBST(LDISKFS_SERIES)
293                 ;;
294 esac # $BACKINGFS
295 ])
296
297 #
298 # LC_CONFIG_PINGER
299 #
300 # the pinger is temporary, until we have the recovery node in place
301 #
302 AC_DEFUN([LC_CONFIG_PINGER],
303 [AC_MSG_CHECKING([whether to enable pinger support])
304 AC_ARG_ENABLE([pinger],
305         AC_HELP_STRING([--disable-pinger],
306                         [disable recovery pinger support]),
307         [],[enable_pinger='yes'])
308 AC_MSG_RESULT([$enable_pinger])
309 if test x$enable_pinger != xno ; then
310   AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
311 fi
312 ])
313
314 #
315 # LC_CONFIG_OBD_BUFFER_SIZE
316 #
317 # the maximum buffer size of lctl ioctls
318 #
319 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
320 [AC_MSG_CHECKING([maximum OBD ioctl size])
321 AC_ARG_WITH([obd-buffer-size],
322         AC_HELP_STRING([--with-obd-buffer-size=[size]],
323                         [set lctl ioctl maximum bytes (default=8192)]),
324         [
325                 OBD_BUFFER_SIZE=$with_obd_buffer_size
326         ],[
327                 OBD_BUFFER_SIZE=8192
328         ])
329 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
330 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
331 ])
332
333 #
334 # LC_CONFIG_GSS
335 #
336 # whether build-in gss/krb5 capability
337 #
338 AC_DEFUN([LC_CONFIG_GSS],
339 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
340 AC_ARG_ENABLE([gss],
341         AC_HELP_STRING([--enable-gss],
342                         [enable gss/krb5 support]),
343         [],[enable_gss='yes'])
344 AC_MSG_RESULT([$enable_gss])
345 if test x$enable_gss != xno ; then
346   AC_DEFINE(ENABLE_GSS, 1, Support GSS/krb5)
347 fi
348 ])
349
350 #
351 # LC_CONFIG_SNAPFS
352 #
353 # Whether snapfs is desired
354 #
355 AC_DEFUN([LC_CONFIG_SNAPFS],
356 [# snap compilation
357 AC_MSG_CHECKING([whether to enable snapfs support])
358 AC_ARG_ENABLE([snapfs],
359         AC_HELP_STRING([--enable-snapfs],
360                         [build snapfs]),
361         [],[enable_snapfs='no'])
362 AC_MSG_RESULT([$enable_snapfs])
363 ])
364
365 #
366 # LC_CONFIG_SMFS
367 #
368 # whether smfs is desired
369 #
370 AC_DEFUN([LC_CONFIG_SMFS],
371 [AC_MSG_CHECKING([whether to enable smfs support])
372 AC_ARG_ENABLE([smfs],
373         AC_HELP_STRING([--enable-smfs],
374                         [build smfs]),
375         [],[enable_smfs='no'])
376 AC_MSG_RESULT([$enable_smfs])
377 ])
378
379 #
380 # LC_PROG_LINUX
381 #
382 # Lustre linux kernel checks
383 #
384 AC_DEFUN([LC_PROG_LINUX],
385 [LC_CONFIG_BACKINGFS
386 LC_CONFIG_PINGER
387 LC_CONFIG_GSS
388 LC_CONFIG_SNAPFS
389 LC_CONFIG_SMFS
390
391 LC_STRUCT_KIOBUF
392 LC_FUNC_COND_RESCHED
393 LC_FUNC_ZAP_PAGE_RANGE
394 LC_FUNC_PDE
395 LC_FUNC_DIRECT_IO
396 LC_HEADER_MM_INLINE
397 LC_STRUCT_INODE
398 ])
399
400 #
401 # LC_CONFIG_LIBLUSTRE
402 #
403 # whether to build liblustre
404 #
405 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
406 [AC_MSG_CHECKING([whether to build Lustre library])
407 AC_ARG_ENABLE([liblustre],
408         AC_HELP_STRING([--disable-liblustre],
409                         [disable building of Lustre library]),
410         [],[enable_liblustre=$with_sysio])
411 AC_MSG_RESULT([$enable_liblustre])
412 # only build sysio if liblustre is built
413 with_sysio="$enable_liblustre"
414
415 AC_MSG_CHECKING([whether to build mpitests])
416 AC_ARG_ENABLE([mpitests],
417         AC_HELP_STRING([--enable-mpitests],
418                         [build liblustre mpi tests]),
419         [],[enable_mpitests=no])
420 AC_MSG_RESULT([$enable_mpitests])
421 ])
422
423 #
424 # LC_CONFIGURE
425 #
426 # other configure checks
427 #
428 AC_DEFUN([LC_CONFIGURE],
429 [LC_CONFIG_OBD_BUFFER_SIZE
430
431 # include/liblustre.h
432 AC_CHECK_HEADERS([asm/page.h sys/user.h stdint.h])
433
434 # liblustre/llite_lib.h
435 AC_CHECK_HEADERS([xtio.h file.h])
436
437 # liblustre/dir.c
438 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
439
440 # liblustre/lutil.c
441 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
442 AC_CHECK_FUNCS([inet_ntoa])
443 ])
444
445 #
446 # LC_CONDITIONALS
447 #
448 # AM_CONDITIONALS for lustre
449 #
450 AC_DEFUN([LC_CONDITIONALS],
451 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
452 AM_CONDITIONAL(EXTN, test x$enable_extN = xyes)
453 AM_CONDITIONAL(LDISKFS, test x$enable_ldiskfs = xyes)
454 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
455 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
456 AM_CONDITIONAL(SNAPFS, test x$enable_snapfs = xyes)
457 AM_CONDITIONAL(SMFS, test x$enable_smfs = xyes)
458 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
459 AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
460 AM_CONDITIONAL(LIBLUSTRE_TESTS, test x$enable_liblustre_tests = xyes)
461 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
462 ])
463
464 #
465 # LC_CONFIG_FILES
466 #
467 # files that should be generated with AC_OUTPUT
468 #
469 AC_DEFUN([LC_CONFIG_FILES],
470 [AC_CONFIG_FILES([
471 lustre/Makefile
472 lustre/autoMakefile
473 lustre/autoconf/Makefile
474 lustre/cmobd/Makefile
475 lustre/cmobd/autoMakefile
476 lustre/cobd/Makefile
477 lustre/cobd/autoMakefile
478 lustre/conf/Makefile
479 lustre/doc/Makefile
480 lustre/include/Makefile
481 lustre/include/linux/Makefile
482 lustre/include/lustre/Makefile
483 lustre/ldiskfs/Makefile
484 lustre/ldiskfs/autoMakefile
485 lustre/ldlm/Makefile
486 lustre/liblustre/Makefile
487 lustre/llite/Makefile
488 lustre/llite/autoMakefile
489 lustre/lmv/Makefile
490 lustre/lmv/autoMakefile
491 lustre/lov/Makefile
492 lustre/lov/autoMakefile
493 lustre/lvfs/Makefile
494 lustre/lvfs/autoMakefile
495 lustre/mdc/Makefile
496 lustre/mdc/autoMakefile
497 lustre/mds/Makefile
498 lustre/mds/autoMakefile
499 lustre/obdclass/Makefile
500 lustre/obdclass/autoMakefile
501 lustre/obdecho/Makefile
502 lustre/obdecho/autoMakefile
503 lustre/obdfilter/Makefile
504 lustre/obdfilter/autoMakefile
505 lustre/osc/Makefile
506 lustre/osc/autoMakefile
507 lustre/ost/Makefile
508 lustre/ost/autoMakefile
509 lustre/ptlbd/Makefile
510 lustre/ptlbd/autoMakefile
511 lustre/ptlrpc/Makefile
512 lustre/ptlrpc/autoMakefile
513 lustre/scripts/Makefile
514 lustre/scripts/version_tag.pl
515 lustre/sec/Makefile
516 lustre/sec/autoMakefile
517 lustre/sec/gss/Makefile
518 lustre/sec/gss/autoMakefile
519 lustre/smfs/Makefile
520 lustre/smfs/autoMakefile
521 lustre/snapfs/Makefile
522 lustre/snapfs/autoMakefile
523 lustre/snapfs/utils/Makefile
524 lustre/tests/Makefile
525 lustre/utils/Lustre/Makefile
526 lustre/utils/Makefile
527 ])
528 ])