unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Freja Nordsiek <fnordsie@gmail.com>
To: guile-devel@gnu.org
Subject: [PATCH] Add to the 2.1.x branch GUILE_SITE_CCACHE_DIR and GUILE_EXTENSION_DIR Autoconf macros along with needed siteccachdir entry in pkgconfig file
Date: Sun, 12 Mar 2017 10:38:29 +0100	[thread overview]
Message-ID: <CAOqf98oCtqOocYedPD5Bpei+G_AM9iGOJ1PDgp3mDeFUifyR2A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1768 bytes --]

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.

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])
     ])

I honestly think this is the better version since it will work even
without the entry in the pkgconfig file but using pkgconfig fits in
better with the existing macros and may be preferred by others. Also,
this version requires GUILE_PROGS to have succeeded. Even if this
version is accepted, I still think the added entry to the pkgconfig
file is a good idea.


Freja Nordsiek

[-- Attachment #2: 0001-Added-GUILE_SITE_CCACHE_DIR-and-GUILE_EXTENSION_DIR-.patch --]
[-- Type: text/x-patch, Size: 3666 bytes --]

From 6ba6a0f1a32b248710d64ce307fa49a9b6a29d8f Mon Sep 17 00:00:00 2001
From: Freja Nordsiek <fnordsie@gmail.com>
Date: Sun, 12 Mar 2017 10:22:53 +0100
Subject: [PATCH] Added GUILE_SITE_CCACHE_DIR and GUILE_EXTENSION_DIR Autoconf
 macros for finding where user compiled .go and C extensions should go.

---
 meta/guile-2.2.pc.in |  1 +
 meta/guile.m4        | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

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..f1c7261 100644
--- a/meta/guile.m4
+++ b/meta/guile.m4
@@ -26,6 +26,8 @@
 ## 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_CCACHE_DIR -- find path to Guile "site-ccache" directory where GO files go
+## GUILE_EXTENSION_DIR -- find path to Guile "extensions" directory
 ## 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
@@ -175,6 +177,52 @@ AC_DEFUN([GUILE_SITE_DIR],
   AC_SUBST(GUILE_SITE)
  ])
 
+# GUILE_SITE_CCACHE_DIR -- find path to Guile "site-ccache" directory where GO files go
+#
+# Usage: GUILE_SITE_CCACHE_DIR
+#
+# This looks for Guile's "site-ccache" directory, usually something like
+# PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/site-ccache, and sets var
+# @var{GUILE_SITE_CCACHE} to the path. Note that the var name is different
+# from the macro name. This is the directory where users should install
+# compiled @code{.go} files for use with this version of Guile.
+#
+# The variable is marked for substitution, as by @code{AC_SUBST}.
+#
+AC_DEFUN([GUILE_SITE_CCACHE_DIR],
+ [AC_REQUIRE([GUILE_PKG])
+  AC_MSG_CHECKING(for Guile site-ccache directory)
+  GUILE_SITE_CCACHE=`$PKG_CONFIG --print-errors --variable=siteccachedir guile-$GUILE_EFFECTIVE_VERSION`
+  AC_MSG_RESULT($GUILE_SITE_CCACHE)
+  if test "$GUILE_SITE_CCACHE" = ""; then
+     AC_MSG_FAILURE(siteccachedir not found)
+  fi
+  AC_SUBST(GUILE_SITE_CCACHE)
+ ])
+
+# GUILE_EXTENSION_DIR -- find path to Guile "extensions" directory
+#
+# Usage: GUILE_EXTENSION_DIR
+#
+# This looks for Guile's "extensions" directory, usually something like
+# PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/extensions, and sets var
+# @var{GUILE_EXTENSION} to the path. Note that the var name is different
+# from the macro name. This is the directory where users should install
+# compiled C extensions for use with this version of Guile.
+#
+# The variable is marked for substitution, as by @code{AC_SUBST}.
+#
+AC_DEFUN([GUILE_EXTENSION_DIR],
+ [AC_REQUIRE([GUILE_PKG])
+  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
+     AC_MSG_FAILURE(extensiondir not found)
+  fi
+  AC_SUBST(GUILE_EXTENSION)
+ ])
+
 # GUILE_PROGS -- set paths to Guile interpreter, config and tool programs
 #
 # Usage: GUILE_PROGS([VERSION])
-- 
2.9.3


             reply	other threads:[~2017-03-12  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-12  9:38 Freja Nordsiek [this message]
2017-03-13 12:46 ` [PATCH] Add to the 2.1.x branch GUILE_SITE_CCACHE_DIR and GUILE_EXTENSION_DIR Autoconf macros along with needed siteccachdir entry in pkgconfig file Andy Wingo
2017-03-14 14:08   ` Freja Nordsiek
2017-03-14 14:53     ` Andy Wingo
2017-03-14 15:31       ` Freja Nordsiek
2017-03-14 15:56         ` Andy Wingo
2017-03-14 16:10           ` Freja Nordsiek
2017-03-14 19:41             ` Freja Nordsiek
2017-03-15  7:46               ` Andy Wingo
2017-03-15  7:49                 ` Freja Nordsiek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOqf98oCtqOocYedPD5Bpei+G_AM9iGOJ1PDgp3mDeFUifyR2A@mail.gmail.com \
    --to=fnordsie@gmail.com \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).