From 1324d454916f6036df901a644c44a2e6af65989c Mon Sep 17 00:00:00 2001 From: Justin Lecher <jlec@gentoo.org> Date: Thu, 7 Mar 2013 13:42:51 +0100 Subject: [PATCH] Use pkg-config to detect ncurses Ncurses provides a pkg-config module which could be used here. If not available we fall back to the old detection heuristic. Signed-off-by: Justin Lecher <jlec@gentoo.org> --- configure.ac | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 16e57d0..7937229 100644 --- a/configure.ac +++ b/configure.ac @@ -36,16 +36,20 @@ AC_ARG_WITH([ncursesw], AC_HELP_STRING([--with-ncursesw], [compile/link with wide-char ncurses library @<:@default@:>@]), [ncurses=ncursesw]) if test "$ncurses" = "auto" -o "$ncurses" = "ncursesw"; then - AC_CHECK_LIB([ncursesw], - [initscr], - [LIBS="$LIBS -lncursesw"; ncurses=ncursesw], - [ncurses=ncurses]) + PKG_CHECK_MODULES([NCURSES], [ncursesw], [LIBS="$LIBS $NCURSES_LIBS"; ncurses=ncursesw], + [AC_CHECK_LIB([ncursesw], + [initscr], + [LIBS="$LIBS -lncursesw"; ncurses=ncursesw], + [ncurses=ncurses]) + ]) fi if test "$ncurses" = "ncurses"; then - AC_CHECK_LIB([ncurses], - [initscr], - [LIBS="$LIBS -lncurses"], - [AC_MSG_ERROR(ncurses library is required)]) + PKG_CHECK_MODULES([NCURSES], [ncurses], [LIBS="$LIBS $NCURSES_LIBS"], + [AC_CHECK_LIB([ncurses], + [initscr], + [LIBS="$LIBS -lncurses"], + [AC_MSG_ERROR(ncurses library is required)]) + ]) fi -- GitLab