Whamcloud - gitweb
LU-4603 lmv: a few fixes about readdir of striped dir.
[fs/lustre-release.git] / config / lustre-build-ldiskfs.m4
1 #
2 # LDISKFS_LINUX_SERIES
3 #
4 AC_DEFUN([LDISKFS_LINUX_SERIES], [
5 LDISKFS_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/.*= *//')
20                 case $PLEV in
21                 2) LDISKFS_SERIES="3.0-sles11.series"
22                         ;;
23                 3) LDISKFS_SERIES="3.0-sles11sp3.series"
24                         ;;
25                 esac
26         ])
27 ])
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
33
34 #
35 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
36 #
37 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
38 #
39 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
40 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
41 ext4_free_blocks_with_buffer_head, [
42         #include <linux/fs.h>
43         #include "$EXT4_SRC_DIR/ext4.h"
44 ],[
45         ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
46 ],[
47         AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
48                 [ext4_free_blocks do not require struct buffer_head])
49 ])
50 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
51
52 #
53 # LB_EXT_PBLOCK
54 #
55 # 2.6.35 renamed ext_pblock to ext4_ext_pblock(ex)
56 #
57 AC_DEFUN([LB_EXT_PBLOCK], [
58 LB_CHECK_COMPILE([if Linux kernel has 'ext_pblock'],
59 ext_pblock, [
60         #include <linux/fs.h>
61         #include "$EXT4_SRC_DIR/ext4_extents.h"
62 ],[
63         ext_pblock(NULL);
64 ],[
65         AC_DEFINE(HAVE_EXT_PBLOCK, 1, [Linux kernel has ext_pblock])
66 ])
67 ]) # LB_EXT_PBLOCK
68
69 #
70 # LDISKFS_AC_PATCH_PROGRAM
71 #
72 # Determine which program should be used to apply the patches to
73 # the ext4 source code to produce the ldiskfs source code.
74 #
75 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
76         AC_ARG_ENABLE([quilt],
77                 [AC_HELP_STRING([--disable-quilt],
78                         [disable use of quilt for ldiskfs])],
79                 [AS_IF([test "x$enableval" = xno],
80                         [use_quilt=no],
81                         [use_quilt=maybe])],
82                 [use_quilt=maybe]
83         )
84
85         AS_IF([test x$use_quilt = xmaybe], [
86                 AC_PATH_PROG([quilt_avail], [quilt], [no])
87                 AS_IF([test x$quilt_avail = xno], [
88                         use_quilt=no
89                 ], [
90                         use_quilt=yes
91                 ])
92         ])
93
94         AS_IF([test x$use_quilt = xno], [
95                 AC_PATH_PROG([patch_avail], [patch], [no])
96                 AS_IF([test x$patch_avail = xno], [
97                         AC_MSG_ERROR([*** Need "quilt" or "patch" command])
98                 ])
99         ])
100 ]) # LDISKFS_AC_PATCH_PROGRAM
101
102 #
103 # LB_CONFIG_LDISKFS
104 #
105 AC_DEFUN([LB_CONFIG_LDISKFS], [
106 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
107 # However we continue to support this option through Lustre 2.5.
108 AC_ARG_WITH([ldiskfs],
109         [],
110         [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
111         AS_IF([test x$withval != xyes -a x$withval != xno],
112                 [AC_MSG_ERROR([
113
114 The ldiskfs option is deprecated,
115 and no longer supports paths to external ldiskfs source
116 ])])
117 ])
118
119 AC_ARG_ENABLE([ldiskfs],
120         [AS_HELP_STRING([--disable-ldiskfs],
121                 [disable ldiskfs osd (default is enable)])],
122         [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
123                 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
124         [AS_IF([test "${with_ldiskfs+set}" = set],
125                 [enable_ldiskfs=$with_ldiskfs],
126                 [enable_ldiskfs=maybe])
127 ])
128
129 AS_IF([test x$enable_server = xno],
130         [AS_CASE([$enable_ldiskfs],
131                 [maybe], [enable_ldiskfs=no],
132                 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
133         )])
134
135 AS_IF([test x$enable_ldiskfs != xno],[
136         # In the future, we chould change enable_ldiskfs from maybe to
137         # either yes or no based on additional tests, e.g.  whether a patch
138         # set is available for the detected kernel.  For now, we just always
139         # set it to "yes".
140         AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
141
142         LDISKFS_LINUX_SERIES
143         LDISKFS_AC_PATCH_PROGRAM
144         LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
145         LB_EXT_PBLOCK
146         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
147         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
148         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
149         AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
150         AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
151         AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
152 ])
153
154 AC_MSG_CHECKING([whether to build ldiskfs])
155 AC_MSG_RESULT([$enable_ldiskfs])
156
157 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
158 ]) # LB_CONFIG_LDISKFS
159
160 #
161 # LB_VALIDATE_EXT4_SRC_DIR
162 #
163 # Spot check the existance of several source files common to ext4.
164 # Detecting this at configure time allows us to avoid a potential build
165 # failure and provide a useful error message to explain what is wrong.
166 #
167 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
168 enable_ldiskfs_build="no"
169 AS_IF([test -n "$EXT4_SRC_DIR"], [
170         enable_ldiskfs_build="yes"
171         LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
172                 enable_ldiskfs_build="no"
173                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
174         ])
175         LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
176                 enable_ldiskfs_build="no"
177                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
178         ])
179         LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
180                 enable_ldiskfs_build="no"
181                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
182         ])
183         LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
184                 enable_ldiskfs_build="no"
185                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
186         ])
187 ])
188
189 AS_IF([test "x$enable_ldiskfs_build" = xno], [
190         enable_ldiskfs="no"
191
192         AC_MSG_WARN([
193
194 Disabling ldiskfs support because complete ext4 source does not exist.
195
196 If you are building using kernel-devel packages and require ldiskfs
197 server support then ensure that the matching kernel-debuginfo-common
198 and kernel-debuginfo-common-<arch> packages are installed.
199 ])
200 ])
201 ]) # LB_VALIDATE_EXT4_SRC_DIR
202
203 #
204 # LB_EXT4_SRC_DIR
205 #
206 # Determine the location of the ext4 source code.  It it required
207 # for several configure tests and to build ldiskfs.
208 #
209 AC_DEFUN([LB_EXT4_SRC_DIR], [
210 AC_MSG_CHECKING([ext4 source directory])
211 # Kernel ext source located with devel headers
212 linux_src=$LINUX
213 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
214         EXT4_SRC_DIR="$linux_src/fs/ext4"
215 ], [
216         # Kernel ext source provided by kernel-debuginfo-common package
217         linux_src=$(ls -1d /usr/src/debug/*/linux-$LINUXRELEASE \
218                 2>/dev/null | tail -1)
219         AS_IF([test -e "$linux_src/fs/ext4/super.c"],
220                 [EXT4_SRC_DIR="$linux_src/fs/ext4"],
221                 [EXT4_SRC_DIR=""])
222 ])
223 AC_MSG_RESULT([$EXT4_SRC_DIR])
224 AC_SUBST(EXT4_SRC_DIR)
225
226 LB_VALIDATE_EXT4_SRC_DIR
227 ]) # LB_EXT4_SRC_DIR
228
229 #
230 # LB_DEFINE_E2FSPROGS_NAMES
231 #
232 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
233 #
234 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
235 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
236 AC_ARG_WITH([ldiskfsprogs],
237         AC_HELP_STRING([--with-ldiskfsprogs],
238                 [use alternate names for ldiskfs-enabled e2fsprogs]),
239         [], [withval="no"])
240
241 AS_IF([test "x$withval" = xyes], [
242         AC_MSG_RESULT([enabled])
243         AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
244         E2FSPROGS="ldiskfsprogs"
245         MKE2FS="mkfs.ldiskfs"
246         DEBUGFS="debugfs.ldiskfs"
247         TUNE2FS="tunefs.ldiskfs"
248         E2LABEL="label.ldiskfs"
249         DUMPE2FS="dumpfs.ldiskfs"
250         E2FSCK="fsck.ldiskfs"
251         PFSCK="pfsck.ldiskfs"
252 ], [
253         AC_MSG_RESULT([disabled])
254         E2FSPROGS="e2fsprogs"
255         MKE2FS="mke2fs"
256         DEBUGFS="debugfs"
257         TUNE2FS="tune2fs"
258         E2LABEL="e2label"
259         DUMPE2FS="dumpe2fs"
260         E2FSCK="e2fsck"
261         PFSCK="fsck"
262 ])
263
264 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
265 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
266 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
267 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
268 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
269 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
270 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
271 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
272
273 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
274 AC_SUBST([MKE2FS], [$MKE2FS])
275 AC_SUBST([DEBUGFS], [$DEBUGFS])
276 AC_SUBST([TUNE2FS], [$TUNE2FS])
277 AC_SUBST([E2LABEL], [$E2LABEL])
278 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
279 AC_SUBST([E2FSCK], [$E2FSCK])
280 AC_SUBST([PFSCK], [$PFSCK])
281 ]) # LB_DEFINE_E2FSPROGS_NAMES