commit 5ec89855b2a36224b10177455d28f8cf1308745d parent 7c345be323b418d66ff6bf1885b920cff85db060 Author: hhvn <dev@hhvn.uk> Date: Fri, 3 Dec 2021 11:47:20 +0000 configure: check if linking with libtinfow is alright Diffstat:
M | configure | | | 23 | ++++++++++++++++++++--- |
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/configure b/configure @@ -25,7 +25,24 @@ cat > test.c <<- EOF EOF ${CC} -ltinfow -o test test.c >/dev/null 2>/dev/null && { printf '%s\n' "yes" - cat >> config.mk <<- EOF - LDFLAGS += -ltinfow + hastinfow=1 +} || { + printf '%s\n' "no" + hastinfow=0 +} + +[ $hastinfow -eq 1 ] && { + printf '%s' "should link with libtinfow... " + cat > test.c <<- EOF + #include <ncurses.h> + int main(void) { initscr(); endwin(); return 0; } EOF -} || printf '%s\n' "no" + if ${CC} -ltinfow -o test test.c >/dev/null 2>/dev/null && ./test >/dev/null 2>/dev/null; then + printf '%s\n' "yes" + cat >> config.mk <<- EOF + LDFLAGS += -ltinfow + EOF + else + printf '%s\n' "no" + fi +}