From: Eli Zaretskii Date: Wed, 22 Sep 2021 16:13:49 +0000 (+0300) Subject: Fix build with native compilation but without zlib X-Git-Tag: emacs-28.0.90~739 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2386b085268af9c06aebc5c4aced1aa6a0d3f702;p=emacs.git 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. --- diff --git a/etc/NEWS b/etc/NEWS index c18952d2389..f273b8e82ab 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 e9635f219fd..bc1adcf4e2f 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)