* don't require gio anymore, not even optionally

This commit is contained in:
Dirk-Jan C. Binnema
2010-08-17 00:41:37 +03:00
parent 908ff418d5
commit 6b20dbd38e
3 changed files with 33 additions and 58 deletions

View File

@ -14,7 +14,7 @@
## along with this program; if not, write to the Free Software Foundation, ## along with this program; if not, write to the Free Software Foundation,
## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
AC_INIT([mu],[0.7],[http://www.djcbsoftware.nl/code/mu]) AC_INIT([mu],[0.7.1],[http://www.djcbsoftware.nl/code/mu])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/mu.cc]) AC_CONFIG_SRCDIR([src/mu.cc])
AM_INIT_AUTOMAKE([dist-bzip2]) AM_INIT_AUTOMAKE([dist-bzip2])
@ -61,7 +61,6 @@ AS_IF([test "x$PMCCABE" = "xno"],[
]) ])
# #
# currently, we don' support systems without d_type in their struct # currently, we don' support systems without d_type in their struct
# dirent (Solaris 10); but we do support FSs for which d_type is always # dirent (Solaris 10); but we do support FSs for which d_type is always
@ -84,16 +83,14 @@ 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 # gio has only been added to recent glib
PKG_CHECK_MODULES(GIO,gio-2.0,[have_gio=yes],[have_gio=no]) dnl PKG_CHECK_MODULES(GIO,gio-2.0,[have_gio=yes],[have_gio=no])
AM_CONDITIONAL(HAVE_GIO, [test "x$have_gio" = "xyes"]) dnl AM_CONDITIONAL(HAVE_GIO, [test "x$have_gio" = "xyes"])
AS_IF([test "x$have_gio" = "xno"],[ dnl AS_IF([test "x$have_gio" = "xno"],[
AC_MSG_WARN([GIO not supported]) dnl AC_MSG_WARN([GIO not supported])
],[ dnl ],[
AC_DEFINE(HAVE_GIO,[1],[Wether we have GIO]) dnl AC_DEFINE(HAVE_GIO,[1],[Wether we have GIO])
]) dnl ])
# 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, [have_gtest=yes],[have_gtest=no]) PKG_CHECK_MODULES(g_test,glib-2.0 >= 2.16, [have_gtest=yes],[have_gtest=no])
@ -111,7 +108,11 @@ AC_SUBST(GMIME_LIBS)
AS_IF([test "x$have_gmime" = "xno"],[ AS_IF([test "x$have_gmime" = "xno"],[
AC_MSG_ERROR([ AC_MSG_ERROR([
*** gmime-2.4 could not be found; please install it *** gmime-2.4 could not be found; please install it
*** e.g., in debian/ubuntu the package would be 'libgmime-2.4-dev']) *** e.g., in debian/ubuntu the package would be 'libgmime-2.4-dev'
*** If you compiled it yourself, you should ensure that the pkgconfig
*** installation dir (e.g., /usr/local/lib/pkgconfig) is in your
*** PKG_CONFIG_PATH.
])
]) ])
@ -121,7 +122,10 @@ AM_CONDITIONAL(HAVE_XAPIAN,test "x$XAPIAN" != "xno")
AS_IF([test "x$XAPIAN" = "xno"],[ AS_IF([test "x$XAPIAN" = "xno"],[
AC_MSG_ERROR([ AC_MSG_ERROR([
*** xapian could not be found; please install it *** xapian could not be found; please install it
*** e.g., in debian/ubuntu the package would be 'libxapian-dev']) *** e.g., in debian/ubuntu the package would be 'libxapian-dev'
*** If you compiled it yourself, you should ensure that xapian-config
*** is in your PATH.
])
],[ ],[
XAPIAN_CXXFLAGS=`$XAPIAN --cxxflags` XAPIAN_CXXFLAGS=`$XAPIAN --cxxflags`
XAPIAN_LIBS=`$XAPIAN --libs` XAPIAN_LIBS=`$XAPIAN --libs`
@ -148,7 +152,7 @@ echo "-----------------------------"
echo echo
echo "Note: the Xapian database is no longer stored as <muhome>/xapian-0.6" echo "Note: the Xapian database is no longer stored as <muhome>/xapian-0.6"
echo "but instead simply as <muhome>/xapian. You can remove the older" echo "but instead simply as <muhome>/xapian. You can remove the older"
echo "<muhome>xapian-0.6 directory to save some disk space" echo "<muhome>/xapian-0.6 directory to save some disk space"
echo echo
echo "type 'make' to build mu, or 'make check' to run the unit tests." echo "type 'make' to build mu, or 'make check' to run the unit tests."

View File

@ -23,7 +23,6 @@ if HAVE_GTEST
SUBDIRS += tests SUBDIRS += tests
endif endif
INCLUDES=$(XAPIAN_CXXFLAGS) $(GMIME_CFLAGS) $(GLIB_CFLAGS) INCLUDES=$(XAPIAN_CXXFLAGS) $(GMIME_CFLAGS) $(GLIB_CFLAGS)
# don't use -Werror, as it might break on other compilers # don't use -Werror, as it might break on other compilers

View File

@ -17,8 +17,9 @@
** **
*/ */
#include <stdio.h> #include <config.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
@ -28,10 +29,6 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#ifdef HAVE_GIO
#include <gio/gio.h>
#endif /*HAVE_GIO*/
#include "mu-log.h" #include "mu-log.h"
#include "mu-util.h" #include "mu-util.h"
@ -116,49 +113,24 @@ mu_log_init_with_fd (int fd, gboolean doclose,
return TRUE; return TRUE;
} }
/* log file is too big!; we move it to <logfile>.old, overwriting */
#ifdef HAVE_GIO
static gboolean
move_log_file (const char* logfile)
{
GFile *src, *dst;
gchar *tmp;
GError *err;
gboolean rv;
src = g_file_new_for_path (logfile);
tmp = g_strdup_printf ("%s.old", logfile);
dst = g_file_new_for_path (tmp);
g_free (tmp);
err = NULL;
rv = g_file_move (src, dst, G_FILE_COPY_OVERWRITE, NULL,
NULL, NULL, &err);
if (!rv) {
g_warning ("Failed to move %s to %s.old: %s",
logfile, logfile, err ? err->message : "?");
if (err)
g_error_free (err);
}
g_object_unref (G_OBJECT(src));
g_object_unref (G_OBJECT(dst));
return rv;
}
#else
static gboolean static gboolean
move_log_file (const char *logfile) move_log_file (const char *logfile)
{ {
g_message ("Failed to move log file '%s', because this mu " gchar *logfile_old;
"was built without GIO support", logfile); int rv;
logfile_old = g_strdup_printf ("%s.old", logfile);
rv = rename (logfile, logfile_old);
g_free (logfile_old);
if (rv != 0) {
g_warning ("Failed to move %s to %s.old: %s",
logfile, logfile, strerror(rv));
return FALSE;
} else
return TRUE;
return TRUE; /* ignore the error */
} }
#endif /* HAVE_GIO */
static gboolean static gboolean