ath25: Replace fall through comment with fallthrough;
[openwrt/staging/ldir.git] / package / utils / f2fs-tools / patches / 100-configure.ac-fix-AC_ARG_WITH.patch
1 From 9af8ee5baceab59d46154c96da62b52935f363fe Mon Sep 17 00:00:00 2001
2 From: Nick Hainke <vincent@systemli.org>
3 Date: Mon, 27 Jun 2022 20:43:11 +0200
4 Subject: [PATCH] configure.ac: fix AC_ARG_WITH
5
6 In the new version the configuration no longer respects the
7 --without/--with blkid/selinux parameters. Add the tests for
8 "with_blkid" and "with_selinux" back to configure.ac as described
9 in the manual.
10
11 Link: https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/External-Software.html
12
13 Fixes: c48335416a09 ("configure.ac: Enable cross-compilation")
14
15 Signed-off-by: Nick Hainke <vincent@systemli.org>
16 ---
17 configure.ac | 44 ++++++++++++++++++++++++++++++--------------
18 1 file changed, 30 insertions(+), 14 deletions(-)
19
20 --- a/configure.ac
21 +++ b/configure.ac
22 @@ -39,12 +39,16 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign
23
24 # Test configure options.
25 AC_ARG_WITH([selinux],
26 - AS_HELP_STRING([--without-selinux],
27 - [Ignore presence of libselinux and disable selinux support]))
28 + [AS_HELP_STRING([--without-selinux],
29 + [Ignore presence of libselinux and disable selinux support])],
30 + [],
31 + [with_selinux=check])
32
33 AC_ARG_WITH([blkid],
34 - AS_HELP_STRING([--without-blkid],
35 - [Ignore presence of libblkid and disable blkid support]))
36 + [AS_HELP_STRING([--without-blkid],
37 + [Ignore presence of libblkid and disable blkid support])],
38 + [],
39 + [with_blkid=check])
40
41 # Checks for programs.
42 AC_PROG_CC
43 @@ -55,11 +59,17 @@ AC_PATH_PROG([LDCONFIG], [ldconfig],
44 [$PATH:/sbin])
45
46 # Checks for libraries.
47 -AC_CHECK_LIB([blkid], [blkid_probe_all],
48 - [AC_SUBST([libblkid_LIBS], ["-lblkid"])
49 - AC_DEFINE([HAVE_LIBBLKID], [1],
50 - [Define if you have libblkid])
51 - ], [], [])
52 +AS_IF([test "x$with_blkid" != xno],
53 + [AC_CHECK_LIB([blkid], [blkid_probe_all],
54 + [AC_SUBST([libblkid_LIBS], ["-lblkid"])
55 + AC_DEFINE([HAVE_LIBBLKID], [1],
56 + [Define if you have libblkid])
57 + ],
58 + [if test "x$with_blkid" != xcheck; then
59 + AC_MSG_FAILURE(
60 + [--with-blkid was given, but test for blkid failed])
61 + fi
62 + ], -lblkid)])
63
64 AC_CHECK_LIB([lzo2], [main],
65 [AC_SUBST([liblzo2_LIBS], ["-llzo2"])
66 @@ -73,11 +83,17 @@ AC_CHECK_LIB([lz4], [main],
67 [Define if you have liblz4])
68 ], [], [])
69
70 -AC_CHECK_LIB([selinux], [getcon],
71 - [AC_SUBST([libselinux_LIBS], ["-lselinux"])
72 - AC_DEFINE([HAVE_LIBSELINUX], [1],
73 - [Define if you have libselinux])
74 - ], [], [])
75 +AS_IF([test "x$with_selinux" != xno],
76 + [AC_CHECK_LIB([selinux], [getcon],
77 + [AC_SUBST([libselinux_LIBS], ["-lselinux"])
78 + AC_DEFINE([HAVE_LIBSELINUX], [1],
79 + [Define if you have libselinux])
80 + ],
81 + [if test "x$with_selinux" != xcheck; then
82 + AC_MSG_FAILURE(
83 + [--with-selinux was given, but test for selinux failed])
84 + fi
85 + ], -lselinux)])
86
87 AC_CHECK_LIB([uuid], [uuid_clear],
88 [AC_SUBST([libuuid_LIBS], ["-luuid"])