summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-08-10 12:16:18 +0100
committerRoy Marples <roy@marples.name>2020-08-10 12:16:18 +0100
commit1a1631f3db42e2d9a7022cdd8d697a65b551ce24 (patch)
treebe3d3249b17f7cb736b651dd21acfbda6a246a8b
parent216835ca56ab1d889dacc336e7f5b1d72e924c21 (diff)
downloaddhcpcd-ui-1a1631f3db42e2d9a7022cdd8d697a65b551ce24.tar.xz
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 <polynomial-c@gentoo.org> for the initial patch.
-rwxr-xr-xconfigure30
1 files changed, 29 insertions, 1 deletions
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 <<EOF >_curses.c
+#include <curses.h>
+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"