From 0d2a6466549f34c74835943c979ee315feb3eda8 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 18 Apr 2018 11:10:11 +0200 Subject: [PATCH 1/6] guile - use more reliable method of finding guile executable based on guile-config This allows to only specify --with-guile-config=xyz to configure and it will pick up the correct guile executable in case more versions of guile are installed on the same system. For example on Fedora 27, I have /usr/bin/guile1.8 /usr/bin/guile (which is guile 2.0) /usr/bin/guile2.2 Without this patch the configure script would always pick /usr/bin/guile regardless of which guile-config I would specify (guile1.8-config, guile-config or guile-config2.2). With the patch guile2.2 is now correctly picked for guile-config2.2. Unfortunately it still won't work with guile 1.8 because that version can't provide the executable name via guile-config yet. In that case configure will fall back to the old behaviour. On my Fedora 27 system that would mean it would still pick the wrong executable. However this is not critical because that as well can be overridden by setting --with-guile=abc. I don't see an easy way to improve on this. --- configure.ac | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 833cb37bf..664c0fa1a 100644 --- a/configure.ac +++ b/configure.ac @@ -1704,13 +1704,20 @@ else fi if test -n "$GUILE_CONFIG" ; then if test x"$GUILE" = xyes; then - AC_MSG_CHECKING([for guile bindir]) - guile_bindir="`$GUILE_CONFIG info bindir`" - AC_MSG_RESULT([$guile_bindir]) - GUILE=$guile_bindir/guile - if ! test -f "$GUILE" ; then - GUILE= - AC_PATH_PROG(GUILE, guile) + AC_MSG_CHECKING([for guile executable]) + if $GUILE_CONFIG info guile > /dev/null 2>&1; then + GUILE="`$GUILE_CONFIG info guile`" + AC_MSG_RESULT([$GUILE]) + else + AC_MSG_RESULT([not in guile-config, constructing path]) + AC_MSG_CHECKING([for guile bindir]) + guile_bindir="`$GUILE_CONFIG info bindir`" + AC_MSG_RESULT([$guile_bindir]) + GUILE=$guile_bindir/guile + if ! test -f "$GUILE" ; then + GUILE= + AC_PATH_PROG(GUILE, guile) + fi fi fi From d1f7054b7e620deaf33e8f75eac73389a60141d9 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 18 Apr 2018 11:46:56 +0200 Subject: [PATCH 2/6] guile - replace obsolete scm_listify with scm_list_n scm_list_n is available in all guile versions supported by swig, while scm_listify no longer is in guile 2.2 --- Lib/guile/guile_scm.swg | 4 ++-- Lib/guile/typemaps.i | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Lib/guile/guile_scm.swg b/Lib/guile/guile_scm.swg index dfd5da271..37eef6f33 100644 --- a/Lib/guile/guile_scm.swg +++ b/Lib/guile/guile_scm.swg @@ -26,10 +26,10 @@ else { \ if (!gswig_list_p) { \ gswig_list_p = 1; \ - gswig_result = scm_listify(gswig_result, object, SCM_UNDEFINED); \ + gswig_result = scm_list_n(gswig_result, object, SCM_UNDEFINED); \ } \ else \ - gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED)); \ + gswig_result = scm_append(scm_list_n(gswig_result, scm_list_n(object, SCM_UNDEFINED), SCM_UNDEFINED)); \ } %} diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index 0d130f523..f2926c163 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -69,13 +69,13 @@ %typemap(throws) SWIGTYPE { $<ype temp = new $ltype($1); scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(SWIG_NewPointerObj(temp, $&descriptor, 1), + scm_list_n(SWIG_NewPointerObj(temp, $&descriptor, 1), SCM_UNDEFINED)); } %typemap(throws) SWIGTYPE & { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(SWIG_NewPointerObj(&$1, $descriptor, 1), + scm_list_n(SWIG_NewPointerObj(&$1, $descriptor, 1), SCM_UNDEFINED)); } @@ -87,13 +87,13 @@ %typemap(throws) SWIGTYPE * { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(SWIG_NewPointerObj($1, $descriptor, 1), + scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1), SCM_UNDEFINED)); } %typemap(throws) SWIGTYPE [] { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(SWIG_NewPointerObj($1, $descriptor, 1), + scm_list_n(SWIG_NewPointerObj($1, $descriptor, 1), SCM_UNDEFINED)); } @@ -176,7 +176,7 @@ %typemap(varout) enum SWIGTYPE { $result = scm_from_long((int)$1); } %typemap(throws) enum SWIGTYPE { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(scm_from_long((int)$1), SCM_UNDEFINED)); + scm_list_n(scm_from_long((int)$1), SCM_UNDEFINED)); } /* The SIMPLE_MAP_WITH_EXPR macro below defines the whole set of @@ -225,7 +225,7 @@ %typemap(throws) C_NAME { C_NAME swig_c_value = $1; scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(C_TO_SCM_EXPR, SCM_UNDEFINED)); + scm_list_n(C_TO_SCM_EXPR, SCM_UNDEFINED)); } %enddef @@ -269,7 +269,7 @@ /* Throw typemap */ %typemap(throws) C_NAME { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(C_TO_SCM($1), SCM_UNDEFINED)); + scm_list_n(C_TO_SCM($1), SCM_UNDEFINED)); } %enddef @@ -344,7 +344,7 @@ SIMPLE_MAP(unsigned long long, scm_to_ulong_long, scm_from_ulong_long, integer); %typemap(throws) char * { scm_throw(scm_from_locale_symbol((char *) "swig-exception"), - scm_listify(SWIG_str02scm($1), SCM_UNDEFINED)); + scm_list_n(SWIG_str02scm($1), SCM_UNDEFINED)); } /* Void */ From a95ceabb70e9a28686440f0cc0dcb64eae281356 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 18 Apr 2018 11:52:54 +0200 Subject: [PATCH 3/6] guile - drop GDB_INTERFACE related stuff Guile itself has removed it a long time ago: http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=8510e39278161d3cbf8ec4ba87b123fe28763ed4 There's no need for it. I suspect it's just there because the interface file was created based on the then real main source file of guile. --- Lib/guile/guilemain.i | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Lib/guile/guilemain.i b/Lib/guile/guilemain.i index 925b81fee..809154e99 100644 --- a/Lib/guile/guilemain.i +++ b/Lib/guile/guilemain.i @@ -12,11 +12,6 @@ extern "C" { #endif -/* Debugger interface (don't change the order of the following lines) */ -#define GDB_TYPE SCM -#include -GDB_INTERFACE; - static void inner_main(void *closure, int argc, char **argv) { From b02cb7e0bcf0ae747355b988b45900ed81538823 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Thu, 19 Apr 2018 15:29:07 +0200 Subject: [PATCH 4/6] Fix guile executable detection on early 2.0.x guile versions Querying guile-config for the executable name was only introduced in guile 2.0.12. If it works it's the most reliable method in environments with more than one guile executable. If it doesn't work fall back to path detection, assuming the executable name is just 'guile'. If that's incorrect it's up to the caller to explicitly specify the path to the right guile executable. --- configure.ac | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 664c0fa1a..0720ad66f 100644 --- a/configure.ac +++ b/configure.ac @@ -1705,19 +1705,20 @@ else if test -n "$GUILE_CONFIG" ; then if test x"$GUILE" = xyes; then AC_MSG_CHECKING([for guile executable]) - if $GUILE_CONFIG info guile > /dev/null 2>&1; then - GUILE="`$GUILE_CONFIG info guile`" + # Try extracting it via guile-config first. If it's defined there it's the most reliable result + GUILE="`$GUILE_CONFIG info guile 2>/dev/null`" + if test -n "$GUILE"; then AC_MSG_RESULT([$GUILE]) else AC_MSG_RESULT([not in guile-config, constructing path]) AC_MSG_CHECKING([for guile bindir]) guile_bindir="`$GUILE_CONFIG info bindir`" AC_MSG_RESULT([$guile_bindir]) - GUILE=$guile_bindir/guile - if ! test -f "$GUILE" ; then - GUILE= - AC_PATH_PROG(GUILE, guile) - fi + GUILE="$guile_bindir/guile" + fi + if ! test -f "$GUILE" ; then + GUILE= + AC_PATH_PROG(GUILE, guile) fi fi From 7e798c18621d1b1b8291a6c8080692e1a3852e4b Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Thu, 19 Apr 2018 16:22:56 +0200 Subject: [PATCH 5/6] Disable guile configuration if guile-config and guile report a different version In addition - inform the user when guile gets disabled while it was requested - skip unecessary configuration work if guile gets disabled --- configure.ac | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 0720ad66f..789311d53 100644 --- a/configure.ac +++ b/configure.ac @@ -1710,7 +1710,7 @@ else if test -n "$GUILE"; then AC_MSG_RESULT([$GUILE]) else - AC_MSG_RESULT([not in guile-config, constructing path]) + AC_MSG_RESULT([not found via guile-config - constructing path]) AC_MSG_CHECKING([for guile bindir]) guile_bindir="`$GUILE_CONFIG info bindir`" AC_MSG_RESULT([$guile_bindir]) @@ -1722,7 +1722,9 @@ else fi fi - if test -f "$GUILE" ; then + if ! test -f "$GUILE" ; then + AC_MSG_WARN([no suitable guile executable found. Disabling Guile]) + else AC_MSG_CHECKING([for guile version]) guile_version=`$GUILE -c '(display (effective-version))'` AC_MSG_RESULT([$guile_version]) @@ -1730,20 +1732,33 @@ else guile_good_version=`$GUILE -c '(if (>= (string->number (effective-version)) 1.8) (display "yes") (display "no"))'` AC_MSG_RESULT([$guile_good_version]) if test x"$guile_good_version" != xyes ; then + AC_MSG_WARN([at least guile version 1.8 is required. Disabling Guile]) GUILE= fi fi - if test -z "$GUILE_CFLAGS" ; then - AC_MSG_CHECKING([for guile compile flags]) - GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty - AC_MSG_RESULT([$GUILE_CFLAGS]) + if test -f "$GUILE" ; then + # Test if guile-config and guile versions match. They should. + gc_version="`$GUILE_CONFIG --version 2>&1 | sed '1 s/.* //;q'`" + g_version="`$GUILE --version | sed '1 s/.* //;q'`" + if test "$gc_version" != "$g_version"; then + AC_MSG_WARN([different versions reported by $GUILE_CONFIG ($gc_version) and $GUILE ($g_version). Disabling Guile]) + GUILE= + fi fi - if test -z "$GUILE_LIBS" ; then - AC_MSG_CHECKING([for guile link flags]) - GUILE_LIBS="`$GUILE_CONFIG link`" - AC_MSG_RESULT([$GUILE_LIBS]) + if test -f "$GUILE" ; then + if test -z "$GUILE_CFLAGS" ; then + AC_MSG_CHECKING([for guile compile flags]) + GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty + AC_MSG_RESULT([$GUILE_CFLAGS]) + fi + + if test -z "$GUILE_LIBS" ; then + AC_MSG_CHECKING([for guile link flags]) + GUILE_LIBS="`$GUILE_CONFIG link`" + AC_MSG_RESULT([$GUILE_LIBS]) + fi fi fi fi From f8adc3e6139d80b758c162aea2725c810f35484b Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 20 Apr 2018 08:54:37 +0200 Subject: [PATCH 6/6] guile - resstructure some configure tests 1. move the 'no executable found' message up to be with the executable tests 2. test for an (non-)empty GUILE variable for all other conditions after that An empty GUILE variable means guile is disabled and consistently using the same test makes the code more readable. --- configure.ac | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 789311d53..5ee050c64 100644 --- a/configure.ac +++ b/configure.ac @@ -1720,11 +1720,12 @@ else GUILE= AC_PATH_PROG(GUILE, guile) fi + if test -z "$GUILE" ; then + AC_MSG_WARN([no suitable guile executable found. Disabling Guile]) + fi fi - if ! test -f "$GUILE" ; then - AC_MSG_WARN([no suitable guile executable found. Disabling Guile]) - else + if test -n "$GUILE" ; then AC_MSG_CHECKING([for guile version]) guile_version=`$GUILE -c '(display (effective-version))'` AC_MSG_RESULT([$guile_version]) @@ -1737,7 +1738,7 @@ else fi fi - if test -f "$GUILE" ; then + if test -n "$GUILE" ; then # Test if guile-config and guile versions match. They should. gc_version="`$GUILE_CONFIG --version 2>&1 | sed '1 s/.* //;q'`" g_version="`$GUILE --version | sed '1 s/.* //;q'`" @@ -1747,7 +1748,7 @@ else fi fi - if test -f "$GUILE" ; then + if test -n "$GUILE" ; then if test -z "$GUILE_CFLAGS" ; then AC_MSG_CHECKING([for guile compile flags]) GUILE_CFLAGS="`$GUILE_CONFIG compile`" # Note that this can sometimes be empty