]> sjero.net Git - wget/commitdiff
Fix a linker error if zlib is not found.
authorGijs van Tulder <gvtulder@gmail.com>
Wed, 11 Jan 2012 14:27:06 +0000 (15:27 +0100)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Wed, 11 Jan 2012 14:27:06 +0000 (15:27 +0100)
ChangeLog
configure.ac
src/ChangeLog
src/init.c
src/main.c
src/warc.c

index 39f591fe6a777ecb67ec99e17a37386aff687fd5..a391a78686b370bce71002d04b3495472f6663c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-01-09  Gijs van Tulder  <gvtulder@gmail.com>
+
+       * configure.ac: Always try to use libz, even without SSL.
+
 2011-12-12  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * Makefile.am (EXTRA_DIST): Add build-aux/bzr-version-gen.
 2011-12-12  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * Makefile.am (EXTRA_DIST): Add build-aux/bzr-version-gen.
index 360f6c91aef5d14f44a4d7a569d81ce5a0aa1c22..647e44e353f0e32afb7f384b5eb0b8d18bc71f4e 100644 (file)
@@ -65,6 +65,9 @@ AC_ARG_WITH(ssl,
 [[  --without-ssl           disable SSL autodetection
   --with-ssl={gnutls,openssl} specify the SSL backend.  GNU TLS is the default.]])
 
 [[  --without-ssl           disable SSL autodetection
   --with-ssl={gnutls,openssl} specify the SSL backend.  GNU TLS is the default.]])
 
+AC_ARG_WITH(zlib,
+[[  --without-zlib          disable zlib ]])
+
 AC_ARG_ENABLE(opie,
 [  --disable-opie          disable support for opie or s/key FTP login],
 ENABLE_OPIE=$enableval, ENABLE_OPIE=yes)
 AC_ARG_ENABLE(opie,
 [  --disable-opie          disable support for opie or s/key FTP login],
 ENABLE_OPIE=$enableval, ENABLE_OPIE=yes)
@@ -234,6 +237,10 @@ dnl
 dnl Checks for libraries.
 dnl
 
 dnl Checks for libraries.
 dnl
 
