]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix build with native compilation but without zlib
authorEli Zaretskii <eliz@gnu.org>
Wed, 22 Sep 2021 16:13:49 +0000 (19:13 +0300)
committerEli Zaretskii <eliz@gnu.org>
Wed, 22 Sep 2021 16:13:49 +0000 (19:13 +0300)
* src/comp.c (comp_hash_source_file): Condition code that requires
zlib with HAVE_ZLIB.

* etc/NEWS: Explain that '--without-compress-install' is necessary
when configuring with native compilation but without zlib.

etc/NEWS
src/comp.c

index c18952d23896fea931557277ab1bf18a84ccfd9d..f273b8e82abe03de863034350dafe3a1656fe875 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -31,6 +31,11 @@ and also requires GCC and Binutils to be available when Lisp code is
 natively compiled.  See the Info node "(elisp) Native Compilation" for
 more details.
 
+If you build Emacs with native compilation, but without zlib, be sure
+to configure with the '--without-compress-install' option, so that the
+installed *.el files are not compressed; otherwise, you will not be
+able to use JIT native compilation of the installed *.el files.
+
 ** The Cairo graphics library is now used by default if present.
 '--with-cairo' is now the default, if the appropriate development files
 are found by 'configure'.  Note that building with Cairo means using
index e9635f219fdb4c5e6318e9dc4e22fd723cff92dd..bc1adcf4e2f7f43ad12dfc41d7c9d466910b0737 100644 (file)
@@ -705,6 +705,12 @@ comp_hash_source_file (Lisp_Object filename)
   /* Can't use Finsert_file_contents + Fbuffer_hash as this is called
      by Fcomp_el_to_eln_filename too early during bootstrap.  */
   bool is_gz = suffix_p (filename, ".gz");
+#ifndef HAVE_ZLIB
+  if (is_gz)
+    xsignal2 (Qfile_notify_error,
+             build_string ("Cannot natively compile compressed *.el files without zlib support"),
+             filename);
+#endif
   Lisp_Object encoded_filename = ENCODE_FILE (filename);
   FILE *f = emacs_fopen (SSDATA (encoded_filename), is_gz ? "rb" : "r");
 
@@ -713,9 +719,13 @@ comp_hash_source_file (Lisp_Object filename)
 
   Lisp_Object digest = make_uninit_string (MD5_DIGEST_SIZE * 2);
 
+#ifdef HAVE_ZLIB
   int res = is_gz
     ? md5_gz_stream (f, SSDATA (digest))
     : md5_stream (f, SSDATA (digest));
+#else
+  int res = md5_stream (f, SSDATA (digest));
+#endif
   fclose (f);
 
   if (res)