Whamcloud - gitweb
LU-12678 socklnd: initialize the_ksocklnd at compile-time.
[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         80)     LDISKFS_SERIES="4.18-rhel8.series"      ;;
17         77)     LDISKFS_SERIES="3.10-rhel7.7.series"    ;;
18         76)     LDISKFS_SERIES="3.10-rhel7.6.series"    ;;
19         75)     LDISKFS_SERIES="3.10-rhel7.5.series"    ;;
20         74)     LDISKFS_SERIES="3.10-rhel7.4.series"    ;;
21         73)     LDISKFS_SERIES="3.10-rhel7.3.series"    ;;
22         72)     LDISKFS_SERIES="3.10-rhel7.2.series"    ;;
23         71)     LDISKFS_SERIES="3.10-rhel7.series"      ;;
24         69)     LDISKFS_SERIES="2.6-rhel6.9.series"     ;;
25         68)     LDISKFS_SERIES="2.6-rhel6.8.series"     ;;
26         67)     LDISKFS_SERIES="2.6-rhel6.7.series"     ;;
27         66)     LDISKFS_SERIES="2.6-rhel6.6.series"     ;;
28         65)     LDISKFS_SERIES="2.6-rhel6.5.series"     ;;
29         64)     LDISKFS_SERIES="2.6-rhel6.4.series"     ;;
30         6[0-3]) LDISKFS_SERIES="2.6-rhel6.series"       ;;
31         esac
32 ], [test x$SUSE_KERNEL = xyes], [
33         AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.82],[
34         AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0],[
35         AS_VERSION_COMPARE([$LINUXRELEASE],[3.12.0],[
36         AS_VERSION_COMPARE([$LINUXRELEASE],[3.0.0],[
37         AS_VERSION_COMPARE([$LINUXRELEASE],[2.6.32], [],
38         [LDISKFS_SERIES="2.6-sles11.series"],[LDISKFS_SERIES="2.6-sles11.series"])],
39         [LDISKFS_SERIES="3.0-sles11.series"],[
40                 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
41                 case $PLEV in
42                 2) LDISKFS_SERIES="3.0-sles11.series"
43                         ;;
44                 3) LDISKFS_SERIES="3.0-sles11sp3.series"
45                         ;;
46                 4) LDISKFS_SERIES="3.0-sles11sp4.series"
47                         ;;
48                 esac
49         ])],[LDISKFS_SERIES="3.12-sles12.series"],[
50                 PLEV=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
51                 case $PLEV in
52                 1) LDISKFS_SERIES="3.12-sles12sp1.series"
53                         ;;
54                 *) LDISKFS_SERIES="3.12-sles12.series"
55                         ;;
56                 esac
57         ])],[LDISKFS_SERIES="4.4-sles12sp2.series"],
58             [LDISKFS_SERIES="4.4-sles12sp2.series"]
59         )], [LDISKFS_SERIES="4.4-sles12sp3.series"],
60             [LDISKFS_SERIES="4.4-sles12sp3.series"])
61 ], [test x$UBUNTU_KERNEL = xyes], [
62         AS_VERSION_COMPARE([$LINUXRELEASE],[5.0.0],[
63         AS_VERSION_COMPARE([$LINUXRELEASE],[4.15.0],[
64         AS_VERSION_COMPARE([$LINUXRELEASE],[4.4.0], [],
65         [
66                 KPLEV=$(echo $LINUXRELEASE | sed -n 's/.*-\([0-9]\+\).*/\1/p')
67                 AS_IF(
68                         [test -z "$KPLEV"], [
69                                 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
70                                 LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"
71                         ],
72                         [test $KPLEV -ge 73], [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"],
73                         [test $KPLEV -ge 62], [LDISKFS_SERIES="4.4.0-62-ubuntu14+16.series"],
74                         [test $KPLEV -ge 49], [LDISKFS_SERIES="4.4.0-49-ubuntu14+16.series"],
75                         [LDISKFS_SERIES="4.4.0-45-ubuntu14+16.series"]
76                 )
77         ],
78         [LDISKFS_SERIES="4.4.0-73-ubuntu14+16.series"])],
79         [
80                 KPLEV=$(echo $LINUXRELEASE | sed -n 's/.*-\([0-9]\+\).*/\1/p')
81                 AS_IF(
82                         [test -z "$KPLEV"], [
83                                 AC_MSG_WARN([Failed to determine Kernel patch level. Assume latest.])
84                                 LDISKFS_SERIES="4.15.0-24-ubuntu18.series"
85                         ],
86                         [test $KPLEV -ge 24], [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"],
87                         [test $KPLEV -ge 20], [LDISKFS_SERIES="4.15.0-20-ubuntu18.series"]
88                 )
89         ],
90         [LDISKFS_SERIES="4.15.0-24-ubuntu18.series"])],
91         [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"],
92         [LDISKFS_SERIES="5.0.0-13-ubuntu19.series"])
93 ])
94 ])
95 # Not RHEL/SLES or Ubuntu .. probably mainline
96 AS_IF([test -z "$LDISKFS_SERIES"],
97         [
98         AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],[],
99         [LDISKFS_SERIES="5.4.0-ml.series"],[
100         AS_VERSION_COMPARE([$LINUXRELEASE],[5.4.0],
101                 [LDISKFS_SERIES="5.4.0-ml.series"], # lt
102                 [LDISKFS_SERIES="5.4.0-ml.series"], # eq
103                 [LDISKFS_SERIES="5.4.0-ml.series"]  # gt
104                 )])
105         ],
106 [])
107 AS_IF([test -z "$LDISKFS_SERIES"],
108         [AC_MSG_RESULT([failed to identify series])],
109         [AC_MSG_RESULT([$LDISKFS_SERIES])])
110 AC_SUBST(LDISKFS_SERIES)
111 ]) # LDISKFS_LINUX_SERIES
112
113 #
114 # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
115 #
116 # 2.6.32-rc7 ext4_free_blocks requires struct buffer_head
117 # Note that RHEL6 is pre 2.6.32-rc7 so this check is still needed.
118 #
119 AC_DEFUN([LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD], [
120 LB_CHECK_COMPILE([if 'ext4_free_blocks' needs 'struct buffer_head'],
121 ext4_free_blocks_with_buffer_head, [
122         #include <linux/fs.h>
123         #include "$EXT4_SRC_DIR/ext4.h"
124 ],[
125         ext4_free_blocks(NULL, NULL, NULL, 0, 0, 0);
126 ],[
127         AC_DEFINE(HAVE_EXT_FREE_BLOCK_WITH_BUFFER_HEAD, 1,
128                 [ext4_free_blocks do not require struct buffer_head])
129 ])
130 ]) # LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
131
132 #
133 # LB_EXT4_JOURNAL_START_3ARGS
134 #
135 # 3.9 added a type argument to ext4_journal_start and friends
136 #
137 AC_DEFUN([LB_EXT4_JOURNAL_START_3ARGS], [
138 LB_CHECK_COMPILE([if ext4_journal_start takes 3 arguments],
139 ext4_journal_start, [
140         #include <linux/fs.h>
141         #include "$EXT4_SRC_DIR/ext4_jbd2.h"
142 ],[
143         ext4_journal_start(NULL, 0, 0);
144 ],[
145         AC_DEFINE(JOURNAL_START_HAS_3ARGS, 1, [ext4_journal_start takes 3 arguments])
146 ])
147 ]) # LB_EXT4_JOURNAL_START_3ARGS
148
149 #
150 # LB_EXT4_BREAD_4ARGS
151 #
152 # 3.18 ext4_bread has 4 arguments
153 # NOTE: It may not be exported for modules, use a positive compiler test here.
154 #
155 AC_DEFUN([LB_EXT4_BREAD_4ARGS], [
156 LB_CHECK_COMPILE([if ext4_bread takes 4 arguments],
157 ext4_bread, [
158         #include <linux/fs.h>
159         #include "$EXT4_SRC_DIR/ext4.h"
160
161         struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
162                                        ext4_lblk_t block, int map_flags)
163         {
164                 struct buffer_head *bh = NULL;
165                 (void)handle;
166                 (void)inode;
167                 (void)block;
168                 (void)map_flags;
169                 return bh;
170         }
171 ],[
172         ext4_bread(NULL, NULL, 0, 0);
173 ],[
174         AC_DEFINE(HAVE_EXT4_BREAD_4ARGS, 1, [ext4_bread takes 4 arguments])
175 ])
176 ]) # LB_EXT4_BREAD_4ARGS
177
178 #
179 # LB_EXT4_HAVE_INFO_DQUOT
180 #
181 # in linux 4.4 i_dqout is in ext4_inode_info, not in struct inode
182 #
183 AC_DEFUN([LB_EXT4_HAVE_INFO_DQUOT], [
184 LB_CHECK_COMPILE([if i_dquot is in ext4_inode_info],
185 ext4_info_dquot, [
186         #include <linux/fs.h>
187         #include <linux/quota.h>
188         #include "$EXT4_SRC_DIR/ext4.h"
189 ],[
190         struct ext4_inode_info in;
191         struct dquot *dq;
192
193         dq = in.i_dquot[0];
194 ],[
195         AC_DEFINE(HAVE_EXT4_INFO_DQUOT, 1, [i_dquot is in ext4_inode_info])
196 ])
197 ]) # LB_EXT4_HAVE_INFO_DQUOT
198
199 #
200 # LB_EXT4_HAVE_I_CRYPT_INFO
201 #
202 # in linux 4.8 i_crypt_info moved from ext4_inode_info to struct inode
203 #
204 # Determine if we need to enable CONFIG_LDISKFS_FS_ENCRYPTION.
205 # If we have i_crypt_info in ext4_inode_info, the config option
206 # should be enabled to make the ldiskfs module compilation happy.
207 # Otherwise i_crypy_info is in struct inode, we need to check kernel
208 # config option to determine that.
209 #
210 AC_DEFUN([LB_EXT4_HAVE_I_CRYPT_INFO], [
211 LB_CHECK_COMPILE([if i_crypt_info is in ext4_inode_info],
212 ext4_i_crypt_info, [
213         #define CONFIG_EXT4_FS_ENCRYPTION 1
214         #include <linux/fs.h>
215         #include "$EXT4_SRC_DIR/ext4.h"
216 ],[
217         struct ext4_inode_info in;
218
219         in.i_crypt_info = NULL;
220 ],[
221         AC_DEFINE(
222                 CONFIG_LDISKFS_FS_ENCRYPTION, 1,
223                 [enable encryption for ldiskfs]
224         )
225 ],[
226         LB_CHECK_CONFIG([EXT4_FS_ENCRYPTION],[
227                 AC_DEFINE(
228                         CONFIG_LDISKFS_FS_ENCRYPTION, 1,
229                         [enable encryption for ldiskfs]
230                 )
231         ])
232 ])
233 ]) # LB_EXT4_HAVE_I_CRYPT_INFO
234
235 #
236 # LB_LDISKFS_IGET_HAS_FLAGS_ARG
237 #
238 # kernel 4.19 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
239 # ext4_iget changed to a macro with 3 args was function with 2 args
240 #
241 AC_DEFUN([LB_LDISKFS_IGET_HAS_FLAGS_ARG], [
242 tmp_flags="$EXTRA_KCFLAGS"
243 EXTRA_KCFLAGS="-Werror"
244 LB_CHECK_COMPILE([if ldiskfs_iget takes a flags argument],
245 ext4_iget_3args, [
246         #include <linux/fs.h>
247         #include "$EXT4_SRC_DIR/ext4.h"
248 ],[
249         int f = EXT4_IGET_SPECIAL;
250         (void)f;
251 ],[
252         AC_DEFINE(HAVE_LDISKFS_IGET_WITH_FLAGS, 1,
253                 [if ldiskfs_iget takes a flags argument])
254 ])
255 EXTRA_KCFLAGS="$tmp_flags"
256 ]) # LB_LDISKFS_IGET_HAS_FLAGS_ARG
257
258 #
259 # LDISKFS_AC_PATCH_PROGRAM
260 #
261 # Determine which program should be used to apply the patches to
262 # the ext4 source code to produce the ldiskfs source code.
263 #
264 AC_DEFUN([LDISKFS_AC_PATCH_PROGRAM], [
265         AC_ARG_ENABLE([quilt],
266                 [AC_HELP_STRING([--disable-quilt],
267                         [disable use of quilt for ldiskfs])],
268                 [AS_IF([test "x$enableval" = xno],
269                         [use_quilt=no],
270                         [use_quilt=maybe])],
271                 [use_quilt=maybe]
272         )
273
274         AS_IF([test x$use_quilt = xmaybe], [
275                 AC_PATH_PROG([quilt_avail], [quilt], [no])
276                 AS_IF([test x$quilt_avail = xno], [
277                         use_quilt=no
278                 ], [
279                         use_quilt=yes
280                 ])
281         ])
282
283         AS_IF([test x$use_quilt = xno], [
284                 AC_PATH_PROG([patch_avail], [patch], [no])
285                 AS_IF([test x$patch_avail = xno], [
286                         AC_MSG_ERROR([*** Need "quilt" or "patch" command])
287                 ])
288         ])
289 ]) # LDISKFS_AC_PATCH_PROGRAM
290
291 #
292 # LB_HAVE_BVEC_ITER_ALL
293 #
294 # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
295 # block: allow bio_for_each_segment_all() to iterate over multi-page bvec
296 #
297 AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
298 tmp_flags="$EXTRA_KCFLAGS"
299 EXTRA_KCFLAGS="-Werror"
300 LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
301 ext4fs_dirhash, [
302         #include <linux/bvec.h>
303 ],[
304         struct bvec_iter_all iter;
305         (void)iter;
306 ],[
307         AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
308                 [if bvec_iter_all exists for multi-page bvec iternation])
309 ])
310 EXTRA_KCFLAGS="$tmp_flags"
311 ]) # LB_HAVE_BVEC_ITER_ALL
312
313 #
314 # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
315 #
316 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
317 # ext4: avoid declaring fs inconsistent due to invalid file handles
318 # __ext4_find_entry became a helper function for ext4_find_entry
319 # conflicting with previous ldiskfs patches.
320 # ldiskfs patches map ext4_find_entry to ldiskfs_find_entry_locked to
321 # avoid conflicting with __ext4_find_entry
322 #
323 # When the following check succeeds __ext4_find_entry helper is not
324 # used.
325 #
326 AC_DEFUN([LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS], [
327 tmp_flags="$EXTRA_KCFLAGS"
328 EXTRA_KCFLAGS="-Werror"
329 LB_CHECK_COMPILE([if __ldiskfs_find_entry is available],
330 ldiskfs_find_entry_locked, [
331         #include <linux/fs.h>
332         #include "$EXT4_SRC_DIR/ext4.h"
333         #include "$EXT4_SRC_DIR/namei.c"
334
335         static int __ext4_find_entry(void) { return 0; }
336 ],[
337         int x = __ext4_find_entry();
338         (void)x;
339 ],[
340         AC_DEFINE(HAVE___LDISKFS_FIND_ENTRY, 1,
341                 [if __ldiskfs_find_entry is available])
342 ])
343 EXTRA_KCFLAGS="$tmp_flags"
344 ]) # LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
345
346 #
347 # LB_LDISKFSFS_DIRHASH_WANTS_DIR
348 #
349 # kernel 5.2 commit 8a363970d1dc38c4ec4ad575c862f776f468d057
350 # ext4fs_dirhash UNICODE support
351 #
352 AC_DEFUN([LB_LDISKFSFS_DIRHASH_WANTS_DIR], [
353 tmp_flags="$EXTRA_KCFLAGS"
354 EXTRA_KCFLAGS="-Werror"
355 LB_CHECK_COMPILE([if ldiskfsfs_dirhash takes an inode argument],
356 ext4fs_dirhash, [
357         #include <linux/fs.h>
358         #include "$EXT4_SRC_DIR/ext4.h"
359
360         int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
361                           struct dx_hash_info *hinfo)
362         {
363                 (void)dir;
364                 (void)name;
365                 (void)len;
366                 (void)hinfo;
367                 return 0;
368         }
369 ],[
370         int f = ext4fs_dirhash(NULL, NULL, 0, NULL);
371         (void)f;
372 ],[
373         AC_DEFINE(HAVE_LDISKFSFS_GETHASH_INODE_ARG, 1,
374                 [if ldiskfsfs_dirhash takes an inode argument])
375 ])
376 EXTRA_KCFLAGS="$tmp_flags"
377 ]) # LB_LDISKFSFS_DIRHASH_WANTS_DIR
378
379 #
380 # LB_CONFIG_LDISKFS
381 #
382 AC_DEFUN([LB_CONFIG_LDISKFS], [
383 # --with-ldiskfs is deprecated now that ldiskfs is fully merged with lustre.
384 # However we continue to support this option through Lustre 2.5.
385 AC_ARG_WITH([ldiskfs],
386         [],
387         [AC_MSG_WARN([--with-ldiskfs is deprecated, please use --enable-ldiskfs])
388         AS_IF([test x$withval != xyes -a x$withval != xno],
389                 [AC_MSG_ERROR([
390
391 The ldiskfs option is deprecated,
392 and no longer supports paths to external ldiskfs source
393 ])])
394 ])
395
396 AC_ARG_ENABLE([ldiskfs],
397         [AS_HELP_STRING([--disable-ldiskfs],
398                 [disable ldiskfs osd (default is enable)])],
399         [AS_IF([test x$enable_ldiskfs != xyes -a x$enable_ldiskfs != xno],
400                 [AC_MSG_ERROR([ldiskfs valid options are "yes" or "no"])])],
401         [AS_IF([test "${with_ldiskfs+set}" = set],
402                 [enable_ldiskfs=$with_ldiskfs],
403                 [enable_ldiskfs=maybe])
404 ])
405
406 AS_IF([test x$enable_server = xno],
407         [AS_CASE([$enable_ldiskfs],
408                 [maybe], [enable_ldiskfs=no],
409                 [yes], [AC_MSG_ERROR([cannot build ldiskfs when servers are disabled])]
410         )])
411
412 AS_IF([test x$enable_ldiskfs != xno],[
413         # In the future, we chould change enable_ldiskfs from maybe to
414         # either yes or no based on additional tests, e.g.  whether a patch
415         # set is available for the detected kernel.  For now, we just always
416         # set it to "yes".
417         AS_IF([test x$enable_ldiskfs = xmaybe], [enable_ldiskfs=yes])
418         AC_SUBST(ENABLE_LDISKFS, yes)
419
420         LDISKFS_LINUX_SERIES
421         LDISKFS_AC_PATCH_PROGRAM
422         LB_EXT_FREE_BLOCKS_WITH_BUFFER_HEAD
423         LB_EXT4_JOURNAL_START_3ARGS
424         LB_EXT4_BREAD_4ARGS
425         LB_EXT4_HAVE_INFO_DQUOT
426         LB_EXT4_HAVE_I_CRYPT_INFO
427         LB_LDISKFS_IGET_HAS_FLAGS_ARG
428         LB_HAVE_BVEC_ITER_ALL
429         LB_LDISKFS_FIND_ENTRY_LOCKED_EXISTS
430         LB_LDISKFSFS_DIRHASH_WANTS_DIR
431         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [posix acls for ldiskfs])
432         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [fs security for ldiskfs])
433         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [extened attributes for ldiskfs])
434         AC_DEFINE(CONFIG_LDISKFS_FS_RW, 1, [enable rw access for ldiskfs])
435         AC_SUBST(LDISKFS_SUBDIR, ldiskfs)
436         AC_DEFINE(HAVE_LDISKFS_OSD, 1, Enable ldiskfs osd)
437 ], [
438         AC_SUBST(ENABLE_LDISKFS, no)
439 ])
440
441 AC_MSG_CHECKING([whether to build ldiskfs])
442 AC_MSG_RESULT([$enable_ldiskfs])
443
444 AM_CONDITIONAL([LDISKFS_ENABLED], [test x$enable_ldiskfs = xyes])
445 ]) # LB_CONFIG_LDISKFS
446
447 #
448 # LB_VALIDATE_EXT4_SRC_DIR
449 #
450 # Spot check the existence of several source files common to ext4.
451 # Detecting this at configure time allows us to avoid a potential build
452 # failure and provide a useful error message to explain what is wrong.
453 #
454 AC_DEFUN([LB_VALIDATE_EXT4_SRC_DIR], [
455 enable_ldiskfs_build="no"
456 AS_IF([test -n "$EXT4_SRC_DIR"], [
457         enable_ldiskfs_build="yes"
458         LB_CHECK_FILE([$EXT4_SRC_DIR/dir.c], [], [
459                 enable_ldiskfs_build="no"
460                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
461         ])
462         LB_CHECK_FILE([$EXT4_SRC_DIR/file.c], [], [
463                 enable_ldiskfs_build="no"
464                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
465         ])
466         LB_CHECK_FILE([$EXT4_SRC_DIR/inode.c], [], [
467                 enable_ldiskfs_build="no"
468                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
469         ])
470         LB_CHECK_FILE([$EXT4_SRC_DIR/super.c], [], [
471                 enable_ldiskfs_build="no"
472                 AC_MSG_WARN([ext4 must exist for ldiskfs build])
473         ])
474 ])
475
476 AS_IF([test "x$enable_ldiskfs_build" = xno], [
477         enable_ldiskfs="no"
478
479         AC_MSG_WARN([
480
481 Disabling ldiskfs support because complete ext4 source does not exist.
482
483 If you are building using kernel-devel packages and require ldiskfs
484 server support then ensure that the matching kernel-debuginfo-common
485 and kernel-debuginfo-common-<arch> packages are installed.
486 ])
487 ])
488 ]) # LB_VALIDATE_EXT4_SRC_DIR
489
490 #
491 # LB_EXT4_SRC_DIR
492 #
493 # Determine the location of the ext4 source code.  It it required
494 # for several configure tests and to build ldiskfs.
495 #
496 AC_DEFUN([LB_EXT4_SRC_DIR], [
497 AC_MSG_CHECKING([ext4 source directory])
498 # Kernel ext source located with devel headers
499 linux_src=$LINUX
500 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
501         EXT4_SRC_DIR="$linux_src/fs/ext4"
502 ], [
503         # Kernel ext source provided by kernel-debuginfo-common package
504         # that extracted to $LINUX
505         linux_src=$(ls -1d $linux_src/../../debug/*/linux-${LINUXRELEASE%.*}* \
506                 2>/dev/null | tail -1)
507         AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
508                 EXT4_SRC_DIR="$linux_src/fs/ext4"
509         ], [
510                 # Kernel ext source provided by kernel-debuginfo-common package
511                 linux_src=$(ls -1d /usr/src/debug/*/linux-${LINUXRELEASE%.*}* \
512                         2>/dev/null | tail -1)
513                 AS_IF([test -e "$linux_src/fs/ext4/super.c"], [
514                         EXT4_SRC_DIR="$linux_src/fs/ext4"
515                 ], [
516                         EXT4_SRC_DIR=""
517                 ])
518         ])
519 ])
520 AC_MSG_RESULT([$EXT4_SRC_DIR])
521 AC_SUBST(EXT4_SRC_DIR)
522
523 LB_VALIDATE_EXT4_SRC_DIR
524 ]) # LB_EXT4_SRC_DIR
525
526 #
527 # LB_DEFINE_E2FSPROGS_NAMES
528 #
529 # Enable the use of alternate naming of ldiskfs-enabled e2fsprogs package.
530 #
531 AC_DEFUN([LB_DEFINE_E2FSPROGS_NAMES], [
532 AC_MSG_CHECKING([whether to use alternate names for e2fsprogs])
533 AC_ARG_WITH([ldiskfsprogs],
534         AC_HELP_STRING([--with-ldiskfsprogs],
535                 [use alternate names for ldiskfs-enabled e2fsprogs]),
536         [], [withval="no"])
537
538 AS_IF([test "x$withval" = xyes], [
539         AC_MSG_RESULT([enabled])
540         AC_DEFINE(HAVE_LDISKFSPROGS, 1, [enable use of ldiskfsprogs package])
541         E2FSPROGS="ldiskfsprogs"
542         MKE2FS="mkfs.ldiskfs"
543         DEBUGFS="debugfs.ldiskfs"
544         TUNE2FS="tunefs.ldiskfs"
545         E2LABEL="label.ldiskfs"
546         DUMPE2FS="dumpfs.ldiskfs"
547         E2FSCK="fsck.ldiskfs"
548         PFSCK="pfsck.ldiskfs"
549 ], [
550         AC_MSG_RESULT([disabled])
551         E2FSPROGS="e2fsprogs"
552         MKE2FS="mke2fs"
553         DEBUGFS="debugfs"
554         TUNE2FS="tune2fs"
555         E2LABEL="e2label"
556         DUMPE2FS="dumpe2fs"
557         E2FSCK="e2fsck"
558         PFSCK="fsck"
559 ])
560
561 AC_DEFINE_UNQUOTED(E2FSPROGS, "$E2FSPROGS", [name of ldiskfs e2fsprogs package])
562 AC_DEFINE_UNQUOTED(MKE2FS, "$MKE2FS", [name of ldiskfs mkfs program])
563 AC_DEFINE_UNQUOTED(DEBUGFS, "$DEBUGFS", [name of ldiskfs debug program])
564 AC_DEFINE_UNQUOTED(TUNE2FS, "$TUNE2FS", [name of ldiskfs tune program])
565 AC_DEFINE_UNQUOTED(E2LABEL, "$E2LABEL", [name of ldiskfs label program])
566 AC_DEFINE_UNQUOTED(DUMPE2FS,"$DUMPE2FS", [name of ldiskfs dump program])
567 AC_DEFINE_UNQUOTED(E2FSCK, "$E2FSCK", [name of ldiskfs fsck program])
568 AC_DEFINE_UNQUOTED(PFSCK, "$PFSCK", [name of parallel fsck program])
569
570 AC_SUBST([E2FSPROGS], [$E2FSPROGS])
571 AC_SUBST([MKE2FS], [$MKE2FS])
572 AC_SUBST([DEBUGFS], [$DEBUGFS])
573 AC_SUBST([TUNE2FS], [$TUNE2FS])
574 AC_SUBST([E2LABEL], [$E2LABEL])
575 AC_SUBST([DUMPE2FS], [$DUMPE2FS])
576 AC_SUBST([E2FSCK], [$E2FSCK])
577 AC_SUBST([PFSCK], [$PFSCK])
578 ]) # LB_DEFINE_E2FSPROGS_NAMES