autoconf/lib/local.mk
Zack Weinberg 35a1c64600
Improve handling of missing aux scripts (autoreconf)
Make ‘autoreconf --install’ add config.sub, config.guess, and
install-sh to the source tree when necessary.  This is only relevant
for packages that don’t use Automake, because ‘automake --add-missing’
already adds these scripts to the source tree, but apparently there
are plenty of packages out there that don’t use Automake, didn’t need
config.{sub,guess} with autoconf 2.69, and do need them with 2.70.
Such packages will need to have their equivalent of ‘make dist’
manually updated to ship the new files, of course.

This patch also has ‘autoreconf’ issue an error if aux files are
missing and ‘--install’ *wasn’t* used, or if --install *was* used but
could not install all the missing files.  This error is more likely to
be caught by maintainers than the configure-time error added in the
previous patch.  It is not currently practical to make autoconf itself
issue this error message, because of how the autoconf wrapper script
is different from all the other wrapper scripts.  Also, autoreconf
runs automake *after* autoconf, so we’d get spurious errors from
packages that do use automake.

* bin/autoreconf.in ($buildauxdir): New package global, initialized
  to $pkgdatadir/build-aux, or to $ENV{autom4te_buildauxdir} if that’s set.
  (find_missing_aux_files, can_install_aux_files, try_install_aux_files)
  (install_aux_file, make_executable): New subs.
  (autoreconf_current_directory): Trace AC_REQUIRE_AUX_FILE.
  After running all tools that might install aux files, try to
  install aux files ourself if --install was given.
  After that, report on any that are still missing.
* lib/autom4te.in (Autoreconf-preselections): Add AC_REQUIRE_AUX_FILE.
  Make list order consistent with list order in autoreconf.in.
* tests/wrapper.as: Set autom4te_buildauxdir to point to location of
  config.guess, config.sub, and install-sh within the source tree.

* lib/local.mk: Install config.guess, config.sub, and install-sh
  into $(pkgdatadir)/build-aux.

* doc/autoconf.texi: Document that autoreconf can now install
  config.guess, config.sub, and install-sh itself without help from
  automake, but packages not using automake will need to arrange for
  tarball distribution of these files by hand.

* tests/torture.at (Missing auxiliary files): Test autoreconf as well.
2020-10-20 16:57:01 -04:00

209 lines
6.4 KiB
Makefile

