bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24657: Autoconf macro GUILE_PROGS only looks for guile without versi


From: Freja Nordsiek
Subject: bug#24657: Autoconf macro GUILE_PROGS only looks for guile without version suffix even if given version - patch included
Date: Mon, 10 Oct 2016 16:45:21 +0700

While trying to build a package that uses guile with autotools, I
found a problem in the provided GUILE_PROGS macro.

The macro searches for the executables guile, guild, guile-config, and
guile-tools. The problem is that even if the macro is given the
version, it only looks for guile, guild, etc. with no version suffix.
Version suffixes are commonly used by GNU/Linux distros to allow
parallel installations of guile 1.8 and 2.0 (and 2.2 if it is there as
well). Though typically one of them, whichever the distro considers to
be primary, will have no suffix and will be just plain suffixless
guile, guild, etc. I installed 2.1.4 (effective version 2.2) from
source with the suffix '-2.2' to use the same style and not risk
collisions with the guile already on my system (2.0 is the default). I
imagine that others may do this sort of thing as well.

Anyhow, GUILE_PROGS looks for suffixless guile and then compares its
effective version to what was provided as an argument or set in the
variable GUILE_EFFECTIVE_VERSION earlier by the GUILE_PKG macro.

On a system with parallel guile installations with use of version
suffixes, this means that the desired version of guile cannot be
targetted unless that one happens to be suffixless (or have a
suffixless symlink). If there is no suffixless guile, then the macro
fails outright. If there is one and it is pointing to a version
different than given as an argument or through the variable
GUILE_EFFECTIVE_VERSION, it throws an error.

For example, on my system (Fedora 24), guile 2.0 is installed without
suffix and with a 'guile2' symlink by a package from the main
repository. I have installed the latest version of guile using the
sources on the git (2.1.4) in parallel using the suffix '-2.2' meaning
its guile executable is 'guile-2.2'. If I use autoconf with the
provided guile.m4 in the same directory as the following configure.ac
looking for guile 2.2 with GUILE_PROGS


    AC_INIT([guile_autoconf_test], [0.1], [])
    m4_include([guile.m4])
    GUILE_PROGS([2.2])
    AC_OUTPUT


I get the following output from the resulting configure script


    checking for guile... /usr/bin/guile
    checking for Guile version >= 2.2... configure: error: Guile 2.2
required, but 2.0.11 found


If I instead run GUILE_PKG first and use the GUILE_EFFECTIVE_VERSION set by it


    AC_INIT([guile_autoconf_test], [0.1], [])
    m4_include([guile.m4])
    GUILE_PKG([2.2])
    GUILE_PROGS
    dnl Get the same results if I do GUILE_PROGS([2.2])
    AC_OUTPUT


I get a similar error from the configure script


    checking for pkg-config... /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    configure: checking for guile 2.2
    configure: found guile 2.2
    checking for guile... /usr/bin/guile
    configure: error: found development files for Guile 2.2, but
/usr/bin/guile has effective version 2.0


Looking at the beginning of the GUILE_PROGS macro in guile.m4 from guile 2.1.4


    AC_DEFUN([GUILE_PROGS],
     [AC_PATH_PROG(GUILE,guile)
      _guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])"
      if test -z "$_guile_required_version"; then
        _guile_required_version=2.0
      fi
      if test "$GUILE" = "" ; then
          AC_MSG_ERROR([guile required but not found])
      fi
      AC_SUBST(GUILE)


The problem comes from AC_PATH_PROG(GUILE,guile) in the very first
line and then the error 5 and 6 lines below it when it fails. Further
on in the macro, if guile is found, it checks its version against the
provided version or against 2.0.

I've written a patch that makes GUILE_PROGS first look for the
specified version (or default version) of guile first with the version
suffix '-X.Y', and if that fails looks for it with the version suffix
'X.Y' (no dash, unlike the first one), and if that fails looks for it
without any version suffix. If it finds guile in this way, it then
compares the versions. The patched version then uses the same suffix
(or lack there of) when finding guild, guile-config, and guile-tools.

I've attached the patch against the current development version of
guile (well, assuming someone hasn't committed in the last half hour).
It changes the macro and updated the documentation as well (the
documentation builds successfully).

The beginning of the GUILE_PROGS macro is changed to


    AC_DEFUN([GUILE_PROGS],
     [_guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])"
      if test -z "$_guile_required_version"; then
        _guile_required_version=2.0
      fi
      _guile_suffix=-$_guile_required_version
      AC_PATH_PROG(GUILE,[guile$_guile_suffix])
      if test "$GUILE" = "" ; then
          _guile_suffix=$_guile_required_version
          AC_PATH_PROG(GUILE,[guile$_guile_suffix])
          if test "$GUILE" = "" ; then
              _guile_suffix=
              AC_PATH_PROG(GUILE,[guile$_guile_suffix])
              if test "$GUILE" = "" ; then
                  AC_MSG_ERROR([guile required but not found])
              fi
          fi
      fi
      AC_SUBST(GUILE)


Then, the previous configure.ac except with the new autoconf macro
file named new_guile.m4


    AC_INIT([guile_autoconf_test], [0.1], [])
    m4_include([new_guile.m4])
    GUILE_PKG([2.2])
    GUILE_PROGS
    AC_OUTPUT


The configure script succeeds at finding guile 2.2


    checking for pkg-config... /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    configure: checking for guile 2.2
    configure: found guile 2.2
    checking for guile-2.2... /usr/local/bin/guile-2.2
    checking for Guile version >= 2.2... 2.1.4
    checking for guild-2.2... /usr/local/bin/guild-2.2
    checking for guile-config-2.2... /usr/local/bin/guile-config-2.2
    configure: creating ./config.status


If configure.ac is changed to not use GUILE_PKG and look for guile
1.8, which is not on my system,


    AC_INIT([guile_autoconf_test], [0.1], [])
    m4_include([new_guile.m4])
    GUILE_PROGS([1.8])
    AC_OUTPUT


The configure tries to find guile-1.8 and then guile1.8
unsuccessfully. It then finds guile, whose version (2.0) is at least
1.8 so configure considers that a success (whether that would be
considered a bug or a feature is up for debate but that is for another
time).


    checking for guile-1.8... no
    checking for guile1.8... no
    checking for guile... /usr/bin/guile
    checking for Guile version >= 1.8... 2.0.11
    checking for guild... /usr/bin/guild
    checking for guile-config... /usr/bin/guile-config
    configure: creating ./config.status



An alternative way to fix the issue would be to instead make
GUILE_PROGS take one or more arbitrary suffixes to try as inputs.
Another alternative would be to look for all executables that begin
with the string 'guile' and check the version of each one till one is
successful. The latter one seems like it would take quite a bit of
work to implement and test.


Freja Nordsiek

Attachment: 0001-Fixed-specific-version-of-guile-search-in-autoconf-m.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]