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