mirror of https://github.com/djcb/mu.git
* don't try to use guile if it's pre-2.x; but add some beginning compat
functions for 1.8 and friends
This commit is contained in:
parent
8b824da539
commit
815d5ad862
33
configure.ac
33
configure.ac
|
@ -209,12 +209,10 @@ AM_CONDITIONAL(HAVE_GIO, [test "x$have_gio" = "xyes"])
|
|||
AM_CONDITIONAL(BUILD_WIDGETS, [test "x$have_webkit" = "xyes" -a "x$have_gio" = "xyes"])
|
||||
|
||||
|
||||
|
||||
|
||||
# check for guile & guile-snarf
|
||||
AC_PATH_PROG(GUILE, [guile-config], [], [$PATH])
|
||||
AS_IF([test "x$GUILE" != "x"],
|
||||
[GUILE_CFLAGS=`$GUILE compile`; GUILE_LIBS=`$GUILE link`])
|
||||
AC_PATH_PROG(GUILE_CONFIG, [guile-config], [], [/usr/bin])
|
||||
AS_IF([test "x$GUILE_CONFIG" != "x"],
|
||||
[GUILE_CFLAGS=`$GUILE_CONFIG compile`; GUILE_LIBS=`$GUILE_CONFIG link`])
|
||||
AC_SUBST(GUILE_LIBS)
|
||||
AC_SUBST(GUILE_CFLAGS)
|
||||
|
||||
|
@ -223,12 +221,21 @@ AS_IF([test "x$GUILE_SNARF" != "x"],[
|
|||
AC_DEFINE_UNQUOTED([GUILE_SNARF], ["$GUILE_SNARF"],[Path to guile-snarf])],[
|
||||
AC_MSG_WARN([cannot find guile-snarf])])
|
||||
|
||||
AM_CONDITIONAL(HAVE_GUILE,[test "$xGUILE" != "x" -a "x$GUILE_SNARF != "x])
|
||||
|
||||
|
||||
AS_IF([test "x$GUILE_CONFIG" != "x"],
|
||||
[GUILE_VERSION="`$GUILE_CONFIG --version 2>&1 | sed 's/.*version //'`";
|
||||
GUILE_MAJOR_VERSION="`echo "$GUILE_VERSION" | sed 's/\..*//'`"])
|
||||
|
||||
AS_IF([test "x$GUILE_MAJOR_VERSION" = "x0" -o "x$GUILE_MAJOR_VERSION" = "x1"],
|
||||
[AC_DEFINE_UNQUOTED([HAVE_PRE2_GUILE],[1],[have pre-2.x guile])])
|
||||
|
||||
# for now, we require guile 2.x
|
||||
AM_CONDITIONAL(HAVE_GUILE,[test "$xGUILE_CONFIG" != "x" -a "x$GUILE_SNARF" != "x" \
|
||||
-a "x$GUILE_MAJOR_VERSION" != "0" \
|
||||
-a "x$GUILE_MAJOR_VERSION" != "1"])
|
||||
|
||||
AS_IF([test "x$GUILE_MAJOR_VERSION" = "x0" -o "x$GUILE_MAJOR_VERSION" = "x1"],
|
||||
[AC_MSG_WARN([Only guile >= 2.x is supported])])
|
||||
|
||||
# check for xdg-open
|
||||
AS_IF([test "x$buildgui"="xyes"],[
|
||||
AC_PATH_PROG(XDGOPEN, [xdg-open], [], [$PATH])
|
||||
|
@ -242,11 +249,9 @@ AC_PATH_PROG([PMCCABE],[pmccabe],[pmccabe],[no])
|
|||
AS_IF([test "x$PMCCABE" = "xno"],[
|
||||
have_pmccabe="no"
|
||||
AC_MSG_WARN([
|
||||
*** Developers: you don't seem to have the 'pmccabe' tool installed.
|
||||
*** Developers: you do not seem to have the pmccabe tool installed.
|
||||
*** Please install it if you want to run the automated code checks])
|
||||
],[
|
||||
have_pmccabe="yes"
|
||||
])
|
||||
],[have_pmccabe="yes"])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
|
@ -291,8 +296,8 @@ if test "x$have_webkit" = "xyes"; then
|
|||
echo "Webkit version : $webkit_version"
|
||||
fi
|
||||
|
||||
if test "x$GUILE" != "x"; then
|
||||
echo "Guile version : `$GUILE --version 2>&1`"
|
||||
if test "x$HAVE_GUILE" != "x"; then
|
||||
echo "Guile version : $GUILE_VERSION"
|
||||
fi
|
||||
|
||||
echo
|
||||
|
|
|
@ -18,7 +18,7 @@ include $(top_srcdir)/gtest.mk
|
|||
|
||||
# enforce compiling this dir first before decending into tests/
|
||||
SUBDIRS= .
|
||||
INCLUDES=-I${top_srcdir}/src ${GUILE_CFLAGS} ${GLIB_CFLAGS}
|
||||
INCLUDES=-I${top_srcdir} -I${top_srcdir}/src ${GUILE_CFLAGS} ${GLIB_CFLAGS}
|
||||
|
||||
# don't use -Werror, as it might break on other compilers
|
||||
# use -Wno-unused-parameters, because some callbacks may not
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include "mu-guile-common.h"
|
||||
|
||||
|
@ -39,3 +42,25 @@ mu_guile_g_error (const char *func_name, GError *err)
|
|||
scm_from_utf8_string (err->message),
|
||||
SCM_UNDEFINED, SCM_UNDEFINED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* backward compat for pre-2.x guile - note, this will fail miserably
|
||||
* if you don't use a UTF8 locale
|
||||
*/
|
||||
#if HAVE_PRE2_GUILE
|
||||
|
||||
SCM
|
||||
scm_from_utf8_string (const char* str)
|
||||
{
|
||||
return scm_from_locale_string (str);
|
||||
}
|
||||
|
||||
char*
|
||||
scm_to_utf8_string (SCM scm)
|
||||
{
|
||||
return scm_to_locale_string (scm);
|
||||
}
|
||||
|
||||
#endif /*HAVE_PRE2_GUILE*/
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
#define __MU_GUILE_UTILS_H__
|
||||
|
||||
#include <libguile.h>
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -44,7 +49,13 @@ void mu_guile_error (const char *func_name, int status,
|
|||
* @param err Gerror
|
||||
*/
|
||||
void mu_guile_g_error (const char *func_name, GError *err);
|
||||
|
||||
|
||||
/* compatibility functions for old guile */
|
||||
#if HAVE_PRE2_GUILE
|
||||
SCM scm_from_utf8_string (const char* str);
|
||||
char* scm_to_utf8_string (SCM scm);
|
||||
#endif /*HAVE_PRE2_GUILE*/
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_GUILE_UTILS_H__*/
|
||||
|
|
|
@ -146,9 +146,9 @@ SCM_DEFINE (msg_prio, "mu:msg:priority", 1, 0, 0,
|
|||
prio = mu_msg_get_prio (msgwrap->_msg);
|
||||
|
||||
switch (prio) {
|
||||
case MU_MSG_PRIO_LOW: return scm_from_utf8_symbol("low");
|
||||
case MU_MSG_PRIO_NORMAL: return scm_from_utf8_symbol("normal");
|
||||
case MU_MSG_PRIO_HIGH: return scm_from_utf8_symbol("high");
|
||||
case MU_MSG_PRIO_LOW: return scm_from_locale_symbol("low");
|
||||
case MU_MSG_PRIO_NORMAL: return scm_from_locale_symbol("normal");
|
||||
case MU_MSG_PRIO_HIGH: return scm_from_locale_symbol("high");
|
||||
default:
|
||||
g_return_val_if_reached (SCM_UNDEFINED);
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ check_flag (MuMsgFlags flag, FlagData *fdata)
|
|||
{
|
||||
if (fdata->flags & flag) {
|
||||
SCM item;
|
||||
item = scm_list_1 (scm_from_utf8_symbol(mu_msg_flag_name(flag)));
|
||||
item = scm_list_1 (scm_from_locale_symbol(mu_msg_flag_name(flag)));
|
||||
fdata->lst = scm_append_x (scm_list_2(fdata->lst, item));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
`guile'[1] is an interpreter/library for the Scheme programming language[2],
|
||||
specifically meant for extending other programs. It is, in fact, the
|
||||
official GNU language for doing so.
|
||||
official GNU language for doing so. 'muile' requires guile 2.x to get the full
|
||||
support; older versions will not support e.g. the 'mu-stats.scm' things
|
||||
discussed below.
|
||||
|
||||
The combination of mu + guile is called `muile', and allows you to write
|
||||
little Scheme-programs to query the mu-database, or inspect individual
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
**
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif /*HAVE_CONFIG_H*/
|
||||
|
||||
#include <mu-runtime.h>
|
||||
|
||||
|
@ -27,7 +30,13 @@
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
mu_runtime_init ("/home/djcb/.mu");
|
||||
|
||||
#ifdef HAVE_PRE2_GUILE
|
||||
g_warning ("Note: muile will not function correctly unless you have a "
|
||||
"UTF-8 locale.");
|
||||
#endif /* HAVE_PRE2_GUILE */
|
||||
|
||||
mu_runtime_init (mu_util_guess_mu_homedir());
|
||||
|
||||
scm_with_guile (&mu_guile_msg_init, NULL);
|
||||
scm_with_guile (&mu_guile_store_init, NULL);
|
||||
|
|
Loading…
Reference in New Issue