* make requirement for GIO optional (issue #22)
This commit is contained in:
22
configure.ac
22
configure.ac
@ -80,17 +80,27 @@ AC_STRUCT_DIRENT_D_INO
|
|||||||
|
|
||||||
|
|
||||||
# glib2?
|
# glib2?
|
||||||
PKG_CHECK_MODULES(GLIB, glib-2.0 gio-2.0)
|
PKG_CHECK_MODULES(GLIB, glib-2.0)
|
||||||
AC_SUBST(GLIB_CFLAGS)
|
AC_SUBST(GLIB_CFLAGS)
|
||||||
AC_SUBST(GLIB_LIBS)
|
AC_SUBST(GLIB_LIBS)
|
||||||
|
|
||||||
|
|
||||||
|
# gio has only been added to recent glib
|
||||||
|
PKG_CHECK_MODULES(GIO,gio-2.0,[have_gio=yes],[have_gio=no])
|
||||||
|
AM_CONDITIONAL(HAVE_GIO, [test "x$have_gio" = "xyes"])
|
||||||
|
AS_IF([test "x$have_gio" = "xno"],[
|
||||||
|
AC_MSG_WARN([GIO not supported])
|
||||||
|
],[
|
||||||
|
AC_DEFINE(HAVE_GIO,[1],[Wether we have GIO])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# g_test was introduced in glib 2.16
|
# g_test was introduced in glib 2.16
|
||||||
PKG_CHECK_MODULES(g_test,glib-2.0 >= 2.16,
|
PKG_CHECK_MODULES(g_test,glib-2.0 >= 2.16, [have_gtest=yes],[have_gtest=no])
|
||||||
[have_gtest=yes],[have_gtest=no])
|
|
||||||
AM_CONDITIONAL(HAVE_GTEST, test "x$have_gtest" = "xyes")
|
AM_CONDITIONAL(HAVE_GTEST, test "x$have_gtest" = "xyes")
|
||||||
if test "x$have_gtest" = "xno"; then
|
AS_IF([test "x$have_gtest" = "xno"],[
|
||||||
AC_MSG_WARN([You need GLIB version >= 2.16 to build the tests])
|
AC_MSG_WARN([You need GLIB version >= 2.16 to build the tests])
|
||||||
fi
|
])
|
||||||
|
|
||||||
|
|
||||||
# gmime2?
|
# gmime2?
|
||||||
|
|||||||
25
src/mu-log.c
25
src/mu-log.c
@ -27,7 +27,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GIO
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#endif /*HAVE_GIO*/
|
||||||
|
|
||||||
#include "mu-log.h"
|
#include "mu-log.h"
|
||||||
#include "mu-util.h"
|
#include "mu-util.h"
|
||||||
@ -61,7 +64,6 @@ try_close (int fd)
|
|||||||
__FUNCTION__, fd, strerror(errno));
|
__FUNCTION__, fd, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
silence (void)
|
silence (void)
|
||||||
{
|
{
|
||||||
@ -117,6 +119,7 @@ mu_log_init_with_fd (int fd, gboolean doclose,
|
|||||||
|
|
||||||
|
|
||||||
/* log file is too big!; we move it to <logfile>.old, overwriting */
|
/* log file is too big!; we move it to <logfile>.old, overwriting */
|
||||||
|
#ifdef HAVE_GIO
|
||||||
static gboolean
|
static gboolean
|
||||||
move_log_file (const char* logfile)
|
move_log_file (const char* logfile)
|
||||||
{
|
{
|
||||||
@ -131,19 +134,31 @@ move_log_file (const char* logfile)
|
|||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
rv = g_file_move (src, dst, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &err);
|
rv = g_file_move (src, dst, G_FILE_COPY_OVERWRITE, NULL,
|
||||||
|
NULL, NULL, &err);
|
||||||
if (!rv) {
|
if (!rv) {
|
||||||
g_warning ("Failed to move %s to %s.old: %s", logfile, logfile,
|
g_warning ("Failed to move %s to %s.old: %s",
|
||||||
err ? err->message : "?");
|
logfile, logfile, err ? err->message : "?");
|
||||||
if (err)
|
if (err)
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (G_OBJECT(src));
|
g_object_unref (G_OBJECT(src));
|
||||||
g_object_unref (G_OBJECT(dst));
|
g_object_unref (G_OBJECT(dst));
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
static gboolean
|
||||||
|
move_log_file (const char *logfile)
|
||||||
|
{
|
||||||
|
g_warning ("Failed to move log file '%s', because this 'mu'"
|
||||||
|
"was built without GIO support", logfile);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_GIO */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
log_file_backup_maybe (const char *logfile)
|
log_file_backup_maybe (const char *logfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user