From patchwork Thu Nov 24 23:51:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 61093 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6AE13896C28 for ; Thu, 24 Nov 2022 23:51:40 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 14C043896C12 for ; Thu, 24 Nov 2022 23:51:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 14C043896C12 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x436.google.com with SMTP id x17so4539166wrn.6 for ; Thu, 24 Nov 2022 15:51:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=mime-version:user-agent:references:message-id:in-reply-to:subject :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8rPNCr83iAI0Y4LHQaedmB0sMktHa0jPuHECE5FWOWQ=; b=CtmbLMcW/oQoH7E19uNQ/DVlcc1T/NpedHztULUmypVZsyLJaE1ypwAKgK/2v4/vEn 6makwKAJhdRmnexoAvfNMLAMG2YfC2KJUBSyAr2xHzdvRYrhA8a1d++1ZlEPt85OVkAd oodPSbrBAN9PgYVjSH0EilxmPlnBUT9v3T0hCuxfozlJaM0nrZrIxeLgN9H/thpEBBds t9PQb4dPqDPe7V7Ubp/TKD0x7sVQM6jcTwGHHy4azhGOwLMtTpp3yn1wkoVwBUm650f/ JxgLxAtCzKZ/yEBIxHPxcOcPFF02aybWMUcZZmdwTBoxgdeC+XF7ZzlP1+mB8f74YrbH fiSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:message-id:in-reply-to:subject :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8rPNCr83iAI0Y4LHQaedmB0sMktHa0jPuHECE5FWOWQ=; b=rVh/FuNs5HeucpY36f/6fLnynpV5IcpyuNscLzbhD6HkBv8JSErCY6fWOf7tDG8IGp rDXjmzksFCQXd+OEdXdZpjJMEKC5hrBjmkFu+ilioNcm2lAaDMltmdjDU9fzQEQlArlr WRGlvt0BEAYoxQw53wvvzAdoXMIjA2teaA58Wvwm2TqXTJeJlWYKsnzk8EGBjEaT3IAg +wFx6on4O/a1Mq2DjEqoOWEy6uUP9e3oy59GJ53nCo0N7Tu9iXzKaH2Yj8QWpNx1EQYB zEa7AzexGVE68txbw1GUbFGAxYL5yZFjZItQA4Gw9QO6Tuo2b9be3LFJO67BEG5atX+U kQBg== X-Gm-Message-State: ANoB5pnA4d5ktNW5p28Z70kjzEdk81wnWoFzOUhKSDo9HGcq7DO364Vb +hk6Oj0gLg63K8+olzYeXzug8ka+XRqKHMy6 X-Google-Smtp-Source: AA0mqf5/Py4Zj8UvFYAzPlwLSpeUhikdKPw+ibTpjbC1q/dbxJFEuQSbereMVCR0g5VCVVwZGaDOYQ== X-Received: by 2002:a05:6000:1146:b0:241:ddc5:5e5e with SMTP id d6-20020a056000114600b00241ddc55e5emr11573531wrx.150.1669333884826; Thu, 24 Nov 2022 15:51:24 -0800 (PST) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id k21-20020a05600c1c9500b003cfa3a12660sm14743799wms.1.2022.11.24.15.51.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2022 15:51:24 -0800 (PST) Date: Thu, 24 Nov 2022 23:51:23 +0000 (GMT) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org Subject: [PATCH 2/3] GDB: Permit a lone version of Guile with `--with-guile=' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Our documentation in `gdb/README' says one can use a version number as an argument to `--with-guile=' to get the desired version of Guile used, hovever such syntax is actually not supported: checking whether to use guile... 2.2 checking for pkg-config... /usr/bin/pkg-config checking for usable guile from /usr/bin/pkg-config... configure: error: unable to find usable guile version from "2.2" make[1]: *** [Makefile:12160: configure-gdb] Error 1 This is confirmed with inline documentation in `configure.ac': dnl There are several different values for --with-guile: [...] dnl guile-version [guile-version-choice-2 ...] - dnl A space-separated list of guile package versions to try. dnl These are passed to pkg-config as-is. dnl E.g., guile-2.0 or guile-2.2-uninstalled Not only it is contrary to what user documentation says, but it seems counter-intuitive and indeed rather weakly justified as well, given that in virtually all configurations the package carrying Guile will actually be called "guile". Implement the documented semantics then and accept a lone version number as an argument to `--with-guile=' as well, using a simple heuristics to tell it apart: a string comprised of digits and point characters only is considered a lone version number to which "guile-" is prepended in the `pkg-config' invocation and other strings are handled as before. This follows an observation that packages do not have solely numeric names. --- gdb/configure | 28 ++++++++++++++++++++++++++++ gdb/configure.ac | 16 ++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) gdb-pkgconfig-guile-version.diff Index: src/gdb/configure =================================================================== --- src.orig/gdb/configure +++ src/gdb/configure @@ -22909,6 +22909,13 @@ $as_echo "$as_me: WARNING: pkg-config no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } for guile_version in ${guile_version_list}; do + case "${guile_version}" in + *[^.0-9]*) + ;; + *) + guile_version=guile-"${guile_version}" + ;; + esac ${pkg_config} --exists ${guile_version} 2>/dev/null if test $? != 0; then continue @@ -22993,6 +23000,13 @@ yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } for guile_version in ${guile_version_list}; do + case "${guile_version}" in + *[^.0-9]*) + ;; + *) + guile_version=guile-"${guile_version}" + ;; + esac ${pkg_config} --exists ${guile_version} 2>/dev/null if test $? != 0; then continue @@ -23074,6 +23088,13 @@ $as_echo "${found_usable_guile}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } for guile_version in ${guile_version_list}; do + case "${guile_version}" in + *[^.0-9]*) + ;; + *) + guile_version=guile-"${guile_version}" + ;; + esac ${pkg_config} --exists ${guile_version} 2>/dev/null if test $? != 0; then continue @@ -23165,6 +23186,13 @@ $as_echo "${found_usable_guile}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usable guile from ${pkg_config}" >&5 $as_echo_n "checking for usable guile from ${pkg_config}... " >&6; } for guile_version in ${guile_version_list}; do + case "${guile_version}" in + *[^.0-9]*) + ;; + *) + guile_version=guile-"${guile_version}" + ;; + esac ${pkg_config} --exists ${guile_version} 2>/dev/null if test $? != 0; then continue Index: src/gdb/configure.ac =================================================================== --- src.orig/gdb/configure.ac +++ src/gdb/configure.ac @@ -996,7 +996,7 @@ AM_CONDITIONAL(HAVE_PYTHON, test "${have dnl Utility to simplify finding libguile. dnl $1 = pkg-config-program -dnl $2 = space-separate list of guile versions to try +dnl $2 = space-separated list of guile version numbers or package names to try dnl $3 = yes|no, indicating whether to flag errors or ignore them dnl $4 = the shell variable to assign the result to dnl If libguile is found we store "yes" here. @@ -1010,6 +1010,13 @@ AC_DEFUN([AC_TRY_LIBGUILE], found_usable_guile=checking AC_MSG_CHECKING([for usable guile from ${pkg_config}]) for guile_version in ${guile_version_list}; do + case "${guile_version}" in + *[[^.0-9]]*) + ;; + *) + guile_version=guile-"${guile_version}" + ;; + esac ${pkg_config} --exists ${guile_version} 2>/dev/null if test $? != 0; then continue @@ -1072,9 +1079,10 @@ dnl The pkg-config program must b dnl auto - Same as "yes", but if guile is missing from the system, dnl fall back to "no". dnl guile-version [guile-version-choice-2 ...] - -dnl A space-separated list of guile package versions to try. -dnl These are passed to pkg-config as-is. -dnl E.g., guile-2.0 or guile-2.2-uninstalled +dnl A space-separated list of guile package version numbers +dnl or names to try. Numbers have "guile-" prepended while +dnl names are passed to pkg-config as-is. +dnl E.g. 3.0, guile-2.0 or guile-2.2-uninstalled. dnl This requires making sure PKG_CONFIG_PATH is set appropriately. dnl /path/to/pkg-config - dnl Use this pkg-config program.