From: Philippe Blain Date: Sun, 19 Feb 2023 22:37:35 +0000 (-0500) Subject: gdb: add --with-curses to --configuration output X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c9066e322f46faf9d753be6ff3e6a09ae668f86;p=binutils-gdb.git gdb: add --with-curses to --configuration output 'gdb --configuration' does not mention if GDB was built with curses. Since b5075fb68d4 (Rename to allow_tui_tests, 2023-01-08) it does show --enable-tui (or --disable-tui), but one might want to know if GDB was built with curses independently of the availability of the TUI. Since configure.ac uses AC_SEARCH_LIBS to check for the curses library, we do not get an automatically defined HAVE_LIBCURSES symbol in config.in. We do have symbols defined by AC_CHECK_HEADERS (HAVE_CURSES_H, etc.) but it would be cumbersome to use those in print_gdb_configuration because we would have to check for all 6 symbols corresponding the 6 headers listed. This would also increase the maintenance burden if support for other variations of curses are added. Instead, define 'HAVE_LIBCURSES' ourselves by adding an 'action-if-found' argument to AC_SEARCH_LIBS, and use it in print_gdb_configuration. While at it, remove the condition on 'ac_cv_search_waddstr' and set 'curses_found' directly in 'action-if-found'. Change-Id: Id90e3d73990e169cee51bcc3e1d52072cfacd5b8 Approved-By: Simon Marchi --- diff --git a/gdb/config.in b/gdb/config.in index a6027847444..a7da88b92d7 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -238,6 +238,9 @@ /* Define if libbacktrace is being used. */ #undef HAVE_LIBBACKTRACE +/* Define to 1 if curses is enabled. */ +#undef HAVE_LIBCURSES + /* Define to 1 if debuginfod is enabled. */ #undef HAVE_LIBDEBUGINFOD diff --git a/gdb/configure b/gdb/configure index cfdaf59a7b7..6bce5c70566 100755 --- a/gdb/configure +++ b/gdb/configure @@ -20624,13 +20624,13 @@ $as_echo "$ac_cv_search_waddstr" >&6; } ac_res=$ac_cv_search_waddstr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + curses_found=yes -fi +$as_echo "#define HAVE_LIBCURSES 1" >>confdefs.h - if test "$ac_cv_search_waddstr" != no; then - curses_found=yes - fi +fi + fi # Check whether we should enable the TUI, but only do so if we really diff --git a/gdb/configure.ac b/gdb/configure.ac index 734589856a1..14012a9e868 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -564,11 +564,11 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. - AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses]) - - if test "$ac_cv_search_waddstr" != no; then - curses_found=yes - fi + AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses], + [curses_found=yes + AC_DEFINE([HAVE_LIBCURSES], [1], + [Define to 1 if curses is enabled.]) + ]) fi # Check whether we should enable the TUI, but only do so if we really diff --git a/gdb/top.c b/gdb/top.c index 1b189d7c5ab..d71d8495622 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1619,6 +1619,16 @@ This GDB was configured as follows:\n\ ")); #endif +#if HAVE_LIBCURSES + gdb_printf (stream, _("\ + --with-curses\n\ +")); +#else + gdb_printf (stream, _("\ + --without-curses\n\ +")); +#endif + #if HAVE_GUILE gdb_printf (stream, _("\ --with-guile\n\