summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorKarel Zak2016-12-12 15:23:53 +0100
committerKarel Zak2016-12-12 15:23:53 +0100
commit3f7429fd2d539c7f948f72bd829404b55ac19d9f (patch)
treef98e8e410c3b391dd2dc2189f56bb8ea4a6887e5 /m4
parentMerge branch 'build-fixes' of https://github.com/rudimeier/util-linux (diff)
downloadkernel-qcow2-util-linux-3f7429fd2d539c7f948f72bd829404b55ac19d9f.tar.gz
kernel-qcow2-util-linux-3f7429fd2d539c7f948f72bd829404b55ac19d9f.tar.xz
kernel-qcow2-util-linux-3f7429fd2d539c7f948f72bd829404b55ac19d9f.zip
build-sys: prefer pkg-config for ncurses
and use ncurses{5,6}-config as fallback only. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'm4')
-rw-r--r--m4/ul.m448
1 files changed, 28 insertions, 20 deletions
diff --git a/m4/ul.m4 b/m4/ul.m4
index c569c3651..44c721ec3 100644
--- a/m4/ul.m4
+++ b/m4/ul.m4
@@ -438,28 +438,36 @@ dnl The expected <name> is ncurses or ncursesw.
dnl
AC_DEFUN([UL_NCURSES_CHECK], [
m4_define([suffix], $1)
+ m4_define([suffixup], m4_toupper($1))
+
+ # pkg-config
+ PKG_CHECK_MODULES(suffixup, [$1], [
+ have_[]suffix=yes
+ NCURSES_LIBS=${suffixup[]_LIBS}
+ NCURSES_CFLAGS=${suffixup[]_CFLAGS}
+ ],[have_[]suffix=no])
# ncurses-config should be everywhere, pkg-config is not supported by default
# by ncurses upstream
#
- AC_MSG_CHECKING([$1])
- if AC_RUN_LOG([suffix[]6-config --version >/dev/null]); then
- have_[]suffix=yes
- NCURSES_LIBS=`suffix[]6-config --libs`
- NCURSES_CFLAGS=`suffix[]6-config --cflags`
- AC_MSG_RESULT([(v6) yes])
- elif AC_RUN_LOG([suffix[]5-config --version >/dev/null]); then
- have_[]suffix=yes
- NCURSES_LIBS=`suffix[]5-config --libs`
- NCURSES_CFLAGS=`suffix[]5-config --cflags`
- AC_MSG_RESULT([(v5) yes])
- else
- AC_MSG_RESULT([no])
-
- # fallback
- AC_CHECK_LIB([$1], [initscr], [have_[]suffix=yes], [have_[]suffix=no])
- AS_IF([test "x$have_[]suffix" = xyes], [
- NCURSES_LIBS="-l[]suffix"
- ])
- fi
+ AS_IF([test "x$have_[]suffix" = xno], [
+ AC_MSG_CHECKING([$1 config])
+ if AC_RUN_LOG([suffix[]6-config --version >/dev/null]); then
+ have_[]suffix=yes
+ NCURSES_LIBS=`suffix[]6-config --libs`
+ NCURSES_CFLAGS=`suffix[]6-config --cflags`
+ AC_MSG_RESULT([(v6) yes])
+ elif AC_RUN_LOG([suffix[]5-config --version >/dev/null]); then
+ have_[]suffix=yes
+ NCURSES_LIBS=`suffix[]5-config --libs`
+ NCURSES_CFLAGS=`suffix[]5-config --cflags`
+ AC_MSG_RESULT([(v5) yes])
+ else
+ AC_MSG_RESULT([no])
+ AS_IF([test "x$have_[]suffix" = xno], [
+ AC_CHECK_LIB([$1], [initscr], [have_[]suffix=yes], [have_[]suffix=no])
+ AS_IF([test "x$have_[]suffix" = xyes], [NCURSES_LIBS="-l[]suffix"])
+ ])
+ fi
+ ])
])