public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@embecosm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] GDB: Permit a lone version of Guile with `--with-guile='
Date: Thu, 24 Nov 2022 23:51:23 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.2.20.2211241944450.19931@tpp.orcam.me.uk> (raw)
In-Reply-To: <alpine.DEB.2.20.2211241701270.19931@tpp.orcam.me.uk>

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.

  parent reply	other threads:[~2022-11-24 23:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 23:50 [PATCH 0/3] GDB: Fix `pkg-config' issues with configuring for Guile Maciej W. Rozycki
2022-11-24 23:51 ` [PATCH 1/3] GDB: Run `pkg-config' with `--static' to pull libguile dependencies Maciej W. Rozycki
2022-11-25  7:56   ` Eli Zaretskii
2022-11-28 12:59     ` Maciej W. Rozycki
2022-11-28 13:35       ` Eli Zaretskii
2022-11-24 23:51 ` Maciej W. Rozycki [this message]
2022-11-26 23:38   ` [PATCH 2/3] GDB: Permit a lone version of Guile with `--with-guile=' Mike Frysinger
2022-11-28 13:00     ` Maciej W. Rozycki
2022-11-24 23:51 ` [PATCH 3/3] GDB: Use standard autoconf macros for `pkg-config' Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.2211241944450.19931@tpp.orcam.me.uk \
    --to=macro@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).