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