I coalesced the new macros into the existing GUILE_SITE_DIR macro, though I had to change a few things as will be explained. It works on Guile 2.1.x, 2.0.x, and 1.8.x. I changed it so that if the directories for go files and compiled C extensions are not found, a warning is raised and those variables are set to blank. Otherwise, it would just result in failure on Guile 1.8.x. While testing this for these different Guile versions, I uncovered a small bug in the GUILE_PROGS macro that I will make a patch for in another email (back on the email chain for the relevant bug).
Freja Nordsiek On Mon, Mar 13, 2017 at 1:46 PM, Andy Wingo <wi...@pobox.com> wrote: > On Sun 12 Mar 2017 10:38, Freja Nordsiek <fnord...@gmail.com> writes: > >> Guile provides the GUILE_SITE_DIR Autoconf macro for finding where a >> user should install scheme files, but there are no equivalent macros >> for the directories to put compiled go files and C extensions into. >> The patch adds the equivalent macros to do this for the 2.1.x branch >> (it might work as is for the 2.0.x branch but I haven't tested it), >> which are more or less copy-pastes of the GUILE_SITE_DIR macro. > > The patch looks good. WDYT though about instead extending > GUILE_SITE_DIR to search for the ccache dir and the extension dir and > AC_SUBST them? It would be nice to avoid adding more ceremonial lines > to configure.ac. > > (I really wish I hadn't named it "ccache"; oh well, too late in 2.1.x to > change.) > >> GUILE_SITE_CCACHE_DIR does require an additional entry to be put into >> Guile's pkgconfig file, which I named siteccachedir to fit in with the >> rest. One major issue is that the GUILE_SITE_CCACHE_DIR macro will >> fail for any version of Guile that does not have the new entry in the >> pkgconfig file, which would be all 2.0.x and 2.1.x releases thus far. >> One way around it would be to instead of using pkgconfig for it would >> to instead use the following macro that uses the Guile interpreter >> itself to find the directory (this is more or less the version I use >> in one of my own projects). >> >> AC_DEFUN([GUILE_SITE_CCACHE_DIR], >> [AC_REQUIRE([GUILE_PROGS]) >> AC_MSG_CHECKING([for Guile site-ccache directory]) >> GUILE_SITE_CCACHE=`$GUILE -c "(display (%site-ccache-dir))"` >> if test $? != "0" -o "$GUILE_SITE_CCACHE" = ""; then >> AC_MSG_FAILURE([siteccachedir not found]) >> fi >> AC_MSG_RESULT([$GUILE_SITE_CCACHE]) >> AC_SUBST([GUILE_SITE_CCACHE]) >> ]) > > A fallback sounds good. In that case it would work fine with 2.0. We > can add more paths to the pkg-config file as well, in parallel; it's > better for other build systems. > > Andy
From 90daf796c829f8e422a281d501f711138f21a334 Mon Sep 17 00:00:00 2001 From: Freja Nordsiek <fnord...@gmail.com> Date: Tue, 14 Mar 2017 15:04:38 +0100 Subject: [PATCH] Made GUILE_SITE_DIR Autoconf macro look for directories for compiled .go and C extensions in addition to the site directory for scheme files. --- meta/guile-2.2.pc.in | 1 + meta/guile.m4 | 35 +++++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/meta/guile-2.2.pc.in b/meta/guile-2.2.pc.in index c8f485b..c6d12b5 100644 --- a/meta/guile-2.2.pc.in +++ b/meta/guile-2.2.pc.in @@ -10,6 +10,7 @@ pkgincludedir=@includedir@/guile sitedir=@sitedir@ extensiondir=@libdir@/guile/@GUILE_EFFECTIVE_VERSION@/extensions +siteccachedir=@libdir@/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache libguileinterface=@LIBGUILE_INTERFACE@ # Actual name of the 'guile' and 'guild' programs. This is diff --git a/meta/guile.m4 b/meta/guile.m4 index 2e4f3dc..4a2e285 100644 --- a/meta/guile.m4 +++ b/meta/guile.m4 @@ -25,7 +25,7 @@ ## GUILE_PKG -- find Guile development files ## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs ## GUILE_FLAGS -- set flags for compiling and linking with Guile -## GUILE_SITE_DIR -- find path to Guile "site" directory +## GUILE_SITE_DIR -- find path to Guile "site" directories for scheme, compiles GO files, and compiled C extensions ## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value ## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module ## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module @@ -154,18 +154,25 @@ AC_DEFUN([GUILE_FLAGS], AC_SUBST([GUILE_LTLIBS]) ]) -# GUILE_SITE_DIR -- find path to Guile "site" directory +# GUILE_SITE_DIR -- find path to Guile site directories # # Usage: GUILE_SITE_DIR # -# This looks for Guile's "site" directory, usually something like -# PREFIX/share/guile/site, and sets var @var{GUILE_SITE} to the path. -# Note that the var name is different from the macro name. +# This looks for Guile's "site" directory for Scheme files (usually something like +# PREFIX/share/guile/site), "site-ccache" directory for compiled @code{.go} files +# (usually something like PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/site-ccache), +# and "extensions" directory for compiled C extensions (usually something like +# PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/extensions). The variables +# @var{GUILE_SITE}, @var{GUILE_SITE_CCACHE}, and @var{GUILE_EXTENSION} are set to these +# paths respectively. The latter two are set to blank if they are not found. Note that +# this macro will run the macros @code{GUILE_PKG} and @code{GUILE_PROGS} if they have +# not already been run. # -# The variable is marked for substitution, as by @code{AC_SUBST}. +# The variables are marked for substitution, as by @code{AC_SUBST}. # AC_DEFUN([GUILE_SITE_DIR], [AC_REQUIRE([GUILE_PKG]) + AC_REQUIRE([GUILE_PROGS]) AC_MSG_CHECKING(for Guile site directory) GUILE_SITE=`$PKG_CONFIG --print-errors --variable=sitedir guile-$GUILE_EFFECTIVE_VERSION` AC_MSG_RESULT($GUILE_SITE) @@ -173,6 +180,22 @@ AC_DEFUN([GUILE_SITE_DIR], AC_MSG_FAILURE(sitedir not found) fi AC_SUBST(GUILE_SITE) + AC_MSG_CHECKING([for Guile site-ccache directory]) + GUILE_SITE_CCACHE=`$GUILE -c "(display (if (defined? '%site-ccache-dir) (%site-ccache-dir) \"\"))"` + AC_MSG_RESULT([$GUILE_SITE_CCACHE]) + if test $? != "0" -o "$GUILE_SITE_CCACHE" = ""; then + GUILE_SITE_CCACHE="" + AC_MSG_WARN([siteccachedir not found]) + fi + AC_SUBST([GUILE_SITE_CCACHE]) + AC_MSG_CHECKING(for Guile extensions directory) + GUILE_EXTENSION=`$PKG_CONFIG --print-errors --variable=extensiondir guile-$GUILE_EFFECTIVE_VERSION` + AC_MSG_RESULT($GUILE_EXTENSION) + if test "$GUILE_EXTENSION" = ""; then + GUILE_EXTENSION="" + AC_MSG_WARN(extensiondir not found) + fi + AC_SUBST(GUILE_EXTENSION) ]) # GUILE_PROGS -- set paths to Guile interpreter, config and tool programs -- 2.9.3