From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id 130EF3858004 for ; Wed, 15 Feb 2023 18:42:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 130EF3858004 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-x830.google.com with SMTP id cr22so22785533qtb.10 for ; Wed, 15 Feb 2023 10:42:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:message-id:content-transfer-encoding:mime-version:subject:date :from:from:to:cc:subject:date:message-id:reply-to; bh=C30X4sLZdAnmyysMXX/qXi8Db1zNMHfZrYNhU00qJFY=; b=VUc9nfMPNrbJyRa1rG5sgLjX/vQaX8rdyO0arj2G6IIb8qQwJMijSD1xGOI+Ml14Fv e74SldW4EMcuQeBrhXZcWnOmCvYEuA2q9a26k5GyVzr1H4mAzETaJvjBqh8RDd43v+/w KsduxciQko6U1X4krFXNBxRKdEJS9Ib9HicswXoiwPKu0+g9dIwVydRgBqP0tRwrr1gq V22ZtOV2ou8xU6F8Sk9KXCrsHsuMV5oRzkLbKZWRMsMtDEtmw9c9cGnEU1OvS4/leL8p aJkU2ZHZsaOmyTm97NnP2op4KBQEeZUq2SDCTud97u4UoZ+bD6occVPuP4NlBUwvpJ2p 5goA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:message-id:content-transfer-encoding:mime-version:subject:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=C30X4sLZdAnmyysMXX/qXi8Db1zNMHfZrYNhU00qJFY=; b=ZBEmiUbZKdgSaQQq4Wq9n2LHwWd03pWroVpwiF0LTpT8lWit3yvuZXVxf/aOm8T/pH IcNLbH4alJb6HAxaIW4s81XHz+9LJ7JvU/1qI1QcbOHRG5eZCs1u4a/3pSW3FDugmE5s yMA8D7yGiuuPuGxi3f0nlzYch4Rf2jg3UwzRueIU5Y6tEGdJ63Z8oOyLZgGM8Yl0J45z Y+HMKbXoRMBy2i64V9X3nirpFJVZNh0ItOs09l3J3k4UluyudMVKljlvRo66OhcJNnw3 jSSQh24SuoCOLsp9oUCYMYStJm+MMRBp2a0BEm0vMocvhCwcNpij8dmUQrxEzga/jsx1 1f2Q== X-Gm-Message-State: AO0yUKX943pgxWmL/oJN3E2/ya3WA2J8FLJ5CBtKiTOZeP98C5pyV6rA gFSsyPMJFA3ML3gkr7XWcYLdr2eLDV0Pdg== X-Google-Smtp-Source: AK7set9ZwvKiimxq3aEBrR8u1pZuYJryT7FxaFYpga2OtjRlZ1mCyC7ldSuEyRaf9uhSvXxKChpFeA== X-Received: by 2002:ac8:58d1:0:b0:3a8:2ccb:f55d with SMTP id u17-20020ac858d1000000b003a82ccbf55dmr5501633qta.33.1676486576003; Wed, 15 Feb 2023 10:42:56 -0800 (PST) Received: from WQUEN758573.ncr.int.ec.gc.ca (ecodor132.cmc.ec.gc.ca. [205.211.133.132]) by smtp.gmail.com with ESMTPSA id u124-20020a376082000000b00702d1c6e7bbsm14308326qkb.130.2023.02.15.10.42.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Feb 2023 10:42:55 -0800 (PST) From: Philippe Blain Date: Wed, 15 Feb 2023 13:42:42 -0500 Subject: [PATCH] gdb: add --with-curses to --configuration output MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230211-configuration-show-curses-v1-1-ce1bc0c062ac@gmail.com> X-B4-Tracking: v=1; b=H4sIAKEn7WMC/x2NQQrDMAwEvxJ0rsB2IYR+pfSg2HKsQ+0iJW0h5 O91ehx2Z3cHYxU2uA07KL/FpNUO/jJALFQXRkmdIbhwdcF7jK1mWTaltTfRSvtg3NTYcGI3Jpe yn9wI3Z/JGGelGsu58CRbWc/gpZzl+z+9P47jB9sLHAGEAAAA To: gdb-patches@sourceware.org X-Mailer: b4 0.12.1 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: '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. --- I was building GDB 12 and noticed that '--configuration' did not show if it was built with curses. I see that on master it now shows '--enable|disable-tui', which is what I wanted to know in the first place, but I had already written this patch so I figured I might as well send it :) I built tested this on x86_64-pc-linux-gnu, with both --with-curses and --without-curses, and also ran the test suite before and after the patch. The patch does not seem to influence the test results. I'm including the generated configure and config.in since it seems (from browsing the list) this is what most people do, but I'm noticing that the "DeveloperTips" page on the wiki [1] mentions to _not_ include these changes when sending the patch. Maybe the page should be updated ? I did not do it since I was not sure... Cheers, Philippe. P.S. I do not have push access. P.P.S. I did sign the FSF copyright assignment :) P.P.P.S. I'm trying out 'b4 send' [2], I hope the patch will end up OK :) [1] https://sourceware.org/gdb/wiki/DeveloperTips#Editing_configure.ac [2] https://b4.docs.kernel.org/en/latest/contributor/overview.html --- gdb/config.in | 3 +++ gdb/configure | 3 +++ gdb/configure.ac | 5 ++++- gdb/top.c | 10 ++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gdb/config.in b/gdb/config.in index 7da131ebf04..54110bc9043 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -235,6 +235,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 113b7cf8a30..2aafd2097c8 100755 --- a/gdb/configure +++ b/gdb/configure @@ -20621,6 +20621,9 @@ ac_res=$ac_cv_search_waddstr if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" +$as_echo "#define HAVE_LIBCURSES 1" >>confdefs.h + + fi diff --git a/gdb/configure.ac b/gdb/configure.ac index 7c7bf88b3fb..eac1b8f1aba 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -563,7 +563,10 @@ 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]) + AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses], + [AC_DEFINE([HAVE_LIBCURSES], [1], + [Define to 1 if curses is enabled.]) + ]) if test "$ac_cv_search_waddstr" != no; then curses_found=yes diff --git a/gdb/top.c b/gdb/top.c index 205eb360ba3..18990cf6a73 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\ --- base-commit: ec78da9ce6540bdcc2aeb3e01ffdbbac957cbe07 change-id: 20230211-configuration-show-curses-8e06d0df1806 -- b4