[2/3] GDB: Permit a lone version of Guile with `--with-guile='
Commit Message
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
Comments
On 24 Nov 2022 23:51, Maciej W. Rozycki wrote:
> --- src.orig/gdb/configure.ac
> +++ src/gdb/configure.ac
> + case "${guile_version}" in
> + *[[^.0-9]]*)
in POSIX shell, don't you need to use ! instead of ^ ?
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04_05
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
-mike
On Sun, 27 Nov 2022, Mike Frysinger wrote:
> On 24 Nov 2022 23:51, Maciej W. Rozycki wrote:
> > --- src.orig/gdb/configure.ac
> > +++ src/gdb/configure.ac
> > + case "${guile_version}" in
> > + *[[^.0-9]]*)
>
> in POSIX shell, don't you need to use ! instead of ^ ?
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_04_05
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13
I guess you are right, although I have never come across it in my 25+
years' shell programming experience. Bash manual says either character is
accepted, which is I suppose why I have never had an issue with using `^'.
I'll send v2.
Well-spotted, thank you!
Maciej
===================================================================
@@ -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
===================================================================
@@ -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.