Remove USE_COMPRESSION and force the use of zlib, by Bo Peng (ben.bob@gmail.com)

* src/lyxlex_pimpl.[hC], src/buffer.C, src/tex2lyx/Makefile.am: remove USE_COMPRESSION
	* configure.ac: check for zlib.h and libz.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13765 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-04-27 18:14:36 +00:00
parent 18d72887a6
commit a19e4ae888
5 changed files with 4 additions and 35 deletions

View File

@ -272,25 +272,10 @@ LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
# Check the form of mkdir() # Check the form of mkdir()
AC_FUNC_MKDIR AC_FUNC_MKDIR
AC_ARG_ENABLE(compression-support, AC_HELP_STRING([--enable-compression-support],[Support for compressed files.]),[ # check for compression support
case "${enableval}" in AC_CHECK_HEADERS(zlib.h,
yes) use_compression=true ;; [AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_ERROR([zlib not found!]))],
no) use_compression=false ;; [LYX_ERROR([zlib.h not found!])])
*) AC_MSG_ERROR(bad value ${enableval} for --enable-compression-support) ;;
esac
],[use_compression=true])
if test $use_compression=true ; then
AC_CHECK_HEADERS(zlib.h, use_compression=true, use_compression=false)
AC_CHECK_LIB(z, gzopen,[use_compression=true;LIBS="$LIBS -lz"], use_compression=false)
if test $use_compression = true ; then
AC_DEFINE(USE_COMPRESSION, 1, [Define as 1 if you want to support compressed files.])
lyx_flags="compression $lyx_flags"
fi
fi
AM_CONDITIONAL(USE_COMPRESSION, test x$use_compression = xtrue)
AC_MSG_CHECKING([whether to support compressed files])
AC_MSG_RESULT($use_compression)
dnl This is a slight hack: the tests generated by autoconf 2.52 do not dnl This is a slight hack: the tests generated by autoconf 2.52 do not
dnl work correctly because of some conflict with stdlib.h with g++ 2.96 dnl work correctly because of some conflict with stdlib.h with g++ 2.96

View File

@ -68,12 +68,10 @@
#include "support/lyxalgo.h" #include "support/lyxalgo.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/fs_extras.h" #include "support/fs_extras.h"
#ifdef USE_COMPRESSION
# include <boost/iostreams/filtering_stream.hpp> # include <boost/iostreams/filtering_stream.hpp>
# include <boost/iostreams/filter/gzip.hpp> # include <boost/iostreams/filter/gzip.hpp>
# include <boost/iostreams/device/file.hpp> # include <boost/iostreams/device/file.hpp>
namespace io = boost::iostreams; namespace io = boost::iostreams;
#endif
#include "support/lyxlib.h" #include "support/lyxlib.h"
#include "support/os.h" #include "support/os.h"
#include "support/path.h" #include "support/path.h"
@ -737,15 +735,11 @@ bool Buffer::writeFile(string const & fname) const
bool retval = false; bool retval = false;
if (params().compressed) { if (params().compressed) {
#ifdef USE_COMPRESSION
io::filtering_ostream ofs(io::gzip_compressor() | io::file_sink(fname)); io::filtering_ostream ofs(io::gzip_compressor() | io::file_sink(fname));
if (!ofs) if (!ofs)
return false; return false;
retval = do_writeFile(ofs); retval = do_writeFile(ofs);
#else
return false;
#endif
} else { } else {
ofstream ofs(fname.c_str(), ios::out|ios::trunc); ofstream ofs(fname.c_str(), ios::out|ios::trunc);
if (!ofs) if (!ofs)

View File

@ -140,7 +140,6 @@ bool LyXLex::Pimpl::setFile(string const & filename)
if (format == "gzip" || format == "zip" || format == "compress") { if (format == "gzip" || format == "zip" || format == "compress") {
lyxerr[Debug::LYXLEX] << "lyxlex: compressed" << endl; lyxerr[Debug::LYXLEX] << "lyxlex: compressed" << endl;
#ifdef USE_COMPRESSION
// The check only outputs a debug message, because it triggers // The check only outputs a debug message, because it triggers
// a bug in compaq cxx 6.2, where is_open() returns 'true' for // a bug in compaq cxx 6.2, where is_open() returns 'true' for
// a fresh new filebuf. (JMarc) // a fresh new filebuf. (JMarc)
@ -153,9 +152,6 @@ bool LyXLex::Pimpl::setFile(string const & filename)
name = filename; name = filename;
lineno = 0; lineno = 0;
return gz_.component<io::file_source>(1)->is_open() && is.good(); return gz_.component<io::file_source>(1)->is_open() && is.good();
#else
return false;
#endif
} else { } else {
lyxerr[Debug::LYXLEX] << "lyxlex: UNcompressed" << endl; lyxerr[Debug::LYXLEX] << "lyxlex: UNcompressed" << endl;

View File

@ -14,12 +14,10 @@
#include "lyxlex.h" #include "lyxlex.h"
#ifdef USE_COMPRESSION
# include <boost/iostreams/filtering_streambuf.hpp> # include <boost/iostreams/filtering_streambuf.hpp>
# include <boost/iostreams/filter/gzip.hpp> # include <boost/iostreams/filter/gzip.hpp>
# include <boost/iostreams/device/file.hpp> # include <boost/iostreams/device/file.hpp>
namespace io = boost::iostreams; namespace io = boost::iostreams;
#endif
#include <boost/utility.hpp> #include <boost/utility.hpp>
@ -64,10 +62,8 @@ public:
/// fb_ is only used to open files, the stream is accessed through is. /// fb_ is only used to open files, the stream is accessed through is.
std::filebuf fb_; std::filebuf fb_;
#ifdef USE_COMPRESSION
/// gz_ is only used to open files, the stream is accessed through is. /// gz_ is only used to open files, the stream is accessed through is.
io::filtering_istreambuf gz_; io::filtering_istreambuf gz_;
#endif
/// the stream that we use. /// the stream that we use.
std::istream is; std::istream is;

View File

@ -20,9 +20,7 @@ AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
BOOST_LIBS = $(BOOST_REGEX) $(BOOST_FILESYSTEM) $(BOOST_IOSTREAMS) BOOST_LIBS = $(BOOST_REGEX) $(BOOST_FILESYSTEM) $(BOOST_IOSTREAMS)
if USE_COMPRESSION
COMPRESSIONLIB = -lz COMPRESSIONLIB = -lz
endif
LINKED_FILES = \ LINKED_FILES = \
FloatList.C \ FloatList.C \