summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2017-06-16 11:28:57 +0200
committerAndy Wingo <wingo@pobox.com>2017-06-16 11:28:57 +0200
commit1683068f61986d3ddb4d0b845a3ed781dc115e9c (patch)
tree33adddf890b7a22d3309e24c9c6d43db97df3161
parentFibers 1.0.0. (diff)
downloadguile-fibers-1683068f61986d3ddb4d0b845a3ed781dc115e9c.tar.gz
Support compiling against Guile 3.0.
-rw-r--r--acinclude.m483
-rw-r--r--configure.ac2
2 files changed, 67 insertions, 18 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 9fd4f1a..89823e9 100644
--- a/acinclude.m4
+++ b/acinclude.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
## 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
@@ -61,7 +61,7 @@
#
AC_DEFUN([GUILE_PKG],
[PKG_PROG_PKG_CONFIG
- _guile_versions_to_search="m4_default([$1], [2.0 1.8])"
+ _guile_versions_to_search="m4_default([$1], [2.2 2.0 1.8])"
if test -n "$GUILE_EFFECTIVE_VERSION"; then
_guile_tmp=""
for v in $_guile_versions_to_search; do
@@ -154,18 +154,28 @@ 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" directories. The variable @var{GUILE_SITE} will
+# be set to Guile's "site" directory for Scheme source files (usually something
+# like PREFIX/share/guile/site). @var{GUILE_SITE_CCACHE} will be set to the
+# directory for compiled Scheme files also known as @code{.go} files
+# (usually something like
+# PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/site-ccache).
+# @var{GUILE_EXTENSION} will be set to the directory for compiled C extensions
+# (usually something like
+# PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/extensions). The latter two
+# are set to blank if the particular version of Guile does not support
+# them. 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 +183,28 @@ AC_DEFUN([GUILE_SITE_DIR],
AC_MSG_FAILURE(sitedir not found)
fi
AC_SUBST(GUILE_SITE)
+ AC_MSG_CHECKING([for Guile site-ccache directory using pkgconfig])
+ GUILE_SITE_CCACHE=`$PKG_CONFIG --variable=siteccachedir guile-$GUILE_EFFECTIVE_VERSION`
+ if test "$GUILE_SITE_CCACHE" = ""; then
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING([for Guile site-ccache directory using interpreter])
+ GUILE_SITE_CCACHE=`$GUILE -c "(display (if (defined? '%site-ccache-dir) (%site-ccache-dir) \"\"))"`
+ if test $? != "0" -o "$GUILE_SITE_CCACHE" = ""; then
+ AC_MSG_RESULT(no)
+ GUILE_SITE_CCACHE=""
+ AC_MSG_WARN([siteccachedir not found])
+ fi
+ fi
+ AC_MSG_RESULT($GUILE_SITE_CCACHE)
+ 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
@@ -181,10 +213,15 @@ AC_DEFUN([GUILE_SITE_DIR],
#
# This macro looks for programs @code{guile} and @code{guild}, setting
# variables @var{GUILE} and @var{GUILD} to their paths, respectively.
-# If @code{guile} is not found, signal an error.
+# The macro will attempt to find @code{guile} with the suffix of
+# @code{-X.Y}, followed by looking for it with the suffix @code{X.Y}, and
+# then fall back to looking for @code{guile} with no suffix. If
+# @code{guile} is still not found, signal an error. The suffix, if any,
+# that was required to find @code{guile} will be used for @code{guild}
+# as well.
#
# By default, this macro will search for the latest stable version of
-# Guile (e.g. 2.0). x.y or x.y.z versions can be specified. If an older
+# Guile (e.g. 2.2). x.y or x.y.z versions can be specified. If an older
# version is found, the macro will signal an error.
#
# The effective version of the found @code{guile} is set to
@@ -198,16 +235,25 @@ AC_DEFUN([GUILE_SITE_DIR],
# The variables are marked for substitution, as by @code{AC_SUBST}.
#
AC_DEFUN([GUILE_PROGS],
- [AC_PATH_PROG(GUILE,guile)
- _guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])"
+ [_guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])"
if test -z "$_guile_required_version"; then
- _guile_required_version=2.0
+ _guile_required_version=2.2
fi
- if test "$GUILE" = "" ; then
+
+ _guile_candidates=guile
+ _tmp=
+ for v in `echo "$_guile_required_version" | tr . ' '`; do
+ if test -n "$_tmp"; then _tmp=$_tmp.; fi
+ _tmp=$_tmp$v
+ _guile_candidates="guile-$_tmp guile$_tmp $_guile_candidates"
+ done
+
+ AC_PATH_PROGS(GUILE,[$_guile_candidates])
+ if test -z "$GUILE"; then
AC_MSG_ERROR([guile required but not found])
fi
- AC_SUBST(GUILE)
+ _guile_suffix=`echo "$GUILE" | sed -e 's,^.*/guile\(.*\)$,\1,'`
_guile_effective_version=`$GUILE -c "(display (effective-version))"`
if test -z "$GUILE_EFFECTIVE_VERSION"; then
GUILE_EFFECTIVE_VERSION=$_guile_effective_version
@@ -241,20 +287,23 @@ AC_DEFUN([GUILE_PROGS],
else
as_fn_error $? "Guile $_guile_required_version required, but $_guile_prog_version found" "$LINENO" 5
fi
+ elif test "$GUILE_EFFECTIVE_VERSION" = "$_major_version.$_minor_version" -a -z "$_micro_version"; then
+ # Allow prereleases that have the right effective version.
+ true
else
AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found])
fi
AC_MSG_RESULT([$_guile_prog_version])
- AC_PATH_PROG(GUILD,guild)
+ AC_PATH_PROG(GUILD,[guild$_guile_suffix])
AC_SUBST(GUILD)
- AC_PATH_PROG(GUILE_CONFIG,guile-config)
+ AC_PATH_PROG(GUILE_CONFIG,[guile-config$_guile_suffix])
AC_SUBST(GUILE_CONFIG)
if test -n "$GUILD"; then
GUILE_TOOLS=$GUILD
else
- AC_PATH_PROG(GUILE_TOOLS,guile-tools)
+ AC_PATH_PROG(GUILE_TOOLS,[guile-tools$_guile_suffix])
fi
AC_SUBST(GUILE_TOOLS)
])
diff --git a/configure.ac b/configure.ac
index d66a978..4015f52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ AC_SUBST(WARN_CFLAGS)
#
# Check for Guile
#
-GUILE_PKG([2.2])
+GUILE_PKG([3.0 2.2])
GUILE_FLAGS
GUILE_PROGS