]> granicus.if.org Git - curl/commitdiff
mkhelp: disable compression if the perl gzip module is unavailable
authorDan Fandrich <dan@coneharvesters.com>
Thu, 23 Mar 2017 20:11:41 +0000 (21:11 +0100)
committerDan Fandrich <dan@coneharvesters.com>
Thu, 23 Mar 2017 20:11:41 +0000 (21:11 +0100)
This is nowadays included with the base perl distribution, but wasn't
prior to about perl 5.14

src/mkhelp.pl

index 8b7f72157b2abf4eb44e5951a1e7dbccd9a14f6b..4b540744cc2c52931871d4bb7e1665d9753413b0 100644 (file)
@@ -113,8 +113,19 @@ print <<HEAD
 HEAD
     ;
 if($c) {
-    # if compressed
-    use IO::Compress::Gzip;
+    # If compression requested, check that the Gzip module is available
+    # or else disable compression
+    $c = eval
+    {
+      require IO::Compress::Gzip;
+      IO::Compress::Gzip->import();
+      1;
+    };
+    print STDERR "Warning: compression requested but Gzip is not available\n" if (!$c)
+}
+
+if($c)
+{
     my $content = join("", @out);
     my $gzippedContent;
     IO::Compress::Gzip::gzip(