From a3d94402568bb121e35d592eb3fbe0f0e416a985 Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Mon, 23 Nov 2009 05:24:05 +0000 Subject: [PATCH] automate build on Darwin, fix error from gcc 4.4 git-svn-id: http://encfs.googlecode.com/svn/trunk@46 db9cf616-1c43-0410-9cb8-a902689de0d6 --- configure.ac | 23 ++++++++++++++++++----- encfs/Makefile.am | 5 +++++ encfs/NameIO.cpp | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 29aa7d2..610537d 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,12 @@ AM_INIT_AUTOMAKE(encfs, 1.5.1) dnl searches for some needed programs RELEASE=1 AC_SUBST(RELEASE) +AC_CANONICAL_HOST +AM_CONDITIONAL([DARWIN], + [case $host_os in darwin*) true;; *) false;; esac]) + +AC_CONFIG_MACRO_DIR([m4]) + dnl without this order in this file, automake will be confused! dnl AM_CONFIG_HEADER(config.h) @@ -54,6 +60,11 @@ CPPFLAGS="$CPPFLAGS $USER_INCLUDES $FUSEFLAGS -D__STDC_FORMAT_MACROS" CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS $USER_INCLUDES" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $USER_LDFLAGS" +# default install path on Darwin of Macports, which is where rlog may be +if test -z "${DARWIN_TRUE}"; then + LDFLAGS="$LDFLAGS -L/opt/local/lib" +fi + if test "$GXX" = "yes"; then CXXFLAGS="-W -Wall -Wpointer-arith -Wwrite-strings $CXXFLAGS" dnl CXXFLAGS="$CXXFLAGS -Wformat=2 -Wconversion" @@ -64,11 +75,13 @@ AC_CHECK_HEADER(fuse.h,, Can't find fuse.h - add the search path to CPPFLAGS and rerun configure, eg: export CPPFLAGS=-I/usr/local/include ])]) -AC_CHECK_LIB(fuse,fuse_new, [FUSE_LIBS="-lfuse"], - [AC_MSG_ERROR([ - Can't find libfuse.a - add the search path to LDFLAGS - and rerun configure, eg: - export LDFLAGS=-L/usr/local/lib ])],) +AC_CHECK_LIB(fuse_ino64,fuse_new, [FUSE_LIBS="-lfuse_ino64"], + [ AC_CHECK_LIB(fuse,fuse_new, [FUSE_LIBS="-lfuse"], + [AC_MSG_ERROR([ + Can't find libfuse.a - add the search path to LDFLAGS + and rerun configure, eg: + export LDFLAGS=-L/usr/local/lib ])],) + ],) AC_SUBST(FUSE_LIBS) diff --git a/encfs/Makefile.am b/encfs/Makefile.am index 450b039..fd15397 100644 --- a/encfs/Makefile.am +++ b/encfs/Makefile.am @@ -9,6 +9,11 @@ INCLUDES = $(all_includes) -I../intl AM_CXXFLAGS = -DRLOG_COMPONENT="encfs" $(ALL_INCLUDES) +if DARWIN +# needed to select correct API in fuse.h +AM_CXXFLAGS += -D__FreeBSD__=10 +endif + if BUILD_NLS # define a C macro LOCALEDIR indicating where catalogs will be installed #localedir = $(datadir)/locale diff --git a/encfs/NameIO.cpp b/encfs/NameIO.cpp index 988bd78..a13694f 100644 --- a/encfs/NameIO.cpp +++ b/encfs/NameIO.cpp @@ -190,7 +190,7 @@ std::string NameIO::recodePath( const char *path, } else { bool isDotFile = (*path == '.'); - char *next = strchr( path, '/' ); + const char *next = strchr( path, '/' ); int len = next ? next - path : strlen( path ); // at this point we know that len > 0