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