From 661da1d08d4fafef495cb5f71cb271a1e55bb153 Mon Sep 17 00:00:00 2001 From: Marco Sirabella Date: Thu, 16 Sep 2021 21:13:57 -0700 Subject: [PATCH] Use AX_WITH_CURSES for curses library discovery Properly discovers libtinfow for customized systems (eg Gentoo) while offloading search handling to autoconf builtins. Fixes #250 Signed-off-by: Marco Sirabella Signed-off-by: Lukas Fleischer --- configure.ac | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 1f6ec61a..74054504 100644 --- a/configure.ac +++ b/configure.ac @@ -29,27 +29,12 @@ AC_CHECK_HEADERS([ctype.h getopt.h locale.h math.h signal.h stdio.h stdlib.h \ #------------------------------------------------------------------------------- # Checks for system libs #------------------------------------------------------------------------------- -AC_CHECK_FUNC(initscr,, -[ - available_ncurses="none" - for lib in ncursesw ncurses - do - AC_CHECK_LIB($lib, initscr, - [available_ncurses="$lib"; break]) - done - if test "$available_ncurses" = none; then - AC_MSG_ERROR(Either ncurses or ncursesw library is required to build calcurse!) - elif test "$available_ncurses" = ncursesw; then - AC_CHECK_HEADERS([ncursesw/ncurses.h],, - [AC_CHECK_HEADERS([ncurses.h],, - AC_MSG_ERROR([Missing ncursesw header file]))]) - else - AC_CHECK_HEADERS([ncurses/ncurses.h],, - [AC_CHECK_HEADERS([ncurses.h],, - AC_MSG_ERROR([Missing ncurses header file]))]) - fi - LIBS="$LIBS -l$available_ncurses" -]) +AX_WITH_CURSES +if test "x$ax_cv_ncursesw" != xyes && test "x$ax_cv_ncurses" != xyes; then + AC_MSG_ERROR(Either ncurses or ncursesw library is required to build calcurse!) +fi + +LIBS="$LIBS $CURSES_LIBS" AC_CHECK_HEADERS([pthread.h], [ AC_CHECK_LIB(pthread, pthread_create, [