Building a testdir for module 'termcap' on a machine with neither libtermcap nor libncurses installed, I get a link error:
gcc -Wno-error -g -O2 -L/home/bruno/inst-x86_64-64/lib -o test-termcap test-termcap.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a libtests.a -ltermcap -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm -lm /usr/bin/ld: cannot find -ltermcap: No such file or directory collect2: error: ld returned 1 exit status This patch fixes it. 2022-05-14 Bruno Haible <[email protected]> termcap: Fix link error when no suitable library is found. * m4/termcap.m4 (gl_TERMCAP_BODY): If no suitable library is found, set LIBTERMCAP and LTLIBTERMCAP to empty. diff --git a/m4/termcap.m4 b/m4/termcap.m4 index 4817b5343c..89765a5352 100644 --- a/m4/termcap.m4 +++ b/m4/termcap.m4 @@ -1,4 +1,4 @@ -# termcap.m4 serial 8 +# termcap.m4 serial 9 dnl Copyright (C) 2000-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -120,6 +120,11 @@ AC_DEFUN([gl_TERMCAP_BODY], ;; libtermcap) ;; + "not found"*) + LIBTERMCAP= + LTLIBTERMCAP= + INCTERMCAP= + ;; esac case "$gl_cv_termcap" in libc | libncurses | libtermcap)
