On Fri, Sep 5, 2025 at 11:19 AM Nick Bowler <nbow...@draconx.ca> wrote:
>
> On Fri, Sep 05, 2025 at 03:49:47AM -0400, Nikolaos Chatzikonstantinou wrote:
> > I am trying to "fix" the support of GNU Guile in Autotools. Guile
> > ships its guile/meta/guile.m4 macros, that among other things, set
> > GUILE_SITE to /usr/share/guile/site/3.0/ (on Debian 12) or similar.
> >
> > Since automake does not understand bin_PROGRAMS, etc, for Guile,
> > programmers are forced to use _DATA to ship scheme files:
> >
> >     foo_DATA = foo.scm
> >     foodir = $(GUILE_SITE)/foo
> >
> > This breaks `make distcheck`, as it attempts to install to a directory
> > under /usr
>
> Right, under no circumstances should the default installation location
> of any files be outside of the prefix.  This is only acceptable for
> installation directories explicitly specified by the user.
>
> The Automake manual has a section which discusses this challenge,
> "Installing to Hard-Coded Locations"[1].
>
> I'm not very familiar with GNU Guile.  But I would suggest:
>
>   - Have your configure script inspect the value of GUILE_SITE to try
>     and identify the suffix which is not related to Guile's datadir.  In
>     your case I imagine that would be the /guile/site/3.0 part.  Let's
>     suppose you set this in a shell variable called guilesitesuffix.

Your recommendation works by manipulating the paths provided by
pkg-config, which AFAIK are provided by distributions. On Debian it's
the datadir, but it could be arbitrary in theory, and not related to
prefix/datadir. In particular, what should the m4 scripts do if the
pkg-config path is unrelated to any autoconf prefixes or LHS
directories?

Another option would be for Guile to use prefix and all the rest.
Can't it use GUILE_SITE=$(datadir)/guile/3.0/site and so on instead? I
understand that Autotools is not a package manager, but ./configure &&
make && make install always does something sensible for C/C++. How can
it be made to work this way for Guile too?

Ideally one wouldn't even need EXTRA_DIST, as the programs could be
specified with _GUILEPROGRAMS or similar. The .scm file suffix is
shared between the Scheme flavors so that autoconf cannot deduce that
Guile is in use; either offer _GUILEPROGRAMS or detect a special
suffix (say .guile). This would allow programmers to specify their
project just like in C, without having to worry about GUILE_SITE,
EXTRA_DIST, _DATA, and so on. Isn't this the optimal solution?

Regards,
Nikolaos Chatzikonstantinou

Reply via email to