util-linux: attempt to fix host-util-linux build
[buildroot-gz.git] / package / util-linux / 0002-build-sys-cleanup-UL_NCURSES_CHECK.patch
blob40810b23eae5f76fe5c591a83bfb0845c51c48de
1 From 862326451184bb0fe9c2b2b110fcfc986f9b1734 Mon Sep 17 00:00:00 2001
2 From: Karel Zak <kzak@redhat.com>
3 Date: Tue, 13 Dec 2016 12:41:18 +0100
4 Subject: [PATCH] build-sys: cleanup UL_NCURSES_CHECK
6 * use SUFFIX for upper-case suffix
7 * use AC_CHECK_TOOL() to search for ncurses-config (thanks to Mike Frysinger)
8 * separate checks by AS_IF()
10 Signed-off-by: Karel Zak <kzak@redhat.com>
11 ---
12 m4/ul.m4 | 54 +++++++++++++++++++++++++++++++++---------------------
13 1 file changed, 33 insertions(+), 21 deletions(-)
15 diff --git a/m4/ul.m4 b/m4/ul.m4
16 index 44c721e..f8a0dd7 100644
17 --- a/m4/ul.m4
18 +++ b/m4/ul.m4
19 @@ -438,36 +438,48 @@ dnl The expected <name> is ncurses or ncursesw.
20 dnl
21 AC_DEFUN([UL_NCURSES_CHECK], [
22 m4_define([suffix], $1)
23 - m4_define([suffixup], m4_toupper($1))
24 + m4_define([SUFFIX], m4_toupper($1))
26 - # pkg-config
27 - PKG_CHECK_MODULES(suffixup, [$1], [
28 + # pkg-config (not supported by ncurses upstream by default)
29 + #
30 + PKG_CHECK_MODULES(SUFFIX, [$1], [
31 have_[]suffix=yes
32 - NCURSES_LIBS=${suffixup[]_LIBS}
33 - NCURSES_CFLAGS=${suffixup[]_CFLAGS}
34 + NCURSES_LIBS=${SUFFIX[]_LIBS}
35 + NCURSES_CFLAGS=${SUFFIX[]_CFLAGS}
36 ],[have_[]suffix=no])
38 - # ncurses-config should be everywhere, pkg-config is not supported by default
39 - # by ncurses upstream
40 + # ncurses6-config
42 AS_IF([test "x$have_[]suffix" = xno], [
43 - AC_MSG_CHECKING([$1 config])
44 - if AC_RUN_LOG([suffix[]6-config --version >/dev/null]); then
45 + AC_CHECK_TOOL(SUFFIX[]6_CONFIG, suffix[]6-config)
46 + if AC_RUN_LOG([$SUFFIX[]6_CONFIG --version >/dev/null]); then
47 have_[]suffix=yes
48 - NCURSES_LIBS=`suffix[]6-config --libs`
49 - NCURSES_CFLAGS=`suffix[]6-config --cflags`
50 - AC_MSG_RESULT([(v6) yes])
51 - elif AC_RUN_LOG([suffix[]5-config --version >/dev/null]); then
52 + NCURSES_LIBS=`$SUFFIX[]6_CONFIG --libs`
53 + NCURSES_CFLAGS=`$SUFFIX[]6_CONFIG --cflags`
54 + else
55 + have_[]suffix=no
56 + fi
57 + ])
59 + # ncurses5-config
60 + #
61 + AS_IF([test "x$have_[]suffix" = xno], [
62 + AC_CHECK_TOOL(SUFFIX[]5_CONFIG, suffix[]5-config)
63 + if AC_RUN_LOG([$SUFFIX[]5_CONFIG --version >/dev/null]); then
64 have_[]suffix=yes
65 - NCURSES_LIBS=`suffix[]5-config --libs`
66 - NCURSES_CFLAGS=`suffix[]5-config --cflags`
67 - AC_MSG_RESULT([(v5) yes])
68 + NCURSES_LIBS=`$SUFFIX[]5_CONFIG --libs`
69 + NCURSES_CFLAGS=`$SUFFIX[]5_CONFIG --cflags`
70 else
71 - AC_MSG_RESULT([no])
72 - AS_IF([test "x$have_[]suffix" = xno], [
73 - AC_CHECK_LIB([$1], [initscr], [have_[]suffix=yes], [have_[]suffix=no])
74 - AS_IF([test "x$have_[]suffix" = xyes], [NCURSES_LIBS="-l[]suffix"])
75 - ])
76 + have_[]suffix=no
80 + # classic autoconf way
81 + #
82 + AS_IF([test "x$have_[]suffix" = xno], [
83 + AS_IF([test "x$have_[]suffix" = xno], [
84 + AC_CHECK_LIB([$1], [initscr], [have_[]suffix=yes], [have_[]suffix=no])
85 + AS_IF([test "x$have_[]suffix" = xyes], [NCURSES_LIBS="-l[]suffix"])
86 + ])
87 + ])
89 --
90 2.6.2