configure.in: look for ncurses pkg-config first

Newer ncurses installs pkg-config files, and these are much easier
to manage when cross-compiling, so default to searching for those.
If they can't be found, we fall back to the existing xxx-config.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Mike Frysinger 2012-04-18 10:25:54 -04:00 committed by Takashi Iwai
parent 8824d0824d
commit 3a25a31285

View file

@ -29,6 +29,7 @@ AC_PROG_INSTALL
AC_PROG_MKDIR_P AC_PROG_MKDIR_P
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_SED AC_PROG_SED
PKG_PROG_PKG_CONFIG
AM_PATH_ALSA(1.0.24) AM_PATH_ALSA(1.0.24)
AC_CHECK_FUNC([snd_ctl_elem_add_enumerated], AC_CHECK_FUNC([snd_ctl_elem_add_enumerated],
, [AC_ERROR([No user enum control support in alsa-lib])]) , [AC_ERROR([No user enum control support in alsa-lib])])
@ -130,34 +131,52 @@ if test x$alsamixer = xtrue; then
NCURSESLIBSUFFIX="" NCURSESLIBSUFFIX=""
CURSES_NLS="no" CURSES_NLS="no"
if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then if test "$curseslib" = "ncursesw" -o \( "$curseslib" = "auto" -a "$USE_NLS" = "yes" \); then
AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes]) dnl First try out pkg-config, then fall back to old config scripts.
if test "$ncursesw5_config" = "yes"; then PKG_CHECK_MODULES([NCURSESW], [ncursesw], [
CURSESINC="<ncurses.h>" CURSESINC="<ncurses.h>"
CURSESLIB=`ncursesw5-config --libs` CURSESLIB="${NCURSESW_LIBS}"
CURSESLIBDIR=`ncursesw5-config --libdir` CURSESLIBDIR=
CURSES_CFLAGS=`ncursesw5-config --cflags` CURSES_CFLAGS="${NCURSESW_CFLAGS}"
curseslib="ncursesw" curseslib="ncursesw"
else ], [
AC_CHECK_LIB(ncursesw, initscr, AC_CHECK_PROG([ncursesw5_config], [ncursesw5-config], [yes])
[ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"]) if test "$ncursesw5_config" = "yes"; then
fi CURSESINC="<ncurses.h>"
CURSESLIB=`ncursesw5-config --libs`
CURSESLIBDIR=`ncursesw5-config --libdir`
CURSES_CFLAGS=`ncursesw5-config --cflags`
curseslib="ncursesw"
else
AC_CHECK_LIB(ncursesw, initscr,
[ CURSESINC='<ncurses.h>'; CURSESLIB='-lncursesw'; curseslib="ncursesw"])
fi
])
if test -n "$CURSESINC"; then if test -n "$CURSESINC"; then
NCURSESLIBSUFFIX="w" NCURSESLIBSUFFIX="w"
CURSES_NLS="yes" CURSES_NLS="yes"
fi fi
fi fi
if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then if test "$curseslib" = "ncurses" -o "$curseslib" = "auto"; then
AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes]) dnl First try out pkg-config, then fall back to old config scripts.
if test "$ncurses5_config" = "yes"; then PKG_CHECK_MODULES([NCURSES], [ncurses], [
CURSESINC="<ncurses.h>" CURSESINC="<ncurses.h>"
CURSESLIB=`ncurses5-config --libs` CURSESLIB="${NCURSES_LIBS}"
CURSESLIBDIR=`ncurses5-config --libdir` CURSESLIBDIR=
CURSES_CFLAGS=`ncurses5-config --cflags` CURSES_CFLAGS="${NCURSES_CFLAGS}"
curseslib="ncurses" curseslib="ncurses"
else ], [
AC_CHECK_LIB(ncurses, initscr, AC_CHECK_PROG([ncurses5_config], [ncurses5-config], [yes])
[ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"]) if test "$ncurses5_config" = "yes"; then
fi CURSESINC="<ncurses.h>"
CURSESLIB=`ncurses5-config --libs`
CURSESLIBDIR=`ncurses5-config --libdir`
CURSES_CFLAGS=`ncurses5-config --cflags`
curseslib="ncurses"
else
AC_CHECK_LIB(ncurses, initscr,
[ CURSESINC='<ncurses.h>'; CURSESLIB='-lncurses'; curseslib="ncurses"])
fi
])
fi fi
if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then if test "$curseslib" = "curses" -o "$curseslib" = "auto"; then
AC_CHECK_LIB(curses, initscr, AC_CHECK_LIB(curses, initscr,
@ -287,7 +306,6 @@ SAVE_UTIL_VERSION
AC_SUBST(LIBRT) AC_SUBST(LIBRT)
dnl Check for systemd dnl Check for systemd
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir], AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])