emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2386b08: Fix build with native compilation but without zlib


From: Eli Zaretskii
Subject: master 2386b08: Fix build with native compilation but without zlib
Date: Wed, 22 Sep 2021 12:14:51 -0400 (EDT)

branch: master
commit 2386b085268af9c06aebc5c4aced1aa6a0d3f702
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix build with native compilation but without zlib
    
    * 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   |  5 +++++
 src/comp.c | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index c18952d..f273b8e 100644
--- 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
diff --git a/src/comp.c b/src/comp.c
index e9635f2..bc1adcf 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]