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