diff options
-rw-r--r-- | ChangeLog.asciidoc | 1 | ||||
-rw-r--r-- | cmake/FindGuile.cmake | 8 | ||||
-rw-r--r-- | config.h.cmake | 1 | ||||
-rw-r--r-- | configure.ac | 20 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile.c | 6 |
5 files changed, 35 insertions, 1 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index c3063346f..dca66045b 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -41,6 +41,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * aspell: fix crash with command "/aspell addword" if no word is given (closes #164, closes #165) * irc: fix translation of CTCP PING reply (closes #137) +* guile: fix compilation with Guile < 2.0.4 (closes #198) * perl: fix detection of Perl >= 5.20 with autotools * script: fix crash on "/script update" if a script detail is displayed in buffer (closes #177) diff --git a/cmake/FindGuile.cmake b/cmake/FindGuile.cmake index 69e3ab011..6002876f4 100644 --- a/cmake/FindGuile.cmake +++ b/cmake/FindGuile.cmake @@ -34,4 +34,12 @@ endif() find_package(PkgConfig) if(PKG_CONFIG_FOUND) pkg_search_module(GUILE guile-2.0) + if(GUILE_FOUND) + # check if variable "scm_install_gmp_memory_functions" exists + set(CMAKE_REQUIRED_INCLUDES ${GUILE_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${GUILE_LDFLAGS}) + check_symbol_exists(scm_install_gmp_memory_functions "libguile.h" HAVE_GUILE_GMP_MEMORY_FUNCTIONS) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_LIBRARIES) + endif() endif() diff --git a/config.h.cmake b/config.h.cmake index 73f427a04..82be05c6e 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -8,6 +8,7 @@ #cmakedefine HAVE_EAT_NEWLINE_GLITCH #cmakedefine HAVE_ASPELL_VERSION_STRING #cmakedefine HAVE_ENCHANT_GET_VERSION +#cmakedefine HAVE_GUILE_GMP_MEMORY_FUNCTIONS #define PACKAGE_VERSION "@VERSION@" #define PACKAGE "@PROJECT_NAME@" #define PACKAGE_NAME "@PROJECT_NAME@" diff --git a/configure.ac b/configure.ac index d328c2e23..514c6b3b0 100644 --- a/configure.ac +++ b/configure.ac @@ -103,6 +103,7 @@ AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK]) AH_VERBATIM([HAVE_EAT_NEWLINE_GLITCH], [#undef HAVE_EAT_NEWLINE_GLITCH]) AH_VERBATIM([HAVE_ASPELL_VERSION_STRING], [#undef HAVE_ASPELL_VERSION_STRING]) AH_VERBATIM([HAVE_ENCHANT_GET_VERSION], [#undef HAVE_ENCHANT_GET_VERSION]) +AH_VERBATIM([HAVE_GUILE_GMP_MEMORY_FUNCTIONS], [#undef HAVE_GUILE_GMP_MEMORY_FUNCTIONS]) AH_VERBATIM([PLUGIN_ALIAS], [#undef PLUGIN_ALIAS]) AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL]) AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET]) @@ -814,7 +815,24 @@ if test "x$enable_guile" = "xyes" ; then fi done - if test "x$guile_found" = "xno" ; then + if test "x$guile_found" = "xyes" ; then + # check if variable "scm_install_gmp_memory_functions" exists + ac_save_CFLAGS="$CFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS $GUILE_CFLAGS" + LDFLAGS="$LDFLAGS $GUILE_LFLAGS" + AC_CACHE_CHECK([for variable scm_install_gmp_memory_functions], ac_cv_have_guile_gmp_memory_functions, [ + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[ #include <libguile.h>]], + [[ scm_install_gmp_memory_functions = 0; ]])], + [ ac_have_guile_gmp_memory_functions="yes" ], + [ ac_have_guile_gmp_memory_functions="no" ])]) + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + if test "x$ac_have_guile_gmp_memory_functions" = "xyes"; then + AC_DEFINE(HAVE_GUILE_GMP_MEMORY_FUNCTIONS) + fi + else AC_MSG_WARN([ *** Guile >= 2.0 couldn't be found on your system. *** WeeChat will be built without Guile (scheme) support.]) diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index 155f88393..7d4304d9f 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -19,6 +19,10 @@ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #undef _ #include <libguile.h> @@ -971,12 +975,14 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) guile_stdout = NULL; +#ifdef HAVE_GUILE_GMP_MEMORY_FUNCTIONS /* * prevent guile to use its own gmp allocator, because it can conflict * with other plugins using GnuTLS like relay, which can crash WeeChat * on unload (or exit) */ scm_install_gmp_memory_functions = 0; +#endif scm_init_guile (); |