From caed2e42c7257a386ed433a8bccba028cc9437c8 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 24 Dec 2024 13:57:38 +0300 Subject: added AX_WITH_CURSES for more robust ncurses checks * Turns out that on SunOS/OmniOS the ncurses port does not ship with a ncursesw pkg-config file, but the ncurses file is for a version, that does contain widechar support as well. * Instead of adding yet another recursive PKG_CHECK_MODULES() call, we now use the AX_WITH_CURSES() macro, which is probably more robust. This should at least fix ./configure on OmniOS. * It also adds a number of feature C macros, that could be useful to check in the future. * At the moment, we strive to support all X/Open-compatible Curses libraries, but both enhanced and color functions are required. Therefore plain SVr4 Curses is not supported. * source: https://www.gnu.org/software/autoconf-archive/ax_with_curses.html --- configure.ac | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index c4f55ac..ad4d805 100644 --- a/configure.ac +++ b/configure.ac @@ -246,20 +246,16 @@ case $INTERFACE in *curses*) case $INTERFACE in ncurses | netbsd-curses) - # The widechar version of ncurses is necessary for Unicode - # support even when not using widechar APIs. - PKG_CHECK_MODULES(NCURSES, [ncursesw], [ - CFLAGS="$CFLAGS $NCURSES_CFLAGS" - CXXFLAGS="$CXXFLAGS $NCURSES_CFLAGS" - LIBS="$LIBS $NCURSES_LIBS" - ], [ - # This should be sufficient to detect non-widechar - # ncurses versions as well, although we could also check - # for an "ncurses" package. - AC_CHECK_LIB(ncurses, initscr, , [ - AC_MSG_ERROR([libncurses missing!]) - ]) - ]) + # This gives precendence to the widechar version of ncurses, + # which is necessary for Unicode support even when not using widechar APIs. + AX_WITH_CURSES + if [[ x$ax_cv_curses_enhanced != xyes -o x$ax_cv_curses_color != xyes ]]; then + AC_MSG_ERROR([X/Open curses compatible library not found!]) + fi + CFLAGS="$CFLAGS $CURSES_CFLAGS" + CXXFLAGS="$CXXFLAGS $CURSES_CFLAGS" + LIBS="$LIBS $CURSES_LIBS" + AC_CHECK_FUNCS([tigetstr]) if [[ x$INTERFACE = xnetbsd-curses ]]; then @@ -348,6 +344,8 @@ case $INTERFACE in ;; esac + # AX_WITH_CURSES defines per-header symbols, but we currently + # demand that CPPFLAGS are set up such, that we can find curses.h anyway. AC_CHECK_HEADERS([curses.h], , [ AC_MSG_ERROR([Curses header missing!]) ]) -- cgit v1.2.3