From 1a1631f3db42e2d9a7022cdd8d697a65b551ce24 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 10 Aug 2020 12:16:18 +0100 Subject: curses: ncurses may define curs_set outside of curses This is a very poor design decision that sadly we need to work around. There is no technical reason why all curses functions are not defined in libcurses. Thanks to Lars Wendler for the initial patch. --- configure | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/configure b/configure index bf44bf0..0e39ea7 100755 --- a/configure +++ b/configure @@ -462,11 +462,39 @@ int main(void) { EOF if $XCC _curses.c -o _curses -lcurses 2>&3; then LIB_CURSES=-lcurses + echo "$LIB_CURSES" fi rm -f _curses.c _curses fi + +# ncurses may have curs_set in libtinfo and not libcurses. +# This is a very poor design as other curses implementations +# do not have this limitation. +if [ -n "$LIB_CURSES" ]; then + printf "Testing for curs_set in $LIB_CURSES ... " + cat <_curses.c +#include +int main(void) { + curs_set(1); + return 0; +} +EOF + if $XCC _curses.c -o _curses $LIB_CURSES 2>&3; then + echo "yes" + else + if $XCC _curses.c -o _curses $LIB_CURSES -ltinfo 2>&3; then + echo "no (libtinfo)" + LIB_CURSES="$LIB_CURSES -ltinfo" + else + echo "no and not found" + [ "$WITH_CURSES" = yes ] && exit 1 + LIB_CURSES= + fi + fi + rm -f _curses.c _curses +fi + if [ -n "$LIB_CURSES" ]; then - echo "$LIB_CURSES" echo "LIB_CURSES= $LIB_CURSES" >>$CONFIG_MK UI="dhcpcd-curses${UI:+ }$UI" -- cgit v1.2.3