How to get rid of those warnings about byte-compile-dest-file-function
BLUF: Add
--eval '(require (quote bytecomp))'
to AM_ELCFLAGS
to get rid of those
Warning (bytecomp): Changing ‘byte-compile-dest-file’ is obsolete (as of 23.2);
when compiling Elisp with Automake.
Dunno if anyone out there is using Automake with an Elisp project, but if you are, you may have been plagued by a once-per-file warning like the following:
Warning (bytecomp): Changing ‘byte-compile-dest-file’ is obsolete (as of 23.2);
This is because Automake (at least as late as 1.16.5) produces make
rules like:
if test '/opt/emacsen/current/bin/emacs' != no; then \ am__dir=. am__subdir_includes=''; \ case indie-org-rss.elc in */*) \ am__dir=`echo 'indie-org-rss.elc' | sed 's,/[^/]*$,,'`; \ am__subdir_includes="-L $am__dir -L ./$am__dir"; \ esac; \ test -d "$am__dir" || /bin/mkdir -p "$am__dir" || exit 1; \ /opt/emacsen/current/bin/emacs --batch \ -L contrib --eval '(require (quote bytecomp))' \ $am__subdir_includes -L . -L . \ --eval '(if (boundp (quote byte-compile-dest-file-function)) (setq byte-compile-dest-file-function (lambda (_) "indie-org-rss.elc")) ( defun byte-compile-dest-file (_) "indie-org-rss.elc") )' \ -f batch-byte-compile 'indie-org-rss.el'; \ else :; fi
This is the salient bit:
(if (boundp (quote byte-compile-dest-file-function)) (setq byte-compile-dest-file-function (lambda (_) "indie-org-rss.elc")) (defun byte-compile-dest-file (_) "indie-org-rss.elc"))
This trips over the following code in bytecomp.el
:
;; Sadly automake relies on this misfeature up to at least version 1.15.1. (if (fboundp 'byte-compile-dest-file) (or (featurep 'bytecomp) (display-warning 'bytecomp (format-message "\ Changing `byte-compile-dest-file' is obsolete (as of 23.2); set `byte-compile-dest-file-function' instead."))) (defun byte-compile-dest-file (filename) ;; ... )
I wondered why byte-compile-dest-file
wasn't defined; turns out, it's defined in the bytecomp
package. Adding --eval '(require (quote bytecomp))'
to AM_ELCFLAGS
ensures it's defined before compilation.