Whamcloud - gitweb
liblustre fixes
[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_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel])
270                         AC_MSG_WARN([This build may fail.])
271                 ])
272                 ;;
273         ldiskfs)
274                 LC_FSHOOKS([
275                         LDISKFS_SERIES="2.6-suse.series"
276                 ],[
277                         LDISKFS_SERIES="2.6-vanilla.series"
278                 ])
279                 AC_SUBST(LDISKFS_SERIES)
280                 ;;
281 esac # $BACKINGFS
282 ])
283
284 #
285 # LC_CONFIG_PINGER
286 #
287 # the pinger is temporary, until we have the recovery node in place
288 #
289 AC_DEFUN([LC_CONFIG_PINGER],
290 [AC_MSG_CHECKING([whether to enable pinger support])
291 AC_ARG_ENABLE([pinger],
292         AC_HELP_STRING([--disable-pinger],
293                         [disable recovery pinger support]),
294         [],[enable_pinger='yes'])
295 AC_MSG_RESULT([$enable_pinger])
296 if test x$enable_pinger != xno ; then
297   AC_DEFINE(ENABLE_PINGER, 1, Use the Pinger)
298 fi
299 ])
300
301 #
302 # LC_CONFIG_OBD_BUFFER_SIZE
303 #
304 # the maximum buffer size of lctl ioctls
305 #
306 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE],
307 [AC_MSG_CHECKING([maximum OBD ioctl size])
308 AC_ARG_WITH([obd-buffer-size],
309         AC_HELP_STRING([--with-obd-buffer-size=[size]],
310                         [set lctl ioctl maximum bytes (default=8192)]),
311         [
312                 OBD_BUFFER_SIZE=$with_obd_buffer_size
313         ],[
314                 OBD_BUFFER_SIZE=8192
315         ])
316 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
317 AC_DEFINE_UNQUOTED(OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE, [IOCTL Buffer Size])
318 ])
319
320 #
321 # LC_CONFIG_SNAPFS
322 #
323 # Whether snapfs is desired
324 #
325 AC_DEFUN([LC_CONFIG_SNAPFS],
326 [# snap compilation
327 AC_MSG_CHECKING([whether to enable snapfs support])
328 AC_ARG_ENABLE([snapfs],
329         AC_HELP_STRING([--enable-snapfs],
330                         [build snapfs]),
331         [],[enable_snapfs='no'])
332 AC_MSG_RESULT([$enable_snapfs])
333 ])
334
335 #
336 # LC_CONFIG_SMFS
337 #
338 # whether smfs is desired
339 #
340 AC_DEFUN([LC_CONFIG_SMFS],
341 [AC_MSG_CHECKING([whether to enable smfs support])
342 AC_ARG_ENABLE([smfs],
343         AC_HELP_STRING([--enable-smfs],
344                         [build smfs]),
345         [],[enable_smfs='no'])
346 AC_MSG_RESULT([$enable_smfs])
347 ])
348
349 #
350 # LC_PROG_LINUX
351 #
352 # Lustre linux kernel checks
353 #
354 AC_DEFUN([LC_PROG_LINUX],
355 [LC_CONFIG_BACKINGFS
356 LC_CONFIG_PINGER
357 LC_CONFIG_SNAPFS
358 LC_CONFIG_SMFS
359
360 LC_STRUCT_KIOBUF
361 LC_FUNC_COND_RESCHED
362 LC_FUNC_ZAP_PAGE_RANGE
363 LC_FUNC_PDE
364 LC_FUNC_DIRECT_IO
365 LC_HEADER_MM_INLINE
366 LC_STRUCT_INODE
367 ])
368
369 #
370 # LC_CONFIG_LIBLUSTRE
371 #
372 # whether to build liblustre
373 #
374 AC_DEFUN([LC_CONFIG_LIBLUSTRE],
375 [AC_MSG_CHECKING([whether to build Lustre library])
376 AC_ARG_ENABLE([liblustre],
377         AC_HELP_STRING([--disable-liblustre],
378                         [disable building of Lustre library]),
379         [],[enable_liblustre=$with_sysio])
380 AC_MSG_RESULT([$enable_liblustre])
381 # only build sysio if liblustre is built
382 with_sysio="$enable_liblustre"
383
384 AC_MSG_CHECKING([whether to build mpitests])
385 AC_ARG_ENABLE([mpitests],
386         AC_HELP_STRING([--enable-mpitests],
387                         [build liblustre mpi tests]),
388         [],[enable_mpitests=no])
389 AC_MSG_RESULT([$enable_mpitests])
390 ])
391
392 #
393 # LC_CONFIGURE
394 #
395 # other configure checks
396 #
397 AC_DEFUN([LC_CONFIGURE],
398 [LC_CONFIG_OBD_BUFFER_SIZE
399
400 # include/liblustre.h
401 AC_CHECK_HEADERS([asm/page.h sys/user.h stdint.h])
402
403 # liblustre/llite_lib.h
404 AC_CHECK_HEADERS([xtio.h file.h])
405
406 # liblustre/dir.c
407 AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
408
409 # liblustre/lutil.c
410 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
411 AC_CHECK_FUNCS([inet_ntoa])
412 ])
413
414 #
415 # LC_CONDITIONALS
416 #
417 # AM_CONDITIONALS for lustre
418 #
419 AC_DEFUN([LC_CONDITIONALS],
420 [AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
421 AM_CONDITIONAL(EXTN, test x$enable_extN = xyes)
422 AM_CONDITIONAL(LDISKFS, test x$enable_ldiskfs = xyes)
423 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
424 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
425 AM_CONDITIONAL(SNAPFS, test x$enable_snapfs = xyes)
426 AM_CONDITIONAL(SMFS, test x$enable_smfs = xyes)
427 AM_CONDITIONAL(LIBLUSTRE, test x$enable_liblustre = xyes)
428 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
429 ])
430
431 #
432 # LC_CONFIG_FILES
433 #
434 # files that should be generated with AC_OUTPUT
435 #
436 AC_DEFUN([LC_CONFIG_FILES],
437 [AC_CONFIG_FILES([
438 lustre/Makefile
439 lustre/autoMakefile
440 lustre/autoconf/Makefile
441 lustre/cmobd/Makefile
442 lustre/cmobd/autoMakefile
443 lustre/cobd/Makefile
444 lustre/cobd/autoMakefile
445 lustre/conf/Makefile
446 lustre/doc/Makefile
447 lustre/include/Makefile
448 lustre/include/linux/Makefile
449 lustre/include/lustre/Makefile
450 lustre/ldiskfs/Makefile
451 lustre/ldiskfs/autoMakefile
452 lustre/ldlm/Makefile
453 lustre/liblustre/Makefile
454 lustre/liblustre/tests/Makefile
455 lustre/llite/Makefile
456 lustre/llite/autoMakefile
457 lustre/lmv/Makefile
458 lustre/lmv/autoMakefile
459 lustre/lov/Makefile
460 lustre/lov/autoMakefile
461 lustre/lvfs/Makefile
462 lustre/lvfs/autoMakefile
463 lustre/mdc/Makefile
464 lustre/mdc/autoMakefile
465 lustre/mds/Makefile
466 lustre/mds/autoMakefile
467 lustre/obdclass/Makefile
468 lustre/obdclass/autoMakefile
469 lustre/obdecho/Makefile
470 lustre/obdecho/autoMakefile
471 lustre/obdfilter/Makefile
472 lustre/obdfilter/autoMakefile
473 lustre/osc/Makefile
474 lustre/osc/autoMakefile
475 lustre/ost/Makefile
476 lustre/ost/autoMakefile
477 lustre/ptlbd/Makefile
478 lustre/ptlbd/autoMakefile
479 lustre/ptlrpc/Makefile
480 lustre/ptlrpc/autoMakefile
481 lustre/scripts/Makefile
482 lustre/scripts/version_tag.pl
483 lustre/smfs/Makefile
484 lustre/smfs/autoMakefile
485 lustre/snapfs/Makefile
486 lustre/snapfs/autoMakefile
487 lustre/snapfs/utils/Makefile
488 lustre/tests/Makefile
489 lustre/utils/Lustre/Makefile
490 lustre/utils/Makefile
491 ])
492 ])