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