From 0176793f19a368c3786c231042b87c3a2ef3de2b Mon Sep 17 00:00:00 2001 From: Alon Bar-Lev Date: Sun, 3 Feb 2013 00:40:57 +0200 Subject: [PATCH] build: detect ncurses using pkg-config --- configure.ac | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index a551913..a84680f 100644 --- a/configure.ac +++ b/configure.ac @@ -10,22 +10,30 @@ AC_CONFIG_HEADERS([config.h]) # Checks for programs. AC_PROG_CC +PKG_PROG_PKG_CONFIG # Checks for libraries. -# Check for ncurses. If we find the library then we check to see if it's -# in a ncurses directory inside the include directory. -# The assumption is made in the source code that panel.h will be in the same place -AC_CHECK_LIB([ncurses], [delscreen], [ - LIBS="-lncurses $LIBS" - AC_CHECK_HEADERS(ncurses.h,, [ - AC_CHECK_HEADERS(ncurses/ncurses.h, [ - AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir]) - ], [AC_MSG_ERROR([ncurses headers not found])]) - ]) - ], [AC_MSG_ERROR([ncurses development library not found])] +PKG_CHECK_MODULES( + [PANEL], + [panel], + [ + CFLAGS="${CFLAGS} ${PANEL_CFLAGS}" + LIBS="${LIBS} ${PANEL_LIBS}" + ], + [ + AC_CHECK_LIB([ncurses], [delscreen], [ + LIBS="-lncurses $LIBS" + AC_CHECK_HEADERS(ncurses.h,, [ + AC_CHECK_HEADERS(ncurses/ncurses.h, [ + AC_DEFINE([NCURSES_IN_SUBDIR], [ncurses/], [Look for ncurses headers in subdir]) + ], [AC_MSG_ERROR([ncurses headers not found])]) + ]) + ], [AC_MSG_ERROR([ncurses development library not found])] + ) + AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])]) + ] ) -AC_CHECK_LIB([panel], [main], ,[AC_MSG_ERROR([ncurses panel library not found])]) AC_CHECK_LIB([parted], [ped_device_probe_all], ,[AC_MSG_ERROR([parted development library not found])]) AC_CHECK_LIB([pthread], [main], ,[AC_MSG_ERROR([pthread development library not found])]) -- 1.7.12.4