On Wed, 12 Feb 2020, Matt Wette wrote:
Hi All,
Over the last year I have been dealing with issues getting a configure.ac put
together
for my guile app. It needs to install .scm and .go files into the place
guile expects to
see them: (%site-ccache-dir) and %load-path. If I compile for my ubuntu
system then
the installed go files need to go in a non-standard place:
/usr/lib/x86_64-linux-gnu/guile/2.2/site-ccache
If I compile for the guix context then the expectation is that the files are
installed in
$prefix/lib/guile/2.2/site-ccache
Here is my solution. What do you think? If $prefix is the same as used to
build guile
then I use the directories from $guile. Otherwise, I use the default. This
now works on
ubuntu and guix.
From configure.ac:
guile_build_prefix=`$GUILE -c "(display (assq-ref %guile-build-info
'prefix))"`
if test "$guile_build_prefix" == "$prefix"; then
echo "using paths for installed guile"
GUILE_SITE_DIR
GUILE_SITE_GO_DIR
GUILE_DATA_DIR
else
echo "using default paths for guile"
GUILE_SITE=$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION
GUILE_SITE_GO=$prefix/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
GUILE_DATA=$prefix/share
AC_SUBST([GUILE_SITE])
AC_SUBST([GUILE_SITE_GO])
AC_SUBST([GUILE_DATA])
fi
GUILE_SITE_DIR is defined in guile.m4, the others are in my own package m4.
I use guile.m4 from the FSF [1]. It gets invoked in configure.ac as
follows [2].
GUILE_PROGS
GUILE_FLAGS
GUILE_SITE_DIR
GUILE_EXT_DIR
GUILE_CACHE_DIR
See [3] for Automake file. Basically the useful variables from guile.m4
are: GUILE_SITE, GUILE_EXT, GUILE_CACHE.
Regards
Jan
[1]: https://gitlab.com/wedesoft/aiscm/-/blob/master/m4/guile.m4
[2]: https://gitlab.com/wedesoft/aiscm/-/blob/master/configure.ac#L236
[3]: https://gitlab.com/wedesoft/aiscm/-/blob/master/aiscm/Makefile.am