4 AC_DEFUN([LDISKFS_LINUX_SERIES], [
6 AC_MSG_CHECKING([which ldiskfs series to use])
7 AS_IF([test x$RHEL_KERNEL = xyes], [
8 AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32-431],[
9 AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32-343],[
10 AS_VERSION_COMPARE([$RHEL_KERNEL_VERSION],[2.6.32],[],
11 [LDISKFS_SERIES="2.6-rhel6.series"], [LDISKFS_SERIES="2.6-rhel6.series"])],
12 [LDISKFS_SERIES="2.6-rhel6.4.series"],[LDISKFS_SERIES="2.6-rhel6.4.series"])],
13 [LDISKFS_SERIES="2.6-rhel6.5.series"],[LDISKFS_SERIES="2.6-rhel6.5.series"])
14 ], [test x$SUSE_KERNEL = xyes], [
15 AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
16 AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
17 [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
18 [LDISKFS_SERIES="3.0-sles11.series"],[
19 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
21 2) LDISKFS_SERIES="3.0-sles11.series"
23 3) LDISKFS_SERIES="3.0-sles11sp3.series"
28 AS_IF([test -z "$LDISKFS_SERIES"],
29 [AC_MSG_WARN([Unknown kernel version $LDISKFS_VERSIONRELEASE])])
30 AC_MSG_RESULT([$LDISKFS_SERIES])
31 AC_SUBST(LDISKFS_SERIES)
32 ]) # LDISKFS_LINUX_SERIES
35 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
37 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
38 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
40 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
41 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
42 ext4_free_blocks_with_buffer_head, [
44 #include "$EXT4_SRC_DIR/ext4.h"
46 ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
48 AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
49 [ext4_free_blocks do not require struct buffer_head])
51 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
56 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
58 AC_DEFUN([LB_EXT_PBLOCK], [
59 LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
62 #include "$EXT4_SRC_DIR/ext4_extents.h"
66 AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
71 # LB_EXT4_JOURNAL_START_3ARGS
73 # 3.9 added a type argument to ext4_journal_start and friends
75 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
76 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
79 #include "$EXT4_SRC_DIR/ext4_jbd2.h"
81 ext4_journal_start(NULL, 0, 0);
83 AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
85 ]) # LB_EXT4_JOURNAL_START_3ARGS
88 # LDISKFS_AC_PATCH_PROGRAM
90 # Determine which program should be used to apply the patches to
91 # the ext4 source code to produce the ldiskfs source code.
93 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
94 AC_ARG_ENABLE([quilt],
95 [AC_HELP_STRING([--disable-quilt],
96 [disable use of quilt for ldiskfs])],
97 [AS_IF([test "x$enableval" = xno],
103 AS_IF([test x$use_quilt = xmaybe], [
104 AC_PATH_PROG([quilt_avail], [quilt], [no])
105 AS_IF([test x$quilt_avail = xno], [
112 AS_IF([test x$use_quilt = xno], [
113 AC_PATH_PROG([patch_avail], [patch], [no])
114 AS_IF([test x$patch_avail = xno], [
115 AC_MSG_ERROR([*** Need "quilt" or "patch" command])
118 ]) # LDISKFS_AC_PATCH_PROGRAM
123 AC_DEFUN([LB_CONFIG_LDISKFS], [
124 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
125 # However we continue to support this option through Lustre 2.5.
126 AC_ARG_WITH([ldiskfs],
128 [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
129 AS_IF([test x$withval != xyes -a x$withval != xno],
132 The ldiskfs option is deprecated,
133 and no longer supports paths to external ldiskfs source
137 AC_ARG_ENABLE([ldiskfs],
138 [AS_HELP_STRING([--disable-ldiskfs],
139 [disable ldiskfs osd (default is enable)])],
140 [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
141 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
142 [AS_IF([test "${with_ldiskfs+set}" = set],
143 [enable_ldiskfs=$with_ldiskfs],
144 [enable_ldiskfs=maybe])
147 AS_IF([test x$enable_server = xno],
148 [AS_CASE([$enable_ldiskfs],
149 [maybe], [enable_ldiskfs=no],
150 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
153 AS_IF([test x$enable_ldiskfs != xno],[
154 # In the future, we chould change enable_ldiskfs from maybe to
155 # either yes or no based on additional tests, e.g. whether a patch
156 # set is available for the detected kernel. For now, we just always
158 AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
161 LDISKFS_AC_PATCH_PROGRAM
162 LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
164 LB_EXT4_JOURNAL_START_3ARGS
165 AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
166 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
167 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
168 AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
169 AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
170 AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
173 AC_MSG_CHECKING([whether to build ldiskfs])
174 AC_MSG_RESULT([$enable_ldiskfs])
176 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
177 ]) # LB_CONFIG_LDISKFS
180 # LB_VALIDATE_EXT4_SRC_DIR
182 # Spot check the existance of several source files common to ext4.
183 # Detecting this at configure time allows us to avoid a potential build
184 # failure and provide a useful error message to explain what is wrong.
186 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
187 enable_ldiskfs_build="no"
188 AS_IF([test -n "$EXT4_SRC_DIR"], [
189 enable_ldiskfs_build="yes"
190 LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
191 enable_ldiskfs_build="no"
192 AC_MSG_WARN([ext4 must exist for ldiskfs build])
194 LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
195 enable_ldiskfs_build="no"
196 AC_MSG_WARN([ext4 must exist for ldiskfs build])
198 LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
199 enable_ldiskfs_build="no"
200 AC_MSG_WARN([ext4 must exist for ldiskfs build])
202 LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
203 enable_ldiskfs_build="no"
204 AC_MSG_WARN([ext4 must exist for ldiskfs build])
208 AS_IF([test "x$enable_ldiskfs_build" = xno], [
213 Disabling ldiskfs support because complete ext4 source does not exist.
215 If you are building using kernel-devel packages and require ldiskfs
216 server support then ensure that the matching kernel-debuginfo-common
217 and kernel-debuginfo-common-<arch> packages are installed.
220 ]) # LB_VALIDATE_EXT4_SRC_DIR
225 # Determine the location of the ext4 source code. It it required
226 # for several configure tests and to build ldiskfs.
228 AC_DEFUN([LB_EXT4_SRC_DIR], [
229 AC_MSG_CHECKING([ext4 source directory])
230 # Kernel ext source located with devel headers
232 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
233 EXT4_SRC_DIR="$linux_src/fs/ext4"
235 # Kernel ext source provided by kernel-debuginfo-common package
236 linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
237 2>/dev/null | tail -1)
238 AS_IF([test -e "$linux_src/fs/ext4/super.c"],
239 [EXT4_SRC_DIR="$linux_src/fs/ext4"],
242 AC_MSG_RESULT([$EXT4_SRC_DIR])
243 AC_SUBST(EXT4_SRC_DIR)
245 LB_VALIDATE_EXT4_SRC_DIR
249 # LB_DEFINE_E2FSPROGS_NAMES
251 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
253 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
254 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
255 AC_ARG_WITH([ldiskfsprogs],
256 AC_HELP_STRING([--with-ldiskfsprogs],
257 [use alternate names for ldiskfs-enabled e2fsprogs]),
260 AS_IF([test "x$withval" = xyes], [
261 AC_MSG_RESULT([enabled])
262 AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
263 E2FSPROGS="ldiskfsprogs"
264 MKE2FS="mkfs.ldiskfs"
265 DEBUGFS="debugfs.ldiskfs"
266 TUNE2FS="tunefs.ldiskfs"
267 E2LABEL="label.ldiskfs"
268 DUMPE2FS="dumpfs.ldiskfs"
269 E2FSCK="fsck.ldiskfs"
270 PFSCK="pfsck.ldiskfs"
272 AC_MSG_RESULT([disabled])
273 E2FSPROGS="e2fsprogs"
283 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
284 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
285 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
286 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
287 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
288 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
289 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
290 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
292 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
293 AC_SUBST([MKE2FS], [$MKE2FS])
294 AC_SUBST([DEBUGFS], [$DEBUGFS])
295 AC_SUBST([TUNE2FS], [$TUNE2FS])
296 AC_SUBST([E2LABEL], [$E2LABEL])
297 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
298 AC_SUBST([E2FSCK], [$E2FSCK])
299 AC_SUBST([PFSCK], [$PFSCK])
300 ]) # LB_DEFINE_E2FSPROGS_NAMES