summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2010-04-19 08:02:12 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2010-04-19 08:02:12 (GMT)
commit884c5ffde12904a7ccf394eb31c5e7cf13ce554c (patch) (side-by-side diff)
treea1711a6950a79f59a2c179ece9df54c3f8975872
parentc5416aa2097f666cfc7701210872000871f65abb (diff)
downloadanubis-884c5ffde12904a7ccf394eb31c5e7cf13ce554c.tar.gz
anubis-884c5ffde12904a7ccf394eb31c5e7cf13ce554c.tar.bz2
Use GINT for integrating with Guile.
* gint: New module. * Makefile.am, configure.ac: Use gint. * bootstrap.conf: Initialize git submodules. * src/Makefile.am: Include gint.mk * am/guile.m4: Remove. * src/guile.c (guile_safe_exec): Use scm_c_catch instead of the deprecated scm_internal_lazy_catch.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitmodules3
-rw-r--r--Makefile.am4
-rw-r--r--am/guile.m485
-rw-r--r--bootstrap.conf3
-rw-r--r--configure.ac33
m---------gint0
-rw-r--r--src/Makefile.am2
-rw-r--r--src/guile.c16
8 files changed, 28 insertions, 118 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..7c369d4
--- a/dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "gint"]
+ path = gint
+ url = git://git.gnu.org.ua/gint.git
diff --git a/Makefile.am b/Makefile.am
index 95190d6..d11a38d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,8 +18,8 @@
## with GNU Anubis. If not, see <http://www.gnu.org/licenses/>.
##
-ACLOCAL_AMFLAGS = -I m4 -I am
-SUBDIRS = build lib src po doc scripts examples guile contrib \
+ACLOCAL_AMFLAGS = -I m4 -I am -I gint
+SUBDIRS = build lib gint src po doc scripts examples guile contrib \
elisp testsuite
.PHONY: make-ChangeLog
diff --git a/am/guile.m4 b/am/guile.m4
deleted file mode 100644
index 8841a6a..0000000
--- a/am/guile.m4
+++ b/dev/null
@@ -1,85 +0,0 @@
-dnl This file is part of GNU mailutils.
-dnl Copyright (C) 2001, 2006, 2007, 2010 Free Software Foundation, Inc.
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 3 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software Foundation,
-dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-dnl
-
-dnl MU_CHECK_GUILE(minversion, [act-if-found], [ac-if-not-found])
-dnl $1 $2 $3
-AC_DEFUN([MU_CHECK_GUILE],
-[
- AS_VAR_SET([mu_cv_guile], [no])
- AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH)
- if test "$GUILE_CONFIG" = no; then
- m4_if([$3],,[AC_MSG_ERROR(cannot find Guile)], [$3])
- else
- AC_SUBST(GUILE_INCLUDES)
- AC_SUBST(GUILE_LIBS)
- AC_SUBST(GUILE_VERSION)
- AC_SUBST(GUILE_VERSION_NUMBER)
-
- GUILE_INCLUDES=`$GUILE_CONFIG compile`
- GUILE_LIBS=`$GUILE_CONFIG link`
- GUILE_VERSION=`($GUILE_CONFIG --version 2>&1; echo '')|sed 's/guile-config [[^0-9]]* \([[0-9]][[0-9.]]*\)$/\1/'`
- VEX=`echo $GUILE_VERSION | sed 's/\./ \\\\* 1000 + /;s/\./ \\\\* 100 + /'`
- GUILE_VERSION_NUMBER=`eval expr "$VEX"`
-
- m4_if([$1],,,[
- VEX=`echo $1 | sed 's/\./ \\\\* 1000 + /;s/\./ \\\\* 100 + /'`
- min=`eval expr "$VEX"`
- if test $GUILE_VERSION_NUMBER -lt $min; then
- m4_if([$3],,
- [AC_MSG_ERROR([Guile version too old; required is at least ]$1)],
- [$3])
- fi])
-
- save_LIBS=$LIBS
- save_CFLAGS=$CFLAGS
- LIBS="$LIBS $GUILE_LIBS"
- CFLAGS="$CFLAGS $GUILE_INCLUDES"
- AC_TRY_LINK([#include <libguile.h>],
- m4_if([$1], , scm_shell(0, NULL);, [$1]),
- [AS_VAR_SET([mu_cv_guile], $GUILE_VERSION)])
- LIBS=$save_LIBS
- CFLAGS=$save_CFLAGS
- fi
-
- if test $mu_cv_guile = no; then
- GUILE_INCLUDES=
- GUILE_LIBS=
- GUILE_VERSION=
- GUILE_VERSION_NUMBER=
- m4_if($3,,[AC_MSG_ERROR(required library libguile not found)], [$3])
- else
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libguile.h>]],
- [SCM_DEVAL_P = 1;
- SCM_BACKTRACE_P = 1;
- SCM_RECORD_POSITIONS_P = 1;
- SCM_RESET_DEBUG_MODE;])],
- [mu_cv_guile_debug=yes],
- [mu_cv_guile_debug=no])
- if test $mu_cv_guile_debug = yes; then
- AC_DEFINE_UNQUOTED([GUILE_DEBUG_MACROS], 1,
- [Define to 1 if SCM_DEVAL_P, SCM_BACKTRACE_P, SCM_RECORD_POSITIONS_P and SCM_RESET_DEBUG_MODE are defined])
- fi
- AC_CHECK_TYPES([scm_t_off],[],[],[#include <libguile.h>])
- AC_DEFINE_UNQUOTED([GUILE_VERSION], "$GUILE_VERSION",
- [Guile version number])
- AC_DEFINE_UNQUOTED([GUILE_VERSION_NUMBER], $GUILE_VERSION_NUMBER,
- [Guile version number: MAX*10 + MIN])
- m4_if([$2],,,[$2])
- fi
-])
-
diff --git a/bootstrap.conf b/bootstrap.conf
index f6e5dac..9589b64 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -3,6 +3,9 @@ if [ -r .bootstrap ]; then
eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
fi
+git submodule init
+git submodule update
+
gnulib_name=libanubis
gnulib_modules=`grep '^[^#]' gnulib.modules`
diff --git a/configure.ac b/configure.ac
index 9947012..cf6c2fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -82,10 +82,10 @@ AH_BOTTOM([
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyaddr)
-AC_SUBST(INCLUDES)
+AC_SUBST(ADD_INCLUDES)
case $build in
*-apple-darwin*)
- INCLUDES="$INCLUDES -I/usr/include" ;;
+ ADD_INCLUDES="$ADD_INCLUDES -I/usr/include" ;;
esac
dnl Internationalization macros.
@@ -103,26 +103,14 @@ case "${withval}" in
*) AC_MSG_ERROR(bad value ${withval} for --without-guile) ;;
esac],[useguile=yes])
-AC_SUBST(M4_DEFS)
-
-AC_SUBST(GUILE_INCLUDES)
-AC_SUBST(GUILE_LIBS)
-AC_SUBST(GUILE_BINDIR)
-AC_SUBST(GUILE_SNARF_VERSION)
-AC_SUBST(GUILE_SCRIPTS)
+AC_SUBST([M4_DEFS])
+AC_SUBST([GUILE_SCRIPTS])
if test x"$useguile" = x"yes"; then
- MU_CHECK_GUILE(,[
- AC_DEFINE(WITH_GUILE,1,[Enable Guile support])
- GUILE_INCLUDES=`guile-config compile`
- GUILE_LIBS=`guile-config link`
- GUILE_BINDIR=`guile-config info bindir`
- GUILE_SCRIPTS='$(GUILE_SCM)'
- M4_DEFS="$M4_DEFS -DWITH_GUILE"
- case "$GUILE_VERSION" in
- 16|17) GUILE_SNARF_VERSION="1.6";;
- *) GUILE_SNARF_VERSION="1.6";;
- esac
- ],[useguile=no])
+ GINT_INIT([gint],[1.8 nodoc std-site-dir],
+ [AC_DEFINE(WITH_GUILE,1,[Enable Guile support])
+ GUILE_SCRIPTS='$(GUILE_SCM)'
+ M4_DEFS="$M4_DEFS -DWITH_GUILE"],
+ [useguile=no])
fi
if test x"$useguile" = x"no"; then
AC_MSG_RESULT([Disabling GUILE support...])
@@ -148,7 +136,7 @@ else
findgpgmedir() { :
if test -f "$1/include/gpgme.h"; then
gpgmedir=1
- INCLUDES="$INCLUDES -I$1/include"
+ ADD_INCLUDES="$ADD_INCLUDES -I$1/include"
AC_MSG_CHECKING(for $1/include/gpgme.h)
AC_MSG_RESULT([yes])
return 0
@@ -414,6 +402,7 @@ AC_CONFIG_FILES([Makefile
build/Makefile
build/guile-1.6/Makefile
contrib/Makefile
+ gint/Makefile
doc/Makefile
elisp/Makefile
examples/Makefile
diff --git a/gint b/gint
new file mode 160000
+Subproject 4254b0590e609b82dac3d688ecb401c9eefb7e2
diff --git a/src/Makefile.am b/src/Makefile.am
index 3c04b95..3ac2331 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -96,7 +96,7 @@ BUILT_SOURCES = env.c
localedir = $(datadir)/locale
DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\"
-INCLUDES = @INCLUDES@ @LIBGNUTLS_CFLAGS@ -I$(top_srcdir)/lib
+INCLUDES = @ADD_INCLUDES@ @LIBGNUTLS_CFLAGS@ -I$(top_srcdir)/lib
SUFFIXES=.opt .c
.opt.c:
diff --git a/src/guile.c b/src/guile.c
index 6af115e..dbba3a9 100644
--- a/src/guile.c
+++ b/src/guile.c
@@ -38,15 +38,13 @@ struct scheme_exec_data
{
SCM (*handler) (void *data);
void *data;
- SCM result;
};
static SCM
scheme_safe_exec_body (void *data)
{
struct scheme_exec_data *ed = data;
- ed->result = ed->handler (ed->data);
- return SCM_BOOL_F;
+ return ed->handler (ed->data);
}
static int
@@ -54,16 +52,18 @@ guile_safe_exec (SCM (*handler) (void *data), void *data, SCM *result)
{
jmp_buf jmp_env;
struct scheme_exec_data ed;
-
+ SCM res;
+
if (setjmp(jmp_env))
return 1;
ed.handler = handler;
ed.data = data;
- scm_internal_lazy_catch (SCM_BOOL_T,
- scheme_safe_exec_body, (void*)&ed,
- eval_catch_handler, &jmp_env);
+ res= scm_c_catch (SCM_BOOL_T,
+ scheme_safe_exec_body, (void*)&ed,
+ eval_catch_handler, &jmp_env,
+ NULL, NULL);
if (result)
- *result = ed.result;
+ *result = res;
return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.