From 683388b0fcc8d0cc386e0ab749bcbba7cea18c8f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 14 Feb 2022 06:26:25 -0700 Subject: [PATCH] configure: try -ltinfo as curses linking flag --- ac/curses.m4 | 21 +++++++++++++++++++-- bc/configure | 34 +++++++++++++++++++++++++++++++++- cs/c/configure | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/ac/curses.m4 b/ac/curses.m4 index 25b0f1f99a3..d713c990949 100644 --- a/ac/curses.m4 +++ b/ac/curses.m4 @@ -22,7 +22,7 @@ if test "${skip_curses_check}" = "no" ; then if test "${enable_curses}" = "no" ; then if test "${enable_portable}" = "yes" ; then if test "${curses_portable_link}" != "" ; then - # Try adding portabel link flags + # Try adding portable link flags ORIG_LIBS="$LIBS" ORIG_CPPFLAGS="$CPPFLAGS" ORIG_PREFLAGS="$PREFLAGS" @@ -62,7 +62,24 @@ if test "${skip_curses_check}" = "no" ; then LIBS="$ORIG_LIBS" curses_lib_flag="" fi - fi + fi + if test "${enable_curses}" = "no" ; then + # Try adding -lncurses -ltinfo + ORIG_LIBS="$LIBS" + curses_lib_flag=" -lncurses -ltinfo" + LIBS="$LIBS $curses_lib_flag" + AC_TRY_LINK( + [#include ] + [#include ], +[ int errret; ] +[ setupterm("", 0, &errret);] + return 0; + , enable_curses=yes, enable_curses=no) + if test "${enable_curses}" = "no" ; then + LIBS="$ORIG_LIBS" + curses_lib_flag="" + fi + fi fi fi fi diff --git a/bc/configure b/bc/configure index 543fab87411..132d2dedd6c 100755 --- a/bc/configure +++ b/bc/configure @@ -5991,7 +5991,7 @@ rm -f core conftest.err conftest.$ac_objext \ if test "${enable_curses}" = "no" ; then if test "${enable_portable}" = "yes" ; then if test "${curses_portable_link}" != "" ; then - # Try adding portabel link flags + # Try adding portable link flags ORIG_LIBS="$LIBS" ORIG_CPPFLAGS="$CPPFLAGS" ORIG_PREFLAGS="$PREFLAGS" @@ -6055,6 +6055,38 @@ if ac_fn_c_try_link "$LINENO"; then : else enable_curses=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "${enable_curses}" = "no" ; then + LIBS="$ORIG_LIBS" + curses_lib_flag="" + fi + fi + if test "${enable_curses}" = "no" ; then + # Try adding -lncurses -ltinfo + ORIG_LIBS="$LIBS" + curses_lib_flag=" -lncurses -ltinfo" + LIBS="$LIBS $curses_lib_flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main () +{ + int errret; + setupterm("", 0, &errret); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + enable_curses=yes +else + enable_curses=no +fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "${enable_curses}" = "no" ; then diff --git a/cs/c/configure b/cs/c/configure index db2132b7f4d..2ec78292f56 100755 --- a/cs/c/configure +++ b/cs/c/configure @@ -5635,7 +5635,7 @@ rm -f core conftest.err conftest.$ac_objext \ if test "${enable_curses}" = "no" ; then if test "${enable_portable}" = "yes" ; then if test "${curses_portable_link}" != "" ; then - # Try adding portabel link flags + # Try adding portable link flags ORIG_LIBS="$LIBS" ORIG_CPPFLAGS="$CPPFLAGS" ORIG_PREFLAGS="$PREFLAGS" @@ -5699,6 +5699,38 @@ if ac_fn_c_try_link "$LINENO"; then : else enable_curses=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "${enable_curses}" = "no" ; then + LIBS="$ORIG_LIBS" + curses_lib_flag="" + fi + fi + if test "${enable_curses}" = "no" ; then + # Try adding -lncurses -ltinfo + ORIG_LIBS="$LIBS" + curses_lib_flag=" -lncurses -ltinfo" + LIBS="$LIBS $curses_lib_flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include +int +main () +{ + int errret; + setupterm("", 0, &errret); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + enable_curses=yes +else + enable_curses=no +fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "${enable_curses}" = "no" ; then