4 # --without-ldiskfs - Disable ldiskfs support.
7 # --with-ldiskfs - Enable ldiskfs support and attempt to autodetect the
8 # --with-ldiskfs=yes headers in one of the following places in this order:
10 # * /usr/src/ldiskfs-*/$LINUXRELEASE
13 # --with-ldiskfs=path - Enable ldiskfs support and use the headers in the
14 # provided path. No autodetection is performed.
16 # --with-ldiskfs-obj - When ldiskfs support is enabled the object directory
17 # will be based on the --with-ldiskfs directory. If
18 # this is detected incorrectly it can be explicitly
19 # specified using this option.
21 # NOTE: As with all external packages ldiskfs is expected to already be
22 # configured and built. However, if the ldiskfs tree is located in-tree
23 # (./ldiskfs) then it will be configured and built recursively as part of
24 # the lustre build system.
26 # NOTE: The lustre and in-tree ldiskfs build systems both make use these
27 # macros. This is undesirable and confusing at best, it is potentially
28 # danagerous at worst. The ldiskfs build system should be entirely stand
29 # alone without dependency on the lustre build system.
31 AC_DEFUN([LB_PATH_LDISKFS],
33 AC_ARG_WITH([ldiskfs],
34 AC_HELP_STRING([--with-ldiskfs=path], [set path to ldiskfs source]),
36 if test x$enable_server = xyes && test x$enable_dist = xno; then
43 case x$with_ldiskfs in
51 ldiskfs_src=$PWD/ldiskfs
52 if test -e "$ldiskfs_src"; then
53 LDISKFS_DIR=$(readlink -f $ldiskfs_src)
55 # Check /usr/src/ldiskfs-*/$LINUXRELEASE
56 ldiskfs_src=$(ls -1d \
57 /usr/src/ldiskfs-*/$LINUXRELEASE \
58 2>/dev/null | tail -1)
59 if test -e "$ldiskfs_src"; then
60 LDISKFS_DIR=$(readlink -f $ldiskfs_src)
63 ldiskfs_src=$PWD/../ldiskfs
64 if test -e "$ldiskfs_src"; then
65 LDISKFS_DIR=$(readlink -f $ldiskfs_src)
67 # Disable ldiskfs failed to detect
75 LDISKFS_DIR=$(readlink -f $with_ldiskfs)
80 AC_MSG_CHECKING([whether to enable ldiskfs])
81 AC_MSG_RESULT([$with_ldiskfs])
83 AC_ARG_WITH([ldiskfs-obj],
84 AC_HELP_STRING([--with-ldiskfs-obj=path],[set path to ldiskfs objects]),
86 if test x$with_ldiskfs = xyes; then
87 LDISKFS_OBJ="$withval"
90 if test x$with_ldiskfs = xyes; then
91 LDISKFS_OBJ=$LDISKFS_DIR
95 if test x$with_ldiskfs = xyes; then
96 AC_MSG_CHECKING([ldiskfs source directory])
97 AC_MSG_RESULT([$LDISKFS_DIR])
100 AC_MSG_CHECKING([ldiskfs object directory])
101 AC_MSG_RESULT([$LDISKFS_OBJ])
102 AC_SUBST(LDISKFS_OBJ)
106 LB_LDISKFS_EXT_RELEASE
109 LB_LDISKFS_DEFINE_OPTIONS
113 # LDISKFS_DEVEL is required because when using the ldiskfs-devel package the
114 # ext3/4 source will be fully patched to ldiskfs. When building with the
115 # in-tree ldiskfs this patching this will occur after the configure step.
116 # We needed a way to determine if we should check the patched or unpatched
119 # Longer term this could be removed by moving the ldiskfs patching in to
120 # the configure phase. Or better yet ldiskfs could be updated to generate
121 # a ldiskfs_config.h which clearly defines how it was built. This can
122 # then be directly included by Lustre to avoid all the autoconf guess work.
123 # For an example of this behavior consult the lustre/zfs build integration.
125 AM_CONDITIONAL(LDISKFS_DEVEL, \
126 test x$LDISKFS_DIR = x$(readlink -f $PWD/ldiskfs) || \
127 test x$LDISKFS_DIR = x$(readlink -f $PWD/../ldiskfs))
129 AM_CONDITIONAL(LDISKFS_BUILD, test x$enable_ldiskfs_build = xyes)
130 AM_CONDITIONAL(LDISKFS_ENABLED, test x$with_ldiskfs = xyes)
132 if test -e "$PWD/ldiskfs"; then
133 LDISKFS_DIST_SUBDIR="ldiskfs"
134 AC_SUBST(LDISKFS_DIST_SUBDIR)
135 AC_CONFIG_SUBDIRS("ldiskfs")
140 # LB_LDISKFS_EXT_RELEASE
142 # Determine if ext3 or ext4 sources should be used for ldiskfs.
144 AC_DEFUN([LB_LDISKFS_EXT_RELEASE],
146 AC_ARG_ENABLE([ext4],
147 AC_HELP_STRING([--enable-ext4], [enable ldiskfs build using ext4]),
150 if test x$RHEL_KERNEL = xyes; then
153 # 2.6.22-2.6.26 ext4 available but unstable
154 case x$LINUXRELEASE in
163 if test x$enable_ext4 = xyes; then
164 LDISKFS_BACKFS='ext4'
166 LDISKFS_BACKFS='ext3'
169 AC_MSG_CHECKING([whether to use ext3 or ext4 source])
170 AC_MSG_RESULT([$LDISKFS_BACKFS])
171 AC_SUBST(LDISKFS_BACKFS)
177 # Determine the location of the ext3/ext4 source code. It it required
178 # for several configure tests and to build ldiskfs.
180 AC_DEFUN([LB_LDISKFS_EXT_DIR],
182 # Kernel ext source located with devel headers
184 if test -e "$linux_src/fs/$LDISKFS_BACKFS/super.c"; then
185 EXT_DIR=$linux_src/fs/$LDISKFS_BACKFS
187 # Kernel ext source provided by kernel-debuginfo-common package
188 linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
189 2>/dev/null | tail -1)
190 if test -e "$linux_src/fs/$LDISKFS_BACKFS/super.c"; then
191 EXT_DIR=$linux_src/fs/$LDISKFS_BACKFS
197 AC_MSG_CHECKING([$LDISKFS_BACKFS source directory])
198 AC_MSG_RESULT([$EXT_DIR])
203 # LB_LDISKFS_EXT_SOURCE
205 # Spot check the existance of several source files common to ext3/ext4.
206 # Detecting this at configure time allows us to avoid a potential build
207 # failure and provide a useful error message to explain what is wrong.
209 AC_DEFUN([LB_LDISKFS_EXT_SOURCE],
211 if test x$EXT_DIR = x; then
212 AC_MSG_ERROR([Complete $LDISKFS_BACKFS source must exist.
214 If you are building using kernel-devel packages then ensure that the
215 matching kernel-debuginfo-common and kernel-debuginfo-common-<arch>
216 packages are installed.])
219 LB_CHECK_FILE([$EXT_DIR/dir.c], [], [ AC_MSG_ERROR(
220 [Complete $LDISKFS_BACKFS source must exist for ldiskfs build])])
221 LB_CHECK_FILE([$EXT_DIR/file.c], [], [ AC_MSG_ERROR(
222 [Complete $LDISKFS_BACKFS source must exist for ldiskfs build])])
223 LB_CHECK_FILE([$EXT_DIR/inode.c], [], [ AC_MSG_ERROR(
224 [Complete $LDISKFS_BACKFS source must exist for ldiskfs build])])
225 LB_CHECK_FILE([$EXT_DIR/super.c], [], [ AC_MSG_ERROR(
226 [Complete $LDISKFS_BACKFS source must exist for ldiskfs build])])
230 # LB_LDISKFS_DEFINE_OPTIONS
232 # Enable config options related to ldiskfs. These are used by ldiskfs,
233 # lvfs, and the osd-ldiskfs code (which includes ldiskfs headers.)
235 AC_DEFUN([LB_LDISKFS_DEFINE_OPTIONS],
237 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
240 if test $LDISKFS_BACKFS = 'ext4'; then
241 AC_DEFINE(HAVE_EXT4_LDISKFS, 1, [build ext4 based ldiskfs])
242 case $LINUXRELEASE in
244 if test x$RHEL_KERNEL = xyes; then
246 AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
248 if test x$SUSE_KERNEL = xyes; then
250 AC_DEFINE(HAVE_LDISKFS_PDO, 1, [have ldiskfs PDO patch])
256 LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET
258 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1,
259 [enable extended attributes for ldiskfs])
260 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1,
261 [enable posix acls for ldiskfs])
262 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1,
263 [enable fs security for ldiskfs])
264 AC_DEFINE(CONFIG_LDISKFSDEV_FS_POSIX_ACL, 1,
265 [enable posix acls for ldiskfs])
266 AC_DEFINE(CONFIG_LDISKFSDEV_FS_XATTR, 1,
267 [enable extented attributes for ldiskfs])
268 AC_DEFINE(CONFIG_LDISKFSDEV_FS_SECURITY, 1,
269 [enable fs security for ldiskfs])
273 # Check for jbd2_journal_callback_set(), which is needed for commit
274 # callbacks. When LU-433 lands jbd2_journal_callback_set() will only
275 # remain for legacy reasons and AC_MSG_ERROR can be removed.
277 # 2.6.18 with ext3 still uses journal_callback_set() for commit callbacks.
279 AC_DEFUN([LB_LDISKFS_JBD2_JOURNAL_CALLBACK_SET],
281 LB_CHECK_SYMBOL_EXPORT([jbd2_journal_callback_set],
283 [AC_DEFINE(HAVE_JBD2_JOURNAL_CALLBACK_SET, 1,
284 [kernel exports jbd2_journal_callback_set])],
285 [LB_CHECK_SYMBOL_EXPORT([journal_callback_set],
287 [AC_DEFINE(HAVE_JOURNAL_CALLBACK_SET, 1,
288 [kernel exports journal_callback_set])])])
292 # Optionally configure/make the ldiskfs sources. If the sources are
293 # determined to reside in-tree this feature will automatically be
294 # enabled. If the sources are not in-tree it will be disabled.
295 # Use --enable-ldiskfs-build or --disable-ldiskfs-build if you need
296 # to override this behavior.
298 AC_DEFUN([LB_LDISKFS_BUILD],
300 AC_ARG_ENABLE([ldiskfs-build],
301 AC_HELP_STRING([--enable-ldiskfs-build],
302 [enable ldiskfs configure/make]),
304 LDISKFS_DIR_INTREE=$(readlink -f $PWD/ldiskfs)
305 if test x$LDISKFS_DIR = x$LDISKFS_DIR_INTREE; then
306 enable_ldiskfs_build='yes'
308 enable_ldiskfs_build='no'
312 AC_MSG_CHECKING([whether to build ldiskfs])
313 if test x$enable_ldiskfs_build = xyes; then
314 AC_MSG_RESULT([$enable_ldiskfs_build])
316 LB_CHECK_FILE([$LDISKFS_DIR/configure], [], [
317 AC_MSG_ERROR([Complete ldiskfs build system must exist])])
318 LB_LDISKFS_EXT_SOURCE
320 LDISKFS_SUBDIR="ldiskfs"
321 AC_SUBST(LDISKFS_SUBDIR)
323 enable_ldiskfs_build='no'
324 AC_MSG_RESULT([$enable_ldiskfs_build])
328 AC_DEFUN([LB_LDISKFS_SYMVERS],
330 AC_MSG_CHECKING([ldiskfs module symbols])
331 if test -r $LDISKFS_OBJ/Module.symvers; then
332 LDISKFS_SYMBOLS=Module.symvers
333 elif test -r $LDISKFS_OBJ/Modules.symvers; then
334 LDISKFS_SYMBOLS=Modules.symvers
335 elif test -r $LDISKFS_OBJ/ldiskfs/Module.symvers; then
336 LDISKFS_SYMBOLS=Module.symvers
337 elif test -r $LDISKFS_OBJ/ldiskfs/Modules.symvers; then
338 LDISKFS_SYMBOLS=Modules.symvers
340 LDISKFS_SYMBOLS=$SYMVERFILE
343 AC_MSG_RESULT([$LDISKFS_SYMBOLS])
344 AC_SUBST(LDISKFS_SYMBOLS)
347 AC_DEFUN([LB_LDISKFS_RELEASE],
349 AC_MSG_CHECKING([ldiskfs source release])
350 if test -r $LDISKFS_OBJ/config.h; then
351 tmp_flags="$EXTRA_KCFLAGS"
352 EXTRA_KCFLAGS="-I$LDISKFS_DIR $EXTRA_KCFLAGS"
355 #undef PACKAGE_TARNAME
356 #undef PACKAGE_VERSION
357 #undef PACKAGE_STRING
358 #undef PACKAGE_BUGREPORT
363 #include <$LDISKFS_OBJ/config.h>
365 char *LDISKFS_RELEASE;
366 LDISKFS_RELEASE=VERSION;
368 $makerule LUSTRE_KERNEL_TEST=conftest.i
370 test -s build/conftest.i
372 eval $(grep "LDISKFS_RELEASE=" build/conftest.i)
374 AC_MSG_RESULT([unknown])
375 AC_MSG_ERROR([Could not preprocess test program.])
377 EXTRA_KCFLAGS="$tmp_flags"
379 elif test -r $LDISKFS_DIR/configure.ac; then
380 LDISKFS_RELEASE=$(awk '/AC\_INIT/ { print [$]3 }' \
381 $LDISKFS_DIR/configure.ac | tr ',' '\n')
383 AC_MSG_RESULT([unknown])
384 AC_MSG_ERROR([Could not locate config.h, META, or configure.ac to check release.])
387 if test x$LDISKFS_RELEASE = x; then
388 AC_MSG_RESULT([unknown])
389 AC_MSG_ERROR([Could not determine ldiskfs release.])
392 AC_MSG_RESULT([$LDISKFS_RELEASE])
393 AC_SUBST(LDISKFS_RELEASE)
397 # LB_DEFINE_E2FSPROGS_NAMES
399 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
401 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES],
403 AC_ARG_WITH([ldiskfsprogs],
404 AC_HELP_STRING([--with-ldiskfsprogs],
405 [use alternate names for ldiskfs-enabled e2fsprogs]),
408 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
409 if test x$withval = xyes ; then
410 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
411 E2FSPROGS="ldiskfsprogs"
412 MKE2FS="mkfs.ldiskfs"
413 DEBUGFS="debugfs.ldiskfs"
414 TUNE2FS="tunefs.ldiskfs"
415 E2LABEL="label.ldiskfs"
416 DUMPE2FS="dumpfs.ldiskfs"
417 E2FSCK="fsck.ldiskfs"
418 PFSCK="pfsck.ldiskfs"
419 AC_MSG_RESULT([enabled])
421 E2FSPROGS="e2fsprogs"
429 AC_MSG_RESULT([disabled])
432 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
433 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
434 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
435 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
436 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
437 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
438 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
439 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
441 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
442 AC_SUBST([MKE2FS], [$MKE2FS])
443 AC_SUBST([DEBUGFS], [$DEBUGFS])
444 AC_SUBST([TUNE2FS], [$TUNE2FS])
445 AC_SUBST([E2LABEL], [$E2LABEL])
446 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
447 AC_SUBST([E2FSCK], [$E2FSCK])
448 AC_SUBST([PFSCK], [$PFSCK])
451 AC_DEFUN([LB_LDISKFS_SERIES],
454 AC_MSG_CHECKING([which ldiskfs series to use])
455 case $LINUXRELEASE in
457 if test x$RHEL_KERNEL = xyes; then
458 LDISKFS_SERIES="2.6-rhel5-ext4.series"
462 if test x$RHEL_KERNEL = xyes; then
463 LDISKFS_SERIES="2.6-rhel6.series"
465 if test x$SUSE_KERNEL = xyes; then
466 LDISKFS_SERIES="2.6-sles11.series"
470 AC_MSG_WARN([Unknown kernel version $LINUXRELEASE])
474 AC_MSG_RESULT([$LDISKFS_SERIES])
478 AC_SUBST(LDISKFS_SERIES)