From 36ee783a1000b5a1e52b81e5564de19ffb99fd37 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 3 Apr 2012 22:02:55 +0200
Subject: texi: info files can be generated in the builddir
User can now ask info files to be built in the $(builddir), rather than
the $(srcdir), by specifying the Automake option 'info-in-builddir'.
This feature was requested by the developers of GCC, GDB, GNU binutils
and the GNU bfd library. See the extensive discussion about automake
bug#11034 for more details.
OK, to be honest, having '.info' files built in the builddir was
*already* possible, but only using ugly and undocumented hacks involving
definition of the CLEANFILES and/or DISTCLEANFILES. For example, the
binutils project did something like this in the relevant 'Makefile.am':
# Automake 1.9 will only build info files in the objdir if they are
# mentioned in DISTCLEANFILES. It doesn't have to be unconditional,
# though, so we use a bogus condition.
if GENINSRC_NEVER
DISTCLEANFILES = binutils.info
endif
See also the extensive discussion about automake bug#11034; in
particular, the following messages:
* lib/Automake/Options.pm (_is_valid_easy_option): Recognize the
new 'info-in-builddir' option.
* automake.in (handle_texinfo_helper): If that option is set,
initialize '$insrc' to '0', so that info files will be generated
in the builddir. Adjust comments to match.
* t/txinfo-builddir.sh: New test.
* t/list-of-tests.mk: Add it.
* NEWS: Update.
* doc/automake.texi: Document the new options.
Signed-off-by: Stefano Lattarini
---
NEWS | 9 ++++
automake.in | 38 +++++++++------
doc/automake.texi | 13 +++++
lib/Automake/Options.pm | 1 +
t/list-of-tests.mk | 1 +
t/txinfo-builddir.sh | 127 ++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 174 insertions(+), 15 deletions(-)
create mode 100755 t/txinfo-builddir.sh
diff --git a/NEWS b/NEWS
index c5b6514c0..804805ef9 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,15 @@ New in 1.13.2:
should take precedence over the same-named automake-provided macro
(defined in '/usr/local/share/aclocal-1.14/vala.m4').
+* Texinfo support:
+
+ - Automake can now be instructed to place '.info' files generated from
+ Texinfo input in the builddir rather than in the srcdir; this is done
+ specifying the new automake option 'info-in-builddir'. This feature
+ was requested by the developers of GCC, GDB, GNU binutils and the GNU
+ bfd library. See the extensive discussion about automake bug#11034
+ for more details.
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New in 1.13.1:
diff --git a/automake.in b/automake.in
index 076425869..e56ea65bb 100644
--- a/automake.in
+++ b/automake.in
@@ -3269,23 +3269,31 @@ sub handle_texinfo_helper ($)
# have a single variable ($INSRC) that controls whether
# the current .info file must be built in the source tree
# or in the build tree. Actually this variable is switched
- # off for .info files that appear to be cleaned; this is
- # for backward compatibility with package such as Texinfo,
- # which do things like
- # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
- # DISTCLEANFILES = texinfo texinfo-* info*.info*
- # # Do not create info files for distribution.
- # dist-info:
- # in order not to distribute .info files.
- my $insrc = ($out_file =~ $user_cleaned_files) ? 0 : 1;
-
- my $soutdir = '$(srcdir)/' . $outdir;
- $outdir = $soutdir if $insrc;
+ # off in two cases:
+ # (1) For '.info' files that appear to be cleaned; this is for
+ # backward compatibility with package such as Texinfo,
+ # which do things like
+ # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
+ # DISTCLEANFILES = texinfo texinfo-* info*.info*
+ # # Do not create info files for distribution.
+ # dist-info:
+ # in order not to distribute .info files.
+ # (2) When the undocumented option 'info-in-builddir' is given.
+ # This is done to allow the developers of GCC, GDB, GNU
+ # binutils and the GNU bfd library to force the '.info' files
+ # to be generated in the builddir rather than the srcdir, as
+ # was once done when the (now removed) 'cygnus' option was
+ # given. See automake bug#11034 for more discussion.
+ my $insrc = 1;
+ $insrc = 0 if $out_file =~ $user_cleaned_files;
+ $insrc = 0 if option 'info-in-builddir';
+
+ $outdir = '$(srcdir)/' . $outdir if $insrc;
# If user specified file_TEXINFOS, then use that as explicit
# dependency list.
@texi_deps = ();
- push (@texi_deps, "$soutdir$vtexi") if $vtexi;
+ push (@texi_deps, "$outdir$vtexi") if $vtexi;
my $canonical = canonicalize ($infobase);
if (var ($canonical . "_TEXINFOS"))
@@ -3339,8 +3347,8 @@ sub handle_texinfo_helper ($)
new Automake::Location,
TEXI => $texi,
VTI => $vti,
- STAMPVTI => "${soutdir}stamp-$vti",
- VTEXI => "$soutdir$vtexi",
+ STAMPVTI => "${outdir}stamp-$vti",
+ VTEXI => "$outdir$vtexi",
MDDIR => $conf_dir,
DIRSTAMP => $dirstamp);
}
diff --git a/doc/automake.texi b/doc/automake.texi
index b4dad5c08..443f65a18 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -7830,6 +7830,11 @@ install} (unless you use @option{no-installinfo}, see below).
Furthermore, @file{.info} files are automatically distributed so that
Texinfo is not a prerequisite for installing your package.
+It is worth noting that, contrary to what happens with the other formats,
+the generated @file{.info} files are by default placed in @code{srcdir}
+rather than in the @code{builddir}. This can be changed with the
+@option{info-in-builddir} option.
+
@trindex dvi
@trindex html
@trindex pdf
@@ -10069,6 +10074,14 @@ options below. This option should be used in the top-level
@file{configure.ac}, it will be ignored otherwise. It will also be
ignored in sub-packages of nested packages (@pxref{Subpackages}).
+@item @option{info-in-builddir}
+@cindex Option, @option{info-in-builddir}
+@opindex info-in-builddir
+Instruct Automake to place the generated @file{.info} files in the
+@code{builddir} rather than in the @code{srcdir}. Note that this
+might make VPATH builds with some non-GNU make implementations more
+brittle.
+
@item @option{no-define}
@cindex Option, @option{no-define}
@opindex no-define
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 3674920bd..39327981a 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -276,6 +276,7 @@ sub _is_valid_easy_option ($)
dist-tarZ
dist-xz
dist-zip
+ info-in-builddir
no-define
no-dependencies
no-dist
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 591b4f0fd..71487e9c5 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1162,6 +1162,7 @@ t/tests-environment-and-log-compiler.sh \
t/txinfo-absolute-srcdir-pr408.sh \
t/txinfo-add-missing-and-dist.sh \
t/txinfo-bsd-make-recurs.sh \
+t/txinfo-builddir.sh \
t/txinfo-clean.sh \
t/txinfo-dvi-recurs.sh \
t/txinfo-info-in-srcdir.sh \
diff --git a/t/txinfo-builddir.sh b/t/txinfo-builddir.sh
new file mode 100755
index 000000000..148a1a687
--- /dev/null
+++ b/t/txinfo-builddir.sh
@@ -0,0 +1,127 @@
+#! /bin/sh
+# Copyright (C) 2012 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 2, 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 .
+
+# Check that info files are built in builddir when needed.
+# This test that this can be done through the so far undocumented
+# option 'info-in-builddir', as requested by at least GCC, GDB,
+# GNU binutils and the GNU bfd library. See automake bug#11034.
+
+required='makeinfo tex texi2dvi'
+. test-init.sh
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = info-in-builddir
+info_TEXINFOS = foo.texi subdir/bar.texi mu.texi
+subdir_bar_TEXINFOS = subdir/inc.texi
+CLEANFILES = mu.info
+
+# mu.info should not be rebuilt in the current directory, since
+# it's up-to-date in $(srcdir).
+# This can be caused by a subtle issue related to VPATH handling
+# of version.texi (see also the comment in texi-vers.am): because
+# stamp-vti is newer than version.texi, the 'version.texi: stamp-vti'
+# rule is always triggered. Still that's not a reason for 'make'
+# to think 'version.texi' has been created...
+check-local:
+ test ! -e mu.info
+ test -f ../mu.info
+END
+
+mkdir subdir
+
+cat > foo.texi << 'END'
+\input texinfo
+@setfilename foo.info
+@settitle foo
+@node Top
+Hello walls.
+@include version.texi
+@bye
+END
+
+cat > mu.texi << 'END'
+\input texinfo
+@setfilename mu.info
+@settitle mu
+@node Top
+Mu mu mu.
+@bye
+END
+
+cat > subdir/bar.texi << 'END'
+\input texinfo
+@setfilename bar.info
+@settitle bar
+@node Top
+Hello walls.
+@include inc.texi
+@bye
+END
+
+echo "I'm included." > subdir/inc.texi
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+$MAKE info
+test -f foo.info
+test -f subdir/bar.info
+test -f mu.info
+test -f stamp-vti
+test -f version.texi
+test ! -e ../foo.info
+test ! -e ../subdir/bar.info
+test ! -e ../mu.info
+test ! -e ../stamp-vti
+test ! -e ../version.texi
+$MAKE clean
+test -f foo.info
+test -f subdir/bar.info
+test ! -e mu.info
+test -f stamp-vti
+test -f version.texi
+
+# Make sure stamp-vti is older that version.texi.
+# (A common situation in a real tree).
+$sleep
+touch stamp-vti
+
+$MAKE distcheck
+# Being distributed, this file should have been rebuilt.
+test -f mu.info
+
+$MAKE distclean
+test -f stamp-vti
+test -f version.texi
+test -f foo.info
+test -f subdir/bar.info
+test ! -e mu.info
+
+../configure
+$MAKE maintainer-clean
+test ! -e stamp-vti
+test ! -e version.texi
+test ! -e foo.info
+test ! -e subdir/bar.info
+test ! -e mu.info
+
+:
--
cgit v1.2.1
From c1a8f56295d9c1621c65de28400cd1d93f037063 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 2 Jan 2013 00:33:42 +0100
Subject: texi: deprecate hack about info files in CLEANFILES variables
For quite a long time, Automake has been implementing an undocumented
hack which ensured that '.info' files which appeared to be cleaned (by
e.g. being listed in the CLEANFILES or DISTCLEANFILES variables) were
built in the builddir rather than in the srcdir; this hack was introduced
to ensure better backward-compatibility with packages such as Texinfo,
which did things like:
info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
DISTCLEANFILES = texinfo texinfo-* info*.info*
# Do not create info files for distribution.
dist-info:
@:
in order not to distribute .info files.
Now that we have the 'info-in-builddir' option that explicitly causes
generated '.info' files to be placed in the builddir, this hack should
be longer necessary, so we deprecate it with runtime warnings. It is
scheduled to be removed altogether in Automake 1.14.
* automake.in (handle_texinfo_helper): Raise proper runtime warnings
if the hack is triggered.
* NEWS: Update.
* t/txinfo28.sh: Adjust.
* t/txinfo23.sh: Likewise.
* t/txinfo25.sh: Adjust and extend.
* t/txinfo24.sh: Likewise.
Signed-off-by: Stefano Lattarini
---
NEWS | 20 ++++++++++++++++++++
automake.in | 15 +++++++++++++++
t/txinfo23.sh | 5 ++++-
t/txinfo24.sh | 2 +-
t/txinfo25.sh | 7 ++++++-
t/txinfo28.sh | 2 +-
6 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 804805ef9..6fd1c7569 100644
--- a/NEWS
+++ b/NEWS
@@ -58,6 +58,26 @@ New in 1.13.2:
bfd library. See the extensive discussion about automake bug#11034
for more details.
+ - For quite a long time, Automake has been implementing an undocumented
+ hack which ensured that '.info' files which appeared to be cleaned
+ (by e.g. being listed in the CLEANFILES or DISTCLEANFILES variables)
+ were built in the builddir rather than in the srcdir; this hack was
+ introduced to ensure better backward-compatibility with packages such
+ as Texinfo, which did things like:
+
+ info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
+ DISTCLEANFILES = texinfo texinfo-* info*.info*
+ # Do not create info files for distribution.
+ dist-info:
+ @:
+
+ in order not to distribute generated '.info' files.
+
+ Now that we have the 'info-in-builddir' option that explicitly causes
+ generated '.info' files to be placed in the builddir, this hack should
+ be longer necessary, so we deprecate it with runtime warnings. It will
+ likely be removed altogether in Automake 1.14.
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New in 1.13.1:
diff --git a/automake.in b/automake.in
index e56ea65bb..fe7f4594e 100644
--- a/automake.in
+++ b/automake.in
@@ -3140,6 +3140,21 @@ sub handle_texinfo_helper ($)
my @f = ();
push @f, $d->value_as_list_recursive (inner_expand => 1) if $d;
push @f, $c->value_as_list_recursive (inner_expand => 1) if $c;
+ if (@f && !option 'info-in-builddir')
+ {
+ msg 'obsolete', "$am_file.am", <
Date: Wed, 2 Jan 2013 21:08:27 +0100
Subject: maint: add some of my maintainer-specific scripts
They are likely not general enough for widespread use, but they
are useful nonetheless.
In the best-case scenario, they will start to be used by other
people, and thus accordingly improved and made more general and
flexible.
In the worst case scenario, well, I still get to keep them in a
centralized, blessed place, simplifying the deployment and use
of them; so still a win for me :-)
* maint/am-ft: New script.
* maint/am-xft: Likewise.
* maint/rename-tests: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
Signed-off-by: Stefano Lattarini
---
Makefile.am | 9 +++++
maint/am-ft | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++
maint/am-xft | 3 ++
maint/rename-tests | 52 +++++++++++++++++++++++++
4 files changed, 173 insertions(+)
create mode 100755 maint/am-ft
create mode 100755 maint/am-xft
create mode 100755 maint/rename-tests
diff --git a/Makefile.am b/Makefile.am
index 030c2eb6a..f6db092f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -679,3 +679,12 @@ EXTRA_DIST += \
old/ChangeLog.09 \
old/ChangeLog.11 \
old/TODO
+
+## ---------------------------------------- ##
+## Maintainer-specific files and scripts. ##
+## ---------------------------------------- ##
+
+EXTRA_DIST += \
+ maint/am-ft \
+ maint/am-xft \
+ maint/rename-tests
diff --git a/maint/am-ft b/maint/am-ft
new file mode 100755
index 000000000..d8a2722be
--- /dev/null
+++ b/maint/am-ft
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+# Remote testing of Automake tarballs made easy.
+# This script requires Bash 4.x or later.
+# TODO: some documentation would be nice ...
+
+set -u
+me=${0##*/}
+
+fatal () { echo "$me: $*" >&2; exit 1; }
+
+cmd='
+ test_script=$HOME/.am-test/run
+ if test -f "$test_script" && test -x "$test_script"; then
+ "$test_script" "$@"
+ else
+ nice -n19 ./configure && nice -n19 make -j10 check
+ fi
+'
+
+remote=
+interactive=1
+while test $# -gt 0; do
+ case $1 in
+ -b|--batch) interactive=0;;
+ -c|--command) cmd=${2-}; shift;;
+ -*) fatal "'$1': invalid option";;
+ *) remote=$1; shift; break;;
+ esac
+ shift
+done
+[[ -n $remote ]] || fatal "no remote given"
+
+if ((interactive)); then
+ do_on_error='{
+ AM_TESTSUITE_FAILED=yes
+ export AM_TESTSUITE_FAILED
+ # We should not modify the environment with which the failed
+ # tests have run, hence do not read ".profile", ".bashrc", and
+ # company.
+ exec bash --noprofile --norc -i
+ }'
+else
+ do_on_error='exit $?'
+fi
+
+tarball=$(echo automake*.tar.xz)
+
+case $tarball in
+ *' '*) fatal "too many automake tarballs: $tarball";;
+esac
+
+test -f $tarball || fatal "no automake tarball found"
+
+distdir=${tarball%%.tar.xz}
+
+env='PATH=$HOME/bin:$PATH'
+if test -t 1; then
+ env+=" TERM='$TERM' AM_COLOR_TESTS=always"
+fi
+
+# This is tempting:
+# $ ssh "command" arg-1 ... arg-2
+# but doesn't work as expected. So we need the following hack
+# to propagate the command line arguments to the remote shell.
+quoted_args=--
+while (($# > 0)); do
+ case $1 in
+ *\'*) quoted_args+=" "$(printf '%s\n' "$1" | sed "s/'/'\\''/g");;
+ *) quoted_args+=" '$1'";;
+ esac
+ shift
+done
+
+set -e
+set -x
+
+scp $tarball $remote:tmp/
+
+# Multiple '-t' to force tty allocation.
+ssh -t -t $remote "
+ set -x; set -e; set -u;
+ set $quoted_args
+ cd tmp
+ if test -e $distdir; then
+ # Use 'perl', not only 'rm -rf', to correctly handle read-only
+ # files or directory. Fall back to 'rm' if something goes awry.
+ perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
+ || rm -rf $distdir || exit 1
+ test ! -e $distdir
+ fi
+ xz -dc $tarball | tar xf -
+ cd $distdir
+ "'
+ am_extra_acdir=$HOME/.am-test/extra-aclocal
+ am_extra_bindir=$HOME/.am-test/extra-bin
+ am_extra_setup=$HOME/.am-test/extra-setup.sh
+ if test -d "$am_extra_acdir"; then
+ export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
+ fi
+ if test -d "$am_extra_bindir"; then
+ export PATH=$am_extra_bindir:$PATH
+ fi
+ '"
+ export $env
+ if test -f \"\$am_extra_setup\"; then
+ . \"\$am_extra_setup\"
+ fi
+ ($cmd) || $do_on_error
+"
diff --git a/maint/am-xft b/maint/am-xft
new file mode 100755
index 000000000..564aa3b02
--- /dev/null
+++ b/maint/am-xft
@@ -0,0 +1,3 @@
+#!/bin/sh
+MAKE=${MAKE-make} GIT=${GIT-git}
+$GIT clean -fdx && $MAKE bootstrap && $MAKE dist && exec am-ft "$@"
diff --git a/maint/rename-tests b/maint/rename-tests
new file mode 100755
index 000000000..6fce9fe84
--- /dev/null
+++ b/maint/rename-tests
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# Convenience script to rename test cases in Automake.
+
+set -e -u
+
+me=${0##*/}
+fatal () { echo "$me: $*" >&2; exit 1; }
+
+case $# in
+ 0) input=$(cat);;
+ 1) input=$(cat -- "$1");;
+ *) fatal "too many arguments";;
+esac
+
+AWK=${AWK-awk}
+SED=${SED-sed}
+
+[[ -f automake.in && -d lib/Automake ]] \
+ || fatal "can only be run from the top-level of the Automake source tree"
+
+$SED --version 2>&1 | grep GNU >/dev/null 2>&1 \
+ || fatal "GNU sed is required by this script"
+
+# Validate and cleanup input.
+input=$(
+ $AWK -v me="$me" "
+ /^#/ { next; }
+ (NF == 0) { next; }
+ (NF != 2) { print me \": wrong number of fields at line \" NR;
+ exit(1); }
+ { printf (\"t/%s t/%s\\n\", \$1, \$2); }
+ " <<<"$input")
+
+# Prepare git commit message.
+exec 5>$me.git-msg
+echo "tests: more significant names for some tests" >&5
+echo >&5
+$AWK >&5 <<<"$input" \
+ '{ printf ("* %s: Rename...\n* %s: ... like this.\n", $1, $2) }'
+exec 5>&-
+
+# Rename tests.
+eval "$($AWK '{ printf ("git mv %s %s\n", $1, $2) }' <<<"$input")"
+
+# Adjust the list of tests (do this conditionally, since such a
+# list is not required nor used in Automake-NG.
+if test -f t/list-of-tests.mk; then
+ $SED -e "$($AWK '{ printf ("s|^%s |%s |\n", $1, $2) }' <<<"$input")" \
+ -i t/list-of-tests.mk
+fi
+
+git status
--
cgit v1.2.1
From 8288e78b83af0bdd660fdf1f8b0682e5a3d2b49d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 2 Jan 2013 21:59:43 +0100
Subject: tests: more significant names for some tests
* t/spy.sh: Rename...
* t/spy-double-colon.sh: ... like this.
* t/yacc4.sh: Rename...
* t/yacc-misc.sh: ... like this.
* t/yaccdry.sh: Rename...
* t/yacc-dry.sh: ... like this.
* t/yaccpp.sh: Rename...
* t/yacc-cxx-grepping.sh: ... like this.
* t/yaccvpath.sh: Rename...
* t/yacc-vpath.sh: ... like this.
Signed-off-by: Stefano Lattarini
---
t/list-of-tests.mk | 10 ++---
t/spy-double-colon.sh | 106 +++++++++++++++++++++++++++++++++++++++++++++++++
t/spy.sh | 106 -------------------------------------------------
t/yacc-cxx-grepping.sh | 81 +++++++++++++++++++++++++++++++++++++
t/yacc-dry.sh | 58 +++++++++++++++++++++++++++
t/yacc-misc.sh | 86 +++++++++++++++++++++++++++++++++++++++
t/yacc-vpath.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++
t/yacc4.sh | 86 ---------------------------------------
t/yaccdry.sh | 58 ---------------------------
t/yaccpp.sh | 81 -------------------------------------
t/yaccvpath.sh | 97 --------------------------------------------
11 files changed, 433 insertions(+), 433 deletions(-)
create mode 100755 t/spy-double-colon.sh
delete mode 100755 t/spy.sh
create mode 100755 t/yacc-cxx-grepping.sh
create mode 100755 t/yacc-dry.sh
create mode 100755 t/yacc-misc.sh
create mode 100755 t/yacc-vpath.sh
delete mode 100755 t/yacc4.sh
delete mode 100755 t/yaccdry.sh
delete mode 100755 t/yaccpp.sh
delete mode 100755 t/yaccvpath.sh
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 2a042efb0..67578fbf8 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -991,7 +991,7 @@ t/spell.sh \
t/spell2.sh \
t/spell3.sh \
t/spelling.sh \
-t/spy.sh \
+t/spy-double-colon.sh \
t/spy-rm.tap \
t/stdinc.sh \
t/stamph2.sh \
@@ -1236,10 +1236,10 @@ t/werror3.sh \
t/werror4.sh \
t/whoami.sh \
t/xsource.sh \
-t/yacc4.sh \
-t/yaccdry.sh \
-t/yaccpp.sh \
-t/yaccvpath.sh \
+t/yacc-misc.sh \
+t/yacc-dry.sh \
+t/yacc-cxx-grepping.sh \
+t/yacc-vpath.sh \
t/yacc-auxdir.sh \
t/yacc-basic.sh \
t/yacc-cxx.sh \
diff --git a/t/spy-double-colon.sh b/t/spy-double-colon.sh
new file mode 100755
index 000000000..6ca3d0f77
--- /dev/null
+++ b/t/spy-double-colon.sh
@@ -0,0 +1,106 @@
+#! /bin/sh
+# Copyright (C) 2003-2013 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 2, 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 .
+
+# Check whether double colon rules work. The Unix V7 make manual
+# mentions double-colon rules, but POSIX does not. They seem to be
+# supported by all Make implementation as far as we can tell. This test
+# case is a spy: we want to detect if there exist implementations where
+# these do not work. We might use these rules to simplify the rebuild
+# rules (instead of the $? hack).
+
+# Tom Tromey write:
+# | In the distant past we used :: rules extensively.
+# | Fran?ois convinced me to get rid of them:
+# |
+# | Thu Nov 23 18:02:38 1995 Tom Tromey
+# | [ ... ]
+# | * subdirs.am: Removed "::" rules
+# | * header.am, libraries.am, mans.am, texinfos.am, footer.am:
+# | Removed "::" rules
+# | * scripts.am, programs.am, libprograms.am: Removed "::" rules
+# |
+# |
+# | I no longer remember the rationale for this. It may have only been a
+# | belief that they were unportable.
+
+# On a related topic, the Autoconf manual has the following text:
+# | 'VPATH' and double-colon rules
+# | Any assignment to 'VPATH' causes Sun 'make' to only execute
+# | the first set of double-colon rules. (This comment has been
+# | here since 1994 and the context has been lost. It's probably
+# | about SunOS 4. If you can reproduce this, please send us a
+# | test case for illustration.)
+
+# We already know that overlapping ::-rule like
+#
+# a :: b
+# echo rule1 >> $@
+# a :: c
+# echo rule2 >> $@
+# a :: b c
+# echo rule3 >> $@
+#
+# do not work equally on all platforms. It seems that in all cases
+# Make attempts to run all matching rules. However at least GNU Make,
+# NetBSD Make, and FreeBSD Make will detect that $@ was updated by the
+# first matching rule and skip remaining matches (with the above
+# example that means that unless 'a' was declared PHONY, only "rule1"
+# will be appended to 'a' if both b and c have changed). Other
+# implementations like OSF1 Make and HP-UX Make do not perform such a
+# check and execute all matching rules whatever they do ("rule1",
+# "rule2", abd "rule3" will all be appended to 'a' if b and c have
+# changed).
+
+# So it seems only non-overlapping ::-rule may be portable. This is
+# what we check now.
+
+. test-init.sh
+
+cat >Makefile <<\EOF
+a :: b
+ echo rule1 >> $@
+a :: c
+ echo rule2 >> $@
+EOF
+
+touch b c
+$sleep
+: > a
+$MAKE
+test x"$(cat a)" = x
+$sleep
+touch b
+$MAKE
+test "$(cat a)" = "rule1"
+# Ensure a is strictly newer than b, so HP-UX make does not execute rule2.
+$sleep
+: > a
+$sleep
+touch c
+$MAKE
+test "$(cat a)" = "rule2"
+
+# Unfortunately, the following is not portable to FreeBSD/NetBSD/OpenBSD
+# make, see explanation above.
+
+#: > a
+#$sleep
+#touch b c
+#$MAKE
+#grep rule1 a
+#grep rule2 a
+
+:
diff --git a/t/spy.sh b/t/spy.sh
deleted file mode 100755
index 6ca3d0f77..000000000
--- a/t/spy.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003-2013 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 2, 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 .
-
-# Check whether double colon rules work. The Unix V7 make manual
-# mentions double-colon rules, but POSIX does not. They seem to be
-# supported by all Make implementation as far as we can tell. This test
-# case is a spy: we want to detect if there exist implementations where
-# these do not work. We might use these rules to simplify the rebuild
-# rules (instead of the $? hack).
-
-# Tom Tromey write:
-# | In the distant past we used :: rules extensively.
-# | Fran?ois convinced me to get rid of them:
-# |
-# | Thu Nov 23 18:02:38 1995 Tom Tromey
-# | [ ... ]
-# | * subdirs.am: Removed "::" rules
-# | * header.am, libraries.am, mans.am, texinfos.am, footer.am:
-# | Removed "::" rules
-# | * scripts.am, programs.am, libprograms.am: Removed "::" rules
-# |
-# |
-# | I no longer remember the rationale for this. It may have only been a
-# | belief that they were unportable.
-
-# On a related topic, the Autoconf manual has the following text:
-# | 'VPATH' and double-colon rules
-# | Any assignment to 'VPATH' causes Sun 'make' to only execute
-# | the first set of double-colon rules. (This comment has been
-# | here since 1994 and the context has been lost. It's probably
-# | about SunOS 4. If you can reproduce this, please send us a
-# | test case for illustration.)
-
-# We already know that overlapping ::-rule like
-#
-# a :: b
-# echo rule1 >> $@
-# a :: c
-# echo rule2 >> $@
-# a :: b c
-# echo rule3 >> $@
-#
-# do not work equally on all platforms. It seems that in all cases
-# Make attempts to run all matching rules. However at least GNU Make,
-# NetBSD Make, and FreeBSD Make will detect that $@ was updated by the
-# first matching rule and skip remaining matches (with the above
-# example that means that unless 'a' was declared PHONY, only "rule1"
-# will be appended to 'a' if both b and c have changed). Other
-# implementations like OSF1 Make and HP-UX Make do not perform such a
-# check and execute all matching rules whatever they do ("rule1",
-# "rule2", abd "rule3" will all be appended to 'a' if b and c have
-# changed).
-
-# So it seems only non-overlapping ::-rule may be portable. This is
-# what we check now.
-
-. test-init.sh
-
-cat >Makefile <<\EOF
-a :: b
- echo rule1 >> $@
-a :: c
- echo rule2 >> $@
-EOF
-
-touch b c
-$sleep
-: > a
-$MAKE
-test x"$(cat a)" = x
-$sleep
-touch b
-$MAKE
-test "$(cat a)" = "rule1"
-# Ensure a is strictly newer than b, so HP-UX make does not execute rule2.
-$sleep
-: > a
-$sleep
-touch c
-$MAKE
-test "$(cat a)" = "rule2"
-
-# Unfortunately, the following is not portable to FreeBSD/NetBSD/OpenBSD
-# make, see explanation above.
-
-#: > a
-#$sleep
-#touch b c
-#$MAKE
-#grep rule1 a
-#grep rule2 a
-
-:
diff --git a/t/yacc-cxx-grepping.sh b/t/yacc-cxx-grepping.sh
new file mode 100755
index 000000000..079014673
--- /dev/null
+++ b/t/yacc-cxx-grepping.sh
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Copyright (C) 1997-2013 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 2, 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 .
+
+# Test to make sure Yacc + C++ is not obviously broken.
+# See also related tests 'yacc-cxx.sh' and 'yacc-d-cxx.sh',
+# which does much more in-depth checks (but requires an actual
+# Yacc program and a working C++ compiler).
+
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+foo_SOURCES = foo.y++
+bar_SOURCES = bar.ypp
+baz_SOURCES = baz.yy
+qux_SOURCES = qux.yxx
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+$EGREP '(\.[ch]|foo|bar|baz|qux)' Makefile.in # For debugging.
+
+$EGREP '(foo|bar|baz|qux)\.h' Makefile.in && exit 1
+
+sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
+
+$FGREP ' foo.c++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' baz.cc ' mk
+$FGREP ' qux.cxx ' mk
+
+cat >> Makefile.am <mk
+
+$FGREP ' foo.c++ ' mk
+$FGREP ' foo.h++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' bar.hpp ' mk
+$FGREP ' baz.cc ' mk
+$FGREP ' baz.hh ' mk
+
+$EGREP '(^| )foo\.h\+\+(:| .*:)' Makefile.in
+$EGREP '(^| )bar\.hpp(:| .*:)' Makefile.in
+$EGREP '(^| )baz\.hh(:| .*:)' Makefile.in
+
+grep ' foo\.h[ :]' mk && exit 1
+grep ' bar\.h[ :]' mk && exit 1
+grep ' baz\.h[ :]' mk && exit 1
+
+$FGREP ' qux-qux.cxx ' mk
+$EGREP '(^| )qux-qux\.cxx(:| .*:)' Makefile.in
+grep 'qux\.h.*:' Makefile.in && exit 1
+
+:
diff --git a/t/yacc-dry.sh b/t/yacc-dry.sh
new file mode 100755
index 000000000..79cf490ae
--- /dev/null
+++ b/t/yacc-dry.sh
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2010-2013 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 2, 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 .
+
+# Removal recovery rules for headers should not remove files with 'make -n'.
+
+required='cc yacc'
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_YFLAGS = -d
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c parse.y
+END
+
+cat > foo.c << 'END'
+int main () { return 0; }
+END
+
+cat > parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure
+$MAKE
+
+rm -f parse.h
+$MAKE -n parse.h
+test -f parse.c
+test ! -e parse.h
+
+:
diff --git a/t/yacc-misc.sh b/t/yacc-misc.sh
new file mode 100755
index 000000000..bdadd648e
--- /dev/null
+++ b/t/yacc-misc.sh
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2001-2013 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 2, 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 .
+
+# Some simple tests of ylwrap functionality.
+
+required='cc yacc'
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = parse.y foo.c
+bar_SOURCES = bar.y foo.c
+END
+
+# First parser.
+cat > parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+# Second parser.
+cat > bar.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cat > foo.c << 'END'
+int main (void)
+{
+ return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+test -f ylwrap
+
+mkdir sub
+cd sub
+
+../configure
+$MAKE
+
+grep '^#.*/sub/\.\./' bar.c && exit 1
+grep '^#.*/sub/\.\./' parse.c && exit 1
+
+# Make distclean must not erase bar.c nor parse.c (by GNU standards) ...
+$MAKE distclean
+test -f bar.c
+test -f parse.c
+# ... but maintainer-clean should.
+../configure
+$MAKE maintainer-clean
+test ! -e bar.c
+test ! -e parse.c
+
+:
diff --git a/t/yacc-vpath.sh b/t/yacc-vpath.sh
new file mode 100755
index 000000000..bd123374f
--- /dev/null
+++ b/t/yacc-vpath.sh
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2001-2013 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 2, 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 .
+
+# This test checks that dependent files are updated before including
+# in the distribution. 'parse.c' depends on 'parse.y'. The later is
+# updated so that 'parse.c' should be rebuild. Then we are running
+# 'make' and 'make distdir' and check whether the version of 'parse.c'
+# to be distributed is up to date.
+
+# Please keep this in sync with sister test 'yacc-d-vpath.sh'.
+
+required='cc yacc'
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = parse.y foo.c
+END
+
+# Original parser, with 'foobar'.
+cat > parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cat > foo.c << 'END'
+int main () { return 0; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+$YACC parse.y
+mv y.tab.c parse.c
+
+mkdir sub
+cd sub
+../configure
+
+$sleep
+
+# New parser, with 'fubar'.
+cat > ../parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+$MAKE
+$MAKE distdir
+$FGREP fubar $distdir/parse.c
+
+# Now check to make sure that 'make dist' will rebuild the parser.
+
+$sleep
+
+# New parser, with 'maude'.
+cat > ../parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+maude : 'm' 'a' 'u' 'd' 'e' {};
+END
+
+$MAKE distdir
+$FGREP maude $distdir/parse.c
+
+:
diff --git a/t/yacc4.sh b/t/yacc4.sh
deleted file mode 100755
index bdadd648e..000000000
--- a/t/yacc4.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2013 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 2, 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 .
-
-# Some simple tests of ylwrap functionality.
-
-required='cc yacc'
-. test-init.sh
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AC_PROG_YACC
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = foo bar
-foo_SOURCES = parse.y foo.c
-bar_SOURCES = bar.y foo.c
-END
-
-# First parser.
-cat > parse.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) {}
-%}
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-# Second parser.
-cat > bar.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) {}
-%}
-%%
-fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-cat > foo.c << 'END'
-int main (void)
-{
- return 0;
-}
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-test -f ylwrap
-
-mkdir sub
-cd sub
-
-../configure
-$MAKE
-
-grep '^#.*/sub/\.\./' bar.c && exit 1
-grep '^#.*/sub/\.\./' parse.c && exit 1
-
-# Make distclean must not erase bar.c nor parse.c (by GNU standards) ...
-$MAKE distclean
-test -f bar.c
-test -f parse.c
-# ... but maintainer-clean should.
-../configure
-$MAKE maintainer-clean
-test ! -e bar.c
-test ! -e parse.c
-
-:
diff --git a/t/yaccdry.sh b/t/yaccdry.sh
deleted file mode 100755
index 79cf490ae..000000000
--- a/t/yaccdry.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2010-2013 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 2, 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 .
-
-# Removal recovery rules for headers should not remove files with 'make -n'.
-
-required='cc yacc'
-. test-init.sh
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AC_PROG_YACC
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-AM_YFLAGS = -d
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c parse.y
-END
-
-cat > foo.c << 'END'
-int main () { return 0; }
-END
-
-cat > parse.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) {}
-%}
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-./configure
-$MAKE
-
-rm -f parse.h
-$MAKE -n parse.h
-test -f parse.c
-test ! -e parse.h
-
-:
diff --git a/t/yaccpp.sh b/t/yaccpp.sh
deleted file mode 100755
index 079014673..000000000
--- a/t/yaccpp.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1997-2013 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 2, 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 .
-
-# Test to make sure Yacc + C++ is not obviously broken.
-# See also related tests 'yacc-cxx.sh' and 'yacc-d-cxx.sh',
-# which does much more in-depth checks (but requires an actual
-# Yacc program and a working C++ compiler).
-
-. test-init.sh
-
-cat >> configure.ac << 'END'
-AC_PROG_CXX
-AC_PROG_YACC
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = foo bar baz qux
-foo_SOURCES = foo.y++
-bar_SOURCES = bar.ypp
-baz_SOURCES = baz.yy
-qux_SOURCES = qux.yxx
-END
-
-$ACLOCAL
-$AUTOMAKE -a
-
-$EGREP '(\.[ch]|foo|bar|baz|qux)' Makefile.in # For debugging.
-
-$EGREP '(foo|bar|baz|qux)\.h' Makefile.in && exit 1
-
-sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
-
-$FGREP ' foo.c++ ' mk
-$FGREP ' bar.cpp ' mk
-$FGREP ' baz.cc ' mk
-$FGREP ' qux.cxx ' mk
-
-cat >> Makefile.am <mk
-
-$FGREP ' foo.c++ ' mk
-$FGREP ' foo.h++ ' mk
-$FGREP ' bar.cpp ' mk
-$FGREP ' bar.hpp ' mk
-$FGREP ' baz.cc ' mk
-$FGREP ' baz.hh ' mk
-
-$EGREP '(^| )foo\.h\+\+(:| .*:)' Makefile.in
-$EGREP '(^| )bar\.hpp(:| .*:)' Makefile.in
-$EGREP '(^| )baz\.hh(:| .*:)' Makefile.in
-
-grep ' foo\.h[ :]' mk && exit 1
-grep ' bar\.h[ :]' mk && exit 1
-grep ' baz\.h[ :]' mk && exit 1
-
-$FGREP ' qux-qux.cxx ' mk
-$EGREP '(^| )qux-qux\.cxx(:| .*:)' Makefile.in
-grep 'qux\.h.*:' Makefile.in && exit 1
-
-:
diff --git a/t/yaccvpath.sh b/t/yaccvpath.sh
deleted file mode 100755
index bd123374f..000000000
--- a/t/yaccvpath.sh
+++ /dev/null
@@ -1,97 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2013 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 2, 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 .
-
-# This test checks that dependent files are updated before including
-# in the distribution. 'parse.c' depends on 'parse.y'. The later is
-# updated so that 'parse.c' should be rebuild. Then we are running
-# 'make' and 'make distdir' and check whether the version of 'parse.c'
-# to be distributed is up to date.
-
-# Please keep this in sync with sister test 'yacc-d-vpath.sh'.
-
-required='cc yacc'
-. test-init.sh
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AC_PROG_YACC
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = foo
-foo_SOURCES = parse.y foo.c
-END
-
-# Original parser, with 'foobar'.
-cat > parse.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) {}
-%}
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-cat > foo.c << 'END'
-int main () { return 0; }
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-$YACC parse.y
-mv y.tab.c parse.c
-
-mkdir sub
-cd sub
-../configure
-
-$sleep
-
-# New parser, with 'fubar'.
-cat > ../parse.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) {}
-%}
-%%
-fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-$MAKE
-$MAKE distdir
-$FGREP fubar $distdir/parse.c
-
-# Now check to make sure that 'make dist' will rebuild the parser.
-
-$sleep
-
-# New parser, with 'maude'.
-cat > ../parse.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) {}
-%}
-%%
-maude : 'm' 'a' 'u' 'd' 'e' {};
-END
-
-$MAKE distdir
-$FGREP maude $distdir/parse.c
-
-:
--
cgit v1.2.1
From 5fdf75877fd22aed951678d92b291b3b7ca1926f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 12:03:37 +0100
Subject: plans: add the "PLANS" directory
Individual files or sub-directories about future and on-going
development plans in Automake will be added in follow-up commits.
This new set of documents is meant to help ensure a more controlled
and smooth development and evolution for Automake, in several ways.
- Having the plans clearly spelled out should will avoid messy
roadmaps with no clear way forward or with muddy or ill-defined
aims or purposes; a trap this is too easy to fall into.
- Keeping planned changes cooking and re-hashed for a while should
ensure rough edges are smoothed up, transitions are planned in a
proper way (hopefully avoiding debacles like the AM_MKDIR_PROG_P
deprecation and the AM_CONFIG_HEADER too-abrupt removal), and
"power users" have more chances of getting informed in due time,
thus having all the time to prepare for the changes or raise
objections against them.
- Having the plans clearly stated and registered in a "centralized"
location should make it more difficult to them to slip through
the cracks, getting forgotten or (worse) only half-implemented.
- Even for discussions and plans registered on the Bug Tracker
as well, a corresponding entry in the PLANS directory can help
in keeping main ideas summarized, and consensus and/or objections
registered and easily compared.
Motivation:
Not a flatting picture for us (and maybe a little too harsh), but
basically true and even spot-on in some regards.
* PLANS/README: New.
* Makefile.am (EXTRA_DIST): Distribute the whole PLANS directory.
Signed-off-by: Stefano Lattarini
---
Makefile.am | 3 ++-
PLANS/README | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
create mode 100644 PLANS/README
diff --git a/Makefile.am b/Makefile.am
index f6db092f3..50e6b9b43 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,8 @@ EXTRA_DIST += \
GNUmakefile \
maint.mk \
syntax-checks.mk \
- HACKING
+ HACKING \
+ PLANS
# Make versioned links. We only run the transform on the root name;
# then we make a versioned link with the transformed base name. This
diff --git a/PLANS/README b/PLANS/README
new file mode 100644
index 000000000..87cb8dc36
--- /dev/null
+++ b/PLANS/README
@@ -0,0 +1,25 @@
+"Plans" for future or on-going Automake development.
+
+The contents is meant to help ensure a more controlled and smooth
+development and evolution for Automake, in several ways.
+
+ - Having the plans clearly spelled out should will avoid messy
+ roadmaps with no clear way forward or with muddy or ill-defined
+ aims or purposes; a trap this is too easy to fall into.
+
+ - Keeping planned changes cooking and re-hashed for a while should
+ ensure rough edges are smoothed up, transitions are planned in a
+ proper way (hopefully avoiding debacles like the AM_MKDIR_PROG_P
+ deprecation and the AM_CONFIG_HEADER too-abrupt removal), and
+ "power users" have more chances of getting informed in due time,
+ thus having all the time to prepare for the changes or raise
+ objections against them.
+
+ - Having the plans clearly stated and registered in a "centralized"
+ location should make it more difficult to them to slip through
+ the cracks, getting forgotten or (worse) only half-implemented.
+
+ - Even for discussions and plans registered on the Bug Tracker
+ as well, a corresponding entry in the PLANS directory can help
+ in keeping main ideas summarized, and consensus and/or objections
+ registered and easily compared.
--
cgit v1.2.1
From 6d80cc2dba29a680cec596e233fab1e6185391b0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 12:23:51 +0100
Subject: maint: move more maintainer files in the 'maint/' subdir
* maint.mk: Move ...
* maint/maint.mk: ... here.
* syntax-checks.mk: Move ...
* maint/syntax-checks.mk: ... here.
* Makefile.am: Adjust.
* GNUmakefile: Likewise.
Signed-off-by: Stefano Lattarini
---
GNUmakefile | 4 +-
Makefile.am | 10 +-
maint.mk | 467 ------------------------------------------
maint/maint.mk | 467 ++++++++++++++++++++++++++++++++++++++++++
maint/syntax-checks.mk | 544 +++++++++++++++++++++++++++++++++++++++++++++++++
syntax-checks.mk | 544 -------------------------------------------------
6 files changed, 1018 insertions(+), 1018 deletions(-)
delete mode 100644 maint.mk
create mode 100644 maint/maint.mk
create mode 100644 maint/syntax-checks.mk
delete mode 100644 syntax-checks.mk
diff --git a/GNUmakefile b/GNUmakefile
index 21db5c4cc..d6baaaa7b 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -25,8 +25,8 @@ ifeq ($(wildcard Makefile),)
$(error Fatal Error)
endif
include ./Makefile
-include $(srcdir)/maint.mk
-include $(srcdir)/syntax-checks.mk
+include $(srcdir)/maint/maint.mk
+include $(srcdir)/maint/syntax-checks.mk
else # ! bootstrap in $(MAKECMDGOALS)
diff --git a/Makefile.am b/Makefile.am
index f6db092f3..0c9d8b7a4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,8 +69,6 @@ EXTRA_DIST += \
$(AUTOMAKESOURCES) \
bootstrap.sh \
GNUmakefile \
- maint.mk \
- syntax-checks.mk \
HACKING
# Make versioned links. We only run the transform on the root name;
@@ -117,8 +115,8 @@ maintainer-clean-local:
rm -rf .autom4te.cache
# So that automake won't complain about the missing ChangeLog.
-# The real rule for ChangeLog generation is now in maint.mk (as
-# it is maintainer-specific).
+# The real rule for ChangeLog generation is now in main/maint.mk
+# (as it is maintainer-specific).
ChangeLog:
@@ -687,4 +685,6 @@ EXTRA_DIST += \
EXTRA_DIST += \
maint/am-ft \
maint/am-xft \
- maint/rename-tests
+ maint/rename-tests \
+ maint/maint.mk \
+ maint/syntax-checks.mk
diff --git a/maint.mk b/maint.mk
deleted file mode 100644
index 69b163048..000000000
--- a/maint.mk
+++ /dev/null
@@ -1,467 +0,0 @@
-# Maintainer makefile rules for Automake.
-#
-# Copyright (C) 1995-2013 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 2, 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 .
-
-# Avoid CDPATH issues.
-unexport CDPATH
-
-# --------------------------------------------------------- #
-# Automatic generation of the ChangeLog from git history. #
-# --------------------------------------------------------- #
-
-gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
-gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
-gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
- --since='2011-12-28 00:00:00' \
- --no-cluster --format '%s%n%n%b'
-
-EXTRA_DIST += lib/gitlog-to-changelog
-EXTRA_DIST += $(gitlog_to_changelog_fixes)
-
-# When executed from a git checkout, generate the ChangeLog from the git
-# history. When executed from an extracted distribution tarball, just
-# copy the distributed ChangeLog in the build directory (and if this
-# fails, or if no distributed ChangeLog file is present, complain and
-# give an error).
-#
-# The ChangeLog should be regenerated unconditionally when working from
-# checked-out sources; otherwise, if we're working from a distribution
-# tarball, we expect the ChangeLog to be distributed, so check that it
-# is indeed present in the source directory.
-ChangeLog:
- $(AM_V_GEN)set -e; set -u; \
- if test -d $(srcdir)/.git; then \
- rm -f $@-t \
- && $(gitlog_to_changelog_command) \
- $(gitlog_to_changelog_options) >$@-t \
- && chmod a-w $@-t \
- && mv -f $@-t $@ \
- || exit 1; \
- elif test ! -f $(srcdir)/$@; then \
- echo "Source tree is not a git checkout, and no pre-existent" \
- "$@ file has been found there" >&2; \
- exit 1; \
- fi
-.PHONY: ChangeLog
-
-
-# --------------------------- #
-# Perl coverage statistics. #
-# --------------------------- #
-
-PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
-PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
-PERL_COVER = cover
-
-check-coverage-run recheck-coverage-run: %-coverage-run: all
- $(MKDIR_P) $(PERL_COVERAGE_DB)
- PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
- WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
- $(MAKE) $*
-
-check-coverage-report:
- @if test ! -d "$(PERL_COVERAGE_DB)"; then \
- echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
- echo "Please run \"make check-coverage\" first" >&2; \
- exit 1; \
- fi
- $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
-
-# We don't use direct dependencies here because we'd like to be able
-# to invoke the report even after interrupted check-coverage.
-check-coverage: check-coverage-run
- $(MAKE) check-coverage-report
-
-recheck-coverage: recheck-coverage-run
- $(MAKE) check-coverage-report
-
-clean-coverage:
- rm -rf "$(PERL_COVERAGE_DB)"
-clean-local: clean-coverage
-
-.PHONY: check-coverage recheck-coverage check-coverage-run \
- recheck-coverage-run check-coverage-report clean-coverage
-
-
-# ---------------------------------------------------- #
-# Tagging and/or uploading stable and beta releases. #
-# ---------------------------------------------------- #
-
-GIT = git
-
-EXTRA_DIST += lib/gnupload
-
-base_version_rx = ^[1-9][0-9]*\.[0-9][0-9]*
-stable_major_version_rx = $(base_version_rx)$$
-stable_minor_version_rx = $(base_version_rx)\.[0-9][0-9]*$$
-beta_version_rx = $(base_version_rx)(\.[0-9][0-9]*)?[bdfhjlnprtvxz]$$
-match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
-
-# Check that we don't have uncommitted or unstaged changes.
-# TODO: Maybe the git suite already offers a shortcut to verify if the
-# TODO: working directory is "clean" or not? If yes, use that instead
-# TODO: of duplicating the logic here.
-git_must_have_clean_workdir = \
- $(GIT) rev-parse --verify HEAD >/dev/null \
- && $(GIT) update-index -q --refresh \
- && $(GIT) diff-files --quiet \
- && $(GIT) diff-index --quiet --cached HEAD \
- || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
-
-determine_release_type = \
- if $(match_version) '$(stable_major_version_rx)'; then \
- release_type='Major release'; \
- announcement_type='major release'; \
- dest=ftp; \
- elif $(match_version) '$(stable_minor_version_rx)'; then \
- release_type='Minor release'; \
- announcement_type='maintenance release'; \
- dest=ftp; \
- elif $(match_version) '$(beta_version_rx)'; then \
- release_type='Beta release'; \
- announcement_type='test release'; \
- dest=alpha; \
- else \
- echo "$@: invalid version '$(VERSION)' for a release" >&2; \
- exit 1; \
- fi
-
-# Help the debugging of $(determine_release_type) and related code.
-print-release-type:
- @$(determine_release_type); \
- echo "$$release_type $(VERSION);" \
- "it will be announced as a $$announcement_type"
-
-git-tag-release: maintainer-check
- @set -e -u; \
- case '$(AM_TAG_DRYRUN)' in \
- ""|[nN]|[nN]o|NO) run="";; \
- *) run="echo Running:";; \
- esac; \
- $(determine_release_type); \
- $(git_must_have_clean_workdir); \
- $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
-
-git-upload-release:
- @# Check this is a version we can cut a release (either test
- @# or stable) from.
- @$(determine_release_type)
- @# The repository must be clean.
- @$(git_must_have_clean_workdir)
- @# Check that we are releasing from a valid tag.
- @tag=`$(GIT) describe` \
- && case $$tag in "v$(VERSION)") true;; *) false;; esac \
- || { echo "$@: you can only create a release from a tagged" \
- "version" >&2; \
- exit 1; }
- @# Build the distribution tarball(s).
- $(MAKE) dist
- @# Upload it to the correct FTP repository.
- @$(determine_release_type) \
- && dest=$$dest.gnu.org:automake \
- && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
- && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
- $(DIST_ARCHIVES)
-
-.PHONY: print-release-type git-upload-release git-tag-release
-
-
-# ------------------------------------------------------------------ #
-# Explore differences of autogenerated files in different commits. #
-# ------------------------------------------------------------------ #
-
-# Visually comparing differences between the Makefile.in files in
-# automake's own build system as generated in two different branches
-# might help to catch bugs and blunders. This has already happened a
-# few times in the past, when we used to version-control Makefile.in.
-autodiffs:
- @set -u; \
- NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
- OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
- am_gitdir='$(abs_top_srcdir)/.git'; \
- get_autofiles_from_rev () \
- { \
- rev=$$1 dir=$$2 \
- && echo "$@: will get files from revision $$rev" \
- && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
- && cd tmp \
- && $(GIT) checkout -q "$$rev" \
- && echo "$@: bootstrapping $$rev" \
- && $(SHELL) ./bootstrap.sh \
- && echo "$@: copying files from $$rev" \
- && makefile_ins=`find . -name Makefile.in` \
- && (tar cf - configure aclocal.m4 $$makefile_ins) | \
- (cd .. && cd "$$dir" && tar xf -) \
- && cd .. \
- && rm -rf tmp; \
- }; \
- outdir=$@.dir \
- && : Before proceeding, ensure the specified revisions truly exist. \
- && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
- && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
- && rm -rf $$outdir \
- && mkdir $$outdir \
- && cd $$outdir \
- && mkdir new old \
- && get_autofiles_from_rev $$OLD_COMMIT old \
- && get_autofiles_from_rev $$NEW_COMMIT new \
- && exit 0
-
-# With lots of eye candy; we like our developers pampered and spoiled :-)
-compare-autodiffs: autodiffs
- @set -u; \
- : $${COLORDIFF=colordiff} $${DIFF=diff}; \
- dir=autodiffs.dir; \
- if test ! -d "$$dir"; then \
- echo "$@: $$dir: Not a directory" >&2; \
- exit 1; \
- fi; \
- mydiff=false mypager=false; \
- if test -t 1; then \
- if ($$COLORDIFF -r . .) /dev/null 2>&1; then \
- mydiff=$$COLORDIFF; \
- mypager="less -R"; \
- else \
- mypager=less; \
- fi; \
- else \
- mypager=cat; \
- fi; \
- if test "$$mydiff" = false; then \
- if ($$DIFF -r -u . .); then \
- mydiff=$$DIFF; \
- else \
- echo "$@: no good-enough diff program specified" >&2; \
- exit 1; \
- fi; \
- fi; \
- st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
- rm -rf $$dir; \
- exit $$st
-.PHONY: autodiffs compare-autodiffs
-
-# ---------------------------------------------- #
-# Help writing the announcement for a release. #
-# ---------------------------------------------- #
-
-PACKAGE_MAILINGLIST = automake@gnu.org
-
-announcement: NEWS
- $(AM_V_GEN): \
- && rm -f $@ $@-t \
- && $(determine_release_type) \
- && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
- && X () { printf '%s\n' "$$*" >> $@-t; } \
- && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
- "$$announcement_type." \
- && X \
- && X "**TODO** Brief description of the release here." \
- && X \
- && X "**TODO** This description can span multiple paragraphs." \
- && X \
- && X "See below for the detailed list of changes since the" \
- && X "previous version, as summarized by the NEWS file." \
- && X \
- && X "Download here:" \
- && X \
- && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
- && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
- && X \
- && X "Please report bugs and problems to" \
- "<$(PACKAGE_BUGREPORT)>," \
- && X "and send general comments and feedback to" \
- "<$(PACKAGE_MAILINGLIST)>." \
- && X \
- && X "Thanks to everyone who has reported problems, contributed" \
- && X "patches, and helped testing Automake!" \
- && X \
- && X "-*-*-*-" \
- && X \
- && sed -n -e '/^~~~/q' -e p $(srcdir)/NEWS >> $@-t \
- && mv -f $@-t $@
-.PHONY: announcement
-CLEANFILES += announcement
-
-# --------------------------------------------------------------------- #
-# Synchronize third-party files that are committed in our repository. #
-# --------------------------------------------------------------------- #
-
-# Program to use to fetch files.
-WGET = wget
-
-# Some repositories we sync files from.
-SV_CVS = 'http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/'
-SV_GIT_CF = 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
-SV_GIT_AC = 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
-SV_GIT_GL = 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
-
-# Files that we fetch and which we compare against.
-# Note that the 'lib/COPYING' file must still be synced by hand.
-FETCHFILES = \
- $(SV_GIT_CF)config.guess \
- $(SV_GIT_CF)config.sub \
- $(SV_CVS)texinfo/texinfo/doc/texinfo.tex \
- $(SV_CVS)texinfo/texinfo/util/gendocs.sh \
- $(SV_CVS)texinfo/texinfo/util/gendocs_template \
- $(SV_GIT_GL)build-aux/gitlog-to-changelog \
- $(SV_GIT_GL)build-aux/gnupload \
- $(SV_GIT_GL)build-aux/update-copyright \
- $(SV_GIT_GL)doc/INSTALL
-
-# Fetch the latest versions of few scripts and files we care about.
-# A retrieval failure or a copying failure usually mean serious problems,
-# so we'll just bail out if 'wget' or 'cp' fail.
-fetch:
- $(AM_V_at)rm -rf Fetchdir
- $(AM_V_at)mkdir Fetchdir
- $(AM_V_GEN)set -e; \
- if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
- for url in $(FETCHFILES); do \
- file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
- $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
- if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
- : Nothing to do; \
- else \
- echo "$@: updating file $$file"; \
- cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
- fi; \
- done
- $(AM_V_at)rm -rf Fetchdir
-.PHONY: fetch
-
-# ---------------------------------------------------------------------- #
-# Generate and upload manuals in several formats, for the GNU website. #
-# ---------------------------------------------------------------------- #
-
-web_manual_dir = doc/web-manual
-
-RSYNC = rsync
-CVS = cvs
-CVSU = cvsu
-CVS_USER = $${USER}
-WEBCVS_ROOT = cvs.savannah.gnu.org:/web
-CVS_RSH = ssh
-export CVS_RSH
-
-.PHONY: web-manual web-manual-update
-web-manual web-manual-update: t = $@.dir
-
-# Build manual in several formats. Note to the recipe:
-# 1. The symlinking of automake.texi into the temporary directory is
-# required to pacify extra checks from gendocs.sh.
-# 2. The redirection to /dev/null before the invocation of gendocs.sh
-# is done to better respect silent rules.
-web-manual:
- $(AM_V_at)rm -rf $(web_manual_dir) $t
- $(AM_V_at)mkdir $t
- $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
- $(AM_V_GEN)cd $t \
- && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
- && export GENDOCS_TEMPLATE_DIR \
- && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
- && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
- -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
- $(PACKAGE) '$(PACKAGE_NAME)'
- $(AM_V_at)mkdir $(web_manual_dir)
- $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
- $(AM_V_at)rm -rf $t
- @! $(AM_V_P) || ls -l $(web_manual_dir)
-
-# Upload manual to www.gnu.org, using CVS (sigh!)
-web-manual-update:
- $(AM_V_at)$(determine_release_type); \
- case $$release_type in \
- [Mm]ajor\ release|[Mm]inor\ release);; \
- *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
- exit 1;; \
- esac
- $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
- echo 'You have to run "$(MAKE) web-manuals" before' \
- 'invoking "$(MAKE) $@"' >&2; \
- exit 1; \
- }
- $(AM_V_at)rm -rf $t
- $(AM_V_at)mkdir $t
- $(AM_V_at)cd $t \
- && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
- co $(PACKAGE)
- @# According to the rsync manpage, "a trailing slash on the
- @# source [...] avoids creating an additional directory
- @# level at the destination". So the trailing '/' after
- @# '$(web_manual_dir)' below is intended.
- $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
- $(AM_V_GEN): \
- && cd $t/$(PACKAGE)/manual \
- && new_files=`$(CVSU) --types='?'` \
- && new_files=`echo "$$new_files" | sed s/^..//` \
- && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
- && $(CVS) ci -m $(VERSION)
- $(AM_V_at)rm -rf $t
-.PHONY: web-manual-update
-
-clean-web-manual:
- $(AM_V_at)rm -rf $(web_manual_dir)
-.PHONY: clean-web-manual
-clean-local: clean-web-manual
-
-EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
-
-# ------------------------------------------------ #
-# Update copyright years of all committed files. #
-# ------------------------------------------------ #
-
-EXTRA_DIST += lib/update-copyright
-
-update_copyright_env = \
- UPDATE_COPYRIGHT_FORCE=1 \
- UPDATE_COPYRIGHT_USE_INTERVALS=2
-
-# In addition to the several README files, these as well are
-# not expected to have a copyright notice.
-files_without_copyright = \
- .autom4te.cfg \
- .git-log-fix \
- .gitattributes \
- .gitignore \
- INSTALL \
- COPYING \
- AUTHORS \
- THANKS \
- lib/INSTALL \
- lib/COPYING
-
-# This script is in the public domain.
-files_without_copyright += lib/mkinstalldirs
-
-# This script has an MIT-style license
-files_without_copyright += lib/install-sh
-
-.PHONY: update-copyright
-update-copyright:
- $(AM_V_GEN)set -e; \
- current_year=`date +%Y` && test -n "$$current_year" \
- || { echo "$@: cannot get current year" >&2; exit 1; }; \
- sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
- bootstrap.sh configure.ac; \
- excluded_re=`( \
- for url in $(FETCHFILES); do echo "$$url"; done \
- | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
- && for f in $(files_without_copyright); do echo $$f; done \
- ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
- $(GIT) ls-files \
- | grep -Ev '(^|/)README$$' \
- | grep -Ev "^($$excluded_re)$$" \
- | $(update_copyright_env) xargs $(srcdir)/lib/$@
diff --git a/maint/maint.mk b/maint/maint.mk
new file mode 100644
index 000000000..69b163048
--- /dev/null
+++ b/maint/maint.mk
@@ -0,0 +1,467 @@
+# Maintainer makefile rules for Automake.
+#
+# Copyright (C) 1995-2013 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 2, 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 .
+
+# Avoid CDPATH issues.
+unexport CDPATH
+
+# --------------------------------------------------------- #
+# Automatic generation of the ChangeLog from git history. #
+# --------------------------------------------------------- #
+
+gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
+gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
+gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
+ --since='2011-12-28 00:00:00' \
+ --no-cluster --format '%s%n%n%b'
+
+EXTRA_DIST += lib/gitlog-to-changelog
+EXTRA_DIST += $(gitlog_to_changelog_fixes)
+
+# When executed from a git checkout, generate the ChangeLog from the git
+# history. When executed from an extracted distribution tarball, just
+# copy the distributed ChangeLog in the build directory (and if this
+# fails, or if no distributed ChangeLog file is present, complain and
+# give an error).
+#
+# The ChangeLog should be regenerated unconditionally when working from
+# checked-out sources; otherwise, if we're working from a distribution
+# tarball, we expect the ChangeLog to be distributed, so check that it
+# is indeed present in the source directory.
+ChangeLog:
+ $(AM_V_GEN)set -e; set -u; \
+ if test -d $(srcdir)/.git; then \
+ rm -f $@-t \
+ && $(gitlog_to_changelog_command) \
+ $(gitlog_to_changelog_options) >$@-t \
+ && chmod a-w $@-t \
+ && mv -f $@-t $@ \
+ || exit 1; \
+ elif test ! -f $(srcdir)/$@; then \
+ echo "Source tree is not a git checkout, and no pre-existent" \
+ "$@ file has been found there" >&2; \
+ exit 1; \
+ fi
+.PHONY: ChangeLog
+
+
+# --------------------------- #
+# Perl coverage statistics. #
+# --------------------------- #
+
+PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
+PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
+PERL_COVER = cover
+
+check-coverage-run recheck-coverage-run: %-coverage-run: all
+ $(MKDIR_P) $(PERL_COVERAGE_DB)
+ PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
+ WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
+ $(MAKE) $*
+
+check-coverage-report:
+ @if test ! -d "$(PERL_COVERAGE_DB)"; then \
+ echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
+ echo "Please run \"make check-coverage\" first" >&2; \
+ exit 1; \
+ fi
+ $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
+
+# We don't use direct dependencies here because we'd like to be able
+# to invoke the report even after interrupted check-coverage.
+check-coverage: check-coverage-run
+ $(MAKE) check-coverage-report
+
+recheck-coverage: recheck-coverage-run
+ $(MAKE) check-coverage-report
+
+clean-coverage:
+ rm -rf "$(PERL_COVERAGE_DB)"
+clean-local: clean-coverage
+
+.PHONY: check-coverage recheck-coverage check-coverage-run \
+ recheck-coverage-run check-coverage-report clean-coverage
+
+
+# ---------------------------------------------------- #
+# Tagging and/or uploading stable and beta releases. #
+# ---------------------------------------------------- #
+
+GIT = git
+
+EXTRA_DIST += lib/gnupload
+
+base_version_rx = ^[1-9][0-9]*\.[0-9][0-9]*
+stable_major_version_rx = $(base_version_rx)$$
+stable_minor_version_rx = $(base_version_rx)\.[0-9][0-9]*$$
+beta_version_rx = $(base_version_rx)(\.[0-9][0-9]*)?[bdfhjlnprtvxz]$$
+match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
+
+# Check that we don't have uncommitted or unstaged changes.
+# TODO: Maybe the git suite already offers a shortcut to verify if the
+# TODO: working directory is "clean" or not? If yes, use that instead
+# TODO: of duplicating the logic here.
+git_must_have_clean_workdir = \
+ $(GIT) rev-parse --verify HEAD >/dev/null \
+ && $(GIT) update-index -q --refresh \
+ && $(GIT) diff-files --quiet \
+ && $(GIT) diff-index --quiet --cached HEAD \
+ || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
+
+determine_release_type = \
+ if $(match_version) '$(stable_major_version_rx)'; then \
+ release_type='Major release'; \
+ announcement_type='major release'; \
+ dest=ftp; \
+ elif $(match_version) '$(stable_minor_version_rx)'; then \
+ release_type='Minor release'; \
+ announcement_type='maintenance release'; \
+ dest=ftp; \
+ elif $(match_version) '$(beta_version_rx)'; then \
+ release_type='Beta release'; \
+ announcement_type='test release'; \
+ dest=alpha; \
+ else \
+ echo "$@: invalid version '$(VERSION)' for a release" >&2; \
+ exit 1; \
+ fi
+
+# Help the debugging of $(determine_release_type) and related code.
+print-release-type:
+ @$(determine_release_type); \
+ echo "$$release_type $(VERSION);" \
+ "it will be announced as a $$announcement_type"
+
+git-tag-release: maintainer-check
+ @set -e -u; \
+ case '$(AM_TAG_DRYRUN)' in \
+ ""|[nN]|[nN]o|NO) run="";; \
+ *) run="echo Running:";; \
+ esac; \
+ $(determine_release_type); \
+ $(git_must_have_clean_workdir); \
+ $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
+
+git-upload-release:
+ @# Check this is a version we can cut a release (either test
+ @# or stable) from.
+ @$(determine_release_type)
+ @# The repository must be clean.
+ @$(git_must_have_clean_workdir)
+ @# Check that we are releasing from a valid tag.
+ @tag=`$(GIT) describe` \
+ && case $$tag in "v$(VERSION)") true;; *) false;; esac \
+ || { echo "$@: you can only create a release from a tagged" \
+ "version" >&2; \
+ exit 1; }
+ @# Build the distribution tarball(s).
+ $(MAKE) dist
+ @# Upload it to the correct FTP repository.
+ @$(determine_release_type) \
+ && dest=$$dest.gnu.org:automake \
+ && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
+ && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
+ $(DIST_ARCHIVES)
+
+.PHONY: print-release-type git-upload-release git-tag-release
+
+
+# ------------------------------------------------------------------ #
+# Explore differences of autogenerated files in different commits. #
+# ------------------------------------------------------------------ #
+
+# Visually comparing differences between the Makefile.in files in
+# automake's own build system as generated in two different branches
+# might help to catch bugs and blunders. This has already happened a
+# few times in the past, when we used to version-control Makefile.in.
+autodiffs:
+ @set -u; \
+ NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
+ OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
+ am_gitdir='$(abs_top_srcdir)/.git'; \
+ get_autofiles_from_rev () \
+ { \
+ rev=$$1 dir=$$2 \
+ && echo "$@: will get files from revision $$rev" \
+ && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
+ && cd tmp \
+ && $(GIT) checkout -q "$$rev" \
+ && echo "$@: bootstrapping $$rev" \
+ && $(SHELL) ./bootstrap.sh \
+ && echo "$@: copying files from $$rev" \
+ && makefile_ins=`find . -name Makefile.in` \
+ && (tar cf - configure aclocal.m4 $$makefile_ins) | \
+ (cd .. && cd "$$dir" && tar xf -) \
+ && cd .. \
+ && rm -rf tmp; \
+ }; \
+ outdir=$@.dir \
+ && : Before proceeding, ensure the specified revisions truly exist. \
+ && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
+ && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
+ && rm -rf $$outdir \
+ && mkdir $$outdir \
+ && cd $$outdir \
+ && mkdir new old \
+ && get_autofiles_from_rev $$OLD_COMMIT old \
+ && get_autofiles_from_rev $$NEW_COMMIT new \
+ && exit 0
+
+# With lots of eye candy; we like our developers pampered and spoiled :-)
+compare-autodiffs: autodiffs
+ @set -u; \
+ : $${COLORDIFF=colordiff} $${DIFF=diff}; \
+ dir=autodiffs.dir; \
+ if test ! -d "$$dir"; then \
+ echo "$@: $$dir: Not a directory" >&2; \
+ exit 1; \
+ fi; \
+ mydiff=false mypager=false; \
+ if test -t 1; then \
+ if ($$COLORDIFF -r . .) /dev/null 2>&1; then \
+ mydiff=$$COLORDIFF; \
+ mypager="less -R"; \
+ else \
+ mypager=less; \
+ fi; \
+ else \
+ mypager=cat; \
+ fi; \
+ if test "$$mydiff" = false; then \
+ if ($$DIFF -r -u . .); then \
+ mydiff=$$DIFF; \
+ else \
+ echo "$@: no good-enough diff program specified" >&2; \
+ exit 1; \
+ fi; \
+ fi; \
+ st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
+ rm -rf $$dir; \
+ exit $$st
+.PHONY: autodiffs compare-autodiffs
+
+# ---------------------------------------------- #
+# Help writing the announcement for a release. #
+# ---------------------------------------------- #
+
+PACKAGE_MAILINGLIST = automake@gnu.org
+
+announcement: NEWS
+ $(AM_V_GEN): \
+ && rm -f $@ $@-t \
+ && $(determine_release_type) \
+ && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
+ && X () { printf '%s\n' "$$*" >> $@-t; } \
+ && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
+ "$$announcement_type." \
+ && X \
+ && X "**TODO** Brief description of the release here." \
+ && X \
+ && X "**TODO** This description can span multiple paragraphs." \
+ && X \
+ && X "See below for the detailed list of changes since the" \
+ && X "previous version, as summarized by the NEWS file." \
+ && X \
+ && X "Download here:" \
+ && X \
+ && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
+ && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
+ && X \
+ && X "Please report bugs and problems to" \
+ "<$(PACKAGE_BUGREPORT)>," \
+ && X "and send general comments and feedback to" \
+ "<$(PACKAGE_MAILINGLIST)>." \
+ && X \
+ && X "Thanks to everyone who has reported problems, contributed" \
+ && X "patches, and helped testing Automake!" \
+ && X \
+ && X "-*-*-*-" \
+ && X \
+ && sed -n -e '/^~~~/q' -e p $(srcdir)/NEWS >> $@-t \
+ && mv -f $@-t $@
+.PHONY: announcement
+CLEANFILES += announcement
+
+# --------------------------------------------------------------------- #
+# Synchronize third-party files that are committed in our repository. #
+# --------------------------------------------------------------------- #
+
+# Program to use to fetch files.
+WGET = wget
+
+# Some repositories we sync files from.
+SV_CVS = 'http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/'
+SV_GIT_CF = 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
+SV_GIT_AC = 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
+SV_GIT_GL = 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
+
+# Files that we fetch and which we compare against.
+# Note that the 'lib/COPYING' file must still be synced by hand.
+FETCHFILES = \
+ $(SV_GIT_CF)config.guess \
+ $(SV_GIT_CF)config.sub \
+ $(SV_CVS)texinfo/texinfo/doc/texinfo.tex \
+ $(SV_CVS)texinfo/texinfo/util/gendocs.sh \
+ $(SV_CVS)texinfo/texinfo/util/gendocs_template \
+ $(SV_GIT_GL)build-aux/gitlog-to-changelog \
+ $(SV_GIT_GL)build-aux/gnupload \
+ $(SV_GIT_GL)build-aux/update-copyright \
+ $(SV_GIT_GL)doc/INSTALL
+
+# Fetch the latest versions of few scripts and files we care about.
+# A retrieval failure or a copying failure usually mean serious problems,
+# so we'll just bail out if 'wget' or 'cp' fail.
+fetch:
+ $(AM_V_at)rm -rf Fetchdir
+ $(AM_V_at)mkdir Fetchdir
+ $(AM_V_GEN)set -e; \
+ if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
+ for url in $(FETCHFILES); do \
+ file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
+ $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
+ if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
+ : Nothing to do; \
+ else \
+ echo "$@: updating file $$file"; \
+ cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
+ fi; \
+ done
+ $(AM_V_at)rm -rf Fetchdir
+.PHONY: fetch
+
+# ---------------------------------------------------------------------- #
+# Generate and upload manuals in several formats, for the GNU website. #
+# ---------------------------------------------------------------------- #
+
+web_manual_dir = doc/web-manual
+
+RSYNC = rsync
+CVS = cvs
+CVSU = cvsu
+CVS_USER = $${USER}
+WEBCVS_ROOT = cvs.savannah.gnu.org:/web
+CVS_RSH = ssh
+export CVS_RSH
+
+.PHONY: web-manual web-manual-update
+web-manual web-manual-update: t = $@.dir
+
+# Build manual in several formats. Note to the recipe:
+# 1. The symlinking of automake.texi into the temporary directory is
+# required to pacify extra checks from gendocs.sh.
+# 2. The redirection to /dev/null before the invocation of gendocs.sh
+# is done to better respect silent rules.
+web-manual:
+ $(AM_V_at)rm -rf $(web_manual_dir) $t
+ $(AM_V_at)mkdir $t
+ $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
+ $(AM_V_GEN)cd $t \
+ && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
+ && export GENDOCS_TEMPLATE_DIR \
+ && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
+ && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
+ -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
+ $(PACKAGE) '$(PACKAGE_NAME)'
+ $(AM_V_at)mkdir $(web_manual_dir)
+ $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
+ $(AM_V_at)rm -rf $t
+ @! $(AM_V_P) || ls -l $(web_manual_dir)
+
+# Upload manual to www.gnu.org, using CVS (sigh!)
+web-manual-update:
+ $(AM_V_at)$(determine_release_type); \
+ case $$release_type in \
+ [Mm]ajor\ release|[Mm]inor\ release);; \
+ *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
+ exit 1;; \
+ esac
+ $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
+ echo 'You have to run "$(MAKE) web-manuals" before' \
+ 'invoking "$(MAKE) $@"' >&2; \
+ exit 1; \
+ }
+ $(AM_V_at)rm -rf $t
+ $(AM_V_at)mkdir $t
+ $(AM_V_at)cd $t \
+ && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
+ co $(PACKAGE)
+ @# According to the rsync manpage, "a trailing slash on the
+ @# source [...] avoids creating an additional directory
+ @# level at the destination". So the trailing '/' after
+ @# '$(web_manual_dir)' below is intended.
+ $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
+ $(AM_V_GEN): \
+ && cd $t/$(PACKAGE)/manual \
+ && new_files=`$(CVSU) --types='?'` \
+ && new_files=`echo "$$new_files" | sed s/^..//` \
+ && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
+ && $(CVS) ci -m $(VERSION)
+ $(AM_V_at)rm -rf $t
+.PHONY: web-manual-update
+
+clean-web-manual:
+ $(AM_V_at)rm -rf $(web_manual_dir)
+.PHONY: clean-web-manual
+clean-local: clean-web-manual
+
+EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
+
+# ------------------------------------------------ #
+# Update copyright years of all committed files. #
+# ------------------------------------------------ #
+
+EXTRA_DIST += lib/update-copyright
+
+update_copyright_env = \
+ UPDATE_COPYRIGHT_FORCE=1 \
+ UPDATE_COPYRIGHT_USE_INTERVALS=2
+
+# In addition to the several README files, these as well are
+# not expected to have a copyright notice.
+files_without_copyright = \
+ .autom4te.cfg \
+ .git-log-fix \
+ .gitattributes \
+ .gitignore \
+ INSTALL \
+ COPYING \
+ AUTHORS \
+ THANKS \
+ lib/INSTALL \
+ lib/COPYING
+
+# This script is in the public domain.
+files_without_copyright += lib/mkinstalldirs
+
+# This script has an MIT-style license
+files_without_copyright += lib/install-sh
+
+.PHONY: update-copyright
+update-copyright:
+ $(AM_V_GEN)set -e; \
+ current_year=`date +%Y` && test -n "$$current_year" \
+ || { echo "$@: cannot get current year" >&2; exit 1; }; \
+ sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
+ bootstrap.sh configure.ac; \
+ excluded_re=`( \
+ for url in $(FETCHFILES); do echo "$$url"; done \
+ | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
+ && for f in $(files_without_copyright); do echo $$f; done \
+ ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
+ $(GIT) ls-files \
+ | grep -Ev '(^|/)README$$' \
+ | grep -Ev "^($$excluded_re)$$" \
+ | $(update_copyright_env) xargs $(srcdir)/lib/$@
diff --git a/maint/syntax-checks.mk b/maint/syntax-checks.mk
new file mode 100644
index 000000000..375738be9
--- /dev/null
+++ b/maint/syntax-checks.mk
@@ -0,0 +1,544 @@
+# Maintainer checks for Automake. Requires GNU make.
+
+# Copyright (C) 2012-2013 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 2, 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 .
+
+# We also have to take into account VPATH builds (where some generated
+# tests might be in '$(builddir)' rather than in '$(srcdir)'), TAP-based
+# tests script (which have a '.tap' extension) and helper scripts used
+# by other test cases (which have a '.sh' extension).
+xtests := $(shell \
+ if test $(srcdir) = .; then \
+ dirs=.; \
+ else \
+ dirs='$(srcdir) .'; \
+ fi; \
+ for d in $$dirs; do \
+ for s in tap sh; do \
+ ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \
+ done; \
+ done | sort)
+
+xdefs = \
+ $(srcdir)/t/ax/am-test-lib.sh \
+ $(srcdir)/t/ax/test-lib.sh \
+ $(srcdir)/t/ax/test-defs.in
+
+ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
+
+# Some simple checks, and then ordinary check. These are only really
+# guaranteed to work on my machine.
+syntax_check_rules = \
+$(sc_tests_plain_check_rules) \
+sc_diff_automake \
+sc_diff_aclocal \
+sc_no_brace_variable_expansions \
+sc_rm_minus_f \
+sc_no_for_variable_in_macro \
+sc_mkinstalldirs \
+sc_pre_normal_post_install_uninstall \
+sc_perl_no_undef \
+sc_perl_no_split_regex_space \
+sc_cd_in_backquotes \
+sc_cd_relative_dir \
+sc_perl_at_uscore_in_scalar_context \
+sc_perl_local \
+sc_AMDEP_TRUE_in_automake_in \
+sc_tests_make_without_am_makeflags \
+$(sc_obsolete_requirements_rules) \
+sc_tests_no_source_defs \
+sc_tests_obsolete_variables \
+sc_tests_here_document_format \
+sc_tests_command_subst \
+sc_tests_exit_not_Exit \
+sc_tests_automake_fails \
+sc_tests_required_after_defs \
+sc_tests_overriding_macros_on_cmdline \
+sc_tests_plain_sleep \
+sc_tests_ls_t \
+sc_tests_executable \
+sc_m4_am_plain_egrep_fgrep \
+sc_tests_no_configure_in \
+sc_tests_PATH_SEPARATOR \
+sc_tests_logs_duplicate_prefixes \
+sc_tests_makefile_variable_order \
+sc_perl_at_substs \
+sc_unquoted_DESTDIR \
+sc_tabs_in_texi \
+sc_at_in_texi
+
+## These check avoids accidental configure substitutions in the source.
+## There are exactly 8 lines that should be modified from automake.in to
+## automake, and 9 lines that should be modified from aclocal.in to
+## aclocal.
+automake_diff_no = 8
+aclocal_diff_no = 9
+sc_diff_automake sc_diff_aclocal: sc_diff_% :
+ @set +e; tmp=$*-diffs.tmp; \
+ diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
+ added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
+ removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
+ test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
+ || { \
+ echo "Found unexpected diffs between $*.in and $*"; \
+ echo "Lines added: $$added" ; \
+ echo "Lines removed: $$removed"; \
+ cat $$tmp >&2; \
+ exit 1; \
+ } >&1; \
+ rm -f $$tmp
+
+## Expect no instances of '${...}'. However, $${...} is ok, since that
+## is a shell construct, not a Makefile construct.
+sc_no_brace_variable_expansions:
+ @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
+ echo "Found too many uses of '\$${' in the lines above." 1>&2; \
+ exit 1; \
+ else :; fi
+
+## Make sure 'rm' is called with '-f'.
+sc_rm_minus_f:
+ @if grep -v '^#' $(ams) $(xtests) \
+ | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
+ | grep -E '\)'; \
+ then \
+ echo "Suspicious 'rm' invocation." 1>&2; \
+ exit 1; \
+ else :; fi
+
+## Never use something like "for file in $(FILES)", this doesn't work
+## if FILES is empty or if it contains shell meta characters (e.g. $ is
+## commonly used in Java filenames).
+sc_no_for_variable_in_macro:
+ @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
+ echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
+ exit 1; \
+ else :; fi
+
+## Make sure all invocations of mkinstalldirs are correct.
+sc_mkinstalldirs:
+ @if grep -n 'mkinstalldirs' $(ams) \
+ | grep -F -v '$$(mkinstalldirs)' \
+ | grep -v '^\./Makefile.am:[0-9][0-9]*: *lib/mkinstalldirs \\$$'; \
+ then \
+ echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
+ exit 1; \
+ else :; fi
+
+## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
+sc_pre_normal_post_install_uninstall:
+ @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
+ grep -v ':##' | grep -v ': @\$$('; then \
+ echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
+ exit 1; \
+ else :; fi
+
+## We never want to use "undef", only "delete", but for $/.
+sc_perl_no_undef:
+ @if grep -n -w 'undef ' $(srcdir)/automake.in | \
+ grep -F -v 'undef $$/'; then \
+ echo "Found undef in automake.in; use delete instead" 1>&2; \
+ exit 1; \
+ fi
+
+## We never want split (/ /,...), only split (' ', ...).
+sc_perl_no_split_regex_space:
+ @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
+ echo "Found bad split in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Look for cd within backquotes
+sc_cd_in_backquotes:
+ @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
+ echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Look for cd to a relative directory (may be influenced by CDPATH).
+## Skip some known directories that are OK.
+sc_cd_relative_dir:
+ @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
+ grep -v 'echo.*cd ' | \
+ grep -v 'am__cd =' | \
+ grep -v '^[^#]*cd [./]' | \
+ grep -v '^[^#]*cd \$$(top_builddir)' | \
+ grep -v '^[^#]*cd "\$$\$$am__cwd' | \
+ grep -v '^[^#]*cd \$$(abs' | \
+ grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
+ echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Using @_ in a scalar context is most probably a programming error.
+sc_perl_at_uscore_in_scalar_context:
+ @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
+ echo "Using @_ in a scalar context in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Allow only few variables to be localized in Automake.
+sc_perl_local:
+ @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
+ grep '^[ \t]*local [^*]'; then \
+ echo "Please avoid 'local'." 1>&2; \
+ exit 1; \
+ fi
+
+## Don't let AMDEP_TRUE substitution appear in automake.in.
+sc_AMDEP_TRUE_in_automake_in:
+ @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
+ echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
+ exit 1; \
+ fi
+
+## Recursive make invocations should always pass $(AM_MAKEFLAGS)
+## to $(MAKE), for portability to non-GNU make.
+sc_tests_make_without_am_makeflags:
+ @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
+ | grep -v 'AM_MAKEFLAGS' \
+ | grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \
+ then \
+ echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
+ exit 1; \
+ fi
+
+## Look out for some obsolete variables.
+sc_tests_obsolete_variables:
+ @vars=" \
+ using_tap \
+ am_using_tap \
+ test_prefer_config_shell \
+ original_AUTOMAKE \
+ original_ACLOCAL \
+ parallel_tests \
+ am_parallel_tests \
+ "; \
+ seen=""; \
+ for v in $$vars; do \
+ if grep -E "\b$$v\b" $(xtests) $(xdefs); then \
+ seen="$$seen $$v"; \
+ fi; \
+ done; \
+ if test -n "$$seen"; then \
+ for v in $$seen; do \
+ case $$v in \
+ parallel_tests|am_parallel_tests) v2=am_serial_tests;; \
+ *) v2=am_$$v;; \
+ esac; \
+ echo "Variable '$$v' is obsolete, use '$$v2' instead." 1>&2; \
+ done; \
+ exit 1; \
+ else :; fi
+
+## Look out for obsolete requirements specified in the test cases.
+sc_obsolete_requirements_rules = sc_no_texi2dvi-o sc_no_makeinfo-html
+modern-requirement.texi2dvi-o = texi2dvi
+modern-requirement.makeinfo-html = makeinfo
+
+$(sc_obsolete_requirements_rules): sc_no_% :
+ @if grep -E 'required=.*\b$*\b' $(xtests); then \
+ echo "Requirement '$*' is obsolete and shouldn't" \
+ "be used anymore." >&2; \
+ echo "You should use '$(modern-requirement.$*)' instead." >&2; \
+ exit 1; \
+ fi
+
+## Tests should never call some programs directly, but only through the
+## corresponding variable (e.g., '$MAKE', not 'make'). This will allow
+## the programs to be overridden at configure time (for less brittleness)
+## or by the user at make time (to allow better testsuite coverage).
+sc_tests_plain_check_rules = \
+ sc_tests_plain_egrep \
+ sc_tests_plain_fgrep \
+ sc_tests_plain_make \
+ sc_tests_plain_perl \
+ sc_tests_plain_automake \
+ sc_tests_plain_aclocal \
+ sc_tests_plain_autoconf \
+ sc_tests_plain_autoupdate \
+ sc_tests_plain_autom4te \
+ sc_tests_plain_autoheader \
+ sc_tests_plain_autoreconf
+
+toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
+
+$(sc_tests_plain_check_rules): sc_tests_plain_% :
+ @# The leading ':' in the grep below is what is printed by the
+ @# preceding 'grep -v' after the file name.
+ @# It works here as a poor man's substitute for beginning-of-line
+ @# marker.
+ @if grep -v '^[ ]*#' $(xtests) \
+ | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[ ]*?$*\b'; \
+ then \
+ echo 'Do not run "$*" in the above tests.' \
+ 'Use "$$$(call toupper,$*)" instead.' 1>&2; \
+ exit 1; \
+ fi
+
+## Tests should only use END and EOF for here documents
+## (so that the next test is effective).
+sc_tests_here_document_format:
+ @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \
+ echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
+ exit 1; \
+ fi
+
+## Our test case should use the $(...) POSIX form for command substitution,
+## rather than the older `...` form.
+## The point of ignoring text on here-documents is that we want to exempt
+## Makefile.am rules, configure.ac code and helper shell script created and
+## used by out shell scripts, because Autoconf (as of version 2.69) does not
+## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
+sc_tests_command_subst:
+ @found=false; \
+ scan () { \
+ sed -n -e '/^#/d' \
+ -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
+ -e 's/\\`/\\{backtick}/' \
+ -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
+ -e '/`/p' $$*; \
+ }; \
+ for file in $(xtests); do \
+ res=`scan $$file`; \
+ if test -n "$$res"; then \
+ echo "$$file:$$res"; \
+ found=true; \
+ fi; \
+ done; \
+ if $$found; then \
+ echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
+ exit 1; \
+ fi
+
+## Tests should no longer call 'Exit', just 'exit'. That's because we
+## now have in place a better workaround to ensure the exit status is
+## transported correctly across the exit trap.
+sc_tests_exit_not_Exit:
+ @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
+ echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
+ exit 1; \
+ fi
+
+## Guard against obsolescent uses of ./defs in tests. Now,
+## 'test-init.sh' should be used instead.
+sc_tests_no_source_defs:
+ @if grep -E '\. .*defs($$| )' $(xtests); then \
+ echo "Source 'test-init.sh', not './defs'." 1>&2; \
+ exit 1; \
+ fi
+
+## Use AUTOMAKE_fails when appropriate
+sc_tests_automake_fails:
+ @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
+ echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
+ exit 1; \
+ fi
+
+## Setting 'required' after sourcing './defs' is a bug.
+sc_tests_required_after_defs:
+ @for file in $(xtests); do \
+ if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
+ echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
+ exit 1; \
+ fi; \
+ done
+
+## Overriding a Makefile macro on the command line is not portable when
+## recursive targets are used. Better use an envvar. SHELL is an
+## exception, POSIX says it can't come from the environment. V, DESTDIR,
+## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
+## as package authors are urged not to initialize them anywhere.
+## Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
+## ok to override it from the command line.
+sc_tests_overriding_macros_on_cmdline:
+ @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
+ echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
+ echo ' in the above lines, it is more portable.' 1>&2; \
+ exit 1; \
+ fi
+# The first s/// tries to account for usages like "$MAKE || st=$?".
+# 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
+# their definitions, hence the more complex last three substitutions below.
+# Also, the 'make-dryrun.sh' is whitelisted, since there we need to
+# override variables from the command line in order to cover the expected
+# code paths.
+ @tests=`for t in $(xtests); do \
+ case $$t in */make-dryrun.sh);; *) echo $$t;; esac; \
+ done`; \
+ if sed -e 's/ || .*//' -e 's/ && .*//' \
+ -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
+ -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
+ -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
+ -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
+ -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
+ -e "s/ exp='[^']*'/ /" \
+ -e 's/ exp="[^"]*"/ /' \
+ -e 's/ exp=[^ ]/ /' \
+ $$tests | grep '\$$MAKE .*='; then \
+ echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
+ echo 'it is more portable.' 1>&2; \
+ exit 1; \
+ fi
+ @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
+ echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
+ echo 'the above lines.' 1>&2; \
+ exit 1; \
+ fi
+
+## Prefer use of our 'is_newest' auxiliary script over the more hacky
+## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
+## cumbersome and more fragile.
+sc_tests_ls_t:
+ @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
+ $(xtests); then \
+ echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
+ exit 1; \
+ fi
+
+## Test scripts must be executable.
+sc_tests_executable:
+ @st=0; \
+ for f in $(xtests); do \
+ case $$f in \
+ t/ax/*|./t/ax/*|$(srcdir)/t/ax/*);; \
+ *) test -x $$f || { echo "$$f: not executable" >&2; st=1; }; \
+ esac; \
+ done; \
+ test $$st -eq 0 || echo '$@: some test scripts are not executable' >&2; \
+ exit $$st;
+
+
+## Never use 'sleep 1' to create files with different timestamps.
+## Use '$sleep' instead. Some filesystems (e.g., Windows) have only
+## a 2sec resolution.
+sc_tests_plain_sleep:
+ @if grep -E '\bsleep +[12345]\b' $(xtests); then \
+ echo 'Do not use "sleep x" in the above tests. Use "$$sleep" instead.' 1>&2; \
+ exit 1; \
+ fi
+
+## fgrep and egrep are not required by POSIX.
+sc_m4_am_plain_egrep_fgrep:
+ @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
+ echo 'Do not use egrep or fgrep in the above files,' \
+ 'they are not portable.' 1>&2; \
+ exit 1; \
+ fi
+
+## Prefer 'configure.ac' over the obsolescent 'configure.in' as the name
+## for configure input files in our testsuite. The latter has been
+## deprecated for several years (at least since autoconf 2.50).
+sc_tests_no_configure_in:
+ @if grep -E '\bconfigure\\*\.in\b' $(xtests) $(xdefs) \
+ | grep -Ev '/backcompat.*\.(sh|tap):' \
+ | grep -Ev '/autodist-configure-no-subdir\.sh:' \
+ | grep -Ev '/(configure|help)\.sh:' \
+ | grep .; \
+ then \
+ echo "Use 'configure.ac', not 'configure.in', as the name" >&2; \
+ echo "for configure input files in the test cases above." >&2; \
+ exit 1; \
+ fi
+
+## Rule to ensure that the testsuite has been run before. We don't depend
+## on 'check' here, because that would be very wasteful in the common case.
+## We could run "make check RECHECK_LOGS=" and avoid toplevel races with
+## AM_RECURSIVE_TARGETS. Suggest keeping test directories around for
+## greppability of the Makefile.in files.
+sc_ensure_testsuite_has_run:
+ @if test ! -f '$(TEST_SUITE_LOG)'; then \
+ echo 'Run "env keep_testdirs=yes make check" before' \
+ 'running "make maintainer-check"' >&2; \
+ exit 1; \
+ fi
+.PHONY: sc_ensure_testsuite_has_run
+
+## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
+## This test actually depends on the testsuite having been run before.
+sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
+ @if grep -E '(warning|error):.*(warning|error):' t/*.log; then \
+ echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
+ exit 1; \
+ fi
+
+## Ensure variables are listed before rules in Makefile.in files we generate.
+sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
+ @st=0; \
+ for file in `find t -name Makefile.in -print`; do \
+ latevars=`sed -n \
+ -e :x -e 's/#.*//' \
+ -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
+ -e '# Literal TAB.' \
+ -e '1,/^ /d' \
+ -e '# Allow @ so we match conditionals.' \
+ -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
+ if test -n "$$latevars"; then \
+ echo "Variables are expanded too late in $$file:" >&2; \
+ echo "$$latevars" | sed 's/^/ /' >&2; \
+ st=1; \
+ fi; \
+ done; \
+ test $$st -eq 0 || { \
+ echo 'Ensure variables are expanded before rules' >&2; \
+ exit 1; \
+ }
+
+## Using ':' as a PATH separator is not portable.
+sc_tests_PATH_SEPARATOR:
+ @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
+ echo "Use '\$$PATH_SEPARATOR', not ':', in PATH definitions" \
+ "above." 1>&2; \
+ exit 1; \
+ fi
+
+## Try to make sure all @...@ substitutions are covered by our
+## substitution rule.
+sc_perl_at_substs:
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
+ echo "Unresolved @...@ substitution in aclocal" 1>&2; \
+ exit 1; \
+ fi
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
+ echo "Unresolved @...@ substitution in automake" 1>&2; \
+ exit 1; \
+ fi
+
+sc_unquoted_DESTDIR:
+ @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
+ echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
+ exit 1; \
+ fi
+
+sc_tabs_in_texi:
+ @if grep ' ' $(srcdir)/doc/automake.texi; then \
+ echo 'Do not use tabs in the manual.' 1>&2; \
+ exit 1; \
+ fi
+
+sc_at_in_texi:
+ @if grep -E '([^@]|^)@([ ][^@]|$$)' $(srcdir)/doc/automake.texi; \
+ then \
+ echo 'Unescaped @.' 1>&2; \
+ exit 1; \
+ fi
+
+$(syntax_check_rules): automake aclocal
+maintainer-check: $(syntax_check_rules)
+.PHONY: maintainer-check $(syntax_check_rules)
+
+## Check that the list of tests given in the Makefile is equal to the
+## list of all test scripts in the Automake testsuite.
+maintainer-check: maintainer-check-list-of-tests
diff --git a/syntax-checks.mk b/syntax-checks.mk
deleted file mode 100644
index 375738be9..000000000
--- a/syntax-checks.mk
+++ /dev/null
@@ -1,544 +0,0 @@
-# Maintainer checks for Automake. Requires GNU make.
-
-# Copyright (C) 2012-2013 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 2, 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 .
-
-# We also have to take into account VPATH builds (where some generated
-# tests might be in '$(builddir)' rather than in '$(srcdir)'), TAP-based
-# tests script (which have a '.tap' extension) and helper scripts used
-# by other test cases (which have a '.sh' extension).
-xtests := $(shell \
- if test $(srcdir) = .; then \
- dirs=.; \
- else \
- dirs='$(srcdir) .'; \
- fi; \
- for d in $$dirs; do \
- for s in tap sh; do \
- ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \
- done; \
- done | sort)
-
-xdefs = \
- $(srcdir)/t/ax/am-test-lib.sh \
- $(srcdir)/t/ax/test-lib.sh \
- $(srcdir)/t/ax/test-defs.in
-
-ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
-
-# Some simple checks, and then ordinary check. These are only really
-# guaranteed to work on my machine.
-syntax_check_rules = \
-$(sc_tests_plain_check_rules) \
-sc_diff_automake \
-sc_diff_aclocal \
-sc_no_brace_variable_expansions \
-sc_rm_minus_f \
-sc_no_for_variable_in_macro \
-sc_mkinstalldirs \
-sc_pre_normal_post_install_uninstall \
-sc_perl_no_undef \
-sc_perl_no_split_regex_space \
-sc_cd_in_backquotes \
-sc_cd_relative_dir \
-sc_perl_at_uscore_in_scalar_context \
-sc_perl_local \
-sc_AMDEP_TRUE_in_automake_in \
-sc_tests_make_without_am_makeflags \
-$(sc_obsolete_requirements_rules) \
-sc_tests_no_source_defs \
-sc_tests_obsolete_variables \
-sc_tests_here_document_format \
-sc_tests_command_subst \
-sc_tests_exit_not_Exit \
-sc_tests_automake_fails \
-sc_tests_required_after_defs \
-sc_tests_overriding_macros_on_cmdline \
-sc_tests_plain_sleep \
-sc_tests_ls_t \
-sc_tests_executable \
-sc_m4_am_plain_egrep_fgrep \
-sc_tests_no_configure_in \
-sc_tests_PATH_SEPARATOR \
-sc_tests_logs_duplicate_prefixes \
-sc_tests_makefile_variable_order \
-sc_perl_at_substs \
-sc_unquoted_DESTDIR \
-sc_tabs_in_texi \
-sc_at_in_texi
-
-## These check avoids accidental configure substitutions in the source.
-## There are exactly 8 lines that should be modified from automake.in to
-## automake, and 9 lines that should be modified from aclocal.in to
-## aclocal.
-automake_diff_no = 8
-aclocal_diff_no = 9
-sc_diff_automake sc_diff_aclocal: sc_diff_% :
- @set +e; tmp=$*-diffs.tmp; \
- diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
- added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
- removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
- test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
- || { \
- echo "Found unexpected diffs between $*.in and $*"; \
- echo "Lines added: $$added" ; \
- echo "Lines removed: $$removed"; \
- cat $$tmp >&2; \
- exit 1; \
- } >&1; \
- rm -f $$tmp
-
-## Expect no instances of '${...}'. However, $${...} is ok, since that
-## is a shell construct, not a Makefile construct.
-sc_no_brace_variable_expansions:
- @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
- echo "Found too many uses of '\$${' in the lines above." 1>&2; \
- exit 1; \
- else :; fi
-
-## Make sure 'rm' is called with '-f'.
-sc_rm_minus_f:
- @if grep -v '^#' $(ams) $(xtests) \
- | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
- | grep -E '\)'; \
- then \
- echo "Suspicious 'rm' invocation." 1>&2; \
- exit 1; \
- else :; fi
-
-## Never use something like "for file in $(FILES)", this doesn't work
-## if FILES is empty or if it contains shell meta characters (e.g. $ is
-## commonly used in Java filenames).
-sc_no_for_variable_in_macro:
- @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
- echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
- exit 1; \
- else :; fi
-
-## Make sure all invocations of mkinstalldirs are correct.
-sc_mkinstalldirs:
- @if grep -n 'mkinstalldirs' $(ams) \
- | grep -F -v '$$(mkinstalldirs)' \
- | grep -v '^\./Makefile.am:[0-9][0-9]*: *lib/mkinstalldirs \\$$'; \
- then \
- echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
- exit 1; \
- else :; fi
-
-## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
-sc_pre_normal_post_install_uninstall:
- @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
- grep -v ':##' | grep -v ': @\$$('; then \
- echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
- exit 1; \
- else :; fi
-
-## We never want to use "undef", only "delete", but for $/.
-sc_perl_no_undef:
- @if grep -n -w 'undef ' $(srcdir)/automake.in | \
- grep -F -v 'undef $$/'; then \
- echo "Found undef in automake.in; use delete instead" 1>&2; \
- exit 1; \
- fi
-
-## We never want split (/ /,...), only split (' ', ...).
-sc_perl_no_split_regex_space:
- @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
- echo "Found bad split in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Look for cd within backquotes
-sc_cd_in_backquotes:
- @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
- echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Look for cd to a relative directory (may be influenced by CDPATH).
-## Skip some known directories that are OK.
-sc_cd_relative_dir:
- @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
- grep -v 'echo.*cd ' | \
- grep -v 'am__cd =' | \
- grep -v '^[^#]*cd [./]' | \
- grep -v '^[^#]*cd \$$(top_builddir)' | \
- grep -v '^[^#]*cd "\$$\$$am__cwd' | \
- grep -v '^[^#]*cd \$$(abs' | \
- grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
- echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Using @_ in a scalar context is most probably a programming error.
-sc_perl_at_uscore_in_scalar_context:
- @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
- echo "Using @_ in a scalar context in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Allow only few variables to be localized in Automake.
-sc_perl_local:
- @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
- grep '^[ \t]*local [^*]'; then \
- echo "Please avoid 'local'." 1>&2; \
- exit 1; \
- fi
-
-## Don't let AMDEP_TRUE substitution appear in automake.in.
-sc_AMDEP_TRUE_in_automake_in:
- @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
- echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
- exit 1; \
- fi
-
-## Recursive make invocations should always pass $(AM_MAKEFLAGS)
-## to $(MAKE), for portability to non-GNU make.
-sc_tests_make_without_am_makeflags:
- @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
- | grep -v 'AM_MAKEFLAGS' \
- | grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \
- then \
- echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
- exit 1; \
- fi
-
-## Look out for some obsolete variables.
-sc_tests_obsolete_variables:
- @vars=" \
- using_tap \
- am_using_tap \
- test_prefer_config_shell \
- original_AUTOMAKE \
- original_ACLOCAL \
- parallel_tests \
- am_parallel_tests \
- "; \
- seen=""; \
- for v in $$vars; do \
- if grep -E "\b$$v\b" $(xtests) $(xdefs); then \
- seen="$$seen $$v"; \
- fi; \
- done; \
- if test -n "$$seen"; then \
- for v in $$seen; do \
- case $$v in \
- parallel_tests|am_parallel_tests) v2=am_serial_tests;; \
- *) v2=am_$$v;; \
- esac; \
- echo "Variable '$$v' is obsolete, use '$$v2' instead." 1>&2; \
- done; \
- exit 1; \
- else :; fi
-
-## Look out for obsolete requirements specified in the test cases.
-sc_obsolete_requirements_rules = sc_no_texi2dvi-o sc_no_makeinfo-html
-modern-requirement.texi2dvi-o = texi2dvi
-modern-requirement.makeinfo-html = makeinfo
-
-$(sc_obsolete_requirements_rules): sc_no_% :
- @if grep -E 'required=.*\b$*\b' $(xtests); then \
- echo "Requirement '$*' is obsolete and shouldn't" \
- "be used anymore." >&2; \
- echo "You should use '$(modern-requirement.$*)' instead." >&2; \
- exit 1; \
- fi
-
-## Tests should never call some programs directly, but only through the
-## corresponding variable (e.g., '$MAKE', not 'make'). This will allow
-## the programs to be overridden at configure time (for less brittleness)
-## or by the user at make time (to allow better testsuite coverage).
-sc_tests_plain_check_rules = \
- sc_tests_plain_egrep \
- sc_tests_plain_fgrep \
- sc_tests_plain_make \
- sc_tests_plain_perl \
- sc_tests_plain_automake \
- sc_tests_plain_aclocal \
- sc_tests_plain_autoconf \
- sc_tests_plain_autoupdate \
- sc_tests_plain_autom4te \
- sc_tests_plain_autoheader \
- sc_tests_plain_autoreconf
-
-toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
-
-$(sc_tests_plain_check_rules): sc_tests_plain_% :
- @# The leading ':' in the grep below is what is printed by the
- @# preceding 'grep -v' after the file name.
- @# It works here as a poor man's substitute for beginning-of-line
- @# marker.
- @if grep -v '^[ ]*#' $(xtests) \
- | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[ ]*?$*\b'; \
- then \
- echo 'Do not run "$*" in the above tests.' \
- 'Use "$$$(call toupper,$*)" instead.' 1>&2; \
- exit 1; \
- fi
-
-## Tests should only use END and EOF for here documents
-## (so that the next test is effective).
-sc_tests_here_document_format:
- @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \
- echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
- exit 1; \
- fi
-
-## Our test case should use the $(...) POSIX form for command substitution,
-## rather than the older `...` form.
-## The point of ignoring text on here-documents is that we want to exempt
-## Makefile.am rules, configure.ac code and helper shell script created and
-## used by out shell scripts, because Autoconf (as of version 2.69) does not
-## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
-sc_tests_command_subst:
- @found=false; \
- scan () { \
- sed -n -e '/^#/d' \
- -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
- -e 's/\\`/\\{backtick}/' \
- -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
- -e '/`/p' $$*; \
- }; \
- for file in $(xtests); do \
- res=`scan $$file`; \
- if test -n "$$res"; then \
- echo "$$file:$$res"; \
- found=true; \
- fi; \
- done; \
- if $$found; then \
- echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
- exit 1; \
- fi
-
-## Tests should no longer call 'Exit', just 'exit'. That's because we
-## now have in place a better workaround to ensure the exit status is
-## transported correctly across the exit trap.
-sc_tests_exit_not_Exit:
- @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
- echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
- exit 1; \
- fi
-
-## Guard against obsolescent uses of ./defs in tests. Now,
-## 'test-init.sh' should be used instead.
-sc_tests_no_source_defs:
- @if grep -E '\. .*defs($$| )' $(xtests); then \
- echo "Source 'test-init.sh', not './defs'." 1>&2; \
- exit 1; \
- fi
-
-## Use AUTOMAKE_fails when appropriate
-sc_tests_automake_fails:
- @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
- echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
- exit 1; \
- fi
-
-## Setting 'required' after sourcing './defs' is a bug.
-sc_tests_required_after_defs:
- @for file in $(xtests); do \
- if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
- echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
- exit 1; \
- fi; \
- done
-
-## Overriding a Makefile macro on the command line is not portable when
-## recursive targets are used. Better use an envvar. SHELL is an
-## exception, POSIX says it can't come from the environment. V, DESTDIR,
-## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
-## as package authors are urged not to initialize them anywhere.
-## Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
-## ok to override it from the command line.
-sc_tests_overriding_macros_on_cmdline:
- @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
- echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
- echo ' in the above lines, it is more portable.' 1>&2; \
- exit 1; \
- fi
-# The first s/// tries to account for usages like "$MAKE || st=$?".
-# 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
-# their definitions, hence the more complex last three substitutions below.
-# Also, the 'make-dryrun.sh' is whitelisted, since there we need to
-# override variables from the command line in order to cover the expected
-# code paths.
- @tests=`for t in $(xtests); do \
- case $$t in */make-dryrun.sh);; *) echo $$t;; esac; \
- done`; \
- if sed -e 's/ || .*//' -e 's/ && .*//' \
- -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
- -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
- -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
- -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
- -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
- -e "s/ exp='[^']*'/ /" \
- -e 's/ exp="[^"]*"/ /' \
- -e 's/ exp=[^ ]/ /' \
- $$tests | grep '\$$MAKE .*='; then \
- echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
- echo 'it is more portable.' 1>&2; \
- exit 1; \
- fi
- @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
- echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
- echo 'the above lines.' 1>&2; \
- exit 1; \
- fi
-
-## Prefer use of our 'is_newest' auxiliary script over the more hacky
-## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
-## cumbersome and more fragile.
-sc_tests_ls_t:
- @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
- $(xtests); then \
- echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
- exit 1; \
- fi
-
-## Test scripts must be executable.
-sc_tests_executable:
- @st=0; \
- for f in $(xtests); do \
- case $$f in \
- t/ax/*|./t/ax/*|$(srcdir)/t/ax/*);; \
- *) test -x $$f || { echo "$$f: not executable" >&2; st=1; }; \
- esac; \
- done; \
- test $$st -eq 0 || echo '$@: some test scripts are not executable' >&2; \
- exit $$st;
-
-
-## Never use 'sleep 1' to create files with different timestamps.
-## Use '$sleep' instead. Some filesystems (e.g., Windows) have only
-## a 2sec resolution.
-sc_tests_plain_sleep:
- @if grep -E '\bsleep +[12345]\b' $(xtests); then \
- echo 'Do not use "sleep x" in the above tests. Use "$$sleep" instead.' 1>&2; \
- exit 1; \
- fi
-
-## fgrep and egrep are not required by POSIX.
-sc_m4_am_plain_egrep_fgrep:
- @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
- echo 'Do not use egrep or fgrep in the above files,' \
- 'they are not portable.' 1>&2; \
- exit 1; \
- fi
-
-## Prefer 'configure.ac' over the obsolescent 'configure.in' as the name
-## for configure input files in our testsuite. The latter has been
-## deprecated for several years (at least since autoconf 2.50).
-sc_tests_no_configure_in:
- @if grep -E '\bconfigure\\*\.in\b' $(xtests) $(xdefs) \
- | grep -Ev '/backcompat.*\.(sh|tap):' \
- | grep -Ev '/autodist-configure-no-subdir\.sh:' \
- | grep -Ev '/(configure|help)\.sh:' \
- | grep .; \
- then \
- echo "Use 'configure.ac', not 'configure.in', as the name" >&2; \
- echo "for configure input files in the test cases above." >&2; \
- exit 1; \
- fi
-
-## Rule to ensure that the testsuite has been run before. We don't depend
-## on 'check' here, because that would be very wasteful in the common case.
-## We could run "make check RECHECK_LOGS=" and avoid toplevel races with
-## AM_RECURSIVE_TARGETS. Suggest keeping test directories around for
-## greppability of the Makefile.in files.
-sc_ensure_testsuite_has_run:
- @if test ! -f '$(TEST_SUITE_LOG)'; then \
- echo 'Run "env keep_testdirs=yes make check" before' \
- 'running "make maintainer-check"' >&2; \
- exit 1; \
- fi
-.PHONY: sc_ensure_testsuite_has_run
-
-## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
-## This test actually depends on the testsuite having been run before.
-sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
- @if grep -E '(warning|error):.*(warning|error):' t/*.log; then \
- echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
- exit 1; \
- fi
-
-## Ensure variables are listed before rules in Makefile.in files we generate.
-sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
- @st=0; \
- for file in `find t -name Makefile.in -print`; do \
- latevars=`sed -n \
- -e :x -e 's/#.*//' \
- -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
- -e '# Literal TAB.' \
- -e '1,/^ /d' \
- -e '# Allow @ so we match conditionals.' \
- -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
- if test -n "$$latevars"; then \
- echo "Variables are expanded too late in $$file:" >&2; \
- echo "$$latevars" | sed 's/^/ /' >&2; \
- st=1; \
- fi; \
- done; \
- test $$st -eq 0 || { \
- echo 'Ensure variables are expanded before rules' >&2; \
- exit 1; \
- }
-
-## Using ':' as a PATH separator is not portable.
-sc_tests_PATH_SEPARATOR:
- @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
- echo "Use '\$$PATH_SEPARATOR', not ':', in PATH definitions" \
- "above." 1>&2; \
- exit 1; \
- fi
-
-## Try to make sure all @...@ substitutions are covered by our
-## substitution rule.
-sc_perl_at_substs:
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
- echo "Unresolved @...@ substitution in aclocal" 1>&2; \
- exit 1; \
- fi
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
- echo "Unresolved @...@ substitution in automake" 1>&2; \
- exit 1; \
- fi
-
-sc_unquoted_DESTDIR:
- @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
- echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
- exit 1; \
- fi
-
-sc_tabs_in_texi:
- @if grep ' ' $(srcdir)/doc/automake.texi; then \
- echo 'Do not use tabs in the manual.' 1>&2; \
- exit 1; \
- fi
-
-sc_at_in_texi:
- @if grep -E '([^@]|^)@([ ][^@]|$$)' $(srcdir)/doc/automake.texi; \
- then \
- echo 'Unescaped @.' 1>&2; \
- exit 1; \
- fi
-
-$(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
-.PHONY: maintainer-check $(syntax_check_rules)
-
-## Check that the list of tests given in the Makefile is equal to the
-## list of all test scripts in the Automake testsuite.
-maintainer-check: maintainer-check-list-of-tests
--
cgit v1.2.1
From da0dfbe7715c8f9558d7ee212b7eb8aac852a2ec Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 12:54:07 +0100
Subject: tests: move runtest.in away from the top-lever directory
Not only this leaves the top-lever directory less cluttered, but
helps in keeping the testsuite-related files more "centralized".
* runtest.in: Move ...
* t/ax/runtest.in: ... here. While at it, add customary
'@configure_input@' comment line.
* Makefile.am (runtest, EXTRA_DIST): Adjust.
Signed-off-by: Stefano Lattarini
---
Makefile.am | 10 ++---
runtest.in | 119 -------------------------------------------------------
t/ax/runtest.in | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 125 insertions(+), 124 deletions(-)
delete mode 100644 runtest.in
create mode 100644 t/ax/runtest.in
diff --git a/Makefile.am b/Makefile.am
index 0c9d8b7a4..d868501f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -337,7 +337,7 @@ TESTS =
# Some testsuite-influential variables should be overridable from the
# test scripts, but not from the environment.
-# Keep this in sync with the similar list in 'runtest.in'.
+# Keep this in sync with the similar list in 't/ax/runtest.in'.
AM_TESTS_ENVIRONMENT = \
for v in \
required \
@@ -445,14 +445,14 @@ EXTRA_DIST += t/ax/shell-no-trail-bslash.in
CLEANFILES += t/ax/shell-no-trail-bslash
noinst_SCRIPTS += t/ax/shell-no-trail-bslash
-runtest: runtest.in Makefile
+runtest: t/ax/runtest.in Makefile
$(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=runtest.in \
+ $(AM_V_GEN)in=t/ax/runtest.in \
&& $(MKDIR_P) t/ax \
- && $(do_subst) <$(srcdir)/runtest.in >$@-t \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
&& chmod a+x $@-t
$(generated_file_finalize)
-EXTRA_DIST += runtest.in
+EXTRA_DIST += t/ax/runtest.in
CLEANFILES += runtest
noinst_SCRIPTS += runtest
diff --git a/runtest.in b/runtest.in
deleted file mode 100644
index 364ba4a86..000000000
--- a/runtest.in
+++ /dev/null
@@ -1,119 +0,0 @@
-#!@AM_TEST_RUNNER_SHELL@
-#
-# Copyright (C) 2012-2013 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 2, 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 .
-
-# Run an Automake test from the command line.
-
-set -e; set -u
-
-: ${AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'}
-: ${AM_PROVE_CMD='prove'}
-: ${AM_PROVEFLAGS='--merge --verbose'}
-: ${srcdir='@srcdir@'}
-: ${abs_srcdir='@abs_srcdir@'}
-: ${abs_builddir='@abs_builddir@'}
-: ${PATH_SEPARATOR='@PATH_SEPARATOR@'}
-
-# For sourcing of extra "shell libraries" by our test scripts. As per
-# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
-# in case it is given with a relative name containing no slashes.
-if test "$srcdir" != .; then
- PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH
-fi
-PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH
-export PATH
-
-# For use by the testsuite framework. The Automake test harness
-# define this, so we better do the same.
-export srcdir
-
-# Some testsuite-influential variables should be overridable from the
-# test scripts, but not from the environment.
-# Keep this in sync with the 'Makefile.am:AM_TESTS_ENVIRONMENT'.
-for v in \
- required \
- am_test_protocol \
- am_serial_tests \
- am_test_prefer_config_shell \
- am_original_AUTOMAKE \
- am_original_ACLOCAL \
- am_test_lib_sourced \
- test_lib_sourced \
-; do
- eval "$v= && unset $v" || exit 1
-done
-unset v
-
-error () { echo "$0: $*" >&2; exit 255; }
-
-# Some shell flags should be passed over to the test scripts.
-shell_opts=
-while test $# -gt 0; do
- case $1 in
- --help)
- echo "Usage: $0 [--shell=PATH] [SHELL-OPTIONS] TEST [TEST-OPTIONS]"
- exit $?
- ;;
- --shell)
- test $# -gt 1 || error "missing argument for option '$1'"
- AM_TEST_RUNNER_SHELL=$2
- shift
- ;;
- --shell=*)
- AM_TEST_RUNNER_SHELL=${1#--shell=}
- ;;
- -o)
- test $# -gt 1 || error "missing argument for option '$1'"
- shell_opts="$shell_opts -o $2"
- shift
- ;;
- -*)
- # Assume it is an option to pass through to the shell.
- shell_opts="$shell_opts $1";;
- *)
- break;;
- esac
- shift
-done
-
-test $# -gt 0 || error "missing argument"
-
-tst=$1; shift
-
-case $tst in
- /*) ;;
- *) if test -f ./$tst; then
- tst=./$tst
- # Support for VPATH build.
- elif test -f $srcdir/$tst; then
- tst=$srcdir/$tst
- else
- error "could not find test '$tst'"
- fi
- ;;
-esac
-
-case $tst in
- *.sh)
- exec $AM_TEST_RUNNER_SHELL $shell_opts "$tst" ${1+"$@"} ;;
- *.tap)
- exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e \
- "$AM_TEST_RUNNER_SHELL $shell_opts" "$tst" ${1+"$@"} ;;
- *)
- error "test '$tst' has an unrecognized extension" ;;
-esac
-
-error "dead code reached"
diff --git a/t/ax/runtest.in b/t/ax/runtest.in
new file mode 100644
index 000000000..57d16a0db
--- /dev/null
+++ b/t/ax/runtest.in
@@ -0,0 +1,120 @@
+#!@AM_TEST_RUNNER_SHELL@
+# @configure_input@
+#
+# Copyright (C) 2012-2013 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 2, 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 .
+
+# Run an Automake test from the command line.
+
+set -e; set -u
+
+: ${AM_TEST_RUNNER_SHELL='@AM_TEST_RUNNER_SHELL@'}
+: ${AM_PROVE_CMD='prove'}
+: ${AM_PROVEFLAGS='--merge --verbose'}
+: ${srcdir='@srcdir@'}
+: ${abs_srcdir='@abs_srcdir@'}
+: ${abs_builddir='@abs_builddir@'}
+: ${PATH_SEPARATOR='@PATH_SEPARATOR@'}
+
+# For sourcing of extra "shell libraries" by our test scripts. As per
+# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+# in case it is given with a relative name containing no slashes.
+if test "$srcdir" != .; then
+ PATH=$abs_srcdir/t/ax$PATH_SEPARATOR$PATH
+fi
+PATH=$abs_builddir/t/ax$PATH_SEPARATOR$PATH
+export PATH
+
+# For use by the testsuite framework. The Automake test harness
+# define this, so we better do the same.
+export srcdir
+
+# Some testsuite-influential variables should be overridable from the
+# test scripts, but not from the environment.
+# Keep this in sync with the 'Makefile.am:AM_TESTS_ENVIRONMENT'.
+for v in \
+ required \
+ am_test_protocol \
+ am_serial_tests \
+ am_test_prefer_config_shell \
+ am_original_AUTOMAKE \
+ am_original_ACLOCAL \
+ am_test_lib_sourced \
+ test_lib_sourced \
+; do
+ eval "$v= && unset $v" || exit 1
+done
+unset v
+
+error () { echo "$0: $*" >&2; exit 255; }
+
+# Some shell flags should be passed over to the test scripts.
+shell_opts=
+while test $# -gt 0; do
+ case $1 in
+ --help)
+ echo "Usage: $0 [--shell=PATH] [SHELL-OPTIONS] TEST [TEST-OPTIONS]"
+ exit $?
+ ;;
+ --shell)
+ test $# -gt 1 || error "missing argument for option '$1'"
+ AM_TEST_RUNNER_SHELL=$2
+ shift
+ ;;
+ --shell=*)
+ AM_TEST_RUNNER_SHELL=${1#--shell=}
+ ;;
+ -o)
+ test $# -gt 1 || error "missing argument for option '$1'"
+ shell_opts="$shell_opts -o $2"
+ shift
+ ;;
+ -*)
+ # Assume it is an option to pass through to the shell.
+ shell_opts="$shell_opts $1";;
+ *)
+ break;;
+ esac
+ shift
+done
+
+test $# -gt 0 || error "missing argument"
+
+tst=$1; shift
+
+case $tst in
+ /*) ;;
+ *) if test -f ./$tst; then
+ tst=./$tst
+ # Support for VPATH build.
+ elif test -f $srcdir/$tst; then
+ tst=$srcdir/$tst
+ else
+ error "could not find test '$tst'"
+ fi
+ ;;
+esac
+
+case $tst in
+ *.sh)
+ exec $AM_TEST_RUNNER_SHELL $shell_opts "$tst" ${1+"$@"} ;;
+ *.tap)
+ exec "$AM_PROVE_CMD" $AM_PROVEFLAGS -e \
+ "$AM_TEST_RUNNER_SHELL $shell_opts" "$tst" ${1+"$@"} ;;
+ *)
+ error "test '$tst' has an unrecognized extension" ;;
+esac
+
+error "dead code reached"
--
cgit v1.2.1
From a59ac344dfe05e36a69cb70c49750d81b02a06ed Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 13:16:14 +0100
Subject: runtest: better command line API
* t/ax/runtest.in: Accept options '-k' and '--keep-testdirs' (same
as exporting '$keep_testdirs' to "yes"). To improve compatibility
with the "make check" interface, allow environment variables to be
passes on the command line. Minor adjustments while at it.
Signed-off-by: Stefano Lattarini
---
t/ax/runtest.in | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/t/ax/runtest.in b/t/ax/runtest.in
index 57d16a0db..57ce889c1 100644
--- a/t/ax/runtest.in
+++ b/t/ax/runtest.in
@@ -58,6 +58,7 @@ for v in \
done
unset v
+xecho () { printf '%s\n' "$*"; }
error () { echo "$0: $*" >&2; exit 255; }
# Some shell flags should be passed over to the test scripts.
@@ -65,7 +66,8 @@ shell_opts=
while test $# -gt 0; do
case $1 in
--help)
- echo "Usage: $0 [--shell=PATH] [SHELL-OPTIONS] TEST [TEST-OPTIONS]"
+ xecho "Usage: $0 [--shell=PATH] [-k] [SHELL-OPTIONS]" \
+ "[VAR=VALUE ...] TEST [TEST-OPTIONS]"
exit $?
;;
--shell)
@@ -81,9 +83,17 @@ while test $# -gt 0; do
shell_opts="$shell_opts -o $2"
shift
;;
+ -k|--keep-testdir|--keep-testdirs)
+ keep_testdirs=yes; export keep_testdirs;;
-*)
# Assume it is an option to pass through to the shell.
shell_opts="$shell_opts $1";;
+ *=*)
+ var=${1%%=*} val=${1#*=}
+ xecho "$var" | LC_ALL=C grep '^[a-zA-Z_][a-zA-Z0-9_]*$' >/dev/null \
+ || error "'$var': invalid variable name"
+ eval "$var=\$val && export $var" || exit 1
+ ;;
*)
break;;
esac
--
cgit v1.2.1
From 9e5579c5c5d692b0393349d3bdfa1d87e2eccbb9 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 13:42:20 +0100
Subject: tests: make two new test executable
* t/backslash-issues.sh: This.
* t/extra-data.sh: And this.
Issue revealed by the 'sc_tests_executable' maintainer check.
Signed-off-by: Stefano Lattarini
---
t/backslash-issues.sh | 0
t/extra-data.sh | 0
2 files changed, 0 insertions(+), 0 deletions(-)
mode change 100644 => 100755 t/backslash-issues.sh
mode change 100644 => 100755 t/extra-data.sh
diff --git a/t/backslash-issues.sh b/t/backslash-issues.sh
old mode 100644
new mode 100755
diff --git a/t/extra-data.sh b/t/extra-data.sh
old mode 100644
new mode 100755
--
cgit v1.2.1
From a790fae9ba74c917af37a735167fe9e1106f4dd7 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 14:05:31 +0100
Subject: texi: Texinfo sources and CLEANFILES definition should co-exist
peacefully
But they don't now, due to a regression introduced in commit
'v1.13.1-4-gc1a8f56'. Fix it. The regression was hitting our
own build system!
* automake.in (handle_texinfo_helper): Only complain if the
'info-in-builddir' is not active and a '.info' file (not any
random file!) is listed in CLEANFILES or DISTCLEANFILES.
Signed-off-by: Stefano Lattarini
---
automake.in | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/automake.in b/automake.in
index 53c49757d..e8ba73f94 100644
--- a/automake.in
+++ b/automake.in
@@ -3139,21 +3139,6 @@ sub handle_texinfo_helper ($)
my @f = ();
push @f, $d->value_as_list_recursive (inner_expand => 1) if $d;
push @f, $c->value_as_list_recursive (inner_expand => 1) if $c;
- if (@f && !option 'info-in-builddir')
- {
- msg 'obsolete', "$am_file.am", <
Date: Thu, 3 Jan 2013 14:32:54 +0100
Subject: build: enable all warnings as fatal in our own build system
Automake should of course be able to bootstrap itself in a
warning-free manner w.r.t. the Autotools. So make any failure
to do so fatal. Not doing so caused the regression fixed by
previous commit 'v1.13.1-22-ga790fae' to go unnoticed.
* configure.ac (AM_INIT_AUTOMAKE): Add '-Werror' and '-Wall'.
* bootstrap.sh: Pass the '-Wall -Werror' options to aclocal,
automake and autoconf invocations.
Signed-off-by: Stefano Lattarini
---
bootstrap.sh | 9 +++++----
configure.ac | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
index 07bcddd80..0ea691d31 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -111,12 +111,13 @@ $PERL ./gen-testsuite-part > t/testsuite-part.tmp
chmod a-w t/testsuite-part.tmp
mv -f t/testsuite-part.tmp t/testsuite-part.am
-# Run the autotools.
+# Run the autotools. Bail out if any warning is triggered.
# Use '-I' here so that our own *.m4 files in m4/ gets included,
# not copied, in aclocal.m4.
-$PERL ./aclocal.tmp -I m4 --automake-acdir m4 --system-acdir m4/acdir
-$AUTOCONF
-$PERL ./automake.tmp
+$PERL ./aclocal.tmp -Wall -Werror -I m4 \
+ --automake-acdir=m4 --system-acdir=m4/acdir
+$AUTOCONF -Wall -Werror
+$PERL ./automake.tmp -Wall -Werror
# Remove temporary files and directories.
rm -rf aclocal-$APIVERSION automake-$APIVERSION
diff --git a/configure.ac b/configure.ac
index cea7aaae7..f86af1879 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ AC_SUBST([am_AUTOUPDATE], ["${AUTOUPDATE-autoupdate}"])
dnl We call AC_PROG_CC in an unusual way, and only for use in our
dnl testsuite, so also use 'no-dependencies' and 'no-define' among
dnl the automake options to avoid bloating and potential problems.
-AM_INIT_AUTOMAKE([dist-xz filename-length-max=99 color-tests
+AM_INIT_AUTOMAKE([-Wall -Werror dist-xz filename-length-max=99 color-tests
no-define no-dependencies])
## Keep this on a line of its own, since it must be found and processed
--
cgit v1.2.1
From 654324c756210161c61484f754a1df77aa748a78 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 14:39:39 +0100
Subject: build: don't enable 'color-tests' automake option explicitly
It's enabled by default since commit 'v1.12.2-136-g2d5571e' (this
change appeared in Automake 1.13).
* configure.ac (AM_INIT_AUTOMAKE): Drop 'color-tests'.
Signed-off-by: Stefano Lattarini
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index f86af1879..d57ed6208 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,7 +39,7 @@ AC_SUBST([am_AUTOUPDATE], ["${AUTOUPDATE-autoupdate}"])
dnl We call AC_PROG_CC in an unusual way, and only for use in our
dnl testsuite, so also use 'no-dependencies' and 'no-define' among
dnl the automake options to avoid bloating and potential problems.
-AM_INIT_AUTOMAKE([-Wall -Werror dist-xz filename-length-max=99 color-tests
+AM_INIT_AUTOMAKE([-Wall -Werror dist-xz filename-length-max=99
no-define no-dependencies])
## Keep this on a line of its own, since it must be found and processed
--
cgit v1.2.1
From a5ebf351f7d41aff1e3716930d687096b3d4475d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 19:02:52 +0100
Subject: NEWS: improve wordings in entry deprecating suffix-less info files
Signed-off-by: Stefano Lattarini
---
NEWS | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index b8106adcc..02a34df75 100644
--- a/NEWS
+++ b/NEWS
@@ -53,7 +53,15 @@ New in 1.13.2:
- Use of suffix-less info files (that can be specified through the
'@setfilename' macro in Texinfo input files) is discouraged, and
- its use will raise warnings in the 'obsolete' category.
+ its use will raise warnings in the 'obsolete' category. Simply
+ use the '.info' extension for all your info files, transforming
+ usages like:
+
+ @setfilename myprogram
+
+ into:
+
+ @setfilename myprogram.info
- Use of Texinfo input files with '.txi' or '.texinfo' extensions
is discouraged, and its use will raise warnings in the 'obsolete'
--
cgit v1.2.1
From 6a67b29744ba72ff9ed6a12349a65b1e4a23f3a6 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 3 Jan 2013 23:10:42 +0100
Subject: texi: remove workaround for older Texinfo (4.1)
* lib/am/texibuild.am: Here, in the rules generating HTML output.
We can do so because, since Automake 1.13, we require Texinfo >= 4.9
anyway.
Basically a backport of Automake-NG commit '1.12.2-879-ge6caf5e'.
Signed-off-by: Stefano Lattarini
---
lib/am/texibuild.am | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am
index 3256fdea5..a59d443ed 100644
--- a/lib/am/texibuild.am
+++ b/lib/am/texibuild.am
@@ -110,15 +110,9 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
?GENERIC? -o $(@:.html=.htp) %SOURCE%; \
?!GENERIC? -o $(@:.html=.htp) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
then \
- rm -rf $@; \
-## Work around a bug in Texinfo 4.1 (-o foo.html outputs files in foo/
-## instead of foo.html/).
- if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
- mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
+ rm -rf $@ && mv $(@:.html=.htp) $@; \
else \
- if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
- rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
- exit 1; \
+ rm -rf $(@:.html=.htp); exit 1; \
fi
## If we are using the generic rules, we need separate dependencies.
--
cgit v1.2.1
From 5df23a7accb0e82109898f02818c2f65a0bb7b91 Mon Sep 17 00:00:00 2001
From: Karl Berry
Date: Thu, 3 Jan 2013 16:09:23 -0700
Subject: docs: mention dist-hook help for EXTRA_DIST
* automake.texi (Basics of Distribution): mention dist-hook
as working around the problems of whole directories in EXTRA_DIST.
Signed-off-by: Stefano Lattarini
---
doc/automake.texi | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/doc/automake.texi b/doc/automake.texi
index e53a2e511..8ace5e5e0 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8418,7 +8418,9 @@ You can also mention a directory in @code{EXTRA_DIST}; in this case the
entire directory will be recursively copied into the distribution.
Please note that this will also copy @emph{everything} in the directory,
including, e.g., Subversion's @file{.svn} private directories or CVS/RCS
-version control files. We recommend against using this feature.
+version control files; thus we recommend against using this feature
+as-is. However, you can use the @code{dist-hook} feature to
+ameliorate the problem; @pxref{The dist Hook}.
@vindex SUBDIRS
@vindex DIST_SUBDIRS
--
cgit v1.2.1
From 0071e0155c0881ef7cafd7b8f9a796e8377fc6db Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 4 Jan 2013 11:48:33 +0100
Subject: plans: add some on-going plans (already registered on the bug
tracker)
Signed-off-by: Stefano Lattarini
---
PLANS/obsolete-removed/am-prog-mkdir-p.txt | 67 ++++++++++++++++++++++
PLANS/obsolete-removed/configure.in.txt | 28 +++++++++
PLANS/texi/drop-split-info-files.txt | 27 +++++++++
.../warnings-for-automake-ng-compatibility.txt | 21 +++++++
4 files changed, 143 insertions(+)
create mode 100644 PLANS/obsolete-removed/am-prog-mkdir-p.txt
create mode 100644 PLANS/obsolete-removed/configure.in.txt
create mode 100644 PLANS/texi/drop-split-info-files.txt
create mode 100644 PLANS/texi/warnings-for-automake-ng-compatibility.txt
diff --git a/PLANS/obsolete-removed/am-prog-mkdir-p.txt b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
new file mode 100644
index 000000000..b096ecece
--- /dev/null
+++ b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
@@ -0,0 +1,67 @@
+In Automake 1.13.x
+------------------
+
+We had already scheduled the removal of the long-deprecated AM_PROG_MKDR_P
+macro (superseded by the autoconf-provided one AC_PROG_MKDIR_P) for
+Automake 1.13 -- see commit 'v1.12-20-g8a1c64f'.
+
+Alas, it turned out the latest Gettext version at the time (0.18.1.1) was
+still using that macro:
+
+
+
+And since the maintenance of Gettext was stalled, we couldn't get a fix
+committed and released in time for the appearance of automake 1.13:
+
+
+
+
+
+So, on a strong advice by Jim Meyering, in commit 'v1.12.4-158-gdf23daf'
+we re-introduced AM_PROG_MKDIR_P in Automake. That has been an
+unfortunate necessity (thanks to Jim for having convinced me of that in
+time!)
+
+
+For Automake 1.14
+-----------------
+
+Finally, AM_PROG_MKDR_P we'll be fully obsolete in in Automake 1.14 (see
+commit 'v1.12.4-174-g5a28948', merged in master by 'v1.13-5-gb373ad9'),
+while still offering a clear error message for the moment (see follow-up
+commit 'v1.13-30-gd01834b').
+
+We can finally do so because Gettext has got a maintainer in the meantime,
+and a new release has been made that no longer uses AM_PROG_MKDIR_P:
+
+
+
+We still keep the obsolete '@mkdir_p@' substitution and '$(mkdir_p)'
+variable around though, since they are still used by 'Makefile.in.in'
+template from gettext:
+
+ $ cd ~/src/gettext
+ $ git checkout master
+ $ git describe
+ v0.18.2-4-g3188bbf
+ $ grep mkdir_p gettext-runtime/po/Makefile.in.in | grep -v '^#'
+ mkdir_p = @mkdir_p@
+ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+ $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
+ $(mkdir_p) $(DESTDIR)$$dir; \
+
+(see also Automake commit v1.12.1-112-g2551021).
+
+More to the point, it's almost impossible to diagnose usages of those
+macro and substitution using the existing Automake parsing and warning
+infrastructure; it's much easier to just keep them around for a while.
+
+
+The future
+----------
+
+We want to finally remove '@mkdir_p@' and '$(mkdir_p)' as well some
+day. It would be nice if we could do so with some kind of deprecation,
+but that is not worth too much work. Anyway, no hurry an no high
+priority for this removal.
diff --git a/PLANS/obsolete-removed/configure.in.txt b/PLANS/obsolete-removed/configure.in.txt
new file mode 100644
index 000000000..baed853bc
--- /dev/null
+++ b/PLANS/obsolete-removed/configure.in.txt
@@ -0,0 +1,28 @@
+In Automake 1.13.x
+------------------
+
+We are already warning about 'configure.in' used as the name for the
+Autoconf input file ('configure.ac' should be used instead); we've
+been doing that since Automake 1.12.4.
+
+We had scheduled to remove support for it altogether in Automake 1.13
+(and announced that in our NEWS file), because we thought that Autoconf
+too would have started deprecating it by the time our 1.13 release was
+done. Alas, this hasn't been the case: the deprecation code is only
+present in the development version of autoconf so far (scheduled to
+become Autoconf 2.70). So ...
+
+
+For Automake 1.14
+-----------------
+
+... we have decided to wait until 2.70 is out before really removing
+'configure.in' support. Since we plan to require Autoconf 2.70 in
+Automake 1.14 (so that we can remove the hacky code emulating
+AC_CONFIG_MACRO_DIRS for older autoconf versions), we are quite sure
+that Autoconf will actually have started deprecating 'configure.in'
+by the time Automake 1.14 is released.
+
+Note that the removal of 'configure.in' has already been implemented
+in our master branch (from where the 1.14 release will be finally
+cut); see commits 'v1.13-17-gbff57c8' and 'v1.13-21-g7626e63'.
diff --git a/PLANS/texi/drop-split-info-files.txt b/PLANS/texi/drop-split-info-files.txt
new file mode 100644
index 000000000..708433158
--- /dev/null
+++ b/PLANS/texi/drop-split-info-files.txt
@@ -0,0 +1,27 @@
+For automake 1.14
+-----------------
+
+We want to drop split info files in Automake 1.14.
+See automake bug#13351: .
+
+Basically, it has been confirmed that the original reason behind
+the existence of split info files was indeed "efficiency,
+especially memory size":
+
+
+So split info files have lost their reason d'etre on modern systems
+(where even Emacs has become a lightweight program ;-). And you are
+not using an embedded system to read Info documentation, right?
+
+In addition, it appears that the use of split info files (at least
+the way Automake-generated rules have been handling them for a long
+time) can cause real problems in some (admittedly quite corner-case)
+situations; see automake bug#12320: .
+
+This change should be completely transparent to the developer (no
+adjustments needed to be made to Makefile.am or other parts of the
+build system). In case some CI system or overly picky build script
+used to rely on that feature, they'll have to be adjusted; but that
+is expected to be a rare occurrence, and thus a price worth pay for
+the nice simplifications and the fixlets this planned change will
+offer us.
diff --git a/PLANS/texi/warnings-for-automake-ng-compatibility.txt b/PLANS/texi/warnings-for-automake-ng-compatibility.txt
new file mode 100644
index 000000000..1dd3da336
--- /dev/null
+++ b/PLANS/texi/warnings-for-automake-ng-compatibility.txt
@@ -0,0 +1,21 @@
+For automake 1.13.2:
+--------------------
+
+I have discouraged the use of '.txi' and '.texinfo' suffixes for
+Texinfo inputs (see commit 'v1.13.1-6-ge1ed314') and the generation
+of suffix-less info files (commit 'v1.13.1-4-g2af418d').
+
+This is done to ease transition to Automake-NG (see commits
+'v1.12.1-416-gd5459b9' and 'v1.12.1-392-ga0c7b6a' there), and
+(to a lesser degree) to discourage use of seldom-tested setups.
+
+
+The Future:
+-----------
+
+I have no plans to do the further step of removing support for those
+usages in future Automake versions. That would be a gratuitous
+incompatibility (in Automake-NG, they have been useful because have
+allowed further refactorings and improvements, but those were
+based on GNU make features, and as such have no place in mainline
+Automake).
--
cgit v1.2.1
From 0ac78fd0580fa4c9b367b61b53120acf5eab9f53 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 5 Jan 2013 12:00:36 +0100
Subject: coverage: user can avoid distributing '.info' pages
Can be done like this:
AUTOMAKE_OPTIONS = info-in-builddir
dist-info:
@:
Note that this usage is not yet documented: we might decide to go
for a fully-fledged 'no-dist-info' flag, or something like that, in
future automake version (this is not yet decided); in which case,
it's better not to have people start to rely on the hack above.
Still, there's no good reason to break it gratuitously, hence this
test coverage.
* t/txinfo-nodist-info.sh: New test.
* t/list-of-tests.mk: Add it.
Signed-off-by: Stefano Lattarini
---
t/list-of-tests.mk | 1 +
t/txinfo-nodist-info.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100755 t/txinfo-nodist-info.sh
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 90eb34a34..f3e996325 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1166,6 +1166,7 @@ t/txinfo-info-in-srcdir.sh \
t/txinfo-makeinfo-error-no-clobber.sh \
t/txinfo-many-output-formats.sh \
t/txinfo-many-output-formats-vpath.sh \
+t/txinfo-nodist-info.sh \
t/txinfo-no-clutter.sh \
t/txinfo-no-extra-dist.sh \
t/txinfo-no-installinfo.sh \
diff --git a/t/txinfo-nodist-info.sh b/t/txinfo-nodist-info.sh
new file mode 100755
index 000000000..265587e4e
--- /dev/null
+++ b/t/txinfo-nodist-info.sh
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Check that we can force generated '.info' info files not to be
+# distributed.
+
+required=makeinfo
+. test-init.sh
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = info-in-builddir
+info_TEXINFOS = foo.texi
+CLEANFILES = foo.info
+
+# To make distcheck work without requiring TeX and texi2dvi.
+dvi:
+
+# Do not distribute generated '.info' files.
+dist-info:
+ @:
+END
+
+mkdir subdir
+
+cat > foo.texi << 'END'
+\input texinfo
+@setfilename foo.info
+@settitle foo
+@node Top
+Hello walls.
+@include version.texi
+@bye
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a -Wno-override
+
+./configure
+$MAKE distdir
+ls -l . $distdir # For debugging.
+test ! -e foo.info
+test ! -e $distdir/foo.info
+$MAKE
+test -f foo.info
+$MAKE distdir
+ls -l $distdir # For debugging.
+test ! -f $distdir/foo.info
+$MAKE distcheck
+
+:
--
cgit v1.2.1
From 285d7b14cc55c047c432e3ed7322cb1a4f96aab2 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 5 Jan 2013 12:12:56 +0100
Subject: texi: remove extra verbosity in creation of dirstamp directory
* lib/am/texi-vers.am (%STAMPVTI%): Here.
Signed-off-by: Stefano Lattarini
---
lib/am/texi-vers.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/am/texi-vers.am b/lib/am/texi-vers.am
index 3f91cf162..bddf3827d 100644
--- a/lib/am/texi-vers.am
+++ b/lib/am/texi-vers.am
@@ -31,7 +31,7 @@ DIST_COMMON += %VTEXI% %STAMPVTI%
## %STAMPVTI% is distributed and %DIRSTAMP% isn't: a distributed file
## should never be dependent upon a non-distributed built file.
## Therefore we ensure that %DIRSTAMP% exists in the rule.
-?DIRSTAMP? test -f %DIRSTAMP% || $(MAKE) $(AM_MAKEFLAGS) %DIRSTAMP%
+?DIRSTAMP? @test -f %DIRSTAMP% || $(MAKE) $(AM_MAKEFLAGS) %DIRSTAMP%
@(dir=.; test -f ./%TEXI% || dir=$(srcdir); \
set `$(SHELL) %MDDIR%mdate-sh $$dir/%TEXI%`; \
echo "@set UPDATED $$1 $$2 $$3"; \
--
cgit v1.2.1
From 744cd575c103166ed2b9e8ea1e8013f3e3e25bfe Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 8 Jan 2013 20:19:04 +0100
Subject: coverage: compile rules used "-c -o" also with losing compilers
If the 'subdir-objects' option is used, Automake-generated rules for
C compilation pass both the "-c" and "-o" options to the C compiler,
*unconditionally*. There are some compilers that choke on such an
usage, but the AM_PROG_CC_C_O macro takes care of them (it does so by
redefining $CC to use the Automake-provided 'compile' wrapper script
automatically, if a losing compiler is detected at configure runtime).
Unfortunately, in case the 'subdir-objects' option is specified in a
Makefile.am, but all the source files resided anyway in the top-level
directory (relative to the Makefile.am), Automake do *not* complain
if AM_PROG_CC_C_O wasn't invoked in 'configure.ac' -- all the while
still passing "-c -o" to the compiler invocations. This could cause
compilation failures with losing compilers if the user forget to call
AM_PROG_CC_C_O in 'configure.ac' (and Automake would not warn him of
the issue).
Expose this bug in the testsuite.
Issue identified by Nick Bowler in the discussion on automake bug#13378:
* t/ccnoco4.sh: New test.
* t/list-of-tests.mk (XFAIL_TESTS, handwritten_TESTS): List it.
Signed-off-by: Stefano Lattarini
---
t/ccnoco4.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
t/list-of-tests.mk | 2 ++
2 files changed, 72 insertions(+)
create mode 100755 t/ccnoco4.sh
diff --git a/t/ccnoco4.sh b/t/ccnoco4.sh
new file mode 100755
index 000000000..54b857a8e
--- /dev/null
+++ b/t/ccnoco4.sh
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 2001-2013 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 2, 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 .
+
+# Check that Automake doesn't pass "-c -o" to losing compiler when
+# the 'subdir-objects' is used but sources are only present in the
+# top-level directory. Reported by Nick Bowler in the discussion on
+# automake bug#13378:
+#
+#
+
+required=gcc
+. test-init.sh
+
+# We deliberately do not call AM_PROG_CC_C_O here.
+cat >> configure.ac << 'END'
+AC_PROG_CC
+$CC --version; $CC -v; # For debugging.
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo bar
+bar_SOURCES = foo.c
+END
+
+echo 'int main (void) { return 0; }' > foo.c
+
+cat > Mycomp << END
+#!/bin/sh
+
+case " \$* " in
+ *\ -c*\ -o* | *\ -o*\ -c*)
+ exit 1
+ ;;
+esac
+
+# Use '$CC', not 'gcc', to honour the compiler chosen
+# by the testsuite setup.
+exec $CC "\$@"
+END
+
+chmod +x Mycomp
+
+# Make sure the compiler doesn't understand '-c -o'.
+CC=$(pwd)/Mycomp
+export CC
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+
+./configure
+$MAKE
+$MAKE distcheck
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index f3e996325..aef3730e2 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -30,6 +30,7 @@ t/pm/Version3.pl
XFAIL_TESTS = \
t/all.sh \
+t/ccnoco4.sh \
t/cond17.sh \
t/gcj6.sh \
t/override-conditional-2.sh \
@@ -209,6 +210,7 @@ t/canon-name.sh \
t/ccnoco.sh \
t/ccnoco2.sh \
t/ccnoco3.sh \
+t/ccnoco4.sh \
t/check.sh \
t/check2.sh \
t/check4.sh \
--
cgit v1.2.1
From 965b8b367162c84f431d68877f97422a00f428ed Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 8 Jan 2013 20:42:28 +0100
Subject: tests: fix some botched inter-test references in heading comments
* t/aclocal-I-order-2.sh: Here.
* t/aclocal-I-order-2.sh: And here.
Signed-off-by: Stefano Lattarini
---
t/aclocal-I-order-2.sh | 2 +-
t/aclocal-I-order-3.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/aclocal-I-order-2.sh b/t/aclocal-I-order-2.sh
index fd58b4efc..c3fe00a95 100755
--- a/t/aclocal-I-order-2.sh
+++ b/t/aclocal-I-order-2.sh
@@ -16,7 +16,7 @@
# Make sure that when two files define the same macro in the same
# directory, the macro from the lexically greatest file is used.
-# See also sister test 'aclocal-I-ordering-2.sh'.
+# See also sister test 'aclocal-I-order-3.sh'.
am_create_testdir=empty
. test-init.sh
diff --git a/t/aclocal-I-order-3.sh b/t/aclocal-I-order-3.sh
index d2077fe92..4fcbf4c99 100755
--- a/t/aclocal-I-order-3.sh
+++ b/t/aclocal-I-order-3.sh
@@ -16,7 +16,7 @@
# Make sure that when two files define the same macro in the same
# directory, the macro from the lexically greatest file is used.
-# Same as acloca-I-ordering.sh, but without calling MACRO2.
+# Same as aclocal-I-order-2.sh, but without calling MACRO2.
am_create_testdir=empty
. test-init.sh
--
cgit v1.2.1
From a28f99b5a17a3930fb67978a8e42c4b3fe0ffeb9 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 8 Jan 2013 21:40:23 +0100
Subject: tests: fix an old botched change to an aclocal test
* t/acloca10.sh (configure.ac): Here, invoke the m4 macro 'MACRO2'
before the macro 'MACRO1' (the related test 't/aclocal-I-order-2.sh'
does the opposite). This reverts a botched edit done (by myself,
oops) in commit 'v1.11-1335-gefdc3e1' of 2011-09-11, "tests: minor
optimizations/simplifications in some aclocal tests", and makes the
behaviour of the test match once again what is stated in the
heading comments. While at it, improve those same heading comments
a little.
Signed-off-by: Stefano Lattarini
---
t/acloca10.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/acloca10.sh b/t/acloca10.sh
index 632e816b6..7c1b0d403 100755
--- a/t/acloca10.sh
+++ b/t/acloca10.sh
@@ -15,7 +15,7 @@
# along with this program. If not, see .
# Make sure aclocal define macros in the same order as -I's.
-# This is the same as aclocal-I-order-1.sh, with the macro calls
+# This is the similar to aclocal-I-order-1.sh, with the macro calls
# reversed (it did make a difference).
#
# Also check for --install.
@@ -28,8 +28,8 @@ am_create_testdir=empty
cat > configure.ac << 'END'
AC_INIT
-MACRO1
MACRO2
+MACRO1
MACRO3
END
--
cgit v1.2.1
From c328a53e07d3c5158e2b6458be8d0284e042c7e5 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 8 Jan 2013 21:47:40 +0100
Subject: tests: rename the last aclocal test with dumb name
* t/acloca10.sh: Rename ...
* t/aclocal-I-install.sh: ... to this saner and slightly more
self-explanatory name.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini
---
t/acloca10.sh | 100 ---------------------------------------------
t/aclocal-I-and-install.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++
t/list-of-tests.mk | 2 +-
3 files changed, 101 insertions(+), 101 deletions(-)
delete mode 100755 t/acloca10.sh
create mode 100755 t/aclocal-I-and-install.sh
diff --git a/t/acloca10.sh b/t/acloca10.sh
deleted file mode 100755
index 7c1b0d403..000000000
--- a/t/acloca10.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003-2013 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 2, 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 .
-
-# Make sure aclocal define macros in the same order as -I's.
-# This is the similar to aclocal-I-order-1.sh, with the macro calls
-# reversed (it did make a difference).
-#
-# Also check for --install.
-
-# TODO: write a sister test that doesn't use a 'dirlist' file, but
-# TODO: puts third-party macros directly into 'acdir'.
-
-am_create_testdir=empty
-. test-init.sh
-
-cat > configure.ac << 'END'
-AC_INIT
-MACRO2
-MACRO1
-MACRO3
-END
-
-ACLOCAL="$ACLOCAL --system-acdir acdir"
-
-mkdir m4_1 m4_2 acdir acdir2
-echo ./acdir2 > acdir/dirlist
-
-cat >m4_1/somedefs.m4 <m4_2/somedefs.m4 <acdir2/macro.m4 <>acdir2/macro.m4
-$ACLOCAL -I m4_1 -I m4_2 --install
-$AUTOCONF
-$FGREP ':macro11:' configure
-$FGREP ':macro21:' configure
-$FGREP ':macro33:' configure
-grep MACRO3 aclocal.m4 && exit 1
-grep GREPME m4_1/macro.m4 && exit 1
-test -f m4_1/macro.m4
-test ! -e m4_2/macro.m4
-diff aclocal.m4 copy.m4
-
-:
diff --git a/t/aclocal-I-and-install.sh b/t/aclocal-I-and-install.sh
new file mode 100755
index 000000000..7c1b0d403
--- /dev/null
+++ b/t/aclocal-I-and-install.sh
@@ -0,0 +1,100 @@
+#! /bin/sh
+# Copyright (C) 2003-2013 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 2, 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 .
+
+# Make sure aclocal define macros in the same order as -I's.
+# This is the similar to aclocal-I-order-1.sh, with the macro calls
+# reversed (it did make a difference).
+#
+# Also check for --install.
+
+# TODO: write a sister test that doesn't use a 'dirlist' file, but
+# TODO: puts third-party macros directly into 'acdir'.
+
+am_create_testdir=empty
+. test-init.sh
+
+cat > configure.ac << 'END'
+AC_INIT
+MACRO2
+MACRO1
+MACRO3
+END
+
+ACLOCAL="$ACLOCAL --system-acdir acdir"
+
+mkdir m4_1 m4_2 acdir acdir2
+echo ./acdir2 > acdir/dirlist
+
+cat >m4_1/somedefs.m4 <m4_2/somedefs.m4 <acdir2/macro.m4 <>acdir2/macro.m4
+$ACLOCAL -I m4_1 -I m4_2 --install
+$AUTOCONF
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
+grep MACRO3 aclocal.m4 && exit 1
+grep GREPME m4_1/macro.m4 && exit 1
+test -f m4_1/macro.m4
+test ! -e m4_2/macro.m4
+diff aclocal.m4 copy.m4
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index aef3730e2..63e098d25 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -72,10 +72,10 @@ t/get-sysconf.sh \
$(perl_TESTS) \
t/instspc.tap \
t/aclocal.sh \
-t/acloca10.sh \
t/aclocal-I-order-1.sh \
t/aclocal-I-order-2.sh \
t/aclocal-I-order-3.sh \
+t/aclocal-I-and-install.sh \
t/aclocal-acdir.sh \
t/aclocal-amflags.sh \
t/aclocal-autoconf-version-check.sh \
--
cgit v1.2.1
From 8971d23fb05a19fcb75a7b8c4c66cf402b1037a4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 8 Jan 2013 21:52:07 +0100
Subject: tests: adjust stale references to old test names
* t/remake-renamed-m4-macro-and-file.sh: Adjust to reflect to old
"acloca22 -> t/aclocal-deleted-header.sh" test rename.
* t/aclocal-pr450.sh (configure.ac): Use '$me' in the AC_INIT call,
instead of hard-coding the old name of this test, i.e., "acloca19".
Signed-off-by: Stefano Lattarini
---
t/aclocal-pr450.sh | 4 ++--
t/remake-renamed-m4-macro-and-file.sh | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/aclocal-pr450.sh b/t/aclocal-pr450.sh
index 7f4796f53..184cc335c 100755
--- a/t/aclocal-pr450.sh
+++ b/t/aclocal-pr450.sh
@@ -20,8 +20,8 @@
. test-init.sh
-cat >configure.ac <<'END'
-AC_INIT([acloca19], [1.0])
+cat >configure.ac <
Date: Wed, 9 Jan 2013 19:57:27 +0100
Subject: plans: we want to active subdir-objects unconditionally in automake
1.14
See automake bug#13378.
* PLANS/subdir-objects.txt: New.
* t/ccnoco4.sh: Improve heading comments a little.
Signed-off-by: Stefano Lattarini
---
PLANS/subdir-objects.txt | 67 ++++++++++++++++++++++++++++++++++++++++++++++++
t/ccnoco4.sh | 9 ++++---
2 files changed, 72 insertions(+), 4 deletions(-)
create mode 100644 PLANS/subdir-objects.txt
diff --git a/PLANS/subdir-objects.txt b/PLANS/subdir-objects.txt
new file mode 100644
index 000000000..e3aec6be8
--- /dev/null
+++ b/PLANS/subdir-objects.txt
@@ -0,0 +1,67 @@
+Summary
+-------
+
+We want to make the behaviour currently enabled by the 'subdir-objects'
+the default one, and in fact the *only* one, in Automake 1.14.
+See automake bug#13378: .
+
+Details
+-------
+
+The fact that Automake-generated Makefiles place compiled object files in
+the current directory by default, also when the corresponding source file
+is in a subdirectory, is basically an historical accident, due to the fact
+that the 'subdir-objects' option had only been introduced in April 1999,
+starting with commit 'user-dep-gen-branchpoint-56-g88b5959', and never
+made the default (likely to avoid backwards-compatibility issues).
+
+Since I believe the behaviour enabled by the 'subdir-objects' is the most
+useful one, and in fact the *only* natural one, I'd like to make it the
+only one available, simplifying the Automake implementation and APIs a
+little in the process.
+
+Alas, since this also means changing the default behaviour of Automake
+('subdir-objects' is not enabled by default, sadly), this means the
+transition path will be less smooth than I'd like.
+
+For automake 1.13.2 (ASAP)
+--------------------------
+
+Fix the bug spotted by Nick Bowler:
+
+
+
+
+and exposed in test case 't/ccnoco4.sh': currently, Automake-generated
+C compilation rules mistakenly pass the "-c -o" options combination
+unconditionally (even to losing compiler) when the 'subdir-objects' is
+used but sources are only present in the top-level directory.
+
+For automake 1.13.2 (with more ease)
+------------------------------------
+
+Give a warning in the category 'unsupported' if the 'subdir-objects'
+option is not specified. This should give the users enough forewarning
+about the planned change, and give them time to update their packages
+to the new semantic.
+
+This warning, when there are C sources in subdirs, should also mention the
+need to use AM_PROG_CC_C_O in configure.ac (thanks to Peter Breitenlohner
+for suggesting this). This is not strictly required, but will make
+things a little simpler for the users, by giving a more complete feedback:
+
+
+Be sure to avoid the warning when it would be irrelevant, i.e., if all
+source files sit in "current" directory (thanks to Peter Johansson for
+suggesting this).
+
+For automake 1.14
+-----------------
+
+Flip the 'subdir-object' option on by default. At the same time,
+drop support for the "old" behaviour of having object files derived
+from sources in a subdirectory being placed in the current directory
+rather than in that same subdirectory.
+
+Still keep the 'subdir-object' option supported (as a simple no-op
+now), to save useless churn in our user's build systems.
diff --git a/t/ccnoco4.sh b/t/ccnoco4.sh
index 54b857a8e..73dce9f68 100755
--- a/t/ccnoco4.sh
+++ b/t/ccnoco4.sh
@@ -14,10 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Check that Automake doesn't pass "-c -o" to losing compiler when
-# the 'subdir-objects' is used but sources are only present in the
-# top-level directory. Reported by Nick Bowler in the discussion on
-# automake bug#13378:
+# Check that Automake-generated C compilation rules don't mistakenly
+# use the "-c -o" options combination unconditionally (even with losing
+# compilers) when the 'subdir-objects' is used but sources are only
+# present in the top-level directory. Reported by Nick Bowler in the
+# discussion on automake bug#13378:
#
#
--
cgit v1.2.1
From 94d8c69f1c350de94445734de7b5dce7b5673909 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 9 Jan 2013 20:11:31 +0100
Subject: plans: automake 1.14 is to assume "rm -f" with no args is OK
See automake bug#10828.
* PLANS/rm-f-without-args.txt: New.
Signed-off-by: Stefano Lattarini
---
PLANS/rm-f-without-args.txt | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 PLANS/rm-f-without-args.txt
diff --git a/PLANS/rm-f-without-args.txt b/PLANS/rm-f-without-args.txt
new file mode 100644
index 000000000..5d39e220d
--- /dev/null
+++ b/PLANS/rm-f-without-args.txt
@@ -0,0 +1,40 @@
+Summary
+-------
+
+POSIX will say in a future version that calling "rm -f" with no argument
+is OK; and this sensible behaviour seem to be already very widespread in
+"the wild" (and possibly lacking only on those systems that are well on
+their way to obsolescence).
+
+Se we'd like to simplify several automake-generated "cleaning" rules
+accordingly, to get rid of the awful idiom:
+
+ test -z "$(VAR)" || rm -f $(VAR)
+
+See automake bug#10828.
+
+For Automake 1.13.2 (or 1.13.3)
+-------------------------------
+
+Add a temporary "probe check" in AM_INIT_AUTOMAKE that verifies that
+the no-args "rm -f" usage is supported on the system configure is
+being run on; complain loudly (but not with a fatal error) if this is
+not the case, and tell the user to report the situation to us.
+
+For Automake 1.14
+-----------------
+
+Make any failure in the configure-time probe check introduced by the
+previous point fatal; and in case of failure, also suggest to the user
+to install an older version of GNU coreutils to work around the
+limitation of his system (this version should be old enough not to
+be bootstrapped with Automake 1.14, otherwise the user will face a
+bootstrapping catch-22).
+
+In all our recipes, start assuming "rm -f" with no argument is OK;
+simplify and de-uglify the recipes accordingly.
+
+For Automake 1.15
+-----------------
+
+Remove the runtime probe altogether.
--
cgit v1.2.1
From a52e9de01897ff994fcfb49eb019a6c23a4c92e8 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 9 Jan 2013 22:01:45 +0100
Subject: depend2.am: improve comments a little
* lib/am/depend2.am: The "fastdep" mode is supported not only for
gcc 3.x, but for gcc 3.x or later, in particular, for all gcc in
the 4.x series (at the time of writing, the latest release is 4.72).
Adjust the comments to match, and re-wrap them while at it.
Signed-off-by: Stefano Lattarini
---
lib/am/depend2.am | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/am/depend2.am b/lib/am/depend2.am
index 80d41854b..18290e4fe 100644
--- a/lib/am/depend2.am
+++ b/lib/am/depend2.am
@@ -27,11 +27,10 @@
## the "if AMDEP" chunk is prefix with @AMDEP_TRUE@ just like for any
## other configure-time conditional.
##
-## We do likewise for %FASTDEP%; this expands to an ordinary
-## configure-time conditional. %FASTDEP% is used to speed up the
-## common case of building a package with gcc 3.x. In this case we
-## can skip the use of depcomp and easily inline the dependency
-## tracking.
+## We do likewise for %FASTDEP%; this expands to an ordinary configure-time
+## conditional. %FASTDEP% is used to speed up the common case of building
+## a package with gcc 3.x or later. In this case we can skip the use of
+## depcomp and easily inline the dependency tracking.
## Verbosity of FASTDEP rules
## --------------------------
--
cgit v1.2.1
From 8f06bfba71ee217263a0cff050ac23b698b79807 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 9 Jan 2013 22:17:53 +0100
Subject: depend2.am: fix comments on verbosity of compilation rules
The situation and decisions described on those comments have become
quite outdated since the introduction of the silent-rules support.
Today, the general idea is to have nice, terse output if silent rules
are enabled, and complete, faithful, very verbose output if they are
not -- without trying to "massage" this verbose output in a more
pleasant form if that would cause complication in the affected code.
So it's better to just drop the obsolescent comments.
Note that we don't start simplifying the existing rules according
to this new philosophy; that will only be done when touching some
existing code (for the 'depend2.am' code, that will probably happen
on the master branch).
Signed-off-by: Stefano Lattarini
---
lib/am/depend2.am | 23 -----------------------
1 file changed, 23 deletions(-)
diff --git a/lib/am/depend2.am b/lib/am/depend2.am
index 18290e4fe..5c6439ad6 100644
--- a/lib/am/depend2.am
+++ b/lib/am/depend2.am
@@ -32,29 +32,6 @@
## a package with gcc 3.x or later. In this case we can skip the use of
## depcomp and easily inline the dependency tracking.
-## Verbosity of FASTDEP rules
-## --------------------------
-## (1) Some people want to see what happens during make. They think
-## @-commands are evil because hiding things hinders debugging.
-## (2) Other people want to see only the important commands--those that
-## may produce diagnostics, such as compiler invocations. They
-## do not care about build details such as dependency generation
-## (the if/then/else machinery in FASTDEP rules). Their point is
-## that it is hard to spot diagnostics in a verbose output.
-## (3) Other people want "make -s" to work as expected: silently.
-## This way they can spot any diagnostic really easily.
-##
-## The second point suggests we hide rules with @ and that we 'echo'
-## only the relevant parts. However this goes against the two others.
-## There are regular complaints about this on the mailing list, but
-## it's hard to please everybody. On April 2003, William Fulton (from
-## clan (3)) and Karl Berry (from clan (2)) agreed that folding the
-## compile rules so that they are output on a single line (instead of 5)
-## would be a good compromise. Actually we use two lines rather than one,
-## because this way %SOURCE% is always located at the end of the first
-## line and is therefore easier to spot. (We need an extra line when
-## depbase is used.)
-
if %?NONLIBTOOL%
?GENERIC?%EXT%.o:
?!GENERIC?%OBJ%: %SOURCE%
--
cgit v1.2.1
From ad2e3170ac4d5fc407038ce07916b3d70f739b3a Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:01:28 +0100
Subject: HACKING: typofix
Signed-off-by: Stefano Lattarini
---
HACKING | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/HACKING b/HACKING
index c70143ef7..bfb4cc8dc 100644
--- a/HACKING
+++ b/HACKING
@@ -112,7 +112,7 @@
* There may be a number of longer-lived feature branches for new
developments. They should be based off of a common ancestor of all
active branches to which the feature should or might be merged later.
- in the future, we might introduce a special branch named 'next' that
+ In the future, we might introduce a special branch named 'next' that
may serve as common ground for feature merging and testing, should
they not yet be ready for master.
--
cgit v1.2.1
From 7138cc5eefae4ab5264cacfef5937a9ab235c238 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:04:06 +0100
Subject: HACKING: we use "merge --log" even when merging master
Signed-off-by: Stefano Lattarini
---
HACKING | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/HACKING b/HACKING
index bfb4cc8dc..edafe94f1 100644
--- a/HACKING
+++ b/HACKING
@@ -126,9 +126,9 @@
the active branches descending from the buggy commit. This offers a
simple way to fix the bug consistently and effectively.
-* For merges from branches other than maint, prefer 'git merge --log' over
- plain 'git merge', so that a later 'git log' gives an indication of which
- actual patches were merged even when they don't appear early in the list.
+* When merging, prefer 'git merge --log' over plain 'git merge', so that
+ a later 'git log' gives an indication of which actual patches were
+ merged even when they don't appear early in the list.
* master and release branches should not be rewound, i.e., should always
fast-forward, except maybe for privacy issues. The maint branch should not
--
cgit v1.2.1
From d7aef9bd0bb8df6f2acbfbae02798aa81d95370f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:06:27 +0100
Subject: HACKING: "detailed explanation" in commit messages is almost
mandatory
Signed-off-by: Stefano Lattarini
---
HACKING | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/HACKING b/HACKING
index edafe94f1..c4f0ba815 100644
--- a/HACKING
+++ b/HACKING
@@ -148,8 +148,9 @@
Here goes a more detailed explanation of why the commit is needed,
- and a general overview of what it does, and how. This section is
- optional, but you are expected to provide it more often than not.
+ and a general overview of what it does, and how. This section
+ should almost always be provided, possibly only with the expection
+ of obvious fixes or very trivial changes.
And if the detailed explanation is quite long or detailed, you can
want to break it in more paragraphs.
--
cgit v1.2.1
From 801cbef2d8a49af4c2e6f5a23b641170d0a1136b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:10:02 +0100
Subject: HACKING: commit messages are not to follow GCS ChangeLog rules too
strongly
Signed-off-by: Stefano Lattarini
---
HACKING | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/HACKING b/HACKING
index c4f0ba815..45f9370d6 100644
--- a/HACKING
+++ b/HACKING
@@ -167,10 +167,10 @@
-* The is mandatory but for the most
- trivial changes, and should follows the GNU guidelines for ChangeLog
- entries (described explicitly in the GNU Coding Standards); it might
- be something of this sort:
+* The should usually be provided (but
+ for short or trivial changes), and should follow the GNU guidelines
+ for ChangeLog entries (described explicitly in the GNU Coding
+ Standards); it might be something of this sort:
* some/file (func1): Improved frobnication.
(func2): Adjusted accordingly.
--
cgit v1.2.1
From ca307a408e036aab9eaf086cc2792929419ede1b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:10:58 +0100
Subject: HACKING: fixlets about git branch rewinding policy
Signed-off-by: Stefano Lattarini
---
HACKING | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/HACKING b/HACKING
index 45f9370d6..0ff1eef27 100644
--- a/HACKING
+++ b/HACKING
@@ -130,11 +130,10 @@
a later 'git log' gives an indication of which actual patches were
merged even when they don't appear early in the list.
-* master and release branches should not be rewound, i.e., should always
- fast-forward, except maybe for privacy issues. The maint branch should not
- be rewound except maybe after retiring a release branch or a new stable
- release. For next, and for feature branches, the announcement for the
- branch should document rewinding policy.
+* The 'master' and 'maint' branches should not be rewound, i.e., should
+ always fast-forward, except maybe for privacy issues. For 'next' (if
+ that will ever be implemented), and for feature branches, the announcement
+ for the branch should document rewinding policy.
============================================================================
= Writing a good commit message
--
cgit v1.2.1
From 27fc8979d004884cf9ce246f8d21d546b18e3003 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:16:37 +0100
Subject: HACKING: rewindable branches should live in the 'experimental/*'
namespace
Signed-off-by: Stefano Lattarini
---
HACKING | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/HACKING b/HACKING
index 0ff1eef27..d8ee634b1 100644
--- a/HACKING
+++ b/HACKING
@@ -131,9 +131,12 @@
merged even when they don't appear early in the list.
* The 'master' and 'maint' branches should not be rewound, i.e., should
- always fast-forward, except maybe for privacy issues. For 'next' (if
- that will ever be implemented), and for feature branches, the announcement
- for the branch should document rewinding policy.
+ always fast-forward, except maybe for privacy issues. For 'next'
+ (if that will ever be implemented), and for feature branches, the
+ announcement for the branch should document rewinding policy. If a
+ topic branch is expected to be rewound, it is good practice to put
+ it in the 'experimental/*' namespace; for example, a rewindable branch
+ dealing with Vala support could be named like "experimental/vala-work".
============================================================================
= Writing a good commit message
--
cgit v1.2.1
From 38bb5c65db4bfbfa9fa477c57fd2efe6f1f15a46 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:27:21 +0100
Subject: HACKING: bug-tracker, the PLANS directory, and how to plan "big"
changes
Signed-off-by: Stefano Lattarini
---
HACKING | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/HACKING b/HACKING
index d8ee634b1..011b6e2fc 100644
--- a/HACKING
+++ b/HACKING
@@ -38,6 +38,16 @@
* Changes other than bug fixes must be mentioned in NEWS. Important
bug fixes should be mentioned in NEWS, too.
+* Changes which are potentially controversial, require a non-trivial
+ plan, or must be implemented gradually with a roadmap spanning several
+ releases (either minor or major) should be discussed on the list,
+ and have a proper entry in the PLANS directory. This entry should be
+ always committed in the "maint" branch, even if the change it deals
+ with is only for the master branch, or a topic branch. Usually, in
+ addition to this, it is useful to open a "wishlist" report on the
+ Automake debbugs tracker, to keep the idea more visible, and have the
+ discussions surrounding it easily archived in a central place.
+
============================================================================
= Naming
--
cgit v1.2.1
From 0168562049b471e432863c4570da53995fb92f2d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:28:45 +0100
Subject: HACKING: minor typofix
Signed-off-by: Stefano Lattarini
---
HACKING | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/HACKING b/HACKING
index 011b6e2fc..99b4a994e 100644
--- a/HACKING
+++ b/HACKING
@@ -14,7 +14,7 @@
* If you incorporate a change from somebody on the net:
First, if it is a large change, you must make sure they have signed the
appropriate paperwork.
- Second, be sure to add their name and email address to THANKS
+ Second, be sure to add their name and email address to THANKS.
* If a change fixes a test, mention the test in the commit message.
If a change fixes a bug registered in the Automake debbugs tracker,
--
cgit v1.2.1
From dbe3eea4d5b65f998c57a571c034c6044f2bd1e2 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:40:26 +0100
Subject: Rename 'maint/' -> 'maintainer/', for Git's sake
Otherwise, Git gets confused by the fact that a directory ('maint')
is named like a branch, and forces me to tweak the command line to
resolve the ambiguity for it.
* maint/: Rename ...
* maintainer/: ... like this.
* Makefile.am, GNUmakefile: Adjust.
Signed-off-by: Stefano Lattarini
---
GNUmakefile | 4 +-
Makefile.am | 12 +-
maint/am-ft | 109 ---------
maint/am-xft | 3 -
maint/maint.mk | 467 -------------------------------------
maint/rename-tests | 52 -----
maint/syntax-checks.mk | 544 --------------------------------------------
maintainer/am-ft | 109 +++++++++
maintainer/am-xft | 3 +
maintainer/maint.mk | 467 +++++++++++++++++++++++++++++++++++++
maintainer/rename-tests | 52 +++++
maintainer/syntax-checks.mk | 544 ++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 1183 insertions(+), 1183 deletions(-)
delete mode 100755 maint/am-ft
delete mode 100755 maint/am-xft
delete mode 100644 maint/maint.mk
delete mode 100755 maint/rename-tests
delete mode 100644 maint/syntax-checks.mk
create mode 100755 maintainer/am-ft
create mode 100755 maintainer/am-xft
create mode 100644 maintainer/maint.mk
create mode 100755 maintainer/rename-tests
create mode 100644 maintainer/syntax-checks.mk
diff --git a/GNUmakefile b/GNUmakefile
index d6baaaa7b..c6f460cd4 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -25,8 +25,8 @@ ifeq ($(wildcard Makefile),)
$(error Fatal Error)
endif
include ./Makefile
-include $(srcdir)/maint/maint.mk
-include $(srcdir)/maint/syntax-checks.mk
+include $(srcdir)/maintainer/maint.mk
+include $(srcdir)/maintainer/syntax-checks.mk
else # ! bootstrap in $(MAKECMDGOALS)
diff --git a/Makefile.am b/Makefile.am
index 3c40f27cb..ab98df708 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -116,7 +116,7 @@ maintainer-clean-local:
rm -rf .autom4te.cache
# So that automake won't complain about the missing ChangeLog.
-# The real rule for ChangeLog generation is now in main/maint.mk
+# The real rule for ChangeLog generation is now in maintainer/maint.mk
# (as it is maintainer-specific).
ChangeLog:
@@ -684,8 +684,8 @@ EXTRA_DIST += \
## ---------------------------------------- ##
EXTRA_DIST += \
- maint/am-ft \
- maint/am-xft \
- maint/rename-tests \
- maint/maint.mk \
- maint/syntax-checks.mk
+ maintainer/am-ft \
+ maintainer/am-xft \
+ maintainer/rename-tests \
+ maintainer/maint.mk \
+ maintainer/syntax-checks.mk
diff --git a/maint/am-ft b/maint/am-ft
deleted file mode 100755
index d8a2722be..000000000
--- a/maint/am-ft
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/usr/bin/env bash
-# Remote testing of Automake tarballs made easy.
-# This script requires Bash 4.x or later.
-# TODO: some documentation would be nice ...
-
-set -u
-me=${0##*/}
-
-fatal () { echo "$me: $*" >&2; exit 1; }
-
-cmd='
- test_script=$HOME/.am-test/run
- if test -f "$test_script" && test -x "$test_script"; then
- "$test_script" "$@"
- else
- nice -n19 ./configure && nice -n19 make -j10 check
- fi
-'
-
-remote=
-interactive=1
-while test $# -gt 0; do
- case $1 in
- -b|--batch) interactive=0;;
- -c|--command) cmd=${2-}; shift;;
- -*) fatal "'$1': invalid option";;
- *) remote=$1; shift; break;;
- esac
- shift
-done
-[[ -n $remote ]] || fatal "no remote given"
-
-if ((interactive)); then
- do_on_error='{
- AM_TESTSUITE_FAILED=yes
- export AM_TESTSUITE_FAILED
- # We should not modify the environment with which the failed
- # tests have run, hence do not read ".profile", ".bashrc", and
- # company.
- exec bash --noprofile --norc -i
- }'
-else
- do_on_error='exit $?'
-fi
-
-tarball=$(echo automake*.tar.xz)
-
-case $tarball in
- *' '*) fatal "too many automake tarballs: $tarball";;
-esac
-
-test -f $tarball || fatal "no automake tarball found"
-
-distdir=${tarball%%.tar.xz}
-
-env='PATH=$HOME/bin:$PATH'
-if test -t 1; then
- env+=" TERM='$TERM' AM_COLOR_TESTS=always"
-fi
-
-# This is tempting:
-# $ ssh "command" arg-1 ... arg-2
-# but doesn't work as expected. So we need the following hack
-# to propagate the command line arguments to the remote shell.
-quoted_args=--
-while (($# > 0)); do
- case $1 in
- *\'*) quoted_args+=" "$(printf '%s\n' "$1" | sed "s/'/'\\''/g");;
- *) quoted_args+=" '$1'";;
- esac
- shift
-done
-
-set -e
-set -x
-
-scp $tarball $remote:tmp/
-
-# Multiple '-t' to force tty allocation.
-ssh -t -t $remote "
- set -x; set -e; set -u;
- set $quoted_args
- cd tmp
- if test -e $distdir; then
- # Use 'perl', not only 'rm -rf', to correctly handle read-only
- # files or directory. Fall back to 'rm' if something goes awry.
- perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
- || rm -rf $distdir || exit 1
- test ! -e $distdir
- fi
- xz -dc $tarball | tar xf -
- cd $distdir
- "'
- am_extra_acdir=$HOME/.am-test/extra-aclocal
- am_extra_bindir=$HOME/.am-test/extra-bin
- am_extra_setup=$HOME/.am-test/extra-setup.sh
- if test -d "$am_extra_acdir"; then
- export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
- fi
- if test -d "$am_extra_bindir"; then
- export PATH=$am_extra_bindir:$PATH
- fi
- '"
- export $env
- if test -f \"\$am_extra_setup\"; then
- . \"\$am_extra_setup\"
- fi
- ($cmd) || $do_on_error
-"
diff --git a/maint/am-xft b/maint/am-xft
deleted file mode 100755
index 564aa3b02..000000000
--- a/maint/am-xft
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-MAKE=${MAKE-make} GIT=${GIT-git}
-$GIT clean -fdx && $MAKE bootstrap && $MAKE dist && exec am-ft "$@"
diff --git a/maint/maint.mk b/maint/maint.mk
deleted file mode 100644
index 69b163048..000000000
--- a/maint/maint.mk
+++ /dev/null
@@ -1,467 +0,0 @@
-# Maintainer makefile rules for Automake.
-#
-# Copyright (C) 1995-2013 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 2, 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 .
-
-# Avoid CDPATH issues.
-unexport CDPATH
-
-# --------------------------------------------------------- #
-# Automatic generation of the ChangeLog from git history. #
-# --------------------------------------------------------- #
-
-gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
-gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
-gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
- --since='2011-12-28 00:00:00' \
- --no-cluster --format '%s%n%n%b'
-
-EXTRA_DIST += lib/gitlog-to-changelog
-EXTRA_DIST += $(gitlog_to_changelog_fixes)
-
-# When executed from a git checkout, generate the ChangeLog from the git
-# history. When executed from an extracted distribution tarball, just
-# copy the distributed ChangeLog in the build directory (and if this
-# fails, or if no distributed ChangeLog file is present, complain and
-# give an error).
-#
-# The ChangeLog should be regenerated unconditionally when working from
-# checked-out sources; otherwise, if we're working from a distribution
-# tarball, we expect the ChangeLog to be distributed, so check that it
-# is indeed present in the source directory.
-ChangeLog:
- $(AM_V_GEN)set -e; set -u; \
- if test -d $(srcdir)/.git; then \
- rm -f $@-t \
- && $(gitlog_to_changelog_command) \
- $(gitlog_to_changelog_options) >$@-t \
- && chmod a-w $@-t \
- && mv -f $@-t $@ \
- || exit 1; \
- elif test ! -f $(srcdir)/$@; then \
- echo "Source tree is not a git checkout, and no pre-existent" \
- "$@ file has been found there" >&2; \
- exit 1; \
- fi
-.PHONY: ChangeLog
-
-
-# --------------------------- #
-# Perl coverage statistics. #
-# --------------------------- #
-
-PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
-PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
-PERL_COVER = cover
-
-check-coverage-run recheck-coverage-run: %-coverage-run: all
- $(MKDIR_P) $(PERL_COVERAGE_DB)
- PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
- WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
- $(MAKE) $*
-
-check-coverage-report:
- @if test ! -d "$(PERL_COVERAGE_DB)"; then \
- echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
- echo "Please run \"make check-coverage\" first" >&2; \
- exit 1; \
- fi
- $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
-
-# We don't use direct dependencies here because we'd like to be able
-# to invoke the report even after interrupted check-coverage.
-check-coverage: check-coverage-run
- $(MAKE) check-coverage-report
-
-recheck-coverage: recheck-coverage-run
- $(MAKE) check-coverage-report
-
-clean-coverage:
- rm -rf "$(PERL_COVERAGE_DB)"
-clean-local: clean-coverage
-
-.PHONY: check-coverage recheck-coverage check-coverage-run \
- recheck-coverage-run check-coverage-report clean-coverage
-
-
-# ---------------------------------------------------- #
-# Tagging and/or uploading stable and beta releases. #
-# ---------------------------------------------------- #
-
-GIT = git
-
-EXTRA_DIST += lib/gnupload
-
-base_version_rx = ^[1-9][0-9]*\.[0-9][0-9]*
-stable_major_version_rx = $(base_version_rx)$$
-stable_minor_version_rx = $(base_version_rx)\.[0-9][0-9]*$$
-beta_version_rx = $(base_version_rx)(\.[0-9][0-9]*)?[bdfhjlnprtvxz]$$
-match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
-
-# Check that we don't have uncommitted or unstaged changes.
-# TODO: Maybe the git suite already offers a shortcut to verify if the
-# TODO: working directory is "clean" or not? If yes, use that instead
-# TODO: of duplicating the logic here.
-git_must_have_clean_workdir = \
- $(GIT) rev-parse --verify HEAD >/dev/null \
- && $(GIT) update-index -q --refresh \
- && $(GIT) diff-files --quiet \
- && $(GIT) diff-index --quiet --cached HEAD \
- || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
-
-determine_release_type = \
- if $(match_version) '$(stable_major_version_rx)'; then \
- release_type='Major release'; \
- announcement_type='major release'; \
- dest=ftp; \
- elif $(match_version) '$(stable_minor_version_rx)'; then \
- release_type='Minor release'; \
- announcement_type='maintenance release'; \
- dest=ftp; \
- elif $(match_version) '$(beta_version_rx)'; then \
- release_type='Beta release'; \
- announcement_type='test release'; \
- dest=alpha; \
- else \
- echo "$@: invalid version '$(VERSION)' for a release" >&2; \
- exit 1; \
- fi
-
-# Help the debugging of $(determine_release_type) and related code.
-print-release-type:
- @$(determine_release_type); \
- echo "$$release_type $(VERSION);" \
- "it will be announced as a $$announcement_type"
-
-git-tag-release: maintainer-check
- @set -e -u; \
- case '$(AM_TAG_DRYRUN)' in \
- ""|[nN]|[nN]o|NO) run="";; \
- *) run="echo Running:";; \
- esac; \
- $(determine_release_type); \
- $(git_must_have_clean_workdir); \
- $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
-
-git-upload-release:
- @# Check this is a version we can cut a release (either test
- @# or stable) from.
- @$(determine_release_type)
- @# The repository must be clean.
- @$(git_must_have_clean_workdir)
- @# Check that we are releasing from a valid tag.
- @tag=`$(GIT) describe` \
- && case $$tag in "v$(VERSION)") true;; *) false;; esac \
- || { echo "$@: you can only create a release from a tagged" \
- "version" >&2; \
- exit 1; }
- @# Build the distribution tarball(s).
- $(MAKE) dist
- @# Upload it to the correct FTP repository.
- @$(determine_release_type) \
- && dest=$$dest.gnu.org:automake \
- && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
- && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
- $(DIST_ARCHIVES)
-
-.PHONY: print-release-type git-upload-release git-tag-release
-
-
-# ------------------------------------------------------------------ #
-# Explore differences of autogenerated files in different commits. #
-# ------------------------------------------------------------------ #
-
-# Visually comparing differences between the Makefile.in files in
-# automake's own build system as generated in two different branches
-# might help to catch bugs and blunders. This has already happened a
-# few times in the past, when we used to version-control Makefile.in.
-autodiffs:
- @set -u; \
- NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
- OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
- am_gitdir='$(abs_top_srcdir)/.git'; \
- get_autofiles_from_rev () \
- { \
- rev=$$1 dir=$$2 \
- && echo "$@: will get files from revision $$rev" \
- && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
- && cd tmp \
- && $(GIT) checkout -q "$$rev" \
- && echo "$@: bootstrapping $$rev" \
- && $(SHELL) ./bootstrap.sh \
- && echo "$@: copying files from $$rev" \
- && makefile_ins=`find . -name Makefile.in` \
- && (tar cf - configure aclocal.m4 $$makefile_ins) | \
- (cd .. && cd "$$dir" && tar xf -) \
- && cd .. \
- && rm -rf tmp; \
- }; \
- outdir=$@.dir \
- && : Before proceeding, ensure the specified revisions truly exist. \
- && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
- && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
- && rm -rf $$outdir \
- && mkdir $$outdir \
- && cd $$outdir \
- && mkdir new old \
- && get_autofiles_from_rev $$OLD_COMMIT old \
- && get_autofiles_from_rev $$NEW_COMMIT new \
- && exit 0
-
-# With lots of eye candy; we like our developers pampered and spoiled :-)
-compare-autodiffs: autodiffs
- @set -u; \
- : $${COLORDIFF=colordiff} $${DIFF=diff}; \
- dir=autodiffs.dir; \
- if test ! -d "$$dir"; then \
- echo "$@: $$dir: Not a directory" >&2; \
- exit 1; \
- fi; \
- mydiff=false mypager=false; \
- if test -t 1; then \
- if ($$COLORDIFF -r . .) /dev/null 2>&1; then \
- mydiff=$$COLORDIFF; \
- mypager="less -R"; \
- else \
- mypager=less; \
- fi; \
- else \
- mypager=cat; \
- fi; \
- if test "$$mydiff" = false; then \
- if ($$DIFF -r -u . .); then \
- mydiff=$$DIFF; \
- else \
- echo "$@: no good-enough diff program specified" >&2; \
- exit 1; \
- fi; \
- fi; \
- st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
- rm -rf $$dir; \
- exit $$st
-.PHONY: autodiffs compare-autodiffs
-
-# ---------------------------------------------- #
-# Help writing the announcement for a release. #
-# ---------------------------------------------- #
-
-PACKAGE_MAILINGLIST = automake@gnu.org
-
-announcement: NEWS
- $(AM_V_GEN): \
- && rm -f $@ $@-t \
- && $(determine_release_type) \
- && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
- && X () { printf '%s\n' "$$*" >> $@-t; } \
- && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
- "$$announcement_type." \
- && X \
- && X "**TODO** Brief description of the release here." \
- && X \
- && X "**TODO** This description can span multiple paragraphs." \
- && X \
- && X "See below for the detailed list of changes since the" \
- && X "previous version, as summarized by the NEWS file." \
- && X \
- && X "Download here:" \
- && X \
- && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
- && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
- && X \
- && X "Please report bugs and problems to" \
- "<$(PACKAGE_BUGREPORT)>," \
- && X "and send general comments and feedback to" \
- "<$(PACKAGE_MAILINGLIST)>." \
- && X \
- && X "Thanks to everyone who has reported problems, contributed" \
- && X "patches, and helped testing Automake!" \
- && X \
- && X "-*-*-*-" \
- && X \
- && sed -n -e '/^~~~/q' -e p $(srcdir)/NEWS >> $@-t \
- && mv -f $@-t $@
-.PHONY: announcement
-CLEANFILES += announcement
-
-# --------------------------------------------------------------------- #
-# Synchronize third-party files that are committed in our repository. #
-# --------------------------------------------------------------------- #
-
-# Program to use to fetch files.
-WGET = wget
-
-# Some repositories we sync files from.
-SV_CVS = 'http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/'
-SV_GIT_CF = 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
-SV_GIT_AC = 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
-SV_GIT_GL = 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
-
-# Files that we fetch and which we compare against.
-# Note that the 'lib/COPYING' file must still be synced by hand.
-FETCHFILES = \
- $(SV_GIT_CF)config.guess \
- $(SV_GIT_CF)config.sub \
- $(SV_CVS)texinfo/texinfo/doc/texinfo.tex \
- $(SV_CVS)texinfo/texinfo/util/gendocs.sh \
- $(SV_CVS)texinfo/texinfo/util/gendocs_template \
- $(SV_GIT_GL)build-aux/gitlog-to-changelog \
- $(SV_GIT_GL)build-aux/gnupload \
- $(SV_GIT_GL)build-aux/update-copyright \
- $(SV_GIT_GL)doc/INSTALL
-
-# Fetch the latest versions of few scripts and files we care about.
-# A retrieval failure or a copying failure usually mean serious problems,
-# so we'll just bail out if 'wget' or 'cp' fail.
-fetch:
- $(AM_V_at)rm -rf Fetchdir
- $(AM_V_at)mkdir Fetchdir
- $(AM_V_GEN)set -e; \
- if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
- for url in $(FETCHFILES); do \
- file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
- $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
- if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
- : Nothing to do; \
- else \
- echo "$@: updating file $$file"; \
- cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
- fi; \
- done
- $(AM_V_at)rm -rf Fetchdir
-.PHONY: fetch
-
-# ---------------------------------------------------------------------- #
-# Generate and upload manuals in several formats, for the GNU website. #
-# ---------------------------------------------------------------------- #
-
-web_manual_dir = doc/web-manual
-
-RSYNC = rsync
-CVS = cvs
-CVSU = cvsu
-CVS_USER = $${USER}
-WEBCVS_ROOT = cvs.savannah.gnu.org:/web
-CVS_RSH = ssh
-export CVS_RSH
-
-.PHONY: web-manual web-manual-update
-web-manual web-manual-update: t = $@.dir
-
-# Build manual in several formats. Note to the recipe:
-# 1. The symlinking of automake.texi into the temporary directory is
-# required to pacify extra checks from gendocs.sh.
-# 2. The redirection to /dev/null before the invocation of gendocs.sh
-# is done to better respect silent rules.
-web-manual:
- $(AM_V_at)rm -rf $(web_manual_dir) $t
- $(AM_V_at)mkdir $t
- $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
- $(AM_V_GEN)cd $t \
- && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
- && export GENDOCS_TEMPLATE_DIR \
- && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
- && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
- -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
- $(PACKAGE) '$(PACKAGE_NAME)'
- $(AM_V_at)mkdir $(web_manual_dir)
- $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
- $(AM_V_at)rm -rf $t
- @! $(AM_V_P) || ls -l $(web_manual_dir)
-
-# Upload manual to www.gnu.org, using CVS (sigh!)
-web-manual-update:
- $(AM_V_at)$(determine_release_type); \
- case $$release_type in \
- [Mm]ajor\ release|[Mm]inor\ release);; \
- *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
- exit 1;; \
- esac
- $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
- echo 'You have to run "$(MAKE) web-manuals" before' \
- 'invoking "$(MAKE) $@"' >&2; \
- exit 1; \
- }
- $(AM_V_at)rm -rf $t
- $(AM_V_at)mkdir $t
- $(AM_V_at)cd $t \
- && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
- co $(PACKAGE)
- @# According to the rsync manpage, "a trailing slash on the
- @# source [...] avoids creating an additional directory
- @# level at the destination". So the trailing '/' after
- @# '$(web_manual_dir)' below is intended.
- $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
- $(AM_V_GEN): \
- && cd $t/$(PACKAGE)/manual \
- && new_files=`$(CVSU) --types='?'` \
- && new_files=`echo "$$new_files" | sed s/^..//` \
- && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
- && $(CVS) ci -m $(VERSION)
- $(AM_V_at)rm -rf $t
-.PHONY: web-manual-update
-
-clean-web-manual:
- $(AM_V_at)rm -rf $(web_manual_dir)
-.PHONY: clean-web-manual
-clean-local: clean-web-manual
-
-EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
-
-# ------------------------------------------------ #
-# Update copyright years of all committed files. #
-# ------------------------------------------------ #
-
-EXTRA_DIST += lib/update-copyright
-
-update_copyright_env = \
- UPDATE_COPYRIGHT_FORCE=1 \
- UPDATE_COPYRIGHT_USE_INTERVALS=2
-
-# In addition to the several README files, these as well are
-# not expected to have a copyright notice.
-files_without_copyright = \
- .autom4te.cfg \
- .git-log-fix \
- .gitattributes \
- .gitignore \
- INSTALL \
- COPYING \
- AUTHORS \
- THANKS \
- lib/INSTALL \
- lib/COPYING
-
-# This script is in the public domain.
-files_without_copyright += lib/mkinstalldirs
-
-# This script has an MIT-style license
-files_without_copyright += lib/install-sh
-
-.PHONY: update-copyright
-update-copyright:
- $(AM_V_GEN)set -e; \
- current_year=`date +%Y` && test -n "$$current_year" \
- || { echo "$@: cannot get current year" >&2; exit 1; }; \
- sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
- bootstrap.sh configure.ac; \
- excluded_re=`( \
- for url in $(FETCHFILES); do echo "$$url"; done \
- | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
- && for f in $(files_without_copyright); do echo $$f; done \
- ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
- $(GIT) ls-files \
- | grep -Ev '(^|/)README$$' \
- | grep -Ev "^($$excluded_re)$$" \
- | $(update_copyright_env) xargs $(srcdir)/lib/$@
diff --git a/maint/rename-tests b/maint/rename-tests
deleted file mode 100755
index 6fce9fe84..000000000
--- a/maint/rename-tests
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env bash
-# Convenience script to rename test cases in Automake.
-
-set -e -u
-
-me=${0##*/}
-fatal () { echo "$me: $*" >&2; exit 1; }
-
-case $# in
- 0) input=$(cat);;
- 1) input=$(cat -- "$1");;
- *) fatal "too many arguments";;
-esac
-
-AWK=${AWK-awk}
-SED=${SED-sed}
-
-[[ -f automake.in && -d lib/Automake ]] \
- || fatal "can only be run from the top-level of the Automake source tree"
-
-$SED --version 2>&1 | grep GNU >/dev/null 2>&1 \
- || fatal "GNU sed is required by this script"
-
-# Validate and cleanup input.
-input=$(
- $AWK -v me="$me" "
- /^#/ { next; }
- (NF == 0) { next; }
- (NF != 2) { print me \": wrong number of fields at line \" NR;
- exit(1); }
- { printf (\"t/%s t/%s\\n\", \$1, \$2); }
- " <<<"$input")
-
-# Prepare git commit message.
-exec 5>$me.git-msg
-echo "tests: more significant names for some tests" >&5
-echo >&5
-$AWK >&5 <<<"$input" \
- '{ printf ("* %s: Rename...\n* %s: ... like this.\n", $1, $2) }'
-exec 5>&-
-
-# Rename tests.
-eval "$($AWK '{ printf ("git mv %s %s\n", $1, $2) }' <<<"$input")"
-
-# Adjust the list of tests (do this conditionally, since such a
-# list is not required nor used in Automake-NG.
-if test -f t/list-of-tests.mk; then
- $SED -e "$($AWK '{ printf ("s|^%s |%s |\n", $1, $2) }' <<<"$input")" \
- -i t/list-of-tests.mk
-fi
-
-git status
diff --git a/maint/syntax-checks.mk b/maint/syntax-checks.mk
deleted file mode 100644
index 375738be9..000000000
--- a/maint/syntax-checks.mk
+++ /dev/null
@@ -1,544 +0,0 @@
-# Maintainer checks for Automake. Requires GNU make.
-
-# Copyright (C) 2012-2013 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 2, 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 .
-
-# We also have to take into account VPATH builds (where some generated
-# tests might be in '$(builddir)' rather than in '$(srcdir)'), TAP-based
-# tests script (which have a '.tap' extension) and helper scripts used
-# by other test cases (which have a '.sh' extension).
-xtests := $(shell \
- if test $(srcdir) = .; then \
- dirs=.; \
- else \
- dirs='$(srcdir) .'; \
- fi; \
- for d in $$dirs; do \
- for s in tap sh; do \
- ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \
- done; \
- done | sort)
-
-xdefs = \
- $(srcdir)/t/ax/am-test-lib.sh \
- $(srcdir)/t/ax/test-lib.sh \
- $(srcdir)/t/ax/test-defs.in
-
-ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
-
-# Some simple checks, and then ordinary check. These are only really
-# guaranteed to work on my machine.
-syntax_check_rules = \
-$(sc_tests_plain_check_rules) \
-sc_diff_automake \
-sc_diff_aclocal \
-sc_no_brace_variable_expansions \
-sc_rm_minus_f \
-sc_no_for_variable_in_macro \
-sc_mkinstalldirs \
-sc_pre_normal_post_install_uninstall \
-sc_perl_no_undef \
-sc_perl_no_split_regex_space \
-sc_cd_in_backquotes \
-sc_cd_relative_dir \
-sc_perl_at_uscore_in_scalar_context \
-sc_perl_local \
-sc_AMDEP_TRUE_in_automake_in \
-sc_tests_make_without_am_makeflags \
-$(sc_obsolete_requirements_rules) \
-sc_tests_no_source_defs \
-sc_tests_obsolete_variables \
-sc_tests_here_document_format \
-sc_tests_command_subst \
-sc_tests_exit_not_Exit \
-sc_tests_automake_fails \
-sc_tests_required_after_defs \
-sc_tests_overriding_macros_on_cmdline \
-sc_tests_plain_sleep \
-sc_tests_ls_t \
-sc_tests_executable \
-sc_m4_am_plain_egrep_fgrep \
-sc_tests_no_configure_in \
-sc_tests_PATH_SEPARATOR \
-sc_tests_logs_duplicate_prefixes \
-sc_tests_makefile_variable_order \
-sc_perl_at_substs \
-sc_unquoted_DESTDIR \
-sc_tabs_in_texi \
-sc_at_in_texi
-
-## These check avoids accidental configure substitutions in the source.
-## There are exactly 8 lines that should be modified from automake.in to
-## automake, and 9 lines that should be modified from aclocal.in to
-## aclocal.
-automake_diff_no = 8
-aclocal_diff_no = 9
-sc_diff_automake sc_diff_aclocal: sc_diff_% :
- @set +e; tmp=$*-diffs.tmp; \
- diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
- added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
- removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
- test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
- || { \
- echo "Found unexpected diffs between $*.in and $*"; \
- echo "Lines added: $$added" ; \
- echo "Lines removed: $$removed"; \
- cat $$tmp >&2; \
- exit 1; \
- } >&1; \
- rm -f $$tmp
-
-## Expect no instances of '${...}'. However, $${...} is ok, since that
-## is a shell construct, not a Makefile construct.
-sc_no_brace_variable_expansions:
- @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
- echo "Found too many uses of '\$${' in the lines above." 1>&2; \
- exit 1; \
- else :; fi
-
-## Make sure 'rm' is called with '-f'.
-sc_rm_minus_f:
- @if grep -v '^#' $(ams) $(xtests) \
- | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
- | grep -E '\)'; \
- then \
- echo "Suspicious 'rm' invocation." 1>&2; \
- exit 1; \
- else :; fi
-
-## Never use something like "for file in $(FILES)", this doesn't work
-## if FILES is empty or if it contains shell meta characters (e.g. $ is
-## commonly used in Java filenames).
-sc_no_for_variable_in_macro:
- @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
- echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
- exit 1; \
- else :; fi
-
-## Make sure all invocations of mkinstalldirs are correct.
-sc_mkinstalldirs:
- @if grep -n 'mkinstalldirs' $(ams) \
- | grep -F -v '$$(mkinstalldirs)' \
- | grep -v '^\./Makefile.am:[0-9][0-9]*: *lib/mkinstalldirs \\$$'; \
- then \
- echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
- exit 1; \
- else :; fi
-
-## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
-sc_pre_normal_post_install_uninstall:
- @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
- grep -v ':##' | grep -v ': @\$$('; then \
- echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
- exit 1; \
- else :; fi
-
-## We never want to use "undef", only "delete", but for $/.
-sc_perl_no_undef:
- @if grep -n -w 'undef ' $(srcdir)/automake.in | \
- grep -F -v 'undef $$/'; then \
- echo "Found undef in automake.in; use delete instead" 1>&2; \
- exit 1; \
- fi
-
-## We never want split (/ /,...), only split (' ', ...).
-sc_perl_no_split_regex_space:
- @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
- echo "Found bad split in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Look for cd within backquotes
-sc_cd_in_backquotes:
- @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
- echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Look for cd to a relative directory (may be influenced by CDPATH).
-## Skip some known directories that are OK.
-sc_cd_relative_dir:
- @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
- grep -v 'echo.*cd ' | \
- grep -v 'am__cd =' | \
- grep -v '^[^#]*cd [./]' | \
- grep -v '^[^#]*cd \$$(top_builddir)' | \
- grep -v '^[^#]*cd "\$$\$$am__cwd' | \
- grep -v '^[^#]*cd \$$(abs' | \
- grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
- echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Using @_ in a scalar context is most probably a programming error.
-sc_perl_at_uscore_in_scalar_context:
- @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
- echo "Using @_ in a scalar context in the lines above." 1>&2; \
- exit 1; \
- fi
-
-## Allow only few variables to be localized in Automake.
-sc_perl_local:
- @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
- grep '^[ \t]*local [^*]'; then \
- echo "Please avoid 'local'." 1>&2; \
- exit 1; \
- fi
-
-## Don't let AMDEP_TRUE substitution appear in automake.in.
-sc_AMDEP_TRUE_in_automake_in:
- @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
- echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
- exit 1; \
- fi
-
-## Recursive make invocations should always pass $(AM_MAKEFLAGS)
-## to $(MAKE), for portability to non-GNU make.
-sc_tests_make_without_am_makeflags:
- @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
- | grep -v 'AM_MAKEFLAGS' \
- | grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \
- then \
- echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
- exit 1; \
- fi
-
-## Look out for some obsolete variables.
-sc_tests_obsolete_variables:
- @vars=" \
- using_tap \
- am_using_tap \
- test_prefer_config_shell \
- original_AUTOMAKE \
- original_ACLOCAL \
- parallel_tests \
- am_parallel_tests \
- "; \
- seen=""; \
- for v in $$vars; do \
- if grep -E "\b$$v\b" $(xtests) $(xdefs); then \
- seen="$$seen $$v"; \
- fi; \
- done; \
- if test -n "$$seen"; then \
- for v in $$seen; do \
- case $$v in \
- parallel_tests|am_parallel_tests) v2=am_serial_tests;; \
- *) v2=am_$$v;; \
- esac; \
- echo "Variable '$$v' is obsolete, use '$$v2' instead." 1>&2; \
- done; \
- exit 1; \
- else :; fi
-
-## Look out for obsolete requirements specified in the test cases.
-sc_obsolete_requirements_rules = sc_no_texi2dvi-o sc_no_makeinfo-html
-modern-requirement.texi2dvi-o = texi2dvi
-modern-requirement.makeinfo-html = makeinfo
-
-$(sc_obsolete_requirements_rules): sc_no_% :
- @if grep -E 'required=.*\b$*\b' $(xtests); then \
- echo "Requirement '$*' is obsolete and shouldn't" \
- "be used anymore." >&2; \
- echo "You should use '$(modern-requirement.$*)' instead." >&2; \
- exit 1; \
- fi
-
-## Tests should never call some programs directly, but only through the
-## corresponding variable (e.g., '$MAKE', not 'make'). This will allow
-## the programs to be overridden at configure time (for less brittleness)
-## or by the user at make time (to allow better testsuite coverage).
-sc_tests_plain_check_rules = \
- sc_tests_plain_egrep \
- sc_tests_plain_fgrep \
- sc_tests_plain_make \
- sc_tests_plain_perl \
- sc_tests_plain_automake \
- sc_tests_plain_aclocal \
- sc_tests_plain_autoconf \
- sc_tests_plain_autoupdate \
- sc_tests_plain_autom4te \
- sc_tests_plain_autoheader \
- sc_tests_plain_autoreconf
-
-toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
-
-$(sc_tests_plain_check_rules): sc_tests_plain_% :
- @# The leading ':' in the grep below is what is printed by the
- @# preceding 'grep -v' after the file name.
- @# It works here as a poor man's substitute for beginning-of-line
- @# marker.
- @if grep -v '^[ ]*#' $(xtests) \
- | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[ ]*?$*\b'; \
- then \
- echo 'Do not run "$*" in the above tests.' \
- 'Use "$$$(call toupper,$*)" instead.' 1>&2; \
- exit 1; \
- fi
-
-## Tests should only use END and EOF for here documents
-## (so that the next test is effective).
-sc_tests_here_document_format:
- @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \
- echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
- exit 1; \
- fi
-
-## Our test case should use the $(...) POSIX form for command substitution,
-## rather than the older `...` form.
-## The point of ignoring text on here-documents is that we want to exempt
-## Makefile.am rules, configure.ac code and helper shell script created and
-## used by out shell scripts, because Autoconf (as of version 2.69) does not
-## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
-sc_tests_command_subst:
- @found=false; \
- scan () { \
- sed -n -e '/^#/d' \
- -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
- -e 's/\\`/\\{backtick}/' \
- -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
- -e '/`/p' $$*; \
- }; \
- for file in $(xtests); do \
- res=`scan $$file`; \
- if test -n "$$res"; then \
- echo "$$file:$$res"; \
- found=true; \
- fi; \
- done; \
- if $$found; then \
- echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
- exit 1; \
- fi
-
-## Tests should no longer call 'Exit', just 'exit'. That's because we
-## now have in place a better workaround to ensure the exit status is
-## transported correctly across the exit trap.
-sc_tests_exit_not_Exit:
- @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
- echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
- exit 1; \
- fi
-
-## Guard against obsolescent uses of ./defs in tests. Now,
-## 'test-init.sh' should be used instead.
-sc_tests_no_source_defs:
- @if grep -E '\. .*defs($$| )' $(xtests); then \
- echo "Source 'test-init.sh', not './defs'." 1>&2; \
- exit 1; \
- fi
-
-## Use AUTOMAKE_fails when appropriate
-sc_tests_automake_fails:
- @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
- echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
- exit 1; \
- fi
-
-## Setting 'required' after sourcing './defs' is a bug.
-sc_tests_required_after_defs:
- @for file in $(xtests); do \
- if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
- echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
- exit 1; \
- fi; \
- done
-
-## Overriding a Makefile macro on the command line is not portable when
-## recursive targets are used. Better use an envvar. SHELL is an
-## exception, POSIX says it can't come from the environment. V, DESTDIR,
-## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
-## as package authors are urged not to initialize them anywhere.
-## Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
-## ok to override it from the command line.
-sc_tests_overriding_macros_on_cmdline:
- @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
- echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
- echo ' in the above lines, it is more portable.' 1>&2; \
- exit 1; \
- fi
-# The first s/// tries to account for usages like "$MAKE || st=$?".
-# 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
-# their definitions, hence the more complex last three substitutions below.
-# Also, the 'make-dryrun.sh' is whitelisted, since there we need to
-# override variables from the command line in order to cover the expected
-# code paths.
- @tests=`for t in $(xtests); do \
- case $$t in */make-dryrun.sh);; *) echo $$t;; esac; \
- done`; \
- if sed -e 's/ || .*//' -e 's/ && .*//' \
- -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
- -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
- -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
- -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
- -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
- -e "s/ exp='[^']*'/ /" \
- -e 's/ exp="[^"]*"/ /' \
- -e 's/ exp=[^ ]/ /' \
- $$tests | grep '\$$MAKE .*='; then \
- echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
- echo 'it is more portable.' 1>&2; \
- exit 1; \
- fi
- @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
- echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
- echo 'the above lines.' 1>&2; \
- exit 1; \
- fi
-
-## Prefer use of our 'is_newest' auxiliary script over the more hacky
-## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
-## cumbersome and more fragile.
-sc_tests_ls_t:
- @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
- $(xtests); then \
- echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
- exit 1; \
- fi
-
-## Test scripts must be executable.
-sc_tests_executable:
- @st=0; \
- for f in $(xtests); do \
- case $$f in \
- t/ax/*|./t/ax/*|$(srcdir)/t/ax/*);; \
- *) test -x $$f || { echo "$$f: not executable" >&2; st=1; }; \
- esac; \
- done; \
- test $$st -eq 0 || echo '$@: some test scripts are not executable' >&2; \
- exit $$st;
-
-
-## Never use 'sleep 1' to create files with different timestamps.
-## Use '$sleep' instead. Some filesystems (e.g., Windows) have only
-## a 2sec resolution.
-sc_tests_plain_sleep:
- @if grep -E '\bsleep +[12345]\b' $(xtests); then \
- echo 'Do not use "sleep x" in the above tests. Use "$$sleep" instead.' 1>&2; \
- exit 1; \
- fi
-
-## fgrep and egrep are not required by POSIX.
-sc_m4_am_plain_egrep_fgrep:
- @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
- echo 'Do not use egrep or fgrep in the above files,' \
- 'they are not portable.' 1>&2; \
- exit 1; \
- fi
-
-## Prefer 'configure.ac' over the obsolescent 'configure.in' as the name
-## for configure input files in our testsuite. The latter has been
-## deprecated for several years (at least since autoconf 2.50).
-sc_tests_no_configure_in:
- @if grep -E '\bconfigure\\*\.in\b' $(xtests) $(xdefs) \
- | grep -Ev '/backcompat.*\.(sh|tap):' \
- | grep -Ev '/autodist-configure-no-subdir\.sh:' \
- | grep -Ev '/(configure|help)\.sh:' \
- | grep .; \
- then \
- echo "Use 'configure.ac', not 'configure.in', as the name" >&2; \
- echo "for configure input files in the test cases above." >&2; \
- exit 1; \
- fi
-
-## Rule to ensure that the testsuite has been run before. We don't depend
-## on 'check' here, because that would be very wasteful in the common case.
-## We could run "make check RECHECK_LOGS=" and avoid toplevel races with
-## AM_RECURSIVE_TARGETS. Suggest keeping test directories around for
-## greppability of the Makefile.in files.
-sc_ensure_testsuite_has_run:
- @if test ! -f '$(TEST_SUITE_LOG)'; then \
- echo 'Run "env keep_testdirs=yes make check" before' \
- 'running "make maintainer-check"' >&2; \
- exit 1; \
- fi
-.PHONY: sc_ensure_testsuite_has_run
-
-## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
-## This test actually depends on the testsuite having been run before.
-sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
- @if grep -E '(warning|error):.*(warning|error):' t/*.log; then \
- echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
- exit 1; \
- fi
-
-## Ensure variables are listed before rules in Makefile.in files we generate.
-sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
- @st=0; \
- for file in `find t -name Makefile.in -print`; do \
- latevars=`sed -n \
- -e :x -e 's/#.*//' \
- -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
- -e '# Literal TAB.' \
- -e '1,/^ /d' \
- -e '# Allow @ so we match conditionals.' \
- -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
- if test -n "$$latevars"; then \
- echo "Variables are expanded too late in $$file:" >&2; \
- echo "$$latevars" | sed 's/^/ /' >&2; \
- st=1; \
- fi; \
- done; \
- test $$st -eq 0 || { \
- echo 'Ensure variables are expanded before rules' >&2; \
- exit 1; \
- }
-
-## Using ':' as a PATH separator is not portable.
-sc_tests_PATH_SEPARATOR:
- @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
- echo "Use '\$$PATH_SEPARATOR', not ':', in PATH definitions" \
- "above." 1>&2; \
- exit 1; \
- fi
-
-## Try to make sure all @...@ substitutions are covered by our
-## substitution rule.
-sc_perl_at_substs:
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
- echo "Unresolved @...@ substitution in aclocal" 1>&2; \
- exit 1; \
- fi
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
- echo "Unresolved @...@ substitution in automake" 1>&2; \
- exit 1; \
- fi
-
-sc_unquoted_DESTDIR:
- @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
- echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
- exit 1; \
- fi
-
-sc_tabs_in_texi:
- @if grep ' ' $(srcdir)/doc/automake.texi; then \
- echo 'Do not use tabs in the manual.' 1>&2; \
- exit 1; \
- fi
-
-sc_at_in_texi:
- @if grep -E '([^@]|^)@([ ][^@]|$$)' $(srcdir)/doc/automake.texi; \
- then \
- echo 'Unescaped @.' 1>&2; \
- exit 1; \
- fi
-
-$(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
-.PHONY: maintainer-check $(syntax_check_rules)
-
-## Check that the list of tests given in the Makefile is equal to the
-## list of all test scripts in the Automake testsuite.
-maintainer-check: maintainer-check-list-of-tests
diff --git a/maintainer/am-ft b/maintainer/am-ft
new file mode 100755
index 000000000..d8a2722be
--- /dev/null
+++ b/maintainer/am-ft
@@ -0,0 +1,109 @@
+#!/usr/bin/env bash
+# Remote testing of Automake tarballs made easy.
+# This script requires Bash 4.x or later.
+# TODO: some documentation would be nice ...
+
+set -u
+me=${0##*/}
+
+fatal () { echo "$me: $*" >&2; exit 1; }
+
+cmd='
+ test_script=$HOME/.am-test/run
+ if test -f "$test_script" && test -x "$test_script"; then
+ "$test_script" "$@"
+ else
+ nice -n19 ./configure && nice -n19 make -j10 check
+ fi
+'
+
+remote=
+interactive=1
+while test $# -gt 0; do
+ case $1 in
+ -b|--batch) interactive=0;;
+ -c|--command) cmd=${2-}; shift;;
+ -*) fatal "'$1': invalid option";;
+ *) remote=$1; shift; break;;
+ esac
+ shift
+done
+[[ -n $remote ]] || fatal "no remote given"
+
+if ((interactive)); then
+ do_on_error='{
+ AM_TESTSUITE_FAILED=yes
+ export AM_TESTSUITE_FAILED
+ # We should not modify the environment with which the failed
+ # tests have run, hence do not read ".profile", ".bashrc", and
+ # company.
+ exec bash --noprofile --norc -i
+ }'
+else
+ do_on_error='exit $?'
+fi
+
+tarball=$(echo automake*.tar.xz)
+
+case $tarball in
+ *' '*) fatal "too many automake tarballs: $tarball";;
+esac
+
+test -f $tarball || fatal "no automake tarball found"
+
+distdir=${tarball%%.tar.xz}
+
+env='PATH=$HOME/bin:$PATH'
+if test -t 1; then
+ env+=" TERM='$TERM' AM_COLOR_TESTS=always"
+fi
+
+# This is tempting:
+# $ ssh "command" arg-1 ... arg-2
+# but doesn't work as expected. So we need the following hack
+# to propagate the command line arguments to the remote shell.
+quoted_args=--
+while (($# > 0)); do
+ case $1 in
+ *\'*) quoted_args+=" "$(printf '%s\n' "$1" | sed "s/'/'\\''/g");;
+ *) quoted_args+=" '$1'";;
+ esac
+ shift
+done
+
+set -e
+set -x
+
+scp $tarball $remote:tmp/
+
+# Multiple '-t' to force tty allocation.
+ssh -t -t $remote "
+ set -x; set -e; set -u;
+ set $quoted_args
+ cd tmp
+ if test -e $distdir; then
+ # Use 'perl', not only 'rm -rf', to correctly handle read-only
+ # files or directory. Fall back to 'rm' if something goes awry.
+ perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
+ || rm -rf $distdir || exit 1
+ test ! -e $distdir
+ fi
+ xz -dc $tarball | tar xf -
+ cd $distdir
+ "'
+ am_extra_acdir=$HOME/.am-test/extra-aclocal
+ am_extra_bindir=$HOME/.am-test/extra-bin
+ am_extra_setup=$HOME/.am-test/extra-setup.sh
+ if test -d "$am_extra_acdir"; then
+ export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
+ fi
+ if test -d "$am_extra_bindir"; then
+ export PATH=$am_extra_bindir:$PATH
+ fi
+ '"
+ export $env
+ if test -f \"\$am_extra_setup\"; then
+ . \"\$am_extra_setup\"
+ fi
+ ($cmd) || $do_on_error
+"
diff --git a/maintainer/am-xft b/maintainer/am-xft
new file mode 100755
index 000000000..564aa3b02
--- /dev/null
+++ b/maintainer/am-xft
@@ -0,0 +1,3 @@
+#!/bin/sh
+MAKE=${MAKE-make} GIT=${GIT-git}
+$GIT clean -fdx && $MAKE bootstrap && $MAKE dist && exec am-ft "$@"
diff --git a/maintainer/maint.mk b/maintainer/maint.mk
new file mode 100644
index 000000000..69b163048
--- /dev/null
+++ b/maintainer/maint.mk
@@ -0,0 +1,467 @@
+# Maintainer makefile rules for Automake.
+#
+# Copyright (C) 1995-2013 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 2, 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 .
+
+# Avoid CDPATH issues.
+unexport CDPATH
+
+# --------------------------------------------------------- #
+# Automatic generation of the ChangeLog from git history. #
+# --------------------------------------------------------- #
+
+gitlog_to_changelog_command = $(PERL) $(srcdir)/lib/gitlog-to-changelog
+gitlog_to_changelog_fixes = $(srcdir)/.git-log-fix
+gitlog_to_changelog_options = --amend=$(gitlog_to_changelog_fixes) \
+ --since='2011-12-28 00:00:00' \
+ --no-cluster --format '%s%n%n%b'
+
+EXTRA_DIST += lib/gitlog-to-changelog
+EXTRA_DIST += $(gitlog_to_changelog_fixes)
+
+# When executed from a git checkout, generate the ChangeLog from the git
+# history. When executed from an extracted distribution tarball, just
+# copy the distributed ChangeLog in the build directory (and if this
+# fails, or if no distributed ChangeLog file is present, complain and
+# give an error).
+#
+# The ChangeLog should be regenerated unconditionally when working from
+# checked-out sources; otherwise, if we're working from a distribution
+# tarball, we expect the ChangeLog to be distributed, so check that it
+# is indeed present in the source directory.
+ChangeLog:
+ $(AM_V_GEN)set -e; set -u; \
+ if test -d $(srcdir)/.git; then \
+ rm -f $@-t \
+ && $(gitlog_to_changelog_command) \
+ $(gitlog_to_changelog_options) >$@-t \
+ && chmod a-w $@-t \
+ && mv -f $@-t $@ \
+ || exit 1; \
+ elif test ! -f $(srcdir)/$@; then \
+ echo "Source tree is not a git checkout, and no pre-existent" \
+ "$@ file has been found there" >&2; \
+ exit 1; \
+ fi
+.PHONY: ChangeLog
+
+
+# --------------------------- #
+# Perl coverage statistics. #
+# --------------------------- #
+
+PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
+PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
+PERL_COVER = cover
+
+check-coverage-run recheck-coverage-run: %-coverage-run: all
+ $(MKDIR_P) $(PERL_COVERAGE_DB)
+ PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
+ WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
+ $(MAKE) $*
+
+check-coverage-report:
+ @if test ! -d "$(PERL_COVERAGE_DB)"; then \
+ echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
+ echo "Please run \"make check-coverage\" first" >&2; \
+ exit 1; \
+ fi
+ $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
+
+# We don't use direct dependencies here because we'd like to be able
+# to invoke the report even after interrupted check-coverage.
+check-coverage: check-coverage-run
+ $(MAKE) check-coverage-report
+
+recheck-coverage: recheck-coverage-run
+ $(MAKE) check-coverage-report
+
+clean-coverage:
+ rm -rf "$(PERL_COVERAGE_DB)"
+clean-local: clean-coverage
+
+.PHONY: check-coverage recheck-coverage check-coverage-run \
+ recheck-coverage-run check-coverage-report clean-coverage
+
+
+# ---------------------------------------------------- #
+# Tagging and/or uploading stable and beta releases. #
+# ---------------------------------------------------- #
+
+GIT = git
+
+EXTRA_DIST += lib/gnupload
+
+base_version_rx = ^[1-9][0-9]*\.[0-9][0-9]*
+stable_major_version_rx = $(base_version_rx)$$
+stable_minor_version_rx = $(base_version_rx)\.[0-9][0-9]*$$
+beta_version_rx = $(base_version_rx)(\.[0-9][0-9]*)?[bdfhjlnprtvxz]$$
+match_version = echo "$(VERSION)" | $(EGREP) >/dev/null
+
+# Check that we don't have uncommitted or unstaged changes.
+# TODO: Maybe the git suite already offers a shortcut to verify if the
+# TODO: working directory is "clean" or not? If yes, use that instead
+# TODO: of duplicating the logic here.
+git_must_have_clean_workdir = \
+ $(GIT) rev-parse --verify HEAD >/dev/null \
+ && $(GIT) update-index -q --refresh \
+ && $(GIT) diff-files --quiet \
+ && $(GIT) diff-index --quiet --cached HEAD \
+ || { echo "$@: you have uncommitted or unstaged changes" >&2; exit 1; }
+
+determine_release_type = \
+ if $(match_version) '$(stable_major_version_rx)'; then \
+ release_type='Major release'; \
+ announcement_type='major release'; \
+ dest=ftp; \
+ elif $(match_version) '$(stable_minor_version_rx)'; then \
+ release_type='Minor release'; \
+ announcement_type='maintenance release'; \
+ dest=ftp; \
+ elif $(match_version) '$(beta_version_rx)'; then \
+ release_type='Beta release'; \
+ announcement_type='test release'; \
+ dest=alpha; \
+ else \
+ echo "$@: invalid version '$(VERSION)' for a release" >&2; \
+ exit 1; \
+ fi
+
+# Help the debugging of $(determine_release_type) and related code.
+print-release-type:
+ @$(determine_release_type); \
+ echo "$$release_type $(VERSION);" \
+ "it will be announced as a $$announcement_type"
+
+git-tag-release: maintainer-check
+ @set -e -u; \
+ case '$(AM_TAG_DRYRUN)' in \
+ ""|[nN]|[nN]o|NO) run="";; \
+ *) run="echo Running:";; \
+ esac; \
+ $(determine_release_type); \
+ $(git_must_have_clean_workdir); \
+ $$run $(GIT) tag -s "v$(VERSION)" -m "$$release_type $(VERSION)"
+
+git-upload-release:
+ @# Check this is a version we can cut a release (either test
+ @# or stable) from.
+ @$(determine_release_type)
+ @# The repository must be clean.
+ @$(git_must_have_clean_workdir)
+ @# Check that we are releasing from a valid tag.
+ @tag=`$(GIT) describe` \
+ && case $$tag in "v$(VERSION)") true;; *) false;; esac \
+ || { echo "$@: you can only create a release from a tagged" \
+ "version" >&2; \
+ exit 1; }
+ @# Build the distribution tarball(s).
+ $(MAKE) dist
+ @# Upload it to the correct FTP repository.
+ @$(determine_release_type) \
+ && dest=$$dest.gnu.org:automake \
+ && echo "Will upload to $$dest: $(DIST_ARCHIVES)" \
+ && $(srcdir)/lib/gnupload $(GNUPLOADFLAGS) --to $$dest \
+ $(DIST_ARCHIVES)
+
+.PHONY: print-release-type git-upload-release git-tag-release
+
+
+# ------------------------------------------------------------------ #
+# Explore differences of autogenerated files in different commits. #
+# ------------------------------------------------------------------ #
+
+# Visually comparing differences between the Makefile.in files in
+# automake's own build system as generated in two different branches
+# might help to catch bugs and blunders. This has already happened a
+# few times in the past, when we used to version-control Makefile.in.
+autodiffs:
+ @set -u; \
+ NEW_COMMIT=$${NEW_COMMIT-"HEAD"}; \
+ OLD_COMMIT=$${OLD_COMMIT-"HEAD~1"}; \
+ am_gitdir='$(abs_top_srcdir)/.git'; \
+ get_autofiles_from_rev () \
+ { \
+ rev=$$1 dir=$$2 \
+ && echo "$@: will get files from revision $$rev" \
+ && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
+ && cd tmp \
+ && $(GIT) checkout -q "$$rev" \
+ && echo "$@: bootstrapping $$rev" \
+ && $(SHELL) ./bootstrap.sh \
+ && echo "$@: copying files from $$rev" \
+ && makefile_ins=`find . -name Makefile.in` \
+ && (tar cf - configure aclocal.m4 $$makefile_ins) | \
+ (cd .. && cd "$$dir" && tar xf -) \
+ && cd .. \
+ && rm -rf tmp; \
+ }; \
+ outdir=$@.dir \
+ && : Before proceeding, ensure the specified revisions truly exist. \
+ && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
+ && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
+ && rm -rf $$outdir \
+ && mkdir $$outdir \
+ && cd $$outdir \
+ && mkdir new old \
+ && get_autofiles_from_rev $$OLD_COMMIT old \
+ && get_autofiles_from_rev $$NEW_COMMIT new \
+ && exit 0
+
+# With lots of eye candy; we like our developers pampered and spoiled :-)
+compare-autodiffs: autodiffs
+ @set -u; \
+ : $${COLORDIFF=colordiff} $${DIFF=diff}; \
+ dir=autodiffs.dir; \
+ if test ! -d "$$dir"; then \
+ echo "$@: $$dir: Not a directory" >&2; \
+ exit 1; \
+ fi; \
+ mydiff=false mypager=false; \
+ if test -t 1; then \
+ if ($$COLORDIFF -r . .) /dev/null 2>&1; then \
+ mydiff=$$COLORDIFF; \
+ mypager="less -R"; \
+ else \
+ mypager=less; \
+ fi; \
+ else \
+ mypager=cat; \
+ fi; \
+ if test "$$mydiff" = false; then \
+ if ($$DIFF -r -u . .); then \
+ mydiff=$$DIFF; \
+ else \
+ echo "$@: no good-enough diff program specified" >&2; \
+ exit 1; \
+ fi; \
+ fi; \
+ st=0; $$mydiff -r -u $$dir/old $$dir/new | $$mypager || st=$$?; \
+ rm -rf $$dir; \
+ exit $$st
+.PHONY: autodiffs compare-autodiffs
+
+# ---------------------------------------------- #
+# Help writing the announcement for a release. #
+# ---------------------------------------------- #
+
+PACKAGE_MAILINGLIST = automake@gnu.org
+
+announcement: NEWS
+ $(AM_V_GEN): \
+ && rm -f $@ $@-t \
+ && $(determine_release_type) \
+ && ftp_base="ftp://$$dest.gnu.org/gnu/$(PACKAGE)" \
+ && X () { printf '%s\n' "$$*" >> $@-t; } \
+ && X "We are pleased to announce the $(PACKAGE_NAME) $(VERSION)" \
+ "$$announcement_type." \
+ && X \
+ && X "**TODO** Brief description of the release here." \
+ && X \
+ && X "**TODO** This description can span multiple paragraphs." \
+ && X \
+ && X "See below for the detailed list of changes since the" \
+ && X "previous version, as summarized by the NEWS file." \
+ && X \
+ && X "Download here:" \
+ && X \
+ && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.gz" \
+ && X " $$ftp_base/$(PACKAGE)-$(VERSION).tar.xz" \
+ && X \
+ && X "Please report bugs and problems to" \
+ "<$(PACKAGE_BUGREPORT)>," \
+ && X "and send general comments and feedback to" \
+ "<$(PACKAGE_MAILINGLIST)>." \
+ && X \
+ && X "Thanks to everyone who has reported problems, contributed" \
+ && X "patches, and helped testing Automake!" \
+ && X \
+ && X "-*-*-*-" \
+ && X \
+ && sed -n -e '/^~~~/q' -e p $(srcdir)/NEWS >> $@-t \
+ && mv -f $@-t $@
+.PHONY: announcement
+CLEANFILES += announcement
+
+# --------------------------------------------------------------------- #
+# Synchronize third-party files that are committed in our repository. #
+# --------------------------------------------------------------------- #
+
+# Program to use to fetch files.
+WGET = wget
+
+# Some repositories we sync files from.
+SV_CVS = 'http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/'
+SV_GIT_CF = 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;hb=HEAD;f='
+SV_GIT_AC = 'http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;hb=HEAD;f='
+SV_GIT_GL = 'http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;hb=HEAD;f='
+
+# Files that we fetch and which we compare against.
+# Note that the 'lib/COPYING' file must still be synced by hand.
+FETCHFILES = \
+ $(SV_GIT_CF)config.guess \
+ $(SV_GIT_CF)config.sub \
+ $(SV_CVS)texinfo/texinfo/doc/texinfo.tex \
+ $(SV_CVS)texinfo/texinfo/util/gendocs.sh \
+ $(SV_CVS)texinfo/texinfo/util/gendocs_template \
+ $(SV_GIT_GL)build-aux/gitlog-to-changelog \
+ $(SV_GIT_GL)build-aux/gnupload \
+ $(SV_GIT_GL)build-aux/update-copyright \
+ $(SV_GIT_GL)doc/INSTALL
+
+# Fetch the latest versions of few scripts and files we care about.
+# A retrieval failure or a copying failure usually mean serious problems,
+# so we'll just bail out if 'wget' or 'cp' fail.
+fetch:
+ $(AM_V_at)rm -rf Fetchdir
+ $(AM_V_at)mkdir Fetchdir
+ $(AM_V_GEN)set -e; \
+ if $(AM_V_P); then wget_opts=; else wget_opts=-nv; fi; \
+ for url in $(FETCHFILES); do \
+ file=`printf '%s\n' "$$url" | sed 's|^.*/||; s|^.*=||'`; \
+ $(WGET) $$wget_opts "$$url" -O Fetchdir/$$file || exit 1; \
+ if cmp Fetchdir/$$file $(srcdir)/lib/$$file >/dev/null; then \
+ : Nothing to do; \
+ else \
+ echo "$@: updating file $$file"; \
+ cp Fetchdir/$$file $(srcdir)/lib/$$file || exit 1; \
+ fi; \
+ done
+ $(AM_V_at)rm -rf Fetchdir
+.PHONY: fetch
+
+# ---------------------------------------------------------------------- #
+# Generate and upload manuals in several formats, for the GNU website. #
+# ---------------------------------------------------------------------- #
+
+web_manual_dir = doc/web-manual
+
+RSYNC = rsync
+CVS = cvs
+CVSU = cvsu
+CVS_USER = $${USER}
+WEBCVS_ROOT = cvs.savannah.gnu.org:/web
+CVS_RSH = ssh
+export CVS_RSH
+
+.PHONY: web-manual web-manual-update
+web-manual web-manual-update: t = $@.dir
+
+# Build manual in several formats. Note to the recipe:
+# 1. The symlinking of automake.texi into the temporary directory is
+# required to pacify extra checks from gendocs.sh.
+# 2. The redirection to /dev/null before the invocation of gendocs.sh
+# is done to better respect silent rules.
+web-manual:
+ $(AM_V_at)rm -rf $(web_manual_dir) $t
+ $(AM_V_at)mkdir $t
+ $(AM_V_at)$(LN_S) '$(abs_srcdir)/doc/$(PACKAGE).texi' '$t/'
+ $(AM_V_GEN)cd $t \
+ && GENDOCS_TEMPLATE_DIR='$(abs_srcdir)/lib' \
+ && export GENDOCS_TEMPLATE_DIR \
+ && if $(AM_V_P); then :; else exec >/dev/null 2>&1; fi \
+ && $(SHELL) '$(abs_srcdir)/lib/gendocs.sh' \
+ -I '$(abs_srcdir)/doc' --email $(PACKAGE_BUGREPORT) \
+ $(PACKAGE) '$(PACKAGE_NAME)'
+ $(AM_V_at)mkdir $(web_manual_dir)
+ $(AM_V_at)mv -f $t/manual/* $(web_manual_dir)
+ $(AM_V_at)rm -rf $t
+ @! $(AM_V_P) || ls -l $(web_manual_dir)
+
+# Upload manual to www.gnu.org, using CVS (sigh!)
+web-manual-update:
+ $(AM_V_at)$(determine_release_type); \
+ case $$release_type in \
+ [Mm]ajor\ release|[Mm]inor\ release);; \
+ *) echo "Cannot upload manuals from a \"$$release_type\"" >&2; \
+ exit 1;; \
+ esac
+ $(AM_V_at)test -f $(web_manual_dir)/$(PACKAGE).html || { \
+ echo 'You have to run "$(MAKE) web-manuals" before' \
+ 'invoking "$(MAKE) $@"' >&2; \
+ exit 1; \
+ }
+ $(AM_V_at)rm -rf $t
+ $(AM_V_at)mkdir $t
+ $(AM_V_at)cd $t \
+ && $(CVS) -z3 -d :ext:$(CVS_USER)@$(WEBCVS_ROOT)/$(PACKAGE) \
+ co $(PACKAGE)
+ @# According to the rsync manpage, "a trailing slash on the
+ @# source [...] avoids creating an additional directory
+ @# level at the destination". So the trailing '/' after
+ @# '$(web_manual_dir)' below is intended.
+ $(AM_V_at)$(RSYNC) -avP $(web_manual_dir)/ $t/$(PACKAGE)/manual
+ $(AM_V_GEN): \
+ && cd $t/$(PACKAGE)/manual \
+ && new_files=`$(CVSU) --types='?'` \
+ && new_files=`echo "$$new_files" | sed s/^..//` \
+ && { test -z "$$new_files" || $(CVS) add -ko $$new_files; } \
+ && $(CVS) ci -m $(VERSION)
+ $(AM_V_at)rm -rf $t
+.PHONY: web-manual-update
+
+clean-web-manual:
+ $(AM_V_at)rm -rf $(web_manual_dir)
+.PHONY: clean-web-manual
+clean-local: clean-web-manual
+
+EXTRA_DIST += lib/gendocs.sh lib/gendocs_template
+
+# ------------------------------------------------ #
+# Update copyright years of all committed files. #
+# ------------------------------------------------ #
+
+EXTRA_DIST += lib/update-copyright
+
+update_copyright_env = \
+ UPDATE_COPYRIGHT_FORCE=1 \
+ UPDATE_COPYRIGHT_USE_INTERVALS=2
+
+# In addition to the several README files, these as well are
+# not expected to have a copyright notice.
+files_without_copyright = \
+ .autom4te.cfg \
+ .git-log-fix \
+ .gitattributes \
+ .gitignore \
+ INSTALL \
+ COPYING \
+ AUTHORS \
+ THANKS \
+ lib/INSTALL \
+ lib/COPYING
+
+# This script is in the public domain.
+files_without_copyright += lib/mkinstalldirs
+
+# This script has an MIT-style license
+files_without_copyright += lib/install-sh
+
+.PHONY: update-copyright
+update-copyright:
+ $(AM_V_GEN)set -e; \
+ current_year=`date +%Y` && test -n "$$current_year" \
+ || { echo "$@: cannot get current year" >&2; exit 1; }; \
+ sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
+ bootstrap.sh configure.ac; \
+ excluded_re=`( \
+ for url in $(FETCHFILES); do echo "$$url"; done \
+ | sed -e 's!^.*/!!' -e 's!^.*=!!' -e 's!^!lib/!' \
+ && for f in $(files_without_copyright); do echo $$f; done \
+ ) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
+ $(GIT) ls-files \
+ | grep -Ev '(^|/)README$$' \
+ | grep -Ev "^($$excluded_re)$$" \
+ | $(update_copyright_env) xargs $(srcdir)/lib/$@
diff --git a/maintainer/rename-tests b/maintainer/rename-tests
new file mode 100755
index 000000000..6fce9fe84
--- /dev/null
+++ b/maintainer/rename-tests
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# Convenience script to rename test cases in Automake.
+
+set -e -u
+
+me=${0##*/}
+fatal () { echo "$me: $*" >&2; exit 1; }
+
+case $# in
+ 0) input=$(cat);;
+ 1) input=$(cat -- "$1");;
+ *) fatal "too many arguments";;
+esac
+
+AWK=${AWK-awk}
+SED=${SED-sed}
+
+[[ -f automake.in && -d lib/Automake ]] \
+ || fatal "can only be run from the top-level of the Automake source tree"
+
+$SED --version 2>&1 | grep GNU >/dev/null 2>&1 \
+ || fatal "GNU sed is required by this script"
+
+# Validate and cleanup input.
+input=$(
+ $AWK -v me="$me" "
+ /^#/ { next; }
+ (NF == 0) { next; }
+ (NF != 2) { print me \": wrong number of fields at line \" NR;
+ exit(1); }
+ { printf (\"t/%s t/%s\\n\", \$1, \$2); }
+ " <<<"$input")
+
+# Prepare git commit message.
+exec 5>$me.git-msg
+echo "tests: more significant names for some tests" >&5
+echo >&5
+$AWK >&5 <<<"$input" \
+ '{ printf ("* %s: Rename...\n* %s: ... like this.\n", $1, $2) }'
+exec 5>&-
+
+# Rename tests.
+eval "$($AWK '{ printf ("git mv %s %s\n", $1, $2) }' <<<"$input")"
+
+# Adjust the list of tests (do this conditionally, since such a
+# list is not required nor used in Automake-NG.
+if test -f t/list-of-tests.mk; then
+ $SED -e "$($AWK '{ printf ("s|^%s |%s |\n", $1, $2) }' <<<"$input")" \
+ -i t/list-of-tests.mk
+fi
+
+git status
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
new file mode 100644
index 000000000..375738be9
--- /dev/null
+++ b/maintainer/syntax-checks.mk
@@ -0,0 +1,544 @@
+# Maintainer checks for Automake. Requires GNU make.
+
+# Copyright (C) 2012-2013 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 2, 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 .
+
+# We also have to take into account VPATH builds (where some generated
+# tests might be in '$(builddir)' rather than in '$(srcdir)'), TAP-based
+# tests script (which have a '.tap' extension) and helper scripts used
+# by other test cases (which have a '.sh' extension).
+xtests := $(shell \
+ if test $(srcdir) = .; then \
+ dirs=.; \
+ else \
+ dirs='$(srcdir) .'; \
+ fi; \
+ for d in $$dirs; do \
+ for s in tap sh; do \
+ ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \
+ done; \
+ done | sort)
+
+xdefs = \
+ $(srcdir)/t/ax/am-test-lib.sh \
+ $(srcdir)/t/ax/test-lib.sh \
+ $(srcdir)/t/ax/test-defs.in
+
+ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
+
+# Some simple checks, and then ordinary check. These are only really
+# guaranteed to work on my machine.
+syntax_check_rules = \
+$(sc_tests_plain_check_rules) \
+sc_diff_automake \
+sc_diff_aclocal \
+sc_no_brace_variable_expansions \
+sc_rm_minus_f \
+sc_no_for_variable_in_macro \
+sc_mkinstalldirs \
+sc_pre_normal_post_install_uninstall \
+sc_perl_no_undef \
+sc_perl_no_split_regex_space \
+sc_cd_in_backquotes \
+sc_cd_relative_dir \
+sc_perl_at_uscore_in_scalar_context \
+sc_perl_local \
+sc_AMDEP_TRUE_in_automake_in \
+sc_tests_make_without_am_makeflags \
+$(sc_obsolete_requirements_rules) \
+sc_tests_no_source_defs \
+sc_tests_obsolete_variables \
+sc_tests_here_document_format \
+sc_tests_command_subst \
+sc_tests_exit_not_Exit \
+sc_tests_automake_fails \
+sc_tests_required_after_defs \
+sc_tests_overriding_macros_on_cmdline \
+sc_tests_plain_sleep \
+sc_tests_ls_t \
+sc_tests_executable \
+sc_m4_am_plain_egrep_fgrep \
+sc_tests_no_configure_in \
+sc_tests_PATH_SEPARATOR \
+sc_tests_logs_duplicate_prefixes \
+sc_tests_makefile_variable_order \
+sc_perl_at_substs \
+sc_unquoted_DESTDIR \
+sc_tabs_in_texi \
+sc_at_in_texi
+
+## These check avoids accidental configure substitutions in the source.
+## There are exactly 8 lines that should be modified from automake.in to
+## automake, and 9 lines that should be modified from aclocal.in to
+## aclocal.
+automake_diff_no = 8
+aclocal_diff_no = 9
+sc_diff_automake sc_diff_aclocal: sc_diff_% :
+ @set +e; tmp=$*-diffs.tmp; \
+ diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
+ added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
+ removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
+ test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
+ || { \
+ echo "Found unexpected diffs between $*.in and $*"; \
+ echo "Lines added: $$added" ; \
+ echo "Lines removed: $$removed"; \
+ cat $$tmp >&2; \
+ exit 1; \
+ } >&1; \
+ rm -f $$tmp
+
+## Expect no instances of '${...}'. However, $${...} is ok, since that
+## is a shell construct, not a Makefile construct.
+sc_no_brace_variable_expansions:
+ @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
+ echo "Found too many uses of '\$${' in the lines above." 1>&2; \
+ exit 1; \
+ else :; fi
+
+## Make sure 'rm' is called with '-f'.
+sc_rm_minus_f:
+ @if grep -v '^#' $(ams) $(xtests) \
+ | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
+ | grep -E '\)'; \
+ then \
+ echo "Suspicious 'rm' invocation." 1>&2; \
+ exit 1; \
+ else :; fi
+
+## Never use something like "for file in $(FILES)", this doesn't work
+## if FILES is empty or if it contains shell meta characters (e.g. $ is
+## commonly used in Java filenames).
+sc_no_for_variable_in_macro:
+ @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
+ echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
+ exit 1; \
+ else :; fi
+
+## Make sure all invocations of mkinstalldirs are correct.
+sc_mkinstalldirs:
+ @if grep -n 'mkinstalldirs' $(ams) \
+ | grep -F -v '$$(mkinstalldirs)' \
+ | grep -v '^\./Makefile.am:[0-9][0-9]*: *lib/mkinstalldirs \\$$'; \
+ then \
+ echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
+ exit 1; \
+ else :; fi
+
+## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
+sc_pre_normal_post_install_uninstall:
+ @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
+ grep -v ':##' | grep -v ': @\$$('; then \
+ echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
+ exit 1; \
+ else :; fi
+
+## We never want to use "undef", only "delete", but for $/.
+sc_perl_no_undef:
+ @if grep -n -w 'undef ' $(srcdir)/automake.in | \
+ grep -F -v 'undef $$/'; then \
+ echo "Found undef in automake.in; use delete instead" 1>&2; \
+ exit 1; \
+ fi
+
+## We never want split (/ /,...), only split (' ', ...).
+sc_perl_no_split_regex_space:
+ @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
+ echo "Found bad split in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Look for cd within backquotes
+sc_cd_in_backquotes:
+ @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
+ echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Look for cd to a relative directory (may be influenced by CDPATH).
+## Skip some known directories that are OK.
+sc_cd_relative_dir:
+ @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
+ grep -v 'echo.*cd ' | \
+ grep -v 'am__cd =' | \
+ grep -v '^[^#]*cd [./]' | \
+ grep -v '^[^#]*cd \$$(top_builddir)' | \
+ grep -v '^[^#]*cd "\$$\$$am__cwd' | \
+ grep -v '^[^#]*cd \$$(abs' | \
+ grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
+ echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Using @_ in a scalar context is most probably a programming error.
+sc_perl_at_uscore_in_scalar_context:
+ @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
+ echo "Using @_ in a scalar context in the lines above." 1>&2; \
+ exit 1; \
+ fi
+
+## Allow only few variables to be localized in Automake.
+sc_perl_local:
+ @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
+ grep '^[ \t]*local [^*]'; then \
+ echo "Please avoid 'local'." 1>&2; \
+ exit 1; \
+ fi
+
+## Don't let AMDEP_TRUE substitution appear in automake.in.
+sc_AMDEP_TRUE_in_automake_in:
+ @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
+ echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
+ exit 1; \
+ fi
+
+## Recursive make invocations should always pass $(AM_MAKEFLAGS)
+## to $(MAKE), for portability to non-GNU make.
+sc_tests_make_without_am_makeflags:
+ @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
+ | grep -v 'AM_MAKEFLAGS' \
+ | grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \
+ then \
+ echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
+ exit 1; \
+ fi
+
+## Look out for some obsolete variables.
+sc_tests_obsolete_variables:
+ @vars=" \
+ using_tap \
+ am_using_tap \
+ test_prefer_config_shell \
+ original_AUTOMAKE \
+ original_ACLOCAL \
+ parallel_tests \
+ am_parallel_tests \
+ "; \
+ seen=""; \
+ for v in $$vars; do \
+ if grep -E "\b$$v\b" $(xtests) $(xdefs); then \
+ seen="$$seen $$v"; \
+ fi; \
+ done; \
+ if test -n "$$seen"; then \
+ for v in $$seen; do \
+ case $$v in \
+ parallel_tests|am_parallel_tests) v2=am_serial_tests;; \
+ *) v2=am_$$v;; \
+ esac; \
+ echo "Variable '$$v' is obsolete, use '$$v2' instead." 1>&2; \
+ done; \
+ exit 1; \
+ else :; fi
+
+## Look out for obsolete requirements specified in the test cases.
+sc_obsolete_requirements_rules = sc_no_texi2dvi-o sc_no_makeinfo-html
+modern-requirement.texi2dvi-o = texi2dvi
+modern-requirement.makeinfo-html = makeinfo
+
+$(sc_obsolete_requirements_rules): sc_no_% :
+ @if grep -E 'required=.*\b$*\b' $(xtests); then \
+ echo "Requirement '$*' is obsolete and shouldn't" \
+ "be used anymore." >&2; \
+ echo "You should use '$(modern-requirement.$*)' instead." >&2; \
+ exit 1; \
+ fi
+
+## Tests should never call some programs directly, but only through the
+## corresponding variable (e.g., '$MAKE', not 'make'). This will allow
+## the programs to be overridden at configure time (for less brittleness)
+## or by the user at make time (to allow better testsuite coverage).
+sc_tests_plain_check_rules = \
+ sc_tests_plain_egrep \
+ sc_tests_plain_fgrep \
+ sc_tests_plain_make \
+ sc_tests_plain_perl \
+ sc_tests_plain_automake \
+ sc_tests_plain_aclocal \
+ sc_tests_plain_autoconf \
+ sc_tests_plain_autoupdate \
+ sc_tests_plain_autom4te \
+ sc_tests_plain_autoheader \
+ sc_tests_plain_autoreconf
+
+toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
+
+$(sc_tests_plain_check_rules): sc_tests_plain_% :
+ @# The leading ':' in the grep below is what is printed by the
+ @# preceding 'grep -v' after the file name.
+ @# It works here as a poor man's substitute for beginning-of-line
+ @# marker.
+ @if grep -v '^[ ]*#' $(xtests) \
+ | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[ ]*?$*\b'; \
+ then \
+ echo 'Do not run "$*" in the above tests.' \
+ 'Use "$$$(call toupper,$*)" instead.' 1>&2; \
+ exit 1; \
+ fi
+
+## Tests should only use END and EOF for here documents
+## (so that the next test is effective).
+sc_tests_here_document_format:
+ @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \
+ echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
+ exit 1; \
+ fi
+
+## Our test case should use the $(...) POSIX form for command substitution,
+## rather than the older `...` form.
+## The point of ignoring text on here-documents is that we want to exempt
+## Makefile.am rules, configure.ac code and helper shell script created and
+## used by out shell scripts, because Autoconf (as of version 2.69) does not
+## yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
+sc_tests_command_subst:
+ @found=false; \
+ scan () { \
+ sed -n -e '/^#/d' \
+ -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
+ -e 's/\\`/\\{backtick}/' \
+ -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
+ -e '/`/p' $$*; \
+ }; \
+ for file in $(xtests); do \
+ res=`scan $$file`; \
+ if test -n "$$res"; then \
+ echo "$$file:$$res"; \
+ found=true; \
+ fi; \
+ done; \
+ if $$found; then \
+ echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
+ exit 1; \
+ fi
+
+## Tests should no longer call 'Exit', just 'exit'. That's because we
+## now have in place a better workaround to ensure the exit status is
+## transported correctly across the exit trap.
+sc_tests_exit_not_Exit:
+ @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
+ echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
+ exit 1; \
+ fi
+
+## Guard against obsolescent uses of ./defs in tests. Now,
+## 'test-init.sh' should be used instead.
+sc_tests_no_source_defs:
+ @if grep -E '\. .*defs($$| )' $(xtests); then \
+ echo "Source 'test-init.sh', not './defs'." 1>&2; \
+ exit 1; \
+ fi
+
+## Use AUTOMAKE_fails when appropriate
+sc_tests_automake_fails:
+ @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
+ echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
+ exit 1; \
+ fi
+
+## Setting 'required' after sourcing './defs' is a bug.
+sc_tests_required_after_defs:
+ @for file in $(xtests); do \
+ if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
+ echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
+ exit 1; \
+ fi; \
+ done
+
+## Overriding a Makefile macro on the command line is not portable when
+## recursive targets are used. Better use an envvar. SHELL is an
+## exception, POSIX says it can't come from the environment. V, DESTDIR,
+## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
+## as package authors are urged not to initialize them anywhere.
+## Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
+## ok to override it from the command line.
+sc_tests_overriding_macros_on_cmdline:
+ @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
+ echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
+ echo ' in the above lines, it is more portable.' 1>&2; \
+ exit 1; \
+ fi
+# The first s/// tries to account for usages like "$MAKE || st=$?".
+# 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
+# their definitions, hence the more complex last three substitutions below.
+# Also, the 'make-dryrun.sh' is whitelisted, since there we need to
+# override variables from the command line in order to cover the expected
+# code paths.
+ @tests=`for t in $(xtests); do \
+ case $$t in */make-dryrun.sh);; *) echo $$t;; esac; \
+ done`; \
+ if sed -e 's/ || .*//' -e 's/ && .*//' \
+ -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
+ -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
+ -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
+ -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
+ -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
+ -e "s/ exp='[^']*'/ /" \
+ -e 's/ exp="[^"]*"/ /' \
+ -e 's/ exp=[^ ]/ /' \
+ $$tests | grep '\$$MAKE .*='; then \
+ echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
+ echo 'it is more portable.' 1>&2; \
+ exit 1; \
+ fi
+ @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
+ echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
+ echo 'the above lines.' 1>&2; \
+ exit 1; \
+ fi
+
+## Prefer use of our 'is_newest' auxiliary script over the more hacky
+## idiom "test $(ls -1t new old | sed 1q) = new", which is both more
+## cumbersome and more fragile.
+sc_tests_ls_t:
+ @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
+ $(xtests); then \
+ echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
+ exit 1; \
+ fi
+
+## Test scripts must be executable.
+sc_tests_executable:
+ @st=0; \
+ for f in $(xtests); do \
+ case $$f in \
+ t/ax/*|./t/ax/*|$(srcdir)/t/ax/*);; \
+ *) test -x $$f || { echo "$$f: not executable" >&2; st=1; }; \
+ esac; \
+ done; \
+ test $$st -eq 0 || echo '$@: some test scripts are not executable' >&2; \
+ exit $$st;
+
+
+## Never use 'sleep 1' to create files with different timestamps.
+## Use '$sleep' instead. Some filesystems (e.g., Windows) have only
+## a 2sec resolution.
+sc_tests_plain_sleep:
+ @if grep -E '\bsleep +[12345]\b' $(xtests); then \
+ echo 'Do not use "sleep x" in the above tests. Use "$$sleep" instead.' 1>&2; \
+ exit 1; \
+ fi
+
+## fgrep and egrep are not required by POSIX.
+sc_m4_am_plain_egrep_fgrep:
+ @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
+ echo 'Do not use egrep or fgrep in the above files,' \
+ 'they are not portable.' 1>&2; \
+ exit 1; \
+ fi
+
+## Prefer 'configure.ac' over the obsolescent 'configure.in' as the name
+## for configure input files in our testsuite. The latter has been
+## deprecated for several years (at least since autoconf 2.50).
+sc_tests_no_configure_in:
+ @if grep -E '\bconfigure\\*\.in\b' $(xtests) $(xdefs) \
+ | grep -Ev '/backcompat.*\.(sh|tap):' \
+ | grep -Ev '/autodist-configure-no-subdir\.sh:' \
+ | grep -Ev '/(configure|help)\.sh:' \
+ | grep .; \
+ then \
+ echo "Use 'configure.ac', not 'configure.in', as the name" >&2; \
+ echo "for configure input files in the test cases above." >&2; \
+ exit 1; \
+ fi
+
+## Rule to ensure that the testsuite has been run before. We don't depend
+## on 'check' here, because that would be very wasteful in the common case.
+## We could run "make check RECHECK_LOGS=" and avoid toplevel races with
+## AM_RECURSIVE_TARGETS. Suggest keeping test directories around for
+## greppability of the Makefile.in files.
+sc_ensure_testsuite_has_run:
+ @if test ! -f '$(TEST_SUITE_LOG)'; then \
+ echo 'Run "env keep_testdirs=yes make check" before' \
+ 'running "make maintainer-check"' >&2; \
+ exit 1; \
+ fi
+.PHONY: sc_ensure_testsuite_has_run
+
+## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
+## This test actually depends on the testsuite having been run before.
+sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
+ @if grep -E '(warning|error):.*(warning|error):' t/*.log; then \
+ echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
+ exit 1; \
+ fi
+
+## Ensure variables are listed before rules in Makefile.in files we generate.
+sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
+ @st=0; \
+ for file in `find t -name Makefile.in -print`; do \
+ latevars=`sed -n \
+ -e :x -e 's/#.*//' \
+ -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
+ -e '# Literal TAB.' \
+ -e '1,/^ /d' \
+ -e '# Allow @ so we match conditionals.' \
+ -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
+ if test -n "$$latevars"; then \
+ echo "Variables are expanded too late in $$file:" >&2; \
+ echo "$$latevars" | sed 's/^/ /' >&2; \
+ st=1; \
+ fi; \
+ done; \
+ test $$st -eq 0 || { \
+ echo 'Ensure variables are expanded before rules' >&2; \
+ exit 1; \
+ }
+
+## Using ':' as a PATH separator is not portable.
+sc_tests_PATH_SEPARATOR:
+ @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
+ echo "Use '\$$PATH_SEPARATOR', not ':', in PATH definitions" \
+ "above." 1>&2; \
+ exit 1; \
+ fi
+
+## Try to make sure all @...@ substitutions are covered by our
+## substitution rule.
+sc_perl_at_substs:
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
+ echo "Unresolved @...@ substitution in aclocal" 1>&2; \
+ exit 1; \
+ fi
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
+ echo "Unresolved @...@ substitution in automake" 1>&2; \
+ exit 1; \
+ fi
+
+sc_unquoted_DESTDIR:
+ @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
+ echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
+ exit 1; \
+ fi
+
+sc_tabs_in_texi:
+ @if grep ' ' $(srcdir)/doc/automake.texi; then \
+ echo 'Do not use tabs in the manual.' 1>&2; \
+ exit 1; \
+ fi
+
+sc_at_in_texi:
+ @if grep -E '([^@]|^)@([ ][^@]|$$)' $(srcdir)/doc/automake.texi; \
+ then \
+ echo 'Unescaped @.' 1>&2; \
+ exit 1; \
+ fi
+
+$(syntax_check_rules): automake aclocal
+maintainer-check: $(syntax_check_rules)
+.PHONY: maintainer-check $(syntax_check_rules)
+
+## Check that the list of tests given in the Makefile is equal to the
+## list of all test scripts in the Automake testsuite.
+maintainer-check: maintainer-check-list-of-tests
--
cgit v1.2.1
From 23f19aede924dee8ed0150df5f9efa3faf2ad145 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 10 Jan 2013 23:44:33 +0100
Subject: typofix: in comments in GNUmakefile
Signed-off-by: Stefano Lattarini
---
GNUmakefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/GNUmakefile b/GNUmakefile
index c6f460cd4..52c200295 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -50,7 +50,7 @@ export BOOTSTRAP_SHELL
# kick in, because the tree might be in an inconsistent state (e.g.,
# we have just switched from 'maint' to 'master', and have the built
# 'automake' script left from 'maint', but the files 'lib/am/*.am'
-# are from 'master': if 'automake' gets run and used those files --
+# are from 'master': if 'automake' gets run and uses those files --
# boom!).
ifdef config-status # Bootstrap from an already-configured tree.
--
cgit v1.2.1
From 10790d08f071a91160bbaeabab7fd8a8d23e5a55 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 11 Jan 2013 17:38:58 +0100
Subject: sync: update files from upstream with "make fetch"
* lib/INSTALL: Update.
* lib/config.guess: Likewise.
* lib/config.sub: Likewise.
* lib/gendocs_template: Likewise.
* lib/gitlog-to-changelog: Likewise.
* lib/gnupload: Likewise.
* lib/texinfo.tex: Likewise.
* lib/update-copyright: Likewise.
Signed-off-by: Stefano Lattarini
---
lib/INSTALL | 2 +-
lib/config.guess | 4 ++--
lib/config.sub | 9 ++++-----
lib/gendocs_template | 2 +-
lib/gitlog-to-changelog | 2 +-
lib/gnupload | 2 +-
lib/texinfo.tex | 7 ++++---
lib/update-copyright | 6 +++---
8 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/lib/INSTALL b/lib/INSTALL
index 6e90e07d2..007e9396d 100644
--- a/lib/INSTALL
+++ b/lib/INSTALL
@@ -1,7 +1,7 @@
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
diff --git a/lib/config.guess b/lib/config.guess
index 1804e9fcd..0aee6044d 100755
--- a/lib/config.guess
+++ b/lib/config.guess
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
-timestamp='2012-12-29'
+timestamp='2012-12-30'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ timestamp='2012-12-29'
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
-# Originally written by Per Bothner.
+# Originally written by Per Bothner.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
diff --git a/lib/config.sub b/lib/config.sub
index 802a224de..707e9e2ef 100755
--- a/lib/config.sub
+++ b/lib/config.sub
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013 Free Software Foundation, Inc.
-timestamp='2012-12-29'
+timestamp='2013-01-11'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -290,6 +290,7 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
@@ -407,6 +408,7 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
@@ -1354,7 +1356,7 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
+ | -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1500,9 +1502,6 @@ case $os in
-aros*)
os=-aros
;;
- -kaos*)
- os=-kaos
- ;;
-zvmoe)
os=-zvmoe
;;
diff --git a/lib/gendocs_template b/lib/gendocs_template
index a62ad6167..63fbe539a 100644
--- a/lib/gendocs_template
+++ b/lib/gendocs_template
@@ -75,7 +75,7 @@ the FSF.
Please send broken links and other corrections or suggestions to
<%%EMAIL%%>.
-Copyright © 2012 Free Software Foundation, Inc.
+Copyright © 2013 Free Software Foundation, Inc.
Verbatim copying and distribution of this entire article are
permitted worldwide, without royalty, in any medium, provided this
diff --git a/lib/gitlog-to-changelog b/lib/gitlog-to-changelog
index 5184edc7d..e02d34c21 100755
--- a/lib/gitlog-to-changelog
+++ b/lib/gitlog-to-changelog
@@ -9,7 +9,7 @@ my $VERSION = '2012-07-29 06:11'; # UTC
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
-# Copyright (C) 2008-2012 Free Software Foundation, Inc.
+# Copyright (C) 2008-2013 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
diff --git a/lib/gnupload b/lib/gnupload
index f6b999b73..e329e8396 100755
--- a/lib/gnupload
+++ b/lib/gnupload
@@ -3,7 +3,7 @@
scriptversion=2012-12-11.16; # UTC
-# Copyright (C) 2004-2012 Free Software Foundation, Inc.
+# Copyright (C) 2004-2013 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
diff --git a/lib/texinfo.tex b/lib/texinfo.tex
index b5f314157..d64f45bbe 100644
--- a/lib/texinfo.tex
+++ b/lib/texinfo.tex
@@ -3,11 +3,11 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2012-11-08.11}
+\def\texinfoversion{2013-01-01.15}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
@@ -24,7 +24,8 @@
%
% As a special exception, when this file is read by TeX when processing
% a Texinfo source document, you may use the result without
-% restriction. (This has been our intent since Texinfo was invented.)
+% restriction. This Exception is an additional permission under section 7
+% of the GNU General Public License, version 3 ("GPLv3").
%
% Please try the latest version of texinfo.tex before submitting bug
% reports; you can get the latest version from:
diff --git a/lib/update-copyright b/lib/update-copyright
index 082b749d6..c72d0e67d 100755
--- a/lib/update-copyright
+++ b/lib/update-copyright
@@ -3,9 +3,9 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}'
if 0;
# Update an FSF copyright year list to include the current year.
-my $VERSION = '2012-02-05.21:39'; # UTC
+my $VERSION = '2013-01-03.09:41'; # UTC
-# Copyright (C) 2009-2012 Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 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
@@ -192,7 +192,7 @@ if (defined $stmt_re)
if ($final_year != $this_year)
{
# Update the year.
- $stmt =~ s/$final_year_orig/$final_year, $this_year/;
+ $stmt =~ s/\b$final_year_orig\b/$final_year, $this_year/;
}
if ($final_year != $this_year || $ENV{'UPDATE_COPYRIGHT_FORCE'})
{
--
cgit v1.2.1
From b670a66a6ac1ee8ef25dc48a26e477812c2dbacf Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 11 Jan 2013 18:26:03 +0100
Subject: tests: can fake a compiler not grasping "-c -o" -- globally in all
tests
The ability to easily do so will be quite important in upcoming changes
about C compilation handling and semantics of the 'subdir-objects'
option. Refer to the extensive discussion about automake bug#13378 for
more details: .
See also commit 'v1.13.1-34-g744cd57' of 2013-01-08, "coverage: compile
rules used "-c -o" also with losing compilers".
* t/ax/cc-no-c-o.in: New, a "C compiler" that chokes when the '-c' and
'-o' options are passed together to it on the command line.
* Makefile.am (t/ax/cc-no-c-o): Generate this script from it.
(noinst_SCRIPTS, CLEANFILES): Add it.
(EXTRA_DIST): Add 't/ax/cc-no-c-o.in'.
(check-cc-no-c-o): New target, runs the whole testsuite with 'cc-no-c-o'
as the C compiler (bot GNU and non-GNU).
* .gitignore: Update.
* t/ccnoco.sh: Use the new script instead of duplicating it.
* t/ccnoco3.sh: Likewise.
* t/ccnoco4.sh: Likewise.
* t/self-check-cc-no-c-o.sh: New testsuite self-check.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini
---
.gitignore | 1 +
Makefile.am | 22 ++++++++++++++++++++++
t/ax/cc-no-c-o.in | 29 +++++++++++++++++++++++++++++
t/ccnoco.sh | 21 ++-------------------
t/ccnoco3.sh | 21 ++-------------------
t/ccnoco4.sh | 23 +++--------------------
t/list-of-tests.mk | 1 +
t/self-check-cc-no-c-o.sh | 35 +++++++++++++++++++++++++++++++++++
8 files changed, 95 insertions(+), 58 deletions(-)
create mode 100644 t/ax/cc-no-c-o.in
create mode 100755 t/self-check-cc-no-c-o.sh
diff --git a/.gitignore b/.gitignore
index a32310e70..dd55add5f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,6 +42,7 @@
/t/wrap/automake-1.*
/t/ax/test-defs.sh
/t/ax/shell-no-trail-bslash
+/t/ax/cc-no-c-o
/t/testsuite-part.am
/t/*-w.tap
/t/*-w.sh
diff --git a/Makefile.am b/Makefile.am
index ab98df708..64e9d4869 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -446,6 +446,17 @@ EXTRA_DIST += t/ax/shell-no-trail-bslash.in
CLEANFILES += t/ax/shell-no-trail-bslash
noinst_SCRIPTS += t/ax/shell-no-trail-bslash
+t/ax/cc-no-c-o: t/ax/cc-no-c-o.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_GEN)in=t/ax/cc-no-c-o.in \
+ && $(MKDIR_P) t/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
+ $(generated_file_finalize)
+EXTRA_DIST += t/ax/cc-no-c-o.in
+CLEANFILES += t/ax/cc-no-c-o
+noinst_SCRIPTS += t/ax/cc-no-c-o
+
runtest: t/ax/runtest.in Makefile
$(AM_V_at)rm -f $@ $@-t
$(AM_V_GEN)in=t/ax/runtest.in \
@@ -518,6 +529,17 @@ check-no-trailing-backslash-in-recipes:
CONFIG_SHELL='$(abs_top_builddir)/t/ax/shell-no-trail-bslash'
.PHONY: check-no-trailing-backslash-in-recipes
+# Some compilers out there (hello, MSVC) still choke on "-c -o" being
+# passed together on the command line. Run the whole testsuite faking
+# the presence of such a compiler, to help catch regressions that would
+# otherwise only present themselves later "in the wild". See also the
+# long discussion about automake bug#13378.
+check-cc-no-c-o:
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ CC='$(abs_top_builddir)/t/ax/cc-no-c-o' \
+ GNU_CC='$(abs_top_builddir)/t/ax/cc-no-c-o'
+.PHONY: check-cc-no-c-o
+
## Checking the list of tests.
test_subdirs = t t/pm contrib/t
include $(srcdir)/t/CheckListOfTests.am
diff --git a/t/ax/cc-no-c-o.in b/t/ax/cc-no-c-o.in
new file mode 100644
index 000000000..c18f9b975
--- /dev/null
+++ b/t/ax/cc-no-c-o.in
@@ -0,0 +1,29 @@
+#! @AM_TEST_RUNNER_SHELL@
+# Copyright (C) 2012-2013 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 2, 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 .
+
+# A "C compiler" that chokes when the '-c' and '-o' options are passed
+# together to it on the command line. See also automake bug#13378.
+
+am_CC=${AM_TESTSUITE_GNU_CC-'@GNU_CC@'}
+
+case " $* " in
+ *\ -c*\ -o* | *\ -o*\ -c*)
+ echo "$0: both '-o' and '-c' seen on the command line" >&2
+ exit 2
+ ;;
+esac
+
+exec $am_CC "$@"
diff --git a/t/ccnoco.sh b/t/ccnoco.sh
index cffabd7d1..c6af79775 100755
--- a/t/ccnoco.sh
+++ b/t/ccnoco.sh
@@ -17,7 +17,7 @@
# Test to make sure we can compile when the compiler doesn't
# understand '-c -o'.
-required=gcc
+required=gcc # For cc-no-c-o.
. test-init.sh
cat >> configure.ac << 'END'
@@ -44,25 +44,8 @@ int main ()
}
END
-cat > Mycomp << END
-#!/bin/sh
-
-case " \$* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
- exit 1
- ;;
-esac
-
-# Use '$CC', not 'gcc', to honour the compiler chosen
-# by the testsuite setup.
-exec $CC "\$@"
-END
-
-chmod +x Mycomp
-
# Make sure the compiler doesn't understand '-c -o'
-CC=$(pwd)/Mycomp
-export CC
+CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
$AUTOCONF
diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh
index 7ad5b3bc5..b8dd77c2b 100755
--- a/t/ccnoco3.sh
+++ b/t/ccnoco3.sh
@@ -16,7 +16,7 @@
# Test to make sure 'compile' doesn't call 'mv SRC SRC'.
-required=gcc
+required=gcc # For cc-no-c-o.
. test-init.sh
cat >> configure.ac << 'END'
@@ -43,25 +43,8 @@ int main ()
}
END
-cat > Mycomp << END
-#!/bin/sh
-
-case " \$* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
- exit 1
- ;;
-esac
-
-# Use '$CC', not 'gcc', to honour the compiler chosen
-# by the testsuite setup.
-exec $CC "\$@"
-END
-
-chmod +x Mycomp
-
# Make sure the compiler doesn't understand '-c -o'
-CC=$(pwd)/Mycomp
-export CC
+CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
$AUTOCONF
diff --git a/t/ccnoco4.sh b/t/ccnoco4.sh
index 73dce9f68..b317fb5b8 100755
--- a/t/ccnoco4.sh
+++ b/t/ccnoco4.sh
@@ -22,7 +22,7 @@
#
#
-required=gcc
+required=gcc # For cc-no-c-o.
. test-init.sh
# We deliberately do not call AM_PROG_CC_C_O here.
@@ -40,25 +40,8 @@ END
echo 'int main (void) { return 0; }' > foo.c
-cat > Mycomp << END
-#!/bin/sh
-
-case " \$* " in
- *\ -c*\ -o* | *\ -o*\ -c*)
- exit 1
- ;;
-esac
-
-# Use '$CC', not 'gcc', to honour the compiler chosen
-# by the testsuite setup.
-exec $CC "\$@"
-END
-
-chmod +x Mycomp
-
-# Make sure the compiler doesn't understand '-c -o'.
-CC=$(pwd)/Mycomp
-export CC
+# Make sure the compiler doesn't understand '-c -o'
+CC=$am_testaux_builddir/cc-no-c-o; export CC
$ACLOCAL
$AUTOCONF
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 63e098d25..2052bd8ee 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -954,6 +954,7 @@ t/remake-timing-bug-pr8365.sh \
t/reqd2.sh \
t/repeated-options.sh \
t/rulepat.sh \
+t/self-check-cc-no-c-o.sh \
t/self-check-configure-help.sh \
t/self-check-dir.tap \
t/self-check-exit.tap \
diff --git a/t/self-check-cc-no-c-o.sh b/t/self-check-cc-no-c-o.sh
new file mode 100755
index 000000000..69809b77f
--- /dev/null
+++ b/t/self-check-cc-no-c-o.sh
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 2012-2013 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 2, 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 .
+
+# Check that our fake "C compiler" that doesn't grasp the '-c' and
+# '-o' command-line options passed together, used to enhance testsuite
+# coverage.
+
+required=gcc # Our fake compiler uses gcc.
+am_create_testdir=empty
+. test-init.sh
+
+CC=$am_testaux_builddir/cc-no-c-o; export CC
+
+echo 'int main (void) { return 0; }' > foo.c
+$CC -c foo.c
+test -f foo.o || test -f foo.obj
+$CC -c -o bar.o foo.c 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep "both '-o' and '-c' seen on the command line" stderr
+test ! -e bar.o && test ! -e bar.obj
+
+:
--
cgit v1.2.1
From 1ab8fb6d0e8497c0b86a1453b901dda29ba9d9f6 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 11 Jan 2013 18:57:28 +0100
Subject: HACKING: suggest more checks before releasing
In particular, "make check-no-trailing-backslash-in-recipes",
"make check-cc-no-c-o" and "make maintainer-check" should also
be run.
Signed-off-by: Stefano Lattarini
---
HACKING | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/HACKING b/HACKING
index 99b4a994e..8f51ff425 100644
--- a/HACKING
+++ b/HACKING
@@ -248,9 +248,14 @@
The repository will always have its own "odd" number so we can easily
distinguish net and repo versions.)
-* Run this:
-
- make bootstrap && make check && make distcheck
+* Run these commands, in this order:
+
+ make bootstrap
+ make check keep_testdirs=yes
+ make maintainer-check
+ make distcheck
+ make check-no-trailing-backslash-in-recipes
+ make check-cc-no-c-o
It is also advised to run "git clean -fdx" before invoking the
bootstrap, to ensure a really clean rebuild. However, it must
--
cgit v1.2.1
From 34001a987a6defdb70f6f3c17cce9d9c665fe6e8 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 9 Jan 2013 23:16:53 +0100
Subject: compile: use 'compile' script when "-c -o" is used with losing
compilers
Do so seen when only source files in the "current" directory are present.
This commit is part of a series of related changes addressing automake
bug#13378 (see also the plan 'PLANS/subdir-objects.txt').
Before this change, Automake-generated C compilation rules mistakenly
passed the "-c -o" options combination unconditionally (even to losing
compiler) when the 'subdir-objects' was used but sources were only
present in the top-level directory. Issue spotted by Nick Bowler:
We fix this by having Automake redefine AC_PROG_CC to take over the role
of AM_PROG_CC_C_O and to require the 'compile' script unconditionally
(albeit that will continue to be invoked only when inferior compilers
are detected).
Among other things, this means AM_PROG_CC_C_O explicitly is no longer
required; that macro is still supported for backward-compatibility, but
calling it is basically a no-op now.
This change has some pros and some cons (obviously, we believe the former
outweighs the latter). Here are the most relevant ones:
+ Pros 1:
Some logic in the Automake script has been simplified.
+ Pros 2:
That simplification has automatically fixed an actual bug (see
Nick's mails referenced above; admittedly, that was present only in
corner-case situations, but still); the test 't/ccnoco4.sh', which
demonstrated the bug and has been failing so far, now passes.
+ Pros 3:
Things works more "automagically" now (no need to manually add the
AM_PROG_CC_C_O macro to configure.ac anymore).
* Cons 1:
The 'compile' script will be required in all projects using C
compilation; this will only be a problem for packages not using
'--add-missing'. However, such packages are definitely more rare
than the ones using '--add-missing', and adjusting them will be
trivial -- just copy the compile script over from the new Automake
installation.
* Cons 2:
The copy & paste of autoconf internals hack this change has introduced
in our "rewrite" of AC_PROG_CC is really an egregious abomination. It
can only be justified with the fact that we expect future versions of
autoconf to implement the semantics we need directly in AC_PROG_CC, so
that we'll be able to leverage that (since Automake 1.14 will require
the latest Autoconf version released).
Now, the detailed list of file-by-file changes ...
* automake.in ($seen_cc_c_o): Remove this global variable.
(scan_autoconf_traces): Don't set it, and do not trace the
'AM_PROG_CC_C_O' m4 macro.
(lang_c_rewrite): Remove, no longer needed.
* doc/automake.texi: Adjust expected "autoreconf --install" output
in the amhello example. Remove statements about the need for the
AM_PROG_CC_C_O macro. Report it is obsolete now.
* m4/init.m4: Re-write AC_PROG_CC to append checks about whether the
C compiler supports "-c -o" together. These checks have basically
been ripped out (with adaptations) from the 'AC_PROG_CC_C_O' macro
of Autoconf and ...
* m4/minuso.m4 (AM_PROG_CC_C_O): ... this macro of ours, which has
thus basically become a no-op.
* t/ax/am-test-lib.sh (am_setup_testdir): Also copy the 'compile'
script in the test directory; if we don't do so, every test using
AC_PROG_CC should call automake with the "--add-missing" option, or
copy the 'compile' script itself.
* t/cond11.sh: No need to create a dummy 'compile' script: that is
already brought in by 'am_setup_testdir()', that is automatically
invoked when 'test-lib.sh' is sourced.
* t/add-missing.tap: Adjust: we expect the 'compile' script to be
required by a mere AC_PROG_CC call now.
* t/dist-auxdir-many-subdirs.sh: Likewise.
* t/specflg6.sh: Likewise.
* t/subobj4.sh: Likewise.
* t/cxx-lt-demo.sh: Likewise, and update comments to match.
* t/distcom2.sh: Enhance a little.
* t/dollarvar2.sh: Adjust.
* t/extra-portability.sh: Likewise.
* t/libobj19.sh: Likewise.
* t/per-target-flags.sh: Likewise.
* t/repeated-options.sh: Likewise.
* t/subobj.sh: Likewise, and enhance a little.
* t/ccnoco2.sh: Remove as obsolete.
* t/list-of-tests.mk (handwritten_TESTS): Adjust.
(XFAIL_TESTS): Remove 't/ccnoco4.sh'.
* NEWS: Update.
Signed-off-by: Stefano Lattarini
---
.gitignore | 1 +
NEWS | 26 ++++++++++++++++++++
automake.in | 47 ------------------------------------
doc/automake.texi | 22 +++++++++--------
m4/init.m4 | 45 +++++++++++++++++++++++++++++++++++
m4/minuso.m4 | 27 ++++++++-------------
t/add-missing.tap | 9 ++++---
t/ax/am-test-lib.sh | 2 +-
t/ccnoco2.sh | 55 -------------------------------------------
t/cond11.sh | 1 -
t/cxx-lt-demo.sh | 6 +++--
t/dist-auxdir-many-subdirs.sh | 1 +
t/distcom2.sh | 2 ++
t/dollarvar2.sh | 11 +++------
t/extra-portability.sh | 13 +++++-----
t/libobj19.sh | 1 -
t/list-of-tests.mk | 2 --
t/per-target-flags.sh | 7 ------
t/repeated-options.sh | 2 +-
t/specflg6.sh | 2 --
t/subobj.sh | 5 +++-
t/subobj4.sh | 1 -
22 files changed, 122 insertions(+), 166 deletions(-)
delete mode 100755 t/ccnoco2.sh
diff --git a/.gitignore b/.gitignore
index dd55add5f..4b509d70e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@
/doc/amhello/config.h.in~
/doc/amhello/configure
/doc/amhello/depcomp
+/doc/amhello/compile
/doc/amhello/install-sh
/doc/amhello/missing
/doc/web-manual
diff --git a/NEWS b/NEWS
index 02a34df75..09bfc1ed6 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,32 @@ New in 1.13.2:
should take precedence over the same-named automake-provided macro
(defined in '/usr/local/share/aclocal-1.14/vala.m4').
+* C compilation, and the AC_PROG_CC and AM_PROG_CC_C_O macros:
+
+ - The 'compile' script is now unconditionally required for all
+ packages that perform C compilation (note that if you are using
+ the '--add-missing' option, automake will fetch that script for
+ you, so you shouldn't need any explicit adjustment).
+ This new behaviour is needed to avoid obscure errors when the
+ 'subdir-objects' option is used, and the compiler is an inferior
+ one that doesn't grasp the combined use of both the "-c -o"
+ options; see discussion about automake bug#13378 for more details:
+
+
+
+ - Automake will automatically enhance the AC_PROG_CC autoconf macro
+ to make it check, at configure time, that the C compiler supports
+ the combined use of both the "-c -o" options. This "rewrite" of
+ AC_PROG_CC is only meant to be temporary, since future Autoconf
+ versions should provide all the features Automake needs.
+
+ - The AM_PROG_CC_C_O is no longer useful, and its use is a no-op
+ now. Future Automake versions might start warning that this
+ macro is obsolete. For better backward-compatibility, this macro
+ still sets a proper 'ac_cv_prog_cc_*_c_o' cache variable, and
+ define the 'NO_MINUS_C_MINUS_O' C preprocessor symbol, but you
+ should really stop relying on that.
+
* Obsolescent features:
- Use of suffix-less info files (that can be specified through the
diff --git a/automake.in b/automake.in
index e8ba73f94..990b60d60 100644
--- a/automake.in
+++ b/automake.in
@@ -387,9 +387,6 @@ my $package_version_location;
# TRUE if we've seen AM_PROG_AR
my $seen_ar = 0;
-# TRUE if we've seen AM_PROG_CC_C_O
-my $seen_cc_c_o = 0;
-
# Location of AC_REQUIRE_AUX_FILE calls, indexed by their argument.
my %required_aux_file = ();
@@ -5179,7 +5176,6 @@ sub scan_autoconf_traces ($)
AM_INIT_AUTOMAKE => 0,
AM_MAINTAINER_MODE => 0,
AM_PROG_AR => 0,
- AM_PROG_CC_C_O => 0,
_AM_SUBST_NOTMAKE => 1,
_AM_COND_IF => 1,
_AM_COND_ELSE => 1,
@@ -5383,10 +5379,6 @@ EOF
{
$seen_ar = $where;
}
- elsif ($macro eq 'AM_PROG_CC_C_O')
- {
- $seen_cc_c_o = $where;
- }
elsif ($macro eq '_AM_COND_IF')
{
cond_stack_if ('', $args[1], $where);
@@ -5607,45 +5599,6 @@ sub lang_sub_obj
return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
}
-# Rewrite a single C source file.
-sub lang_c_rewrite
-{
- my ($directory, $base, $ext, $obj, $have_per_exec_flags, $var) = @_;
-
- my $r = LANG_PROCESS;
- if (option 'subdir-objects')
- {
- $r = LANG_SUBDIR;
- if ($directory && $directory ne '.')
- {
- $base = $directory . '/' . $base;
-
- # libtool is always able to put the object at the proper place,
- # so we do not have to require AM_PROG_CC_C_O when building .lo files.
- msg_var ('portability', $var,
- "compiling '$base.c' in subdir requires "
- . "'AM_PROG_CC_C_O' in '$configure_ac'",
- uniq_scope => US_GLOBAL,
- uniq_part => 'AM_PROG_CC_C_O subdir')
- unless $seen_cc_c_o || $obj eq '.lo';
- }
- }
-
- if (! $seen_cc_c_o
- && $have_per_exec_flags
- && ! option 'subdir-objects'
- && $obj ne '.lo')
- {
- msg_var ('portability',
- $var, "compiling '$base.c' with per-target flags requires "
- . "'AM_PROG_CC_C_O' in '$configure_ac'",
- uniq_scope => US_GLOBAL,
- uniq_part => 'AM_PROG_CC_C_O per-target')
- }
-
- return $r;
-}
-
# Rewrite a single header file.
sub lang_header_rewrite
{
diff --git a/doc/automake.texi b/doc/automake.texi
index 8ace5e5e0..a333a1c33 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -1496,6 +1496,7 @@ command as follows:
~/amhello % @kbd{autoreconf --install}
configure.ac: installing './install-sh'
configure.ac: installing './missing'
+configure.ac: installing './compile'
src/Makefile.am: installing './depcomp'
@end example
@@ -3994,10 +3995,9 @@ choose the assembler for you (by default the C compiler) and set
@item AM_PROG_CC_C_O
@acindex AM_PROG_CC_C_O
@acindex AC_PROG_CC_C_O
-This is like @code{AC_PROG_CC_C_O}, but it generates its results in
-the manner required by Automake. You must use this instead of
-@code{AC_PROG_CC_C_O} when you need this functionality, that is, when
-using per-target flags or subdir-objects with C sources.
+This is an @emph{obsolete wrapper} around @code{AC_PROG_CC_C_O}.
+New code needs not use this macro. It might be deprecated and
+@emph{retired in future Automake versions}.
@item AM_PROG_LEX
@acindex AM_PROG_LEX
@@ -4068,6 +4068,13 @@ Invocation, , Using @command{autoupdate} to Modernize
@table @code
+@item AM_PROG_CC_C_O
+@acindex AM_PROG_CC_C_O
+@acindex AC_PROG_CC_C_O
+This is an @emph{obsolete wrapper} around @code{AC_PROG_CC_C_O}. New
+code needs not to use this macro. It will be deprecated, and then
+removed, in future Automake versions.
+
@item AM_PROG_MKDIR_P
@acindex AM_PROG_MKDIR_P
@cindex @code{mkdir -p}, macro check
@@ -5810,9 +5817,7 @@ different name for the intermediate object files. Ordinarily a file
like @file{sample.c} will be compiled to produce @file{sample.o}.
However, if the program's @code{_CFLAGS} variable is set, then the
object file will be named, for instance, @file{maude-sample.o}. (See
-also @ref{Renamed Objects}.) The use of per-target compilation flags
-with C sources requires that the macro @code{AM_PROG_CC_C_O} be called
-from @file{configure.ac}.
+also @ref{Renamed Objects}).
In compilations with per-target flags, the ordinary @samp{AM_} form of
the flags variable is @emph{not} automatically included in the
@@ -10245,9 +10250,6 @@ the source file. For instance, if the source file is
@file{subdir/file.cxx}, then the output file would be
@file{subdir/file.o}.
-In order to use this option with C sources, you should add
-@code{AM_PROG_CC_C_O} to @file{configure.ac}.
-
@anchor{tar-formats}
@item @option{tar-v7}
@itemx @option{tar-ustar}
diff --git a/m4/init.m4 b/m4/init.m4
index 44b24819a..c5af65cce 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -125,6 +125,51 @@ dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+dnl We have to redefine AC_PROG_CC to allow our compile rules to use
+dnl "-c -o" together also with losing compilers.
+dnl FIXME: Add references to the original discussion and bug report.
+dnl FIXME: Shameless copy & paste from Autoconf internals, since trying to
+dnl play smart among tangles of AC_REQUIRE, m4_defn, m4_provide and
+dnl other tricks was proving too difficult, and in the end, likely
+dnl more brittle too. And this should anyway be just a temporary
+dnl band-aid, until Autoconf provides the semantics and/or hooks we
+dnl need (hint hint, nudge nudge) ...
+AC_DEFUN([AC_PROG_CC],
+m4_defn([AC_PROG_CC])
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+dnl FIXME The following abomination is expected to disappear in
+dnl Automake 1.14.
+AC_MSG_CHECKING([whether $CC understands -c and -o together])
+set dummy $CC; am__cc=`AS_ECHO(["$[2]"]) | \
+ sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
+AC_CACHE_VAL([am_cv_prog_cc_${am__cc}_c_o],
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
+rm -f conftest2.*
+if _AC_DO_VAR(ac_try) && test -f conftest2.$ac_objext
+then
+ eval am_cv_prog_cc_${am__cc}_c_o=yes
+else
+ eval am_cv_prog_cc_${am__cc}_c_o=no
+fi
+rm -f core conftest*
+])dnl
+if eval test \"\$am_cv_prog_cc_${am__cc}_c_o\" = yes; then
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+ # Losing compiler, so wrap it with the 'compile' script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
diff --git a/m4/minuso.m4 b/m4/minuso.m4
index 984427cfc..17fa8c92a 100644
--- a/m4/minuso.m4
+++ b/m4/minuso.m4
@@ -7,26 +7,19 @@
# AM_PROG_CC_C_O
# --------------
-# Like AC_PROG_CC_C_O, but changed for automake.
+# Basically a no-op now, completely superseded by the AC_PROG_CC
+# adjusted by Automake. Kept for backward-compatibility.
AC_DEFUN([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC_C_O])dnl
-AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
- # Losing compiler, so override with the script.
- # FIXME: It is wrong to rewrite CC.
- # But if we don't then we get into trouble of one sort or another.
- # A longer-term fix would be to have automake use am__CC in this case,
- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
- CC="$am_aux_dir/compile $CC"
-fi
+[AC_REQUIRE([AC_PROG_CC])dnl
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+# For better backward-compatibility. Users are advised to stop
+# relying on this cache variable and C preprocessor symbol ASAP.
+eval ac_cv_prog_cc_${am__cc}_c_o=\$am_cv_prog_cc_${am__cc}_c_o
+if eval test \"\$ac_cv_prog_cc_${am__cc}_c_o\" != yes; then
+ AC_DEFINE([NO_MINUS_C_MINUS_O], [1],
+ [Define to 1 if your C compiler doesn't accept -c and -o together.])
+fi
])
diff --git a/t/add-missing.tap b/t/add-missing.tap
index f74c2fd93..9c4b774b3 100755
--- a/t/add-missing.tap
+++ b/t/add-missing.tap
@@ -247,6 +247,7 @@ check_ <<'END'
depcomp/C
== Files ==
depcomp
+compile
== configure.ac ==
AC_PROG_CC
== Makefile.am ==
@@ -271,9 +272,9 @@ compile
== Files ==
compile
== configure.ac ==
-# Using AM_PROG_CC_C_O in configure.ac should be enough. No need to
-# use AC_PROG_CC too, nor to define xxx_PROGRAMS in Makefile.am.
-AM_PROG_CC_C_O
+# Using AC_PROG_CC in configure.ac should be enough. No
+# need to also define, say, xxx_PROGRAMS in Makefile.am.
+AC_PROG_CC
END
# For config.guess and config.sub.
@@ -294,6 +295,7 @@ check_ <<'END'
== Name ==
ylwrap/Lex
== Files ==
+compile
ylwrap
== configure.ac ==
AC_PROG_CC
@@ -308,6 +310,7 @@ check_ <<'END'
== Name ==
ylwrap/Yacc
== Files ==
+compile
ylwrap
== configure.ac ==
AC_PROG_CC
diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index f3fcacca5..0ceb4d09c 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -820,7 +820,7 @@ am_setup_testdir ()
|| framework_failure_ "cannot chdir into test subdirectory"
if test x"$am_create_testdir" != x"empty"; then
cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
- "$am_scriptdir"/depcomp . \
+ "$am_scriptdir"/compile "$am_scriptdir"/depcomp . \
|| framework_failure_ "fetching common files from $am_scriptdir"
# Build appropriate environment in test directory. E.g., create
# configure.ac, touch all necessary files, etc. Don't use AC_OUTPUT,
diff --git a/t/ccnoco2.sh b/t/ccnoco2.sh
deleted file mode 100755
index a835fa668..000000000
--- a/t/ccnoco2.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2006-2013 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 2, 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 .
-
-# Make sure Automake requires AM_PROG_CC_C_O when either per-targets
-# flags or subdir-objects are used.
-
-. test-init.sh
-
-cat >>configure.ac <Makefile.am <Makefile.am <> Makefile.am
-AUTOMAKE_fails --copy --add-missing
-grep '^Makefile\.am:2:.*subdir.*AM_PROG_CC_C_O' stderr
-
-:
diff --git a/t/cond11.sh b/t/cond11.sh
index 03c4077ad..7d729d8f1 100755
--- a/t/cond11.sh
+++ b/t/cond11.sh
@@ -47,7 +47,6 @@ END
: > config.guess
: > config.sub
-: > compile
$ACLOCAL
$AUTOCONF
diff --git a/t/cxx-lt-demo.sh b/t/cxx-lt-demo.sh
index 8afc974aa..3a87cfdfc 100755
--- a/t/cxx-lt-demo.sh
+++ b/t/cxx-lt-demo.sh
@@ -94,10 +94,12 @@ $AUTOCONF
$AUTOMAKE --add-missing --copy
ls -l . ax # For debugging.
-for f in ltmain.sh depcomp config.guess config.sub; do
+# Ideally, the 'compile' script should not be required by C++ compilers.
+# But alas, LT_INIT seems to invoke AC_PROG_CC anyway, and that brings in
+# that script.
+for f in ltmain.sh depcomp compile config.guess config.sub; do
test -f ax/$f && test ! -h ax/$f || exit 1
done
-test ! -e ax/compile # Not required by C++ compilers.
cat > src/main.cc << 'END'
#include "libfoo.h++"
diff --git a/t/dist-auxdir-many-subdirs.sh b/t/dist-auxdir-many-subdirs.sh
index d49372a1f..ec1a9641f 100755
--- a/t/dist-auxdir-many-subdirs.sh
+++ b/t/dist-auxdir-many-subdirs.sh
@@ -63,6 +63,7 @@ END
required_files='
install-sh
missing
+ compile
depcomp
py-compile
test-driver
diff --git a/t/distcom2.sh b/t/distcom2.sh
index 57154d97c..dc0cb4d29 100755
--- a/t/distcom2.sh
+++ b/t/distcom2.sh
@@ -44,6 +44,8 @@ $ACLOCAL
for opt in '' --no-force; do
+ rm -f compile depcomp
+
$AUTOMAKE $opt --add-missing
test -f compile
diff --git a/t/dollarvar2.sh b/t/dollarvar2.sh
index 718374370..ef2dd06af 100755
--- a/t/dollarvar2.sh
+++ b/t/dollarvar2.sh
@@ -65,27 +65,22 @@ grep 'recursive variable expansion' stderr
cat >Makefile.am <<'EOF'
x = 1
bla = $(foo$(x))
-noinst_PROGRAMS = foo
-foo_CPPFLAGS = -Dwhatever
+oops = $(var-with-dash)
EOF
-echo AC_PROG_CC >> configure.ac
-
-$ACLOCAL --force
-
# Can disable both 'portability' and 'portability-recursive' warnings.
$AUTOMAKE -Wno-portability
# Disabling 'portability-recursive' warnings should not disable
# 'portability' warnings.
AUTOMAKE_fails -Wportability -Wno-portability-recursive
-grep AM_PROG_CC_C_O stderr
+grep 'var-with-dash' stderr
grep 'recursive variable expansion' stderr && exit 1
# Enabling 'portability-recursive' warnings should not enable
# all the 'portability' warning.
AUTOMAKE_fails -Wno-portability -Wportability-recursive
-grep AM_PROG_CC_C_O stderr && exit 1
+grep 'var-with-dash' stderr && exit 1
grep 'recursive variable expansion' stderr
:
diff --git a/t/extra-portability.sh b/t/extra-portability.sh
index 94dd799e2..1ea23ad75 100755
--- a/t/extra-portability.sh
+++ b/t/extra-portability.sh
@@ -62,30 +62,29 @@ $AUTOMAKE -Wall -Wno-portability
# Now, a setup where also a "simple" portability warning is present.
#
-# Per-target flags require the use of AM_PROG_CC_C_O in configure.ac.
-echo libfoo_a_CPPFLAGS = -Dwhatever >> Makefile.am
+echo 'var = $(foo--bar)' >> Makefile.am
# Enabling extra-portability enables portability as well ...
AUTOMAKE_fails -Wextra-portability
-grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'foo--bar' stderr
grep 'requires.*AM_PROG_AR' stderr
# ... even if it had been previously disabled.
AUTOMAKE_fails -Wno-portability -Wextra-portability
-grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'foo--bar' stderr
grep 'requires.*AM_PROG_AR' stderr
# Disabling extra-portability leaves portability intact (1).
AUTOMAKE_fails -Wportability -Wno-extra-portability
-grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'foo--bar' stderr
grep 'requires.*AM_PROG_AR' stderr && exit 1
# Disabling extra-portability leaves portability intact (2).
AUTOMAKE_fails -Wall -Wno-extra-portability
-grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'foo--bar' stderr
grep 'requires.*AM_PROG_AR' stderr && exit 1
# Enabling portability does not enable extra-portability.
AUTOMAKE_fails -Wportability
-grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'foo--bar' stderr
grep 'requires.*AM_PROG_AR' stderr && exit 1
# Disabling portability disables extra-portability.
diff --git a/t/libobj19.sh b/t/libobj19.sh
index fdca575b5..65172fb21 100755
--- a/t/libobj19.sh
+++ b/t/libobj19.sh
@@ -55,7 +55,6 @@ extern int dummy;
END
cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"
-cp "$am_scriptdir/compile" . || fatal_ "fetching auxiliary script 'compile'"
$ACLOCAL
$AUTOCONF
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 2052bd8ee..baccdca6d 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -30,7 +30,6 @@ t/pm/Version3.pl
XFAIL_TESTS = \
t/all.sh \
-t/ccnoco4.sh \
t/cond17.sh \
t/gcj6.sh \
t/override-conditional-2.sh \
@@ -208,7 +207,6 @@ t/canon7.sh \
t/canon8.sh \
t/canon-name.sh \
t/ccnoco.sh \
-t/ccnoco2.sh \
t/ccnoco3.sh \
t/ccnoco4.sh \
t/check.sh \
diff --git a/t/per-target-flags.sh b/t/per-target-flags.sh
index ef19e6925..333242f9d 100755
--- a/t/per-target-flags.sh
+++ b/t/per-target-flags.sh
@@ -55,15 +55,8 @@ cat - libMakefile.am > libMakefile2.am << 'END'
AUTOMAKE_OPTIONS = no-dependencies
END
-# Make sure 'compile' is required.
-for m in $makefiles; do
- AUTOMAKE_fails $m
- $EGREP " required file.* '(compile|\./compile)'" stderr
-done
-
makefiles=$(for mkf in $makefiles; do echo $mkf.in; done)
-: > compile
$AUTOMAKE
# Sanity check.
diff --git a/t/repeated-options.sh b/t/repeated-options.sh
index af1897bcb..d3fe96207 100755
--- a/t/repeated-options.sh
+++ b/t/repeated-options.sh
@@ -58,7 +58,7 @@ int main (void)
}
END
-cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver .
+cp "$am_scriptdir"/test-driver .
$ACLOCAL
$AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; exit 1; }
diff --git a/t/specflg6.sh b/t/specflg6.sh
index 77d837a53..bbc83343f 100755
--- a/t/specflg6.sh
+++ b/t/specflg6.sh
@@ -36,8 +36,6 @@ foo_CFLAGS = -DFOO
foo_SOURCES = foo.c
END
-: > compile
-
$ACLOCAL
$AUTOMAKE
diff --git a/t/subobj.sh b/t/subobj.sh
index 2431184b6..6e5fd9800 100755
--- a/t/subobj.sh
+++ b/t/subobj.sh
@@ -20,6 +20,8 @@
cat >> configure.ac << 'END'
AC_PROG_CC
+dnl This should be a no-op now, but still be supported
+dnl without causing warnings.
AM_PROG_CC_C_O
END
@@ -30,10 +32,11 @@ wish_SOURCES = generic/a.c generic/b.c
END
$ACLOCAL
+rm -f compile
$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; exit 1; }
cat stderr >&2
# Make sure compile is installed, and that Automake says so.
-grep 'install.*compile' stderr
+grep '^configure\.ac:4:.*install.*compile' stderr
test -f compile
grep '^generic/a\.\$(OBJEXT):' Makefile.in
diff --git a/t/subobj4.sh b/t/subobj4.sh
index b1b577d6a..45d9666ab 100755
--- a/t/subobj4.sh
+++ b/t/subobj4.sh
@@ -41,7 +41,6 @@ END
cat > d2/Makefile.am << 'END'
END
-: > compile
: > d2/z.c
$ACLOCAL
--
cgit v1.2.1
From fba16588f89f3a7d8a24034718e5f50204b2b0d8 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 11:09:14 +0100
Subject: copyright: update some copyright years
With "make update-copyright". Apparently they were missed in the
last bump.
* bootstrap.sh, configure.ac, t/txinfo-builddir.sh: In these files.
Signed-off-by: Stefano Lattarini
---
bootstrap.sh | 2 +-
configure.ac | 2 +-
t/txinfo-builddir.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
index 0ea691d31..0a5a290e2 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -38,7 +38,7 @@ datadir=.
PERL_THREADS=0
# This should be automatically updated by the 'update-copyright'
# rule of our Makefile.
-RELEASE_YEAR=2012
+RELEASE_YEAR=2013
# Override SHELL. This is required on DJGPP so that Perl's system()
# uses bash, not COMMAND.COM which doesn't quote arguments properly.
diff --git a/configure.ac b/configure.ac
index d57ed6208..6ef2be734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ AM_INIT_AUTOMAKE([-Wall -Werror dist-xz filename-length-max=99
## Keep this on a line of its own, since it must be found and processed
## by the 'update-copyright' rule in our Makefile.
-RELEASE_YEAR=2012
+RELEASE_YEAR=2013
AC_SUBST([RELEASE_YEAR])
# The API version is the base version. We must guarantee
diff --git a/t/txinfo-builddir.sh b/t/txinfo-builddir.sh
index 148a1a687..e0156c54d 100755
--- a/t/txinfo-builddir.sh
+++ b/t/txinfo-builddir.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2012-2013 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
--
cgit v1.2.1
From b8e238a757e692ef1849035fbc69045807f3fe54 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 11:16:44 +0100
Subject: maint: consistently honor the UPDATE_COPYRIGHT_YEAR environment
variable
* maintainer/maint.mk (update-copyright): Here. The 'lib/update-copyright'
already honoured it, but some parts of our recipe didn't. This has caused
the incomplete copyright bump that was fixed by the previous patch.
Signed-off-by: Stefano Lattarini
---
maintainer/maint.mk | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/maintainer/maint.mk b/maintainer/maint.mk
index 69b163048..87df79f8f 100644
--- a/maintainer/maint.mk
+++ b/maintainer/maint.mk
@@ -449,11 +449,17 @@ files_without_copyright += lib/mkinstalldirs
# This script has an MIT-style license
files_without_copyright += lib/install-sh
+# The UPDATE_COPYRIGHT_YEAR environment variable is honoured by the
+# 'lib/update-copyright' script.
.PHONY: update-copyright
update-copyright:
$(AM_V_GEN)set -e; \
- current_year=`date +%Y` && test -n "$$current_year" \
- || { echo "$@: cannot get current year" >&2; exit 1; }; \
+ if test -n "$$UPDATE_COPYRIGHT_YEAR"; then \
+ current_year=$$UPDATE_COPYRIGHT_YEAR; \
+ else \
+ current_year=`date +%Y` && test -n "$$current_year" \
+ || { echo "$@: cannot get current year" >&2; exit 1; }; \
+ fi; \
sed -i "/^RELEASE_YEAR=/s/=.*$$/=$$current_year/" \
bootstrap.sh configure.ac; \
excluded_re=`( \
--
cgit v1.2.1
From a9966b04d38577a76156ce16828bce874b582874 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 11:22:10 +0100
Subject: maint: files in PLANS are to be exempted from copyright notice
* maintainer/maint.mk (update-copyright): Adjust.
Signed-off-by: Stefano Lattarini
---
maintainer/maint.mk | 1 +
1 file changed, 1 insertion(+)
diff --git a/maintainer/maint.mk b/maintainer/maint.mk
index 87df79f8f..1ea10a2f2 100644
--- a/maintainer/maint.mk
+++ b/maintainer/maint.mk
@@ -469,5 +469,6 @@ update-copyright:
) | sed -e '$$!s,$$,|,' | tr -d '\012\015'`; \
$(GIT) ls-files \
| grep -Ev '(^|/)README$$' \
+ | grep -Ev '^PLANS(/|$$)' \
| grep -Ev "^($$excluded_re)$$" \
| $(update_copyright_env) xargs $(srcdir)/lib/$@
--
cgit v1.2.1
From d353dbc3f01357e9bfce59d1720a8cb2498d12bd Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 11:26:36 +0100
Subject: copyright: add few missing copyright notices
Issue revealed by warnings from "make update-copyright".
* maintainer/am-ft: Add copyright notice.
* maintainer/am-xft: Likewise.
* maintainer/rename-tests: Likewise.
Signed-off-by: Stefano Lattarini
---
maintainer/am-ft | 16 ++++++++++++++++
maintainer/am-xft | 15 +++++++++++++++
maintainer/rename-tests | 15 +++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/maintainer/am-ft b/maintainer/am-ft
index d8a2722be..1d227906e 100755
--- a/maintainer/am-ft
+++ b/maintainer/am-ft
@@ -1,6 +1,22 @@
#!/usr/bin/env bash
# Remote testing of Automake tarballs made easy.
# This script requires Bash 4.x or later.
+
+# Copyright (C) 2013 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 2, 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 .
+
# TODO: some documentation would be nice ...
set -u
diff --git a/maintainer/am-xft b/maintainer/am-xft
index 564aa3b02..d7fee4cbb 100755
--- a/maintainer/am-xft
+++ b/maintainer/am-xft
@@ -1,3 +1,18 @@
#!/bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
MAKE=${MAKE-make} GIT=${GIT-git}
$GIT clean -fdx && $MAKE bootstrap && $MAKE dist && exec am-ft "$@"
diff --git a/maintainer/rename-tests b/maintainer/rename-tests
index 6fce9fe84..a58474862 100755
--- a/maintainer/rename-tests
+++ b/maintainer/rename-tests
@@ -1,6 +1,21 @@
#!/usr/bin/env bash
# Convenience script to rename test cases in Automake.
+# Copyright (C) 2013 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 2, 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 .
+
set -e -u
me=${0##*/}
--
cgit v1.2.1
From 182626687f2640609f8eb28ad1b04b078342f2c7 Mon Sep 17 00:00:00 2001
From: Mike Frysinger
Date: Sat, 12 Jan 2013 00:19:40 -0500
Subject: ithreads: use runtime (not configure time) detection of perl threads
I can't imagine the runtime checks being a big runtime penalty, so there
shouldn't be a need to do the checks at configure check and hardcode the
result in the generated automake.
With the current system, it means if you change your perl config (build
perl w/threads, build automake, build perl w/out threads), or deploy a
compiled automake package on a different system (build had threads, but
deployed system does not), you get errors when trying to run automake.
So take the logic from configure.ac and move it to the one place where
PERL_THREADS is used (lib/Automake/Config.in) and do the version/config
checking at runtime.
* bootstrap.sh (PERL_THREADS): Delete assignment and use in sed.
* configure.ac (am_cv_prog_PERL_ithreads, PERL_THREADS): Delete all code
related to these two variables.
* lib/Automake/Config.in (perl_threads): Initialize to 0, and only set to
1 if the perl version is at least 5.007_002, and useithreads is in Config.
Copyright-paperwork-exempt: yes
Signed-off-by: Mike Frysinger
Signed-off-by: Stefano Lattarini
---
bootstrap.sh | 2 --
configure.ac | 26 --------------------------
lib/Automake/Config.in | 9 ++++++++-
3 files changed, 8 insertions(+), 29 deletions(-)
diff --git a/bootstrap.sh b/bootstrap.sh
index 0a5a290e2..93bf3fd54 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -35,7 +35,6 @@ export AUTOM4TE # ditto
VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
PACKAGE=automake
datadir=.
-PERL_THREADS=0
# This should be automatically updated by the 'update-copyright'
# rule of our Makefile.
RELEASE_YEAR=2013
@@ -83,7 +82,6 @@ dosubst ()
sed -e "s%@APIVERSION@%$APIVERSION%g" \
-e "s%@PACKAGE@%$PACKAGE%g" \
-e "s%@PERL@%$PERL%g" \
- -e "s%@PERL_THREADS@%$PERL_THREADS%g" \
-e "s%@SHELL@%$BOOTSTRAP_SHELL%g" \
-e "s%@VERSION@%$VERSION%g" \
-e "s%@datadir@%$datadir%g" \
diff --git a/configure.ac b/configure.ac
index 6ef2be734..006a08c2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -86,32 +86,6 @@ installed, select the one Automake should use using
./configure PERL=/path/to/perl])
}
-# We require ithreads support, and version 5.7.2 for CLONE.
-AC_CACHE_CHECK([whether $PERL supports ithreads], [am_cv_prog_PERL_ithreads],
-[if $PERL -e '
- require 5.007_002;
- use Config;
- if ($Config{useithreads})
- {
- require threads;
- import threads;
- require Thread::Queue;
- import Thread::Queue;
- exit 0;
- }
- exit 1;' >&AS_MESSAGE_LOG_FD 2>&1
-then
- am_cv_prog_PERL_ithreads=yes
-else
- am_cv_prog_PERL_ithreads=no
-fi])
-if test $am_cv_prog_PERL_ithreads = yes; then
- PERL_THREADS=1;
-else
- PERL_THREADS=0;
-fi
-AC_SUBST([PERL_THREADS])
-
# The test suite will skip some tests if tex is absent.
AC_CHECK_PROG([TEX], [tex], [tex])
# Save details about the selected TeX program in config.log.
diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in
index fe6ef9d29..885e74e5d 100644
--- a/lib/Automake/Config.in
+++ b/lib/Automake/Config.in
@@ -33,7 +33,14 @@ our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@';
our $VERSION = '@VERSION@';
our $RELEASE_YEAR = '@RELEASE_YEAR@';
our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@';
-our $perl_threads = @PERL_THREADS@;
+
+our $perl_threads = 0;
+# We need at least this version for CLONE support.
+if (eval { require 5.007_002; })
+ {
+ use Config;
+ $perl_threads = $Config{useithreads};
+ }
1;
--
cgit v1.2.1
From 30af9050ea11ca27a2224c5cb31612f614965efb Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 12:10:39 +0100
Subject: INSTALL: update copyright years
Signed-off-by: Stefano Lattarini
---
INSTALL | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/INSTALL b/INSTALL
index 6e90e07d2..007e9396d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
Installation Instructions
*************************
-Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
+Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
--
cgit v1.2.1
From 7746e5284767b9459e5ab3dc7eef4da63d68f93a Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 12:30:15 +0100
Subject: coverage: obsolete macro AM_PROG_CC_C_O should cause no warning nor
errors
Suggested by Eric Blake.
* t/am-prog-cc-c-o.sh: New test.
* t/list-of-tests.mk: Add it.
Signed-off-by: Stefano Lattarini
---
t/am-prog-cc-c-o.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
t/list-of-tests.mk | 1 +
2 files changed, 92 insertions(+)
create mode 100755 t/am-prog-cc-c-o.sh
diff --git a/t/am-prog-cc-c-o.sh b/t/am-prog-cc-c-o.sh
new file mode 100755
index 000000000..da6a3a4a4
--- /dev/null
+++ b/t/am-prog-cc-c-o.sh
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Check that uses of the obsolescent AM_PROG_CC_C_O macro doesn't
+# cause spurious warnings or errors. Suggested by Eric Blake.
+
+# We need gcc for for two reasons:
+# 1. to ensure our C compiler grasps "-c -o" together.
+# 2. to be able to later fake a dumb compiler not grasping that
+# (done with 'cc-no-c-o' script below, which required gcc).
+required=gcc
+. test-init.sh
+
+echo bin_PROGRAMS = foo > Makefile.am
+echo 'int main (void) { return 0; }' > foo.c
+
+cp configure.ac configure.bak
+
+cat >> configure.ac << 'END'
+# Since AM_PROG_CC_C_O rewrites $CC, it's an error to call AC_PROG_CC
+# after it.
+AM_PROG_CC_C_O
+AC_PROG_CC
+END
+
+$ACLOCAL -Wnone 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+grep '^configure\.ac:7:.* AC_PROG_CC .*called after AM_PROG_CC_C_O' stderr
+
+cat configure.bak - > configure.ac << 'END'
+dnl It's OK to call AM_PROG_CC_C_O after AC_PROG_CC.
+AC_PROG_CC
+AM_PROG_CC_C_O
+# Make sure that $CC can be used after AM_PROG_CC_C_O.
+$CC --version || exit 1
+$CC -v || exit 1
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure >stdout || { cat stdout; exit 1; }
+cat stdout
+grep 'understands -c and -o together.* yes$' stdout
+# No repeated checks please.
+test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
+$MAKE
+
+$MAKE maintainer-clean
+
+rm -rf autom4te*.cache
+
+cat configure.bak - > configure.ac << 'END'
+dnl It's also OK to call AM_PROG_CC_C_O *without* AC_PROG_CC.
+AM_PROG_CC_C_O
+# Make sure that $CC can be used after AM_PROG_CC_C_O.
+$CC --version || exit 1
+$CC -v || exit 1
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Make sure the compiler doesn't understand '-c -o'
+CC=$am_testaux_builddir/cc-no-c-o; export CC
+
+./configure >stdout || { cat stdout; exit 1; }
+cat stdout
+grep 'understands -c and -o together.* no$' stdout
+# No repeated checks please.
+test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
+$MAKE
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index baccdca6d..a6e1ceeb4 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -132,6 +132,7 @@ t/aminit-moreargs-deprecation.sh \
t/amassign.sh \
t/am-config-header-no-more.sh \
t/am-prog-cc-stdc-no-more.sh \
+t/am-prog-cc-c-o.sh \
t/am-macro-not-found.sh \
t/amopt.sh \
t/amopts-location.sh \
--
cgit v1.2.1
From 1e44f8532f6b7d9d4c59efdb8e2850bc212260af Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 12:53:21 +0100
Subject: tests: remove most uses of the AM_PROG_CC_C_O obsolete macro
Our NEWS file says its use will no longer be required in Automake
1.13, so better make sure that is actually the case.
* Several tests: Adjust.
Signed-off-by: Stefano Lattarini
---
t/acsubst2.sh | 1 -
t/ax/depcomp.sh | 1 -
t/c-demo.sh | 1 -
t/ccnoco.sh | 4 +---
t/ccnoco3.sh | 1 -
t/ccnoco4.sh | 1 -
t/check8.sh | 1 -
t/compile4.sh | 1 -
t/depcomp8a.sh | 6 +-----
t/depcomp8b.sh | 5 +----
t/distcom2.sh | 3 +--
t/instdir-ltlib.sh | 1 -
t/instdir-prog.sh | 1 -
t/lex-line.sh | 1 -
t/lex-subobj-nodep.sh | 1 -
t/lex5.sh | 1 -
t/libobj19.sh | 1 -
t/libtool9.sh | 1 -
t/per-target-flags.sh | 1 -
t/pr224.sh | 1 -
t/pr401.sh | 3 +--
t/pr401b.sh | 3 +--
t/pr401c.sh | 3 +--
t/repeated-options.sh | 1 -
t/silent-c.sh | 1 -
t/silent-lex.sh | 1 -
t/silent-lt.sh | 1 -
t/silent-many-languages.sh | 1 -
t/silent-nested-vars.sh | 1 -
t/silent-yacc.sh | 2 +-
t/specflg-dummy.sh | 1 -
t/specflg6.sh | 1 -
t/specflg7.sh | 1 -
t/specflg8.sh | 1 -
t/specflg9.sh | 1 -
t/subobj-clean-lt-pr10697.sh | 1 -
t/subobj-clean-pr10697.sh | 1 -
t/subobj.sh | 7 +------
t/subobj11a.sh | 1 -
t/subobj11b.sh | 5 +----
t/subobj11c.sh | 5 +----
t/subobj4.sh | 1 -
t/subobj5.sh | 1 -
t/subobj6.sh | 2 +-
t/subobj7.sh | 1 -
t/subobj8.sh | 1 -
t/suffix-custom-subobj-and-specflg.sh | 1 -
t/target-cflags.sh | 1 -
t/vala-libs.sh | 1 -
t/vala-mix.sh | 1 -
t/vala-non-recursive-setup.sh | 1 -
t/vala-per-target-flags.sh | 1 -
t/vala-recursive-setup.sh | 1 -
t/vala-vapi.sh | 1 -
t/yacc-dist-nobuild-subdir.sh | 1 -
t/yacc-grepping2.sh | 1 -
t/yacc-line.sh | 1 -
t/yacc-subdir.sh | 1 -
58 files changed, 12 insertions(+), 82 deletions(-)
diff --git a/t/acsubst2.sh b/t/acsubst2.sh
index 2428dc2a8..fc7c9ad17 100755
--- a/t/acsubst2.sh
+++ b/t/acsubst2.sh
@@ -18,7 +18,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_SUBST([FOOBAR_CFLAGS],[blablabla])
END
diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index cdeaae5d6..0e5b6a521 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -132,7 +132,6 @@ AC_INIT([$me], [1.0])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
$(if test $depcomp_with_libtool = yes; then
echo AC_PROG_LIBTOOL
diff --git a/t/c-demo.sh b/t/c-demo.sh
index df2fc5540..a0012e2cc 100755
--- a/t/c-demo.sh
+++ b/t/c-demo.sh
@@ -27,7 +27,6 @@ AC_CONFIG_SRCDIR([tests/test.test])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB
AM_CONDITIONAL([RUN_TESTS], [test x"$run_tests" != x"no"])
diff --git a/t/ccnoco.sh b/t/ccnoco.sh
index c6af79775..be9be375e 100755
--- a/t/ccnoco.sh
+++ b/t/ccnoco.sh
@@ -22,9 +22,7 @@ required=gcc # For cc-no-c-o.
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
-# Make sure that $CC can be used after AM_PROG_CC_C_O.
-$CC -v || exit 1
+$CC --version; $CC -v; # For debugging.
AC_OUTPUT
END
diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh
index b8dd77c2b..baf3bdfd0 100755
--- a/t/ccnoco3.sh
+++ b/t/ccnoco3.sh
@@ -21,7 +21,6 @@ required=gcc # For cc-no-c-o.
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
$CC --version; $CC -v; # For debugging.
AC_OUTPUT
END
diff --git a/t/ccnoco4.sh b/t/ccnoco4.sh
index b317fb5b8..beb02daae 100755
--- a/t/ccnoco4.sh
+++ b/t/ccnoco4.sh
@@ -25,7 +25,6 @@
required=gcc # For cc-no-c-o.
. test-init.sh
-# We deliberately do not call AM_PROG_CC_C_O here.
cat >> configure.ac << 'END'
AC_PROG_CC
$CC --version; $CC -v; # For debugging.
diff --git a/t/check8.sh b/t/check8.sh
index a48614764..743d1bd00 100755
--- a/t/check8.sh
+++ b/t/check8.sh
@@ -22,7 +22,6 @@ required='cc native'
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/compile4.sh b/t/compile4.sh
index a06aa8729..ddabe3143 100755
--- a/t/compile4.sh
+++ b/t/compile4.sh
@@ -46,7 +46,6 @@ absmainobj=$cwd/main.obj
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB
AC_CONFIG_FILES([sub/Makefile])
diff --git a/t/depcomp8a.sh b/t/depcomp8a.sh
index aa0be3963..76aa37694 100755
--- a/t/depcomp8a.sh
+++ b/t/depcomp8a.sh
@@ -24,7 +24,6 @@ required=cc
cat >> configure.ac << 'END'
AC_PROG_CC
-#x AM_PROG_CC_C_O
AC_OUTPUT
END
@@ -64,12 +63,9 @@ DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
# Try again with subdir-objects option.
-sed 's/#x //' configure.ac >configure.tmp
-mv -f configure.tmp configure.ac
echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
-$ACLOCAL
-$AUTOMAKE -a
+$AUTOMAKE
grep include Makefile.in # For debugging.
grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh
index c2a54da65..52382f14a 100755
--- a/t/depcomp8b.sh
+++ b/t/depcomp8b.sh
@@ -56,12 +56,9 @@ DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
# Try again with subdir-objects option.
-sed 's/#x //' configure.ac >configure.tmp
-mv -f configure.tmp configure.ac
echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
-$ACLOCAL
-$AUTOMAKE -a
+$AUTOMAKE
grep include Makefile.in # For debugging.
grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
diff --git a/t/distcom2.sh b/t/distcom2.sh
index dc0cb4d29..1f39b6679 100755
--- a/t/distcom2.sh
+++ b/t/distcom2.sh
@@ -22,7 +22,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_CONFIG_FILES([subdir/Makefile])
AC_OUTPUT
END
@@ -76,7 +75,7 @@ for opt in '' --no-force; do
$FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt
# The 'compile' script will be listed in the DIST_COMMON of the top-level
- # Makefile because it's required in configure.ac (by AM_PROG_CC_C_O).
+ # Makefile because it's required in configure.ac (by AC_PROG_CC).
$FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt
done
diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh
index 32d8d409a..726f809bc 100755
--- a/t/instdir-ltlib.sh
+++ b/t/instdir-ltlib.sh
@@ -23,7 +23,6 @@ required='cc libtoolize'
cat >>configure.ac <<'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_LIBTOOL
AM_PATH_PYTHON
diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh
index 2fa14e5c3..f916a11e9 100755
--- a/t/instdir-prog.sh
+++ b/t/instdir-prog.sh
@@ -23,7 +23,6 @@ required=cc
cat >>configure.ac <<'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB
AM_PATH_PYTHON
diff --git a/t/lex-line.sh b/t/lex-line.sh
index d4340e488..9b27c0b39 100755
--- a/t/lex-line.sh
+++ b/t/lex-line.sh
@@ -25,7 +25,6 @@ required='cc lex'
cat >> configure.ac << 'END'
AC_CONFIG_FILES([sub/Makefile])
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_LEX
AC_OUTPUT
END
diff --git a/t/lex-subobj-nodep.sh b/t/lex-subobj-nodep.sh
index 3282350c2..75e4f0c43 100755
--- a/t/lex-subobj-nodep.sh
+++ b/t/lex-subobj-nodep.sh
@@ -22,7 +22,6 @@ required='cc lex'
cat >>configure.ac <<\END
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_LEX
AC_OUTPUT
END
diff --git a/t/lex5.sh b/t/lex5.sh
index 13c8239e5..232f77dba 100755
--- a/t/lex5.sh
+++ b/t/lex5.sh
@@ -21,7 +21,6 @@ required='cc lex'
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_LEX
AC_OUTPUT
END
diff --git a/t/libobj19.sh b/t/libobj19.sh
index 65172fb21..1a4cf23d4 100755
--- a/t/libobj19.sh
+++ b/t/libobj19.sh
@@ -22,7 +22,6 @@ required=cc
cat >> configure.ac << 'END'
AC_CONFIG_LIBOBJ_DIR([libobj-dir])
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB
AC_LIBOBJ([foobar])
diff --git a/t/libtool9.sh b/t/libtool9.sh
index 26eb5f147..bb6ac87d9 100755
--- a/t/libtool9.sh
+++ b/t/libtool9.sh
@@ -24,7 +24,6 @@ required='cc libtoolize'
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
diff --git a/t/per-target-flags.sh b/t/per-target-flags.sh
index 333242f9d..d27a24472 100755
--- a/t/per-target-flags.sh
+++ b/t/per-target-flags.sh
@@ -26,7 +26,6 @@ AC_INIT([$me], [1.0])
AM_INIT_AUTOMAKE([-Wno-extra-portability])
AC_CONFIG_FILES([$makefiles])
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_RANLIB
AC_OUTPUT
diff --git a/t/pr224.sh b/t/pr224.sh
index 764d9fb98..b6bf6b986 100755
--- a/t/pr224.sh
+++ b/t/pr224.sh
@@ -43,7 +43,6 @@ EOF
cat >>configure.ac <<'EOF'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
EOF
diff --git a/t/pr401.sh b/t/pr401.sh
index f3020429e..89094de75 100755
--- a/t/pr401.sh
+++ b/t/pr401.sh
@@ -45,7 +45,6 @@ cat >>configure.ac << 'EOF'
## These lines are activated for later tests
#: AC_CONFIG_LIBOBJ_DIR([lib])
AC_PROG_CC
-#x AM_PROG_CC_C_O
AC_LIBOBJ([feep])
AC_LIBSOURCE([feep.c])
AM_PROG_AR
@@ -118,7 +117,7 @@ mv -f src/t src/Makefile.am
## Test using LIBOBJS from a sibling directory. ##
## -------------------------------------------- ##
-sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.tmp
+sed 's/lib\/Makefile //' configure.ac >configure.tmp
mv -f configure.tmp configure.ac
cat >Makefile.am <<'EOF'
diff --git a/t/pr401b.sh b/t/pr401b.sh
index 3fa2ad1db..cf7a69885 100755
--- a/t/pr401b.sh
+++ b/t/pr401b.sh
@@ -45,7 +45,6 @@ cat >>configure.ac << 'EOF'
## These lines are activated for later tests
#: AC_CONFIG_LIBOBJ_DIR([lib])
AC_PROG_CC
-#x AM_PROG_CC_C_O
AC_LIBOBJ([feep])
AC_LIBSOURCE([feep.c])
AM_PROG_AR
@@ -118,7 +117,7 @@ mv -f src/t src/Makefile.am
## Test using LTLIBOBJS from a sibling directory. ##
## ---------------------------------------------- ##
-sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.tmp
+sed 's/lib\/Makefile //' configure.ac >configure.tmp
mv -f configure.tmp configure.ac
cat >Makefile.am <<'EOF'
diff --git a/t/pr401c.sh b/t/pr401c.sh
index 07c755d10..22e587629 100755
--- a/t/pr401c.sh
+++ b/t/pr401c.sh
@@ -47,7 +47,6 @@ cat >>configure.ac << 'EOF'
## These lines are activated for later tests.
#: AC_CONFIG_LIBOBJ_DIR([lib])
AC_PROG_CC
-#x AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB
AC_FUNC_ALLOCA
@@ -120,7 +119,7 @@ mv -f src/t src/Makefile.am
## Test using ALLOCA from a sibling directory. ##
## ------------------------------------------- ##
-sed 's/#x //; s/lib\/Makefile //' configure.ac >configure.tmp
+sed 's/lib\/Makefile //' configure.ac >configure.tmp
mv -f configure.tmp configure.ac
cat >Makefile.am <<'EOF'
diff --git a/t/repeated-options.sh b/t/repeated-options.sh
index d3fe96207..95963c547 100755
--- a/t/repeated-options.sh
+++ b/t/repeated-options.sh
@@ -24,7 +24,6 @@ cat >configure.ac <>configure.ac <<'EOF'
AC_CONFIG_FILES([sub/Makefile])
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
EOF
diff --git a/t/silent-lex.sh b/t/silent-lex.sh
index 018f8a7a9..320e91f1d 100755
--- a/t/silent-lex.sh
+++ b/t/silent-lex.sh
@@ -22,7 +22,6 @@ required='cc lex'
mkdir sub
cat >>configure.ac <<'EOF'
-AM_PROG_CC_C_O
AC_PROG_LEX
AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
diff --git a/t/silent-lt.sh b/t/silent-lt.sh
index dc9bf2acc..0ae003719 100755
--- a/t/silent-lt.sh
+++ b/t/silent-lt.sh
@@ -26,7 +26,6 @@ cat >>configure.ac <<'EOF'
AC_CONFIG_FILES([sub/Makefile])
AC_PROG_CC
AM_PROG_AR
-AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_OUTPUT
EOF
diff --git a/t/silent-many-languages.sh b/t/silent-many-languages.sh
index bffbb6a49..5395af6d9 100755
--- a/t/silent-many-languages.sh
+++ b/t/silent-many-languages.sh
@@ -93,7 +93,6 @@ do_and_check_verbose_build ()
mkdir sub
cat >>configure.ac <<'EOF'
-AM_PROG_CC_C_O
AC_PROG_F77
AC_PROG_FC
AC_PROG_LEX
diff --git a/t/silent-nested-vars.sh b/t/silent-nested-vars.sh
index 7dca05696..f03204d0b 100755
--- a/t/silent-nested-vars.sh
+++ b/t/silent-nested-vars.sh
@@ -22,7 +22,6 @@
cat >>configure.ac <<'EOF'
AM_SILENT_RULES
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
EOF
diff --git a/t/silent-yacc.sh b/t/silent-yacc.sh
index 5017d5069..bb215189f 100755
--- a/t/silent-yacc.sh
+++ b/t/silent-yacc.sh
@@ -22,7 +22,7 @@ required='cc yacc'
mkdir sub
cat >>configure.ac <<'EOF'
-AM_PROG_CC_C_O
+AC_PROG_CC
AC_PROG_YACC
AC_CONFIG_FILES([sub/Makefile])
AC_OUTPUT
diff --git a/t/specflg-dummy.sh b/t/specflg-dummy.sh
index 89ac20657..c1b9cd5ce 100755
--- a/t/specflg-dummy.sh
+++ b/t/specflg-dummy.sh
@@ -64,7 +64,6 @@ AC_PROG_RANLIB
AC_PROG_LIBTOOL
AM_PROG_UPC
AC_PROG_OBJC
-AM_PROG_CC_C_O
END
cat > Makefile.am <<'END'
diff --git a/t/specflg6.sh b/t/specflg6.sh
index bbc83343f..8178b3446 100755
--- a/t/specflg6.sh
+++ b/t/specflg6.sh
@@ -22,7 +22,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_CONDITIONAL([BAR], [true])
END
diff --git a/t/specflg7.sh b/t/specflg7.sh
index ee3786e23..0a40b5deb 100755
--- a/t/specflg7.sh
+++ b/t/specflg7.sh
@@ -21,7 +21,6 @@ required='cc native'
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/specflg8.sh b/t/specflg8.sh
index 3bb785b91..5e51053ce 100755
--- a/t/specflg8.sh
+++ b/t/specflg8.sh
@@ -23,7 +23,6 @@ required='cc native'
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/specflg9.sh b/t/specflg9.sh
index 0ee90f10a..3e0c69484 100755
--- a/t/specflg9.sh
+++ b/t/specflg9.sh
@@ -20,7 +20,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/subobj-clean-lt-pr10697.sh b/t/subobj-clean-lt-pr10697.sh
index ddcd112e9..053ce4177 100755
--- a/t/subobj-clean-lt-pr10697.sh
+++ b/t/subobj-clean-lt-pr10697.sh
@@ -28,7 +28,6 @@ cat >> configure.ac << 'END'
AM_PROG_AR
AC_PROG_LIBTOOL
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/subobj-clean-pr10697.sh b/t/subobj-clean-pr10697.sh
index df97f0708..e244e3d79 100755
--- a/t/subobj-clean-pr10697.sh
+++ b/t/subobj-clean-pr10697.sh
@@ -26,7 +26,6 @@ required=cc
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_CONFIG_FILES([get-objext.sh:get-objext.in])
AC_OUTPUT
END
diff --git a/t/subobj.sh b/t/subobj.sh
index 6e5fd9800..d16512abc 100755
--- a/t/subobj.sh
+++ b/t/subobj.sh
@@ -18,12 +18,7 @@
. test-init.sh
-cat >> configure.ac << 'END'
-AC_PROG_CC
-dnl This should be a no-op now, but still be supported
-dnl without causing warnings.
-AM_PROG_CC_C_O
-END
+echo AC_PROG_CC >> configure.ac
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
diff --git a/t/subobj11a.sh b/t/subobj11a.sh
index 25cbf4e21..2ff04b567 100755
--- a/t/subobj11a.sh
+++ b/t/subobj11a.sh
@@ -31,7 +31,6 @@ required=cc
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/subobj11b.sh b/t/subobj11b.sh
index 14970a0e4..deaa2b68e 100755
--- a/t/subobj11b.sh
+++ b/t/subobj11b.sh
@@ -28,10 +28,7 @@
. test-init.sh
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-END
+echo AC_PROG_CC >> configure.ac
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
diff --git a/t/subobj11c.sh b/t/subobj11c.sh
index a8a435b3a..7476e47c0 100755
--- a/t/subobj11c.sh
+++ b/t/subobj11c.sh
@@ -21,10 +21,7 @@
. test-init.sh
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-END
+echo AC_PROG_CC >> configure.ac
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
diff --git a/t/subobj4.sh b/t/subobj4.sh
index 45d9666ab..816f50668 100755
--- a/t/subobj4.sh
+++ b/t/subobj4.sh
@@ -21,7 +21,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_CXX
AC_CONFIG_FILES([d1/Makefile d2/Makefile])
AC_OUTPUT
diff --git a/t/subobj5.sh b/t/subobj5.sh
index 548230409..485142354 100755
--- a/t/subobj5.sh
+++ b/t/subobj5.sh
@@ -23,7 +23,6 @@ required=cc
cat >> configure.ac << 'END'
AC_CONFIG_FILES([generic/Makefile])
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/subobj6.sh b/t/subobj6.sh
index 71755fdb2..0e7aa86b6 100755
--- a/t/subobj6.sh
+++ b/t/subobj6.sh
@@ -21,7 +21,7 @@ required=cc
. test-init.sh
cat >> configure.ac << 'END'
-AM_PROG_CC_C_O
+AC_PROG_CC
AC_OUTPUT
END
diff --git a/t/subobj7.sh b/t/subobj7.sh
index 2d997c77f..5dc9ea861 100755
--- a/t/subobj7.sh
+++ b/t/subobj7.sh
@@ -21,7 +21,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/subobj8.sh b/t/subobj8.sh
index 51e1727d7..dd03008bf 100755
--- a/t/subobj8.sh
+++ b/t/subobj8.sh
@@ -23,7 +23,6 @@ AC_INIT([$me], [1.0])
AC_CONFIG_AUX_DIR([tools])
AM_INIT_AUTOMAKE
AC_PROG_CC
-AM_PROG_CC_C_O
AC_CONFIG_FILES([Makefile foo/Makefile])
AC_OUTPUT
END
diff --git a/t/suffix-custom-subobj-and-specflg.sh b/t/suffix-custom-subobj-and-specflg.sh
index e9f35c771..32356d7b3 100755
--- a/t/suffix-custom-subobj-and-specflg.sh
+++ b/t/suffix-custom-subobj-and-specflg.sh
@@ -23,7 +23,6 @@ required=cc
cat >>configure.ac <> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_OUTPUT
END
diff --git a/t/vala-libs.sh b/t/vala-libs.sh
index f3e905434..66fd2436a 100755
--- a/t/vala-libs.sh
+++ b/t/vala-libs.sh
@@ -22,7 +22,6 @@ required="valac cc pkg-config libtoolize GNUmake"
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_AR
AC_PROG_RANLIB
AC_PROG_LIBTOOL
diff --git a/t/vala-mix.sh b/t/vala-mix.sh
index 7b7403d8c..1ac851e0b 100755
--- a/t/vala-mix.sh
+++ b/t/vala-mix.sh
@@ -21,7 +21,6 @@ required='valac cc pkg-config GNUmake'
cat >> configure.ac <<'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_VALAC([0.7.3])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
AC_OUTPUT
diff --git a/t/vala-non-recursive-setup.sh b/t/vala-non-recursive-setup.sh
index ca65a4f4f..88d9d332a 100755
--- a/t/vala-non-recursive-setup.sh
+++ b/t/vala-non-recursive-setup.sh
@@ -23,7 +23,6 @@ mkdir src
cat >> 'configure.ac' << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_VALAC([0.7.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
AC_OUTPUT
diff --git a/t/vala-per-target-flags.sh b/t/vala-per-target-flags.sh
index 346136508..add07cf33 100755
--- a/t/vala-per-target-flags.sh
+++ b/t/vala-per-target-flags.sh
@@ -23,7 +23,6 @@ mkdir src
cat >> configure.ac <<'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_VALAC([0.7.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
AC_CONFIG_FILES([src/Makefile])
diff --git a/t/vala-recursive-setup.sh b/t/vala-recursive-setup.sh
index 5c1f4c653..cf7980dd2 100755
--- a/t/vala-recursive-setup.sh
+++ b/t/vala-recursive-setup.sh
@@ -23,7 +23,6 @@ mkdir src
cat >> 'configure.ac' << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_VALAC([0.7.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
AC_CONFIG_FILES([src/Makefile])
diff --git a/t/vala-vapi.sh b/t/vala-vapi.sh
index 9def25385..ce5ca9d73 100755
--- a/t/vala-vapi.sh
+++ b/t/vala-vapi.sh
@@ -21,7 +21,6 @@ required='pkg-config valac cc GNUmake'
cat >> configure.ac <<'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AM_PROG_VALAC([0.7.3])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.4])
AC_OUTPUT
diff --git a/t/yacc-dist-nobuild-subdir.sh b/t/yacc-dist-nobuild-subdir.sh
index 7ea252884..8b7f7ff9b 100755
--- a/t/yacc-dist-nobuild-subdir.sh
+++ b/t/yacc-dist-nobuild-subdir.sh
@@ -27,7 +27,6 @@ useless_vpath_rebuild && skip_ "would trip on automake bug#7884"
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_YACC
AC_OUTPUT
END
diff --git a/t/yacc-grepping2.sh b/t/yacc-grepping2.sh
index 9f20798a2..58a963c8c 100755
--- a/t/yacc-grepping2.sh
+++ b/t/yacc-grepping2.sh
@@ -21,7 +21,6 @@
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_YACC
END
diff --git a/t/yacc-line.sh b/t/yacc-line.sh
index ed30c56b3..9067a2d63 100755
--- a/t/yacc-line.sh
+++ b/t/yacc-line.sh
@@ -25,7 +25,6 @@ required='cc yacc'
cat >> configure.ac << 'END'
AC_CONFIG_FILES([sub/Makefile])
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_YACC
AC_OUTPUT
END
diff --git a/t/yacc-subdir.sh b/t/yacc-subdir.sh
index 9db492178..95788ec8a 100755
--- a/t/yacc-subdir.sh
+++ b/t/yacc-subdir.sh
@@ -22,7 +22,6 @@ required='cc yacc'
cat >> configure.ac << 'END'
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_YACC
AC_OUTPUT
END
--
cgit v1.2.1
From 16574dac612eff9e6b6eb1e9c378b840724f93b4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 17:30:32 +0100
Subject: coverage: using multiple lexers in a single program
Using Flex and Automake built-in support for lex, that is possible.
A little tricky, but not difficult.
See:
* t/lex-multiple.sh: New test.
* t/list-of-tests.mk: Add it.
Signed-off-by: Stefano Lattarini
---
t/lex-multiple.sh | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++
t/list-of-tests.mk | 1 +
2 files changed, 108 insertions(+)
create mode 100755 t/lex-multiple.sh
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
new file mode 100755
index 000000000..e1c71a1ab
--- /dev/null
+++ b/t/lex-multiple.sh
@@ -0,0 +1,107 @@
+#! /bin/sh
+# Copyright (C) 2012 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 2, 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 .
+
+# Check that we can build a program using several lexers at once
+# (assuming Flex is used). That is a little tricky, but possible.
+# See:
+#
+#
+
+required='cc flex'
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_PROG_LEX
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zardoz
+
+zardoz_SOURCES = main.c
+# Convenience libraries.
+noinst_LIBRARIES = liblex.a liblex-foo.a liblex-bar.a
+zardoz_LDADD = $(noinst_LIBRARIES)
+
+liblex_a_SOURCES = 0.l
+
+# We need the output to always be named 'lex.yy.c', in order for
+# ylwrap to pick it up.
+liblex_foo_a_LFLAGS = -Pfoo --outfile=lex.yy.c
+liblex_foo_a_SOURCES = a.l
+
+# Ditto.
+liblex_bar_a_LFLAGS = -Pbar_ --outfile=lex.yy.c
+liblex_bar_a_SOURCES = b.l
+END
+
+cat > main.c << 'END'
+#include
+#include
+#include
+
+int main (int argc, char *argv[])
+{
+ if (argc != 2)
+ abort ();
+ else if (!strcmp(argv[1], "--vanilla"))
+ return (yylex () != 121);
+ else if (!strcmp(argv[1], "--foo"))
+ return (foolex () != 121);
+ else if (!strcmp(argv[1], "--bar"))
+ return (bar_lex () != 121);
+ else
+ abort ();
+}
+END
+
+cat > 0.l << 'END'
+%{
+#define YY_NO_UNISTD_H 1
+%}
+%%
+"VANILLA" { printf (":%s:\n", yytext); return 121; }
+. { printf (":%s:\n", yytext); return 1; }
+%%
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+END
+
+sed 's/VANILLA/FOO/' 0.l > a.l
+sed 's/VANILLA/BAR/' 0.l > b.l
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+$MAKE
+
+if ! cross_compiling; then
+ echo VANILLA | ./zardoz --vanilla
+ echo FOO | ./zardoz --foo
+ echo BAR | ./zardoz --bar
+ ./zardoz --vanilla
Date: Sat, 12 Jan 2013 17:38:32 +0100
Subject: docs: typofix in manual
* doc/automake.texi (Yacc and Lex): Here, don't write "automake -i"
where "automake -a" is actually intended. Re-wrap some text while
at it.
Signed-off-by: Stefano Lattarini
---
doc/automake.texi | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/automake.texi b/doc/automake.texi
index a333a1c33..239f9ef3f 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6248,10 +6248,10 @@ rebuild rule for distributed Yacc and Lex sources are only used when
@cindex Multiple @command{lex} lexers
@cindex @command{lex}, multiple lexers
-When @command{lex} or @command{yacc} sources are used, @code{automake
--i} automatically installs an auxiliary program called
-@command{ylwrap} in your package (@pxref{Auxiliary Programs}). This
-program is used by the build rules to rename the output of these
+When @command{lex} or @command{yacc} sources are used, @code{automake -a}
+automatically installs an auxiliary program called @command{ylwrap} in
+your package (@pxref{Auxiliary Programs}).
+This program is used by the build rules to rename the output of these
tools, and makes it possible to include multiple @command{yacc} (or
@command{lex}) source files in a single directory. (This is necessary
because yacc's output file name is fixed, and a parallel make could
--
cgit v1.2.1
From b8d77c81afbbcf314ff21d84643c9189923c55a4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 17:41:58 +0100
Subject: convenience: "make lint" as an alias for "make maintainer-check"
* maintainer/syntax-checks.mk (lint): Here. I'm a lazy typist ...
Signed-off-by: Stefano Lattarini
---
maintainer/syntax-checks.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index 375738be9..6bb7662ac 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -542,3 +542,7 @@ maintainer-check: $(syntax_check_rules)
## Check that the list of tests given in the Makefile is equal to the
## list of all test scripts in the Automake testsuite.
maintainer-check: maintainer-check-list-of-tests
+
+# I'm a lazy typist.
+lint: maintainer-check
+.PHONY: lint
--
cgit v1.2.1
From 52b2af5d14fb180aa39bccc8b22df8d1ff33a664 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 17:52:44 +0100
Subject: ywrap: style fixes (no semantic change intended)
Signed-off-by: Stefano Lattarini
---
lib/ylwrap | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/lib/ylwrap b/lib/ylwrap
index 1c4d77612..13b6a23f8 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -1,7 +1,7 @@
#! /bin/sh
# ylwrap - wrapper for lex/yacc invocations.
-scriptversion=2012-12-21.17; # UTC
+scriptversion=2013-01-12.17; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
#
@@ -40,7 +40,7 @@ get_dirname ()
# guard FILE
# ----------
# The CPP macro used to guard inclusion of FILE.
-guard()
+guard ()
{
printf '%s\n' "$1" \
| sed \
@@ -96,17 +96,17 @@ esac
# The input.
-input="$1"
+input=$1
shift
# We'll later need for a correct munging of "#line" directives.
input_sub_rx=`get_dirname "$input" | quote_for_sed`
-case "$input" in
+case $input in
[\\/]* | ?:[\\/]*)
# Absolute path; do nothing.
;;
*)
# Relative path. Make it absolute.
- input="`pwd`/$input"
+ input=`pwd`/$input
;;
esac
input_rx=`get_dirname "$input" | quote_for_sed`
@@ -132,8 +132,8 @@ sed_fix_filenames=
# guard in its implementation file.
sed_fix_header_guards=
-while test "$#" -ne 0; do
- if test "$1" = "--"; then
+while test $# -ne 0; do
+ if test x"$1" = x"--"; then
shift
break
fi
@@ -153,12 +153,12 @@ while test "$#" -ne 0; do
done
# The program to run.
-prog="$1"
+prog=$1
shift
# Make any relative path in $prog absolute.
-case "$prog" in
+case $prog in
[\\/]* | ?:[\\/]*) ;;
- *[\\/]*) prog="`pwd`/$prog" ;;
+ *[\\/]*) prog=`pwd`/$prog ;;
esac
# FIXME: add hostname here for parallel makes that run commands on
@@ -188,7 +188,7 @@ if test $ret -eq 0; then
# otherwise prepend '../'.
case $to in
[\\/]* | ?:[\\/]*) target=$to;;
- *) target="../$to";;
+ *) target=../$to;;
esac
# Do not overwrite unchanged header files to avoid useless
@@ -197,7 +197,7 @@ if test $ret -eq 0; then
# output of all other files to a temporary file so we can
# compare them to existing versions.
if test $from != $parser; then
- realtarget="$target"
+ realtarget=$target
target=tmp-`printf '%s\n' "$target" | sed 's|.*[\\/]||g'`
fi
--
cgit v1.2.1
From 0dee02df98e29cc6a2d43ba60d6a2b93e715bfc4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 17:53:17 +0100
Subject: ywrap: remove an obsolete FIXME comment
If it were still relevant, somebody would have complained by now.
Signed-off-by: Stefano Lattarini
---
lib/ylwrap | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/ylwrap b/lib/ylwrap
index 13b6a23f8..8f072a8e9 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -161,8 +161,6 @@ case $prog in
*[\\/]*) prog=`pwd`/$prog ;;
esac
-# FIXME: add hostname here for parallel makes that run commands on
-# other machines. But that might take us over the 14-char limit.
dirname=ylwrap$$
do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
--
cgit v1.2.1
From 593032130119da79aba14dc26c3cc985bf3a5610 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 18:42:43 +0100
Subject: plans: update w.r.t. latest changes
Signed-off-by: Stefano Lattarini
---
PLANS/subdir-objects.txt | 37 +++++++++++-----------
.../warnings-for-automake-ng-compatibility.txt | 4 +--
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/PLANS/subdir-objects.txt b/PLANS/subdir-objects.txt
index e3aec6be8..e4e6e25ad 100644
--- a/PLANS/subdir-objects.txt
+++ b/PLANS/subdir-objects.txt
@@ -24,33 +24,28 @@ Alas, since this also means changing the default behaviour of Automake
('subdir-objects' is not enabled by default, sadly), this means the
transition path will be less smooth than I'd like.
-For automake 1.13.2 (ASAP)
---------------------------
+DONE for automake 1.13.2
+------------------------
-Fix the bug spotted by Nick Bowler:
+The bug spotted by Nick Bowler:
-and exposed in test case 't/ccnoco4.sh': currently, Automake-generated
-C compilation rules mistakenly pass the "-c -o" options combination
-unconditionally (even to losing compiler) when the 'subdir-objects' is
-used but sources are only present in the top-level directory.
+and exposed in test case 't/ccnoco4.sh' has been fixed (see commit
+v1.13.1-56-g34001a9). The bug was due to the fact that Automake-generated
+C compilation rules mistakenly passed the "-c -o" options combination
+unconditionally (even to losing compiler) when the 'subdir-objects' was
+used but sources were only present in the top-level directory.
-For automake 1.13.2 (with more ease)
-------------------------------------
+TODO for automake 1.13.2
+------------------------
Give a warning in the category 'unsupported' if the 'subdir-objects'
option is not specified. This should give the users enough forewarning
about the planned change, and give them time to update their packages
to the new semantic.
-This warning, when there are C sources in subdirs, should also mention the
-need to use AM_PROG_CC_C_O in configure.ac (thanks to Peter Breitenlohner
-for suggesting this). This is not strictly required, but will make
-things a little simpler for the users, by giving a more complete feedback:
-
-
Be sure to avoid the warning when it would be irrelevant, i.e., if all
source files sit in "current" directory (thanks to Peter Johansson for
suggesting this).
@@ -58,10 +53,14 @@ suggesting this).
For automake 1.14
-----------------
-Flip the 'subdir-object' option on by default. At the same time,
-drop support for the "old" behaviour of having object files derived
-from sources in a subdirectory being placed in the current directory
-rather than in that same subdirectory.
+Remove the copy & paste of Autoconf internals in our AC_PROG_CC rewrite
+See the first patch in the series:
+
+
+Make the behaviour once activated by the 'subdir-object' option mandatory.
+With that change, we'll drop support for the "old" behaviour of having
+object files derived from sources in a subdirectory being placed in the
+current directory rather than in that same subdirectory.
Still keep the 'subdir-object' option supported (as a simple no-op
now), to save useless churn in our user's build systems.
diff --git a/PLANS/texi/warnings-for-automake-ng-compatibility.txt b/PLANS/texi/warnings-for-automake-ng-compatibility.txt
index 1dd3da336..aca46b4a2 100644
--- a/PLANS/texi/warnings-for-automake-ng-compatibility.txt
+++ b/PLANS/texi/warnings-for-automake-ng-compatibility.txt
@@ -1,5 +1,5 @@
-For automake 1.13.2:
---------------------
+Done in automake 1.13.2:
+------------------------
I have discouraged the use of '.txi' and '.texinfo' suffixes for
Texinfo inputs (see commit 'v1.13.1-6-ge1ed314') and the generation
--
cgit v1.2.1
From 4864af66bfd189a501061d775bb9743a1285d88e Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 13 Jan 2013 17:50:30 +0100
Subject: subdir-objects: complain if it isn't enabled
Since the next major automake version will make the behaviour so far
only activated with the 'subdir-object' option mandatory, it's better
if we start warning users not using that option.
As suggested by Peter Johansson, we strive to avoid the warning when
it would be irrelevant, i.e., if all source files sit in "current"
directory.
See automake bug#13378.
* automake.in (handle_single_transform): Print the warning when
necessary.
* t/subobj.sh: Enhance.
* t/ax/depcomp.sh: Adjust.
* t/cscope.tap: Likewise.
* t/depcomp8a.sh: Likewise.
* t/depcomp8b.sh: Likewise.
* t/ext2.sh: Likewise.
* t/extra-portability.sh: Likewise.
* t/fort2.sh: Likewise.
* t/fort4.sh: Likewise.
* t/fort5.sh: Likewise.
* t/lex-line.sh: Likewise.
* t/libtool3.sh: Likewise.
* t/ltinstloc.sh: Likewise.
* t/ltlibsrc.sh: Likewise.
* t/ltorder.sh: Likewise.
* t/parallel-tests-suffix-prog.sh: Likewise.
* t/sourcefile-in-subdir.sh: Likewise.
* t/specflg9.sh: Likewise.
* t/subobj4.sh: Likewise.
* t/subobj7.sh: Likewise.
* t/subpkg-yacc.sh: Likewise.
* t/subpkg.sh: Likewise.
* t/suffix-custom-subobj-and-specflg.sh: Likewise.
* t/vala-libs.sh: Likewise.
* t/vala-non-recursive-setup.sh: Likewise.
* t/yacc-grepping2.sh: Likewise.
* t/yacc-line.sh: Likewise.
---
automake.in | 31 ++++++++++++++++--
t/ax/depcomp.sh | 9 +++---
t/cscope.tap | 6 ++--
t/depcomp8a.sh | 4 ++-
t/depcomp8b.sh | 9 ++++--
t/ext2.sh | 1 +
t/extra-portability.sh | 2 +-
t/fort2.sh | 58 +++++++++++++++++++++++++--------
t/fort4.sh | 2 +-
t/fort5.sh | 4 ++-
t/lex-line.sh | 4 ++-
t/libtool3.sh | 4 +++
t/ltinstloc.sh | 1 +
t/ltlibsrc.sh | 2 ++
t/ltorder.sh | 1 +
t/parallel-tests-suffix-prog.sh | 1 +
t/sourcefile-in-subdir.sh | 2 +-
t/specflg9.sh | 1 +
t/subobj.sh | 61 +++++++++++++++++++++++++++++++----
t/subobj4.sh | 2 +-
t/subobj7.sh | 1 +
t/subpkg-yacc.sh | 2 +-
t/subpkg.sh | 2 +-
t/suffix-custom-subobj-and-specflg.sh | 11 +------
t/vala-libs.sh | 3 +-
t/vala-non-recursive-setup.sh | 1 +
t/yacc-grepping2.sh | 10 +++---
t/yacc-line.sh | 4 ++-
28 files changed, 183 insertions(+), 56 deletions(-)
diff --git a/automake.in b/automake.in
index 990b60d60..0e3b882b8 100644
--- a/automake.in
+++ b/automake.in
@@ -1793,9 +1793,36 @@ sub handle_single_transform ($$$$$%)
# If rewrite said it was ok, put the object into a
# subdir.
- if ($r == LANG_SUBDIR && $directory ne '')
+ if ($directory ne '')
{
- $object = $directory . '/' . $object;
+ if ($r == LANG_SUBDIR)
+ {
+ $object = $directory . '/' . $object;
+ }
+ else
+ {
+ # Since the next major version of automake (1.14) will
+ # make the behaviour so far only activated with the
+ # 'subdir-object' option mandatory, it's better if we
+ # start warning users not using that option.
+ # As suggested by Peter Johansson, we strive to avoid
+ # the warning when it would be irrelevant, i.e., if
+ # all source files sit in "current" directory.
+ msg_var 'unsupported', $var,
+ "source file '$full' is in a subdirectory,"
+ . "\nbut option 'subdir-objects' is disabled";
+ msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL;
+possible forward-incompatibility.
+At least a source file is in a subdirectory, but the 'subdir-objects'
+automake option hasn't been enabled. For now, the corresponding output
+object file(s) will be placed in the top-level directory. However,
+this behaviour will change in future Automake versions: they will
+unconditionally cause object files to be placed in the same subdirectory
+of the corresponding sources.
+You are advised to start using 'subdir-objects' option throughout your
+project, to avoid future incompatibilities.
+EOF
+ }
}
# If the object file has been renamed (because per-target
diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index 0e5b6a521..1534d5f8e 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -130,7 +130,7 @@ check_distclean ()
cat > configure.ac < src/Makefile.am <> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
+cat > configure.ac << 'END'
+AC_INIT([cscope-test], [1.0])
+AM_INIT_AUTOMAKE([subdir-objects])
+AC_CONFIG_FILES([Makefile sub/Makefile])
AC_SUBST([CC], [who-cares])
AC_SUBST([CXX], [who-cares])
AC_SUBST([FC], [who-cares])
diff --git a/t/depcomp8a.sh b/t/depcomp8a.sh
index 76aa37694..d6c73edb7 100755
--- a/t/depcomp8a.sh
+++ b/t/depcomp8a.sh
@@ -48,7 +48,9 @@ int bar (void)
END
$ACLOCAL
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
grep include Makefile.in # For debugging.
grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh
index 52382f14a..879ee1c0d 100755
--- a/t/depcomp8b.sh
+++ b/t/depcomp8b.sh
@@ -31,6 +31,9 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
+## FIXME: stop disabling the warnings in the 'unsupported' category
+## FIXME: once the 'subdir-objects' option has been mandatory.
+AUTOMAKE_OPTIONS = -Wno-unsupported
lib_LTLIBRARIES = libzardoz.la
libzardoz_la_SOURCES = foo.c sub/bar.c
END
@@ -42,7 +45,9 @@ echo 'int bar (void) { return 0; }' > sub/bar.c
libtoolize
$ACLOCAL
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
grep include Makefile.in # For debugging.
grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
@@ -56,7 +61,7 @@ DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
# Try again with subdir-objects option.
-echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
+echo AUTOMAKE_OPTIONS += subdir-objects >> Makefile.am
$AUTOMAKE
grep include Makefile.in # For debugging.
diff --git a/t/ext2.sh b/t/ext2.sh
index 108908058..4858aec66 100755
--- a/t/ext2.sh
+++ b/t/ext2.sh
@@ -25,6 +25,7 @@ AC_PROG_CXX
EOF
cat >Makefile.am <Makefile.am <Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+FC = fake-fc
bin_PROGRAMS = hello goodbye
-hello_SOURCES = hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 sub/bonjour.f08
+hello_SOURCES = hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 \
+ greets.f08 sub/bonjour.f08
goodbye_SOURCES = bye.f95 sub/baz.f90
-goodbye_FCFLAGS =
+goodbye_FCFLAGS = --gby
END
$ACLOCAL
$AUTOMAKE
-# The following tests aren't fool-proof, but they don't
-# need a Fortran compiler.
grep '.\$(LINK)' Makefile.in && exit 1
grep '.\$(FCLINK)' Makefile.in
grep '.\$(FCCOMPILE)' Makefile.in > stdout
cat stdout
grep -v '\$(FCFLAGS_f' stdout && exit 1
grep '.\$(FC.*\$(FCFLAGS_blabla' Makefile.in && exit 1
-# Notice the TAB:
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f90' Makefile.in
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f95).*\.f95' Makefile.in
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f03).*\.f03' Makefile.in
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f08).*\.f08' Makefile.in
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f95' Makefile.in && exit 1
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f95).*\.f90' Makefile.in && exit 1
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f90).*\.f03' Makefile.in && exit 1
-grep '^[ ].*\$(FC.*\$(FCFLAGS_f08).*\.f90' Makefile.in && exit 1
+
+sed '/^AC_FC_SRCEXT.*blabla/d' configure.ac >t
+mv -f t configure.ac
+
+rm -rf autom4te*.cache
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+touch hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 \
+ sub/bonjour.f08 bye.f95 sub/baz.f90
+
+$MAKE -n \
+ FCFLAGS_f90=--@90 FCFLAGS_f95=--@95 FCFLAGS_f03=--@03 FCFLAGS_f08=--@08 \
+ > stdout || { cat stdout; exit 1; }
+cat stdout
+# To make it easier to have stricter grepping below.
+sed -e 's/[ ][ ]*/ /g' -e 's/^/ /' -e 's/$/ /' stdout > out
+cat out
+
+grep ' fake-fc .* --@90 .* hello\.f90 ' out
+grep ' fake-fc .* --@95 .* foo\.f95 ' out
+grep ' fake-fc .* --@95 .* sub/bar\.f95 ' out
+grep ' fake-fc .* --@03 .* hi\.f03 ' out
+grep ' fake-fc .* --@03 .* sub/howdy\.f03 ' out
+grep ' fake-fc .* --@08 .* greets\.f08 ' out
+grep ' fake-fc .* --@08 .* sub/bonjour\.f08 ' out
+grep ' fake-fc .* --gby .* --@95 .*[` ]bye\.f95 ' out
+grep ' fake-fc .* --gby .* --@90 .*[` ]sub/baz\.f90 ' out
+
+test $(grep -c '.*--gby.*\.f' out) -eq 2
+
+$EGREP 'fake-fc.*--@(95|03|08).*\.f90' out && exit 1
+$EGREP 'fake-fc.*--@(90|03|08).*\.f95' out && exit 1
+$EGREP 'fake-fc.*--@(90|95|08).*\.f03' out && exit 1
+$EGREP 'fake-fc.*--@(95|95|03).*\.f08' out && exit 1
:
diff --git a/t/fort4.sh b/t/fort4.sh
index 822edb8c8..2ef27abeb 100755
--- a/t/fort4.sh
+++ b/t/fort4.sh
@@ -65,7 +65,7 @@ LDADD = $(FCLIBS)
END
$ACLOCAL
-$AUTOMAKE -a
+$AUTOMAKE -a -Wno-unsupported
# The Fortran 77 linker should be preferred:
grep '.\$(FCLINK)' Makefile.in && exit 1
diff --git a/t/fort5.sh b/t/fort5.sh
index 02727061d..7b9991b96 100755
--- a/t/fort5.sh
+++ b/t/fort5.sh
@@ -75,7 +75,9 @@ END
libtoolize --force
$ACLOCAL
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
$AUTOCONF
# This test requires Libtool >= 2.0. Earlier Libtool does not
diff --git a/t/lex-line.sh b/t/lex-line.sh
index 9b27c0b39..258f6af56 100755
--- a/t/lex-line.sh
+++ b/t/lex-line.sh
@@ -86,7 +86,9 @@ c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
for vpath in : false; do
diff --git a/t/libtool3.sh b/t/libtool3.sh
index fb8c194ed..5653280e6 100755
--- a/t/libtool3.sh
+++ b/t/libtool3.sh
@@ -28,6 +28,10 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+AUTOMAKE_OPTIONS = -Wno-unsupported
+
lib_LTLIBRARIES = lib0.la liba/liba.la
lib0_la_SOURCES = 0.c
liba_liba_la_SOURCES = liba/a.c
diff --git a/t/ltinstloc.sh b/t/ltinstloc.sh
index b9670cbac..bae3d49df 100755
--- a/t/ltinstloc.sh
+++ b/t/ltinstloc.sh
@@ -35,6 +35,7 @@ lib_LTLIBRARIES = liba1.la sub/liba2.la
pkglib_LTLIBRARIES = liba1.la
nobase_lib_LTLIBRARIES = sub/liba2.la
endif
+AUTOMAKE_OPTIONS = subdir-objects
END
libtoolize
diff --git a/t/ltlibsrc.sh b/t/ltlibsrc.sh
index e58bba716..8c8098bdb 100755
--- a/t/ltlibsrc.sh
+++ b/t/ltlibsrc.sh
@@ -35,6 +35,8 @@ noinst_LTLIBRARIES = foo.la zoo.d/old2.la
$(srcdir)/zoo_d_old2_la.c: $(srcdir)/old_la.c
cp $(srcdir)/old_la.c $@
+
+AUTOMAKE_OPTIONS = -Wno-unsupported
END
cat > foo.c << 'END'
diff --git a/t/ltorder.sh b/t/ltorder.sh
index fe9d7bda2..c243ac78b 100755
--- a/t/ltorder.sh
+++ b/t/ltorder.sh
@@ -27,6 +27,7 @@ AC_OUTPUT
END
cat >Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
nobase_lib_LTLIBRARIES = liba1.la sub/liba2.la sub/liba3.la liba4.la liba5.la
sub_liba2_la_LIBADD = liba1.la
sub_liba3_la_LIBADD = sub/liba2.la
diff --git a/t/parallel-tests-suffix-prog.sh b/t/parallel-tests-suffix-prog.sh
index 64f103c70..7b924a33b 100755
--- a/t/parallel-tests-suffix-prog.sh
+++ b/t/parallel-tests-suffix-prog.sh
@@ -27,6 +27,7 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
## Note that automake should not match the '/test' part of 'sub/test' as
## '.test' suffix, nor the '/chk' part of 'sub/chk' as '.chk' suffix.
TESTS = $(dist_TESTS) $(check_PROGRAMS)
diff --git a/t/sourcefile-in-subdir.sh b/t/sourcefile-in-subdir.sh
index a01077617..1054f18aa 100755
--- a/t/sourcefile-in-subdir.sh
+++ b/t/sourcefile-in-subdir.sh
@@ -29,7 +29,7 @@ AC_PROG_CC
END
$ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-unsupported
grep '^z\.o: x/z\.c$' Makefile.in
diff --git a/t/specflg9.sh b/t/specflg9.sh
index 3e0c69484..4f3d3b0c2 100755
--- a/t/specflg9.sh
+++ b/t/specflg9.sh
@@ -24,6 +24,7 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = zzfoo zzbar
zzfoo_SOURCES = sub/foo.c
zzbar_SOURCES = bar.c
diff --git a/t/subobj.sh b/t/subobj.sh
index d16512abc..22ab2d30d 100755
--- a/t/subobj.sh
+++ b/t/subobj.sh
@@ -14,19 +14,63 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Test of subdir objects with C.
+# Test of subdir objects with C and C++.
. test-init.sh
-echo AC_PROG_CC >> configure.ac
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_YACC
+AC_CONFIG_FILES([sub/Makefile])
+END
+
+$ACLOCAL
+: > ylwrap
cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
+SUBDIRS = sub
bin_PROGRAMS = wish
-wish_SOURCES = generic/a.c generic/b.c
+wish_SOURCES = generic/a.c
+wish_SOURCES += another/z.cxx
END
-$ACLOCAL
+mkdir sub
+cat > sub/Makefile.am << 'END'
+dream_SOURCES = generic/b.c more/r.y
+bin_PROGRAMS = dream
+END
+
+AUTOMAKE_fails
+grep "^Makefile\.am:3:.*'generic/a\.c'.* in a subdirectory" stderr
+grep "^Makefile\.am:[34]:.*'another/z\.cxx'.* in a subdirectory" stderr
+grep "^sub/Makefile\.am:1:.*'generic/b\.c'.* in a subdirectory" stderr
+grep "option 'subdir-objects' is disabled" stderr
+# Verbose tips should be given, but not too many times.
+for msg in \
+ "possible forward-incompatibility" \
+ "advi[sc]e.* 'subdir-objects' option throughout" \
+ "unconditionally.* object file.* same subdirectory" \
+; do
+ test $(grep -c "$msg" stderr) -eq 1
+done
+
+# Guard against stupid typos.
+grep 'subdir-object([^s]|$)' stderr && exit 1
+
+$AUTOMAKE -Wno-unsupported
+
+echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
+AUTOMAKE_fails
+grep "^Makefile\.am" stderr && exit 1
+grep "^sub/Makefile\.am:.*'generic/b\.c'.* in a subdirectory" stderr
+grep "option 'subdir-objects' is disabled" stderr
+
+sed 's/^AM_INIT_AUTOMAKE/&([subdir-objects])/' configure.ac > configure.tmp
+mv -f configure.tmp configure.ac
+$ACLOCAL --force
+$AUTOMAKE
+
rm -f compile
$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; exit 1; }
cat stderr >&2
@@ -35,9 +79,12 @@ grep '^configure\.ac:4:.*install.*compile' stderr
test -f compile
grep '^generic/a\.\$(OBJEXT):' Makefile.in
-grep '[^/]a\.\$(OBJEXT)' Makefile.in && exit 1
+grep '^generic/b\.\$(OBJEXT):' sub/Makefile.in
+grep '^another/z\.\$(OBJEXT):' Makefile.in
+$EGREP '(^|[^/])[abz]\.\$(OBJEXT)' Makefile.in sub/Makefile.in && exit 1
# Opportunistically test for a different bug.
-grep '^generic/b\.\$(OBJEXT):.*dirstamp' Makefile.in
+grep '^another/z\.\$(OBJEXT):.*dirstamp' Makefile.in
+grep '^generic/b\.\$(OBJEXT):.*dirstamp' sub/Makefile.in
:
diff --git a/t/subobj4.sh b/t/subobj4.sh
index 816f50668..dbbed30be 100755
--- a/t/subobj4.sh
+++ b/t/subobj4.sh
@@ -43,7 +43,7 @@ END
: > d2/z.c
$ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-unsupported
grep '\$(CC) .*\.\./d2/z\.c' d1/Makefile.in
diff --git a/t/subobj7.sh b/t/subobj7.sh
index 5dc9ea861..de73cc2dc 100755
--- a/t/subobj7.sh
+++ b/t/subobj7.sh
@@ -25,6 +25,7 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = wish
wish_SOURCES = foo.c generic/a.c
END
diff --git a/t/subpkg-yacc.sh b/t/subpkg-yacc.sh
index 639e4156c..9fc676190 100755
--- a/t/subpkg-yacc.sh
+++ b/t/subpkg-yacc.sh
@@ -49,7 +49,7 @@ mkdir lib/src
cat >lib/configure.ac <<'EOF'
AC_INIT([lib], [2.3])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_RANLIB
AC_PROG_YACC
dnl This comes after YACC and RANLIB checks, deliberately.
diff --git a/t/subpkg.sh b/t/subpkg.sh
index 6f59ac58d..f9cdc74e2 100755
--- a/t/subpkg.sh
+++ b/t/subpkg.sh
@@ -62,7 +62,7 @@ mkdir lib/src
cat >lib/configure.ac <<'EOF'
AC_INIT([lib], [2.3])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([../m4])
AM_PROG_AR
AC_PROG_RANLIB
diff --git a/t/suffix-custom-subobj-and-specflg.sh b/t/suffix-custom-subobj-and-specflg.sh
index 32356d7b3..b862d8825 100755
--- a/t/suffix-custom-subobj-and-specflg.sh
+++ b/t/suffix-custom-subobj-and-specflg.sh
@@ -53,18 +53,9 @@ END
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
-./configure
-$MAKE
-
-$MAKE distcheck
-$MAKE distclean
-
-# Should also work without subdir-objects.
-sed '/subdir-objects/d' < Makefile.am > t
-mv -f t Makefile.am
-$AUTOMAKE
./configure
+
$MAKE
$MAKE distcheck
diff --git a/t/vala-libs.sh b/t/vala-libs.sh
index 66fd2436a..f1ed99ab2 100755
--- a/t/vala-libs.sh
+++ b/t/vala-libs.sh
@@ -31,6 +31,7 @@ AC_OUTPUT
END
cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
lib_LIBRARIES = libmu.a
lib_LTLIBRARIES = src/libzardoz.la
libmu_a_SOURCES = mu.vala mu2.c mu.vapi mu2.h
@@ -75,7 +76,7 @@ int main ()
}
END
-mkdir src
+mkdir -p src
cat > src/zardoz-foo.vala << 'END'
using GLib;
public class Foo {
diff --git a/t/vala-non-recursive-setup.sh b/t/vala-non-recursive-setup.sh
index 88d9d332a..88f67a879 100755
--- a/t/vala-non-recursive-setup.sh
+++ b/t/vala-non-recursive-setup.sh
@@ -39,6 +39,7 @@ public class Zardoz {
END
cat > 'Makefile.am' <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = src/zardoz
src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
src_zardoz_LDADD = $(GOBJECT_LIBS)
diff --git a/t/yacc-grepping2.sh b/t/yacc-grepping2.sh
index 58a963c8c..3c5da2255 100755
--- a/t/yacc-grepping2.sh
+++ b/t/yacc-grepping2.sh
@@ -34,7 +34,9 @@ mkdir sub
: > sub/maude.y
$ACLOCAL
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
grep '^maude\.c:.*maude\.y' Makefile.in
@@ -47,7 +49,6 @@ bin_PROGRAMS = maude
maude_SOURCES = sub/maude.y
END
-$ACLOCAL
$AUTOMAKE -a
# No rule needed, the default .y.c: inference rule is enough
@@ -64,8 +65,9 @@ maude_SOURCES = sub/maude.y
maude_YFLAGS = -d
END
-$ACLOCAL
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
# Rule should use maude_YFLAGS.
grep 'AM_YFLAGS.*maude' Makefile.in && exit 1
diff --git a/t/yacc-line.sh b/t/yacc-line.sh
index 9067a2d63..b034af36e 100755
--- a/t/yacc-line.sh
+++ b/t/yacc-line.sh
@@ -76,7 +76,9 @@ c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -a
+# FIXME: stop disabling the warnings in the 'unsupported' category
+# FIXME: once the 'subdir-objects' option has been mandatory.
+$AUTOMAKE -a -Wno-unsupported
for vpath in : false; do
--
cgit v1.2.1
From f78b0f0b2741fcdd4e21151758a8a75ddaa8aa17 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 12 Jan 2013 19:20:54 +0100
Subject: init.m4: add probe to check "rm -f" without args work
See automake bug#10828.
POSIX will say in a future version that running "rm -f" with no argument
is OK: ).
We want to be able to make that assumption in our Makefile recipes.
So we introduce an aggressive probe to check that the usage we want is
actually supported "in the wild" to an acceptable degree.
* m4/init.m4 (AM_INIT_AUTOMAKE): Implement the probe. To make any issue
more visible, cause the running configure to be aborted by default if
the 'rm' program in use doesn't match our expectations; the user can
still override this though, by setting the ACCEPT_INFERIOR_RM_PROGRAM
environment variable to "yes".
* t/spy-rm.tap: Update heading comments.
* t/rm-f-probe.sh: New test.
* t/list-of-tests.mk: Add it.
* PLANS/rm-f-without-args.txt: Adjust.
Signed-off-by: Stefano Lattarini
---
PLANS/rm-f-without-args.txt | 8 ++---
m4/init.m4 | 43 +++++++++++++++++++++++++-
t/list-of-tests.mk | 1 +
t/rm-f-probe.sh | 74 +++++++++++++++++++++++++++++++++++++++++++++
t/spy-rm.tap | 8 ++---
5 files changed, 125 insertions(+), 9 deletions(-)
create mode 100755 t/rm-f-probe.sh
diff --git a/PLANS/rm-f-without-args.txt b/PLANS/rm-f-without-args.txt
index 5d39e220d..5362f98e6 100644
--- a/PLANS/rm-f-without-args.txt
+++ b/PLANS/rm-f-without-args.txt
@@ -13,13 +13,13 @@ accordingly, to get rid of the awful idiom:
See automake bug#10828.
-For Automake 1.13.2 (or 1.13.3)
--------------------------------
+For Automake 1.13.2 (DONE)
+--------------------------
Add a temporary "probe check" in AM_INIT_AUTOMAKE that verifies that
the no-args "rm -f" usage is supported on the system configure is
-being run on; complain loudly (but not with a fatal error) if this is
-not the case, and tell the user to report the situation to us.
+being run on; complain loudly if this is not the case, and tell the
+user to report the situation to us.
For Automake 1.14
-----------------
diff --git a/m4/init.m4 b/m4/init.m4
index c5af65cce..ce64a6ccf 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -117,7 +117,48 @@ dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
+
+# POSIX will say in a future version that running "rm -f" with no argument
+# is OK; and we want to be able to make that assumption in our Makefile
+# recipes. So use an aggressive probe to check that the usage we want is
+# actually supported "in the wild" to an acceptable degree.
+# See automake bug#10828.
+# To make any issue more visible, cause the running configure to be aborted
+# by default if the 'rm' program in use doesn't match our expectations; the
+# user can still override this though.
+if rm -f && rm -fr && rm -rf; then : OK; else
+ cat >&2 <<'END'
+Oops!
+
+Your 'rm' program seems unable to run without file operands specified
+on the command line, even when the '-f' option is present. This is contrary
+to the behaviour of most rm programs out there, and not conforming with
+the upcoming POSIX standard:
+
+Please tell bug-automake@gnu.org about your system, including the value
+of your $PATH and any error possibly output before this message. This
+can help us improve future automake versions.
+
+END
+ if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
+ echo 'Configuration will proceed anyway, since you have set the' >&2
+ echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
+ echo >&2
+ else
+ cat >&2 <<'END'
+Aborting the configuration process, to ensure you take notice of the issue.
+
+You can download and install GNU coreutils to get an 'rm' implementation
+that behaves properly: .
+
+If you want to complete the configuration process using your problematic
+'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
+to "yes", and re-run configure.
+
+END
+ AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
+ fi
+fi])
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 44f598ed2..0f5dbee01 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -953,6 +953,7 @@ t/remake-macrodir.sh \
t/remake-timing-bug-pr8365.sh \
t/reqd2.sh \
t/repeated-options.sh \
+t/rm-f-probe.sh \
t/rulepat.sh \
t/self-check-cc-no-c-o.sh \
t/self-check-configure-help.sh \
diff --git a/t/rm-f-probe.sh b/t/rm-f-probe.sh
new file mode 100755
index 000000000..1cb220aa0
--- /dev/null
+++ b/t/rm-f-probe.sh
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Verify our probe that checks that "rm -f" doesn't complain if called
+# without file operands works as expected. See automake bug#10828.
+
+. test-init.sh
+
+echo AC_OUTPUT >> configure.ac
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir bin
+cat > bin/rm <<'END'
+#!/bin/sh
+set -e; set -u;
+PATH=$original_PATH; export PATH
+rm_opts=
+while test $# -gt 0; do
+ case $1 in
+ -*) rm_opts="$rm_opts $1";;
+ *) break;;
+ esac
+ shift
+done
+if test $# -eq 0; then
+ echo "Oops, fake rm called without arguments" >&2
+ exit 1
+else
+ exec rm $rm_opts "$@"
+fi
+END
+chmod a+x bin/rm
+
+original_PATH=$PATH
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
+export PATH original_PATH
+
+rm -f && exit 99 # Sanity check.
+
+./configure 2>stderr && { cat stderr >&2; exit 1; }
+cat stderr >&2
+
+grep "'rm' program.* unable to run without file operands" stderr
+$FGREP "tell bug-automake@gnu.org about your system" stderr
+$FGREP "install GNU coreutils" stderr
+$EGREP "(^| |')ACCEPT_INFERIOR_RM_PROGRAM($| |')" stderr
+
+ACCEPT_INFERIOR_RM_PROGRAM=yes; export ACCEPT_INFERIOR_RM_PROGRAM
+
+./configure
+$MAKE
+$MAKE distcheck
+
+# For the sake of our exit trap.
+PATH=$original_PATH; export PATH
+
+:
diff --git a/t/spy-rm.tap b/t/spy-rm.tap
index 29840abf4..3b8dd2d10 100755
--- a/t/spy-rm.tap
+++ b/t/spy-rm.tap
@@ -19,10 +19,10 @@
# to hold on all non-museum systems, and will soon be mandated
# by POSIX as well) in future version of automake, to simplify
# automake-provided cleanup rules.
-# References:
-#
-#
-#
+# See automake bug#10828.
+# Other references:
+#
+#
am_create_testdir=empty
. test-init.sh
--
cgit v1.2.1
From a787b9caa6b6970e48e3a2f512077446386fc838 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 18 Jan 2013 11:22:01 +0100
Subject: plans: we are not going to remove AM_PROG_MKDIR_P in Automake 1.14
See commit v1.13.1-109-g030ecb4 of 2013-01-16, "compat: restore
AM_PROG_MKDIR, again", for the rationale; that rationale is now
also copied...
* PLANS/obsolete-removed/am-prog-mkdir-p.txt: ... here.
Signed-off-by: Stefano Lattarini
---
PLANS/obsolete-removed/am-prog-mkdir-p.txt | 85 ++++++++++++++----------------
1 file changed, 41 insertions(+), 44 deletions(-)
diff --git a/PLANS/obsolete-removed/am-prog-mkdir-p.txt b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
index b096ecece..d5b769553 100644
--- a/PLANS/obsolete-removed/am-prog-mkdir-p.txt
+++ b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
@@ -1,8 +1,10 @@
-In Automake 1.13.x
-------------------
+The macro AM_PROG_MKDIR_P is no longer going to be removed in Automake 1.14
+(and in fact, any plan to remove it "evenatually" has been dropped as well).
-We had already scheduled the removal of the long-deprecated AM_PROG_MKDR_P
-macro (superseded by the autoconf-provided one AC_PROG_MKDIR_P) for
+Let's see a bit of history to understand why.
+
+I had already scheduled the removal of the long-deprecated AM_PROG_MKDR_P
+macro (superseded by the Autoconf-provided one AC_PROG_MKDIR_P) for
Automake 1.13 -- see commit 'v1.12-20-g8a1c64f'.
Alas, it turned out the latest Gettext version at the time (0.18.1.1) was
@@ -10,58 +12,53 @@ still using that macro:
-And since the maintenance of Gettext was stalled, we couldn't get a fix
-committed and released in time for the appearance of automake 1.13:
+And since the maintenance of Gettext was stalled, I couldn't get a fix
+committed and released in time for the appearance of Automake 1.13:
-So, on a strong advice by Jim Meyering, in commit 'v1.12.4-158-gdf23daf'
-we re-introduced AM_PROG_MKDIR_P in Automake. That has been an
-unfortunate necessity (thanks to Jim for having convinced me of that in
-time!)
-
-
-For Automake 1.14
------------------
+So, on strong advice by Jim Meyering, in commit 'v1.12.4-158-gdf23daf'
+I re-introduced AM_PROG_MKDIR_P in Automake (thanks to Jim for having
+convinced me to do so in time!)
-Finally, AM_PROG_MKDR_P we'll be fully obsolete in in Automake 1.14 (see
-commit 'v1.12.4-174-g5a28948', merged in master by 'v1.13-5-gb373ad9'),
-while still offering a clear error message for the moment (see follow-up
-commit 'v1.13-30-gd01834b').
+But then, Gettext (as said, the greatest "offender" in the use of
+AM_PROG_MKDIR_P), in its latest release 0.18.2, finally removed all the
+uses of that macro still present in its code base. Yay. So I thought
+we could finally and quite safely remove AM_PROG_MKDIR_P in Automake 1.14;
+and I proceeded to do so, see commit 'v1.13-30-gd01834b' and the merge
+commit 'v1.13-5-gb373ad9'. Well, it turned out I was wrong, again, and
+in a trickier and sublter way this time. Let's see the details.
-We can finally do so because Gettext has got a maintainer in the meantime,
-and a new release has been made that no longer uses AM_PROG_MKDIR_P:
+If a package's 'configure.ac' contains a call like:
-
+ AM_GNU_GETTEXT_VERSION([0.18])
-We still keep the obsolete '@mkdir_p@' substitution and '$(mkdir_p)'
-variable around though, since they are still used by 'Makefile.in.in'
-template from gettext:
+then the 'autopoint' script will bring the data files from the Gettext
+release *1.18* into the package's tree -- yes, even even if the developer
+has installed *and is using* Gettext 1.18.2! Now, these data files
+comprise m4 files (that will be seen by subsequent aclocal and autoconf
+calls), and of course, the pre-0.18.2 version of some of these files
+still contains occurrences of AM_PROG_MKDIR_P -- so Automake 1.13 errors
+out, and we lose. That already happened in practice:
- $ cd ~/src/gettext
- $ git checkout master
- $ git describe
- v0.18.2-4-g3188bbf
- $ grep mkdir_p gettext-runtime/po/Makefile.in.in | grep -v '^#'
- mkdir_p = @mkdir_p@
- $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
- $(mkdir_p) $(DESTDIR)$$dir; \
- $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
- $(mkdir_p) $(DESTDIR)$$dir; \
+
-(see also Automake commit v1.12.1-112-g2551021).
+Moreover, while I might see it as not unreasonable to ask a developer
+using Automake 1.14 to also update Gettext to 1.18.2, that would not
+be enough; in order for gettext to use the correct data files, that
+developer would have to update his configure.ac to read:
-More to the point, it's almost impossible to diagnose usages of those
-macro and substitution using the existing Automake parsing and warning
-infrastructure; it's much easier to just keep them around for a while.
+ AM_GNU_GETTEXT_VERSION([0.18.2])
+thus requiring *all* of his co-developers to install Gettext 1.18.2,
+even if they are still using, say, Automake 1.13. Bad.
-The future
-----------
+So I decided to re-instate this macro as a simple alias for AC_PROG_MKDIR_P
+(plus a non-fatal runtime warning in the 'obsolete' category), and drop
+any plan to remove it (see how much good those plans have done us so far).
+See commit v1.13.1-109-g030ecb4.
-We want to finally remove '@mkdir_p@' and '$(mkdir_p)' as well some
-day. It would be nice if we could do so with some kind of deprecation,
-but that is not worth too much work. Anyway, no hurry an no high
-priority for this removal.
+Similarly, the obsolete '@mkdir_p@' substitution and '$(mkdir_p)' make
+variable are still supported, as simple aliases to '$(MKDIR_P)'.
--
cgit v1.2.1
From f479a4a3da2fae6c257dbc3dd65860f830532418 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Mon, 21 Jan 2013 15:24:03 +0100
Subject: maint: bump version 1.13.1a -> 1.13.2a
The 1.13.2 bug-fixing release will ship from the 'branch-1.13.2' git
branch, not from the 'maint' one, since the latter contains changes
that are non-trivial and hasn't cooked enough yet. The 'maint' branch
will give rise to the 1.13.3 release instead, eventually. Adjust the
version number to match.
* configure.ac (AC_INIT): Bump version number to 1.13.2b.
* m4/amversion.m4: Likewise (auto-updated by "make bootstrap").
Signed-off-by: Stefano Lattarini
---
configure.ac | 2 +-
m4/amversion.m4 | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 006a08c2d..840abf472 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@
# along with this program. If not, see .
AC_PREREQ([2.69])
-AC_INIT([GNU Automake], [1.13.1a], [bug-automake@gnu.org])
+AC_INIT([GNU Automake], [1.13.2a], [bug-automake@gnu.org])
AC_CONFIG_SRCDIR([automake.in])
AC_CONFIG_AUX_DIR([lib])
diff --git a/m4/amversion.m4 b/m4/amversion.m4
index 992740f73..02b309c8f 100644
--- a/m4/amversion.m4
+++ b/m4/amversion.m4
@@ -15,7 +15,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.13'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.13.1a], [],
+m4_if([$1], [1.13.2a], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -31,7 +31,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.13.1a])dnl
+[AM_AUTOMAKE_VERSION([1.13.2a])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
--
cgit v1.2.1
From bb7e8f79d92f0030ad538ecac06fad0cfdddc407 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Mon, 21 Jan 2013 15:35:48 +0100
Subject: lint: fix spurious failure for 'sc_rm_minus_f' syntax check
* maintainer/syntax-checks.mk (sc_rm_minus_f): Also exempt
file 't/rm-f-probe.sh'.
Signed-off-by: Stefano Lattarini
---
maintainer/syntax-checks.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index 6bb7662ac..e7e2fc055 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -111,7 +111,7 @@ sc_no_brace_variable_expansions:
## Make sure 'rm' is called with '-f'.
sc_rm_minus_f:
@if grep -v '^#' $(ams) $(xtests) \
- | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
+ | grep -vE '/(rm-f-probe\.sh|spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
| grep -E '\)'; \
then \
echo "Suspicious 'rm' invocation." 1>&2; \
--
cgit v1.2.1
From 94c28cc5e9e28d1215619721901d3e0580a758ef Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Mon, 21 Jan 2013 15:45:17 +0100
Subject: tests: more information about Lex and Yacc programs
* t/get-sysconf.sh: Try to also get the version of '$LEX' and '$YACC'.
This will help debugging of user-reported problems.
Signed-off-by: Stefano Lattarini
---
t/get-sysconf.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/t/get-sysconf.sh b/t/get-sysconf.sh
index 4c681081e..bd4932f4c 100755
--- a/t/get-sysconf.sh
+++ b/t/get-sysconf.sh
@@ -46,6 +46,14 @@ $PERL -V || st=1
# happen with older perl installation, or on MinGW/MSYS.
$PERL -e 'use TAP::Parser; print $TAP::Parser::VERSION, "\n"' || :
+# It's OK if the selected Lex and Yacc programs don't know how to print
+# the version number or the help screen; those are usually available only
+# for Flex and Bison.
+$LEX --version || :
+$LEX --help || :
+$YACC --version || :
+$YACC --help || :
+
cat "$am_top_builddir/config.log" || st=1
cat "$am_top_builddir/t/wrap/aclocal-$APIVERSION" || st=1
cat "$am_top_builddir/t/wrap/automake-$APIVERSION" || st=1
--
cgit v1.2.1
From 6d9e9dd453944cd86ddc530a131bd338f4734638 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Mon, 4 Feb 2013 19:34:03 +0100
Subject: refactor: rip module Automake::Language out of automake script
This is just a preparatory patch in view of future changes.
* lib/Automake/Language.pm: New module, ripped out from ...
* automake.in: ... here. Related adjustments.
* Makefile.am (dist_perllib_DATA): List the new module.
Signed-off-by: Stefano Lattarini
---
Makefile.am | 1 +
automake.in | 94 ++----------------------------------
lib/Automake/Language.pm | 122 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 128 insertions(+), 89 deletions(-)
create mode 100644 lib/Automake/Language.pm
diff --git a/Makefile.am b/Makefile.am
index fa3dd3f3d..c245369ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -188,6 +188,7 @@ dist_perllib_DATA = \
lib/Automake/Getopt.pm \
lib/Automake/Item.pm \
lib/Automake/ItemDef.pm \
+ lib/Automake/Language.pm \
lib/Automake/Location.pm \
lib/Automake/Options.pm \
lib/Automake/Rule.pm \
diff --git a/automake.in b/automake.in
index d6ed599d9..5b57d3feb 100644
--- a/automake.in
+++ b/automake.in
@@ -25,7 +25,9 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
# Perl reimplementation by Tom Tromey , and
# Alexandre Duret-Lutz .
-package Language;
+package Automake;
+
+use strict;
BEGIN
{
@@ -43,93 +45,6 @@ BEGIN
$ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
}
-use Class::Struct ();
-Class::Struct::struct (
- # Short name of the language (c, f77...).
- 'name' => "\$",
- # Nice name of the language (C, Fortran 77...).
- 'Name' => "\$",
-
- # List of configure variables which must be defined.
- 'config_vars' => '@',
-
- # 'pure' is '1' or ''. A 'pure' language is one where, if
- # all the files in a directory are of that language, then we
- # do not require the C compiler or any code to call it.
- 'pure' => "\$",
-
- 'autodep' => "\$",
-
- # Name of the compiling variable (COMPILE).
- 'compiler' => "\$",
- # Content of the compiling variable.
- 'compile' => "\$",
- # Flag to require compilation without linking (-c).
- 'compile_flag' => "\$",
- 'extensions' => '@',
- # A subroutine to compute a list of possible extensions of
- # the product given the input extensions.
- # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
- 'output_extensions' => "\$",
- # A list of flag variables used in 'compile'.
- # (defaults to [])
- 'flags' => "@",
-
- # Any tag to pass to libtool while compiling.
- 'libtool_tag' => "\$",
-
- # The file to use when generating rules for this language.
- # The default is 'depend2'.
- 'rule_file' => "\$",
-
- # Name of the linking variable (LINK).
- 'linker' => "\$",
- # Content of the linking variable.
- 'link' => "\$",
-
- # Name of the compiler variable (CC).
- 'ccer' => "\$",
-
- # Name of the linker variable (LD).
- 'lder' => "\$",
- # Content of the linker variable ($(CC)).
- 'ld' => "\$",
-
- # Flag to specify the output file (-o).
- 'output_flag' => "\$",
- '_finish' => "\$",
-
- # This is a subroutine which is called whenever we finally
- # determine the context in which a source file will be
- # compiled.
- '_target_hook' => "\$",
-
- # If TRUE, nodist_ sources will be compiled using specific rules
- # (i.e. not inference rules). The default is FALSE.
- 'nodist_specific' => "\$");
-
-
-sub finish ($)
-{
- my ($self) = @_;
- if (defined $self->_finish)
- {
- &{$self->_finish} (@_);
- }
-}
-
-sub target_hook ($$$$%)
-{
- my ($self) = @_;
- if (defined $self->_target_hook)
- {
- &{$self->_target_hook} (@_);
- }
-}
-
-package Automake;
-
-use strict;
use Automake::Config;
BEGIN
{
@@ -156,6 +71,7 @@ use Automake::VarDef;
use Automake::Rule;
use Automake::RuleDef;
use Automake::Wrap 'makefile_wrap';
+use Automake::Language;
use File::Basename;
use File::Spec;
use Carp;
@@ -5956,7 +5872,7 @@ sub register_language (%)
$option{'nodist_specific'} = 0
unless defined $option{'nodist_specific'};
- my $lang = new Language (%option);
+ my $lang = new Automake::Language (%option);
# Fill indexes.
$extension_map{$_} = $lang->name foreach @{$lang->extensions};
diff --git a/lib/Automake/Language.pm b/lib/Automake/Language.pm
new file mode 100644
index 000000000..6408e86d0
--- /dev/null
+++ b/lib/Automake/Language.pm
@@ -0,0 +1,122 @@
+# Copyright (C) 2013 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 2, 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 .
+
+package Automake::Language;
+
+use 5.006;
+use strict;
+
+use Class::Struct ();
+Class::Struct::struct (
+ # Short name of the language (c, f77...).
+ 'name' => "\$",
+ # Nice name of the language (C, Fortran 77...).
+ 'Name' => "\$",
+
+ # List of configure variables which must be defined.
+ 'config_vars' => '@',
+
+ # 'pure' is '1' or ''. A 'pure' language is one where, if
+ # all the files in a directory are of that language, then we
+ # do not require the C compiler or any code to call it.
+ 'pure' => "\$",
+
+ 'autodep' => "\$",
+
+ # Name of the compiling variable (COMPILE).
+ 'compiler' => "\$",
+ # Content of the compiling variable.
+ 'compile' => "\$",
+ # Flag to require compilation without linking (-c).
+ 'compile_flag' => "\$",
+ 'extensions' => '@',
+ # A subroutine to compute a list of possible extensions of
+ # the product given the input extensions.
+ # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
+ 'output_extensions' => "\$",
+ # A list of flag variables used in 'compile'.
+ # (defaults to [])
+ 'flags' => "@",
+
+ # Any tag to pass to libtool while compiling.
+ 'libtool_tag' => "\$",
+
+ # The file to use when generating rules for this language.
+ # The default is 'depend2'.
+ 'rule_file' => "\$",
+
+ # Name of the linking variable (LINK).
+ 'linker' => "\$",
+ # Content of the linking variable.
+ 'link' => "\$",
+
+ # Name of the compiler variable (CC).
+ 'ccer' => "\$",
+
+ # Name of the linker variable (LD).
+ 'lder' => "\$",
+ # Content of the linker variable ($(CC)).
+ 'ld' => "\$",
+
+ # Flag to specify the output file (-o).
+ 'output_flag' => "\$",
+ '_finish' => "\$",
+
+ # This is a subroutine which is called whenever we finally
+ # determine the context in which a source file will be
+ # compiled.
+ '_target_hook' => "\$",
+
+ # If TRUE, nodist_ sources will be compiled using specific rules
+ # (i.e. not inference rules). The default is FALSE.
+ 'nodist_specific' => "\$");
+
+
+sub finish ($)
+{
+ my ($self) = @_;
+ if (defined $self->_finish)
+ {
+ &{$self->_finish} (@_);
+ }
+}
+
+sub target_hook ($$$$%)
+{
+ my ($self) = @_;
+ if (defined $self->_target_hook)
+ {
+ &{$self->_target_hook} (@_);
+ }
+}
+
+1;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
--
cgit v1.2.1
From 283ded7f5b9b7ad97300293cd65f3f1b48c21115 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Mon, 4 Feb 2013 23:04:18 +0100
Subject: build: auto-generate perl subroutines prototypes for automake and
aclocal
This will allow us to avoid either using the '&foo' invocation form when
invoking a subroutine before its definition, or having to maintain the
list of prototypes by hand (with the risk of having it become incomplete
or fall out-of-sync when future edits to the automake and aclocal scripts
are done).
* Makefile.am (automake, aclocal): Automatically generate a list of
prototypes by looking at the subroutines definitions.
* bootstrap.sh: Likewise, when generating the temporary automake and
aclocal scripts used for bootstrapping.
* automake.in: Add a placeholder that will be tracked by the new recipes
and substituted with the computed prototypes. Remove existing prototypes,
that are now superfluous. Some adjustments required by the new, more
comprehensive prototypes declarations.
* aclocal.in: Likewise.
* maintainer/syntax-checks.mk (sc_diff_automake, sc_diff_aclocal): Adjust.
Signed-off-by: Stefano Lattarini
---
Makefile.am | 13 +++++++++----
aclocal.in | 22 +---------------------
automake.in | 18 +++++++++---------
bootstrap.sh | 11 ++++++-----
lib/gen-perl-protos | 36 ++++++++++++++++++++++++++++++++++++
maintainer/syntax-checks.mk | 19 +++++++++++--------
6 files changed, 72 insertions(+), 47 deletions(-)
create mode 100755 lib/gen-perl-protos
diff --git a/Makefile.am b/Makefile.am
index c245369ba..2e055612b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,13 +96,18 @@ uninstall-hook:
# $(datadir) or other do_subst'ituted variables change.
automake: automake.in
aclocal: aclocal.in
-automake aclocal: Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=$@.in; $(do_subst) <$(srcdir)/$@.in >$@-t
+automake aclocal: Makefile lib/gen-perl-protos
+ $(AM_V_GEN)rm -f $@ $@-t $@-t2 \
+## Common substitutions.
+ && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
+## Auto-compute prototypes of perl subroutines.
+ && $(PERL) -w $(srcdir)/lib/gen-perl-protos $@-t > $@-t2 \
+ && mv -f $@-t2 $@-t \
## We can't use '$(generated_file_finalize)' here, because currently
## Automake contains occurrences of unexpanded @substitutions@ in
## comments, and that is perfectly legit.
- $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
+ && chmod a+x,a-w $@-t && mv -f $@-t $@
+EXTRA_DIST += lib/gen-perl-protos
# The master location for INSTALL is lib/INSTALL.
# This is where "make fetch" will install new versions.
diff --git a/aclocal.in b/aclocal.in
index b51c09df7..9e4ab7936 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -169,27 +169,7 @@ my $erase_me;
# Prototypes for all subroutines.
-sub unlink_tmp (;$);
-sub xmkdir_p ($);
-sub check_acinclude ();
-sub reset_maps ();
-sub install_file ($$);
-sub list_compare (\@\@);
-sub scan_m4_dirs ($$@);
-sub scan_m4_files ();
-sub add_macro ($);
-sub scan_configure_dep ($);
-sub add_file ($);
-sub scan_file ($$$);
-sub strip_redundant_includes (%);
-sub trace_used_macros ();
-sub scan_configure ();
-sub write_aclocal ($@);
-sub usage ($);
-sub version ();
-sub handle_acdir_option ($$);
-sub parse_arguments ();
-sub parse_ACLOCAL_PATH ();
+#! Prototypes here will automatically be generated by the build system.
################################################################
diff --git a/automake.in b/automake.in
index 5b57d3feb..3e2784376 100644
--- a/automake.in
+++ b/automake.in
@@ -76,6 +76,13 @@ use File::Basename;
use File::Spec;
use Carp;
+## ----------------------- ##
+## Subroutine prototypes. ##
+## ----------------------- ##
+
+#! Prototypes here will automatically be generated by the build system.
+
+
## ----------- ##
## Constants. ##
## ----------- ##
@@ -531,13 +538,6 @@ Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
################################################################
-## --------------------------------- ##
-## Forward subroutine declarations. ##
-## --------------------------------- ##
-sub register_language (%);
-sub file_contents_internal ($$$%);
-sub define_files_variable ($\@$$);
-
# &initialize_per_input ()
# ------------------------
@@ -948,7 +948,7 @@ register_language ('name' => 'java',
# Uncategorized errors about the current Makefile.am.
sub err_am ($;%)
{
- msg_am ('error', @_);
+ msg_am ('error', shift, @_);
}
# err_ac ($MESSAGE, [%OPTIONS])
@@ -956,7 +956,7 @@ sub err_am ($;%)
# Uncategorized errors about configure.ac.
sub err_ac ($;%)
{
- msg_ac ('error', @_);
+ msg_ac ('error', shift, @_);
}
# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
diff --git a/bootstrap.sh b/bootstrap.sh
index 93bf3fd54..541280ee0 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -95,14 +95,15 @@ dosubst ()
dosubst automake-$APIVERSION/Automake/Config.in \
automake-$APIVERSION/Automake/Config.pm
-# Create temporary replacement for aclocal.
-dosubst aclocal.in aclocal.tmp
-
# Overwrite amversion.m4.
dosubst m4/amversion.in m4/amversion.m4
-# Create temporary replacement for automake.
-dosubst automake.in automake.tmp
+# Create temporary replacement for aclocal and automake.
+for p in aclocal automake; do
+ dosubst $p.in $p.tmp
+ $PERL -w lib/gen-perl-protos $p.tmp > $p.tmp2
+ mv -f $p.tmp2 $p.tmp
+done
# Create required makefile snippets.
$PERL ./gen-testsuite-part > t/testsuite-part.tmp
diff --git a/lib/gen-perl-protos b/lib/gen-perl-protos
new file mode 100755
index 000000000..9e73d8d7a
--- /dev/null
+++ b/lib/gen-perl-protos
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+#
+# Copyright (C) 2013 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, 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 .
+
+use warnings;
+use strict;
+
+my @lines = <>;
+my @protos = map { /^(sub \w+\s*\(.*\))/ ? ("$1;") : () } @lines;
+
+while (defined ($_ = shift @lines))
+ {
+ if (/^#!.* prototypes/i)
+ {
+ print "# BEGIN AUTOMATICALLY GENERATED PROTOTYPES\n";
+ print join ("\n", sort @protos) . "\n";
+ print "# END AUTOMATICALLY GENERATED PROTOTYPES\n";
+ }
+ else
+ {
+ print;
+ }
+ }
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index e7e2fc055..878789f15 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -86,19 +86,22 @@ sc_at_in_texi
automake_diff_no = 8
aclocal_diff_no = 9
sc_diff_automake sc_diff_aclocal: sc_diff_% :
- @set +e; tmp=$*-diffs.tmp; \
- diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
- added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
- removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
- test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
+ @set +e; \
+ in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \
+ && sed '/^#!.*[pP]rototypes/d' $(srcdir)/$*.in > $$in \
+ && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $* > $$out \
+ && { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \
+ && added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \
+ && removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \
+ && test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
|| { \
echo "Found unexpected diffs between $*.in and $*"; \
echo "Lines added: $$added" ; \
echo "Lines removed: $$removed"; \
- cat $$tmp >&2; \
+ cat $$diffs; \
exit 1; \
- } >&1; \
- rm -f $$tmp
+ } >&2; \
+ rm -f $$in $$out $$diffs
## Expect no instances of '${...}'. However, $${...} is ok, since that
## is a shell construct, not a Makefile construct.
--
cgit v1.2.1
From e7b9d315e6bcb3a3c86042dc5fd58e6f4461ed2d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Mon, 4 Feb 2013 23:37:23 +0100
Subject: maint: use more perl subroutines prototypes in the automake script
* automake.in: Throughout this file. Note that these new prototypes
are not much useful, since many subroutine calls still use the old
'&foo' form; but we'll take care of that in later patches.
* lib/Automake/Language.pm (target_hook): Call the '_target_hook'
of the given language in a more modern form, avoiding '&'.
Signed-off-by: Stefano Lattarini
---
automake.in | 90 ++++++++++++++++++++++++------------------------
lib/Automake/Language.pm | 2 +-
2 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/automake.in b/automake.in
index 3e2784376..8466ee421 100644
--- a/automake.in
+++ b/automake.in
@@ -1146,7 +1146,7 @@ sub handle_silent ()
# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
-sub handle_options
+sub handle_options ()
{
my $var = var ('AUTOMAKE_OPTIONS');
if ($var)
@@ -1219,7 +1219,7 @@ sub check_user_variables (@)
}
# Call finish function for each language that was used.
-sub handle_languages
+sub handle_languages ()
{
if (! option 'no-dependencies')
{
@@ -1526,7 +1526,7 @@ sub append_exeext (&$)
# mentioned. This is a separate function (as opposed to being inlined
# in handle_source_transform) because it isn't always appropriate to
# do this check.
-sub check_libobjs_sources
+sub check_libobjs_sources ($$)
{
my ($one_file, $unxformed) = @_;
@@ -2133,7 +2133,7 @@ sub handle_source_transform ($$$$%)
# transformed name of object being built, or empty string if no object
# name of _LDADD/_LIBADD-type variable to examine
# Returns 1 if LIBOBJS seen, 0 otherwise.
-sub handle_lib_objects
+sub handle_lib_objects ($$)
{
my ($xname, $varname) = @_;
@@ -2303,7 +2303,7 @@ sub handle_ALLOCA ($$$)
}
# Canonicalize the input parameter
-sub canonicalize
+sub canonicalize ($)
{
my ($string) = @_;
$string =~ tr/A-Za-z0-9_\@/_/c;
@@ -2313,7 +2313,7 @@ sub canonicalize
# Canonicalize a name, and check to make sure the non-canonical name
# is never used. Returns canonical name. Arguments are name and a
# list of suffixes to check for.
-sub check_canonical_spelling
+sub check_canonical_spelling ($@)
{
my ($name, @suffixes) = @_;
@@ -2389,7 +2389,7 @@ sub handle_compile ()
# handle_libtool ()
# -----------------
# Handle libtool rules.
-sub handle_libtool
+sub handle_libtool ()
{
return unless var ('LIBTOOL');
@@ -2418,7 +2418,7 @@ sub handle_libtool
# handle_programs ()
# ------------------
# Handle C programs.
-sub handle_programs
+sub handle_programs ()
{
my @proglist = &am_install_var ('progs', 'PROGRAMS',
'bin', 'sbin', 'libexec', 'pkglibexec',
@@ -2510,7 +2510,7 @@ sub handle_programs
# handle_libraries ()
# -------------------
# Handle libraries.
-sub handle_libraries
+sub handle_libraries ()
{
my @liblist = &am_install_var ('libs', 'LIBRARIES',
'lib', 'pkglib', 'noinst', 'check');
@@ -2623,7 +2623,7 @@ sub handle_libraries
# handle_ltlibraries ()
# ---------------------
# Handle shared libraries.
-sub handle_ltlibraries
+sub handle_ltlibraries ()
{
my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
'noinst', 'lib', 'pkglib', 'check');
@@ -2893,7 +2893,7 @@ sub check_typos ()
# Handle scripts.
-sub handle_scripts
+sub handle_scripts ()
{
# NOTE we no longer automatically clean SCRIPTS, because it is
# useful to sometimes distribute scripts verbatim. This happens
@@ -3416,7 +3416,7 @@ sub handle_texinfo ()
# Handle any man pages.
-sub handle_man_pages
+sub handle_man_pages ()
{
reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
@@ -3555,7 +3555,7 @@ sub handle_man_pages
}
# Handle DATA variables.
-sub handle_data
+sub handle_data ()
{
&am_install_var ('-noextra', '-candist', 'data', 'DATA',
'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
@@ -3564,7 +3564,7 @@ sub handle_data
}
# Handle TAGS.
-sub handle_tags
+sub handle_tags ()
{
my @config;
foreach my $spec (@config_headers)
@@ -4291,7 +4291,7 @@ sub handle_configure ($$$@)
}
# Handle C headers.
-sub handle_headers
+sub handle_headers ()
{
my @r = &am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
'oldinclude', 'pkginclude',
@@ -4303,7 +4303,7 @@ sub handle_headers
}
}
-sub handle_gettext
+sub handle_gettext ()
{
return if ! $seen_gettext || $relative_dir ne '.';
@@ -4360,7 +4360,7 @@ sub handle_gettext
}
# Handle footer elements.
-sub handle_footer
+sub handle_footer ()
{
reject_rule ('.SUFFIXES',
"use variable 'SUFFIXES', not target '.SUFFIXES'");
@@ -4612,7 +4612,7 @@ sub target_cmp
# &handle_factored_dependencies ()
# --------------------------------
# Handle everything related to gathered targets.
-sub handle_factored_dependencies
+sub handle_factored_dependencies ()
{
# Reject bad hooks.
foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook',
@@ -4699,13 +4699,13 @@ sub handle_factored_dependencies
# &handle_tests_dejagnu ()
# ------------------------
-sub handle_tests_dejagnu
+sub handle_tests_dejagnu ()
{
push (@check_tests, 'check-DEJAGNU');
$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
-sub handle_per_suffix_test
+sub handle_per_suffix_test ($%)
{
my ($test_suffix, %transform) = @_;
my ($pfx, $generic, $am_exeext);
@@ -4769,7 +4769,7 @@ sub is_valid_test_extension ($)
}
# Handle TESTS variable and other checks.
-sub handle_tests
+sub handle_tests ()
{
if (option 'dejagnu')
{
@@ -4903,7 +4903,7 @@ sub handle_tests
}
# Handle Emacs Lisp.
-sub handle_emacs_lisp
+sub handle_emacs_lisp ()
{
my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
'lisp', 'noinst');
@@ -4924,7 +4924,7 @@ sub handle_emacs_lisp
}
# Handle Python
-sub handle_python
+sub handle_python ()
{
my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
'noinst');
@@ -4936,7 +4936,7 @@ sub handle_python
}
# Handle Java.
-sub handle_java
+sub handle_java ()
{
my @sourcelist = &am_install_var ('-candist',
'java', 'JAVA',
@@ -4981,7 +4981,7 @@ sub handle_java
# Handle some of the minor options.
-sub handle_minor_options
+sub handle_minor_options ()
{
if (option 'readme-alpha')
{
@@ -5479,7 +5479,7 @@ sub scan_autoconf_files ()
################################################################
# Do any extra checking for GNU standards.
-sub check_gnu_standards
+sub check_gnu_standards ()
{
if ($relative_dir eq '.')
{
@@ -5511,7 +5511,7 @@ sub check_gnu_standards
}
# Do any extra checking for GNITS standards.
-sub check_gnits_standards
+sub check_gnits_standards ()
{
if ($relative_dir eq '.')
{
@@ -5537,7 +5537,7 @@ sub check_gnits_standards
# This is just a convenience function that can be used to determine
# when a subdir object should be used.
-sub lang_sub_obj
+sub lang_sub_obj ()
{
return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
}
@@ -5686,7 +5686,7 @@ sub lang_vala_finish_target ($$)
# Add output rules to invoke valac and create stamp file as a witness
# to handle multiple outputs. This function is called after all source
# file processing is done.
-sub lang_vala_finish
+sub lang_vala_finish ()
{
my ($self) = @_;
@@ -5704,7 +5704,7 @@ sub lang_vala_finish
# The built .c files should be cleaned only on maintainer-clean
# as the .c files are distributed. This function is called for each
# .vala source file.
-sub lang_vala_target_hook
+sub lang_vala_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5713,7 +5713,7 @@ sub lang_vala_target_hook
# This is a yacc helper which is called whenever we have decided to
# compile a yacc file.
-sub lang_yacc_target_hook
+sub lang_yacc_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5789,7 +5789,7 @@ sub lang_yacc_target_hook
# This is a lex helper which is called whenever we have decided to
# compile a lex file.
-sub lang_lex_target_hook
+sub lang_lex_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
# The GNU rules say that yacc/lex output files should be removed
@@ -5800,7 +5800,7 @@ sub lang_lex_target_hook
}
# This is a helper for both lex and yacc.
-sub yacc_lex_finish_helper
+sub yacc_lex_finish_helper ()
{
return if defined $language_scratch{'lex-yacc-done'};
$language_scratch{'lex-yacc-done'} = 1;
@@ -5810,7 +5810,7 @@ sub yacc_lex_finish_helper
&define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
}
-sub lang_yacc_finish
+sub lang_yacc_finish ()
{
return if defined $language_scratch{'yacc-done'};
$language_scratch{'yacc-done'} = 1;
@@ -5821,7 +5821,7 @@ sub lang_yacc_finish
}
-sub lang_lex_finish
+sub lang_lex_finish ()
{
return if defined $language_scratch{'lex-done'};
$language_scratch{'lex-done'} = 1;
@@ -5834,7 +5834,7 @@ sub lang_lex_finish
# precedence. This is lame, but something has to have global
# knowledge in order to eliminate the conflict. Add more linkers as
# required.
-sub resolve_linker
+sub resolve_linker (%)
{
my (%linkers) = @_;
@@ -5846,7 +5846,7 @@ sub resolve_linker
}
# Called to indicate that an extension was used.
-sub saw_extension
+sub saw_extension ($)
{
my ($ext) = @_;
$extension_seen{$ext} = 1;
@@ -5928,7 +5928,7 @@ sub derive_suffix ($$)
################################################################
# Pretty-print something and append to output_rules.
-sub pretty_print_rule
+sub pretty_print_rule (@)
{
$output_rules .= &makefile_wrap (@_);
}
@@ -6538,7 +6538,7 @@ sub read_am_file ($$)
# ----------------------------
# A helper for read_main_am_file which initializes configure variables
# and variables from header-vars.am.
-sub define_standard_variables
+sub define_standard_variables ()
{
my $saved_output_vars = $output_vars;
my ($comments, undef, $rules) =
@@ -6585,7 +6585,7 @@ sub read_main_am_file ($$)
# &flatten ($STRING)
# ------------------
# Flatten the $STRING and return the result.
-sub flatten
+sub flatten ($)
{
$_ = shift;
@@ -7059,7 +7059,7 @@ sub am_primary_prefixes ($$@)
# up into multiple functions.
#
# Usage is: am_install_var (OPTION..., file, HOW, where...)
-sub am_install_var
+sub am_install_var (@)
{
my (@args) = @_;
@@ -7265,7 +7265,7 @@ sub am_install_var
my %make_dirs = ();
my $make_dirs_set = 0;
-sub is_make_dir
+sub is_make_dir ($)
{
my ($dir) = @_;
if (! $make_dirs_set)
@@ -7319,7 +7319,7 @@ sub locate_aux_dir ()
# &push_required_file ($DIR, $FILE, $FULLFILE)
# --------------------------------------------------
# Push the given file onto DIST_COMMON.
-sub push_required_file
+sub push_required_file ($$$)
{
my ($dir, $file, $fullfile) = @_;
@@ -7715,7 +7715,7 @@ sub require_build_directory_maybe ($)
################################################################
# Push a list of files onto dist_common.
-sub push_dist_common
+sub push_dist_common (@)
{
prog_error "push_dist_common run after handle_dist"
if $handle_dist_run;
@@ -8130,7 +8130,7 @@ sub handle_makefiles_serial ()
# get_number_of_threads ()
# ------------------------
# Logic for deciding how many worker threads to use.
-sub get_number_of_threads
+sub get_number_of_threads ()
{
my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
diff --git a/lib/Automake/Language.pm b/lib/Automake/Language.pm
index 6408e86d0..a678e1e4d 100644
--- a/lib/Automake/Language.pm
+++ b/lib/Automake/Language.pm
@@ -98,7 +98,7 @@ sub target_hook ($$$$%)
my ($self) = @_;
if (defined $self->_target_hook)
{
- &{$self->_target_hook} (@_);
+ $self->_target_hook->(@_);
}
}
--
cgit v1.2.1
From ba25a9f1c295d7799575afa39c4c9854a85ad8e3 Mon Sep 17 00:00:00 2001
From: Peter Rosin
Date: Fri, 8 Feb 2013 09:11:45 +0100
Subject: preproc: add support for relative names in included fragments
The rationale for this change is that it is annoying to have
to repeat the directory name when including a Makefile fragment.
For deep directory structures these repeats can generate a lot
of bloat. It also hinders reuse and easy directory restructuring
if all Makefile fragments have to know exactly where they live.
Suggested by Bob Friesenhahn, and later discussed in bug#13524.
In the course of discussion, the following notations were rejected:
&{reldir}& - to hard to type, {reldir} - interferes with ${reldir},
{am_reldir} - short form {D} interferes with ${D}, @am_reldir@ - short
form @D@ interferes with AC_SUBST([D]) as well as invading the
config.status turf. Other notations were also suggested...
* automake.in (read_am_file): Add third argument specifying the
relative directory of this Makefile fragment compared to the
main Makefile. Replace %reldir% and %canon_reldir% in the
fragment with this relative directory (with slashes etc, or
canonicalized).
(read_main_am_file): Adjust.
* t/preproc-reldir.sh: New test.
* t/list-of-tests.mk: Augment.
* doc/automake.texi (Include): Document the new feature.
NEWS: Add new feature.
Co-authored-by: Stefano Lattarini
Signed-off-by: Peter Rosin
Signed-off-by: Stefano Lattarini
---
NEWS | 12 +++++
automake.in | 26 ++++++++---
doc/automake.texi | 20 ++++++++
t/list-of-tests.mk | 1 +
t/preproc-reldir.sh | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 182 insertions(+), 6 deletions(-)
create mode 100755 t/preproc-reldir.sh
diff --git a/NEWS b/NEWS
index 6dcce72ed..2fcbe7895 100644
--- a/NEWS
+++ b/NEWS
@@ -100,6 +100,18 @@ New in 1.13.2:
be longer necessary, so we deprecate it with runtime warnings. It will
likely be removed altogether in Automake 1.14.
+* Relative directory in Makefile fragments:
+
+ - The special Automake-time substitutions '%reldir%' and '%canon_reldir%'
+ (and their short versions, '%D%' and '%C%' respectively) can now be used
+ in an included Makefile fragment. The former is substituted with the
+ relative directory of the included fragment (compared to the top level
+ including Makefile), and the latter with the canonicalized version of
+ the same relative directory:
+
+ bin_PROGRAMS += %reldir%/foo
+ %canon_reldir%_foo_SOURCES = %reldir%/bar.c
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New in 1.13.2:
diff --git a/automake.in b/automake.in
index d6ed599d9..80e54ffdb 100644
--- a/automake.in
+++ b/automake.in
@@ -6330,15 +6330,16 @@ sub check_trailing_slash ($\$)
}
-# &read_am_file ($AMFILE, $WHERE)
-# -------------------------------
+# &read_am_file ($AMFILE, $WHERE, $RELDIR)
+# ----------------------------------------
# Read Makefile.am and set up %contents. Simultaneously copy lines
# from Makefile.am into $output_trailer, or define variables as
# appropriate. NOTE we put rules in the trailer section. We want
# user rules to come after our generated stuff.
-sub read_am_file ($$)
+sub read_am_file ($$$)
{
- my ($amfile, $where) = @_;
+ my ($amfile, $where, $reldir) = @_;
+ my $canon_reldir = &canonicalize ($reldir);
my $am_file = new Automake::XFile ("< $amfile");
verb "reading $amfile";
@@ -6423,6 +6424,17 @@ sub read_am_file ($$)
my $new_saw_bk = check_trailing_slash ($where, $_);
+ if ($reldir eq '.')
+ {
+ # If present, eat the following '_' or '/', converting
+ # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo"
+ # when $reldir is '.'.
+ $_ =~ s,%(D|reldir)%/,,g;
+ $_ =~ s,%(C|canon_reldir)%_,,g;
+ }
+ $_ =~ s/%(D|reldir)%/${reldir}/g;
+ $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g;
+
if (/$IGNORE_PATTERN/o)
{
# Merely delete comments beginning with two hashes.
@@ -6584,8 +6596,10 @@ sub read_am_file ($$)
push_dist_common ("\$\(srcdir\)/$path");
$path = $relative_dir . "/" . $path if $relative_dir ne '.';
}
+ my $new_reldir = File::Spec->abs2rel ($path, $relative_dir);
+ $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,;
$where->push_context ("'$path' included from here");
- &read_am_file ($path, $where);
+ &read_am_file ($path, $where, $new_reldir);
$where->pop_context;
}
else
@@ -6658,7 +6672,7 @@ sub read_main_am_file ($$)
&define_standard_variables;
# Read user file, which might override some of our values.
- &read_am_file ($amfile, new Automake::Location);
+ &read_am_file ($amfile, new Automake::Location, '.');
}
diff --git a/doc/automake.texi b/doc/automake.texi
index feae3ac80..d420d28ed 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -10519,6 +10519,26 @@ condition applies to the entire contents of that fragment.
Makefile fragments included this way are always distributed because
they are needed to rebuild @file{Makefile.in}.
+Inside a fragment, the construct @code{%reldir%} is replaced with the
+directory of the fragment relative to the base @file{Makefile.am}.
+Similarly, @code{%canon_reldir%} is replaced with the canonicalized
+(@pxref{Canonicalization}) form of @code{%reldir%}. As a convenience,
+@code{%D%} is a synonym for @code{%reldir%}, and @code{%C%}
+is a synonym for @code{%canon_reldir%}.
+
+A special feature is that if the fragment is in the same directory as
+the base @file{Makefile.am} (i.e., @code{%reldir%} is @code{.}), then
+@code{%reldir%} and @code{%canon_reldir%} will expand to the empty
+string as well as eat, if present, a following slash or underscore
+respectively.
+
+Thus, a makefile fragment might look like this:
+
+@example
+bin_PROGRAMS += %reldir%/mumble
+%canon_reldir%_mumble_SOURCES = %reldir%/one.c
+@end example
+
@node Conditionals
@chapter Conditionals
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 0acbdcfae..72c99eefa 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -865,6 +865,7 @@ t/pr401.sh \
t/pr401b.sh \
t/pr401c.sh \
t/prefix.sh \
+t/preproc-reldir.sh \
t/primary.sh \
t/primary2.sh \
t/primary3.sh \
diff --git a/t/preproc-reldir.sh b/t/preproc-reldir.sh
new file mode 100755
index 000000000..ab443df39
--- /dev/null
+++ b/t/preproc-reldir.sh
@@ -0,0 +1,129 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Test %reldir% and %canon_reldir%.
+
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CONFIG_FILES([zot/Makefile])
+AC_OUTPUT
+END
+
+mkdir foo
+mkdir foo/bar
+mkdir foo/foobar
+mkdir zot
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS =
+include $(top_srcdir)/foo/local.mk
+include $(srcdir)/foo/foobar/local.mk
+include local.mk
+END
+
+cat > zot/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS =
+include $(top_srcdir)/zot/local.mk
+include $(top_srcdir)/top.mk
+include ../reltop.mk
+END
+
+cat > local.mk << 'END'
+%canon_reldir%_whoami:
+ @echo "I am %reldir%/local.mk"
+
+bin_PROGRAMS += %reldir%/mumble
+%canon_reldir%_mumble_SOURCES = %reldir%/one.c
+END
+
+cat > top.mk << 'END'
+%canon_reldir%_top_whoami:
+ @echo "I am %reldir%/top.mk"
+
+bin_PROGRAMS += %D%/scream
+%C%_scream_SOURCES = %D%/two.c
+END
+
+cat > reltop.mk << 'END'
+%C%_reltop_whoami:
+ @echo "I am %D%/reltop.mk"
+
+bin_PROGRAMS += %reldir%/sigh
+%canon_reldir%_sigh_SOURCES = %reldir%/three.c
+END
+
+cat > one.c << 'END'
+int main(void) { return 0; }
+END
+
+cp local.mk foo
+cp local.mk foo/bar
+cp local.mk foo/foobar
+cp local.mk zot
+echo "include %reldir%/bar/local.mk" >> foo/local.mk
+
+cp one.c foo
+cp one.c foo/bar
+cp one.c foo/foobar
+cp one.c zot
+cp one.c two.c
+cp one.c three.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+$MAKE whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am local.mk" output
+$MAKE foo_whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am foo/local.mk" output
+$MAKE foo_bar_whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am foo/bar/local.mk" output
+$MAKE foo_foobar_whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am foo/foobar/local.mk" output
+
+$MAKE
+./mumble
+foo/mumble
+foo/bar/mumble
+foo/foobar/mumble
+
+cd zot
+
+$MAKE ___top_whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am ../top.mk" output
+$MAKE ___reltop_whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am ../reltop.mk" output
+$MAKE whoami >output 2>&1 || { cat output; exit 1; }
+cat output
+grep "I am local.mk" output
+
+$MAKE
+./mumble
+../scream
+../sigh
--
cgit v1.2.1
From f6edf9d31204204907b67f167516bd5082b78d0c Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 8 Feb 2013 09:17:10 +0100
Subject: preproc: enhance and extend tests
* t/preproc-demo.sh: New test, a "demo" of how the new pre-processing
feature could be used in a real-world package.
* t/preproc-errmsg.sh: New test, check that error messages remain
useful when the new pre-processing features are involved.
* t/preproc-reldir.sh: Split up ...
* t/preproc-basics.sh, t/preproc-c-compile.sh: ... into these two
tests, with some refactorings, clean-up and enhancements.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini
---
t/list-of-tests.mk | 5 +-
t/preproc-basics.sh | 106 +++++++++++++++++++++++
t/preproc-c-compile.sh | 118 +++++++++++++++++++++++++
t/preproc-demo.sh | 230 +++++++++++++++++++++++++++++++++++++++++++++++++
t/preproc-errmsg.sh | 75 ++++++++++++++++
t/preproc-reldir.sh | 129 ---------------------------
6 files changed, 533 insertions(+), 130 deletions(-)
create mode 100755 t/preproc-basics.sh
create mode 100755 t/preproc-c-compile.sh
create mode 100755 t/preproc-demo.sh
create mode 100755 t/preproc-errmsg.sh
delete mode 100755 t/preproc-reldir.sh
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 72c99eefa..679fe5d40 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -865,7 +865,10 @@ t/pr401.sh \
t/pr401b.sh \
t/pr401c.sh \
t/prefix.sh \
-t/preproc-reldir.sh \
+t/preproc-basics.sh \
+t/preproc-c-compile.sh \
+t/preproc-demo.sh \
+t/preproc-errmsg.sh \
t/primary.sh \
t/primary2.sh \
t/primary3.sh \
diff --git a/t/preproc-basics.sh b/t/preproc-basics.sh
new file mode 100755
index 000000000..6000d883c
--- /dev/null
+++ b/t/preproc-basics.sh
@@ -0,0 +1,106 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Basic tests for '%...%' preprocessing in included Makefile fragments:
+# %reldir% a.k.a. %D%
+# %canon_reldir% a.k.a. %C%
+
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_CONFIG_FILES([zot/Makefile])
+AC_OUTPUT
+END
+
+mkdir foo foo/bar foo/foobar zot
+
+cat > Makefile.am << 'END'
+include $(top_srcdir)/foo/local.mk
+include $(srcdir)/foo/foobar/local.mk
+include local.mk
+END
+
+cat > zot/Makefile.am << 'END'
+include $(top_srcdir)/zot/local.mk
+
+## Check that '%canon_reldir%' doesn't remain overridden
+## by the previous include.
+%canon_reldir%_zot_whoami:
+ echo "I am %reldir%/Makefile.am" >$@
+
+include $(top_srcdir)/top.mk
+include ../reltop.mk
+END
+
+cat > local.mk << 'END'
+%canon_reldir%_whoami:
+ echo "I am %reldir%/local.mk" >$@
+END
+
+cat > top.mk << 'END'
+%canon_reldir%_top_whoami:
+ echo "I am %reldir%/top.mk" >$@
+END
+
+cat > reltop.mk << 'END'
+%C%_reltop_whoami:
+ echo "I am %D%/reltop.mk" >$@
+END
+
+cp local.mk foo
+cp local.mk foo/bar
+cp local.mk foo/foobar
+cp local.mk zot
+
+cat >> foo/local.mk << 'END'
+include %reldir%/bar/local.mk
+## Check that '%canon_reldir%' doesn't remain overridden by the
+## previous include. The duplicated checks are done to ensure that
+## Automake substitutes all pre-processing occurrences on a line,
+## not just the first one.
+test-%reldir%:
+ test '%reldir%' = foo && test '%reldir%' = foo
+ test '%D%' = foo && test '%D%' = foo
+ test '%canon_reldir%' = foo && test '%C%' = foo
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+check ()
+{
+ test $# -eq 2 || fatal_ "made_into(): bad usage"
+ target=$1 contents=$2
+ rm -f "$target" \
+ && $MAKE "$target" \
+ && test x"$(cat "$target")" = x"$contents"
+}
+
+check whoami "I am local.mk"
+check foo_whoami "I am foo/local.mk"
+check foo_bar_whoami "I am foo/bar/local.mk"
+check foo_foobar_whoami "I am foo/foobar/local.mk"
+$MAKE test-foo
+
+cd zot
+check whoami "I am local.mk"
+check ___top_whoami "I am ../top.mk"
+check ___reltop_whoami "I am ../reltop.mk"
+check zot_whoami "I am Makefile.am"
+
+:
diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh
new file mode 100755
index 000000000..79e9325ed
--- /dev/null
+++ b/t/preproc-c-compile.sh
@@ -0,0 +1,118 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Test pre-processing substitutions '%reldir%' and '%canon_reldir%'
+# with C compilation and subdir objects.
+
+require=cc
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CONFIG_FILES([zot/Makefile])
+AC_OUTPUT
+END
+
+mkdir foo
+mkdir foo/bar
+mkdir foo/foobar
+mkdir zot
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+SUBDIRS = zot
+bin_PROGRAMS =
+
+include $(top_srcdir)/foo/local.mk
+include $(srcdir)/foo/foobar/local.mk
+include local.mk
+
+check-local:
+ is $(bin_PROGRAMS) == \
+ foo/mumble2$(EXEEXT) \
+ foo/bar/mumble$(EXEEXT) \
+ foo/foobar/mumble$(EXEEXT) \
+ mumble$(EXEEXT)
+ test '$(mumble_SOURCES)' = one.c
+ test '$(foo_mumble2_SOURCES)' = foo/one.c
+ test '$(foo_bar_mumble_SOURCES)' = foo/bar/one.c
+ test '$(foo_foobar_mumble_SOURCES)' = foo/foobar/one.c
+ test -f mumble$(EXEEXT)
+ test -f foo/mumble2$(EXEEXT)
+ test -f foo/bar/mumble$(EXEEXT)
+ test -f foo/foobar/mumble$(EXEEXT)
+ test -f zot/mumble$(EXEEXT)
+ : Test some of the object files too.
+ test -f one.$(OBJEXT)
+ test -f foo/foobar/one.$(OBJEXT)
+ test -f zot/one.$(OBJEXT)
+END
+
+cat > zot/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS =
+include $(top_srcdir)/zot/local.mk
+
+test:
+ test '$(bin_PROGRAMS)' == mumble$(EXEEXT)
+ test '$(mumble_SOURCES)' = one.c
+check-local: test
+END
+
+cat > local.mk << 'END'
+bin_PROGRAMS += %reldir%/mumble
+%canon_reldir%_mumble_SOURCES = %reldir%/one.c
+END
+
+echo 'int main (void) { return 0; }' > one.c
+
+sed 's/mumble/mumble2/' local.mk > foo/local.mk
+cp local.mk foo/bar
+cp local.mk foo/foobar
+cp local.mk zot
+echo "include %reldir%/bar/local.mk" >> foo/local.mk
+
+cp one.c foo
+cp one.c foo/bar
+cp one.c foo/foobar
+cp one.c zot
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE
+$MAKE check-local
+if ! cross_compiling; then
+ ./mumble
+ ./foo/mumble2
+ ./foo/bar/mumble
+ ./foo/foobar/mumble
+ ./zot/mumble
+fi
+
+(cd zot && $MAKE test)
+
+# GNU install refuses to override a just-installed file; since we
+# have plenty of 'mumble' dummy programs to install in the same
+# location, such "overridden installations" are not a problem for
+# us, so just force the use the 'install-sh' script
+ac_cv_path_install=$(pwd)/install-sh; export ac_cv_path_install
+$MAKE distcheck
+
+:
diff --git a/t/preproc-demo.sh b/t/preproc-demo.sh
new file mode 100755
index 000000000..4c1b2d9dd
--- /dev/null
+++ b/t/preproc-demo.sh
@@ -0,0 +1,230 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Demo of a package using pre-processing substitutions '%reldir%' and
+# '%canon_reldir%', and their respective shorthands '%D%' and '%C%'.
+
+am_create_testdir=empty
+required=cc
+. test-init.sh
+
+if cross_compiling; then
+ WE_ARE_CROSS_COMPILING=yes
+else
+ WE_ARE_CROSS_COMPILING=no
+fi
+export WE_ARE_CROSS_COMPILING
+
+SAFE_PRINT_FAIL=; unset SAFE_PRINT_FAIL
+
+cat > configure.ac << 'END'
+AC_INIT([GNU Demo], [0.7], [bug-automake@gnu.org])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([1.12.6 foreign subdir-objects -Wall])
+AM_CONDITIONAL([NATIVE_BUILD], [test $WE_ARE_CROSS_COMPILING != yes])
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+mkdir build-aux lib lib/tests src tests
+
+## Top level.
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS =
+check_PROGRAMS =
+noinst_LIBRARIES =
+AM_CPPFLAGS =
+AM_TESTS_ENVIRONMENT =
+CLEANFILES =
+EXTRA_DIST =
+LDADD =
+TESTS =
+
+include $(srcdir)/src/progs.am
+include $(srcdir)/lib/gnulib.am
+include $(srcdir)/tests/check.am
+END
+
+## Src subdir.
+
+cat > src/progs.am <<'END'
+bin_PROGRAMS += %reldir%/hello
+
+bin_PROGRAMS += %D%/goodbye
+%canon_reldir%_goodbye_SOURCES = %D%/hello.c
+%C%_goodbye_CPPFLAGS = $(AM_CPPFLAGS) -DGREETINGS='"Goodbye"'
+
+# The testsuite should have access to our built programs.
+AM_TESTS_ENVIRONMENT += \
+ PROGDIR='$(top_builddir)/%reldir%'; \
+ export PROGDIR; \
+ PATH='$(abs_builddir)/%reldir%'$(PATH_SEPARATOR)$$PATH; \
+ export PATH;
+END
+
+cat > src/hello.c <<'END'
+#include "safe-print.h"
+#include
+#include
+
+#ifndef GREETINGS
+# define GREETINGS "Hello"
+#endif
+
+int
+main (void)
+{
+ safe_print (stdout, GREETINGS ", World!\n");
+ exit (EXIT_SUCCESS);
+}
+END
+
+## Lib subdir.
+
+cat > lib/gnulib.am << 'END'
+noinst_LIBRARIES += %D%/libgnu.a
+
+AM_CPPFLAGS += -I%D% -I$(top_srcdir)/%D%
+LDADD += $(noinst_LIBRARIES)
+
+%C%_libgnu_a_SOURCES = \
+ %D%/safe-print.c \
+ %D%/safe-print.h
+
+if NATIVE_BUILD
+include %D%/tests/gnulib-check.am
+endif
+END
+
+cat > lib/safe-print.c <<'END'
+#include "safe-print.h"
+#include
+#include
+
+void
+safe_print (FILE *fp, const char * str)
+{
+ if (fprintf (fp, "%s", str) != strlen (str)
+ || fflush (fp) != 0 || ferror (fp))
+ {
+ fprintf (stderr, "I/O error\n");
+ exit (EXIT_FAILURE);
+ }
+}
+
+END
+
+cat > lib/safe-print.h <<'END'
+#include
+void safe_print (FILE *, const char *);
+END
+
+## Lib/Tests (sub)subdir.
+
+cat > lib/tests/gnulib-check.am <<'END'
+check_PROGRAMS += %D%/safe-print-test
+TESTS += $(check_PROGRAMS)
+AM_TESTS_ENVIRONMENT += EXEEXT='$(EXEEXT)'; export EXEEXT;
+END
+
+cat > lib/tests/safe-print-test.c <<'END'
+#include "safe-print.h"
+int
+main (void)
+{
+ safe_print (stdout, "dummy\n");
+ return 0;
+}
+END
+
+## Tests subdir.
+
+cat > tests/check.am <<'END'
+TEST_EXTENSIONS = .sh
+SH_LOG_COMPILER = $(SHELL)
+
+handwritten_TESTS = \
+ %D%/hello.sh \
+ %D%/built.sh
+TESTS += $(handwritten_TESTS)
+EXTRA_DIST += $(handwritten_TESTS)
+
+TESTS += %D%/goodbye.sh
+CLEANFILES += %D%/goodbye.sh
+%D%/goodbye.sh: %D%/hello.sh
+ $(MKDIR_P) %D%
+ rm -f $@ $@-t
+ sed -e 's/hello/goodbye/' \
+ -e 's/Hello/Goodbye/' \
+ < $(srcdir)/%D%/hello.sh >$@-t
+ chmod a-w,a+x $@-t && mv -f $@-t $@
+END
+
+cat > tests/hello.sh <<'END'
+#!/bin/sh
+set -x -e
+if test "$WE_ARE_CROSS_COMPILING" = yes; then
+ echo Skipping: cannot run in cross-compilation mode
+ exit 77
+else
+ hello || exit 1
+ test "`hello`" = 'Hello, World!' || exit 1
+fi
+END
+
+cat > tests/built.sh <<'END'
+#!/bin/sh
+set -x
+test -n "$PROGDIR" || exit 99
+test -f "$PROGDIR/hello$EXEEXT" || exit 1
+test -x "$PROGDIR/hello$EXEEXT" || exit 1
+test -f "$PROGDIR/goodbye$EXEEXT" || exit 1
+test -x "$PROGDIR/goodbye$EXEEXT" || exit 1
+END
+
+
+## Go.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing --copy
+test ! -e compile
+test -f build-aux/compile
+
+./configure
+
+$MAKE
+
+VERBOSE=x $MAKE check >stdout || { cat stdout; exit 1; }
+cat stdout
+cat tests/built.log
+cat tests/hello.log
+cat tests/goodbye.log
+if cross_compiling; then
+ test ! -e lib/tests/safe-print-test.log
+ count_test_results total=3 pass=1 fail=0 xpass=0 xfail=0 skip=2 error=0
+else
+ count_test_results total=4 pass=4 fail=0 xpass=0 xfail=0 skip=0 error=0
+fi
+
+$MAKE distcheck
+
+:
diff --git a/t/preproc-errmsg.sh b/t/preproc-errmsg.sh
new file mode 100755
index 000000000..d7cf488d2
--- /dev/null
+++ b/t/preproc-errmsg.sh
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Tests error messages when '%reldir%' and '%canon_reldir%' substitutions
+# (and their shorthands '%D%' and '%C%') are involved.
+
+. test-init.sh
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AM_PROG_AR
+END
+
+: > ar-lib
+
+mkdir sub sub/sub2
+
+cat > Makefile.am <<'END'
+%canon_reldir%_x1_SOURCES = bar.c
+include sub/local.mk
+END
+
+cat > sub/local.mk <<'END'
+AUTOMAKE_OPTIONS = -Wno-extra-portability
+include %D%/sub2/more.mk
+noinst_LIBRARIES = %reldir%-one.a %D%-two.a
+%C%_x2_SOURCES = foo.c
+END
+
+cat > sub/sub2/more.mk <<'END'
+%C%_UNDEFINED +=
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+
+cat > expected << 'END'
+sub/sub2/more.mk:1: sub_sub2_UNDEFINED must be set with '=' before using '+='
+Makefile.am:2: 'sub/local.mk' included from here
+sub/local.mk:2: 'sub/sub2/more.mk' included from here
+sub/local.mk:3: 'sub-one.a' is not a standard library name
+sub/local.mk:3: did you mean 'libsub-one.a'?
+Makefile.am:2: 'sub/local.mk' included from here
+sub/local.mk:3: 'sub-two.a' is not a standard library name
+sub/local.mk:3: did you mean 'libsub-two.a'?
+Makefile.am:2: 'sub/local.mk' included from here
+Makefile.am:1: variable 'x1_SOURCES' is defined but no program or
+Makefile.am:1: library has 'x1' as canonical name (possible typo)
+sub/local.mk:4: variable 'sub_x2_SOURCES' is defined but no program or
+sub/local.mk:4: library has 'sub_x2' as canonical name (possible typo)
+Makefile.am:2: 'sub/local.mk' included from here
+END
+
+sed -e '/warnings are treated as errors/d' \
+ -e 's/: warning:/:/' -e 's/: error:/:/' \
+ -e 's/ */ /g' \
+ obtained
+
+diff expected obtained
+
+:
diff --git a/t/preproc-reldir.sh b/t/preproc-reldir.sh
deleted file mode 100755
index ab443df39..000000000
--- a/t/preproc-reldir.sh
+++ /dev/null
@@ -1,129 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2013 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 2, 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 .
-
-# Test %reldir% and %canon_reldir%.
-
-. test-init.sh
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_CONFIG_FILES([zot/Makefile])
-AC_OUTPUT
-END
-
-mkdir foo
-mkdir foo/bar
-mkdir foo/foobar
-mkdir zot
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS =
-include $(top_srcdir)/foo/local.mk
-include $(srcdir)/foo/foobar/local.mk
-include local.mk
-END
-
-cat > zot/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS =
-include $(top_srcdir)/zot/local.mk
-include $(top_srcdir)/top.mk
-include ../reltop.mk
-END
-
-cat > local.mk << 'END'
-%canon_reldir%_whoami:
- @echo "I am %reldir%/local.mk"
-
-bin_PROGRAMS += %reldir%/mumble
-%canon_reldir%_mumble_SOURCES = %reldir%/one.c
-END
-
-cat > top.mk << 'END'
-%canon_reldir%_top_whoami:
- @echo "I am %reldir%/top.mk"
-
-bin_PROGRAMS += %D%/scream
-%C%_scream_SOURCES = %D%/two.c
-END
-
-cat > reltop.mk << 'END'
-%C%_reltop_whoami:
- @echo "I am %D%/reltop.mk"
-
-bin_PROGRAMS += %reldir%/sigh
-%canon_reldir%_sigh_SOURCES = %reldir%/three.c
-END
-
-cat > one.c << 'END'
-int main(void) { return 0; }
-END
-
-cp local.mk foo
-cp local.mk foo/bar
-cp local.mk foo/foobar
-cp local.mk zot
-echo "include %reldir%/bar/local.mk" >> foo/local.mk
-
-cp one.c foo
-cp one.c foo/bar
-cp one.c foo/foobar
-cp one.c zot
-cp one.c two.c
-cp one.c three.c
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-./configure
-
-$MAKE whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am local.mk" output
-$MAKE foo_whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am foo/local.mk" output
-$MAKE foo_bar_whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am foo/bar/local.mk" output
-$MAKE foo_foobar_whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am foo/foobar/local.mk" output
-
-$MAKE
-./mumble
-foo/mumble
-foo/bar/mumble
-foo/foobar/mumble
-
-cd zot
-
-$MAKE ___top_whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am ../top.mk" output
-$MAKE ___reltop_whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am ../reltop.mk" output
-$MAKE whoami >output 2>&1 || { cat output; exit 1; }
-cat output
-grep "I am local.mk" output
-
-$MAKE
-./mumble
-../scream
-../sigh
--
cgit v1.2.1
From 57b72c4b8e8d5521b0a83aaa445276c2155dc64e Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 13 Feb 2013 19:39:38 +0100
Subject: style: call perl functions 'like_this()', not '&like_this()'
We can do so now that our build rules auto-generate a list of
prototypes for all functions ins our scripts.
* automake.in: Adjust throughout.
* HACKING: Adjust advises.
Signed-off-by: Stefano Lattarini
---
HACKING | 5 +-
automake.in | 552 ++++++++++++++++++++++++++++++------------------------------
2 files changed, 278 insertions(+), 279 deletions(-)
diff --git a/HACKING b/HACKING
index 8f51ff425..a4f89bd66 100644
--- a/HACKING
+++ b/HACKING
@@ -96,11 +96,8 @@
default), and other portions using the GNU style (cperl-mode's
default). Write new code using GNU style.
-* Don't use & for function calls, unless required.
+* Don't use & for function calls, unless really required.
The use of & prevents prototypes from being checked.
- Just as above, don't change massively all the code to strip the
- &, just convert the old code as you work on it, and write new
- code without.
============================================================================
= Working with git
diff --git a/automake.in b/automake.in
index 8466ee421..0df09653e 100644
--- a/automake.in
+++ b/automake.in
@@ -264,7 +264,7 @@ my %ac_config_files_location = ();
my %ac_config_files_condition = ();
# Directory to search for configure-required files. This
-# will be computed by &locate_aux_dir and can be set using
+# will be computed by locate_aux_dir() and can be set using
# AC_CONFIG_AUX_DIR in configure.ac.
# $CONFIG_AUX_DIR is the 'raw' directory, valid only in the source-tree.
my $config_aux_dir = '';
@@ -539,8 +539,8 @@ Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
################################################################
-# &initialize_per_input ()
-# ------------------------
+# initialize_per_input ()
+# -----------------------
# (Re)-Initialize per-Makefile.am variables.
sub initialize_per_input ()
{
@@ -995,8 +995,8 @@ sub subst ($)
# $BACKPATH
-# &backname ($RELDIR)
-# --------------------
+# backname ($RELDIR)
+# -------------------
# If I "cd $RELDIR", then to come back, I should "cd $BACKPATH".
# For instance 'src/foo' => '../..'.
# Works with non strictly increasing paths, i.e., 'src/../lib' => '..'.
@@ -1228,10 +1228,10 @@ sub handle_languages ()
if (keys %extension_seen && keys %dep_files)
{
# Set location of depcomp.
- &define_variable ('depcomp',
- "\$(SHELL) $am_config_aux_dir/depcomp",
- INTERNAL);
- &define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
+ define_variable ('depcomp',
+ "\$(SHELL) $am_config_aux_dir/depcomp",
+ INTERNAL);
+ define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
@@ -1254,15 +1254,15 @@ sub handle_languages ()
# Compute the set of directories to remove in distclean-depend.
my @depdirs = uniq (map { dirname ($_) } @deplist);
- $output_rules .= &file_contents ('depend',
- new Automake::Location,
- DEPDIRS => "@depdirs");
+ $output_rules .= file_contents ('depend',
+ new Automake::Location,
+ DEPDIRS => "@depdirs");
}
}
else
{
- &define_variable ('depcomp', '', INTERNAL);
- &define_variable ('am__depfiles_maybe', '', INTERNAL);
+ define_variable ('depcomp', '', INTERNAL);
+ define_variable ('am__depfiles_maybe', '', INTERNAL);
}
my %done;
@@ -1297,7 +1297,7 @@ sub handle_languages ()
'FASTDEP' => $FASTDEP,
'-c' => $lang->compile_flag || '',
# These are not used, but they need to be defined
- # so &transform do not complain.
+ # so transform() do not complain.
SUBDIROBJ => 0,
'DERIVED-EXT' => 'BUG',
DIST_SOURCE => 1,
@@ -1320,7 +1320,7 @@ sub handle_languages ()
# Compute a possible derived extension.
# This is not used by depend2.am.
- my $der_ext = (&{$lang->output_extensions} ($ext))[0];
+ my $der_ext = ($lang->output_extensions->($ext))[0];
# When we output an inference rule like '.c.o:' we
# have two cases to consider: either subdir-objects
@@ -1490,7 +1490,7 @@ sub handle_languages ()
if ($needs_c)
{
- &define_compiler_variable ($languages{'c'})
+ define_compiler_variable ($languages{'c'})
unless defined $done{$languages{'c'}};
define_linker_variable ($languages{'c'});
}
@@ -1625,13 +1625,13 @@ sub handle_single_transform ($$$$$%)
# language function.
my $aggregate = 'AM';
- $extension = &derive_suffix ($extension, $obj);
+ $extension = derive_suffix ($extension, $obj);
my $lang;
if ($extension_map{$extension} &&
($lang = $languages{$extension_map{$extension}}))
{
# Found the language, so see what it says.
- &saw_extension ($extension);
+ saw_extension ($extension);
# Do we have per-executable flags for this executable?
my $have_per_exec_flags = 0;
@@ -1871,7 +1871,7 @@ EOF
unshift (@files, $object);
# Distribute derived sources unless the source they are
# derived from is not.
- &push_dist_common ($object)
+ push_dist_common ($object)
unless ($topparent =~ /^(?:nobase_)?nodist_/);
next;
}
@@ -1926,7 +1926,7 @@ EOF
unless option 'no-dependencies';
}
- &pretty_print_rule ($object . ':', "\t", @dep_list)
+ pretty_print_rule ($object . ':', "\t", @dep_list)
if scalar @dep_list > 0;
}
@@ -2056,7 +2056,7 @@ sub handle_source_transform ($$$$%)
}
if ($needlinker)
{
- $linker ||= &resolve_linker (%linkers_used);
+ $linker ||= resolve_linker (%linkers_used);
}
my @keys = sort keys %used_pfx;
@@ -2096,7 +2096,7 @@ sub handle_source_transform ($$$$%)
$default_source = '$(srcdir)/' . $default_source;
}
- &define_variable ($one_file . "_SOURCES", $default_source, $where);
+ define_variable ($one_file . "_SOURCES", $default_source, $where);
push (@sources, $default_source);
push (@dist_sources, $default_source);
@@ -2106,7 +2106,7 @@ sub handle_source_transform ($$$$%)
$one_file . '_SOURCES',
$one_file, $obj,
$default_source, %transform);
- $linker ||= &resolve_linker (%linkers_used);
+ $linker ||= resolve_linker (%linkers_used);
define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
}
else
@@ -2265,8 +2265,8 @@ sub handle_LIBOBJS ($$$)
{
if ($iter =~ /\.[cly]$/)
{
- &saw_extension ($&);
- &saw_extension ('.c');
+ saw_extension ($&);
+ saw_extension ('.c');
}
if ($iter =~ /\.h$/)
@@ -2299,7 +2299,7 @@ sub handle_ALLOCA ($$$)
$var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
$dep_files{$dir . '$(DEPDIR)/alloca.P' . $myobjext} = 1;
require_libsource_with_macro ($cond, $var, FOREIGN, 'alloca.c');
- &saw_extension ('.c');
+ saw_extension ('.c');
}
# Canonicalize the input parameter
@@ -2317,7 +2317,7 @@ sub check_canonical_spelling ($@)
{
my ($name, @suffixes) = @_;
- my $xname = &canonicalize ($name);
+ my $xname = canonicalize ($name);
if ($xname ne $name)
{
foreach my $xt (@suffixes)
@@ -2377,11 +2377,11 @@ sub handle_compile ()
}
my ($coms, $vars, $rules) =
- &file_contents_internal (1, "$libdir/am/compile.am",
- new Automake::Location,
- ('DEFAULT_INCLUDES' => $default_includes,
- 'MOSTLYRMS' => join ("\n", @mostly_rms),
- 'DISTRMS' => join ("\n", @dist_rms)));
+ file_contents_internal (1, "$libdir/am/compile.am",
+ new Automake::Location,
+ 'DEFAULT_INCLUDES' => $default_includes,
+ 'MOSTLYRMS' => join ("\n", @mostly_rms),
+ 'DISTRMS' => join ("\n", @dist_rms));
$output_vars .= $vars;
$output_rules .= "$coms$rules";
}
@@ -2410,8 +2410,8 @@ sub handle_libtool ()
check_user_variables 'LIBTOOLFLAGS';
# Output the libtool compilation rules.
- $output_rules .= &file_contents ('libtool',
- new Automake::Location,
+ $output_rules .= file_contents ('libtool',
+ new Automake::Location,
LTRMS => join ("\n", @libtool_rms));
}
@@ -2420,14 +2420,14 @@ sub handle_libtool ()
# Handle C programs.
sub handle_programs ()
{
- my @proglist = &am_install_var ('progs', 'PROGRAMS',
- 'bin', 'sbin', 'libexec', 'pkglibexec',
- 'noinst', 'check');
+ my @proglist = am_install_var ('progs', 'PROGRAMS',
+ 'bin', 'sbin', 'libexec', 'pkglibexec',
+ 'noinst', 'check');
return if ! @proglist;
$must_handle_compiled_objects = 1;
my $seen_global_libobjs =
- var ('LDADD') && &handle_lib_objects ('', 'LDADD');
+ var ('LDADD') && handle_lib_objects ('', 'LDADD');
foreach my $pair (@proglist)
{
@@ -2439,30 +2439,30 @@ sub handle_programs ()
$known_programs{$one_file} = $where;
# Canonicalize names and check for misspellings.
- my $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
- '_SOURCES', '_OBJECTS',
- '_DEPENDENCIES');
+ my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
+ '_SOURCES', '_OBJECTS',
+ '_DEPENDENCIES');
$where->push_context ("while processing program '$one_file'");
$where->set (INTERNAL->get);
- my $linker = &handle_source_transform ($xname, $one_file, $obj, $where,
- NONLIBTOOL => 1, LIBTOOL => 0);
+ my $linker = handle_source_transform ($xname, $one_file, $obj, $where,
+ NONLIBTOOL => 1, LIBTOOL => 0);
if (var ($xname . "_LDADD"))
{
- $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD');
+ $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD');
}
else
{
# User didn't define prog_LDADD override. So do it.
- &define_variable ($xname . '_LDADD', '$(LDADD)', $where);
+ define_variable ($xname . '_LDADD', '$(LDADD)', $where);
# This does a bit too much work. But we need it to
# generate _DEPENDENCIES when appropriate.
if (var ('LDADD'))
{
- $seen_libobjs = &handle_lib_objects ($xname, 'LDADD');
+ $seen_libobjs = handle_lib_objects ($xname, 'LDADD');
}
}
@@ -2474,7 +2474,7 @@ sub handle_programs ()
set_seen ($xname . '_LDFLAGS');
# Determine program to use for link.
- my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xname);
+ my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname);
$vlink = verbose_flag ($vlink || 'GEN');
# If the resulting program lies in a subdirectory,
@@ -2483,24 +2483,24 @@ sub handle_programs ()
$libtool_clean_directories{dirname ($one_file)} = 1;
- $output_rules .= &file_contents ('program',
- $where,
- PROGRAM => $one_file,
- XPROGRAM => $xname,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp,
- EXEEXT => '$(EXEEXT)');
+ $output_rules .= file_contents ('program',
+ $where,
+ PROGRAM => $one_file,
+ XPROGRAM => $xname,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ DIRSTAMP => $dirstamp,
+ EXEEXT => '$(EXEEXT)');
if ($seen_libobjs || $seen_global_libobjs)
{
if (var ($xname . '_LDADD'))
{
- &check_libobjs_sources ($xname, $xname . '_LDADD');
+ check_libobjs_sources ($xname, $xname . '_LDADD');
}
elsif (var ('LDADD'))
{
- &check_libobjs_sources ($xname, 'LDADD');
+ check_libobjs_sources ($xname, 'LDADD');
}
}
}
@@ -2512,8 +2512,8 @@ sub handle_programs ()
# Handle libraries.
sub handle_libraries ()
{
- my @liblist = &am_install_var ('libs', 'LIBRARIES',
- 'lib', 'pkglib', 'noinst', 'check');
+ my @liblist = am_install_var ('libs', 'LIBRARIES',
+ 'lib', 'pkglib', 'noinst', 'check');
return if ! @liblist;
$must_handle_compiled_objects = 1;
@@ -2526,9 +2526,9 @@ sub handle_libraries ()
$var->requires_variables ('library used', 'RANLIB');
}
- &define_variable ('AR', 'ar', INTERNAL);
- &define_variable ('ARFLAGS', 'cru', INTERNAL);
- &define_verbose_tagvar ('AR');
+ define_variable ('AR', 'ar', INTERNAL);
+ define_variable ('ARFLAGS', 'cru', INTERNAL);
+ define_verbose_tagvar ('AR');
foreach my $pair (@liblist)
{
@@ -2555,27 +2555,27 @@ sub handle_libraries ()
my $obj = '.$(OBJEXT)';
# Canonicalize names and check for misspellings.
- my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
- '_OBJECTS', '_DEPENDENCIES',
- '_AR');
+ my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
+ '_OBJECTS', '_DEPENDENCIES',
+ '_AR');
if (! var ($xlib . '_AR'))
{
- &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
+ define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
}
# Generate support for conditional object inclusion in
# libraries.
if (var ($xlib . '_LIBADD'))
{
- if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+ if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
{
$seen_libobjs = 1;
}
}
else
{
- &define_variable ($xlib . "_LIBADD", '', $where);
+ define_variable ($xlib . "_LIBADD", '', $where);
}
reject_var ($xlib . '_LDADD',
@@ -2585,8 +2585,8 @@ sub handle_libraries ()
set_seen ($xlib . '_DEPENDENCIES');
set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
- &handle_source_transform ($xlib, $onelib, $obj, $where,
- NONLIBTOOL => 1, LIBTOOL => 0);
+ handle_source_transform ($xlib, $onelib, $obj, $where,
+ NONLIBTOOL => 1, LIBTOOL => 0);
# If the resulting library lies in a subdirectory,
# make sure this directory will exist.
@@ -2594,19 +2594,19 @@ sub handle_libraries ()
my $verbose = verbose_flag ('AR');
my $silent = silent_flag ();
- $output_rules .= &file_contents ('library',
- $where,
- VERBOSE => $verbose,
- SILENT => $silent,
- LIBRARY => $onelib,
- XLIBRARY => $xlib,
- DIRSTAMP => $dirstamp);
+ $output_rules .= file_contents ('library',
+ $where,
+ VERBOSE => $verbose,
+ SILENT => $silent,
+ LIBRARY => $onelib,
+ XLIBRARY => $xlib,
+ DIRSTAMP => $dirstamp);
if ($seen_libobjs)
{
if (var ($xlib . '_LIBADD'))
{
- &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+ check_libobjs_sources ($xlib, $xlib . '_LIBADD');
}
}
@@ -2625,8 +2625,8 @@ sub handle_libraries ()
# Handle shared libraries.
sub handle_ltlibraries ()
{
- my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
- 'noinst', 'lib', 'pkglib', 'check');
+ my @liblist = am_install_var ('ltlib', 'LTLIBRARIES',
+ 'noinst', 'lib', 'pkglib', 'check');
return if ! @liblist;
$must_handle_compiled_objects = 1;
@@ -2728,9 +2728,9 @@ sub handle_ltlibraries ()
my $obj = '.lo';
# Canonicalize names and check for misspellings.
- my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
- '_SOURCES', '_OBJECTS',
- '_DEPENDENCIES');
+ my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
+ '_SOURCES', '_OBJECTS',
+ '_DEPENDENCIES');
# Check that the library fits the standard naming convention.
my $libname_rx = '^lib.*\.la';
@@ -2777,25 +2777,25 @@ sub handle_ltlibraries ()
# libraries.
if (var ($xlib . '_LIBADD'))
{
- if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+ if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
{
$seen_libobjs = 1;
}
}
else
{
- &define_variable ($xlib . "_LIBADD", '', $where);
+ define_variable ($xlib . "_LIBADD", '', $where);
}
reject_var ("${xlib}_LDADD",
"use '${xlib}_LIBADD', not '${xlib}_LDADD'");
- my $linker = &handle_source_transform ($xlib, $onelib, $obj, $where,
- NONLIBTOOL => 0, LIBTOOL => 1);
+ my $linker = handle_source_transform ($xlib, $onelib, $obj, $where,
+ NONLIBTOOL => 0, LIBTOOL => 1);
# Determine program to use for link.
- my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xlib);
+ my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib);
$vlink = verbose_flag ($vlink || 'GEN');
my $rpathvar = "am_${xlib}_rpath";
@@ -2840,19 +2840,19 @@ sub handle_ltlibraries ()
my $dirname = dirname $onelib;
$libtool_clean_directories{$dirname} = 1;
- $output_rules .= &file_contents ('ltlibrary',
- $where,
- LTLIBRARY => $onelib,
- XLTLIBRARY => $xlib,
- RPATH => $rpath,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp);
+ $output_rules .= file_contents ('ltlibrary',
+ $where,
+ LTLIBRARY => $onelib,
+ XLTLIBRARY => $xlib,
+ RPATH => $rpath,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ DIRSTAMP => $dirstamp);
if ($seen_libobjs)
{
if (var ($xlib . '_LIBADD'))
{
- &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+ check_libobjs_sources ($xlib, $xlib . '_LIBADD');
}
}
@@ -2898,9 +2898,9 @@ sub handle_scripts ()
# NOTE we no longer automatically clean SCRIPTS, because it is
# useful to sometimes distribute scripts verbatim. This happens
# e.g. in Automake itself.
- &am_install_var ('-candist', 'scripts', 'SCRIPTS',
- 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
- 'noinst', 'check');
+ am_install_var ('-candist', 'scripts', 'SCRIPTS',
+ 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
+ 'noinst', 'check');
}
@@ -2911,8 +2911,8 @@ sub handle_scripts ()
## ------------------------ ##
# ($OUTFILE, $VFILE)
-# &scan_texinfo_file ($FILENAME)
-# ------------------------------
+# scan_texinfo_file ($FILENAME)
+# -----------------------------
# $OUTFILE - name of the info file produced by $FILENAME.
# $VFILE - name of the version.texi file used (undef if none).
sub scan_texinfo_file ($)
@@ -3450,7 +3450,7 @@ sub handle_man_pages ()
$trans_sect_vars{$varname} = 1;
}
- &push_dist_common ($varname)
+ push_dist_common ($varname)
if $pfx eq 'dist_';
}
}
@@ -3485,7 +3485,7 @@ sub handle_man_pages ()
{
$trans_vars{$varname} = 1;
}
- &push_dist_common ($varname)
+ push_dist_common ($varname)
if $pfx eq 'dist_';
}
}
@@ -3529,18 +3529,18 @@ sub handle_man_pages ()
@unsorted_deps = (keys %notrans_vars, keys %trans_vars,
keys %notrans_this_sect, keys %trans_this_sect);
my @deps = sort @unsorted_deps;
- $output_rules .= &file_contents ('mans',
- new Automake::Location,
- SECTION => $section,
- DEPS => "@deps",
- NOTRANS_MANS => $notrans_mans,
- NOTRANS_SECT_LIST => "@notrans_sect_list",
- HAVE_NOTRANS => $have_notrans,
- NOTRANS_LIST => "@notrans_list",
- TRANS_MANS => $trans_mans,
- TRANS_SECT_LIST => "@trans_sect_list",
- HAVE_TRANS => $have_trans,
- TRANS_LIST => "@trans_list");
+ $output_rules .= file_contents ('mans',
+ new Automake::Location,
+ SECTION => $section,
+ DEPS => "@deps",
+ NOTRANS_MANS => $notrans_mans,
+ NOTRANS_SECT_LIST => "@notrans_sect_list",
+ HAVE_NOTRANS => $have_notrans,
+ NOTRANS_LIST => "@notrans_list",
+ TRANS_MANS => $trans_mans,
+ TRANS_SECT_LIST => "@trans_sect_list",
+ HAVE_TRANS => $have_trans,
+ TRANS_LIST => "@trans_list");
}
@unsorted_deps = (keys %notrans_vars, keys %trans_vars,
@@ -3557,10 +3557,10 @@ sub handle_man_pages ()
# Handle DATA variables.
sub handle_data ()
{
- &am_install_var ('-noextra', '-candist', 'data', 'DATA',
- 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
- 'ps', 'sysconf', 'sharedstate', 'localstate',
- 'pkgdata', 'lisp', 'noinst', 'check');
+ am_install_var ('-noextra', '-candist', 'data', 'DATA',
+ 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
+ 'ps', 'sysconf', 'sharedstate', 'localstate',
+ 'pkgdata', 'lisp', 'noinst', 'check');
}
# Handle TAGS.
@@ -3586,7 +3586,7 @@ sub handle_tags ()
if (rvar('am__tagged_files')->value_as_list_recursive
|| var ('ETAGS_ARGS') || var ('SUBDIRS'))
{
- $output_rules .= &file_contents ('tags', new Automake::Location);
+ $output_rules .= file_contents ('tags', new Automake::Location);
set_seen 'TAGS_DEPENDENCIES';
}
else
@@ -3695,7 +3695,7 @@ sub handle_dist ()
if ($relative_dir eq '.'
&& $config_aux_dir_set_in_configure_ac)
{
- if (! &is_make_dir ($config_aux_dir))
+ if (! is_make_dir ($config_aux_dir))
{
$check_aux = 1;
}
@@ -3706,14 +3706,14 @@ sub handle_dist ()
# The file might be absent, but if it can be built it's ok.
|| rule $cfile)
{
- &push_dist_common ($cfile);
+ push_dist_common ($cfile);
}
# Don't use 'elsif' here because a file might meaningfully
# appear in both directories.
if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile))
{
- &push_dist_common ("$config_aux_dir/$cfile")
+ push_dist_common ("$config_aux_dir/$cfile")
}
}
@@ -3741,7 +3741,7 @@ sub handle_dist ()
# Files to distributed. Don't use ->value_as_list_recursive
# as it recursively expands '$(dist_pkgdata_DATA)' etc.
my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
- @dist_common = uniq @dist_common;
+ @dist_common = uniq (@dist_common);
variable_delete 'DIST_COMMON';
define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
@@ -3762,10 +3762,10 @@ sub handle_dist ()
my $flm = option ('filename-length-max');
my $filename_filter = $flm ? '.' x $flm->[1] : '';
- $output_rules .= &file_contents ('distdir',
- new Automake::Location,
- %transform,
- FILENAME_FILTER => $filename_filter);
+ $output_rules .= file_contents ('distdir',
+ new Automake::Location,
+ %transform,
+ FILENAME_FILTER => $filename_filter);
}
@@ -3825,8 +3825,8 @@ sub check_directories_in_var ($)
skip_ac_subst => 1);
}
-# &handle_subdirs ()
-# ------------------
+# handle_subdirs ()
+# -----------------
# Handle subdirectories.
sub handle_subdirs ()
{
@@ -3840,14 +3840,14 @@ sub handle_subdirs ()
check_directories_in_var $dsubdirs
if $dsubdirs;
- $output_rules .= &file_contents ('subdirs', new Automake::Location);
+ $output_rules .= file_contents ('subdirs', new Automake::Location);
rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
}
# ($REGEN, @DEPENDENCIES)
-# &scan_aclocal_m4
-# ----------------
+# scan_aclocal_m4
+# ---------------
# If aclocal.m4 creation is automated, return the list of its dependencies.
sub scan_aclocal_m4 ()
{
@@ -3858,7 +3858,7 @@ sub scan_aclocal_m4 ()
if (-f 'aclocal.m4')
{
- &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
+ define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
my $aclocal = new Automake::XFile "< aclocal.m4";
my $line = $aclocal->getline;
@@ -3898,13 +3898,13 @@ sub substitute_ac_subst_variables_worker($)
sub substitute_ac_subst_variables ($)
{
my ($text) = @_;
- $text =~ s/\${([^ \t=:+{}]+)}/&substitute_ac_subst_variables_worker ($1)/ge;
+ $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
return $text;
}
# @DEPENDENCIES
-# &prepend_srcdir (@INPUTS)
-# -------------------------
+# prepend_srcdir (@INPUTS)
+# ------------------------
# Prepend $(srcdir) or $(top_srcdir) to all @INPUTS. The idea is that
# if an input file has a directory part the same as the current
# directory, then the directory part is simply replaced by $(srcdir).
@@ -3977,8 +3977,8 @@ sub rewrite_inputs_into_dependencies ($@)
-# &handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
-# ------------------------------------------------------------------
+# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
+# -----------------------------------------------------------------
# Handle remaking and configure stuff.
# We need the name of the input file, to do proper remaking rules.
sub handle_configure ($$$@)
@@ -4024,7 +4024,7 @@ sub handle_configure ($$$@)
if ($relative_dir eq '.')
{
- &push_dist_common ('acconfig.h')
+ push_dist_common ('acconfig.h')
if -f 'acconfig.h';
}
@@ -4043,7 +4043,7 @@ sub handle_configure ($$$@)
# directory and the header's directory doesn't have a
# Makefile, then we also want to build the header.
if ($relative_dir eq $config_h_dir
- || ($relative_dir eq '.' && ! &is_make_dir ($config_h_dir)))
+ || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir)))
{
my ($cn_sans_dir, $stamp_dir);
if ($relative_dir eq $config_h_dir)
@@ -4190,7 +4190,7 @@ sub handle_configure ($$$@)
my $fd = dirname ($file);
if ($fd ne $relative_dir)
{
- if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+ if ($relative_dir eq '.' && ! is_make_dir ($fd))
{
$local = $file;
}
@@ -4245,7 +4245,7 @@ sub handle_configure ($$$@)
my $fd = dirname ($link);
if ($fd ne $relative_dir)
{
- if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+ if ($relative_dir eq '.' && ! is_make_dir ($fd))
{
$local = $link;
}
@@ -4273,7 +4273,7 @@ sub handle_configure ($$$@)
# At the top-level ('.') we also distribute files whose
# directory does not have a Makefile.
if (($fd eq $relative_dir)
- || ($relative_dir eq '.' && ! &is_make_dir ($fd)))
+ || ($relative_dir eq '.' && ! is_make_dir ($fd)))
{
# The following will distribute $file as a side-effect when
# it is appropriate (i.e., when $file is not already an output).
@@ -4293,13 +4293,13 @@ sub handle_configure ($$$@)
# Handle C headers.
sub handle_headers ()
{
- my @r = &am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
- 'oldinclude', 'pkginclude',
- 'noinst', 'check');
+ my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
+ 'oldinclude', 'pkginclude',
+ 'noinst', 'check');
foreach (@r)
{
next unless $_->[1] =~ /\..*$/;
- &saw_extension ($&);
+ saw_extension ($&);
}
}
@@ -4398,7 +4398,7 @@ sub handle_footer ()
# Generate 'make install' rules.
sub handle_install ()
{
- $output_rules .= &file_contents
+ $output_rules .= file_contents
('install',
new Automake::Location,
maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
@@ -4434,8 +4434,8 @@ sub handle_all ($)
push (@all, "all-local")
if user_phony_rule "all-local";
- &pretty_print_rule ("all-am:", "\t\t", @all);
- &depend ('.PHONY', 'all-am', 'all');
+ pretty_print_rule ("all-am:", "\t\t", @all);
+ depend ('.PHONY', 'all-am', 'all');
# Output 'all'.
@@ -4491,7 +4491,7 @@ sub handle_user_recursion ()
# associated 'foo-local' rule; we define it as an empty rule by
# default, so that the user can transparently extend it in his
# own Makefile.am.
- pretty_print_rule ("$target-local:");
+ pretty_print_rule ("$target-local:", '', '');
# $target-recursive might as well be undefined, so do not add
# it here; it's taken care of in subdirs.am anyway.
depend (".PHONY", "$target-am", "$target-local");
@@ -4499,8 +4499,8 @@ sub handle_user_recursion ()
}
-# &do_check_merge_target ()
-# -------------------------
+# do_check_merge_target ()
+# ------------------------
# Handle check merge target specially.
sub do_check_merge_target ()
{
@@ -4578,7 +4578,7 @@ sub handle_clean ($)
push @{$rms{$when}}, "\t-$rm\n";
}
- $output_rules .= &file_contents
+ $output_rules .= file_contents
('clean',
new Automake::Location,
MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}),
@@ -4590,10 +4590,9 @@ sub handle_clean ($)
}
-# &target_cmp ($A, $B)
-# --------------------
-# Subroutine for &handle_factored_dependencies to let '.PHONY' and
-# other '.TARGETS' be last.
+# Subroutine for handle_factored_dependencies() to let '.PHONY' and
+# other '.TARGETS' be last. This is meant to be used as a comparison
+# subroutine passed to the sort built-int.
sub target_cmp
{
return 0 if $a eq $b;
@@ -4609,8 +4608,8 @@ sub target_cmp
}
-# &handle_factored_dependencies ()
-# --------------------------------
+# handle_factored_dependencies ()
+# -------------------------------
# Handle everything related to gathered targets.
sub handle_factored_dependencies ()
{
@@ -4689,7 +4688,7 @@ sub handle_factored_dependencies ()
foreach my $cond (@undefined_conds)
{
my $condstr = $cond->subst_string;
- &pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
+ pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
$output_rules .= $actions{$_} if defined $actions{$_};
$output_rules .= "\n";
}
@@ -4697,8 +4696,8 @@ sub handle_factored_dependencies ()
}
-# &handle_tests_dejagnu ()
-# ------------------------
+# handle_tests_dejagnu ()
+# -----------------------
sub handle_tests_dejagnu ()
{
push (@check_tests, 'check-DEJAGNU');
@@ -4773,7 +4772,7 @@ sub handle_tests ()
{
if (option 'dejagnu')
{
- &handle_tests_dejagnu;
+ handle_tests_dejagnu;
}
else
{
@@ -4788,9 +4787,9 @@ sub handle_tests ()
{
push (@check_tests, 'check-TESTS');
my $check_deps = "@check";
- $output_rules .= &file_contents ('check', new Automake::Location,
- SERIAL_TESTS => !! option 'serial-tests',
- CHECK_DEPS => $check_deps);
+ $output_rules .= file_contents ('check', new Automake::Location,
+ SERIAL_TESTS => !! option 'serial-tests',
+ CHECK_DEPS => $check_deps);
# Tests that are known programs should have $(EXEEXT) appended.
# For matching purposes, we need to adjust XFAIL_TESTS as well.
@@ -4905,8 +4904,8 @@ sub handle_tests ()
# Handle Emacs Lisp.
sub handle_emacs_lisp ()
{
- my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
- 'lisp', 'noinst');
+ my @elfiles = am_install_var ('-candist', 'lisp', 'LISP',
+ 'lisp', 'noinst');
return if ! @elfiles;
@@ -4926,21 +4925,21 @@ sub handle_emacs_lisp ()
# Handle Python
sub handle_python ()
{
- my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
- 'noinst');
+ my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON',
+ 'noinst');
return if ! @pyfiles;
require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
- &define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
+ define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
}
# Handle Java.
sub handle_java ()
{
- my @sourcelist = &am_install_var ('-candist',
- 'java', 'JAVA',
- 'noinst', 'check');
+ my @sourcelist = am_install_var ('-candist',
+ 'java', 'JAVA',
+ 'noinst', 'check');
return if ! @sourcelist;
my @prefixes = am_primary_prefixes ('JAVA', 1,
@@ -5006,8 +5005,8 @@ sub handle_minor_options ()
################################################################
# ($OUTPUT, @INPUTS)
-# &split_config_file_spec ($SPEC)
-# -------------------------------
+# split_config_file_spec ($SPEC)
+# ------------------------------
# Decode the Autoconf syntax for config files (files, headers, links
# etc.).
sub split_config_file_spec ($)
@@ -5044,8 +5043,8 @@ sub locate_am (@)
my %make_list;
-# &scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
-# ---------------------------------------------------
+# scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
+# --------------------------------------------------
# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
# (or AC_OUTPUT).
sub scan_autoconf_config_files ($$)
@@ -5086,8 +5085,8 @@ sub scan_autoconf_config_files ($$)
}
-# &scan_autoconf_traces ($FILENAME)
-# ---------------------------------
+# scan_autoconf_traces ($FILENAME)
+# --------------------------------
sub scan_autoconf_traces ($)
{
my ($filename) = @_;
@@ -5392,8 +5391,8 @@ EOF
}
-# &scan_autoconf_files ()
-# -----------------------
+# scan_autoconf_files ()
+# ----------------------
# Check whether we use 'configure.ac' or 'configure.in'.
# Scan it (and possibly 'aclocal.m4') for interesting things.
# We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
@@ -5563,7 +5562,7 @@ sub lang_yacc_rewrite
{
my ($directory, $base, $ext) = @_;
- my $r = &lang_sub_obj;
+ my $r = lang_sub_obj;
(my $newext = $ext) =~ tr/y/c/;
return ($r, $newext);
}
@@ -5574,7 +5573,7 @@ sub lang_lex_rewrite
{
my ($directory, $base, $ext) = @_;
- my $r = &lang_sub_obj;
+ my $r = lang_sub_obj;
(my $newext = $ext) =~ tr/l/c/;
return ($r, $newext);
}
@@ -5772,9 +5771,9 @@ sub lang_yacc_target_hook ($$$$%)
. "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; fi\n";
}
# Distribute the generated file, unless its .y source was
- # listed in a nodist_ variable. (&handle_source_transform
+ # listed in a nodist_ variable. (handle_source_transform()
# will set DIST_SOURCE.)
- &push_dist_common ($header)
+ push_dist_common ($header)
if $transform{'DIST_SOURCE'};
# The GNU rules say that yacc/lex output files should be removed
@@ -5807,7 +5806,7 @@ sub yacc_lex_finish_helper ()
# FIXME: for now, no line number.
require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
- &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
+ define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
}
sub lang_yacc_finish ()
@@ -5898,7 +5897,7 @@ sub register_language (%)
# Upate the $suffix_rule map.
foreach my $suffix (@{$lang->extensions})
{
- foreach my $dest (&{$lang->output_extensions} ($suffix))
+ foreach my $dest ($lang->output_extensions->($suffix))
{
register_suffix_rule (INTERNAL, $suffix, $dest);
}
@@ -5928,9 +5927,9 @@ sub derive_suffix ($$)
################################################################
# Pretty-print something and append to output_rules.
-sub pretty_print_rule (@)
+sub pretty_print_rule ($$@)
{
- $output_rules .= &makefile_wrap (@_);
+ $output_rules .= makefile_wrap (shift, shift, @_);
}
@@ -6068,8 +6067,8 @@ sub cond_stack_endif ($$$)
## ------------------------ ##
-# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
-# -----------------------------------------------------
+# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
+# ----------------------------------------------------
# Like define_variable, but the value is a list, and the variable may
# be defined conditionally. The second argument is the condition
# under which the value should be defined; this should be the empty
@@ -6139,14 +6138,14 @@ sub define_compiler_variable ($)
my $libtool_tag = '';
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
- &define_variable ($var, $value, INTERNAL);
+ define_variable ($var, $value, INTERNAL);
if (var ('LIBTOOL'))
{
my $verbose = define_verbose_libtool ();
- &define_variable ("LT$var",
- "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
- . "\$(LIBTOOLFLAGS) --mode=compile $value",
- INTERNAL);
+ define_variable ("LT$var",
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)"
+ . " \$(LIBTOOLFLAGS) --mode=compile $value",
+ INTERNAL);
}
define_verbose_tagvar ($lang->ccer || 'GEN');
}
@@ -6163,7 +6162,7 @@ sub define_linker_variable ($)
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
# CCLD = $(CC).
- &define_variable ($lang->lder, $lang->ld, INTERNAL);
+ define_variable ($lang->lder, $lang->ld, INTERNAL);
# CCLINK = $(CCLD) blah blah...
my $link = '';
if (var ('LIBTOOL'))
@@ -6172,9 +6171,9 @@ sub define_linker_variable ($)
$link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
. "\$(LIBTOOLFLAGS) --mode=link ";
}
- &define_variable ($lang->linker, $link . $lang->link, INTERNAL);
- &define_variable ($lang->compiler, $lang);
- &define_verbose_tagvar ($lang->lder || 'GEN');
+ define_variable ($lang->linker, $link . $lang->link, INTERNAL);
+ define_variable ($lang->compiler, $lang, INTERNAL);
+ define_verbose_tagvar ($lang->lder || 'GEN');
}
sub define_per_target_linker_variable ($$)
@@ -6221,14 +6220,14 @@ sub define_per_target_linker_variable ($$)
return ($lang->linker, $lang->lder)
if $link_command eq $orig_command;
- &define_variable ("${target}_LINK", $link_command, INTERNAL);
+ define_variable ("${target}_LINK", $link_command, INTERNAL);
return ("${target}_LINK", $lang->lder);
}
################################################################
-# &check_trailing_slash ($WHERE, $LINE)
-# -------------------------------------
+# check_trailing_slash ($WHERE, $LINE)
+# ------------------------------------
# Return 1 iff $LINE ends with a slash.
# Might modify $LINE.
sub check_trailing_slash ($\$)
@@ -6246,8 +6245,8 @@ sub check_trailing_slash ($\$)
}
-# &read_am_file ($AMFILE, $WHERE)
-# -------------------------------
+# read_am_file ($AMFILE, $WHERE)
+# ------------------------------
# Read Makefile.am and set up %contents. Simultaneously copy lines
# from Makefile.am into $output_trailer, or define variables as
# appropriate. NOTE we put rules in the trailer section. We want
@@ -6501,7 +6500,7 @@ sub read_am_file ($$)
$path = $relative_dir . "/" . $path if $relative_dir ne '.';
}
$where->push_context ("'$path' included from here");
- &read_am_file ($path, $where);
+ read_am_file ($path, $where);
$where->pop_context;
}
else
@@ -6547,7 +6546,7 @@ sub define_standard_variables ()
foreach my $var (sort keys %configure_vars)
{
- &define_configure_variable ($var);
+ define_configure_variable ($var);
}
$output_vars .= $comments . $rules;
@@ -6571,10 +6570,10 @@ sub read_main_am_file ($$)
# We want to predefine as many variables as possible. This lets
# the user set them with '+=' in Makefile.am.
- &define_standard_variables;
+ define_standard_variables;
# Read user file, which might override some of our values.
- &read_am_file ($amfile, new Automake::Location);
+ read_am_file ($amfile, new Automake::Location);
}
@@ -6582,8 +6581,8 @@ sub read_main_am_file ($$)
################################################################
# $FLATTENED
-# &flatten ($STRING)
-# ------------------
+# flatten ($STRING)
+# -----------------
# Flatten the $STRING and return the result.
sub flatten ($)
{
@@ -6715,8 +6714,8 @@ sub preprocess_file ($%)
# @PARAGRAPHS
-# &make_paragraphs ($MAKEFILE, [%TRANSFORM])
-# ------------------------------------------
+# make_paragraphs ($MAKEFILE, [%TRANSFORM])
+# -----------------------------------------
# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
# paragraphs.
sub make_paragraphs ($%)
@@ -6761,8 +6760,8 @@ sub make_paragraphs ($%)
# ($COMMENT, $VARIABLES, $RULES)
-# &file_contents_internal ($IS_AM, $FILE, $WHERE, [%TRANSFORM])
-# -------------------------------------------------------------
+# file_contents_internal ($IS_AM, $FILE, $WHERE, [%TRANSFORM])
+# ------------------------------------------------------------
# Return contents of a file from $libdir/am, automatically skipping
# macros or rules which are already known. $IS_AM iff the caller is
# reading an Automake file (as opposed to the user's Makefile.am).
@@ -6860,7 +6859,7 @@ sub file_contents_internal ($$$%)
my ($targets, $dependencies) = ($1, $2);
# Remove the escaped new lines.
# I don't know why, but I have to use a tmp $flat_deps.
- my $flat_deps = &flatten ($dependencies);
+ my $flat_deps = flatten ($dependencies);
my @deps = split (' ', $flat_deps);
foreach (split (' ', $targets))
@@ -6884,7 +6883,7 @@ sub file_contents_internal ($$$%)
# Output only if not in FALSE.
if (defined $dependencies{$_} && $cond != FALSE)
{
- &depend ($_, @deps);
+ depend ($_, @deps);
register_action ($_, $actions);
}
else
@@ -6954,8 +6953,8 @@ sub file_contents_internal ($$$%)
# $CONTENTS
-# &file_contents ($BASENAME, $WHERE, [%TRANSFORM])
-# ------------------------------------------------
+# file_contents ($BASENAME, $WHERE, [%TRANSFORM])
+# -----------------------------------------------
# Return contents of a file from $libdir/am, automatically skipping
# macros or rules which are already known.
sub file_contents ($$%)
@@ -6969,8 +6968,8 @@ sub file_contents ($$%)
# @PREFIX
-# &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
-# -----------------------------------------------------
+# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
+# ----------------------------------------------------
# Find all variable prefixes that are used for install directories. A
# prefix 'zar' qualifies iff:
#
@@ -7163,11 +7162,12 @@ sub am_install_var (@)
}
else
{
- # Strip any $(EXEEXT) suffix the user might have added, or this
- # will confuse &handle_source_transform and &check_canonical_spelling.
+ # Strip any $(EXEEXT) suffix the user might have added,
+ # or this will confuse handle_source_transform() and
+ # check_canonical_spelling().
# We'll add $(EXEEXT) back later anyway.
- # Do it here rather than in handle_programs so the uniquifying at the
- # end of this function works.
+ # Do it here rather than in handle_programs so the
+ # uniquifying at the end of this function works.
${$locvals}[1] =~ s/\$\(EXEEXT\)$//
if $primary eq 'PROGRAMS';
@@ -7211,18 +7211,17 @@ sub am_install_var (@)
# Singular form of $PRIMARY.
(my $one_primary = $primary) =~ s/S$//;
- $output_rules .= &file_contents ($file, $where,
- PRIMARY => $primary,
- ONE_PRIMARY => $one_primary,
- DIR => $X,
- NDIR => $nodir_name,
- BASE => $strip_subdir,
-
- EXEC => $exec_p,
- INSTALL => $install_p,
- DIST => $dist_p,
- DISTVAR => $distvar,
- 'CK-OPTS' => $check_options_p);
+ $output_rules .= file_contents ($file, $where,
+ PRIMARY => $primary,
+ ONE_PRIMARY => $one_primary,
+ DIR => $X,
+ NDIR => $nodir_name,
+ BASE => $strip_subdir,
+ EXEC => $exec_p,
+ INSTALL => $install_p,
+ DIST => $dist_p,
+ DISTVAR => $distvar,
+ 'CK-OPTS' => $check_options_p);
}
# The JAVA variable is used as the name of the Java interpreter.
@@ -7316,8 +7315,8 @@ sub locate_aux_dir ()
}
-# &push_required_file ($DIR, $FILE, $FULLFILE)
-# --------------------------------------------------
+# push_required_file ($DIR, $FILE, $FULLFILE)
+# -------------------------------------------------
# Push the given file onto DIST_COMMON.
sub push_required_file ($$$)
{
@@ -7353,7 +7352,7 @@ sub push_required_file ($$$)
$am_config_libobj_dir =~ s|/*$||;
push_dist_common ("$am_config_libobj_dir/$file");
}
- elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
+ elsif ($relative_dir eq '.' && ! is_make_dir ($dir))
{
# If we are doing the topmost directory, and the file is in a
# subdir which does not have a Makefile, then we distribute it
@@ -7403,8 +7402,8 @@ sub push_required_file ($$$)
# than once.
my %required_file_not_found = ();
-# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
-# --------------------------------------------------------
+# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# -------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
sub required_file_check_or_copy ($$$)
{
@@ -7512,8 +7511,8 @@ sub required_file_check_or_copy ($$$)
}
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
-# ----------------------------------------------------------------------
+# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ---------------------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
# $MYSTRICT is the strictness level at which this file becomes required.
# Worker threads may queue up the action to be serialized by the master,
@@ -7541,16 +7540,16 @@ sub require_file_internal ($$$@)
}
}
-# &require_file ($WHERE, $MYSTRICT, @FILES)
-# -----------------------------------------
+# require_file ($WHERE, $MYSTRICT, @FILES)
+# ----------------------------------------
sub require_file ($$@)
{
my ($where, $mystrict, @files) = @_;
require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
}
-# &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# -----------------------------------------------------------
+# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ----------------------------------------------------------
sub require_file_with_macro ($$$@)
{
my ($cond, $macro, $mystrict, @files) = @_;
@@ -7558,8 +7557,8 @@ sub require_file_with_macro ($$$@)
require_file ($macro->rdef ($cond)->location, $mystrict, @files);
}
-# &require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------------
+# require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
# Require an AC_LIBSOURCEd file. If AC_CONFIG_LIBOBJ_DIR was called, it
# must be in that directory. Otherwise expect it in the current directory.
sub require_libsource_with_macro ($$$@)
@@ -7577,9 +7576,9 @@ sub require_libsource_with_macro ($$$@)
}
}
-# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
# $MYSTRICT, @FILES)
-# ---------------------------------------------------------------
+# --------------------------------------------------------------
sub queue_required_file_check_or_copy ($$$$@)
{
my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
@@ -7595,8 +7594,8 @@ sub queue_required_file_check_or_copy ($$$$@)
$queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
}
-# &require_queued_file_check_or_copy ($QUEUE)
-# -------------------------------------------
+# require_queued_file_check_or_copy ($QUEUE)
+# ------------------------------------------
sub require_queued_file_check_or_copy ($)
{
my ($queue) = @_;
@@ -7628,8 +7627,8 @@ sub require_queued_file_check_or_copy ($)
}
}
-# &require_conf_file ($WHERE, $MYSTRICT, @FILES)
-# ----------------------------------------------
+# require_conf_file ($WHERE, $MYSTRICT, @FILES)
+# ---------------------------------------------
# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
sub require_conf_file ($$@)
{
@@ -7640,8 +7639,8 @@ sub require_conf_file ($$@)
}
-# &require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------------
+# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
sub require_conf_file_with_macro ($$$@)
{
my ($cond, $macro, $mystrict, @files) = @_;
@@ -7651,8 +7650,8 @@ sub require_conf_file_with_macro ($$$@)
################################################################
-# &require_build_directory ($DIRECTORY)
-# -------------------------------------
+# require_build_directory ($DIRECTORY)
+# ------------------------------------
# Emit rules to create $DIRECTORY if needed, and return
# the file that any target requiring this directory should be made
# dependent upon.
@@ -7692,8 +7691,8 @@ sub require_build_directory ($)
return $dirstamp;
}
-# &require_build_directory_maybe ($FILE)
-# --------------------------------------
+# require_build_directory_maybe ($FILE)
+# -------------------------------------
# If $FILE lies in a subdirectory, emit a rule to create this
# directory and return the file that $FILE should be made
# dependent upon. Otherwise, just return the empty string.
@@ -7745,8 +7744,8 @@ sub generate_makefile ($$)
# $OUTPUT is encoded. If it contains a ":" then the first element
# is the real output file, and all remaining elements are input
# files. We don't scan or otherwise deal with these input files,
- # other than to mark them as dependencies. See
- # &scan_autoconf_files for details.
+ # other than to mark them as dependencies. See the subroutine
+ # 'scan_autoconf_files' for details.
my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in});
$relative_dir = dirname ($makefile);
@@ -7802,9 +7801,9 @@ sub generate_makefile ($$)
handle_silent;
- # These must be run after all the sources are scanned. They
- # use variables defined by &handle_libraries, &handle_ltlibraries,
- # or &handle_programs.
+ # These must be run after all the sources are scanned. They use
+ # variables defined by handle_libraries(), handle_ltlibraries(),
+ # or handle_programs().
handle_compile;
handle_languages;
handle_libtool;
@@ -7915,6 +7914,9 @@ sub generate_makefile ($$)
# Helper function for usage().
sub print_autodist_files (@)
{
+ # NOTE: we need to call our 'uniq' function with the leading '&'
+ # here, because otherwise perl complains that "Unquoted string
+ # 'uniq' may clash with future reserved word".
my @lcomm = sort (&uniq (@_));
my @four;
@@ -8007,8 +8009,8 @@ General help using GNU software: .
}
-# &version ()
-# -----------
+# version ()
+# ----------
# Print version information
sub version ()
{
@@ -8062,7 +8064,7 @@ sub parse_arguments ()
set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
for my $warning (@warnings)
{
- &parse_warnings ('-W', $warning);
+ parse_warnings ('-W', $warning);
}
return unless @ARGV;
--
cgit v1.2.1
From 4356484dc4b1ff15760a735025877a174c85fe0f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 17 Feb 2013 00:04:28 +0100
Subject: cosmetics: fix some "docstring-like" comments in automake
* automake.in: Here. And remove some redundant ones.
Signed-off-by: Stefano Lattarini
---
automake.in | 107 ++++++++++++------------------------------------------------
1 file changed, 20 insertions(+), 87 deletions(-)
diff --git a/automake.in b/automake.in
index d4c25c4c0..1523053d6 100644
--- a/automake.in
+++ b/automake.in
@@ -1070,11 +1070,9 @@ sub define_verbose_var ($$;$)
if (! vardef ($verbose_var, TRUE));
}
-# Above should not be needed in the general automake code.
-
# verbose_flag (NAME)
# -------------------
-# Contents of %VERBOSE%: variable to expand before rule command.
+# Contents of '%VERBOSE%' variable to expand before rule command.
sub verbose_flag ($)
{
my ($name) = @_;
@@ -1104,8 +1102,6 @@ sub define_verbose_tagvar ($)
define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
}
-# define_verbose_texinfo
-# ----------------------
# Engage the needed silent rules machinery for assorted texinfo commands.
sub define_verbose_texinfo ()
{
@@ -1118,8 +1114,6 @@ sub define_verbose_texinfo ()
define_verbose_var('texidevnull', '> /dev/null');
}
-# define_verbose_libtool
-# ----------------------
# Engage the needed silent rules machinery for 'libtool --silent'.
sub define_verbose_libtool ()
{
@@ -2302,7 +2296,7 @@ sub handle_ALLOCA ($$$)
saw_extension ('.c');
}
-# Canonicalize the input parameter
+# Canonicalize the input parameter.
sub canonicalize ($)
{
my ($string) = @_;
@@ -2329,9 +2323,6 @@ sub check_canonical_spelling ($@)
return $xname;
}
-
-# handle_compile ()
-# -----------------
# Set up the compile suite.
sub handle_compile ()
{
@@ -2386,8 +2377,6 @@ sub handle_compile ()
$output_rules .= "$coms$rules";
}
-# handle_libtool ()
-# -----------------
# Handle libtool rules.
sub handle_libtool ()
{
@@ -2415,9 +2404,7 @@ sub handle_libtool ()
LTRMS => join ("\n", @libtool_rms));
}
-# handle_programs ()
-# ------------------
-# Handle C programs.
+
sub handle_programs ()
{
my @proglist = am_install_var ('progs', 'PROGRAMS',
@@ -2507,9 +2494,6 @@ sub handle_programs ()
}
-# handle_libraries ()
-# -------------------
-# Handle libraries.
sub handle_libraries ()
{
my @liblist = am_install_var ('libs', 'LIBRARIES',
@@ -2620,9 +2604,6 @@ sub handle_libraries ()
}
-# handle_ltlibraries ()
-# ---------------------
-# Handle shared libraries.
sub handle_ltlibraries ()
{
my @liblist = am_install_var ('ltlib', 'LTLIBRARIES',
@@ -2892,7 +2873,6 @@ sub check_typos ()
}
-# Handle scripts.
sub handle_scripts ()
{
# NOTE we no longer automatically clean SCRIPTS, because it is
@@ -2904,8 +2884,6 @@ sub handle_scripts ()
}
-
-
## ------------------------ ##
## Handling Texinfo files. ##
## ------------------------ ##
@@ -3064,7 +3042,7 @@ sub output_texinfo_build_rules ($$$@)
# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
# handle_texinfo_helper ($info_texinfos)
# --------------------------------------
-# Handle all Texinfo source; helper for handle_texinfo.
+# Handle all Texinfo source; helper for 'handle_texinfo'.
sub handle_texinfo_helper ($)
{
my ($info_texinfos) = @_;
@@ -3384,9 +3362,6 @@ EOF
}
-# handle_texinfo ()
-# -----------------
-# Handle all Texinfo source.
sub handle_texinfo ()
{
reject_var 'TEXINFOS', "'TEXINFOS' is an anachronism; use 'info_TEXINFOS'";
@@ -3415,7 +3390,6 @@ sub handle_texinfo ()
}
-# Handle any man pages.
sub handle_man_pages ()
{
reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
@@ -3554,7 +3528,7 @@ sub handle_man_pages ()
unless option 'no-installman';
}
-# Handle DATA variables.
+
sub handle_data ()
{
am_install_var ('-noextra', '-candist', 'data', 'DATA',
@@ -3563,7 +3537,7 @@ sub handle_data ()
'pkgdata', 'lisp', 'noinst', 'check');
}
-# Handle TAGS.
+
sub handle_tags ()
{
my @config;
@@ -3631,8 +3605,6 @@ sub user_phony_rule ($)
}
-# handle_dist
-# -----------
# Handle 'dist' target.
sub handle_dist ()
{
@@ -3825,9 +3797,7 @@ sub check_directories_in_var ($)
skip_ac_subst => 1);
}
-# handle_subdirs ()
-# -----------------
-# Handle subdirectories.
+
sub handle_subdirs ()
{
my $subdirs = var ('SUBDIRS');
@@ -3883,7 +3853,7 @@ sub scan_aclocal_m4 ()
}
-# Helper function for substitute_ac_subst_variables.
+# Helper function for 'substitute_ac_subst_variables'.
sub substitute_ac_subst_variables_worker($)
{
my ($token) = @_;
@@ -4290,7 +4260,6 @@ sub handle_configure ($$$@)
@actual_other_vpath_files);
}
-# Handle C headers.
sub handle_headers ()
{
my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
@@ -4359,7 +4328,7 @@ sub handle_gettext ()
require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
}
-# Handle footer elements.
+# Emit makefile footer.
sub handle_footer ()
{
reject_rule ('.SUFFIXES',
@@ -4411,7 +4380,7 @@ sub handle_install ()
}
-# Deal with all and all-am.
+# Deal with 'all' and 'all-am'.
sub handle_all ($)
{
my ($makefile) = @_;
@@ -4472,7 +4441,7 @@ sub handle_all ($)
}
}
-# Generate helper targets for user recursion, where needed.
+# Generate helper targets for user-defined recursive targets, where needed.
sub handle_user_recursion ()
{
return unless @extra_recursive_targets;
@@ -4499,8 +4468,6 @@ sub handle_user_recursion ()
}
-# do_check_merge_target ()
-# ------------------------
# Handle check merge target specially.
sub do_check_merge_target ()
{
@@ -4537,8 +4504,6 @@ sub do_check_merge_target ()
if var ('BUILT_SOURCES');
}
-# handle_clean ($MAKEFILE)
-# ------------------------
# Handle all 'clean' targets.
sub handle_clean ($)
{
@@ -4608,8 +4573,6 @@ sub target_cmp
}
-# handle_factored_dependencies ()
-# -------------------------------
# Handle everything related to gathered targets.
sub handle_factored_dependencies ()
{
@@ -4696,8 +4659,6 @@ sub handle_factored_dependencies ()
}
-# handle_tests_dejagnu ()
-# -----------------------
sub handle_tests_dejagnu ()
{
push (@check_tests, 'check-DEJAGNU');
@@ -4767,7 +4728,7 @@ sub is_valid_test_extension ($)
return 0;
}
-# Handle TESTS variable and other checks.
+
sub handle_tests ()
{
if (option 'dejagnu')
@@ -4901,7 +4862,6 @@ sub handle_tests ()
}
}
-# Handle Emacs Lisp.
sub handle_emacs_lisp ()
{
my @elfiles = am_install_var ('-candist', 'lisp', 'LISP',
@@ -4922,7 +4882,6 @@ sub handle_emacs_lisp ()
'EMACS', 'lispdir');
}
-# Handle Python
sub handle_python ()
{
my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON',
@@ -4934,7 +4893,6 @@ sub handle_python ()
define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
}
-# Handle Java.
sub handle_java ()
{
my @sourcelist = am_install_var ('-candist',
@@ -4979,7 +4937,6 @@ sub handle_java ()
}
-# Handle some of the minor options.
sub handle_minor_options ()
{
if (option 'readme-alpha')
@@ -5085,8 +5042,6 @@ sub scan_autoconf_config_files ($$)
}
-# scan_autoconf_traces ($FILENAME)
-# --------------------------------
sub scan_autoconf_traces ($)
{
my ($filename) = @_;
@@ -5391,8 +5346,6 @@ EOF
}
-# scan_autoconf_files ()
-# ----------------------
# Check whether we use 'configure.ac' or 'configure.in'.
# Scan it (and possibly 'aclocal.m4') for interesting things.
# We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
@@ -5924,9 +5877,7 @@ sub derive_suffix ($$)
}
-################################################################
-
-# Pretty-print something and append to output_rules.
+# Pretty-print something and append to '$output_rules'.
sub pretty_print_rule ($$@)
{
$output_rules .= makefile_wrap (shift, shift, @_);
@@ -6151,9 +6102,6 @@ sub define_compiler_variable ($)
}
-# define_linker_variable ($LANG)
-# ------------------------------
-# Define linker variables.
sub define_linker_variable ($)
{
my ($lang) = @_;
@@ -6533,8 +6481,6 @@ sub read_am_file ($$)
}
-# define_standard_variables ()
-# ----------------------------
# A helper for read_main_am_file which initializes configure variables
# and variables from header-vars.am.
sub define_standard_variables ()
@@ -6552,7 +6498,6 @@ sub define_standard_variables ()
$output_vars .= $comments . $rules;
}
-# Read main am file.
sub read_main_am_file ($$)
{
my ($amfile, $infile) = @_;
@@ -6580,9 +6525,6 @@ sub read_main_am_file ($$)
################################################################
-# $FLATTENED
-# flatten ($STRING)
-# -----------------
# Flatten the $STRING and return the result.
sub flatten ($)
{
@@ -6598,7 +6540,7 @@ sub flatten ($)
# transform_token ($TOKEN, \%PAIRS, $KEY)
-# =======================================
+# ---------------------------------------
# Return the value associated to $KEY in %PAIRS, as used on $TOKEN
# (which should be ?KEY? or any of the special %% requests)..
sub transform_token ($$$)
@@ -6611,7 +6553,7 @@ sub transform_token ($$$)
# transform ($TOKEN, \%PAIRS)
-# ===========================
+# ---------------------------
# If ($TOKEN, $VAL) is in %PAIRS:
# - replaces %KEY% with $VAL,
# - enables/disables ?KEY? and ?!KEY?,
@@ -7043,6 +6985,9 @@ sub am_primary_prefixes ($$@)
}
+# am_install_var (-OPTION..., file, HOW, where...)
+# ------------------------------------------------
+#
# Handle 'where_HOW' variable magic. Does all lookups, generates
# install code, and possibly generates code to define the primary
# variable. The first argument is the name of the .am file to munge,
@@ -7057,7 +7002,6 @@ sub am_primary_prefixes ($$@)
# FIXME: this should be rewritten to be cleaner. It should be broken
# up into multiple functions.
#
-# Usage is: am_install_var (OPTION..., file, HOW, where...)
sub am_install_var (@)
{
my (@args) = @_;
@@ -7316,7 +7260,7 @@ sub locate_aux_dir ()
# push_required_file ($DIR, $FILE, $FULLFILE)
-# -------------------------------------------------
+# -------------------------------------------
# Push the given file onto DIST_COMMON.
sub push_required_file ($$$)
{
@@ -7713,7 +7657,7 @@ sub require_build_directory_maybe ($)
################################################################
-# Push a list of files onto dist_common.
+# Push a list of files onto '@dist_common'.
sub push_dist_common (@)
{
prog_error "push_dist_common run after handle_dist"
@@ -7958,7 +7902,6 @@ sub print_autodist_files (@)
}
-# Print usage information.
sub usage ()
{
print "Usage: $0 [OPTION]... [Makefile]...
@@ -8009,9 +7952,6 @@ General help using GNU software: .
}
-# version ()
-# ----------
-# Print version information
sub version ()
{
print <
Date: Thu, 21 Feb 2013 15:52:22 +0100
Subject: maint: more adjustments to the new versioning scheme
This is a follow-up to commit 'v1.13.1b-11-g97aaf12'.
* automake.in: Adjust a comment.
* PLANS: Adjust several files in here.
Signed-off-by: Stefano Lattarini
---
PLANS/obsolete-removed/am-prog-mkdir-p.txt | 8 +++-----
PLANS/obsolete-removed/configure.in.txt | 10 +++++-----
PLANS/rm-f-without-args.txt | 10 +++++-----
PLANS/subdir-objects.txt | 10 +++++-----
PLANS/texi/drop-split-info-files.txt | 6 +++---
automake.in | 2 +-
6 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/PLANS/obsolete-removed/am-prog-mkdir-p.txt b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
index d5b769553..20d5cf52c 100644
--- a/PLANS/obsolete-removed/am-prog-mkdir-p.txt
+++ b/PLANS/obsolete-removed/am-prog-mkdir-p.txt
@@ -1,6 +1,4 @@
-The macro AM_PROG_MKDIR_P is no longer going to be removed in Automake 1.14
-(and in fact, any plan to remove it "evenatually" has been dropped as well).
-
+The macro AM_PROG_MKDIR_P is no longer going to be removed from Automake.
Let's see a bit of history to understand why.
I had already scheduled the removal of the long-deprecated AM_PROG_MKDR_P
@@ -46,14 +44,14 @@ out, and we lose. That already happened in practice:
Moreover, while I might see it as not unreasonable to ask a developer
-using Automake 1.14 to also update Gettext to 1.18.2, that would not
+using Automake 2.0 to also update Gettext to 1.18.2, that would not
be enough; in order for gettext to use the correct data files, that
developer would have to update his configure.ac to read:
AM_GNU_GETTEXT_VERSION([0.18.2])
thus requiring *all* of his co-developers to install Gettext 1.18.2,
-even if they are still using, say, Automake 1.13. Bad.
+even if they are still using, say, Automake 1.13 or 1.14. Bad.
So I decided to re-instate this macro as a simple alias for AC_PROG_MKDIR_P
(plus a non-fatal runtime warning in the 'obsolete' category), and drop
diff --git a/PLANS/obsolete-removed/configure.in.txt b/PLANS/obsolete-removed/configure.in.txt
index baed853bc..180f92c14 100644
--- a/PLANS/obsolete-removed/configure.in.txt
+++ b/PLANS/obsolete-removed/configure.in.txt
@@ -13,16 +13,16 @@ present in the development version of autoconf so far (scheduled to
become Autoconf 2.70). So ...
-For Automake 1.14
------------------
+For Automake 2.0
+----------------
... we have decided to wait until 2.70 is out before really removing
'configure.in' support. Since we plan to require Autoconf 2.70 in
-Automake 1.14 (so that we can remove the hacky code emulating
+Automake 2.0 (so that we can remove the hacky code emulating
AC_CONFIG_MACRO_DIRS for older autoconf versions), we are quite sure
that Autoconf will actually have started deprecating 'configure.in'
-by the time Automake 1.14 is released.
+by the time Automake 2.0 is released.
Note that the removal of 'configure.in' has already been implemented
-in our master branch (from where the 1.14 release will be finally
+in our 'next' branch (from where the 2.0 release will be finally
cut); see commits 'v1.13-17-gbff57c8' and 'v1.13-21-g7626e63'.
diff --git a/PLANS/rm-f-without-args.txt b/PLANS/rm-f-without-args.txt
index 5362f98e6..918e0492d 100644
--- a/PLANS/rm-f-without-args.txt
+++ b/PLANS/rm-f-without-args.txt
@@ -21,20 +21,20 @@ the no-args "rm -f" usage is supported on the system configure is
being run on; complain loudly if this is not the case, and tell the
user to report the situation to us.
-For Automake 1.14
------------------
+For Automake 2.0
+----------------
Make any failure in the configure-time probe check introduced by the
previous point fatal; and in case of failure, also suggest to the user
to install an older version of GNU coreutils to work around the
limitation of his system (this version should be old enough not to
-be bootstrapped with Automake 1.14, otherwise the user will face a
+be bootstrapped with Automake 2.0, otherwise the user will face a
bootstrapping catch-22).
In all our recipes, start assuming "rm -f" with no argument is OK;
simplify and de-uglify the recipes accordingly.
-For Automake 1.15
------------------
+For Automake 3.0
+----------------
Remove the runtime probe altogether.
diff --git a/PLANS/subdir-objects.txt b/PLANS/subdir-objects.txt
index e4e6e25ad..86474036a 100644
--- a/PLANS/subdir-objects.txt
+++ b/PLANS/subdir-objects.txt
@@ -2,7 +2,7 @@ Summary
-------
We want to make the behaviour currently enabled by the 'subdir-objects'
-the default one, and in fact the *only* one, in Automake 1.14.
+the default one, and in fact the *only* one, in Automake 2.0.
See automake bug#13378: .
Details
@@ -38,8 +38,8 @@ C compilation rules mistakenly passed the "-c -o" options combination
unconditionally (even to losing compiler) when the 'subdir-objects' was
used but sources were only present in the top-level directory.
-TODO for automake 1.13.2
-------------------------
+TODO for automake 1.14
+----------------------
Give a warning in the category 'unsupported' if the 'subdir-objects'
option is not specified. This should give the users enough forewarning
@@ -50,8 +50,8 @@ Be sure to avoid the warning when it would be irrelevant, i.e., if all
source files sit in "current" directory (thanks to Peter Johansson for
suggesting this).
-For automake 1.14
------------------
+For automake 2.0
+----------------
Remove the copy & paste of Autoconf internals in our AC_PROG_CC rewrite
See the first patch in the series:
diff --git a/PLANS/texi/drop-split-info-files.txt b/PLANS/texi/drop-split-info-files.txt
index 708433158..8b36ecb05 100644
--- a/PLANS/texi/drop-split-info-files.txt
+++ b/PLANS/texi/drop-split-info-files.txt
@@ -1,7 +1,7 @@
-For automake 1.14
------------------
+For automake 2.0
+----------------
-We want to drop split info files in Automake 1.14.
+We want to drop split info files in Automake 2.0.
See automake bug#13351: .
Basically, it has been confirmed that the original reason behind
diff --git a/automake.in b/automake.in
index 44d67b477..13811f796 100644
--- a/automake.in
+++ b/automake.in
@@ -1711,7 +1711,7 @@ sub handle_single_transform ($$$$$%)
}
else
{
- # Since the next major version of automake (1.14) will
+ # Since the next major version of automake (2.0) will
# make the behaviour so far only activated with the
# 'subdir-object' option mandatory, it's better if we
# start warning users not using that option.
--
cgit v1.2.1
From c8a2bc7c7331bed33cc47187d04fbc144b860dff Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 5 Mar 2013 18:30:03 +0100
Subject: perl: perl subroutine prototypes are problematic, don't use them
Basically, in perl, "subroutine prototypes" are not prototypes at all;
rather, they are a trick to allow user-defined subroutines that behave
like perl built-in functions. For example, prototyped subroutines can
be called without parentheses, and can impose context on their arguments.
Such semantics can be useful in some selected situations, but might also
easily cause unexpected and harmful behaviours and side effects if we
try to use perl prototypes as we would use C prototypes.
See the excellent article "Far More than Everything You've Ever Wanted
to Know about Prototypes in Perl" by Tom Christiansen for more detailed
information:
It is important to note that modern perl allows a non-predeclared
subroutine to be called without the '&' character, as long as its
call uses proper parentheses:
foo 'str', 2; # will trigger errors if foo is not predeclared
foo('str', 2); # ok even if foo is not predeclared
&foo('str', 2); # ditto; but the '&' is old-style and redundant
Note also that the prototype indicating "no argument":
sub func() { ... }
can actually be useful, and has no discernible downsides, so we'll
keep using it where it makes sense.
Also, in few, selected cases, we *want* to have subroutines behave like
perl builtins (e.g., we want the 'append_exeext' function to be able
to take a code block as first argument). In such cases, we will of
course continue to make use of perl subroutine prototypes.
Let's finally see an example that might clarify the kind of problems the
use of subroutine prototypes in perl can cause. This is just scratching
the surface; there are several other aspects, typically subtler and more
dangerous, that are not touched here.
If you have the prototyped subroutine definition:
sub foo ($@)
{
my $s = shift;
print "SCALAR: $s\n";
print "ARRAY: @_\n";
}
and call 'foo' in code like:
@list = (-1, 0, 1);
foo(@list);
you won't get a compile-time nor a runtime error (as a naive interpretation
of the "prototype" characterization would let you think). Rather, the
prototype will cause the array '@list' will be coerced into scalar context
before being passed too 'foo', which means that its *length* (3) will be
passed to 'foo' as first argument; and since no further arguments are
present after '@list', that *void* will be coerced to an empty list before
being passed to 'foo'.
So code above will have the result of printing:
SCALAR: 3
ARRAY:
Quite tricky, and definitely a behaviour we don't want to rely on.
* automake.in: Delete most subroutine prototypes. Fix few of the
remaining ones. Related minor simplifications and adjustments.
* lib/gen-perl-protos: Adjust.
Signed-off-by: Stefano Lattarini
---
automake.in | 224 +++++++++++++++++++++++++++++++-----------------------------
1 file changed, 117 insertions(+), 107 deletions(-)
diff --git a/automake.in b/automake.in
index 70f1f670c..bbf0c880a 100644
--- a/automake.in
+++ b/automake.in
@@ -529,7 +529,7 @@ my %am_file_cache;
# macro_define() call because SUFFIXES definitions impact
# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
# the input am file.
-sub var_SUFFIXES_trigger ($$)
+sub var_SUFFIXES_trigger
{
my ($type, $value) = @_;
accept_extensions (split (' ', $value));
@@ -946,23 +946,23 @@ register_language ('name' => 'java',
# err_am ($MESSAGE, [%OPTIONS])
# -----------------------------
# Uncategorized errors about the current Makefile.am.
-sub err_am ($;%)
+sub err_am
{
- msg_am ('error', shift, @_);
+ msg_am ('error', @_);
}
# err_ac ($MESSAGE, [%OPTIONS])
# -----------------------------
# Uncategorized errors about configure.ac.
-sub err_ac ($;%)
+sub err_ac
{
- msg_ac ('error', shift, @_);
+ msg_ac ('error', @_);
}
# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
# ---------------------------------------
# Messages about about the current Makefile.am.
-sub msg_am ($$;%)
+sub msg_am
{
my ($channel, $msg, %opts) = @_;
msg $channel, "${am_file}.am", $msg, %opts;
@@ -971,7 +971,7 @@ sub msg_am ($$;%)
# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS])
# ---------------------------------------
# Messages about about configure.ac.
-sub msg_ac ($$;%)
+sub msg_ac
{
my ($channel, $msg, %opts) = @_;
msg $channel, $configure_ac, $msg, %opts;
@@ -985,7 +985,7 @@ sub msg_ac ($$;%)
# We do this to avoid having the substitutions directly in automake.in;
# when we do that they are sometimes removed and this causes confusion
# and bugs.
-sub subst ($)
+sub subst
{
my ($text) = @_;
return '@' . $text . '@';
@@ -1000,7 +1000,7 @@ sub subst ($)
# If I "cd $RELDIR", then to come back, I should "cd $BACKPATH".
# For instance 'src/foo' => '../..'.
# Works with non strictly increasing paths, i.e., 'src/../lib' => '..'.
-sub backname ($)
+sub backname
{
my ($file) = @_;
my @res;
@@ -1027,7 +1027,7 @@ sub backname ($)
# verbose_var (NAME)
# ------------------
# The public variable stem used to implement silent rules.
-sub verbose_var ($)
+sub verbose_var
{
my ($name) = @_;
return 'AM_V_' . $name;
@@ -1036,7 +1036,7 @@ sub verbose_var ($)
# verbose_private_var (NAME)
# --------------------------
# The naming policy for the private variables for silent rules.
-sub verbose_private_var ($)
+sub verbose_private_var
{
my ($name) = @_;
return 'am__v_' . $name;
@@ -1047,7 +1047,7 @@ sub verbose_private_var ($)
# For silent rules, setup VAR and dispatcher, to expand to
# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
# empty) if not.
-sub define_verbose_var ($$;$)
+sub define_verbose_var
{
my ($name, $silent_val, $verbose_val) = @_;
$verbose_val = '' unless defined $verbose_val;
@@ -1073,13 +1073,13 @@ sub define_verbose_var ($$;$)
# verbose_flag (NAME)
# -------------------
# Contents of '%VERBOSE%' variable to expand before rule command.
-sub verbose_flag ($)
+sub verbose_flag
{
my ($name) = @_;
return '$(' . verbose_var ($name) . ')';
}
-sub verbose_nodep_flag ($)
+sub verbose_nodep_flag
{
my ($name) = @_;
return '$(' . verbose_var ($name) . subst ('am__nodep') . ')';
@@ -1096,7 +1096,7 @@ sub silent_flag ()
# define_verbose_tagvar (NAME)
# ----------------------------
# Engage the needed silent rules machinery for tag NAME.
-sub define_verbose_tagvar ($)
+sub define_verbose_tagvar
{
my ($name) = @_;
define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
@@ -1173,7 +1173,7 @@ sub handle_options ()
# If the VAR wasn't defined conditionally, return $(VAR).
# Otherwise we create an am__VAR_DIST variable which contains
# all possible values, and return $(am__VAR_DIST).
-sub shadow_unconditionally ($$)
+sub shadow_unconditionally
{
my ($varname, $where) = @_;
my $var = var $varname;
@@ -1190,7 +1190,7 @@ sub shadow_unconditionally ($$)
# ----------------------------
# Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR
# otherwise.
-sub check_user_variables (@)
+sub check_user_variables
{
my @dont_override = @_;
foreach my $flag (@dont_override)
@@ -1520,7 +1520,7 @@ sub append_exeext (&$)
# mentioned. This is a separate function (as opposed to being inlined
# in handle_source_transform) because it isn't always appropriate to
# do this check.
-sub check_libobjs_sources ($$)
+sub check_libobjs_sources
{
my ($one_file, $unxformed) = @_;
@@ -1568,7 +1568,7 @@ sub check_libobjs_sources ($$)
# when producing explicit rules
# Result is a list of the names of objects
# %linkers_used will be updated with any linkers needed
-sub handle_single_transform ($$$$$%)
+sub handle_single_transform
{
my ($var, $topparent, $derived, $obj, $_file, %transform) = @_;
my @files = ($_file);
@@ -1971,7 +1971,7 @@ EOF
#
# Result is a pair ($LINKER, $OBJVAR):
# $LINKER is a boolean, true if a linker is needed to deal with the objects
-sub define_objects_from_sources ($$$$$$$%)
+sub define_objects_from_sources
{
my ($var, $objvar, $nodefine, $one_file,
$obj, $topparent, $where, %transform) = @_;
@@ -2005,7 +2005,7 @@ sub define_objects_from_sources ($$$$$$$%)
# extra arguments to pass to file_contents when producing rules
# Return the name of the linker variable that must be used.
# Empty return means just use 'LINK'.
-sub handle_source_transform ($$$$%)
+sub handle_source_transform
{
# one_file is canonical name. unxformed is given name. obj is
# object extension.
@@ -2043,7 +2043,7 @@ sub handle_source_transform ($$$$%)
$needlinker |=
define_objects_from_sources ($varname,
$xpfx . $one_file . '_OBJECTS',
- $prefix =~ /EXTRA_/,
+ !!($prefix =~ /EXTRA_/),
$one_file, $obj, $varname, $where,
DIST_SOURCE => ($prefix !~ /^nodist_/),
%transform);
@@ -2127,7 +2127,7 @@ sub handle_source_transform ($$$$%)
# transformed name of object being built, or empty string if no object
# name of _LDADD/_LIBADD-type variable to examine
# Returns 1 if LIBOBJS seen, 0 otherwise.
-sub handle_lib_objects ($$)
+sub handle_lib_objects
{
my ($xname, $varname) = @_;
@@ -2205,7 +2205,7 @@ sub handle_lib_objects ($$)
# -------------------------------
# Definitions common to LIBOBJS and ALLOCA.
# VAR should be one of LIBOBJS, LTLIBOBJS, ALLOCA, or LTALLOCA.
-sub handle_LIBOBJS_or_ALLOCA ($)
+sub handle_LIBOBJS_or_ALLOCA
{
my ($var) = @_;
@@ -2244,7 +2244,7 @@ sub handle_LIBOBJS_or_ALLOCA ($)
return $dir;
}
-sub handle_LIBOBJS ($$$)
+sub handle_LIBOBJS
{
my ($var, $cond, $lt) = @_;
my $myobjext = $lt ? 'lo' : 'o';
@@ -2283,7 +2283,7 @@ sub handle_LIBOBJS ($$$)
}
}
-sub handle_ALLOCA ($$$)
+sub handle_ALLOCA
{
my ($var, $cond, $lt) = @_;
my $myobjext = $lt ? 'lo' : 'o';
@@ -2297,7 +2297,7 @@ sub handle_ALLOCA ($$$)
}
# Canonicalize the input parameter.
-sub canonicalize ($)
+sub canonicalize
{
my ($string) = @_;
$string =~ tr/A-Za-z0-9_\@/_/c;
@@ -2307,7 +2307,7 @@ sub canonicalize ($)
# Canonicalize a name, and check to make sure the non-canonical name
# is never used. Returns canonical name. Arguments are name and a
# list of suffixes to check for.
-sub check_canonical_spelling ($@)
+sub check_canonical_spelling
{
my ($name, @suffixes) = @_;
@@ -2893,7 +2893,7 @@ sub handle_scripts ()
# -----------------------------
# $OUTFILE - name of the info file produced by $FILENAME.
# $VFILE - name of the version.texi file used (undef if none).
-sub scan_texinfo_file ($)
+sub scan_texinfo_file
{
my ($filename) = @_;
@@ -2948,7 +2948,7 @@ sub scan_texinfo_file ($)
# DEST - the destination Info file
# INSRC - whether DEST should be built in the source tree
# DEPENDENCIES - known dependencies
-sub output_texinfo_build_rules ($$$@)
+sub output_texinfo_build_rules
{
my ($source, $dest, $insrc, @deps) = @_;
@@ -3043,7 +3043,7 @@ sub output_texinfo_build_rules ($$$@)
# handle_texinfo_helper ($info_texinfos)
# --------------------------------------
# Handle all Texinfo source; helper for 'handle_texinfo'.
-sub handle_texinfo_helper ($)
+sub handle_texinfo_helper
{
my ($info_texinfos) = @_;
my (@infobase, @info_deps_list, @texi_deps);
@@ -3585,7 +3585,7 @@ sub handle_tags ()
# Return false if rule $NAME does not exist. Otherwise,
# declare it as phony, complete its definition (in case it is
# conditional), and return its Automake::Rule instance.
-sub user_phony_rule ($)
+sub user_phony_rule
{
my ($name) = @_;
my $rule = rule $name;
@@ -3745,7 +3745,7 @@ sub handle_dist ()
# -------------------------------------------------------
# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane
# name. Use $WHERE as a location in the diagnostic, if any.
-sub check_directory ($$;$)
+sub check_directory
{
my ($dir, $where, $reldir) = @_;
$reldir = '.' unless defined $reldir;
@@ -3783,7 +3783,7 @@ sub check_directory ($$;$)
# check_directories_in_var ($VARIABLE)
# ------------------------------------
# Recursively check all items in variables $VARIABLE as directories
-sub check_directories_in_var ($)
+sub check_directories_in_var
{
my ($var) = @_;
$var->traverse_recursively
@@ -3854,7 +3854,7 @@ sub scan_aclocal_m4 ()
# Helper function for 'substitute_ac_subst_variables'.
-sub substitute_ac_subst_variables_worker($)
+sub substitute_ac_subst_variables_worker
{
my ($token) = @_;
return "\@$token\@" if var $token;
@@ -3865,7 +3865,7 @@ sub substitute_ac_subst_variables_worker($)
# -------------------------------------
# Replace any occurrence of ${FOO} in $TEXT by @FOO@ if FOO is an AC_SUBST
# variable.
-sub substitute_ac_subst_variables ($)
+sub substitute_ac_subst_variables
{
my ($text) = @_;
$text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
@@ -3880,7 +3880,7 @@ sub substitute_ac_subst_variables ($)
# directory, then the directory part is simply replaced by $(srcdir).
# But if the directory part is different, then $(top_srcdir) is
# prepended.
-sub prepend_srcdir (@)
+sub prepend_srcdir
{
my (@inputs) = @_;
my @newinputs;
@@ -3906,7 +3906,7 @@ sub prepend_srcdir (@)
# rule of
# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...)
# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs.
-sub rewrite_inputs_into_dependencies ($@)
+sub rewrite_inputs_into_dependencies
{
my ($file, @inputs) = @_;
my @res = ();
@@ -3951,7 +3951,7 @@ sub rewrite_inputs_into_dependencies ($@)
# -----------------------------------------------------------------
# Handle remaking and configure stuff.
# We need the name of the input file, to do proper remaking rules.
-sub handle_configure ($$$@)
+sub handle_configure
{
my ($makefile_am, $makefile_in, $makefile, @inputs) = @_;
@@ -4374,14 +4374,16 @@ sub handle_install ()
? (" \$(BUILT_SOURCES)\n"
. "\t\$(MAKE) \$(AM_MAKEFLAGS)")
: ''),
- 'installdirs-local' => (user_phony_rule 'installdirs-local'
+ 'installdirs-local' => (user_phony_rule ('installdirs-local')
? ' installdirs-local' : ''),
am__installdirs => variable_value ('am__installdirs') || '');
}
+# handle_all ($MAKEFILE)
+#-----------------------
# Deal with 'all' and 'all-am'.
-sub handle_all ($)
+sub handle_all
{
my ($makefile) = @_;
@@ -4505,7 +4507,7 @@ sub do_check_merge_target ()
}
# Handle all 'clean' targets.
-sub handle_clean ($)
+sub handle_clean
{
my ($makefile) = @_;
@@ -4665,7 +4667,9 @@ sub handle_tests_dejagnu ()
$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
-sub handle_per_suffix_test ($%)
+# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM])
+#----------------------------------------------------
+sub handle_per_suffix_test
{
my ($test_suffix, %transform) = @_;
my ($pfx, $generic, $am_exeext);
@@ -4718,7 +4722,7 @@ sub handle_per_suffix_test ($%)
# ------------------------------
# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
# otherwise.
-sub is_valid_test_extension ($)
+sub is_valid_test_extension
{
my $ext = shift;
return 1
@@ -4966,7 +4970,7 @@ sub handle_minor_options ()
# ------------------------------
# Decode the Autoconf syntax for config files (files, headers, links
# etc.).
-sub split_config_file_spec ($)
+sub split_config_file_spec
{
my ($spec) = @_;
my ($output, @inputs) = split (/:/, $spec);
@@ -4983,7 +4987,7 @@ sub split_config_file_spec ($)
# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in
# This functions returns the first *.in file for which a *.am exists.
# It returns undef otherwise.
-sub locate_am (@)
+sub locate_am
{
my (@rest) = @_;
my $input;
@@ -5004,7 +5008,7 @@ my %make_list;
# --------------------------------------------------
# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
# (or AC_OUTPUT).
-sub scan_autoconf_config_files ($$)
+sub scan_autoconf_config_files
{
my ($where, $config_files) = @_;
@@ -5042,7 +5046,7 @@ sub scan_autoconf_config_files ($$)
}
-sub scan_autoconf_traces ($)
+sub scan_autoconf_traces
{
my ($filename) = @_;
@@ -5545,7 +5549,7 @@ sub lang_java_rewrite
# language, etc. A finish function is only called if a source file of
# the appropriate type has been seen.
-sub lang_vala_finish_target ($$)
+sub lang_vala_finish_target
{
my ($self, $name) = @_;
@@ -5658,7 +5662,7 @@ sub lang_vala_finish ()
# The built .c files should be cleaned only on maintainer-clean
# as the .c files are distributed. This function is called for each
# .vala source file.
-sub lang_vala_target_hook ($$$$%)
+sub lang_vala_target_hook
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5667,7 +5671,7 @@ sub lang_vala_target_hook ($$$$%)
# This is a yacc helper which is called whenever we have decided to
# compile a yacc file.
-sub lang_yacc_target_hook ($$$$%)
+sub lang_yacc_target_hook
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5743,7 +5747,7 @@ sub lang_yacc_target_hook ($$$$%)
# This is a lex helper which is called whenever we have decided to
# compile a lex file.
-sub lang_lex_target_hook ($$$$%)
+sub lang_lex_target_hook
{
my ($self, $aggregate, $output, $input, %transform) = @_;
# The GNU rules say that yacc/lex output files should be removed
@@ -5788,7 +5792,7 @@ sub lang_lex_finish ()
# precedence. This is lame, but something has to have global
# knowledge in order to eliminate the conflict. Add more linkers as
# required.
-sub resolve_linker (%)
+sub resolve_linker
{
my (%linkers) = @_;
@@ -5800,7 +5804,7 @@ sub resolve_linker (%)
}
# Called to indicate that an extension was used.
-sub saw_extension ($)
+sub saw_extension
{
my ($ext) = @_;
$extension_seen{$ext} = 1;
@@ -5810,7 +5814,7 @@ sub saw_extension ($)
# ------------------------------
# Register a single language.
# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE.
-sub register_language (%)
+sub register_language
{
my (%option) = @_;
@@ -5863,7 +5867,7 @@ sub register_language (%)
# --------------------------
# This function is used to find a path from a user-specified suffix $EXT
# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'.
-sub derive_suffix ($$)
+sub derive_suffix
{
my ($source_ext, $obj) = @_;
@@ -5880,7 +5884,7 @@ sub derive_suffix ($$)
# Pretty-print something and append to '$output_rules'.
-sub pretty_print_rule ($$@)
+sub pretty_print_rule
{
$output_rules .= makefile_wrap (shift, shift, @_);
}
@@ -5897,7 +5901,7 @@ sub pretty_print_rule ($$@)
# $STRING
# make_conditional_string ($NEGATE, $COND)
# ----------------------------------------
-sub make_conditional_string ($$)
+sub make_conditional_string
{
my ($negate, $cond) = @_;
$cond = "${cond}_TRUE"
@@ -5925,7 +5929,7 @@ my %_am_macro_for_cond =
# $COND
# cond_stack_if ($NEGATE, $COND, $WHERE)
# --------------------------------------
-sub cond_stack_if ($$$)
+sub cond_stack_if
{
my ($negate, $cond, $where) = @_;
@@ -5955,7 +5959,7 @@ sub cond_stack_if ($$$)
# $COND
# cond_stack_else ($NEGATE, $COND, $WHERE)
# ----------------------------------------
-sub cond_stack_else ($$$)
+sub cond_stack_else
{
my ($negate, $cond, $where) = @_;
@@ -5985,7 +5989,7 @@ sub cond_stack_else ($$$)
# $COND
# cond_stack_endif ($NEGATE, $COND, $WHERE)
# -----------------------------------------
-sub cond_stack_endif ($$$)
+sub cond_stack_endif
{
my ($negate, $cond, $where) = @_;
my $old_cond;
@@ -6028,7 +6032,7 @@ sub cond_stack_endif ($$$)
# string to define the variable unconditionally. The third argument
# is a list holding the values to use for the variable. The value is
# pretty printed in the output file.
-sub define_pretty_variable ($$$@)
+sub define_pretty_variable
{
my ($var, $cond, $where, @value) = @_;
@@ -6045,7 +6049,7 @@ sub define_pretty_variable ($$$@)
# --------------------------------------
# Define a new Automake Makefile variable VAR to VALUE, but only if
# not already defined.
-sub define_variable ($$$)
+sub define_variable
{
my ($var, $value, $where) = @_;
define_pretty_variable ($var, TRUE, $where, $value);
@@ -6067,14 +6071,14 @@ sub define_files_variable ($\@$$)
# Like define_variable, but define a variable to be the configure
# substitution by the same name.
-sub define_configure_variable ($)
+sub define_configure_variable
{
my ($var) = @_;
# Some variables we do not want to output. For instance it
# would be a bad idea to output `U = @U@` when `@U@` can be
# substituted as `\`.
my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
- Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst $var,
+ Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var),
'', $configure_vars{$var}, $pretty);
}
@@ -6083,7 +6087,7 @@ sub define_configure_variable ($)
# --------------------------------
# Define a compiler variable. We also handle defining the 'LT'
# version of the command when using libtool.
-sub define_compiler_variable ($)
+sub define_compiler_variable
{
my ($lang) = @_;
@@ -6104,7 +6108,7 @@ sub define_compiler_variable ($)
}
-sub define_linker_variable ($)
+sub define_linker_variable
{
my ($lang) = @_;
@@ -6126,7 +6130,7 @@ sub define_linker_variable ($)
define_verbose_tagvar ($lang->lder || 'GEN');
}
-sub define_per_target_linker_variable ($$)
+sub define_per_target_linker_variable
{
my ($linker, $target) = @_;
@@ -6201,7 +6205,7 @@ sub check_trailing_slash ($\$)
# from Makefile.am into $output_trailer, or define variables as
# appropriate. NOTE we put rules in the trailer section. We want
# user rules to come after our generated stuff.
-sub read_am_file ($$$)
+sub read_am_file
{
my ($amfile, $where, $reldir) = @_;
my $canon_reldir = &canonicalize ($reldir);
@@ -6514,7 +6518,10 @@ sub define_standard_variables ()
$output_vars .= $comments . $rules;
}
-sub read_main_am_file ($$)
+
+# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN)
+# ----------------------------------------------
+sub read_main_am_file
{
my ($amfile, $infile) = @_;
@@ -6541,8 +6548,10 @@ sub read_main_am_file ($$)
################################################################
-# Flatten the $STRING and return the result.
-sub flatten ($)
+# $STRING
+# flatten ($ORIGINAL_STRING)
+# --------------------------
+sub flatten
{
$_ = shift;
@@ -6559,7 +6568,7 @@ sub flatten ($)
# ---------------------------------------
# Return the value associated to $KEY in %PAIRS, as used on $TOKEN
# (which should be ?KEY? or any of the special %% requests)..
-sub transform_token ($$$)
+sub transform_token ($\%$)
{
my ($token, $transform, $key) = @_;
my $res = $transform->{$key};
@@ -6574,7 +6583,7 @@ sub transform_token ($$$)
# - replaces %KEY% with $VAL,
# - enables/disables ?KEY? and ?!KEY?,
# - replaces %?KEY% with TRUE or FALSE.
-sub transform ($$)
+sub transform ($\%)
{
my ($token, $transform) = @_;
@@ -6583,18 +6592,18 @@ sub transform ($$)
# when there is neither IFTRUE nor IFFALSE.
if ($token =~ /^%([\w\-]+)%$/)
{
- return transform_token ($token, $transform, $1);
+ return transform_token ($token, %$transform, $1);
}
# %?KEY%.
elsif ($token =~ /^%\?([\w\-]+)%$/)
{
- return transform_token ($token, $transform, $1) ? 'TRUE' : 'FALSE';
+ return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE';
}
# ?KEY? and ?!KEY?.
elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x)
{
my $neg = ($1 eq '!') ? 1 : 0;
- my $val = transform_token ($token, $transform, $2);
+ my $val = transform_token ($token, %$transform, $2);
return (!!$val == $neg) ? '##%' : '';
}
else
@@ -6609,7 +6618,7 @@ sub transform ($$)
# Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
# No extra parsing or post-processing is done (i.e., recognition of
# rules declaration or of make variables definitions).
-sub preprocess_file ($%)
+sub preprocess_file
{
my ($file, %transform) = @_;
@@ -6661,7 +6670,7 @@ sub preprocess_file ($%)
# Substitute Automake template tokens.
s/(?: % \?? [\w\-]+ %
| \? !? [\w\-]+ \?
- )/transform($&, \%transform)/gex;
+ )/transform($&, %transform)/gex;
# transform() may have added some ##%-comments to strip.
# (we use '##%' instead of '##' so we can distinguish ##%##%##% from
# ####### and do not remove the latter.)
@@ -6676,7 +6685,7 @@ sub preprocess_file ($%)
# -----------------------------------------
# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
# paragraphs.
-sub make_paragraphs ($%)
+sub make_paragraphs
{
my ($file, %transform) = @_;
$transform{FIRST} = !$transformed_files{$file};
@@ -6723,7 +6732,7 @@ sub make_paragraphs ($%)
# Return contents of a file from $libdir/am, automatically skipping
# macros or rules which are already known. $IS_AM iff the caller is
# reading an Automake file (as opposed to the user's Makefile.am).
-sub file_contents_internal ($$$%)
+sub file_contents_internal
{
my ($is_am, $file, $where, %transform) = @_;
@@ -6915,7 +6924,7 @@ sub file_contents_internal ($$$%)
# -----------------------------------------------
# Return contents of a file from $libdir/am, automatically skipping
# macros or rules which are already known.
-sub file_contents ($$%)
+sub file_contents
{
my ($basename, $where, %transform) = @_;
my ($comments, $variables, $rules) =
@@ -6941,7 +6950,7 @@ sub file_contents ($$%)
# variable "zardir" is defined, then "zar_PROGRAMS" becomes valid.
# This is to provide a little extra flexibility in those cases which
# need it.
-sub am_primary_prefixes ($$@)
+sub am_primary_prefixes
{
my ($primary, $can_dist, @prefixes) = @_;
@@ -7018,7 +7027,7 @@ sub am_primary_prefixes ($$@)
# FIXME: this should be rewritten to be cleaner. It should be broken
# up into multiple functions.
#
-sub am_install_var (@)
+sub am_install_var
{
my (@args) = @_;
@@ -7224,7 +7233,9 @@ sub am_install_var (@)
my %make_dirs = ();
my $make_dirs_set = 0;
-sub is_make_dir ($)
+# is_make_dir ($DIRECTORY)
+# ------------------------
+sub is_make_dir
{
my ($dir) = @_;
if (! $make_dirs_set)
@@ -7278,7 +7289,7 @@ sub locate_aux_dir ()
# push_required_file ($DIR, $FILE, $FULLFILE)
# -------------------------------------------
# Push the given file onto DIST_COMMON.
-sub push_required_file ($$$)
+sub push_required_file
{
my ($dir, $file, $fullfile) = @_;
@@ -7365,7 +7376,7 @@ my %required_file_not_found = ();
# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
# -------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
-sub required_file_check_or_copy ($$$)
+sub required_file_check_or_copy
{
my ($where, $dir, $file) = @_;
@@ -7477,7 +7488,7 @@ sub required_file_check_or_copy ($$$)
# $MYSTRICT is the strictness level at which this file becomes required.
# Worker threads may queue up the action to be serialized by the master,
# if $QUEUE is true
-sub require_file_internal ($$$@)
+sub require_file_internal
{
my ($where, $mystrict, $dir, $queue, @files) = @_;
@@ -7502,7 +7513,7 @@ sub require_file_internal ($$$@)
# require_file ($WHERE, $MYSTRICT, @FILES)
# ----------------------------------------
-sub require_file ($$@)
+sub require_file
{
my ($where, $mystrict, @files) = @_;
require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
@@ -7510,7 +7521,7 @@ sub require_file ($$@)
# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
# ----------------------------------------------------------
-sub require_file_with_macro ($$$@)
+sub require_file_with_macro
{
my ($cond, $macro, $mystrict, @files) = @_;
$macro = rvar ($macro) unless ref $macro;
@@ -7521,7 +7532,7 @@ sub require_file_with_macro ($$$@)
# ---------------------------------------------------------------
# Require an AC_LIBSOURCEd file. If AC_CONFIG_LIBOBJ_DIR was called, it
# must be in that directory. Otherwise expect it in the current directory.
-sub require_libsource_with_macro ($$$@)
+sub require_libsource_with_macro
{
my ($cond, $macro, $mystrict, @files) = @_;
$macro = rvar ($macro) unless ref $macro;
@@ -7537,9 +7548,9 @@ sub require_libsource_with_macro ($$$@)
}
# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
-# $MYSTRICT, @FILES)
+# $MYSTRICT, @FILES)
# --------------------------------------------------------------
-sub queue_required_file_check_or_copy ($$$$@)
+sub queue_required_file_check_or_copy
{
my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
my @serial_loc;
@@ -7556,7 +7567,7 @@ sub queue_required_file_check_or_copy ($$$$@)
# require_queued_file_check_or_copy ($QUEUE)
# ------------------------------------------
-sub require_queued_file_check_or_copy ($)
+sub require_queued_file_check_or_copy
{
my ($queue) = @_;
my $where;
@@ -7590,7 +7601,7 @@ sub require_queued_file_check_or_copy ($)
# require_conf_file ($WHERE, $MYSTRICT, @FILES)
# ---------------------------------------------
# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
-sub require_conf_file ($$@)
+sub require_conf_file
{
my ($where, $mystrict, @files) = @_;
my $queue = defined $required_conf_file_queue ? 1 : 0;
@@ -7601,7 +7612,7 @@ sub require_conf_file ($$@)
# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
# ---------------------------------------------------------------
-sub require_conf_file_with_macro ($$$@)
+sub require_conf_file_with_macro
{
my ($cond, $macro, $mystrict, @files) = @_;
require_conf_file (rvar ($macro)->rdef ($cond)->location,
@@ -7617,7 +7628,7 @@ sub require_conf_file_with_macro ($$$@)
# dependent upon.
# We don't want to emit the rule twice, and want to reuse it
# for directories with equivalent names (e.g., 'foo/bar' and './foo//bar').
-sub require_build_directory ($)
+sub require_build_directory
{
my $directory = shift;
@@ -7656,7 +7667,7 @@ sub require_build_directory ($)
# If $FILE lies in a subdirectory, emit a rule to create this
# directory and return the file that $FILE should be made
# dependent upon. Otherwise, just return the empty string.
-sub require_build_directory_maybe ($)
+sub require_build_directory_maybe
{
my $file = shift;
my $directory = dirname ($file);
@@ -7674,7 +7685,7 @@ sub require_build_directory_maybe ($)
################################################################
# Push a list of files onto '@dist_common'.
-sub push_dist_common (@)
+sub push_dist_common
{
prog_error "push_dist_common run after handle_dist"
if $handle_dist_run;
@@ -7689,7 +7700,7 @@ sub push_dist_common (@)
# ----------------------------------------------
# Generate a Makefile.in given the name of the corresponding Makefile and
# the name of the file output by config.status.
-sub generate_makefile ($$)
+sub generate_makefile
{
my ($makefile_am, $makefile_in) = @_;
@@ -7864,15 +7875,12 @@ sub generate_makefile ($$)
print $gm_file $output;
}
-################################################################
-
-
-
################################################################
+
# Helper function for usage().
-sub print_autodist_files (@)
+sub print_autodist_files
{
# NOTE: we need to call our 'uniq' function with the leading '&'
# here, because otherwise perl complains that "Unquoted string
@@ -8051,7 +8059,9 @@ sub parse_arguments ()
}
-sub handle_makefile ($)
+# handle_makefile ($MAKEFILE)
+# ---------------------------
+sub handle_makefile
{
my ($file) = @_;
($am_file = $file) =~ s/\.in$//;
@@ -8110,7 +8120,7 @@ sub get_number_of_threads ()
#
# The latter requires that the makefile that deals with the aux dir
# files be handled last, done by the master thread.
-sub handle_makefiles_threaded ($)
+sub handle_makefiles_threaded
{
my ($nthreads) = @_;
--
cgit v1.2.1
From 375cd196b718de69722c962e4ae944f91957562c Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 19 Apr 2013 14:15:17 +0200
Subject: maintcheck: avoid spurious failure
* t/preproc-errmsg.sh: Here, breaking up a sed command to avoid spuriously
triggering a failure in the 'sc_tests_logs_duplicate_prefixes' maintainer
check.
Signed-off-by: Stefano Lattarini
---
t/preproc-errmsg.sh | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/t/preproc-errmsg.sh b/t/preproc-errmsg.sh
index d7cf488d2..704562dcd 100755
--- a/t/preproc-errmsg.sh
+++ b/t/preproc-errmsg.sh
@@ -65,10 +65,13 @@ sub/local.mk:4: library has 'sub_x2' as canonical name (possible typo)
Makefile.am:2: 'sub/local.mk' included from here
END
-sed -e '/warnings are treated as errors/d' \
- -e 's/: warning:/:/' -e 's/: error:/:/' \
- -e 's/ */ /g' \
- obtained
+# We need to break these substitutions into multiple sed invocations
+# to avoid spuriously triggering the 'sc_tests_logs_duplicate_prefixes'
+# maintainer check.
+sed -e '/warnings are treated as errors/d' stderr > t1
+sed -e 's/: warning:/:/' t1 > t2
+sed -e 's/: error:/:/' t2 > t3
+sed -e 's/ */ /g' t3 > obtained
diff expected obtained
--
cgit v1.2.1
From 00f911e702265c297a04ecbcd5957ef236bf6f2f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 19 Apr 2013 16:12:48 +0200
Subject: NEWS (mint): reflect new Automake versioning scheme
The next minor Automake version will be 1.14, and *not* 1.13.2 -- that
will be the next bug-fixing version.
Signed-off-by: Stefano Lattarini
---
NEWS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 61903d56e..1d0d78927 100644
--- a/NEWS
+++ b/NEWS
@@ -80,7 +80,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-New in 1.13.2:
+New in 1.14:
* C compilation, and the AC_PROG_CC and AM_PROG_CC_C_O macros:
--
cgit v1.2.1
From dc08b37d20edf096c4b2555df24944ec08e063b3 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 19 Apr 2013 17:41:22 +0200
Subject: automake: refactoring: factor out common cpp-like flags
* automake.in (@cpplike_flags): In this new variable...
(C, C++, Objective C, Objective C++, Unified Parallel C, Preprocessed
Assembler, Preprocessed Fortran, Preprocessed Fortran 77): ... to be
used by registration (with the 'register_language' subroutine) of these
languages.
This is a refactoring meant to simplify future changes; no semantic
change is intended.
Signed-off-by: Stefano Lattarini
---
automake.in | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/automake.in b/automake.in
index bbf0c880a..751dc84ed 100644
--- a/automake.in
+++ b/automake.in
@@ -609,6 +609,15 @@ sub initialize_per_input ()
# Initialize our list of languages that are internally supported.
+my @cpplike_flags =
+ qw{
+ $(DEFS)
+ $(DEFAULT_INCLUDES)
+ $(INCLUDES)
+ $(AM_CPPFLAGS)
+ $(CPPFLAGS)
+ };
+
# C.
register_language ('name' => 'c',
'Name' => 'C',
@@ -617,7 +626,7 @@ register_language ('name' => 'c',
'flags' => ['CFLAGS', 'CPPFLAGS'],
'ccer' => 'CC',
'compiler' => 'COMPILE',
- 'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)',
+ 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)",
'lder' => 'CCLD',
'ld' => '$(CC)',
'linker' => 'LINK',
@@ -634,7 +643,7 @@ register_language ('name' => 'cxx',
'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'autodep' => 'CXX',
'flags' => ['CXXFLAGS', 'CPPFLAGS'],
- 'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)',
+ 'compile' => "\$(CXX) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)",
'ccer' => 'CXX',
'compiler' => 'CXXCOMPILE',
'compile_flag' => '-c',
@@ -653,7 +662,7 @@ register_language ('name' => 'objc',
'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'autodep' => 'OBJC',
'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
- 'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)',
+ 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)",
'ccer' => 'OBJC',
'compiler' => 'OBJCCOMPILE',
'compile_flag' => '-c',
@@ -671,7 +680,7 @@ register_language ('name' => 'objcxx',
'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'autodep' => 'OBJCXX',
'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
- 'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
+ 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)",
'ccer' => 'OBJCXX',
'compiler' => 'OBJCXXCOMPILE',
'compile_flag' => '-c',
@@ -689,7 +698,7 @@ register_language ('name' => 'upc',
'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
'autodep' => 'UPC',
'flags' => ['UPCFLAGS', 'CPPFLAGS'],
- 'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)',
+ 'compile' => "\$(UPC) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)",
'ccer' => 'UPC',
'compiler' => 'UPCCOMPILE',
'compile_flag' => '-c',
@@ -808,7 +817,7 @@ register_language ('name' => 'cppasm',
'autodep' => 'CCAS',
'flags' => ['CCASFLAGS', 'CPPFLAGS'],
- 'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+ 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)",
'ccer' => 'CPPAS',
'compiler' => 'CPPASCOMPILE',
'compile_flag' => '-c',
@@ -862,7 +871,7 @@ register_language ('name' => 'ppfc',
'flags' => ['FCFLAGS', 'CPPFLAGS'],
'ccer' => 'PPFC',
'compiler' => 'PPFCCOMPILE',
- 'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)',
+ 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)",
'compile_flag' => '-c',
'output_flag' => '-o',
'libtool_tag' => 'FC',
@@ -894,7 +903,7 @@ register_language ('name' => 'ppf77',
'flags' => ['FFLAGS', 'CPPFLAGS'],
'ccer' => 'PPF77',
'compiler' => 'PPF77COMPILE',
- 'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)',
+ 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)",
'compile_flag' => '-c',
'output_flag' => '-o',
'libtool_tag' => 'F77',
--
cgit v1.2.1
From 9ce05bc8b95751ffe65c64ecd45aeef8618d90c8 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 20 Apr 2013 14:44:41 +0200
Subject: tests: fix botched cross-reference in a heading comment
* t/extra-dist-wildcards.sh: Here.
Signed-off-by: Stefano Lattarini
---
t/extra-dist-wildcards.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/extra-dist-wildcards.sh b/t/extra-dist-wildcards.sh
index 5e7ef9801..782b8d772 100755
--- a/t/extra-dist-wildcards.sh
+++ b/t/extra-dist-wildcards.sh
@@ -16,8 +16,8 @@
# Check that wildcards in EXTRA_DIST are honoured.
# Suggested by observations from Braden McDaniel.
-# See also sister test 'extra11.sh', that checks a similar usage
-# with the involvement of the $(wildcard) GNU make builtin.
+# See also sister test 'extra-dist-wildcards-gnu.sh', that checks a
+# similar usage with the involvement of the $(wildcard) GNU make builtin.
required=GNUmake
. test-init.sh
--
cgit v1.2.1
From c209e4df034c5aeb27375dddf5c15578cbd0887c Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 20 Apr 2013 14:46:33 +0200
Subject: typofix: in comments in t/extra2.sh
Signed-off-by: Stefano Lattarini
---
t/extra2.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/extra2.sh b/t/extra2.sh
index b971a4b87..f3c3f5bdb 100755
--- a/t/extra2.sh
+++ b/t/extra2.sh
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# Check to make sure EXTRA_foo_SOURCES not defined unnecessarily.
+# Check to make sure EXTRA_foo_SOURCES are not defined unnecessarily.
. test-init.sh
--
cgit v1.2.1
From ad5816114582e329cfaf6df84ebfd6ddba190e34 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 25 Apr 2013 22:02:14 +0200
Subject: tests: rename some with more descriptive names
* t/tar3.sh: Rename ...
* t/tar-opts-errors.sh: ... like this.
* t/tar2.sh: Rename...
* t/tar-pax.sh: ... like this.
* t/tar.sh: Rename ...
* t/tar-ustar.sh: ... like this.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini
---
t/list-of-tests.mk | 6 +++---
t/tar-opts-errors.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
t/tar-pax.sh | 40 ++++++++++++++++++++++++++++++++++++++++
t/tar-ustar.sh | 40 ++++++++++++++++++++++++++++++++++++++++
t/tar.sh | 40 ----------------------------------------
t/tar2.sh | 40 ----------------------------------------
t/tar3.sh | 52 ----------------------------------------------------
7 files changed, 135 insertions(+), 135 deletions(-)
create mode 100755 t/tar-opts-errors.sh
create mode 100755 t/tar-pax.sh
create mode 100755 t/tar-ustar.sh
delete mode 100755 t/tar.sh
delete mode 100755 t/tar2.sh
delete mode 100755 t/tar3.sh
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 679fe5d40..a610169b5 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1156,9 +1156,9 @@ t/tags.sh \
t/tags2.sh \
t/tagsub.sh \
t/tags-pr12372.sh \
-t/tar.sh \
-t/tar2.sh \
-t/tar3.sh \
+t/tar-ustar.sh \
+t/tar-pax.sh \
+t/tar-opts-errors.sh \
t/tar-override.sh \
t/target-cflags.sh \
t/targetclash.sh \
diff --git a/t/tar-opts-errors.sh b/t/tar-opts-errors.sh
new file mode 100755
index 000000000..040d7b449
--- /dev/null
+++ b/t/tar-opts-errors.sh
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 2004-2013 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 2, 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 .
+
+# Check the tar options diagnostics.
+
+. test-init.sh
+
+cat > configure.ac << 'END'
+AC_INIT([tar2], [1.0])
+AM_INIT_AUTOMAKE([tar-pax tar-v7])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails
+grep "^configure\.ac:2:.*mutually exclusive" stderr > tar-err
+cat tar-err
+test 1 -eq $(wc -l < tar-err)
+grep "'tar-pax'" tar-err
+grep "'tar-v7'" tar-err
+
+rm -rf autom4te.cache
+
+cat > configure.ac << 'END'
+AC_INIT([tar2], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+echo 'AUTOMAKE_OPTIONS = tar-pax' > Makefile.am
+
+AUTOMAKE_fails
+grep '^Makefile\.am:1:.*tar-pax.*AM_INIT_AUTOMAKE' stderr
+
+:
diff --git a/t/tar-pax.sh b/t/tar-pax.sh
new file mode 100755
index 000000000..5a9d4d745
--- /dev/null
+++ b/t/tar-pax.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2004-2013 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 2, 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 .
+
+# Check the tar-pax option.
+
+. test-init.sh
+
+cat > configure.ac << 'END'
+AC_INIT([tar2], [1.0])
+AM_INIT_AUTOMAKE([tar-pax])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+if grep 'am__tar.*false' Makefile; then
+ skip_ "cannot find proper archiver program"
+fi
+
+$MAKE distcheck
+test -f tar2-1.0.tar.gz
diff --git a/t/tar-ustar.sh b/t/tar-ustar.sh
new file mode 100755
index 000000000..58e52eabf
--- /dev/null
+++ b/t/tar-ustar.sh
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2004-2013 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 2, 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 .
+
+# Check the tar-ustar option.
+
+. test-init.sh
+
+cat > configure.ac << 'END'
+AC_INIT([tar], [1.0])
+AM_INIT_AUTOMAKE([tar-ustar])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+if grep 'am__tar.*false' Makefile; then
+ skip_ "cannot find proper archiver program"
+fi
+
+$MAKE distcheck
+test -f tar-1.0.tar.gz
diff --git a/t/tar.sh b/t/tar.sh
deleted file mode 100755
index 58e52eabf..000000000
--- a/t/tar.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004-2013 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 2, 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 .
-
-# Check the tar-ustar option.
-
-. test-init.sh
-
-cat > configure.ac << 'END'
-AC_INIT([tar], [1.0])
-AM_INIT_AUTOMAKE([tar-ustar])
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-END
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-./configure
-
-if grep 'am__tar.*false' Makefile; then
- skip_ "cannot find proper archiver program"
-fi
-
-$MAKE distcheck
-test -f tar-1.0.tar.gz
diff --git a/t/tar2.sh b/t/tar2.sh
deleted file mode 100755
index 5a9d4d745..000000000
--- a/t/tar2.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004-2013 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 2, 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 .
-
-# Check the tar-pax option.
-
-. test-init.sh
-
-cat > configure.ac << 'END'
-AC_INIT([tar2], [1.0])
-AM_INIT_AUTOMAKE([tar-pax])
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-END
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-./configure
-
-if grep 'am__tar.*false' Makefile; then
- skip_ "cannot find proper archiver program"
-fi
-
-$MAKE distcheck
-test -f tar2-1.0.tar.gz
diff --git a/t/tar3.sh b/t/tar3.sh
deleted file mode 100755
index 040d7b449..000000000
--- a/t/tar3.sh
+++ /dev/null
@@ -1,52 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004-2013 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 2, 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 .
-
-# Check the tar options diagnostics.
-
-. test-init.sh
-
-cat > configure.ac << 'END'
-AC_INIT([tar2], [1.0])
-AM_INIT_AUTOMAKE([tar-pax tar-v7])
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-END
-
-: > Makefile.am
-
-$ACLOCAL
-AUTOMAKE_fails
-grep "^configure\.ac:2:.*mutually exclusive" stderr > tar-err
-cat tar-err
-test 1 -eq $(wc -l < tar-err)
-grep "'tar-pax'" tar-err
-grep "'tar-v7'" tar-err
-
-rm -rf autom4te.cache
-
-cat > configure.ac << 'END'
-AC_INIT([tar2], [1.0])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-END
-
-echo 'AUTOMAKE_OPTIONS = tar-pax' > Makefile.am
-
-AUTOMAKE_fails
-grep '^Makefile\.am:1:.*tar-pax.*AM_INIT_AUTOMAKE' stderr
-
-:
--
cgit v1.2.1
From 9c813963e2f67cbf4604a1a1947c2ff779ecc8f0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 4 May 2013 13:59:19 +0200
Subject: tests: remove bashism from a test
* t/preproc-c-compile.sh (Makefile.am): Use "test foo = bar", not the
bash-specific "test foo == bar".
Signed-off-by: Stefano Lattarini
---
t/preproc-c-compile.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh
index 79e9325ed..1b8af0f29 100755
--- a/t/preproc-c-compile.sh
+++ b/t/preproc-c-compile.sh
@@ -68,7 +68,7 @@ bin_PROGRAMS =
include $(top_srcdir)/zot/local.mk
test:
- test '$(bin_PROGRAMS)' == mumble$(EXEEXT)
+ test '$(bin_PROGRAMS)' = mumble$(EXEEXT)
test '$(mumble_SOURCES)' = one.c
check-local: test
END
--
cgit v1.2.1
From 481c9975556b178a3aa095a808b9c7a87a24c426 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 4 May 2013 14:02:06 +0200
Subject: tests: typofixes in comments in t/preproc-c-compile.sh
Signed-off-by: Stefano Lattarini
---
t/preproc-c-compile.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh
index 1b8af0f29..7c398a83e 100755
--- a/t/preproc-c-compile.sh
+++ b/t/preproc-c-compile.sh
@@ -111,7 +111,7 @@ fi
# GNU install refuses to override a just-installed file; since we
# have plenty of 'mumble' dummy programs to install in the same
# location, such "overridden installations" are not a problem for
-# us, so just force the use the 'install-sh' script
+# us; so just force the use the 'install-sh' script.
ac_cv_path_install=$(pwd)/install-sh; export ac_cv_path_install
$MAKE distcheck
--
cgit v1.2.1
From 1667d369091fe41d2bbdf645490a29d45142556f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 5 May 2013 00:53:27 +0200
Subject: maint branch: we are going to become Automake 1.14
* configure.ac (AC_INIT): So adjust beta version in here, from
1.13.2a to 1.13a.
* m4/amversion.m4: Regenerate.
Signed-off-by: Stefano Lattarini
---
configure.ac | 2 +-
m4/amversion.m4 | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 840abf472..043b46795 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@
# along with this program. If not, see .
AC_PREREQ([2.69])
-AC_INIT([GNU Automake], [1.13.2a], [bug-automake@gnu.org])
+AC_INIT([GNU Automake], [1.13a], [bug-automake@gnu.org])
AC_CONFIG_SRCDIR([automake.in])
AC_CONFIG_AUX_DIR([lib])
diff --git a/m4/amversion.m4 b/m4/amversion.m4
index 02b309c8f..e8e5e360f 100644
--- a/m4/amversion.m4
+++ b/m4/amversion.m4
@@ -12,10 +12,10 @@
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.13'
+[am__api_version='1.13a'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.13.2a], [],
+m4_if([$1], [1.13a], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -31,7 +31,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.13.2a])dnl
+[AM_AUTOMAKE_VERSION([1.13a])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
--
cgit v1.2.1
From c8f106c772e608b25aa6a3aa8eeeb0119e097ab2 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 9 May 2013 11:17:47 +0200
Subject: build: break up monolithic Makefile.am in subdir-specific fragments
This is convenient to do, now that we have improved "relative directory"
support with the '%reladir%' (a.k.a. '%D%') and '%canon_reladir%' (a.k.a.
'%C%') Automake-time substitutions for included makefile fragments.
This move also satisfy our philosophy of using new Automake features in
our own build system, as a way of facilitating early discovery of possible
bugs or interface warts.
* Makefile.am: Break up ...
* doc/Makefile.inc, lib/Automake/Makefile.inc, lib/Makefile.inc,
lib/am/Makefile.inc, m4/Makefile.inc, t/Makefile.inc): ... in this
new included fragments. Adjust as needed, and make deliberate use
of the '%D%' substitution.
* contrib/t/local.am: Rename ...
* contrib/t/Makefile.inc: ... like this.
Signed-off-by: Stefano Lattarini
---
Makefile.am | 586 ++--------------------------------------------
contrib/t/Makefile.inc | 26 ++
contrib/t/local.am | 25 --
doc/Makefile.inc | 116 +++++++++
lib/Automake/Makefile.inc | 57 +++++
lib/Makefile.inc | 68 ++++++
lib/am/Makefile.inc | 65 +++++
m4/Makefile.inc | 79 +++++++
t/Makefile.inc | 274 ++++++++++++++++++++++
9 files changed, 704 insertions(+), 592 deletions(-)
create mode 100644 contrib/t/Makefile.inc
delete mode 100644 contrib/t/local.am
create mode 100644 doc/Makefile.inc
create mode 100644 lib/Automake/Makefile.inc
create mode 100644 lib/Makefile.inc
create mode 100644 lib/am/Makefile.inc
create mode 100644 m4/Makefile.inc
create mode 100644 t/Makefile.inc
diff --git a/Makefile.am b/Makefile.am
index a98a1ce1a..c49d1e9e2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,6 +22,11 @@ CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
EXTRA_DIST =
+TAGS_FILES =
+dist_noinst_DATA =
+nodist_noinst_DATA =
+dist_noinst_SCRIPTS =
+nodist_noinst_SCRIPTS =
## ------------ ##
## Top level. ##
@@ -63,7 +68,7 @@ bin_SCRIPTS = automake aclocal
CLEANFILES += $(bin_SCRIPTS)
AUTOMAKESOURCES = automake.in aclocal.in
-TAGS_FILES = $(AUTOMAKESOURCES)
+TAGS_FILES += $(AUTOMAKESOURCES)
EXTRA_DIST += \
$(AUTOMAKESOURCES) \
@@ -130,563 +135,7 @@ maintainer-clean-local:
# (as it is maintainer-specific).
ChangeLog:
-
-## -------------------------------------------------------------------- ##
-## Auxiliary scripts and files for use with "automake --add-missing". ##
-## -------------------------------------------------------------------- ##
-
-dist_pkgvdata_DATA = \
- lib/COPYING \
- lib/INSTALL \
- lib/texinfo.tex
-
-# These must all be executable when installed. However, if we use
-# _SCRIPTS, then the program transform will be applied, which is not
-# what we want. So we make them executable by hand.
-dist_script_DATA = \
- lib/config.guess \
- lib/config.sub \
- lib/install-sh \
- lib/mdate-sh \
- lib/missing \
- lib/mkinstalldirs \
- lib/ylwrap \
- lib/depcomp \
- lib/compile \
- lib/py-compile \
- lib/ar-lib \
- lib/test-driver \
- lib/tap-driver.sh \
- lib/tap-driver.pl
-
-install-data-hook:
- @$(POST_INSTALL)
- @for f in $(dist_script_DATA); do echo $$f; done \
- | sed 's,^lib/,,' \
- | ( st=0; \
- while read f; do \
- echo " chmod +x '$(DESTDIR)$(scriptdir)/$$f'"; \
- chmod +x "$(DESTDIR)$(scriptdir)/$$f" || st=1; \
- done; \
- exit $$st )
-
-installcheck-local: installcheck-executable-scripts
-installcheck-executable-scripts:
- @for f in $(dist_script_DATA); do echo $$f; done \
- | sed 's,^lib/,,' \
- | while read f; do \
- path="$(pkgvdatadir)/$$f"; \
- test -x "$$path" || echo $$path; \
- done \
- | sed 's/$$/: not executable/' \
- | grep . 1>&2 && exit 1; exit 0
-
-
-## ---------------------------------------------------- ##
-## Private perl modules used by automake and aclocal. ##
-## ---------------------------------------------------- ##
-
-perllibdir = $(pkgvdatadir)/Automake
-dist_perllib_DATA = \
- lib/Automake/ChannelDefs.pm \
- lib/Automake/Channels.pm \
- lib/Automake/Condition.pm \
- lib/Automake/Configure_ac.pm \
- lib/Automake/DisjConditions.pm \
- lib/Automake/FileUtils.pm \
- lib/Automake/General.pm \
- lib/Automake/Getopt.pm \
- lib/Automake/Item.pm \
- lib/Automake/ItemDef.pm \
- lib/Automake/Language.pm \
- lib/Automake/Location.pm \
- lib/Automake/Options.pm \
- lib/Automake/Rule.pm \
- lib/Automake/RuleDef.pm \
- lib/Automake/Variable.pm \
- lib/Automake/VarDef.pm \
- lib/Automake/Version.pm \
- lib/Automake/XFile.pm \
- lib/Automake/Wrap.pm
-
-nodist_perllib_DATA = lib/Automake/Config.pm
-CLEANFILES += $(nodist_perllib_DATA)
-
-lib/Automake/Config.pm: lib/Automake/Config.in Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_at)test -d lib/Automake || $(MKDIR_P) lib/Automake
- $(AM_V_GEN)in=Config.in \
- && $(do_subst) <$(srcdir)/lib/Automake/Config.in >$@-t
- $(generated_file_finalize)
-EXTRA_DIST += lib/Automake/Config.in
-
-
-## --------------------- ##
-## Makefile fragments. ##
-## --------------------- ##
-
-dist_am_DATA = \
- lib/am/check.am \
- lib/am/check2.am \
- lib/am/clean-hdr.am \
- lib/am/clean.am \
- lib/am/compile.am \
- lib/am/configure.am \
- lib/am/data.am \
- lib/am/dejagnu.am \
- lib/am/depend.am \
- lib/am/depend2.am \
- lib/am/distdir.am \
- lib/am/footer.am \
- lib/am/header-vars.am \
- lib/am/header.am \
- lib/am/install.am \
- lib/am/inst-vars.am \
- lib/am/java.am \
- lib/am/lang-compile.am \
- lib/am/lex.am \
- lib/am/library.am \
- lib/am/libs.am \
- lib/am/libtool.am \
- lib/am/lisp.am \
- lib/am/ltlib.am \
- lib/am/ltlibrary.am \
- lib/am/mans-vars.am \
- lib/am/mans.am \
- lib/am/program.am \
- lib/am/progs.am \
- lib/am/python.am \
- lib/am/remake-hdr.am \
- lib/am/scripts.am \
- lib/am/subdirs.am \
- lib/am/tags.am \
- lib/am/texi-vers.am \
- lib/am/texibuild.am \
- lib/am/texinfos.am \
- lib/am/vala.am \
- lib/am/yacc.am
-
-
-## ------------------------------ ##
-## Automake-provided m4 macros. ##
-## ------------------------------ ##
-
-dist_automake_ac_DATA = \
- m4/amversion.m4 \
- m4/ar-lib.m4 \
- m4/as.m4 \
- m4/auxdir.m4 \
- m4/cond.m4 \
- m4/cond-if.m4 \
- m4/depend.m4 \
- m4/depout.m4 \
- m4/dmalloc.m4 \
- m4/extra-recurs.m4 \
- m4/gcj.m4 \
- m4/init.m4 \
- m4/install-sh.m4 \
- m4/lead-dot.m4 \
- m4/lex.m4 \
- m4/lispdir.m4 \
- m4/maintainer.m4 \
- m4/make.m4 \
- m4/minuso.m4 \
- m4/missing.m4 \
- m4/mkdirp.m4 \
- m4/obsolete.m4 \
- m4/options.m4 \
- m4/python.m4 \
- m4/runlog.m4 \
- m4/sanity.m4 \
- m4/silent.m4 \
- m4/strip.m4 \
- m4/substnot.m4 \
- m4/tar.m4 \
- m4/upc.m4 \
- m4/vala.m4
-
-automake_internal_acdir = $(automake_acdir)/internal
-dist_automake_internal_ac_DATA = m4/internal/ac-config-macro-dirs.m4
-
-dist_system_ac_DATA = m4/acdir/README
-
-# We build amversion.m4 here, instead of from config.status,
-# because config.status is rerun each time one of configure's
-# dependencies change and amversion.m4 happens to be a configure
-# dependency. configure and amversion.m4 would be rebuilt in
-# loop otherwise.
-# Use '$(top_srcdir)/m4' for the benefit of non-GNU makes: this is
-# how amversion.m4 appears in our dependencies.
-$(top_srcdir)/m4/amversion.m4: $(srcdir)/configure.ac $(srcdir)/m4/amversion.in
- $(AM_V_at)rm -f $@-t $@
- $(AM_V_GEN)in=amversion.in \
- && $(do_subst) <$(srcdir)/m4/amversion.in >$@-t
- $(generated_file_finalize)
-EXTRA_DIST += m4/amversion.in
-
-
-## ------------ ##
-## Testsuite. ##
-## ------------ ##
-
-# Run the tests with a proper shell detected at configure time.
-LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
-
-TEST_EXTENSIONS = .pl .sh .tap
-SH_LOG_COMPILER = $(LOG_COMPILER)
-TAP_LOG_COMPILER = $(LOG_COMPILER)
-PL_LOG_COMPILER = $(PERL)
-AM_PL_LOG_FLAGS = -Mstrict -I $(builddir)/lib -I $(srcdir)/lib -w
-
-TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
-
-AM_TAP_LOG_DRIVER_FLAGS = --merge
-
-EXTRA_DIST += t/README t/ax/is t/ax/is_newest
-
-## Will be updated later.
-TESTS =
-
-# Some testsuite-influential variables should be overridable from the
-# test scripts, but not from the environment.
-# Keep this in sync with the similar list in 't/ax/runtest.in'.
-AM_TESTS_ENVIRONMENT = \
- for v in \
- required \
- am_test_protocol \
- am_serial_tests \
- am_test_prefer_config_shell \
- am_original_AUTOMAKE \
- am_original_ACLOCAL \
- am_test_lib_sourced \
- test_lib_sourced \
- ; do \
- eval test x"\$${$$v}" = x || unset $$v; \
- done;
-# We want warning messages and explanations for skipped tests to go to
-# the console if possible, so set up 'stderr_fileno_' properly.
-AM_TESTS_FD_REDIRECT = 9>&2
-AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
-
-# For sourcing of extra "shell libraries" by our test scripts. As per
-# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
-# in case it is given with a relative name containing no slashes.
-AM_TESTS_ENVIRONMENT += \
- if test $(srcdir) != .; then \
- PATH='$(abs_srcdir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
- fi; \
- PATH='$(abs_builddir)/t/ax'$(PATH_SEPARATOR)$$PATH; \
- export PATH;
-
-# Hand-written tests.
-
-include $(srcdir)/t/list-of-tests.mk
-
-TESTS += $(handwritten_TESTS)
-EXTRA_DIST += $(handwritten_TESTS)
-
-# Automatically-generated tests wrapping hand-written ones.
-# Also, automatically-computed dependencies for tests.
-
-include $(srcdir)/t/testsuite-part.am
-
-TESTS += $(generated_TESTS)
-EXTRA_DIST += $(generated_TESTS)
-
-$(srcdir)/t/testsuite-part.am:
- $(AM_V_at)rm -f t/testsuite-part.tmp $@
- $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
- --srcdir $(srcdir) > t/testsuite-part.tmp
- $(AM_V_at)chmod a-w t/testsuite-part.tmp
- $(AM_V_at)mv -f t/testsuite-part.tmp $@
-EXTRA_DIST += gen-testsuite-part
-
-# The dependecies declared here are not truly complete, but such
-# completeness would cause more issues than it would solve. See
-# automake bug#11347.
-$(generated_TESTS): $(srcdir)/gen-testsuite-part
-$(srcdir)/t/testsuite-part.am: $(srcdir)/gen-testsuite-part Makefile.am
-
-# Hand-written tests for stuff in 'contrib/'.
-include $(srcdir)/contrib/t/local.am
-TESTS += $(contrib_TESTS)
-EXTRA_DIST += $(contrib_TESTS)
-
-# Static dependencies valid for each test case (also further
-# extended later). Note that use 'noinst_' rather than 'check_'
-# as the prefix, because we really want them to be built by
-# "make all". This makes it easier to run the test cases by
-# hand after having simply configured and built the package.
-
-nodist_noinst_SCRIPTS = \
- t/wrap/aclocal-$(APIVERSION) \
- t/wrap/automake-$(APIVERSION)
-
-dist_noinst_DATA = \
- t/ax/test-init.sh \
- t/ax/test-lib.sh \
- t/ax/am-test-lib.sh \
- t/ax/tap-functions.sh
-
-# Few more static dependencies.
-t/distcheck-missing-m4.log: t/ax/distcheck-hook-m4.am
-t/distcheck-outdated-m4.log: t/ax/distcheck-hook-m4.am
-EXTRA_DIST += t/ax/distcheck-hook-m4.am
-
-t/ax/test-defs.sh: t/ax/test-defs.in Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_at)$(MKDIR_P) t/ax
- $(AM_V_GEN)in=t/ax/test-defs.in \
- && $(do_subst) <$(srcdir)/$$in >$@-t
- $(generated_file_finalize)
-EXTRA_DIST += t/ax/test-defs.in
-CLEANFILES += t/ax/test-defs.sh
-nodist_noinst_DATA = t/ax/test-defs.sh
-
-## Will be updated soon.
-noinst_SCRIPTS =
-
-t/ax/shell-no-trail-bslash: t/ax/shell-no-trail-bslash.in Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=t/ax/shell-no-trail-bslash.in \
- && $(MKDIR_P) t/ax \
- && $(do_subst) <$(srcdir)/$$in >$@-t \
- && chmod a+x $@-t
- $(generated_file_finalize)
-EXTRA_DIST += t/ax/shell-no-trail-bslash.in
-CLEANFILES += t/ax/shell-no-trail-bslash
-noinst_SCRIPTS += t/ax/shell-no-trail-bslash
-
-t/ax/cc-no-c-o: t/ax/cc-no-c-o.in Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=t/ax/cc-no-c-o.in \
- && $(MKDIR_P) t/ax \
- && $(do_subst) <$(srcdir)/$$in >$@-t \
- && chmod a+x $@-t
- $(generated_file_finalize)
-EXTRA_DIST += t/ax/cc-no-c-o.in
-CLEANFILES += t/ax/cc-no-c-o
-noinst_SCRIPTS += t/ax/cc-no-c-o
-
-runtest: t/ax/runtest.in Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=t/ax/runtest.in \
- && $(MKDIR_P) t/ax \
- && $(do_subst) <$(srcdir)/$$in >$@-t \
- && chmod a+x $@-t
- $(generated_file_finalize)
-EXTRA_DIST += t/ax/runtest.in
-CLEANFILES += runtest
-noinst_SCRIPTS += runtest
-
-# If two test scripts have the same basename, they will end up sharing
-# the same log file, leading to all sort of undefined and undesired
-# behaviours.
-check-no-repeated-test-name:
- @LC_ALL=C; export LC_ALL; \
- lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
- | sort | uniq -c | awk '($$1 > 1) { print }' \
- | sed 's/\.log$$//' | grep . >&2 \
- && { \
- echo $@: test names listed above are duplicated >&2; \
- exit 1; \
- }; :
-check-local: check-no-repeated-test-name
-.PHONY: check-no-repeated-test-name
-
-# Check that our test cases are syntactically correct.
-# See automake bug#11898.
-check-tests-syntax:
- @st=0; \
- err () { echo "$@: $$*" >&2; st=1; }; \
-## The user might do something like "make check TESTS=t/foo" or
-## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
-## 't/foo.sh' to be run; this has worked well until today, and
-## we want to continue supporting this use case.
- bases=`for log in : $(TEST_LOGS); do echo $$log; done \
- | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
- for bas in $$bases; do \
- for suf in sh tap pl; do \
- tst=$$bas.$$suf; \
-## Emulate VPATH search.
- if test -f $$tst; then \
- break; \
- elif test -f $(srcdir)/$$tst; then \
- tst=$(srcdir)/$$tst; \
- break; \
- else \
- tst=''; \
- fi; \
- done; \
- test -n "$$tst" || err "couldn't find test '$$bas'"; \
-## Don't check that perl tests are valid shell scripts!
- test $$suf = pl && continue; \
- $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
- $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
- || err "test '$$tst' syntactically invalid"; \
- done; \
- exit $$st
-check-local: check-tests-syntax
-.PHONY: check-tests-syntax
-
-# Recipes with a trailing backslash character (possibly followed by
-# blank characters only) can cause spurious syntax errors with at
-# least older bash versions (e.g., bash 2.05b), and can be potentially
-# be unportable to other weaker shells. Run the testsuite in a way
-# that helps catching such problems in Automake-generated recipes.
-# See automake bug#10436.
-check-no-trailing-backslash-in-recipes:
- $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
- CONFIG_SHELL='$(abs_top_builddir)/t/ax/shell-no-trail-bslash'
-.PHONY: check-no-trailing-backslash-in-recipes
-
-# Some compilers out there (hello, MSVC) still choke on "-c -o" being
-# passed together on the command line. Run the whole testsuite faking
-# the presence of such a compiler, to help catch regressions that would
-# otherwise only present themselves later "in the wild". See also the
-# long discussion about automake bug#13378.
-check-cc-no-c-o:
- $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
- CC='$(abs_top_builddir)/t/ax/cc-no-c-o' \
- GNU_CC='$(abs_top_builddir)/t/ax/cc-no-c-o'
-.PHONY: check-cc-no-c-o
-
-## Checking the list of tests.
-test_subdirs = t t/pm contrib/t
-include $(srcdir)/t/CheckListOfTests.am
-
-# Run the testsuite with the installed aclocal and automake.
-installcheck-local: installcheck-testsuite
-installcheck-testsuite:
- am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
-
-# Performance tests.
-.PHONY: perf
-perf: all
- $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
- TESTS='$(perf_TESTS)' check
-PERF_TEST_SUITE_LOG = t/perf/test-suite.log
-CLEANFILES += $(PERF_TEST_SUITE_LOG)
-EXTRA_DIST += $(perf_TESTS)
-
-clean-local: clean-local-check
-.PHONY: clean-local-check
-clean-local-check:
-## Directories candidate to be test directories match this wildcard.
- @globs='t/*.dir t/*/*.dir */t/*.dir */t/*/*.dir'; \
-## The 'nullglob' bash option is not portable, so use perl.
- dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \
- if test -n "$$dirs"; then \
-## Errors in find are acceptable, errors in rm are not.
- find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
- echo " rm -rf $$dirs"; \
- rm -rf $$dirs || exit 1; \
- fi
-
-
-## ---------------- ##
-## Documentation. ##
-## ---------------- ##
-
-info_TEXINFOS = doc/automake.texi doc/automake-history.texi
-doc_automake_TEXINFOS = doc/fdl.texi
-doc_automake_history_TEXINFOS = doc/fdl.texi
-
-man1_MANS = \
- doc/aclocal.1 \
- doc/automake.1 \
- doc/aclocal-$(APIVERSION).1 \
- doc/automake-$(APIVERSION).1
-
-$(man1_MANS): $(srcdir)/configure.ac
-
-CLEANFILES += $(man1_MANS)
-EXTRA_DIST += doc/help2man
-
-update_mans = \
- $(AM_V_GEN): \
- && $(MKDIR_P) doc \
- && $(extend_PATH) \
- && $(PERL) $(srcdir)/doc/help2man --output=$@
-
-doc/aclocal.1 doc/automake.1:
- $(AM_V_GEN): \
- && $(MKDIR_P) doc \
- && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
- && echo ".so man1/$$f-$(APIVERSION).1" > $@
-
-doc/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm
- $(update_mans) aclocal-$(APIVERSION)
-doc/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm
- $(update_mans) automake-$(APIVERSION)
-
-
-## ---------------------------- ##
-## Example package "amhello". ##
-## ---------------------------- ##
-
-amhello_sources = \
- doc/amhello/configure.ac \
- doc/amhello/Makefile.am \
- doc/amhello/README \
- doc/amhello/src/main.c \
- doc/amhello/src/Makefile.am
-
-amhello_configury = \
- aclocal.m4 \
- autom4te.cache \
- Makefile.in \
- config.h.in \
- configure \
- depcomp \
- install-sh \
- missing \
- src/Makefile.in
-
-dist_noinst_DATA += $(amhello_sources)
-dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz
-
-setup_autotools_paths = { \
- $(extend_PATH) \
- && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \
- && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \
- && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \
- && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \
- && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \
- && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \
- && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \
- && true; \
-}
-
-# We depend on configure.ac so that we regenerate the tarball
-# whenever the Automake version changes.
-$(srcdir)/doc/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac
- $(AM_V_GEN)tmp=amhello-output.tmp \
- && $(am__cd) $(srcdir)/doc/amhello \
- && : Make our aclocal and automake avaiable before system ones. \
- && $(setup_autotools_paths) \
- && ( \
- { $(AM_V_P) || exec 5>&2 >$$tmp 2>&1; } \
- && $(am_AUTORECONF) -vfi \
- && ./configure \
- && $(MAKE) $(AM_MAKEFLAGS) distcheck \
- && $(MAKE) $(AM_MAKEFLAGS) distclean \
- || { \
- if $(AM_V_P); then :; else \
- echo "$@: recipe failed." >&5; \
- echo "See file '`pwd`/$$tmp' for details" >&5; \
- fi; \
- exit 1; \
- } \
- ) \
- && rm -rf $(amhello_configury) $$tmp \
- && mv -f amhello-1.0.tar.gz ..
-
-
-## ------------------------------------------------- ##
-## Third-party, obsolescent or experimental stuff. ##
-## ------------------------------------------------- ##
-
+# Third-party, obsolescent or experimental stuff.
EXTRA_DIST += \
contrib/check-html.am \
contrib/multilib/README \
@@ -696,11 +145,7 @@ EXTRA_DIST += \
contrib/multilib/multi.m4 \
contrib/README
-
-## --------------------------------------------------- ##
-## Older files, kept mostly for historical interest. ##
-## --------------------------------------------------- ##
-
+# Older files, kept mostly for historical interest.
EXTRA_DIST += \
old/ChangeLog-tests \
old/ChangeLog.96 \
@@ -714,13 +159,20 @@ EXTRA_DIST += \
old/ChangeLog.11 \
old/TODO
-## ---------------------------------------- ##
-## Maintainer-specific files and scripts. ##
-## ---------------------------------------- ##
-
+# Maintainer-specific files and scripts.
EXTRA_DIST += \
maintainer/am-ft \
maintainer/am-xft \
maintainer/rename-tests \
maintainer/maint.mk \
maintainer/syntax-checks.mk
+
+# Most work delegated to sub-dir makefile fragments.
+include $(srcdir)/doc/Makefile.inc
+include $(srcdir)/lib/Makefile.inc
+include $(srcdir)/lib/Automake/Makefile.inc
+include $(srcdir)/lib/am/Makefile.inc
+include $(srcdir)/m4/Makefile.inc
+include $(srcdir)/t/Makefile.inc
+
+# vim: ft=automake noet
diff --git a/contrib/t/Makefile.inc b/contrib/t/Makefile.inc
new file mode 100644
index 000000000..a92b80d96
--- /dev/null
+++ b/contrib/t/Makefile.inc
@@ -0,0 +1,26 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## -------------------------------- ##
+## Tests for stuff in 'contrib/'. ##
+## -------------------------------- ##
+
+contrib_TESTS = \
+ %D%/parallel-tests-html.sh \
+ %D%/parallel-tests-html-recursive.sh \
+ %D%/help-multilib.sh \
+ %D%/multilib.sh
diff --git a/contrib/t/local.am b/contrib/t/local.am
deleted file mode 100644
index f44df9c4e..000000000
--- a/contrib/t/local.am
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 1995-2013 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 2, 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 .
-
-# Automake: tests for stuff in 'contrib/'.
-
-## Relative to the top-level directory.
-contrib_testsuite_dir = contrib/t
-
-contrib_TESTS = \
- $(contrib_testsuite_dir)/parallel-tests-html.sh \
- $(contrib_testsuite_dir)/parallel-tests-html-recursive.sh \
- $(contrib_testsuite_dir)/help-multilib.sh \
- $(contrib_testsuite_dir)/multilib.sh
diff --git a/doc/Makefile.inc b/doc/Makefile.inc
new file mode 100644
index 000000000..8515a5d5a
--- /dev/null
+++ b/doc/Makefile.inc
@@ -0,0 +1,116 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## ---------------- ##
+## Documentation. ##
+## ---------------- ##
+
+info_TEXINFOS = %D%/automake.texi %D%/automake-history.texi
+doc_automake_TEXINFOS = %D%/fdl.texi
+doc_automake_history_TEXINFOS = %D%/fdl.texi
+
+man1_MANS = \
+ %D%/aclocal.1 \
+ %D%/automake.1 \
+ %D%/aclocal-$(APIVERSION).1 \
+ %D%/automake-$(APIVERSION).1
+
+$(man1_MANS): $(top_srcdir)/configure.ac
+
+CLEANFILES += $(man1_MANS)
+EXTRA_DIST += %D%/help2man
+
+update_mans = \
+ $(AM_V_GEN): \
+ && $(MKDIR_P) %D% \
+ && $(extend_PATH) \
+ && $(PERL) $(srcdir)/%D%/help2man --output=$@
+
+%D%/aclocal.1 %D%/automake.1:
+ $(AM_V_GEN): \
+ && $(MKDIR_P) %D% \
+ && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
+ && echo ".so man1/$$f-$(APIVERSION).1" > $@
+
+%D%/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm
+ $(update_mans) aclocal-$(APIVERSION)
+%D%/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm
+ $(update_mans) automake-$(APIVERSION)
+
+## ---------------------------- ##
+## Example package "amhello". ##
+## ---------------------------- ##
+
+amhello_sources = \
+ %D%/amhello/configure.ac \
+ %D%/amhello/Makefile.am \
+ %D%/amhello/README \
+ %D%/amhello/src/main.c \
+ %D%/amhello/src/Makefile.am
+
+amhello_configury = \
+ aclocal.m4 \
+ autom4te.cache \
+ Makefile.in \
+ config.h.in \
+ configure \
+ depcomp \
+ install-sh \
+ missing \
+ src/Makefile.in
+
+dist_noinst_DATA += $(amhello_sources)
+dist_doc_DATA = $(srcdir)/%D%/amhello-1.0.tar.gz
+
+setup_autotools_paths = { \
+ $(extend_PATH) \
+ && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \
+ && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \
+ && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \
+ && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \
+ && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \
+ && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \
+ && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \
+ && true; \
+}
+
+# We depend on configure.ac so that we regenerate the tarball
+# whenever the Automake version changes.
+$(srcdir)/%D%/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac
+ $(AM_V_GEN)tmp=amhello-output.tmp \
+ && $(am__cd) $(srcdir)/%D%/amhello \
+ && : Make our aclocal and automake avaiable before system ones. \
+ && $(setup_autotools_paths) \
+ && ( \
+ { $(AM_V_P) || exec 5>&2 >$$tmp 2>&1; } \
+ && $(am_AUTORECONF) -vfi \
+ && ./configure \
+ && $(MAKE) $(AM_MAKEFLAGS) distcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) distclean \
+ || { \
+ if $(AM_V_P); then :; else \
+ echo "$@: recipe failed." >&5; \
+ echo "See file '`pwd`/$$tmp' for details" >&5; \
+ fi; \
+ exit 1; \
+ } \
+ ) \
+ && rm -rf $(amhello_configury) $$tmp \
+ && mv -f amhello-1.0.tar.gz ..
+
+
+# vim: ft=automake noet
diff --git a/lib/Automake/Makefile.inc b/lib/Automake/Makefile.inc
new file mode 100644
index 000000000..48b15231f
--- /dev/null
+++ b/lib/Automake/Makefile.inc
@@ -0,0 +1,57 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## ---------------------------------------------------- ##
+## Private perl modules used by automake and aclocal. ##
+## ---------------------------------------------------- ##
+
+perllibdir = $(pkgvdatadir)/Automake
+
+dist_perllib_DATA = \
+ %D%/ChannelDefs.pm \
+ %D%/Channels.pm \
+ %D%/Condition.pm \
+ %D%/Configure_ac.pm \
+ %D%/DisjConditions.pm \
+ %D%/FileUtils.pm \
+ %D%/General.pm \
+ %D%/Getopt.pm \
+ %D%/Item.pm \
+ %D%/ItemDef.pm \
+ %D%/Language.pm \
+ %D%/Location.pm \
+ %D%/Options.pm \
+ %D%/Rule.pm \
+ %D%/RuleDef.pm \
+ %D%/Variable.pm \
+ %D%/VarDef.pm \
+ %D%/Version.pm \
+ %D%/XFile.pm \
+ %D%/Wrap.pm
+
+nodist_perllib_DATA = %D%/Config.pm
+CLEANFILES += $(nodist_perllib_DATA)
+
+%D%/Config.pm: %D%/Config.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_at)$(MKDIR_P) %D%
+ $(AM_V_GEN)in=Config.in \
+ && $(do_subst) <$(srcdir)/%D%/Config.in >$@-t
+ $(generated_file_finalize)
+EXTRA_DIST += %D%/Config.in
+
+# vim: ft=automake noet
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
new file mode 100644
index 000000000..d1971f55f
--- /dev/null
+++ b/lib/Makefile.inc
@@ -0,0 +1,68 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## -------------------------------------------------------------------- ##
+## Auxiliary scripts and files for use with "automake --add-missing". ##
+## -------------------------------------------------------------------- ##
+
+dist_pkgvdata_DATA = \
+ %D%/COPYING \
+ %D%/INSTALL \
+ %D%/texinfo.tex
+
+# These must all be executable when installed. However, if we use
+# _SCRIPTS, then the program transform will be applied, which is not
+# what we want. So we make them executable by hand.
+dist_script_DATA = \
+ %D%/config.guess \
+ %D%/config.sub \
+ %D%/install-sh \
+ %D%/mdate-sh \
+ %D%/missing \
+ %D%/mkinstalldirs \
+ %D%/ylwrap \
+ %D%/depcomp \
+ %D%/compile \
+ %D%/py-compile \
+ %D%/ar-lib \
+ %D%/test-driver \
+ %D%/tap-driver.sh \
+ %D%/tap-driver.pl
+
+install-data-hook:
+ @$(POST_INSTALL)
+ @for f in $(dist_script_DATA); do echo $$f; done \
+ | sed 's,^%D%/,,' \
+ | ( st=0; \
+ while read f; do \
+ echo " chmod +x '$(DESTDIR)$(scriptdir)/$$f'"; \
+ chmod +x "$(DESTDIR)$(scriptdir)/$$f" || st=1; \
+ done; \
+ exit $$st )
+
+installcheck-local: installcheck-executable-scripts
+installcheck-executable-scripts:
+ @for f in $(dist_script_DATA); do echo $$f; done \
+ | sed 's,^%D%/,,' \
+ | while read f; do \
+ path="$(pkgvdatadir)/$$f"; \
+ test -x "$$path" || echo $$path; \
+ done \
+ | sed 's/$$/: not executable/' \
+ | grep . 1>&2 && exit 1; exit 0
+
+# vim: ft=automake noet
diff --git a/lib/am/Makefile.inc b/lib/am/Makefile.inc
new file mode 100644
index 000000000..da9468284
--- /dev/null
+++ b/lib/am/Makefile.inc
@@ -0,0 +1,65 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## --------------------- ##
+## Makefile fragments. ##
+## --------------------- ##
+
+amdir = @amdir@
+
+dist_am_DATA = \
+ %D%/check.am \
+ %D%/check2.am \
+ %D%/clean-hdr.am \
+ %D%/clean.am \
+ %D%/compile.am \
+ %D%/configure.am \
+ %D%/data.am \
+ %D%/dejagnu.am \
+ %D%/depend.am \
+ %D%/depend2.am \
+ %D%/distdir.am \
+ %D%/footer.am \
+ %D%/header-vars.am \
+ %D%/header.am \
+ %D%/install.am \
+ %D%/inst-vars.am \
+ %D%/java.am \
+ %D%/lang-compile.am \
+ %D%/lex.am \
+ %D%/library.am \
+ %D%/libs.am \
+ %D%/libtool.am \
+ %D%/lisp.am \
+ %D%/ltlib.am \
+ %D%/ltlibrary.am \
+ %D%/mans-vars.am \
+ %D%/mans.am \
+ %D%/program.am \
+ %D%/progs.am \
+ %D%/python.am \
+ %D%/remake-hdr.am \
+ %D%/scripts.am \
+ %D%/subdirs.am \
+ %D%/tags.am \
+ %D%/texi-vers.am \
+ %D%/texibuild.am \
+ %D%/texinfos.am \
+ %D%/vala.am \
+ %D%/yacc.am
+
+# vim: ft=automake noet
diff --git a/m4/Makefile.inc b/m4/Makefile.inc
new file mode 100644
index 000000000..11874e731
--- /dev/null
+++ b/m4/Makefile.inc
@@ -0,0 +1,79 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## ------------------------------ ##
+## Automake-provided m4 macros. ##
+## ------------------------------ ##
+
+system_acdir = @system_acdir@
+automake_acdir = @automake_acdir@
+
+dist_automake_ac_DATA = \
+ %D%/amversion.m4 \
+ %D%/ar-lib.m4 \
+ %D%/as.m4 \
+ %D%/auxdir.m4 \
+ %D%/cond.m4 \
+ %D%/cond-if.m4 \
+ %D%/depend.m4 \
+ %D%/depout.m4 \
+ %D%/dmalloc.m4 \
+ %D%/extra-recurs.m4 \
+ %D%/gcj.m4 \
+ %D%/init.m4 \
+ %D%/install-sh.m4 \
+ %D%/lead-dot.m4 \
+ %D%/lex.m4 \
+ %D%/lispdir.m4 \
+ %D%/maintainer.m4 \
+ %D%/make.m4 \
+ %D%/minuso.m4 \
+ %D%/missing.m4 \
+ %D%/mkdirp.m4 \
+ %D%/obsolete.m4 \
+ %D%/options.m4 \
+ %D%/python.m4 \
+ %D%/runlog.m4 \
+ %D%/sanity.m4 \
+ %D%/silent.m4 \
+ %D%/strip.m4 \
+ %D%/substnot.m4 \
+ %D%/tar.m4 \
+ %D%/upc.m4 \
+ %D%/vala.m4
+
+dist_system_ac_DATA = %D%/acdir/README
+
+automake_internal_acdir = $(automake_acdir)/internal
+dist_automake_internal_ac_DATA = %D%/internal/ac-config-macro-dirs.m4
+
+# We build amversion.m4 here, instead of from config.status,
+# because config.status is rerun each time one of configure's
+# dependencies change and amversion.m4 happens to be a configure
+# dependency. configure and amversion.m4 would be rebuilt in
+# loop otherwise.
+# Use '$(top_srcdir)' for the benefit of non-GNU makes: this is
+# how amversion.m4 appears in our dependencies.
+$(top_srcdir)/%D%/amversion.m4: $(srcdir)/configure.ac \
+ $(srcdir)/%D%/amversion.in
+ $(AM_V_at)rm -f $@-t $@
+ $(AM_V_GEN)in=amversion.in \
+ && $(do_subst) <$(srcdir)/%D%/amversion.in >$@-t
+ $(generated_file_finalize)
+EXTRA_DIST += %D%/amversion.in
+
+# vim: ft=automake noet
diff --git a/t/Makefile.inc b/t/Makefile.inc
new file mode 100644
index 000000000..18a57c2c2
--- /dev/null
+++ b/t/Makefile.inc
@@ -0,0 +1,274 @@
+## Included by top-level Makefile for Automake.
+
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## ------------ ##
+## Testsuite. ##
+## ------------ ##
+
+# Run the tests with a proper shell detected at configure time.
+LOG_COMPILER = $(AM_TEST_RUNNER_SHELL)
+
+TEST_EXTENSIONS = .pl .sh .tap
+SH_LOG_COMPILER = $(LOG_COMPILER)
+TAP_LOG_COMPILER = $(LOG_COMPILER)
+PL_LOG_COMPILER = $(PERL)
+AM_PL_LOG_FLAGS = -Mstrict -I $(builddir)/lib -I $(srcdir)/lib -w
+
+TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
+
+AM_TAP_LOG_DRIVER_FLAGS = --merge
+
+EXTRA_DIST += %D%/README %D%/ax/is %D%/ax/is_newest
+
+## Will be updated later.
+TESTS =
+
+# Some testsuite-influential variables should be overridable from the
+# test scripts, but not from the environment.
+# Keep this in sync with the similar list in ax/runtest.in.
+AM_TESTS_ENVIRONMENT = \
+ for v in \
+ required \
+ am_test_protocol \
+ am_serial_tests \
+ am_test_prefer_config_shell \
+ am_original_AUTOMAKE \
+ am_original_ACLOCAL \
+ am_test_lib_sourced \
+ test_lib_sourced \
+ ; do \
+ eval test x"\$${$$v}" = x || unset $$v; \
+ done;
+# We want warning messages and explanations for skipped tests to go to
+# the console if possible, so set up 'stderr_fileno_' properly.
+AM_TESTS_FD_REDIRECT = 9>&2
+AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
+
+# For sourcing of extra "shell libraries" by our test scripts. As per
+# POSIX, sourcing a file with '.' will cause it to be looked up in $PATH
+# in case it is given with a relative name containing no slashes.
+AM_TESTS_ENVIRONMENT += \
+ if test $(srcdir) != .; then \
+ PATH='$(abs_srcdir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \
+ fi; \
+ PATH='$(abs_builddir)/%D%/ax'$(PATH_SEPARATOR)$$PATH; \
+ export PATH;
+
+# Hand-written tests.
+
+include $(srcdir)/%D%/list-of-tests.mk
+
+TESTS += $(handwritten_TESTS)
+EXTRA_DIST += $(handwritten_TESTS)
+
+# Automatically-generated tests wrapping hand-written ones.
+# Also, automatically-computed dependencies for tests.
+
+include $(srcdir)/%D%/testsuite-part.am
+
+TESTS += $(generated_TESTS)
+EXTRA_DIST += $(generated_TESTS)
+
+$(srcdir)/%D%/testsuite-part.am:
+ $(AM_V_at)rm -f %D%/testsuite-part.tmp $@
+ $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
+ --srcdir $(srcdir) > %D%/testsuite-part.tmp
+ $(AM_V_at)chmod a-w %D%/testsuite-part.tmp
+ $(AM_V_at)mv -f %D%/testsuite-part.tmp $@
+EXTRA_DIST += gen-testsuite-part
+
+# The dependecies declared here are not truly complete, but such
+# completeness would cause more issues than it would solve. See
+# automake bug#11347.
+$(generated_TESTS): $(srcdir)/gen-testsuite-part
+$(srcdir)/%D%/testsuite-part.am: $(srcdir)/gen-testsuite-part
+$(srcdir)/%D%/testsuite-part.am: Makefile.am
+
+# Hand-written tests for stuff in 'contrib/'.
+include $(srcdir)/contrib/%D%/Makefile.inc
+TESTS += $(contrib_TESTS)
+EXTRA_DIST += $(contrib_TESTS)
+
+# Static dependencies valid for each test case (also further
+# extended later). Note that use 'noinst_' rather than 'check_'
+# as the prefix, because we really want them to be built by
+# "make all". This makes it easier to run the test cases by
+# hand after having simply configured and built the package.
+
+nodist_noinst_SCRIPTS += \
+ %D%/wrap/aclocal-$(APIVERSION) \
+ %D%/wrap/automake-$(APIVERSION)
+
+dist_noinst_DATA += \
+ %D%/ax/test-init.sh \
+ %D%/ax/test-lib.sh \
+ %D%/ax/am-test-lib.sh \
+ %D%/ax/tap-functions.sh
+
+# Few more static dependencies.
+%D%/distcheck-missing-m4.log: %D%/ax/distcheck-hook-m4.am
+%D%/distcheck-outdated-m4.log: %D%/ax/distcheck-hook-m4.am
+EXTRA_DIST += %D%/ax/distcheck-hook-m4.am
+
+%D%/ax/test-defs.sh: %D%/ax/test-defs.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_at)$(MKDIR_P) %D%/ax
+ $(AM_V_GEN)in=%D%/ax/test-defs.in \
+ && $(do_subst) <$(srcdir)/$$in >$@-t
+ $(generated_file_finalize)
+EXTRA_DIST += %D%/ax/test-defs.in
+CLEANFILES += %D%/ax/test-defs.sh
+nodist_noinst_DATA += %D%/ax/test-defs.sh
+
+%D%/ax/shell-no-trail-bslash: %D%/ax/shell-no-trail-bslash.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_GEN)in=%D%/ax/shell-no-trail-bslash.in \
+ && $(MKDIR_P) %D%/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
+ $(generated_file_finalize)
+EXTRA_DIST += %D%/ax/shell-no-trail-bslash.in
+CLEANFILES += %D%/ax/shell-no-trail-bslash
+nodist_noinst_SCRIPTS += %D%/ax/shell-no-trail-bslash
+
+%D%/ax/cc-no-c-o: %D%/ax/cc-no-c-o.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_GEN)in=%D%/ax/cc-no-c-o.in \
+ && $(MKDIR_P) %D%/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
+ $(generated_file_finalize)
+EXTRA_DIST += %D%/ax/cc-no-c-o.in
+CLEANFILES += %D%/ax/cc-no-c-o
+nodist_noinst_SCRIPTS += %D%/ax/cc-no-c-o
+
+runtest: %D%/ax/runtest.in Makefile
+ $(AM_V_at)rm -f $@ $@-t
+ $(AM_V_GEN)in=%D%/ax/runtest.in \
+ && $(MKDIR_P) %D%/ax \
+ && $(do_subst) <$(srcdir)/$$in >$@-t \
+ && chmod a+x $@-t
+ $(generated_file_finalize)
+EXTRA_DIST += %D%/ax/runtest.in
+CLEANFILES += runtest
+nodist_noinst_SCRIPTS += runtest
+
+# If two test scripts have the same basename, they will end up sharing
+# the same log file, leading to all sort of undefined and undesired
+# behaviours.
+check-no-repeated-test-name:
+ @LC_ALL=C; export LC_ALL; \
+ lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
+ | sort | uniq -c | awk '($$1 > 1) { print }' \
+ | sed 's/\.log$$//' | grep . >&2 \
+ && { \
+ echo $@: test names listed above are duplicated >&2; \
+ exit 1; \
+ }; :
+check-local: check-no-repeated-test-name
+.PHONY: check-no-repeated-test-name
+
+# Check that our test cases are syntactically correct.
+# See automake bug#11898.
+check-tests-syntax:
+ @st=0; \
+ err () { echo "$@: $$*" >&2; st=1; }; \
+## The user might do something like "make check TESTS=t/foo" or
+## "make check TESTS_LOGS=t/foo.log" and expect (say) the test
+## 't/foo.sh' to be run; this has worked well until today, and
+## we want to continue supporting this use case.
+ bases=`for log in : $(TEST_LOGS); do echo $$log; done \
+ | sed -e '/^:$$/d' -e 's/\.log$$//'`; \
+ for bas in $$bases; do \
+ for suf in sh tap pl; do \
+ tst=$$bas.$$suf; \
+## Emulate VPATH search.
+ if test -f $$tst; then \
+ break; \
+ elif test -f $(srcdir)/$$tst; then \
+ tst=$(srcdir)/$$tst; \
+ break; \
+ else \
+ tst=''; \
+ fi; \
+ done; \
+ test -n "$$tst" || err "couldn't find test '$$bas'"; \
+## Don't check that perl tests are valid shell scripts!
+ test $$suf = pl && continue; \
+ $(AM_V_P) && echo " $(AM_TEST_RUNNER_SHELL) -n $$tst"; \
+ $(AM_TEST_RUNNER_SHELL) -n "$$tst" \
+ || err "test '$$tst' syntactically invalid"; \
+ done; \
+ exit $$st
+check-local: check-tests-syntax
+.PHONY: check-tests-syntax
+
+# Recipes with a trailing backslash character (possibly followed by
+# blank characters only) can cause spurious syntax errors with at
+# least older bash versions (e.g., bash 2.05b), and can be potentially
+# be unportable to other weaker shells. Run the testsuite in a way
+# that helps catching such problems in Automake-generated recipes.
+# See automake bug#10436.
+check-no-trailing-backslash-in-recipes:
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ CONFIG_SHELL='$(abs_top_builddir)/%D%/ax/shell-no-trail-bslash'
+.PHONY: check-no-trailing-backslash-in-recipes
+
+# Some compilers out there (hello, MSVC) still choke on "-c -o" being
+# passed together on the command line. Run the whole testsuite faking
+# the presence of such a compiler, to help catch regressions that would
+# otherwise only present themselves later "in the wild". See also the
+# long discussion about automake bug#13378.
+check-cc-no-c-o:
+ $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ CC='$(abs_top_builddir)/%D%/ax/cc-no-c-o' \
+ GNU_CC='$(abs_top_builddir)/%D%/ax/cc-no-c-o'
+.PHONY: check-cc-no-c-o
+
+## Checking the list of tests.
+test_subdirs = %D% %D%/pm contrib/%D%
+include %D%/CheckListOfTests.am
+
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local: installcheck-testsuite
+installcheck-testsuite:
+ am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
+# Performance tests.
+.PHONY: perf
+perf: all
+ $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
+ TESTS='$(perf_TESTS)' check
+PERF_TEST_SUITE_LOG = %D%/perf/test-suite.log
+CLEANFILES += $(PERF_TEST_SUITE_LOG)
+EXTRA_DIST += $(perf_TESTS)
+
+clean-local: clean-local-check
+.PHONY: clean-local-check
+clean-local-check:
+## Directories candidate to be test directories match this wildcard.
+ @globs='%D%/*.dir %D%/*/*.dir */%D%/*.dir */%D%/*/*.dir'; \
+## The 'nullglob' bash option is not portable, so use perl.
+ dirs=`$(PERL) -e "print join(' ', glob('$$globs'));"` || exit 1; \
+ if test -n "$$dirs"; then \
+## Errors in find are acceptable, errors in rm are not.
+ find $$dirs -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
+ echo " rm -rf $$dirs"; \
+ rm -rf $$dirs || exit 1; \
+ fi
+
+# vim: ft=automake noet
--
cgit v1.2.1
From ce70cf4b95a486f712fab0af865f6c005139fafe Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 9 May 2013 11:57:20 +0200
Subject: build: move automake and aclocal in 'bin' subdir
* automake.in: Rename ...
* bin/automake.in: ... like this.
* aclocal.in: Rename ...
* bin/aclocal.in: ... like this.
* Makefile.am: Move parts that dealt with the building/distribution
of aclocal and Automake ..
* bin/Makefile.inc): ... in this new included fragment. Adjust as
needed, and make deliberate use of the '%D%' substitution.
* lib/gen-perl-protos: Move ...
* bin/gen-perl-protos: ... here.
* bootstrap.sh, configure.ac, maintainer/rename-tests,
t/wrap/aclocal.in, t/wrap/automake.in, doc/Makefile.inc,
t/ax/tap-setup.sh, .gitignore: Adjust.
* maintainer/syntax-checks.mk: Likewise, and enhance a little.
Signed-off-by: Stefano Lattarini
---
.gitignore | 4 +-
Makefile.am | 58 +-
aclocal.in | 1214 -------
automake.in | 8251 -------------------------------------------
bin/Makefile.inc | 70 +
bin/aclocal.in | 1214 +++++++
bin/automake.in | 8251 +++++++++++++++++++++++++++++++++++++++++++
bin/gen-perl-protos | 36 +
bootstrap.sh | 12 +-
configure.ac | 2 +-
doc/Makefile.inc | 4 +-
lib/gen-perl-protos | 36 -
maintainer/rename-tests | 2 +-
maintainer/syntax-checks.mk | 34 +-
t/ax/tap-setup.sh | 2 +-
t/wrap/aclocal.in | 2 +-
t/wrap/automake.in | 2 +-
17 files changed, 9612 insertions(+), 9582 deletions(-)
delete mode 100644 aclocal.in
delete mode 100644 automake.in
create mode 100644 bin/Makefile.inc
create mode 100644 bin/aclocal.in
create mode 100644 bin/automake.in
create mode 100755 bin/gen-perl-protos
delete mode 100755 lib/gen-perl-protos
diff --git a/.gitignore b/.gitignore
index 4b509d70e..f13fd2101 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,8 +10,8 @@
/config.status
/config.status.lineno
/configure.lineno
-/aclocal
-/automake
+/bin/aclocal
+/bin/automake
/runtest
/doc/.dirstamp
/doc/automake*.info
diff --git a/Makefile.am b/Makefile.am
index c49d1e9e2..143308a11 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,6 +32,12 @@ nodist_noinst_SCRIPTS =
## Top level. ##
## ------------ ##
+EXTRA_DIST += \
+ bootstrap.sh \
+ GNUmakefile \
+ HACKING \
+ PLANS
+
# We want a handful of substitutions to be fully-expanded by make;
# then use config.status to substitute the remainder where a single
# expansion is sufficient. We use a funny notation here to avoid
@@ -63,62 +69,11 @@ generated_file_finalize = $(AM_V_at) \
fi; \
chmod a-w $@-t && mv -f $@-t $@
-bin_SCRIPTS = automake aclocal
-
-CLEANFILES += $(bin_SCRIPTS)
-AUTOMAKESOURCES = automake.in aclocal.in
-
-TAGS_FILES += $(AUTOMAKESOURCES)
-
-EXTRA_DIST += \
- $(AUTOMAKESOURCES) \
- bootstrap.sh \
- GNUmakefile \
- HACKING \
- PLANS
-
# For some tests or targets, we need to have the just-build automake and
# aclocal scripts avaiable on PATH.
extend_PATH = \
{ PATH='$(abs_builddir)/t/wrap'$(PATH_SEPARATOR)$$PATH && export PATH; }
-# Make versioned links. We only run the transform on the root name;
-# then we make a versioned link with the transformed base name. This
-# seemed like the most reasonable approach.
-install-exec-hook:
- @$(POST_INSTALL)
- @for p in $(bin_SCRIPTS); do \
- f=`echo $$p | sed '$(transform)'`; \
- fv="$$f-$(APIVERSION)"; \
- rm -f "$(DESTDIR)$(bindir)/$$fv"; \
- echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
- $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
- done
-
-uninstall-hook:
- @for p in $(bin_SCRIPTS); do \
- f=`echo $$p | sed '$(transform)'`; \
- fv="$$f-$(APIVERSION)"; \
- rm -f "$(DESTDIR)$(bindir)/$$fv"; \
- done
-
-# These files depend on Makefile so they are rebuilt if $(VERSION),
-# $(datadir) or other do_subst'ituted variables change.
-automake: automake.in
-aclocal: aclocal.in
-automake aclocal: Makefile lib/gen-perl-protos
- $(AM_V_GEN)rm -f $@ $@-t $@-t2 \
-## Common substitutions.
- && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
-## Auto-compute prototypes of perl subroutines.
- && $(PERL) -w $(srcdir)/lib/gen-perl-protos $@-t > $@-t2 \
- && mv -f $@-t2 $@-t \
-## We can't use '$(generated_file_finalize)' here, because currently
-## Automake contains occurrences of unexpanded @substitutions@ in
-## comments, and that is perfectly legit.
- && chmod a+x,a-w $@-t && mv -f $@-t $@
-EXTRA_DIST += lib/gen-perl-protos
-
# The master location for INSTALL is lib/INSTALL.
# This is where "make fetch" will install new versions.
# Make sure we also update this copy.
@@ -168,6 +123,7 @@ EXTRA_DIST += \
maintainer/syntax-checks.mk
# Most work delegated to sub-dir makefile fragments.
+include $(srcdir)/bin/Makefile.inc
include $(srcdir)/doc/Makefile.inc
include $(srcdir)/lib/Makefile.inc
include $(srcdir)/lib/Automake/Makefile.inc
diff --git a/aclocal.in b/aclocal.in
deleted file mode 100644
index ba3047905..000000000
--- a/aclocal.in
+++ /dev/null
@@ -1,1214 +0,0 @@
-#!@PERL@ -w
-# -*- perl -*-
-# @configure_input@
-
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
- if 0;
-
-# aclocal - create aclocal.m4 by scanning configure.ac
-
-# Copyright (C) 1996-2013 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 2, 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 .
-
-# Written by Tom Tromey , and
-# Alexandre Duret-Lutz .
-
-BEGIN
-{
- @Aclocal::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@')
- unless @Aclocal::perl_libdirs;
- unshift @INC, @Aclocal::perl_libdirs;
-}
-
-use strict;
-
-use Automake::Config;
-use Automake::General;
-use Automake::Configure_ac;
-use Automake::Channels;
-use Automake::ChannelDefs;
-use Automake::XFile;
-use Automake::FileUtils;
-use File::Basename;
-use File::Path ();
-
-# Some globals.
-
-# Support AC_CONFIG_MACRO_DIRS also with older autoconf.
-# FIXME: To be removed in Automake 2.0, once we can assume autoconf
-# 2.70 or later.
-# FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'.
-my $ac_config_macro_dirs_fallback =
- 'm4_ifndef([AC_CONFIG_MACRO_DIRS], [' .
- 'm4_defun([_AM_CONFIG_MACRO_DIRS], [])' .
- 'm4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])' .
- '])';
-
-# We do not operate in threaded mode.
-$perl_threads = 0;
-
-# Include paths for searching macros. We search macros in this order:
-# user-supplied directories first, then the directory containing the
-# automake macros, and finally the system-wide directories for
-# third-party macros.
-# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS.
-# @automake_includes can be reset with the '--automake-acdir' option.
-# @system_includes can be augmented with the 'dirlist' file or the
-# ACLOCAL_PATH environment variable, and reset with the '--system-acdir'
-# option.
-my @user_includes = ();
-my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
-my @system_includes = ('@datadir@/aclocal');
-
-# Whether we should copy M4 file in $user_includes[0].
-my $install = 0;
-
-# --diff
-my @diff_command;
-
-# --dry-run
-my $dry_run = 0;
-
-# configure.ac or configure.in.
-my $configure_ac;
-
-# Output file name.
-my $output_file = 'aclocal.m4';
-
-# Option --force.
-my $force_output = 0;
-
-# Modification time of the youngest dependency.
-my $greatest_mtime = 0;
-
-# Which macros have been seen.
-my %macro_seen = ();
-
-# Remember the order into which we scanned the files.
-# It's important to output the contents of aclocal.m4 in the opposite order.
-# (Definitions in first files we have scanned should override those from
-# later files. So they must appear last in the output.)
-my @file_order = ();
-
-# Map macro names to file names.
-my %map = ();
-
-# Ditto, but records the last definition of each macro as returned by --trace.
-my %map_traced_defs = ();
-
-# Map basenames to macro names.
-my %invmap = ();
-
-# Map file names to file contents.
-my %file_contents = ();
-
-# Map file names to file types.
-my %file_type = ();
-use constant FT_USER => 1;
-use constant FT_AUTOMAKE => 2;
-use constant FT_SYSTEM => 3;
-
-# Map file names to included files (transitively closed).
-my %file_includes = ();
-
-# Files which have already been added.
-my %file_added = ();
-
-# Files that have already been scanned.
-my %scanned_configure_dep = ();
-
-# Serial numbers, for files that have one.
-# The key is the basename of the file,
-# the value is the serial number represented as a list.
-my %serial = ();
-
-# Matches a macro definition.
-# AC_DEFUN([macroname], ...)
-# or
-# AC_DEFUN(macroname, ...)
-# When macroname is '['-quoted , we accept any character in the name,
-# except ']'. Otherwise macroname stops on the first ']', ',', ')',
-# or '\n' encountered.
-my $ac_defun_rx =
- "(?:AU_ALIAS|A[CU]_DEFUN|AC_DEFUN_ONCE)\\((?:\\[([^]]+)\\]|([^],)\n]+))";
-
-# Matches an AC_REQUIRE line.
-my $ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
-
-# Matches an m4_include line.
-my $m4_include_rx = "(m4_|m4_s|s)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
-
-# Match a serial number.
-my $serial_line_rx = '^#\s*serial\s+(\S*)';
-my $serial_number_rx = '^\d+(?:\.\d+)*$';
-
-# Autoconf version. This variable is set by 'trace_used_macros'.
-my $ac_version;
-
-# User directory containing extra m4 files for macros definition,
-# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS.
-# This variable is updated by 'trace_used_macros'.
-my @ac_config_macro_dirs;
-
-# If set, names a temporary file that must be erased on abnormal exit.
-my $erase_me;
-
-# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function.
-use constant SCAN_M4_DIRS_SILENT => 0;
-use constant SCAN_M4_DIRS_WARN => 1;
-use constant SCAN_M4_DIRS_ERROR => 2;
-
-################################################################
-
-# Prototypes for all subroutines.
-
-#! Prototypes here will automatically be generated by the build system.
-
-################################################################
-
-# Erase temporary file ERASE_ME. Handle signals.
-sub unlink_tmp (;$)
-{
- my ($sig) = @_;
-
- if ($sig)
- {
- verb "caught SIG$sig, bailing out";
- }
- if (defined $erase_me && -e $erase_me && !unlink ($erase_me))
- {
- fatal "could not remove '$erase_me': $!";
- }
- undef $erase_me;
-
- # reraise default handler.
- if ($sig)
- {
- $SIG{$sig} = 'DEFAULT';
- kill $sig => $$;
- }
-}
-
-$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp';
-END { unlink_tmp }
-
-sub xmkdir_p ($)
-{
- my $dir = shift;
- local $@ = undef;
- return
- if -d $dir or eval { File::Path::mkpath $dir };
- chomp $@;
- $@ =~ s/\s+at\s.*\bline\s\d+.*$//;
- fatal "could not create directory '$dir': $@";
-}
-
-# Check macros in acinclude.m4. If one is not used, warn.
-sub check_acinclude ()
-{
- foreach my $key (keys %map)
- {
- # FIXME: should print line number of acinclude.m4.
- msg ('syntax', "macro '$key' defined in acinclude.m4 but never used")
- if $map{$key} eq 'acinclude.m4' && ! exists $macro_seen{$key};
- }
-}
-
-sub reset_maps ()
-{
- $greatest_mtime = 0;
- %macro_seen = ();
- @file_order = ();
- %map = ();
- %map_traced_defs = ();
- %file_contents = ();
- %file_type = ();
- %file_includes = ();
- %file_added = ();
- %scanned_configure_dep = ();
- %invmap = ();
- %serial = ();
- undef &search;
-}
-
-# install_file ($SRC, $DESTDIR)
-sub install_file ($$)
-{
- my ($src, $destdir) = @_;
- my $dest = $destdir . "/" . basename ($src);
- my $diff_dest;
-
- verb "installing $src to $dest";
-
- if ($force_output
- || !exists $file_contents{$dest}
- || $file_contents{$src} ne $file_contents{$dest})
- {
- if (-e $dest)
- {
- msg 'note', "overwriting '$dest' with '$src'";
- $diff_dest = $dest;
- }
- else
- {
- msg 'note', "installing '$dest' from '$src'";
- }
-
- if (@diff_command)
- {
- if (! defined $diff_dest)
- {
- # $dest does not exist. We create an empty one just to
- # run diff, and we erase it afterward. Using the real
- # the destination file (rather than a temporary file) is
- # good when diff is run with options that display the
- # file name.
- #
- # If creating $dest fails, fall back to /dev/null. At
- # least one diff implementation (Tru64's) cannot deal
- # with /dev/null. However working around this is not
- # worth the trouble since nobody run aclocal on a
- # read-only tree anyway.
- $erase_me = $dest;
- my $f = new IO::File "> $dest";
- if (! defined $f)
- {
- undef $erase_me;
- $diff_dest = '/dev/null';
- }
- else
- {
- $diff_dest = $dest;
- $f->close;
- }
- }
- my @cmd = (@diff_command, $diff_dest, $src);
- $! = 0;
- verb "running: @cmd";
- my $res = system (@cmd);
- Automake::FileUtils::handle_exec_errors "@cmd", 1
- if $res;
- unlink_tmp;
- }
- elsif (!$dry_run)
- {
- xmkdir_p ($destdir);
- xsystem ('cp', $src, $dest);
- }
- }
-}
-
-# Compare two lists of numbers.
-sub list_compare (\@\@)
-{
- my @l = @{$_[0]};
- my @r = @{$_[1]};
- while (1)
- {
- if (0 == @l)
- {
- return (0 == @r) ? 0 : -1;
- }
- elsif (0 == @r)
- {
- return 1;
- }
- elsif ($l[0] < $r[0])
- {
- return -1;
- }
- elsif ($l[0] > $r[0])
- {
- return 1;
- }
- shift @l;
- shift @r;
- }
-}
-
-################################################################
-
-# scan_m4_dirs($TYPE, $ERR_LEVEL, @DIRS)
-# -----------------------------------------------
-# Scan all M4 files installed in @DIRS for new macro definitions.
-# Register each file as of type $TYPE (one of the FT_* constants).
-# If a directory in @DIRS cannot be read:
-# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR
-# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA
-# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT
-sub scan_m4_dirs ($$@)
-{
- my ($type, $err_level, @dirlist) = @_;
-
- foreach my $m4dir (@dirlist)
- {
- if (! opendir (DIR, $m4dir))
- {
- # TODO: maybe avoid complaining only if errno == ENONENT?
- my $message = "couldn't open directory '$m4dir': $!";
-
- if ($err_level == SCAN_M4_DIRS_ERROR)
- {
- fatal $message;
- }
- elsif ($err_level == SCAN_M4_DIRS_WARN)
- {
- msg ('unsupported', $message);
- next;
- }
- elsif ($err_level == SCAN_M4_DIRS_SILENT)
- {
- next; # Silently ignore.
- }
- else
- {
- prog_error "invalid \$err_level value '$err_level'";
- }
- }
-
- # We reverse the directory contents so that foo2.m4 gets
- # used in preference to foo1.m4.
- foreach my $file (reverse sort grep (! /^\./, readdir (DIR)))
- {
- # Only examine .m4 files.
- next unless $file =~ /\.m4$/;
-
- # Skip some files when running out of srcdir.
- next if $file eq 'aclocal.m4';
-
- my $fullfile = File::Spec->canonpath ("$m4dir/$file");
- scan_file ($type, $fullfile, 'aclocal');
- }
- closedir (DIR);
- }
-}
-
-# Scan all the installed m4 files and construct a map.
-sub scan_m4_files ()
-{
- # First, scan configure.ac. It may contain macro definitions,
- # or may include other files that define macros.
- scan_file (FT_USER, $configure_ac, 'aclocal');
-
- # Then, scan acinclude.m4 if it exists.
- if (-f 'acinclude.m4')
- {
- scan_file (FT_USER, 'acinclude.m4', 'aclocal');
- }
-
- # Finally, scan all files in our search paths.
-
- if (@user_includes)
- {
- # Don't explore the same directory multiple times. This is here not
- # only for speedup purposes. We need this when the user has e.g.
- # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set
- # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac. This makes the 'm4'
- # directory to occur twice here and fail on the second call to
- # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist.
- # TODO: Shouldn't there be rather a check in scan_m4_dirs for
- # @user_includes[0]?
- @user_includes = uniq @user_includes;
-
- # Don't complain if the first user directory doesn't exist, in case
- # we need to create it later (can happen if '--install' was given).
- scan_m4_dirs (FT_USER,
- $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN,
- $user_includes[0]);
- scan_m4_dirs (FT_USER,
- SCAN_M4_DIRS_ERROR,
- @user_includes[1..$#user_includes]);
- }
- scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
- scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
-
- # Construct a new function that does the searching. We use a
- # function (instead of just evaluating $search in the loop) so that
- # "die" is correctly and easily propagated if run.
- my $search = "sub search {\nmy \$found = 0;\n";
- foreach my $key (reverse sort keys %map)
- {
- $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { add_macro ("' . $key
- . '"); $found = 1; }' . "\n");
- }
- $search .= "return \$found;\n};\n";
- eval $search;
- prog_error "$@\n search is $search" if $@;
-}
-
-################################################################
-
-# Add a macro to the output.
-sub add_macro ($)
-{
- my ($macro) = @_;
-
- # Ignore unknown required macros. Either they are not really
- # needed (e.g., a conditional AC_REQUIRE), in which case aclocal
- # should be quiet, or they are needed and Autoconf itself will
- # complain when we trace for macro usage later.
- return unless defined $map{$macro};
-
- verb "saw macro $macro";
- $macro_seen{$macro} = 1;
- add_file ($map{$macro});
-}
-
-# scan_configure_dep ($file)
-# --------------------------
-# Scan a configure dependency (configure.ac, or separate m4 files)
-# for uses of known macros and AC_REQUIREs of possibly unknown macros.
-# Recursively scan m4_included files.
-sub scan_configure_dep ($)
-{
- my ($file) = @_;
- # Do not scan a file twice.
- return ()
- if exists $scanned_configure_dep{$file};
- $scanned_configure_dep{$file} = 1;
-
- my $mtime = mtime $file;
- $greatest_mtime = $mtime if $greatest_mtime < $mtime;
-
- my $contents = exists $file_contents{$file} ?
- $file_contents{$file} : contents $file;
-
- my $line = 0;
- my @rlist = ();
- my @ilist = ();
- foreach (split ("\n", $contents))
- {
- ++$line;
- # Remove comments from current line.
- s/\bdnl\b.*$//;
- s/\#.*$//;
- # Avoid running all the following regexes on white lines.
- next if /^\s*$/;
-
- while (/$m4_include_rx/go)
- {
- my $ifile = $2 || $3;
- # Skip missing 'sinclude'd files.
- next if $1 ne 'm4_' && ! -f $ifile;
- push @ilist, $ifile;
- }
-
- while (/$ac_require_rx/go)
- {
- push (@rlist, $1 || $2);
- }
-
- # The search function is constructed dynamically by
- # scan_m4_files. The last parenthetical match makes sure we
- # don't match things that look like macro assignments or
- # AC_SUBSTs.
- if (! &search && /(^|\s+)(AM_[A-Z0-9_]+)($|[^\]\)=A-Z0-9_])/)
- {
- # Macro not found, but AM_ prefix found.
- # Make this just a warning, because we do not know whether
- # the macro is actually used (it could be called conditionally).
- msg ('unsupported', "$file:$line",
- "macro '$2' not found in library");
- }
- }
-
- add_macro ($_) foreach (@rlist);
- scan_configure_dep ($_) foreach @ilist;
-}
-
-# add_file ($FILE)
-# ----------------
-# Add $FILE to output.
-sub add_file ($)
-{
- my ($file) = @_;
-
- # Only add a file once.
- return if ($file_added{$file});
- $file_added{$file} = 1;
-
- scan_configure_dep $file;
-}
-
-# Point to the documentation for underquoted AC_DEFUN only once.
-my $underquoted_manual_once = 0;
-
-# scan_file ($TYPE, $FILE, $WHERE)
-# --------------------------------
-# Scan a single M4 file ($FILE), and all files it includes.
-# Return the list of included files.
-# $TYPE is one of FT_USER, FT_AUTOMAKE, or FT_SYSTEM, depending
-# on where the file comes from.
-# $WHERE is the location to use in the diagnostic if the file
-# does not exist.
-sub scan_file ($$$)
-{
- my ($type, $file, $where) = @_;
- my $basename = basename $file;
-
- # Do not scan the same file twice.
- return @{$file_includes{$file}} if exists $file_includes{$file};
- # Prevent potential infinite recursion (if two files include each other).
- return () if exists $file_contents{$file};
-
- unshift @file_order, $file;
-
- $file_type{$file} = $type;
-
- fatal "$where: file '$file' does not exist" if ! -e $file;
-
- my $fh = new Automake::XFile $file;
- my $contents = '';
- my @inc_files = ();
- my %inc_lines = ();
-
- my $defun_seen = 0;
- my $serial_seen = 0;
- my $serial_older = 0;
-
- while ($_ = $fh->getline)
- {
- # Ignore '##' lines.
- next if /^##/;
-
- $contents .= $_;
- my $line = $_;
-
- if ($line =~ /$serial_line_rx/go)
- {
- my $number = $1;
- if ($number !~ /$serial_number_rx/go)
- {
- msg ('syntax', "$file:$.",
- "ill-formed serial number '$number', "
- . "expecting a version string with only digits and dots");
- }
- elsif ($defun_seen)
- {
- # aclocal removes all definitions from M4 file with the
- # same basename if a greater serial number is found.
- # Encountering a serial after some macros will undefine
- # these macros...
- msg ('syntax', "$file:$.",
- 'the serial number must appear before any macro definition');
- }
- # We really care about serials only for non-automake macros
- # and when --install is used. But the above diagnostics are
- # made regardless of this, because not using --install is
- # not a reason not the fix macro files.
- elsif ($install && $type != FT_AUTOMAKE)
- {
- $serial_seen = 1;
- my @new = split (/\./, $number);
-
- verb "$file:$.: serial $number";
-
- if (!exists $serial{$basename}
- || list_compare (@new, @{$serial{$basename}}) > 0)
- {
- # Delete any definition we knew from the old macro.
- foreach my $def (@{$invmap{$basename}})
- {
- verb "$file:$.: ignoring previous definition of $def";
- delete $map{$def};
- }
- $invmap{$basename} = [];
- $serial{$basename} = \@new;
- }
- else
- {
- $serial_older = 1;
- }
- }
- }
-
- # Remove comments from current line.
- # Do not do it earlier, because the serial line is a comment.
- $line =~ s/\bdnl\b.*$//;
- $line =~ s/\#.*$//;
-
- while ($line =~ /$ac_defun_rx/go)
- {
- $defun_seen = 1;
- if (! defined $1)
- {
- msg ('syntax', "$file:$.", "underquoted definition of $2"
- . "\n run info Automake 'Extending aclocal'\n"
- . " or see http://www.gnu.org/software/automake/manual/"
- . "automake.html#Extending-aclocal")
- unless $underquoted_manual_once;
- $underquoted_manual_once = 1;
- }
-
- # If this macro does not have a serial and we have already
- # seen a macro with the same basename earlier, we should
- # ignore the macro (don't exit immediately so we can still
- # diagnose later #serial numbers and underquoted macros).
- $serial_older ||= ($type != FT_AUTOMAKE
- && !$serial_seen && exists $serial{$basename});
-
- my $macro = $1 || $2;
- if (!$serial_older && !defined $map{$macro})
- {
- verb "found macro $macro in $file: $.";
- $map{$macro} = $file;
- push @{$invmap{$basename}}, $macro;
- }
- else
- {
- # Note: we used to give an error here if we saw a
- # duplicated macro. However, this turns out to be
- # extremely unpopular. It causes actual problems which
- # are hard to work around, especially when you must
- # mix-and-match tool versions.
- verb "ignoring macro $macro in $file: $.";
- }
- }
-
- while ($line =~ /$m4_include_rx/go)
- {
- my $ifile = $2 || $3;
- # Skip missing 'sinclude'd files.
- next if $1 ne 'm4_' && ! -f $ifile;
- push (@inc_files, $ifile);
- $inc_lines{$ifile} = $.;
- }
- }
-
- # Ignore any file that has an old serial (or no serial if we know
- # another one with a serial).
- return ()
- if ($serial_older ||
- ($type != FT_AUTOMAKE && !$serial_seen && exists $serial{$basename}));
-
- $file_contents{$file} = $contents;
-
- # For some reason I don't understand, it does not work
- # to do "map { scan_file ($_, ...) } @inc_files" below.
- # With Perl 5.8.2 it undefines @inc_files.
- my @copy = @inc_files;
- my @all_inc_files = (@inc_files,
- map { scan_file ($type, $_,
- "$file:$inc_lines{$_}") } @copy);
- $file_includes{$file} = \@all_inc_files;
- return @all_inc_files;
-}
-
-# strip_redundant_includes (%FILES)
-# ---------------------------------
-# Each key in %FILES is a file that must be present in the output.
-# However some of these files might already include other files in %FILES,
-# so there is no point in including them another time.
-# This removes items of %FILES which are already included by another file.
-sub strip_redundant_includes (%)
-{
- my %files = @_;
-
- # Always include acinclude.m4, even if it does not appear to be used.
- $files{'acinclude.m4'} = 1 if -f 'acinclude.m4';
- # File included by $configure_ac are redundant.
- $files{$configure_ac} = 1;
-
- # Files at the end of @file_order should override those at the beginning,
- # so it is important to preserve these trailing files. We can remove
- # a file A if it is going to be output before a file B that includes
- # file A, not the converse.
- foreach my $file (reverse @file_order)
- {
- next unless exists $files{$file};
- foreach my $ifile (@{$file_includes{$file}})
- {
- next unless exists $files{$ifile};
- delete $files{$ifile};
- verb "$ifile is already included by $file";
- }
- }
-
- # configure.ac is implicitly included.
- delete $files{$configure_ac};
-
- return %files;
-}
-
-sub trace_used_macros ()
-{
- my %files = map { $map{$_} => 1 } keys %macro_seen;
- %files = strip_redundant_includes %files;
-
- # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings
- # from autom4te about macros being "m4_require'd but not m4_defun'd";
- # for more background, see:
- # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html
- # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal
- # to silence m4_require warnings".
- my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])";
-
- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@');
- $traces .= " --language Autoconf-without-aclocal-m4 ";
- $traces = "echo '$early_m4_code' | $traces - ";
-
- # Support AC_CONFIG_MACRO_DIRS also with older autoconf.
- # Note that we can't use '$ac_config_macro_dirs_fallback' here, because
- # a bug in option parsing code of autom4te 2.68 and earlier will cause
- # it to read standard input last, even if the "-" argument is specified
- # early.
- # FIXME: To be removed in Automake 2.0, once we can assume autoconf
- # 2.70 or later.
- $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 ";
-
- # All candidate files.
- $traces .= join (' ',
- (map { "'$_'" }
- (grep { exists $files{$_} } @file_order))) . " ";
-
- # All candidate macros.
- $traces .= join (' ',
- (map { "--trace='$_:\$f::\$n::\${::}%'" }
- ('AC_DEFUN',
- 'AC_DEFUN_ONCE',
- 'AU_DEFUN',
- '_AM_AUTOCONF_VERSION',
- 'AC_CONFIG_MACRO_DIR_TRACE',
- # FIXME: Tracing the next two macros is a hack for
- # compatibility with older autoconf. Remove this in
- # Automake 2.0, when we can assume Autoconf 2.70 or
- # later.
- 'AC_CONFIG_MACRO_DIR',
- '_AM_CONFIG_MACRO_DIRS')),
- # Do not trace $1 for all other macros as we do
- # not need it and it might contains harmful
- # characters (like newlines).
- (map { "--trace='$_:\$f::\$n'" } (keys %macro_seen)));
-
- verb "running $traces $configure_ac";
-
- my $tracefh = new Automake::XFile ("$traces $configure_ac |");
-
- @ac_config_macro_dirs = ();
-
- my %traced = ();
-
- while ($_ = $tracefh->getline)
- {
- chomp;
- my ($file, $macro, $arg1) = split (/::/);
-
- $traced{$macro} = 1 if exists $macro_seen{$macro};
-
- if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE'
- || $macro eq 'AU_DEFUN')
- {
- $map_traced_defs{$arg1} = $file;
- }
- elsif ($macro eq '_AM_AUTOCONF_VERSION')
- {
- $ac_version = $arg1;
- }
- elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE')
- {
- push @ac_config_macro_dirs, $arg1;
- }
- # FIXME: We still need to trace AC_CONFIG_MACRO_DIR
- # for compatibility with older autoconf. Remove this
- # once we can assume Autoconf 2.70 or later.
- elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
- {
- @ac_config_macro_dirs = ($arg1);
- }
- # FIXME:This is an hack for compatibility with older autoconf.
- # Remove this once we can assume Autoconf 2.70 or later.
- elsif ($macro eq '_AM_CONFIG_MACRO_DIRS')
- {
- # Empty leading/trailing fields might be produced by split,
- # hence the grep is really needed.
- push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1));
- }
- }
-
- # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls
- # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could
- # leave unwanted duplicates in @ac_config_macro_dirs.
- # Remove this in Automake 2.0, when we'll stop tracing
- # AC_CONFIG_MACRO_DIR explicitly.
- @ac_config_macro_dirs = uniq @ac_config_macro_dirs;
-
- $tracefh->close;
-
- return %traced;
-}
-
-sub scan_configure ()
-{
- # Make sure we include acinclude.m4 if it exists.
- if (-f 'acinclude.m4')
- {
- add_file ('acinclude.m4');
- }
- scan_configure_dep ($configure_ac);
-}
-
-################################################################
-
-# Write output.
-# Return 0 iff some files were installed locally.
-sub write_aclocal ($@)
-{
- my ($output_file, @macros) = @_;
- my $output = '';
-
- my %files = ();
- # Get the list of files containing definitions for the macros used.
- # (Filter out unused macro definitions with $map_traced_defs. This
- # can happen when an Autoconf macro is conditionally defined:
- # aclocal sees the potential definition, but this definition is
- # actually never processed and the Autoconf implementation is used
- # instead.)
- for my $m (@macros)
- {
- $files{$map{$m}} = 1
- if (exists $map_traced_defs{$m}
- && $map{$m} eq $map_traced_defs{$m});
- }
- # Do not explicitly include a file that is already indirectly included.
- %files = strip_redundant_includes %files;
-
- my $installed = 0;
-
- for my $file (grep { exists $files{$_} } @file_order)
- {
- # Check the time stamp of this file, and of all files it includes.
- for my $ifile ($file, @{$file_includes{$file}})
- {
- my $mtime = mtime $ifile;
- $greatest_mtime = $mtime if $greatest_mtime < $mtime;
- }
-
- # If the file to add looks like outside the project, copy it
- # to the output. The regex catches filenames starting with
- # things like '/', '\', or 'c:\'.
- if ($file_type{$file} != FT_USER
- || $file =~ m,^(?:\w:)?[\\/],)
- {
- if (!$install || $file_type{$file} != FT_SYSTEM)
- {
- # Copy the file into aclocal.m4.
- $output .= $file_contents{$file} . "\n";
- }
- else
- {
- # Install the file (and any file it includes).
- my $dest;
- for my $ifile (@{$file_includes{$file}}, $file)
- {
- install_file ($ifile, $user_includes[0]);
- }
- $installed = 1;
- }
- }
- else
- {
- # Otherwise, simply include the file.
- $output .= "m4_include([$file])\n";
- }
- }
-
- if ($installed)
- {
- verb "running aclocal anew, because some files were installed locally";
- return 0;
- }
-
- # Nothing to output?!
- # FIXME: Shouldn't we diagnose this?
- return 1 if ! length ($output);
-
- if ($ac_version)
- {
- # Do not use "$output_file" here for the same reason we do not
- # use it in the header below. autom4te will output the name of
- # the file in the diagnostic anyway.
- $output = "m4_ifndef([AC_AUTOCONF_VERSION],
- [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],,
-[m4_warning([this file was generated for autoconf $ac_version.
-You have another version of autoconf. It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically 'autoreconf'.])])
-
-$output";
- }
-
- # We used to print "# $output_file generated automatically etc." But
- # this creates spurious differences when using autoreconf. Autoreconf
- # creates aclocal.m4t and then rename it to aclocal.m4, but the
- # rebuild rules generated by Automake create aclocal.m4 directly --
- # this would gives two ways to get the same file, with a different
- # name in the header.
- $output = "# generated automatically by aclocal $VERSION -*- Autoconf -*-
-
-# Copyright (C) 1996-$RELEASE_YEAR Free Software Foundation, Inc.
-
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-$ac_config_macro_dirs_fallback
-$output";
-
- # We try not to update $output_file unless necessary, because
- # doing so invalidate Autom4te's cache and therefore slows down
- # tools called after aclocal.
- #
- # We need to overwrite $output_file in the following situations.
- # * The --force option is in use.
- # * One of the dependencies is younger.
- # (Not updating $output_file in this situation would cause
- # make to call aclocal in loop.)
- # * The contents of the current file are different from what
- # we have computed.
- if (!$force_output
- && $greatest_mtime < mtime ($output_file)
- && $output eq contents ($output_file))
- {
- verb "$output_file unchanged";
- return 1;
- }
-
- verb "writing $output_file";
-
- if (!$dry_run)
- {
- if (-e $output_file && !unlink $output_file)
- {
- fatal "could not remove '$output_file': $!";
- }
- my $out = new Automake::XFile "> $output_file";
- print $out $output;
- }
- return 1;
-}
-
-################################################################
-
-# Print usage and exit.
-sub usage ($)
-{
- my ($status) = @_;
-
- print <<'EOF';
-Usage: aclocal [OPTION]...
-
-Generate 'aclocal.m4' by scanning 'configure.ac' or 'configure.in'
-
-Options:
- --automake-acdir=DIR directory holding automake-provided m4 files
- --system-acdir=DIR directory holding third-party system-wide files
- --diff[=COMMAND] run COMMAND [diff -u] on M4 files that would be
- changed (implies --install and --dry-run)
- --dry-run pretend to, but do not actually update any file
- --force always update output file
- --help print this help, then exit
- -I DIR add directory to search list for .m4 files
- --install copy third-party files to the first -I directory
- --output=FILE put output in FILE (default aclocal.m4)
- --print-ac-dir print name of directory holding system-wide
- third-party m4 files, then exit
- --verbose don't be silent
- --version print version number, then exit
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY
-
-Warning categories include:
- syntax dubious syntactic constructs (default)
- unsupported unknown macros (default)
- all all the warnings (default)
- no-CATEGORY turn off warnings in CATEGORY
- none turn off all the warnings
- error treat warnings as errors
-
-Report bugs to <@PACKAGE_BUGREPORT@>.
-GNU Automake home page: <@PACKAGE_URL@>.
-General help using GNU software: .
-EOF
- exit $status;
-}
-
-# Print version and exit.
-sub version ()
-{
- print <
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-
-Written by Tom Tromey
- and Alexandre Duret-Lutz .
-EOF
- exit 0;
-}
-
-# Parse command line.
-sub parse_arguments ()
-{
- my $print_and_exit = 0;
- my $diff_command;
-
- my %cli_options =
- (
- 'help' => sub { usage(0); },
- 'version' => \&version,
- 'system-acdir=s' => sub { shift; @system_includes = @_; },
- 'automake-acdir=s' => sub { shift; @automake_includes = @_; },
- 'diff:s' => \$diff_command,
- 'dry-run' => \$dry_run,
- 'force' => \$force_output,
- 'I=s' => \@user_includes,
- 'install' => \$install,
- 'output=s' => \$output_file,
- 'print-ac-dir' => \$print_and_exit,
- 'verbose' => sub { setup_channel 'verb', silent => 0; },
- 'W|warnings=s' => \&parse_warnings,
- );
-
- use Automake::Getopt ();
- Automake::Getopt::parse_options %cli_options;
-
- if (@ARGV > 0)
- {
- fatal ("non-option arguments are not accepted: '$ARGV[0]'.\n"
- . "Try '$0 --help' for more information.");
- }
-
- if ($print_and_exit)
- {
- print "@system_includes\n";
- exit 0;
- }
-
- if (defined $diff_command)
- {
- $diff_command = 'diff -u' if $diff_command eq '';
- @diff_command = split (' ', $diff_command);
- $install = 1;
- $dry_run = 1;
- }
-
- # Finally, adds any directory listed in the 'dirlist' file.
- if (open (DIRLIST, "$system_includes[0]/dirlist"))
- {
- while ()
- {
- # Ignore '#' lines.
- next if /^#/;
- # strip off newlines and end-of-line comments
- s/\s*\#.*$//;
- chomp;
- foreach my $dir (glob)
- {
- push (@system_includes, $dir) if -d $dir;
- }
- }
- close (DIRLIST);
- }
-}
-
-# Add any directory listed in the 'ACLOCAL_PATH' environment variable
-# to the list of system include directories.
-sub parse_ACLOCAL_PATH ()
-{
- return if not defined $ENV{"ACLOCAL_PATH"};
- # Directories in ACLOCAL_PATH should take precedence over system
- # directories, so we use unshift. However, directories that
- # come first in ACLOCAL_PATH take precedence over directories
- # coming later, which is why the result of split is reversed.
- foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"})
- {
- unshift (@system_includes, $dir) if $dir ne '' && -d $dir;
- }
-}
-
-################################################################
-
-parse_WARNINGS; # Parse the WARNINGS environment variable.
-parse_arguments;
-parse_ACLOCAL_PATH;
-$configure_ac = require_configure_ac;
-
-# We may have to rerun aclocal if some file have been installed, but
-# it should not happen more than once. The reason we must run again
-# is that once the file has been moved from /usr/share/aclocal/ to the
-# local m4/ directory it appears at a new place in the search path,
-# hence it should be output at a different position in aclocal.m4. If
-# we did not rerun aclocal, the next run of aclocal would produce a
-# different aclocal.m4.
-my $loop = 0;
-my $rerun_due_to_macrodir = 0;
-while (1)
- {
- ++$loop;
- prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir;
-
- reset_maps;
- scan_m4_files;
- scan_configure;
- last if $exit_code;
- my %macro_traced = trace_used_macros;
-
- if (!$rerun_due_to_macrodir && @ac_config_macro_dirs)
- {
- # The directory specified in calls to the AC_CONFIG_MACRO_DIRS
- # m4 macro (if any) must go after the user includes specified
- # explicitly with the '-I' option.
- push @user_includes, @ac_config_macro_dirs;
- # We might have to scan some new directory of .m4 files.
- $rerun_due_to_macrodir++;
- next;
- }
-
- if ($install && !@user_includes)
- {
- fatal "installation of third-party macros impossible without " .
- "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)";
- }
-
- last if write_aclocal ($output_file, keys %macro_traced);
- last if $dry_run;
- }
-check_acinclude;
-
-exit $exit_code;
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/automake.in b/automake.in
deleted file mode 100644
index 751dc84ed..000000000
--- a/automake.in
+++ /dev/null
@@ -1,8251 +0,0 @@
-#!@PERL@ -w
-# -*- perl -*-
-# @configure_input@
-
-eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
- if 0;
-
-# automake - create Makefile.in from Makefile.am
-# Copyright (C) 1994-2013 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 2, 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 .
-
-# Originally written by David Mackenzie .
-# Perl reimplementation by Tom Tromey , and
-# Alexandre Duret-Lutz .
-
-package Automake;
-
-use strict;
-
-BEGIN
-{
- @Automake::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@')
- unless @Automake::perl_libdirs;
- unshift @INC, @Automake::perl_libdirs;
-
- # Override SHELL. This is required on DJGPP so that system() uses
- # bash, not COMMAND.COM which doesn't quote arguments properly.
- # Other systems aren't expected to use $SHELL when Automake
- # runs, but it should be safe to drop the "if DJGPP" guard if
- # it turns up other systems need the same thing. After all,
- # if SHELL is used, ./configure's SHELL is always better than
- # the user's SHELL (which may be something like tcsh).
- $ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
-}
-
-use Automake::Config;
-BEGIN
-{
- if ($perl_threads)
- {
- require threads;
- import threads;
- require Thread::Queue;
- import Thread::Queue;
- }
-}
-use Automake::General;
-use Automake::XFile;
-use Automake::Channels;
-use Automake::ChannelDefs;
-use Automake::Configure_ac;
-use Automake::FileUtils;
-use Automake::Location;
-use Automake::Condition qw/TRUE FALSE/;
-use Automake::DisjConditions;
-use Automake::Options;
-use Automake::Variable;
-use Automake::VarDef;
-use Automake::Rule;
-use Automake::RuleDef;
-use Automake::Wrap 'makefile_wrap';
-use Automake::Language;
-use File::Basename;
-use File::Spec;
-use Carp;
-
-## ----------------------- ##
-## Subroutine prototypes. ##
-## ----------------------- ##
-
-#! Prototypes here will automatically be generated by the build system.
-
-
-## ----------- ##
-## Constants. ##
-## ----------- ##
-
-# Some regular expressions. One reason to put them here is that it
-# makes indentation work better in Emacs.
-
-# Writing singled-quoted-$-terminated regexes is a pain because
-# perl-mode thinks of $' as the ${'} variable (instead of a $ followed
-# by a closing quote. Letting perl-mode think the quote is not closed
-# leads to all sort of misindentations. On the other hand, defining
-# regexes as double-quoted strings is far less readable. So usually
-# we will write:
-#
-# $REGEX = '^regex_value' . "\$";
-
-my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n';
-my $WHITE_PATTERN = '^\s*' . "\$";
-my $COMMENT_PATTERN = '^#';
-my $TARGET_PATTERN='[$a-zA-Z0-9_.@%][-.a-zA-Z0-9_(){}/$+@%]*';
-# A rule has three parts: a list of targets, a list of dependencies,
-# and optionally actions.
-my $RULE_PATTERN =
- "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$";
-
-# Only recognize leading spaces, not leading tabs. If we recognize
-# leading tabs here then we need to make the reader smarter, because
-# otherwise it will think rules like 'foo=bar; \' are errors.
-my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$";
-# This pattern recognizes a Gnits version id and sets $1 if the
-# release is an alpha release. We also allow a suffix which can be
-# used to extend the version number with a "fork" identifier.
-my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?';
-
-my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$";
-my $ELSE_PATTERN =
- '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
-my $ENDIF_PATTERN =
- '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
-my $PATH_PATTERN = '(\w|[+/.-])+';
-# This will pass through anything not of the prescribed form.
-my $INCLUDE_PATTERN = ('^include\s+'
- . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')'
- . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')'
- . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$");
-
-# Directories installed during 'install-exec' phase.
-my $EXEC_DIR_PATTERN =
- '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
-
-# Values for AC_CANONICAL_*
-use constant AC_CANONICAL_BUILD => 1;
-use constant AC_CANONICAL_HOST => 2;
-use constant AC_CANONICAL_TARGET => 3;
-
-# Values indicating when something should be cleaned.
-use constant MOSTLY_CLEAN => 0;
-use constant CLEAN => 1;
-use constant DIST_CLEAN => 2;
-use constant MAINTAINER_CLEAN => 3;
-
-# Libtool files.
-my @libtool_files = qw(ltmain.sh config.guess config.sub);
-# ltconfig appears here for compatibility with old versions of libtool.
-my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh);
-
-# Commonly found files we look for and automatically include in
-# DISTFILES.
-my @common_files =
- (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB
- COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO
- ar-lib compile config.guess config.rpath
- config.sub depcomp install-sh libversion.in mdate-sh
- missing mkinstalldirs py-compile texinfo.tex ylwrap),
- @libtool_files, @libtool_sometimes);
-
-# Commonly used files we auto-include, but only sometimes. This list
-# is used for the --help output only.
-my @common_sometimes =
- qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure
- configure.ac configure.in stamp-vti);
-
-# Standard directories from the GNU Coding Standards, and additional
-# pkg* directories from Automake. Stored in a hash for fast member check.
-my %standard_prefix =
- map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info
- lib libexec lisp locale localstate man man1 man2
- man3 man4 man5 man6 man7 man8 man9 oldinclude pdf
- pkgdata pkginclude pkglib pkglibexec ps sbin
- sharedstate sysconf));
-
-# Copyright on generated Makefile.ins.
-my $gen_copyright = "\
-# Copyright (C) 1994-$RELEASE_YEAR Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-";
-
-# These constants are returned by the lang_*_rewrite functions.
-# LANG_SUBDIR means that the resulting object file should be in a
-# subdir if the source file is. In this case the file name cannot
-# have '..' components.
-use constant LANG_IGNORE => 0;
-use constant LANG_PROCESS => 1;
-use constant LANG_SUBDIR => 2;
-
-# These are used when keeping track of whether an object can be built
-# by two different paths.
-use constant COMPILE_LIBTOOL => 1;
-use constant COMPILE_ORDINARY => 2;
-
-# We can't always associate a location to a variable or a rule,
-# when it's defined by Automake. We use INTERNAL in this case.
-use constant INTERNAL => new Automake::Location;
-
-# Serialization keys for message queues.
-use constant QUEUE_MESSAGE => "msg";
-use constant QUEUE_CONF_FILE => "conf file";
-use constant QUEUE_LOCATION => "location";
-use constant QUEUE_STRING => "string";
-
-## ---------------------------------- ##
-## Variables related to the options. ##
-## ---------------------------------- ##
-
-# TRUE if we should always generate Makefile.in.
-my $force_generation = 1;
-
-# From the Perl manual.
-my $symlink_exists = (eval 'symlink ("", "");', $@ eq '');
-
-# TRUE if missing standard files should be installed.
-my $add_missing = 0;
-
-# TRUE if we should copy missing files; otherwise symlink if possible.
-my $copy_missing = 0;
-
-# TRUE if we should always update files that we know about.
-my $force_missing = 0;
-
-
-## ---------------------------------------- ##
-## Variables filled during files scanning. ##
-## ---------------------------------------- ##
-
-# Name of the configure.ac file.
-my $configure_ac;
-
-# Files found by scanning configure.ac for LIBOBJS.
-my %libsources = ();
-
-# Names used in AC_CONFIG_HEADER call.
-my @config_headers = ();
-
-# Names used in AC_CONFIG_LINKS call.
-my @config_links = ();
-
-# List of Makefile.am's to process, and their corresponding outputs.
-my @input_files = ();
-my %output_files = ();
-
-# Complete list of Makefile.am's that exist.
-my @configure_input_files = ();
-
-# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's,
-# and their outputs.
-my @other_input_files = ();
-# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADER appears.
-# The keys are the files created by these macros.
-my %ac_config_files_location = ();
-# The condition under which AC_CONFIG_FOOS appears.
-my %ac_config_files_condition = ();
-
-# Directory to search for configure-required files. This
-# will be computed by locate_aux_dir() and can be set using
-# AC_CONFIG_AUX_DIR in configure.ac.
-# $CONFIG_AUX_DIR is the 'raw' directory, valid only in the source-tree.
-my $config_aux_dir = '';
-my $config_aux_dir_set_in_configure_ac = 0;
-# $AM_CONFIG_AUX_DIR is prefixed with $(top_srcdir), so it can be used
-# in Makefiles.
-my $am_config_aux_dir = '';
-
-# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR
-# in configure.ac.
-my $config_libobj_dir = '';
-
-# Whether AM_GNU_GETTEXT has been seen in configure.ac.
-my $seen_gettext = 0;
-# Whether AM_GNU_GETTEXT([external]) is used.
-my $seen_gettext_external = 0;
-# Where AM_GNU_GETTEXT appears.
-my $ac_gettext_location;
-# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen.
-my $seen_gettext_intl = 0;
-
-# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any).
-my @extra_recursive_targets = ();
-
-# Lists of tags supported by Libtool.
-my %libtool_tags = ();
-# 1 if Libtool uses LT_SUPPORTED_TAG. If it does, then it also
-# uses AC_REQUIRE_AUX_FILE.
-my $libtool_new_api = 0;
-
-# Most important AC_CANONICAL_* macro seen so far.
-my $seen_canonical = 0;
-
-# Where AM_MAINTAINER_MODE appears.
-my $seen_maint_mode;
-
-# Actual version we've seen.
-my $package_version = '';
-
-# Where version is defined.
-my $package_version_location;
-
-# TRUE if we've seen AM_PROG_AR
-my $seen_ar = 0;
-
-# Location of AC_REQUIRE_AUX_FILE calls, indexed by their argument.
-my %required_aux_file = ();
-
-# Where AM_INIT_AUTOMAKE is called;
-my $seen_init_automake = 0;
-
-# TRUE if we've seen AM_AUTOMAKE_VERSION.
-my $seen_automake_version = 0;
-
-# Hash table of discovered configure substitutions. Keys are names,
-# values are 'FILE:LINE' strings which are used by error message
-# generation.
-my %configure_vars = ();
-
-# Ignored configure substitutions (i.e., variables not to be output in
-# Makefile.in)
-my %ignored_configure_vars = ();
-
-# Files included by $configure_ac.
-my @configure_deps = ();
-
-# Greatest timestamp of configure's dependencies.
-my $configure_deps_greatest_timestamp = 0;
-
-# Hash table of AM_CONDITIONAL variables seen in configure.
-my %configure_cond = ();
-
-# This maps extensions onto language names.
-my %extension_map = ();
-
-# List of the DIST_COMMON files we discovered while reading
-# configure.ac.
-my $configure_dist_common = '';
-
-# This maps languages names onto objects.
-my %languages = ();
-# Maps each linker variable onto a language object.
-my %link_languages = ();
-
-# maps extensions to needed source flags.
-my %sourceflags = ();
-
-# List of targets we must always output.
-# FIXME: Complete, and remove falsely required targets.
-my %required_targets =
- (
- 'all' => 1,
- 'dvi' => 1,
- 'pdf' => 1,
- 'ps' => 1,
- 'info' => 1,
- 'install-info' => 1,
- 'install' => 1,
- 'install-data' => 1,
- 'install-exec' => 1,
- 'uninstall' => 1,
-
- # FIXME: Not required, temporary hacks.
- # Well, actually they are sort of required: the -recursive
- # targets will run them anyway...
- 'html-am' => 1,
- 'dvi-am' => 1,
- 'pdf-am' => 1,
- 'ps-am' => 1,
- 'info-am' => 1,
- 'install-data-am' => 1,
- 'install-exec-am' => 1,
- 'install-html-am' => 1,
- 'install-dvi-am' => 1,
- 'install-pdf-am' => 1,
- 'install-ps-am' => 1,
- 'install-info-am' => 1,
- 'installcheck-am' => 1,
- 'uninstall-am' => 1,
- 'tags-am' => 1,
- 'ctags-am' => 1,
- 'cscopelist-am' => 1,
- 'install-man' => 1,
- );
-
-# Queue to push require_conf_file requirements to.
-my $required_conf_file_queue;
-
-# The name of the Makefile currently being processed.
-my $am_file = 'BUG';
-
-################################################################
-
-## ------------------------------------------ ##
-## Variables reset by &initialize_per_input. ##
-## ------------------------------------------ ##
-
-# Relative dir of the output makefile.
-my $relative_dir;
-
-# Greatest timestamp of the output's dependencies (excluding
-# configure's dependencies).
-my $output_deps_greatest_timestamp;
-
-# These variables are used when generating each Makefile.in.
-# They hold the Makefile.in until it is ready to be printed.
-my $output_vars;
-my $output_all;
-my $output_header;
-my $output_rules;
-my $output_trailer;
-
-# This is the conditional stack, updated on if/else/endif, and
-# used to build Condition objects.
-my @cond_stack;
-
-# This holds the set of included files.
-my @include_stack;
-
-# List of dependencies for the obvious targets.
-my @all;
-my @check;
-my @check_tests;
-
-# Keys in this hash table are files to delete. The associated
-# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.)
-my %clean_files;
-
-# Keys in this hash table are object files or other files in
-# subdirectories which need to be removed. This only holds files
-# which are created by compilations. The value in the hash indicates
-# when the file should be removed.
-my %compile_clean_files;
-
-# Keys in this hash table are directories where we expect to build a
-# libtool object. We use this information to decide what directories
-# to delete.
-my %libtool_clean_directories;
-
-# Value of $(SOURCES), used by tags.am.
-my @sources;
-# Sources which go in the distribution.
-my @dist_sources;
-
-# This hash maps object file names onto their corresponding source
-# file names. This is used to ensure that each object is created
-# by a single source file.
-my %object_map;
-
-# This hash maps object file names onto an integer value representing
-# whether this object has been built via ordinary compilation or
-# libtool compilation (the COMPILE_* constants).
-my %object_compilation_map;
-
-
-# This keeps track of the directories for which we've already
-# created dirstamp code. Keys are directories, values are stamp files.
-# Several keys can share the same stamp files if they are equivalent
-# (as are './/foo' and 'foo').
-my %directory_map;
-
-# All .P files.
-my %dep_files;
-
-# This is a list of all targets to run during "make dist".
-my @dist_targets;
-
-# Keep track of all programs declared in this Makefile, without
-# $(EXEEXT). @substitutions@ are not listed.
-my %known_programs;
-my %known_libraries;
-
-# This keeps track of which extensions we've seen (that we care
-# about).
-my %extension_seen;
-
-# This is random scratch space for the language finish functions.
-# Don't randomly overwrite it; examine other uses of keys first.
-my %language_scratch;
-
-# We keep track of which objects need special (per-executable)
-# handling on a per-language basis.
-my %lang_specific_files;
-
-# This is set when 'handle_dist' has finished. Once this happens,
-# we should no longer push on dist_common.
-my $handle_dist_run;
-
-# Used to store a set of linkers needed to generate the sources currently
-# under consideration.
-my %linkers_used;
-
-# True if we need 'LINK' defined. This is a hack.
-my $need_link;
-
-# Does the generated Makefile have to build some compiled object
-# (for binary programs, or plain or libtool libraries)?
-my $must_handle_compiled_objects;
-
-# Record each file processed by make_paragraphs.
-my %transformed_files;
-
-################################################################
-
-## ---------------------------------------------- ##
-## Variables not reset by &initialize_per_input. ##
-## ---------------------------------------------- ##
-
-# Cache each file processed by make_paragraphs.
-# (This is different from %transformed_files because
-# %transformed_files is reset for each file while %am_file_cache
-# it global to the run.)
-my %am_file_cache;
-
-################################################################
-
-# var_SUFFIXES_trigger ($TYPE, $VALUE)
-# ------------------------------------
-# This is called by Automake::Variable::define() when SUFFIXES
-# is defined ($TYPE eq '') or appended ($TYPE eq '+').
-# The work here needs to be performed as a side-effect of the
-# macro_define() call because SUFFIXES definitions impact
-# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
-# the input am file.
-sub var_SUFFIXES_trigger
-{
- my ($type, $value) = @_;
- accept_extensions (split (' ', $value));
-}
-Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
-
-################################################################
-
-
-# initialize_per_input ()
-# -----------------------
-# (Re)-Initialize per-Makefile.am variables.
-sub initialize_per_input ()
-{
- reset_local_duplicates ();
-
- $relative_dir = undef;
-
- $output_deps_greatest_timestamp = 0;
-
- $output_vars = '';
- $output_all = '';
- $output_header = '';
- $output_rules = '';
- $output_trailer = '';
-
- Automake::Options::reset;
- Automake::Variable::reset;
- Automake::Rule::reset;
-
- @cond_stack = ();
-
- @include_stack = ();
-
- @all = ();
- @check = ();
- @check_tests = ();
-
- %clean_files = ();
- %compile_clean_files = ();
-
- # We always include '.'. This isn't strictly correct.
- %libtool_clean_directories = ('.' => 1);
-
- @sources = ();
- @dist_sources = ();
-
- %object_map = ();
- %object_compilation_map = ();
-
- %directory_map = ();
-
- %dep_files = ();
-
- @dist_targets = ();
-
- %known_programs = ();
- %known_libraries= ();
-
- %extension_seen = ();
-
- %language_scratch = ();
-
- %lang_specific_files = ();
-
- $handle_dist_run = 0;
-
- $need_link = 0;
-
- $must_handle_compiled_objects = 0;
-
- %transformed_files = ();
-}
-
-
-################################################################
-
-# Initialize our list of languages that are internally supported.
-
-my @cpplike_flags =
- qw{
- $(DEFS)
- $(DEFAULT_INCLUDES)
- $(INCLUDES)
- $(AM_CPPFLAGS)
- $(CPPFLAGS)
- };
-
-# C.
-register_language ('name' => 'c',
- 'Name' => 'C',
- 'config_vars' => ['CC'],
- 'autodep' => '',
- 'flags' => ['CFLAGS', 'CPPFLAGS'],
- 'ccer' => 'CC',
- 'compiler' => 'COMPILE',
- 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)",
- 'lder' => 'CCLD',
- 'ld' => '$(CC)',
- 'linker' => 'LINK',
- 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'compile_flag' => '-c',
- 'libtool_tag' => 'CC',
- 'extensions' => ['.c']);
-
-# C++.
-register_language ('name' => 'cxx',
- 'Name' => 'C++',
- 'config_vars' => ['CXX'],
- 'linker' => 'CXXLINK',
- 'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'autodep' => 'CXX',
- 'flags' => ['CXXFLAGS', 'CPPFLAGS'],
- 'compile' => "\$(CXX) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)",
- 'ccer' => 'CXX',
- 'compiler' => 'CXXCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'CXX',
- 'lder' => 'CXXLD',
- 'ld' => '$(CXX)',
- 'pure' => 1,
- 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']);
-
-# Objective C.
-register_language ('name' => 'objc',
- 'Name' => 'Objective C',
- 'config_vars' => ['OBJC'],
- 'linker' => 'OBJCLINK',
- 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'autodep' => 'OBJC',
- 'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
- 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)",
- 'ccer' => 'OBJC',
- 'compiler' => 'OBJCCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'lder' => 'OBJCLD',
- 'ld' => '$(OBJC)',
- 'pure' => 1,
- 'extensions' => ['.m']);
-
-# Objective C++.
-register_language ('name' => 'objcxx',
- 'Name' => 'Objective C++',
- 'config_vars' => ['OBJCXX'],
- 'linker' => 'OBJCXXLINK',
- 'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'autodep' => 'OBJCXX',
- 'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
- 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)",
- 'ccer' => 'OBJCXX',
- 'compiler' => 'OBJCXXCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'lder' => 'OBJCXXLD',
- 'ld' => '$(OBJCXX)',
- 'pure' => 1,
- 'extensions' => ['.mm']);
-
-# Unified Parallel C.
-register_language ('name' => 'upc',
- 'Name' => 'Unified Parallel C',
- 'config_vars' => ['UPC'],
- 'linker' => 'UPCLINK',
- 'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'autodep' => 'UPC',
- 'flags' => ['UPCFLAGS', 'CPPFLAGS'],
- 'compile' => "\$(UPC) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)",
- 'ccer' => 'UPC',
- 'compiler' => 'UPCCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'lder' => 'UPCLD',
- 'ld' => '$(UPC)',
- 'pure' => 1,
- 'extensions' => ['.upc']);
-
-# Headers.
-register_language ('name' => 'header',
- 'Name' => 'Header',
- 'extensions' => ['.h', '.H', '.hxx', '.h++', '.hh',
- '.hpp', '.inc'],
- # No output.
- 'output_extensions' => sub { return () },
- # Nothing to do.
- '_finish' => sub { });
-
-# Vala
-register_language ('name' => 'vala',
- 'Name' => 'Vala',
- 'config_vars' => ['VALAC'],
- 'flags' => [],
- 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
- 'ccer' => 'VALAC',
- 'compiler' => 'VALACOMPILE',
- 'extensions' => ['.vala'],
- 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
- return ($ext,) },
- 'rule_file' => 'vala',
- '_finish' => \&lang_vala_finish,
- '_target_hook' => \&lang_vala_target_hook,
- 'nodist_specific' => 1);
-
-# Yacc (C & C++).
-register_language ('name' => 'yacc',
- 'Name' => 'Yacc',
- 'config_vars' => ['YACC'],
- 'flags' => ['YFLAGS'],
- 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)',
- 'ccer' => 'YACC',
- 'compiler' => 'YACCCOMPILE',
- 'extensions' => ['.y'],
- 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
- return ($ext,) },
- 'rule_file' => 'yacc',
- '_finish' => \&lang_yacc_finish,
- '_target_hook' => \&lang_yacc_target_hook,
- 'nodist_specific' => 1);
-register_language ('name' => 'yaccxx',
- 'Name' => 'Yacc (C++)',
- 'config_vars' => ['YACC'],
- 'rule_file' => 'yacc',
- 'flags' => ['YFLAGS'],
- 'ccer' => 'YACC',
- 'compiler' => 'YACCCOMPILE',
- 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)',
- 'extensions' => ['.y++', '.yy', '.yxx', '.ypp'],
- 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
- return ($ext,) },
- '_finish' => \&lang_yacc_finish,
- '_target_hook' => \&lang_yacc_target_hook,
- 'nodist_specific' => 1);
-
-# Lex (C & C++).
-register_language ('name' => 'lex',
- 'Name' => 'Lex',
- 'config_vars' => ['LEX'],
- 'rule_file' => 'lex',
- 'flags' => ['LFLAGS'],
- 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)',
- 'ccer' => 'LEX',
- 'compiler' => 'LEXCOMPILE',
- 'extensions' => ['.l'],
- 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
- return ($ext,) },
- '_finish' => \&lang_lex_finish,
- '_target_hook' => \&lang_lex_target_hook,
- 'nodist_specific' => 1);
-register_language ('name' => 'lexxx',
- 'Name' => 'Lex (C++)',
- 'config_vars' => ['LEX'],
- 'rule_file' => 'lex',
- 'flags' => ['LFLAGS'],
- 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)',
- 'ccer' => 'LEX',
- 'compiler' => 'LEXCOMPILE',
- 'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
- 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
- return ($ext,) },
- '_finish' => \&lang_lex_finish,
- '_target_hook' => \&lang_lex_target_hook,
- 'nodist_specific' => 1);
-
-# Assembler.
-register_language ('name' => 'asm',
- 'Name' => 'Assembler',
- 'config_vars' => ['CCAS', 'CCASFLAGS'],
-
- 'flags' => ['CCASFLAGS'],
- # Users can set AM_CCASFLAGS to include DEFS, INCLUDES,
- # or anything else required. They can also set CCAS.
- # Or simply use Preprocessed Assembler.
- 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
- 'ccer' => 'CCAS',
- 'compiler' => 'CCASCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'extensions' => ['.s']);
-
-# Preprocessed Assembler.
-register_language ('name' => 'cppasm',
- 'Name' => 'Preprocessed Assembler',
- 'config_vars' => ['CCAS', 'CCASFLAGS'],
-
- 'autodep' => 'CCAS',
- 'flags' => ['CCASFLAGS', 'CPPFLAGS'],
- 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)",
- 'ccer' => 'CPPAS',
- 'compiler' => 'CPPASCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'extensions' => ['.S', '.sx']);
-
-# Fortran 77
-register_language ('name' => 'f77',
- 'Name' => 'Fortran 77',
- 'config_vars' => ['F77'],
- 'linker' => 'F77LINK',
- 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'flags' => ['FFLAGS'],
- 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)',
- 'ccer' => 'F77',
- 'compiler' => 'F77COMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'F77',
- 'lder' => 'F77LD',
- 'ld' => '$(F77)',
- 'pure' => 1,
- 'extensions' => ['.f', '.for']);
-
-# Fortran
-register_language ('name' => 'fc',
- 'Name' => 'Fortran',
- 'config_vars' => ['FC'],
- 'linker' => 'FCLINK',
- 'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'flags' => ['FCFLAGS'],
- 'compile' => '$(FC) $(AM_FCFLAGS) $(FCFLAGS)',
- 'ccer' => 'FC',
- 'compiler' => 'FCCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'FC',
- 'lder' => 'FCLD',
- 'ld' => '$(FC)',
- 'pure' => 1,
- 'extensions' => ['.f90', '.f95', '.f03', '.f08']);
-
-# Preprocessed Fortran
-register_language ('name' => 'ppfc',
- 'Name' => 'Preprocessed Fortran',
- 'config_vars' => ['FC'],
- 'linker' => 'FCLINK',
- 'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'lder' => 'FCLD',
- 'ld' => '$(FC)',
- 'flags' => ['FCFLAGS', 'CPPFLAGS'],
- 'ccer' => 'PPFC',
- 'compiler' => 'PPFCCOMPILE',
- 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)",
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'FC',
- 'pure' => 1,
- 'extensions' => ['.F90','.F95', '.F03', '.F08']);
-
-# Preprocessed Fortran 77
-#
-# The current support for preprocessing Fortran 77 just involves
-# passing "$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
-# $(CPPFLAGS)" as additional flags to the Fortran 77 compiler, since
-# this is how GNU Make does it; see the "GNU Make Manual, Edition 0.51
-# for 'make' Version 3.76 Beta" (specifically, from info file
-# '(make)Catalogue of Rules').
-#
-# A better approach would be to write an Autoconf test
-# (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all
-# Fortran 77 compilers know how to do preprocessing. The Autoconf
-# macro AC_PROG_FPP should test the Fortran 77 compiler first for
-# preprocessing capabilities, and then fall back on cpp (if cpp were
-# available).
-register_language ('name' => 'ppf77',
- 'Name' => 'Preprocessed Fortran 77',
- 'config_vars' => ['F77'],
- 'linker' => 'F77LINK',
- 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'lder' => 'F77LD',
- 'ld' => '$(F77)',
- 'flags' => ['FFLAGS', 'CPPFLAGS'],
- 'ccer' => 'PPF77',
- 'compiler' => 'PPF77COMPILE',
- 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)",
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'F77',
- 'pure' => 1,
- 'extensions' => ['.F']);
-
-# Ratfor.
-register_language ('name' => 'ratfor',
- 'Name' => 'Ratfor',
- 'config_vars' => ['F77'],
- 'linker' => 'F77LINK',
- 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'lder' => 'F77LD',
- 'ld' => '$(F77)',
- 'flags' => ['RFLAGS', 'FFLAGS'],
- # FIXME also FFLAGS.
- 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)',
- 'ccer' => 'F77',
- 'compiler' => 'RCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'F77',
- 'pure' => 1,
- 'extensions' => ['.r']);
-
-# Java via gcj.
-register_language ('name' => 'java',
- 'Name' => 'Java',
- 'config_vars' => ['GCJ'],
- 'linker' => 'GCJLINK',
- 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
- 'autodep' => 'GCJ',
- 'flags' => ['GCJFLAGS'],
- 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)',
- 'ccer' => 'GCJ',
- 'compiler' => 'GCJCOMPILE',
- 'compile_flag' => '-c',
- 'output_flag' => '-o',
- 'libtool_tag' => 'GCJ',
- 'lder' => 'GCJLD',
- 'ld' => '$(GCJ)',
- 'pure' => 1,
- 'extensions' => ['.java', '.class', '.zip', '.jar']);
-
-################################################################
-
-# Error reporting functions.
-
-# err_am ($MESSAGE, [%OPTIONS])
-# -----------------------------
-# Uncategorized errors about the current Makefile.am.
-sub err_am
-{
- msg_am ('error', @_);
-}
-
-# err_ac ($MESSAGE, [%OPTIONS])
-# -----------------------------
-# Uncategorized errors about configure.ac.
-sub err_ac
-{
- msg_ac ('error', @_);
-}
-
-# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
-# ---------------------------------------
-# Messages about about the current Makefile.am.
-sub msg_am
-{
- my ($channel, $msg, %opts) = @_;
- msg $channel, "${am_file}.am", $msg, %opts;
-}
-
-# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS])
-# ---------------------------------------
-# Messages about about configure.ac.
-sub msg_ac
-{
- my ($channel, $msg, %opts) = @_;
- msg $channel, $configure_ac, $msg, %opts;
-}
-
-################################################################
-
-# subst ($TEXT)
-# -------------
-# Return a configure-style substitution using the indicated text.
-# We do this to avoid having the substitutions directly in automake.in;
-# when we do that they are sometimes removed and this causes confusion
-# and bugs.
-sub subst
-{
- my ($text) = @_;
- return '@' . $text . '@';
-}
-
-################################################################
-
-
-# $BACKPATH
-# backname ($RELDIR)
-# -------------------
-# If I "cd $RELDIR", then to come back, I should "cd $BACKPATH".
-# For instance 'src/foo' => '../..'.
-# Works with non strictly increasing paths, i.e., 'src/../lib' => '..'.
-sub backname
-{
- my ($file) = @_;
- my @res;
- foreach (split (/\//, $file))
- {
- next if $_ eq '.' || $_ eq '';
- if ($_ eq '..')
- {
- pop @res
- or prog_error ("trying to reverse path '$file' pointing outside tree");
- }
- else
- {
- push (@res, '..');
- }
- }
- return join ('/', @res) || '.';
-}
-
-################################################################
-
-# Silent rules handling functions.
-
-# verbose_var (NAME)
-# ------------------
-# The public variable stem used to implement silent rules.
-sub verbose_var
-{
- my ($name) = @_;
- return 'AM_V_' . $name;
-}
-
-# verbose_private_var (NAME)
-# --------------------------
-# The naming policy for the private variables for silent rules.
-sub verbose_private_var
-{
- my ($name) = @_;
- return 'am__v_' . $name;
-}
-
-# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE])
-# ----------------------------------------------------------
-# For silent rules, setup VAR and dispatcher, to expand to
-# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
-# empty) if not.
-sub define_verbose_var
-{
- my ($name, $silent_val, $verbose_val) = @_;
- $verbose_val = '' unless defined $verbose_val;
- my $var = verbose_var ($name);
- my $pvar = verbose_private_var ($name);
- my $silent_var = $pvar . '_0';
- my $verbose_var = $pvar . '_1';
- # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
- # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
- # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead.
- # See AM_SILENT_RULES in m4/silent.m4.
- define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
- define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)',
- INTERNAL);
- Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
- $silent_val, '', INTERNAL, VAR_ASIS)
- if (! vardef ($silent_var, TRUE));
- Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
- $verbose_val, '', INTERNAL, VAR_ASIS)
- if (! vardef ($verbose_var, TRUE));
-}
-
-# verbose_flag (NAME)
-# -------------------
-# Contents of '%VERBOSE%' variable to expand before rule command.
-sub verbose_flag
-{
- my ($name) = @_;
- return '$(' . verbose_var ($name) . ')';
-}
-
-sub verbose_nodep_flag
-{
- my ($name) = @_;
- return '$(' . verbose_var ($name) . subst ('am__nodep') . ')';
-}
-
-# silent_flag
-# -----------
-# Contents of %SILENT%: variable to expand to '@' when silent.
-sub silent_flag ()
-{
- return verbose_flag ('at');
-}
-
-# define_verbose_tagvar (NAME)
-# ----------------------------
-# Engage the needed silent rules machinery for tag NAME.
-sub define_verbose_tagvar
-{
- my ($name) = @_;
- define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
-}
-
-# Engage the needed silent rules machinery for assorted texinfo commands.
-sub define_verbose_texinfo ()
-{
- my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF');
- foreach my $tag (@tagvars)
- {
- define_verbose_tagvar($tag);
- }
- define_verbose_var('texinfo', '-q');
- define_verbose_var('texidevnull', '> /dev/null');
-}
-
-# Engage the needed silent rules machinery for 'libtool --silent'.
-sub define_verbose_libtool ()
-{
- define_verbose_var ('lt', '--silent');
- return verbose_flag ('lt');
-}
-
-sub handle_silent ()
-{
- # Define "$(AM_V_P)", expanding to a shell conditional that can be
- # used in make recipes to determine whether we are being run in
- # silent mode or not. The choice of the name derives from the LISP
- # convention of appending the letter 'P' to denote a predicate (see
- # also "the '-P' convention" in the Jargon File); we do so for lack
- # of a better convention.
- define_verbose_var ('P', 'false', ':');
- # *Always* provide the user with '$(AM_V_GEN)', unconditionally.
- define_verbose_tagvar ('GEN');
- define_verbose_var ('at', '@');
-}
-
-
-################################################################
-
-
-# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
-sub handle_options ()
-{
- my $var = var ('AUTOMAKE_OPTIONS');
- if ($var)
- {
- if ($var->has_conditional_contents)
- {
- msg_var ('unsupported', $var,
- "'AUTOMAKE_OPTIONS' cannot have conditional contents");
- }
- my @options = map { { option => $_->[1], where => $_->[0] } }
- $var->value_as_list_recursive (cond_filter => TRUE,
- location => 1);
- return 1 if process_option_list (@options);
- }
-
- if ($strictness == GNITS)
- {
- set_option ('readme-alpha', INTERNAL);
- set_option ('std-options', INTERNAL);
- set_option ('check-news', INTERNAL);
- }
-
- return 0;
-}
-
-# shadow_unconditionally ($varname, $where)
-# -----------------------------------------
-# Return a $(variable) that contains all possible values
-# $varname can take.
-# If the VAR wasn't defined conditionally, return $(VAR).
-# Otherwise we create an am__VAR_DIST variable which contains
-# all possible values, and return $(am__VAR_DIST).
-sub shadow_unconditionally
-{
- my ($varname, $where) = @_;
- my $var = var $varname;
- if ($var->has_conditional_contents)
- {
- $varname = "am__${varname}_DIST";
- my @files = uniq ($var->value_as_list_recursive);
- define_pretty_variable ($varname, TRUE, $where, @files);
- }
- return "\$($varname)"
-}
-
-# check_user_variables (@LIST)
-# ----------------------------
-# Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR
-# otherwise.
-sub check_user_variables
-{
- my @dont_override = @_;
- foreach my $flag (@dont_override)
- {
- my $var = var $flag;
- if ($var)
- {
- for my $cond ($var->conditions->conds)
- {
- if ($var->rdef ($cond)->owner == VAR_MAKEFILE)
- {
- msg_cond_var ('gnu', $cond, $flag,
- "'$flag' is a user variable, "
- . "you should not override it;\n"
- . "use 'AM_$flag' instead");
- }
- }
- }
- }
-}
-
-# Call finish function for each language that was used.
-sub handle_languages ()
-{
- if (! option 'no-dependencies')
- {
- # Include auto-dep code. Don't include it if DEP_FILES would
- # be empty.
- if (keys %extension_seen && keys %dep_files)
- {
- # Set location of depcomp.
- define_variable ('depcomp',
- "\$(SHELL) $am_config_aux_dir/depcomp",
- INTERNAL);
- define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
-
- require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
-
- my @deplist = sort keys %dep_files;
- # Generate each 'include' individually. Irix 6 make will
- # not properly include several files resulting from a
- # variable expansion; generating many separate includes
- # seems safest.
- $output_rules .= "\n";
- foreach my $iter (@deplist)
- {
- $output_rules .= (subst ('AMDEP_TRUE')
- . subst ('am__include')
- . ' '
- . subst ('am__quote')
- . $iter
- . subst ('am__quote')
- . "\n");
- }
-
- # Compute the set of directories to remove in distclean-depend.
- my @depdirs = uniq (map { dirname ($_) } @deplist);
- $output_rules .= file_contents ('depend',
- new Automake::Location,
- DEPDIRS => "@depdirs");
- }
- }
- else
- {
- define_variable ('depcomp', '', INTERNAL);
- define_variable ('am__depfiles_maybe', '', INTERNAL);
- }
-
- my %done;
-
- # Is the C linker needed?
- my $needs_c = 0;
- foreach my $ext (sort keys %extension_seen)
- {
- next unless $extension_map{$ext};
-
- my $lang = $languages{$extension_map{$ext}};
-
- my $rule_file = $lang->rule_file || 'depend2';
-
- # Get information on $LANG.
- my $pfx = $lang->autodep;
- my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
-
- my ($AMDEP, $FASTDEP) =
- (option 'no-dependencies' || $lang->autodep eq 'no')
- ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx");
-
- my $verbose = verbose_flag ($lang->ccer || 'GEN');
- my $verbose_nodep = ($AMDEP eq 'FALSE')
- ? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN');
- my $silent = silent_flag ();
-
- my %transform = ('EXT' => $ext,
- 'PFX' => $pfx,
- 'FPFX' => $fpfx,
- 'AMDEP' => $AMDEP,
- 'FASTDEP' => $FASTDEP,
- '-c' => $lang->compile_flag || '',
- # These are not used, but they need to be defined
- # so transform() do not complain.
- SUBDIROBJ => 0,
- 'DERIVED-EXT' => 'BUG',
- DIST_SOURCE => 1,
- VERBOSE => $verbose,
- 'VERBOSE-NODEP' => $verbose_nodep,
- SILENT => $silent,
- );
-
- # Generate the appropriate rules for this extension.
- if (((! option 'no-dependencies') && $lang->autodep ne 'no')
- || defined $lang->compile)
- {
- # Some C compilers don't support -c -o. Use it only if really
- # needed.
- my $output_flag = $lang->output_flag || '';
- $output_flag = '-o'
- if (! $output_flag
- && $lang->name eq 'c'
- && option 'subdir-objects');
-
- # Compute a possible derived extension.
- # This is not used by depend2.am.
- my $der_ext = ($lang->output_extensions->($ext))[0];
-
- # When we output an inference rule like '.c.o:' we
- # have two cases to consider: either subdir-objects
- # is used, or it is not.
- #
- # In the latter case the rule is used to build objects
- # in the current directory, and dependencies always
- # go into './$(DEPDIR)/'. We can hard-code this value.
- #
- # In the former case the rule can be used to build
- # objects in sub-directories too. Dependencies should
- # go into the appropriate sub-directories, e.g.,
- # 'sub/$(DEPDIR)/'. The value of this directory
- # needs to be computed on-the-fly.
- #
- # DEPBASE holds the name of this directory, plus the
- # basename part of the object file (extensions Po, TPo,
- # Plo, TPlo will be added later as appropriate). It is
- # either hardcoded, or a shell variable ('$depbase') that
- # will be computed by the rule.
- my $depbase =
- option ('subdir-objects') ? '$$depbase' : '$(DEPDIR)/$*';
- $output_rules .=
- file_contents ($rule_file,
- new Automake::Location,
- %transform,
- GENERIC => 1,
-
- 'DERIVED-EXT' => $der_ext,
-
- DEPBASE => $depbase,
- BASE => '$*',
- SOURCE => '$<',
- SOURCEFLAG => $sourceflags{$ext} || '',
- OBJ => '$@',
- OBJOBJ => '$@',
- LTOBJ => '$@',
-
- COMPILE => '$(' . $lang->compiler . ')',
- LTCOMPILE => '$(LT' . $lang->compiler . ')',
- -o => $output_flag,
- SUBDIROBJ => !! option 'subdir-objects');
- }
-
- # Now include code for each specially handled object with this
- # language.
- my %seen_files = ();
- foreach my $file (@{$lang_specific_files{$lang->name}})
- {
- my ($derived, $source, $obj, $myext, $srcext, %file_transform) = @$file;
-
- # We might see a given object twice, for instance if it is
- # used under different conditions.
- next if defined $seen_files{$obj};
- $seen_files{$obj} = 1;
-
- prog_error ("found " . $lang->name .
- " in handle_languages, but compiler not defined")
- unless defined $lang->compile;
-
- my $obj_compile = $lang->compile;
-
- # Rewrite each occurrence of 'AM_$flag' in the compile
- # rule into '${derived}_$flag' if it exists.
- for my $flag (@{$lang->flags})
- {
- my $val = "${derived}_$flag";
- $obj_compile =~ s/\(AM_$flag\)/\($val\)/
- if set_seen ($val);
- }
-
- my $libtool_tag = '';
- if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag})
- {
- $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
- }
-
- my $ptltflags = "${derived}_LIBTOOLFLAGS";
- $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags;
-
- my $ltverbose = define_verbose_libtool ();
- my $obj_ltcompile =
- "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
- . "--mode=compile $obj_compile";
-
- # We _need_ '-o' for per object rules.
- my $output_flag = $lang->output_flag || '-o';
-
- my $depbase = dirname ($obj);
- $depbase = ''
- if $depbase eq '.';
- $depbase .= '/'
- unless $depbase eq '';
- $depbase .= '$(DEPDIR)/' . basename ($obj);
-
- $output_rules .=
- file_contents ($rule_file,
- new Automake::Location,
- %transform,
- GENERIC => 0,
-
- DEPBASE => $depbase,
- BASE => $obj,
- SOURCE => $source,
- SOURCEFLAG => $sourceflags{$srcext} || '',
- # Use $myext and not '.o' here, in case
- # we are actually building a new source
- # file -- e.g. via yacc.
- OBJ => "$obj$myext",
- OBJOBJ => "$obj.obj",
- LTOBJ => "$obj.lo",
-
- VERBOSE => $verbose,
- 'VERBOSE-NODEP' => $verbose_nodep,
- SILENT => $silent,
- COMPILE => $obj_compile,
- LTCOMPILE => $obj_ltcompile,
- -o => $output_flag,
- %file_transform);
- }
-
- # The rest of the loop is done once per language.
- next if defined $done{$lang};
- $done{$lang} = 1;
-
- # Load the language dependent Makefile chunks.
- my %lang = map { uc ($_) => 0 } keys %languages;
- $lang{uc ($lang->name)} = 1;
- $output_rules .= file_contents ('lang-compile',
- new Automake::Location,
- %transform, %lang);
-
- # If the source to a program consists entirely of code from a
- # 'pure' language, for instance C++ or Fortran 77, then we
- # don't need the C compiler code. However if we run into
- # something unusual then we do generate the C code. There are
- # probably corner cases here that do not work properly.
- # People linking Java code to Fortran code deserve pain.
- $needs_c ||= ! $lang->pure;
-
- define_compiler_variable ($lang)
- if ($lang->compile);
-
- define_linker_variable ($lang)
- if ($lang->link);
-
- require_variables ("$am_file.am", $lang->Name . " source seen",
- TRUE, @{$lang->config_vars});
-
- # Call the finisher.
- $lang->finish;
-
- # Flags listed in '->flags' are user variables (per GNU Standards),
- # they should not be overridden in the Makefile...
- my @dont_override = @{$lang->flags};
- # ... and so is LDFLAGS.
- push @dont_override, 'LDFLAGS' if $lang->link;
-
- check_user_variables @dont_override;
- }
-
- # If the project is entirely C++ or entirely Fortran 77 (i.e., 1
- # suffix rule was learned), don't bother with the C stuff. But if
- # anything else creeps in, then use it.
- $needs_c = 1
- if $need_link || suffix_rules_count > 1;
-
- if ($needs_c)
- {
- define_compiler_variable ($languages{'c'})
- unless defined $done{$languages{'c'}};
- define_linker_variable ($languages{'c'});
- }
-}
-
-
-# append_exeext { PREDICATE } $MACRO
-# ----------------------------------
-# Append $(EXEEXT) to each filename in $F appearing in the Makefile
-# variable $MACRO if &PREDICATE($F) is true. @substitutions@ are
-# ignored.
-#
-# This is typically used on all filenames of *_PROGRAMS, and filenames
-# of TESTS that are programs.
-sub append_exeext (&$)
-{
- my ($pred, $macro) = @_;
-
- transform_variable_recursively
- ($macro, $macro, 'am__EXEEXT', 0, INTERNAL,
- sub {
- my ($subvar, $val, $cond, $full_cond) = @_;
- # Append $(EXEEXT) unless the user did it already, or it's a
- # @substitution@.
- $val .= '$(EXEEXT)'
- if $val !~ /(?:\$\(EXEEXT\)$|^[@]\w+[@]$)/ && &$pred ($val);
- return $val;
- });
-}
-
-
-# Check to make sure a source defined in LIBOBJS is not explicitly
-# mentioned. This is a separate function (as opposed to being inlined
-# in handle_source_transform) because it isn't always appropriate to
-# do this check.
-sub check_libobjs_sources
-{
- my ($one_file, $unxformed) = @_;
-
- foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
- 'dist_EXTRA_', 'nodist_EXTRA_')
- {
- my @files;
- my $varname = $prefix . $one_file . '_SOURCES';
- my $var = var ($varname);
- if ($var)
- {
- @files = $var->value_as_list_recursive;
- }
- elsif ($prefix eq '')
- {
- @files = ($unxformed . '.c');
- }
- else
- {
- next;
- }
-
- foreach my $file (@files)
- {
- err_var ($prefix . $one_file . '_SOURCES',
- "automatically discovered file '$file' should not" .
- " be explicitly mentioned")
- if defined $libsources{$file};
- }
- }
-}
-
-
-# @OBJECTS
-# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM)
-# -----------------------------------------------------------------------------
-# Does much of the actual work for handle_source_transform.
-# Arguments are:
-# $VAR is the name of the variable that the source filenames come from
-# $TOPPARENT is the name of the _SOURCES variable which is being processed
-# $DERIVED is the name of resulting executable or library
-# $OBJ is the object extension (e.g., '.lo')
-# $FILE the source file to transform
-# %TRANSFORM contains extras arguments to pass to file_contents
-# when producing explicit rules
-# Result is a list of the names of objects
-# %linkers_used will be updated with any linkers needed
-sub handle_single_transform
-{
- my ($var, $topparent, $derived, $obj, $_file, %transform) = @_;
- my @files = ($_file);
- my @result = ();
-
- # Turn sources into objects. We use a while loop like this
- # because we might add to @files in the loop.
- while (scalar @files > 0)
- {
- $_ = shift @files;
-
- # Configure substitutions in _SOURCES variables are errors.
- if (/^\@.*\@$/)
- {
- my $parent_msg = '';
- $parent_msg = "\nand is referred to from '$topparent'"
- if $topparent ne $var->name;
- err_var ($var,
- "'" . $var->name . "' includes configure substitution '$_'"
- . $parent_msg . ";\nconfigure " .
- "substitutions are not allowed in _SOURCES variables");
- next;
- }
-
- # If the source file is in a subdirectory then the '.o' is put
- # into the current directory, unless the subdir-objects option
- # is in effect.
-
- # Split file name into base and extension.
- next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/;
- my $full = $_;
- my $directory = $1 || '';
- my $base = $2;
- my $extension = $3;
-
- # We must generate a rule for the object if it requires its own flags.
- my $renamed = 0;
- my ($linker, $object);
-
- # This records whether we've seen a derived source file (e.g.
- # yacc output).
- my $derived_source = 0;
-
- # This holds the 'aggregate context' of the file we are
- # currently examining. If the file is compiled with
- # per-object flags, then it will be the name of the object.
- # Otherwise it will be 'AM'. This is used by the target hook
- # language function.
- my $aggregate = 'AM';
-
- $extension = derive_suffix ($extension, $obj);
- my $lang;
- if ($extension_map{$extension} &&
- ($lang = $languages{$extension_map{$extension}}))
- {
- # Found the language, so see what it says.
- saw_extension ($extension);
-
- # Do we have per-executable flags for this executable?
- my $have_per_exec_flags = 0;
- my @peflags = @{$lang->flags};
- push @peflags, 'LIBTOOLFLAGS' if $obj eq '.lo';
- foreach my $flag (@peflags)
- {
- if (set_seen ("${derived}_$flag"))
- {
- $have_per_exec_flags = 1;
- last;
- }
- }
-
- # Note: computed subr call. The language rewrite function
- # should return one of the LANG_* constants. It could
- # also return a list whose first value is such a constant
- # and whose second value is a new source extension which
- # should be applied. This means this particular language
- # generates another source file which we must then process
- # further.
- my $subr = \&{'lang_' . $lang->name . '_rewrite'};
- defined &$subr or $subr = \&lang_sub_obj;
- my ($r, $source_extension)
- = &$subr ($directory, $base, $extension,
- $obj, $have_per_exec_flags, $var);
- # Skip this entry if we were asked not to process it.
- next if $r == LANG_IGNORE;
-
- # Now extract linker and other info.
- $linker = $lang->linker;
-
- my $this_obj_ext;
- if (defined $source_extension)
- {
- $this_obj_ext = $source_extension;
- $derived_source = 1;
- }
- else
- {
- $this_obj_ext = $obj;
- }
- $object = $base . $this_obj_ext;
-
- if ($have_per_exec_flags)
- {
- # We have a per-executable flag in effect for this
- # object. In this case we rewrite the object's
- # name to ensure it is unique.
-
- # We choose the name 'DERIVED_OBJECT' to ensure
- # (1) uniqueness, and (2) continuity between
- # invocations. However, this will result in a
- # name that is too long for losing systems, in
- # some situations. So we provide _SHORTNAME to
- # override.
-
- my $dname = $derived;
- my $var = var ($derived . '_SHORTNAME');
- if ($var)
- {
- # FIXME: should use the same Condition as
- # the _SOURCES variable. But this is really
- # silly overkill -- nobody should have
- # conditional shortnames.
- $dname = $var->variable_value;
- }
- $object = $dname . '-' . $object;
-
- prog_error ($lang->name . " flags defined without compiler")
- if ! defined $lang->compile;
-
- $renamed = 1;
- }
-
- # If rewrite said it was ok, put the object into a
- # subdir.
- if ($directory ne '')
- {
- if ($r == LANG_SUBDIR)
- {
- $object = $directory . '/' . $object;
- }
- else
- {
- # Since the next major version of automake (2.0) will
- # make the behaviour so far only activated with the
- # 'subdir-object' option mandatory, it's better if we
- # start warning users not using that option.
- # As suggested by Peter Johansson, we strive to avoid
- # the warning when it would be irrelevant, i.e., if
- # all source files sit in "current" directory.
- msg_var 'unsupported', $var,
- "source file '$full' is in a subdirectory,"
- . "\nbut option 'subdir-objects' is disabled";
- msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL;
-possible forward-incompatibility.
-At least a source file is in a subdirectory, but the 'subdir-objects'
-automake option hasn't been enabled. For now, the corresponding output
-object file(s) will be placed in the top-level directory. However,
-this behaviour will change in future Automake versions: they will
-unconditionally cause object files to be placed in the same subdirectory
-of the corresponding sources.
-You are advised to start using 'subdir-objects' option throughout your
-project, to avoid future incompatibilities.
-EOF
- }
- }
-
- # If the object file has been renamed (because per-target
- # flags are used) we cannot compile the file with an
- # inference rule: we need an explicit rule.
- #
- # If the source is in a subdirectory and the object is in
- # the current directory, we also need an explicit rule.
- #
- # If both source and object files are in a subdirectory
- # (this happens when the subdir-objects option is used),
- # then the inference will work.
- #
- # The latter case deserves a historical note. When the
- # subdir-objects option was added on 1999-04-11 it was
- # thought that inferences rules would work for
- # subdirectory objects too. Later, on 1999-11-22,
- # automake was changed to output explicit rules even for
- # subdir-objects. Nobody remembers why, but this occurred
- # soon after the merge of the user-dep-gen-branch so it
- # might be related. In late 2003 people complained about
- # the size of the generated Makefile.ins (libgcj, with
- # 2200+ subdir objects was reported to have a 9MB
- # Makefile), so we now rely on inference rules again.
- # Maybe we'll run across the same issue as in the past,
- # but at least this time we can document it. However since
- # dependency tracking has evolved it is possible that
- # our old problem no longer exists.
- # Using inference rules for subdir-objects has been tested
- # with GNU make, Solaris make, Ultrix make, BSD make,
- # HP-UX make, and OSF1 make successfully.
- if ($renamed
- || ($directory ne '' && ! option 'subdir-objects')
- # We must also use specific rules for a nodist_ source
- # if its language requests it.
- || ($lang->nodist_specific && ! $transform{'DIST_SOURCE'}))
- {
- my $obj_sans_ext = substr ($object, 0,
- - length ($this_obj_ext));
- my $full_ansi;
- if ($directory ne '')
- {
- $full_ansi = $directory . '/' . $base . $extension;
- }
- else
- {
- $full_ansi = $base . $extension;
- }
-
- my @specifics = ($full_ansi, $obj_sans_ext,
- # Only use $this_obj_ext in the derived
- # source case because in the other case we
- # *don't* want $(OBJEXT) to appear here.
- ($derived_source ? $this_obj_ext : '.o'),
- $extension);
-
- # If we renamed the object then we want to use the
- # per-executable flag name. But if this is simply a
- # subdir build then we still want to use the AM_ flag
- # name.
- if ($renamed)
- {
- unshift @specifics, $derived;
- $aggregate = $derived;
- }
- else
- {
- unshift @specifics, 'AM';
- }
-
- # Each item on this list is a reference to a list consisting
- # of four values followed by additional transform flags for
- # file_contents. The four values are the derived flag prefix
- # (e.g. for 'foo_CFLAGS', it is 'foo'), the name of the
- # source file, the base name of the output file, and
- # the extension for the object file.
- push (@{$lang_specific_files{$lang->name}},
- [@specifics, %transform]);
- }
- }
- elsif ($extension eq $obj)
- {
- # This is probably the result of a direct suffix rule.
- # In this case we just accept the rewrite.
- $object = "$base$extension";
- $object = "$directory/$object" if $directory ne '';
- $linker = '';
- }
- else
- {
- # No error message here. Used to have one, but it was
- # very unpopular.
- # FIXME: we could potentially do more processing here,
- # perhaps treating the new extension as though it were a
- # new source extension (as above). This would require
- # more restructuring than is appropriate right now.
- next;
- }
-
- err_am "object '$object' created by '$full' and '$object_map{$object}'"
- if (defined $object_map{$object}
- && $object_map{$object} ne $full);
-
- my $comp_val = (($object =~ /\.lo$/)
- ? COMPILE_LIBTOOL : COMPILE_ORDINARY);
- (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/;
- if (defined $object_compilation_map{$comp_obj}
- && $object_compilation_map{$comp_obj} != 0
- # Only see the error once.
- && ($object_compilation_map{$comp_obj}
- != (COMPILE_LIBTOOL | COMPILE_ORDINARY))
- && $object_compilation_map{$comp_obj} != $comp_val)
- {
- err_am "object '$comp_obj' created both with libtool and without";
- }
- $object_compilation_map{$comp_obj} |= $comp_val;
-
- if (defined $lang)
- {
- # Let the language do some special magic if required.
- $lang->target_hook ($aggregate, $object, $full, %transform);
- }
-
- if ($derived_source)
- {
- prog_error ($lang->name . " has automatic dependency tracking")
- if $lang->autodep ne 'no';
- # Make sure this new source file is handled next. That will
- # make it appear to be at the right place in the list.
- unshift (@files, $object);
- # Distribute derived sources unless the source they are
- # derived from is not.
- push_dist_common ($object)
- unless ($topparent =~ /^(?:nobase_)?nodist_/);
- next;
- }
-
- $linkers_used{$linker} = 1;
-
- push (@result, $object);
-
- if (! defined $object_map{$object})
- {
- my @dep_list = ();
- $object_map{$object} = $full;
-
- # If resulting object is in subdir, we need to make
- # sure the subdir exists at build time.
- if ($object =~ /\//)
- {
- # FIXME: check that $DIRECTORY is somewhere in the
- # project
-
- # For Java, the way we're handling it right now, a
- # '..' component doesn't make sense.
- if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
- {
- err_am "'$full' should not contain a '..' component";
- }
-
- # Make sure *all* objects files in the subdirectory are
- # removed by "make mostlyclean". Not only this is more
- # efficient than listing the object files to be removed
- # individually (which would cause an 'rm' invocation for
- # each of them -- very inefficient, see bug#10697), it
- # would also leave stale object files in the subdirectory
- # whenever a source file there is removed or renamed.
- $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN;
- if ($object =~ /\.lo$/)
- {
- # If we have a libtool object, then we also must remove
- # any '.lo' objects in its same subdirectory.
- $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN;
- # Remember to cleanup .libs/ in this directory.
- $libtool_clean_directories{$directory} = 1;
- }
-
- push (@dep_list, require_build_directory ($directory));
-
- # If we're generating dependencies, we also want
- # to make sure that the appropriate subdir of the
- # .deps directory is created.
- push (@dep_list,
- require_build_directory ($directory . '/$(DEPDIR)'))
- unless option 'no-dependencies';
- }
-
- pretty_print_rule ($object . ':', "\t", @dep_list)
- if scalar @dep_list > 0;
- }
-
- # Transform .o or $o file into .P file (for automatic
- # dependency code).
- # Properly flatten multiple adjacent slashes, as Solaris 10 make
- # might fail over them in an include statement.
- # Leading double slashes may be special, as per Posix, so deal
- # with them carefully.
- if ($lang && $lang->autodep ne 'no')
- {
- my $depfile = $object;
- $depfile =~ s/\.([^.]*)$/.P$1/;
- $depfile =~ s/\$\(OBJEXT\)$/o/;
- my $maybe_extra_leading_slash = '';
- $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],;
- $depfile =~ s,/+,/,g;
- my $basename = basename ($depfile);
- # This might make $dirname empty, but we account for that below.
- (my $dirname = dirname ($depfile)) =~ s/\/*$//;
- $dirname = $maybe_extra_leading_slash . $dirname;
- $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1;
- }
- }
-
- return @result;
-}
-
-
-# $LINKER
-# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE,
-# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM)
-# ---------------------------------------------------------------------------
-# Define an _OBJECTS variable for a _SOURCES variable (or subvariable)
-#
-# Arguments are:
-# $VAR is the name of the _SOURCES variable
-# $OBJVAR is the name of the _OBJECTS variable if known (otherwise
-# it will be generated and returned).
-# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but
-# work done to determine the linker will be).
-# $ONE_FILE is the canonical (transformed) name of object to build
-# $OBJ is the object extension (i.e. either '.o' or '.lo').
-# $TOPPARENT is the _SOURCES variable being processed.
-# $WHERE context into which this definition is done
-# %TRANSFORM extra arguments to pass to file_contents when producing
-# rules
-#
-# Result is a pair ($LINKER, $OBJVAR):
-# $LINKER is a boolean, true if a linker is needed to deal with the objects
-sub define_objects_from_sources
-{
- my ($var, $objvar, $nodefine, $one_file,
- $obj, $topparent, $where, %transform) = @_;
-
- my $needlinker = "";
-
- transform_variable_recursively
- ($var, $objvar, 'am__objects', $nodefine, $where,
- # The transform code to run on each filename.
- sub {
- my ($subvar, $val, $cond, $full_cond) = @_;
- my @trans = handle_single_transform ($subvar, $topparent,
- $one_file, $obj, $val,
- %transform);
- $needlinker = "true" if @trans;
- return @trans;
- });
-
- return $needlinker;
-}
-
-
-# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM)
-# -----------------------------------------------------------------------------
-# Handle SOURCE->OBJECT transform for one program or library.
-# Arguments are:
-# canonical (transformed) name of target to build
-# actual target of object to build
-# object extension (i.e., either '.o' or '$o')
-# location of the source variable
-# extra arguments to pass to file_contents when producing rules
-# Return the name of the linker variable that must be used.
-# Empty return means just use 'LINK'.
-sub handle_source_transform
-{
- # one_file is canonical name. unxformed is given name. obj is
- # object extension.
- my ($one_file, $unxformed, $obj, $where, %transform) = @_;
-
- my $linker = '';
-
- # No point in continuing if _OBJECTS is defined.
- return if reject_var ($one_file . '_OBJECTS',
- $one_file . '_OBJECTS should not be defined');
-
- my %used_pfx = ();
- my $needlinker;
- %linkers_used = ();
- foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
- 'dist_EXTRA_', 'nodist_EXTRA_')
- {
- my $varname = $prefix . $one_file . "_SOURCES";
- my $var = var $varname;
- next unless $var;
-
- # We are going to define _OBJECTS variables using the prefix.
- # Then we glom them all together. So we can't use the null
- # prefix here as we need it later.
- my $xpfx = ($prefix eq '') ? 'am_' : $prefix;
-
- # Keep track of which prefixes we saw.
- $used_pfx{$xpfx} = 1
- unless $prefix =~ /EXTRA_/;
-
- push @sources, "\$($varname)";
- push @dist_sources, shadow_unconditionally ($varname, $where)
- unless (option ('no-dist') || $prefix =~ /^nodist_/);
-
- $needlinker |=
- define_objects_from_sources ($varname,
- $xpfx . $one_file . '_OBJECTS',
- !!($prefix =~ /EXTRA_/),
- $one_file, $obj, $varname, $where,
- DIST_SOURCE => ($prefix !~ /^nodist_/),
- %transform);
- }
- if ($needlinker)
- {
- $linker ||= resolve_linker (%linkers_used);
- }
-
- my @keys = sort keys %used_pfx;
- if (scalar @keys == 0)
- {
- # The default source for libfoo.la is libfoo.c, but for
- # backward compatibility we first look at libfoo_la.c,
- # if no default source suffix is given.
- my $old_default_source = "$one_file.c";
- my $ext_var = var ('AM_DEFAULT_SOURCE_EXT');
- my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c';
- msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value")
- if $default_source_ext =~ /[\t ]/;
- (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,;
- # TODO: Remove this backward-compatibility hack in Automake 2.0.
- if ($old_default_source ne $default_source
- && !$ext_var
- && (rule $old_default_source
- || rule '$(srcdir)/' . $old_default_source
- || rule '${srcdir}/' . $old_default_source
- || -f $old_default_source))
- {
- my $loc = $where->clone;
- $loc->pop_context;
- msg ('obsolete', $loc,
- "the default source for '$unxformed' has been changed "
- . "to '$default_source'.\n(Using '$old_default_source' for "
- . "backward compatibility.)");
- $default_source = $old_default_source;
- }
- # If a rule exists to build this source with a $(srcdir)
- # prefix, use that prefix in our variables too. This is for
- # the sake of BSD Make.
- if (rule '$(srcdir)/' . $default_source
- || rule '${srcdir}/' . $default_source)
- {
- $default_source = '$(srcdir)/' . $default_source;
- }
-
- define_variable ($one_file . "_SOURCES", $default_source, $where);
- push (@sources, $default_source);
- push (@dist_sources, $default_source);
-
- %linkers_used = ();
- my (@result) =
- handle_single_transform ($one_file . '_SOURCES',
- $one_file . '_SOURCES',
- $one_file, $obj,
- $default_source, %transform);
- $linker ||= resolve_linker (%linkers_used);
- define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
- }
- else
- {
- @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys;
- define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys);
- }
-
- # If we want to use 'LINK' we must make sure it is defined.
- if ($linker eq '')
- {
- $need_link = 1;
- }
-
- return $linker;
-}
-
-
-# handle_lib_objects ($XNAME, $VAR)
-# ---------------------------------
-# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables.
-# Also, generate _DEPENDENCIES variable if appropriate.
-# Arguments are:
-# transformed name of object being built, or empty string if no object
-# name of _LDADD/_LIBADD-type variable to examine
-# Returns 1 if LIBOBJS seen, 0 otherwise.
-sub handle_lib_objects
-{
- my ($xname, $varname) = @_;
-
- my $var = var ($varname);
- prog_error "'$varname' undefined"
- unless $var;
- prog_error "unexpected variable name '$varname'"
- unless $varname =~ /^(.*)(?:LIB|LD)ADD$/;
- my $prefix = $1 || 'AM_';
-
- my $seen_libobjs = 0;
- my $flagvar = 0;
-
- transform_variable_recursively
- ($varname, $xname . '_DEPENDENCIES', 'am__DEPENDENCIES',
- ! $xname, INTERNAL,
- # Transformation function, run on each filename.
- sub {
- my ($subvar, $val, $cond, $full_cond) = @_;
-
- if ($val =~ /^-/)
- {
- # Skip -lfoo and -Ldir silently; these are explicitly allowed.
- if ($val !~ /^-[lL]/ &&
- # Skip -dlopen and -dlpreopen; these are explicitly allowed
- # for Libtool libraries or programs. (Actually we are a bit
- # lax here since this code also applies to non-libtool
- # libraries or programs, for which -dlopen and -dlopreopen
- # are pure nonsense. Diagnosing this doesn't seem very
- # important: the developer will quickly get complaints from
- # the linker.)
- $val !~ /^-dl(?:pre)?open$/ &&
- # Only get this error once.
- ! $flagvar)
- {
- $flagvar = 1;
- # FIXME: should display a stack of nested variables
- # as context when $var != $subvar.
- err_var ($var, "linker flags such as '$val' belong in "
- . "'${prefix}LDFLAGS'");
- }
- return ();
- }
- elsif ($val !~ /^\@.*\@$/)
- {
- # Assume we have a file of some sort, and output it into the
- # dependency variable. Autoconf substitutions are not output;
- # rarely is a new dependency substituted into e.g. foo_LDADD
- # -- but bad things (e.g. -lX11) are routinely substituted.
- # Note that LIBOBJS and ALLOCA are exceptions to this rule,
- # and handled specially below.
- return $val;
- }
- elsif ($val =~ /^\@(LT)?LIBOBJS\@$/)
- {
- handle_LIBOBJS ($subvar, $cond, $1);
- $seen_libobjs = 1;
- return $val;
- }
- elsif ($val =~ /^\@(LT)?ALLOCA\@$/)
- {
- handle_ALLOCA ($subvar, $cond, $1);
- return $val;
- }
- else
- {
- return ();
- }
- });
-
- return $seen_libobjs;
-}
-
-# handle_LIBOBJS_or_ALLOCA ($VAR)
-# -------------------------------
-# Definitions common to LIBOBJS and ALLOCA.
-# VAR should be one of LIBOBJS, LTLIBOBJS, ALLOCA, or LTALLOCA.
-sub handle_LIBOBJS_or_ALLOCA
-{
- my ($var) = @_;
-
- my $dir = '';
-
- # If LIBOBJS files must be built in another directory we have
- # to define LIBOBJDIR and ensure the files get cleaned.
- # Otherwise LIBOBJDIR can be left undefined, and the cleaning
- # is achieved by 'rm -f *.$(OBJEXT)' in compile.am.
- if ($config_libobj_dir
- && $relative_dir ne $config_libobj_dir)
- {
- if (option 'subdir-objects')
- {
- # In the top-level Makefile we do not use $(top_builddir), because
- # we are already there, and since the targets are built without
- # a $(top_builddir), it helps BSD Make to match them with
- # dependencies.
- $dir = "$config_libobj_dir/"
- if $config_libobj_dir ne '.';
- $dir = backname ($relative_dir) . "/$dir"
- if $relative_dir ne '.';
- define_variable ('LIBOBJDIR', "$dir", INTERNAL);
- $clean_files{"\$($var)"} = MOSTLY_CLEAN;
- # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
- # be created by libtool as a side-effect of creating LTLIBOBJS).
- $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
- }
- else
- {
- error ("'\$($var)' cannot be used outside '$config_libobj_dir' if"
- . " 'subdir-objects' is not set");
- }
- }
-
- return $dir;
-}
-
-sub handle_LIBOBJS
-{
- my ($var, $cond, $lt) = @_;
- my $myobjext = $lt ? 'lo' : 'o';
- $lt ||= '';
-
- $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS')
- if ! keys %libsources;
-
- my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS";
-
- foreach my $iter (keys %libsources)
- {
- if ($iter =~ /\.[cly]$/)
- {
- saw_extension ($&);
- saw_extension ('.c');
- }
-
- if ($iter =~ /\.h$/)
- {
- require_libsource_with_macro ($cond, $var, FOREIGN, $iter);
- }
- elsif ($iter ne 'alloca.c')
- {
- my $rewrite = $iter;
- $rewrite =~ s/\.c$/.P$myobjext/;
- $dep_files{$dir . '$(DEPDIR)/' . $rewrite} = 1;
- $rewrite = "^" . quotemeta ($iter) . "\$";
- # Only require the file if it is not a built source.
- my $bs = var ('BUILT_SOURCES');
- if (! $bs || ! grep (/$rewrite/, $bs->value_as_list_recursive))
- {
- require_libsource_with_macro ($cond, $var, FOREIGN, $iter);
- }
- }
- }
-}
-
-sub handle_ALLOCA
-{
- my ($var, $cond, $lt) = @_;
- my $myobjext = $lt ? 'lo' : 'o';
- $lt ||= '';
- my $dir = handle_LIBOBJS_or_ALLOCA "${lt}ALLOCA";
-
- $var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
- $dep_files{$dir . '$(DEPDIR)/alloca.P' . $myobjext} = 1;
- require_libsource_with_macro ($cond, $var, FOREIGN, 'alloca.c');
- saw_extension ('.c');
-}
-
-# Canonicalize the input parameter.
-sub canonicalize
-{
- my ($string) = @_;
- $string =~ tr/A-Za-z0-9_\@/_/c;
- return $string;
-}
-
-# Canonicalize a name, and check to make sure the non-canonical name
-# is never used. Returns canonical name. Arguments are name and a
-# list of suffixes to check for.
-sub check_canonical_spelling
-{
- my ($name, @suffixes) = @_;
-
- my $xname = canonicalize ($name);
- if ($xname ne $name)
- {
- foreach my $xt (@suffixes)
- {
- reject_var ("$name$xt", "use '$xname$xt', not '$name$xt'");
- }
- }
-
- return $xname;
-}
-
-# Set up the compile suite.
-sub handle_compile ()
-{
- return if ! $must_handle_compiled_objects;
-
- # Boilerplate.
- my $default_includes = '';
- if (! option 'nostdinc')
- {
- my @incs = ('-I.', subst ('am__isrc'));
-
- my $var = var 'CONFIG_HEADER';
- if ($var)
- {
- foreach my $hdr (split (' ', $var->variable_value))
- {
- push @incs, '-I' . dirname ($hdr);
- }
- }
- # We want '-I. -I$(srcdir)', but the latter -I is redundant
- # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@`
- # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'.
- # Items in CONFIG_HEADER are never in $(srcdir) so it is safe
- # to just put @am__isrc@ right after '-I.', without a space.
- ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/;
- }
-
- my (@mostly_rms, @dist_rms);
- foreach my $item (sort keys %compile_clean_files)
- {
- if ($compile_clean_files{$item} == MOSTLY_CLEAN)
- {
- push (@mostly_rms, "\t-rm -f $item");
- }
- elsif ($compile_clean_files{$item} == DIST_CLEAN)
- {
- push (@dist_rms, "\t-rm -f $item");
- }
- else
- {
- prog_error 'invalid entry in %compile_clean_files';
- }
- }
-
- my ($coms, $vars, $rules) =
- file_contents_internal (1, "$libdir/am/compile.am",
- new Automake::Location,
- 'DEFAULT_INCLUDES' => $default_includes,
- 'MOSTLYRMS' => join ("\n", @mostly_rms),
- 'DISTRMS' => join ("\n", @dist_rms));
- $output_vars .= $vars;
- $output_rules .= "$coms$rules";
-}
-
-# Handle libtool rules.
-sub handle_libtool ()
-{
- return unless var ('LIBTOOL');
-
- # Libtool requires some files, but only at top level.
- # (Starting with Libtool 2.0 we do not have to bother. These
- # requirements are done with AC_REQUIRE_AUX_FILE.)
- require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files)
- if $relative_dir eq '.' && ! $libtool_new_api;
-
- my @libtool_rms;
- foreach my $item (sort keys %libtool_clean_directories)
- {
- my $dir = ($item eq '.') ? '' : "$item/";
- # .libs is for Unix, _libs for DOS.
- push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs");
- }
-
- check_user_variables 'LIBTOOLFLAGS';
-
- # Output the libtool compilation rules.
- $output_rules .= file_contents ('libtool',
- new Automake::Location,
- LTRMS => join ("\n", @libtool_rms));
-}
-
-
-sub handle_programs ()
-{
- my @proglist = am_install_var ('progs', 'PROGRAMS',
- 'bin', 'sbin', 'libexec', 'pkglibexec',
- 'noinst', 'check');
- return if ! @proglist;
- $must_handle_compiled_objects = 1;
-
- my $seen_global_libobjs =
- var ('LDADD') && handle_lib_objects ('', 'LDADD');
-
- foreach my $pair (@proglist)
- {
- my ($where, $one_file) = @$pair;
-
- my $seen_libobjs = 0;
- my $obj = '.$(OBJEXT)';
-
- $known_programs{$one_file} = $where;
-
- # Canonicalize names and check for misspellings.
- my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
- '_SOURCES', '_OBJECTS',
- '_DEPENDENCIES');
-
- $where->push_context ("while processing program '$one_file'");
- $where->set (INTERNAL->get);
-
- my $linker = handle_source_transform ($xname, $one_file, $obj, $where,
- NONLIBTOOL => 1, LIBTOOL => 0);
-
- if (var ($xname . "_LDADD"))
- {
- $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD');
- }
- else
- {
- # User didn't define prog_LDADD override. So do it.
- define_variable ($xname . '_LDADD', '$(LDADD)', $where);
-
- # This does a bit too much work. But we need it to
- # generate _DEPENDENCIES when appropriate.
- if (var ('LDADD'))
- {
- $seen_libobjs = handle_lib_objects ($xname, 'LDADD');
- }
- }
-
- reject_var ($xname . '_LIBADD',
- "use '${xname}_LDADD', not '${xname}_LIBADD'");
-
- set_seen ($xname . '_DEPENDENCIES');
- set_seen ('EXTRA_' . $xname . '_DEPENDENCIES');
- set_seen ($xname . '_LDFLAGS');
-
- # Determine program to use for link.
- my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname);
- $vlink = verbose_flag ($vlink || 'GEN');
-
- # If the resulting program lies in a subdirectory,
- # ensure that the directory exists before we need it.
- my $dirstamp = require_build_directory_maybe ($one_file);
-
- $libtool_clean_directories{dirname ($one_file)} = 1;
-
- $output_rules .= file_contents ('program',
- $where,
- PROGRAM => $one_file,
- XPROGRAM => $xname,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp,
- EXEEXT => '$(EXEEXT)');
-
- if ($seen_libobjs || $seen_global_libobjs)
- {
- if (var ($xname . '_LDADD'))
- {
- check_libobjs_sources ($xname, $xname . '_LDADD');
- }
- elsif (var ('LDADD'))
- {
- check_libobjs_sources ($xname, 'LDADD');
- }
- }
- }
-}
-
-
-sub handle_libraries ()
-{
- my @liblist = am_install_var ('libs', 'LIBRARIES',
- 'lib', 'pkglib', 'noinst', 'check');
- return if ! @liblist;
- $must_handle_compiled_objects = 1;
-
- my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib',
- 'noinst', 'check');
-
- if (@prefix)
- {
- my $var = rvar ($prefix[0] . '_LIBRARIES');
- $var->requires_variables ('library used', 'RANLIB');
- }
-
- define_variable ('AR', 'ar', INTERNAL);
- define_variable ('ARFLAGS', 'cru', INTERNAL);
- define_verbose_tagvar ('AR');
-
- foreach my $pair (@liblist)
- {
- my ($where, $onelib) = @$pair;
-
- my $seen_libobjs = 0;
- # Check that the library fits the standard naming convention.
- my $bn = basename ($onelib);
- if ($bn !~ /^lib.*\.a$/)
- {
- $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/;
- my $suggestion = dirname ($onelib) . "/$bn";
- $suggestion =~ s|^\./||g;
- msg ('error-gnu/warn', $where,
- "'$onelib' is not a standard library name\n"
- . "did you mean '$suggestion'?")
- }
-
- ($known_libraries{$onelib} = $bn) =~ s/\.a$//;
-
- $where->push_context ("while processing library '$onelib'");
- $where->set (INTERNAL->get);
-
- my $obj = '.$(OBJEXT)';
-
- # Canonicalize names and check for misspellings.
- my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
- '_OBJECTS', '_DEPENDENCIES',
- '_AR');
-
- if (! var ($xlib . '_AR'))
- {
- define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
- }
-
- # Generate support for conditional object inclusion in
- # libraries.
- if (var ($xlib . '_LIBADD'))
- {
- if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
- {
- $seen_libobjs = 1;
- }
- }
- else
- {
- define_variable ($xlib . "_LIBADD", '', $where);
- }
-
- reject_var ($xlib . '_LDADD',
- "use '${xlib}_LIBADD', not '${xlib}_LDADD'");
-
- # Make sure we at look at this.
- set_seen ($xlib . '_DEPENDENCIES');
- set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
-
- handle_source_transform ($xlib, $onelib, $obj, $where,
- NONLIBTOOL => 1, LIBTOOL => 0);
-
- # If the resulting library lies in a subdirectory,
- # make sure this directory will exist.
- my $dirstamp = require_build_directory_maybe ($onelib);
- my $verbose = verbose_flag ('AR');
- my $silent = silent_flag ();
-
- $output_rules .= file_contents ('library',
- $where,
- VERBOSE => $verbose,
- SILENT => $silent,
- LIBRARY => $onelib,
- XLIBRARY => $xlib,
- DIRSTAMP => $dirstamp);
-
- if ($seen_libobjs)
- {
- if (var ($xlib . '_LIBADD'))
- {
- check_libobjs_sources ($xlib, $xlib . '_LIBADD');
- }
- }
-
- if (! $seen_ar)
- {
- msg ('extra-portability', $where,
- "'$onelib': linking libraries using a non-POSIX\n"
- . "archiver requires 'AM_PROG_AR' in '$configure_ac'")
- }
- }
-}
-
-
-sub handle_ltlibraries ()
-{
- my @liblist = am_install_var ('ltlib', 'LTLIBRARIES',
- 'noinst', 'lib', 'pkglib', 'check');
- return if ! @liblist;
- $must_handle_compiled_objects = 1;
-
- my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib',
- 'noinst', 'check');
-
- if (@prefix)
- {
- my $var = rvar ($prefix[0] . '_LTLIBRARIES');
- $var->requires_variables ('Libtool library used', 'LIBTOOL');
- }
-
- my %instdirs = ();
- my %instsubdirs = ();
- my %instconds = ();
- my %liblocations = (); # Location (in Makefile.am) of each library.
-
- foreach my $key (@prefix)
- {
- # Get the installation directory of each library.
- my $dir = $key;
- my $strip_subdir = 1;
- if ($dir =~ /^nobase_/)
- {
- $dir =~ s/^nobase_//;
- $strip_subdir = 0;
- }
- my $var = rvar ($key . '_LTLIBRARIES');
-
- # We reject libraries which are installed in several places
- # in the same condition, because we can only specify one
- # '-rpath' option.
- $var->traverse_recursively
- (sub
- {
- my ($var, $val, $cond, $full_cond) = @_;
- my $hcond = $full_cond->human;
- my $where = $var->rdef ($cond)->location;
- my $ldir = '';
- $ldir = '/' . dirname ($val)
- if (!$strip_subdir);
- # A library cannot be installed in different directories
- # in overlapping conditions.
- if (exists $instconds{$val})
- {
- my ($msg, $acond) =
- $instconds{$val}->ambiguous_p ($val, $full_cond);
-
- if ($msg)
- {
- error ($where, $msg, partial => 1);
- my $dirtxt = "installed " . ($strip_subdir ? "in" : "below") . " '$dir'";
- $dirtxt = "built for '$dir'"
- if $dir eq 'EXTRA' || $dir eq 'noinst' || $dir eq 'check';
- my $dircond =
- $full_cond->true ? "" : " in condition $hcond";
-
- error ($where, "'$val' should be $dirtxt$dircond ...",
- partial => 1);
-
- my $hacond = $acond->human;
- my $adir = $instdirs{$val}{$acond};
- my $adirtxt = "installed in '$adir'";
- $adirtxt = "built for '$adir'"
- if ($adir eq 'EXTRA' || $adir eq 'noinst'
- || $adir eq 'check');
- my $adircond = $acond->true ? "" : " in condition $hacond";
-
- my $onlyone = ($dir ne $adir) ?
- ("\nLibtool libraries can be built for only one "
- . "destination") : "";
-
- error ($liblocations{$val}{$acond},
- "... and should also be $adirtxt$adircond.$onlyone");
- return;
- }
- }
- else
- {
- $instconds{$val} = new Automake::DisjConditions;
- }
- $instdirs{$val}{$full_cond} = $dir;
- $instsubdirs{$val}{$full_cond} = $ldir;
- $liblocations{$val}{$full_cond} = $where;
- $instconds{$val} = $instconds{$val}->merge ($full_cond);
- },
- sub
- {
- return ();
- },
- skip_ac_subst => 1);
- }
-
- foreach my $pair (@liblist)
- {
- my ($where, $onelib) = @$pair;
-
- my $seen_libobjs = 0;
- my $obj = '.lo';
-
- # Canonicalize names and check for misspellings.
- my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
- '_SOURCES', '_OBJECTS',
- '_DEPENDENCIES');
-
- # Check that the library fits the standard naming convention.
- my $libname_rx = '^lib.*\.la';
- my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS');
- my $ldvar2 = var ('LDFLAGS');
- if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive))
- || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive)))
- {
- # Relax name checking for libtool modules.
- $libname_rx = '\.la';
- }
-
- my $bn = basename ($onelib);
- if ($bn !~ /$libname_rx$/)
- {
- my $type = 'library';
- if ($libname_rx eq '\.la')
- {
- $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/;
- $type = 'module';
- }
- else
- {
- $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/;
- }
- my $suggestion = dirname ($onelib) . "/$bn";
- $suggestion =~ s|^\./||g;
- msg ('error-gnu/warn', $where,
- "'$onelib' is not a standard libtool $type name\n"
- . "did you mean '$suggestion'?")
- }
-
- ($known_libraries{$onelib} = $bn) =~ s/\.la$//;
-
- $where->push_context ("while processing Libtool library '$onelib'");
- $where->set (INTERNAL->get);
-
- # Make sure we look at these.
- set_seen ($xlib . '_LDFLAGS');
- set_seen ($xlib . '_DEPENDENCIES');
- set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
-
- # Generate support for conditional object inclusion in
- # libraries.
- if (var ($xlib . '_LIBADD'))
- {
- if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
- {
- $seen_libobjs = 1;
- }
- }
- else
- {
- define_variable ($xlib . "_LIBADD", '', $where);
- }
-
- reject_var ("${xlib}_LDADD",
- "use '${xlib}_LIBADD', not '${xlib}_LDADD'");
-
-
- my $linker = handle_source_transform ($xlib, $onelib, $obj, $where,
- NONLIBTOOL => 0, LIBTOOL => 1);
-
- # Determine program to use for link.
- my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib);
- $vlink = verbose_flag ($vlink || 'GEN');
-
- my $rpathvar = "am_${xlib}_rpath";
- my $rpath = "\$($rpathvar)";
- foreach my $rcond ($instconds{$onelib}->conds)
- {
- my $val;
- if ($instdirs{$onelib}{$rcond} eq 'EXTRA'
- || $instdirs{$onelib}{$rcond} eq 'noinst'
- || $instdirs{$onelib}{$rcond} eq 'check')
- {
- # It's an EXTRA_ library, so we can't specify -rpath,
- # because we don't know where the library will end up.
- # The user probably knows, but generally speaking automake
- # doesn't -- and in fact configure could decide
- # dynamically between two different locations.
- $val = '';
- }
- else
- {
- $val = ('-rpath $(' . $instdirs{$onelib}{$rcond} . 'dir)');
- $val .= $instsubdirs{$onelib}{$rcond}
- if defined $instsubdirs{$onelib}{$rcond};
- }
- if ($rcond->true)
- {
- # If $rcond is true there is only one condition and
- # there is no point defining an helper variable.
- $rpath = $val;
- }
- else
- {
- define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val);
- }
- }
-
- # If the resulting library lies in a subdirectory,
- # make sure this directory will exist.
- my $dirstamp = require_build_directory_maybe ($onelib);
-
- # Remember to cleanup .libs/ in this directory.
- my $dirname = dirname $onelib;
- $libtool_clean_directories{$dirname} = 1;
-
- $output_rules .= file_contents ('ltlibrary',
- $where,
- LTLIBRARY => $onelib,
- XLTLIBRARY => $xlib,
- RPATH => $rpath,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp);
- if ($seen_libobjs)
- {
- if (var ($xlib . '_LIBADD'))
- {
- check_libobjs_sources ($xlib, $xlib . '_LIBADD');
- }
- }
-
- if (! $seen_ar)
- {
- msg ('extra-portability', $where,
- "'$onelib': linking libtool libraries using a non-POSIX\n"
- . "archiver requires 'AM_PROG_AR' in '$configure_ac'")
- }
- }
-}
-
-# See if any _SOURCES variable were misspelled.
-sub check_typos ()
-{
- # It is ok if the user sets this particular variable.
- set_seen 'AM_LDFLAGS';
-
- foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES')
- {
- foreach my $var (variables $primary)
- {
- my $varname = $var->name;
- # A configure variable is always legitimate.
- next if exists $configure_vars{$varname};
-
- for my $cond ($var->conditions->conds)
- {
- $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
- msg_var ('syntax', $var, "variable '$varname' is defined but no"
- . " program or\nlibrary has '$1' as canonical name"
- . " (possible typo)")
- unless $var->rdef ($cond)->seen;
- }
- }
- }
-}
-
-
-sub handle_scripts ()
-{
- # NOTE we no longer automatically clean SCRIPTS, because it is
- # useful to sometimes distribute scripts verbatim. This happens
- # e.g. in Automake itself.
- am_install_var ('-candist', 'scripts', 'SCRIPTS',
- 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
- 'noinst', 'check');
-}
-
-
-## ------------------------ ##
-## Handling Texinfo files. ##
-## ------------------------ ##
-
-# ($OUTFILE, $VFILE)
-# scan_texinfo_file ($FILENAME)
-# -----------------------------
-# $OUTFILE - name of the info file produced by $FILENAME.
-# $VFILE - name of the version.texi file used (undef if none).
-sub scan_texinfo_file
-{
- my ($filename) = @_;
-
- my $texi = new Automake::XFile "< $filename";
- verb "reading $filename";
-
- my ($outfile, $vfile);
- while ($_ = $texi->getline)
- {
- if (/^\@setfilename +(\S+)/)
- {
- # Honor only the first @setfilename. (It's possible to have
- # more occurrences later if the manual shows examples of how
- # to use @setfilename...)
- next if $outfile;
-
- $outfile = $1;
- if (index ($outfile, '.') < 0)
- {
- msg 'obsolete', "$filename:$.",
- "use of suffix-less info files is discouraged"
- }
- elsif ($outfile !~ /\.info$/)
- {
- error ("$filename:$.",
- "output '$outfile' has unrecognized extension");
- return;
- }
- }
- # A "version.texi" file is actually any file whose name matches
- # "vers*.texi".
- elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/)
- {
- $vfile = $1;
- }
- }
-
- if (! $outfile)
- {
- err_am "'$filename' missing \@setfilename";
- return;
- }
-
- return ($outfile, $vfile);
-}
-
-
-# ($DIRSTAMP, @CLEAN_FILES)
-# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES)
-# ------------------------------------------------------------------
-# SOURCE - the source Texinfo file
-# DEST - the destination Info file
-# INSRC - whether DEST should be built in the source tree
-# DEPENDENCIES - known dependencies
-sub output_texinfo_build_rules
-{
- my ($source, $dest, $insrc, @deps) = @_;
-
- # Split 'a.texi' into 'a' and '.texi'.
- my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/);
- my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/);
-
- $ssfx ||= "";
- $dsfx ||= "";
-
- # We can output two kinds of rules: the "generic" rules use Make
- # suffix rules and are appropriate when $source and $dest do not lie
- # in a sub-directory; the "specific" rules are needed in the other
- # case.
- #
- # The former are output only once (this is not really apparent here,
- # but just remember that some logic deeper in Automake will not
- # output the same rule twice); while the later need to be output for
- # each Texinfo source.
- my $generic;
- my $makeinfoflags;
- my $sdir = dirname $source;
- if ($sdir eq '.' && dirname ($dest) eq '.')
- {
- $generic = 1;
- $makeinfoflags = '-I $(srcdir)';
- }
- else
- {
- $generic = 0;
- $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir";
- }
-
- # A directory can contain two kinds of info files: some built in the
- # source tree, and some built in the build tree. The rules are
- # different in each case. However we cannot output two different
- # set of generic rules. Because in-source builds are more usual, we
- # use generic rules in this case and fall back to "specific" rules
- # for build-dir builds. (It should not be a problem to invert this
- # if needed.)
- $generic = 0 unless $insrc;
-
- # We cannot use a suffix rule to build info files with an empty
- # extension. Otherwise we would output a single suffix inference
- # rule, with separate dependencies, as in
- #
- # .texi:
- # $(MAKEINFO) ...
- # foo.info: foo.texi
- #
- # which confuse Solaris make. (See the Autoconf manual for
- # details.) Therefore we use a specific rule in this case. This
- # applies to info files only (dvi and pdf files always have an
- # extension).
- my $generic_info = ($generic && $dsfx) ? 1 : 0;
-
- # If the resulting file lies in a subdirectory,
- # make sure this directory will exist.
- my $dirstamp = require_build_directory_maybe ($dest);
-
- my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx;
-
- $output_rules .= file_contents ('texibuild',
- new Automake::Location,
- AM_V_MAKEINFO => verbose_flag('MAKEINFO'),
- AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'),
- AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'),
- DEPS => "@deps",
- DEST_PREFIX => $dpfx,
- DEST_INFO_PREFIX => $dipfx,
- DEST_SUFFIX => $dsfx,
- DIRSTAMP => $dirstamp,
- GENERIC => $generic,
- GENERIC_INFO => $generic_info,
- INSRC => $insrc,
- MAKEINFOFLAGS => $makeinfoflags,
- SILENT => silent_flag(),
- SOURCE => ($generic
- ? '$<' : $source),
- SOURCE_INFO => ($generic_info
- ? '$<' : $source),
- SOURCE_REAL => $source,
- SOURCE_SUFFIX => $ssfx,
- TEXIQUIET => verbose_flag('texinfo'),
- TEXIDEVNULL => verbose_flag('texidevnull'),
- );
- return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
-}
-
-
-# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
-# handle_texinfo_helper ($info_texinfos)
-# --------------------------------------
-# Handle all Texinfo source; helper for 'handle_texinfo'.
-sub handle_texinfo_helper
-{
- my ($info_texinfos) = @_;
- my (@infobase, @info_deps_list, @texi_deps);
- my %versions;
- my $done = 0;
- my (@mostly_cleans, @texi_cleans, @maint_cleans) = ('', '', '');
-
- # Build a regex matching user-cleaned files.
- my $d = var 'DISTCLEANFILES';
- my $c = var 'CLEANFILES';
- my @f = ();
- push @f, $d->value_as_list_recursive (inner_expand => 1) if $d;
- push @f, $c->value_as_list_recursive (inner_expand => 1) if $c;
- @f = map { s|[^A-Za-z_0-9*\[\]\-]|\\$&|g; s|\*|[^/]*|g; $_; } @f;
- my $user_cleaned_files = '^(?:' . join ('|', @f) . ')$';
-
- foreach my $texi
- ($info_texinfos->value_as_list_recursive (inner_expand => 1))
- {
- my $infobase = $texi;
- if ($infobase =~ s/\.texi$//)
- {
- 1; # Nothing more to do.
- }
- elsif ($infobase =~ s/\.(txi|texinfo)$//)
- {
- msg_var 'obsolete', $info_texinfos,
- "suffix '.$1' for Texinfo files is discouraged;" .
- " use '.texi' instead";
- }
- else
- {
- # FIXME: report line number.
- err_am "texinfo file '$texi' has unrecognized extension";
- next;
- }
-
- push @infobase, $infobase;
-
- # If 'version.texi' is referenced by input file, then include
- # automatic versioning capability.
- my ($out_file, $vtexi) =
- scan_texinfo_file ("$relative_dir/$texi")
- or next;
- # Directory of auxiliary files and build by-products used by texi2dvi
- # and texi2pdf.
- push @mostly_cleans, "$infobase.t2d";
- push @mostly_cleans, "$infobase.t2p";
-
- # If the Texinfo source is in a subdirectory, create the
- # resulting info in this subdirectory. If it is in the current
- # directory, try hard to not prefix "./" because it breaks the
- # generic rules.
- my $outdir = dirname ($texi) . '/';
- $outdir = "" if $outdir eq './';
- $out_file = $outdir . $out_file;
-
- # Until Automake 1.6.3, .info files were built in the
- # source tree. This was an obstacle to the support of
- # non-distributed .info files, and non-distributed .texi
- # files.
- #
- # * Non-distributed .texi files is important in some packages
- # where .texi files are built at make time, probably using
- # other binaries built in the package itself, maybe using
- # tools or information found on the build host. Because
- # these files are not distributed they are always rebuilt
- # at make time; they should therefore not lie in the source
- # directory. One plan was to support this using
- # nodist_info_TEXINFOS or something similar. (Doing this
- # requires some sanity checks. For instance Automake should
- # not allow:
- # dist_info_TEXINFOS = foo.texi
- # nodist_foo_TEXINFOS = included.texi
- # because a distributed file should never depend on a
- # non-distributed file.)
- #
- # * If .texi files are not distributed, then .info files should
- # not be distributed either. There are also cases where one
- # wants to distribute .texi files, but does not want to
- # distribute the .info files. For instance the Texinfo package
- # distributes the tool used to build these files; it would
- # be a waste of space to distribute them. It's not clear
- # which syntax we should use to indicate that .info files should
- # not be distributed. Akim Demaille suggested that eventually
- # we switch to a new syntax:
- # | Maybe we should take some inspiration from what's already
- # | done in the rest of Automake. Maybe there is too much
- # | syntactic sugar here, and you want
- # | nodist_INFO = bar.info
- # | dist_bar_info_SOURCES = bar.texi
- # | bar_texi_DEPENDENCIES = foo.texi
- # | with a bit of magic to have bar.info represent the whole
- # | bar*info set. That's a lot more verbose that the current
- # | situation, but it is # not new, hence the user has less
- # | to learn.
- # |
- # | But there is still too much room for meaningless specs:
- # | nodist_INFO = bar.info
- # | dist_bar_info_SOURCES = bar.texi
- # | dist_PS = bar.ps something-written-by-hand.ps
- # | nodist_bar_ps_SOURCES = bar.texi
- # | bar_texi_DEPENDENCIES = foo.texi
- # | here bar.texi is dist_ in line 2, and nodist_ in 4.
- #
- # Back to the point, it should be clear that in order to support
- # non-distributed .info files, we need to build them in the
- # build tree, not in the source tree (non-distributed .texi
- # files are less of a problem, because we do not output build
- # rules for them). In Automake 1.7 .info build rules have been
- # largely cleaned up so that .info files get always build in the
- # build tree, even when distributed. The idea was that
- # (1) if during a VPATH build the .info file was found to be
- # absent or out-of-date (in the source tree or in the
- # build tree), Make would rebuild it in the build tree.
- # If an up-to-date source-tree of the .info file existed,
- # make would not rebuild it in the build tree.
- # (2) having two copies of .info files, one in the source tree
- # and one (newer) in the build tree is not a problem
- # because 'make dist' always pick files in the build tree
- # first.
- # However it turned out the be a bad idea for several reasons:
- # * Tru64, OpenBSD, and FreeBSD (not NetBSD) Make do not behave
- # like GNU Make on point (1) above. These implementations
- # of Make would always rebuild .info files in the build
- # tree, even if such files were up to date in the source
- # tree. Consequently, it was impossible to perform a VPATH
- # build of a package containing Texinfo files using these
- # Make implementations.
- # (Refer to the Autoconf Manual, section "Limitation of
- # Make", paragraph "VPATH", item "target lookup", for
- # an account of the differences between these
- # implementations.)
- # * The GNU Coding Standards require these files to be built
- # in the source-tree (when they are distributed, that is).
- # * Keeping a fresher copy of distributed files in the
- # build tree can be annoying during development because
- # - if the files is kept under CVS, you really want it
- # to be updated in the source tree
- # - it is confusing that 'make distclean' does not erase
- # all files in the build tree.
- #
- # Consequently, starting with Automake 1.8, .info files are
- # built in the source tree again. Because we still plan to
- # support non-distributed .info files at some point, we
- # have a single variable ($INSRC) that controls whether
- # the current .info file must be built in the source tree
- # or in the build tree. Actually this variable is switched
- # off in two cases:
- # (1) For '.info' files that appear to be cleaned; this is for
- # backward compatibility with package such as Texinfo,
- # which do things like
- # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
- # DISTCLEANFILES = texinfo texinfo-* info*.info*
- # # Do not create info files for distribution.
- # dist-info:
- # in order not to distribute .info files.
- # (2) When the undocumented option 'info-in-builddir' is given.
- # This is done to allow the developers of GCC, GDB, GNU
- # binutils and the GNU bfd library to force the '.info' files
- # to be generated in the builddir rather than the srcdir, as
- # was once done when the (now removed) 'cygnus' option was
- # given. See automake bug#11034 for more discussion.
- my $insrc = 1;
-
- if (option 'info-in-builddir')
- {
- $insrc = 0;
- }
- elsif ($out_file =~ $user_cleaned_files)
- {
- $insrc = 0;
- msg 'obsolete', "$am_file.am", < $texi,
- VTI => $vti,
- STAMPVTI => "${outdir}stamp-$vti",
- VTEXI => "$outdir$vtexi",
- MDDIR => $conf_dir,
- DIRSTAMP => $dirstamp);
- }
- }
-
- # Handle location of texinfo.tex.
- my $need_texi_file = 0;
- my $texinfodir;
- if (var ('TEXINFO_TEX'))
- {
- # The user defined TEXINFO_TEX so assume he knows what he is
- # doing.
- $texinfodir = ('$(srcdir)/'
- . dirname (variable_value ('TEXINFO_TEX')));
- }
- elsif ($config_aux_dir_set_in_configure_ac)
- {
- $texinfodir = $am_config_aux_dir;
- define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
- $need_texi_file = 2; # so that we require_conf_file later
- }
- else
- {
- $texinfodir = '$(srcdir)';
- $need_texi_file = 1;
- }
- define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL);
-
- push (@dist_targets, 'dist-info');
-
- if (! option 'no-installinfo')
- {
- # Make sure documentation is made and installed first. Use
- # $(INFO_DEPS), not 'info', because otherwise recursive makes
- # get run twice during "make all".
- unshift (@all, '$(INFO_DEPS)');
- }
-
- define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL);
- define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL);
- define_files_variable ("PSS", @infobase, 'ps', INTERNAL);
- define_files_variable ("HTMLS", @infobase, 'html', INTERNAL);
-
- # This next isn't strictly needed now -- the places that look here
- # could easily be changed to look in info_TEXINFOS. But this is
- # probably better, in case noinst_TEXINFOS is ever supported.
- define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL);
-
- # Do some error checking. Note that this file is not required
- # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
- # up above.
- if ($need_texi_file && ! option 'no-texinfo.tex')
- {
- if ($need_texi_file > 1)
- {
- require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
- 'texinfo.tex');
- }
- else
- {
- require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
- 'texinfo.tex');
- }
- }
-
- return (makefile_wrap ("", "\t ", @mostly_cleans),
- makefile_wrap ("", "\t ", @texi_cleans),
- makefile_wrap ("", "\t ", @maint_cleans));
-}
-
-
-sub handle_texinfo ()
-{
- reject_var 'TEXINFOS', "'TEXINFOS' is an anachronism; use 'info_TEXINFOS'";
- # FIXME: I think this is an obsolete future feature name.
- reject_var 'html_TEXINFOS', "HTML generation not yet supported";
-
- my $info_texinfos = var ('info_TEXINFOS');
- my ($mostlyclean, $clean, $maintclean) = ('', '', '');
- if ($info_texinfos)
- {
- define_verbose_texinfo;
- ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
- chomp $mostlyclean;
- chomp $clean;
- chomp $maintclean;
- }
-
- $output_rules .= file_contents ('texinfos',
- new Automake::Location,
- AM_V_DVIPS => verbose_flag('DVIPS'),
- MOSTLYCLEAN => $mostlyclean,
- TEXICLEAN => $clean,
- MAINTCLEAN => $maintclean,
- 'LOCAL-TEXIS' => !!$info_texinfos,
- TEXIQUIET => verbose_flag('texinfo'));
-}
-
-
-sub handle_man_pages ()
-{
- reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
-
- # Find all the sections in use. We do this by first looking for
- # "standard" sections, and then looking for any additional
- # sections used in man_MANS.
- my (%sections, %notrans_sections, %trans_sections,
- %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars);
- # We handle nodist_ for uniformity. man pages aren't distributed
- # by default so it isn't actually very important.
- foreach my $npfx ('', 'notrans_')
- {
- foreach my $pfx ('', 'dist_', 'nodist_')
- {
- # Add more sections as needed.
- foreach my $section ('0'..'9', 'n', 'l')
- {
- my $varname = $npfx . $pfx . 'man' . $section . '_MANS';
- if (var ($varname))
- {
- $sections{$section} = 1;
- $varname = '$(' . $varname . ')';
- if ($npfx eq 'notrans_')
- {
- $notrans_sections{$section} = 1;
- $notrans_sect_vars{$varname} = 1;
- }
- else
- {
- $trans_sections{$section} = 1;
- $trans_sect_vars{$varname} = 1;
- }
-
- push_dist_common ($varname)
- if $pfx eq 'dist_';
- }
- }
-
- my $varname = $npfx . $pfx . 'man_MANS';
- my $var = var ($varname);
- if ($var)
- {
- foreach ($var->value_as_list_recursive)
- {
- # A page like 'foo.1c' goes into man1dir.
- if (/\.([0-9a-z])([a-z]*)$/)
- {
- $sections{$1} = 1;
- if ($npfx eq 'notrans_')
- {
- $notrans_sections{$1} = 1;
- }
- else
- {
- $trans_sections{$1} = 1;
- }
- }
- }
-
- $varname = '$(' . $varname . ')';
- if ($npfx eq 'notrans_')
- {
- $notrans_vars{$varname} = 1;
- }
- else
- {
- $trans_vars{$varname} = 1;
- }
- push_dist_common ($varname)
- if $pfx eq 'dist_';
- }
- }
- }
-
- return unless %sections;
-
- my @unsorted_deps;
-
- # Build section independent variables.
- my $have_notrans = %notrans_vars;
- my @notrans_list = sort keys %notrans_vars;
- my $have_trans = %trans_vars;
- my @trans_list = sort keys %trans_vars;
-
- # Now for each section, generate an install and uninstall rule.
- # Sort sections so output is deterministic.
- foreach my $section (sort keys %sections)
- {
- # Build section dependent variables.
- my $notrans_mans = $have_notrans || exists $notrans_sections{$section};
- my $trans_mans = $have_trans || exists $trans_sections{$section};
- my (%notrans_this_sect, %trans_this_sect);
- my $expr = 'man' . $section . '_MANS';
- foreach my $varname (keys %notrans_sect_vars)
- {
- if ($varname =~ /$expr/)
- {
- $notrans_this_sect{$varname} = 1;
- }
- }
- foreach my $varname (keys %trans_sect_vars)
- {
- if ($varname =~ /$expr/)
- {
- $trans_this_sect{$varname} = 1;
- }
- }
- my @notrans_sect_list = sort keys %notrans_this_sect;
- my @trans_sect_list = sort keys %trans_this_sect;
- @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
- keys %notrans_this_sect, keys %trans_this_sect);
- my @deps = sort @unsorted_deps;
- $output_rules .= file_contents ('mans',
- new Automake::Location,
- SECTION => $section,
- DEPS => "@deps",
- NOTRANS_MANS => $notrans_mans,
- NOTRANS_SECT_LIST => "@notrans_sect_list",
- HAVE_NOTRANS => $have_notrans,
- NOTRANS_LIST => "@notrans_list",
- TRANS_MANS => $trans_mans,
- TRANS_SECT_LIST => "@trans_sect_list",
- HAVE_TRANS => $have_trans,
- TRANS_LIST => "@trans_list");
- }
-
- @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
- keys %notrans_sect_vars, keys %trans_sect_vars);
- my @mans = sort @unsorted_deps;
- $output_vars .= file_contents ('mans-vars',
- new Automake::Location,
- MANS => "@mans");
-
- push (@all, '$(MANS)')
- unless option 'no-installman';
-}
-
-
-sub handle_data ()
-{
- am_install_var ('-noextra', '-candist', 'data', 'DATA',
- 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
- 'ps', 'sysconf', 'sharedstate', 'localstate',
- 'pkgdata', 'lisp', 'noinst', 'check');
-}
-
-
-sub handle_tags ()
-{
- my @config;
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- foreach my $in (@ins)
- {
- # If the config header source is in this directory,
- # require it.
- push @config, basename ($in)
- if $relative_dir eq dirname ($in);
- }
- }
-
- define_variable ('am__tagged_files',
- '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)'
- . "@config", INTERNAL);
-
- if (rvar('am__tagged_files')->value_as_list_recursive
- || var ('ETAGS_ARGS') || var ('SUBDIRS'))
- {
- $output_rules .= file_contents ('tags', new Automake::Location);
- set_seen 'TAGS_DEPENDENCIES';
- }
- else
- {
- reject_var ('TAGS_DEPENDENCIES',
- "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
- . " without\nsources or 'ETAGS_ARGS'");
- # Every Makefile must define some sort of TAGS rule.
- # Otherwise, it would be possible for a top-level "make TAGS"
- # to fail because some subdirectory failed. Ditto ctags and
- # cscope.
- $output_rules .=
- "tags TAGS:\n\n" .
- "ctags CTAGS:\n\n" .
- "cscope cscopelist:\n\n";
- }
-}
-
-
-# user_phony_rule ($NAME)
-# -----------------------
-# Return false if rule $NAME does not exist. Otherwise,
-# declare it as phony, complete its definition (in case it is
-# conditional), and return its Automake::Rule instance.
-sub user_phony_rule
-{
- my ($name) = @_;
- my $rule = rule $name;
- if ($rule)
- {
- depend ('.PHONY', $name);
- # Define $NAME in all condition where it is not already defined,
- # so that it is always OK to depend on $NAME.
- for my $c ($rule->not_always_defined_in_cond (TRUE)->conds)
- {
- Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE,
- $c, INTERNAL);
- $output_rules .= $c->subst_string . "$name:\n";
- }
- }
- return $rule;
-}
-
-
-# Handle 'dist' target.
-sub handle_dist ()
-{
- # Substitutions for distdir.am
- my %transform;
-
- # Define DIST_SUBDIRS. This must always be done, regardless of the
- # no-dist setting: target like 'distclean' or 'maintainer-clean' use it.
- my $subdirs = var ('SUBDIRS');
- if ($subdirs)
- {
- # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
- # to all possible directories, and use it. If DIST_SUBDIRS is
- # defined, just use it.
-
- # Note that we check DIST_SUBDIRS first on purpose, so that
- # we don't call has_conditional_contents for now reason.
- # (In the past one project used so many conditional subdirectories
- # that calling has_conditional_contents on SUBDIRS caused
- # automake to grow to 150Mb -- this should not happen with
- # the current implementation of has_conditional_contents,
- # but it's more efficient to avoid the call anyway.)
- if (var ('DIST_SUBDIRS'))
- {
- }
- elsif ($subdirs->has_conditional_contents)
- {
- define_pretty_variable
- ('DIST_SUBDIRS', TRUE, INTERNAL,
- uniq ($subdirs->value_as_list_recursive));
- }
- else
- {
- # We always define this because that is what 'distclean'
- # wants.
- define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL,
- '$(SUBDIRS)');
- }
- }
-
- # The remaining definitions are only required when a dist target is used.
- return if option 'no-dist';
-
- # At least one of the archive formats must be enabled.
- if ($relative_dir eq '.')
- {
- my $archive_defined = option 'no-dist-gzip' ? 0 : 1;
- $archive_defined ||=
- grep { option "dist-$_" } qw(shar zip tarZ bzip2 lzip xz);
- error (option 'no-dist-gzip',
- "no-dist-gzip specified but no dist-* specified,\n"
- . "at least one archive format must be enabled")
- unless $archive_defined;
- }
-
- # Look for common files that should be included in distribution.
- # If the aux dir is set, and it does not have a Makefile.am, then
- # we check for these files there as well.
- my $check_aux = 0;
- if ($relative_dir eq '.'
- && $config_aux_dir_set_in_configure_ac)
- {
- if (! is_make_dir ($config_aux_dir))
- {
- $check_aux = 1;
- }
- }
- foreach my $cfile (@common_files)
- {
- if (dir_has_case_matching_file ($relative_dir, $cfile)
- # The file might be absent, but if it can be built it's ok.
- || rule $cfile)
- {
- push_dist_common ($cfile);
- }
-
- # Don't use 'elsif' here because a file might meaningfully
- # appear in both directories.
- if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile))
- {
- push_dist_common ("$config_aux_dir/$cfile")
- }
- }
-
- # We might copy elements from $configure_dist_common to
- # %dist_common if we think we need to. If the file appears in our
- # directory, we would have discovered it already, so we don't
- # check that. But if the file is in a subdir without a Makefile,
- # we want to distribute it here if we are doing '.'. Ugly!
- # Also, in some corner cases, it's possible that the following code
- # will cause the same file to appear in the $(DIST_COMMON) variables
- # of two distinct Makefiles; but this is not a problem, since the
- # 'distdir' target in 'lib/am/distdir.am' can deal with the same
- # file being distributed multiple times.
- # See also automake bug#9651.
- if ($relative_dir eq '.')
- {
- foreach my $file (split (' ' , $configure_dist_common))
- {
- my $dir = dirname ($file);
- push_dist_common ($file)
- if ($dir eq '.' || ! is_make_dir ($dir));
- }
- }
-
- # Files to distributed. Don't use ->value_as_list_recursive
- # as it recursively expands '$(dist_pkgdata_DATA)' etc.
- my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
- @dist_common = uniq (@dist_common);
- variable_delete 'DIST_COMMON';
- define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
-
- # Now that we've processed DIST_COMMON, disallow further attempts
- # to set it.
- $handle_dist_run = 1;
-
- $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook';
- $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external;
-
- # If the target 'dist-hook' exists, make sure it is run. This
- # allows users to do random weird things to the distribution
- # before it is packaged up.
- push (@dist_targets, 'dist-hook')
- if user_phony_rule 'dist-hook';
- $transform{'DIST-TARGETS'} = join (' ', @dist_targets);
-
- my $flm = option ('filename-length-max');
- my $filename_filter = $flm ? '.' x $flm->[1] : '';
-
- $output_rules .= file_contents ('distdir',
- new Automake::Location,
- %transform,
- FILENAME_FILTER => $filename_filter);
-}
-
-
-# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."])
-# -------------------------------------------------------
-# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane
-# name. Use $WHERE as a location in the diagnostic, if any.
-sub check_directory
-{
- my ($dir, $where, $reldir) = @_;
- $reldir = '.' unless defined $reldir;
-
- error $where, "required directory $reldir/$dir does not exist"
- unless -d "$reldir/$dir";
-
- # If an 'obj/' directory exists, BSD make will enter it before
- # reading 'Makefile'. Hence the 'Makefile' in the current directory
- # will not be read.
- #
- # % cat Makefile
- # all:
- # echo Hello
- # % cat obj/Makefile
- # all:
- # echo World
- # % make # GNU make
- # echo Hello
- # Hello
- # % pmake # BSD make
- # echo World
- # World
- msg ('portability', $where,
- "naming a subdirectory 'obj' causes troubles with BSD make")
- if $dir eq 'obj';
-
- # 'aux' is probably the most important of the following forbidden name,
- # since it's tempting to use it as an AC_CONFIG_AUX_DIR.
- msg ('portability', $where,
- "name '$dir' is reserved on W32 and DOS platforms")
- if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/);
-}
-
-# check_directories_in_var ($VARIABLE)
-# ------------------------------------
-# Recursively check all items in variables $VARIABLE as directories
-sub check_directories_in_var
-{
- my ($var) = @_;
- $var->traverse_recursively
- (sub
- {
- my ($var, $val, $cond, $full_cond) = @_;
- check_directory ($val, $var->rdef ($cond)->location, $relative_dir);
- return ();
- },
- undef,
- skip_ac_subst => 1);
-}
-
-
-sub handle_subdirs ()
-{
- my $subdirs = var ('SUBDIRS');
- return
- unless $subdirs;
-
- check_directories_in_var $subdirs;
-
- my $dsubdirs = var ('DIST_SUBDIRS');
- check_directories_in_var $dsubdirs
- if $dsubdirs;
-
- $output_rules .= file_contents ('subdirs', new Automake::Location);
- rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
-}
-
-
-# ($REGEN, @DEPENDENCIES)
-# scan_aclocal_m4
-# ---------------
-# If aclocal.m4 creation is automated, return the list of its dependencies.
-sub scan_aclocal_m4 ()
-{
- my $regen_aclocal = 0;
-
- set_seen 'CONFIG_STATUS_DEPENDENCIES';
- set_seen 'CONFIGURE_DEPENDENCIES';
-
- if (-f 'aclocal.m4')
- {
- define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
-
- my $aclocal = new Automake::XFile "< aclocal.m4";
- my $line = $aclocal->getline;
- $regen_aclocal = $line =~ 'generated automatically by aclocal';
- }
-
- my @ac_deps = ();
-
- if (set_seen ('ACLOCAL_M4_SOURCES'))
- {
- push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
- msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
- "'ACLOCAL_M4_SOURCES' is obsolete.\n"
- . "It should be safe to simply remove it");
- }
-
- # Note that it might be possible that aclocal.m4 doesn't exist but
- # should be auto-generated. This case probably isn't very
- # important.
-
- return ($regen_aclocal, @ac_deps);
-}
-
-
-# Helper function for 'substitute_ac_subst_variables'.
-sub substitute_ac_subst_variables_worker
-{
- my ($token) = @_;
- return "\@$token\@" if var $token;
- return "\${$token\}";
-}
-
-# substitute_ac_subst_variables ($TEXT)
-# -------------------------------------
-# Replace any occurrence of ${FOO} in $TEXT by @FOO@ if FOO is an AC_SUBST
-# variable.
-sub substitute_ac_subst_variables
-{
- my ($text) = @_;
- $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
- return $text;
-}
-
-# @DEPENDENCIES
-# prepend_srcdir (@INPUTS)
-# ------------------------
-# Prepend $(srcdir) or $(top_srcdir) to all @INPUTS. The idea is that
-# if an input file has a directory part the same as the current
-# directory, then the directory part is simply replaced by $(srcdir).
-# But if the directory part is different, then $(top_srcdir) is
-# prepended.
-sub prepend_srcdir
-{
- my (@inputs) = @_;
- my @newinputs;
-
- foreach my $single (@inputs)
- {
- if (dirname ($single) eq $relative_dir)
- {
- push (@newinputs, '$(srcdir)/' . basename ($single));
- }
- else
- {
- push (@newinputs, '$(top_srcdir)/' . $single);
- }
- }
- return @newinputs;
-}
-
-# @DEPENDENCIES
-# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS)
-# ---------------------------------------------------
-# Compute a list of dependencies appropriate for the rebuild
-# rule of
-# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...)
-# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs.
-sub rewrite_inputs_into_dependencies
-{
- my ($file, @inputs) = @_;
- my @res = ();
-
- for my $i (@inputs)
- {
- # We cannot create dependencies on shell variables.
- next if (substitute_ac_subst_variables $i) =~ /\$/;
-
- if (exists $ac_config_files_location{$i} && $i ne $file)
- {
- my $di = dirname $i;
- if ($di eq $relative_dir)
- {
- $i = basename $i;
- }
- # In the top-level Makefile we do not use $(top_builddir), because
- # we are already there, and since the targets are built without
- # a $(top_builddir), it helps BSD Make to match them with
- # dependencies.
- elsif ($relative_dir ne '.')
- {
- $i = '$(top_builddir)/' . $i;
- }
- }
- else
- {
- msg ('error', $ac_config_files_location{$file},
- "required file '$i' not found")
- unless $i =~ /\$/ || exists $output_files{$i} || -f $i;
- ($i) = prepend_srcdir ($i);
- push_dist_common ($i);
- }
- push @res, $i;
- }
- return @res;
-}
-
-
-
-# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
-# -----------------------------------------------------------------
-# Handle remaking and configure stuff.
-# We need the name of the input file, to do proper remaking rules.
-sub handle_configure
-{
- my ($makefile_am, $makefile_in, $makefile, @inputs) = @_;
-
- prog_error 'empty @inputs'
- unless @inputs;
-
- my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am,
- $makefile_in);
- my $rel_makefile = basename $makefile;
-
- my $colon_infile = ':' . join (':', @inputs);
- $colon_infile = '' if $colon_infile eq ":$makefile.in";
- my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs);
- my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4;
- define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL,
- @configure_deps, @aclocal_m4_deps,
- '$(top_srcdir)/' . $configure_ac);
- my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)');
- push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4';
- define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
- @configuredeps);
-
- my $automake_options = '--' . $strictness_name .
- (global_option 'no-dependencies' ? ' --ignore-deps' : '');
-
- $output_rules .= file_contents
- ('configure',
- new Automake::Location,
- MAKEFILE => $rel_makefile,
- 'MAKEFILE-DEPS' => "@rewritten",
- 'CONFIG-MAKEFILE' => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@',
- 'MAKEFILE-IN' => $rel_makefile_in,
- 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0),
- 'MAKEFILE-IN-DEPS' => "@include_stack",
- 'MAKEFILE-AM' => $rel_makefile_am,
- 'AUTOMAKE-OPTIONS' => $automake_options,
- 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile",
- 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4,
- VERBOSE => verbose_flag ('GEN'));
-
- if ($relative_dir eq '.')
- {
- push_dist_common ('acconfig.h')
- if -f 'acconfig.h';
- }
-
- # If we have a configure header, require it.
- my $hdr_index = 0;
- my @distclean_config;
- foreach my $spec (@config_headers)
- {
- $hdr_index += 1;
- # $CONFIG_H_PATH: config.h from top level.
- my ($config_h_path, @ins) = split_config_file_spec ($spec);
- my $config_h_dir = dirname ($config_h_path);
-
- # If the header is in the current directory we want to build
- # the header here. Otherwise, if we're at the topmost
- # directory and the header's directory doesn't have a
- # Makefile, then we also want to build the header.
- if ($relative_dir eq $config_h_dir
- || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir)))
- {
- my ($cn_sans_dir, $stamp_dir);
- if ($relative_dir eq $config_h_dir)
- {
- $cn_sans_dir = basename ($config_h_path);
- $stamp_dir = '';
- }
- else
- {
- $cn_sans_dir = $config_h_path;
- if ($config_h_dir eq '.')
- {
- $stamp_dir = '';
- }
- else
- {
- $stamp_dir = $config_h_dir . '/';
- }
- }
-
- # This will also distribute all inputs.
- @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins);
-
- # Cannot define rebuild rules for filenames with shell variables.
- next if (substitute_ac_subst_variables $config_h_path) =~ /\$/;
-
- # Header defined in this directory.
- my @files;
- if (-f $config_h_path . '.top')
- {
- push (@files, "$cn_sans_dir.top");
- }
- if (-f $config_h_path . '.bot')
- {
- push (@files, "$cn_sans_dir.bot");
- }
-
- push_dist_common (@files);
-
- # For now, acconfig.h can only appear in the top srcdir.
- if (-f 'acconfig.h')
- {
- push (@files, '$(top_srcdir)/acconfig.h');
- }
-
- my $stamp = "${stamp_dir}stamp-h${hdr_index}";
- $output_rules .=
- file_contents ('remake-hdr',
- new Automake::Location,
- FILES => "@files",
- 'FIRST-HDR' => ($hdr_index == 1),
- CONFIG_H => $cn_sans_dir,
- CONFIG_HIN => $ins[0],
- CONFIG_H_DEPS => "@ins",
- CONFIG_H_PATH => $config_h_path,
- STAMP => "$stamp");
-
- push @distclean_config, $cn_sans_dir, $stamp;
- }
- }
-
- $output_rules .= file_contents ('clean-hdr',
- new Automake::Location,
- FILES => "@distclean_config")
- if @distclean_config;
-
- # Distribute and define mkinstalldirs only if it is already present
- # in the package, for backward compatibility (some people may still
- # use $(mkinstalldirs)).
- # TODO: start warning about this in Automake 1.14, and have
- # TODO: Automake 2.0 drop it (and the mkinstalldirs script
- # TODO: as well).
- my $mkidpath = "$config_aux_dir/mkinstalldirs";
- if (-f $mkidpath)
- {
- # Use require_file so that any existing script gets updated
- # by --force-missing.
- require_conf_file ($mkidpath, FOREIGN, 'mkinstalldirs');
- define_variable ('mkinstalldirs',
- "\$(SHELL) $am_config_aux_dir/mkinstalldirs", INTERNAL);
- }
- else
- {
- # Use $(install_sh), not $(MKDIR_P) because the latter requires
- # at least one argument, and $(mkinstalldirs) used to work
- # even without arguments (e.g. $(mkinstalldirs) $(conditional_dir)).
- define_variable ('mkinstalldirs', '$(install_sh) -d', INTERNAL);
- }
-
- reject_var ('CONFIG_HEADER',
- "'CONFIG_HEADER' is an anachronism; now determined "
- . "automatically\nfrom '$configure_ac'");
-
- my @config_h;
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- # Generate CONFIG_HEADER define.
- if ($relative_dir eq dirname ($out))
- {
- push @config_h, basename ($out);
- }
- else
- {
- push @config_h, "\$(top_builddir)/$out";
- }
- }
- define_variable ("CONFIG_HEADER", "@config_h", INTERNAL)
- if @config_h;
-
- # Now look for other files in this directory which must be remade
- # by config.status, and generate rules for them.
- my @actual_other_files = ();
- # These get cleaned only in a VPATH build.
- my @actual_other_vpath_files = ();
- foreach my $lfile (@other_input_files)
- {
- my $file;
- my @inputs;
- if ($lfile =~ /^([^:]*):(.*)$/)
- {
- # This is the ":" syntax of AC_OUTPUT.
- $file = $1;
- @inputs = split (':', $2);
- }
- else
- {
- # Normal usage.
- $file = $lfile;
- @inputs = $file . '.in';
- }
-
- # Automake files should not be stored in here, but in %MAKE_LIST.
- prog_error ("$lfile in \@other_input_files\n"
- . "\@other_input_files = (@other_input_files)")
- if -f $file . '.am';
-
- my $local = basename ($file);
-
- # We skip files that aren't in this directory. However, if
- # the file's directory does not have a Makefile, and we are
- # currently doing '.', then we create a rule to rebuild the
- # file in the subdir.
- my $fd = dirname ($file);
- if ($fd ne $relative_dir)
- {
- if ($relative_dir eq '.' && ! is_make_dir ($fd))
- {
- $local = $file;
- }
- else
- {
- next;
- }
- }
-
- my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs);
-
- # Cannot output rules for shell variables.
- next if (substitute_ac_subst_variables $local) =~ /\$/;
-
- my $condstr = '';
- my $cond = $ac_config_files_condition{$lfile};
- if (defined $cond)
- {
- $condstr = $cond->subst_string;
- Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond,
- $ac_config_files_location{$file});
- }
- $output_rules .= ($condstr . $local . ': '
- . '$(top_builddir)/config.status '
- . "@rewritten_inputs\n"
- . $condstr . "\t"
- . 'cd $(top_builddir) && '
- . '$(SHELL) ./config.status '
- . ($relative_dir eq '.' ? '' : '$(subdir)/')
- . '$@'
- . "\n");
- push (@actual_other_files, $local);
- }
-
- # For links we should clean destinations and distribute sources.
- foreach my $spec (@config_links)
- {
- my ($link, $file) = split /:/, $spec;
- # Some people do AC_CONFIG_LINKS($computed). We only handle
- # the DEST:SRC form.
- next unless $file;
- my $where = $ac_config_files_location{$link};
-
- # Skip destinations that contain shell variables.
- if ((substitute_ac_subst_variables $link) !~ /\$/)
- {
- # We skip links that aren't in this directory. However, if
- # the link's directory does not have a Makefile, and we are
- # currently doing '.', then we add the link to CONFIG_CLEAN_FILES
- # in '.'s Makefile.in.
- my $local = basename ($link);
- my $fd = dirname ($link);
- if ($fd ne $relative_dir)
- {
- if ($relative_dir eq '.' && ! is_make_dir ($fd))
- {
- $local = $link;
- }
- else
- {
- $local = undef;
- }
- }
- if ($file ne $link)
- {
- push @actual_other_files, $local if $local;
- }
- else
- {
- push @actual_other_vpath_files, $local if $local;
- }
- }
-
- # Do not process sources that contain shell variables.
- if ((substitute_ac_subst_variables $file) !~ /\$/)
- {
- my $fd = dirname ($file);
-
- # We distribute files that are in this directory.
- # At the top-level ('.') we also distribute files whose
- # directory does not have a Makefile.
- if (($fd eq $relative_dir)
- || ($relative_dir eq '.' && ! is_make_dir ($fd)))
- {
- # The following will distribute $file as a side-effect when
- # it is appropriate (i.e., when $file is not already an output).
- # We do not need the result, just the side-effect.
- rewrite_inputs_into_dependencies ($link, $file);
- }
- }
- }
-
- # These files get removed by "make distclean".
- define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL,
- @actual_other_files);
- define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL,
- @actual_other_vpath_files);
-}
-
-sub handle_headers ()
-{
- my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
- 'oldinclude', 'pkginclude',
- 'noinst', 'check');
- foreach (@r)
- {
- next unless $_->[1] =~ /\..*$/;
- saw_extension ($&);
- }
-}
-
-sub handle_gettext ()
-{
- return if ! $seen_gettext || $relative_dir ne '.';
-
- my $subdirs = var 'SUBDIRS';
-
- if (! $subdirs)
- {
- err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined";
- return;
- }
-
- # Perform some sanity checks to help users get the right setup.
- # We disable these tests when po/ doesn't exist in order not to disallow
- # unusual gettext setups.
- #
- # Bruno Haible:
- # | The idea is:
- # |
- # | 1) If a package doesn't have a directory po/ at top level, it
- # | will likely have multiple po/ directories in subpackages.
- # |
- # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT
- # | is used without 'external'. It is also useful to warn for the
- # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both
- # | warnings apply only to the usual layout of packages, therefore
- # | they should both be disabled if no po/ directory is found at
- # | top level.
-
- if (-d 'po')
- {
- my @subdirs = $subdirs->value_as_list_recursive;
-
- msg_var ('syntax', $subdirs,
- "AM_GNU_GETTEXT used but 'po' not in SUBDIRS")
- if ! grep ($_ eq 'po', @subdirs);
-
- # intl/ is not required when AM_GNU_GETTEXT is called with the
- # 'external' option and AM_GNU_GETTEXT_INTL_SUBDIR is not called.
- msg_var ('syntax', $subdirs,
- "AM_GNU_GETTEXT used but 'intl' not in SUBDIRS")
- if (! ($seen_gettext_external && ! $seen_gettext_intl)
- && ! grep ($_ eq 'intl', @subdirs));
-
- # intl/ should not be used with AM_GNU_GETTEXT([external]), except
- # if AM_GNU_GETTEXT_INTL_SUBDIR is called.
- msg_var ('syntax', $subdirs,
- "'intl' should not be in SUBDIRS when "
- . "AM_GNU_GETTEXT([external]) is used")
- if ($seen_gettext_external && ! $seen_gettext_intl
- && grep ($_ eq 'intl', @subdirs));
- }
-
- require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
-}
-
-# Emit makefile footer.
-sub handle_footer ()
-{
- reject_rule ('.SUFFIXES',
- "use variable 'SUFFIXES', not target '.SUFFIXES'");
-
- # Note: AIX 4.1 /bin/make will fail if any suffix rule appears
- # before .SUFFIXES. So we make sure that .SUFFIXES appears before
- # anything else, by sticking it right after the default: target.
- $output_header .= ".SUFFIXES:\n";
- my $suffixes = var 'SUFFIXES';
- my @suffixes = Automake::Rule::suffixes;
- if (@suffixes || $suffixes)
- {
- # Make sure SUFFIXES has unique elements. Sort them to ensure
- # the output remains consistent. However, $(SUFFIXES) is
- # always at the start of the list, unsorted. This is done
- # because make will choose rules depending on the ordering of
- # suffixes, and this lets the user have some control. Push
- # actual suffixes, and not $(SUFFIXES). Some versions of make
- # do not like variable substitutions on the .SUFFIXES line.
- my @user_suffixes = ($suffixes
- ? $suffixes->value_as_list_recursive : ());
-
- my %suffixes = map { $_ => 1 } @suffixes;
- delete @suffixes{@user_suffixes};
-
- $output_header .= (".SUFFIXES: "
- . join (' ', @user_suffixes, sort keys %suffixes)
- . "\n");
- }
-
- $output_trailer .= file_contents ('footer', new Automake::Location);
-}
-
-
-# Generate 'make install' rules.
-sub handle_install ()
-{
- $output_rules .= file_contents
- ('install',
- new Automake::Location,
- maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
- ? (" \$(BUILT_SOURCES)\n"
- . "\t\$(MAKE) \$(AM_MAKEFLAGS)")
- : ''),
- 'installdirs-local' => (user_phony_rule ('installdirs-local')
- ? ' installdirs-local' : ''),
- am__installdirs => variable_value ('am__installdirs') || '');
-}
-
-
-# handle_all ($MAKEFILE)
-#-----------------------
-# Deal with 'all' and 'all-am'.
-sub handle_all
-{
- my ($makefile) = @_;
-
- # Output 'all-am'.
-
- # Put this at the beginning for the sake of non-GNU makes. This
- # is still wrong if these makes can run parallel jobs. But it is
- # right enough.
- unshift (@all, basename ($makefile));
-
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- push (@all, basename ($out))
- if dirname ($out) eq $relative_dir;
- }
-
- # Install 'all' hooks.
- push (@all, "all-local")
- if user_phony_rule "all-local";
-
- pretty_print_rule ("all-am:", "\t\t", @all);
- depend ('.PHONY', 'all-am', 'all');
-
-
- # Output 'all'.
-
- my @local_headers = ();
- push @local_headers, '$(BUILT_SOURCES)'
- if var ('BUILT_SOURCES');
- foreach my $spec (@config_headers)
- {
- my ($out, @ins) = split_config_file_spec ($spec);
- push @local_headers, basename ($out)
- if dirname ($out) eq $relative_dir;
- }
-
- if (@local_headers)
- {
- # We need to make sure config.h is built before we recurse.
- # We also want to make sure that built sources are built
- # before any ordinary 'all' targets are run. We can't do this
- # by changing the order of dependencies to the "all" because
- # that breaks when using parallel makes. Instead we handle
- # things explicitly.
- $output_all .= ("all: @local_headers"
- . "\n\t"
- . '$(MAKE) $(AM_MAKEFLAGS) '
- . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
- . "\n\n");
- depend ('.MAKE', 'all');
- }
- else
- {
- $output_all .= "all: " . (var ('SUBDIRS')
- ? 'all-recursive' : 'all-am') . "\n\n";
- }
-}
-
-# Generate helper targets for user-defined recursive targets, where needed.
-sub handle_user_recursion ()
-{
- return unless @extra_recursive_targets;
-
- define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL,
- map { "$_-recursive" } @extra_recursive_targets);
- my $aux = var ('SUBDIRS') ? 'recursive' : 'am';
- foreach my $target (@extra_recursive_targets)
- {
- # This allows the default target's rules to be overridden in
- # Makefile.am.
- user_phony_rule ($target);
- depend ("$target", "$target-$aux");
- depend ("$target-am", "$target-local");
- # Every user-defined recursive target 'foo' *must* have a valid
- # associated 'foo-local' rule; we define it as an empty rule by
- # default, so that the user can transparently extend it in his
- # own Makefile.am.
- pretty_print_rule ("$target-local:", '', '');
- # $target-recursive might as well be undefined, so do not add
- # it here; it's taken care of in subdirs.am anyway.
- depend (".PHONY", "$target-am", "$target-local");
- }
-}
-
-
-# Handle check merge target specially.
-sub do_check_merge_target ()
-{
- # Include user-defined local form of target.
- push @check_tests, 'check-local'
- if user_phony_rule 'check-local';
-
- # The check target must depend on the local equivalent of
- # 'all', to ensure all the primary targets are built. Then it
- # must build the local check rules.
- $output_rules .= "check-am: all-am\n";
- if (@check)
- {
- pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check);
- depend ('.MAKE', 'check-am');
- }
-
- if (@check_tests)
- {
- pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
- @check_tests);
- depend ('.MAKE', 'check-am');
- }
-
- depend '.PHONY', 'check', 'check-am';
- # Handle recursion. We have to honor BUILT_SOURCES like for 'all:'.
- $output_rules .= ("check: "
- . (var ('BUILT_SOURCES')
- ? "\$(BUILT_SOURCES)\n\t\$(MAKE) \$(AM_MAKEFLAGS) "
- : '')
- . (var ('SUBDIRS') ? 'check-recursive' : 'check-am')
- . "\n");
- depend ('.MAKE', 'check')
- if var ('BUILT_SOURCES');
-}
-
-# Handle all 'clean' targets.
-sub handle_clean
-{
- my ($makefile) = @_;
-
- # Clean the files listed in user variables if they exist.
- $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN
- if var ('MOSTLYCLEANFILES');
- $clean_files{'$(CLEANFILES)'} = CLEAN
- if var ('CLEANFILES');
- $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN
- if var ('DISTCLEANFILES');
- $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN
- if var ('MAINTAINERCLEANFILES');
-
- # Built sources are automatically removed by maintainer-clean.
- $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN
- if var ('BUILT_SOURCES');
-
- # Compute a list of "rm"s to run for each target.
- my %rms = (MOSTLY_CLEAN, [],
- CLEAN, [],
- DIST_CLEAN, [],
- MAINTAINER_CLEAN, []);
-
- foreach my $file (keys %clean_files)
- {
- my $when = $clean_files{$file};
- prog_error 'invalid entry in %clean_files'
- unless exists $rms{$when};
-
- my $rm = "rm -f $file";
- # If file is a variable, make sure when don't call 'rm -f' without args.
- $rm ="test -z \"$file\" || $rm"
- if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/);
-
- push @{$rms{$when}}, "\t-$rm\n";
- }
-
- $output_rules .= file_contents
- ('clean',
- new Automake::Location,
- MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}),
- CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}),
- DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}),
- MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}),
- MAKEFILE => basename $makefile,
- );
-}
-
-
-# Subroutine for handle_factored_dependencies() to let '.PHONY' and
-# other '.TARGETS' be last. This is meant to be used as a comparison
-# subroutine passed to the sort built-int.
-sub target_cmp
-{
- return 0 if $a eq $b;
-
- my $a1 = substr ($a, 0, 1);
- my $b1 = substr ($b, 0, 1);
- if ($a1 ne $b1)
- {
- return -1 if $b1 eq '.';
- return 1 if $a1 eq '.';
- }
- return $a cmp $b;
-}
-
-
-# Handle everything related to gathered targets.
-sub handle_factored_dependencies ()
-{
- # Reject bad hooks.
- foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook',
- 'uninstall-exec-local', 'uninstall-exec-hook',
- 'uninstall-dvi-local',
- 'uninstall-html-local',
- 'uninstall-info-local',
- 'uninstall-pdf-local',
- 'uninstall-ps-local')
- {
- my $x = $utarg;
- $x =~ s/-.*-/-/;
- reject_rule ($utarg, "use '$x', not '$utarg'");
- }
-
- reject_rule ('install-local',
- "use 'install-data-local' or 'install-exec-local', "
- . "not 'install-local'");
-
- reject_rule ('install-hook',
- "use 'install-data-hook' or 'install-exec-hook', "
- . "not 'install-hook'");
-
- # Install the -local hooks.
- foreach (keys %dependencies)
- {
- # Hooks are installed on the -am targets.
- s/-am$// or next;
- depend ("$_-am", "$_-local")
- if user_phony_rule "$_-local";
- }
-
- # Install the -hook hooks.
- # FIXME: Why not be as liberal as we are with -local hooks?
- foreach ('install-exec', 'install-data', 'uninstall')
- {
- if (user_phony_rule "$_-hook")
- {
- depend ('.MAKE', "$_-am");
- register_action("$_-am",
- ("\t\@\$(NORMAL_INSTALL)\n"
- . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook"));
- }
- }
-
- # All the required targets are phony.
- depend ('.PHONY', keys %required_targets);
-
- # Actually output gathered targets.
- foreach (sort target_cmp keys %dependencies)
- {
- # If there is nothing about this guy, skip it.
- next
- unless (@{$dependencies{$_}}
- || $actions{$_}
- || $required_targets{$_});
-
- # Define gathered targets in undefined conditions.
- # FIXME: Right now we must handle .PHONY as an exception,
- # because people write things like
- # .PHONY: myphonytarget
- # to append dependencies. This would not work if Automake
- # refrained from defining its own .PHONY target as it does
- # with other overridden targets.
- # Likewise for '.MAKE'.
- my @undefined_conds = (TRUE,);
- if ($_ ne '.PHONY' && $_ ne '.MAKE')
- {
- @undefined_conds =
- Automake::Rule::define ($_, 'internal',
- RULE_AUTOMAKE, TRUE, INTERNAL);
- }
- my @uniq_deps = uniq (sort @{$dependencies{$_}});
- foreach my $cond (@undefined_conds)
- {
- my $condstr = $cond->subst_string;
- pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
- $output_rules .= $actions{$_} if defined $actions{$_};
- $output_rules .= "\n";
- }
- }
-}
-
-
-sub handle_tests_dejagnu ()
-{
- push (@check_tests, 'check-DEJAGNU');
- $output_rules .= file_contents ('dejagnu', new Automake::Location);
-}
-
-# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM])
-#----------------------------------------------------
-sub handle_per_suffix_test
-{
- my ($test_suffix, %transform) = @_;
- my ($pfx, $generic, $am_exeext);
- if ($test_suffix eq '')
- {
- $pfx = '';
- $generic = 0;
- $am_exeext = 'FALSE';
- }
- else
- {
- prog_error ("test suffix '$test_suffix' lacks leading dot")
- unless $test_suffix =~ m/^\.(.*)/;
- $pfx = uc ($1) . '_';
- $generic = 1;
- $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
- : 'FALSE';
- }
- # The "test driver" program, deputed to handle tests protocol used by
- # test scripts. By default, it's assumed that no protocol is used, so
- # we fall back to the old behaviour, implemented by the 'test-driver'
- # auxiliary script.
- if (! var "${pfx}LOG_DRIVER")
- {
- require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
- define_variable ("${pfx}LOG_DRIVER",
- "\$(SHELL) $am_config_aux_dir/test-driver",
- INTERNAL);
- }
- my $driver = '$(' . $pfx . 'LOG_DRIVER)';
- my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
- . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
- my $compile = "${pfx}LOG_COMPILE";
- define_variable ($compile,
- '$(' . $pfx . 'LOG_COMPILER)'
- . ' $(AM_' . $pfx . 'LOG_FLAGS)'
- . ' $(' . $pfx . 'LOG_FLAGS)',
- INTERNAL);
- $output_rules .= file_contents ('check2', new Automake::Location,
- GENERIC => $generic,
- DRIVER => $driver,
- DRIVER_FLAGS => $driver_flags,
- COMPILE => '$(' . $compile . ')',
- EXT => $test_suffix,
- am__EXEEXT => $am_exeext,
- %transform);
-}
-
-# is_valid_test_extension ($EXT)
-# ------------------------------
-# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
-# otherwise.
-sub is_valid_test_extension
-{
- my $ext = shift;
- return 1
- if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/);
- return 1
- if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT'));
- return 0;
-}
-
-
-sub handle_tests ()
-{
- if (option 'dejagnu')
- {
- handle_tests_dejagnu;
- }
- else
- {
- foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS')
- {
- reject_var ($c, "'$c' defined but 'dejagnu' not in "
- . "'AUTOMAKE_OPTIONS'");
- }
- }
-
- if (var ('TESTS'))
- {
- push (@check_tests, 'check-TESTS');
- my $check_deps = "@check";
- $output_rules .= file_contents ('check', new Automake::Location,
- SERIAL_TESTS => !! option 'serial-tests',
- CHECK_DEPS => $check_deps);
-
- # Tests that are known programs should have $(EXEEXT) appended.
- # For matching purposes, we need to adjust XFAIL_TESTS as well.
- append_exeext { exists $known_programs{$_[0]} } 'TESTS';
- append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
- if (var ('XFAIL_TESTS'));
-
- if (! option 'serial-tests')
- {
- define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
- my $suff = '.test';
- my $at_exeext = '';
- my $handle_exeext = exists $configure_vars{'EXEEXT'};
- if ($handle_exeext)
- {
- $at_exeext = subst ('EXEEXT');
- $suff = $at_exeext . ' ' . $suff;
- }
- if (! var 'TEST_EXTENSIONS')
- {
- define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
- }
- my $var = var 'TEST_EXTENSIONS';
- # Currently, we are not able to deal with conditional contents
- # in TEST_EXTENSIONS.
- if ($var->has_conditional_contents)
- {
- msg_var 'unsupported', $var,
- "'TEST_EXTENSIONS' cannot have conditional contents";
- }
- my @test_suffixes = $var->value_as_list_recursive;
- if ((my @invalid_test_suffixes =
- grep { !is_valid_test_extension $_ } @test_suffixes) > 0)
- {
- error $var->rdef (TRUE)->location,
- "invalid test extensions: @invalid_test_suffixes";
- }
- @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
- if ($handle_exeext)
- {
- unshift (@test_suffixes, $at_exeext)
- unless $test_suffixes[0] eq $at_exeext;
- }
- unshift (@test_suffixes, '');
-
- transform_variable_recursively
- ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL,
- sub {
- my ($subvar, $val, $cond, $full_cond) = @_;
- my $obj = $val;
- return $obj
- if $val =~ /^\@.*\@$/;
- $obj =~ s/\$\(EXEEXT\)$//o;
-
- if ($val =~ /(\$\((top_)?srcdir\))\//o)
- {
- msg ('error', $subvar->rdef ($cond)->location,
- "using '$1' in TESTS is currently broken: '$val'");
- }
-
- foreach my $test_suffix (@test_suffixes)
- {
- next
- if $test_suffix eq $at_exeext || $test_suffix eq '';
- return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
- if substr ($obj, - length ($test_suffix)) eq $test_suffix;
- }
- my $base = $obj;
- $obj .= '.log';
- handle_per_suffix_test ('',
- OBJ => $obj,
- BASE => $base,
- SOURCE => $val);
- return $obj;
- });
-
- my $nhelper=1;
- my $prev = 'TESTS';
- my $post = '';
- my $last_suffix = $test_suffixes[$#test_suffixes];
- my $cur = '';
- foreach my $test_suffix (@test_suffixes)
- {
- if ($test_suffix eq $last_suffix)
- {
- $cur = 'TEST_LOGS';
- }
- else
- {
- $cur = 'am__test_logs' . $nhelper;
- }
- define_variable ($cur,
- '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL);
- $post = '.log';
- $prev = $cur;
- $nhelper++;
- if ($test_suffix ne $at_exeext && $test_suffix ne '')
- {
- handle_per_suffix_test ($test_suffix,
- OBJ => '',
- BASE => '$*',
- SOURCE => '$<');
- }
- }
- $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
- $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
- $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
- }
- }
-}
-
-sub handle_emacs_lisp ()
-{
- my @elfiles = am_install_var ('-candist', 'lisp', 'LISP',
- 'lisp', 'noinst');
-
- return if ! @elfiles;
-
- define_pretty_variable ('am__ELFILES', TRUE, INTERNAL,
- map { $_->[1] } @elfiles);
- define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL,
- '$(am__ELFILES:.el=.elc)');
- # This one can be overridden by users.
- define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)');
-
- push @all, '$(ELCFILES)';
-
- require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE,
- 'EMACS', 'lispdir');
-}
-
-sub handle_python ()
-{
- my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON',
- 'noinst');
- return if ! @pyfiles;
-
- require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
- require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
- define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
-}
-
-sub handle_java ()
-{
- my @sourcelist = am_install_var ('-candist',
- 'java', 'JAVA',
- 'noinst', 'check');
- return if ! @sourcelist;
-
- my @prefixes = am_primary_prefixes ('JAVA', 1,
- 'noinst', 'check');
-
- my $dir;
- my @java_sources = ();
- foreach my $prefix (@prefixes)
- {
- (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//;
-
- next
- if $curs eq 'EXTRA';
-
- push @java_sources, '$(' . $prefix . '_JAVA' . ')';
-
- if (defined $dir)
- {
- err_var "${curs}_JAVA", "multiple _JAVA primaries in use"
- unless $curs eq $dir;
- }
-
- $dir = $curs;
- }
-
- define_pretty_variable ('am__java_sources', TRUE, INTERNAL,
- "@java_sources");
-
- if ($dir eq 'check')
- {
- push (@check, "class$dir.stamp");
- }
- else
- {
- push (@all, "class$dir.stamp");
- }
-}
-
-
-sub handle_minor_options ()
-{
- if (option 'readme-alpha')
- {
- if ($relative_dir eq '.')
- {
- if ($package_version !~ /^$GNITS_VERSION_PATTERN$/)
- {
- msg ('error-gnits', $package_version_location,
- "version '$package_version' doesn't follow " .
- "Gnits standards");
- }
- if (defined $1 && -f 'README-alpha')
- {
- # This means we have an alpha release. See
- # GNITS_VERSION_PATTERN for details.
- push_dist_common ('README-alpha');
- }
- }
- }
-}
-
-################################################################
-
-# ($OUTPUT, @INPUTS)
-# split_config_file_spec ($SPEC)
-# ------------------------------
-# Decode the Autoconf syntax for config files (files, headers, links
-# etc.).
-sub split_config_file_spec
-{
- my ($spec) = @_;
- my ($output, @inputs) = split (/:/, $spec);
-
- push @inputs, "$output.in"
- unless @inputs;
-
- return ($output, @inputs);
-}
-
-# $input
-# locate_am (@POSSIBLE_SOURCES)
-# -----------------------------
-# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in
-# This functions returns the first *.in file for which a *.am exists.
-# It returns undef otherwise.
-sub locate_am
-{
- my (@rest) = @_;
- my $input;
- foreach my $file (@rest)
- {
- if (($file =~ /^(.*)\.in$/) && -f "$1.am")
- {
- $input = $file;
- last;
- }
- }
- return $input;
-}
-
-my %make_list;
-
-# scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
-# --------------------------------------------------
-# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
-# (or AC_OUTPUT).
-sub scan_autoconf_config_files
-{
- my ($where, $config_files) = @_;
-
- # Look at potential Makefile.am's.
- foreach (split ' ', $config_files)
- {
- # Must skip empty string for Perl 4.
- next if $_ eq "\\" || $_ eq '';
-
- # Handle $local:$input syntax.
- my ($local, @rest) = split (/:/);
- @rest = ("$local.in",) unless @rest;
- # Keep in sync with test 'conffile-leading-dot.sh'.
- msg ('unsupported', $where,
- "omit leading './' from config file names such as '$local';"
- . "\nremake rules might be subtly broken otherwise")
- if ($local =~ /^\.\//);
- my $input = locate_am @rest;
- if ($input)
- {
- # We have a file that automake should generate.
- $make_list{$input} = join (':', ($local, @rest));
- }
- else
- {
- # We have a file that automake should cause to be
- # rebuilt, but shouldn't generate itself.
- push (@other_input_files, $_);
- }
- $ac_config_files_location{$local} = $where;
- $ac_config_files_condition{$local} =
- new Automake::Condition (@cond_stack)
- if (@cond_stack);
- }
-}
-
-
-sub scan_autoconf_traces
-{
- my ($filename) = @_;
-
- # Macros to trace, with their minimal number of arguments.
- #
- # IMPORTANT: If you add a macro here, you should also add this macro
- # ========= to Automake-preselection in autoconf/lib/autom4te.in.
- my %traced = (
- AC_CANONICAL_BUILD => 0,
- AC_CANONICAL_HOST => 0,
- AC_CANONICAL_TARGET => 0,
- AC_CONFIG_AUX_DIR => 1,
- AC_CONFIG_FILES => 1,
- AC_CONFIG_HEADERS => 1,
- AC_CONFIG_LIBOBJ_DIR => 1,
- AC_CONFIG_LINKS => 1,
- AC_FC_SRCEXT => 1,
- AC_INIT => 0,
- AC_LIBSOURCE => 1,
- AC_REQUIRE_AUX_FILE => 1,
- AC_SUBST_TRACE => 1,
- AM_AUTOMAKE_VERSION => 1,
- AM_PROG_MKDIR_P => 0,
- AM_CONDITIONAL => 2,
- AM_EXTRA_RECURSIVE_TARGETS => 1,
- AM_GNU_GETTEXT => 0,
- AM_GNU_GETTEXT_INTL_SUBDIR => 0,
- AM_INIT_AUTOMAKE => 0,
- AM_MAINTAINER_MODE => 0,
- AM_PROG_AR => 0,
- _AM_SUBST_NOTMAKE => 1,
- _AM_COND_IF => 1,
- _AM_COND_ELSE => 1,
- _AM_COND_ENDIF => 1,
- LT_SUPPORTED_TAG => 1,
- _LT_AC_TAGCONFIG => 0,
- m4_include => 1,
- m4_sinclude => 1,
- sinclude => 1,
- );
-
- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " ";
-
- # Use a separator unlikely to be used, not ':', the default, which
- # has a precise meaning for AC_CONFIG_FILES and so on.
- $traces .= join (' ',
- map { "--trace=$_" . ':\$f:\$l::\$d::\$n::\${::}%' }
- (keys %traced));
-
- my $tracefh = new Automake::XFile ("$traces $filename |");
- verb "reading $traces";
-
- @cond_stack = ();
- my $where;
-
- while ($_ = $tracefh->getline)
- {
- chomp;
- my ($here, $depth, @args) = split (/::/);
- $where = new Automake::Location $here;
- my $macro = $args[0];
-
- prog_error ("unrequested trace '$macro'")
- unless exists $traced{$macro};
-
- # Skip and diagnose malformed calls.
- if ($#args < $traced{$macro})
- {
- msg ('syntax', $where, "not enough arguments for $macro");
- next;
- }
-
- # Alphabetical ordering please.
- if ($macro eq 'AC_CANONICAL_BUILD')
- {
- if ($seen_canonical <= AC_CANONICAL_BUILD)
- {
- $seen_canonical = AC_CANONICAL_BUILD;
- }
- }
- elsif ($macro eq 'AC_CANONICAL_HOST')
- {
- if ($seen_canonical <= AC_CANONICAL_HOST)
- {
- $seen_canonical = AC_CANONICAL_HOST;
- }
- }
- elsif ($macro eq 'AC_CANONICAL_TARGET')
- {
- $seen_canonical = AC_CANONICAL_TARGET;
- }
- elsif ($macro eq 'AC_CONFIG_AUX_DIR')
- {
- if ($seen_init_automake)
- {
- error ($where, "AC_CONFIG_AUX_DIR must be called before "
- . "AM_INIT_AUTOMAKE ...", partial => 1);
- error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here");
- }
- $config_aux_dir = $args[1];
- $config_aux_dir_set_in_configure_ac = 1;
- check_directory ($config_aux_dir, $where);
- }
- elsif ($macro eq 'AC_CONFIG_FILES')
- {
- # Look at potential Makefile.am's.
- scan_autoconf_config_files ($where, $args[1]);
- }
- elsif ($macro eq 'AC_CONFIG_HEADERS')
- {
- foreach my $spec (split (' ', $args[1]))
- {
- my ($dest, @src) = split (':', $spec);
- $ac_config_files_location{$dest} = $where;
- push @config_headers, $spec;
- }
- }
- elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
- {
- $config_libobj_dir = $args[1];
- check_directory ($config_libobj_dir, $where);
- }
- elsif ($macro eq 'AC_CONFIG_LINKS')
- {
- foreach my $spec (split (' ', $args[1]))
- {
- my ($dest, $src) = split (':', $spec);
- $ac_config_files_location{$dest} = $where;
- push @config_links, $spec;
- }
- }
- elsif ($macro eq 'AC_FC_SRCEXT')
- {
- my $suffix = $args[1];
- # These flags are used as %SOURCEFLAG% in depend2.am,
- # where the trailing space is important.
- $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') '
- if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || $suffix eq 'f08');
- }
- elsif ($macro eq 'AC_INIT')
- {
- if (defined $args[2])
- {
- $package_version = $args[2];
- $package_version_location = $where;
- }
- }
- elsif ($macro eq 'AC_LIBSOURCE')
- {
- $libsources{$args[1]} = $here;
- }
- elsif ($macro eq 'AC_REQUIRE_AUX_FILE')
- {
- # Only remember the first time a file is required.
- $required_aux_file{$args[1]} = $where
- unless exists $required_aux_file{$args[1]};
- }
- elsif ($macro eq 'AC_SUBST_TRACE')
- {
- # Just check for alphanumeric in AC_SUBST_TRACE. If you do
- # AC_SUBST(5), then too bad.
- $configure_vars{$args[1]} = $where
- if $args[1] =~ /^\w+$/;
- }
- elsif ($macro eq 'AM_AUTOMAKE_VERSION')
- {
- error ($where,
- "version mismatch. This is Automake $VERSION,\n" .
- "but the definition used by this AM_INIT_AUTOMAKE\n" .
- "comes from Automake $args[1]. You should recreate\n" .
- "aclocal.m4 with aclocal and run automake again.\n",
- # $? = 63 is used to indicate version mismatch to missing.
- exit_code => 63)
- if $VERSION ne $args[1];
-
- $seen_automake_version = 1;
- }
- elsif ($macro eq 'AM_PROG_MKDIR_P')
- {
- # FIXME: we are no longer going to remove this! adjust warning
- # FIXME: message accordingly.
- msg 'obsolete', $where, <<'EOF';
-The 'AM_PROG_MKDIR_P' macro is deprecated, and will soon be removed.
-You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
-and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.
-EOF
- }
- elsif ($macro eq 'AM_CONDITIONAL')
- {
- $configure_cond{$args[1]} = $where;
- }
- elsif ($macro eq 'AM_EXTRA_RECURSIVE_TARGETS')
- {
- # Empty leading/trailing fields might be produced by split,
- # hence the grep is really needed.
- push @extra_recursive_targets,
- grep (/./, (split /\s+/, $args[1]));
- }
- elsif ($macro eq 'AM_GNU_GETTEXT')
- {
- $seen_gettext = $where;
- $ac_gettext_location = $where;
- $seen_gettext_external = grep ($_ eq 'external', @args);
- }
- elsif ($macro eq 'AM_GNU_GETTEXT_INTL_SUBDIR')
- {
- $seen_gettext_intl = $where;
- }
- elsif ($macro eq 'AM_INIT_AUTOMAKE')
- {
- $seen_init_automake = $where;
- if (defined $args[2])
- {
- msg 'obsolete', $where, <<'EOF';
-AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
-http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
-EOF
- $package_version = $args[2];
- $package_version_location = $where;
- }
- elsif (defined $args[1])
- {
- my @opts = split (' ', $args[1]);
- @opts = map { { option => $_, where => $where } } @opts;
- exit $exit_code if process_global_option_list (@opts);
- }
- }
- elsif ($macro eq 'AM_MAINTAINER_MODE')
- {
- $seen_maint_mode = $where;
- }
- elsif ($macro eq 'AM_PROG_AR')
- {
- $seen_ar = $where;
- }
- elsif ($macro eq '_AM_COND_IF')
- {
- cond_stack_if ('', $args[1], $where);
- error ($where, "missing m4 quoting, macro depth $depth")
- if ($depth != 1);
- }
- elsif ($macro eq '_AM_COND_ELSE')
- {
- cond_stack_else ('!', $args[1], $where);
- error ($where, "missing m4 quoting, macro depth $depth")
- if ($depth != 1);
- }
- elsif ($macro eq '_AM_COND_ENDIF')
- {
- cond_stack_endif (undef, undef, $where);
- error ($where, "missing m4 quoting, macro depth $depth")
- if ($depth != 1);
- }
- elsif ($macro eq '_AM_SUBST_NOTMAKE')
- {
- $ignored_configure_vars{$args[1]} = $where;
- }
- elsif ($macro eq 'm4_include'
- || $macro eq 'm4_sinclude'
- || $macro eq 'sinclude')
- {
- # Skip missing 'sinclude'd files.
- next if $macro ne 'm4_include' && ! -f $args[1];
-
- # Some modified versions of Autoconf don't use
- # frozen files. Consequently it's possible that we see all
- # m4_include's performed during Autoconf's startup.
- # Obviously we don't want to distribute Autoconf's files
- # so we skip absolute filenames here.
- push @configure_deps, '$(top_srcdir)/' . $args[1]
- unless $here =~ m,^(?:\w:)?[\\/],;
- # Keep track of the greatest timestamp.
- if (-e $args[1])
- {
- my $mtime = mtime $args[1];
- $configure_deps_greatest_timestamp = $mtime
- if $mtime > $configure_deps_greatest_timestamp;
- }
- }
- elsif ($macro eq 'LT_SUPPORTED_TAG')
- {
- $libtool_tags{$args[1]} = 1;
- $libtool_new_api = 1;
- }
- elsif ($macro eq '_LT_AC_TAGCONFIG')
- {
- # _LT_AC_TAGCONFIG is an old macro present in Libtool 1.5.
- # We use it to detect whether tags are supported. Our
- # preferred interface is LT_SUPPORTED_TAG, but it was
- # introduced in Libtool 1.6.
- if (0 == keys %libtool_tags)
- {
- # Hardcode the tags supported by Libtool 1.5.
- %libtool_tags = (CC => 1, CXX => 1, GCJ => 1, F77 => 1);
- }
- }
- }
-
- error ($where, "condition stack not properly closed")
- if (@cond_stack);
-
- $tracefh->close;
-}
-
-
-# Check whether we use 'configure.ac' or 'configure.in'.
-# Scan it (and possibly 'aclocal.m4') for interesting things.
-# We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
-sub scan_autoconf_files ()
-{
- # Reinitialize libsources here. This isn't really necessary,
- # since we currently assume there is only one configure.ac. But
- # that won't always be the case.
- %libsources = ();
-
- # Keep track of the youngest configure dependency.
- $configure_deps_greatest_timestamp = mtime $configure_ac;
- if (-e 'aclocal.m4')
- {
- my $mtime = mtime 'aclocal.m4';
- $configure_deps_greatest_timestamp = $mtime
- if $mtime > $configure_deps_greatest_timestamp;
- }
-
- scan_autoconf_traces ($configure_ac);
-
- @configure_input_files = sort keys %make_list;
- # Set input and output files if not specified by user.
- if (! @input_files)
- {
- @input_files = @configure_input_files;
- %output_files = %make_list;
- }
-
-
- if (! $seen_init_automake)
- {
- err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou "
- . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE,"
- . "\nthat aclocal.m4 is present in the top-level directory,\n"
- . "and that aclocal.m4 was recently regenerated "
- . "(using aclocal)");
- }
- else
- {
- if (! $seen_automake_version)
- {
- if (-f 'aclocal.m4')
- {
- error ($seen_init_automake,
- "your implementation of AM_INIT_AUTOMAKE comes from " .
- "an\nold Automake version. You should recreate " .
- "aclocal.m4\nwith aclocal and run automake again",
- # $? = 63 is used to indicate version mismatch to missing.
- exit_code => 63);
- }
- else
- {
- error ($seen_init_automake,
- "no proper implementation of AM_INIT_AUTOMAKE was " .
- "found,\nprobably because aclocal.m4 is missing.\n" .
- "You should run aclocal to create this file, then\n" .
- "run automake again");
- }
- }
- }
-
- locate_aux_dir ();
-
- # Look for some files we need. Always check for these. This
- # check must be done for every run, even those where we are only
- # looking at a subdir Makefile. We must set relative_dir for
- # push_required_file to work.
- # Sort the files for stable verbose output.
- $relative_dir = '.';
- foreach my $file (sort keys %required_aux_file)
- {
- require_conf_file ($required_aux_file{$file}->get, FOREIGN, $file)
- }
- err_am "'install.sh' is an anachronism; use 'install-sh' instead"
- if -f $config_aux_dir . '/install.sh';
-
- # Preserve dist_common for later.
- $configure_dist_common = variable_value ('DIST_COMMON') || '';
-
-}
-
-################################################################
-
-# Do any extra checking for GNU standards.
-sub check_gnu_standards ()
-{
- if ($relative_dir eq '.')
- {
- # In top level (or only) directory.
- require_file ("$am_file.am", GNU,
- qw/INSTALL NEWS README AUTHORS ChangeLog/);
-
- # Accept one of these three licenses; default to COPYING.
- # Make sure we do not overwrite an existing license.
- my $license;
- foreach (qw /COPYING COPYING.LIB COPYING.LESSER/)
- {
- if (-f $_)
- {
- $license = $_;
- last;
- }
- }
- require_file ("$am_file.am", GNU, 'COPYING')
- unless $license;
- }
-
- for my $opt ('no-installman', 'no-installinfo')
- {
- msg ('error-gnu', option $opt,
- "option '$opt' disallowed by GNU standards")
- if option $opt;
- }
-}
-
-# Do any extra checking for GNITS standards.
-sub check_gnits_standards ()
-{
- if ($relative_dir eq '.')
- {
- # In top level (or only) directory.
- require_file ("$am_file.am", GNITS, 'THANKS');
- }
-}
-
-################################################################
-#
-# Functions to handle files of each language.
-
-# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a
-# simple formula: Return value is LANG_SUBDIR if the resulting object
-# file should be in a subdir if the source file is, LANG_PROCESS if
-# file is to be dealt with, LANG_IGNORE otherwise.
-
-# Much of the actual processing is handled in
-# handle_single_transform. These functions exist so that
-# auxiliary information can be recorded for a later cleanup pass.
-# Note that the calls to these functions are computed, so don't bother
-# searching for their precise names in the source.
-
-# This is just a convenience function that can be used to determine
-# when a subdir object should be used.
-sub lang_sub_obj ()
-{
- return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
-}
-
-# Rewrite a single header file.
-sub lang_header_rewrite
-{
- # Header files are simply ignored.
- return LANG_IGNORE;
-}
-
-# Rewrite a single Vala source file.
-sub lang_vala_rewrite
-{
- my ($directory, $base, $ext) = @_;
-
- (my $newext = $ext) =~ s/vala$/c/;
- return (LANG_SUBDIR, $newext);
-}
-
-# Rewrite a single yacc/yacc++ file.
-sub lang_yacc_rewrite
-{
- my ($directory, $base, $ext) = @_;
-
- my $r = lang_sub_obj;
- (my $newext = $ext) =~ tr/y/c/;
- return ($r, $newext);
-}
-sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); };
-
-# Rewrite a single lex/lex++ file.
-sub lang_lex_rewrite
-{
- my ($directory, $base, $ext) = @_;
-
- my $r = lang_sub_obj;
- (my $newext = $ext) =~ tr/l/c/;
- return ($r, $newext);
-}
-sub lang_lexxx_rewrite { lang_lex_rewrite (@_); };
-
-# Rewrite a single Java file.
-sub lang_java_rewrite
-{
- return LANG_SUBDIR;
-}
-
-# The lang_X_finish functions are called after all source file
-# processing is done. Each should handle defining rules for the
-# language, etc. A finish function is only called if a source file of
-# the appropriate type has been seen.
-
-sub lang_vala_finish_target
-{
- my ($self, $name) = @_;
-
- my $derived = canonicalize ($name);
- my $var = var "${derived}_SOURCES";
- return unless $var;
-
- my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive);
-
- # For automake bug#11229.
- return unless @vala_sources;
-
- foreach my $vala_file (@vala_sources)
- {
- my $c_file = $vala_file;
- if ($c_file =~ s/(.*)\.vala$/$1.c/)
- {
- $c_file = "\$(srcdir)/$c_file";
- $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n"
- . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
- . "\t\@if test -f \$@; then :; else \\\n"
- . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
- . "\tfi\n";
- $clean_files{$c_file} = MAINTAINER_CLEAN;
- }
- }
-
- # Add rebuild rules for generated header and vapi files
- my $flags = var ($derived . '_VALAFLAGS');
- if ($flags)
- {
- my $lastflag = '';
- foreach my $flag ($flags->value_as_list_recursive)
- {
- if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header',
- '--vapi', '--internal-vapi', '--gir')))
- {
- my $headerfile = "\$(srcdir)/$flag";
- $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n"
- . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
- . "\t\@if test -f \$@; then :; else \\\n"
- . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
- . "\tfi\n";
-
- # valac is not used when building from dist tarballs
- # distribute the generated files
- push_dist_common ($headerfile);
- $clean_files{$headerfile} = MAINTAINER_CLEAN;
- }
- $lastflag = $flag;
- }
- }
-
- my $compile = $self->compile;
-
- # Rewrite each occurrence of 'AM_VALAFLAGS' in the compile
- # rule into '${derived}_VALAFLAGS' if it exists.
- my $val = "${derived}_VALAFLAGS";
- $compile =~ s/\(AM_VALAFLAGS\)/\($val\)/
- if set_seen ($val);
-
- # VALAFLAGS is a user variable (per GNU Standards),
- # it should not be overridden in the Makefile...
- check_user_variables 'VALAFLAGS';
-
- my $dirname = dirname ($name);
-
- # Only generate C code, do not run C compiler
- $compile .= " -C";
-
- my $verbose = verbose_flag ('VALAC');
- my $silent = silent_flag ();
- my $stampfile = "\$(srcdir)/${derived}_vala.stamp";
-
- $output_rules .=
- "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n".
-# Since the C files generated from the vala sources depend on the
-# ${derived}_vala.stamp file, we must ensure its timestamp is older than
-# those of the C files generated by the valac invocation below (this is
-# especially important on systems with sub-second timestamp resolution).
-# Thus we need to create the stamp file *before* invoking valac, and to
-# move it to its final location only after valac has been invoked.
- "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n".
- "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n".
- "\t${silent}mv -f \$\@-t \$\@\n";
-
- push_dist_common ($stampfile);
-
- $clean_files{$stampfile} = MAINTAINER_CLEAN;
-}
-
-# Add output rules to invoke valac and create stamp file as a witness
-# to handle multiple outputs. This function is called after all source
-# file processing is done.
-sub lang_vala_finish ()
-{
- my ($self) = @_;
-
- foreach my $prog (keys %known_programs)
- {
- lang_vala_finish_target ($self, $prog);
- }
-
- while (my ($name) = each %known_libraries)
- {
- lang_vala_finish_target ($self, $name);
- }
-}
-
-# The built .c files should be cleaned only on maintainer-clean
-# as the .c files are distributed. This function is called for each
-# .vala source file.
-sub lang_vala_target_hook
-{
- my ($self, $aggregate, $output, $input, %transform) = @_;
-
- $clean_files{$output} = MAINTAINER_CLEAN;
-}
-
-# This is a yacc helper which is called whenever we have decided to
-# compile a yacc file.
-sub lang_yacc_target_hook
-{
- my ($self, $aggregate, $output, $input, %transform) = @_;
-
- # If some relevant *YFLAGS variable contains the '-d' flag, we'll
- # have to to generate special code.
- my $yflags_contains_minus_d = 0;
-
- foreach my $pfx ("", "${aggregate}_")
- {
- my $yflagsvar = var ("${pfx}YFLAGS");
- next unless $yflagsvar;
- # We cannot work reliably with conditionally-defined YFLAGS.
- if ($yflagsvar->has_conditional_contents)
- {
- msg_var ('unsupported', $yflagsvar,
- "'${pfx}YFLAGS' cannot have conditional contents");
- }
- else
- {
- $yflags_contains_minus_d = 1
- if grep (/^-d$/, $yflagsvar->value_as_list_recursive);
- }
- }
-
- if ($yflags_contains_minus_d)
- {
- # Found a '-d' that applies to the compilation of this file.
- # Add a dependency for the generated header file, and arrange
- # for that file to be included in the distribution.
-
- # The extension of the output file (e.g., '.c' or '.cxx').
- # We'll need it to compute the name of the generated header file.
- (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/;
-
- # We know that a yacc input should be turned into either a C or
- # C++ output file. We depend on this fact (here and in yacc.am),
- # so check that it really holds.
- my $lang = $languages{$extension_map{$output_ext}};
- prog_error "invalid output name '$output' for yacc file '$input'"
- if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx'));
-
- (my $header_ext = $output_ext) =~ s/c/h/g;
- # Quote $output_ext in the regexp, so that dots in it are taken
- # as literal dots, not as metacharacters.
- (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/;
-
- foreach my $cond (Automake::Rule::define (${header}, 'internal',
- RULE_AUTOMAKE, TRUE,
- INTERNAL))
- {
- my $condstr = $cond->subst_string;
- $output_rules .=
- "$condstr${header}: $output\n"
- # Recover from removal of $header
- . "$condstr\t\@if test ! -f \$@; then rm -f $output; else :; fi\n"
- . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; fi\n";
- }
- # Distribute the generated file, unless its .y source was
- # listed in a nodist_ variable. (handle_source_transform()
- # will set DIST_SOURCE.)
- push_dist_common ($header)
- if $transform{'DIST_SOURCE'};
-
- # The GNU rules say that yacc/lex output files should be removed
- # by maintainer-clean. However, if the files are not distributed,
- # then we want to remove them with "make clean"; otherwise,
- # "make distcheck" will fail.
- $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
- }
- # See the comment above for $HEADER.
- $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
-}
-
-# This is a lex helper which is called whenever we have decided to
-# compile a lex file.
-sub lang_lex_target_hook
-{
- my ($self, $aggregate, $output, $input, %transform) = @_;
- # The GNU rules say that yacc/lex output files should be removed
- # by maintainer-clean. However, if the files are not distributed,
- # then we want to remove them with "make clean"; otherwise,
- # "make distcheck" will fail.
- $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
-}
-
-# This is a helper for both lex and yacc.
-sub yacc_lex_finish_helper ()
-{
- return if defined $language_scratch{'lex-yacc-done'};
- $language_scratch{'lex-yacc-done'} = 1;
-
- # FIXME: for now, no line number.
- require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
- define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
-}
-
-sub lang_yacc_finish ()
-{
- return if defined $language_scratch{'yacc-done'};
- $language_scratch{'yacc-done'} = 1;
-
- reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead";
-
- yacc_lex_finish_helper;
-}
-
-
-sub lang_lex_finish ()
-{
- return if defined $language_scratch{'lex-done'};
- $language_scratch{'lex-done'} = 1;
-
- yacc_lex_finish_helper;
-}
-
-
-# Given a hash table of linker names, pick the name that has the most
-# precedence. This is lame, but something has to have global
-# knowledge in order to eliminate the conflict. Add more linkers as
-# required.
-sub resolve_linker
-{
- my (%linkers) = @_;
-
- foreach my $l (qw(GCJLINK OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK))
- {
- return $l if defined $linkers{$l};
- }
- return 'LINK';
-}
-
-# Called to indicate that an extension was used.
-sub saw_extension
-{
- my ($ext) = @_;
- $extension_seen{$ext} = 1;
-}
-
-# register_language (%ATTRIBUTE)
-# ------------------------------
-# Register a single language.
-# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE.
-sub register_language
-{
- my (%option) = @_;
-
- # Set the defaults.
- $option{'autodep'} = 'no'
- unless defined $option{'autodep'};
- $option{'linker'} = ''
- unless defined $option{'linker'};
- $option{'flags'} = []
- unless defined $option{'flags'};
- $option{'output_extensions'} = sub { return ( '.$(OBJEXT)', '.lo' ) }
- unless defined $option{'output_extensions'};
- $option{'nodist_specific'} = 0
- unless defined $option{'nodist_specific'};
-
- my $lang = new Automake::Language (%option);
-
- # Fill indexes.
- $extension_map{$_} = $lang->name foreach @{$lang->extensions};
- $languages{$lang->name} = $lang;
- my $link = $lang->linker;
- if ($link)
- {
- if (exists $link_languages{$link})
- {
- prog_error ("'$link' has different definitions in "
- . $lang->name . " and " . $link_languages{$link}->name)
- if $lang->link ne $link_languages{$link}->link;
- }
- else
- {
- $link_languages{$link} = $lang;
- }
- }
-
- # Update the pattern of known extensions.
- accept_extensions (@{$lang->extensions});
-
- # Update the $suffix_rule map.
- foreach my $suffix (@{$lang->extensions})
- {
- foreach my $dest ($lang->output_extensions->($suffix))
- {
- register_suffix_rule (INTERNAL, $suffix, $dest);
- }
- }
-}
-
-# derive_suffix ($EXT, $OBJ)
-# --------------------------
-# This function is used to find a path from a user-specified suffix $EXT
-# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'.
-sub derive_suffix
-{
- my ($source_ext, $obj) = @_;
-
- while (! $extension_map{$source_ext}
- && $source_ext ne $obj
- && exists $suffix_rules->{$source_ext}
- && exists $suffix_rules->{$source_ext}{$obj})
- {
- $source_ext = $suffix_rules->{$source_ext}{$obj}[0];
- }
-
- return $source_ext;
-}
-
-
-# Pretty-print something and append to '$output_rules'.
-sub pretty_print_rule
-{
- $output_rules .= makefile_wrap (shift, shift, @_);
-}
-
-
-################################################################
-
-
-## -------------------------------- ##
-## Handling the conditional stack. ##
-## -------------------------------- ##
-
-
-# $STRING
-# make_conditional_string ($NEGATE, $COND)
-# ----------------------------------------
-sub make_conditional_string
-{
- my ($negate, $cond) = @_;
- $cond = "${cond}_TRUE"
- unless $cond =~ /^TRUE|FALSE$/;
- $cond = Automake::Condition::conditional_negate ($cond)
- if $negate;
- return $cond;
-}
-
-
-my %_am_macro_for_cond =
- (
- AMDEP => "one of the compiler tests\n"
- . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\n"
- . " AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC",
- am__fastdepCC => 'AC_PROG_CC',
- am__fastdepCCAS => 'AM_PROG_AS',
- am__fastdepCXX => 'AC_PROG_CXX',
- am__fastdepGCJ => 'AM_PROG_GCJ',
- am__fastdepOBJC => 'AC_PROG_OBJC',
- am__fastdepOBJCXX => 'AC_PROG_OBJCXX',
- am__fastdepUPC => 'AM_PROG_UPC'
- );
-
-# $COND
-# cond_stack_if ($NEGATE, $COND, $WHERE)
-# --------------------------------------
-sub cond_stack_if
-{
- my ($negate, $cond, $where) = @_;
-
- if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/)
- {
- my $text = "$cond does not appear in AM_CONDITIONAL";
- my $scope = US_LOCAL;
- if (exists $_am_macro_for_cond{$cond})
- {
- my $mac = $_am_macro_for_cond{$cond};
- $text .= "\n The usual way to define '$cond' is to add ";
- $text .= ($mac =~ / /) ? $mac : "'$mac'";
- $text .= "\n to '$configure_ac' and run 'aclocal' and 'autoconf' again";
- # These warnings appear in Automake files (depend2.am),
- # so there is no need to display them more than once:
- $scope = US_GLOBAL;
- }
- error $where, $text, uniq_scope => $scope;
- }
-
- push (@cond_stack, make_conditional_string ($negate, $cond));
-
- return new Automake::Condition (@cond_stack);
-}
-
-
-# $COND
-# cond_stack_else ($NEGATE, $COND, $WHERE)
-# ----------------------------------------
-sub cond_stack_else
-{
- my ($negate, $cond, $where) = @_;
-
- if (! @cond_stack)
- {
- error $where, "else without if";
- return FALSE;
- }
-
- $cond_stack[$#cond_stack] =
- Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]);
-
- # If $COND is given, check against it.
- if (defined $cond)
- {
- $cond = make_conditional_string ($negate, $cond);
-
- error ($where, "else reminder ($negate$cond) incompatible with "
- . "current conditional: $cond_stack[$#cond_stack]")
- if $cond_stack[$#cond_stack] ne $cond;
- }
-
- return new Automake::Condition (@cond_stack);
-}
-
-
-# $COND
-# cond_stack_endif ($NEGATE, $COND, $WHERE)
-# -----------------------------------------
-sub cond_stack_endif
-{
- my ($negate, $cond, $where) = @_;
- my $old_cond;
-
- if (! @cond_stack)
- {
- error $where, "endif without if";
- return TRUE;
- }
-
- # If $COND is given, check against it.
- if (defined $cond)
- {
- $cond = make_conditional_string ($negate, $cond);
-
- error ($where, "endif reminder ($negate$cond) incompatible with "
- . "current conditional: $cond_stack[$#cond_stack]")
- if $cond_stack[$#cond_stack] ne $cond;
- }
-
- pop @cond_stack;
-
- return new Automake::Condition (@cond_stack);
-}
-
-
-
-
-
-## ------------------------ ##
-## Handling the variables. ##
-## ------------------------ ##
-
-
-# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
-# ----------------------------------------------------
-# Like define_variable, but the value is a list, and the variable may
-# be defined conditionally. The second argument is the condition
-# under which the value should be defined; this should be the empty
-# string to define the variable unconditionally. The third argument
-# is a list holding the values to use for the variable. The value is
-# pretty printed in the output file.
-sub define_pretty_variable
-{
- my ($var, $cond, $where, @value) = @_;
-
- if (! vardef ($var, $cond))
- {
- Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value",
- '', $where, VAR_PRETTY);
- rvar ($var)->rdef ($cond)->set_seen;
- }
-}
-
-
-# define_variable ($VAR, $VALUE, $WHERE)
-# --------------------------------------
-# Define a new Automake Makefile variable VAR to VALUE, but only if
-# not already defined.
-sub define_variable
-{
- my ($var, $value, $where) = @_;
- define_pretty_variable ($var, TRUE, $where, $value);
-}
-
-
-# define_files_variable ($VAR, \@BASENAME, $EXTENSION, $WHERE)
-# ------------------------------------------------------------
-# Define the $VAR which content is the list of file names composed of
-# a @BASENAME and the $EXTENSION.
-sub define_files_variable ($\@$$)
-{
- my ($var, $basename, $extension, $where) = @_;
- define_variable ($var,
- join (' ', map { "$_.$extension" } @$basename),
- $where);
-}
-
-
-# Like define_variable, but define a variable to be the configure
-# substitution by the same name.
-sub define_configure_variable
-{
- my ($var) = @_;
- # Some variables we do not want to output. For instance it
- # would be a bad idea to output `U = @U@` when `@U@` can be
- # substituted as `\`.
- my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
- Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var),
- '', $configure_vars{$var}, $pretty);
-}
-
-
-# define_compiler_variable ($LANG)
-# --------------------------------
-# Define a compiler variable. We also handle defining the 'LT'
-# version of the command when using libtool.
-sub define_compiler_variable
-{
- my ($lang) = @_;
-
- my ($var, $value) = ($lang->compiler, $lang->compile);
- my $libtool_tag = '';
- $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
- if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
- define_variable ($var, $value, INTERNAL);
- if (var ('LIBTOOL'))
- {
- my $verbose = define_verbose_libtool ();
- define_variable ("LT$var",
- "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)"
- . " \$(LIBTOOLFLAGS) --mode=compile $value",
- INTERNAL);
- }
- define_verbose_tagvar ($lang->ccer || 'GEN');
-}
-
-
-sub define_linker_variable
-{
- my ($lang) = @_;
-
- my $libtool_tag = '';
- $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
- if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
- # CCLD = $(CC).
- define_variable ($lang->lder, $lang->ld, INTERNAL);
- # CCLINK = $(CCLD) blah blah...
- my $link = '';
- if (var ('LIBTOOL'))
- {
- my $verbose = define_verbose_libtool ();
- $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
- . "\$(LIBTOOLFLAGS) --mode=link ";
- }
- define_variable ($lang->linker, $link . $lang->link, INTERNAL);
- define_variable ($lang->compiler, $lang, INTERNAL);
- define_verbose_tagvar ($lang->lder || 'GEN');
-}
-
-sub define_per_target_linker_variable
-{
- my ($linker, $target) = @_;
-
- # If the user wrote a custom link command, we don't define ours.
- return "${target}_LINK"
- if set_seen "${target}_LINK";
-
- my $xlink = $linker ? $linker : 'LINK';
-
- my $lang = $link_languages{$xlink};
- prog_error "Unknown language for linker variable '$xlink'"
- unless $lang;
-
- my $link_command = $lang->link;
- if (var 'LIBTOOL')
- {
- my $libtool_tag = '';
- $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
- if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
-
- my $verbose = define_verbose_libtool ();
- $link_command =
- "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) "
- . "--mode=link " . $link_command;
- }
-
- # Rewrite each occurrence of 'AM_$flag' in the link
- # command into '${derived}_$flag' if it exists.
- my $orig_command = $link_command;
- my @flags = (@{$lang->flags}, 'LDFLAGS');
- push @flags, 'LIBTOOLFLAGS' if var 'LIBTOOL';
- for my $flag (@flags)
- {
- my $val = "${target}_$flag";
- $link_command =~ s/\(AM_$flag\)/\($val\)/
- if set_seen ($val);
- }
-
- # If the computed command is the same as the generic command, use
- # the command linker variable.
- return ($lang->linker, $lang->lder)
- if $link_command eq $orig_command;
-
- define_variable ("${target}_LINK", $link_command, INTERNAL);
- return ("${target}_LINK", $lang->lder);
-}
-
-################################################################
-
-# check_trailing_slash ($WHERE, $LINE)
-# ------------------------------------
-# Return 1 iff $LINE ends with a slash.
-# Might modify $LINE.
-sub check_trailing_slash ($\$)
-{
- my ($where, $line) = @_;
-
- # Ignore '##' lines.
- return 0 if $$line =~ /$IGNORE_PATTERN/o;
-
- # Catch and fix a common error.
- msg "syntax", $where, "whitespace following trailing backslash"
- if $$line =~ s/\\\s+\n$/\\\n/;
-
- return $$line =~ /\\$/;
-}
-
-
-# read_am_file ($AMFILE, $WHERE, $RELDIR)
-# ---------------------------------------
-# Read Makefile.am and set up %contents. Simultaneously copy lines
-# from Makefile.am into $output_trailer, or define variables as
-# appropriate. NOTE we put rules in the trailer section. We want
-# user rules to come after our generated stuff.
-sub read_am_file
-{
- my ($amfile, $where, $reldir) = @_;
- my $canon_reldir = &canonicalize ($reldir);
-
- my $am_file = new Automake::XFile ("< $amfile");
- verb "reading $amfile";
-
- # Keep track of the youngest output dependency.
- my $mtime = mtime $amfile;
- $output_deps_greatest_timestamp = $mtime
- if $mtime > $output_deps_greatest_timestamp;
-
- my $spacing = '';
- my $comment = '';
- my $blank = 0;
- my $saw_bk = 0;
- my $var_look = VAR_ASIS;
-
- use constant IN_VAR_DEF => 0;
- use constant IN_RULE_DEF => 1;
- use constant IN_COMMENT => 2;
- my $prev_state = IN_RULE_DEF;
-
- while ($_ = $am_file->getline)
- {
- $where->set ("$amfile:$.");
- if (/$IGNORE_PATTERN/o)
- {
- # Merely delete comments beginning with two hashes.
- }
- elsif (/$WHITE_PATTERN/o)
- {
- error $where, "blank line following trailing backslash"
- if $saw_bk;
- # Stick a single white line before the incoming macro or rule.
- $spacing = "\n";
- $blank = 1;
- # Flush all comments seen so far.
- if ($comment ne '')
- {
- $output_vars .= $comment;
- $comment = '';
- }
- }
- elsif (/$COMMENT_PATTERN/o)
- {
- # Stick comments before the incoming macro or rule. Make
- # sure a blank line precedes the first block of comments.
- $spacing = "\n" unless $blank;
- $blank = 1;
- $comment .= $spacing . $_;
- $spacing = '';
- $prev_state = IN_COMMENT;
- }
- else
- {
- last;
- }
- $saw_bk = check_trailing_slash ($where, $_);
- }
-
- # We save the conditional stack on entry, and then check to make
- # sure it is the same on exit. This lets us conditionally include
- # other files.
- my @saved_cond_stack = @cond_stack;
- my $cond = new Automake::Condition (@cond_stack);
-
- my $last_var_name = '';
- my $last_var_type = '';
- my $last_var_value = '';
- my $last_where;
- # FIXME: shouldn't use $_ in this loop; it is too big.
- while ($_)
- {
- $where->set ("$amfile:$.");
-
- # Make sure the line is \n-terminated.
- chomp;
- $_ .= "\n";
-
- # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be
- # used by users. @MAINT@ is an anachronism now.
- $_ =~ s/\@MAINT\@//g
- unless $seen_maint_mode;
-
- my $new_saw_bk = check_trailing_slash ($where, $_);
-
- if ($reldir eq '.')
- {
- # If present, eat the following '_' or '/', converting
- # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo"
- # when $reldir is '.'.
- $_ =~ s,%(D|reldir)%/,,g;
- $_ =~ s,%(C|canon_reldir)%_,,g;
- }
- $_ =~ s/%(D|reldir)%/${reldir}/g;
- $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g;
-
- if (/$IGNORE_PATTERN/o)
- {
- # Merely delete comments beginning with two hashes.
-
- # Keep any backslash from the previous line.
- $new_saw_bk = $saw_bk;
- }
- elsif (/$WHITE_PATTERN/o)
- {
- # Stick a single white line before the incoming macro or rule.
- $spacing = "\n";
- error $where, "blank line following trailing backslash"
- if $saw_bk;
- }
- elsif (/$COMMENT_PATTERN/o)
- {
- error $where, "comment following trailing backslash"
- if $saw_bk && $prev_state != IN_COMMENT;
-
- # Stick comments before the incoming macro or rule.
- $comment .= $spacing . $_;
- $spacing = '';
- $prev_state = IN_COMMENT;
- }
- elsif ($saw_bk)
- {
- if ($prev_state == IN_RULE_DEF)
- {
- my $cond = new Automake::Condition @cond_stack;
- $output_trailer .= $cond->subst_string;
- $output_trailer .= $_;
- }
- elsif ($prev_state == IN_COMMENT)
- {
- # If the line doesn't start with a '#', add it.
- # We do this because a continued comment like
- # # A = foo \
- # bar \
- # baz
- # is not portable. BSD make doesn't honor
- # escaped newlines in comments.
- s/^#?/#/;
- $comment .= $spacing . $_;
- }
- else # $prev_state == IN_VAR_DEF
- {
- $last_var_value .= ' '
- unless $last_var_value =~ /\s$/;
- $last_var_value .= $_;
-
- if (!/\\$/)
- {
- Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
- $last_var_type, $cond,
- $last_var_value, $comment,
- $last_where, VAR_ASIS)
- if $cond != FALSE;
- $comment = $spacing = '';
- }
- }
- }
-
- elsif (/$IF_PATTERN/o)
- {
- $cond = cond_stack_if ($1, $2, $where);
- }
- elsif (/$ELSE_PATTERN/o)
- {
- $cond = cond_stack_else ($1, $2, $where);
- }
- elsif (/$ENDIF_PATTERN/o)
- {
- $cond = cond_stack_endif ($1, $2, $where);
- }
-
- elsif (/$RULE_PATTERN/o)
- {
- # Found a rule.
- $prev_state = IN_RULE_DEF;
-
- # For now we have to output all definitions of user rules
- # and can't diagnose duplicates (see the comment in
- # Automake::Rule::define). So we go on and ignore the return value.
- Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where);
-
- check_variable_expansions ($_, $where);
-
- $output_trailer .= $comment . $spacing;
- my $cond = new Automake::Condition @cond_stack;
- $output_trailer .= $cond->subst_string;
- $output_trailer .= $_;
- $comment = $spacing = '';
- }
- elsif (/$ASSIGNMENT_PATTERN/o)
- {
- # Found a macro definition.
- $prev_state = IN_VAR_DEF;
- $last_var_name = $1;
- $last_var_type = $2;
- $last_var_value = $3;
- $last_where = $where->clone;
- if ($3 ne '' && substr ($3, -1) eq "\\")
- {
- # We preserve the '\' because otherwise the long lines
- # that are generated will be truncated by broken
- # 'sed's.
- $last_var_value = $3 . "\n";
- }
- # Normally we try to output variable definitions in the
- # same format they were input. However, POSIX compliant
- # systems are not required to support lines longer than
- # 2048 bytes (most notably, some sed implementation are
- # limited to 4000 bytes, and sed is used by config.status
- # to rewrite Makefile.in into Makefile). Moreover nobody
- # would really write such long lines by hand since it is
- # hardly maintainable. So if a line is longer that 1000
- # bytes (an arbitrary limit), assume it has been
- # automatically generated by some tools, and flatten the
- # variable definition. Otherwise, keep the variable as it
- # as been input.
- $var_look = VAR_PRETTY if length ($last_var_value) >= 1000;
-
- if (!/\\$/)
- {
- Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
- $last_var_type, $cond,
- $last_var_value, $comment,
- $last_where, $var_look)
- if $cond != FALSE;
- $comment = $spacing = '';
- $var_look = VAR_ASIS;
- }
- }
- elsif (/$INCLUDE_PATTERN/o)
- {
- my $path = $1;
-
- if ($path =~ s/^\$\(top_srcdir\)\///)
- {
- push (@include_stack, "\$\(top_srcdir\)/$path");
- # Distribute any included file.
-
- # Always use the $(top_srcdir) prefix in DIST_COMMON,
- # otherwise OSF make will implicitly copy the included
- # file in the build tree during "make distdir" to satisfy
- # the dependency.
- # (subdir-am-cond.sh and subdir-ac-cond.sh will fail)
- push_dist_common ("\$\(top_srcdir\)/$path");
- }
- else
- {
- $path =~ s/\$\(srcdir\)\///;
- push (@include_stack, "\$\(srcdir\)/$path");
- # Always use the $(srcdir) prefix in DIST_COMMON,
- # otherwise OSF make will implicitly copy the included
- # file in the build tree during "make distdir" to satisfy
- # the dependency.
- # (subdir-am-cond.sh and subdir-ac-cond.sh will fail)
- push_dist_common ("\$\(srcdir\)/$path");
- $path = $relative_dir . "/" . $path if $relative_dir ne '.';
- }
- my $new_reldir = File::Spec->abs2rel ($path, $relative_dir);
- $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,;
- $where->push_context ("'$path' included from here");
- read_am_file ($path, $where, $new_reldir);
- $where->pop_context;
- }
- else
- {
- # This isn't an error; it is probably a continued rule.
- # In fact, this is what we assume.
- $prev_state = IN_RULE_DEF;
- check_variable_expansions ($_, $where);
- $output_trailer .= $comment . $spacing;
- my $cond = new Automake::Condition @cond_stack;
- $output_trailer .= $cond->subst_string;
- $output_trailer .= $_;
- $comment = $spacing = '';
- error $where, "'#' comment at start of rule is unportable"
- if $_ =~ /^\t\s*\#/;
- }
-
- $saw_bk = $new_saw_bk;
- $_ = $am_file->getline;
- }
-
- $output_trailer .= $comment;
-
- error ($where, "trailing backslash on last line")
- if $saw_bk;
-
- error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack"
- : "too many conditionals closed in include file"))
- if "@saved_cond_stack" ne "@cond_stack";
-}
-
-
-# A helper for read_main_am_file which initializes configure variables
-# and variables from header-vars.am.
-sub define_standard_variables ()
-{
- my $saved_output_vars = $output_vars;
- my ($comments, undef, $rules) =
- file_contents_internal (1, "$libdir/am/header-vars.am",
- new Automake::Location);
-
- foreach my $var (sort keys %configure_vars)
- {
- define_configure_variable ($var);
- }
-
- $output_vars .= $comments . $rules;
-}
-
-
-# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN)
-# ----------------------------------------------
-sub read_main_am_file
-{
- my ($amfile, $infile) = @_;
-
- # This supports the strange variable tricks we are about to play.
- prog_error ("variable defined before read_main_am_file\n" . variables_dump ())
- if (scalar (variables) > 0);
-
- # Generate copyright header for generated Makefile.in.
- # We do discard the output of predefined variables, handled below.
- $output_vars = ("# " . basename ($infile) . " generated by automake "
- . $VERSION . " from " . basename ($amfile) . ".\n");
- $output_vars .= '# ' . subst ('configure_input') . "\n";
- $output_vars .= $gen_copyright;
-
- # We want to predefine as many variables as possible. This lets
- # the user set them with '+=' in Makefile.am.
- define_standard_variables;
-
- # Read user file, which might override some of our values.
- read_am_file ($amfile, new Automake::Location, '.');
-}
-
-
-
-################################################################
-
-# $STRING
-# flatten ($ORIGINAL_STRING)
-# --------------------------
-sub flatten
-{
- $_ = shift;
-
- s/\\\n//somg;
- s/\s+/ /g;
- s/^ //;
- s/ $//;
-
- return $_;
-}
-
-
-# transform_token ($TOKEN, \%PAIRS, $KEY)
-# ---------------------------------------
-# Return the value associated to $KEY in %PAIRS, as used on $TOKEN
-# (which should be ?KEY? or any of the special %% requests)..
-sub transform_token ($\%$)
-{
- my ($token, $transform, $key) = @_;
- my $res = $transform->{$key};
- prog_error "Unknown key '$key' in '$token'" unless defined $res;
- return $res;
-}
-
-
-# transform ($TOKEN, \%PAIRS)
-# ---------------------------
-# If ($TOKEN, $VAL) is in %PAIRS:
-# - replaces %KEY% with $VAL,
-# - enables/disables ?KEY? and ?!KEY?,
-# - replaces %?KEY% with TRUE or FALSE.
-sub transform ($\%)
-{
- my ($token, $transform) = @_;
-
- # %KEY%.
- # Must be before the following pattern to exclude the case
- # when there is neither IFTRUE nor IFFALSE.
- if ($token =~ /^%([\w\-]+)%$/)
- {
- return transform_token ($token, %$transform, $1);
- }
- # %?KEY%.
- elsif ($token =~ /^%\?([\w\-]+)%$/)
- {
- return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE';
- }
- # ?KEY? and ?!KEY?.
- elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x)
- {
- my $neg = ($1 eq '!') ? 1 : 0;
- my $val = transform_token ($token, %$transform, $2);
- return (!!$val == $neg) ? '##%' : '';
- }
- else
- {
- prog_error "Unknown request format: $token";
- }
-}
-
-# $TEXT
-# preprocess_file ($MAKEFILE, [%TRANSFORM])
-# -----------------------------------------
-# Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
-# No extra parsing or post-processing is done (i.e., recognition of
-# rules declaration or of make variables definitions).
-sub preprocess_file
-{
- my ($file, %transform) = @_;
-
- # Complete %transform with global options.
- # Note that %transform goes last, so it overrides global options.
- %transform = ( 'MAINTAINER-MODE'
- => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '',
-
- 'XZ' => !! option 'dist-xz',
- 'LZIP' => !! option 'dist-lzip',
- 'BZIP2' => !! option 'dist-bzip2',
- 'COMPRESS' => !! option 'dist-tarZ',
- 'GZIP' => ! option 'no-dist-gzip',
- 'SHAR' => !! option 'dist-shar',
- 'ZIP' => !! option 'dist-zip',
-
- 'INSTALL-INFO' => ! option 'no-installinfo',
- 'INSTALL-MAN' => ! option 'no-installman',
- 'CK-NEWS' => !! option 'check-news',
-
- 'SUBDIRS' => !! var ('SUBDIRS'),
- 'TOPDIR_P' => $relative_dir eq '.',
-
- 'BUILD' => ($seen_canonical >= AC_CANONICAL_BUILD),
- 'HOST' => ($seen_canonical >= AC_CANONICAL_HOST),
- 'TARGET' => ($seen_canonical >= AC_CANONICAL_TARGET),
-
- 'LIBTOOL' => !! var ('LIBTOOL'),
- 'NONLIBTOOL' => 1,
- %transform);
-
- if (! defined ($_ = $am_file_cache{$file}))
- {
- verb "reading $file";
- # Swallow the whole file.
- my $fc_file = new Automake::XFile "< $file";
- my $saved_dollar_slash = $/;
- undef $/;
- $_ = $fc_file->getline;
- $/ = $saved_dollar_slash;
- $fc_file->close;
- # Remove ##-comments.
- # Besides we don't need more than two consecutive new-lines.
- s/(?:$IGNORE_PATTERN|(?<=\n\n)\n+)//gom;
- # Remember the contents of the just-read file.
- $am_file_cache{$file} = $_;
- }
-
- # Substitute Automake template tokens.
- s/(?: % \?? [\w\-]+ %
- | \? !? [\w\-]+ \?
- )/transform($&, %transform)/gex;
- # transform() may have added some ##%-comments to strip.
- # (we use '##%' instead of '##' so we can distinguish ##%##%##% from
- # ####### and do not remove the latter.)
- s/^[ \t]*(?:##%)+.*\n//gm;
-
- return $_;
-}
-
-
-# @PARAGRAPHS
-# make_paragraphs ($MAKEFILE, [%TRANSFORM])
-# -----------------------------------------
-# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
-# paragraphs.
-sub make_paragraphs
-{
- my ($file, %transform) = @_;
- $transform{FIRST} = !$transformed_files{$file};
- $transformed_files{$file} = 1;
-
- my @lines = split /(?set ($file);
-
- my $result_vars = '';
- my $result_rules = '';
- my $comment = '';
- my $spacing = '';
-
- # The following flags are used to track rules spanning across
- # multiple paragraphs.
- my $is_rule = 0; # 1 if we are processing a rule.
- my $discard_rule = 0; # 1 if the current rule should not be output.
-
- # We save the conditional stack on entry, and then check to make
- # sure it is the same on exit. This lets us conditionally include
- # other files.
- my @saved_cond_stack = @cond_stack;
- my $cond = new Automake::Condition (@cond_stack);
-
- foreach (make_paragraphs ($file, %transform))
- {
- # FIXME: no line number available.
- $where->set ($file);
-
- # Sanity checks.
- error $where, "blank line following trailing backslash:\n$_"
- if /\\$/;
- error $where, "comment following trailing backslash:\n$_"
- if /\\#/;
-
- if (/^$/)
- {
- $is_rule = 0;
- # Stick empty line before the incoming macro or rule.
- $spacing = "\n";
- }
- elsif (/$COMMENT_PATTERN/mso)
- {
- $is_rule = 0;
- # Stick comments before the incoming macro or rule.
- $comment = "$_\n";
- }
-
- # Handle inclusion of other files.
- elsif (/$INCLUDE_PATTERN/o)
- {
- if ($cond != FALSE)
- {
- my $file = ($is_am ? "$libdir/am/" : '') . $1;
- $where->push_context ("'$file' included from here");
- # N-ary '.=' fails.
- my ($com, $vars, $rules)
- = file_contents_internal ($is_am, $file, $where, %transform);
- $where->pop_context;
- $comment .= $com;
- $result_vars .= $vars;
- $result_rules .= $rules;
- }
- }
-
- # Handling the conditionals.
- elsif (/$IF_PATTERN/o)
- {
- $cond = cond_stack_if ($1, $2, $file);
- }
- elsif (/$ELSE_PATTERN/o)
- {
- $cond = cond_stack_else ($1, $2, $file);
- }
- elsif (/$ENDIF_PATTERN/o)
- {
- $cond = cond_stack_endif ($1, $2, $file);
- }
-
- # Handling rules.
- elsif (/$RULE_PATTERN/mso)
- {
- $is_rule = 1;
- $discard_rule = 0;
- # Separate relationship from optional actions: the first
- # `new-line tab" not preceded by backslash (continuation
- # line).
- my $paragraph = $_;
- /^(.*?)(?:(?subst_string/gme;
- $result_rules .= "$spacing$comment$condparagraph\n";
- }
- if (scalar @undefined_conds == 0)
- {
- # Remember to discard next paragraphs
- # if they belong to this rule.
- # (but see also FIXME: #2 above.)
- $discard_rule = 1;
- }
- $comment = $spacing = '';
- last;
- }
- }
- }
-
- elsif (/$ASSIGNMENT_PATTERN/mso)
- {
- my ($var, $type, $val) = ($1, $2, $3);
- error $where, "variable '$var' with trailing backslash"
- if /\\$/;
-
- $is_rule = 0;
-
- Automake::Variable::define ($var,
- $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE,
- $type, $cond, $val, $comment, $where,
- VAR_ASIS)
- if $cond != FALSE;
-
- $comment = $spacing = '';
- }
- else
- {
- # This isn't an error; it is probably some tokens which
- # configure is supposed to replace, such as '@SET-MAKE@',
- # or some part of a rule cut by an if/endif.
- if (! $cond->false && ! ($is_rule && $discard_rule))
- {
- s/^/$cond->subst_string/gme;
- $result_rules .= "$spacing$comment$_\n";
- }
- $comment = $spacing = '';
- }
- }
-
- error ($where, @cond_stack ?
- "unterminated conditionals: @cond_stack" :
- "too many conditionals closed in include file")
- if "@saved_cond_stack" ne "@cond_stack";
-
- return ($comment, $result_vars, $result_rules);
-}
-
-
-# $CONTENTS
-# file_contents ($BASENAME, $WHERE, [%TRANSFORM])
-# -----------------------------------------------
-# Return contents of a file from $libdir/am, automatically skipping
-# macros or rules which are already known.
-sub file_contents
-{
- my ($basename, $where, %transform) = @_;
- my ($comments, $variables, $rules) =
- file_contents_internal (1, "$libdir/am/$basename.am", $where,
- %transform);
- return "$comments$variables$rules";
-}
-
-
-# @PREFIX
-# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
-# ----------------------------------------------------
-# Find all variable prefixes that are used for install directories. A
-# prefix 'zar' qualifies iff:
-#
-# * 'zardir' is a variable.
-# * 'zar_PRIMARY' is a variable.
-#
-# As a side effect, it looks for misspellings. It is an error to have
-# a variable ending in a "reserved" suffix whose prefix is unknown, e.g.
-# "bni_PROGRAMS". However, unusual prefixes are allowed if a variable
-# of the same name (with "dir" appended) exists. For instance, if the
-# variable "zardir" is defined, then "zar_PROGRAMS" becomes valid.
-# This is to provide a little extra flexibility in those cases which
-# need it.
-sub am_primary_prefixes
-{
- my ($primary, $can_dist, @prefixes) = @_;
-
- local $_;
- my %valid = map { $_ => 0 } @prefixes;
- $valid{'EXTRA'} = 0;
- foreach my $var (variables $primary)
- {
- # Automake is allowed to define variables that look like primaries
- # but which aren't. E.g. INSTALL_sh_DATA.
- # Autoconf can also define variables like INSTALL_DATA, so
- # ignore all configure variables (at least those which are not
- # redefined in Makefile.am).
- # FIXME: We should make sure that these variables are not
- # conditionally defined (or else adjust the condition below).
- my $def = $var->def (TRUE);
- next if $def && $def->owner != VAR_MAKEFILE;
-
- my $varname = $var->name;
-
- if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/)
- {
- my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || '');
- if ($dist ne '' && ! $can_dist)
- {
- err_var ($var,
- "invalid variable '$varname': 'dist' is forbidden");
- }
- # Standard directories must be explicitly allowed.
- elsif (! defined $valid{$X} && exists $standard_prefix{$X})
- {
- err_var ($var,
- "'${X}dir' is not a legitimate directory " .
- "for '$primary'");
- }
- # A not explicitly valid directory is allowed if Xdir is defined.
- elsif (! defined $valid{$X} &&
- $var->requires_variables ("'$varname' is used", "${X}dir"))
- {
- # Nothing to do. Any error message has been output
- # by $var->requires_variables.
- }
- else
- {
- # Ensure all extended prefixes are actually used.
- $valid{"$base$dist$X"} = 1;
- }
- }
- else
- {
- prog_error "unexpected variable name: $varname";
- }
- }
-
- # Return only those which are actually defined.
- return sort grep { var ($_ . '_' . $primary) } keys %valid;
-}
-
-
-# am_install_var (-OPTION..., file, HOW, where...)
-# ------------------------------------------------
-#
-# Handle 'where_HOW' variable magic. Does all lookups, generates
-# install code, and possibly generates code to define the primary
-# variable. The first argument is the name of the .am file to munge,
-# the second argument is the primary variable (e.g. HEADERS), and all
-# subsequent arguments are possible installation locations.
-#
-# Returns list of [$location, $value] pairs, where
-# $value's are the values in all where_HOW variable, and $location
-# there associated location (the place here their parent variables were
-# defined).
-#
-# FIXME: this should be rewritten to be cleaner. It should be broken
-# up into multiple functions.
-#
-sub am_install_var
-{
- my (@args) = @_;
-
- my $do_require = 1;
- my $can_dist = 0;
- my $default_dist = 0;
- while (@args)
- {
- if ($args[0] eq '-noextra')
- {
- $do_require = 0;
- }
- elsif ($args[0] eq '-candist')
- {
- $can_dist = 1;
- }
- elsif ($args[0] eq '-defaultdist')
- {
- $default_dist = 1;
- $can_dist = 1;
- }
- elsif ($args[0] !~ /^-/)
- {
- last;
- }
- shift (@args);
- }
-
- my ($file, $primary, @prefix) = @args;
-
- # Now that configure substitutions are allowed in where_HOW
- # variables, it is an error to actually define the primary. We
- # allow 'JAVA', as it is customarily used to mean the Java
- # interpreter. This is but one of several Java hacks. Similarly,
- # 'PYTHON' is customarily used to mean the Python interpreter.
- reject_var $primary, "'$primary' is an anachronism"
- unless $primary eq 'JAVA' || $primary eq 'PYTHON';
-
- # Get the prefixes which are valid and actually used.
- @prefix = am_primary_prefixes ($primary, $can_dist, @prefix);
-
- # If a primary includes a configure substitution, then the EXTRA_
- # form is required. Otherwise we can't properly do our job.
- my $require_extra;
-
- my @used = ();
- my @result = ();
-
- foreach my $X (@prefix)
- {
- my $nodir_name = $X;
- my $one_name = $X . '_' . $primary;
- my $one_var = var $one_name;
-
- my $strip_subdir = 1;
- # If subdir prefix should be preserved, do so.
- if ($nodir_name =~ /^nobase_/)
- {
- $strip_subdir = 0;
- $nodir_name =~ s/^nobase_//;
- }
-
- # If files should be distributed, do so.
- my $dist_p = 0;
- if ($can_dist)
- {
- $dist_p = (($default_dist && $nodir_name !~ /^nodist_/)
- || (! $default_dist && $nodir_name =~ /^dist_/));
- $nodir_name =~ s/^(dist|nodist)_//;
- }
-
-
- # Use the location of the currently processed variable.
- # We are not processing a particular condition, so pick the first
- # available.
- my $tmpcond = $one_var->conditions->one_cond;
- my $where = $one_var->rdef ($tmpcond)->location->clone;
-
- # Append actual contents of where_PRIMARY variable to
- # @result, skipping @substitutions@.
- foreach my $locvals ($one_var->value_as_list_recursive (location => 1))
- {
- my ($loc, $value) = @$locvals;
- # Skip configure substitutions.
- if ($value =~ /^\@.*\@$/)
- {
- if ($nodir_name eq 'EXTRA')
- {
- error ($where,
- "'$one_name' contains configure substitution, "
- . "but shouldn't");
- }
- # Check here to make sure variables defined in
- # configure.ac do not imply that EXTRA_PRIMARY
- # must be defined.
- elsif (! defined $configure_vars{$one_name})
- {
- $require_extra = $one_name
- if $do_require;
- }
- }
- else
- {
- # Strip any $(EXEEXT) suffix the user might have added,
- # or this will confuse handle_source_transform() and
- # check_canonical_spelling().
- # We'll add $(EXEEXT) back later anyway.
- # Do it here rather than in handle_programs so the
- # uniquifying at the end of this function works.
- ${$locvals}[1] =~ s/\$\(EXEEXT\)$//
- if $primary eq 'PROGRAMS';
-
- push (@result, $locvals);
- }
- }
- # A blatant hack: we rewrite each _PROGRAMS primary to include
- # EXEEXT.
- append_exeext { 1 } $one_name
- if $primary eq 'PROGRAMS';
- # "EXTRA" shouldn't be used when generating clean targets,
- # all, or install targets. We used to warn if EXTRA_FOO was
- # defined uselessly, but this was annoying.
- next
- if $nodir_name eq 'EXTRA';
-
- if ($nodir_name eq 'check')
- {
- push (@check, '$(' . $one_name . ')');
- }
- else
- {
- push (@used, '$(' . $one_name . ')');
- }
-
- # Is this to be installed?
- my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check';
-
- # If so, with install-exec? (or install-data?).
- my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o);
-
- my $check_options_p = $install_p && !! option 'std-options';
-
- # Use the location of the currently processed variable as context.
- $where->push_context ("while processing '$one_name'");
-
- # The variable containing all files to distribute.
- my $distvar = "\$($one_name)";
- $distvar = shadow_unconditionally ($one_name, $where)
- if ($dist_p && $one_var->has_conditional_contents);
-
- # Singular form of $PRIMARY.
- (my $one_primary = $primary) =~ s/S$//;
- $output_rules .= file_contents ($file, $where,
- PRIMARY => $primary,
- ONE_PRIMARY => $one_primary,
- DIR => $X,
- NDIR => $nodir_name,
- BASE => $strip_subdir,
- EXEC => $exec_p,
- INSTALL => $install_p,
- DIST => $dist_p,
- DISTVAR => $distvar,
- 'CK-OPTS' => $check_options_p);
- }
-
- # The JAVA variable is used as the name of the Java interpreter.
- # The PYTHON variable is used as the name of the Python interpreter.
- if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON')
- {
- # Define it.
- define_pretty_variable ($primary, TRUE, INTERNAL, @used);
- $output_vars .= "\n";
- }
-
- err_var ($require_extra,
- "'$require_extra' contains configure substitution,\n"
- . "but 'EXTRA_$primary' not defined")
- if ($require_extra && ! var ('EXTRA_' . $primary));
-
- # Push here because PRIMARY might be configure time determined.
- push (@all, '$(' . $primary . ')')
- if @used && $primary ne 'JAVA' && $primary ne 'PYTHON';
-
- # Make the result unique. This lets the user use conditionals in
- # a natural way, but still lets us program lazily -- we don't have
- # to worry about handling a particular object more than once.
- # We will keep only one location per object.
- my %result = ();
- for my $pair (@result)
- {
- my ($loc, $val) = @$pair;
- $result{$val} = $loc;
- }
- my @l = sort keys %result;
- return map { [$result{$_}->clone, $_] } @l;
-}
-
-
-################################################################
-
-# Each key in this hash is the name of a directory holding a
-# Makefile.in. These variables are local to 'is_make_dir'.
-my %make_dirs = ();
-my $make_dirs_set = 0;
-
-# is_make_dir ($DIRECTORY)
-# ------------------------
-sub is_make_dir
-{
- my ($dir) = @_;
- if (! $make_dirs_set)
- {
- foreach my $iter (@configure_input_files)
- {
- $make_dirs{dirname ($iter)} = 1;
- }
- # We also want to notice Makefile.in's.
- foreach my $iter (@other_input_files)
- {
- if ($iter =~ /Makefile\.in$/)
- {
- $make_dirs{dirname ($iter)} = 1;
- }
- }
- $make_dirs_set = 1;
- }
- return defined $make_dirs{$dir};
-}
-
-################################################################
-
-# Find the aux dir. This should match the algorithm used by
-# ./configure. (See the Autoconf documentation for for
-# AC_CONFIG_AUX_DIR.)
-sub locate_aux_dir ()
-{
- if (! $config_aux_dir_set_in_configure_ac)
- {
- # The default auxiliary directory is the first
- # of ., .., or ../.. that contains install-sh.
- # Assume . if install-sh doesn't exist yet.
- for my $dir (qw (. .. ../..))
- {
- if (-f "$dir/install-sh")
- {
- $config_aux_dir = $dir;
- last;
- }
- }
- $config_aux_dir = '.' unless $config_aux_dir;
- }
- # Avoid unsightly '/.'s.
- $am_config_aux_dir =
- '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir");
- $am_config_aux_dir =~ s,/*$,,;
-}
-
-
-# push_required_file ($DIR, $FILE, $FULLFILE)
-# -------------------------------------------
-# Push the given file onto DIST_COMMON.
-sub push_required_file
-{
- my ($dir, $file, $fullfile) = @_;
-
- # If the file to be distributed is in the same directory of the
- # currently processed Makefile.am, then we want to distribute it
- # from this same Makefile.am.
- if ($dir eq $relative_dir)
- {
- push_dist_common ($file);
- }
- # This is needed to allow a construct in a non-top-level Makefile.am
- # to require a file in the build-aux directory (see at least the test
- # script 'test-driver-is-distributed.sh'). This is related to the
- # automake bug#9546. Note that the use of $config_aux_dir instead
- # of $am_config_aux_dir here is deliberate and necessary.
- elsif ($dir eq $config_aux_dir)
- {
- push_dist_common ("$am_config_aux_dir/$file");
- }
- # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
- # We probably need some refactoring of this function and its callers,
- # to have a more explicit and systematic handling of all the special
- # cases; but, since there are only two of them, this is low-priority
- # ATM.
- elsif ($config_libobj_dir && $dir eq $config_libobj_dir)
- {
- # Avoid unsightly '/.'s.
- my $am_config_libobj_dir =
- '$(top_srcdir)' .
- ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir");
- $am_config_libobj_dir =~ s|/*$||;
- push_dist_common ("$am_config_libobj_dir/$file");
- }
- elsif ($relative_dir eq '.' && ! is_make_dir ($dir))
- {
- # If we are doing the topmost directory, and the file is in a
- # subdir which does not have a Makefile, then we distribute it
- # here.
-
- # If a required file is above the source tree, it is important
- # to prefix it with '$(srcdir)' so that no VPATH search is
- # performed. Otherwise problems occur with Make implementations
- # that rewrite and simplify rules whose dependencies are found in a
- # VPATH location. Here is an example with OSF1/Tru64 Make.
- #
- # % cat Makefile
- # VPATH = sub
- # distdir: ../a
- # echo ../a
- # % ls
- # Makefile a
- # % make
- # echo a
- # a
- #
- # Dependency '../a' was found in 'sub/../a', but this make
- # implementation simplified it as 'a'. (Note that the sub/
- # directory does not even exist.)
- #
- # This kind of VPATH rewriting seems hard to cancel. The
- # distdir.am hack against VPATH rewriting works only when no
- # simplification is done, i.e., for dependencies which are in
- # subdirectories, not in enclosing directories. Hence, in
- # the latter case we use a full path to make sure no VPATH
- # search occurs.
- $fullfile = '$(srcdir)/' . $fullfile
- if $dir =~ m,^\.\.(?:$|/),;
-
- push_dist_common ($fullfile);
- }
- else
- {
- prog_error "a Makefile in relative directory $relative_dir " .
- "can't add files in directory $dir to DIST_COMMON";
- }
-}
-
-
-# If a file name appears as a key in this hash, then it has already
-# been checked for. This allows us not to report the same error more
-# than once.
-my %required_file_not_found = ();
-
-# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
-# -------------------------------------------------------
-# Verify that the file must exist in $DIRECTORY, or install it.
-sub required_file_check_or_copy
-{
- my ($where, $dir, $file) = @_;
-
- my $fullfile = "$dir/$file";
- my $found_it = 0;
- my $dangling_sym = 0;
-
- if (-l $fullfile && ! -f $fullfile)
- {
- $dangling_sym = 1;
- }
- elsif (dir_has_case_matching_file ($dir, $file))
- {
- $found_it = 1;
- }
-
- # '--force-missing' only has an effect if '--add-missing' is
- # specified.
- return
- if $found_it && (! $add_missing || ! $force_missing);
-
- # If we've already looked for it, we're done. You might
- # wonder why we don't do this before searching for the
- # file. If we do that, then something like
- # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
- # DIST_COMMON.
- if (! $found_it)
- {
- return if defined $required_file_not_found{$fullfile};
- $required_file_not_found{$fullfile} = 1;
- }
- if ($dangling_sym && $add_missing)
- {
- unlink ($fullfile);
- }
-
- my $trailer = '';
- my $trailer2 = '';
- my $suppress = 0;
-
- # Only install missing files according to our desired
- # strictness level.
- my $message = "required file '$fullfile' not found";
- if ($add_missing)
- {
- if (-f "$libdir/$file")
- {
- $suppress = 1;
-
- # Install the missing file. Symlink if we
- # can, copy if we must. Note: delete the file
- # first, in case it is a dangling symlink.
- $message = "installing '$fullfile'";
-
- # The license file should not be volatile.
- if ($file eq "COPYING")
- {
- $message .= " using GNU General Public License v3 file";
- $trailer2 = "\n Consider adding the COPYING file"
- . " to the version control system"
- . "\n for your code, to avoid questions"
- . " about which license your project uses";
- }
-
- # Windows Perl will hang if we try to delete a
- # file that doesn't exist.
- unlink ($fullfile) if -f $fullfile;
- if ($symlink_exists && ! $copy_missing)
- {
- if (! symlink ("$libdir/$file", $fullfile)
- || ! -e $fullfile)
- {
- $suppress = 0;
- $trailer = "; error while making link: $!";
- }
- }
- elsif (system ('cp', "$libdir/$file", $fullfile))
- {
- $suppress = 0;
- $trailer = "\n error while copying";
- }
- set_dir_cache_file ($dir, $file);
- }
- }
- else
- {
- $trailer = "\n 'automake --add-missing' can install '$file'"
- if -f "$libdir/$file";
- }
-
- # If --force-missing was specified, and we have
- # actually found the file, then do nothing.
- return
- if $found_it && $force_missing;
-
- # If we couldn't install the file, but it is a target in
- # the Makefile, don't print anything. This allows files
- # like README, AUTHORS, or THANKS to be generated.
- return
- if !$suppress && rule $file;
-
- msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
-}
-
-
-# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
-# ---------------------------------------------------------------------
-# Verify that the file must exist in $DIRECTORY, or install it.
-# $MYSTRICT is the strictness level at which this file becomes required.
-# Worker threads may queue up the action to be serialized by the master,
-# if $QUEUE is true
-sub require_file_internal
-{
- my ($where, $mystrict, $dir, $queue, @files) = @_;
-
- return
- unless $strictness >= $mystrict;
-
- foreach my $file (@files)
- {
- push_required_file ($dir, $file, "$dir/$file");
- if ($queue)
- {
- queue_required_file_check_or_copy ($required_conf_file_queue,
- QUEUE_CONF_FILE, $relative_dir,
- $where, $mystrict, @files);
- }
- else
- {
- required_file_check_or_copy ($where, $dir, $file);
- }
- }
-}
-
-# require_file ($WHERE, $MYSTRICT, @FILES)
-# ----------------------------------------
-sub require_file
-{
- my ($where, $mystrict, @files) = @_;
- require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
-}
-
-# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------
-sub require_file_with_macro
-{
- my ($cond, $macro, $mystrict, @files) = @_;
- $macro = rvar ($macro) unless ref $macro;
- require_file ($macro->rdef ($cond)->location, $mystrict, @files);
-}
-
-# require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ---------------------------------------------------------------
-# Require an AC_LIBSOURCEd file. If AC_CONFIG_LIBOBJ_DIR was called, it
-# must be in that directory. Otherwise expect it in the current directory.
-sub require_libsource_with_macro
-{
- my ($cond, $macro, $mystrict, @files) = @_;
- $macro = rvar ($macro) unless ref $macro;
- if ($config_libobj_dir)
- {
- require_file_internal ($macro->rdef ($cond)->location, $mystrict,
- $config_libobj_dir, 0, @files);
- }
- else
- {
- require_file ($macro->rdef ($cond)->location, $mystrict, @files);
- }
-}
-
-# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
-# $MYSTRICT, @FILES)
-# --------------------------------------------------------------
-sub queue_required_file_check_or_copy
-{
- my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
- my @serial_loc;
- if (ref $where)
- {
- @serial_loc = (QUEUE_LOCATION, $where->serialize ());
- }
- else
- {
- @serial_loc = (QUEUE_STRING, $where);
- }
- $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
-}
-
-# require_queued_file_check_or_copy ($QUEUE)
-# ------------------------------------------
-sub require_queued_file_check_or_copy
-{
- my ($queue) = @_;
- my $where;
- my $dir = $queue->dequeue ();
- my $loc_key = $queue->dequeue ();
- if ($loc_key eq QUEUE_LOCATION)
- {
- $where = Automake::Location::deserialize ($queue);
- }
- elsif ($loc_key eq QUEUE_STRING)
- {
- $where = $queue->dequeue ();
- }
- else
- {
- prog_error "unexpected key $loc_key";
- }
- my $mystrict = $queue->dequeue ();
- my $nfiles = $queue->dequeue ();
- my @files;
- push @files, $queue->dequeue ()
- foreach (1 .. $nfiles);
- return
- unless $strictness >= $mystrict;
- foreach my $file (@files)
- {
- required_file_check_or_copy ($where, $config_aux_dir, $file);
- }
-}
-
-# require_conf_file ($WHERE, $MYSTRICT, @FILES)
-# ---------------------------------------------
-# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
-sub require_conf_file
-{
- my ($where, $mystrict, @files) = @_;
- my $queue = defined $required_conf_file_queue ? 1 : 0;
- require_file_internal ($where, $mystrict, $config_aux_dir,
- $queue, @files);
-}
-
-
-# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ---------------------------------------------------------------
-sub require_conf_file_with_macro
-{
- my ($cond, $macro, $mystrict, @files) = @_;
- require_conf_file (rvar ($macro)->rdef ($cond)->location,
- $mystrict, @files);
-}
-
-################################################################
-
-# require_build_directory ($DIRECTORY)
-# ------------------------------------
-# Emit rules to create $DIRECTORY if needed, and return
-# the file that any target requiring this directory should be made
-# dependent upon.
-# We don't want to emit the rule twice, and want to reuse it
-# for directories with equivalent names (e.g., 'foo/bar' and './foo//bar').
-sub require_build_directory
-{
- my $directory = shift;
-
- return $directory_map{$directory} if exists $directory_map{$directory};
-
- my $cdir = File::Spec->canonpath ($directory);
-
- if (exists $directory_map{$cdir})
- {
- my $stamp = $directory_map{$cdir};
- $directory_map{$directory} = $stamp;
- return $stamp;
- }
-
- my $dirstamp = "$cdir/\$(am__dirstamp)";
-
- $directory_map{$directory} = $dirstamp;
- $directory_map{$cdir} = $dirstamp;
-
- # Set a variable for the dirstamp basename.
- define_pretty_variable ('am__dirstamp', TRUE, INTERNAL,
- '$(am__leading_dot)dirstamp');
-
- # Directory must be removed by 'make distclean'.
- $clean_files{$dirstamp} = DIST_CLEAN;
-
- $output_rules .= ("$dirstamp:\n"
- . "\t\@\$(MKDIR_P) $directory\n"
- . "\t\@: > $dirstamp\n");
-
- return $dirstamp;
-}
-
-# require_build_directory_maybe ($FILE)
-# -------------------------------------
-# If $FILE lies in a subdirectory, emit a rule to create this
-# directory and return the file that $FILE should be made
-# dependent upon. Otherwise, just return the empty string.
-sub require_build_directory_maybe
-{
- my $file = shift;
- my $directory = dirname ($file);
-
- if ($directory ne '.')
- {
- return require_build_directory ($directory);
- }
- else
- {
- return '';
- }
-}
-
-################################################################
-
-# Push a list of files onto '@dist_common'.
-sub push_dist_common
-{
- prog_error "push_dist_common run after handle_dist"
- if $handle_dist_run;
- Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_",
- '', INTERNAL, VAR_PRETTY);
-}
-
-
-################################################################
-
-# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN)
-# ----------------------------------------------
-# Generate a Makefile.in given the name of the corresponding Makefile and
-# the name of the file output by config.status.
-sub generate_makefile
-{
- my ($makefile_am, $makefile_in) = @_;
-
- # Reset all the Makefile.am related variables.
- initialize_per_input;
-
- # AUTOMAKE_OPTIONS can contains -W flags to disable or enable
- # warnings for this file. So hold any warning issued before
- # we have processed AUTOMAKE_OPTIONS.
- buffer_messages ('warning');
-
- # $OUTPUT is encoded. If it contains a ":" then the first element
- # is the real output file, and all remaining elements are input
- # files. We don't scan or otherwise deal with these input files,
- # other than to mark them as dependencies. See the subroutine
- # 'scan_autoconf_files' for details.
- my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in});
-
- $relative_dir = dirname ($makefile);
-
- read_main_am_file ($makefile_am, $makefile_in);
- if (handle_options)
- {
- # Process buffered warnings.
- flush_messages;
- # Fatal error. Just return, so we can continue with next file.
- return;
- }
- # Process buffered warnings.
- flush_messages;
-
- # There are a few install-related variables that you should not define.
- foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL')
- {
- my $v = var $var;
- if ($v)
- {
- my $def = $v->def (TRUE);
- prog_error "$var not defined in condition TRUE"
- unless $def;
- reject_var $var, "'$var' should not be defined"
- if $def->owner != VAR_AUTOMAKE;
- }
- }
-
- # Catch some obsolete variables.
- msg_var ('obsolete', 'INCLUDES',
- "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')")
- if var ('INCLUDES');
-
- # Must do this after reading .am file.
- define_variable ('subdir', $relative_dir, INTERNAL);
-
- # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
- # recursive rules are enabled.
- define_pretty_variable ('SUBDIRS', TRUE, INTERNAL, '')
- if var 'DIST_SUBDIRS' && ! var 'SUBDIRS';
-
- # Check first, because we might modify some state.
- check_gnu_standards;
- check_gnits_standards;
-
- handle_configure ($makefile_am, $makefile_in, $makefile, @inputs);
- handle_gettext;
- handle_libraries;
- handle_ltlibraries;
- handle_programs;
- handle_scripts;
-
- handle_silent;
-
- # These must be run after all the sources are scanned. They use
- # variables defined by handle_libraries(), handle_ltlibraries(),
- # or handle_programs().
- handle_compile;
- handle_languages;
- handle_libtool;
-
- # Variables used by distdir.am and tags.am.
- define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources);
- if (! option 'no-dist')
- {
- define_pretty_variable ('DIST_SOURCES', TRUE, INTERNAL, @dist_sources);
- }
-
- handle_texinfo;
- handle_emacs_lisp;
- handle_python;
- handle_java;
- handle_man_pages;
- handle_data;
- handle_headers;
- handle_subdirs;
- handle_user_recursion;
- handle_tags;
- handle_minor_options;
- # Must come after handle_programs so that %known_programs is up-to-date.
- handle_tests;
-
- # This must come after most other rules.
- handle_dist;
-
- handle_footer;
- do_check_merge_target;
- handle_all ($makefile);
-
- # FIXME: Gross!
- if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
- {
- $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
- }
- if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
- {
- $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n";
- }
-
- handle_install;
- handle_clean ($makefile);
- handle_factored_dependencies;
-
- # Comes last, because all the above procedures may have
- # defined or overridden variables.
- $output_vars .= output_variables;
-
- check_typos;
-
- if ($exit_code != 0)
- {
- verb "not writing $makefile_in because of earlier errors";
- return;
- }
-
- my $am_relative_dir = dirname ($makefile_am);
- mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir;
-
- # We make sure that 'all:' is the first target.
- my $output =
- "$output_vars$output_all$output_header$output_rules$output_trailer";
-
- # Decide whether we must update the output file or not.
- # We have to update in the following situations.
- # * $force_generation is set.
- # * any of the output dependencies is younger than the output
- # * the contents of the output is different (this can happen
- # if the project has been populated with a file listed in
- # @common_files since the last run).
- # Output's dependencies are split in two sets:
- # * dependencies which are also configure dependencies
- # These do not change between each Makefile.am
- # * other dependencies, specific to the Makefile.am being processed
- # (such as the Makefile.am itself, or any Makefile fragment
- # it includes).
- my $timestamp = mtime $makefile_in;
- if (! $force_generation
- && $configure_deps_greatest_timestamp < $timestamp
- && $output_deps_greatest_timestamp < $timestamp
- && $output eq contents ($makefile_in))
- {
- verb "$makefile_in unchanged";
- # No need to update.
- return;
- }
-
- if (-e $makefile_in)
- {
- unlink ($makefile_in)
- or fatal "cannot remove $makefile_in: $!";
- }
-
- my $gm_file = new Automake::XFile "> $makefile_in";
- verb "creating $makefile_in";
- print $gm_file $output;
-}
-
-
-################################################################
-
-
-# Helper function for usage().
-sub print_autodist_files
-{
- # NOTE: we need to call our 'uniq' function with the leading '&'
- # here, because otherwise perl complains that "Unquoted string
- # 'uniq' may clash with future reserved word".
- my @lcomm = sort (&uniq (@_));
-
- my @four;
- format USAGE_FORMAT =
- @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
- $four[0], $four[1], $four[2], $four[3]
-.
- local $~ = "USAGE_FORMAT";
-
- my $cols = 4;
- my $rows = int(@lcomm / $cols);
- my $rest = @lcomm % $cols;
-
- if ($rest)
- {
- $rows++;
- }
- else
- {
- $rest = $cols;
- }
-
- for (my $y = 0; $y < $rows; $y++)
- {
- @four = ("", "", "", "");
- for (my $x = 0; $x < $cols; $x++)
- {
- last if $y + 1 == $rows && $x == $rest;
-
- my $idx = (($x > $rest)
- ? ($rows * $rest + ($rows - 1) * ($x - $rest))
- : ($rows * $x));
-
- $idx += $y;
- $four[$x] = $lcomm[$idx];
- }
- write;
- }
-}
-
-
-sub usage ()
-{
- print "Usage: $0 [OPTION]... [Makefile]...
-
-Generate Makefile.in for configure from Makefile.am.
-
-Operation modes:
- --help print this help, then exit
- --version print version number, then exit
- -v, --verbose verbosely list files processed
- --no-force only update Makefile.in's that are out of date
- -W, --warnings=CATEGORY report the warnings falling in CATEGORY
-
-Dependency tracking:
- -i, --ignore-deps disable dependency tracking code
- --include-deps enable dependency tracking code
-
-Flavors:
- --foreign set strictness to foreign
- --gnits set strictness to gnits
- --gnu set strictness to gnu
-
-Library files:
- -a, --add-missing add missing standard files to package
- --libdir=DIR set directory storing library files
- --print-libdir print directory storing library files
- -c, --copy with -a, copy missing files (default is symlink)
- -f, --force-missing force update of standard files
-
-";
- Automake::ChannelDefs::usage;
-
- print "\nFiles automatically distributed if found " .
- "(always):\n";
- print_autodist_files @common_files;
- print "\nFiles automatically distributed if found " .
- "(under certain conditions):\n";
- print_autodist_files @common_sometimes;
-
- print '
-Report bugs to <@PACKAGE_BUGREPORT@>.
-GNU Automake home page: <@PACKAGE_URL@>.
-General help using GNU software: .
-';
-
- # --help always returns 0 per GNU standards.
- exit 0;
-}
-
-
-sub version ()
-{
- print <
-This is free software: you are free to change and redistribute it.
-There is NO WARRANTY, to the extent permitted by law.
-
-Written by Tom Tromey
- and Alexandre Duret-Lutz .
-EOF
- # --version always returns 0 per GNU standards.
- exit 0;
-}
-
-################################################################
-
-# Parse command line.
-sub parse_arguments ()
-{
- my $strict = 'gnu';
- my $ignore_deps = 0;
- my @warnings = ();
-
- my %cli_options =
- (
- 'version' => \&version,
- 'help' => \&usage,
- 'libdir=s' => \$libdir,
- 'print-libdir' => sub { print "$libdir\n"; exit 0; },
- 'gnu' => sub { $strict = 'gnu'; },
- 'gnits' => sub { $strict = 'gnits'; },
- 'foreign' => sub { $strict = 'foreign'; },
- 'include-deps' => sub { $ignore_deps = 0; },
- 'i|ignore-deps' => sub { $ignore_deps = 1; },
- 'no-force' => sub { $force_generation = 0; },
- 'f|force-missing' => \$force_missing,
- 'a|add-missing' => \$add_missing,
- 'c|copy' => \$copy_missing,
- 'v|verbose' => sub { setup_channel 'verb', silent => 0; },
- 'W|warnings=s' => \@warnings,
- );
-
- use Automake::Getopt ();
- Automake::Getopt::parse_options %cli_options;
-
- set_strictness ($strict);
- my $cli_where = new Automake::Location;
- set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
- for my $warning (@warnings)
- {
- parse_warnings ('-W', $warning);
- }
-
- return unless @ARGV;
-
- my $errspec = 0;
- foreach my $arg (@ARGV)
- {
- fatal ("empty argument\nTry '$0 --help' for more information")
- if ($arg eq '');
-
- # Handle $local:$input syntax.
- my ($local, @rest) = split (/:/, $arg);
- @rest = ("$local.in",) unless @rest;
- my $input = locate_am @rest;
- if ($input)
- {
- push @input_files, $input;
- $output_files{$input} = join (':', ($local, @rest));
- }
- else
- {
- error "no Automake input file found for '$arg'";
- $errspec = 1;
- }
- }
- fatal "no input file found among supplied arguments"
- if $errspec && ! @input_files;
-}
-
-
-# handle_makefile ($MAKEFILE)
-# ---------------------------
-sub handle_makefile
-{
- my ($file) = @_;
- ($am_file = $file) =~ s/\.in$//;
- if (! -f ($am_file . '.am'))
- {
- error "'$am_file.am' does not exist";
- }
- else
- {
- # Any warning setting now local to this Makefile.am.
- dup_channel_setup;
-
- generate_makefile ($am_file . '.am', $file);
-
- # Back out any warning setting.
- drop_channel_setup;
- }
-}
-
-# Deal with all makefiles, without threads.
-sub handle_makefiles_serial ()
-{
- foreach my $file (@input_files)
- {
- handle_makefile ($file);
- }
-}
-
-# Logic for deciding how many worker threads to use.
-sub get_number_of_threads ()
-{
- my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
-
- $nthreads = 0
- unless $nthreads =~ /^[0-9]+$/;
-
- # It doesn't make sense to use more threads than makefiles,
- my $max_threads = @input_files;
-
- if ($nthreads > $max_threads)
- {
- $nthreads = $max_threads;
- }
- return $nthreads;
-}
-
-# handle_makefiles_threaded ($NTHREADS)
-# -------------------------------------
-# Deal with all makefiles, using threads. The general strategy is to
-# spawn NTHREADS worker threads, dispatch makefiles to them, and let the
-# worker threads push back everything that needs serialization:
-# * warning and (normal) error messages, for stable stderr output
-# order and content (avoiding duplicates, for example),
-# * races when installing aux files (and respective messages),
-# * races when collecting aux files for distribution.
-#
-# The latter requires that the makefile that deals with the aux dir
-# files be handled last, done by the master thread.
-sub handle_makefiles_threaded
-{
- my ($nthreads) = @_;
-
- # The file queue distributes all makefiles, the message queues
- # collect all serializations needed for respective files.
- my $file_queue = Thread::Queue->new;
- my %msg_queues;
- foreach my $file (@input_files)
- {
- $msg_queues{$file} = Thread::Queue->new;
- }
-
- verb "spawning $nthreads worker threads";
- my @threads = (1 .. $nthreads);
- foreach my $t (@threads)
- {
- $t = threads->new (sub
- {
- while (my $file = $file_queue->dequeue)
- {
- verb "handling $file";
- my $queue = $msg_queues{$file};
- setup_channel_queue ($queue, QUEUE_MESSAGE);
- $required_conf_file_queue = $queue;
- handle_makefile ($file);
- $queue->enqueue (undef);
- setup_channel_queue (undef, undef);
- $required_conf_file_queue = undef;
- }
- return $exit_code;
- });
- }
-
- # Queue all makefiles.
- verb "queuing " . @input_files . " input files";
- $file_queue->enqueue (@input_files, (undef) x @threads);
-
- # Collect and process serializations.
- foreach my $file (@input_files)
- {
- verb "dequeuing messages for " . $file;
- reset_local_duplicates ();
- my $queue = $msg_queues{$file};
- while (my $key = $queue->dequeue)
- {
- if ($key eq QUEUE_MESSAGE)
- {
- pop_channel_queue ($queue);
- }
- elsif ($key eq QUEUE_CONF_FILE)
- {
- require_queued_file_check_or_copy ($queue);
- }
- else
- {
- prog_error "unexpected key $key";
- }
- }
- }
-
- foreach my $t (@threads)
- {
- my @exit_thread = $t->join;
- $exit_code = $exit_thread[0]
- if ($exit_thread[0] > $exit_code);
- }
-}
-
-################################################################
-
-# Parse the WARNINGS environment variable.
-parse_WARNINGS;
-
-# Parse command line.
-parse_arguments;
-
-$configure_ac = require_configure_ac;
-
-# Do configure.ac scan only once.
-scan_autoconf_files;
-
-if (! @input_files)
- {
- my $msg = '';
- $msg = "\nDid you forget AC_CONFIG_FILES([Makefile]) in $configure_ac?"
- if -f 'Makefile.am';
- fatal ("no 'Makefile.am' found for any configure output$msg");
- }
-
-my $nthreads = get_number_of_threads ();
-
-if ($perl_threads && $nthreads >= 1)
- {
- handle_makefiles_threaded ($nthreads);
- }
-else
- {
- handle_makefiles_serial ();
- }
-
-exit $exit_code;
-
-
-### Setup "GNU" style for perl-mode and cperl-mode.
-## Local Variables:
-## perl-indent-level: 2
-## perl-continued-statement-offset: 2
-## perl-continued-brace-offset: 0
-## perl-brace-offset: 0
-## perl-brace-imaginary-offset: 0
-## perl-label-offset: -2
-## cperl-indent-level: 2
-## cperl-brace-offset: 0
-## cperl-continued-brace-offset: 0
-## cperl-label-offset: -2
-## cperl-extra-newline-before-brace: t
-## cperl-merge-trailing-else: nil
-## cperl-continued-statement-offset: 2
-## End:
diff --git a/bin/Makefile.inc b/bin/Makefile.inc
new file mode 100644
index 000000000..280fff002
--- /dev/null
+++ b/bin/Makefile.inc
@@ -0,0 +1,70 @@
+## Copyright (C) 1995-2013 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 2, 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 .
+
+## ----------------------------------- ##
+## The automake and aclocal scripts. ##
+## ----------------------------------- ##
+
+bin_SCRIPTS = %D%/automake %D%/aclocal
+CLEANFILES += $(bin_SCRIPTS)
+
+# Used by maintainer checks and such.
+automake_in = $(srcdir)/%D%/automake.in
+aclocal_in = $(srcdir)/%D%/aclocal.in
+automake_script = %D%/automake
+aclocal_script = %D%/aclocal
+
+AUTOMAKESOURCES = $(automake_in) $(aclocal_in)
+TAGS_FILES += $(AUTOMAKESOURCES)
+EXTRA_DIST += $(AUTOMAKESOURCES)
+
+# Make versioned links. We only run the transform on the root name;
+# then we make a versioned link with the transformed base name. This
+# seemed like the most reasonable approach.
+install-exec-hook:
+ @$(POST_INSTALL)
+ @for p in $(bin_SCRIPTS); do \
+ f=`echo $$p | sed -e 's,.*/,,' -e '$(transform)'`; \
+ fv="$$f-$(APIVERSION)"; \
+ rm -f "$(DESTDIR)$(bindir)/$$fv"; \
+ echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
+ $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
+ done
+
+uninstall-hook:
+ @for p in $(bin_SCRIPTS); do \
+ f=`echo $$p | sed -e 's,.*/,,' -e '$(transform)'`; \
+ fv="$$f-$(APIVERSION)"; \
+ rm -f "$(DESTDIR)$(bindir)/$$fv"; \
+ done
+
+# These files depend on Makefile so they are rebuilt if $(VERSION),
+# $(datadir) or other do_subst'ituted variables change.
+%D%/automake: %D%/automake.in
+%D%/aclocal: %D%/aclocal.in
+%D%/automake %D%/aclocal: Makefile %D%/gen-perl-protos
+ $(AM_V_GEN)rm -f $@ $@-t $@-t2 \
+## Common substitutions.
+ && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
+## Auto-compute prototypes of perl subroutines.
+ && $(PERL) -w $(srcdir)/%D%/gen-perl-protos $@-t > $@-t2 \
+ && mv -f $@-t2 $@-t \
+## We can't use '$(generated_file_finalize)' here, because currently
+## Automake contains occurrences of unexpanded @substitutions@ in
+## comments, and that is perfectly legit.
+ && chmod a+x,a-w $@-t && mv -f $@-t $@
+EXTRA_DIST += %D%/gen-perl-protos
+
+# vim: ft=automake noet
diff --git a/bin/aclocal.in b/bin/aclocal.in
new file mode 100644
index 000000000..ba3047905
--- /dev/null
+++ b/bin/aclocal.in
@@ -0,0 +1,1214 @@
+#!@PERL@ -w
+# -*- perl -*-
+# @configure_input@
+
+eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
+ if 0;
+
+# aclocal - create aclocal.m4 by scanning configure.ac
+
+# Copyright (C) 1996-2013 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 2, 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 .
+
+# Written by Tom Tromey , and
+# Alexandre Duret-Lutz .
+
+BEGIN
+{
+ @Aclocal::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@')
+ unless @Aclocal::perl_libdirs;
+ unshift @INC, @Aclocal::perl_libdirs;
+}
+
+use strict;
+
+use Automake::Config;
+use Automake::General;
+use Automake::Configure_ac;
+use Automake::Channels;
+use Automake::ChannelDefs;
+use Automake::XFile;
+use Automake::FileUtils;
+use File::Basename;
+use File::Path ();
+
+# Some globals.
+
+# Support AC_CONFIG_MACRO_DIRS also with older autoconf.
+# FIXME: To be removed in Automake 2.0, once we can assume autoconf
+# 2.70 or later.
+# FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'.
+my $ac_config_macro_dirs_fallback =
+ 'm4_ifndef([AC_CONFIG_MACRO_DIRS], [' .
+ 'm4_defun([_AM_CONFIG_MACRO_DIRS], [])' .
+ 'm4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])' .
+ '])';
+
+# We do not operate in threaded mode.
+$perl_threads = 0;
+
+# Include paths for searching macros. We search macros in this order:
+# user-supplied directories first, then the directory containing the
+# automake macros, and finally the system-wide directories for
+# third-party macros.
+# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS.
+# @automake_includes can be reset with the '--automake-acdir' option.
+# @system_includes can be augmented with the 'dirlist' file or the
+# ACLOCAL_PATH environment variable, and reset with the '--system-acdir'
+# option.
+my @user_includes = ();
+my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
+my @system_includes = ('@datadir@/aclocal');
+
+# Whether we should copy M4 file in $user_includes[0].
+my $install = 0;
+
+# --diff
+my @diff_command;
+
+# --dry-run
+my $dry_run = 0;
+
+# configure.ac or configure.in.
+my $configure_ac;
+
+# Output file name.
+my $output_file = 'aclocal.m4';
+
+# Option --force.
+my $force_output = 0;
+
+# Modification time of the youngest dependency.
+my $greatest_mtime = 0;
+
+# Which macros have been seen.
+my %macro_seen = ();
+
+# Remember the order into which we scanned the files.
+# It's important to output the contents of aclocal.m4 in the opposite order.
+# (Definitions in first files we have scanned should override those from
+# later files. So they must appear last in the output.)
+my @file_order = ();
+
+# Map macro names to file names.
+my %map = ();
+
+# Ditto, but records the last definition of each macro as returned by --trace.
+my %map_traced_defs = ();
+
+# Map basenames to macro names.
+my %invmap = ();
+
+# Map file names to file contents.
+my %file_contents = ();
+
+# Map file names to file types.
+my %file_type = ();
+use constant FT_USER => 1;
+use constant FT_AUTOMAKE => 2;
+use constant FT_SYSTEM => 3;
+
+# Map file names to included files (transitively closed).
+my %file_includes = ();
+
+# Files which have already been added.
+my %file_added = ();
+
+# Files that have already been scanned.
+my %scanned_configure_dep = ();
+
+# Serial numbers, for files that have one.
+# The key is the basename of the file,
+# the value is the serial number represented as a list.
+my %serial = ();
+
+# Matches a macro definition.
+# AC_DEFUN([macroname], ...)
+# or
+# AC_DEFUN(macroname, ...)
+# When macroname is '['-quoted , we accept any character in the name,
+# except ']'. Otherwise macroname stops on the first ']', ',', ')',
+# or '\n' encountered.
+my $ac_defun_rx =
+ "(?:AU_ALIAS|A[CU]_DEFUN|AC_DEFUN_ONCE)\\((?:\\[([^]]+)\\]|([^],)\n]+))";
+
+# Matches an AC_REQUIRE line.
+my $ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
+
+# Matches an m4_include line.
+my $m4_include_rx = "(m4_|m4_s|s)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)";
+
+# Match a serial number.
+my $serial_line_rx = '^#\s*serial\s+(\S*)';
+my $serial_number_rx = '^\d+(?:\.\d+)*$';
+
+# Autoconf version. This variable is set by 'trace_used_macros'.
+my $ac_version;
+
+# User directory containing extra m4 files for macros definition,
+# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS.
+# This variable is updated by 'trace_used_macros'.
+my @ac_config_macro_dirs;
+
+# If set, names a temporary file that must be erased on abnormal exit.
+my $erase_me;
+
+# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function.
+use constant SCAN_M4_DIRS_SILENT => 0;
+use constant SCAN_M4_DIRS_WARN => 1;
+use constant SCAN_M4_DIRS_ERROR => 2;
+
+################################################################
+
+# Prototypes for all subroutines.
+
+#! Prototypes here will automatically be generated by the build system.
+
+################################################################
+
+# Erase temporary file ERASE_ME. Handle signals.
+sub unlink_tmp (;$)
+{
+ my ($sig) = @_;
+
+ if ($sig)
+ {
+ verb "caught SIG$sig, bailing out";
+ }
+ if (defined $erase_me && -e $erase_me && !unlink ($erase_me))
+ {
+ fatal "could not remove '$erase_me': $!";
+ }
+ undef $erase_me;
+
+ # reraise default handler.
+ if ($sig)
+ {
+ $SIG{$sig} = 'DEFAULT';
+ kill $sig => $$;
+ }
+}
+
+$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp';
+END { unlink_tmp }
+
+sub xmkdir_p ($)
+{
+ my $dir = shift;
+ local $@ = undef;
+ return
+ if -d $dir or eval { File::Path::mkpath $dir };
+ chomp $@;
+ $@ =~ s/\s+at\s.*\bline\s\d+.*$//;
+ fatal "could not create directory '$dir': $@";
+}
+
+# Check macros in acinclude.m4. If one is not used, warn.
+sub check_acinclude ()
+{
+ foreach my $key (keys %map)
+ {
+ # FIXME: should print line number of acinclude.m4.
+ msg ('syntax', "macro '$key' defined in acinclude.m4 but never used")
+ if $map{$key} eq 'acinclude.m4' && ! exists $macro_seen{$key};
+ }
+}
+
+sub reset_maps ()
+{
+ $greatest_mtime = 0;
+ %macro_seen = ();
+ @file_order = ();
+ %map = ();
+ %map_traced_defs = ();
+ %file_contents = ();
+ %file_type = ();
+ %file_includes = ();
+ %file_added = ();
+ %scanned_configure_dep = ();
+ %invmap = ();
+ %serial = ();
+ undef &search;
+}
+
+# install_file ($SRC, $DESTDIR)
+sub install_file ($$)
+{
+ my ($src, $destdir) = @_;
+ my $dest = $destdir . "/" . basename ($src);
+ my $diff_dest;
+
+ verb "installing $src to $dest";
+
+ if ($force_output
+ || !exists $file_contents{$dest}
+ || $file_contents{$src} ne $file_contents{$dest})
+ {
+ if (-e $dest)
+ {
+ msg 'note', "overwriting '$dest' with '$src'";
+ $diff_dest = $dest;
+ }
+ else
+ {
+ msg 'note', "installing '$dest' from '$src'";
+ }
+
+ if (@diff_command)
+ {
+ if (! defined $diff_dest)
+ {
+ # $dest does not exist. We create an empty one just to
+ # run diff, and we erase it afterward. Using the real
+ # the destination file (rather than a temporary file) is
+ # good when diff is run with options that display the
+ # file name.
+ #
+ # If creating $dest fails, fall back to /dev/null. At
+ # least one diff implementation (Tru64's) cannot deal
+ # with /dev/null. However working around this is not
+ # worth the trouble since nobody run aclocal on a
+ # read-only tree anyway.
+ $erase_me = $dest;
+ my $f = new IO::File "> $dest";
+ if (! defined $f)
+ {
+ undef $erase_me;
+ $diff_dest = '/dev/null';
+ }
+ else
+ {
+ $diff_dest = $dest;
+ $f->close;
+ }
+ }
+ my @cmd = (@diff_command, $diff_dest, $src);
+ $! = 0;
+ verb "running: @cmd";
+ my $res = system (@cmd);
+ Automake::FileUtils::handle_exec_errors "@cmd", 1
+ if $res;
+ unlink_tmp;
+ }
+ elsif (!$dry_run)
+ {
+ xmkdir_p ($destdir);
+ xsystem ('cp', $src, $dest);
+ }
+ }
+}
+
+# Compare two lists of numbers.
+sub list_compare (\@\@)
+{
+ my @l = @{$_[0]};
+ my @r = @{$_[1]};
+ while (1)
+ {
+ if (0 == @l)
+ {
+ return (0 == @r) ? 0 : -1;
+ }
+ elsif (0 == @r)
+ {
+ return 1;
+ }
+ elsif ($l[0] < $r[0])
+ {
+ return -1;
+ }
+ elsif ($l[0] > $r[0])
+ {
+ return 1;
+ }
+ shift @l;
+ shift @r;
+ }
+}
+
+################################################################
+
+# scan_m4_dirs($TYPE, $ERR_LEVEL, @DIRS)
+# -----------------------------------------------
+# Scan all M4 files installed in @DIRS for new macro definitions.
+# Register each file as of type $TYPE (one of the FT_* constants).
+# If a directory in @DIRS cannot be read:
+# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR
+# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA
+# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT
+sub scan_m4_dirs ($$@)
+{
+ my ($type, $err_level, @dirlist) = @_;
+
+ foreach my $m4dir (@dirlist)
+ {
+ if (! opendir (DIR, $m4dir))
+ {
+ # TODO: maybe avoid complaining only if errno == ENONENT?
+ my $message = "couldn't open directory '$m4dir': $!";
+
+ if ($err_level == SCAN_M4_DIRS_ERROR)
+ {
+ fatal $message;
+ }
+ elsif ($err_level == SCAN_M4_DIRS_WARN)
+ {
+ msg ('unsupported', $message);
+ next;
+ }
+ elsif ($err_level == SCAN_M4_DIRS_SILENT)
+ {
+ next; # Silently ignore.
+ }
+ else
+ {
+ prog_error "invalid \$err_level value '$err_level'";
+ }
+ }
+
+ # We reverse the directory contents so that foo2.m4 gets
+ # used in preference to foo1.m4.
+ foreach my $file (reverse sort grep (! /^\./, readdir (DIR)))
+ {
+ # Only examine .m4 files.
+ next unless $file =~ /\.m4$/;
+
+ # Skip some files when running out of srcdir.
+ next if $file eq 'aclocal.m4';
+
+ my $fullfile = File::Spec->canonpath ("$m4dir/$file");
+ scan_file ($type, $fullfile, 'aclocal');
+ }
+ closedir (DIR);
+ }
+}
+
+# Scan all the installed m4 files and construct a map.
+sub scan_m4_files ()
+{
+ # First, scan configure.ac. It may contain macro definitions,
+ # or may include other files that define macros.
+ scan_file (FT_USER, $configure_ac, 'aclocal');
+
+ # Then, scan acinclude.m4 if it exists.
+ if (-f 'acinclude.m4')
+ {
+ scan_file (FT_USER, 'acinclude.m4', 'aclocal');
+ }
+
+ # Finally, scan all files in our search paths.
+
+ if (@user_includes)
+ {
+ # Don't explore the same directory multiple times. This is here not
+ # only for speedup purposes. We need this when the user has e.g.
+ # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set
+ # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac. This makes the 'm4'
+ # directory to occur twice here and fail on the second call to
+ # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist.
+ # TODO: Shouldn't there be rather a check in scan_m4_dirs for
+ # @user_includes[0]?
+ @user_includes = uniq @user_includes;
+
+ # Don't complain if the first user directory doesn't exist, in case
+ # we need to create it later (can happen if '--install' was given).
+ scan_m4_dirs (FT_USER,
+ $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN,
+ $user_includes[0]);
+ scan_m4_dirs (FT_USER,
+ SCAN_M4_DIRS_ERROR,
+ @user_includes[1..$#user_includes]);
+ }
+ scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
+
+ # Construct a new function that does the searching. We use a
+ # function (instead of just evaluating $search in the loop) so that
+ # "die" is correctly and easily propagated if run.
+ my $search = "sub search {\nmy \$found = 0;\n";
+ foreach my $key (reverse sort keys %map)
+ {
+ $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { add_macro ("' . $key
+ . '"); $found = 1; }' . "\n");
+ }
+ $search .= "return \$found;\n};\n";
+ eval $search;
+ prog_error "$@\n search is $search" if $@;
+}
+
+################################################################
+
+# Add a macro to the output.
+sub add_macro ($)
+{
+ my ($macro) = @_;
+
+ # Ignore unknown required macros. Either they are not really
+ # needed (e.g., a conditional AC_REQUIRE), in which case aclocal
+ # should be quiet, or they are needed and Autoconf itself will
+ # complain when we trace for macro usage later.
+ return unless defined $map{$macro};
+
+ verb "saw macro $macro";
+ $macro_seen{$macro} = 1;
+ add_file ($map{$macro});
+}
+
+# scan_configure_dep ($file)
+# --------------------------
+# Scan a configure dependency (configure.ac, or separate m4 files)
+# for uses of known macros and AC_REQUIREs of possibly unknown macros.
+# Recursively scan m4_included files.
+sub scan_configure_dep ($)
+{
+ my ($file) = @_;
+ # Do not scan a file twice.
+ return ()
+ if exists $scanned_configure_dep{$file};
+ $scanned_configure_dep{$file} = 1;
+
+ my $mtime = mtime $file;
+ $greatest_mtime = $mtime if $greatest_mtime < $mtime;
+
+ my $contents = exists $file_contents{$file} ?
+ $file_contents{$file} : contents $file;
+
+ my $line = 0;
+ my @rlist = ();
+ my @ilist = ();
+ foreach (split ("\n", $contents))
+ {
+ ++$line;
+ # Remove comments from current line.
+ s/\bdnl\b.*$//;
+ s/\#.*$//;
+ # Avoid running all the following regexes on white lines.
+ next if /^\s*$/;
+
+ while (/$m4_include_rx/go)
+ {
+ my $ifile = $2 || $3;
+ # Skip missing 'sinclude'd files.
+ next if $1 ne 'm4_' && ! -f $ifile;
+ push @ilist, $ifile;
+ }
+
+ while (/$ac_require_rx/go)
+ {
+ push (@rlist, $1 || $2);
+ }
+
+ # The search function is constructed dynamically by
+ # scan_m4_files. The last parenthetical match makes sure we
+ # don't match things that look like macro assignments or
+ # AC_SUBSTs.
+ if (! &search && /(^|\s+)(AM_[A-Z0-9_]+)($|[^\]\)=A-Z0-9_])/)
+ {
+ # Macro not found, but AM_ prefix found.
+ # Make this just a warning, because we do not know whether
+ # the macro is actually used (it could be called conditionally).
+ msg ('unsupported', "$file:$line",
+ "macro '$2' not found in library");
+ }
+ }
+
+ add_macro ($_) foreach (@rlist);
+ scan_configure_dep ($_) foreach @ilist;
+}
+
+# add_file ($FILE)
+# ----------------
+# Add $FILE to output.
+sub add_file ($)
+{
+ my ($file) = @_;
+
+ # Only add a file once.
+ return if ($file_added{$file});
+ $file_added{$file} = 1;
+
+ scan_configure_dep $file;
+}
+
+# Point to the documentation for underquoted AC_DEFUN only once.
+my $underquoted_manual_once = 0;
+
+# scan_file ($TYPE, $FILE, $WHERE)
+# --------------------------------
+# Scan a single M4 file ($FILE), and all files it includes.
+# Return the list of included files.
+# $TYPE is one of FT_USER, FT_AUTOMAKE, or FT_SYSTEM, depending
+# on where the file comes from.
+# $WHERE is the location to use in the diagnostic if the file
+# does not exist.
+sub scan_file ($$$)
+{
+ my ($type, $file, $where) = @_;
+ my $basename = basename $file;
+
+ # Do not scan the same file twice.
+ return @{$file_includes{$file}} if exists $file_includes{$file};
+ # Prevent potential infinite recursion (if two files include each other).
+ return () if exists $file_contents{$file};
+
+ unshift @file_order, $file;
+
+ $file_type{$file} = $type;
+
+ fatal "$where: file '$file' does not exist" if ! -e $file;
+
+ my $fh = new Automake::XFile $file;
+ my $contents = '';
+ my @inc_files = ();
+ my %inc_lines = ();
+
+ my $defun_seen = 0;
+ my $serial_seen = 0;
+ my $serial_older = 0;
+
+ while ($_ = $fh->getline)
+ {
+ # Ignore '##' lines.
+ next if /^##/;
+
+ $contents .= $_;
+ my $line = $_;
+
+ if ($line =~ /$serial_line_rx/go)
+ {
+ my $number = $1;
+ if ($number !~ /$serial_number_rx/go)
+ {
+ msg ('syntax', "$file:$.",
+ "ill-formed serial number '$number', "
+ . "expecting a version string with only digits and dots");
+ }
+ elsif ($defun_seen)
+ {
+ # aclocal removes all definitions from M4 file with the
+ # same basename if a greater serial number is found.
+ # Encountering a serial after some macros will undefine
+ # these macros...
+ msg ('syntax', "$file:$.",
+ 'the serial number must appear before any macro definition');
+ }
+ # We really care about serials only for non-automake macros
+ # and when --install is used. But the above diagnostics are
+ # made regardless of this, because not using --install is
+ # not a reason not the fix macro files.
+ elsif ($install && $type != FT_AUTOMAKE)
+ {
+ $serial_seen = 1;
+ my @new = split (/\./, $number);
+
+ verb "$file:$.: serial $number";
+
+ if (!exists $serial{$basename}
+ || list_compare (@new, @{$serial{$basename}}) > 0)
+ {
+ # Delete any definition we knew from the old macro.
+ foreach my $def (@{$invmap{$basename}})
+ {
+ verb "$file:$.: ignoring previous definition of $def";
+ delete $map{$def};
+ }
+ $invmap{$basename} = [];
+ $serial{$basename} = \@new;
+ }
+ else
+ {
+ $serial_older = 1;
+ }
+ }
+ }
+
+ # Remove comments from current line.
+ # Do not do it earlier, because the serial line is a comment.
+ $line =~ s/\bdnl\b.*$//;
+ $line =~ s/\#.*$//;
+
+ while ($line =~ /$ac_defun_rx/go)
+ {
+ $defun_seen = 1;
+ if (! defined $1)
+ {
+ msg ('syntax', "$file:$.", "underquoted definition of $2"
+ . "\n run info Automake 'Extending aclocal'\n"
+ . " or see http://www.gnu.org/software/automake/manual/"
+ . "automake.html#Extending-aclocal")
+ unless $underquoted_manual_once;
+ $underquoted_manual_once = 1;
+ }
+
+ # If this macro does not have a serial and we have already
+ # seen a macro with the same basename earlier, we should
+ # ignore the macro (don't exit immediately so we can still
+ # diagnose later #serial numbers and underquoted macros).
+ $serial_older ||= ($type != FT_AUTOMAKE
+ && !$serial_seen && exists $serial{$basename});
+
+ my $macro = $1 || $2;
+ if (!$serial_older && !defined $map{$macro})
+ {
+ verb "found macro $macro in $file: $.";
+ $map{$macro} = $file;
+ push @{$invmap{$basename}}, $macro;
+ }
+ else
+ {
+ # Note: we used to give an error here if we saw a
+ # duplicated macro. However, this turns out to be
+ # extremely unpopular. It causes actual problems which
+ # are hard to work around, especially when you must
+ # mix-and-match tool versions.
+ verb "ignoring macro $macro in $file: $.";
+ }
+ }
+
+ while ($line =~ /$m4_include_rx/go)
+ {
+ my $ifile = $2 || $3;
+ # Skip missing 'sinclude'd files.
+ next if $1 ne 'm4_' && ! -f $ifile;
+ push (@inc_files, $ifile);
+ $inc_lines{$ifile} = $.;
+ }
+ }
+
+ # Ignore any file that has an old serial (or no serial if we know
+ # another one with a serial).
+ return ()
+ if ($serial_older ||
+ ($type != FT_AUTOMAKE && !$serial_seen && exists $serial{$basename}));
+
+ $file_contents{$file} = $contents;
+
+ # For some reason I don't understand, it does not work
+ # to do "map { scan_file ($_, ...) } @inc_files" below.
+ # With Perl 5.8.2 it undefines @inc_files.
+ my @copy = @inc_files;
+ my @all_inc_files = (@inc_files,
+ map { scan_file ($type, $_,
+ "$file:$inc_lines{$_}") } @copy);
+ $file_includes{$file} = \@all_inc_files;
+ return @all_inc_files;
+}
+
+# strip_redundant_includes (%FILES)
+# ---------------------------------
+# Each key in %FILES is a file that must be present in the output.
+# However some of these files might already include other files in %FILES,
+# so there is no point in including them another time.
+# This removes items of %FILES which are already included by another file.
+sub strip_redundant_includes (%)
+{
+ my %files = @_;
+
+ # Always include acinclude.m4, even if it does not appear to be used.
+ $files{'acinclude.m4'} = 1 if -f 'acinclude.m4';
+ # File included by $configure_ac are redundant.
+ $files{$configure_ac} = 1;
+
+ # Files at the end of @file_order should override those at the beginning,
+ # so it is important to preserve these trailing files. We can remove
+ # a file A if it is going to be output before a file B that includes
+ # file A, not the converse.
+ foreach my $file (reverse @file_order)
+ {
+ next unless exists $files{$file};
+ foreach my $ifile (@{$file_includes{$file}})
+ {
+ next unless exists $files{$ifile};
+ delete $files{$ifile};
+ verb "$ifile is already included by $file";
+ }
+ }
+
+ # configure.ac is implicitly included.
+ delete $files{$configure_ac};
+
+ return %files;
+}
+
+sub trace_used_macros ()
+{
+ my %files = map { $map{$_} => 1 } keys %macro_seen;
+ %files = strip_redundant_includes %files;
+
+ # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings
+ # from autom4te about macros being "m4_require'd but not m4_defun'd";
+ # for more background, see:
+ # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html
+ # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal
+ # to silence m4_require warnings".
+ my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])";
+
+ my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@');
+ $traces .= " --language Autoconf-without-aclocal-m4 ";
+ $traces = "echo '$early_m4_code' | $traces - ";
+
+ # Support AC_CONFIG_MACRO_DIRS also with older autoconf.
+ # Note that we can't use '$ac_config_macro_dirs_fallback' here, because
+ # a bug in option parsing code of autom4te 2.68 and earlier will cause
+ # it to read standard input last, even if the "-" argument is specified
+ # early.
+ # FIXME: To be removed in Automake 2.0, once we can assume autoconf
+ # 2.70 or later.
+ $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 ";
+
+ # All candidate files.
+ $traces .= join (' ',
+ (map { "'$_'" }
+ (grep { exists $files{$_} } @file_order))) . " ";
+
+ # All candidate macros.
+ $traces .= join (' ',
+ (map { "--trace='$_:\$f::\$n::\${::}%'" }
+ ('AC_DEFUN',
+ 'AC_DEFUN_ONCE',
+ 'AU_DEFUN',
+ '_AM_AUTOCONF_VERSION',
+ 'AC_CONFIG_MACRO_DIR_TRACE',
+ # FIXME: Tracing the next two macros is a hack for
+ # compatibility with older autoconf. Remove this in
+ # Automake 2.0, when we can assume Autoconf 2.70 or
+ # later.
+ 'AC_CONFIG_MACRO_DIR',
+ '_AM_CONFIG_MACRO_DIRS')),
+ # Do not trace $1 for all other macros as we do
+ # not need it and it might contains harmful
+ # characters (like newlines).
+ (map { "--trace='$_:\$f::\$n'" } (keys %macro_seen)));
+
+ verb "running $traces $configure_ac";
+
+ my $tracefh = new Automake::XFile ("$traces $configure_ac |");
+
+ @ac_config_macro_dirs = ();
+
+ my %traced = ();
+
+ while ($_ = $tracefh->getline)
+ {
+ chomp;
+ my ($file, $macro, $arg1) = split (/::/);
+
+ $traced{$macro} = 1 if exists $macro_seen{$macro};
+
+ if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE'
+ || $macro eq 'AU_DEFUN')
+ {
+ $map_traced_defs{$arg1} = $file;
+ }
+ elsif ($macro eq '_AM_AUTOCONF_VERSION')
+ {
+ $ac_version = $arg1;
+ }
+ elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE')
+ {
+ push @ac_config_macro_dirs, $arg1;
+ }
+ # FIXME: We still need to trace AC_CONFIG_MACRO_DIR
+ # for compatibility with older autoconf. Remove this
+ # once we can assume Autoconf 2.70 or later.
+ elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
+ {
+ @ac_config_macro_dirs = ($arg1);
+ }
+ # FIXME:This is an hack for compatibility with older autoconf.
+ # Remove this once we can assume Autoconf 2.70 or later.
+ elsif ($macro eq '_AM_CONFIG_MACRO_DIRS')
+ {
+ # Empty leading/trailing fields might be produced by split,
+ # hence the grep is really needed.
+ push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1));
+ }
+ }
+
+ # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls
+ # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could
+ # leave unwanted duplicates in @ac_config_macro_dirs.
+ # Remove this in Automake 2.0, when we'll stop tracing
+ # AC_CONFIG_MACRO_DIR explicitly.
+ @ac_config_macro_dirs = uniq @ac_config_macro_dirs;
+
+ $tracefh->close;
+
+ return %traced;
+}
+
+sub scan_configure ()
+{
+ # Make sure we include acinclude.m4 if it exists.
+ if (-f 'acinclude.m4')
+ {
+ add_file ('acinclude.m4');
+ }
+ scan_configure_dep ($configure_ac);
+}
+
+################################################################
+
+# Write output.
+# Return 0 iff some files were installed locally.
+sub write_aclocal ($@)
+{
+ my ($output_file, @macros) = @_;
+ my $output = '';
+
+ my %files = ();
+ # Get the list of files containing definitions for the macros used.
+ # (Filter out unused macro definitions with $map_traced_defs. This
+ # can happen when an Autoconf macro is conditionally defined:
+ # aclocal sees the potential definition, but this definition is
+ # actually never processed and the Autoconf implementation is used
+ # instead.)
+ for my $m (@macros)
+ {
+ $files{$map{$m}} = 1
+ if (exists $map_traced_defs{$m}
+ && $map{$m} eq $map_traced_defs{$m});
+ }
+ # Do not explicitly include a file that is already indirectly included.
+ %files = strip_redundant_includes %files;
+
+ my $installed = 0;
+
+ for my $file (grep { exists $files{$_} } @file_order)
+ {
+ # Check the time stamp of this file, and of all files it includes.
+ for my $ifile ($file, @{$file_includes{$file}})
+ {
+ my $mtime = mtime $ifile;
+ $greatest_mtime = $mtime if $greatest_mtime < $mtime;
+ }
+
+ # If the file to add looks like outside the project, copy it
+ # to the output. The regex catches filenames starting with
+ # things like '/', '\', or 'c:\'.
+ if ($file_type{$file} != FT_USER
+ || $file =~ m,^(?:\w:)?[\\/],)
+ {
+ if (!$install || $file_type{$file} != FT_SYSTEM)
+ {
+ # Copy the file into aclocal.m4.
+ $output .= $file_contents{$file} . "\n";
+ }
+ else
+ {
+ # Install the file (and any file it includes).
+ my $dest;
+ for my $ifile (@{$file_includes{$file}}, $file)
+ {
+ install_file ($ifile, $user_includes[0]);
+ }
+ $installed = 1;
+ }
+ }
+ else
+ {
+ # Otherwise, simply include the file.
+ $output .= "m4_include([$file])\n";
+ }
+ }
+
+ if ($installed)
+ {
+ verb "running aclocal anew, because some files were installed locally";
+ return 0;
+ }
+
+ # Nothing to output?!
+ # FIXME: Shouldn't we diagnose this?
+ return 1 if ! length ($output);
+
+ if ($ac_version)
+ {
+ # Do not use "$output_file" here for the same reason we do not
+ # use it in the header below. autom4te will output the name of
+ # the file in the diagnostic anyway.
+ $output = "m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],,
+[m4_warning([this file was generated for autoconf $ac_version.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+$output";
+ }
+
+ # We used to print "# $output_file generated automatically etc." But
+ # this creates spurious differences when using autoreconf. Autoreconf
+ # creates aclocal.m4t and then rename it to aclocal.m4, but the
+ # rebuild rules generated by Automake create aclocal.m4 directly --
+ # this would gives two ways to get the same file, with a different
+ # name in the header.
+ $output = "# generated automatically by aclocal $VERSION -*- Autoconf -*-
+
+# Copyright (C) 1996-$RELEASE_YEAR Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+$ac_config_macro_dirs_fallback
+$output";
+
+ # We try not to update $output_file unless necessary, because
+ # doing so invalidate Autom4te's cache and therefore slows down
+ # tools called after aclocal.
+ #
+ # We need to overwrite $output_file in the following situations.
+ # * The --force option is in use.
+ # * One of the dependencies is younger.
+ # (Not updating $output_file in this situation would cause
+ # make to call aclocal in loop.)
+ # * The contents of the current file are different from what
+ # we have computed.
+ if (!$force_output
+ && $greatest_mtime < mtime ($output_file)
+ && $output eq contents ($output_file))
+ {
+ verb "$output_file unchanged";
+ return 1;
+ }
+
+ verb "writing $output_file";
+
+ if (!$dry_run)
+ {
+ if (-e $output_file && !unlink $output_file)
+ {
+ fatal "could not remove '$output_file': $!";
+ }
+ my $out = new Automake::XFile "> $output_file";
+ print $out $output;
+ }
+ return 1;
+}
+
+################################################################
+
+# Print usage and exit.
+sub usage ($)
+{
+ my ($status) = @_;
+
+ print <<'EOF';
+Usage: aclocal [OPTION]...
+
+Generate 'aclocal.m4' by scanning 'configure.ac' or 'configure.in'
+
+Options:
+ --automake-acdir=DIR directory holding automake-provided m4 files
+ --system-acdir=DIR directory holding third-party system-wide files
+ --diff[=COMMAND] run COMMAND [diff -u] on M4 files that would be
+ changed (implies --install and --dry-run)
+ --dry-run pretend to, but do not actually update any file
+ --force always update output file
+ --help print this help, then exit
+ -I DIR add directory to search list for .m4 files
+ --install copy third-party files to the first -I directory
+ --output=FILE put output in FILE (default aclocal.m4)
+ --print-ac-dir print name of directory holding system-wide
+ third-party m4 files, then exit
+ --verbose don't be silent
+ --version print version number, then exit
+ -W, --warnings=CATEGORY report the warnings falling in CATEGORY
+
+Warning categories include:
+ syntax dubious syntactic constructs (default)
+ unsupported unknown macros (default)
+ all all the warnings (default)
+ no-CATEGORY turn off warnings in CATEGORY
+ none turn off all the warnings
+ error treat warnings as errors
+
+Report bugs to <@PACKAGE_BUGREPORT@>.
+GNU Automake home page: <@PACKAGE_URL@>.
+General help using GNU software: .
+EOF
+ exit $status;
+}
+
+# Print version and exit.
+sub version ()
+{
+ print <
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Tom Tromey
+ and Alexandre Duret-Lutz .
+EOF
+ exit 0;
+}
+
+# Parse command line.
+sub parse_arguments ()
+{
+ my $print_and_exit = 0;
+ my $diff_command;
+
+ my %cli_options =
+ (
+ 'help' => sub { usage(0); },
+ 'version' => \&version,
+ 'system-acdir=s' => sub { shift; @system_includes = @_; },
+ 'automake-acdir=s' => sub { shift; @automake_includes = @_; },
+ 'diff:s' => \$diff_command,
+ 'dry-run' => \$dry_run,
+ 'force' => \$force_output,
+ 'I=s' => \@user_includes,
+ 'install' => \$install,
+ 'output=s' => \$output_file,
+ 'print-ac-dir' => \$print_and_exit,
+ 'verbose' => sub { setup_channel 'verb', silent => 0; },
+ 'W|warnings=s' => \&parse_warnings,
+ );
+
+ use Automake::Getopt ();
+ Automake::Getopt::parse_options %cli_options;
+
+ if (@ARGV > 0)
+ {
+ fatal ("non-option arguments are not accepted: '$ARGV[0]'.\n"
+ . "Try '$0 --help' for more information.");
+ }
+
+ if ($print_and_exit)
+ {
+ print "@system_includes\n";
+ exit 0;
+ }
+
+ if (defined $diff_command)
+ {
+ $diff_command = 'diff -u' if $diff_command eq '';
+ @diff_command = split (' ', $diff_command);
+ $install = 1;
+ $dry_run = 1;
+ }
+
+ # Finally, adds any directory listed in the 'dirlist' file.
+ if (open (DIRLIST, "$system_includes[0]/dirlist"))
+ {
+ while ()
+ {
+ # Ignore '#' lines.
+ next if /^#/;
+ # strip off newlines and end-of-line comments
+ s/\s*\#.*$//;
+ chomp;
+ foreach my $dir (glob)
+ {
+ push (@system_includes, $dir) if -d $dir;
+ }
+ }
+ close (DIRLIST);
+ }
+}
+
+# Add any directory listed in the 'ACLOCAL_PATH' environment variable
+# to the list of system include directories.
+sub parse_ACLOCAL_PATH ()
+{
+ return if not defined $ENV{"ACLOCAL_PATH"};
+ # Directories in ACLOCAL_PATH should take precedence over system
+ # directories, so we use unshift. However, directories that
+ # come first in ACLOCAL_PATH take precedence over directories
+ # coming later, which is why the result of split is reversed.
+ foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"})
+ {
+ unshift (@system_includes, $dir) if $dir ne '' && -d $dir;
+ }
+}
+
+################################################################
+
+parse_WARNINGS; # Parse the WARNINGS environment variable.
+parse_arguments;
+parse_ACLOCAL_PATH;
+$configure_ac = require_configure_ac;
+
+# We may have to rerun aclocal if some file have been installed, but
+# it should not happen more than once. The reason we must run again
+# is that once the file has been moved from /usr/share/aclocal/ to the
+# local m4/ directory it appears at a new place in the search path,
+# hence it should be output at a different position in aclocal.m4. If
+# we did not rerun aclocal, the next run of aclocal would produce a
+# different aclocal.m4.
+my $loop = 0;
+my $rerun_due_to_macrodir = 0;
+while (1)
+ {
+ ++$loop;
+ prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir;
+
+ reset_maps;
+ scan_m4_files;
+ scan_configure;
+ last if $exit_code;
+ my %macro_traced = trace_used_macros;
+
+ if (!$rerun_due_to_macrodir && @ac_config_macro_dirs)
+ {
+ # The directory specified in calls to the AC_CONFIG_MACRO_DIRS
+ # m4 macro (if any) must go after the user includes specified
+ # explicitly with the '-I' option.
+ push @user_includes, @ac_config_macro_dirs;
+ # We might have to scan some new directory of .m4 files.
+ $rerun_due_to_macrodir++;
+ next;
+ }
+
+ if ($install && !@user_includes)
+ {
+ fatal "installation of third-party macros impossible without " .
+ "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)";
+ }
+
+ last if write_aclocal ($output_file, keys %macro_traced);
+ last if $dry_run;
+ }
+check_acinclude;
+
+exit $exit_code;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/bin/automake.in b/bin/automake.in
new file mode 100644
index 000000000..751dc84ed
--- /dev/null
+++ b/bin/automake.in
@@ -0,0 +1,8251 @@
+#!@PERL@ -w
+# -*- perl -*-
+# @configure_input@
+
+eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
+ if 0;
+
+# automake - create Makefile.in from Makefile.am
+# Copyright (C) 1994-2013 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 2, 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 .
+
+# Originally written by David Mackenzie .
+# Perl reimplementation by Tom Tromey , and
+# Alexandre Duret-Lutz .
+
+package Automake;
+
+use strict;
+
+BEGIN
+{
+ @Automake::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@')
+ unless @Automake::perl_libdirs;
+ unshift @INC, @Automake::perl_libdirs;
+
+ # Override SHELL. This is required on DJGPP so that system() uses
+ # bash, not COMMAND.COM which doesn't quote arguments properly.
+ # Other systems aren't expected to use $SHELL when Automake
+ # runs, but it should be safe to drop the "if DJGPP" guard if
+ # it turns up other systems need the same thing. After all,
+ # if SHELL is used, ./configure's SHELL is always better than
+ # the user's SHELL (which may be something like tcsh).
+ $ENV{'SHELL'} = '@SHELL@' if exists $ENV{'DJDIR'};
+}
+
+use Automake::Config;
+BEGIN
+{
+ if ($perl_threads)
+ {
+ require threads;
+ import threads;
+ require Thread::Queue;
+ import Thread::Queue;
+ }
+}
+use Automake::General;
+use Automake::XFile;
+use Automake::Channels;
+use Automake::ChannelDefs;
+use Automake::Configure_ac;
+use Automake::FileUtils;
+use Automake::Location;
+use Automake::Condition qw/TRUE FALSE/;
+use Automake::DisjConditions;
+use Automake::Options;
+use Automake::Variable;
+use Automake::VarDef;
+use Automake::Rule;
+use Automake::RuleDef;
+use Automake::Wrap 'makefile_wrap';
+use Automake::Language;
+use File::Basename;
+use File::Spec;
+use Carp;
+
+## ----------------------- ##
+## Subroutine prototypes. ##
+## ----------------------- ##
+
+#! Prototypes here will automatically be generated by the build system.
+
+
+## ----------- ##
+## Constants. ##
+## ----------- ##
+
+# Some regular expressions. One reason to put them here is that it
+# makes indentation work better in Emacs.
+
+# Writing singled-quoted-$-terminated regexes is a pain because
+# perl-mode thinks of $' as the ${'} variable (instead of a $ followed
+# by a closing quote. Letting perl-mode think the quote is not closed
+# leads to all sort of misindentations. On the other hand, defining
+# regexes as double-quoted strings is far less readable. So usually
+# we will write:
+#
+# $REGEX = '^regex_value' . "\$";
+
+my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n';
+my $WHITE_PATTERN = '^\s*' . "\$";
+my $COMMENT_PATTERN = '^#';
+my $TARGET_PATTERN='[$a-zA-Z0-9_.@%][-.a-zA-Z0-9_(){}/$+@%]*';
+# A rule has three parts: a list of targets, a list of dependencies,
+# and optionally actions.
+my $RULE_PATTERN =
+ "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$";
+
+# Only recognize leading spaces, not leading tabs. If we recognize
+# leading tabs here then we need to make the reader smarter, because
+# otherwise it will think rules like 'foo=bar; \' are errors.
+my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$";
+# This pattern recognizes a Gnits version id and sets $1 if the
+# release is an alpha release. We also allow a suffix which can be
+# used to extend the version number with a "fork" identifier.
+my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?';
+
+my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$";
+my $ELSE_PATTERN =
+ '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
+my $ENDIF_PATTERN =
+ '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$";
+my $PATH_PATTERN = '(\w|[+/.-])+';
+# This will pass through anything not of the prescribed form.
+my $INCLUDE_PATTERN = ('^include\s+'
+ . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')'
+ . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')'
+ . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$");
+
+# Directories installed during 'install-exec' phase.
+my $EXEC_DIR_PATTERN =
+ '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
+
+# Values for AC_CANONICAL_*
+use constant AC_CANONICAL_BUILD => 1;
+use constant AC_CANONICAL_HOST => 2;
+use constant AC_CANONICAL_TARGET => 3;
+
+# Values indicating when something should be cleaned.
+use constant MOSTLY_CLEAN => 0;
+use constant CLEAN => 1;
+use constant DIST_CLEAN => 2;
+use constant MAINTAINER_CLEAN => 3;
+
+# Libtool files.
+my @libtool_files = qw(ltmain.sh config.guess config.sub);
+# ltconfig appears here for compatibility with old versions of libtool.
+my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh);
+
+# Commonly found files we look for and automatically include in
+# DISTFILES.
+my @common_files =
+ (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB
+ COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO
+ ar-lib compile config.guess config.rpath
+ config.sub depcomp install-sh libversion.in mdate-sh
+ missing mkinstalldirs py-compile texinfo.tex ylwrap),
+ @libtool_files, @libtool_sometimes);
+
+# Commonly used files we auto-include, but only sometimes. This list
+# is used for the --help output only.
+my @common_sometimes =
+ qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure
+ configure.ac configure.in stamp-vti);
+
+# Standard directories from the GNU Coding Standards, and additional
+# pkg* directories from Automake. Stored in a hash for fast member check.
+my %standard_prefix =
+ map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info
+ lib libexec lisp locale localstate man man1 man2
+ man3 man4 man5 man6 man7 man8 man9 oldinclude pdf
+ pkgdata pkginclude pkglib pkglibexec ps sbin
+ sharedstate sysconf));
+
+# Copyright on generated Makefile.ins.
+my $gen_copyright = "\
+# Copyright (C) 1994-$RELEASE_YEAR Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+";
+
+# These constants are returned by the lang_*_rewrite functions.
+# LANG_SUBDIR means that the resulting object file should be in a
+# subdir if the source file is. In this case the file name cannot
+# have '..' components.
+use constant LANG_IGNORE => 0;
+use constant LANG_PROCESS => 1;
+use constant LANG_SUBDIR => 2;
+
+# These are used when keeping track of whether an object can be built
+# by two different paths.
+use constant COMPILE_LIBTOOL => 1;
+use constant COMPILE_ORDINARY => 2;
+
+# We can't always associate a location to a variable or a rule,
+# when it's defined by Automake. We use INTERNAL in this case.
+use constant INTERNAL => new Automake::Location;
+
+# Serialization keys for message queues.
+use constant QUEUE_MESSAGE => "msg";
+use constant QUEUE_CONF_FILE => "conf file";
+use constant QUEUE_LOCATION => "location";
+use constant QUEUE_STRING => "string";
+
+## ---------------------------------- ##
+## Variables related to the options. ##
+## ---------------------------------- ##
+
+# TRUE if we should always generate Makefile.in.
+my $force_generation = 1;
+
+# From the Perl manual.
+my $symlink_exists = (eval 'symlink ("", "");', $@ eq '');
+
+# TRUE if missing standard files should be installed.
+my $add_missing = 0;
+
+# TRUE if we should copy missing files; otherwise symlink if possible.
+my $copy_missing = 0;
+
+# TRUE if we should always update files that we know about.
+my $force_missing = 0;
+
+
+## ---------------------------------------- ##
+## Variables filled during files scanning. ##
+## ---------------------------------------- ##
+
+# Name of the configure.ac file.
+my $configure_ac;
+
+# Files found by scanning configure.ac for LIBOBJS.
+my %libsources = ();
+
+# Names used in AC_CONFIG_HEADER call.
+my @config_headers = ();
+
+# Names used in AC_CONFIG_LINKS call.
+my @config_links = ();
+
+# List of Makefile.am's to process, and their corresponding outputs.
+my @input_files = ();
+my %output_files = ();
+
+# Complete list of Makefile.am's that exist.
+my @configure_input_files = ();
+
+# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's,
+# and their outputs.
+my @other_input_files = ();
+# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADER appears.
+# The keys are the files created by these macros.
+my %ac_config_files_location = ();
+# The condition under which AC_CONFIG_FOOS appears.
+my %ac_config_files_condition = ();
+
+# Directory to search for configure-required files. This
+# will be computed by locate_aux_dir() and can be set using
+# AC_CONFIG_AUX_DIR in configure.ac.
+# $CONFIG_AUX_DIR is the 'raw' directory, valid only in the source-tree.
+my $config_aux_dir = '';
+my $config_aux_dir_set_in_configure_ac = 0;
+# $AM_CONFIG_AUX_DIR is prefixed with $(top_srcdir), so it can be used
+# in Makefiles.
+my $am_config_aux_dir = '';
+
+# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR
+# in configure.ac.
+my $config_libobj_dir = '';
+
+# Whether AM_GNU_GETTEXT has been seen in configure.ac.
+my $seen_gettext = 0;
+# Whether AM_GNU_GETTEXT([external]) is used.
+my $seen_gettext_external = 0;
+# Where AM_GNU_GETTEXT appears.
+my $ac_gettext_location;
+# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen.
+my $seen_gettext_intl = 0;
+
+# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any).
+my @extra_recursive_targets = ();
+
+# Lists of tags supported by Libtool.
+my %libtool_tags = ();
+# 1 if Libtool uses LT_SUPPORTED_TAG. If it does, then it also
+# uses AC_REQUIRE_AUX_FILE.
+my $libtool_new_api = 0;
+
+# Most important AC_CANONICAL_* macro seen so far.
+my $seen_canonical = 0;
+
+# Where AM_MAINTAINER_MODE appears.
+my $seen_maint_mode;
+
+# Actual version we've seen.
+my $package_version = '';
+
+# Where version is defined.
+my $package_version_location;
+
+# TRUE if we've seen AM_PROG_AR
+my $seen_ar = 0;
+
+# Location of AC_REQUIRE_AUX_FILE calls, indexed by their argument.
+my %required_aux_file = ();
+
+# Where AM_INIT_AUTOMAKE is called;
+my $seen_init_automake = 0;
+
+# TRUE if we've seen AM_AUTOMAKE_VERSION.
+my $seen_automake_version = 0;
+
+# Hash table of discovered configure substitutions. Keys are names,
+# values are 'FILE:LINE' strings which are used by error message
+# generation.
+my %configure_vars = ();
+
+# Ignored configure substitutions (i.e., variables not to be output in
+# Makefile.in)
+my %ignored_configure_vars = ();
+
+# Files included by $configure_ac.
+my @configure_deps = ();
+
+# Greatest timestamp of configure's dependencies.
+my $configure_deps_greatest_timestamp = 0;
+
+# Hash table of AM_CONDITIONAL variables seen in configure.
+my %configure_cond = ();
+
+# This maps extensions onto language names.
+my %extension_map = ();
+
+# List of the DIST_COMMON files we discovered while reading
+# configure.ac.
+my $configure_dist_common = '';
+
+# This maps languages names onto objects.
+my %languages = ();
+# Maps each linker variable onto a language object.
+my %link_languages = ();
+
+# maps extensions to needed source flags.
+my %sourceflags = ();
+
+# List of targets we must always output.
+# FIXME: Complete, and remove falsely required targets.
+my %required_targets =
+ (
+ 'all' => 1,
+ 'dvi' => 1,
+ 'pdf' => 1,
+ 'ps' => 1,
+ 'info' => 1,
+ 'install-info' => 1,
+ 'install' => 1,
+ 'install-data' => 1,
+ 'install-exec' => 1,
+ 'uninstall' => 1,
+
+ # FIXME: Not required, temporary hacks.
+ # Well, actually they are sort of required: the -recursive
+ # targets will run them anyway...
+ 'html-am' => 1,
+ 'dvi-am' => 1,
+ 'pdf-am' => 1,
+ 'ps-am' => 1,
+ 'info-am' => 1,
+ 'install-data-am' => 1,
+ 'install-exec-am' => 1,
+ 'install-html-am' => 1,
+ 'install-dvi-am' => 1,
+ 'install-pdf-am' => 1,
+ 'install-ps-am' => 1,
+ 'install-info-am' => 1,
+ 'installcheck-am' => 1,
+ 'uninstall-am' => 1,
+ 'tags-am' => 1,
+ 'ctags-am' => 1,
+ 'cscopelist-am' => 1,
+ 'install-man' => 1,
+ );
+
+# Queue to push require_conf_file requirements to.
+my $required_conf_file_queue;
+
+# The name of the Makefile currently being processed.
+my $am_file = 'BUG';
+
+################################################################
+
+## ------------------------------------------ ##
+## Variables reset by &initialize_per_input. ##
+## ------------------------------------------ ##
+
+# Relative dir of the output makefile.
+my $relative_dir;
+
+# Greatest timestamp of the output's dependencies (excluding
+# configure's dependencies).
+my $output_deps_greatest_timestamp;
+
+# These variables are used when generating each Makefile.in.
+# They hold the Makefile.in until it is ready to be printed.
+my $output_vars;
+my $output_all;
+my $output_header;
+my $output_rules;
+my $output_trailer;
+
+# This is the conditional stack, updated on if/else/endif, and
+# used to build Condition objects.
+my @cond_stack;
+
+# This holds the set of included files.
+my @include_stack;
+
+# List of dependencies for the obvious targets.
+my @all;
+my @check;
+my @check_tests;
+
+# Keys in this hash table are files to delete. The associated
+# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.)
+my %clean_files;
+
+# Keys in this hash table are object files or other files in
+# subdirectories which need to be removed. This only holds files
+# which are created by compilations. The value in the hash indicates
+# when the file should be removed.
+my %compile_clean_files;
+
+# Keys in this hash table are directories where we expect to build a
+# libtool object. We use this information to decide what directories
+# to delete.
+my %libtool_clean_directories;
+
+# Value of $(SOURCES), used by tags.am.
+my @sources;
+# Sources which go in the distribution.
+my @dist_sources;
+
+# This hash maps object file names onto their corresponding source
+# file names. This is used to ensure that each object is created
+# by a single source file.
+my %object_map;
+
+# This hash maps object file names onto an integer value representing
+# whether this object has been built via ordinary compilation or
+# libtool compilation (the COMPILE_* constants).
+my %object_compilation_map;
+
+
+# This keeps track of the directories for which we've already
+# created dirstamp code. Keys are directories, values are stamp files.
+# Several keys can share the same stamp files if they are equivalent
+# (as are './/foo' and 'foo').
+my %directory_map;
+
+# All .P files.
+my %dep_files;
+
+# This is a list of all targets to run during "make dist".
+my @dist_targets;
+
+# Keep track of all programs declared in this Makefile, without
+# $(EXEEXT). @substitutions@ are not listed.
+my %known_programs;
+my %known_libraries;
+
+# This keeps track of which extensions we've seen (that we care
+# about).
+my %extension_seen;
+
+# This is random scratch space for the language finish functions.
+# Don't randomly overwrite it; examine other uses of keys first.
+my %language_scratch;
+
+# We keep track of which objects need special (per-executable)
+# handling on a per-language basis.
+my %lang_specific_files;
+
+# This is set when 'handle_dist' has finished. Once this happens,
+# we should no longer push on dist_common.
+my $handle_dist_run;
+
+# Used to store a set of linkers needed to generate the sources currently
+# under consideration.
+my %linkers_used;
+
+# True if we need 'LINK' defined. This is a hack.
+my $need_link;
+
+# Does the generated Makefile have to build some compiled object
+# (for binary programs, or plain or libtool libraries)?
+my $must_handle_compiled_objects;
+
+# Record each file processed by make_paragraphs.
+my %transformed_files;
+
+################################################################
+
+## ---------------------------------------------- ##
+## Variables not reset by &initialize_per_input. ##
+## ---------------------------------------------- ##
+
+# Cache each file processed by make_paragraphs.
+# (This is different from %transformed_files because
+# %transformed_files is reset for each file while %am_file_cache
+# it global to the run.)
+my %am_file_cache;
+
+################################################################
+
+# var_SUFFIXES_trigger ($TYPE, $VALUE)
+# ------------------------------------
+# This is called by Automake::Variable::define() when SUFFIXES
+# is defined ($TYPE eq '') or appended ($TYPE eq '+').
+# The work here needs to be performed as a side-effect of the
+# macro_define() call because SUFFIXES definitions impact
+# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing
+# the input am file.
+sub var_SUFFIXES_trigger
+{
+ my ($type, $value) = @_;
+ accept_extensions (split (' ', $value));
+}
+Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
+
+################################################################
+
+
+# initialize_per_input ()
+# -----------------------
+# (Re)-Initialize per-Makefile.am variables.
+sub initialize_per_input ()
+{
+ reset_local_duplicates ();
+
+ $relative_dir = undef;
+
+ $output_deps_greatest_timestamp = 0;
+
+ $output_vars = '';
+ $output_all = '';
+ $output_header = '';
+ $output_rules = '';
+ $output_trailer = '';
+
+ Automake::Options::reset;
+ Automake::Variable::reset;
+ Automake::Rule::reset;
+
+ @cond_stack = ();
+
+ @include_stack = ();
+
+ @all = ();
+ @check = ();
+ @check_tests = ();
+
+ %clean_files = ();
+ %compile_clean_files = ();
+
+ # We always include '.'. This isn't strictly correct.
+ %libtool_clean_directories = ('.' => 1);
+
+ @sources = ();
+ @dist_sources = ();
+
+ %object_map = ();
+ %object_compilation_map = ();
+
+ %directory_map = ();
+
+ %dep_files = ();
+
+ @dist_targets = ();
+
+ %known_programs = ();
+ %known_libraries= ();
+
+ %extension_seen = ();
+
+ %language_scratch = ();
+
+ %lang_specific_files = ();
+
+ $handle_dist_run = 0;
+
+ $need_link = 0;
+
+ $must_handle_compiled_objects = 0;
+
+ %transformed_files = ();
+}
+
+
+################################################################
+
+# Initialize our list of languages that are internally supported.
+
+my @cpplike_flags =
+ qw{
+ $(DEFS)
+ $(DEFAULT_INCLUDES)
+ $(INCLUDES)
+ $(AM_CPPFLAGS)
+ $(CPPFLAGS)
+ };
+
+# C.
+register_language ('name' => 'c',
+ 'Name' => 'C',
+ 'config_vars' => ['CC'],
+ 'autodep' => '',
+ 'flags' => ['CFLAGS', 'CPPFLAGS'],
+ 'ccer' => 'CC',
+ 'compiler' => 'COMPILE',
+ 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)",
+ 'lder' => 'CCLD',
+ 'ld' => '$(CC)',
+ 'linker' => 'LINK',
+ 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'compile_flag' => '-c',
+ 'libtool_tag' => 'CC',
+ 'extensions' => ['.c']);
+
+# C++.
+register_language ('name' => 'cxx',
+ 'Name' => 'C++',
+ 'config_vars' => ['CXX'],
+ 'linker' => 'CXXLINK',
+ 'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'autodep' => 'CXX',
+ 'flags' => ['CXXFLAGS', 'CPPFLAGS'],
+ 'compile' => "\$(CXX) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)",
+ 'ccer' => 'CXX',
+ 'compiler' => 'CXXCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'CXX',
+ 'lder' => 'CXXLD',
+ 'ld' => '$(CXX)',
+ 'pure' => 1,
+ 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']);
+
+# Objective C.
+register_language ('name' => 'objc',
+ 'Name' => 'Objective C',
+ 'config_vars' => ['OBJC'],
+ 'linker' => 'OBJCLINK',
+ 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'autodep' => 'OBJC',
+ 'flags' => ['OBJCFLAGS', 'CPPFLAGS'],
+ 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)",
+ 'ccer' => 'OBJC',
+ 'compiler' => 'OBJCCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'lder' => 'OBJCLD',
+ 'ld' => '$(OBJC)',
+ 'pure' => 1,
+ 'extensions' => ['.m']);
+
+# Objective C++.
+register_language ('name' => 'objcxx',
+ 'Name' => 'Objective C++',
+ 'config_vars' => ['OBJCXX'],
+ 'linker' => 'OBJCXXLINK',
+ 'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'autodep' => 'OBJCXX',
+ 'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
+ 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)",
+ 'ccer' => 'OBJCXX',
+ 'compiler' => 'OBJCXXCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'lder' => 'OBJCXXLD',
+ 'ld' => '$(OBJCXX)',
+ 'pure' => 1,
+ 'extensions' => ['.mm']);
+
+# Unified Parallel C.
+register_language ('name' => 'upc',
+ 'Name' => 'Unified Parallel C',
+ 'config_vars' => ['UPC'],
+ 'linker' => 'UPCLINK',
+ 'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'autodep' => 'UPC',
+ 'flags' => ['UPCFLAGS', 'CPPFLAGS'],
+ 'compile' => "\$(UPC) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)",
+ 'ccer' => 'UPC',
+ 'compiler' => 'UPCCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'lder' => 'UPCLD',
+ 'ld' => '$(UPC)',
+ 'pure' => 1,
+ 'extensions' => ['.upc']);
+
+# Headers.
+register_language ('name' => 'header',
+ 'Name' => 'Header',
+ 'extensions' => ['.h', '.H', '.hxx', '.h++', '.hh',
+ '.hpp', '.inc'],
+ # No output.
+ 'output_extensions' => sub { return () },
+ # Nothing to do.
+ '_finish' => sub { });
+
+# Vala
+register_language ('name' => 'vala',
+ 'Name' => 'Vala',
+ 'config_vars' => ['VALAC'],
+ 'flags' => [],
+ 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
+ 'ccer' => 'VALAC',
+ 'compiler' => 'VALACOMPILE',
+ 'extensions' => ['.vala'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
+ return ($ext,) },
+ 'rule_file' => 'vala',
+ '_finish' => \&lang_vala_finish,
+ '_target_hook' => \&lang_vala_target_hook,
+ 'nodist_specific' => 1);
+
+# Yacc (C & C++).
+register_language ('name' => 'yacc',
+ 'Name' => 'Yacc',
+ 'config_vars' => ['YACC'],
+ 'flags' => ['YFLAGS'],
+ 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)',
+ 'ccer' => 'YACC',
+ 'compiler' => 'YACCCOMPILE',
+ 'extensions' => ['.y'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
+ return ($ext,) },
+ 'rule_file' => 'yacc',
+ '_finish' => \&lang_yacc_finish,
+ '_target_hook' => \&lang_yacc_target_hook,
+ 'nodist_specific' => 1);
+register_language ('name' => 'yaccxx',
+ 'Name' => 'Yacc (C++)',
+ 'config_vars' => ['YACC'],
+ 'rule_file' => 'yacc',
+ 'flags' => ['YFLAGS'],
+ 'ccer' => 'YACC',
+ 'compiler' => 'YACCCOMPILE',
+ 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)',
+ 'extensions' => ['.y++', '.yy', '.yxx', '.ypp'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/;
+ return ($ext,) },
+ '_finish' => \&lang_yacc_finish,
+ '_target_hook' => \&lang_yacc_target_hook,
+ 'nodist_specific' => 1);
+
+# Lex (C & C++).
+register_language ('name' => 'lex',
+ 'Name' => 'Lex',
+ 'config_vars' => ['LEX'],
+ 'rule_file' => 'lex',
+ 'flags' => ['LFLAGS'],
+ 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)',
+ 'ccer' => 'LEX',
+ 'compiler' => 'LEXCOMPILE',
+ 'extensions' => ['.l'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
+ return ($ext,) },
+ '_finish' => \&lang_lex_finish,
+ '_target_hook' => \&lang_lex_target_hook,
+ 'nodist_specific' => 1);
+register_language ('name' => 'lexxx',
+ 'Name' => 'Lex (C++)',
+ 'config_vars' => ['LEX'],
+ 'rule_file' => 'lex',
+ 'flags' => ['LFLAGS'],
+ 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)',
+ 'ccer' => 'LEX',
+ 'compiler' => 'LEXCOMPILE',
+ 'extensions' => ['.l++', '.ll', '.lxx', '.lpp'],
+ 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/;
+ return ($ext,) },
+ '_finish' => \&lang_lex_finish,
+ '_target_hook' => \&lang_lex_target_hook,
+ 'nodist_specific' => 1);
+
+# Assembler.
+register_language ('name' => 'asm',
+ 'Name' => 'Assembler',
+ 'config_vars' => ['CCAS', 'CCASFLAGS'],
+
+ 'flags' => ['CCASFLAGS'],
+ # Users can set AM_CCASFLAGS to include DEFS, INCLUDES,
+ # or anything else required. They can also set CCAS.
+ # Or simply use Preprocessed Assembler.
+ 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
+ 'ccer' => 'CCAS',
+ 'compiler' => 'CCASCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'extensions' => ['.s']);
+
+# Preprocessed Assembler.
+register_language ('name' => 'cppasm',
+ 'Name' => 'Preprocessed Assembler',
+ 'config_vars' => ['CCAS', 'CCASFLAGS'],
+
+ 'autodep' => 'CCAS',
+ 'flags' => ['CCASFLAGS', 'CPPFLAGS'],
+ 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)",
+ 'ccer' => 'CPPAS',
+ 'compiler' => 'CPPASCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'extensions' => ['.S', '.sx']);
+
+# Fortran 77
+register_language ('name' => 'f77',
+ 'Name' => 'Fortran 77',
+ 'config_vars' => ['F77'],
+ 'linker' => 'F77LINK',
+ 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'flags' => ['FFLAGS'],
+ 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)',
+ 'ccer' => 'F77',
+ 'compiler' => 'F77COMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'F77',
+ 'lder' => 'F77LD',
+ 'ld' => '$(F77)',
+ 'pure' => 1,
+ 'extensions' => ['.f', '.for']);
+
+# Fortran
+register_language ('name' => 'fc',
+ 'Name' => 'Fortran',
+ 'config_vars' => ['FC'],
+ 'linker' => 'FCLINK',
+ 'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'flags' => ['FCFLAGS'],
+ 'compile' => '$(FC) $(AM_FCFLAGS) $(FCFLAGS)',
+ 'ccer' => 'FC',
+ 'compiler' => 'FCCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'FC',
+ 'lder' => 'FCLD',
+ 'ld' => '$(FC)',
+ 'pure' => 1,
+ 'extensions' => ['.f90', '.f95', '.f03', '.f08']);
+
+# Preprocessed Fortran
+register_language ('name' => 'ppfc',
+ 'Name' => 'Preprocessed Fortran',
+ 'config_vars' => ['FC'],
+ 'linker' => 'FCLINK',
+ 'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'lder' => 'FCLD',
+ 'ld' => '$(FC)',
+ 'flags' => ['FCFLAGS', 'CPPFLAGS'],
+ 'ccer' => 'PPFC',
+ 'compiler' => 'PPFCCOMPILE',
+ 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)",
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'FC',
+ 'pure' => 1,
+ 'extensions' => ['.F90','.F95', '.F03', '.F08']);
+
+# Preprocessed Fortran 77
+#
+# The current support for preprocessing Fortran 77 just involves
+# passing "$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
+# $(CPPFLAGS)" as additional flags to the Fortran 77 compiler, since
+# this is how GNU Make does it; see the "GNU Make Manual, Edition 0.51
+# for 'make' Version 3.76 Beta" (specifically, from info file
+# '(make)Catalogue of Rules').
+#
+# A better approach would be to write an Autoconf test
+# (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all
+# Fortran 77 compilers know how to do preprocessing. The Autoconf
+# macro AC_PROG_FPP should test the Fortran 77 compiler first for
+# preprocessing capabilities, and then fall back on cpp (if cpp were
+# available).
+register_language ('name' => 'ppf77',
+ 'Name' => 'Preprocessed Fortran 77',
+ 'config_vars' => ['F77'],
+ 'linker' => 'F77LINK',
+ 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'lder' => 'F77LD',
+ 'ld' => '$(F77)',
+ 'flags' => ['FFLAGS', 'CPPFLAGS'],
+ 'ccer' => 'PPF77',
+ 'compiler' => 'PPF77COMPILE',
+ 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)",
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'F77',
+ 'pure' => 1,
+ 'extensions' => ['.F']);
+
+# Ratfor.
+register_language ('name' => 'ratfor',
+ 'Name' => 'Ratfor',
+ 'config_vars' => ['F77'],
+ 'linker' => 'F77LINK',
+ 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'lder' => 'F77LD',
+ 'ld' => '$(F77)',
+ 'flags' => ['RFLAGS', 'FFLAGS'],
+ # FIXME also FFLAGS.
+ 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)',
+ 'ccer' => 'F77',
+ 'compiler' => 'RCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'F77',
+ 'pure' => 1,
+ 'extensions' => ['.r']);
+
+# Java via gcj.
+register_language ('name' => 'java',
+ 'Name' => 'Java',
+ 'config_vars' => ['GCJ'],
+ 'linker' => 'GCJLINK',
+ 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+ 'autodep' => 'GCJ',
+ 'flags' => ['GCJFLAGS'],
+ 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)',
+ 'ccer' => 'GCJ',
+ 'compiler' => 'GCJCOMPILE',
+ 'compile_flag' => '-c',
+ 'output_flag' => '-o',
+ 'libtool_tag' => 'GCJ',
+ 'lder' => 'GCJLD',
+ 'ld' => '$(GCJ)',
+ 'pure' => 1,
+ 'extensions' => ['.java', '.class', '.zip', '.jar']);
+
+################################################################
+
+# Error reporting functions.
+
+# err_am ($MESSAGE, [%OPTIONS])
+# -----------------------------
+# Uncategorized errors about the current Makefile.am.
+sub err_am
+{
+ msg_am ('error', @_);
+}
+
+# err_ac ($MESSAGE, [%OPTIONS])
+# -----------------------------
+# Uncategorized errors about configure.ac.
+sub err_ac
+{
+ msg_ac ('error', @_);
+}
+
+# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
+# ---------------------------------------
+# Messages about about the current Makefile.am.
+sub msg_am
+{
+ my ($channel, $msg, %opts) = @_;
+ msg $channel, "${am_file}.am", $msg, %opts;
+}
+
+# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS])
+# ---------------------------------------
+# Messages about about configure.ac.
+sub msg_ac
+{
+ my ($channel, $msg, %opts) = @_;
+ msg $channel, $configure_ac, $msg, %opts;
+}
+
+################################################################
+
+# subst ($TEXT)
+# -------------
+# Return a configure-style substitution using the indicated text.
+# We do this to avoid having the substitutions directly in automake.in;
+# when we do that they are sometimes removed and this causes confusion
+# and bugs.
+sub subst
+{
+ my ($text) = @_;
+ return '@' . $text . '@';
+}
+
+################################################################
+
+
+# $BACKPATH
+# backname ($RELDIR)
+# -------------------
+# If I "cd $RELDIR", then to come back, I should "cd $BACKPATH".
+# For instance 'src/foo' => '../..'.
+# Works with non strictly increasing paths, i.e., 'src/../lib' => '..'.
+sub backname
+{
+ my ($file) = @_;
+ my @res;
+ foreach (split (/\//, $file))
+ {
+ next if $_ eq '.' || $_ eq '';
+ if ($_ eq '..')
+ {
+ pop @res
+ or prog_error ("trying to reverse path '$file' pointing outside tree");
+ }
+ else
+ {
+ push (@res, '..');
+ }
+ }
+ return join ('/', @res) || '.';
+}
+
+################################################################
+
+# Silent rules handling functions.
+
+# verbose_var (NAME)
+# ------------------
+# The public variable stem used to implement silent rules.
+sub verbose_var
+{
+ my ($name) = @_;
+ return 'AM_V_' . $name;
+}
+
+# verbose_private_var (NAME)
+# --------------------------
+# The naming policy for the private variables for silent rules.
+sub verbose_private_var
+{
+ my ($name) = @_;
+ return 'am__v_' . $name;
+}
+
+# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE])
+# ----------------------------------------------------------
+# For silent rules, setup VAR and dispatcher, to expand to
+# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
+# empty) if not.
+sub define_verbose_var
+{
+ my ($name, $silent_val, $verbose_val) = @_;
+ $verbose_val = '' unless defined $verbose_val;
+ my $var = verbose_var ($name);
+ my $pvar = verbose_private_var ($name);
+ my $silent_var = $pvar . '_0';
+ my $verbose_var = $pvar . '_1';
+ # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
+ # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
+ # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead.
+ # See AM_SILENT_RULES in m4/silent.m4.
+ define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
+ define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)',
+ INTERNAL);
+ Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
+ $silent_val, '', INTERNAL, VAR_ASIS)
+ if (! vardef ($silent_var, TRUE));
+ Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
+ $verbose_val, '', INTERNAL, VAR_ASIS)
+ if (! vardef ($verbose_var, TRUE));
+}
+
+# verbose_flag (NAME)
+# -------------------
+# Contents of '%VERBOSE%' variable to expand before rule command.
+sub verbose_flag
+{
+ my ($name) = @_;
+ return '$(' . verbose_var ($name) . ')';
+}
+
+sub verbose_nodep_flag
+{
+ my ($name) = @_;
+ return '$(' . verbose_var ($name) . subst ('am__nodep') . ')';
+}
+
+# silent_flag
+# -----------
+# Contents of %SILENT%: variable to expand to '@' when silent.
+sub silent_flag ()
+{
+ return verbose_flag ('at');
+}
+
+# define_verbose_tagvar (NAME)
+# ----------------------------
+# Engage the needed silent rules machinery for tag NAME.
+sub define_verbose_tagvar
+{
+ my ($name) = @_;
+ define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;');
+}
+
+# Engage the needed silent rules machinery for assorted texinfo commands.
+sub define_verbose_texinfo ()
+{
+ my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF');
+ foreach my $tag (@tagvars)
+ {
+ define_verbose_tagvar($tag);
+ }
+ define_verbose_var('texinfo', '-q');
+ define_verbose_var('texidevnull', '> /dev/null');
+}
+
+# Engage the needed silent rules machinery for 'libtool --silent'.
+sub define_verbose_libtool ()
+{
+ define_verbose_var ('lt', '--silent');
+ return verbose_flag ('lt');
+}
+
+sub handle_silent ()
+{
+ # Define "$(AM_V_P)", expanding to a shell conditional that can be
+ # used in make recipes to determine whether we are being run in
+ # silent mode or not. The choice of the name derives from the LISP
+ # convention of appending the letter 'P' to denote a predicate (see
+ # also "the '-P' convention" in the Jargon File); we do so for lack
+ # of a better convention.
+ define_verbose_var ('P', 'false', ':');
+ # *Always* provide the user with '$(AM_V_GEN)', unconditionally.
+ define_verbose_tagvar ('GEN');
+ define_verbose_var ('at', '@');
+}
+
+
+################################################################
+
+
+# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
+sub handle_options ()
+{
+ my $var = var ('AUTOMAKE_OPTIONS');
+ if ($var)
+ {
+ if ($var->has_conditional_contents)
+ {
+ msg_var ('unsupported', $var,
+ "'AUTOMAKE_OPTIONS' cannot have conditional contents");
+ }
+ my @options = map { { option => $_->[1], where => $_->[0] } }
+ $var->value_as_list_recursive (cond_filter => TRUE,
+ location => 1);
+ return 1 if process_option_list (@options);
+ }
+
+ if ($strictness == GNITS)
+ {
+ set_option ('readme-alpha', INTERNAL);
+ set_option ('std-options', INTERNAL);
+ set_option ('check-news', INTERNAL);
+ }
+
+ return 0;
+}
+
+# shadow_unconditionally ($varname, $where)
+# -----------------------------------------
+# Return a $(variable) that contains all possible values
+# $varname can take.
+# If the VAR wasn't defined conditionally, return $(VAR).
+# Otherwise we create an am__VAR_DIST variable which contains
+# all possible values, and return $(am__VAR_DIST).
+sub shadow_unconditionally
+{
+ my ($varname, $where) = @_;
+ my $var = var $varname;
+ if ($var->has_conditional_contents)
+ {
+ $varname = "am__${varname}_DIST";
+ my @files = uniq ($var->value_as_list_recursive);
+ define_pretty_variable ($varname, TRUE, $where, @files);
+ }
+ return "\$($varname)"
+}
+
+# check_user_variables (@LIST)
+# ----------------------------
+# Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR
+# otherwise.
+sub check_user_variables
+{
+ my @dont_override = @_;
+ foreach my $flag (@dont_override)
+ {
+ my $var = var $flag;
+ if ($var)
+ {
+ for my $cond ($var->conditions->conds)
+ {
+ if ($var->rdef ($cond)->owner == VAR_MAKEFILE)
+ {
+ msg_cond_var ('gnu', $cond, $flag,
+ "'$flag' is a user variable, "
+ . "you should not override it;\n"
+ . "use 'AM_$flag' instead");
+ }
+ }
+ }
+ }
+}
+
+# Call finish function for each language that was used.
+sub handle_languages ()
+{
+ if (! option 'no-dependencies')
+ {
+ # Include auto-dep code. Don't include it if DEP_FILES would
+ # be empty.
+ if (keys %extension_seen && keys %dep_files)
+ {
+ # Set location of depcomp.
+ define_variable ('depcomp',
+ "\$(SHELL) $am_config_aux_dir/depcomp",
+ INTERNAL);
+ define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
+
+ require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
+
+ my @deplist = sort keys %dep_files;
+ # Generate each 'include' individually. Irix 6 make will
+ # not properly include several files resulting from a
+ # variable expansion; generating many separate includes
+ # seems safest.
+ $output_rules .= "\n";
+ foreach my $iter (@deplist)
+ {
+ $output_rules .= (subst ('AMDEP_TRUE')
+ . subst ('am__include')
+ . ' '
+ . subst ('am__quote')
+ . $iter
+ . subst ('am__quote')
+ . "\n");
+ }
+
+ # Compute the set of directories to remove in distclean-depend.
+ my @depdirs = uniq (map { dirname ($_) } @deplist);
+ $output_rules .= file_contents ('depend',
+ new Automake::Location,
+ DEPDIRS => "@depdirs");
+ }
+ }
+ else
+ {
+ define_variable ('depcomp', '', INTERNAL);
+ define_variable ('am__depfiles_maybe', '', INTERNAL);
+ }
+
+ my %done;
+
+ # Is the C linker needed?
+ my $needs_c = 0;
+ foreach my $ext (sort keys %extension_seen)
+ {
+ next unless $extension_map{$ext};
+
+ my $lang = $languages{$extension_map{$ext}};
+
+ my $rule_file = $lang->rule_file || 'depend2';
+
+ # Get information on $LANG.
+ my $pfx = $lang->autodep;
+ my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
+
+ my ($AMDEP, $FASTDEP) =
+ (option 'no-dependencies' || $lang->autodep eq 'no')
+ ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx");
+
+ my $verbose = verbose_flag ($lang->ccer || 'GEN');
+ my $verbose_nodep = ($AMDEP eq 'FALSE')
+ ? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN');
+ my $silent = silent_flag ();
+
+ my %transform = ('EXT' => $ext,
+ 'PFX' => $pfx,
+ 'FPFX' => $fpfx,
+ 'AMDEP' => $AMDEP,
+ 'FASTDEP' => $FASTDEP,
+ '-c' => $lang->compile_flag || '',
+ # These are not used, but they need to be defined
+ # so transform() do not complain.
+ SUBDIROBJ => 0,
+ 'DERIVED-EXT' => 'BUG',
+ DIST_SOURCE => 1,
+ VERBOSE => $verbose,
+ 'VERBOSE-NODEP' => $verbose_nodep,
+ SILENT => $silent,
+ );
+
+ # Generate the appropriate rules for this extension.
+ if (((! option 'no-dependencies') && $lang->autodep ne 'no')
+ || defined $lang->compile)
+ {
+ # Some C compilers don't support -c -o. Use it only if really
+ # needed.
+ my $output_flag = $lang->output_flag || '';
+ $output_flag = '-o'
+ if (! $output_flag
+ && $lang->name eq 'c'
+ && option 'subdir-objects');
+
+ # Compute a possible derived extension.
+ # This is not used by depend2.am.
+ my $der_ext = ($lang->output_extensions->($ext))[0];
+
+ # When we output an inference rule like '.c.o:' we
+ # have two cases to consider: either subdir-objects
+ # is used, or it is not.
+ #
+ # In the latter case the rule is used to build objects
+ # in the current directory, and dependencies always
+ # go into './$(DEPDIR)/'. We can hard-code this value.
+ #
+ # In the former case the rule can be used to build
+ # objects in sub-directories too. Dependencies should
+ # go into the appropriate sub-directories, e.g.,
+ # 'sub/$(DEPDIR)/'. The value of this directory
+ # needs to be computed on-the-fly.
+ #
+ # DEPBASE holds the name of this directory, plus the
+ # basename part of the object file (extensions Po, TPo,
+ # Plo, TPlo will be added later as appropriate). It is
+ # either hardcoded, or a shell variable ('$depbase') that
+ # will be computed by the rule.
+ my $depbase =
+ option ('subdir-objects') ? '$$depbase' : '$(DEPDIR)/$*';
+ $output_rules .=
+ file_contents ($rule_file,
+ new Automake::Location,
+ %transform,
+ GENERIC => 1,
+
+ 'DERIVED-EXT' => $der_ext,
+
+ DEPBASE => $depbase,
+ BASE => '$*',
+ SOURCE => '$<',
+ SOURCEFLAG => $sourceflags{$ext} || '',
+ OBJ => '$@',
+ OBJOBJ => '$@',
+ LTOBJ => '$@',
+
+ COMPILE => '$(' . $lang->compiler . ')',
+ LTCOMPILE => '$(LT' . $lang->compiler . ')',
+ -o => $output_flag,
+ SUBDIROBJ => !! option 'subdir-objects');
+ }
+
+ # Now include code for each specially handled object with this
+ # language.
+ my %seen_files = ();
+ foreach my $file (@{$lang_specific_files{$lang->name}})
+ {
+ my ($derived, $source, $obj, $myext, $srcext, %file_transform) = @$file;
+
+ # We might see a given object twice, for instance if it is
+ # used under different conditions.
+ next if defined $seen_files{$obj};
+ $seen_files{$obj} = 1;
+
+ prog_error ("found " . $lang->name .
+ " in handle_languages, but compiler not defined")
+ unless defined $lang->compile;
+
+ my $obj_compile = $lang->compile;
+
+ # Rewrite each occurrence of 'AM_$flag' in the compile
+ # rule into '${derived}_$flag' if it exists.
+ for my $flag (@{$lang->flags})
+ {
+ my $val = "${derived}_$flag";
+ $obj_compile =~ s/\(AM_$flag\)/\($val\)/
+ if set_seen ($val);
+ }
+
+ my $libtool_tag = '';
+ if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag})
+ {
+ $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
+ }
+
+ my $ptltflags = "${derived}_LIBTOOLFLAGS";
+ $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags;
+
+ my $ltverbose = define_verbose_libtool ();
+ my $obj_ltcompile =
+ "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
+ . "--mode=compile $obj_compile";
+
+ # We _need_ '-o' for per object rules.
+ my $output_flag = $lang->output_flag || '-o';
+
+ my $depbase = dirname ($obj);
+ $depbase = ''
+ if $depbase eq '.';
+ $depbase .= '/'
+ unless $depbase eq '';
+ $depbase .= '$(DEPDIR)/' . basename ($obj);
+
+ $output_rules .=
+ file_contents ($rule_file,
+ new Automake::Location,
+ %transform,
+ GENERIC => 0,
+
+ DEPBASE => $depbase,
+ BASE => $obj,
+ SOURCE => $source,
+ SOURCEFLAG => $sourceflags{$srcext} || '',
+ # Use $myext and not '.o' here, in case
+ # we are actually building a new source
+ # file -- e.g. via yacc.
+ OBJ => "$obj$myext",
+ OBJOBJ => "$obj.obj",
+ LTOBJ => "$obj.lo",
+
+ VERBOSE => $verbose,
+ 'VERBOSE-NODEP' => $verbose_nodep,
+ SILENT => $silent,
+ COMPILE => $obj_compile,
+ LTCOMPILE => $obj_ltcompile,
+ -o => $output_flag,
+ %file_transform);
+ }
+
+ # The rest of the loop is done once per language.
+ next if defined $done{$lang};
+ $done{$lang} = 1;
+
+ # Load the language dependent Makefile chunks.
+ my %lang = map { uc ($_) => 0 } keys %languages;
+ $lang{uc ($lang->name)} = 1;
+ $output_rules .= file_contents ('lang-compile',
+ new Automake::Location,
+ %transform, %lang);
+
+ # If the source to a program consists entirely of code from a
+ # 'pure' language, for instance C++ or Fortran 77, then we
+ # don't need the C compiler code. However if we run into
+ # something unusual then we do generate the C code. There are
+ # probably corner cases here that do not work properly.
+ # People linking Java code to Fortran code deserve pain.
+ $needs_c ||= ! $lang->pure;
+
+ define_compiler_variable ($lang)
+ if ($lang->compile);
+
+ define_linker_variable ($lang)
+ if ($lang->link);
+
+ require_variables ("$am_file.am", $lang->Name . " source seen",
+ TRUE, @{$lang->config_vars});
+
+ # Call the finisher.
+ $lang->finish;
+
+ # Flags listed in '->flags' are user variables (per GNU Standards),
+ # they should not be overridden in the Makefile...
+ my @dont_override = @{$lang->flags};
+ # ... and so is LDFLAGS.
+ push @dont_override, 'LDFLAGS' if $lang->link;
+
+ check_user_variables @dont_override;
+ }
+
+ # If the project is entirely C++ or entirely Fortran 77 (i.e., 1
+ # suffix rule was learned), don't bother with the C stuff. But if
+ # anything else creeps in, then use it.
+ $needs_c = 1
+ if $need_link || suffix_rules_count > 1;
+
+ if ($needs_c)
+ {
+ define_compiler_variable ($languages{'c'})
+ unless defined $done{$languages{'c'}};
+ define_linker_variable ($languages{'c'});
+ }
+}
+
+
+# append_exeext { PREDICATE } $MACRO
+# ----------------------------------
+# Append $(EXEEXT) to each filename in $F appearing in the Makefile
+# variable $MACRO if &PREDICATE($F) is true. @substitutions@ are
+# ignored.
+#
+# This is typically used on all filenames of *_PROGRAMS, and filenames
+# of TESTS that are programs.
+sub append_exeext (&$)
+{
+ my ($pred, $macro) = @_;
+
+ transform_variable_recursively
+ ($macro, $macro, 'am__EXEEXT', 0, INTERNAL,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ # Append $(EXEEXT) unless the user did it already, or it's a
+ # @substitution@.
+ $val .= '$(EXEEXT)'
+ if $val !~ /(?:\$\(EXEEXT\)$|^[@]\w+[@]$)/ && &$pred ($val);
+ return $val;
+ });
+}
+
+
+# Check to make sure a source defined in LIBOBJS is not explicitly
+# mentioned. This is a separate function (as opposed to being inlined
+# in handle_source_transform) because it isn't always appropriate to
+# do this check.
+sub check_libobjs_sources
+{
+ my ($one_file, $unxformed) = @_;
+
+ foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
+ 'dist_EXTRA_', 'nodist_EXTRA_')
+ {
+ my @files;
+ my $varname = $prefix . $one_file . '_SOURCES';
+ my $var = var ($varname);
+ if ($var)
+ {
+ @files = $var->value_as_list_recursive;
+ }
+ elsif ($prefix eq '')
+ {
+ @files = ($unxformed . '.c');
+ }
+ else
+ {
+ next;
+ }
+
+ foreach my $file (@files)
+ {
+ err_var ($prefix . $one_file . '_SOURCES',
+ "automatically discovered file '$file' should not" .
+ " be explicitly mentioned")
+ if defined $libsources{$file};
+ }
+ }
+}
+
+
+# @OBJECTS
+# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM)
+# -----------------------------------------------------------------------------
+# Does much of the actual work for handle_source_transform.
+# Arguments are:
+# $VAR is the name of the variable that the source filenames come from
+# $TOPPARENT is the name of the _SOURCES variable which is being processed
+# $DERIVED is the name of resulting executable or library
+# $OBJ is the object extension (e.g., '.lo')
+# $FILE the source file to transform
+# %TRANSFORM contains extras arguments to pass to file_contents
+# when producing explicit rules
+# Result is a list of the names of objects
+# %linkers_used will be updated with any linkers needed
+sub handle_single_transform
+{
+ my ($var, $topparent, $derived, $obj, $_file, %transform) = @_;
+ my @files = ($_file);
+ my @result = ();
+
+ # Turn sources into objects. We use a while loop like this
+ # because we might add to @files in the loop.
+ while (scalar @files > 0)
+ {
+ $_ = shift @files;
+
+ # Configure substitutions in _SOURCES variables are errors.
+ if (/^\@.*\@$/)
+ {
+ my $parent_msg = '';
+ $parent_msg = "\nand is referred to from '$topparent'"
+ if $topparent ne $var->name;
+ err_var ($var,
+ "'" . $var->name . "' includes configure substitution '$_'"
+ . $parent_msg . ";\nconfigure " .
+ "substitutions are not allowed in _SOURCES variables");
+ next;
+ }
+
+ # If the source file is in a subdirectory then the '.o' is put
+ # into the current directory, unless the subdir-objects option
+ # is in effect.
+
+ # Split file name into base and extension.
+ next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/;
+ my $full = $_;
+ my $directory = $1 || '';
+ my $base = $2;
+ my $extension = $3;
+
+ # We must generate a rule for the object if it requires its own flags.
+ my $renamed = 0;
+ my ($linker, $object);
+
+ # This records whether we've seen a derived source file (e.g.
+ # yacc output).
+ my $derived_source = 0;
+
+ # This holds the 'aggregate context' of the file we are
+ # currently examining. If the file is compiled with
+ # per-object flags, then it will be the name of the object.
+ # Otherwise it will be 'AM'. This is used by the target hook
+ # language function.
+ my $aggregate = 'AM';
+
+ $extension = derive_suffix ($extension, $obj);
+ my $lang;
+ if ($extension_map{$extension} &&
+ ($lang = $languages{$extension_map{$extension}}))
+ {
+ # Found the language, so see what it says.
+ saw_extension ($extension);
+
+ # Do we have per-executable flags for this executable?
+ my $have_per_exec_flags = 0;
+ my @peflags = @{$lang->flags};
+ push @peflags, 'LIBTOOLFLAGS' if $obj eq '.lo';
+ foreach my $flag (@peflags)
+ {
+ if (set_seen ("${derived}_$flag"))
+ {
+ $have_per_exec_flags = 1;
+ last;
+ }
+ }
+
+ # Note: computed subr call. The language rewrite function
+ # should return one of the LANG_* constants. It could
+ # also return a list whose first value is such a constant
+ # and whose second value is a new source extension which
+ # should be applied. This means this particular language
+ # generates another source file which we must then process
+ # further.
+ my $subr = \&{'lang_' . $lang->name . '_rewrite'};
+ defined &$subr or $subr = \&lang_sub_obj;
+ my ($r, $source_extension)
+ = &$subr ($directory, $base, $extension,
+ $obj, $have_per_exec_flags, $var);
+ # Skip this entry if we were asked not to process it.
+ next if $r == LANG_IGNORE;
+
+ # Now extract linker and other info.
+ $linker = $lang->linker;
+
+ my $this_obj_ext;
+ if (defined $source_extension)
+ {
+ $this_obj_ext = $source_extension;
+ $derived_source = 1;
+ }
+ else
+ {
+ $this_obj_ext = $obj;
+ }
+ $object = $base . $this_obj_ext;
+
+ if ($have_per_exec_flags)
+ {
+ # We have a per-executable flag in effect for this
+ # object. In this case we rewrite the object's
+ # name to ensure it is unique.
+
+ # We choose the name 'DERIVED_OBJECT' to ensure
+ # (1) uniqueness, and (2) continuity between
+ # invocations. However, this will result in a
+ # name that is too long for losing systems, in
+ # some situations. So we provide _SHORTNAME to
+ # override.
+
+ my $dname = $derived;
+ my $var = var ($derived . '_SHORTNAME');
+ if ($var)
+ {
+ # FIXME: should use the same Condition as
+ # the _SOURCES variable. But this is really
+ # silly overkill -- nobody should have
+ # conditional shortnames.
+ $dname = $var->variable_value;
+ }
+ $object = $dname . '-' . $object;
+
+ prog_error ($lang->name . " flags defined without compiler")
+ if ! defined $lang->compile;
+
+ $renamed = 1;
+ }
+
+ # If rewrite said it was ok, put the object into a
+ # subdir.
+ if ($directory ne '')
+ {
+ if ($r == LANG_SUBDIR)
+ {
+ $object = $directory . '/' . $object;
+ }
+ else
+ {
+ # Since the next major version of automake (2.0) will
+ # make the behaviour so far only activated with the
+ # 'subdir-object' option mandatory, it's better if we
+ # start warning users not using that option.
+ # As suggested by Peter Johansson, we strive to avoid
+ # the warning when it would be irrelevant, i.e., if
+ # all source files sit in "current" directory.
+ msg_var 'unsupported', $var,
+ "source file '$full' is in a subdirectory,"
+ . "\nbut option 'subdir-objects' is disabled";
+ msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL;
+possible forward-incompatibility.
+At least a source file is in a subdirectory, but the 'subdir-objects'
+automake option hasn't been enabled. For now, the corresponding output
+object file(s) will be placed in the top-level directory. However,
+this behaviour will change in future Automake versions: they will
+unconditionally cause object files to be placed in the same subdirectory
+of the corresponding sources.
+You are advised to start using 'subdir-objects' option throughout your
+project, to avoid future incompatibilities.
+EOF
+ }
+ }
+
+ # If the object file has been renamed (because per-target
+ # flags are used) we cannot compile the file with an
+ # inference rule: we need an explicit rule.
+ #
+ # If the source is in a subdirectory and the object is in
+ # the current directory, we also need an explicit rule.
+ #
+ # If both source and object files are in a subdirectory
+ # (this happens when the subdir-objects option is used),
+ # then the inference will work.
+ #
+ # The latter case deserves a historical note. When the
+ # subdir-objects option was added on 1999-04-11 it was
+ # thought that inferences rules would work for
+ # subdirectory objects too. Later, on 1999-11-22,
+ # automake was changed to output explicit rules even for
+ # subdir-objects. Nobody remembers why, but this occurred
+ # soon after the merge of the user-dep-gen-branch so it
+ # might be related. In late 2003 people complained about
+ # the size of the generated Makefile.ins (libgcj, with
+ # 2200+ subdir objects was reported to have a 9MB
+ # Makefile), so we now rely on inference rules again.
+ # Maybe we'll run across the same issue as in the past,
+ # but at least this time we can document it. However since
+ # dependency tracking has evolved it is possible that
+ # our old problem no longer exists.
+ # Using inference rules for subdir-objects has been tested
+ # with GNU make, Solaris make, Ultrix make, BSD make,
+ # HP-UX make, and OSF1 make successfully.
+ if ($renamed
+ || ($directory ne '' && ! option 'subdir-objects')
+ # We must also use specific rules for a nodist_ source
+ # if its language requests it.
+ || ($lang->nodist_specific && ! $transform{'DIST_SOURCE'}))
+ {
+ my $obj_sans_ext = substr ($object, 0,
+ - length ($this_obj_ext));
+ my $full_ansi;
+ if ($directory ne '')
+ {
+ $full_ansi = $directory . '/' . $base . $extension;
+ }
+ else
+ {
+ $full_ansi = $base . $extension;
+ }
+
+ my @specifics = ($full_ansi, $obj_sans_ext,
+ # Only use $this_obj_ext in the derived
+ # source case because in the other case we
+ # *don't* want $(OBJEXT) to appear here.
+ ($derived_source ? $this_obj_ext : '.o'),
+ $extension);
+
+ # If we renamed the object then we want to use the
+ # per-executable flag name. But if this is simply a
+ # subdir build then we still want to use the AM_ flag
+ # name.
+ if ($renamed)
+ {
+ unshift @specifics, $derived;
+ $aggregate = $derived;
+ }
+ else
+ {
+ unshift @specifics, 'AM';
+ }
+
+ # Each item on this list is a reference to a list consisting
+ # of four values followed by additional transform flags for
+ # file_contents. The four values are the derived flag prefix
+ # (e.g. for 'foo_CFLAGS', it is 'foo'), the name of the
+ # source file, the base name of the output file, and
+ # the extension for the object file.
+ push (@{$lang_specific_files{$lang->name}},
+ [@specifics, %transform]);
+ }
+ }
+ elsif ($extension eq $obj)
+ {
+ # This is probably the result of a direct suffix rule.
+ # In this case we just accept the rewrite.
+ $object = "$base$extension";
+ $object = "$directory/$object" if $directory ne '';
+ $linker = '';
+ }
+ else
+ {
+ # No error message here. Used to have one, but it was
+ # very unpopular.
+ # FIXME: we could potentially do more processing here,
+ # perhaps treating the new extension as though it were a
+ # new source extension (as above). This would require
+ # more restructuring than is appropriate right now.
+ next;
+ }
+
+ err_am "object '$object' created by '$full' and '$object_map{$object}'"
+ if (defined $object_map{$object}
+ && $object_map{$object} ne $full);
+
+ my $comp_val = (($object =~ /\.lo$/)
+ ? COMPILE_LIBTOOL : COMPILE_ORDINARY);
+ (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/;
+ if (defined $object_compilation_map{$comp_obj}
+ && $object_compilation_map{$comp_obj} != 0
+ # Only see the error once.
+ && ($object_compilation_map{$comp_obj}
+ != (COMPILE_LIBTOOL | COMPILE_ORDINARY))
+ && $object_compilation_map{$comp_obj} != $comp_val)
+ {
+ err_am "object '$comp_obj' created both with libtool and without";
+ }
+ $object_compilation_map{$comp_obj} |= $comp_val;
+
+ if (defined $lang)
+ {
+ # Let the language do some special magic if required.
+ $lang->target_hook ($aggregate, $object, $full, %transform);
+ }
+
+ if ($derived_source)
+ {
+ prog_error ($lang->name . " has automatic dependency tracking")
+ if $lang->autodep ne 'no';
+ # Make sure this new source file is handled next. That will
+ # make it appear to be at the right place in the list.
+ unshift (@files, $object);
+ # Distribute derived sources unless the source they are
+ # derived from is not.
+ push_dist_common ($object)
+ unless ($topparent =~ /^(?:nobase_)?nodist_/);
+ next;
+ }
+
+ $linkers_used{$linker} = 1;
+
+ push (@result, $object);
+
+ if (! defined $object_map{$object})
+ {
+ my @dep_list = ();
+ $object_map{$object} = $full;
+
+ # If resulting object is in subdir, we need to make
+ # sure the subdir exists at build time.
+ if ($object =~ /\//)
+ {
+ # FIXME: check that $DIRECTORY is somewhere in the
+ # project
+
+ # For Java, the way we're handling it right now, a
+ # '..' component doesn't make sense.
+ if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//)
+ {
+ err_am "'$full' should not contain a '..' component";
+ }
+
+ # Make sure *all* objects files in the subdirectory are
+ # removed by "make mostlyclean". Not only this is more
+ # efficient than listing the object files to be removed
+ # individually (which would cause an 'rm' invocation for
+ # each of them -- very inefficient, see bug#10697), it
+ # would also leave stale object files in the subdirectory
+ # whenever a source file there is removed or renamed.
+ $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN;
+ if ($object =~ /\.lo$/)
+ {
+ # If we have a libtool object, then we also must remove
+ # any '.lo' objects in its same subdirectory.
+ $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN;
+ # Remember to cleanup .libs/ in this directory.
+ $libtool_clean_directories{$directory} = 1;
+ }
+
+ push (@dep_list, require_build_directory ($directory));
+
+ # If we're generating dependencies, we also want
+ # to make sure that the appropriate subdir of the
+ # .deps directory is created.
+ push (@dep_list,
+ require_build_directory ($directory . '/$(DEPDIR)'))
+ unless option 'no-dependencies';
+ }
+
+ pretty_print_rule ($object . ':', "\t", @dep_list)
+ if scalar @dep_list > 0;
+ }
+
+ # Transform .o or $o file into .P file (for automatic
+ # dependency code).
+ # Properly flatten multiple adjacent slashes, as Solaris 10 make
+ # might fail over them in an include statement.
+ # Leading double slashes may be special, as per Posix, so deal
+ # with them carefully.
+ if ($lang && $lang->autodep ne 'no')
+ {
+ my $depfile = $object;
+ $depfile =~ s/\.([^.]*)$/.P$1/;
+ $depfile =~ s/\$\(OBJEXT\)$/o/;
+ my $maybe_extra_leading_slash = '';
+ $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],;
+ $depfile =~ s,/+,/,g;
+ my $basename = basename ($depfile);
+ # This might make $dirname empty, but we account for that below.
+ (my $dirname = dirname ($depfile)) =~ s/\/*$//;
+ $dirname = $maybe_extra_leading_slash . $dirname;
+ $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1;
+ }
+ }
+
+ return @result;
+}
+
+
+# $LINKER
+# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE,
+# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM)
+# ---------------------------------------------------------------------------
+# Define an _OBJECTS variable for a _SOURCES variable (or subvariable)
+#
+# Arguments are:
+# $VAR is the name of the _SOURCES variable
+# $OBJVAR is the name of the _OBJECTS variable if known (otherwise
+# it will be generated and returned).
+# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but
+# work done to determine the linker will be).
+# $ONE_FILE is the canonical (transformed) name of object to build
+# $OBJ is the object extension (i.e. either '.o' or '.lo').
+# $TOPPARENT is the _SOURCES variable being processed.
+# $WHERE context into which this definition is done
+# %TRANSFORM extra arguments to pass to file_contents when producing
+# rules
+#
+# Result is a pair ($LINKER, $OBJVAR):
+# $LINKER is a boolean, true if a linker is needed to deal with the objects
+sub define_objects_from_sources
+{
+ my ($var, $objvar, $nodefine, $one_file,
+ $obj, $topparent, $where, %transform) = @_;
+
+ my $needlinker = "";
+
+ transform_variable_recursively
+ ($var, $objvar, 'am__objects', $nodefine, $where,
+ # The transform code to run on each filename.
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ my @trans = handle_single_transform ($subvar, $topparent,
+ $one_file, $obj, $val,
+ %transform);
+ $needlinker = "true" if @trans;
+ return @trans;
+ });
+
+ return $needlinker;
+}
+
+
+# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM)
+# -----------------------------------------------------------------------------
+# Handle SOURCE->OBJECT transform for one program or library.
+# Arguments are:
+# canonical (transformed) name of target to build
+# actual target of object to build
+# object extension (i.e., either '.o' or '$o')
+# location of the source variable
+# extra arguments to pass to file_contents when producing rules
+# Return the name of the linker variable that must be used.
+# Empty return means just use 'LINK'.
+sub handle_source_transform
+{
+ # one_file is canonical name. unxformed is given name. obj is
+ # object extension.
+ my ($one_file, $unxformed, $obj, $where, %transform) = @_;
+
+ my $linker = '';
+
+ # No point in continuing if _OBJECTS is defined.
+ return if reject_var ($one_file . '_OBJECTS',
+ $one_file . '_OBJECTS should not be defined');
+
+ my %used_pfx = ();
+ my $needlinker;
+ %linkers_used = ();
+ foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
+ 'dist_EXTRA_', 'nodist_EXTRA_')
+ {
+ my $varname = $prefix . $one_file . "_SOURCES";
+ my $var = var $varname;
+ next unless $var;
+
+ # We are going to define _OBJECTS variables using the prefix.
+ # Then we glom them all together. So we can't use the null
+ # prefix here as we need it later.
+ my $xpfx = ($prefix eq '') ? 'am_' : $prefix;
+
+ # Keep track of which prefixes we saw.
+ $used_pfx{$xpfx} = 1
+ unless $prefix =~ /EXTRA_/;
+
+ push @sources, "\$($varname)";
+ push @dist_sources, shadow_unconditionally ($varname, $where)
+ unless (option ('no-dist') || $prefix =~ /^nodist_/);
+
+ $needlinker |=
+ define_objects_from_sources ($varname,
+ $xpfx . $one_file . '_OBJECTS',
+ !!($prefix =~ /EXTRA_/),
+ $one_file, $obj, $varname, $where,
+ DIST_SOURCE => ($prefix !~ /^nodist_/),
+ %transform);
+ }
+ if ($needlinker)
+ {
+ $linker ||= resolve_linker (%linkers_used);
+ }
+
+ my @keys = sort keys %used_pfx;
+ if (scalar @keys == 0)
+ {
+ # The default source for libfoo.la is libfoo.c, but for
+ # backward compatibility we first look at libfoo_la.c,
+ # if no default source suffix is given.
+ my $old_default_source = "$one_file.c";
+ my $ext_var = var ('AM_DEFAULT_SOURCE_EXT');
+ my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c';
+ msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value")
+ if $default_source_ext =~ /[\t ]/;
+ (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,;
+ # TODO: Remove this backward-compatibility hack in Automake 2.0.
+ if ($old_default_source ne $default_source
+ && !$ext_var
+ && (rule $old_default_source
+ || rule '$(srcdir)/' . $old_default_source
+ || rule '${srcdir}/' . $old_default_source
+ || -f $old_default_source))
+ {
+ my $loc = $where->clone;
+ $loc->pop_context;
+ msg ('obsolete', $loc,
+ "the default source for '$unxformed' has been changed "
+ . "to '$default_source'.\n(Using '$old_default_source' for "
+ . "backward compatibility.)");
+ $default_source = $old_default_source;
+ }
+ # If a rule exists to build this source with a $(srcdir)
+ # prefix, use that prefix in our variables too. This is for
+ # the sake of BSD Make.
+ if (rule '$(srcdir)/' . $default_source
+ || rule '${srcdir}/' . $default_source)
+ {
+ $default_source = '$(srcdir)/' . $default_source;
+ }
+
+ define_variable ($one_file . "_SOURCES", $default_source, $where);
+ push (@sources, $default_source);
+ push (@dist_sources, $default_source);
+
+ %linkers_used = ();
+ my (@result) =
+ handle_single_transform ($one_file . '_SOURCES',
+ $one_file . '_SOURCES',
+ $one_file, $obj,
+ $default_source, %transform);
+ $linker ||= resolve_linker (%linkers_used);
+ define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
+ }
+ else
+ {
+ @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys;
+ define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys);
+ }
+
+ # If we want to use 'LINK' we must make sure it is defined.
+ if ($linker eq '')
+ {
+ $need_link = 1;
+ }
+
+ return $linker;
+}
+
+
+# handle_lib_objects ($XNAME, $VAR)
+# ---------------------------------
+# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables.
+# Also, generate _DEPENDENCIES variable if appropriate.
+# Arguments are:
+# transformed name of object being built, or empty string if no object
+# name of _LDADD/_LIBADD-type variable to examine
+# Returns 1 if LIBOBJS seen, 0 otherwise.
+sub handle_lib_objects
+{
+ my ($xname, $varname) = @_;
+
+ my $var = var ($varname);
+ prog_error "'$varname' undefined"
+ unless $var;
+ prog_error "unexpected variable name '$varname'"
+ unless $varname =~ /^(.*)(?:LIB|LD)ADD$/;
+ my $prefix = $1 || 'AM_';
+
+ my $seen_libobjs = 0;
+ my $flagvar = 0;
+
+ transform_variable_recursively
+ ($varname, $xname . '_DEPENDENCIES', 'am__DEPENDENCIES',
+ ! $xname, INTERNAL,
+ # Transformation function, run on each filename.
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+
+ if ($val =~ /^-/)
+ {
+ # Skip -lfoo and -Ldir silently; these are explicitly allowed.
+ if ($val !~ /^-[lL]/ &&
+ # Skip -dlopen and -dlpreopen; these are explicitly allowed
+ # for Libtool libraries or programs. (Actually we are a bit
+ # lax here since this code also applies to non-libtool
+ # libraries or programs, for which -dlopen and -dlopreopen
+ # are pure nonsense. Diagnosing this doesn't seem very
+ # important: the developer will quickly get complaints from
+ # the linker.)
+ $val !~ /^-dl(?:pre)?open$/ &&
+ # Only get this error once.
+ ! $flagvar)
+ {
+ $flagvar = 1;
+ # FIXME: should display a stack of nested variables
+ # as context when $var != $subvar.
+ err_var ($var, "linker flags such as '$val' belong in "
+ . "'${prefix}LDFLAGS'");
+ }
+ return ();
+ }
+ elsif ($val !~ /^\@.*\@$/)
+ {
+ # Assume we have a file of some sort, and output it into the
+ # dependency variable. Autoconf substitutions are not output;
+ # rarely is a new dependency substituted into e.g. foo_LDADD
+ # -- but bad things (e.g. -lX11) are routinely substituted.
+ # Note that LIBOBJS and ALLOCA are exceptions to this rule,
+ # and handled specially below.
+ return $val;
+ }
+ elsif ($val =~ /^\@(LT)?LIBOBJS\@$/)
+ {
+ handle_LIBOBJS ($subvar, $cond, $1);
+ $seen_libobjs = 1;
+ return $val;
+ }
+ elsif ($val =~ /^\@(LT)?ALLOCA\@$/)
+ {
+ handle_ALLOCA ($subvar, $cond, $1);
+ return $val;
+ }
+ else
+ {
+ return ();
+ }
+ });
+
+ return $seen_libobjs;
+}
+
+# handle_LIBOBJS_or_ALLOCA ($VAR)
+# -------------------------------
+# Definitions common to LIBOBJS and ALLOCA.
+# VAR should be one of LIBOBJS, LTLIBOBJS, ALLOCA, or LTALLOCA.
+sub handle_LIBOBJS_or_ALLOCA
+{
+ my ($var) = @_;
+
+ my $dir = '';
+
+ # If LIBOBJS files must be built in another directory we have
+ # to define LIBOBJDIR and ensure the files get cleaned.
+ # Otherwise LIBOBJDIR can be left undefined, and the cleaning
+ # is achieved by 'rm -f *.$(OBJEXT)' in compile.am.
+ if ($config_libobj_dir
+ && $relative_dir ne $config_libobj_dir)
+ {
+ if (option 'subdir-objects')
+ {
+ # In the top-level Makefile we do not use $(top_builddir), because
+ # we are already there, and since the targets are built without
+ # a $(top_builddir), it helps BSD Make to match them with
+ # dependencies.
+ $dir = "$config_libobj_dir/"
+ if $config_libobj_dir ne '.';
+ $dir = backname ($relative_dir) . "/$dir"
+ if $relative_dir ne '.';
+ define_variable ('LIBOBJDIR', "$dir", INTERNAL);
+ $clean_files{"\$($var)"} = MOSTLY_CLEAN;
+ # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
+ # be created by libtool as a side-effect of creating LTLIBOBJS).
+ $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
+ }
+ else
+ {
+ error ("'\$($var)' cannot be used outside '$config_libobj_dir' if"
+ . " 'subdir-objects' is not set");
+ }
+ }
+
+ return $dir;
+}
+
+sub handle_LIBOBJS
+{
+ my ($var, $cond, $lt) = @_;
+ my $myobjext = $lt ? 'lo' : 'o';
+ $lt ||= '';
+
+ $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS')
+ if ! keys %libsources;
+
+ my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS";
+
+ foreach my $iter (keys %libsources)
+ {
+ if ($iter =~ /\.[cly]$/)
+ {
+ saw_extension ($&);
+ saw_extension ('.c');
+ }
+
+ if ($iter =~ /\.h$/)
+ {
+ require_libsource_with_macro ($cond, $var, FOREIGN, $iter);
+ }
+ elsif ($iter ne 'alloca.c')
+ {
+ my $rewrite = $iter;
+ $rewrite =~ s/\.c$/.P$myobjext/;
+ $dep_files{$dir . '$(DEPDIR)/' . $rewrite} = 1;
+ $rewrite = "^" . quotemeta ($iter) . "\$";
+ # Only require the file if it is not a built source.
+ my $bs = var ('BUILT_SOURCES');
+ if (! $bs || ! grep (/$rewrite/, $bs->value_as_list_recursive))
+ {
+ require_libsource_with_macro ($cond, $var, FOREIGN, $iter);
+ }
+ }
+ }
+}
+
+sub handle_ALLOCA
+{
+ my ($var, $cond, $lt) = @_;
+ my $myobjext = $lt ? 'lo' : 'o';
+ $lt ||= '';
+ my $dir = handle_LIBOBJS_or_ALLOCA "${lt}ALLOCA";
+
+ $var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
+ $dep_files{$dir . '$(DEPDIR)/alloca.P' . $myobjext} = 1;
+ require_libsource_with_macro ($cond, $var, FOREIGN, 'alloca.c');
+ saw_extension ('.c');
+}
+
+# Canonicalize the input parameter.
+sub canonicalize
+{
+ my ($string) = @_;
+ $string =~ tr/A-Za-z0-9_\@/_/c;
+ return $string;
+}
+
+# Canonicalize a name, and check to make sure the non-canonical name
+# is never used. Returns canonical name. Arguments are name and a
+# list of suffixes to check for.
+sub check_canonical_spelling
+{
+ my ($name, @suffixes) = @_;
+
+ my $xname = canonicalize ($name);
+ if ($xname ne $name)
+ {
+ foreach my $xt (@suffixes)
+ {
+ reject_var ("$name$xt", "use '$xname$xt', not '$name$xt'");
+ }
+ }
+
+ return $xname;
+}
+
+# Set up the compile suite.
+sub handle_compile ()
+{
+ return if ! $must_handle_compiled_objects;
+
+ # Boilerplate.
+ my $default_includes = '';
+ if (! option 'nostdinc')
+ {
+ my @incs = ('-I.', subst ('am__isrc'));
+
+ my $var = var 'CONFIG_HEADER';
+ if ($var)
+ {
+ foreach my $hdr (split (' ', $var->variable_value))
+ {
+ push @incs, '-I' . dirname ($hdr);
+ }
+ }
+ # We want '-I. -I$(srcdir)', but the latter -I is redundant
+ # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@`
+ # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'.
+ # Items in CONFIG_HEADER are never in $(srcdir) so it is safe
+ # to just put @am__isrc@ right after '-I.', without a space.
+ ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/;
+ }
+
+ my (@mostly_rms, @dist_rms);
+ foreach my $item (sort keys %compile_clean_files)
+ {
+ if ($compile_clean_files{$item} == MOSTLY_CLEAN)
+ {
+ push (@mostly_rms, "\t-rm -f $item");
+ }
+ elsif ($compile_clean_files{$item} == DIST_CLEAN)
+ {
+ push (@dist_rms, "\t-rm -f $item");
+ }
+ else
+ {
+ prog_error 'invalid entry in %compile_clean_files';
+ }
+ }
+
+ my ($coms, $vars, $rules) =
+ file_contents_internal (1, "$libdir/am/compile.am",
+ new Automake::Location,
+ 'DEFAULT_INCLUDES' => $default_includes,
+ 'MOSTLYRMS' => join ("\n", @mostly_rms),
+ 'DISTRMS' => join ("\n", @dist_rms));
+ $output_vars .= $vars;
+ $output_rules .= "$coms$rules";
+}
+
+# Handle libtool rules.
+sub handle_libtool ()
+{
+ return unless var ('LIBTOOL');
+
+ # Libtool requires some files, but only at top level.
+ # (Starting with Libtool 2.0 we do not have to bother. These
+ # requirements are done with AC_REQUIRE_AUX_FILE.)
+ require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files)
+ if $relative_dir eq '.' && ! $libtool_new_api;
+
+ my @libtool_rms;
+ foreach my $item (sort keys %libtool_clean_directories)
+ {
+ my $dir = ($item eq '.') ? '' : "$item/";
+ # .libs is for Unix, _libs for DOS.
+ push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs");
+ }
+
+ check_user_variables 'LIBTOOLFLAGS';
+
+ # Output the libtool compilation rules.
+ $output_rules .= file_contents ('libtool',
+ new Automake::Location,
+ LTRMS => join ("\n", @libtool_rms));
+}
+
+
+sub handle_programs ()
+{
+ my @proglist = am_install_var ('progs', 'PROGRAMS',
+ 'bin', 'sbin', 'libexec', 'pkglibexec',
+ 'noinst', 'check');
+ return if ! @proglist;
+ $must_handle_compiled_objects = 1;
+
+ my $seen_global_libobjs =
+ var ('LDADD') && handle_lib_objects ('', 'LDADD');
+
+ foreach my $pair (@proglist)
+ {
+ my ($where, $one_file) = @$pair;
+
+ my $seen_libobjs = 0;
+ my $obj = '.$(OBJEXT)';
+
+ $known_programs{$one_file} = $where;
+
+ # Canonicalize names and check for misspellings.
+ my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
+ '_SOURCES', '_OBJECTS',
+ '_DEPENDENCIES');
+
+ $where->push_context ("while processing program '$one_file'");
+ $where->set (INTERNAL->get);
+
+ my $linker = handle_source_transform ($xname, $one_file, $obj, $where,
+ NONLIBTOOL => 1, LIBTOOL => 0);
+
+ if (var ($xname . "_LDADD"))
+ {
+ $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD');
+ }
+ else
+ {
+ # User didn't define prog_LDADD override. So do it.
+ define_variable ($xname . '_LDADD', '$(LDADD)', $where);
+
+ # This does a bit too much work. But we need it to
+ # generate _DEPENDENCIES when appropriate.
+ if (var ('LDADD'))
+ {
+ $seen_libobjs = handle_lib_objects ($xname, 'LDADD');
+ }
+ }
+
+ reject_var ($xname . '_LIBADD',
+ "use '${xname}_LDADD', not '${xname}_LIBADD'");
+
+ set_seen ($xname . '_DEPENDENCIES');
+ set_seen ('EXTRA_' . $xname . '_DEPENDENCIES');
+ set_seen ($xname . '_LDFLAGS');
+
+ # Determine program to use for link.
+ my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname);
+ $vlink = verbose_flag ($vlink || 'GEN');
+
+ # If the resulting program lies in a subdirectory,
+ # ensure that the directory exists before we need it.
+ my $dirstamp = require_build_directory_maybe ($one_file);
+
+ $libtool_clean_directories{dirname ($one_file)} = 1;
+
+ $output_rules .= file_contents ('program',
+ $where,
+ PROGRAM => $one_file,
+ XPROGRAM => $xname,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ DIRSTAMP => $dirstamp,
+ EXEEXT => '$(EXEEXT)');
+
+ if ($seen_libobjs || $seen_global_libobjs)
+ {
+ if (var ($xname . '_LDADD'))
+ {
+ check_libobjs_sources ($xname, $xname . '_LDADD');
+ }
+ elsif (var ('LDADD'))
+ {
+ check_libobjs_sources ($xname, 'LDADD');
+ }
+ }
+ }
+}
+
+
+sub handle_libraries ()
+{
+ my @liblist = am_install_var ('libs', 'LIBRARIES',
+ 'lib', 'pkglib', 'noinst', 'check');
+ return if ! @liblist;
+ $must_handle_compiled_objects = 1;
+
+ my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib',
+ 'noinst', 'check');
+
+ if (@prefix)
+ {
+ my $var = rvar ($prefix[0] . '_LIBRARIES');
+ $var->requires_variables ('library used', 'RANLIB');
+ }
+
+ define_variable ('AR', 'ar', INTERNAL);
+ define_variable ('ARFLAGS', 'cru', INTERNAL);
+ define_verbose_tagvar ('AR');
+
+ foreach my $pair (@liblist)
+ {
+ my ($where, $onelib) = @$pair;
+
+ my $seen_libobjs = 0;
+ # Check that the library fits the standard naming convention.
+ my $bn = basename ($onelib);
+ if ($bn !~ /^lib.*\.a$/)
+ {
+ $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/;
+ my $suggestion = dirname ($onelib) . "/$bn";
+ $suggestion =~ s|^\./||g;
+ msg ('error-gnu/warn', $where,
+ "'$onelib' is not a standard library name\n"
+ . "did you mean '$suggestion'?")
+ }
+
+ ($known_libraries{$onelib} = $bn) =~ s/\.a$//;
+
+ $where->push_context ("while processing library '$onelib'");
+ $where->set (INTERNAL->get);
+
+ my $obj = '.$(OBJEXT)';
+
+ # Canonicalize names and check for misspellings.
+ my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
+ '_OBJECTS', '_DEPENDENCIES',
+ '_AR');
+
+ if (! var ($xlib . '_AR'))
+ {
+ define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
+ }
+
+ # Generate support for conditional object inclusion in
+ # libraries.
+ if (var ($xlib . '_LIBADD'))
+ {
+ if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+ {
+ $seen_libobjs = 1;
+ }
+ }
+ else
+ {
+ define_variable ($xlib . "_LIBADD", '', $where);
+ }
+
+ reject_var ($xlib . '_LDADD',
+ "use '${xlib}_LIBADD', not '${xlib}_LDADD'");
+
+ # Make sure we at look at this.
+ set_seen ($xlib . '_DEPENDENCIES');
+ set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
+
+ handle_source_transform ($xlib, $onelib, $obj, $where,
+ NONLIBTOOL => 1, LIBTOOL => 0);
+
+ # If the resulting library lies in a subdirectory,
+ # make sure this directory will exist.
+ my $dirstamp = require_build_directory_maybe ($onelib);
+ my $verbose = verbose_flag ('AR');
+ my $silent = silent_flag ();
+
+ $output_rules .= file_contents ('library',
+ $where,
+ VERBOSE => $verbose,
+ SILENT => $silent,
+ LIBRARY => $onelib,
+ XLIBRARY => $xlib,
+ DIRSTAMP => $dirstamp);
+
+ if ($seen_libobjs)
+ {
+ if (var ($xlib . '_LIBADD'))
+ {
+ check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+ }
+ }
+
+ if (! $seen_ar)
+ {
+ msg ('extra-portability', $where,
+ "'$onelib': linking libraries using a non-POSIX\n"
+ . "archiver requires 'AM_PROG_AR' in '$configure_ac'")
+ }
+ }
+}
+
+
+sub handle_ltlibraries ()
+{
+ my @liblist = am_install_var ('ltlib', 'LTLIBRARIES',
+ 'noinst', 'lib', 'pkglib', 'check');
+ return if ! @liblist;
+ $must_handle_compiled_objects = 1;
+
+ my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib',
+ 'noinst', 'check');
+
+ if (@prefix)
+ {
+ my $var = rvar ($prefix[0] . '_LTLIBRARIES');
+ $var->requires_variables ('Libtool library used', 'LIBTOOL');
+ }
+
+ my %instdirs = ();
+ my %instsubdirs = ();
+ my %instconds = ();
+ my %liblocations = (); # Location (in Makefile.am) of each library.
+
+ foreach my $key (@prefix)
+ {
+ # Get the installation directory of each library.
+ my $dir = $key;
+ my $strip_subdir = 1;
+ if ($dir =~ /^nobase_/)
+ {
+ $dir =~ s/^nobase_//;
+ $strip_subdir = 0;
+ }
+ my $var = rvar ($key . '_LTLIBRARIES');
+
+ # We reject libraries which are installed in several places
+ # in the same condition, because we can only specify one
+ # '-rpath' option.
+ $var->traverse_recursively
+ (sub
+ {
+ my ($var, $val, $cond, $full_cond) = @_;
+ my $hcond = $full_cond->human;
+ my $where = $var->rdef ($cond)->location;
+ my $ldir = '';
+ $ldir = '/' . dirname ($val)
+ if (!$strip_subdir);
+ # A library cannot be installed in different directories
+ # in overlapping conditions.
+ if (exists $instconds{$val})
+ {
+ my ($msg, $acond) =
+ $instconds{$val}->ambiguous_p ($val, $full_cond);
+
+ if ($msg)
+ {
+ error ($where, $msg, partial => 1);
+ my $dirtxt = "installed " . ($strip_subdir ? "in" : "below") . " '$dir'";
+ $dirtxt = "built for '$dir'"
+ if $dir eq 'EXTRA' || $dir eq 'noinst' || $dir eq 'check';
+ my $dircond =
+ $full_cond->true ? "" : " in condition $hcond";
+
+ error ($where, "'$val' should be $dirtxt$dircond ...",
+ partial => 1);
+
+ my $hacond = $acond->human;
+ my $adir = $instdirs{$val}{$acond};
+ my $adirtxt = "installed in '$adir'";
+ $adirtxt = "built for '$adir'"
+ if ($adir eq 'EXTRA' || $adir eq 'noinst'
+ || $adir eq 'check');
+ my $adircond = $acond->true ? "" : " in condition $hacond";
+
+ my $onlyone = ($dir ne $adir) ?
+ ("\nLibtool libraries can be built for only one "
+ . "destination") : "";
+
+ error ($liblocations{$val}{$acond},
+ "... and should also be $adirtxt$adircond.$onlyone");
+ return;
+ }
+ }
+ else
+ {
+ $instconds{$val} = new Automake::DisjConditions;
+ }
+ $instdirs{$val}{$full_cond} = $dir;
+ $instsubdirs{$val}{$full_cond} = $ldir;
+ $liblocations{$val}{$full_cond} = $where;
+ $instconds{$val} = $instconds{$val}->merge ($full_cond);
+ },
+ sub
+ {
+ return ();
+ },
+ skip_ac_subst => 1);
+ }
+
+ foreach my $pair (@liblist)
+ {
+ my ($where, $onelib) = @$pair;
+
+ my $seen_libobjs = 0;
+ my $obj = '.lo';
+
+ # Canonicalize names and check for misspellings.
+ my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
+ '_SOURCES', '_OBJECTS',
+ '_DEPENDENCIES');
+
+ # Check that the library fits the standard naming convention.
+ my $libname_rx = '^lib.*\.la';
+ my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS');
+ my $ldvar2 = var ('LDFLAGS');
+ if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive))
+ || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive)))
+ {
+ # Relax name checking for libtool modules.
+ $libname_rx = '\.la';
+ }
+
+ my $bn = basename ($onelib);
+ if ($bn !~ /$libname_rx$/)
+ {
+ my $type = 'library';
+ if ($libname_rx eq '\.la')
+ {
+ $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/;
+ $type = 'module';
+ }
+ else
+ {
+ $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/;
+ }
+ my $suggestion = dirname ($onelib) . "/$bn";
+ $suggestion =~ s|^\./||g;
+ msg ('error-gnu/warn', $where,
+ "'$onelib' is not a standard libtool $type name\n"
+ . "did you mean '$suggestion'?")
+ }
+
+ ($known_libraries{$onelib} = $bn) =~ s/\.la$//;
+
+ $where->push_context ("while processing Libtool library '$onelib'");
+ $where->set (INTERNAL->get);
+
+ # Make sure we look at these.
+ set_seen ($xlib . '_LDFLAGS');
+ set_seen ($xlib . '_DEPENDENCIES');
+ set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
+
+ # Generate support for conditional object inclusion in
+ # libraries.
+ if (var ($xlib . '_LIBADD'))
+ {
+ if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+ {
+ $seen_libobjs = 1;
+ }
+ }
+ else
+ {
+ define_variable ($xlib . "_LIBADD", '', $where);
+ }
+
+ reject_var ("${xlib}_LDADD",
+ "use '${xlib}_LIBADD', not '${xlib}_LDADD'");
+
+
+ my $linker = handle_source_transform ($xlib, $onelib, $obj, $where,
+ NONLIBTOOL => 0, LIBTOOL => 1);
+
+ # Determine program to use for link.
+ my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib);
+ $vlink = verbose_flag ($vlink || 'GEN');
+
+ my $rpathvar = "am_${xlib}_rpath";
+ my $rpath = "\$($rpathvar)";
+ foreach my $rcond ($instconds{$onelib}->conds)
+ {
+ my $val;
+ if ($instdirs{$onelib}{$rcond} eq 'EXTRA'
+ || $instdirs{$onelib}{$rcond} eq 'noinst'
+ || $instdirs{$onelib}{$rcond} eq 'check')
+ {
+ # It's an EXTRA_ library, so we can't specify -rpath,
+ # because we don't know where the library will end up.
+ # The user probably knows, but generally speaking automake
+ # doesn't -- and in fact configure could decide
+ # dynamically between two different locations.
+ $val = '';
+ }
+ else
+ {
+ $val = ('-rpath $(' . $instdirs{$onelib}{$rcond} . 'dir)');
+ $val .= $instsubdirs{$onelib}{$rcond}
+ if defined $instsubdirs{$onelib}{$rcond};
+ }
+ if ($rcond->true)
+ {
+ # If $rcond is true there is only one condition and
+ # there is no point defining an helper variable.
+ $rpath = $val;
+ }
+ else
+ {
+ define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val);
+ }
+ }
+
+ # If the resulting library lies in a subdirectory,
+ # make sure this directory will exist.
+ my $dirstamp = require_build_directory_maybe ($onelib);
+
+ # Remember to cleanup .libs/ in this directory.
+ my $dirname = dirname $onelib;
+ $libtool_clean_directories{$dirname} = 1;
+
+ $output_rules .= file_contents ('ltlibrary',
+ $where,
+ LTLIBRARY => $onelib,
+ XLTLIBRARY => $xlib,
+ RPATH => $rpath,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ DIRSTAMP => $dirstamp);
+ if ($seen_libobjs)
+ {
+ if (var ($xlib . '_LIBADD'))
+ {
+ check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+ }
+ }
+
+ if (! $seen_ar)
+ {
+ msg ('extra-portability', $where,
+ "'$onelib': linking libtool libraries using a non-POSIX\n"
+ . "archiver requires 'AM_PROG_AR' in '$configure_ac'")
+ }
+ }
+}
+
+# See if any _SOURCES variable were misspelled.
+sub check_typos ()
+{
+ # It is ok if the user sets this particular variable.
+ set_seen 'AM_LDFLAGS';
+
+ foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES')
+ {
+ foreach my $var (variables $primary)
+ {
+ my $varname = $var->name;
+ # A configure variable is always legitimate.
+ next if exists $configure_vars{$varname};
+
+ for my $cond ($var->conditions->conds)
+ {
+ $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
+ msg_var ('syntax', $var, "variable '$varname' is defined but no"
+ . " program or\nlibrary has '$1' as canonical name"
+ . " (possible typo)")
+ unless $var->rdef ($cond)->seen;
+ }
+ }
+ }
+}
+
+
+sub handle_scripts ()
+{
+ # NOTE we no longer automatically clean SCRIPTS, because it is
+ # useful to sometimes distribute scripts verbatim. This happens
+ # e.g. in Automake itself.
+ am_install_var ('-candist', 'scripts', 'SCRIPTS',
+ 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
+ 'noinst', 'check');
+}
+
+
+## ------------------------ ##
+## Handling Texinfo files. ##
+## ------------------------ ##
+
+# ($OUTFILE, $VFILE)
+# scan_texinfo_file ($FILENAME)
+# -----------------------------
+# $OUTFILE - name of the info file produced by $FILENAME.
+# $VFILE - name of the version.texi file used (undef if none).
+sub scan_texinfo_file
+{
+ my ($filename) = @_;
+
+ my $texi = new Automake::XFile "< $filename";
+ verb "reading $filename";
+
+ my ($outfile, $vfile);
+ while ($_ = $texi->getline)
+ {
+ if (/^\@setfilename +(\S+)/)
+ {
+ # Honor only the first @setfilename. (It's possible to have
+ # more occurrences later if the manual shows examples of how
+ # to use @setfilename...)
+ next if $outfile;
+
+ $outfile = $1;
+ if (index ($outfile, '.') < 0)
+ {
+ msg 'obsolete', "$filename:$.",
+ "use of suffix-less info files is discouraged"
+ }
+ elsif ($outfile !~ /\.info$/)
+ {
+ error ("$filename:$.",
+ "output '$outfile' has unrecognized extension");
+ return;
+ }
+ }
+ # A "version.texi" file is actually any file whose name matches
+ # "vers*.texi".
+ elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/)
+ {
+ $vfile = $1;
+ }
+ }
+
+ if (! $outfile)
+ {
+ err_am "'$filename' missing \@setfilename";
+ return;
+ }
+
+ return ($outfile, $vfile);
+}
+
+
+# ($DIRSTAMP, @CLEAN_FILES)
+# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES)
+# ------------------------------------------------------------------
+# SOURCE - the source Texinfo file
+# DEST - the destination Info file
+# INSRC - whether DEST should be built in the source tree
+# DEPENDENCIES - known dependencies
+sub output_texinfo_build_rules
+{
+ my ($source, $dest, $insrc, @deps) = @_;
+
+ # Split 'a.texi' into 'a' and '.texi'.
+ my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/);
+ my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/);
+
+ $ssfx ||= "";
+ $dsfx ||= "";
+
+ # We can output two kinds of rules: the "generic" rules use Make
+ # suffix rules and are appropriate when $source and $dest do not lie
+ # in a sub-directory; the "specific" rules are needed in the other
+ # case.
+ #
+ # The former are output only once (this is not really apparent here,
+ # but just remember that some logic deeper in Automake will not
+ # output the same rule twice); while the later need to be output for
+ # each Texinfo source.
+ my $generic;
+ my $makeinfoflags;
+ my $sdir = dirname $source;
+ if ($sdir eq '.' && dirname ($dest) eq '.')
+ {
+ $generic = 1;
+ $makeinfoflags = '-I $(srcdir)';
+ }
+ else
+ {
+ $generic = 0;
+ $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir";
+ }
+
+ # A directory can contain two kinds of info files: some built in the
+ # source tree, and some built in the build tree. The rules are
+ # different in each case. However we cannot output two different
+ # set of generic rules. Because in-source builds are more usual, we
+ # use generic rules in this case and fall back to "specific" rules
+ # for build-dir builds. (It should not be a problem to invert this
+ # if needed.)
+ $generic = 0 unless $insrc;
+
+ # We cannot use a suffix rule to build info files with an empty
+ # extension. Otherwise we would output a single suffix inference
+ # rule, with separate dependencies, as in
+ #
+ # .texi:
+ # $(MAKEINFO) ...
+ # foo.info: foo.texi
+ #
+ # which confuse Solaris make. (See the Autoconf manual for
+ # details.) Therefore we use a specific rule in this case. This
+ # applies to info files only (dvi and pdf files always have an
+ # extension).
+ my $generic_info = ($generic && $dsfx) ? 1 : 0;
+
+ # If the resulting file lies in a subdirectory,
+ # make sure this directory will exist.
+ my $dirstamp = require_build_directory_maybe ($dest);
+
+ my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx;
+
+ $output_rules .= file_contents ('texibuild',
+ new Automake::Location,
+ AM_V_MAKEINFO => verbose_flag('MAKEINFO'),
+ AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'),
+ AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'),
+ DEPS => "@deps",
+ DEST_PREFIX => $dpfx,
+ DEST_INFO_PREFIX => $dipfx,
+ DEST_SUFFIX => $dsfx,
+ DIRSTAMP => $dirstamp,
+ GENERIC => $generic,
+ GENERIC_INFO => $generic_info,
+ INSRC => $insrc,
+ MAKEINFOFLAGS => $makeinfoflags,
+ SILENT => silent_flag(),
+ SOURCE => ($generic
+ ? '$<' : $source),
+ SOURCE_INFO => ($generic_info
+ ? '$<' : $source),
+ SOURCE_REAL => $source,
+ SOURCE_SUFFIX => $ssfx,
+ TEXIQUIET => verbose_flag('texinfo'),
+ TEXIDEVNULL => verbose_flag('texidevnull'),
+ );
+ return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
+}
+
+
+# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN)
+# handle_texinfo_helper ($info_texinfos)
+# --------------------------------------
+# Handle all Texinfo source; helper for 'handle_texinfo'.
+sub handle_texinfo_helper
+{
+ my ($info_texinfos) = @_;
+ my (@infobase, @info_deps_list, @texi_deps);
+ my %versions;
+ my $done = 0;
+ my (@mostly_cleans, @texi_cleans, @maint_cleans) = ('', '', '');
+
+ # Build a regex matching user-cleaned files.
+ my $d = var 'DISTCLEANFILES';
+ my $c = var 'CLEANFILES';
+ my @f = ();
+ push @f, $d->value_as_list_recursive (inner_expand => 1) if $d;
+ push @f, $c->value_as_list_recursive (inner_expand => 1) if $c;
+ @f = map { s|[^A-Za-z_0-9*\[\]\-]|\\$&|g; s|\*|[^/]*|g; $_; } @f;
+ my $user_cleaned_files = '^(?:' . join ('|', @f) . ')$';
+
+ foreach my $texi
+ ($info_texinfos->value_as_list_recursive (inner_expand => 1))
+ {
+ my $infobase = $texi;
+ if ($infobase =~ s/\.texi$//)
+ {
+ 1; # Nothing more to do.
+ }
+ elsif ($infobase =~ s/\.(txi|texinfo)$//)
+ {
+ msg_var 'obsolete', $info_texinfos,
+ "suffix '.$1' for Texinfo files is discouraged;" .
+ " use '.texi' instead";
+ }
+ else
+ {
+ # FIXME: report line number.
+ err_am "texinfo file '$texi' has unrecognized extension";
+ next;
+ }
+
+ push @infobase, $infobase;
+
+ # If 'version.texi' is referenced by input file, then include
+ # automatic versioning capability.
+ my ($out_file, $vtexi) =
+ scan_texinfo_file ("$relative_dir/$texi")
+ or next;
+ # Directory of auxiliary files and build by-products used by texi2dvi
+ # and texi2pdf.
+ push @mostly_cleans, "$infobase.t2d";
+ push @mostly_cleans, "$infobase.t2p";
+
+ # If the Texinfo source is in a subdirectory, create the
+ # resulting info in this subdirectory. If it is in the current
+ # directory, try hard to not prefix "./" because it breaks the
+ # generic rules.
+ my $outdir = dirname ($texi) . '/';
+ $outdir = "" if $outdir eq './';
+ $out_file = $outdir . $out_file;
+
+ # Until Automake 1.6.3, .info files were built in the
+ # source tree. This was an obstacle to the support of
+ # non-distributed .info files, and non-distributed .texi
+ # files.
+ #
+ # * Non-distributed .texi files is important in some packages
+ # where .texi files are built at make time, probably using
+ # other binaries built in the package itself, maybe using
+ # tools or information found on the build host. Because
+ # these files are not distributed they are always rebuilt
+ # at make time; they should therefore not lie in the source
+ # directory. One plan was to support this using
+ # nodist_info_TEXINFOS or something similar. (Doing this
+ # requires some sanity checks. For instance Automake should
+ # not allow:
+ # dist_info_TEXINFOS = foo.texi
+ # nodist_foo_TEXINFOS = included.texi
+ # because a distributed file should never depend on a
+ # non-distributed file.)
+ #
+ # * If .texi files are not distributed, then .info files should
+ # not be distributed either. There are also cases where one
+ # wants to distribute .texi files, but does not want to
+ # distribute the .info files. For instance the Texinfo package
+ # distributes the tool used to build these files; it would
+ # be a waste of space to distribute them. It's not clear
+ # which syntax we should use to indicate that .info files should
+ # not be distributed. Akim Demaille suggested that eventually
+ # we switch to a new syntax:
+ # | Maybe we should take some inspiration from what's already
+ # | done in the rest of Automake. Maybe there is too much
+ # | syntactic sugar here, and you want
+ # | nodist_INFO = bar.info
+ # | dist_bar_info_SOURCES = bar.texi
+ # | bar_texi_DEPENDENCIES = foo.texi
+ # | with a bit of magic to have bar.info represent the whole
+ # | bar*info set. That's a lot more verbose that the current
+ # | situation, but it is # not new, hence the user has less
+ # | to learn.
+ # |
+ # | But there is still too much room for meaningless specs:
+ # | nodist_INFO = bar.info
+ # | dist_bar_info_SOURCES = bar.texi
+ # | dist_PS = bar.ps something-written-by-hand.ps
+ # | nodist_bar_ps_SOURCES = bar.texi
+ # | bar_texi_DEPENDENCIES = foo.texi
+ # | here bar.texi is dist_ in line 2, and nodist_ in 4.
+ #
+ # Back to the point, it should be clear that in order to support
+ # non-distributed .info files, we need to build them in the
+ # build tree, not in the source tree (non-distributed .texi
+ # files are less of a problem, because we do not output build
+ # rules for them). In Automake 1.7 .info build rules have been
+ # largely cleaned up so that .info files get always build in the
+ # build tree, even when distributed. The idea was that
+ # (1) if during a VPATH build the .info file was found to be
+ # absent or out-of-date (in the source tree or in the
+ # build tree), Make would rebuild it in the build tree.
+ # If an up-to-date source-tree of the .info file existed,
+ # make would not rebuild it in the build tree.
+ # (2) having two copies of .info files, one in the source tree
+ # and one (newer) in the build tree is not a problem
+ # because 'make dist' always pick files in the build tree
+ # first.
+ # However it turned out the be a bad idea for several reasons:
+ # * Tru64, OpenBSD, and FreeBSD (not NetBSD) Make do not behave
+ # like GNU Make on point (1) above. These implementations
+ # of Make would always rebuild .info files in the build
+ # tree, even if such files were up to date in the source
+ # tree. Consequently, it was impossible to perform a VPATH
+ # build of a package containing Texinfo files using these
+ # Make implementations.
+ # (Refer to the Autoconf Manual, section "Limitation of
+ # Make", paragraph "VPATH", item "target lookup", for
+ # an account of the differences between these
+ # implementations.)
+ # * The GNU Coding Standards require these files to be built
+ # in the source-tree (when they are distributed, that is).
+ # * Keeping a fresher copy of distributed files in the
+ # build tree can be annoying during development because
+ # - if the files is kept under CVS, you really want it
+ # to be updated in the source tree
+ # - it is confusing that 'make distclean' does not erase
+ # all files in the build tree.
+ #
+ # Consequently, starting with Automake 1.8, .info files are
+ # built in the source tree again. Because we still plan to
+ # support non-distributed .info files at some point, we
+ # have a single variable ($INSRC) that controls whether
+ # the current .info file must be built in the source tree
+ # or in the build tree. Actually this variable is switched
+ # off in two cases:
+ # (1) For '.info' files that appear to be cleaned; this is for
+ # backward compatibility with package such as Texinfo,
+ # which do things like
+ # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi
+ # DISTCLEANFILES = texinfo texinfo-* info*.info*
+ # # Do not create info files for distribution.
+ # dist-info:
+ # in order not to distribute .info files.
+ # (2) When the undocumented option 'info-in-builddir' is given.
+ # This is done to allow the developers of GCC, GDB, GNU
+ # binutils and the GNU bfd library to force the '.info' files
+ # to be generated in the builddir rather than the srcdir, as
+ # was once done when the (now removed) 'cygnus' option was
+ # given. See automake bug#11034 for more discussion.
+ my $insrc = 1;
+
+ if (option 'info-in-builddir')
+ {
+ $insrc = 0;
+ }
+ elsif ($out_file =~ $user_cleaned_files)
+ {
+ $insrc = 0;
+ msg 'obsolete', "$am_file.am", < $texi,
+ VTI => $vti,
+ STAMPVTI => "${outdir}stamp-$vti",
+ VTEXI => "$outdir$vtexi",
+ MDDIR => $conf_dir,
+ DIRSTAMP => $dirstamp);
+ }
+ }
+
+ # Handle location of texinfo.tex.
+ my $need_texi_file = 0;
+ my $texinfodir;
+ if (var ('TEXINFO_TEX'))
+ {
+ # The user defined TEXINFO_TEX so assume he knows what he is
+ # doing.
+ $texinfodir = ('$(srcdir)/'
+ . dirname (variable_value ('TEXINFO_TEX')));
+ }
+ elsif ($config_aux_dir_set_in_configure_ac)
+ {
+ $texinfodir = $am_config_aux_dir;
+ define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
+ $need_texi_file = 2; # so that we require_conf_file later
+ }
+ else
+ {
+ $texinfodir = '$(srcdir)';
+ $need_texi_file = 1;
+ }
+ define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL);
+
+ push (@dist_targets, 'dist-info');
+
+ if (! option 'no-installinfo')
+ {
+ # Make sure documentation is made and installed first. Use
+ # $(INFO_DEPS), not 'info', because otherwise recursive makes
+ # get run twice during "make all".
+ unshift (@all, '$(INFO_DEPS)');
+ }
+
+ define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL);
+ define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL);
+ define_files_variable ("PSS", @infobase, 'ps', INTERNAL);
+ define_files_variable ("HTMLS", @infobase, 'html', INTERNAL);
+
+ # This next isn't strictly needed now -- the places that look here
+ # could easily be changed to look in info_TEXINFOS. But this is
+ # probably better, in case noinst_TEXINFOS is ever supported.
+ define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL);
+
+ # Do some error checking. Note that this file is not required
+ # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly
+ # up above.
+ if ($need_texi_file && ! option 'no-texinfo.tex')
+ {
+ if ($need_texi_file > 1)
+ {
+ require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
+ 'texinfo.tex');
+ }
+ else
+ {
+ require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN,
+ 'texinfo.tex');
+ }
+ }
+
+ return (makefile_wrap ("", "\t ", @mostly_cleans),
+ makefile_wrap ("", "\t ", @texi_cleans),
+ makefile_wrap ("", "\t ", @maint_cleans));
+}
+
+
+sub handle_texinfo ()
+{
+ reject_var 'TEXINFOS', "'TEXINFOS' is an anachronism; use 'info_TEXINFOS'";
+ # FIXME: I think this is an obsolete future feature name.
+ reject_var 'html_TEXINFOS', "HTML generation not yet supported";
+
+ my $info_texinfos = var ('info_TEXINFOS');
+ my ($mostlyclean, $clean, $maintclean) = ('', '', '');
+ if ($info_texinfos)
+ {
+ define_verbose_texinfo;
+ ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
+ chomp $mostlyclean;
+ chomp $clean;
+ chomp $maintclean;
+ }
+
+ $output_rules .= file_contents ('texinfos',
+ new Automake::Location,
+ AM_V_DVIPS => verbose_flag('DVIPS'),
+ MOSTLYCLEAN => $mostlyclean,
+ TEXICLEAN => $clean,
+ MAINTCLEAN => $maintclean,
+ 'LOCAL-TEXIS' => !!$info_texinfos,
+ TEXIQUIET => verbose_flag('texinfo'));
+}
+
+
+sub handle_man_pages ()
+{
+ reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
+
+ # Find all the sections in use. We do this by first looking for
+ # "standard" sections, and then looking for any additional
+ # sections used in man_MANS.
+ my (%sections, %notrans_sections, %trans_sections,
+ %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars);
+ # We handle nodist_ for uniformity. man pages aren't distributed
+ # by default so it isn't actually very important.
+ foreach my $npfx ('', 'notrans_')
+ {
+ foreach my $pfx ('', 'dist_', 'nodist_')
+ {
+ # Add more sections as needed.
+ foreach my $section ('0'..'9', 'n', 'l')
+ {
+ my $varname = $npfx . $pfx . 'man' . $section . '_MANS';
+ if (var ($varname))
+ {
+ $sections{$section} = 1;
+ $varname = '$(' . $varname . ')';
+ if ($npfx eq 'notrans_')
+ {
+ $notrans_sections{$section} = 1;
+ $notrans_sect_vars{$varname} = 1;
+ }
+ else
+ {
+ $trans_sections{$section} = 1;
+ $trans_sect_vars{$varname} = 1;
+ }
+
+ push_dist_common ($varname)
+ if $pfx eq 'dist_';
+ }
+ }
+
+ my $varname = $npfx . $pfx . 'man_MANS';
+ my $var = var ($varname);
+ if ($var)
+ {
+ foreach ($var->value_as_list_recursive)
+ {
+ # A page like 'foo.1c' goes into man1dir.
+ if (/\.([0-9a-z])([a-z]*)$/)
+ {
+ $sections{$1} = 1;
+ if ($npfx eq 'notrans_')
+ {
+ $notrans_sections{$1} = 1;
+ }
+ else
+ {
+ $trans_sections{$1} = 1;
+ }
+ }
+ }
+
+ $varname = '$(' . $varname . ')';
+ if ($npfx eq 'notrans_')
+ {
+ $notrans_vars{$varname} = 1;
+ }
+ else
+ {
+ $trans_vars{$varname} = 1;
+ }
+ push_dist_common ($varname)
+ if $pfx eq 'dist_';
+ }
+ }
+ }
+
+ return unless %sections;
+
+ my @unsorted_deps;
+
+ # Build section independent variables.
+ my $have_notrans = %notrans_vars;
+ my @notrans_list = sort keys %notrans_vars;
+ my $have_trans = %trans_vars;
+ my @trans_list = sort keys %trans_vars;
+
+ # Now for each section, generate an install and uninstall rule.
+ # Sort sections so output is deterministic.
+ foreach my $section (sort keys %sections)
+ {
+ # Build section dependent variables.
+ my $notrans_mans = $have_notrans || exists $notrans_sections{$section};
+ my $trans_mans = $have_trans || exists $trans_sections{$section};
+ my (%notrans_this_sect, %trans_this_sect);
+ my $expr = 'man' . $section . '_MANS';
+ foreach my $varname (keys %notrans_sect_vars)
+ {
+ if ($varname =~ /$expr/)
+ {
+ $notrans_this_sect{$varname} = 1;
+ }
+ }
+ foreach my $varname (keys %trans_sect_vars)
+ {
+ if ($varname =~ /$expr/)
+ {
+ $trans_this_sect{$varname} = 1;
+ }
+ }
+ my @notrans_sect_list = sort keys %notrans_this_sect;
+ my @trans_sect_list = sort keys %trans_this_sect;
+ @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
+ keys %notrans_this_sect, keys %trans_this_sect);
+ my @deps = sort @unsorted_deps;
+ $output_rules .= file_contents ('mans',
+ new Automake::Location,
+ SECTION => $section,
+ DEPS => "@deps",
+ NOTRANS_MANS => $notrans_mans,
+ NOTRANS_SECT_LIST => "@notrans_sect_list",
+ HAVE_NOTRANS => $have_notrans,
+ NOTRANS_LIST => "@notrans_list",
+ TRANS_MANS => $trans_mans,
+ TRANS_SECT_LIST => "@trans_sect_list",
+ HAVE_TRANS => $have_trans,
+ TRANS_LIST => "@trans_list");
+ }
+
+ @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
+ keys %notrans_sect_vars, keys %trans_sect_vars);
+ my @mans = sort @unsorted_deps;
+ $output_vars .= file_contents ('mans-vars',
+ new Automake::Location,
+ MANS => "@mans");
+
+ push (@all, '$(MANS)')
+ unless option 'no-installman';
+}
+
+
+sub handle_data ()
+{
+ am_install_var ('-noextra', '-candist', 'data', 'DATA',
+ 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
+ 'ps', 'sysconf', 'sharedstate', 'localstate',
+ 'pkgdata', 'lisp', 'noinst', 'check');
+}
+
+
+sub handle_tags ()
+{
+ my @config;
+ foreach my $spec (@config_headers)
+ {
+ my ($out, @ins) = split_config_file_spec ($spec);
+ foreach my $in (@ins)
+ {
+ # If the config header source is in this directory,
+ # require it.
+ push @config, basename ($in)
+ if $relative_dir eq dirname ($in);
+ }
+ }
+
+ define_variable ('am__tagged_files',
+ '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)'
+ . "@config", INTERNAL);
+
+ if (rvar('am__tagged_files')->value_as_list_recursive
+ || var ('ETAGS_ARGS') || var ('SUBDIRS'))
+ {
+ $output_rules .= file_contents ('tags', new Automake::Location);
+ set_seen 'TAGS_DEPENDENCIES';
+ }
+ else
+ {
+ reject_var ('TAGS_DEPENDENCIES',
+ "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
+ . " without\nsources or 'ETAGS_ARGS'");
+ # Every Makefile must define some sort of TAGS rule.
+ # Otherwise, it would be possible for a top-level "make TAGS"
+ # to fail because some subdirectory failed. Ditto ctags and
+ # cscope.
+ $output_rules .=
+ "tags TAGS:\n\n" .
+ "ctags CTAGS:\n\n" .
+ "cscope cscopelist:\n\n";
+ }
+}
+
+
+# user_phony_rule ($NAME)
+# -----------------------
+# Return false if rule $NAME does not exist. Otherwise,
+# declare it as phony, complete its definition (in case it is
+# conditional), and return its Automake::Rule instance.
+sub user_phony_rule
+{
+ my ($name) = @_;
+ my $rule = rule $name;
+ if ($rule)
+ {
+ depend ('.PHONY', $name);
+ # Define $NAME in all condition where it is not already defined,
+ # so that it is always OK to depend on $NAME.
+ for my $c ($rule->not_always_defined_in_cond (TRUE)->conds)
+ {
+ Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE,
+ $c, INTERNAL);
+ $output_rules .= $c->subst_string . "$name:\n";
+ }
+ }
+ return $rule;
+}
+
+
+# Handle 'dist' target.
+sub handle_dist ()
+{
+ # Substitutions for distdir.am
+ my %transform;
+
+ # Define DIST_SUBDIRS. This must always be done, regardless of the
+ # no-dist setting: target like 'distclean' or 'maintainer-clean' use it.
+ my $subdirs = var ('SUBDIRS');
+ if ($subdirs)
+ {
+ # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
+ # to all possible directories, and use it. If DIST_SUBDIRS is
+ # defined, just use it.
+
+ # Note that we check DIST_SUBDIRS first on purpose, so that
+ # we don't call has_conditional_contents for now reason.
+ # (In the past one project used so many conditional subdirectories
+ # that calling has_conditional_contents on SUBDIRS caused
+ # automake to grow to 150Mb -- this should not happen with
+ # the current implementation of has_conditional_contents,
+ # but it's more efficient to avoid the call anyway.)
+ if (var ('DIST_SUBDIRS'))
+ {
+ }
+ elsif ($subdirs->has_conditional_contents)
+ {
+ define_pretty_variable
+ ('DIST_SUBDIRS', TRUE, INTERNAL,
+ uniq ($subdirs->value_as_list_recursive));
+ }
+ else
+ {
+ # We always define this because that is what 'distclean'
+ # wants.
+ define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL,
+ '$(SUBDIRS)');
+ }
+ }
+
+ # The remaining definitions are only required when a dist target is used.
+ return if option 'no-dist';
+
+ # At least one of the archive formats must be enabled.
+ if ($relative_dir eq '.')
+ {
+ my $archive_defined = option 'no-dist-gzip' ? 0 : 1;
+ $archive_defined ||=
+ grep { option "dist-$_" } qw(shar zip tarZ bzip2 lzip xz);
+ error (option 'no-dist-gzip',
+ "no-dist-gzip specified but no dist-* specified,\n"
+ . "at least one archive format must be enabled")
+ unless $archive_defined;
+ }
+
+ # Look for common files that should be included in distribution.
+ # If the aux dir is set, and it does not have a Makefile.am, then
+ # we check for these files there as well.
+ my $check_aux = 0;
+ if ($relative_dir eq '.'
+ && $config_aux_dir_set_in_configure_ac)
+ {
+ if (! is_make_dir ($config_aux_dir))
+ {
+ $check_aux = 1;
+ }
+ }
+ foreach my $cfile (@common_files)
+ {
+ if (dir_has_case_matching_file ($relative_dir, $cfile)
+ # The file might be absent, but if it can be built it's ok.
+ || rule $cfile)
+ {
+ push_dist_common ($cfile);
+ }
+
+ # Don't use 'elsif' here because a file might meaningfully
+ # appear in both directories.
+ if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile))
+ {
+ push_dist_common ("$config_aux_dir/$cfile")
+ }
+ }
+
+ # We might copy elements from $configure_dist_common to
+ # %dist_common if we think we need to. If the file appears in our
+ # directory, we would have discovered it already, so we don't
+ # check that. But if the file is in a subdir without a Makefile,
+ # we want to distribute it here if we are doing '.'. Ugly!
+ # Also, in some corner cases, it's possible that the following code
+ # will cause the same file to appear in the $(DIST_COMMON) variables
+ # of two distinct Makefiles; but this is not a problem, since the
+ # 'distdir' target in 'lib/am/distdir.am' can deal with the same
+ # file being distributed multiple times.
+ # See also automake bug#9651.
+ if ($relative_dir eq '.')
+ {
+ foreach my $file (split (' ' , $configure_dist_common))
+ {
+ my $dir = dirname ($file);
+ push_dist_common ($file)
+ if ($dir eq '.' || ! is_make_dir ($dir));
+ }
+ }
+
+ # Files to distributed. Don't use ->value_as_list_recursive
+ # as it recursively expands '$(dist_pkgdata_DATA)' etc.
+ my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
+ @dist_common = uniq (@dist_common);
+ variable_delete 'DIST_COMMON';
+ define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
+
+ # Now that we've processed DIST_COMMON, disallow further attempts
+ # to set it.
+ $handle_dist_run = 1;
+
+ $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook';
+ $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external;
+
+ # If the target 'dist-hook' exists, make sure it is run. This
+ # allows users to do random weird things to the distribution
+ # before it is packaged up.
+ push (@dist_targets, 'dist-hook')
+ if user_phony_rule 'dist-hook';
+ $transform{'DIST-TARGETS'} = join (' ', @dist_targets);
+
+ my $flm = option ('filename-length-max');
+ my $filename_filter = $flm ? '.' x $flm->[1] : '';
+
+ $output_rules .= file_contents ('distdir',
+ new Automake::Location,
+ %transform,
+ FILENAME_FILTER => $filename_filter);
+}
+
+
+# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."])
+# -------------------------------------------------------
+# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane
+# name. Use $WHERE as a location in the diagnostic, if any.
+sub check_directory
+{
+ my ($dir, $where, $reldir) = @_;
+ $reldir = '.' unless defined $reldir;
+
+ error $where, "required directory $reldir/$dir does not exist"
+ unless -d "$reldir/$dir";
+
+ # If an 'obj/' directory exists, BSD make will enter it before
+ # reading 'Makefile'. Hence the 'Makefile' in the current directory
+ # will not be read.
+ #
+ # % cat Makefile
+ # all:
+ # echo Hello
+ # % cat obj/Makefile
+ # all:
+ # echo World
+ # % make # GNU make
+ # echo Hello
+ # Hello
+ # % pmake # BSD make
+ # echo World
+ # World
+ msg ('portability', $where,
+ "naming a subdirectory 'obj' causes troubles with BSD make")
+ if $dir eq 'obj';
+
+ # 'aux' is probably the most important of the following forbidden name,
+ # since it's tempting to use it as an AC_CONFIG_AUX_DIR.
+ msg ('portability', $where,
+ "name '$dir' is reserved on W32 and DOS platforms")
+ if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/);
+}
+
+# check_directories_in_var ($VARIABLE)
+# ------------------------------------
+# Recursively check all items in variables $VARIABLE as directories
+sub check_directories_in_var
+{
+ my ($var) = @_;
+ $var->traverse_recursively
+ (sub
+ {
+ my ($var, $val, $cond, $full_cond) = @_;
+ check_directory ($val, $var->rdef ($cond)->location, $relative_dir);
+ return ();
+ },
+ undef,
+ skip_ac_subst => 1);
+}
+
+
+sub handle_subdirs ()
+{
+ my $subdirs = var ('SUBDIRS');
+ return
+ unless $subdirs;
+
+ check_directories_in_var $subdirs;
+
+ my $dsubdirs = var ('DIST_SUBDIRS');
+ check_directories_in_var $dsubdirs
+ if $dsubdirs;
+
+ $output_rules .= file_contents ('subdirs', new Automake::Location);
+ rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
+}
+
+
+# ($REGEN, @DEPENDENCIES)
+# scan_aclocal_m4
+# ---------------
+# If aclocal.m4 creation is automated, return the list of its dependencies.
+sub scan_aclocal_m4 ()
+{
+ my $regen_aclocal = 0;
+
+ set_seen 'CONFIG_STATUS_DEPENDENCIES';
+ set_seen 'CONFIGURE_DEPENDENCIES';
+
+ if (-f 'aclocal.m4')
+ {
+ define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
+
+ my $aclocal = new Automake::XFile "< aclocal.m4";
+ my $line = $aclocal->getline;
+ $regen_aclocal = $line =~ 'generated automatically by aclocal';
+ }
+
+ my @ac_deps = ();
+
+ if (set_seen ('ACLOCAL_M4_SOURCES'))
+ {
+ push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
+ msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
+ "'ACLOCAL_M4_SOURCES' is obsolete.\n"
+ . "It should be safe to simply remove it");
+ }
+
+ # Note that it might be possible that aclocal.m4 doesn't exist but
+ # should be auto-generated. This case probably isn't very
+ # important.
+
+ return ($regen_aclocal, @ac_deps);
+}
+
+
+# Helper function for 'substitute_ac_subst_variables'.
+sub substitute_ac_subst_variables_worker
+{
+ my ($token) = @_;
+ return "\@$token\@" if var $token;
+ return "\${$token\}";
+}
+
+# substitute_ac_subst_variables ($TEXT)
+# -------------------------------------
+# Replace any occurrence of ${FOO} in $TEXT by @FOO@ if FOO is an AC_SUBST
+# variable.
+sub substitute_ac_subst_variables
+{
+ my ($text) = @_;
+ $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
+ return $text;
+}
+
+# @DEPENDENCIES
+# prepend_srcdir (@INPUTS)
+# ------------------------
+# Prepend $(srcdir) or $(top_srcdir) to all @INPUTS. The idea is that
+# if an input file has a directory part the same as the current
+# directory, then the directory part is simply replaced by $(srcdir).
+# But if the directory part is different, then $(top_srcdir) is
+# prepended.
+sub prepend_srcdir
+{
+ my (@inputs) = @_;
+ my @newinputs;
+
+ foreach my $single (@inputs)
+ {
+ if (dirname ($single) eq $relative_dir)
+ {
+ push (@newinputs, '$(srcdir)/' . basename ($single));
+ }
+ else
+ {
+ push (@newinputs, '$(top_srcdir)/' . $single);
+ }
+ }
+ return @newinputs;
+}
+
+# @DEPENDENCIES
+# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS)
+# ---------------------------------------------------
+# Compute a list of dependencies appropriate for the rebuild
+# rule of
+# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...)
+# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs.
+sub rewrite_inputs_into_dependencies
+{
+ my ($file, @inputs) = @_;
+ my @res = ();
+
+ for my $i (@inputs)
+ {
+ # We cannot create dependencies on shell variables.
+ next if (substitute_ac_subst_variables $i) =~ /\$/;
+
+ if (exists $ac_config_files_location{$i} && $i ne $file)
+ {
+ my $di = dirname $i;
+ if ($di eq $relative_dir)
+ {
+ $i = basename $i;
+ }
+ # In the top-level Makefile we do not use $(top_builddir), because
+ # we are already there, and since the targets are built without
+ # a $(top_builddir), it helps BSD Make to match them with
+ # dependencies.
+ elsif ($relative_dir ne '.')
+ {
+ $i = '$(top_builddir)/' . $i;
+ }
+ }
+ else
+ {
+ msg ('error', $ac_config_files_location{$file},
+ "required file '$i' not found")
+ unless $i =~ /\$/ || exists $output_files{$i} || -f $i;
+ ($i) = prepend_srcdir ($i);
+ push_dist_common ($i);
+ }
+ push @res, $i;
+ }
+ return @res;
+}
+
+
+
+# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
+# -----------------------------------------------------------------
+# Handle remaking and configure stuff.
+# We need the name of the input file, to do proper remaking rules.
+sub handle_configure
+{
+ my ($makefile_am, $makefile_in, $makefile, @inputs) = @_;
+
+ prog_error 'empty @inputs'
+ unless @inputs;
+
+ my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am,
+ $makefile_in);
+ my $rel_makefile = basename $makefile;
+
+ my $colon_infile = ':' . join (':', @inputs);
+ $colon_infile = '' if $colon_infile eq ":$makefile.in";
+ my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs);
+ my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4;
+ define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL,
+ @configure_deps, @aclocal_m4_deps,
+ '$(top_srcdir)/' . $configure_ac);
+ my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)');
+ push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4';
+ define_pretty_variable ('am__configure_deps', TRUE, INTERNAL,
+ @configuredeps);
+
+ my $automake_options = '--' . $strictness_name .
+ (global_option 'no-dependencies' ? ' --ignore-deps' : '');
+
+ $output_rules .= file_contents
+ ('configure',
+ new Automake::Location,
+ MAKEFILE => $rel_makefile,
+ 'MAKEFILE-DEPS' => "@rewritten",
+ 'CONFIG-MAKEFILE' => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@',
+ 'MAKEFILE-IN' => $rel_makefile_in,
+ 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0),
+ 'MAKEFILE-IN-DEPS' => "@include_stack",
+ 'MAKEFILE-AM' => $rel_makefile_am,
+ 'AUTOMAKE-OPTIONS' => $automake_options,
+ 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile",
+ 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4,
+ VERBOSE => verbose_flag ('GEN'));
+
+ if ($relative_dir eq '.')
+ {
+ push_dist_common ('acconfig.h')
+ if -f 'acconfig.h';
+ }
+
+ # If we have a configure header, require it.
+ my $hdr_index = 0;
+ my @distclean_config;
+ foreach my $spec (@config_headers)
+ {
+ $hdr_index += 1;
+ # $CONFIG_H_PATH: config.h from top level.
+ my ($config_h_path, @ins) = split_config_file_spec ($spec);
+ my $config_h_dir = dirname ($config_h_path);
+
+ # If the header is in the current directory we want to build
+ # the header here. Otherwise, if we're at the topmost
+ # directory and the header's directory doesn't have a
+ # Makefile, then we also want to build the header.
+ if ($relative_dir eq $config_h_dir
+ || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir)))
+ {
+ my ($cn_sans_dir, $stamp_dir);
+ if ($relative_dir eq $config_h_dir)
+ {
+ $cn_sans_dir = basename ($config_h_path);
+ $stamp_dir = '';
+ }
+ else
+ {
+ $cn_sans_dir = $config_h_path;
+ if ($config_h_dir eq '.')
+ {
+ $stamp_dir = '';
+ }
+ else
+ {
+ $stamp_dir = $config_h_dir . '/';
+ }
+ }
+
+ # This will also distribute all inputs.
+ @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins);
+
+ # Cannot define rebuild rules for filenames with shell variables.
+ next if (substitute_ac_subst_variables $config_h_path) =~ /\$/;
+
+ # Header defined in this directory.
+ my @files;
+ if (-f $config_h_path . '.top')
+ {
+ push (@files, "$cn_sans_dir.top");
+ }
+ if (-f $config_h_path . '.bot')
+ {
+ push (@files, "$cn_sans_dir.bot");
+ }
+
+ push_dist_common (@files);
+
+ # For now, acconfig.h can only appear in the top srcdir.
+ if (-f 'acconfig.h')
+ {
+ push (@files, '$(top_srcdir)/acconfig.h');
+ }
+
+ my $stamp = "${stamp_dir}stamp-h${hdr_index}";
+ $output_rules .=
+ file_contents ('remake-hdr',
+ new Automake::Location,
+ FILES => "@files",
+ 'FIRST-HDR' => ($hdr_index == 1),
+ CONFIG_H => $cn_sans_dir,
+ CONFIG_HIN => $ins[0],
+ CONFIG_H_DEPS => "@ins",
+ CONFIG_H_PATH => $config_h_path,
+ STAMP => "$stamp");
+
+ push @distclean_config, $cn_sans_dir, $stamp;
+ }
+ }
+
+ $output_rules .= file_contents ('clean-hdr',
+ new Automake::Location,
+ FILES => "@distclean_config")
+ if @distclean_config;
+
+ # Distribute and define mkinstalldirs only if it is already present
+ # in the package, for backward compatibility (some people may still
+ # use $(mkinstalldirs)).
+ # TODO: start warning about this in Automake 1.14, and have
+ # TODO: Automake 2.0 drop it (and the mkinstalldirs script
+ # TODO: as well).
+ my $mkidpath = "$config_aux_dir/mkinstalldirs";
+ if (-f $mkidpath)
+ {
+ # Use require_file so that any existing script gets updated
+ # by --force-missing.
+ require_conf_file ($mkidpath, FOREIGN, 'mkinstalldirs');
+ define_variable ('mkinstalldirs',
+ "\$(SHELL) $am_config_aux_dir/mkinstalldirs", INTERNAL);
+ }
+ else
+ {
+ # Use $(install_sh), not $(MKDIR_P) because the latter requires
+ # at least one argument, and $(mkinstalldirs) used to work
+ # even without arguments (e.g. $(mkinstalldirs) $(conditional_dir)).
+ define_variable ('mkinstalldirs', '$(install_sh) -d', INTERNAL);
+ }
+
+ reject_var ('CONFIG_HEADER',
+ "'CONFIG_HEADER' is an anachronism; now determined "
+ . "automatically\nfrom '$configure_ac'");
+
+ my @config_h;
+ foreach my $spec (@config_headers)
+ {
+ my ($out, @ins) = split_config_file_spec ($spec);
+ # Generate CONFIG_HEADER define.
+ if ($relative_dir eq dirname ($out))
+ {
+ push @config_h, basename ($out);
+ }
+ else
+ {
+ push @config_h, "\$(top_builddir)/$out";
+ }
+ }
+ define_variable ("CONFIG_HEADER", "@config_h", INTERNAL)
+ if @config_h;
+
+ # Now look for other files in this directory which must be remade
+ # by config.status, and generate rules for them.
+ my @actual_other_files = ();
+ # These get cleaned only in a VPATH build.
+ my @actual_other_vpath_files = ();
+ foreach my $lfile (@other_input_files)
+ {
+ my $file;
+ my @inputs;
+ if ($lfile =~ /^([^:]*):(.*)$/)
+ {
+ # This is the ":" syntax of AC_OUTPUT.
+ $file = $1;
+ @inputs = split (':', $2);
+ }
+ else
+ {
+ # Normal usage.
+ $file = $lfile;
+ @inputs = $file . '.in';
+ }
+
+ # Automake files should not be stored in here, but in %MAKE_LIST.
+ prog_error ("$lfile in \@other_input_files\n"
+ . "\@other_input_files = (@other_input_files)")
+ if -f $file . '.am';
+
+ my $local = basename ($file);
+
+ # We skip files that aren't in this directory. However, if
+ # the file's directory does not have a Makefile, and we are
+ # currently doing '.', then we create a rule to rebuild the
+ # file in the subdir.
+ my $fd = dirname ($file);
+ if ($fd ne $relative_dir)
+ {
+ if ($relative_dir eq '.' && ! is_make_dir ($fd))
+ {
+ $local = $file;
+ }
+ else
+ {
+ next;
+ }
+ }
+
+ my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs);
+
+ # Cannot output rules for shell variables.
+ next if (substitute_ac_subst_variables $local) =~ /\$/;
+
+ my $condstr = '';
+ my $cond = $ac_config_files_condition{$lfile};
+ if (defined $cond)
+ {
+ $condstr = $cond->subst_string;
+ Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond,
+ $ac_config_files_location{$file});
+ }
+ $output_rules .= ($condstr . $local . ': '
+ . '$(top_builddir)/config.status '
+ . "@rewritten_inputs\n"
+ . $condstr . "\t"
+ . 'cd $(top_builddir) && '
+ . '$(SHELL) ./config.status '
+ . ($relative_dir eq '.' ? '' : '$(subdir)/')
+ . '$@'
+ . "\n");
+ push (@actual_other_files, $local);
+ }
+
+ # For links we should clean destinations and distribute sources.
+ foreach my $spec (@config_links)
+ {
+ my ($link, $file) = split /:/, $spec;
+ # Some people do AC_CONFIG_LINKS($computed). We only handle
+ # the DEST:SRC form.
+ next unless $file;
+ my $where = $ac_config_files_location{$link};
+
+ # Skip destinations that contain shell variables.
+ if ((substitute_ac_subst_variables $link) !~ /\$/)
+ {
+ # We skip links that aren't in this directory. However, if
+ # the link's directory does not have a Makefile, and we are
+ # currently doing '.', then we add the link to CONFIG_CLEAN_FILES
+ # in '.'s Makefile.in.
+ my $local = basename ($link);
+ my $fd = dirname ($link);
+ if ($fd ne $relative_dir)
+ {
+ if ($relative_dir eq '.' && ! is_make_dir ($fd))
+ {
+ $local = $link;
+ }
+ else
+ {
+ $local = undef;
+ }
+ }
+ if ($file ne $link)
+ {
+ push @actual_other_files, $local if $local;
+ }
+ else
+ {
+ push @actual_other_vpath_files, $local if $local;
+ }
+ }
+
+ # Do not process sources that contain shell variables.
+ if ((substitute_ac_subst_variables $file) !~ /\$/)
+ {
+ my $fd = dirname ($file);
+
+ # We distribute files that are in this directory.
+ # At the top-level ('.') we also distribute files whose
+ # directory does not have a Makefile.
+ if (($fd eq $relative_dir)
+ || ($relative_dir eq '.' && ! is_make_dir ($fd)))
+ {
+ # The following will distribute $file as a side-effect when
+ # it is appropriate (i.e., when $file is not already an output).
+ # We do not need the result, just the side-effect.
+ rewrite_inputs_into_dependencies ($link, $file);
+ }
+ }
+ }
+
+ # These files get removed by "make distclean".
+ define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL,
+ @actual_other_files);
+ define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL,
+ @actual_other_vpath_files);
+}
+
+sub handle_headers ()
+{
+ my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
+ 'oldinclude', 'pkginclude',
+ 'noinst', 'check');
+ foreach (@r)
+ {
+ next unless $_->[1] =~ /\..*$/;
+ saw_extension ($&);
+ }
+}
+
+sub handle_gettext ()
+{
+ return if ! $seen_gettext || $relative_dir ne '.';
+
+ my $subdirs = var 'SUBDIRS';
+
+ if (! $subdirs)
+ {
+ err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined";
+ return;
+ }
+
+ # Perform some sanity checks to help users get the right setup.
+ # We disable these tests when po/ doesn't exist in order not to disallow
+ # unusual gettext setups.
+ #
+ # Bruno Haible:
+ # | The idea is:
+ # |
+ # | 1) If a package doesn't have a directory po/ at top level, it
+ # | will likely have multiple po/ directories in subpackages.
+ # |
+ # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT
+ # | is used without 'external'. It is also useful to warn for the
+ # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both
+ # | warnings apply only to the usual layout of packages, therefore
+ # | they should both be disabled if no po/ directory is found at
+ # | top level.
+
+ if (-d 'po')
+ {
+ my @subdirs = $subdirs->value_as_list_recursive;
+
+ msg_var ('syntax', $subdirs,
+ "AM_GNU_GETTEXT used but 'po' not in SUBDIRS")
+ if ! grep ($_ eq 'po', @subdirs);
+
+ # intl/ is not required when AM_GNU_GETTEXT is called with the
+ # 'external' option and AM_GNU_GETTEXT_INTL_SUBDIR is not called.
+ msg_var ('syntax', $subdirs,
+ "AM_GNU_GETTEXT used but 'intl' not in SUBDIRS")
+ if (! ($seen_gettext_external && ! $seen_gettext_intl)
+ && ! grep ($_ eq 'intl', @subdirs));
+
+ # intl/ should not be used with AM_GNU_GETTEXT([external]), except
+ # if AM_GNU_GETTEXT_INTL_SUBDIR is called.
+ msg_var ('syntax', $subdirs,
+ "'intl' should not be in SUBDIRS when "
+ . "AM_GNU_GETTEXT([external]) is used")
+ if ($seen_gettext_external && ! $seen_gettext_intl
+ && grep ($_ eq 'intl', @subdirs));
+ }
+
+ require_file ($ac_gettext_location, GNU, 'ABOUT-NLS');
+}
+
+# Emit makefile footer.
+sub handle_footer ()
+{
+ reject_rule ('.SUFFIXES',
+ "use variable 'SUFFIXES', not target '.SUFFIXES'");
+
+ # Note: AIX 4.1 /bin/make will fail if any suffix rule appears
+ # before .SUFFIXES. So we make sure that .SUFFIXES appears before
+ # anything else, by sticking it right after the default: target.
+ $output_header .= ".SUFFIXES:\n";
+ my $suffixes = var 'SUFFIXES';
+ my @suffixes = Automake::Rule::suffixes;
+ if (@suffixes || $suffixes)
+ {
+ # Make sure SUFFIXES has unique elements. Sort them to ensure
+ # the output remains consistent. However, $(SUFFIXES) is
+ # always at the start of the list, unsorted. This is done
+ # because make will choose rules depending on the ordering of
+ # suffixes, and this lets the user have some control. Push
+ # actual suffixes, and not $(SUFFIXES). Some versions of make
+ # do not like variable substitutions on the .SUFFIXES line.
+ my @user_suffixes = ($suffixes
+ ? $suffixes->value_as_list_recursive : ());
+
+ my %suffixes = map { $_ => 1 } @suffixes;
+ delete @suffixes{@user_suffixes};
+
+ $output_header .= (".SUFFIXES: "
+ . join (' ', @user_suffixes, sort keys %suffixes)
+ . "\n");
+ }
+
+ $output_trailer .= file_contents ('footer', new Automake::Location);
+}
+
+
+# Generate 'make install' rules.
+sub handle_install ()
+{
+ $output_rules .= file_contents
+ ('install',
+ new Automake::Location,
+ maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
+ ? (" \$(BUILT_SOURCES)\n"
+ . "\t\$(MAKE) \$(AM_MAKEFLAGS)")
+ : ''),
+ 'installdirs-local' => (user_phony_rule ('installdirs-local')
+ ? ' installdirs-local' : ''),
+ am__installdirs => variable_value ('am__installdirs') || '');
+}
+
+
+# handle_all ($MAKEFILE)
+#-----------------------
+# Deal with 'all' and 'all-am'.
+sub handle_all
+{
+ my ($makefile) = @_;
+
+ # Output 'all-am'.
+
+ # Put this at the beginning for the sake of non-GNU makes. This
+ # is still wrong if these makes can run parallel jobs. But it is
+ # right enough.
+ unshift (@all, basename ($makefile));
+
+ foreach my $spec (@config_headers)
+ {
+ my ($out, @ins) = split_config_file_spec ($spec);
+ push (@all, basename ($out))
+ if dirname ($out) eq $relative_dir;
+ }
+
+ # Install 'all' hooks.
+ push (@all, "all-local")
+ if user_phony_rule "all-local";
+
+ pretty_print_rule ("all-am:", "\t\t", @all);
+ depend ('.PHONY', 'all-am', 'all');
+
+
+ # Output 'all'.
+
+ my @local_headers = ();
+ push @local_headers, '$(BUILT_SOURCES)'
+ if var ('BUILT_SOURCES');
+ foreach my $spec (@config_headers)
+ {
+ my ($out, @ins) = split_config_file_spec ($spec);
+ push @local_headers, basename ($out)
+ if dirname ($out) eq $relative_dir;
+ }
+
+ if (@local_headers)
+ {
+ # We need to make sure config.h is built before we recurse.
+ # We also want to make sure that built sources are built
+ # before any ordinary 'all' targets are run. We can't do this
+ # by changing the order of dependencies to the "all" because
+ # that breaks when using parallel makes. Instead we handle
+ # things explicitly.
+ $output_all .= ("all: @local_headers"
+ . "\n\t"
+ . '$(MAKE) $(AM_MAKEFLAGS) '
+ . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
+ . "\n\n");
+ depend ('.MAKE', 'all');
+ }
+ else
+ {
+ $output_all .= "all: " . (var ('SUBDIRS')
+ ? 'all-recursive' : 'all-am') . "\n\n";
+ }
+}
+
+# Generate helper targets for user-defined recursive targets, where needed.
+sub handle_user_recursion ()
+{
+ return unless @extra_recursive_targets;
+
+ define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL,
+ map { "$_-recursive" } @extra_recursive_targets);
+ my $aux = var ('SUBDIRS') ? 'recursive' : 'am';
+ foreach my $target (@extra_recursive_targets)
+ {
+ # This allows the default target's rules to be overridden in
+ # Makefile.am.
+ user_phony_rule ($target);
+ depend ("$target", "$target-$aux");
+ depend ("$target-am", "$target-local");
+ # Every user-defined recursive target 'foo' *must* have a valid
+ # associated 'foo-local' rule; we define it as an empty rule by
+ # default, so that the user can transparently extend it in his
+ # own Makefile.am.
+ pretty_print_rule ("$target-local:", '', '');
+ # $target-recursive might as well be undefined, so do not add
+ # it here; it's taken care of in subdirs.am anyway.
+ depend (".PHONY", "$target-am", "$target-local");
+ }
+}
+
+
+# Handle check merge target specially.
+sub do_check_merge_target ()
+{
+ # Include user-defined local form of target.
+ push @check_tests, 'check-local'
+ if user_phony_rule 'check-local';
+
+ # The check target must depend on the local equivalent of
+ # 'all', to ensure all the primary targets are built. Then it
+ # must build the local check rules.
+ $output_rules .= "check-am: all-am\n";
+ if (@check)
+ {
+ pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check);
+ depend ('.MAKE', 'check-am');
+ }
+
+ if (@check_tests)
+ {
+ pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ",
+ @check_tests);
+ depend ('.MAKE', 'check-am');
+ }
+
+ depend '.PHONY', 'check', 'check-am';
+ # Handle recursion. We have to honor BUILT_SOURCES like for 'all:'.
+ $output_rules .= ("check: "
+ . (var ('BUILT_SOURCES')
+ ? "\$(BUILT_SOURCES)\n\t\$(MAKE) \$(AM_MAKEFLAGS) "
+ : '')
+ . (var ('SUBDIRS') ? 'check-recursive' : 'check-am')
+ . "\n");
+ depend ('.MAKE', 'check')
+ if var ('BUILT_SOURCES');
+}
+
+# Handle all 'clean' targets.
+sub handle_clean
+{
+ my ($makefile) = @_;
+
+ # Clean the files listed in user variables if they exist.
+ $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN
+ if var ('MOSTLYCLEANFILES');
+ $clean_files{'$(CLEANFILES)'} = CLEAN
+ if var ('CLEANFILES');
+ $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN
+ if var ('DISTCLEANFILES');
+ $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN
+ if var ('MAINTAINERCLEANFILES');
+
+ # Built sources are automatically removed by maintainer-clean.
+ $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN
+ if var ('BUILT_SOURCES');
+
+ # Compute a list of "rm"s to run for each target.
+ my %rms = (MOSTLY_CLEAN, [],
+ CLEAN, [],
+ DIST_CLEAN, [],
+ MAINTAINER_CLEAN, []);
+
+ foreach my $file (keys %clean_files)
+ {
+ my $when = $clean_files{$file};
+ prog_error 'invalid entry in %clean_files'
+ unless exists $rms{$when};
+
+ my $rm = "rm -f $file";
+ # If file is a variable, make sure when don't call 'rm -f' without args.
+ $rm ="test -z \"$file\" || $rm"
+ if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/);
+
+ push @{$rms{$when}}, "\t-$rm\n";
+ }
+
+ $output_rules .= file_contents
+ ('clean',
+ new Automake::Location,
+ MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}),
+ CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}),
+ DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}),
+ MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}),
+ MAKEFILE => basename $makefile,
+ );
+}
+
+
+# Subroutine for handle_factored_dependencies() to let '.PHONY' and
+# other '.TARGETS' be last. This is meant to be used as a comparison
+# subroutine passed to the sort built-int.
+sub target_cmp
+{
+ return 0 if $a eq $b;
+
+ my $a1 = substr ($a, 0, 1);
+ my $b1 = substr ($b, 0, 1);
+ if ($a1 ne $b1)
+ {
+ return -1 if $b1 eq '.';
+ return 1 if $a1 eq '.';
+ }
+ return $a cmp $b;
+}
+
+
+# Handle everything related to gathered targets.
+sub handle_factored_dependencies ()
+{
+ # Reject bad hooks.
+ foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook',
+ 'uninstall-exec-local', 'uninstall-exec-hook',
+ 'uninstall-dvi-local',
+ 'uninstall-html-local',
+ 'uninstall-info-local',
+ 'uninstall-pdf-local',
+ 'uninstall-ps-local')
+ {
+ my $x = $utarg;
+ $x =~ s/-.*-/-/;
+ reject_rule ($utarg, "use '$x', not '$utarg'");
+ }
+
+ reject_rule ('install-local',
+ "use 'install-data-local' or 'install-exec-local', "
+ . "not 'install-local'");
+
+ reject_rule ('install-hook',
+ "use 'install-data-hook' or 'install-exec-hook', "
+ . "not 'install-hook'");
+
+ # Install the -local hooks.
+ foreach (keys %dependencies)
+ {
+ # Hooks are installed on the -am targets.
+ s/-am$// or next;
+ depend ("$_-am", "$_-local")
+ if user_phony_rule "$_-local";
+ }
+
+ # Install the -hook hooks.
+ # FIXME: Why not be as liberal as we are with -local hooks?
+ foreach ('install-exec', 'install-data', 'uninstall')
+ {
+ if (user_phony_rule "$_-hook")
+ {
+ depend ('.MAKE', "$_-am");
+ register_action("$_-am",
+ ("\t\@\$(NORMAL_INSTALL)\n"
+ . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook"));
+ }
+ }
+
+ # All the required targets are phony.
+ depend ('.PHONY', keys %required_targets);
+
+ # Actually output gathered targets.
+ foreach (sort target_cmp keys %dependencies)
+ {
+ # If there is nothing about this guy, skip it.
+ next
+ unless (@{$dependencies{$_}}
+ || $actions{$_}
+ || $required_targets{$_});
+
+ # Define gathered targets in undefined conditions.
+ # FIXME: Right now we must handle .PHONY as an exception,
+ # because people write things like
+ # .PHONY: myphonytarget
+ # to append dependencies. This would not work if Automake
+ # refrained from defining its own .PHONY target as it does
+ # with other overridden targets.
+ # Likewise for '.MAKE'.
+ my @undefined_conds = (TRUE,);
+ if ($_ ne '.PHONY' && $_ ne '.MAKE')
+ {
+ @undefined_conds =
+ Automake::Rule::define ($_, 'internal',
+ RULE_AUTOMAKE, TRUE, INTERNAL);
+ }
+ my @uniq_deps = uniq (sort @{$dependencies{$_}});
+ foreach my $cond (@undefined_conds)
+ {
+ my $condstr = $cond->subst_string;
+ pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
+ $output_rules .= $actions{$_} if defined $actions{$_};
+ $output_rules .= "\n";
+ }
+ }
+}
+
+
+sub handle_tests_dejagnu ()
+{
+ push (@check_tests, 'check-DEJAGNU');
+ $output_rules .= file_contents ('dejagnu', new Automake::Location);
+}
+
+# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM])
+#----------------------------------------------------
+sub handle_per_suffix_test
+{
+ my ($test_suffix, %transform) = @_;
+ my ($pfx, $generic, $am_exeext);
+ if ($test_suffix eq '')
+ {
+ $pfx = '';
+ $generic = 0;
+ $am_exeext = 'FALSE';
+ }
+ else
+ {
+ prog_error ("test suffix '$test_suffix' lacks leading dot")
+ unless $test_suffix =~ m/^\.(.*)/;
+ $pfx = uc ($1) . '_';
+ $generic = 1;
+ $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
+ : 'FALSE';
+ }
+ # The "test driver" program, deputed to handle tests protocol used by
+ # test scripts. By default, it's assumed that no protocol is used, so
+ # we fall back to the old behaviour, implemented by the 'test-driver'
+ # auxiliary script.
+ if (! var "${pfx}LOG_DRIVER")
+ {
+ require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
+ define_variable ("${pfx}LOG_DRIVER",
+ "\$(SHELL) $am_config_aux_dir/test-driver",
+ INTERNAL);
+ }
+ my $driver = '$(' . $pfx . 'LOG_DRIVER)';
+ my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
+ . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
+ my $compile = "${pfx}LOG_COMPILE";
+ define_variable ($compile,
+ '$(' . $pfx . 'LOG_COMPILER)'
+ . ' $(AM_' . $pfx . 'LOG_FLAGS)'
+ . ' $(' . $pfx . 'LOG_FLAGS)',
+ INTERNAL);
+ $output_rules .= file_contents ('check2', new Automake::Location,
+ GENERIC => $generic,
+ DRIVER => $driver,
+ DRIVER_FLAGS => $driver_flags,
+ COMPILE => '$(' . $compile . ')',
+ EXT => $test_suffix,
+ am__EXEEXT => $am_exeext,
+ %transform);
+}
+
+# is_valid_test_extension ($EXT)
+# ------------------------------
+# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
+# otherwise.
+sub is_valid_test_extension
+{
+ my $ext = shift;
+ return 1
+ if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/);
+ return 1
+ if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT'));
+ return 0;
+}
+
+
+sub handle_tests ()
+{
+ if (option 'dejagnu')
+ {
+ handle_tests_dejagnu;
+ }
+ else
+ {
+ foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS')
+ {
+ reject_var ($c, "'$c' defined but 'dejagnu' not in "
+ . "'AUTOMAKE_OPTIONS'");
+ }
+ }
+
+ if (var ('TESTS'))
+ {
+ push (@check_tests, 'check-TESTS');
+ my $check_deps = "@check";
+ $output_rules .= file_contents ('check', new Automake::Location,
+ SERIAL_TESTS => !! option 'serial-tests',
+ CHECK_DEPS => $check_deps);
+
+ # Tests that are known programs should have $(EXEEXT) appended.
+ # For matching purposes, we need to adjust XFAIL_TESTS as well.
+ append_exeext { exists $known_programs{$_[0]} } 'TESTS';
+ append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
+ if (var ('XFAIL_TESTS'));
+
+ if (! option 'serial-tests')
+ {
+ define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
+ my $suff = '.test';
+ my $at_exeext = '';
+ my $handle_exeext = exists $configure_vars{'EXEEXT'};
+ if ($handle_exeext)
+ {
+ $at_exeext = subst ('EXEEXT');
+ $suff = $at_exeext . ' ' . $suff;
+ }
+ if (! var 'TEST_EXTENSIONS')
+ {
+ define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
+ }
+ my $var = var 'TEST_EXTENSIONS';
+ # Currently, we are not able to deal with conditional contents
+ # in TEST_EXTENSIONS.
+ if ($var->has_conditional_contents)
+ {
+ msg_var 'unsupported', $var,
+ "'TEST_EXTENSIONS' cannot have conditional contents";
+ }
+ my @test_suffixes = $var->value_as_list_recursive;
+ if ((my @invalid_test_suffixes =
+ grep { !is_valid_test_extension $_ } @test_suffixes) > 0)
+ {
+ error $var->rdef (TRUE)->location,
+ "invalid test extensions: @invalid_test_suffixes";
+ }
+ @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
+ if ($handle_exeext)
+ {
+ unshift (@test_suffixes, $at_exeext)
+ unless $test_suffixes[0] eq $at_exeext;
+ }
+ unshift (@test_suffixes, '');
+
+ transform_variable_recursively
+ ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL,
+ sub {
+ my ($subvar, $val, $cond, $full_cond) = @_;
+ my $obj = $val;
+ return $obj
+ if $val =~ /^\@.*\@$/;
+ $obj =~ s/\$\(EXEEXT\)$//o;
+
+ if ($val =~ /(\$\((top_)?srcdir\))\//o)
+ {
+ msg ('error', $subvar->rdef ($cond)->location,
+ "using '$1' in TESTS is currently broken: '$val'");
+ }
+
+ foreach my $test_suffix (@test_suffixes)
+ {
+ next
+ if $test_suffix eq $at_exeext || $test_suffix eq '';
+ return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
+ if substr ($obj, - length ($test_suffix)) eq $test_suffix;
+ }
+ my $base = $obj;
+ $obj .= '.log';
+ handle_per_suffix_test ('',
+ OBJ => $obj,
+ BASE => $base,
+ SOURCE => $val);
+ return $obj;
+ });
+
+ my $nhelper=1;
+ my $prev = 'TESTS';
+ my $post = '';
+ my $last_suffix = $test_suffixes[$#test_suffixes];
+ my $cur = '';
+ foreach my $test_suffix (@test_suffixes)
+ {
+ if ($test_suffix eq $last_suffix)
+ {
+ $cur = 'TEST_LOGS';
+ }
+ else
+ {
+ $cur = 'am__test_logs' . $nhelper;
+ }
+ define_variable ($cur,
+ '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL);
+ $post = '.log';
+ $prev = $cur;
+ $nhelper++;
+ if ($test_suffix ne $at_exeext && $test_suffix ne '')
+ {
+ handle_per_suffix_test ($test_suffix,
+ OBJ => '',
+ BASE => '$*',
+ SOURCE => '$<');
+ }
+ }
+ $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
+ $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
+ $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
+ }
+ }
+}
+
+sub handle_emacs_lisp ()
+{
+ my @elfiles = am_install_var ('-candist', 'lisp', 'LISP',
+ 'lisp', 'noinst');
+
+ return if ! @elfiles;
+
+ define_pretty_variable ('am__ELFILES', TRUE, INTERNAL,
+ map { $_->[1] } @elfiles);
+ define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL,
+ '$(am__ELFILES:.el=.elc)');
+ # This one can be overridden by users.
+ define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)');
+
+ push @all, '$(ELCFILES)';
+
+ require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE,
+ 'EMACS', 'lispdir');
+}
+
+sub handle_python ()
+{
+ my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON',
+ 'noinst');
+ return if ! @pyfiles;
+
+ require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
+ require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
+ define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
+}
+
+sub handle_java ()
+{
+ my @sourcelist = am_install_var ('-candist',
+ 'java', 'JAVA',
+ 'noinst', 'check');
+ return if ! @sourcelist;
+
+ my @prefixes = am_primary_prefixes ('JAVA', 1,
+ 'noinst', 'check');
+
+ my $dir;
+ my @java_sources = ();
+ foreach my $prefix (@prefixes)
+ {
+ (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//;
+
+ next
+ if $curs eq 'EXTRA';
+
+ push @java_sources, '$(' . $prefix . '_JAVA' . ')';
+
+ if (defined $dir)
+ {
+ err_var "${curs}_JAVA", "multiple _JAVA primaries in use"
+ unless $curs eq $dir;
+ }
+
+ $dir = $curs;
+ }
+
+ define_pretty_variable ('am__java_sources', TRUE, INTERNAL,
+ "@java_sources");
+
+ if ($dir eq 'check')
+ {
+ push (@check, "class$dir.stamp");
+ }
+ else
+ {
+ push (@all, "class$dir.stamp");
+ }
+}
+
+
+sub handle_minor_options ()
+{
+ if (option 'readme-alpha')
+ {
+ if ($relative_dir eq '.')
+ {
+ if ($package_version !~ /^$GNITS_VERSION_PATTERN$/)
+ {
+ msg ('error-gnits', $package_version_location,
+ "version '$package_version' doesn't follow " .
+ "Gnits standards");
+ }
+ if (defined $1 && -f 'README-alpha')
+ {
+ # This means we have an alpha release. See
+ # GNITS_VERSION_PATTERN for details.
+ push_dist_common ('README-alpha');
+ }
+ }
+ }
+}
+
+################################################################
+
+# ($OUTPUT, @INPUTS)
+# split_config_file_spec ($SPEC)
+# ------------------------------
+# Decode the Autoconf syntax for config files (files, headers, links
+# etc.).
+sub split_config_file_spec
+{
+ my ($spec) = @_;
+ my ($output, @inputs) = split (/:/, $spec);
+
+ push @inputs, "$output.in"
+ unless @inputs;
+
+ return ($output, @inputs);
+}
+
+# $input
+# locate_am (@POSSIBLE_SOURCES)
+# -----------------------------
+# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in
+# This functions returns the first *.in file for which a *.am exists.
+# It returns undef otherwise.
+sub locate_am
+{
+ my (@rest) = @_;
+ my $input;
+ foreach my $file (@rest)
+ {
+ if (($file =~ /^(.*)\.in$/) && -f "$1.am")
+ {
+ $input = $file;
+ last;
+ }
+ }
+ return $input;
+}
+
+my %make_list;
+
+# scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
+# --------------------------------------------------
+# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
+# (or AC_OUTPUT).
+sub scan_autoconf_config_files
+{
+ my ($where, $config_files) = @_;
+
+ # Look at potential Makefile.am's.
+ foreach (split ' ', $config_files)
+ {
+ # Must skip empty string for Perl 4.
+ next if $_ eq "\\" || $_ eq '';
+
+ # Handle $local:$input syntax.
+ my ($local, @rest) = split (/:/);
+ @rest = ("$local.in",) unless @rest;
+ # Keep in sync with test 'conffile-leading-dot.sh'.
+ msg ('unsupported', $where,
+ "omit leading './' from config file names such as '$local';"
+ . "\nremake rules might be subtly broken otherwise")
+ if ($local =~ /^\.\//);
+ my $input = locate_am @rest;
+ if ($input)
+ {
+ # We have a file that automake should generate.
+ $make_list{$input} = join (':', ($local, @rest));
+ }
+ else
+ {
+ # We have a file that automake should cause to be
+ # rebuilt, but shouldn't generate itself.
+ push (@other_input_files, $_);
+ }
+ $ac_config_files_location{$local} = $where;
+ $ac_config_files_condition{$local} =
+ new Automake::Condition (@cond_stack)
+ if (@cond_stack);
+ }
+}
+
+
+sub scan_autoconf_traces
+{
+ my ($filename) = @_;
+
+ # Macros to trace, with their minimal number of arguments.
+ #
+ # IMPORTANT: If you add a macro here, you should also add this macro
+ # ========= to Automake-preselection in autoconf/lib/autom4te.in.
+ my %traced = (
+ AC_CANONICAL_BUILD => 0,
+ AC_CANONICAL_HOST => 0,
+ AC_CANONICAL_TARGET => 0,
+ AC_CONFIG_AUX_DIR => 1,
+ AC_CONFIG_FILES => 1,
+ AC_CONFIG_HEADERS => 1,
+ AC_CONFIG_LIBOBJ_DIR => 1,
+ AC_CONFIG_LINKS => 1,
+ AC_FC_SRCEXT => 1,
+ AC_INIT => 0,
+ AC_LIBSOURCE => 1,
+ AC_REQUIRE_AUX_FILE => 1,
+ AC_SUBST_TRACE => 1,
+ AM_AUTOMAKE_VERSION => 1,
+ AM_PROG_MKDIR_P => 0,
+ AM_CONDITIONAL => 2,
+ AM_EXTRA_RECURSIVE_TARGETS => 1,
+ AM_GNU_GETTEXT => 0,
+ AM_GNU_GETTEXT_INTL_SUBDIR => 0,
+ AM_INIT_AUTOMAKE => 0,
+ AM_MAINTAINER_MODE => 0,
+ AM_PROG_AR => 0,
+ _AM_SUBST_NOTMAKE => 1,
+ _AM_COND_IF => 1,
+ _AM_COND_ELSE => 1,
+ _AM_COND_ENDIF => 1,
+ LT_SUPPORTED_TAG => 1,
+ _LT_AC_TAGCONFIG => 0,
+ m4_include => 1,
+ m4_sinclude => 1,
+ sinclude => 1,
+ );
+
+ my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " ";
+
+ # Use a separator unlikely to be used, not ':', the default, which
+ # has a precise meaning for AC_CONFIG_FILES and so on.
+ $traces .= join (' ',
+ map { "--trace=$_" . ':\$f:\$l::\$d::\$n::\${::}%' }
+ (keys %traced));
+
+ my $tracefh = new Automake::XFile ("$traces $filename |");
+ verb "reading $traces";
+
+ @cond_stack = ();
+ my $where;
+
+ while ($_ = $tracefh->getline)
+ {
+ chomp;
+ my ($here, $depth, @args) = split (/::/);
+ $where = new Automake::Location $here;
+ my $macro = $args[0];
+
+ prog_error ("unrequested trace '$macro'")
+ unless exists $traced{$macro};
+
+ # Skip and diagnose malformed calls.
+ if ($#args < $traced{$macro})
+ {
+ msg ('syntax', $where, "not enough arguments for $macro");
+ next;
+ }
+
+ # Alphabetical ordering please.
+ if ($macro eq 'AC_CANONICAL_BUILD')
+ {
+ if ($seen_canonical <= AC_CANONICAL_BUILD)
+ {
+ $seen_canonical = AC_CANONICAL_BUILD;
+ }
+ }
+ elsif ($macro eq 'AC_CANONICAL_HOST')
+ {
+ if ($seen_canonical <= AC_CANONICAL_HOST)
+ {
+ $seen_canonical = AC_CANONICAL_HOST;
+ }
+ }
+ elsif ($macro eq 'AC_CANONICAL_TARGET')
+ {
+ $seen_canonical = AC_CANONICAL_TARGET;
+ }
+ elsif ($macro eq 'AC_CONFIG_AUX_DIR')
+ {
+ if ($seen_init_automake)
+ {
+ error ($where, "AC_CONFIG_AUX_DIR must be called before "
+ . "AM_INIT_AUTOMAKE ...", partial => 1);
+ error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here");
+ }
+ $config_aux_dir = $args[1];
+ $config_aux_dir_set_in_configure_ac = 1;
+ check_directory ($config_aux_dir, $where);
+ }
+ elsif ($macro eq 'AC_CONFIG_FILES')
+ {
+ # Look at potential Makefile.am's.
+ scan_autoconf_config_files ($where, $args[1]);
+ }
+ elsif ($macro eq 'AC_CONFIG_HEADERS')
+ {
+ foreach my $spec (split (' ', $args[1]))
+ {
+ my ($dest, @src) = split (':', $spec);
+ $ac_config_files_location{$dest} = $where;
+ push @config_headers, $spec;
+ }
+ }
+ elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
+ {
+ $config_libobj_dir = $args[1];
+ check_directory ($config_libobj_dir, $where);
+ }
+ elsif ($macro eq 'AC_CONFIG_LINKS')
+ {
+ foreach my $spec (split (' ', $args[1]))
+ {
+ my ($dest, $src) = split (':', $spec);
+ $ac_config_files_location{$dest} = $where;
+ push @config_links, $spec;
+ }
+ }
+ elsif ($macro eq 'AC_FC_SRCEXT')
+ {
+ my $suffix = $args[1];
+ # These flags are used as %SOURCEFLAG% in depend2.am,
+ # where the trailing space is important.
+ $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') '
+ if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || $suffix eq 'f08');
+ }
+ elsif ($macro eq 'AC_INIT')
+ {
+ if (defined $args[2])
+ {
+ $package_version = $args[2];
+ $package_version_location = $where;
+ }
+ }
+ elsif ($macro eq 'AC_LIBSOURCE')
+ {
+ $libsources{$args[1]} = $here;
+ }
+ elsif ($macro eq 'AC_REQUIRE_AUX_FILE')
+ {
+ # Only remember the first time a file is required.
+ $required_aux_file{$args[1]} = $where
+ unless exists $required_aux_file{$args[1]};
+ }
+ elsif ($macro eq 'AC_SUBST_TRACE')
+ {
+ # Just check for alphanumeric in AC_SUBST_TRACE. If you do
+ # AC_SUBST(5), then too bad.
+ $configure_vars{$args[1]} = $where
+ if $args[1] =~ /^\w+$/;
+ }
+ elsif ($macro eq 'AM_AUTOMAKE_VERSION')
+ {
+ error ($where,
+ "version mismatch. This is Automake $VERSION,\n" .
+ "but the definition used by this AM_INIT_AUTOMAKE\n" .
+ "comes from Automake $args[1]. You should recreate\n" .
+ "aclocal.m4 with aclocal and run automake again.\n",
+ # $? = 63 is used to indicate version mismatch to missing.
+ exit_code => 63)
+ if $VERSION ne $args[1];
+
+ $seen_automake_version = 1;
+ }
+ elsif ($macro eq 'AM_PROG_MKDIR_P')
+ {
+ # FIXME: we are no longer going to remove this! adjust warning
+ # FIXME: message accordingly.
+ msg 'obsolete', $where, <<'EOF';
+The 'AM_PROG_MKDIR_P' macro is deprecated, and will soon be removed.
+You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
+and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.
+EOF
+ }
+ elsif ($macro eq 'AM_CONDITIONAL')
+ {
+ $configure_cond{$args[1]} = $where;
+ }
+ elsif ($macro eq 'AM_EXTRA_RECURSIVE_TARGETS')
+ {
+ # Empty leading/trailing fields might be produced by split,
+ # hence the grep is really needed.
+ push @extra_recursive_targets,
+ grep (/./, (split /\s+/, $args[1]));
+ }
+ elsif ($macro eq 'AM_GNU_GETTEXT')
+ {
+ $seen_gettext = $where;
+ $ac_gettext_location = $where;
+ $seen_gettext_external = grep ($_ eq 'external', @args);
+ }
+ elsif ($macro eq 'AM_GNU_GETTEXT_INTL_SUBDIR')
+ {
+ $seen_gettext_intl = $where;
+ }
+ elsif ($macro eq 'AM_INIT_AUTOMAKE')
+ {
+ $seen_init_automake = $where;
+ if (defined $args[2])
+ {
+ msg 'obsolete', $where, <<'EOF';
+AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
+EOF
+ $package_version = $args[2];
+ $package_version_location = $where;
+ }
+ elsif (defined $args[1])
+ {
+ my @opts = split (' ', $args[1]);
+ @opts = map { { option => $_, where => $where } } @opts;
+ exit $exit_code if process_global_option_list (@opts);
+ }
+ }
+ elsif ($macro eq 'AM_MAINTAINER_MODE')
+ {
+ $seen_maint_mode = $where;
+ }
+ elsif ($macro eq 'AM_PROG_AR')
+ {
+ $seen_ar = $where;
+ }
+ elsif ($macro eq '_AM_COND_IF')
+ {
+ cond_stack_if ('', $args[1], $where);
+ error ($where, "missing m4 quoting, macro depth $depth")
+ if ($depth != 1);
+ }
+ elsif ($macro eq '_AM_COND_ELSE')
+ {
+ cond_stack_else ('!', $args[1], $where);
+ error ($where, "missing m4 quoting, macro depth $depth")
+ if ($depth != 1);
+ }
+ elsif ($macro eq '_AM_COND_ENDIF')
+ {
+ cond_stack_endif (undef, undef, $where);
+ error ($where, "missing m4 quoting, macro depth $depth")
+ if ($depth != 1);
+ }
+ elsif ($macro eq '_AM_SUBST_NOTMAKE')
+ {
+ $ignored_configure_vars{$args[1]} = $where;
+ }
+ elsif ($macro eq 'm4_include'
+ || $macro eq 'm4_sinclude'
+ || $macro eq 'sinclude')
+ {
+ # Skip missing 'sinclude'd files.
+ next if $macro ne 'm4_include' && ! -f $args[1];
+
+ # Some modified versions of Autoconf don't use
+ # frozen files. Consequently it's possible that we see all
+ # m4_include's performed during Autoconf's startup.
+ # Obviously we don't want to distribute Autoconf's files
+ # so we skip absolute filenames here.
+ push @configure_deps, '$(top_srcdir)/' . $args[1]
+ unless $here =~ m,^(?:\w:)?[\\/],;
+ # Keep track of the greatest timestamp.
+ if (-e $args[1])
+ {
+ my $mtime = mtime $args[1];
+ $configure_deps_greatest_timestamp = $mtime
+ if $mtime > $configure_deps_greatest_timestamp;
+ }
+ }
+ elsif ($macro eq 'LT_SUPPORTED_TAG')
+ {
+ $libtool_tags{$args[1]} = 1;
+ $libtool_new_api = 1;
+ }
+ elsif ($macro eq '_LT_AC_TAGCONFIG')
+ {
+ # _LT_AC_TAGCONFIG is an old macro present in Libtool 1.5.
+ # We use it to detect whether tags are supported. Our
+ # preferred interface is LT_SUPPORTED_TAG, but it was
+ # introduced in Libtool 1.6.
+ if (0 == keys %libtool_tags)
+ {
+ # Hardcode the tags supported by Libtool 1.5.
+ %libtool_tags = (CC => 1, CXX => 1, GCJ => 1, F77 => 1);
+ }
+ }
+ }
+
+ error ($where, "condition stack not properly closed")
+ if (@cond_stack);
+
+ $tracefh->close;
+}
+
+
+# Check whether we use 'configure.ac' or 'configure.in'.
+# Scan it (and possibly 'aclocal.m4') for interesting things.
+# We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
+sub scan_autoconf_files ()
+{
+ # Reinitialize libsources here. This isn't really necessary,
+ # since we currently assume there is only one configure.ac. But
+ # that won't always be the case.
+ %libsources = ();
+
+ # Keep track of the youngest configure dependency.
+ $configure_deps_greatest_timestamp = mtime $configure_ac;
+ if (-e 'aclocal.m4')
+ {
+ my $mtime = mtime 'aclocal.m4';
+ $configure_deps_greatest_timestamp = $mtime
+ if $mtime > $configure_deps_greatest_timestamp;
+ }
+
+ scan_autoconf_traces ($configure_ac);
+
+ @configure_input_files = sort keys %make_list;
+ # Set input and output files if not specified by user.
+ if (! @input_files)
+ {
+ @input_files = @configure_input_files;
+ %output_files = %make_list;
+ }
+
+
+ if (! $seen_init_automake)
+ {
+ err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou "
+ . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE,"
+ . "\nthat aclocal.m4 is present in the top-level directory,\n"
+ . "and that aclocal.m4 was recently regenerated "
+ . "(using aclocal)");
+ }
+ else
+ {
+ if (! $seen_automake_version)
+ {
+ if (-f 'aclocal.m4')
+ {
+ error ($seen_init_automake,
+ "your implementation of AM_INIT_AUTOMAKE comes from " .
+ "an\nold Automake version. You should recreate " .
+ "aclocal.m4\nwith aclocal and run automake again",
+ # $? = 63 is used to indicate version mismatch to missing.
+ exit_code => 63);
+ }
+ else
+ {
+ error ($seen_init_automake,
+ "no proper implementation of AM_INIT_AUTOMAKE was " .
+ "found,\nprobably because aclocal.m4 is missing.\n" .
+ "You should run aclocal to create this file, then\n" .
+ "run automake again");
+ }
+ }
+ }
+
+ locate_aux_dir ();
+
+ # Look for some files we need. Always check for these. This
+ # check must be done for every run, even those where we are only
+ # looking at a subdir Makefile. We must set relative_dir for
+ # push_required_file to work.
+ # Sort the files for stable verbose output.
+ $relative_dir = '.';
+ foreach my $file (sort keys %required_aux_file)
+ {
+ require_conf_file ($required_aux_file{$file}->get, FOREIGN, $file)
+ }
+ err_am "'install.sh' is an anachronism; use 'install-sh' instead"
+ if -f $config_aux_dir . '/install.sh';
+
+ # Preserve dist_common for later.
+ $configure_dist_common = variable_value ('DIST_COMMON') || '';
+
+}
+
+################################################################
+
+# Do any extra checking for GNU standards.
+sub check_gnu_standards ()
+{
+ if ($relative_dir eq '.')
+ {
+ # In top level (or only) directory.
+ require_file ("$am_file.am", GNU,
+ qw/INSTALL NEWS README AUTHORS ChangeLog/);
+
+ # Accept one of these three licenses; default to COPYING.
+ # Make sure we do not overwrite an existing license.
+ my $license;
+ foreach (qw /COPYING COPYING.LIB COPYING.LESSER/)
+ {
+ if (-f $_)
+ {
+ $license = $_;
+ last;
+ }
+ }
+ require_file ("$am_file.am", GNU, 'COPYING')
+ unless $license;
+ }
+
+ for my $opt ('no-installman', 'no-installinfo')
+ {
+ msg ('error-gnu', option $opt,
+ "option '$opt' disallowed by GNU standards")
+ if option $opt;
+ }
+}
+
+# Do any extra checking for GNITS standards.
+sub check_gnits_standards ()
+{
+ if ($relative_dir eq '.')
+ {
+ # In top level (or only) directory.
+ require_file ("$am_file.am", GNITS, 'THANKS');
+ }
+}
+
+################################################################
+#
+# Functions to handle files of each language.
+
+# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a
+# simple formula: Return value is LANG_SUBDIR if the resulting object
+# file should be in a subdir if the source file is, LANG_PROCESS if
+# file is to be dealt with, LANG_IGNORE otherwise.
+
+# Much of the actual processing is handled in
+# handle_single_transform. These functions exist so that
+# auxiliary information can be recorded for a later cleanup pass.
+# Note that the calls to these functions are computed, so don't bother
+# searching for their precise names in the source.
+
+# This is just a convenience function that can be used to determine
+# when a subdir object should be used.
+sub lang_sub_obj ()
+{
+ return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
+}
+
+# Rewrite a single header file.
+sub lang_header_rewrite
+{
+ # Header files are simply ignored.
+ return LANG_IGNORE;
+}
+
+# Rewrite a single Vala source file.
+sub lang_vala_rewrite
+{
+ my ($directory, $base, $ext) = @_;
+
+ (my $newext = $ext) =~ s/vala$/c/;
+ return (LANG_SUBDIR, $newext);
+}
+
+# Rewrite a single yacc/yacc++ file.
+sub lang_yacc_rewrite
+{
+ my ($directory, $base, $ext) = @_;
+
+ my $r = lang_sub_obj;
+ (my $newext = $ext) =~ tr/y/c/;
+ return ($r, $newext);
+}
+sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); };
+
+# Rewrite a single lex/lex++ file.
+sub lang_lex_rewrite
+{
+ my ($directory, $base, $ext) = @_;
+
+ my $r = lang_sub_obj;
+ (my $newext = $ext) =~ tr/l/c/;
+ return ($r, $newext);
+}
+sub lang_lexxx_rewrite { lang_lex_rewrite (@_); };
+
+# Rewrite a single Java file.
+sub lang_java_rewrite
+{
+ return LANG_SUBDIR;
+}
+
+# The lang_X_finish functions are called after all source file
+# processing is done. Each should handle defining rules for the
+# language, etc. A finish function is only called if a source file of
+# the appropriate type has been seen.
+
+sub lang_vala_finish_target
+{
+ my ($self, $name) = @_;
+
+ my $derived = canonicalize ($name);
+ my $var = var "${derived}_SOURCES";
+ return unless $var;
+
+ my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive);
+
+ # For automake bug#11229.
+ return unless @vala_sources;
+
+ foreach my $vala_file (@vala_sources)
+ {
+ my $c_file = $vala_file;
+ if ($c_file =~ s/(.*)\.vala$/$1.c/)
+ {
+ $c_file = "\$(srcdir)/$c_file";
+ $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n"
+ . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
+ . "\t\@if test -f \$@; then :; else \\\n"
+ . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
+ . "\tfi\n";
+ $clean_files{$c_file} = MAINTAINER_CLEAN;
+ }
+ }
+
+ # Add rebuild rules for generated header and vapi files
+ my $flags = var ($derived . '_VALAFLAGS');
+ if ($flags)
+ {
+ my $lastflag = '';
+ foreach my $flag ($flags->value_as_list_recursive)
+ {
+ if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header',
+ '--vapi', '--internal-vapi', '--gir')))
+ {
+ my $headerfile = "\$(srcdir)/$flag";
+ $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n"
+ . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n"
+ . "\t\@if test -f \$@; then :; else \\\n"
+ . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n"
+ . "\tfi\n";
+
+ # valac is not used when building from dist tarballs
+ # distribute the generated files
+ push_dist_common ($headerfile);
+ $clean_files{$headerfile} = MAINTAINER_CLEAN;
+ }
+ $lastflag = $flag;
+ }
+ }
+
+ my $compile = $self->compile;
+
+ # Rewrite each occurrence of 'AM_VALAFLAGS' in the compile
+ # rule into '${derived}_VALAFLAGS' if it exists.
+ my $val = "${derived}_VALAFLAGS";
+ $compile =~ s/\(AM_VALAFLAGS\)/\($val\)/
+ if set_seen ($val);
+
+ # VALAFLAGS is a user variable (per GNU Standards),
+ # it should not be overridden in the Makefile...
+ check_user_variables 'VALAFLAGS';
+
+ my $dirname = dirname ($name);
+
+ # Only generate C code, do not run C compiler
+ $compile .= " -C";
+
+ my $verbose = verbose_flag ('VALAC');
+ my $silent = silent_flag ();
+ my $stampfile = "\$(srcdir)/${derived}_vala.stamp";
+
+ $output_rules .=
+ "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n".
+# Since the C files generated from the vala sources depend on the
+# ${derived}_vala.stamp file, we must ensure its timestamp is older than
+# those of the C files generated by the valac invocation below (this is
+# especially important on systems with sub-second timestamp resolution).
+# Thus we need to create the stamp file *before* invoking valac, and to
+# move it to its final location only after valac has been invoked.
+ "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n".
+ "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n".
+ "\t${silent}mv -f \$\@-t \$\@\n";
+
+ push_dist_common ($stampfile);
+
+ $clean_files{$stampfile} = MAINTAINER_CLEAN;
+}
+
+# Add output rules to invoke valac and create stamp file as a witness
+# to handle multiple outputs. This function is called after all source
+# file processing is done.
+sub lang_vala_finish ()
+{
+ my ($self) = @_;
+
+ foreach my $prog (keys %known_programs)
+ {
+ lang_vala_finish_target ($self, $prog);
+ }
+
+ while (my ($name) = each %known_libraries)
+ {
+ lang_vala_finish_target ($self, $name);
+ }
+}
+
+# The built .c files should be cleaned only on maintainer-clean
+# as the .c files are distributed. This function is called for each
+# .vala source file.
+sub lang_vala_target_hook
+{
+ my ($self, $aggregate, $output, $input, %transform) = @_;
+
+ $clean_files{$output} = MAINTAINER_CLEAN;
+}
+
+# This is a yacc helper which is called whenever we have decided to
+# compile a yacc file.
+sub lang_yacc_target_hook
+{
+ my ($self, $aggregate, $output, $input, %transform) = @_;
+
+ # If some relevant *YFLAGS variable contains the '-d' flag, we'll
+ # have to to generate special code.
+ my $yflags_contains_minus_d = 0;
+
+ foreach my $pfx ("", "${aggregate}_")
+ {
+ my $yflagsvar = var ("${pfx}YFLAGS");
+ next unless $yflagsvar;
+ # We cannot work reliably with conditionally-defined YFLAGS.
+ if ($yflagsvar->has_conditional_contents)
+ {
+ msg_var ('unsupported', $yflagsvar,
+ "'${pfx}YFLAGS' cannot have conditional contents");
+ }
+ else
+ {
+ $yflags_contains_minus_d = 1
+ if grep (/^-d$/, $yflagsvar->value_as_list_recursive);
+ }
+ }
+
+ if ($yflags_contains_minus_d)
+ {
+ # Found a '-d' that applies to the compilation of this file.
+ # Add a dependency for the generated header file, and arrange
+ # for that file to be included in the distribution.
+
+ # The extension of the output file (e.g., '.c' or '.cxx').
+ # We'll need it to compute the name of the generated header file.
+ (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/;
+
+ # We know that a yacc input should be turned into either a C or
+ # C++ output file. We depend on this fact (here and in yacc.am),
+ # so check that it really holds.
+ my $lang = $languages{$extension_map{$output_ext}};
+ prog_error "invalid output name '$output' for yacc file '$input'"
+ if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx'));
+
+ (my $header_ext = $output_ext) =~ s/c/h/g;
+ # Quote $output_ext in the regexp, so that dots in it are taken
+ # as literal dots, not as metacharacters.
+ (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/;
+
+ foreach my $cond (Automake::Rule::define (${header}, 'internal',
+ RULE_AUTOMAKE, TRUE,
+ INTERNAL))
+ {
+ my $condstr = $cond->subst_string;
+ $output_rules .=
+ "$condstr${header}: $output\n"
+ # Recover from removal of $header
+ . "$condstr\t\@if test ! -f \$@; then rm -f $output; else :; fi\n"
+ . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; fi\n";
+ }
+ # Distribute the generated file, unless its .y source was
+ # listed in a nodist_ variable. (handle_source_transform()
+ # will set DIST_SOURCE.)
+ push_dist_common ($header)
+ if $transform{'DIST_SOURCE'};
+
+ # The GNU rules say that yacc/lex output files should be removed
+ # by maintainer-clean. However, if the files are not distributed,
+ # then we want to remove them with "make clean"; otherwise,
+ # "make distcheck" will fail.
+ $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
+ }
+ # See the comment above for $HEADER.
+ $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
+}
+
+# This is a lex helper which is called whenever we have decided to
+# compile a lex file.
+sub lang_lex_target_hook
+{
+ my ($self, $aggregate, $output, $input, %transform) = @_;
+ # The GNU rules say that yacc/lex output files should be removed
+ # by maintainer-clean. However, if the files are not distributed,
+ # then we want to remove them with "make clean"; otherwise,
+ # "make distcheck" will fail.
+ $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
+}
+
+# This is a helper for both lex and yacc.
+sub yacc_lex_finish_helper ()
+{
+ return if defined $language_scratch{'lex-yacc-done'};
+ $language_scratch{'lex-yacc-done'} = 1;
+
+ # FIXME: for now, no line number.
+ require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
+ define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
+}
+
+sub lang_yacc_finish ()
+{
+ return if defined $language_scratch{'yacc-done'};
+ $language_scratch{'yacc-done'} = 1;
+
+ reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead";
+
+ yacc_lex_finish_helper;
+}
+
+
+sub lang_lex_finish ()
+{
+ return if defined $language_scratch{'lex-done'};
+ $language_scratch{'lex-done'} = 1;
+
+ yacc_lex_finish_helper;
+}
+
+
+# Given a hash table of linker names, pick the name that has the most
+# precedence. This is lame, but something has to have global
+# knowledge in order to eliminate the conflict. Add more linkers as
+# required.
+sub resolve_linker
+{
+ my (%linkers) = @_;
+
+ foreach my $l (qw(GCJLINK OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK))
+ {
+ return $l if defined $linkers{$l};
+ }
+ return 'LINK';
+}
+
+# Called to indicate that an extension was used.
+sub saw_extension
+{
+ my ($ext) = @_;
+ $extension_seen{$ext} = 1;
+}
+
+# register_language (%ATTRIBUTE)
+# ------------------------------
+# Register a single language.
+# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE.
+sub register_language
+{
+ my (%option) = @_;
+
+ # Set the defaults.
+ $option{'autodep'} = 'no'
+ unless defined $option{'autodep'};
+ $option{'linker'} = ''
+ unless defined $option{'linker'};
+ $option{'flags'} = []
+ unless defined $option{'flags'};
+ $option{'output_extensions'} = sub { return ( '.$(OBJEXT)', '.lo' ) }
+ unless defined $option{'output_extensions'};
+ $option{'nodist_specific'} = 0
+ unless defined $option{'nodist_specific'};
+
+ my $lang = new Automake::Language (%option);
+
+ # Fill indexes.
+ $extension_map{$_} = $lang->name foreach @{$lang->extensions};
+ $languages{$lang->name} = $lang;
+ my $link = $lang->linker;
+ if ($link)
+ {
+ if (exists $link_languages{$link})
+ {
+ prog_error ("'$link' has different definitions in "
+ . $lang->name . " and " . $link_languages{$link}->name)
+ if $lang->link ne $link_languages{$link}->link;
+ }
+ else
+ {
+ $link_languages{$link} = $lang;
+ }
+ }
+
+ # Update the pattern of known extensions.
+ accept_extensions (@{$lang->extensions});
+
+ # Update the $suffix_rule map.
+ foreach my $suffix (@{$lang->extensions})
+ {
+ foreach my $dest ($lang->output_extensions->($suffix))
+ {
+ register_suffix_rule (INTERNAL, $suffix, $dest);
+ }
+ }
+}
+
+# derive_suffix ($EXT, $OBJ)
+# --------------------------
+# This function is used to find a path from a user-specified suffix $EXT
+# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'.
+sub derive_suffix
+{
+ my ($source_ext, $obj) = @_;
+
+ while (! $extension_map{$source_ext}
+ && $source_ext ne $obj
+ && exists $suffix_rules->{$source_ext}
+ && exists $suffix_rules->{$source_ext}{$obj})
+ {
+ $source_ext = $suffix_rules->{$source_ext}{$obj}[0];
+ }
+
+ return $source_ext;
+}
+
+
+# Pretty-print something and append to '$output_rules'.
+sub pretty_print_rule
+{
+ $output_rules .= makefile_wrap (shift, shift, @_);
+}
+
+
+################################################################
+
+
+## -------------------------------- ##
+## Handling the conditional stack. ##
+## -------------------------------- ##
+
+
+# $STRING
+# make_conditional_string ($NEGATE, $COND)
+# ----------------------------------------
+sub make_conditional_string
+{
+ my ($negate, $cond) = @_;
+ $cond = "${cond}_TRUE"
+ unless $cond =~ /^TRUE|FALSE$/;
+ $cond = Automake::Condition::conditional_negate ($cond)
+ if $negate;
+ return $cond;
+}
+
+
+my %_am_macro_for_cond =
+ (
+ AMDEP => "one of the compiler tests\n"
+ . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\n"
+ . " AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC",
+ am__fastdepCC => 'AC_PROG_CC',
+ am__fastdepCCAS => 'AM_PROG_AS',
+ am__fastdepCXX => 'AC_PROG_CXX',
+ am__fastdepGCJ => 'AM_PROG_GCJ',
+ am__fastdepOBJC => 'AC_PROG_OBJC',
+ am__fastdepOBJCXX => 'AC_PROG_OBJCXX',
+ am__fastdepUPC => 'AM_PROG_UPC'
+ );
+
+# $COND
+# cond_stack_if ($NEGATE, $COND, $WHERE)
+# --------------------------------------
+sub cond_stack_if
+{
+ my ($negate, $cond, $where) = @_;
+
+ if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/)
+ {
+ my $text = "$cond does not appear in AM_CONDITIONAL";
+ my $scope = US_LOCAL;
+ if (exists $_am_macro_for_cond{$cond})
+ {
+ my $mac = $_am_macro_for_cond{$cond};
+ $text .= "\n The usual way to define '$cond' is to add ";
+ $text .= ($mac =~ / /) ? $mac : "'$mac'";
+ $text .= "\n to '$configure_ac' and run 'aclocal' and 'autoconf' again";
+ # These warnings appear in Automake files (depend2.am),
+ # so there is no need to display them more than once:
+ $scope = US_GLOBAL;
+ }
+ error $where, $text, uniq_scope => $scope;
+ }
+
+ push (@cond_stack, make_conditional_string ($negate, $cond));
+
+ return new Automake::Condition (@cond_stack);
+}
+
+
+# $COND
+# cond_stack_else ($NEGATE, $COND, $WHERE)
+# ----------------------------------------
+sub cond_stack_else
+{
+ my ($negate, $cond, $where) = @_;
+
+ if (! @cond_stack)
+ {
+ error $where, "else without if";
+ return FALSE;
+ }
+
+ $cond_stack[$#cond_stack] =
+ Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]);
+
+ # If $COND is given, check against it.
+ if (defined $cond)
+ {
+ $cond = make_conditional_string ($negate, $cond);
+
+ error ($where, "else reminder ($negate$cond) incompatible with "
+ . "current conditional: $cond_stack[$#cond_stack]")
+ if $cond_stack[$#cond_stack] ne $cond;
+ }
+
+ return new Automake::Condition (@cond_stack);
+}
+
+
+# $COND
+# cond_stack_endif ($NEGATE, $COND, $WHERE)
+# -----------------------------------------
+sub cond_stack_endif
+{
+ my ($negate, $cond, $where) = @_;
+ my $old_cond;
+
+ if (! @cond_stack)
+ {
+ error $where, "endif without if";
+ return TRUE;
+ }
+
+ # If $COND is given, check against it.
+ if (defined $cond)
+ {
+ $cond = make_conditional_string ($negate, $cond);
+
+ error ($where, "endif reminder ($negate$cond) incompatible with "
+ . "current conditional: $cond_stack[$#cond_stack]")
+ if $cond_stack[$#cond_stack] ne $cond;
+ }
+
+ pop @cond_stack;
+
+ return new Automake::Condition (@cond_stack);
+}
+
+
+
+
+
+## ------------------------ ##
+## Handling the variables. ##
+## ------------------------ ##
+
+
+# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
+# ----------------------------------------------------
+# Like define_variable, but the value is a list, and the variable may
+# be defined conditionally. The second argument is the condition
+# under which the value should be defined; this should be the empty
+# string to define the variable unconditionally. The third argument
+# is a list holding the values to use for the variable. The value is
+# pretty printed in the output file.
+sub define_pretty_variable
+{
+ my ($var, $cond, $where, @value) = @_;
+
+ if (! vardef ($var, $cond))
+ {
+ Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value",
+ '', $where, VAR_PRETTY);
+ rvar ($var)->rdef ($cond)->set_seen;
+ }
+}
+
+
+# define_variable ($VAR, $VALUE, $WHERE)
+# --------------------------------------
+# Define a new Automake Makefile variable VAR to VALUE, but only if
+# not already defined.
+sub define_variable
+{
+ my ($var, $value, $where) = @_;
+ define_pretty_variable ($var, TRUE, $where, $value);
+}
+
+
+# define_files_variable ($VAR, \@BASENAME, $EXTENSION, $WHERE)
+# ------------------------------------------------------------
+# Define the $VAR which content is the list of file names composed of
+# a @BASENAME and the $EXTENSION.
+sub define_files_variable ($\@$$)
+{
+ my ($var, $basename, $extension, $where) = @_;
+ define_variable ($var,
+ join (' ', map { "$_.$extension" } @$basename),
+ $where);
+}
+
+
+# Like define_variable, but define a variable to be the configure
+# substitution by the same name.
+sub define_configure_variable
+{
+ my ($var) = @_;
+ # Some variables we do not want to output. For instance it
+ # would be a bad idea to output `U = @U@` when `@U@` can be
+ # substituted as `\`.
+ my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
+ Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var),
+ '', $configure_vars{$var}, $pretty);
+}
+
+
+# define_compiler_variable ($LANG)
+# --------------------------------
+# Define a compiler variable. We also handle defining the 'LT'
+# version of the command when using libtool.
+sub define_compiler_variable
+{
+ my ($lang) = @_;
+
+ my ($var, $value) = ($lang->compiler, $lang->compile);
+ my $libtool_tag = '';
+ $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
+ if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
+ define_variable ($var, $value, INTERNAL);
+ if (var ('LIBTOOL'))
+ {
+ my $verbose = define_verbose_libtool ();
+ define_variable ("LT$var",
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)"
+ . " \$(LIBTOOLFLAGS) --mode=compile $value",
+ INTERNAL);
+ }
+ define_verbose_tagvar ($lang->ccer || 'GEN');
+}
+
+
+sub define_linker_variable
+{
+ my ($lang) = @_;
+
+ my $libtool_tag = '';
+ $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
+ if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
+ # CCLD = $(CC).
+ define_variable ($lang->lder, $lang->ld, INTERNAL);
+ # CCLINK = $(CCLD) blah blah...
+ my $link = '';
+ if (var ('LIBTOOL'))
+ {
+ my $verbose = define_verbose_libtool ();
+ $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=link ";
+ }
+ define_variable ($lang->linker, $link . $lang->link, INTERNAL);
+ define_variable ($lang->compiler, $lang, INTERNAL);
+ define_verbose_tagvar ($lang->lder || 'GEN');
+}
+
+sub define_per_target_linker_variable
+{
+ my ($linker, $target) = @_;
+
+ # If the user wrote a custom link command, we don't define ours.
+ return "${target}_LINK"
+ if set_seen "${target}_LINK";
+
+ my $xlink = $linker ? $linker : 'LINK';
+
+ my $lang = $link_languages{$xlink};
+ prog_error "Unknown language for linker variable '$xlink'"
+ unless $lang;
+
+ my $link_command = $lang->link;
+ if (var 'LIBTOOL')
+ {
+ my $libtool_tag = '';
+ $libtool_tag = '--tag=' . $lang->libtool_tag . ' '
+ if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
+
+ my $verbose = define_verbose_libtool ();
+ $link_command =
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) "
+ . "--mode=link " . $link_command;
+ }
+
+ # Rewrite each occurrence of 'AM_$flag' in the link
+ # command into '${derived}_$flag' if it exists.
+ my $orig_command = $link_command;
+ my @flags = (@{$lang->flags}, 'LDFLAGS');
+ push @flags, 'LIBTOOLFLAGS' if var 'LIBTOOL';
+ for my $flag (@flags)
+ {
+ my $val = "${target}_$flag";
+ $link_command =~ s/\(AM_$flag\)/\($val\)/
+ if set_seen ($val);
+ }
+
+ # If the computed command is the same as the generic command, use
+ # the command linker variable.
+ return ($lang->linker, $lang->lder)
+ if $link_command eq $orig_command;
+
+ define_variable ("${target}_LINK", $link_command, INTERNAL);
+ return ("${target}_LINK", $lang->lder);
+}
+
+################################################################
+
+# check_trailing_slash ($WHERE, $LINE)
+# ------------------------------------
+# Return 1 iff $LINE ends with a slash.
+# Might modify $LINE.
+sub check_trailing_slash ($\$)
+{
+ my ($where, $line) = @_;
+
+ # Ignore '##' lines.
+ return 0 if $$line =~ /$IGNORE_PATTERN/o;
+
+ # Catch and fix a common error.
+ msg "syntax", $where, "whitespace following trailing backslash"
+ if $$line =~ s/\\\s+\n$/\\\n/;
+
+ return $$line =~ /\\$/;
+}
+
+
+# read_am_file ($AMFILE, $WHERE, $RELDIR)
+# ---------------------------------------
+# Read Makefile.am and set up %contents. Simultaneously copy lines
+# from Makefile.am into $output_trailer, or define variables as
+# appropriate. NOTE we put rules in the trailer section. We want
+# user rules to come after our generated stuff.
+sub read_am_file
+{
+ my ($amfile, $where, $reldir) = @_;
+ my $canon_reldir = &canonicalize ($reldir);
+
+ my $am_file = new Automake::XFile ("< $amfile");
+ verb "reading $amfile";
+
+ # Keep track of the youngest output dependency.
+ my $mtime = mtime $amfile;
+ $output_deps_greatest_timestamp = $mtime
+ if $mtime > $output_deps_greatest_timestamp;
+
+ my $spacing = '';
+ my $comment = '';
+ my $blank = 0;
+ my $saw_bk = 0;
+ my $var_look = VAR_ASIS;
+
+ use constant IN_VAR_DEF => 0;
+ use constant IN_RULE_DEF => 1;
+ use constant IN_COMMENT => 2;
+ my $prev_state = IN_RULE_DEF;
+
+ while ($_ = $am_file->getline)
+ {
+ $where->set ("$amfile:$.");
+ if (/$IGNORE_PATTERN/o)
+ {
+ # Merely delete comments beginning with two hashes.
+ }
+ elsif (/$WHITE_PATTERN/o)
+ {
+ error $where, "blank line following trailing backslash"
+ if $saw_bk;
+ # Stick a single white line before the incoming macro or rule.
+ $spacing = "\n";
+ $blank = 1;
+ # Flush all comments seen so far.
+ if ($comment ne '')
+ {
+ $output_vars .= $comment;
+ $comment = '';
+ }
+ }
+ elsif (/$COMMENT_PATTERN/o)
+ {
+ # Stick comments before the incoming macro or rule. Make
+ # sure a blank line precedes the first block of comments.
+ $spacing = "\n" unless $blank;
+ $blank = 1;
+ $comment .= $spacing . $_;
+ $spacing = '';
+ $prev_state = IN_COMMENT;
+ }
+ else
+ {
+ last;
+ }
+ $saw_bk = check_trailing_slash ($where, $_);
+ }
+
+ # We save the conditional stack on entry, and then check to make
+ # sure it is the same on exit. This lets us conditionally include
+ # other files.
+ my @saved_cond_stack = @cond_stack;
+ my $cond = new Automake::Condition (@cond_stack);
+
+ my $last_var_name = '';
+ my $last_var_type = '';
+ my $last_var_value = '';
+ my $last_where;
+ # FIXME: shouldn't use $_ in this loop; it is too big.
+ while ($_)
+ {
+ $where->set ("$amfile:$.");
+
+ # Make sure the line is \n-terminated.
+ chomp;
+ $_ .= "\n";
+
+ # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be
+ # used by users. @MAINT@ is an anachronism now.
+ $_ =~ s/\@MAINT\@//g
+ unless $seen_maint_mode;
+
+ my $new_saw_bk = check_trailing_slash ($where, $_);
+
+ if ($reldir eq '.')
+ {
+ # If present, eat the following '_' or '/', converting
+ # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo"
+ # when $reldir is '.'.
+ $_ =~ s,%(D|reldir)%/,,g;
+ $_ =~ s,%(C|canon_reldir)%_,,g;
+ }
+ $_ =~ s/%(D|reldir)%/${reldir}/g;
+ $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g;
+
+ if (/$IGNORE_PATTERN/o)
+ {
+ # Merely delete comments beginning with two hashes.
+
+ # Keep any backslash from the previous line.
+ $new_saw_bk = $saw_bk;
+ }
+ elsif (/$WHITE_PATTERN/o)
+ {
+ # Stick a single white line before the incoming macro or rule.
+ $spacing = "\n";
+ error $where, "blank line following trailing backslash"
+ if $saw_bk;
+ }
+ elsif (/$COMMENT_PATTERN/o)
+ {
+ error $where, "comment following trailing backslash"
+ if $saw_bk && $prev_state != IN_COMMENT;
+
+ # Stick comments before the incoming macro or rule.
+ $comment .= $spacing . $_;
+ $spacing = '';
+ $prev_state = IN_COMMENT;
+ }
+ elsif ($saw_bk)
+ {
+ if ($prev_state == IN_RULE_DEF)
+ {
+ my $cond = new Automake::Condition @cond_stack;
+ $output_trailer .= $cond->subst_string;
+ $output_trailer .= $_;
+ }
+ elsif ($prev_state == IN_COMMENT)
+ {
+ # If the line doesn't start with a '#', add it.
+ # We do this because a continued comment like
+ # # A = foo \
+ # bar \
+ # baz
+ # is not portable. BSD make doesn't honor
+ # escaped newlines in comments.
+ s/^#?/#/;
+ $comment .= $spacing . $_;
+ }
+ else # $prev_state == IN_VAR_DEF
+ {
+ $last_var_value .= ' '
+ unless $last_var_value =~ /\s$/;
+ $last_var_value .= $_;
+
+ if (!/\\$/)
+ {
+ Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
+ $last_var_type, $cond,
+ $last_var_value, $comment,
+ $last_where, VAR_ASIS)
+ if $cond != FALSE;
+ $comment = $spacing = '';
+ }
+ }
+ }
+
+ elsif (/$IF_PATTERN/o)
+ {
+ $cond = cond_stack_if ($1, $2, $where);
+ }
+ elsif (/$ELSE_PATTERN/o)
+ {
+ $cond = cond_stack_else ($1, $2, $where);
+ }
+ elsif (/$ENDIF_PATTERN/o)
+ {
+ $cond = cond_stack_endif ($1, $2, $where);
+ }
+
+ elsif (/$RULE_PATTERN/o)
+ {
+ # Found a rule.
+ $prev_state = IN_RULE_DEF;
+
+ # For now we have to output all definitions of user rules
+ # and can't diagnose duplicates (see the comment in
+ # Automake::Rule::define). So we go on and ignore the return value.
+ Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where);
+
+ check_variable_expansions ($_, $where);
+
+ $output_trailer .= $comment . $spacing;
+ my $cond = new Automake::Condition @cond_stack;
+ $output_trailer .= $cond->subst_string;
+ $output_trailer .= $_;
+ $comment = $spacing = '';
+ }
+ elsif (/$ASSIGNMENT_PATTERN/o)
+ {
+ # Found a macro definition.
+ $prev_state = IN_VAR_DEF;
+ $last_var_name = $1;
+ $last_var_type = $2;
+ $last_var_value = $3;
+ $last_where = $where->clone;
+ if ($3 ne '' && substr ($3, -1) eq "\\")
+ {
+ # We preserve the '\' because otherwise the long lines
+ # that are generated will be truncated by broken
+ # 'sed's.
+ $last_var_value = $3 . "\n";
+ }
+ # Normally we try to output variable definitions in the
+ # same format they were input. However, POSIX compliant
+ # systems are not required to support lines longer than
+ # 2048 bytes (most notably, some sed implementation are
+ # limited to 4000 bytes, and sed is used by config.status
+ # to rewrite Makefile.in into Makefile). Moreover nobody
+ # would really write such long lines by hand since it is
+ # hardly maintainable. So if a line is longer that 1000
+ # bytes (an arbitrary limit), assume it has been
+ # automatically generated by some tools, and flatten the
+ # variable definition. Otherwise, keep the variable as it
+ # as been input.
+ $var_look = VAR_PRETTY if length ($last_var_value) >= 1000;
+
+ if (!/\\$/)
+ {
+ Automake::Variable::define ($last_var_name, VAR_MAKEFILE,
+ $last_var_type, $cond,
+ $last_var_value, $comment,
+ $last_where, $var_look)
+ if $cond != FALSE;
+ $comment = $spacing = '';
+ $var_look = VAR_ASIS;
+ }
+ }
+ elsif (/$INCLUDE_PATTERN/o)
+ {
+ my $path = $1;
+
+ if ($path =~ s/^\$\(top_srcdir\)\///)
+ {
+ push (@include_stack, "\$\(top_srcdir\)/$path");
+ # Distribute any included file.
+
+ # Always use the $(top_srcdir) prefix in DIST_COMMON,
+ # otherwise OSF make will implicitly copy the included
+ # file in the build tree during "make distdir" to satisfy
+ # the dependency.
+ # (subdir-am-cond.sh and subdir-ac-cond.sh will fail)
+ push_dist_common ("\$\(top_srcdir\)/$path");
+ }
+ else
+ {
+ $path =~ s/\$\(srcdir\)\///;
+ push (@include_stack, "\$\(srcdir\)/$path");
+ # Always use the $(srcdir) prefix in DIST_COMMON,
+ # otherwise OSF make will implicitly copy the included
+ # file in the build tree during "make distdir" to satisfy
+ # the dependency.
+ # (subdir-am-cond.sh and subdir-ac-cond.sh will fail)
+ push_dist_common ("\$\(srcdir\)/$path");
+ $path = $relative_dir . "/" . $path if $relative_dir ne '.';
+ }
+ my $new_reldir = File::Spec->abs2rel ($path, $relative_dir);
+ $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,;
+ $where->push_context ("'$path' included from here");
+ read_am_file ($path, $where, $new_reldir);
+ $where->pop_context;
+ }
+ else
+ {
+ # This isn't an error; it is probably a continued rule.
+ # In fact, this is what we assume.
+ $prev_state = IN_RULE_DEF;
+ check_variable_expansions ($_, $where);
+ $output_trailer .= $comment . $spacing;
+ my $cond = new Automake::Condition @cond_stack;
+ $output_trailer .= $cond->subst_string;
+ $output_trailer .= $_;
+ $comment = $spacing = '';
+ error $where, "'#' comment at start of rule is unportable"
+ if $_ =~ /^\t\s*\#/;
+ }
+
+ $saw_bk = $new_saw_bk;
+ $_ = $am_file->getline;
+ }
+
+ $output_trailer .= $comment;
+
+ error ($where, "trailing backslash on last line")
+ if $saw_bk;
+
+ error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack"
+ : "too many conditionals closed in include file"))
+ if "@saved_cond_stack" ne "@cond_stack";
+}
+
+
+# A helper for read_main_am_file which initializes configure variables
+# and variables from header-vars.am.
+sub define_standard_variables ()
+{
+ my $saved_output_vars = $output_vars;
+ my ($comments, undef, $rules) =
+ file_contents_internal (1, "$libdir/am/header-vars.am",
+ new Automake::Location);
+
+ foreach my $var (sort keys %configure_vars)
+ {
+ define_configure_variable ($var);
+ }
+
+ $output_vars .= $comments . $rules;
+}
+
+
+# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN)
+# ----------------------------------------------
+sub read_main_am_file
+{
+ my ($amfile, $infile) = @_;
+
+ # This supports the strange variable tricks we are about to play.
+ prog_error ("variable defined before read_main_am_file\n" . variables_dump ())
+ if (scalar (variables) > 0);
+
+ # Generate copyright header for generated Makefile.in.
+ # We do discard the output of predefined variables, handled below.
+ $output_vars = ("# " . basename ($infile) . " generated by automake "
+ . $VERSION . " from " . basename ($amfile) . ".\n");
+ $output_vars .= '# ' . subst ('configure_input') . "\n";
+ $output_vars .= $gen_copyright;
+
+ # We want to predefine as many variables as possible. This lets
+ # the user set them with '+=' in Makefile.am.
+ define_standard_variables;
+
+ # Read user file, which might override some of our values.
+ read_am_file ($amfile, new Automake::Location, '.');
+}
+
+
+
+################################################################
+
+# $STRING
+# flatten ($ORIGINAL_STRING)
+# --------------------------
+sub flatten
+{
+ $_ = shift;
+
+ s/\\\n//somg;
+ s/\s+/ /g;
+ s/^ //;
+ s/ $//;
+
+ return $_;
+}
+
+
+# transform_token ($TOKEN, \%PAIRS, $KEY)
+# ---------------------------------------
+# Return the value associated to $KEY in %PAIRS, as used on $TOKEN
+# (which should be ?KEY? or any of the special %% requests)..
+sub transform_token ($\%$)
+{
+ my ($token, $transform, $key) = @_;
+ my $res = $transform->{$key};
+ prog_error "Unknown key '$key' in '$token'" unless defined $res;
+ return $res;
+}
+
+
+# transform ($TOKEN, \%PAIRS)
+# ---------------------------
+# If ($TOKEN, $VAL) is in %PAIRS:
+# - replaces %KEY% with $VAL,
+# - enables/disables ?KEY? and ?!KEY?,
+# - replaces %?KEY% with TRUE or FALSE.
+sub transform ($\%)
+{
+ my ($token, $transform) = @_;
+
+ # %KEY%.
+ # Must be before the following pattern to exclude the case
+ # when there is neither IFTRUE nor IFFALSE.
+ if ($token =~ /^%([\w\-]+)%$/)
+ {
+ return transform_token ($token, %$transform, $1);
+ }
+ # %?KEY%.
+ elsif ($token =~ /^%\?([\w\-]+)%$/)
+ {
+ return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE';
+ }
+ # ?KEY? and ?!KEY?.
+ elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x)
+ {
+ my $neg = ($1 eq '!') ? 1 : 0;
+ my $val = transform_token ($token, %$transform, $2);
+ return (!!$val == $neg) ? '##%' : '';
+ }
+ else
+ {
+ prog_error "Unknown request format: $token";
+ }
+}
+
+# $TEXT
+# preprocess_file ($MAKEFILE, [%TRANSFORM])
+# -----------------------------------------
+# Load a $MAKEFILE, apply the %TRANSFORM, and return the result.
+# No extra parsing or post-processing is done (i.e., recognition of
+# rules declaration or of make variables definitions).
+sub preprocess_file
+{
+ my ($file, %transform) = @_;
+
+ # Complete %transform with global options.
+ # Note that %transform goes last, so it overrides global options.
+ %transform = ( 'MAINTAINER-MODE'
+ => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '',
+
+ 'XZ' => !! option 'dist-xz',
+ 'LZIP' => !! option 'dist-lzip',
+ 'BZIP2' => !! option 'dist-bzip2',
+ 'COMPRESS' => !! option 'dist-tarZ',
+ 'GZIP' => ! option 'no-dist-gzip',
+ 'SHAR' => !! option 'dist-shar',
+ 'ZIP' => !! option 'dist-zip',
+
+ 'INSTALL-INFO' => ! option 'no-installinfo',
+ 'INSTALL-MAN' => ! option 'no-installman',
+ 'CK-NEWS' => !! option 'check-news',
+
+ 'SUBDIRS' => !! var ('SUBDIRS'),
+ 'TOPDIR_P' => $relative_dir eq '.',
+
+ 'BUILD' => ($seen_canonical >= AC_CANONICAL_BUILD),
+ 'HOST' => ($seen_canonical >= AC_CANONICAL_HOST),
+ 'TARGET' => ($seen_canonical >= AC_CANONICAL_TARGET),
+
+ 'LIBTOOL' => !! var ('LIBTOOL'),
+ 'NONLIBTOOL' => 1,
+ %transform);
+
+ if (! defined ($_ = $am_file_cache{$file}))
+ {
+ verb "reading $file";
+ # Swallow the whole file.
+ my $fc_file = new Automake::XFile "< $file";
+ my $saved_dollar_slash = $/;
+ undef $/;
+ $_ = $fc_file->getline;
+ $/ = $saved_dollar_slash;
+ $fc_file->close;
+ # Remove ##-comments.
+ # Besides we don't need more than two consecutive new-lines.
+ s/(?:$IGNORE_PATTERN|(?<=\n\n)\n+)//gom;
+ # Remember the contents of the just-read file.
+ $am_file_cache{$file} = $_;
+ }
+
+ # Substitute Automake template tokens.
+ s/(?: % \?? [\w\-]+ %
+ | \? !? [\w\-]+ \?
+ )/transform($&, %transform)/gex;
+ # transform() may have added some ##%-comments to strip.
+ # (we use '##%' instead of '##' so we can distinguish ##%##%##% from
+ # ####### and do not remove the latter.)
+ s/^[ \t]*(?:##%)+.*\n//gm;
+
+ return $_;
+}
+
+
+# @PARAGRAPHS
+# make_paragraphs ($MAKEFILE, [%TRANSFORM])
+# -----------------------------------------
+# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
+# paragraphs.
+sub make_paragraphs
+{
+ my ($file, %transform) = @_;
+ $transform{FIRST} = !$transformed_files{$file};
+ $transformed_files{$file} = 1;
+
+ my @lines = split /(?set ($file);
+
+ my $result_vars = '';
+ my $result_rules = '';
+ my $comment = '';
+ my $spacing = '';
+
+ # The following flags are used to track rules spanning across
+ # multiple paragraphs.
+ my $is_rule = 0; # 1 if we are processing a rule.
+ my $discard_rule = 0; # 1 if the current rule should not be output.
+
+ # We save the conditional stack on entry, and then check to make
+ # sure it is the same on exit. This lets us conditionally include
+ # other files.
+ my @saved_cond_stack = @cond_stack;
+ my $cond = new Automake::Condition (@cond_stack);
+
+ foreach (make_paragraphs ($file, %transform))
+ {
+ # FIXME: no line number available.
+ $where->set ($file);
+
+ # Sanity checks.
+ error $where, "blank line following trailing backslash:\n$_"
+ if /\\$/;
+ error $where, "comment following trailing backslash:\n$_"
+ if /\\#/;
+
+ if (/^$/)
+ {
+ $is_rule = 0;
+ # Stick empty line before the incoming macro or rule.
+ $spacing = "\n";
+ }
+ elsif (/$COMMENT_PATTERN/mso)
+ {
+ $is_rule = 0;
+ # Stick comments before the incoming macro or rule.
+ $comment = "$_\n";
+ }
+
+ # Handle inclusion of other files.
+ elsif (/$INCLUDE_PATTERN/o)
+ {
+ if ($cond != FALSE)
+ {
+ my $file = ($is_am ? "$libdir/am/" : '') . $1;
+ $where->push_context ("'$file' included from here");
+ # N-ary '.=' fails.
+ my ($com, $vars, $rules)
+ = file_contents_internal ($is_am, $file, $where, %transform);
+ $where->pop_context;
+ $comment .= $com;
+ $result_vars .= $vars;
+ $result_rules .= $rules;
+ }
+ }
+
+ # Handling the conditionals.
+ elsif (/$IF_PATTERN/o)
+ {
+ $cond = cond_stack_if ($1, $2, $file);
+ }
+ elsif (/$ELSE_PATTERN/o)
+ {
+ $cond = cond_stack_else ($1, $2, $file);
+ }
+ elsif (/$ENDIF_PATTERN/o)
+ {
+ $cond = cond_stack_endif ($1, $2, $file);
+ }
+
+ # Handling rules.
+ elsif (/$RULE_PATTERN/mso)
+ {
+ $is_rule = 1;
+ $discard_rule = 0;
+ # Separate relationship from optional actions: the first
+ # `new-line tab" not preceded by backslash (continuation
+ # line).
+ my $paragraph = $_;
+ /^(.*?)(?:(?subst_string/gme;
+ $result_rules .= "$spacing$comment$condparagraph\n";
+ }
+ if (scalar @undefined_conds == 0)
+ {
+ # Remember to discard next paragraphs
+ # if they belong to this rule.
+ # (but see also FIXME: #2 above.)
+ $discard_rule = 1;
+ }
+ $comment = $spacing = '';
+ last;
+ }
+ }
+ }
+
+ elsif (/$ASSIGNMENT_PATTERN/mso)
+ {
+ my ($var, $type, $val) = ($1, $2, $3);
+ error $where, "variable '$var' with trailing backslash"
+ if /\\$/;
+
+ $is_rule = 0;
+
+ Automake::Variable::define ($var,
+ $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE,
+ $type, $cond, $val, $comment, $where,
+ VAR_ASIS)
+ if $cond != FALSE;
+
+ $comment = $spacing = '';
+ }
+ else
+ {
+ # This isn't an error; it is probably some tokens which
+ # configure is supposed to replace, such as '@SET-MAKE@',
+ # or some part of a rule cut by an if/endif.
+ if (! $cond->false && ! ($is_rule && $discard_rule))
+ {
+ s/^/$cond->subst_string/gme;
+ $result_rules .= "$spacing$comment$_\n";
+ }
+ $comment = $spacing = '';
+ }
+ }
+
+ error ($where, @cond_stack ?
+ "unterminated conditionals: @cond_stack" :
+ "too many conditionals closed in include file")
+ if "@saved_cond_stack" ne "@cond_stack";
+
+ return ($comment, $result_vars, $result_rules);
+}
+
+
+# $CONTENTS
+# file_contents ($BASENAME, $WHERE, [%TRANSFORM])
+# -----------------------------------------------
+# Return contents of a file from $libdir/am, automatically skipping
+# macros or rules which are already known.
+sub file_contents
+{
+ my ($basename, $where, %transform) = @_;
+ my ($comments, $variables, $rules) =
+ file_contents_internal (1, "$libdir/am/$basename.am", $where,
+ %transform);
+ return "$comments$variables$rules";
+}
+
+
+# @PREFIX
+# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
+# ----------------------------------------------------
+# Find all variable prefixes that are used for install directories. A
+# prefix 'zar' qualifies iff:
+#
+# * 'zardir' is a variable.
+# * 'zar_PRIMARY' is a variable.
+#
+# As a side effect, it looks for misspellings. It is an error to have
+# a variable ending in a "reserved" suffix whose prefix is unknown, e.g.
+# "bni_PROGRAMS". However, unusual prefixes are allowed if a variable
+# of the same name (with "dir" appended) exists. For instance, if the
+# variable "zardir" is defined, then "zar_PROGRAMS" becomes valid.
+# This is to provide a little extra flexibility in those cases which
+# need it.
+sub am_primary_prefixes
+{
+ my ($primary, $can_dist, @prefixes) = @_;
+
+ local $_;
+ my %valid = map { $_ => 0 } @prefixes;
+ $valid{'EXTRA'} = 0;
+ foreach my $var (variables $primary)
+ {
+ # Automake is allowed to define variables that look like primaries
+ # but which aren't. E.g. INSTALL_sh_DATA.
+ # Autoconf can also define variables like INSTALL_DATA, so
+ # ignore all configure variables (at least those which are not
+ # redefined in Makefile.am).
+ # FIXME: We should make sure that these variables are not
+ # conditionally defined (or else adjust the condition below).
+ my $def = $var->def (TRUE);
+ next if $def && $def->owner != VAR_MAKEFILE;
+
+ my $varname = $var->name;
+
+ if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/)
+ {
+ my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || '');
+ if ($dist ne '' && ! $can_dist)
+ {
+ err_var ($var,
+ "invalid variable '$varname': 'dist' is forbidden");
+ }
+ # Standard directories must be explicitly allowed.
+ elsif (! defined $valid{$X} && exists $standard_prefix{$X})
+ {
+ err_var ($var,
+ "'${X}dir' is not a legitimate directory " .
+ "for '$primary'");
+ }
+ # A not explicitly valid directory is allowed if Xdir is defined.
+ elsif (! defined $valid{$X} &&
+ $var->requires_variables ("'$varname' is used", "${X}dir"))
+ {
+ # Nothing to do. Any error message has been output
+ # by $var->requires_variables.
+ }
+ else
+ {
+ # Ensure all extended prefixes are actually used.
+ $valid{"$base$dist$X"} = 1;
+ }
+ }
+ else
+ {
+ prog_error "unexpected variable name: $varname";
+ }
+ }
+
+ # Return only those which are actually defined.
+ return sort grep { var ($_ . '_' . $primary) } keys %valid;
+}
+
+
+# am_install_var (-OPTION..., file, HOW, where...)
+# ------------------------------------------------
+#
+# Handle 'where_HOW' variable magic. Does all lookups, generates
+# install code, and possibly generates code to define the primary
+# variable. The first argument is the name of the .am file to munge,
+# the second argument is the primary variable (e.g. HEADERS), and all
+# subsequent arguments are possible installation locations.
+#
+# Returns list of [$location, $value] pairs, where
+# $value's are the values in all where_HOW variable, and $location
+# there associated location (the place here their parent variables were
+# defined).
+#
+# FIXME: this should be rewritten to be cleaner. It should be broken
+# up into multiple functions.
+#
+sub am_install_var
+{
+ my (@args) = @_;
+
+ my $do_require = 1;
+ my $can_dist = 0;
+ my $default_dist = 0;
+ while (@args)
+ {
+ if ($args[0] eq '-noextra')
+ {
+ $do_require = 0;
+ }
+ elsif ($args[0] eq '-candist')
+ {
+ $can_dist = 1;
+ }
+ elsif ($args[0] eq '-defaultdist')
+ {
+ $default_dist = 1;
+ $can_dist = 1;
+ }
+ elsif ($args[0] !~ /^-/)
+ {
+ last;
+ }
+ shift (@args);
+ }
+
+ my ($file, $primary, @prefix) = @args;
+
+ # Now that configure substitutions are allowed in where_HOW
+ # variables, it is an error to actually define the primary. We
+ # allow 'JAVA', as it is customarily used to mean the Java
+ # interpreter. This is but one of several Java hacks. Similarly,
+ # 'PYTHON' is customarily used to mean the Python interpreter.
+ reject_var $primary, "'$primary' is an anachronism"
+ unless $primary eq 'JAVA' || $primary eq 'PYTHON';
+
+ # Get the prefixes which are valid and actually used.
+ @prefix = am_primary_prefixes ($primary, $can_dist, @prefix);
+
+ # If a primary includes a configure substitution, then the EXTRA_
+ # form is required. Otherwise we can't properly do our job.
+ my $require_extra;
+
+ my @used = ();
+ my @result = ();
+
+ foreach my $X (@prefix)
+ {
+ my $nodir_name = $X;
+ my $one_name = $X . '_' . $primary;
+ my $one_var = var $one_name;
+
+ my $strip_subdir = 1;
+ # If subdir prefix should be preserved, do so.
+ if ($nodir_name =~ /^nobase_/)
+ {
+ $strip_subdir = 0;
+ $nodir_name =~ s/^nobase_//;
+ }
+
+ # If files should be distributed, do so.
+ my $dist_p = 0;
+ if ($can_dist)
+ {
+ $dist_p = (($default_dist && $nodir_name !~ /^nodist_/)
+ || (! $default_dist && $nodir_name =~ /^dist_/));
+ $nodir_name =~ s/^(dist|nodist)_//;
+ }
+
+
+ # Use the location of the currently processed variable.
+ # We are not processing a particular condition, so pick the first
+ # available.
+ my $tmpcond = $one_var->conditions->one_cond;
+ my $where = $one_var->rdef ($tmpcond)->location->clone;
+
+ # Append actual contents of where_PRIMARY variable to
+ # @result, skipping @substitutions@.
+ foreach my $locvals ($one_var->value_as_list_recursive (location => 1))
+ {
+ my ($loc, $value) = @$locvals;
+ # Skip configure substitutions.
+ if ($value =~ /^\@.*\@$/)
+ {
+ if ($nodir_name eq 'EXTRA')
+ {
+ error ($where,
+ "'$one_name' contains configure substitution, "
+ . "but shouldn't");
+ }
+ # Check here to make sure variables defined in
+ # configure.ac do not imply that EXTRA_PRIMARY
+ # must be defined.
+ elsif (! defined $configure_vars{$one_name})
+ {
+ $require_extra = $one_name
+ if $do_require;
+ }
+ }
+ else
+ {
+ # Strip any $(EXEEXT) suffix the user might have added,
+ # or this will confuse handle_source_transform() and
+ # check_canonical_spelling().
+ # We'll add $(EXEEXT) back later anyway.
+ # Do it here rather than in handle_programs so the
+ # uniquifying at the end of this function works.
+ ${$locvals}[1] =~ s/\$\(EXEEXT\)$//
+ if $primary eq 'PROGRAMS';
+
+ push (@result, $locvals);
+ }
+ }
+ # A blatant hack: we rewrite each _PROGRAMS primary to include
+ # EXEEXT.
+ append_exeext { 1 } $one_name
+ if $primary eq 'PROGRAMS';
+ # "EXTRA" shouldn't be used when generating clean targets,
+ # all, or install targets. We used to warn if EXTRA_FOO was
+ # defined uselessly, but this was annoying.
+ next
+ if $nodir_name eq 'EXTRA';
+
+ if ($nodir_name eq 'check')
+ {
+ push (@check, '$(' . $one_name . ')');
+ }
+ else
+ {
+ push (@used, '$(' . $one_name . ')');
+ }
+
+ # Is this to be installed?
+ my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check';
+
+ # If so, with install-exec? (or install-data?).
+ my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o);
+
+ my $check_options_p = $install_p && !! option 'std-options';
+
+ # Use the location of the currently processed variable as context.
+ $where->push_context ("while processing '$one_name'");
+
+ # The variable containing all files to distribute.
+ my $distvar = "\$($one_name)";
+ $distvar = shadow_unconditionally ($one_name, $where)
+ if ($dist_p && $one_var->has_conditional_contents);
+
+ # Singular form of $PRIMARY.
+ (my $one_primary = $primary) =~ s/S$//;
+ $output_rules .= file_contents ($file, $where,
+ PRIMARY => $primary,
+ ONE_PRIMARY => $one_primary,
+ DIR => $X,
+ NDIR => $nodir_name,
+ BASE => $strip_subdir,
+ EXEC => $exec_p,
+ INSTALL => $install_p,
+ DIST => $dist_p,
+ DISTVAR => $distvar,
+ 'CK-OPTS' => $check_options_p);
+ }
+
+ # The JAVA variable is used as the name of the Java interpreter.
+ # The PYTHON variable is used as the name of the Python interpreter.
+ if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON')
+ {
+ # Define it.
+ define_pretty_variable ($primary, TRUE, INTERNAL, @used);
+ $output_vars .= "\n";
+ }
+
+ err_var ($require_extra,
+ "'$require_extra' contains configure substitution,\n"
+ . "but 'EXTRA_$primary' not defined")
+ if ($require_extra && ! var ('EXTRA_' . $primary));
+
+ # Push here because PRIMARY might be configure time determined.
+ push (@all, '$(' . $primary . ')')
+ if @used && $primary ne 'JAVA' && $primary ne 'PYTHON';
+
+ # Make the result unique. This lets the user use conditionals in
+ # a natural way, but still lets us program lazily -- we don't have
+ # to worry about handling a particular object more than once.
+ # We will keep only one location per object.
+ my %result = ();
+ for my $pair (@result)
+ {
+ my ($loc, $val) = @$pair;
+ $result{$val} = $loc;
+ }
+ my @l = sort keys %result;
+ return map { [$result{$_}->clone, $_] } @l;
+}
+
+
+################################################################
+
+# Each key in this hash is the name of a directory holding a
+# Makefile.in. These variables are local to 'is_make_dir'.
+my %make_dirs = ();
+my $make_dirs_set = 0;
+
+# is_make_dir ($DIRECTORY)
+# ------------------------
+sub is_make_dir
+{
+ my ($dir) = @_;
+ if (! $make_dirs_set)
+ {
+ foreach my $iter (@configure_input_files)
+ {
+ $make_dirs{dirname ($iter)} = 1;
+ }
+ # We also want to notice Makefile.in's.
+ foreach my $iter (@other_input_files)
+ {
+ if ($iter =~ /Makefile\.in$/)
+ {
+ $make_dirs{dirname ($iter)} = 1;
+ }
+ }
+ $make_dirs_set = 1;
+ }
+ return defined $make_dirs{$dir};
+}
+
+################################################################
+
+# Find the aux dir. This should match the algorithm used by
+# ./configure. (See the Autoconf documentation for for
+# AC_CONFIG_AUX_DIR.)
+sub locate_aux_dir ()
+{
+ if (! $config_aux_dir_set_in_configure_ac)
+ {
+ # The default auxiliary directory is the first
+ # of ., .., or ../.. that contains install-sh.
+ # Assume . if install-sh doesn't exist yet.
+ for my $dir (qw (. .. ../..))
+ {
+ if (-f "$dir/install-sh")
+ {
+ $config_aux_dir = $dir;
+ last;
+ }
+ }
+ $config_aux_dir = '.' unless $config_aux_dir;
+ }
+ # Avoid unsightly '/.'s.
+ $am_config_aux_dir =
+ '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir");
+ $am_config_aux_dir =~ s,/*$,,;
+}
+
+
+# push_required_file ($DIR, $FILE, $FULLFILE)
+# -------------------------------------------
+# Push the given file onto DIST_COMMON.
+sub push_required_file
+{
+ my ($dir, $file, $fullfile) = @_;
+
+ # If the file to be distributed is in the same directory of the
+ # currently processed Makefile.am, then we want to distribute it
+ # from this same Makefile.am.
+ if ($dir eq $relative_dir)
+ {
+ push_dist_common ($file);
+ }
+ # This is needed to allow a construct in a non-top-level Makefile.am
+ # to require a file in the build-aux directory (see at least the test
+ # script 'test-driver-is-distributed.sh'). This is related to the
+ # automake bug#9546. Note that the use of $config_aux_dir instead
+ # of $am_config_aux_dir here is deliberate and necessary.
+ elsif ($dir eq $config_aux_dir)
+ {
+ push_dist_common ("$am_config_aux_dir/$file");
+ }
+ # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
+ # We probably need some refactoring of this function and its callers,
+ # to have a more explicit and systematic handling of all the special
+ # cases; but, since there are only two of them, this is low-priority
+ # ATM.
+ elsif ($config_libobj_dir && $dir eq $config_libobj_dir)
+ {
+ # Avoid unsightly '/.'s.
+ my $am_config_libobj_dir =
+ '$(top_srcdir)' .
+ ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir");
+ $am_config_libobj_dir =~ s|/*$||;
+ push_dist_common ("$am_config_libobj_dir/$file");
+ }
+ elsif ($relative_dir eq '.' && ! is_make_dir ($dir))
+ {
+ # If we are doing the topmost directory, and the file is in a
+ # subdir which does not have a Makefile, then we distribute it
+ # here.
+
+ # If a required file is above the source tree, it is important
+ # to prefix it with '$(srcdir)' so that no VPATH search is
+ # performed. Otherwise problems occur with Make implementations
+ # that rewrite and simplify rules whose dependencies are found in a
+ # VPATH location. Here is an example with OSF1/Tru64 Make.
+ #
+ # % cat Makefile
+ # VPATH = sub
+ # distdir: ../a
+ # echo ../a
+ # % ls
+ # Makefile a
+ # % make
+ # echo a
+ # a
+ #
+ # Dependency '../a' was found in 'sub/../a', but this make
+ # implementation simplified it as 'a'. (Note that the sub/
+ # directory does not even exist.)
+ #
+ # This kind of VPATH rewriting seems hard to cancel. The
+ # distdir.am hack against VPATH rewriting works only when no
+ # simplification is done, i.e., for dependencies which are in
+ # subdirectories, not in enclosing directories. Hence, in
+ # the latter case we use a full path to make sure no VPATH
+ # search occurs.
+ $fullfile = '$(srcdir)/' . $fullfile
+ if $dir =~ m,^\.\.(?:$|/),;
+
+ push_dist_common ($fullfile);
+ }
+ else
+ {
+ prog_error "a Makefile in relative directory $relative_dir " .
+ "can't add files in directory $dir to DIST_COMMON";
+ }
+}
+
+
+# If a file name appears as a key in this hash, then it has already
+# been checked for. This allows us not to report the same error more
+# than once.
+my %required_file_not_found = ();
+
+# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# -------------------------------------------------------
+# Verify that the file must exist in $DIRECTORY, or install it.
+sub required_file_check_or_copy
+{
+ my ($where, $dir, $file) = @_;
+
+ my $fullfile = "$dir/$file";
+ my $found_it = 0;
+ my $dangling_sym = 0;
+
+ if (-l $fullfile && ! -f $fullfile)
+ {
+ $dangling_sym = 1;
+ }
+ elsif (dir_has_case_matching_file ($dir, $file))
+ {
+ $found_it = 1;
+ }
+
+ # '--force-missing' only has an effect if '--add-missing' is
+ # specified.
+ return
+ if $found_it && (! $add_missing || ! $force_missing);
+
+ # If we've already looked for it, we're done. You might
+ # wonder why we don't do this before searching for the
+ # file. If we do that, then something like
+ # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
+ # DIST_COMMON.
+ if (! $found_it)
+ {
+ return if defined $required_file_not_found{$fullfile};
+ $required_file_not_found{$fullfile} = 1;
+ }
+ if ($dangling_sym && $add_missing)
+ {
+ unlink ($fullfile);
+ }
+
+ my $trailer = '';
+ my $trailer2 = '';
+ my $suppress = 0;
+
+ # Only install missing files according to our desired
+ # strictness level.
+ my $message = "required file '$fullfile' not found";
+ if ($add_missing)
+ {
+ if (-f "$libdir/$file")
+ {
+ $suppress = 1;
+
+ # Install the missing file. Symlink if we
+ # can, copy if we must. Note: delete the file
+ # first, in case it is a dangling symlink.
+ $message = "installing '$fullfile'";
+
+ # The license file should not be volatile.
+ if ($file eq "COPYING")
+ {
+ $message .= " using GNU General Public License v3 file";
+ $trailer2 = "\n Consider adding the COPYING file"
+ . " to the version control system"
+ . "\n for your code, to avoid questions"
+ . " about which license your project uses";
+ }
+
+ # Windows Perl will hang if we try to delete a
+ # file that doesn't exist.
+ unlink ($fullfile) if -f $fullfile;
+ if ($symlink_exists && ! $copy_missing)
+ {
+ if (! symlink ("$libdir/$file", $fullfile)
+ || ! -e $fullfile)
+ {
+ $suppress = 0;
+ $trailer = "; error while making link: $!";
+ }
+ }
+ elsif (system ('cp', "$libdir/$file", $fullfile))
+ {
+ $suppress = 0;
+ $trailer = "\n error while copying";
+ }
+ set_dir_cache_file ($dir, $file);
+ }
+ }
+ else
+ {
+ $trailer = "\n 'automake --add-missing' can install '$file'"
+ if -f "$libdir/$file";
+ }
+
+ # If --force-missing was specified, and we have
+ # actually found the file, then do nothing.
+ return
+ if $found_it && $force_missing;
+
+ # If we couldn't install the file, but it is a target in
+ # the Makefile, don't print anything. This allows files
+ # like README, AUTHORS, or THANKS to be generated.
+ return
+ if !$suppress && rule $file;
+
+ msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
+}
+
+
+# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ---------------------------------------------------------------------
+# Verify that the file must exist in $DIRECTORY, or install it.
+# $MYSTRICT is the strictness level at which this file becomes required.
+# Worker threads may queue up the action to be serialized by the master,
+# if $QUEUE is true
+sub require_file_internal
+{
+ my ($where, $mystrict, $dir, $queue, @files) = @_;
+
+ return
+ unless $strictness >= $mystrict;
+
+ foreach my $file (@files)
+ {
+ push_required_file ($dir, $file, "$dir/$file");
+ if ($queue)
+ {
+ queue_required_file_check_or_copy ($required_conf_file_queue,
+ QUEUE_CONF_FILE, $relative_dir,
+ $where, $mystrict, @files);
+ }
+ else
+ {
+ required_file_check_or_copy ($where, $dir, $file);
+ }
+ }
+}
+
+# require_file ($WHERE, $MYSTRICT, @FILES)
+# ----------------------------------------
+sub require_file
+{
+ my ($where, $mystrict, @files) = @_;
+ require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
+}
+
+# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ----------------------------------------------------------
+sub require_file_with_macro
+{
+ my ($cond, $macro, $mystrict, @files) = @_;
+ $macro = rvar ($macro) unless ref $macro;
+ require_file ($macro->rdef ($cond)->location, $mystrict, @files);
+}
+
+# require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
+# Require an AC_LIBSOURCEd file. If AC_CONFIG_LIBOBJ_DIR was called, it
+# must be in that directory. Otherwise expect it in the current directory.
+sub require_libsource_with_macro
+{
+ my ($cond, $macro, $mystrict, @files) = @_;
+ $macro = rvar ($macro) unless ref $macro;
+ if ($config_libobj_dir)
+ {
+ require_file_internal ($macro->rdef ($cond)->location, $mystrict,
+ $config_libobj_dir, 0, @files);
+ }
+ else
+ {
+ require_file ($macro->rdef ($cond)->location, $mystrict, @files);
+ }
+}
+
+# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+# $MYSTRICT, @FILES)
+# --------------------------------------------------------------
+sub queue_required_file_check_or_copy
+{
+ my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
+ my @serial_loc;
+ if (ref $where)
+ {
+ @serial_loc = (QUEUE_LOCATION, $where->serialize ());
+ }
+ else
+ {
+ @serial_loc = (QUEUE_STRING, $where);
+ }
+ $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
+}
+
+# require_queued_file_check_or_copy ($QUEUE)
+# ------------------------------------------
+sub require_queued_file_check_or_copy
+{
+ my ($queue) = @_;
+ my $where;
+ my $dir = $queue->dequeue ();
+ my $loc_key = $queue->dequeue ();
+ if ($loc_key eq QUEUE_LOCATION)
+ {
+ $where = Automake::Location::deserialize ($queue);
+ }
+ elsif ($loc_key eq QUEUE_STRING)
+ {
+ $where = $queue->dequeue ();
+ }
+ else
+ {
+ prog_error "unexpected key $loc_key";
+ }
+ my $mystrict = $queue->dequeue ();
+ my $nfiles = $queue->dequeue ();
+ my @files;
+ push @files, $queue->dequeue ()
+ foreach (1 .. $nfiles);
+ return
+ unless $strictness >= $mystrict;
+ foreach my $file (@files)
+ {
+ required_file_check_or_copy ($where, $config_aux_dir, $file);
+ }
+}
+
+# require_conf_file ($WHERE, $MYSTRICT, @FILES)
+# ---------------------------------------------
+# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
+sub require_conf_file
+{
+ my ($where, $mystrict, @files) = @_;
+ my $queue = defined $required_conf_file_queue ? 1 : 0;
+ require_file_internal ($where, $mystrict, $config_aux_dir,
+ $queue, @files);
+}
+
+
+# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
+sub require_conf_file_with_macro
+{
+ my ($cond, $macro, $mystrict, @files) = @_;
+ require_conf_file (rvar ($macro)->rdef ($cond)->location,
+ $mystrict, @files);
+}
+
+################################################################
+
+# require_build_directory ($DIRECTORY)
+# ------------------------------------
+# Emit rules to create $DIRECTORY if needed, and return
+# the file that any target requiring this directory should be made
+# dependent upon.
+# We don't want to emit the rule twice, and want to reuse it
+# for directories with equivalent names (e.g., 'foo/bar' and './foo//bar').
+sub require_build_directory
+{
+ my $directory = shift;
+
+ return $directory_map{$directory} if exists $directory_map{$directory};
+
+ my $cdir = File::Spec->canonpath ($directory);
+
+ if (exists $directory_map{$cdir})
+ {
+ my $stamp = $directory_map{$cdir};
+ $directory_map{$directory} = $stamp;
+ return $stamp;
+ }
+
+ my $dirstamp = "$cdir/\$(am__dirstamp)";
+
+ $directory_map{$directory} = $dirstamp;
+ $directory_map{$cdir} = $dirstamp;
+
+ # Set a variable for the dirstamp basename.
+ define_pretty_variable ('am__dirstamp', TRUE, INTERNAL,
+ '$(am__leading_dot)dirstamp');
+
+ # Directory must be removed by 'make distclean'.
+ $clean_files{$dirstamp} = DIST_CLEAN;
+
+ $output_rules .= ("$dirstamp:\n"
+ . "\t\@\$(MKDIR_P) $directory\n"
+ . "\t\@: > $dirstamp\n");
+
+ return $dirstamp;
+}
+
+# require_build_directory_maybe ($FILE)
+# -------------------------------------
+# If $FILE lies in a subdirectory, emit a rule to create this
+# directory and return the file that $FILE should be made
+# dependent upon. Otherwise, just return the empty string.
+sub require_build_directory_maybe
+{
+ my $file = shift;
+ my $directory = dirname ($file);
+
+ if ($directory ne '.')
+ {
+ return require_build_directory ($directory);
+ }
+ else
+ {
+ return '';
+ }
+}
+
+################################################################
+
+# Push a list of files onto '@dist_common'.
+sub push_dist_common
+{
+ prog_error "push_dist_common run after handle_dist"
+ if $handle_dist_run;
+ Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_",
+ '', INTERNAL, VAR_PRETTY);
+}
+
+
+################################################################
+
+# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN)
+# ----------------------------------------------
+# Generate a Makefile.in given the name of the corresponding Makefile and
+# the name of the file output by config.status.
+sub generate_makefile
+{
+ my ($makefile_am, $makefile_in) = @_;
+
+ # Reset all the Makefile.am related variables.
+ initialize_per_input;
+
+ # AUTOMAKE_OPTIONS can contains -W flags to disable or enable
+ # warnings for this file. So hold any warning issued before
+ # we have processed AUTOMAKE_OPTIONS.
+ buffer_messages ('warning');
+
+ # $OUTPUT is encoded. If it contains a ":" then the first element
+ # is the real output file, and all remaining elements are input
+ # files. We don't scan or otherwise deal with these input files,
+ # other than to mark them as dependencies. See the subroutine
+ # 'scan_autoconf_files' for details.
+ my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in});
+
+ $relative_dir = dirname ($makefile);
+
+ read_main_am_file ($makefile_am, $makefile_in);
+ if (handle_options)
+ {
+ # Process buffered warnings.
+ flush_messages;
+ # Fatal error. Just return, so we can continue with next file.
+ return;
+ }
+ # Process buffered warnings.
+ flush_messages;
+
+ # There are a few install-related variables that you should not define.
+ foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL')
+ {
+ my $v = var $var;
+ if ($v)
+ {
+ my $def = $v->def (TRUE);
+ prog_error "$var not defined in condition TRUE"
+ unless $def;
+ reject_var $var, "'$var' should not be defined"
+ if $def->owner != VAR_AUTOMAKE;
+ }
+ }
+
+ # Catch some obsolete variables.
+ msg_var ('obsolete', 'INCLUDES',
+ "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')")
+ if var ('INCLUDES');
+
+ # Must do this after reading .am file.
+ define_variable ('subdir', $relative_dir, INTERNAL);
+
+ # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that
+ # recursive rules are enabled.
+ define_pretty_variable ('SUBDIRS', TRUE, INTERNAL, '')
+ if var 'DIST_SUBDIRS' && ! var 'SUBDIRS';
+
+ # Check first, because we might modify some state.
+ check_gnu_standards;
+ check_gnits_standards;
+
+ handle_configure ($makefile_am, $makefile_in, $makefile, @inputs);
+ handle_gettext;
+ handle_libraries;
+ handle_ltlibraries;
+ handle_programs;
+ handle_scripts;
+
+ handle_silent;
+
+ # These must be run after all the sources are scanned. They use
+ # variables defined by handle_libraries(), handle_ltlibraries(),
+ # or handle_programs().
+ handle_compile;
+ handle_languages;
+ handle_libtool;
+
+ # Variables used by distdir.am and tags.am.
+ define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources);
+ if (! option 'no-dist')
+ {
+ define_pretty_variable ('DIST_SOURCES', TRUE, INTERNAL, @dist_sources);
+ }
+
+ handle_texinfo;
+ handle_emacs_lisp;
+ handle_python;
+ handle_java;
+ handle_man_pages;
+ handle_data;
+ handle_headers;
+ handle_subdirs;
+ handle_user_recursion;
+ handle_tags;
+ handle_minor_options;
+ # Must come after handle_programs so that %known_programs is up-to-date.
+ handle_tests;
+
+ # This must come after most other rules.
+ handle_dist;
+
+ handle_footer;
+ do_check_merge_target;
+ handle_all ($makefile);
+
+ # FIXME: Gross!
+ if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
+ {
+ $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
+ }
+ if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
+ {
+ $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n";
+ }
+
+ handle_install;
+ handle_clean ($makefile);
+ handle_factored_dependencies;
+
+ # Comes last, because all the above procedures may have
+ # defined or overridden variables.
+ $output_vars .= output_variables;
+
+ check_typos;
+
+ if ($exit_code != 0)
+ {
+ verb "not writing $makefile_in because of earlier errors";
+ return;
+ }
+
+ my $am_relative_dir = dirname ($makefile_am);
+ mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir;
+
+ # We make sure that 'all:' is the first target.
+ my $output =
+ "$output_vars$output_all$output_header$output_rules$output_trailer";
+
+ # Decide whether we must update the output file or not.
+ # We have to update in the following situations.
+ # * $force_generation is set.
+ # * any of the output dependencies is younger than the output
+ # * the contents of the output is different (this can happen
+ # if the project has been populated with a file listed in
+ # @common_files since the last run).
+ # Output's dependencies are split in two sets:
+ # * dependencies which are also configure dependencies
+ # These do not change between each Makefile.am
+ # * other dependencies, specific to the Makefile.am being processed
+ # (such as the Makefile.am itself, or any Makefile fragment
+ # it includes).
+ my $timestamp = mtime $makefile_in;
+ if (! $force_generation
+ && $configure_deps_greatest_timestamp < $timestamp
+ && $output_deps_greatest_timestamp < $timestamp
+ && $output eq contents ($makefile_in))
+ {
+ verb "$makefile_in unchanged";
+ # No need to update.
+ return;
+ }
+
+ if (-e $makefile_in)
+ {
+ unlink ($makefile_in)
+ or fatal "cannot remove $makefile_in: $!";
+ }
+
+ my $gm_file = new Automake::XFile "> $makefile_in";
+ verb "creating $makefile_in";
+ print $gm_file $output;
+}
+
+
+################################################################
+
+
+# Helper function for usage().
+sub print_autodist_files
+{
+ # NOTE: we need to call our 'uniq' function with the leading '&'
+ # here, because otherwise perl complains that "Unquoted string
+ # 'uniq' may clash with future reserved word".
+ my @lcomm = sort (&uniq (@_));
+
+ my @four;
+ format USAGE_FORMAT =
+ @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<
+ $four[0], $four[1], $four[2], $four[3]
+.
+ local $~ = "USAGE_FORMAT";
+
+ my $cols = 4;
+ my $rows = int(@lcomm / $cols);
+ my $rest = @lcomm % $cols;
+
+ if ($rest)
+ {
+ $rows++;
+ }
+ else
+ {
+ $rest = $cols;
+ }
+
+ for (my $y = 0; $y < $rows; $y++)
+ {
+ @four = ("", "", "", "");
+ for (my $x = 0; $x < $cols; $x++)
+ {
+ last if $y + 1 == $rows && $x == $rest;
+
+ my $idx = (($x > $rest)
+ ? ($rows * $rest + ($rows - 1) * ($x - $rest))
+ : ($rows * $x));
+
+ $idx += $y;
+ $four[$x] = $lcomm[$idx];
+ }
+ write;
+ }
+}
+
+
+sub usage ()
+{
+ print "Usage: $0 [OPTION]... [Makefile]...
+
+Generate Makefile.in for configure from Makefile.am.
+
+Operation modes:
+ --help print this help, then exit
+ --version print version number, then exit
+ -v, --verbose verbosely list files processed
+ --no-force only update Makefile.in's that are out of date
+ -W, --warnings=CATEGORY report the warnings falling in CATEGORY
+
+Dependency tracking:
+ -i, --ignore-deps disable dependency tracking code
+ --include-deps enable dependency tracking code
+
+Flavors:
+ --foreign set strictness to foreign
+ --gnits set strictness to gnits
+ --gnu set strictness to gnu
+
+Library files:
+ -a, --add-missing add missing standard files to package
+ --libdir=DIR set directory storing library files
+ --print-libdir print directory storing library files
+ -c, --copy with -a, copy missing files (default is symlink)
+ -f, --force-missing force update of standard files
+
+";
+ Automake::ChannelDefs::usage;
+
+ print "\nFiles automatically distributed if found " .
+ "(always):\n";
+ print_autodist_files @common_files;
+ print "\nFiles automatically distributed if found " .
+ "(under certain conditions):\n";
+ print_autodist_files @common_sometimes;
+
+ print '
+Report bugs to <@PACKAGE_BUGREPORT@>.
+GNU Automake home page: <@PACKAGE_URL@>.
+General help using GNU software: .
+';
+
+ # --help always returns 0 per GNU standards.
+ exit 0;
+}
+
+
+sub version ()
+{
+ print <
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Tom Tromey
+ and Alexandre Duret-Lutz .
+EOF
+ # --version always returns 0 per GNU standards.
+ exit 0;
+}
+
+################################################################
+
+# Parse command line.
+sub parse_arguments ()
+{
+ my $strict = 'gnu';
+ my $ignore_deps = 0;
+ my @warnings = ();
+
+ my %cli_options =
+ (
+ 'version' => \&version,
+ 'help' => \&usage,
+ 'libdir=s' => \$libdir,
+ 'print-libdir' => sub { print "$libdir\n"; exit 0; },
+ 'gnu' => sub { $strict = 'gnu'; },
+ 'gnits' => sub { $strict = 'gnits'; },
+ 'foreign' => sub { $strict = 'foreign'; },
+ 'include-deps' => sub { $ignore_deps = 0; },
+ 'i|ignore-deps' => sub { $ignore_deps = 1; },
+ 'no-force' => sub { $force_generation = 0; },
+ 'f|force-missing' => \$force_missing,
+ 'a|add-missing' => \$add_missing,
+ 'c|copy' => \$copy_missing,
+ 'v|verbose' => sub { setup_channel 'verb', silent => 0; },
+ 'W|warnings=s' => \@warnings,
+ );
+
+ use Automake::Getopt ();
+ Automake::Getopt::parse_options %cli_options;
+
+ set_strictness ($strict);
+ my $cli_where = new Automake::Location;
+ set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
+ for my $warning (@warnings)
+ {
+ parse_warnings ('-W', $warning);
+ }
+
+ return unless @ARGV;
+
+ my $errspec = 0;
+ foreach my $arg (@ARGV)
+ {
+ fatal ("empty argument\nTry '$0 --help' for more information")
+ if ($arg eq '');
+
+ # Handle $local:$input syntax.
+ my ($local, @rest) = split (/:/, $arg);
+ @rest = ("$local.in",) unless @rest;
+ my $input = locate_am @rest;
+ if ($input)
+ {
+ push @input_files, $input;
+ $output_files{$input} = join (':', ($local, @rest));
+ }
+ else
+ {
+ error "no Automake input file found for '$arg'";
+ $errspec = 1;
+ }
+ }
+ fatal "no input file found among supplied arguments"
+ if $errspec && ! @input_files;
+}
+
+
+# handle_makefile ($MAKEFILE)
+# ---------------------------
+sub handle_makefile
+{
+ my ($file) = @_;
+ ($am_file = $file) =~ s/\.in$//;
+ if (! -f ($am_file . '.am'))
+ {
+ error "'$am_file.am' does not exist";
+ }
+ else
+ {
+ # Any warning setting now local to this Makefile.am.
+ dup_channel_setup;
+
+ generate_makefile ($am_file . '.am', $file);
+
+ # Back out any warning setting.
+ drop_channel_setup;
+ }
+}
+
+# Deal with all makefiles, without threads.
+sub handle_makefiles_serial ()
+{
+ foreach my $file (@input_files)
+ {
+ handle_makefile ($file);
+ }
+}
+
+# Logic for deciding how many worker threads to use.
+sub get_number_of_threads ()
+{
+ my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
+
+ $nthreads = 0
+ unless $nthreads =~ /^[0-9]+$/;
+
+ # It doesn't make sense to use more threads than makefiles,
+ my $max_threads = @input_files;
+
+ if ($nthreads > $max_threads)
+ {
+ $nthreads = $max_threads;
+ }
+ return $nthreads;
+}
+
+# handle_makefiles_threaded ($NTHREADS)
+# -------------------------------------
+# Deal with all makefiles, using threads. The general strategy is to
+# spawn NTHREADS worker threads, dispatch makefiles to them, and let the
+# worker threads push back everything that needs serialization:
+# * warning and (normal) error messages, for stable stderr output
+# order and content (avoiding duplicates, for example),
+# * races when installing aux files (and respective messages),
+# * races when collecting aux files for distribution.
+#
+# The latter requires that the makefile that deals with the aux dir
+# files be handled last, done by the master thread.
+sub handle_makefiles_threaded
+{
+ my ($nthreads) = @_;
+
+ # The file queue distributes all makefiles, the message queues
+ # collect all serializations needed for respective files.
+ my $file_queue = Thread::Queue->new;
+ my %msg_queues;
+ foreach my $file (@input_files)
+ {
+ $msg_queues{$file} = Thread::Queue->new;
+ }
+
+ verb "spawning $nthreads worker threads";
+ my @threads = (1 .. $nthreads);
+ foreach my $t (@threads)
+ {
+ $t = threads->new (sub
+ {
+ while (my $file = $file_queue->dequeue)
+ {
+ verb "handling $file";
+ my $queue = $msg_queues{$file};
+ setup_channel_queue ($queue, QUEUE_MESSAGE);
+ $required_conf_file_queue = $queue;
+ handle_makefile ($file);
+ $queue->enqueue (undef);
+ setup_channel_queue (undef, undef);
+ $required_conf_file_queue = undef;
+ }
+ return $exit_code;
+ });
+ }
+
+ # Queue all makefiles.
+ verb "queuing " . @input_files . " input files";
+ $file_queue->enqueue (@input_files, (undef) x @threads);
+
+ # Collect and process serializations.
+ foreach my $file (@input_files)
+ {
+ verb "dequeuing messages for " . $file;
+ reset_local_duplicates ();
+ my $queue = $msg_queues{$file};
+ while (my $key = $queue->dequeue)
+ {
+ if ($key eq QUEUE_MESSAGE)
+ {
+ pop_channel_queue ($queue);
+ }
+ elsif ($key eq QUEUE_CONF_FILE)
+ {
+ require_queued_file_check_or_copy ($queue);
+ }
+ else
+ {
+ prog_error "unexpected key $key";
+ }
+ }
+ }
+
+ foreach my $t (@threads)
+ {
+ my @exit_thread = $t->join;
+ $exit_code = $exit_thread[0]
+ if ($exit_thread[0] > $exit_code);
+ }
+}
+
+################################################################
+
+# Parse the WARNINGS environment variable.
+parse_WARNINGS;
+
+# Parse command line.
+parse_arguments;
+
+$configure_ac = require_configure_ac;
+
+# Do configure.ac scan only once.
+scan_autoconf_files;
+
+if (! @input_files)
+ {
+ my $msg = '';
+ $msg = "\nDid you forget AC_CONFIG_FILES([Makefile]) in $configure_ac?"
+ if -f 'Makefile.am';
+ fatal ("no 'Makefile.am' found for any configure output$msg");
+ }
+
+my $nthreads = get_number_of_threads ();
+
+if ($perl_threads && $nthreads >= 1)
+ {
+ handle_makefiles_threaded ($nthreads);
+ }
+else
+ {
+ handle_makefiles_serial ();
+ }
+
+exit $exit_code;
+
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/bin/gen-perl-protos b/bin/gen-perl-protos
new file mode 100755
index 000000000..9e73d8d7a
--- /dev/null
+++ b/bin/gen-perl-protos
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+#
+# Copyright (C) 2013 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, 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 .
+
+use warnings;
+use strict;
+
+my @lines = <>;
+my @protos = map { /^(sub \w+\s*\(.*\))/ ? ("$1;") : () } @lines;
+
+while (defined ($_ = shift @lines))
+ {
+ if (/^#!.* prototypes/i)
+ {
+ print "# BEGIN AUTOMATICALLY GENERATED PROTOTYPES\n";
+ print join ("\n", sort @protos) . "\n";
+ print "# END AUTOMATICALLY GENERATED PROTOTYPES\n";
+ }
+ else
+ {
+ print;
+ }
+ }
diff --git a/bootstrap.sh b/bootstrap.sh
index 541280ee0..5add98a93 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -99,9 +99,9 @@ dosubst automake-$APIVERSION/Automake/Config.in \
dosubst m4/amversion.in m4/amversion.m4
# Create temporary replacement for aclocal and automake.
-for p in aclocal automake; do
+for p in bin/aclocal bin/automake; do
dosubst $p.in $p.tmp
- $PERL -w lib/gen-perl-protos $p.tmp > $p.tmp2
+ $PERL -w bin/gen-perl-protos $p.tmp > $p.tmp2
mv -f $p.tmp2 $p.tmp
done
@@ -113,11 +113,11 @@ mv -f t/testsuite-part.tmp t/testsuite-part.am
# Run the autotools. Bail out if any warning is triggered.
# Use '-I' here so that our own *.m4 files in m4/ gets included,
# not copied, in aclocal.m4.
-$PERL ./aclocal.tmp -Wall -Werror -I m4 \
- --automake-acdir=m4 --system-acdir=m4/acdir
+$PERL ./bin/aclocal.tmp -Wall -Werror -I m4 \
+ --automake-acdir=m4 --system-acdir=m4/acdir
$AUTOCONF -Wall -Werror
-$PERL ./automake.tmp -Wall -Werror
+$PERL ./bin/automake.tmp -Wall -Werror
# Remove temporary files and directories.
rm -rf aclocal-$APIVERSION automake-$APIVERSION
-rm -f aclocal.tmp automake.tmp
+rm -f bin/aclocal.tmp bin/automake.tmp
diff --git a/configure.ac b/configure.ac
index 043b46795..1a0620ff0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@
AC_PREREQ([2.69])
AC_INIT([GNU Automake], [1.13a], [bug-automake@gnu.org])
-AC_CONFIG_SRCDIR([automake.in])
+AC_CONFIG_SRCDIR([bin/automake.in])
AC_CONFIG_AUX_DIR([lib])
AM_SILENT_RULES([yes])
diff --git a/doc/Makefile.inc b/doc/Makefile.inc
index 8515a5d5a..dd477d6f9 100644
--- a/doc/Makefile.inc
+++ b/doc/Makefile.inc
@@ -46,9 +46,9 @@ update_mans = \
&& f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \
&& echo ".so man1/$$f-$(APIVERSION).1" > $@
-%D%/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm
+%D%/aclocal-$(APIVERSION).1: $(aclocal_script) lib/Automake/Config.pm
$(update_mans) aclocal-$(APIVERSION)
-%D%/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm
+%D%/automake-$(APIVERSION).1: $(automake_script) lib/Automake/Config.pm
$(update_mans) automake-$(APIVERSION)
## ---------------------------- ##
diff --git a/lib/gen-perl-protos b/lib/gen-perl-protos
deleted file mode 100755
index 9e73d8d7a..000000000
--- a/lib/gen-perl-protos
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env perl
-#
-# Copyright (C) 2013 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, 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 .
-
-use warnings;
-use strict;
-
-my @lines = <>;
-my @protos = map { /^(sub \w+\s*\(.*\))/ ? ("$1;") : () } @lines;
-
-while (defined ($_ = shift @lines))
- {
- if (/^#!.* prototypes/i)
- {
- print "# BEGIN AUTOMATICALLY GENERATED PROTOTYPES\n";
- print join ("\n", sort @protos) . "\n";
- print "# END AUTOMATICALLY GENERATED PROTOTYPES\n";
- }
- else
- {
- print;
- }
- }
diff --git a/maintainer/rename-tests b/maintainer/rename-tests
index a58474862..28963fa37 100755
--- a/maintainer/rename-tests
+++ b/maintainer/rename-tests
@@ -30,7 +30,7 @@ esac
AWK=${AWK-awk}
SED=${SED-sed}
-[[ -f automake.in && -d lib/Automake ]] \
+[[ -f bin/automake.in && -d lib/Automake ]] \
|| fatal "can only be run from the top-level of the Automake source tree"
$SED --version 2>&1 | grep GNU >/dev/null 2>&1 \
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index ab316cb15..61fcef3b9 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -85,17 +85,19 @@ sc_at_in_texi
## aclocal.
automake_diff_no = 8
aclocal_diff_no = 9
+sc_diff_automake sc_diff_aclocal: in=$($*_in)
+sc_diff_automake sc_diff_aclocal: out=$($*_script)
sc_diff_automake sc_diff_aclocal: sc_diff_% :
@set +e; \
in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \
- && sed '/^#!.*[pP]rototypes/d' $(srcdir)/$*.in > $$in \
- && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $* > $$out \
+ && sed '/^#!.*[pP]rototypes/d' $(in) > $$in \
+ && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $(out) > $$out \
&& { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \
&& added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \
&& removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \
&& test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
|| { \
- echo "Found unexpected diffs between $*.in and $*"; \
+ echo "Found unexpected diffs between $(in) and $(out)"; \
echo "Lines added: $$added" ; \
echo "Lines removed: $$removed"; \
cat $$diffs; \
@@ -150,22 +152,22 @@ sc_pre_normal_post_install_uninstall:
## We never want to use "undef", only "delete", but for $/.
sc_perl_no_undef:
- @if grep -n -w 'undef ' $(srcdir)/automake.in | \
+ @if grep -n -w 'undef ' $(automake_in) | \
grep -F -v 'undef $$/'; then \
- echo "Found undef in automake.in; use delete instead" 1>&2; \
+ echo "Found 'undef' in the lines above; use 'delete' instead" 1>&2; \
exit 1; \
fi
## We never want split (/ /,...), only split (' ', ...).
sc_perl_no_split_regex_space:
- @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
+ @if grep -n 'split (/ /' $(automake_in) $(acloca_in); then \
echo "Found bad split in the lines above." 1>&2; \
exit 1; \
fi
## Look for cd within backquotes
sc_cd_in_backquotes:
- @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
+ @if grep -n '^[^#]*` *cd ' $(automake_in) $(ams); then \
echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
exit 1; \
fi
@@ -173,7 +175,7 @@ sc_cd_in_backquotes:
## Look for cd to a relative directory (may be influenced by CDPATH).
## Skip some known directories that are OK.
sc_cd_relative_dir:
- @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
+ @if grep -n '^[^#]*cd ' $(automake_in) $(ams) | \
grep -v 'echo.*cd ' | \
grep -v 'am__cd =' | \
grep -v '^[^#]*cd [./]' | \
@@ -187,22 +189,24 @@ sc_cd_relative_dir:
## Using @_ in a scalar context is most probably a programming error.
sc_perl_at_uscore_in_scalar_context:
- @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
+ @if grep -Hn '[^%@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' \
+ $(automake_in) $(aclocal_in); then \
echo "Using @_ in a scalar context in the lines above." 1>&2; \
exit 1; \
fi
-## Allow only few variables to be localized in Automake.
+## Allow only few variables to be localized in automake and aclocal.
sc_perl_local:
- @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
- grep '^[ \t]*local [^*]'; then \
+ @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' \
+ $(automake_in) $(aclocal_in) | \
+ grep '^[ \t]*local [^*]'; then \
echo "Please avoid 'local'." 1>&2; \
exit 1; \
fi
## Don't let AMDEP_TRUE substitution appear in automake.in.
sc_AMDEP_TRUE_in_automake_in:
- @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
+ @if grep '@AMDEP''_TRUE@' $(automake_in); then \
echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
exit 1; \
fi
@@ -210,7 +214,7 @@ sc_AMDEP_TRUE_in_automake_in:
## Recursive make invocations should always pass $(AM_MAKEFLAGS)
## to $(MAKE), for portability to non-GNU make.
sc_tests_make_without_am_makeflags:
- @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
+ @if grep '^[^#].*(MAKE) ' $(ams) $(automake_in) \
| grep -v 'AM_MAKEFLAGS' \
| grep -v '/am/header-vars\.am:.*am--echo.*| $$(MAKE) -f *-'; \
then \
@@ -532,7 +536,7 @@ sc_at_in_texi:
exit 1; \
fi
-$(syntax_check_rules): automake aclocal
+$(syntax_check_rules): bin/automake bin/aclocal
maintainer-check: $(syntax_check_rules)
.PHONY: maintainer-check $(syntax_check_rules)
diff --git a/t/ax/tap-setup.sh b/t/ax/tap-setup.sh
index 6955c86a0..3c992a388 100644
--- a/t/ax/tap-setup.sh
+++ b/t/ax/tap-setup.sh
@@ -22,7 +22,7 @@
# Check that we are running from a proper directory: last thing we want
# is to overwrite some random user files.
-test -f ../../automake && test -f ../../runtest && test -d ../../t \
+test -f ../../bin/automake && test -f ../../runtest && test -d ../../t \
|| fatal_ "running from a wrong directory"
test ! -f Makefile.am || mv Makefile.am Makefile.am~ \
diff --git a/t/wrap/aclocal.in b/t/wrap/aclocal.in
index 3e60eb01e..cdcae1a88 100644
--- a/t/wrap/aclocal.in
+++ b/t/wrap/aclocal.in
@@ -26,4 +26,4 @@ BEGIN
'--automake-acdir=@abs_top_srcdir@/m4',
'--system-acdir=@abs_top_srcdir@/m4/acdir';
}
-require '@abs_top_builddir@/aclocal';
+require '@abs_top_builddir@/bin/aclocal';
diff --git a/t/wrap/automake.in b/t/wrap/automake.in
index bc6eab61b..cf18d7b24 100644
--- a/t/wrap/automake.in
+++ b/t/wrap/automake.in
@@ -24,4 +24,4 @@ BEGIN
if '@srcdir@' ne '.';
unshift @ARGV, '--libdir=@abs_top_srcdir@/lib';
}
-require '@abs_top_builddir@/automake';
+require '@abs_top_builddir@/bin/automake';
--
cgit v1.2.1
From 560702945f154bbaa595da3da88a9b6770b026d2 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 9 May 2013 19:50:38 +0200
Subject: tests: avoid spurious failure with older flex (2.5.4)
That old version is unfortunately still relevant, being the one
installed on NetBSD 5.1.
* t/lex-multiple.sh: Use the '-o' option rather than the longer
equivalent '--outfile'. The latter is not supported by older
versions of flex (e.g., flex 2.5.4).
Signed-off-by: Stefano Lattarini
---
t/lex-multiple.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index e1c71a1ab..575995964 100755
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -43,11 +43,11 @@ liblex_a_SOURCES = 0.l
# We need the output to always be named 'lex.yy.c', in order for
# ylwrap to pick it up.
-liblex_foo_a_LFLAGS = -Pfoo --outfile=lex.yy.c
+liblex_foo_a_LFLAGS = -Pfoo -olex.yy.c
liblex_foo_a_SOURCES = a.l
# Ditto.
-liblex_bar_a_LFLAGS = -Pbar_ --outfile=lex.yy.c
+liblex_bar_a_LFLAGS = -Pbar_ -olex.yy.c
liblex_bar_a_SOURCES = b.l
END
--
cgit v1.2.1
From 1021f5cf48784b6ed6b28834f14485b52b4c80e3 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 9 May 2013 20:13:19 +0200
Subject: maint: re-run "make update-copyright" ...
* t/lex-multiple.sh: ... which updates the copyright years
of this test (they were somehow not bumped in the past).
Signed-off-by: Stefano Lattarini
---
t/lex-multiple.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index 575995964..7383eaf2d 100755
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2012-2013 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
--
cgit v1.2.1
From 126cd5242844fa9511cb6709fc5df72bf1851d14 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 10:57:38 +0200
Subject: am: prefer a shorter idiom where possible
That is, prefer:
test -f FILE || do_action
over:
if test ! -f FILE; then do_action; else :; fi
* lib/am/remake-hdr.am (%CONFIG_H%): Here.
Signed-off-by: Stefano Lattarini
---
lib/am/remake-hdr.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/am/remake-hdr.am b/lib/am/remake-hdr.am
index 1703b01de..979427d41 100644
--- a/lib/am/remake-hdr.am
+++ b/lib/am/remake-hdr.am
@@ -16,8 +16,8 @@
%CONFIG_H%: %STAMP%
## Recover from removal of CONFIG_HEADER.
- @if test ! -f $@; then rm -f %STAMP%; else :; fi
- @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) %STAMP%; else :; fi
+ @test -f $@ || rm -f %STAMP%
+ @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) %STAMP%
%STAMP%: %CONFIG_H_DEPS% $(top_builddir)/config.status
--
cgit v1.2.1
From 780299d96327ac43de44e38173c0162ed2c10474 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 19:22:06 +0200
Subject: dist: deprecated shar and tar+compress formats
See also discussion about automake wishlist bug#13324.
* lib/Automake/Options.pm: Give proper warnings in the 'obsolete'
category if the 'dist-shar' or 'dist-tarZ' options are used.
* lib/distdir.am: When the 'dist-tarZ' or 'dist-shar' targets are
invoked, make them give a non-fatal warning.
* doc/automake.texi: Report the new deprecations.
* t/dist-shar.sh: New test.
* t/dist-tarZ.sh: Likewise.
* t/lzma.sh: While at it, rename ...
* t/dist-lzma.sh: ... like this, and tweak it to keep more in
sync with the new tests.
* t/dist-formats.tap: Remove references to deprecated formats.
* t/list-of-tests.mk: Adjust.
Signed-off-by: Stefano Lattarini
---
doc/automake.texi | 19 ++++++++++------
lib/Automake/Options.pm | 17 ++++++++++++--
lib/am/distdir.am | 6 +++++
t/dist-formats.tap | 50 +++++++++++++++++------------------------
t/dist-lzma.sh | 41 ++++++++++++++++++++++++++++++++++
t/dist-shar.sh | 47 +++++++++++++++++++++++++++++++++++++++
t/dist-tarZ.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
t/list-of-tests.mk | 4 +++-
t/lzma.sh | 41 ----------------------------------
9 files changed, 203 insertions(+), 81 deletions(-)
create mode 100755 t/dist-lzma.sh
create mode 100755 t/dist-shar.sh
create mode 100755 t/dist-tarZ.sh
delete mode 100755 t/lzma.sh
diff --git a/doc/automake.texi b/doc/automake.texi
index 8b5125e2b..b7ae70969 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8706,13 +8706,16 @@ Generate a @samp{zip} archive of the distribution.
@item @code{dist-tarZ}
Generate a tar archive of the distribution, compressed with the
-historical (obsolescent) program @command{compress}. Use of this
-option is discouraged.
+historical (and obsolescent) program @command{compress}. This
+option is deprecated, and it and the corresponding functionality
+will be removed altogether in Automake 2.0.
@trindex dist-tarZ
@item @code{dist-shar}
-Generate a @samp{shar} archive of the distribution. This format archive
-is obsolescent, and use of this option is discouraged.
+Generate a @samp{shar} archive of the distribution. This format
+archive is obsolescent, and use of this option is deprecated.
+It and the corresponding functionality will be removed altogether
+in Automake 2.0.
@trindex dist-shar
@end table
@@ -10108,15 +10111,17 @@ Hook @code{dist-zip} to @code{dist}.
@cindex Option, @option{dist-shar}
@opindex dist-shar
Hook @code{dist-shar} to @code{dist}. Use of this option
-is discouraged, as the @samp{shar} format is obsolescent and
-problematic.
+is deprecated, as the @samp{shar} format is obsolescent and
+problematic. Support for it will be removed altogether in
+Automake 2.0.
@trindex dist-shar
@item @option{dist-tarZ}
@cindex Option, @option{dist-tarZ}
@opindex dist-tarZ
Hook @code{dist-tarZ} to @code{dist}. Use of this option
-is discouraged, as the @samp{compress} program is obsolete.
+is deprecated, as the @samp{compress} program is obsolete.
+Support for it will be removed altogether in Automake 2.0.
@trindex dist-tarZ
@item @option{filename-length-max=99}
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index e3f551a43..737d2a170 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -272,8 +272,6 @@ sub _is_valid_easy_option ($)
dejagnu
dist-bzip2
dist-lzip
- dist-shar
- dist-tarZ
dist-xz
dist-zip
info-in-builddir
@@ -334,6 +332,21 @@ sub _process_option_list (\%@)
error ($where, "support for lzma-compressed distribution " .
"archives has been removed");
}
+ # TODO: Make this a fatal error in Automake 2.0.
+ elsif ($_ eq 'dist-shar')
+ {
+ msg ('obsolete', $where,
+ "support for shar distribution archives is deprecated.\n" .
+ " It will be removed in Automake 2.0");
+ }
+ # TODO: Make this a fatal error in Automake 2.0.
+ elsif ($_ eq 'dist-tarZ')
+ {
+ msg ('obsolete', $where,
+ "support for distribution archives compressed with " .
+ "legacy program 'compress' is deprecated.\n" .
+ " It will be removed in Automake 2.0");
+ }
elsif (/^filename-length-max=(\d+)$/)
{
delete $options->{$_};
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index e5d8d5ea9..0e5f6bdb9 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -339,12 +339,18 @@ dist-xz: distdir
?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
.PHONY: dist-tarZ
dist-tarZ: distdir
+ @echo WARNING: "Support for shar distribution archives is" \
+ "deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__post_remove_distdir)
?SHAR?DIST_ARCHIVES += $(distdir).shar.gz
.PHONY: dist-shar
dist-shar: distdir
+ @echo WARNING: "Support for distribution archives compressed with" \
+ "legacy program 'compress' is deprecated." >&2
+ @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir)
diff --git a/t/dist-formats.tap b/t/dist-formats.tap
index 730fa5d07..bebac374d 100755
--- a/t/dist-formats.tap
+++ b/t/dist-formats.tap
@@ -20,7 +20,7 @@
am_create_testdir=empty
. test-init.sh
-plan_ 70
+plan_ 66
# ---------------------------------------------------- #
# Common and/or auxiliary subroutines and variables. #
@@ -56,12 +56,10 @@ setup_vars_for_compression_format ()
suffix=NONE compressor=NONE
case $1 in
gzip) suffix=tar.gz compressor=gzip ;;
- tarZ) suffix=tar.Z compressor=compress ;;
lzip) suffix=tar.lz compressor=lzip ;;
xz) suffix=tar.xz compressor=xz ;;
bzip2) suffix=tar.bz2 compressor=bzip2 ;;
zip) suffix=zip compressor=zip ;;
- shar) suffix=shar.gz compressor=shar ;;
*) fatal_ "invalid compression format '$1'";;
esac
}
@@ -73,20 +71,6 @@ have_compressor ()
# Assume gzip(1) is available on every reasonable portability target.
gzip)
return 0;;
- # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
- # and is just a dummy script that is not able to actually compress
- # (it can only decompress). So, check that the 'compress' program
- # is actually able to compress input.
- # Note that, at least on GNU/Linux, 'compress' does (and is
- # documented to) exit with status 2 if the output is larger than
- # the input after (attempted) compression; so we need to pass it
- # an input that it can actually reduce in size when compressing.
- compress)
- for x in 1 2 3 4 5 6 7 8; do
- echo aaaaaaaaaaaaaaaaaaaaa
- done | compress -c >/dev/null && return 0
- return 1
- ;;
*)
case $1 in
# Do not use --version, or older versions bzip2 would try to
@@ -113,7 +97,7 @@ have_compressor ()
fatal_ "have_compressor(): dead code reached"
}
-all_compression_formats='gzip tarZ lzip xz bzip2 zip shar'
+all_compression_formats='gzip lzip xz bzip2 zip'
all_compressors=$(
for x in $all_compression_formats; do
@@ -305,7 +289,7 @@ END
nogzip in am and bzip2 in am
nogzip in ac and xz in am
nogzip in am and lzip in ac
-nogzip in ac and tarZ in ac
+nogzip in ac and zip in ac
# ----------------------------------------------------------- #
@@ -324,13 +308,13 @@ end_subtest
# Parallel compression. #
# ----------------------- #
-# We only use formats requiring 'gzip', 'bzip2' and 'compress' programs,
-# since there are the most likely to be all found on the great majority
+# We only use formats requiring 'gzip', 'bzip2' and 'xz' programs,
+# since there are the most likely to be all found on the majority
# of systems.
-start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-tarZ
+start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-xz
-desc=gzip+bzip2+tarZ
+desc=gzip+bzip2+xz
tarname=parallel-compression-1.0
check_tarball ()
@@ -353,11 +337,17 @@ check_tarball ()
command_ok_ "$desc [automake]" $AUTOMAKE
-skip_reason=
-have_compressor compress || skip_reason="'compress' not available"
-have_compressor bzip2 || skip_reason="'bzip2' not available"
+if ! have_compressor xz && ! have_compressor bzip2; then
+ skip_reason="both 'bzip2' and 'xz' are unavailable"
+elif ! have_compressor xz; then
+ skip_reason="'xz' not available"
+elif ! have_compressor bzip2; then
+ skip_reason="'bzip2' not available"
+else
+ skip_reason=
+fi
if test "$MAKE_j4" = false; then
- test -z "$skip_reason" || skip_reason="$skip_reason and "
+ test -z "$skip_reason" || skip_reason="$skip_reason, and "
skip_reason="${skip_reason}make concurrency unavailable"
fi
@@ -370,7 +360,7 @@ else
ls -l # For debugging.
command_ok_ "$desc [check .tar.gz tarball]" check_tarball gzip
command_ok_ "$desc [check .tar.bz2 tarball]" check_tarball bzip2
- command_ok_ "$desc [check .tar.Z tarball]" check_tarball tarZ
+ command_ok_ "$desc [check .tar.xz tarball]" check_tarball xz
fi
unset tarname desc skip_reason
@@ -445,8 +435,8 @@ END
chmod a+x check-distdir grep-distdir-error
for prog in tar $all_compressors; do
case $prog in
- tar|shar|zip) cp check-distdir $prog;;
- *) cp grep-distdir-error $prog;;
+ tar|zip) cp check-distdir $prog;;
+ *) cp grep-distdir-error $prog;;
esac
done
unset prog
diff --git a/t/dist-lzma.sh b/t/dist-lzma.sh
new file mode 100755
index 000000000..d1d3e4b67
--- /dev/null
+++ b/t/dist-lzma.sh
@@ -0,0 +1,41 @@
+#! /bin/sh
+# Copyright (C) 2003-2013 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 2, 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 .
+
+# Check support for no-dist-gzip with lzma.
+
+. test-init.sh
+
+errmsg='support for lzma.*removed'
+
+echo AUTOMAKE_OPTIONS = dist-lzma > Makefile.am
+$ACLOCAL --force
+AUTOMAKE_fails -Wnone -Wno-error
+grep "^Makefile\\.am:1:.*$errmsg" stderr
+
+cat > configure.ac < Makefile.am
+
+rm -rf autom4te*.cache
+$ACLOCAL
+AUTOMAKE_fails -Wnone -Wno-error
+grep "^configure\\.ac:2:.*$errmsg" stderr
+
+:
diff --git a/t/dist-shar.sh b/t/dist-shar.sh
new file mode 100755
index 000000000..cd0442552
--- /dev/null
+++ b/t/dist-shar.sh
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Check support for no-dist-gzip with dist-shar.
+
+required=shar
+. test-init.sh
+
+errmsg='support for shar .*deprecated'
+
+echo AUTOMAKE_OPTIONS = dist-shar > Makefile.am
+$ACLOCAL
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\\.am:1:.*$errmsg" stderr
+
+cat > configure.ac < Makefile.am
+
+rm -rf autom4te*.cache
+$ACLOCAL
+AUTOMAKE_run -Wno-error
+grep "^configure\\.ac:2:.*$errmsg" stderr
+
+$AUTOCONF
+./configure
+$MAKE distcheck
+test -f $distdir.shar.gz
+
+:
diff --git a/t/dist-tarZ.sh b/t/dist-tarZ.sh
new file mode 100755
index 000000000..f27648166
--- /dev/null
+++ b/t/dist-tarZ.sh
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2013 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 2, 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 .
+
+# Check support for no-dist-gzip with dist-tarZ.
+
+. test-init.sh
+
+# On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
+# and is just a dummy script that is not able to actually compress
+# (it can only decompress). So, check that the 'compress' program
+# is actually able to compress input.
+# Note that, at least on GNU/Linux, 'compress' does (and is
+# documented to) exit with status 2 if the output is larger than
+# the input after (attempted) compression; so we need to pass it
+# an input that it can actually reduce in size when compressing.
+for x in 1 2 3 4 5 6 7 8; do
+ echo aaaaaaaaaaaaaaaaaaaaa
+done | compress -c >/dev/null \
+ || skip_ "cannot find a working 'compress' program"
+
+errmsg=".*legacy .*'compress' .*deprecated"
+
+echo AUTOMAKE_OPTIONS = dist-tarZ > Makefile.am
+$ACLOCAL
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\\.am:1:.*$errmsg" stderr
+
+cat > configure.ac < Makefile.am
+
+rm -rf autom4te*.cache
+$ACLOCAL
+AUTOMAKE_run -Wno-error
+grep "^configure\\.ac:2:.*$errmsg" stderr
+
+$AUTOCONF
+./configure
+$MAKE distcheck
+test -f dist-tarz-1.0.tar.Z
+
+:
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index b8cc5923a..ce3639cb1 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -384,6 +384,9 @@ t/destdir.sh \
t/dir-named-obj-is-bad.sh \
t/discover.sh \
t/dist-formats.tap \
+t/dist-lzma.sh \
+t/dist-tarZ.sh \
+t/dist-shar.sh \
t/dist-auxdir-many-subdirs.sh \
t/dist-auxfile-2.sh \
t/dist-auxfile.sh \
@@ -655,7 +658,6 @@ t/ltinstloc.sh \
t/ltlibobjs.sh \
t/ltlibsrc.sh \
t/ltorder.sh \
-t/lzma.sh \
t/m4-inclusion.sh \
t/maintclean.sh \
t/maintclean-vpath.sh \
diff --git a/t/lzma.sh b/t/lzma.sh
deleted file mode 100755
index 30fc689b9..000000000
--- a/t/lzma.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003-2013 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 2, 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 .
-
-# Check support for no-dist-gzip with lzma.
-
-. test-init.sh
-
-errmsg='support for lzma.*removed'
-
-echo AUTOMAKE_OPTIONS = dist-lzma > Makefile.am
-$ACLOCAL --force
-AUTOMAKE_fails -Wnone -Wno-error
-grep "^Makefile\\.am:1:.*$errmsg" stderr
-
-cat > configure.ac << 'END'
-AC_INIT([lzma], [1.0])
-AM_INIT_AUTOMAKE([no-dist-gzip dist-lzma])
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-END
-: > Makefile.am
-
-rm -rf autom4te*.cache
-$ACLOCAL
-AUTOMAKE_fails -Wnone -Wno-error
-grep "^configure\\.ac:2:.*$errmsg" stderr
-
-:
--
cgit v1.2.1
From 05703b1ad6ae8728d360d28e385cc6187dbe2102 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 19:32:20 +0200
Subject: maintcheck: fix two references to old location of aclocal and
automake
* maintainer/syntax-checks.mk (sc_perl_at_substs): Here: it should
refer to 'bin/automake' and 'bin/aclocal', not 'automake' and
'alocal'.
Signed-off-by: Stefano Lattarini
---
maintainer/syntax-checks.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index 61fcef3b9..76670eac1 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -508,11 +508,11 @@ sc_tests_PATH_SEPARATOR:
## Try to make sure all @...@ substitutions are covered by our
## substitution rule.
sc_perl_at_substs:
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' bin/aclocal | wc -l` -ne 0; then \
echo "Unresolved @...@ substitution in aclocal" 1>&2; \
exit 1; \
fi
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' bin/automake | wc -l` -ne 0; then \
echo "Unresolved @...@ substitution in automake" 1>&2; \
exit 1; \
fi
--
cgit v1.2.1
From cfba5c03994cf6784de1c68f92c0d3d3f5cae7bc Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 20:06:08 +0200
Subject: PLANS: fix botched version reference
* PLANS/rm-f-without-args.txt: Here. The probe checking that "rm -f"
without arguments works will be introduced in Automake 1.14, not in
Automake 1.13.2.
Signed-off-by: Stefano Lattarini
---
PLANS/rm-f-without-args.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PLANS/rm-f-without-args.txt b/PLANS/rm-f-without-args.txt
index 918e0492d..b940fc3e9 100644
--- a/PLANS/rm-f-without-args.txt
+++ b/PLANS/rm-f-without-args.txt
@@ -13,8 +13,8 @@ accordingly, to get rid of the awful idiom:
See automake bug#10828.
-For Automake 1.13.2 (DONE)
---------------------------
+For Automake 1.14 (DONE)
+------------------------
Add a temporary "probe check" in AM_INIT_AUTOMAKE that verifies that
the no-args "rm -f" usage is supported on the system configure is
--
cgit v1.2.1
From c0e30c4f1a7dc7c983a0621dabbd7682eed06e96 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 20:09:42 +0200
Subject: PLANS: fix reference to non-existent 'next' branch
* PLANS/obsolete-removed/configure.in.txt: Here. We should refer
to the 'master' branch instead.
Signed-off-by: Stefano Lattarini
---
PLANS/obsolete-removed/configure.in.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PLANS/obsolete-removed/configure.in.txt b/PLANS/obsolete-removed/configure.in.txt
index 180f92c14..6612384b5 100644
--- a/PLANS/obsolete-removed/configure.in.txt
+++ b/PLANS/obsolete-removed/configure.in.txt
@@ -24,5 +24,5 @@ that Autoconf will actually have started deprecating 'configure.in'
by the time Automake 2.0 is released.
Note that the removal of 'configure.in' has already been implemented
-in our 'next' branch (from where the 2.0 release will be finally
+in our 'master' branch (from where the 2.0 release will be finally
cut); see commits 'v1.13-17-gbff57c8' and 'v1.13-21-g7626e63'.
--
cgit v1.2.1
From 0709f52fabeb1f4bbab46a8349471ced111a716e Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 20:35:21 +0200
Subject: NEWS: fix a reference to Automake 1.14 where Automake 2.0 was
intended
Signed-off-by: Stefano Lattarini
---
NEWS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 8cb006df8..594bb85b2 100644
--- a/NEWS
+++ b/NEWS
@@ -135,7 +135,7 @@ New in 1.14:
Now that we have the 'info-in-builddir' option that explicitly causes
generated '.info' files to be placed in the builddir, this hack should
be longer necessary, so we deprecate it with runtime warnings. It will
- likely be removed altogether in Automake 1.14.
+ likely be removed altogether in Automake 2.0.
* Relative directory in Makefile fragments:
--
cgit v1.2.1
From ebadaac0d292c6f6c0fded6074d54c3eedca02bc Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 20:52:36 +0200
Subject: PLANS: we have already dropped support for split info files in master
Signed-off-by: Stefano Lattarini
---
PLANS/texi/drop-split-info-files.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/PLANS/texi/drop-split-info-files.txt b/PLANS/texi/drop-split-info-files.txt
index 8b36ecb05..a0a5636e7 100644
--- a/PLANS/texi/drop-split-info-files.txt
+++ b/PLANS/texi/drop-split-info-files.txt
@@ -1,7 +1,7 @@
-For automake 2.0
-----------------
+For in Automake 2.0 (DONE)
+--------------------------
-We want to drop split info files in Automake 2.0.
+We will drop split info files in Automake 2.0.
See automake bug#13351: .
Basically, it has been confirmed that the original reason behind
--
cgit v1.2.1
From 0fd44c9b41405cf3d9580de77b5242cdae37c637 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 20:56:07 +0200
Subject: PLANS: one minor fixlet (mostly cosmetic)
Signed-off-by: Stefano Lattarini
---
PLANS/obsolete-removed/configure.in.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/PLANS/obsolete-removed/configure.in.txt b/PLANS/obsolete-removed/configure.in.txt
index 6612384b5..d3f6da795 100644
--- a/PLANS/obsolete-removed/configure.in.txt
+++ b/PLANS/obsolete-removed/configure.in.txt
@@ -1,5 +1,5 @@
-In Automake 1.13.x
-------------------
+In Automake 1.13.x (once planned, then dropped)
+-----------------------------------------------
We are already warning about 'configure.in' used as the name for the
Autoconf input file ('configure.ac' should be used instead); we've
--
cgit v1.2.1
From 7a2ff99d85c7abcd2753e9815fc8fdac4b13e38f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 21:17:30 +0200
Subject: news: document new 'subdir-objects' warning
* NEWS: Automake 1.14 will warn if a subdir source file is
specified but the 'subdir-objects' option is not given. This
is done to smooth the transition to Automake 2.0, which will
unconditionally assume the behaviour now given only with the
'subdir-objects' option.
Signed-off-by: Stefano Lattarini
---
NEWS | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/NEWS b/NEWS
index 594bb85b2..53881df67 100644
--- a/NEWS
+++ b/NEWS
@@ -95,6 +95,16 @@ New in 1.14:
+ - The next major Automake version (2.0) will unconditionally turn on
+ the 'subdir-objects' option. I order to smooth out the transition,
+ we now give a warning (in the category 'unsupported') whenever a
+ source file is present in a subdirectory but the 'subdir-object' is
+ not enabled. For example, the following usage will trigger such a
+ warning (of course, assuming the 'subdir-objects' option is off):
+
+ bin_PROGRAMS = sub/foo
+ sub_foo_SOURCES = sub/main.c sub/bar.c
+
- Automake will automatically enhance the AC_PROG_CC autoconf macro
to make it check, at configure time, that the C compiler supports
the combined use of both the "-c -o" options. This "rewrite" of
--
cgit v1.2.1
From b602d99c9a85f00067553458d8ed2fd96b8d5bb7 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 22:17:43 +0200
Subject: NEWS: typofix
Reported-by: Eric Blake
Signed-off-by: Stefano Lattarini
---
NEWS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 53881df67..7f9f6fcf5 100644
--- a/NEWS
+++ b/NEWS
@@ -96,7 +96,7 @@ New in 1.14:
- The next major Automake version (2.0) will unconditionally turn on
- the 'subdir-objects' option. I order to smooth out the transition,
+ the 'subdir-objects' option. In order to smooth out the transition,
we now give a warning (in the category 'unsupported') whenever a
source file is present in a subdirectory but the 'subdir-object' is
not enabled. For example, the following usage will trigger such a
--
cgit v1.2.1
From efa6880fa10ce8ccc0e0c34c6603fd15169501a0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 22:19:03 +0200
Subject: THANKS: update Eric Blake's e-mail address
Signed-off-by: Stefano Lattarini
---
THANKS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/THANKS b/THANKS
index 66b32709d..fe7a7de6c 100644
--- a/THANKS
+++ b/THANKS
@@ -108,7 +108,7 @@ Elmar Hoffmann elho@elho.net
Elrond Elrond@Wunder-Nett.org
Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de
Erez Zadok ezk@cs.columbia.edu
-Eric Blake ebb9@byu.net
+Eric Blake eblake@redhat.com
Eric Dorland eric@debian.org
Eric Magnien emagnien@club-internet.fr
Eric Siegerman erics_97@pobox.com
--
cgit v1.2.1
From b636268a12d1a0fdee3eb4ac0f8e9a1eaf45da80 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 22:34:21 +0200
Subject: options: re-enable some sanity checks
They had been unwittingly disabled by a slightly incorrect
code ordering.
* lib/Automake/Options.pm (process_option_list): Here.
(process_global_option_list): And here.
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 737d2a170..bcbfd1757 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -402,16 +402,16 @@ sub process_option_list (@)
{
prog_error "local options already processed"
if $_options_processed;
- return _process_option_list (%_options, @_);
$_options_processed = 1;
+ return _process_option_list (%_options, @_);
}
sub process_global_option_list (@)
{
prog_error "global options already processed"
if $_global_options_processed;
- return _process_option_list (%_global_options, @_);
$_global_options_processed = 1;
+ return _process_option_list (%_global_options, @_);
}
=item C
--
cgit v1.2.1
From 6e486c5db436b0145280806655b17a462d2f827b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 22:50:54 +0200
Subject: options: consistently use return statuses to report errors
* lib/Automake/Options.pm (_process_option_list): Here.
(process_option_list, process_global_option_list): Remove
redundant use of 'return'.
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index bcbfd1757..d578c9bba 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -320,17 +320,20 @@ sub _process_option_list (\%@)
# Obsolete (and now removed) de-ANSI-fication support.
error ($where,
"automatic de-ANSI-fication support has been removed");
+ return 1;
}
# TODO: Remove this special check in Automake 3.0.
elsif ($_ eq 'cygnus')
{
error $where, "support for Cygnus-style trees has been removed";
+ return 1;
}
# TODO: Remove this special check in Automake 3.0.
elsif ($_ eq 'dist-lzma')
{
error ($where, "support for lzma-compressed distribution " .
"archives has been removed");
+ return 1;
}
# TODO: Make this a fatal error in Automake 2.0.
elsif ($_ eq 'dist-shar')
@@ -361,7 +364,7 @@ sub _process_option_list (\%@)
if $opt eq $_ or ! exists $options->{$opt};
error ($where,
"options '$_' and '$opt' are mutually exclusive");
- last;
+ return 1;
}
}
elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/)
@@ -403,7 +406,7 @@ sub process_option_list (@)
prog_error "local options already processed"
if $_options_processed;
$_options_processed = 1;
- return _process_option_list (%_options, @_);
+ _process_option_list (%_options, @_);
}
sub process_global_option_list (@)
@@ -411,7 +414,7 @@ sub process_global_option_list (@)
prog_error "global options already processed"
if $_global_options_processed;
$_global_options_processed = 1;
- return _process_option_list (%_global_options, @_);
+ _process_option_list (%_global_options, @_);
}
=item C
--
cgit v1.2.1
From f7ef16feb40d3ea8b126ec29b31dae5cec31faf0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 23:01:27 +0200
Subject: options: tiny simplification in dealing with erroneous opts
* lib/Automake/Options.pm (_process_option_list): Here, when an
invalid option is detected, there's no need to call &error with
the "uniq_scope => US_GLOBAL" switch. In fact, if the same
erroneous option is specified in AUTOMAKE_OPTIONS in both (say)
'Makefile.am' and 'sub/Makefile.am', we want each such erroneous
usage reported separately, rather than just the first time it is
encountered (as happens when "uniq_scope => US_GLOBAL" is used).
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index d578c9bba..dcdc119af 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -384,8 +384,7 @@ sub _process_option_list (\%@)
}
elsif (! _is_valid_easy_option $_)
{
- error ($where, "option '$_' not recognized",
- uniq_scope => US_GLOBAL);
+ error ($where, "option '$_' not recognized");
return 1;
}
}
--
cgit v1.2.1
From 117ddf8d25420691edbd065a85f64cd8a283e1c0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 23:08:28 +0200
Subject: options: more consistency in use of return statuses to report errors
* lib/Automake/Options.pm (_option_must_be_from_configure): By giving
a proper return status here.
(_process_option_list): And using it here.
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index dcdc119af..b6464ce52 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -245,6 +245,7 @@ Return 1 on error, 0 otherwise.
=cut
+# $BOOL
# _option_must_be_from_configure ($OPTION, $WHERE)
# ----------------------------------------------
# Check that the $OPTION given in location $WHERE is specified with
@@ -252,13 +253,15 @@ Return 1 on error, 0 otherwise.
sub _option_must_be_from_configure ($$)
{
my ($opt, $where)= @_;
- return
+ return 1
if $where->get =~ /^configure\./;
error $where,
"option '$opt' can only be used as argument to AM_INIT_AUTOMAKE\n" .
"but not in AUTOMAKE_OPTIONS makefile statements";
+ return 0;
}
+# $BOOL
# _is_valid_easy_option ($OPTION)
# -------------------------------
# Explicitly recognize valid automake options that require no
@@ -357,7 +360,8 @@ sub _process_option_list (\%@)
}
elsif ($_ eq 'tar-v7' || $_ eq 'tar-ustar' || $_ eq 'tar-pax')
{
- _option_must_be_from_configure ($_, $where);
+ return 1
+ unless _option_must_be_from_configure ($_, $where);
for my $opt ('tar-v7', 'tar-ustar', 'tar-pax')
{
next
--
cgit v1.2.1
From 9a0d4868528e29af16877568a2da664ef640b7fe Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 23:29:04 +0200
Subject: options: better name for an internal function
* lib/Automake/Options.pm (_option_must_be_from_configure): Rename ...
(_option_is_from_configure): ... like this.
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index b6464ce52..e87fb05d1 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -246,11 +246,11 @@ Return 1 on error, 0 otherwise.
=cut
# $BOOL
-# _option_must_be_from_configure ($OPTION, $WHERE)
+# _option_is_from_configure ($OPTION, $WHERE)
# ----------------------------------------------
# Check that the $OPTION given in location $WHERE is specified with
# AM_INIT_AUTOMAKE, not with AUTOMAKE_OPTIONS.
-sub _option_must_be_from_configure ($$)
+sub _option_is_from_configure ($$)
{
my ($opt, $where)= @_;
return 1
@@ -361,7 +361,7 @@ sub _process_option_list (\%@)
elsif ($_ eq 'tar-v7' || $_ eq 'tar-ustar' || $_ eq 'tar-pax')
{
return 1
- unless _option_must_be_from_configure ($_, $where);
+ unless _option_is_from_configure ($_, $where);
for my $opt ('tar-v7', 'tar-ustar', 'tar-pax')
{
next
--
cgit v1.2.1
From 90ec3fe5aa8aed2a1c42751f91ffaa438cf04867 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Fri, 10 May 2013 23:50:25 +0200
Subject: refactor: fix few "inverted boolean" usages
In some subroutines, we used a return value of 0 to indicate success,
and a return status of 1 to indicate failure. That was not very
consistent with the perl interpretation of 0 as a false value and 1 as
a true value. So we now invert the meaning of the exit statuses.
* lib/Automake/Options.pm (_process_option_list): Here.
(process_global_option_list, process_option_list): And by reflex,
here as well.
* bin/automake.in (handle_options): And here.
(generate_makefile, scan_autoconf_traces): Adjust.
Signed-off-by: Stefano Lattarini
---
bin/automake.in | 10 +++++-----
lib/Automake/Options.pm | 22 ++++++++++++----------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/bin/automake.in b/bin/automake.in
index 3614b6ba3..0aef77116 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -1148,7 +1148,7 @@ sub handle_silent ()
################################################################
-# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
+# Handle AUTOMAKE_OPTIONS variable. Return 0 on error, 1 otherwise.
sub handle_options ()
{
my $var = var ('AUTOMAKE_OPTIONS');
@@ -1162,7 +1162,7 @@ sub handle_options ()
my @options = map { { option => $_->[1], where => $_->[0] } }
$var->value_as_list_recursive (cond_filter => TRUE,
location => 1);
- return 1 if process_option_list (@options);
+ return 0 unless process_option_list (@options);
}
if ($strictness == GNITS)
@@ -1172,7 +1172,7 @@ sub handle_options ()
set_option ('check-news', INTERNAL);
}
- return 0;
+ return 1;
}
# shadow_unconditionally ($varname, $where)
@@ -5280,7 +5280,7 @@ EOF
{
my @opts = split (' ', $args[1]);
@opts = map { { option => $_, where => $where } } @opts;
- exit $exit_code if process_global_option_list (@opts);
+ exit $exit_code unless process_global_option_list (@opts);
}
}
elsif ($macro eq 'AM_MAINTAINER_MODE')
@@ -7731,7 +7731,7 @@ sub generate_makefile
$relative_dir = dirname ($makefile);
read_main_am_file ($makefile_am, $makefile_in);
- if (handle_options)
+ if (not handle_options)
{
# Process buffered warnings.
flush_messages;
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index e87fb05d1..f745d3a49 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -241,7 +241,7 @@ These functions should be called at most once for each set of options
having the same precedence; i.e., do not call it twice for two options
from C.
-Return 1 on error, 0 otherwise.
+Return 0 on error, 1 otherwise.
=cut
@@ -323,20 +323,20 @@ sub _process_option_list (\%@)
# Obsolete (and now removed) de-ANSI-fication support.
error ($where,
"automatic de-ANSI-fication support has been removed");
- return 1;
+ return 0;
}
# TODO: Remove this special check in Automake 3.0.
elsif ($_ eq 'cygnus')
{
error $where, "support for Cygnus-style trees has been removed";
- return 1;
+ return 0;
}
# TODO: Remove this special check in Automake 3.0.
elsif ($_ eq 'dist-lzma')
{
error ($where, "support for lzma-compressed distribution " .
"archives has been removed");
- return 1;
+ return 0;
}
# TODO: Make this a fatal error in Automake 2.0.
elsif ($_ eq 'dist-shar')
@@ -360,15 +360,17 @@ sub _process_option_list (\%@)
}
elsif ($_ eq 'tar-v7' || $_ eq 'tar-ustar' || $_ eq 'tar-pax')
{
- return 1
- unless _option_is_from_configure ($_, $where);
+ if (not _option_is_from_configure ($_, $where))
+ {
+ return 0;
+ }
for my $opt ('tar-v7', 'tar-ustar', 'tar-pax')
{
next
if $opt eq $_ or ! exists $options->{$opt};
error ($where,
"options '$_' and '$opt' are mutually exclusive");
- return 1;
+ return 0;
}
}
elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/)
@@ -378,7 +380,7 @@ sub _process_option_list (\%@)
{
error ($where, "require Automake $_, but have $VERSION",
uniq_scope => US_GLOBAL);
- return 1;
+ return 0;
}
}
elsif (/^(?:--warnings=|-W)(.*)$/)
@@ -389,7 +391,7 @@ sub _process_option_list (\%@)
elsif (! _is_valid_easy_option $_)
{
error ($where, "option '$_' not recognized");
- return 1;
+ return 0;
}
}
# We process warnings here, so that any explicitly-given warning setting
@@ -401,7 +403,7 @@ sub _process_option_list (\%@)
"unknown warning category '$w->{'cat'}'"
if switch_warning $w->{cat};
}
- return 0;
+ return 1;
}
sub process_option_list (@)
--
cgit v1.2.1
From 9f21b55d38e8983090ce169969a2f8f1f6645583 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 11 May 2013 00:28:15 +0200
Subject: options: try to report as much errors as possible
For example, if two invalid options are used in AUTOMAKE_OPTIONS, don't
report just the first one, but both of them.
* lib/Automake/Options.pm (_process_option_list): Do so by avoiding
early returns in here.
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index f745d3a49..db5661cec 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -307,6 +307,7 @@ sub _process_option_list (\%@)
{
my ($options, @list) = @_;
my @warnings = ();
+ my $ret = 1;
foreach my $h (@list)
{
@@ -323,20 +324,20 @@ sub _process_option_list (\%@)
# Obsolete (and now removed) de-ANSI-fication support.
error ($where,
"automatic de-ANSI-fication support has been removed");
- return 0;
+ $ret = 0;
}
# TODO: Remove this special check in Automake 3.0.
elsif ($_ eq 'cygnus')
{
error $where, "support for Cygnus-style trees has been removed";
- return 0;
+ $ret = 0;
}
# TODO: Remove this special check in Automake 3.0.
elsif ($_ eq 'dist-lzma')
{
error ($where, "support for lzma-compressed distribution " .
"archives has been removed");
- return 0;
+ $ret = 0;
}
# TODO: Make this a fatal error in Automake 2.0.
elsif ($_ eq 'dist-shar')
@@ -362,7 +363,7 @@ sub _process_option_list (\%@)
{
if (not _option_is_from_configure ($_, $where))
{
- return 0;
+ $ret = 0;
}
for my $opt ('tar-v7', 'tar-ustar', 'tar-pax')
{
@@ -370,7 +371,7 @@ sub _process_option_list (\%@)
if $opt eq $_ or ! exists $options->{$opt};
error ($where,
"options '$_' and '$opt' are mutually exclusive");
- return 0;
+ $ret = 0;
}
}
elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/)
@@ -380,7 +381,7 @@ sub _process_option_list (\%@)
{
error ($where, "require Automake $_, but have $VERSION",
uniq_scope => US_GLOBAL);
- return 0;
+ $ret = 0;
}
}
elsif (/^(?:--warnings=|-W)(.*)$/)
@@ -391,9 +392,10 @@ sub _process_option_list (\%@)
elsif (! _is_valid_easy_option $_)
{
error ($where, "option '$_' not recognized");
- return 0;
+ $ret = 0;
}
}
+
# We process warnings here, so that any explicitly-given warning setting
# will take precedence over warning settings defined implicitly by the
# strictness.
@@ -403,7 +405,8 @@ sub _process_option_list (\%@)
"unknown warning category '$w->{'cat'}'"
if switch_warning $w->{cat};
}
- return 1;
+
+ return $ret;
}
sub process_option_list (@)
--
cgit v1.2.1
From f233bf8f277775f37b7dd4559af237d129231cbb Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 11 May 2013 10:25:33 +0200
Subject: options: tiny simplification in dealing with incompatible versions
* lib/Automake/Options.pm (_process_option_list): Here, when an
incompatible version number option is detected, there's no need
to call error() with the "uniq_scope => US_GLOBAL" switch.
In fact, if the same incompatible version number is specified in
AUTOMAKE_OPTIONS in both (say) 'Makefile.am' and 'sub/Makefile.am',
we want each such erroneous usage reported separately, rather than
just the first time it is encountered (as we'd expect to happen
when "uniq_scope => US_GLOBAL" is used).
Ideally, this change should have been folded into the similar
commit 'v1.13.1d-129-gf7ef16f', but we noticed that too late.
Oh well.
Signed-off-by: Stefano Lattarini
---
lib/Automake/Options.pm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index db5661cec..fab33f3a3 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -379,8 +379,7 @@ sub _process_option_list (\%@)
# Got a version number.
if (Automake::Version::check ($VERSION, $&))
{
- error ($where, "require Automake $_, but have $VERSION",
- uniq_scope => US_GLOBAL);
+ error ($where, "require Automake $_, but have $VERSION");
$ret = 0;
}
}
--
cgit v1.2.1
From 32eb770b73903a6b09216709790a093b33afff8d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sat, 11 May 2013 11:03:41 +0200
Subject: compile: avoid AC_PROG_CC messy rewrite
Instead, add an hook to AC_OUTPUT to have AM_PROG_CC_C_O invoked
automatically.
See also the long-winded discussion about automake bug#13378.
* m4/minuso.m4 (AM_PROG_CC_C_O): Bring back the old implementation,
from commit v1.13.1-55-g1ab8fb6.
* m4/init.m4 (AC_PROG_CC): Remove this horrible, hacky re-write.
* (AM_INIT_AUTOMAKE): Arrange for AM_PROG_CC_C_O to be called if
necessary.
* t/am-prog-cc-c-o.sh: Adjust to avoid spurious failure.
* t/subobj.sh: Likewise.
Suggested-by: Nick Bowler
Signed-off-by: Stefano Lattarini
---
m4/init.m4 | 52 ++++++----------------------------------------------
m4/minuso.m4 | 27 +++++++++++++++++----------
t/add-missing.tap | 9 ++++-----
t/am-prog-cc-c-o.sh | 4 ++--
t/subobj.sh | 3 ++-
5 files changed, 31 insertions(+), 64 deletions(-)
diff --git a/m4/init.m4 b/m4/init.m4
index ce64a6ccf..a6f27339d 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -110,6 +110,12 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
[m4_define([AC_PROG_OBJCXX],
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
])
+dnl Automatically invoke AM_PROG_CC_C_O as necessary. Since AC_PROG_CC is
+dnl usually called after AM_INIT_AUTOMAKE, we arrange for the test to be
+dnl done later by AC_CONFIG_COMMANDS_PRE.
+AC_CONFIG_COMMANDS_PRE([AC_PROVIDE_IFELSE(
+ [AC_PROG_CC],
+ [AC_LANG_PUSH([C]) AM_PROG_CC_C_O AC_LANG_POP([C])])])dnl
AC_REQUIRE([AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
@@ -166,52 +172,6 @@ dnl mangled by Autoconf and run in a shell conditional statement.
m4_define([_AC_COMPILER_EXEEXT],
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-dnl We have to redefine AC_PROG_CC to allow our compile rules to use
-dnl "-c -o" together also with losing compilers.
-dnl FIXME: Add references to the original discussion and bug report.
-dnl FIXME: Shameless copy & paste from Autoconf internals, since trying to
-dnl play smart among tangles of AC_REQUIRE, m4_defn, m4_provide and
-dnl other tricks was proving too difficult, and in the end, likely
-dnl more brittle too. And this should anyway be just a temporary
-dnl band-aid, until Autoconf provides the semantics and/or hooks we
-dnl need (hint hint, nudge nudge) ...
-AC_DEFUN([AC_PROG_CC],
-m4_defn([AC_PROG_CC])
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([compile])dnl
-dnl FIXME The following abomination is expected to disappear in
-dnl Automake 1.14.
-AC_MSG_CHECKING([whether $CC understands -c and -o together])
-set dummy $CC; am__cc=`AS_ECHO(["$[2]"]) | \
- sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
-AC_CACHE_VAL([am_cv_prog_cc_${am__cc}_c_o],
-[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
-rm -f conftest2.*
-if _AC_DO_VAR(ac_try) && test -f conftest2.$ac_objext
-then
- eval am_cv_prog_cc_${am__cc}_c_o=yes
-else
- eval am_cv_prog_cc_${am__cc}_c_o=no
-fi
-rm -f core conftest*
-])dnl
-if eval test \"\$am_cv_prog_cc_${am__cc}_c_o\" = yes; then
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
- # Losing compiler, so wrap it with the 'compile' script.
- # FIXME: It is wrong to rewrite CC.
- # But if we don't then we get into trouble of one sort or another.
- # A longer-term fix would be to have automake use am__CC in this case,
- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
- CC="$am_aux_dir/compile $CC"
-fi
-])
-
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
diff --git a/m4/minuso.m4 b/m4/minuso.m4
index 17fa8c92a..984427cfc 100644
--- a/m4/minuso.m4
+++ b/m4/minuso.m4
@@ -7,19 +7,26 @@
# AM_PROG_CC_C_O
# --------------
-# Basically a no-op now, completely superseded by the AC_PROG_CC
-# adjusted by Automake. Kept for backward-compatibility.
+# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
-[AC_REQUIRE([AC_PROG_CC])dnl
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
-# For better backward-compatibility. Users are advised to stop
-# relying on this cache variable and C preprocessor symbol ASAP.
-eval ac_cv_prog_cc_${am__cc}_c_o=\$am_cv_prog_cc_${am__cc}_c_o
-if eval test \"\$ac_cv_prog_cc_${am__cc}_c_o\" != yes; then
- AC_DEFINE([NO_MINUS_C_MINUS_O], [1],
- [Define to 1 if your C compiler doesn't accept -c and -o together.])
-fi
])
diff --git a/t/add-missing.tap b/t/add-missing.tap
index 9c4b774b3..053b9a111 100755
--- a/t/add-missing.tap
+++ b/t/add-missing.tap
@@ -62,6 +62,7 @@ AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM
AM_PATH_LISPDIR
AM_PATH_PYTHON
+AC_OUTPUT
END
$ACLOCAL || framework_failure_ "cannot pre-compute aclocal.m4"
@@ -247,7 +248,6 @@ check_ <<'END'
depcomp/C
== Files ==
depcomp
-compile
== configure.ac ==
AC_PROG_CC
== Makefile.am ==
@@ -272,9 +272,10 @@ compile
== Files ==
compile
== configure.ac ==
-# Using AC_PROG_CC in configure.ac should be enough. No
-# need to also define, say, xxx_PROGRAMS in Makefile.am.
+# Using AC_PROG_CC and AC_OUTPUT in configure.ac should be enough.
+# No need to also define, say, xxx_PROGRAMS in Makefile.am.
AC_PROG_CC
+AC_OUTPUT
END
# For config.guess and config.sub.
@@ -295,7 +296,6 @@ check_ <<'END'
== Name ==
ylwrap/Lex
== Files ==
-compile
ylwrap
== configure.ac ==
AC_PROG_CC
@@ -310,7 +310,6 @@ check_ <<'END'
== Name ==
ylwrap/Yacc
== Files ==
-compile
ylwrap
== configure.ac ==
AC_PROG_CC
diff --git a/t/am-prog-cc-c-o.sh b/t/am-prog-cc-c-o.sh
index da6a3a4a4..549cdcc58 100755
--- a/t/am-prog-cc-c-o.sh
+++ b/t/am-prog-cc-c-o.sh
@@ -56,7 +56,7 @@ $AUTOMAKE --add-missing
./configure >stdout || { cat stdout; exit 1; }
cat stdout
-grep 'understands -c and -o together.* yes$' stdout
+$EGREP 'understands? -c and -o together.* yes$' stdout
# No repeated checks please.
test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
$MAKE
@@ -83,7 +83,7 @@ CC=$am_testaux_builddir/cc-no-c-o; export CC
./configure >stdout || { cat stdout; exit 1; }
cat stdout
-grep 'understands -c and -o together.* no$' stdout
+$EGREP 'understands? -c and -o together.* no$' stdout
# No repeated checks please.
test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
$MAKE
diff --git a/t/subobj.sh b/t/subobj.sh
index 22ab2d30d..f595e68ad 100755
--- a/t/subobj.sh
+++ b/t/subobj.sh
@@ -23,6 +23,7 @@ AC_PROG_CC
AC_PROG_CXX
AC_PROG_YACC
AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
END
$ACLOCAL
@@ -75,7 +76,7 @@ rm -f compile
$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; exit 1; }
cat stderr >&2
# Make sure compile is installed, and that Automake says so.
-grep '^configure\.ac:4:.*install.*compile' stderr
+grep '^configure\.ac:[48]:.*install.*compile' stderr
test -f compile
grep '^generic/a\.\$(OBJEXT):' Makefile.in
--
cgit v1.2.1
From c148dc73a92c1df5e70a61e9495e62c010090bd4 Mon Sep 17 00:00:00 2001
From: Nick Bowler
Date: Sat, 11 May 2013 11:45:16 +0200
Subject: Use AC_DEFUN_ONCE to define AM_PROG_CC_C_O
If AM_PROG_CC_C_O is expanded multiple times, and the compiler does not
support -c and -o together, each expansion of the macro will prepend
the compile script to CC. This can result in the compile script
invoking the compile script, which at best pointless and silly.
Fortunately, there does not appear to be any serious problems as the
first compile invocation strips out -o options, causing subsequent
invocations of the script to merely exec their arguments.
Other than fixing the above, this should not normally cause any changes
to the resulting configure script, except in the (hopefully rare) case
where AM_PROG_CC_C_O is directly expanded (i.e., *not* using AC_REQUIRE)
in the body of a macro defined with AC_DEFUN. In that case, the use of
AC_DEFUN_ONCE may cause the expansion of AM_PROG_CC_C_O to appear
earlier in the configure script.
* m4/minuso.m4: Change the definition of AM_PROG_CC_C_O to use
AC_DEFUN_ONCE, avoiding problems caused by multiple expansions.
Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini
---
m4/minuso.m4 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/m4/minuso.m4 b/m4/minuso.m4
index 984427cfc..06f74c906 100644
--- a/m4/minuso.m4
+++ b/m4/minuso.m4
@@ -8,7 +8,7 @@
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
-AC_DEFUN([AM_PROG_CC_C_O],
+AC_DEFUN_ONCE([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
--
cgit v1.2.1
From e142bcb0e2f29ff444195c5ea934b834dc63d048 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 14 May 2013 12:12:44 +0200
Subject: build: fixup for building in a VPATH setup
* bin/Makefile.inc (%D%/automake, %D%/aclocal): Make sure that the
directory where the targets scripts are going to be built exists,
before trying to create said scripts.
Signed-off-by: Stefano Lattarini
---
bin/Makefile.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/bin/Makefile.inc b/bin/Makefile.inc
index 280fff002..5842b7109 100644
--- a/bin/Makefile.inc
+++ b/bin/Makefile.inc
@@ -56,6 +56,7 @@ uninstall-hook:
%D%/aclocal: %D%/aclocal.in
%D%/automake %D%/aclocal: Makefile %D%/gen-perl-protos
$(AM_V_GEN)rm -f $@ $@-t $@-t2 \
+ && $(MKDIR_P) $(@D) \
## Common substitutions.
&& in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
## Auto-compute prototypes of perl subroutines.
--
cgit v1.2.1
From 6653939c0d4c551502bb4b74cf4ae9c7441a9436 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 14 May 2013 13:17:50 +0200
Subject: check-cc-no-c-o: avoid a spurious failure
* t/am-prog-cc-c-o.sh: In this test, by relying on the knowledge
that we are running under the aegis of the 'check-cc-no-c-o'
maintainer-specific target, knowledge given us by ...
* t/Makefile.in (check-cc-no-c-o) : ... the new environment
variable 'AM_TESTSUITE_SIMULATING_NO_CC_C_O', set to a value
of "yes" by this rule.
* t/ax/test-defs.in: Initialize the new variable to "no" by
default, and add an explanatory comment.
Signed-off-by: Stefano Lattarini
---
t/Makefile.inc | 1 +
t/am-prog-cc-c-o.sh | 6 +++++-
t/ax/test-defs.in | 5 +++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/t/Makefile.inc b/t/Makefile.inc
index 18a57c2c2..800b66cd2 100644
--- a/t/Makefile.inc
+++ b/t/Makefile.inc
@@ -235,6 +235,7 @@ check-no-trailing-backslash-in-recipes:
# long discussion about automake bug#13378.
check-cc-no-c-o:
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes \
CC='$(abs_top_builddir)/%D%/ax/cc-no-c-o' \
GNU_CC='$(abs_top_builddir)/%D%/ax/cc-no-c-o'
.PHONY: check-cc-no-c-o
diff --git a/t/am-prog-cc-c-o.sh b/t/am-prog-cc-c-o.sh
index 549cdcc58..920a0dc93 100755
--- a/t/am-prog-cc-c-o.sh
+++ b/t/am-prog-cc-c-o.sh
@@ -56,7 +56,11 @@ $AUTOMAKE --add-missing
./configure >stdout || { cat stdout; exit 1; }
cat stdout
-$EGREP 'understands? -c and -o together.* yes$' stdout
+if test "$AM_TESTSUITE_SIMULATING_NO_CC_C_O" != no; then
+ $EGREP 'understands? -c and -o together.* no$' stdout
+else
+ $EGREP 'understands? -c and -o together.* yes$' stdout
+fi
# No repeated checks please.
test $(grep -c ".*-c['\" ].*-o['\" ]" stdout) -eq 1
$MAKE
diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in
index 108374322..7bf43429b 100644
--- a/t/ax/test-defs.in
+++ b/t/ax/test-defs.in
@@ -76,6 +76,11 @@ PATH_SEPARATOR='@PATH_SEPARATOR@'
host_alias=${host_alias-'@host_alias@'}; export host_alias
build_alias=${build_alias-'@build_alias@'}; export build_alias
+# Whether the testsuite is being run by faking the presence of a C
+# compiler that doesn't grasp the '-c' and '-o' flags together. By
+# default, of course, it isn't.
+: "${AM_TESTSUITE_SIMULATING_NO_CC_C_O:=no}"
+
# A concurrency-safe "mkdir -p" implementation.
MKDIR_P=${AM_TESTSUITE_MKDIR_P-'@MKDIR_P@'}
--
cgit v1.2.1
From cce6192b67e6e66a39dd4ee002bf3b8919cbf30b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 14 May 2013 13:40:48 +0200
Subject: check-cc-no-c-o: unify initializations in a single place
* t/ax/test-defs.in: That is, by setting CC and GNU_CC here, in accord
with the value of the variable 'AM_TESTSUITE_SIMULATING_NO_CC_C_O'.
* t/Makefile.in (check-cc-no-c-o) : No need to reset CC and GNU_CC any
longer in the recursive "make check" invocation.
Signed-off-by: Stefano Lattarini
---
t/Makefile.inc | 4 +---
t/ax/test-defs.in | 11 ++++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/t/Makefile.inc b/t/Makefile.inc
index 800b66cd2..85c4c8ef5 100644
--- a/t/Makefile.inc
+++ b/t/Makefile.inc
@@ -235,9 +235,7 @@ check-no-trailing-backslash-in-recipes:
# long discussion about automake bug#13378.
check-cc-no-c-o:
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
- AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes \
- CC='$(abs_top_builddir)/%D%/ax/cc-no-c-o' \
- GNU_CC='$(abs_top_builddir)/%D%/ax/cc-no-c-o'
+ AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes
.PHONY: check-cc-no-c-o
## Checking the list of tests.
diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in
index 7bf43429b..9662c792b 100644
--- a/t/ax/test-defs.in
+++ b/t/ax/test-defs.in
@@ -141,7 +141,11 @@ FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'}
# Compilers and their flags. These can point to non-GNU compilers (and
# on non-Linux and non-BSD systems, they probably will).
-CC=${AM_TESTSUITE_CC-${CC-'@CC@'}}
+if test $AM_TESTSUITE_SIMULATING_NO_CC_C_O = no; then
+ CC=${AM_TESTSUITE_CC-${CC-'@CC@'}}
+else
+ CC=$am_testaux_builddir/cc-no-c-o
+fi
CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}}
F77=${AM_TESTSUITE_F77-${F77-'@F77@'}}
FC=${AM_TESTSUITE_FC-${FC-'@FC@'}}
@@ -152,6 +156,11 @@ FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}}
CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}}
# GNU compilers and their flags.
+if test $AM_TESTSUITE_SIMULATING_NO_CC_C_O = no; then
+ GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}}
+else
+ GNU_CC=$am_testaux_builddir/cc-no-c-o
+fi
GNU_CC=${AM_TESTSUITE_GNU_CC-${GNU_CC-'@GNU_CC@'}}
GNU_CXX=${AM_TESTSUITE_GNU_CXX-${GNU_CXX-'@GNU_CXX@'}}
GNU_F77=${AM_TESTSUITE_GNU_F77-${GNU_F77-'@GNU_F77@'}}
--
cgit v1.2.1
From c6b827b2f82ed40a3ddee2f1e986e186cacffb67 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 14 May 2013 14:18:00 +0200
Subject: build: be more respectful of user-specified verbosity
* t/Makefile.in (check-cc-no-c-o, check-no-trailing-backslash-in-recipes,
installcheck-testsuite, perf): Here.
Signed-off-by: Stefano Lattarini
---
t/Makefile.inc | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/t/Makefile.inc b/t/Makefile.inc
index 85c4c8ef5..f979c66dc 100644
--- a/t/Makefile.inc
+++ b/t/Makefile.inc
@@ -224,7 +224,7 @@ check-local: check-tests-syntax
# that helps catching such problems in Automake-generated recipes.
# See automake bug#10436.
check-no-trailing-backslash-in-recipes:
- $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
CONFIG_SHELL='$(abs_top_builddir)/%D%/ax/shell-no-trail-bslash'
.PHONY: check-no-trailing-backslash-in-recipes
@@ -234,7 +234,7 @@ check-no-trailing-backslash-in-recipes:
# otherwise only present themselves later "in the wild". See also the
# long discussion about automake bug#13378.
check-cc-no-c-o:
- $(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) check \
+ $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
AM_TESTSUITE_SIMULATING_NO_CC_C_O=yes
.PHONY: check-cc-no-c-o
@@ -245,13 +245,14 @@ include %D%/CheckListOfTests.am
# Run the testsuite with the installed aclocal and automake.
installcheck-local: installcheck-testsuite
installcheck-testsuite:
- am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+ $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
+ am_running_installcheck=yes
# Performance tests.
.PHONY: perf
perf: all
- $(MAKE) $(AM_MAKEFLAGS) TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' \
- TESTS='$(perf_TESTS)' check
+ $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) check \
+ TEST_SUITE_LOG='$(PERF_TEST_SUITE_LOG)' TESTS='$(perf_TESTS)'
PERF_TEST_SUITE_LOG = %D%/perf/test-suite.log
CLEANFILES += $(PERF_TEST_SUITE_LOG)
EXTRA_DIST += $(perf_TESTS)
--
cgit v1.2.1
From 7810a65de4899ef3c6489fb30cc2458c24c25ca8 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Tue, 14 May 2013 15:50:12 +0200
Subject: tests: less uses of "make -e"; avoid spurious failures in
'check-cc-no-c-o'
That is, when the testsuite is run using a fake C compiler that doesn't
grasp the '-c' and '-o' options together.
* t/instdir-prog.sh: Adjust.
* t/instdir-ltlib.sh: Likewise.
* t/python-virtualenv.sh: Likewise.
Signed-off-by: Stefano Lattarini
---
t/instdir-ltlib.sh | 23 ++++++++++++++++-------
t/instdir-prog.sh | 22 +++++++++++++++-------
t/python-virtualenv.sh | 9 ++++-----
3 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh
index 726f809bc..273206cba 100755
--- a/t/instdir-ltlib.sh
+++ b/t/instdir-ltlib.sh
@@ -66,22 +66,31 @@ cd build
../configure --prefix="$instdir" PYTHON="echo" \
am_cv_python_pythondir="$instdir/python" \
am_cv_python_pyexecdir="$instdir/pyexec"
-$MAKE
+xMAKE ()
+{
+ # Early line break here to please maintainer-check.
+ $MAKE \
+ bindir= libdir= pyexecdir= \
+ AM_MAKEFLAGS='bindir= libdir= pyexecdir=' \
+ "$@"
+}
+
+xMAKE
-bindir= libdir= pyexecdir=
-export bindir libdir pyexecdir
-$MAKE -e install
+xMAKE install
test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -e "$instdir"
test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
# Creative quoting below to please maintainer-check.
grep 'rm'' ' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; }
+xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; }
cat stdout
# Creative quoting below to please maintainer-check.
grep 'rm'' ' stdout && exit 1
+$MAKE
+
:
diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh
index f916a11e9..f2b96b8ee 100755
--- a/t/instdir-prog.sh
+++ b/t/instdir-prog.sh
@@ -65,20 +65,28 @@ cd build
../configure --prefix="$instdir" PYTHON="echo" \
am_cv_python_pythondir="$instdir/python" \
am_cv_python_pyexecdir="$instdir/pyexec"
-$MAKE
-bindir= libdir= pyexecdir=
-export bindir libdir pyexecdir
-$MAKE -e install
+xMAKE ()
+{
+ # Early line break here to please maintainer-check.
+ $MAKE \
+ bindir= libdir= pyexecdir= \
+ AM_MAKEFLAGS='bindir= libdir= pyexecdir=' \
+ "$@"
+}
+
+xMAKE
+
+xMAKE install
test ! -e "$instdir"
-$MAKE -e install DESTDIR="$destdir"
+xMAKE install DESTDIR="$destdir"
test ! -e "$instdir"
test ! -e "$destdir"
-$MAKE -e uninstall > stdout || { cat stdout; exit 1; }
+xMAKE uninstall > stdout || { cat stdout; exit 1; }
cat stdout
# Creative quoting below to please maintainer-check.
grep 'rm'' ' stdout && exit 1
-$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; }
+xMAKE uninstall DESTDIR="$destdir" > stdout || { cat stdout; exit 1; }
cat stdout
# Creative quoting below to please maintainer-check.
grep 'rm'' ' stdout && exit 1
diff --git a/t/python-virtualenv.sh b/t/python-virtualenv.sh
index a67e7c273..faf1d5a50 100755
--- a/t/python-virtualenv.sh
+++ b/t/python-virtualenv.sh
@@ -178,13 +178,12 @@ $MAKE distclean
# Overriding pythondir and pyexecdir at make time should be enough.
./configure --prefix="$cwd/bad-prefix"
-pythondir=$py_site pyexecdir=$py_site
-export pythondir pyexecdir
-check_install -e
+check_install pythondir="$py_site" pyexecdir="$py_site" \
+ AM_MAKEFLAGS="pythondir='$py_site' pyexecdir='$py_site'"
test ! -e bad-prefix
$MAKE test-run
-check_uninstall -e
-unset pythondir pyexecdir
+check_uninstall pythondir="$py_site" pyexecdir="$py_site" \
+ AM_MAKEFLAGS="pythondir='$py_site' pyexecdir='$py_site'"
# Also check that the distribution is self-contained, for completeness.
$MAKE distcheck
--
cgit v1.2.1
From 563ecade28bb4ec0f285019959267015af5725b3 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Wed, 15 May 2013 15:55:44 +0200
Subject: THANKS: update Akim's e-mail address
Signed-off-by: Stefano Lattarini
---
THANKS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/THANKS b/THANKS
index fe7a7de6c..853c37987 100644
--- a/THANKS
+++ b/THANKS
@@ -6,7 +6,7 @@ Adam J. Richter adam@yggdrasil.com
Adam Mercer ramercer@gmail.com
Adam Sampson ats@offog.org
Adrian Bunk bunk@fs.tum.de
-Akim Demaille akim@freefriends.org
+Akim Demaille akim@gnu.org
Alan Modra amodra@bigpond.net.au
Alex Hornby alex@anvil.co.uk
Alex Unleashed unledev@gmail.com
--
cgit v1.2.1
From 5969f68eeb8df96670703ef7ad025060fa397e97 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 16 May 2013 00:21:20 +0200
Subject: PLANS: subdir-objects: various updates
Signed-off-by: Stefano Lattarini
---
PLANS/subdir-objects.txt | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/PLANS/subdir-objects.txt b/PLANS/subdir-objects.txt
index 86474036a..94c6305ec 100644
--- a/PLANS/subdir-objects.txt
+++ b/PLANS/subdir-objects.txt
@@ -3,7 +3,7 @@ Summary
We want to make the behaviour currently enabled by the 'subdir-objects'
the default one, and in fact the *only* one, in Automake 2.0.
-See automake bug#13378: .
+See automake bug#13378: .
Details
-------
@@ -38,29 +38,25 @@ C compilation rules mistakenly passed the "-c -o" options combination
unconditionally (even to losing compiler) when the 'subdir-objects' was
used but sources were only present in the top-level directory.
-TODO for automake 1.14
+DONE for automake 1.14
----------------------
-Give a warning in the category 'unsupported' if the 'subdir-objects'
+We give a warning in the category 'unsupported' if the 'subdir-objects'
option is not specified. This should give the users enough forewarning
about the planned change, and give them time to update their packages
to the new semantic.
-Be sure to avoid the warning when it would be irrelevant, i.e., if all
-source files sit in "current" directory (thanks to Peter Johansson for
-suggesting this).
+We also make sure to avoid the warning when it would be irrelevant, i.e.,
+if all source files sit in "current" directory (thanks to Peter Johansson
+for suggesting this).
For automake 2.0
----------------
-Remove the copy & paste of Autoconf internals in our AC_PROG_CC rewrite
-See the first patch in the series:
-
-
Make the behaviour once activated by the 'subdir-object' option mandatory.
With that change, we'll drop support for the "old" behaviour of having
object files derived from sources in a subdirectory being placed in the
current directory rather than in that same subdirectory.
-Still keep the 'subdir-object' option supported (as a simple no-op
+Still keep the 'subdir-objects' option supported (as a simple no-op
now), to save useless churn in our user's build systems.
--
cgit v1.2.1
From 9c468420a8ff18940ab2e9d47d096788ed5801f0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Thu, 16 May 2013 13:36:49 +0200
Subject: tests: remove remaining exec bits ('maint' branch)
The executable bit gives the impression that the tests are directly
runnable, as with "./t/foo.sh", but it has been a while since that
was the case. Today, tests are runnable only through "make check"
or "./runtest".
This change is for the 'maint' branch (automake 1.13a), and is a
follow-up to commit 'v1.13.2-3-g74017b5', done on the 'micro' branch
(automake 1.13.2a). It will soon be followed by a similar patch
for the 'master' branch (automake 1.99a).
* t/am-prog-cc-c-o.sh: Remove executable bit.
* t/ccnoco4.sh: Likewise.
* t/dist-shar.sh: Likewise.
* t/dist-tarZ.sh: Likewise.
* t/lex-multiple.sh: Likewise.
* t/preproc-basics.sh: Likewise.
* t/preproc-c-compile.sh: Likewise.
* t/preproc-demo.sh: Likewise.
* t/preproc-errmsg.sh: Likewise.
* t/rm-f-probe.sh: Likewise.
* t/self-check-cc-no-c-o.sh: Likewise.
* t/txinfo-builddir.sh: Likewise.
* t/txinfo-nodist-info.sh: Likewise.
Signed-off-by: Stefano Lattarini
---
t/am-prog-cc-c-o.sh | 0
t/ccnoco4.sh | 0
t/dist-shar.sh | 0
t/dist-tarZ.sh | 0
t/lex-multiple.sh | 0
t/preproc-basics.sh | 0
t/preproc-c-compile.sh | 0
t/preproc-demo.sh | 0
t/preproc-errmsg.sh | 0
t/rm-f-probe.sh | 0
t/self-check-cc-no-c-o.sh | 0
t/txinfo-builddir.sh | 0
t/txinfo-nodist-info.sh | 0
13 files changed, 0 insertions(+), 0 deletions(-)
mode change 100755 => 100644 t/am-prog-cc-c-o.sh
mode change 100755 => 100644 t/ccnoco4.sh
mode change 100755 => 100644 t/dist-shar.sh
mode change 100755 => 100644 t/dist-tarZ.sh
mode change 100755 => 100644 t/lex-multiple.sh
mode change 100755 => 100644 t/preproc-basics.sh
mode change 100755 => 100644 t/preproc-c-compile.sh
mode change 100755 => 100644 t/preproc-demo.sh
mode change 100755 => 100644 t/preproc-errmsg.sh
mode change 100755 => 100644 t/rm-f-probe.sh
mode change 100755 => 100644 t/self-check-cc-no-c-o.sh
mode change 100755 => 100644 t/txinfo-builddir.sh
mode change 100755 => 100644 t/txinfo-nodist-info.sh
diff --git a/t/am-prog-cc-c-o.sh b/t/am-prog-cc-c-o.sh
old mode 100755
new mode 100644
diff --git a/t/ccnoco4.sh b/t/ccnoco4.sh
old mode 100755
new mode 100644
diff --git a/t/dist-shar.sh b/t/dist-shar.sh
old mode 100755
new mode 100644
diff --git a/t/dist-tarZ.sh b/t/dist-tarZ.sh
old mode 100755
new mode 100644
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
old mode 100755
new mode 100644
diff --git a/t/preproc-basics.sh b/t/preproc-basics.sh
old mode 100755
new mode 100644
diff --git a/t/preproc-c-compile.sh b/t/preproc-c-compile.sh
old mode 100755
new mode 100644
diff --git a/t/preproc-demo.sh b/t/preproc-demo.sh
old mode 100755
new mode 100644
diff --git a/t/preproc-errmsg.sh b/t/preproc-errmsg.sh
old mode 100755
new mode 100644
diff --git a/t/rm-f-probe.sh b/t/rm-f-probe.sh
old mode 100755
new mode 100644
diff --git a/t/self-check-cc-no-c-o.sh b/t/self-check-cc-no-c-o.sh
old mode 100755
new mode 100644
diff --git a/t/txinfo-builddir.sh b/t/txinfo-builddir.sh
old mode 100755
new mode 100644
diff --git a/t/txinfo-nodist-info.sh b/t/txinfo-nodist-info.sh
old mode 100755
new mode 100644
--
cgit v1.2.1
From 478740deb00d19000ddbcd8a21789f1d65bd2c54 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 19 May 2013 00:09:30 +0200
Subject: tests: fix a spurious failure with FreeBSD make
Failures due to known VPATH support issues in that make implementation
(the same issues that have been causing the long-standing bug#7884).
* t/lex-multiple.sh: Adjust.
Signed-off-by: Stefano Lattarini
---
t/lex-multiple.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lex-multiple.sh b/t/lex-multiple.sh
index 7383eaf2d..e804bb229 100644
--- a/t/lex-multiple.sh
+++ b/t/lex-multiple.sh
@@ -102,6 +102,6 @@ if ! cross_compiling; then
: For shells with busted 'set -e'.
fi
-$MAKE distcheck
+yl_distcheck
:
--
cgit v1.2.1
From b8e9d8d0171fbb15652a88b840b231b686a87498 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 19 May 2013 12:22:22 +0200
Subject: tests: fix another spurious with FreeBSD make
* t/parallel-tests-recheck-pr11791.sh: Here.
Signed-off-by: Stefano Lattarini
---
t/parallel-tests-recheck-pr11791.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/parallel-tests-recheck-pr11791.sh b/t/parallel-tests-recheck-pr11791.sh
index ac3a38906..1bd535d7c 100644
--- a/t/parallel-tests-recheck-pr11791.sh
+++ b/t/parallel-tests-recheck-pr11791.sh
@@ -45,7 +45,7 @@ count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
st=0; $MAKE -k recheck >stdout || st=$?
cat stdout
# Don't trust the exit status of "make -k" for non-GNU makes.
-if using_gmake && test $st -eq 0; then exit 1; fi
+if using_gmake && test $st -eq 0; then exit 1; else :; fi
count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
# Introduce an error in foo.c, that should cause a compilation failure.
@@ -64,7 +64,7 @@ test -f foo.trs
st=0; $MAKE -k recheck >stdout || st=$?
cat stdout
# Don't trust the exit status of "make -k" for non-GNU makes.
-if using_gmake && test $st -eq 0; then exit 1; fi
+if using_gmake && test $st -eq 0; then exit 1; else :; fi
# We don't get a change to run the testsuite.
$EGREP '(X?PASS|X?FAIL|SKIP|ERROR):' stdout && exit 1
test -f foo.log
--
cgit v1.2.1
From 533186d2edfbcfeac9944ff06e7770fae68be6d9 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 19 May 2013 12:24:48 +0200
Subject: tests: fix a botched heading comment
* t/parallel-tests-recheck-pr11791.sh: Here.
Signed-off-by: Stefano Lattarini
---
t/parallel-tests-recheck-pr11791.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/parallel-tests-recheck-pr11791.sh b/t/parallel-tests-recheck-pr11791.sh
index 1bd535d7c..7fad70688 100644
--- a/t/parallel-tests-recheck-pr11791.sh
+++ b/t/parallel-tests-recheck-pr11791.sh
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-# parallel-tests: "make recheck" "make -k recheck" in the face of build
+# parallel-tests: "make -k recheck" in the face of build
# failures for the test cases. See automake bug#11791.
required='cc native'
--
cgit v1.2.1
From 8f252e4ce02f36ccb06d26fd401a6285b491ae8b Mon Sep 17 00:00:00 2001
From: Stefano Lattarini
Date: Sun, 19 May 2013 16:48:19 +0200
Subject: texi: build version.texi and stamp-vti in srcdir
Do so even when the 'info-in-builddir' option is present, or when
the corresponding '*.info' files are listed in $(CLEANFILES) or in
$(DISTCLEANFILES).
This fixes failures in the following tests, when they are run with
$MAKE pointing to FreeBSD make:
- txinfo-nodist-info.sh
- txinfo23.sh
- txinfo24.sh
- txinfo28.sh
- txinfo25.sh
BTW, notice that the test 'txinfo-builddir.sh' fails with FreeBSD make
as well, but that is due to a known FreeBSD make VPATH issue (the same
described in automake bug#7884). But that is not a regression, since
the 'info-in-builddir' option will be new in Automake 1.14. Moreover,
we already warn in the manual that the use of that option can indeed
cause problems with VPATH builds done by non-GNU make.
* bin/automake.in (handle_texinfo_helper): New local variable
'$soutdir'. Use it instead of '$outdir' where appropriate (in
particular, in the transform used on file 'texi-vers.am'.
* t/txinfo-builddir.sh: Adjust to avoid spurious failures.
Signed-off-by: Stefano Lattarini