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