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