diff --git a/ChangeLog b/ChangeLog index 01fa5d5..cb778bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Tue Aug 21 2012 Valient Gough + * replace boost with C++11 + +Sun Aug 19 2012 Valient Gough + * move encrypted key into separate config block + +Sat Aug 18 2012 Valient Gough + * add V to getopt for version + +Sun May 13 2012 Valient Gough + * allow "config" for top-level v6 xml config + * drop logging of useStdin state + Wed Apr 25 2012 Valient Gough * fix encfsctl cat when iv chaining is enabled. Fixes issue #132 diff --git a/configure.ac b/configure.ac index 0a1d3e5..e9438e3 100644 --- a/configure.ac +++ b/configure.ac @@ -46,9 +46,7 @@ AC_PROG_LIBTOOL AX_PTHREAD -AX_BOOST_BASE([1.34]) -AX_BOOST_SYSTEM -AX_BOOST_FILESYSTEM +AC_CHECK_HEADERS([tr1/memory tr1/unordered_map tr1/unordered_set tr1/tuple]) dnl Need to include any user specified flags in the tests below, as they might dnl specify required include directories.. diff --git a/encfs/BlockNameIO.cpp b/encfs/BlockNameIO.cpp index 34366a3..9faa662 100644 --- a/encfs/BlockNameIO.cpp +++ b/encfs/BlockNameIO.cpp @@ -31,7 +31,6 @@ #include "i18n.h" using namespace rlog; -using namespace boost; static RLogChannel * Info = DEF_CHANNEL( "info/nameio", Log_Info ); diff --git a/encfs/BlockNameIO.h b/encfs/BlockNameIO.h index a2a0f5f..7bc4514 100644 --- a/encfs/BlockNameIO.h +++ b/encfs/BlockNameIO.h @@ -21,7 +21,7 @@ #include "NameIO.h" #include "CipherKey.h" -#include +#include class Cipher; @@ -36,7 +36,7 @@ public: static Interface CurrentInterface(bool caseSensitive = false); BlockNameIO( const Interface &iface, - const boost::shared_ptr &cipher, + const shared_ptr &cipher, const CipherKey &key, int blockSize, bool caseSensitiveEncoding = false ); virtual ~BlockNameIO(); @@ -57,11 +57,10 @@ protected: private: int _interface; int _bs; - boost::shared_ptr _cipher; + shared_ptr _cipher; CipherKey _key; bool _caseSensitive; }; - #endif diff --git a/encfs/Cipher.cpp b/encfs/Cipher.cpp index 1c1047c..211f653 100644 --- a/encfs/Cipher.cpp +++ b/encfs/Cipher.cpp @@ -34,7 +34,6 @@ #include "SSL_Cipher.h" using namespace std; -using boost::shared_ptr; #define REF_MODULE(TYPE) \ if( !TYPE::Enabled() ) \ diff --git a/encfs/Cipher.h b/encfs/Cipher.h index 87efd5b..bfb209d 100644 --- a/encfs/Cipher.h +++ b/encfs/Cipher.h @@ -29,8 +29,6 @@ #include #include -using boost::shared_ptr; - /* Mostly pure virtual interface defining operations on a cipher. @@ -42,7 +40,7 @@ class Cipher public: // if no key length was indicated when cipher was registered, then keyLen // <= 0 will be used. - typedef boost::shared_ptr (*CipherConstructor)( + typedef shared_ptr (*CipherConstructor)( const Interface &iface, int keyLenBits ); struct CipherAlgorithm @@ -59,9 +57,9 @@ public: static AlgorithmList GetAlgorithmList( bool includeHidden = false ); - static boost::shared_ptr New( const Interface &iface, + static shared_ptr New( const Interface &iface, int keyLen = -1); - static boost::shared_ptr New( const std::string &cipherName, + static shared_ptr New( const std::string &cipherName, int keyLen = -1 ); diff --git a/encfs/CipherFileIO.cpp b/encfs/CipherFileIO.cpp index d7af35b..fb2b4ca 100644 --- a/encfs/CipherFileIO.cpp +++ b/encfs/CipherFileIO.cpp @@ -27,8 +27,6 @@ #include #include -using boost::shared_ptr; - /* - Version 2:0 adds support for a per-file initialization vector with a fixed 8 byte header. The headers are enabled globally within a diff --git a/encfs/CipherFileIO.h b/encfs/CipherFileIO.h index d4b4c1b..79535e4 100644 --- a/encfs/CipherFileIO.h +++ b/encfs/CipherFileIO.h @@ -34,7 +34,7 @@ class Cipher; class CipherFileIO : public BlockFileIO { public: - CipherFileIO( const boost::shared_ptr &base, + CipherFileIO( const shared_ptr &base, const FSConfigPtr &cfg); virtual ~CipherFileIO(); @@ -68,7 +68,7 @@ private: bool streamWrite( unsigned char *buf, int size, uint64_t iv64 ) const; - boost::shared_ptr base; + shared_ptr base; FSConfigPtr fsConfig; @@ -80,7 +80,7 @@ private: uint64_t fileIV; int lastFlags; - boost::shared_ptr cipher; + shared_ptr cipher; CipherKey key; }; diff --git a/encfs/CipherKey.h b/encfs/CipherKey.h index 9c88cd7..1935d3c 100644 --- a/encfs/CipherKey.h +++ b/encfs/CipherKey.h @@ -21,7 +21,7 @@ #ifndef _CipherKey_incl_ #define _CipherKey_incl_ -#include +#include "shared_ptr.h" class AbstractCipherKey { @@ -30,7 +30,7 @@ public: virtual ~AbstractCipherKey(); }; -typedef boost::shared_ptr CipherKey; +typedef shared_ptr CipherKey; #endif diff --git a/encfs/ConfigVar.h b/encfs/ConfigVar.h index 0c8ca04..5bf903f 100644 --- a/encfs/ConfigVar.h +++ b/encfs/ConfigVar.h @@ -19,9 +19,7 @@ #define _ConfigVar_incl_ #include -#include - -using boost::shared_ptr; +#include "shared_ptr.h" class ConfigVar { diff --git a/encfs/Context.cpp b/encfs/Context.cpp index 3ab8435..c7ef5c2 100644 --- a/encfs/Context.cpp +++ b/encfs/Context.cpp @@ -140,7 +140,7 @@ shared_ptr EncFS_Context::getNode(void *pl) } void *EncFS_Context::putNode(const char *path, - const boost::shared_ptr &node) + const shared_ptr &node) { Lock lock( contextMutex ); Placeholder *pl = new Placeholder( node ); diff --git a/encfs/Context.h b/encfs/Context.h index 5628bd2..0b810da 100644 --- a/encfs/Context.h +++ b/encfs/Context.h @@ -19,16 +19,17 @@ #define _Context_incl_ #include "encfs.h" -#include +#include "shared_ptr.h" #include -#ifdef USE_HASHMAP -#include +#if HAVE_TR1_UNORDERED_MAP +#include +using std::tr1::unordered_map; #else -#include +#include +using std::unordered_map; #endif -using boost::shared_ptr; struct EncFS_Args; struct EncFS_Opts; class FileNode; @@ -87,15 +88,9 @@ private: }; // set of open files, indexed by path -#ifdef USE_HASHMAP - typedef __gnu_cxx::hash_map > FileMap; -#else - typedef std::map< std::string, - std::set > FileMap; -#endif - + typedef unordered_map > FileMap; mutable pthread_mutex_t contextMutex; + FileMap openFiles; int usageCount; diff --git a/encfs/DirNode.h b/encfs/DirNode.h index f075a8a..34240be 100644 --- a/encfs/DirNode.h +++ b/encfs/DirNode.h @@ -31,8 +31,7 @@ #include "NameIO.h" #include "CipherKey.h" #include "FSConfig.h" - -using boost::shared_ptr; +#include "shared_ptr.h" class Cipher; class RenameOp; @@ -72,19 +71,6 @@ private: }; inline bool DirTraverse::valid() const { return dir != 0; } -#ifdef USE_HASHMAP -namespace __gnu_cxx -{ - template<> struct hash - { - size_t operator() (const std::string &__s) const - { - return __stl_hash_string( __s.c_str() ); - } - }; -} -#endif - class DirNode { public: diff --git a/encfs/FSConfig.h b/encfs/FSConfig.h index 32bc329..0ac02e4 100644 --- a/encfs/FSConfig.h +++ b/encfs/FSConfig.h @@ -24,9 +24,9 @@ #include "encfs.h" #include "Interface.h" #include "CipherKey.h" +#include "shared_ptr.h" #include -#include enum ConfigType { @@ -52,8 +52,8 @@ CipherKey getUserKey(const EncfsConfig &config, CipherKey getNewUserKey(EncfsConfig &config, bool useStdin, const std::string &program, const std::string &rootDir); -boost::shared_ptr getCipher(const EncfsConfig &cfg); -boost::shared_ptr getCipher(const Interface &iface, int keySize); +shared_ptr getCipher(const EncfsConfig &cfg); +shared_ptr getCipher(const Interface &iface, int keySize); // helpers for serializing to/from a stream std::ostream &operator << (std::ostream &os, const EncfsConfig &cfg); @@ -62,12 +62,12 @@ std::istream &operator >> (std::istream &os, EncfsConfig &cfg); // Filesystem state struct FSConfig { - boost::shared_ptr config; - boost::shared_ptr opts; + shared_ptr config; + shared_ptr opts; - boost::shared_ptr cipher; + shared_ptr cipher; CipherKey key; - boost::shared_ptr nameCoding; + shared_ptr nameCoding; bool forceDecode; // force decode on MAC block failures bool reverseEncryption; // reverse encryption operation @@ -75,7 +75,7 @@ struct FSConfig bool idleTracking; // turn on idle monitoring of filesystem }; -typedef boost::shared_ptr FSConfigPtr; +typedef shared_ptr FSConfigPtr; #endif diff --git a/encfs/FileNode.cpp b/encfs/FileNode.cpp index 2671a60..5e73190 100644 --- a/encfs/FileNode.cpp +++ b/encfs/FileNode.cpp @@ -50,7 +50,6 @@ using namespace std; using namespace rel; using namespace rlog; -using boost::dynamic_pointer_cast; /* TODO: locking at the FileNode level is inefficient, since this precludes diff --git a/encfs/FileNode.h b/encfs/FileNode.h index 6ad954a..df8caec 100644 --- a/encfs/FileNode.h +++ b/encfs/FileNode.h @@ -29,7 +29,6 @@ class Cipher; class FileIO; class DirNode; -using boost::shared_ptr; class FileNode { diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp index 436d1f6..10cee18 100644 --- a/encfs/FileUtils.cpp +++ b/encfs/FileUtils.cpp @@ -61,9 +61,6 @@ #include "i18n.h" -#include -#include - #include #include @@ -74,7 +71,6 @@ using namespace rlog; using namespace std; using namespace gnu; -namespace fs = boost::filesystem; static const int DefaultBlockSize = 1024; // The maximum length of text passwords. If longer are needed, @@ -90,17 +86,8 @@ static const char ENCFS_ENV_ROOTDIR[] = "encfs_root"; static const char ENCFS_ENV_STDOUT[] = "encfs_stdout"; static const char ENCFS_ENV_STDERR[] = "encfs_stderr"; - -//static int V5SubVersion = 20040518; -//static int V5SubVersion = 20040621; // add external IV chaining -static int V5SubVersion = 20040813; // fix MACFileIO block size issues - -// 20080813 was really made on 20080413 -- typo on date.. -//const int V6SubVersion = 20080813; // switch to v6/XML, add allowHoles option -//const int V6SubVersion = 20080816; // add salt and iteration count -const int V6SubVersion = 20100713; // add version field for boost 1.42+ - -const int ProtoSubVersion = 20120302; +const int V5Latest = 20040813; // fix MACFileIO block size issues +const int ProtoSubVersion = 20120819; const char ConfigFileName[] = ".encfs.txt"; @@ -116,7 +103,7 @@ struct ConfigInfo {Config_V6, ".encfs6.xml", "ENCFS6_CONFIG", readV6Config }, // backward compatible support for older versions {Config_V5, ".encfs5", "ENCFS5_CONFIG", readV5Config }, - {Config_V3, ".encfs4", NULL, readV4Config }, + {Config_V4, ".encfs4", NULL, readV4Config }, // prehistoric - no longer support {Config_V3, ".encfs3", NULL, NULL }, {Config_Prehistoric, ".encfs2", NULL, NULL }, @@ -310,7 +297,7 @@ bool readV6Config( const char *configFile, { rInfo("found 20080813"); cfg.set_revision(20080813); - } else if (version < V5SubVersion) + } else if (version < V5Latest) { rError("Invalid version %i - please fix config file", version); } else @@ -393,16 +380,16 @@ bool readV5Config( const char *configFile, try { config.set_revision(cfgRdr["subVersion"].readInt(0)); - if(config.revision() > V5SubVersion) + if(config.revision() > V5Latest) { /* config file specifies a version outside our supported range.. */ rWarning(_("Config subversion %i found, but this version of" " encfs only supports up to version %i."), - config.revision(), V5SubVersion); + config.revision(), V5Latest); return false; } - if( config.revision() < 20040813 ) + if( config.revision() < V5Latest ) { rError(_("This version of EncFS doesn't support " "filesystems created before 2004-08-13")); @@ -1053,7 +1040,7 @@ RootPtr createConfig( EncFS_Context *ctx, config.set_block_size( blockSize ); config.mutable_naming()->MergeFrom( nameIOIface ); config.set_creator( "EncFS " VERSION ); - config.set_revision( V6SubVersion ); + config.set_revision( ProtoSubVersion ); config.set_block_mac_bytes( blockMACBytes ); config.set_block_mac_rand_bytes( blockMACRandBytes ); config.set_unique_iv( uniqueIV ); @@ -1142,7 +1129,7 @@ RootPtr createConfig( EncFS_Context *ctx, fsConfig->cipher = cipher; fsConfig->key = volumeKey; fsConfig->nameCoding = nameCoder; - fsConfig->config = boost::shared_ptr(new EncfsConfig(config)); + fsConfig->config = shared_ptr(new EncfsConfig(config)); fsConfig->forceDecode = forceDecode; fsConfig->reverseEncryption = reverseEncryption; fsConfig->idleTracking = enableIdleTracking; @@ -1227,7 +1214,7 @@ void showFSInfo( const EncfsConfig &config ) } if(config.block_mac_bytes() || config.block_mac_rand_bytes()) { - if(config.revision() < 20040813) + if(config.revision() < V5Latest) { cout << autosprintf( // xgroup(diag) @@ -1636,7 +1623,7 @@ RootPtr initFS( EncFS_Context *ctx, const shared_ptr &opts ) fsConfig->cipher = cipher; fsConfig->key = volumeKey; fsConfig->nameCoding = nameCoder; - fsConfig->config = boost::shared_ptr(new EncfsConfig(config)); + fsConfig->config = shared_ptr(new EncfsConfig(config)); fsConfig->forceDecode = opts->forceDecode; fsConfig->reverseEncryption = opts->reverseEncryption; fsConfig->opts = opts; diff --git a/encfs/FileUtils.h b/encfs/FileUtils.h index c20fbab..483ae3f 100644 --- a/encfs/FileUtils.h +++ b/encfs/FileUtils.h @@ -44,15 +44,15 @@ class DirNode; struct EncFS_Root { - boost::shared_ptr cipher; + shared_ptr cipher; CipherKey volumeKey; - boost::shared_ptr root; + shared_ptr root; EncFS_Root(); ~EncFS_Root(); }; -typedef boost::shared_ptr RootPtr; +typedef shared_ptr RootPtr; enum ConfigMode { @@ -109,10 +109,10 @@ bool saveConfig( const std::string &rootdir, const EncfsConfig &config ); class EncFS_Context; -RootPtr initFS( EncFS_Context *ctx, const boost::shared_ptr &opts ); +RootPtr initFS( EncFS_Context *ctx, const shared_ptr &opts ); RootPtr createConfig( EncFS_Context *ctx, - const boost::shared_ptr &opts ); + const shared_ptr &opts ); void showFSInfo( const EncfsConfig &config ); diff --git a/encfs/MACFileIO.cpp b/encfs/MACFileIO.cpp index ac69ccc..4d6898c 100644 --- a/encfs/MACFileIO.cpp +++ b/encfs/MACFileIO.cpp @@ -31,8 +31,6 @@ using namespace rlog; using namespace std; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; static RLogChannel *Info = DEF_CHANNEL("info/MACFileIO", Log_Info); // diff --git a/encfs/MACFileIO.h b/encfs/MACFileIO.h index 4b6aac5..e8b4262 100644 --- a/encfs/MACFileIO.h +++ b/encfs/MACFileIO.h @@ -21,8 +21,6 @@ #include "BlockFileIO.h" #include "Cipher.h" -using boost::shared_ptr; - class MACFileIO : public BlockFileIO { public: diff --git a/encfs/Makefile.am b/encfs/Makefile.am index ba7c6c8..c2cd157 100644 --- a/encfs/Makefile.am +++ b/encfs/Makefile.am @@ -1,10 +1,9 @@ include $(top_srcdir)/Makefile.common -ALL_INCLUDES = @RLOG_CFLAGS@ @OPENSSL_CFLAGS@ @BOOST_CPPFLAGS@ +ALL_INCLUDES = @RLOG_CFLAGS@ @OPENSSL_CFLAGS@ ALL_INCLUDES += @PROTOBUF_CFLAGS@ -ALL_LDFLAGS = @RLOG_LIBS@ @OPENSSL_LIBS@ @BOOST_LDFLAGS@ -ALL_LDFLAGS += @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@ +ALL_LDFLAGS = @RLOG_LIBS@ @OPENSSL_LIBS@ ALL_LDFLAGS += @PROTOBUF_LIBS@ INCLUDES = $(all_includes) -I../intl @@ -50,9 +49,7 @@ endif # : +1 : => internal changes, nothing breaks # libencfs_la_LDFLAGS = -version-info 7:0:0 -libencfs_la_LIBADD = @RLOG_LIBS@ \ - @OPENSSL_LIBS@ \ - @BOOST_FILESYSTEM_LIB@ @BOOST_SYSTEM_LIB@ +libencfs_la_LIBADD = @RLOG_LIBS@ @OPENSSL_LIBS@ EXTRASRC = ../intl/autosprintf.cpp if BUILD_OPENSSL @@ -105,7 +102,6 @@ encfsctl_SOURCES = \ noinst_HEADERS = \ base64.h \ - boost-versioning.h \ BlockFileIO.h \ BlockNameIO.h \ CipherFileIO.h \ diff --git a/encfs/NameIO.h b/encfs/NameIO.h index 93f48a1..603d257 100644 --- a/encfs/NameIO.h +++ b/encfs/NameIO.h @@ -26,7 +26,6 @@ #include "Interface.h" #include "CipherKey.h" -using boost::shared_ptr; class Cipher; class NameIO diff --git a/encfs/NullCipher.cpp b/encfs/NullCipher.cpp index f70e077..18daff4 100644 --- a/encfs/NullCipher.cpp +++ b/encfs/NullCipher.cpp @@ -19,16 +19,14 @@ #include "Range.h" #include "Interface.h" +#include "shared_ptr.h" -#include #include #include using namespace std; using namespace rlog; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; static Interface NullInterface = makeInterface( "nullCipher", 1, 0, 0 ); diff --git a/encfs/NullNameIO.cpp b/encfs/NullNameIO.cpp index 8792e37..65733a9 100644 --- a/encfs/NullNameIO.cpp +++ b/encfs/NullNameIO.cpp @@ -22,8 +22,6 @@ #include -using boost::shared_ptr; - static shared_ptr NewNNIO( const Interface &, const shared_ptr &, const CipherKey & ) { diff --git a/encfs/SSL_Cipher.cpp b/encfs/SSL_Cipher.cpp index 98d5b27..3e00899 100644 --- a/encfs/SSL_Cipher.cpp +++ b/encfs/SSL_Cipher.cpp @@ -46,9 +46,6 @@ using namespace std; using namespace rel; using namespace rlog; -using boost::shared_ptr; -using boost::dynamic_pointer_cast; - const int MAX_KEYLENGTH = 32; // in bytes (256 bit) const int MAX_IVLENGTH = 16; const int KEY_CHECKSUM_BYTES = 4; diff --git a/encfs/SSL_Cipher.h b/encfs/SSL_Cipher.h index 5ea7f72..fd2a76f 100644 --- a/encfs/SSL_Cipher.h +++ b/encfs/SSL_Cipher.h @@ -28,8 +28,6 @@ struct evp_cipher_st; typedef struct evp_cipher_st EVP_CIPHER; #endif -using boost::shared_ptr; - /* Implements Cipher interface for OpenSSL's ciphers. diff --git a/encfs/StreamNameIO.h b/encfs/StreamNameIO.h index 2940ff3..3983db0 100644 --- a/encfs/StreamNameIO.h +++ b/encfs/StreamNameIO.h @@ -22,7 +22,6 @@ #include "CipherKey.h" class Cipher; -using boost::shared_ptr; class StreamNameIO : public NameIO { diff --git a/encfs/XmlReader.cpp b/encfs/XmlReader.cpp index f5b54a9..c318d95 100644 --- a/encfs/XmlReader.cpp +++ b/encfs/XmlReader.cpp @@ -27,8 +27,9 @@ #include #include #include -#include +#include +#include #include #include @@ -151,7 +152,7 @@ public: struct XmlReader::XmlReaderData { - boost::shared_ptr doc; + shared_ptr doc; }; XmlReader::XmlReader() diff --git a/encfs/XmlReader.h b/encfs/XmlReader.h index e538a66..497fc1e 100644 --- a/encfs/XmlReader.h +++ b/encfs/XmlReader.h @@ -21,11 +21,11 @@ #ifndef _XmlReader_incl_ #define _XmlReader_incl_ -#include #include +#include "shared_ptr.h" class XmlValue; -typedef boost::shared_ptr XmlValuePtr; +typedef shared_ptr XmlValuePtr; class XmlValue { @@ -72,7 +72,7 @@ public: private: struct XmlReaderData; - boost::shared_ptr pd; + shared_ptr pd; }; #endif diff --git a/encfs/boost-versioning.h b/encfs/boost-versioning.h deleted file mode 100644 index b3cfa51..0000000 --- a/encfs/boost-versioning.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef BOOST_VERSIONING_INCL -#define BOOST_VERSIONING_INCL - -// This header stores workaround code for dealing with incompatible changes -// made to boost archive/serialization classes. - - -#if (BOOST_VERSION <= 104100) -// Easy case, boost archive serial numbers are sizeof(int) -BOOST_CLASS_VERSION(EncFSConfig, V6SubVersion) -#else -// starting with boost 1.42, serial numbers change to 8-bit. However to make -// things tricker, the internal comparison is more like 16bit, which makes -// writing backward compatible code very tricky. - -// We make a partial specialization of the iserializer class to remove the -// version number checking which would otherwise cause boost::serialization to -// throw an exception if it came across a version that was greater then what -// we specify in BOOST_CLASS_VERSION below. Without this, manual editing -// of the file is needed before boost will allow us to read it. - -// See bug http://code.google.com/p/encfs/issues/detail?id=60 - -BOOST_CLASS_VERSION(EncFSConfig, 20) - - -namespace boost { -namespace archive { -namespace detail { - - -// Specialize iserializer class in order to get rid of version check -template -class iserializer : public basic_iserializer -{ -private: - virtual void destroy(/*const*/ void *address) const { - boost::serialization::access::destroy(static_cast(address)); - } -protected: - explicit iserializer() : - basic_iserializer( - boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation::type - >::get_const_instance() - ) - {} -public: - virtual BOOST_DLLEXPORT void load_object_data( - basic_iarchive & ar, - void *x, - const unsigned int file_version - ) const BOOST_USED; - virtual bool class_info() const { - return boost::serialization::implementation_level::value - >= boost::serialization::object_class_info; - } - virtual bool tracking(const unsigned int /* flags */) const { - return boost::serialization::tracking_level::value - == boost::serialization::track_always - || ( boost::serialization::tracking_level::value - == boost::serialization::track_selectively - && serialized_as_pointer()); - } - virtual version_type version() const { - return version_type(::boost::serialization::version::value); - } - virtual bool is_polymorphic() const { - return boost::is_polymorphic::value; - } - virtual ~iserializer(){}; -}; - -template -BOOST_DLLEXPORT void iserializer::load_object_data( - basic_iarchive & ar, - void *x, - const unsigned int file_version -) const { - boost::serialization::serialize_adl( - boost::serialization::smart_cast_reference(ar), - * static_cast(x), - file_version - ); -} - -} -} -} - -#endif - - - -#endif // BOOST_VERSIONING_INCL diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp index dac15bd..69f3dd7 100644 --- a/encfs/encfs.cpp +++ b/encfs/encfs.cpp @@ -41,14 +41,21 @@ #include #include -#include -#include +#if HAVE_TR1_TUPLE +#include +using namespace std; +using namespace std::tr1; +#else +#include +using namespace std; +#endif #include "DirNode.h" #include "MemoryPool.h" #include "FileUtils.h" #include "Mutex.h" #include "Context.h" +#include "shared_ptr.h" #include #include @@ -59,10 +66,8 @@ #define ESUCCESS 0 -using namespace std; using namespace rlog; using rel::Lock; -using namespace boost; #define GET_FN(ctx, finfo) ctx->getNode((void*)(uintptr_t)finfo->fh) @@ -165,16 +170,16 @@ int _do_getattr(FileNode *fnode, struct stat *stbuf) if(FSRoot) { // determine plaintext link size.. Easiest to read and decrypt.. - scoped_array buf(new char[stbuf->st_size+1]); + vector buf(stbuf->st_size+1, 0); - res = ::readlink( fnode->cipherName(), buf.get(), stbuf->st_size ); + res = ::readlink( fnode->cipherName(), &buf[0], stbuf->st_size ); if(res >= 0) { // other functions expect c-strings to be null-terminated, which // readlink doesn't provide buf[res] = '\0'; - stbuf->st_size = FSRoot->plainPath( buf.get() ).length(); + stbuf->st_size = FSRoot->plainPath( &buf[0] ).length(); res = ESUCCESS; } else @@ -363,8 +368,8 @@ int encfs_rmdir(const char *path) int _do_readlink(EncFS_Context *ctx, const string &cyName, tuple data ) { - char *buf = data.get<0>(); - size_t size = data.get<1>(); + char *buf = get<0>(data); + size_t size = get<1>(data); int res = ESUCCESS; shared_ptr FSRoot = ctx->getRoot(&res); @@ -500,7 +505,7 @@ int encfs_chmod(const char *path, mode_t mode) int _do_chown(EncFS_Context *, const string &cyName, tuple data) { - int res = lchown( cyName.c_str(), data.get<0>(), data.get<1>() ); + int res = lchown( cyName.c_str(), get<0>(data), get<1>(data) ); return (res == -1) ? -errno : ESUCCESS; } @@ -633,7 +638,7 @@ int encfs_release(const char *path, struct fuse_file_info *finfo) int _do_read(FileNode *fnode, tuple data) { - return fnode->read( data.get<2>(), data.get<0>(), data.get<1>()); + return fnode->read( get<2>(data), get<0>(data), get<1>(data)); } int encfs_read(const char *path, char *buf, size_t size, off_t offset, @@ -656,8 +661,8 @@ int encfs_fsync(const char *path, int dataSync, int _do_write(FileNode *fnode, tuple data) { - size_t size = data.get<1>(); - if(fnode->write( data.get<2>(), (unsigned char *)data.get<0>(), size )) + size_t size = get<1>(data); + if(fnode->write( get<2>(data), (unsigned char *)get<0>(data), size )) return size; else return -EIO; @@ -707,8 +712,8 @@ int _do_setxattr(EncFS_Context *, const string &cyName, tuple data) { int options = 0; - return ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(), - data.get<2>(), data.get<3>(), options ); + return ::setxattr( cyName.c_str(), get<0>(data), get<1>(data), + get<2>(data), get<3>(data), options ); } int encfs_setxattr( const char *path, const char *name, const char *value, size_t size, int flags, uint32_t position ) @@ -721,8 +726,8 @@ int encfs_setxattr( const char *path, const char *name, int _do_setxattr(EncFS_Context *, const string &cyName, tuple data) { - return ::setxattr( cyName.c_str(), data.get<0>(), data.get<1>(), - data.get<2>(), data.get<3>() ); + return ::setxattr( cyName.c_str(), get<0>(data), get<1>(data), + get<2>(data), get<3>(data) ); } int encfs_setxattr( const char *path, const char *name, const char *value, size_t size, int flags ) @@ -738,8 +743,8 @@ int _do_getxattr(EncFS_Context *, const string &cyName, tuple data) { int options = 0; - return ::getxattr( cyName.c_str(), data.get<0>(), - data.get<1>(), data.get<2>(), data.get<3>(), options ); + return ::getxattr( cyName.c_str(), get<0>(data), + get<1>(data), get<2>(data), get<3>(data), options ); } int encfs_getxattr( const char *path, const char *name, char *value, size_t size, uint32_t position ) @@ -751,8 +756,8 @@ int encfs_getxattr( const char *path, const char *name, int _do_getxattr(EncFS_Context *, const string &cyName, tuple data) { - return ::getxattr( cyName.c_str(), data.get<0>(), - data.get<1>(), data.get<2>()); + return ::getxattr( cyName.c_str(), get<0>(data), + get<1>(data), get<2>(data)); } int encfs_getxattr( const char *path, const char *name, char *value, size_t size ) @@ -768,10 +773,10 @@ int _do_listxattr(EncFS_Context *, const string &cyName, { #ifdef XATTR_ADD_OPT int options = 0; - int res = ::listxattr( cyName.c_str(), data.get<0>(), data.get<1>(), + int res = ::listxattr( cyName.c_str(), get<0>(data), get<1>(data), options ); #else - int res = ::listxattr( cyName.c_str(), data.get<0>(), data.get<1>() ); + int res = ::listxattr( cyName.c_str(), get<0>(data), get<1>(data) ); #endif return (res == -1) ? -errno : res; } diff --git a/encfs/encfsctl.cpp b/encfs/encfsctl.cpp index 6a5dd9f..c208769 100644 --- a/encfs/encfsctl.cpp +++ b/encfs/encfsctl.cpp @@ -45,8 +45,6 @@ #include "i18n.h" -#include - #ifdef HAVE_SSL #define NO_DES #include @@ -55,7 +53,6 @@ using namespace rlog; using namespace std; using namespace gnu; -using namespace boost; static int showInfo( int argc, char **argv ); @@ -472,8 +469,8 @@ static int copyLink(const struct stat &stBuf, const shared_ptr &rootInfo, const string &cpath, const string &destName ) { - scoped_array buf(new char[stBuf.st_size+1]); - int res = ::readlink( cpath.c_str(), buf.get(), stBuf.st_size ); + vector buf(stBuf.st_size+1, 0); + int res = ::readlink( cpath.c_str(), &buf[0], stBuf.st_size ); if(res == -1) { cerr << "unable to readlink of " << cpath << "\n"; @@ -481,7 +478,7 @@ static int copyLink(const struct stat &stBuf, } buf[res] = '\0'; - string decodedLink = rootInfo->root->plainPath(buf.get()); + string decodedLink = rootInfo->root->plainPath(&buf[0]); res = ::symlink( decodedLink.c_str(), destName.c_str() ); if(res == -1) diff --git a/encfs/main.cpp b/encfs/main.cpp index d20d00a..66911ca 100644 --- a/encfs/main.cpp +++ b/encfs/main.cpp @@ -33,9 +33,6 @@ #include -#include -#include - #include #include #include @@ -70,8 +67,6 @@ inline static int MAX(int a, int b) using namespace std; using namespace rlog; using namespace gnu; -using boost::shared_ptr; -using boost::scoped_ptr; // Maximum number of arguments that we're going to pass on to fuse. Doesn't // affect how many arguments we can handle, just how many we can pass on.. @@ -501,8 +496,8 @@ int main(int argc, char *argv[]) #endif // log to stderr by default.. - scoped_ptr slog( new StdioNode( STDERR_FILENO ) ); - scoped_ptr logNode; + shared_ptr slog( new StdioNode( STDERR_FILENO ) ); + shared_ptr logNode; // show error and warning output slog->subscribeTo( GetGlobalChannel("error") ); diff --git a/encfs/shared_ptr.h b/encfs/shared_ptr.h new file mode 100644 index 0000000..fd4fa8f --- /dev/null +++ b/encfs/shared_ptr.h @@ -0,0 +1,38 @@ + +/***************************************************************************** + * Author: Valient Gough + * + ***************************************************************************** + * Copyright (c) 2012 Valient Gough + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef _SHARED_PTR_incl_ +#define _SHARED_PTR_incl_ + +#include "config.h" + +#ifdef HAVE_TR1_MEMORY + #include + using std::tr1::shared_ptr; + using std::tr1::dynamic_pointer_cast; +#else + #include + using std::shared_ptr; + using std::dynamic_pointer_cast; +#endif + +#endif + diff --git a/encfs/test.cpp b/encfs/test.cpp index dbdf2ab..66ca7a0 100644 --- a/encfs/test.cpp +++ b/encfs/test.cpp @@ -20,8 +20,8 @@ #include "config.h" +#include #include - #include #include @@ -49,14 +49,17 @@ #include +#if HAVE_TR1_UNORDERED_SET #include - +using std::tr1::unordered_set; +#else +#include +using std::unordered_set; +#endif using namespace std; using namespace rlog; -using boost::shared_ptr; - const int FSBlockSize = 256; static @@ -171,7 +174,7 @@ bool testNameCoding( DirNode &dirNode, bool verbose, cerr << "Checking for name collections, this will take a while..\n"; // check for collision rate char buf[64]; - tr1::unordered_set encryptedNames; + unordered_set encryptedNames; for (long i=0; i < 10000000; i++) { snprintf(buf, sizeof(buf), "%li", i); diff --git a/m4/ax_boost_base.m4 b/m4/ax_boost_base.m4 deleted file mode 100644 index 2e5afd0..0000000 --- a/m4/ax_boost_base.m4 +++ /dev/null @@ -1,223 +0,0 @@ -# =========================================================================== -# http://autoconf-archive.cryp.to/ax_boost_base.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_BASE([MINIMUM-VERSION]) -# -# DESCRIPTION -# -# Test for the Boost C++ libraries of a particular version (or newer) -# -# If no path to the installed boost library is given the macro searchs -# under /usr, /usr/local, /opt and /opt/local and evaluates the -# $BOOST_ROOT environment variable. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) -# -# And sets: -# -# HAVE_BOOST -# -# LAST MODIFICATION -# -# 2008-04-12 -# -# COPYLEFT -# -# Copyright (c) 2008 Thomas Porschberg -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. - -AC_DEFUN([AX_BOOST_BASE], -[ -AC_ARG_WITH([boost], - AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ac_boost_path="" - else - want_boost="yes" - ac_boost_path="$withval" - fi - ], - [want_boost="yes"]) - - -AC_ARG_WITH([boost-libdir], - AS_HELP_STRING([--with-boost-libdir=LIB_DIR], - [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]), - [ - if test -d $withval - then - ac_boost_lib_path="$withval" - else - AC_MSG_ERROR(--with-boost-libdir expected directory name) - fi - ], - [ac_boost_lib_path=""] -) - -if test "x$want_boost" = "xyes"; then - boost_lib_version_req=ifelse([$1], ,1.20.0,$1) - boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'` - boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'` - boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'` - boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'` - if test "x$boost_lib_version_req_sub_minor" = "x" ; then - boost_lib_version_req_sub_minor="0" - fi - WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor` - AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req) - succeeded=no - - dnl first we check the system location for boost libraries - dnl this location ist chosen if boost libraries are installed with the --layout=system option - dnl or if you install boost with RPM - if test "$ac_boost_path" != ""; then - BOOST_LDFLAGS="-L$ac_boost_path/lib" - BOOST_CPPFLAGS="-I$ac_boost_path/include" - else - for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do - if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then - BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib" - BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include" - break; - fi - done - fi - - dnl overwrite ld flags if we have required special directory with - dnl --with-boost-libdir parameter - if test "$ac_boost_lib_path" != ""; then - BOOST_LDFLAGS="-L$ac_boost_lib_path" - fi - - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if BOOST_VERSION >= $WANT_BOOST_VERSION - // Everything is okay - #else - # error Boost version is too old - #endif - ]])],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[ - ]) - AC_LANG_POP([C++]) - - - - dnl if we found no boost with system layout we search for boost libraries - dnl built and installed without the --layout=system option or for a staged(not installed) version - if test "x$succeeded" != "xyes"; then - _version=0 - if test "$ac_boost_path" != ""; then - if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then - for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "$V_CHECK" = "1" ; then - _version=$_version_tmp - fi - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE" - done - fi - else - for ac_boost_path in /usr /usr/local /opt /opt/local ; do - if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then - for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do - _version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'` - V_CHECK=`expr $_version_tmp \> $_version` - if test "$V_CHECK" = "1" ; then - _version=$_version_tmp - best_path=$ac_boost_path - fi - done - fi - done - - VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'` - BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE" - if test "$ac_boost_lib_path" = "" - then - BOOST_LDFLAGS="-L$best_path/lib" - fi - - if test "x$BOOST_ROOT" != "x"; then - if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then - version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'` - stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'` - stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'` - V_CHECK=`expr $stage_version_shorten \>\= $_version` - if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then - AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT) - BOOST_CPPFLAGS="-I$BOOST_ROOT" - BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib" - fi - fi - fi - fi - - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_LANG_PUSH(C++) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - @%:@include - ]], [[ - #if BOOST_VERSION >= $WANT_BOOST_VERSION - // Everything is okay - #else - # error Boost version is too old - #endif - ]])],[ - AC_MSG_RESULT(yes) - succeeded=yes - found_system=yes - ],[ - ]) - AC_LANG_POP([C++]) - fi - - if test "$succeeded" != "yes" ; then - if test "$_version" = "0" ; then - AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation.]]) - else - AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).]) - fi - else - AC_SUBST(BOOST_CPPFLAGS) - AC_SUBST(BOOST_LDFLAGS) - AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available]) - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" -fi - -]) diff --git a/m4/ax_boost_filesystem.m4 b/m4/ax_boost_filesystem.m4 deleted file mode 100644 index 18df8f4..0000000 --- a/m4/ax_boost_filesystem.m4 +++ /dev/null @@ -1,118 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_filesystem.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_FILESYSTEM -# -# DESCRIPTION -# -# Test for Filesystem library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_FILESYSTEM_LIB) -# -# And sets: -# -# HAVE_BOOST_FILESYSTEM -# -# LICENSE -# -# Copyright (c) 2009 Thomas Porschberg -# Copyright (c) 2009 Michael Tindal -# Copyright (c) 2009 Roman Rybalko -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 22 - -AC_DEFUN([AX_BOOST_FILESYSTEM], -[ - AC_ARG_WITH([boost-filesystem], - AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@], - [use the Filesystem library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_filesystem_lib="" - else - want_boost="yes" - ax_boost_user_filesystem_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - LIBS_SAVED=$LIBS - LIBS="$LIBS $BOOST_SYSTEM_LIB" - export LIBS - - AC_CACHE_CHECK(whether the Boost::Filesystem library is available, - ax_cv_boost_filesystem, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[using namespace boost::filesystem; - path my_path( "foo/bar/data.txt" ); - return 0;]])], - ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_filesystem" = "xyes"; then - AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - if test "x$ax_boost_user_filesystem_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.so* $BOOSTLIBDIR/libboost_filesystem*.dylib* $BOOSTLIBDIR/libboost_filesystem*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - if test "x$link_filesystem" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - fi - else - for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break], - [link_filesystem="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_filesystem" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - LIBS="$LIBS_SAVED" - fi -]) diff --git a/m4/ax_boost_serialization.m4 b/m4/ax_boost_serialization.m4 deleted file mode 100644 index 47e955a..0000000 --- a/m4/ax_boost_serialization.m4 +++ /dev/null @@ -1,117 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_serialization.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_SERIALIZATION -# -# DESCRIPTION -# -# Test for Serialization library from the Boost C++ libraries. The macro -# requires a preceding call to AX_BOOST_BASE. Further documentation is -# available at . -# -# This macro calls: -# -# AC_SUBST(BOOST_SERIALIZATION_LIB) -# -# And sets: -# -# HAVE_BOOST_SERIALIZATION -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 18 - -AC_DEFUN([AX_BOOST_SERIALIZATION], -[ - AC_ARG_WITH([boost-serialization], - AS_HELP_STRING([--with-boost-serialization@<:@=special-lib@:>@], - [use the Serialization library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-serialization=boost_serialization-gcc-mt-d-1_33_1 ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_serialization_lib="" - else - want_boost="yes" - ax_boost_user_serialization_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - AC_MSG_WARN(BOOST_CPPFLAGS $BOOST_CPPFLAGS) - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::Serialization library is available, - ax_cv_boost_serialization, - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include - @%:@include - @%:@include - ]], - [[std::ofstream ofs("filename"); - boost::archive::text_oarchive oa(ofs); - return 0; - ]])], - ax_cv_boost_serialization=yes, ax_cv_boost_serialization=no) - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_serialization" = "xyes"; then - AC_DEFINE(HAVE_BOOST_SERIALIZATION,,[define if the Boost::Serialization library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - if test "x$ax_boost_user_serialization_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_serialization*.so* $BOOSTLIBDIR/libboost_serialization*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_serialization.*\)\.so.*$;\1;' -e 's;^lib\(boost_serialization.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break], - [link_serialization="no"]) - done - if test "x$link_serialization" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_serialization*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_serialization.*\)\.dll.*$;\1;' -e 's;^\(boost_serialization.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break], - [link_serialization="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_serialization_lib boost_serialization-$ax_boost_user_serialization_lib; do - AC_CHECK_LIB($ax_lib, main, - [BOOST_SERIALIZATION_LIB="-l$ax_lib"; AC_SUBST(BOOST_SERIALIZATION_LIB) link_serialization="yes"; break], - [link_serialization="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_serialization" != "xyes"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -]) diff --git a/m4/ax_boost_system.m4 b/m4/ax_boost_system.m4 deleted file mode 100644 index 7fbf6d3..0000000 --- a/m4/ax_boost_system.m4 +++ /dev/null @@ -1,120 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_boost_system.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BOOST_SYSTEM -# -# DESCRIPTION -# -# Test for System library from the Boost C++ libraries. The macro requires -# a preceding call to AX_BOOST_BASE. Further documentation is available at -# . -# -# This macro calls: -# -# AC_SUBST(BOOST_SYSTEM_LIB) -# -# And sets: -# -# HAVE_BOOST_SYSTEM -# -# LICENSE -# -# Copyright (c) 2008 Thomas Porschberg -# Copyright (c) 2008 Michael Tindal -# Copyright (c) 2008 Daniel Casimiro -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 14 - -AC_DEFUN([AX_BOOST_SYSTEM], -[ - AC_ARG_WITH([boost-system], - AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@], - [use the System library from boost - it is possible to specify a certain library for the linker - e.g. --with-boost-system=boost_system-gcc-mt ]), - [ - if test "$withval" = "no"; then - want_boost="no" - elif test "$withval" = "yes"; then - want_boost="yes" - ax_boost_user_system_lib="" - else - want_boost="yes" - ax_boost_user_system_lib="$withval" - fi - ], - [want_boost="yes"] - ) - - if test "x$want_boost" = "xyes"; then - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_BUILD]) - CPPFLAGS_SAVED="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS" - export CPPFLAGS - - LDFLAGS_SAVED="$LDFLAGS" - LDFLAGS="$LDFLAGS $BOOST_LDFLAGS" - export LDFLAGS - - AC_CACHE_CHECK(whether the Boost::System library is available, - ax_cv_boost_system, - [AC_LANG_PUSH([C++]) - CXXFLAGS_SAVE=$CXXFLAGS - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include ]], - [[boost::system::system_category]])], - ax_cv_boost_system=yes, ax_cv_boost_system=no) - CXXFLAGS=$CXXFLAGS_SAVE - AC_LANG_POP([C++]) - ]) - if test "x$ax_cv_boost_system" = "xyes"; then - AC_SUBST(BOOST_CPPFLAGS) - - AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available]) - BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'` - - LDFLAGS_SAVE=$LDFLAGS - if test "x$ax_boost_user_system_lib" = "x"; then - for libextension in `ls $BOOSTLIBDIR/libboost_system*.so* $BOOSTLIBDIR/libboost_system*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - if test "x$link_system" != "xyes"; then - for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do - ax_lib=${libextension} - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - fi - - else - for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do - AC_CHECK_LIB($ax_lib, exit, - [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break], - [link_system="no"]) - done - - fi - if test "x$ax_lib" = "x"; then - AC_MSG_ERROR(Could not find a version of the library!) - fi - if test "x$link_system" = "xno"; then - AC_MSG_ERROR(Could not link against $ax_lib !) - fi - fi - - CPPFLAGS="$CPPFLAGS_SAVED" - LDFLAGS="$LDFLAGS_SAVED" - fi -])