guile: fix compilation with Guile < 2.0.4 (closes #198)

v2.8-utf8proc
Sébastien Helleu 2014-09-20 15:43:29 +02:00
parent 1801e0da3b
commit 6a2bef6fb7
5 changed files with 35 additions and 1 deletions

View File

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

View File

@ -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()

View File

@ -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@"

View File

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

View File

@ -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 ();