diff options
author | Clemens Gruber <clemens.gruber@pqgruber.com> | 2017-11-06 16:26:06 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2017-11-16 18:03:27 +0100 |
commit | b8949549ff98b54cd390901aba0ede18b1223f10 (patch) | |
tree | 0ef933f9eb4837ff83eb75dd4e329fa91fd3ef0d /configure.ac | |
parent | 18734536e8af28c10debc93d4cf45913cd1d3d69 (diff) | |
download | ptxdist-b8949549ff98b54cd390901aba0ede18b1223f10.tar.gz ptxdist-b8949549ff98b54cd390901aba0ede18b1223f10.tar.xz |
ptxdist: Use pkg-config for ncurses detection
Use pkg-config to detect ncurses instead of AC_SEARCH_LIBS.
We still have a --with-ncurses option to prepend the search path of the
ncurses headers. The CFLAGS from pkg-config are always appended, as they
not only contain -I but also -D flags.
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 5348db8a2..338fb6089 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,11 @@ AC_PROG_CC AC_PROG_CXX dnl +dnl Check for pkg-config +dnl +PKG_PROG_PKG_CONFIG + +dnl dnl Check header files, mostly for lxdialog & kconfig dnl AC_HEADER_STDC @@ -41,28 +46,36 @@ AC_SEARCH_LIBS(regcomp, [regex gnuregex],, CONF_LIBS=${LIBS} AC_SUBST(CONF_LIBS) -AC_SEARCH_LIBS(mvaddch, [curses ncurses pdcurses], [CURSES_LIB=$ac_lib], - [AC_MSG_ERROR([curses development library not found, please install libncurses-dev])]) -MCONF_LIBS=${LIBS} +PKG_CHECK_MODULES([NCURSES], [ncurses],, [ + AC_MSG_ERROR([Cannot find ncurses library.])]) +MCONF_LIBS="${LIBS} ${NCURSES_LIBS}" AC_SUBST(MCONF_LIBS) +PKG_CHECK_MODULES([NCURSES_PANEL], [panel],, + AC_MSG_ERROR([Cannot find ncurses panel library.])]) +PKG_CHECK_MODULES([NCURSES_MENU], [menu],, + AC_MSG_ERROR([Cannot find ncurses menu library.])]) +NCONF_LIBS="${LIBS} ${NCURSES_LIBS} ${NCURSES_PANEL_LIBS} ${NCURSES_MENU_LIBS}" +AC_SUBST(NCONF_LIBS) + AC_CHECK_HEADERS( - [curses.h ncurses.h ncurses/curses.h ncurses/ncurses.h pdcurses.h pdcurses/curses.h pdcurses/pdcurses.h], + [curses.h ncurses.h ncurses/curses.h ncurses/ncurses.h], [CURSES_LOC="<$ac_header>";found_curses_headers=yes; break;]) AS_IF([test "x$CURSES_LOC" = "x"], - [AC_MSG_ERROR([curses headers not found])]) + [AC_MSG_ERROR([ncurses headers not found])]) AC_SUBST(CURSES_LOC) +CPPFLAGS="${NCURSES_CFLAGS}" AC_ARG_WITH(ncurses, AS_HELP_STRING([--with-ncurses],[Include path to the ncurses headers]), [ if test "x$withval" != "xyes"; then - CPPFLAGS="-I$withval" - AC_SUBST(CPPFLAGS) + CPPFLAGS="-I$withval ${CPPFLAGS}" fi with_ncurses=yes ],[ with_ncurses=auto ]) +AC_SUBST(CPPFLAGS) AC_CHECK_HEADER( [menu.h], |