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