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)
108 LB_LDISKFS_DEFINE_OPTIONS
112 # LDISKFS_DEVEL is required because when using the ldiskfs-devel package the
113 # ext4 source will be fully patched to ldiskfs. When building with the
114 # in-tree ldiskfs this patching this will occur after the configure step.
115 # We needed a way to determine if we should check the patched or unpatched
118 # Longer term this could be removed by moving the ldiskfs patching in to
119 # the configure phase. Or better yet ldiskfs could be updated to generate
120 # a ldiskfs_config.h which clearly defines how it was built. This can
121 # then be directly included by Lustre to avoid all the autoconf guess work.
122 # For an example of this behavior consult the lustre/zfs build integration.
124 AM_CONDITIONAL(LDISKFS_DEVEL, \
125 test x$LDISKFS_DIR = x$(readlink -f $PWD/ldiskfs) || \
126 test x$LDISKFS_DIR = x$(readlink -f $PWD/../ldiskfs))
128 AM_CONDITIONAL(LDISKFS_BUILD, test x$enable_ldiskfs_build = xyes)
129 AM_CONDITIONAL(LDISKFS_ENABLED, test x$with_ldiskfs = xyes)
131 if test -e "$PWD/ldiskfs"; then
132 LDISKFS_DIST_SUBDIR="ldiskfs"
133 AC_SUBST(LDISKFS_DIST_SUBDIR)
134 AC_CONFIG_SUBDIRS("ldiskfs")
141 # Determine the location of the ext4 source code. It it required
142 # for several configure tests and to build ldiskfs.
144 AC_DEFUN([LB_LDISKFS_EXT_DIR],
146 # Kernel ext source located with devel headers
148 if test -e "$linux_src/fs/ext4/super.c"; then
149 EXT_DIR=$linux_src/fs/ext4
151 # Kernel ext source provided by kernel-debuginfo-common package
152 linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
153 2>/dev/null | tail -1)
154 if test -e "$linux_src/fs/ext4/super.c"; then
155 EXT_DIR=$linux_src/fs/ext4
161 AC_MSG_CHECKING([ext4 source directory])
162 AC_MSG_RESULT([$EXT_DIR])
167 # LB_LDISKFS_EXT_SOURCE
169 # Spot check the existance of several source files common to ext4.
170 # Detecting this at configure time allows us to avoid a potential build
171 # failure and provide a useful error message to explain what is wrong.
173 AC_DEFUN([LB_LDISKFS_EXT_SOURCE],
175 if test x$EXT_DIR = x; then
176 enable_ldiskfs_build='no'
178 LB_CHECK_FILE([$EXT_DIR/dir.c], [], [
179 enable_ldiskfs_build='no'
180 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
181 LB_CHECK_FILE([$EXT_DIR/file.c], [], [
182 enable_ldiskfs_build='no'
183 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
184 LB_CHECK_FILE([$EXT_DIR/inode.c], [], [
185 enable_ldiskfs_build='no'
186 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
187 LB_CHECK_FILE([$EXT_DIR/super.c], [], [
188 enable_ldiskfs_build='no'
189 AC_MSG_WARN([ext4 must exist for ldiskfs build])])
192 if test x$enable_ldiskfs_build = xno; then
194 enable_ldiskfs_build='no'
200 Disabling server because complete ext4 source does not exist.
202 If you are building using kernel-devel packages and require ldiskfs
203 server support then ensure that the matching kernel-debuginfo-common
204 and kernel-debuginfo-common-<arch> packages are installed.
212 # LB_LDISKFS_DEFINE_OPTIONS
214 # Enable config options related to ldiskfs. These are used by ldiskfs,
215 # lvfs, and the osd-ldiskfs code (which includes ldiskfs headers.)
217 AC_DEFUN([LB_LDISKFS_DEFINE_OPTIONS],
219 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
221 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1,
222 [enable extended attributes for ldiskfs])
223 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1,
224 [enable posix acls for ldiskfs])
225 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1,
226 [enable fs security for ldiskfs])
227 AC_DEFINE(CONFIG_LDISKFSDEV_FS_POSIX_ACL, 1,
228 [enable posix acls for ldiskfs])
229 AC_DEFINE(CONFIG_LDISKFSDEV_FS_XATTR, 1,
230 [enable extented attributes for ldiskfs])
231 AC_DEFINE(CONFIG_LDISKFSDEV_FS_SECURITY, 1,
232 [enable fs security for ldiskfs])
236 # Optionally configure/make the ldiskfs sources. If the sources are
237 # determined to reside in-tree this feature will automatically be
238 # enabled. If the sources are not in-tree it will be disabled.
239 # Use --enable-ldiskfs-build or --disable-ldiskfs-build if you need
240 # to override this behavior.
242 AC_DEFUN([LB_LDISKFS_BUILD],
244 AC_ARG_ENABLE([ldiskfs-build],
245 AC_HELP_STRING([--enable-ldiskfs-build],
246 [enable ldiskfs configure/make]),
248 LDISKFS_DIR_INTREE=$(readlink -f $PWD/ldiskfs)
249 if test x$LDISKFS_DIR = x$LDISKFS_DIR_INTREE; then
250 enable_ldiskfs_build='yes'
252 enable_ldiskfs_build='no'
256 AC_MSG_CHECKING([whether to build ldiskfs])
257 if test x$enable_ldiskfs_build = xyes; then
258 AC_MSG_RESULT([$enable_ldiskfs_build])
259 LDISKFS_SUBDIR="ldiskfs"
261 LB_CHECK_FILE([$LDISKFS_DIR/configure], [], [
262 AC_MSG_ERROR([Complete ldiskfs build system must exist])])
263 LB_LDISKFS_EXT_SOURCE
265 AC_SUBST(LDISKFS_SUBDIR)
267 enable_ldiskfs_build='no'
268 AC_MSG_RESULT([$enable_ldiskfs_build])
272 AC_DEFUN([LB_LDISKFS_SYMVERS],
274 AC_MSG_CHECKING([ldiskfs module symbols])
275 if test -r $LDISKFS_OBJ/Module.symvers; then
276 LDISKFS_SYMBOLS=Module.symvers
277 elif test -r $LDISKFS_OBJ/Modules.symvers; then
278 LDISKFS_SYMBOLS=Modules.symvers
279 elif test -r $LDISKFS_OBJ/ldiskfs/Module.symvers; then
280 LDISKFS_SYMBOLS=Module.symvers
281 elif test -r $LDISKFS_OBJ/ldiskfs/Modules.symvers; then
282 LDISKFS_SYMBOLS=Modules.symvers
284 LDISKFS_SYMBOLS=$SYMVERFILE
287 AC_MSG_RESULT([$LDISKFS_SYMBOLS])
288 AC_SUBST(LDISKFS_SYMBOLS)
291 AC_DEFUN([LB_LDISKFS_RELEASE],
293 AC_MSG_CHECKING([ldiskfs source release])
294 if test -r $LDISKFS_OBJ/config.h; then
295 tmp_flags="$EXTRA_KCFLAGS"
296 EXTRA_KCFLAGS="-I$LDISKFS_DIR $EXTRA_KCFLAGS"
299 #undef PACKAGE_TARNAME
300 #undef PACKAGE_VERSION
301 #undef PACKAGE_STRING
302 #undef PACKAGE_BUGREPORT
307 #include <$LDISKFS_OBJ/config.h>
309 char *LDISKFS_RELEASE;
310 LDISKFS_RELEASE=VERSION;
312 $makerule LUSTRE_KERNEL_TEST=conftest.i
314 test -s build/conftest.i
316 eval $(grep "LDISKFS_RELEASE=" build/conftest.i)
318 AC_MSG_RESULT([unknown])
319 AC_MSG_ERROR([Could not preprocess test program.])
321 EXTRA_KCFLAGS="$tmp_flags"
323 elif test -r $LDISKFS_DIR/configure.ac; then
324 LDISKFS_RELEASE=$(awk '/AC\_INIT/ { print [$]3 }' \
325 $LDISKFS_DIR/configure.ac | tr ',' '\n')
327 AC_MSG_RESULT([unknown])
328 AC_MSG_ERROR([Could not locate config.h, META, or configure.ac to check release.])
331 if test x$LDISKFS_RELEASE = x; then
332 AC_MSG_RESULT([unknown])
333 AC_MSG_ERROR([Could not determine ldiskfs release.])
336 AC_MSG_RESULT([$LDISKFS_RELEASE])
337 AC_SUBST(LDISKFS_RELEASE)
341 # LB_DEFINE_E2FSPROGS_NAMES
343 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
345 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES],
347 AC_ARG_WITH([ldiskfsprogs],
348 AC_HELP_STRING([--with-ldiskfsprogs],
349 [use alternate names for ldiskfs-enabled e2fsprogs]),
352 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
353 if test x$withval = xyes ; then
354 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
355 E2FSPROGS="ldiskfsprogs"
356 MKE2FS="mkfs.ldiskfs"
357 DEBUGFS="debugfs.ldiskfs"
358 TUNE2FS="tunefs.ldiskfs"
359 E2LABEL="label.ldiskfs"
360 DUMPE2FS="dumpfs.ldiskfs"
361 E2FSCK="fsck.ldiskfs"
362 PFSCK="pfsck.ldiskfs"
363 AC_MSG_RESULT([enabled])
365 E2FSPROGS="e2fsprogs"
373 AC_MSG_RESULT([disabled])
376 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
377 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
378 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
379 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
380 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
381 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
382 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
383 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
385 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
386 AC_SUBST([MKE2FS], [$MKE2FS])
387 AC_SUBST([DEBUGFS], [$DEBUGFS])
388 AC_SUBST([TUNE2FS], [$TUNE2FS])
389 AC_SUBST([E2LABEL], [$E2LABEL])
390 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
391 AC_SUBST([E2FSCK], [$E2FSCK])
392 AC_SUBST([PFSCK], [$PFSCK])