From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by sourceware.org (Postfix) with ESMTPS id 5F1ED3858D1E for ; Mon, 20 Feb 2023 11:48:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F1ED3858D1E 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-x834.google.com with SMTP id ay9so399770qtb.9 for ; Mon, 20 Feb 2023 03:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:message-id:content-transfer-encoding:mime-version :subject:date:from:from:to:cc:subject:date:message-id:reply-to; bh=iN6V0fOKgxRNJHi+UdS2h+ULaIJaFvkxAeHCo5Idgzs=; b=g9PwWo7bmRrsjobK79Riog8EGG+Cn5Zbv+nmz/KvEsaY7XSAmUN0/kIH96s7XLywvd BLMCky71hxQ8Mkz8O0e2+TKoYr/y6DKUGAl4efz6gYVoRCtWmz9N+UsgxLfYXM1FekDP R7c9ydQoqn42CU2wZWHHV8veAsuONRSrXZ4uVRroOg2c+yJ/cfiIXrUiJI8pVSzTZzZb wUTGg9lifmEqTuww8ZyR95zAaUem9ThGsx96GfY4QkhB8snRYF9VKN8AJSy7uYP9NHfM Mi2y1aQQ8fYTSxejFQ4iPiWOxT2FAGvNAKCA1SOaD9hiT9taqlpICOyh+pFAVmx1Jqsh gqYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-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=iN6V0fOKgxRNJHi+UdS2h+ULaIJaFvkxAeHCo5Idgzs=; b=QuHRkF2zUryozR7kO5+OatWLHWyKxpeEvGUMcBCCIYdxTGJWWVg0J2I+RleaiHazPr aHaWk51t9TvQbwnZ+EJU1uYN5Mr3am3zqNNM79Y8oHY5VOOvs9wzaLnZe7pMYhwuCa1x I4JvorqaCGgBUc9P1JZ8ann0bTUb1ZkmMzKR3PuASjdsQoBSFfIadSJTpq9QUbdVARb8 Sh9l3wif28sjySi8Ml8Y7d12dd2FutPNQxBgRqbTCzMVr/1Nd9W4RnFAPRU0mAYifnBL GfZk5KeZfmbijXGK2qZD6hFZJ4SE259j0J5K7DXYUTqNwgOlmhLn+V6sJkezXPUt0ZGH grrA== X-Gm-Message-State: AO0yUKWXASTuiq5a4P8Qfy0hdjb/vIPjcz+BjuqTwA2VxzkHd9fwUiPO Yi9Q2u5ihx0i2bvZ9ajzvOJiU+JfABs= X-Google-Smtp-Source: AK7set/r+e4EaaBxKJw877ZwFwOU1kYe7M07/sBtgiUlQuN64wNuhVKTMoX2XMGrY9xdxJp1oaJp8g== X-Received: by 2002:a05:6214:dc7:b0:56e:f417:2ac0 with SMTP id 7-20020a0562140dc700b0056ef4172ac0mr696328qvt.10.1676846269735; Sun, 19 Feb 2023 14:37:49 -0800 (PST) Received: from WQUEN758573.ncr.int.ec.gc.ca (bras-base-esmnpq8902w-grc-06-206-172-203-52.dsl.bell.ca. [206.172.203.52]) by smtp.gmail.com with ESMTPSA id a189-20020a37b1c6000000b0073bb4312842sm4861912qkf.128.2023.02.19.14.37.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Feb 2023 14:37:48 -0800 (PST) From: Philippe Blain Date: Sun, 19 Feb 2023 17:37:35 -0500 Subject: [PATCH v2] 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-v2-1-a28c6ea6f00a@gmail.com> X-B4-Tracking: v=1; b=H4sIAK6k8mMC/42OTQ6CMBCFr0K6dkxbE0JceQ/jogwDnURaMwOoI dzdwglcfu9n3qxGSZjUXKvVCC2snFMBf6oMxpAGAu4KG2/9xXrnAHPqeZglTCUJGvMbcBYlhYZ s3dmud42tTem3QQlaCQnjfmEMOpHsxkuo588xen8UjqxTlu/xw+J29Z+5xUGxybVo0dY+4G0YA z/PmEfz2LbtB3sDDBTbAAAA In-Reply-To: <20230211-configuration-show-curses-v1-1-ce1bc0c062ac@gmail.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.13-dev-696ff X-Spam-Status: No, score=-11.1 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=unavailable 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. While at it, remove the condition on 'ac_cv_search_waddstr' and set 'curses_found' directly in 'action-if-found'. --- Changes in v2: - set 'curses_found' directly in action-if-found, as suggested by Simon v1: 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 | 8 ++++---- gdb/configure.ac | 10 +++++----- gdb/top.c | 10 ++++++++++ 4 files changed, 22 insertions(+), 9 deletions(-) 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..9be220e28fa 100755 --- a/gdb/configure +++ b/gdb/configure @@ -20620,13 +20620,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 7c7bf88b3fb..6ad0f9d8815 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -563,11 +563,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 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