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