# Make Autoconf-related libraries.
# Copyright (C) 2001-2005, 2009-2017, 2020 Free Software Foundation,
# Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ETAGS_ARGS += $(ETAGS_FOR_AUTOCONF)
TAGS_FILES = # Incrementally updated later.
# Additional checks.
check-local: check-forbidden-patterns
forbidden_patterns = -e '^_*EOF' -e ' cmp '
forbidden_patterns_files = # Incrementally updated later.
## ---------------------------------------------------------------- ##
## Auxiliary perl modules used by autom4te and other perl scripts. ##
## ---------------------------------------------------------------- ##
perllibdir = $(pkgdatadir)/Autom4te
dist_perllib_DATA = \
lib/Autom4te/C4che.pm \
lib/Autom4te/ChannelDefs.pm \
lib/Autom4te/Channels.pm \
lib/Autom4te/Config.pm \
lib/Autom4te/Configure_ac.pm \
lib/Autom4te/FileUtils.pm \
lib/Autom4te/General.pm \
lib/Autom4te/Getopt.pm \
lib/Autom4te/Request.pm \
lib/Autom4te/XFile.pm
TAGS_FILES += $(dist_perllib_DATA)
# Note: ETAGS_ARGS should have already been extended to handle perl files.
## ------------------------------------------ ##
## Make Autom4te default configuration file. ##
## ------------------------------------------ ##
nodist_pkgdata_DATA = lib/autom4te.cfg
EXTRA_DIST += lib/autom4te.in
# All the files below depend on Makefile so that they are rebuilt
# when the prefix, etc. changes. Unfortunately, suffix rules
# cannot have additional dependencies, so we have to use explicit rules.
CLEANFILES += lib/autom4te.cfg
lib/autom4te.cfg: $(srcdir)/lib/autom4te.in Makefile
rm -f $@ $@-t
$(MKDIR_P) $(@D)
$(edit) $(srcdir)/lib/autom4te.in >$@-t
chmod a-w $@-t
mv -f $@-t $@
## ----------------------------- ##
## Make Autoconf Emacs library. ##
## ----------------------------- ##
dist_lisp_LISP = lib/emacs/autoconf-mode.el lib/emacs/autotest-mode.el
# TODO: This is required to work around a limitation in older
# Automake. Remove once we can assume Automake 1.13 or later.
CLEANFILES += autoconf-mode.elc autotest-mode.elc
## ----------------------- ##
## Make Autoconf library. ##
## ----------------------- ##
autoconflibdir = $(pkgdatadir)/autoconf
dist_autoconflib_DATA = \
lib/autoconf/autoconf.m4 \
lib/autoconf/general.m4 \
lib/autoconf/status.m4 \
lib/autoconf/oldnames.m4 \
lib/autoconf/specific.m4 \
lib/autoconf/autoheader.m4 \
lib/autoconf/autoupdate.m4 \
lib/autoconf/autotest.m4 \
lib/autoconf/autoscan.m4 \
lib/autoconf/lang.m4 \
lib/autoconf/c.m4 \
lib/autoconf/erlang.m4 \
lib/autoconf/fortran.m4 \
lib/autoconf/functions.m4 \
lib/autoconf/go.m4 \
lib/autoconf/headers.m4 \
lib/autoconf/types.m4 \
lib/autoconf/libs.m4 \
lib/autoconf/programs.m4 \
lib/autoconf/trailer.m4
nodist_autoconflib_DATA = lib/autoconf/autoconf.m4f
CLEANFILES += $(nodist_autoconflib_DATA)
TAGS_FILES += $(dist_autoconflib_DATA)
forbidden_patterns_files += $(dist_autoconflib_DATA)
lib/autoconf/autoconf.m4f: $(autoconf_m4f_dependencies)
## ------------------------ ##
## Make Autoscan library. ##
## ------------------------ ##
autoscanlibdir = $(pkgdatadir)/autoscan
EXTRA_DIST += lib/autoscan/autoscan.pre
nodist_autoscanlib_DATA = lib/autoscan/autoscan.list
CLEANFILES += lib/autoscan/autoscan.list
lib/autoscan/autoscan.list: $(srcdir)/lib/autoscan/autoscan.pre
$(MKDIR_P) $(@D)
echo '# Automatically Generated: do not edit this file' >$@
sed '/^[#]/!q' $(srcdir)/lib/autoscan/autoscan.pre >>$@
( \
sed -n '/^[^#]/p' $(srcdir)/lib/autoscan/autoscan.pre; \
$(MY_AUTOM4TE) --cache '' -M -l autoconf-without-aclocal-m4 \
-t'AN_OUTPUT:$$1: $$2 $$3' \
) | LC_ALL=C sort >>$@
lib/autoscan/autoscan.list: $(autoconf_m4f_dependencies) Makefile
## ----------------------------------- ##
## Make Autoconf library for M4sugar. ##
## ----------------------------------- ##
m4sugarlibdir = $(pkgdatadir)/m4sugar
dist_m4sugarlib_DATA = \
lib/m4sugar/m4sugar.m4 \
lib/m4sugar/foreach.m4 \
lib/m4sugar/m4sh.m4
nodist_m4sugarlib_DATA = \
lib/m4sugar/version.m4 \
lib/m4sugar/m4sugar.m4f \
lib/m4sugar/m4sh.m4f
CLEANFILES += $(nodist_m4sugarlib_DATA)
# The ':;' in the second line of the recipe works around a redirected
# compound command bash exit status bug.
lib/m4sugar/version.m4: Makefile
$(MKDIR_P) $(@D)
:;{ \
echo '# This file is part of -*- Autoconf -*-.' && \
echo '# Version of Autoconf.' && \
echo '# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007, 2009' && \
echo '# Free Software Foundation, Inc.' && \
echo &&\
echo 'm4_define([m4_PACKAGE_NAME], [$(PACKAGE_NAME)])' && \
echo 'm4_define([m4_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])' && \
echo 'm4_define([m4_PACKAGE_VERSION], [$(PACKAGE_VERSION)])' && \
echo 'm4_define([m4_PACKAGE_STRING], [$(PACKAGE_STRING)])' && \
echo 'm4_define([m4_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])' && \
echo 'm4_define([m4_PACKAGE_URL], [$(PACKAGE_URL)])' && \
echo 'm4_define([m4_PACKAGE_YEAR], [$(RELEASE_YEAR)])'; \
} > $@-t
mv $@-t $@
TAGS_FILES += $(dist_m4sugarlib_DATA)
forbidden_patterns_files += $(dist_m4sugarlib_DATA)
lib/m4sugar/m4sugar.m4f: $(m4sugar_m4f_dependencies)
lib/m4sugar/m4sh.m4f: $(m4sh_m4f_dependencies)
## ----------------------- ##
## Make Autotest library. ##
## ----------------------- ##
autotestlibdir = $(pkgdatadir)/autotest
dist_autotestlib_DATA = \
lib/autotest/autotest.m4 \
lib/autotest/general.m4 \
lib/autotest/specific.m4
nodist_autotestlib_DATA = lib/autotest/autotest.m4f
CLEANFILES += $(nodist_autotestlib_DATA)
TAGS_FILES += $(dist_autotestlib_DATA)
forbidden_patterns_files += $(dist_autotestlib_DATA)
lib/autotest/autotest.m4f: $(autotest_m4f_dependencies)
## --------------------------- ##
## Install auxiliary scripts. ##
## --------------------------- ##
buildauxdir = $(pkgdatadir)/build-aux
dist_buildaux_SCRIPTS = \
build-aux/config.guess \
build-aux/config.sub \
build-aux/install-sh