+AS_IF([test x"$with_zlib" != xno], [
+  AC_CHECK_LIB(z, compress)
+])
+
 AS_IF([test x"$with_ssl" = xopenssl], [
     dnl some versions of openssl use zlib compression
     AC_CHECK_LIB(z, compress)
 AS_IF([test x"$with_ssl" = xopenssl], [
     dnl some versions of openssl use zlib compression
     AC_CHECK_LIB(z, compress)
index e58decb5ff8dfe7c4bcb30457c367751398cc9d5..141a47d42f821e2bd9c16109863ec4c8d7217894 100644 (file)
@@ -1,3 +1,10 @@
+2012-01-09  Gijs van Tulder  <gvtulder@gmail.com>
+
+       * init.c: Disable WARC compression if zlib is disabled.
+       * main.c: Do not show the 'no-warc-compression' option if zlib is
+       disabled.
+       * warc.c: Do not compress WARC files if zlib is disabled.
+
 2012-01-09  Sasikantha Babu   <sasikanth.v19@gmail.com> (tiny change)
        * connect.c (connect_to_ip): properly formatted ipv6 address display.
        (socket_family): New function - returns socket family type.
 2012-01-09  Sasikantha Babu   <sasikanth.v19@gmail.com> (tiny change)
        * connect.c (connect_to_ip): properly formatted ipv6 address display.
        (socket_family): New function - returns socket family type.
index 47fdea06c5f584bf8efb73c10330ad1b51599318..d2fba82cebda62d5e70f8b17e2f5a21eec481f43 100644 (file)
@@ -267,7 +267,9 @@ static const struct {
   { "waitretry",        &opt.waitretry,         cmd_time },
   { "warccdx",          &opt.warc_cdx_enabled,  cmd_boolean },
   { "warccdxdedup",     &opt.warc_cdx_dedup_filename,  cmd_file },
   { "waitretry",        &opt.waitretry,         cmd_time },
   { "warccdx",          &opt.warc_cdx_enabled,  cmd_boolean },
   { "warccdxdedup",     &opt.warc_cdx_dedup_filename,  cmd_file },
+#ifdef HAVE_LIBZ
   { "warccompression",  &opt.warc_compression_enabled, cmd_boolean },
   { "warccompression",  &opt.warc_compression_enabled, cmd_boolean },
+#endif
   { "warcdigests",      &opt.warc_digests_enabled, cmd_boolean },
   { "warcfile",         &opt.warc_filename,     cmd_file },
   { "warcheader",       NULL,                   cmd_spec_warc_header },
   { "warcdigests",      &opt.warc_digests_enabled, cmd_boolean },
   { "warcfile",         &opt.warc_filename,     cmd_file },
   { "warcheader",       NULL,                   cmd_spec_warc_header },
@@ -374,7 +376,11 @@ defaults (void)
   opt.show_all_dns_entries = false;
 
   opt.warc_maxsize = 0; /* 1024 * 1024 * 1024; */
   opt.show_all_dns_entries = false;
 
   opt.warc_maxsize = 0; /* 1024 * 1024 * 1024; */
+#ifdef HAVE_LIBZ
   opt.warc_compression_enabled = true;
   opt.warc_compression_enabled = true;
+#else
+  opt.warc_compression_enabled = false;
+#endif
   opt.warc_digests_enabled = true;
   opt.warc_cdx_enabled = false;
   opt.warc_cdx_dedup_filename = NULL;
   opt.warc_digests_enabled = true;
   opt.warc_cdx_enabled = false;
   opt.warc_cdx_dedup_filename = NULL;
index 2846735900da5bccadd9b7818fd28fbdcd270fb4..5aa528defbcbb0ef0b3cf30db3fb8ce4c6897c09 100644 (file)
@@ -289,7 +289,9 @@ static struct cmdline_option option_data[] =
     { "wait", 'w', OPT_VALUE, "wait", -1 },
     { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
     { "warc-cdx", 0, OPT_BOOLEAN, "warccdx", -1 },
     { "wait", 'w', OPT_VALUE, "wait", -1 },
     { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
     { "warc-cdx", 0, OPT_BOOLEAN, "warccdx", -1 },
+#ifdef HAVE_LIBZ
     { "warc-compression", 0, OPT_BOOLEAN, "warccompression", -1 },
     { "warc-compression", 0, OPT_BOOLEAN, "warccompression", -1 },
+#endif
     { "warc-dedup", 0, OPT_VALUE, "warccdxdedup", -1 },
     { "warc-digests", 0, OPT_BOOLEAN, "warcdigests", -1 },
     { "warc-file", 0, OPT_VALUE, "warcfile", -1 },
     { "warc-dedup", 0, OPT_VALUE, "warccdxdedup", -1 },
     { "warc-digests", 0, OPT_BOOLEAN, "warcdigests", -1 },
     { "warc-file", 0, OPT_VALUE, "warcfile", -1 },
@@ -674,8 +676,10 @@ WARC options:\n"),
        --warc-cdx                write CDX index files.\n"),
     N_("\
        --warc-dedup=FILENAME     do not store records listed in this CDX file.\n"),
        --warc-cdx                write CDX index files.\n"),
     N_("\
        --warc-dedup=FILENAME     do not store records listed in this CDX file.\n"),
+#ifdef HAVE_LIBZ
     N_("\
        --no-warc-compression     do not compress WARC files with GZIP.\n"),
     N_("\
        --no-warc-compression     do not compress WARC files with GZIP.\n"),
+#endif
     N_("\
        --no-warc-digests         do not calculate SHA1 digests.\n"),
     N_("\
     N_("\
        --no-warc-digests         do not calculate SHA1 digests.\n"),
     N_("\
index 680ac99775dd717605adc0c7c0fbaa5958242b34..a3cc81845a326c1db4a1b3787210a84fcdee7fd5 100644 (file)
@@ -14,7 +14,9 @@
 #include <sha1.h>
 #include <base32.h>
 #include <unistd.h>
 #include <sha1.h>
 #include <base32.h>
 #include <unistd.h>
+#ifdef HAVE_LIBZ
 #include <zlib.h>
 #include <zlib.h>
+#endif
 #ifdef HAVE_LIBUUID
 #include <uuid/uuid.h>
 #endif
 #ifdef HAVE_LIBUUID
 #include <uuid/uuid.h>
 #endif
@@ -42,6 +44,7 @@ static FILE *warc_manifest_fp;
 /* The current WARC file (or NULL, if WARC is disabled). */
 static FILE *warc_current_file;
 
 /* The current WARC file (or NULL, if WARC is disabled). */
 static FILE *warc_current_file;
 
+#ifdef HAVE_LIBZ
 /* The gzip stream for the current WARC file
    (or NULL, if WARC or gzip is disabled). */
 static gzFile *warc_current_gzfile;
 /* The gzip stream for the current WARC file
    (or NULL, if WARC or gzip is disabled). */
 static gzFile *warc_current_gzfile;
@@ -51,6 +54,7 @@ static size_t warc_current_gzfile_offset;
 
 /* The uncompressed size (so far) of the current record. */
 static size_t warc_current_gzfile_uncompressed_size;
 
 /* The uncompressed size (so far) of the current record. */
 static size_t warc_current_gzfile_uncompressed_size;
+# endif
 
 /* This is true until a warc_write_* method fails. */
 static bool warc_write_ok;
 
 /* This is true until a warc_write_* method fails. */
 static bool warc_write_ok;
@@ -105,12 +109,14 @@ warc_cmp_sha1_digest (const void *digest1, const void *digest2)
 static size_t
 warc_write_buffer (const char *buffer, size_t size)
 {
 static size_t
 warc_write_buffer (const char *buffer, size_t size)
 {
+#ifdef HAVE_LIBZ
   if (warc_current_gzfile)
     {
       warc_current_gzfile_uncompressed_size += size;
       return gzwrite (warc_current_gzfile, buffer, size);
     }
   else
   if (warc_current_gzfile)
     {
       warc_current_gzfile_uncompressed_size += size;
       return gzwrite (warc_current_gzfile, buffer, size);
     }
   else
+#endif
     return fwrite (buffer, 1, size, warc_current_file);
 }
 
     return fwrite (buffer, 1, size, warc_current_file);
 }
 
@@ -155,6 +161,7 @@ warc_write_start_record ()
   if (opt.warc_maxsize > 0 && ftell (warc_current_file) >= opt.warc_maxsize)
     warc_start_new_file (false);
 
   if (opt.warc_maxsize > 0 && ftell (warc_current_file) >= opt.warc_maxsize)
     warc_start_new_file (false);
 
+#ifdef HAVE_LIBZ
   /* Start a GZIP stream, if required. */
   if (opt.warc_compression_enabled)
     {
   /* Start a GZIP stream, if required. */
   if (opt.warc_compression_enabled)
     {
@@ -179,6 +186,7 @@ warc_write_start_record ()
           return false;
         }
     }
           return false;
         }
     }
+#endif
 
   warc_write_string ("WARC/1.0\r\n");
   return warc_write_ok;
 
   warc_write_string ("WARC/1.0\r\n");
   return warc_write_ok;
@@ -247,6 +255,7 @@ warc_write_end_record ()
 {
   warc_write_buffer ("\r\n\r\n", 4);
 
 {
   warc_write_buffer ("\r\n\r\n", 4);
 
+#ifdef HAVE_LIBZ
   /* We start a new gzip stream for each record.  */
   if (warc_write_ok && warc_current_gzfile)
     {
   /* We start a new gzip stream for each record.  */
   if (warc_write_ok && warc_current_gzfile)
     {
@@ -325,6 +334,7 @@ warc_write_end_record ()
       fflush (warc_current_file);
       fseek (warc_current_file, 0, SEEK_END);
     }
       fflush (warc_current_file);
       fseek (warc_current_file, 0, SEEK_END);
     }
+#endif /* HAVE_LIBZ */
 
   return warc_write_ok;
 }
 
   return warc_write_ok;
 }
@@ -687,7 +697,11 @@ warc_start_new_file (bool meta)
   char *new_filename = malloc (base_filename_length + 1 + 5 + 8 + 1);
   warc_current_filename = new_filename;
 
   char *new_filename = malloc (base_filename_length + 1 + 5 + 8 + 1);
   warc_current_filename = new_filename;
 
+#ifdef HAVE_LIBZ
   char *extension = (opt.warc_compression_enabled ? "warc.gz" : "warc");
   char *extension = (opt.warc_compression_enabled ? "warc.gz" : "warc");
+#else
+  char *extension = "warc";
+#endif
 
   /* If max size is enabled, we add a serial number to the file names. */
   if (meta)
 
   /* If max size is enabled, we add a serial number to the file names. */
   if (meta)