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.

  - Choose a better name than foodir.  I suggest guilesitedir.

  - In your configure script, write something like (ensure that the
    substituted value contains ${datadir} as a literal string):

      guilesitedir=\${datadir}$guilesitesuffix
      AC_SUBST([guilesitedir])

  - Remove any assignment of guilesitedir from your Makefile.am.
    Since this is AC_SUBST-ed, Automake will put the usual

      guilesitedir = @guilesitedir@

    line into Makefile.in.

  - Optionally, add a configure option such as --with-guilesitedir
    to adjust the value substituted by configure.  This is purely
    for user convenience.  Whether or not you do this, guilesitedir
    can be overidden on the make command line, e.g.,

      make install guilesitedir=/some/where/else

Guile probably could provide macros to do all of this, so that users
of Guile don't need to invent their own solutions.

[1] 
https://www.gnu.org/software/automake/manual/automake.html#Hard_002dCoded-Install-Paths

Hope that helps,
  Nick

Reply via email to