From 5e73ad8fbd8a56fd7394d9510fa94bdd6db65948 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Mon, 28 Jul 2003 23:05:58 +0000 Subject: [PATCH] some more compression stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7433 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 4 ++++ config/ChangeLog | 4 ++++ config/lyxinclude.m4 | 6 +++--- configure.ac | 23 ++++++++++++++++++++--- src/buffer.C | 4 +++- src/support/ChangeLog | 4 ++++ src/support/Makefile.am | 9 ++++++--- 7 files changed, 44 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5562248fff..3f63e9b59e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-07-29 Lars Gullik Bjønnes + + * configure.ac: compression support + 2003-07-28 Lars Gullik Bjønnes * configure.ac: check for zlib. diff --git a/config/ChangeLog b/config/ChangeLog index 468392ac3a..b0a9fcf37c 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,7 @@ +2003-07-29 Lars Gullik Bjønnes + + * lyxinclude.m4: use AC_HELP_STRING + 2003-07-27 Lars Gullik Bjønnes * configure.ac,configure.in,lyxinclude213.m4,relyx_configure.ac,relyx_configure.in: delete file diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index f37f8f9c6b..45fcc0f489 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -162,7 +162,7 @@ AC_PROG_CXX ### We might want to get or shut warnings. AC_ARG_ENABLE(warnings, - [ --enable-warnings tell the compiler to display more warnings],, + AC_HELP_STRING([--enable-warnings],[tell the compiler to display more warnings]),, [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then enable_warnings=yes; else @@ -177,7 +177,7 @@ fi ### We might want to disable debug AC_ARG_ENABLE(debug, - [ --enable-debug enable debug information],, + AC_HELP_STRING([--enable-debug],[enable debug information]),, [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes && test $ac_cv_prog_gxx = yes ; then enable_debug=yes; else @@ -186,7 +186,7 @@ AC_ARG_ENABLE(debug, ### set up optimization AC_ARG_ENABLE(optimization, - [ --enable-optimization[=value] enable compiler optimisation],, + AC_HELP_STRING([--enable-optimization[=value]],[enable compiler optimisation]),, enable_optimization=yes;) case $enable_optimization in yes) lyx_opt=-O;; diff --git a/configure.ac b/configure.ac index 20ee166268..865ee9413e 100644 --- a/configure.ac +++ b/configure.ac @@ -78,7 +78,7 @@ LYX_CXX_STL_MODERN_STREAMS ### and now some special lyx flags. AC_ARG_ENABLE(assertions, - [ --enable-assertions add runtime sanity checks in the program],, + AC_HELP_STRING([--enable-assertions],[add runtime sanity checks in the program]),, [if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then enable_assertions=yes; else @@ -246,8 +246,25 @@ LYX_CHECK_DECL(vsnprintf, stdio.h) LYX_CHECK_DECL(istreambuf_iterator, iterator) LYX_CHECK_DECL(mkstemp,[unistd.h stdlib.h]) -AC_CHECK_HEADERS(zlib.h) -AC_CHECK_LIB(z, gzopen) +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_COMRESSION, 1, [Define as 1 if you want to supprot compressed files.]) + lyx_flags="$lyx_flags compression" + 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 work correctly because of some conflict with stdlib.h with g++ 2.96 diff --git a/src/buffer.C b/src/buffer.C index 3c82bc2f48..eea4099fed 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -483,6 +483,8 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, // the first token _must_ be... if (token != "\\lyxformat") { + lyxerr << "Token: " << token << endl; + Alert::error(_("Document format failure"), _("The specified document is not a LyX document.")); return false; @@ -522,7 +524,7 @@ bool Buffer::readFile(LyXLex & lex, string const & filename, return false; } command += " -t" - +tostr(LYX_FORMAT) + ' ' + + tostr(LYX_FORMAT) + ' ' + QuoteName(filename); lyxerr[Debug::INFO] << "Running '" << command << '\'' diff --git a/src/support/ChangeLog b/src/support/ChangeLog index f8f3627e32..a593ccdd36 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,7 @@ +2003-07-29 Lars Gullik Bjønnes + + * Makefile.am: contidionalize USE_COMPRESSION + 2003-07-28 Lars Gullik Bjønnes * filetools.C (getExtFromContents): correct magic for gzip and diff --git a/src/support/Makefile.am b/src/support/Makefile.am index fa803b8d81..5aad3bc1fb 100644 --- a/src/support/Makefile.am +++ b/src/support/Makefile.am @@ -14,6 +14,10 @@ if USE_LYXSTRING LYXSTRING = lyxstring.C lyxstring.h endif +if USE_COMPRESSION +COMPRESSION = gzstream.C gzstream.C +endif + BUILT_SOURCES = path_defines.C libsupport_la_SOURCES = \ @@ -46,9 +50,7 @@ libsupport_la_SOURCES = \ forkedcontr.C \ forkedcontr.h \ getcwd.C \ - gzstream.C \ - gzstream.h \ - kill.C \ + $(COMPRESSION) kill.C \ limited_stack.h \ lstrings.C \ lstrings.h \ @@ -66,6 +68,7 @@ libsupport_la_SOURCES = \ path.C \ path.h \ path_defines.C \ + path_defines.h \ putenv.C \ rename.C \ rmdir.C \ -- 2.39.2