automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/4] Documentation and tests for the `silent' option.


From: Ralf Wildenhues
Subject: [PATCH 3/4] Documentation and tests for the `silent' option.
Date: Sun, 8 Mar 2009 10:40:20 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

This one is pretty straight-forward.  Test that we diagnose recursive
variable expansions, unless we use the `silent' option.  It is a bit of
a hack to have `silent' turn off a warning, but it is necessary in order
to avoid warnings from the variables generated by automake.

The maintainer-check change deserves a note, too: typically, commands
like
  make $target VAR=VALUE

do not work with non-GNU make and recursive makefiles, when VAR has been
set in the makefiles.  There is a portable alternative,
  env VAR=VALUE make -e $target

but it has the downside of letting all other environment stuff possibly
override makefile variables, too.  This can lead to ugly issues.

So we have to tell Makefile.am authors to _not_ set such variables.
This also means that they cannot use
  # default to verbose mode:
  AC_SUBST([V], [1])

for the same reason.  For DESTDIR, this requirement is rather easy to
fulfill, but for `V', I suppose package authors will be tempted to add
such a setting.

I don't know of a good way to allow to choose the default verbosity at
configure run time, that avoids this issue.  Suggestions welcome.

Cheers,
Ralf

        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.

diff --git a/Makefile.am b/Makefile.am
index d637e10..8b87a8c 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/NEWS b/NEWS
index d4b59e9..78ce7ab 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 0dfa9c7..0d104cc 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
address@hidden 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
 @address@hidden@address@hidden, where @var{ALPHA} is a
 letter; it should be omitted for non-alpha releases.
 
address@hidden @option{silent}
address@hidden Option, @option{silent}
address@hidden silent
+Enable silent build rules.  This will cause many build rules to output a
+status line of the form
+
address@hidden
+  GEN @var{output-file}
address@hidden example
+
address@hidden
+instead of printing the command that will be executed to update
address@hidden  It will also silence @command{libtool} output.
+
address@hidden @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
address@hidden option if your package needs to build with
address@hidden implementations that do not support it.  The
address@hidden 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 8a65684..5ff30e4 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/dollarvar.test b/tests/dollarvar.test
new file mode 100755
index 0000000..3c43a61
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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 0000000..b3c03e4
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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 0000000..136952e
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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 0000000..0df2bae
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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 0000000..dc897cb
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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 0000000..4a2fd5d
--- /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 <http://www.gnu.org/licenses/>.
+
+# 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
+
+:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]