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/branches/BRANCH_1_4_X@13780 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2006-04-28 16:35:50 +00:00
parent 25f1d0553f
commit 03b848f567
7 changed files with 10 additions and 40 deletions

View File

@ -253,25 +253,10 @@ LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h])
# Check the form of mkdir()
AC_FUNC_MKDIR
AC_ARG_ENABLE(compression-support, AC_HELP_STRING([--enable-compression-support],[Support for compressed files.]),[
case "${enableval}" in
yes) use_compression=true ;;
no) use_compression=false ;;
*) 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)
# check for compression support
AC_CHECK_HEADERS(zlib.h,
[AC_CHECK_LIB(z, gzopen, [LIBS="$LIBS -lz"], LYX_ERROR([zlib not found!]))],
[LYX_ERROR([zlib.h not found!])])
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

View File

@ -67,9 +67,7 @@
#include "support/lyxalgo.h"
#include "support/filetools.h"
#include "support/fs_extras.h"
#ifdef USE_COMPRESSION
# include "support/gzstream.h"
#endif
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/path.h"
@ -734,15 +732,11 @@ bool Buffer::writeFile(string const & fname) const
bool retval = false;
if (params().compressed) {
#ifdef USE_COMPRESSION
gz::ogzstream ofs(fname.c_str(), ios::out|ios::trunc);
if (!ofs)
return false;
retval = do_writeFile(ofs);
#else
return false;
#endif
} else {
ofstream ofs(fname.c_str(), ios::out|ios::trunc);
if (!ofs)

View File

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

View File

@ -14,9 +14,7 @@
#include "lyxlex.h"
#ifdef USE_COMPRESSION
# include "support/gzstream.h"
#endif
#include <boost/utility.hpp>
@ -61,10 +59,8 @@ public:
/// fb_ is only used to open files, the stream is accessed through is.
std::filebuf fb_;
#ifdef USE_COMPRESSION
/// gz_ is only used to open files, the stream is accessed through is.
gz::gzstreambuf gz_;
#endif
/// the stream that we use.
std::istream is;

View File

@ -9,10 +9,6 @@ EXTRA_DIST = package.C.in pch.h \
noinst_LTLIBRARIES = libsupport.la
if USE_COMPRESSION
COMPRESSION = gzstream.C gzstream.h
endif
BUILT_SOURCES = $(PCH_FILE) package.C
AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
@ -46,7 +42,9 @@ libsupport_la_SOURCES = \
fs_extras.C \
fs_extras.h \
getcwd.C \
$(COMPRESSION) kill.C \
gzstream.C \
gzstream.h \
kill.C \
limited_stack.h \
lstrings.C \
lstrings.h \

View File

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

View File

@ -95,6 +95,9 @@ What's new
- Fix the code to find interface localization under Windows and Mac OS X.
- remove --enable-compression-support option of configure. Compression
support via zlib is now a requirement.
- When compiling with --with-version-suffix under windows, do not
rename the executable files.