The attached `git format-patch` is based on automake v1.16.5 and fixes
the following warning

    Warning (bytecomp): byte-compile-dest-file is obsolete (as of 23.2);
    Set byte-compile-dest-file-function instead.

The solution is to ensure bytecomp is loaded which defines
byte-compile-dest-file-function so it can be used when available,
and fallback to the original byte-compile-dest-file for earlier
GNU Emacs and XEmacs.

So far I've tested the result on

* CentOS 7.9 (distro emacs 24.3)
* OpenBSD 7.1 (custom emacs 28.2)
* OpenSUSE Leap 15.4 (distro emacs 27.2, xemacs 21.5)

and the warning is no longer generated.
From 2cc2732a76823886614724db729dc8e92ae23d9e Mon Sep 17 00:00:00 2001
From: Richard Hopkins <>
Date: Tue, 20 Sep 2022 22:02:32 +0100
Subject: [PATCH] Ensure `byte-compile-dest-file-function' is used when
 available

* lib/am/lisp.am (.el.elc): Require the bytecomp library so
byte-compile-dest-file-function can be used when available.

Without this change the byte compilation check in
am__emacs_byte_compile_setup would always fallback to the deprecated
byte-compile-dest-file instead and then show the following:

    Warning (bytecomp): byte-compile-dest-file is obsolete (as of 23.2);
    Set byte-compile-dest-file-function instead.

For example, using the original check on Emacs 28.2:

$ emacs --batch --eval \
    "(princ (boundp 'byte-compile-dest-file-function))"
=> nil

and using the new check:

$ emacs --batch -l bytecomp --eval \
    "(princ (boundp 'byte-compile-dest-file-function))"
=> t
---
 lib/am/lisp.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/am/lisp.am b/lib/am/lisp.am
index 11b5e5842..b40251f62 100644
--- a/lib/am/lisp.am
+++ b/lib/am/lisp.am
@@ -41,6 +41,7 @@ endif %?INSTALL%
 	  $(EMACS) --batch \
 	    $(AM_ELCFLAGS) $(ELCFLAGS) \
 	    $$am__subdir_includes -L $(builddir) -L $(srcdir) \
+	    -l bytecomp \
 	    --eval '$(am__emacs_byte_compile_setup)' \
 	    -f batch-byte-compile '$<'; \
 	else :; fi
-- 
2.37.3

Reply via email to