From a51f03728410166e827262b59f85f31f0419e69d Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 7 Mar 2009 15:59:24 +0100 Subject: [PATCH] Documentation and tests for the `silent' option. * NEWS: Update. * doc/automake.texi (Invoking Automake): `silent' turns off some portability warnings. (Libtool Flags): `silent' silences libtool. (Options): Document the `silent' flag. * tests/dollarvar.test, tests/silent.test, tests/silent2.test, tests/silent3.test, tests/silent4.test, tests/silent5.test: New tests. * tests/Makefile.am: Update. * Makefile.am (maintainer-check): Ignore `DESTDIR' and `V' when checking for make variables that should not be overridden from the command line. Signed-off-by: Ralf Wildenhues --- ChangeLog | 16 +++++ Makefile.am | 8 ++- Makefile.in | 3 +- NEWS | 5 ++ doc/automake.texi | 38 +++++++++- tests/Makefile.am | 6 ++ tests/Makefile.in | 6 ++ tests/dollarvar.test | 63 +++++++++++++++++ tests/silent.test | 92 ++++++++++++++++++++++++ tests/silent2.test | 94 +++++++++++++++++++++++++ tests/silent3.test | 95 +++++++++++++++++++++++++ tests/silent4.test | 98 ++++++++++++++++++++++++++ tests/silent5.test | 162 +++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 681 insertions(+), 5 deletions(-) create mode 100755 tests/dollarvar.test create mode 100755 tests/silent.test create mode 100755 tests/silent2.test create mode 100755 tests/silent3.test create mode 100755 tests/silent4.test create mode 100755 tests/silent5.test diff --git a/ChangeLog b/ChangeLog index dd000d4af..cd4c9fd01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2009-03-07 Ralf Wildenhues + + Documentation and tests for the `silent' option. + * NEWS: Update. + * doc/automake.texi (Invoking Automake): `silent' turns off some + portability warnings. + (Libtool Flags): `silent' silences libtool. + (Options): Document the `silent' flag. + * tests/dollarvar.test, tests/silent.test, tests/silent2.test, + tests/silent3.test, tests/silent4.test, tests/silent5.test: New + tests. + * tests/Makefile.am: Update. + * Makefile.am (maintainer-check): Ignore `DESTDIR' and `V' when + checking for make variables that should not be overridden from + the command line. + 2009-03-07 Jan Engelhardt Ralf Wildenhues diff --git a/Makefile.am b/Makefile.am index d637e10f4..8b87a8c85 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ ## Makefile for Automake. ## Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, -## 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +## 2005, 2006, 2007, 2008, 2009 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 @@ -273,13 +273,15 @@ maintainer-check: automake aclocal 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. +## POSIX says it can't come from the environment. V and DESTDIRS are exceptions, +## too, as package authors are urged not to intitialize this anywhere. @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; 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 - @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \ + @if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \ + 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; \ diff --git a/Makefile.in b/Makefile.in index 49f70c2d0..09580595e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -933,7 +933,8 @@ maintainer-check: automake aclocal echo ' in the above lines, it is more portable.' 1>&2; \ exit 1; \ fi - @if grep -v SHELL $(srcdir)/tests/*.test | grep '\$$MAKE .*=' ; then \ + @if sed 's/DESTDIR=[^ ]*//; s/SHELL=[^ ]*//; s/V=[^ ]*//' $(srcdir)/tests/*.test | \ + 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; \ diff --git a/NEWS b/NEWS index d4b59e950..78ce7ab86 100644 --- a/NEWS +++ b/NEWS @@ -109,6 +109,11 @@ New in 1.10a: - The `color-tests' option causes colored test result output on terminals. + - The `silent' option enables Linux kernel-style silent build output. + This option requires the widely supported but non-POSIX `make' feature + of recursive variable expansion, so do not use it if your package needs + to build with `make' implementations that do not support it. + - New prefix `notrans_' for manpages which should not be transformed by --program-transform. diff --git a/doc/automake.texi b/doc/automake.texi index 0dfa9c709..0d104ccf8 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -2562,6 +2562,8 @@ variables. The categories output by default are @samp{syntax} and @samp{unsupported}. Additionally, @samp{gnu} and @samp{portability} are enabled in @option{--gnu} and @option{--gnits} strictness. +On the other hand, the @option{silent} options (@pxref{Options}) +turns off portability warnings about recursive variable expansions. @vindex WARNINGS The environment variable @env{WARNINGS} can contain a comma separated @@ -5261,7 +5263,9 @@ setting. The libtool rules also use a @code{LIBTOOLFLAGS} variable that should not be set in @file{Makefile.am}: this is a user variable (@pxref{Flag Variables Ordering}. It allows users to run @samp{make -LIBTOOLFLAGS=--silent}, for instance. +LIBTOOLFLAGS=--silent}, for instance. Note that the verbosity of +@command{libtool} can also be influenced with the Automake @option{silent} +option (@pxref{Options}). @node LTLIBOBJS, Libtool Issues, Libtool Flags, A Shared Library @@ -8693,6 +8697,38 @@ non-alpha releases. The second form is @samp{@var{MAJOR}.@var{MINOR}@var{ALPHA}}, where @var{ALPHA} is a letter; it should be omitted for non-alpha releases. +@item @option{silent} +@cindex Option, @option{silent} +@opindex silent +Enable silent build rules. This will cause many build rules to output a +status line of the form + +@example + GEN @var{output-file} +@end example + +@noindent +instead of printing the command that will be executed to update +@var{output-file}. It will also silence @command{libtool} output. + +@vindex @code{V} +The verbosity can be influenced at @command{make} run time by setting the +variable @code{V}: @samp{make V=0} is equivalent to @code{V} being unset, +while @samp{make V=1} will produce verbose output. + +For portability to different @command{make} implementations, package authors +are advised to not set the variable @code{V} inside the @file{Makefile.am} +file, to allow the user to override the value for subdirectories as well. + +The current implementation of this feature relies on a non-POSIX, but in +practice rather widely supported @file{Makefile} construct of nested +variable expansion @samp{$(@var{var1}$(V))}. Do not use the +@option{silent} option if your package needs to build with +@command{make} implementations that do not support it. The +@option{silent} option turns off warnings about recursive variable +expansion, which are in turn enabled by @option{-Wportability} +(@pxref{Invoking Automake}). + @item @option{std-options} @cindex Options, @option{std-options} @cindex @samp{make installcheck}, testing @option{--help} and @option{--version} diff --git a/tests/Makefile.am b/tests/Makefile.am index 8a6568484..5ff30e4e5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -240,6 +240,7 @@ distcom7.test \ distdir.test \ distname.test \ dollar.test \ +dollarvar.test \ double.test \ dup2.test \ else.test \ @@ -534,6 +535,11 @@ rulepat.test \ sanity.test \ scripts.test \ seenc.test \ +silent.test \ +silent2.test \ +silent3.test \ +silent4.test \ +silent5.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index a49105591..dfc01de0b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -395,6 +395,7 @@ distcom7.test \ distdir.test \ distname.test \ dollar.test \ +dollarvar.test \ double.test \ dup2.test \ else.test \ @@ -689,6 +690,11 @@ rulepat.test \ sanity.test \ scripts.test \ seenc.test \ +silent.test \ +silent2.test \ +silent3.test \ +silent4.test \ +silent5.test \ sinclude.test \ srcsub.test \ srcsub2.test \ diff --git a/tests/dollarvar.test b/tests/dollarvar.test new file mode 100755 index 000000000..3c43a61b7 --- /dev/null +++ b/tests/dollarvar.test @@ -0,0 +1,63 @@ +#!/bin/sh +# Copyright (C) 2009 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 . + +# Test to make sure that -Wportability complains about recursive +# variable expansions and variables containing `$', `$(...)', or +# `${...}' in the name. We support recursive variable expansions using +# the latter two constructs for the `silent' option, and they are +# rather widely supported in practice. OTOH variable definitions +# containing a `$' on the left hand side of an assignment are not +# portable in practice, even though POSIX allows them. :-/ + +. ./defs + +set -e + +cat >Makefile.am <<'EOF' +x = 1 +foo$x = 1 +bar$(x) = 1 +baz${x} = 1 +bla = $(foo$x) +bli = $(foo$(x)) +blo = $(foo${x}) +EOF + +$ACLOCAL +AUTOMAKE_fails -Wportability +grep 'Makefile.am:2' stderr +grep 'Makefile.am:3' stderr +grep 'Makefile.am:4' stderr +grep 'Makefile.am:5' stderr +grep 'Makefile.am:6' stderr +grep 'Makefile.am:7' stderr + +# On the other hand, if we allow `silent' mode, then we need to allow +# recursive variable expansion, too. + +# This should work with AUTOMAKE_OPTIONS. +echo 'AUTOMAKE_OPTIONS = silent' >> Makefile.am + +AUTOMAKE_fails -Wportability +grep 'Makefile.am:2' stderr +grep 'Makefile.am:3' stderr +grep 'Makefile.am:4' stderr +grep 'Makefile.am:5' stderr +grep 'Makefile.am:6' stderr && Exit 1 +grep 'Makefile.am:7' stderr && Exit 1 + + +: diff --git a/tests/silent.test b/tests/silent.test new file mode 100755 index 000000000..b3c03e4d8 --- /dev/null +++ b/tests/silent.test @@ -0,0 +1,92 @@ +#!/bin/sh +# Copyright (C) 2009 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 . + +# Check silent mode, without libtool, standard depmode case. + +# Please keep this file in sync with silent2.test. + +. ./defs + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AC_CONFIG_FILES([sub/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent +# Need generic and non-generic rules. +bin_PROGRAMS = foo bar +bar_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = baz bla +bla_CFLAGS = $(AM_CFLAGS) +EOF + +cat > foo.c <<'EOF' +int main () +{ + return 0; +} +EOF +cp foo.c bar.c +cp foo.c sub/baz.c +cp foo.c sub/bla.c + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure +$MAKE >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout && Exit 1 +grep ' -o foo' stdout && Exit 1 +grep mv stdout && Exit 1 +grep 'CC .*foo\.' stdout +grep 'CC .*bar\.' stdout +grep 'CC .*baz\.' stdout +grep 'CC .*bla\.' stdout +grep 'CCLD .*foo' stdout +grep 'CCLD .*bar' stdout +grep 'CCLD .*baz' stdout +grep 'CCLD .*bla' stdout + +$MAKE clean +$MAKE V=1 >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout +grep ' -o foo' stdout +grep 'CC .*foo\.' stdout && Exit 1 +grep 'CC .*bar\.' stdout && Exit 1 +grep 'CC .*baz\.' stdout && Exit 1 +grep 'CC .*bla\.' stdout && Exit 1 +grep 'CCLD .*foo' stdout && Exit 1 +grep 'CCLD .*bar' stdout && Exit 1 +grep 'CCLD .*baz' stdout && Exit 1 +grep 'CCLD .*bla' stdout && Exit 1 + +: diff --git a/tests/silent2.test b/tests/silent2.test new file mode 100755 index 000000000..136952e53 --- /dev/null +++ b/tests/silent2.test @@ -0,0 +1,94 @@ +#!/bin/sh +# Copyright (C) 2009 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 . + +# Check silent mode, without libtool, non-fastdep case +# (so that, with GCC, we also cover the other code paths in depend2). + +# Please keep this file in sync with silent.test. + +required=gcc +. ./defs + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AC_CONFIG_FILES([sub/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent +# Need generic and non-generic rules. +bin_PROGRAMS = foo bar +bar_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = baz bla +bla_CFLAGS = $(AM_CFLAGS) +EOF + +cat > foo.c <<'EOF' +int main () +{ + return 0; +} +EOF +cp foo.c bar.c +cp foo.c sub/baz.c +cp foo.c sub/bla.c + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure am_cv_CC_dependencies_compiler_type=gcc +$MAKE >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout && Exit 1 +grep ' -o foo' stdout && Exit 1 +grep mv stdout && Exit 1 +grep 'CC .*foo\.' stdout +grep 'CC .*bar\.' stdout +grep 'CC .*baz\.' stdout +grep 'CC .*bla\.' stdout +grep 'CCLD .*foo' stdout +grep 'CCLD .*bar' stdout +grep 'CCLD .*baz' stdout +grep 'CCLD .*bla' stdout + +$MAKE clean +$MAKE V=1 >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout +grep ' -o foo' stdout +grep 'CC .*foo\.' stdout && Exit 1 +grep 'CC .*bar\.' stdout && Exit 1 +grep 'CC .*baz\.' stdout && Exit 1 +grep 'CC .*bla\.' stdout && Exit 1 +grep 'CCLD .*foo' stdout && Exit 1 +grep 'CCLD .*bar' stdout && Exit 1 +grep 'CCLD .*baz' stdout && Exit 1 +grep 'CCLD .*bla' stdout && Exit 1 + +: diff --git a/tests/silent3.test b/tests/silent3.test new file mode 100755 index 000000000..0df2bae22 --- /dev/null +++ b/tests/silent3.test @@ -0,0 +1,95 @@ +#!/bin/sh +# Copyright (C) 2009 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 . + +# Check silent mode, with libtool, standard depmode case. + +# Please keep this file in sync with silent4.test. + +required=libtoolize +. ./defs + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AC_CONFIG_FILES([sub/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_LIBTOOL +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent +# Need generic and non-generic rules. +lib_LTLIBRARIES = libfoo.la libbar.la +libbar_la_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent subdir-objects +# Need generic and non-generic rules. +lib_LTLIBRARIES = libbaz.la libbla.la +libbla_la_CFLAGS = $(AM_CFLAGS) +EOF + +cat > libfoo.c <<'EOF' +int main () +{ + return 0; +} +EOF +cp libfoo.c libbar.c +cp libfoo.c sub/libbaz.c +cp libfoo.c sub/libbla.c + +libtoolize +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure +$MAKE >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout && Exit 1 +grep ' -o libfoo' stdout && Exit 1 +grep mv stdout && Exit 1 +grep ' CC .*foo\.' stdout +grep ' CC .*bar\.' stdout +grep ' CC .*baz\.' stdout +grep ' CC .*bla\.' stdout +grep ' CCLD .*foo' stdout +grep ' CCLD .*bar' stdout +grep ' CCLD .*baz' stdout +grep ' CCLD .*bla' stdout + +$MAKE clean +$MAKE V=1 >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout +grep ' -o libfoo' stdout +grep ' CC .*foo\.' stdout && Exit 1 +grep ' CC .*bar\.' stdout && Exit 1 +grep ' CC .*baz\.' stdout && Exit 1 +grep ' CC .*bla\.' stdout && Exit 1 +grep ' CCLD .*foo' stdout && Exit 1 +grep ' CCLD .*bar' stdout && Exit 1 +grep ' CCLD .*baz' stdout && Exit 1 +grep ' CCLD .*bla' stdout && Exit 1 + +: diff --git a/tests/silent4.test b/tests/silent4.test new file mode 100755 index 000000000..dc897cb23 --- /dev/null +++ b/tests/silent4.test @@ -0,0 +1,98 @@ +#!/bin/sh +# Copyright (C) 2009 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 . + +# Check silent mode, with libtool, non-fastdep case +# (so that, with GCC, we also cover the other code paths in depend2). + +# Please keep this file in sync with silent3.test. + +required="libtoolize gcc" +. ./defs + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AC_CONFIG_FILES([sub/Makefile]) +AC_PROG_CC +AM_PROG_CC_C_O +AC_PROG_LIBTOOL +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent +# Need generic and non-generic rules. +lib_LTLIBRARIES = libfoo.la libbar.la +libbar_la_CFLAGS = $(AM_CFLAGS) +SUBDIRS = sub +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent subdir-objects +# Need generic and non-generic rules. +lib_LTLIBRARIES = libbaz.la libbla.la +libbla_la_CFLAGS = $(AM_CFLAGS) +EOF + +cat > libfoo.c <<'EOF' +int main () +{ + return 0; +} +EOF +cp libfoo.c libbar.c +cp libfoo.c sub/libbaz.c +cp libfoo.c sub/libbla.c + +libtoolize +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +./configure am_cv_CC_dependencies_compiler_type=gcc +$MAKE >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout && Exit 1 +grep ' -o libfoo' stdout && Exit 1 +grep mv stdout && Exit 1 +grep ' CC .*foo\.' stdout +grep ' CC .*bar\.' stdout +grep ' CC .*baz\.' stdout +grep ' CC .*bla\.' stdout +grep ' CCLD .*foo' stdout +grep ' CCLD .*bar' stdout +grep ' CCLD .*baz' stdout +grep ' CCLD .*bla' stdout + +$MAKE clean +$MAKE V=1 >stdout || { cat stdout; Exit 1; } +cat stdout +grep ' -c' stdout +grep ' -o libfoo' stdout +grep ' CC .*foo\.' stdout && Exit 1 +grep ' CC .*bar\.' stdout && Exit 1 +grep ' CC .*baz\.' stdout && Exit 1 +grep ' CC .*bla\.' stdout && Exit 1 +grep ' CCLD .*foo' stdout && Exit 1 +grep ' CCLD .*bar' stdout && Exit 1 +grep ' CCLD .*baz' stdout && Exit 1 +grep ' CCLD .*bla' stdout && Exit 1 + +$MAKE distclean + +: diff --git a/tests/silent5.test b/tests/silent5.test new file mode 100755 index 000000000..4a2fd5d80 --- /dev/null +++ b/tests/silent5.test @@ -0,0 +1,162 @@ +#!/bin/sh +# Copyright (C) 2009 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 . + +# Check silent mode, languages other than C. + +required='g++ gfortran flex bison' +. ./defs + +set -e + +mkdir sub + +cat >>configure.in <<'EOF' +AM_PROG_CC_C_O +AC_PROG_CXX +AC_PROG_F77 +AC_PROG_FC +AC_PROG_LEX +AC_PROG_YACC +AC_CONFIG_FILES([sub/Makefile]) +AC_OUTPUT +EOF + +cat > Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent +# Need generic and non-generic rules. +bin_PROGRAMS = foo bar +bar_CFLAGS = $(AM_CFLAGS) +foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y +SUBDIRS = sub +AM_YFLAGS = -d +LDADD = $(LEXLIB) +BUILT_SOURCES = foo6.h +EOF + +cat > sub/Makefile.am <<'EOF' +AUTOMAKE_OPTIONS = silent subdir-objects +# Need generic and non-generic rules. +bin_PROGRAMS = baz bla +bla_CFLAGS = $(AM_CFLAGS) +baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y +AM_YFLAGS = -d +LDADD = $(LEXLIB) +BUILT_SOURCES = baz6.h +EOF + +cat > foo1.cpp <<'EOF' +int main () +{ + return 0; +} +EOF +cat > foo2.f90 <<'EOF' + subroutine foo2 + return + end +EOF +cat > foo3.f <<'EOF' + subroutine foo3 + return + end +EOF +cat > foo5.l <<'EOF' +%% +"END" return EOF; +. +%% +EOF +cat > foo6.y <<'EOF' +%{ +void yyerror (char *s) {} +%} +%token EOF +%% +fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {}; +EOF +cp foo1.cpp bar.c +cp foo1.cpp sub/baz.c +cp foo1.cpp sub/bla.c +cp foo1.cpp sub/baz1.cpp +cp foo2.f90 sub/baz2.f90 +cp foo3.f sub/baz3.f +cp foo5.l sub/baz5.l +cp foo6.y sub/baz6.y + +$ACLOCAL +$AUTOMAKE --add-missing +$AUTOCONF + +# configure once for fastdep, once for non-fastdep +for config_args in '' am_cv_CC_dependencies_compiler_type=gcc +do + ./configure $config_args + $MAKE >stdout || { cat stdout; Exit 1; } + cat stdout + grep ' -c' stdout && Exit 1 + grep ' -o ' stdout && Exit 1 + grep mv stdout && Exit 1 + + grep 'CXX .*foo1\.' stdout + grep 'CXX .*baz1\.' stdout + grep 'FC .*foo2\.' stdout + grep 'FC .*baz2\.' stdout + grep 'F77 .*foo3\.' stdout + grep 'F77 .*baz3\.' stdout + grep 'LEX .*foo5\.' stdout + grep 'LEX .*baz5\.' stdout + grep ' CC .*foo5\.' stdout + grep ' CC .*baz5\.' stdout + grep 'YACC .*foo6\.' stdout + grep 'YACC .*baz6\.' stdout + grep ' CC .*foo6\.' stdout + grep ' CC .*baz6\.' stdout + + grep 'CXXLD .*foo' stdout + grep 'CCLD .*bar' stdout + grep 'CXXLD .*baz' stdout + grep 'CCLD .*bla' stdout + + $MAKE clean + $MAKE V=1 >stdout || { cat stdout; Exit 1; } + cat stdout + grep ' -c' stdout + grep ' -o ' stdout + + grep 'CXX .*foo1\.' stdout && Exit 1 + grep 'CXX .*baz1\.' stdout && Exit 1 + grep 'FC .*foo2\.' stdout && Exit 1 + grep 'FC .*baz2\.' stdout && Exit 1 + grep 'F77 .*foo3\.' stdout && Exit 1 + grep 'F77 .*baz3\.' stdout && Exit 1 + grep 'LEX .*foo5\.' stdout && Exit 1 + grep 'LEX .*baz5\.' stdout && Exit 1 + grep ' CC .*foo5\.' stdout && Exit 1 + grep ' CC .*baz5\.' stdout && Exit 1 + grep 'YACC .*foo6\.' stdout && Exit 1 + grep 'YACC .*baz6\.' stdout && Exit 1 + grep ' CC .*foo6\.' stdout && Exit 1 + grep ' CC .*baz6\.' stdout && Exit 1 + + grep 'CXXLD .*foo' stdout && Exit 1 + grep 'CCLD .*bar' stdout && Exit 1 + grep 'CXXLD .*baz' stdout && Exit 1 + grep 'CCLD .*bla' stdout && Exit 1 + $MAKE clean + $MAKE maintainer-clean +done + +: -- 2.34.1