automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-744-


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-744-g475fe69
Date: Sat, 09 Apr 2011 21:31:10 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=475fe6935b26ff42cfe7b88bd87cf0563a7c866e

The branch, master has been updated
       via  475fe6935b26ff42cfe7b88bd87cf0563a7c866e (commit)
       via  9010c3f5eb3b1adb2d1b6b95ea7bb13c2f689287 (commit)
       via  38f41a03549259cc1a70d5da10b082b1ba86d04b (commit)
       via  a22e2cddc790290d62d115c5e6b83c5f9186d4e9 (commit)
      from  3dc39576936d18aa897bf955ab55916f61244a36 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 475fe6935b26ff42cfe7b88bd87cf0563a7c866e
Merge: 9010c3f 38f41a0
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 9 23:27:48 2011 +0200

    Merge branch 'maint'

commit 9010c3f5eb3b1adb2d1b6b95ea7bb13c2f689287
Author: Stefano Lattarini <address@hidden>
Date:   Wed Apr 6 14:45:40 2011 +0200

    coverage: add tests on remake rules in more complex situations
    
    * tests/defs (using_gmake): New function.
    (for tool in $required): Use it when $tool is 'GNUmake'.
    * tests/remake-moved-m4-file.test: New test.
    * tests/remake-deleted-m4-file.test: Likewise.
    * tests/remake-renamed-m4-file.test: Likewise.
    * tests/remake-renamed-m4-macro-and-file.test: Likewise.
    * tests/remake-renamed-m4-macro.test: Likewise.
    * tests/remake-add-acsubst-gnulib.test: Likewise.
    * tests/remake-add-header-gnulib.test: Likewise.
    * tests/remake-remove-header-gnulib.test: Likewise.
    * tests/Makefile.am (TESTS): Update.

commit a22e2cddc790290d62d115c5e6b83c5f9186d4e9
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 9 21:41:03 2011 +0200

    typofix in 'tests/defs'
    
    * tests/defs: Fix typo (`itslef' instead of `itself') in
    comments.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   35 +++++
 NEWS                                               |    3 +
 THANKS                                             |    1 +
 automake.in                                        |   10 ++-
 tests/Makefile.am                                  |    9 ++
 tests/Makefile.in                                  |    9 ++
 tests/defs                                         |   37 +++++-
 tests/{java-noinst.test => java-check.test}        |   46 +++++---
 tests/remake-deleted-m4-file.test                  |   74 +++++++++++
 tests/remake-gnulib-add-acsubst.test               |  132 +++++++++++++++++++
 tests/remake-gnulib-add-header.test                |  108 ++++++++++++++++
 tests/remake-gnulib-remove-header.test             |  134 ++++++++++++++++++++
 tests/remake-moved-m4-file.test                    |   78 ++++++++++++
 tests/remake-renamed-m4-file.test                  |   85 +++++++++++++
 tests/remake-renamed-m4-macro-and-file.test        |   88 +++++++++++++
 ...-override.test => remake-renamed-m4-macro.test} |   64 ++++++----
 16 files changed, 861 insertions(+), 52 deletions(-)
 copy tests/{java-noinst.test => java-check.test} (54%)
 create mode 100755 tests/remake-deleted-m4-file.test
 create mode 100755 tests/remake-gnulib-add-acsubst.test
 create mode 100755 tests/remake-gnulib-add-header.test
 create mode 100755 tests/remake-gnulib-remove-header.test
 create mode 100755 tests/remake-moved-m4-file.test
 create mode 100755 tests/remake-renamed-m4-file.test
 create mode 100755 tests/remake-renamed-m4-macro-and-file.test
 copy tests/{yflags-force-override.test => remake-renamed-m4-macro.test} (54%)

diff --git a/ChangeLog b/ChangeLog
index 3de7584..96969a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2011-04-09  Stefano Lattarini  <address@hidden>
+
+       java: check_JAVA does not cause compilation by "make all" anymore
+       Fixes automake bug#8234.
+       * automake.in (handle_java): Make stamp of class files built from
+       java sources in $(check_JAVA) a dependency of `check' target, not
+       `all' target.
+       * tests/java-check.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+       * THANKS: Update.
+       Report from Petteri Räty.
+
+2011-04-09  Stefano Lattarini  <address@hidden>
+           Bruno Haible  <address@hidden>
+
+       coverage: add tests on remake rules in more complex situations
+       * tests/defs (using_gmake): New function.
+       (for tool in $required): Use it when $tool is 'GNUmake'.
+       * tests/remake-moved-m4-file.test: New test.
+       * tests/remake-deleted-m4-file.test: Likewise.
+       * tests/remake-renamed-m4-file.test: Likewise.
+       * tests/remake-renamed-m4-macro-and-file.test: Likewise.
+       * tests/remake-renamed-m4-macro.test: Likewise.
+       * tests/remake-add-acsubst-gnulib.test: Likewise.
+       * tests/remake-add-header-gnulib.test: Likewise.
+       * tests/remake-remove-header-gnulib.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-09  Stefano Lattarini  <address@hidden>
+
+       typofix in 'tests/defs'
+       * tests/defs: Fix typo (`itslef' instead of `itself') in
+       comments.
+
 2011-04-06  Stefano Lattarini  <address@hidden>
 
        coverage: more on java support EXTRA_ and noinst_ prefixes
diff --git a/NEWS b/NEWS
index 1fc539d..2646297 100644
--- a/NEWS
+++ b/NEWS
@@ -122,6 +122,9 @@ Bugs fixed in 1.11a:
     with Tru64/OSF 5.1 sh upon unreadable log files any more.
 
   - The makedepend depmode now works better with VPATH builds.
+
+  - Java sources specified with check_JAVA are not compiled anymore upon
+    "make all", but only upon "make check".
 
 New in 1.11:
 
diff --git a/THANKS b/THANKS
index 9a76e7f..5ee0e4c 100644
--- a/THANKS
+++ b/THANKS
@@ -282,6 +282,7 @@ Peter O'Gorman              address@hidden
 Peter Rosin            address@hidden
 Peter Seiderer         address@hidden
 Petter Reinholdtsen    address@hidden
+Petteri Räty          address@hidden
 Phil Edwards           address@hidden
 Phil Nelson            address@hidden
 Philip Fong            address@hidden
diff --git a/automake.in b/automake.in
index f9a6821..a1c6f30 100644
--- a/automake.in
+++ b/automake.in
@@ -5153,8 +5153,14 @@ sub handle_java
        $dir = $curs;
       }
 
-
-    push (@all, 'class' . $dir . '.stamp');
+    if ($dir eq 'check')
+      {
+        push (@check, "class$dir.stamp");
+      }
+    else
+      {
+        push (@all, "class$dir.stamp");
+      }
 }
 
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c890f4c..5b02a66 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -521,6 +521,7 @@ interp2.test \
 java.test \
 java2.test \
 java3.test \
+java-check.test \
 javaprim.test \
 javasubst.test \
 java-extra.test \
@@ -790,6 +791,14 @@ remake10b.test \
 remake10c.test \
 remake11.test \
 remake12.test \
+remake-gnulib-add-acsubst.test \
+remake-gnulib-add-header.test \
+remake-gnulib-remove-header.test \
+remake-moved-m4-file.test \
+remake-deleted-m4-file.test \
+remake-renamed-m4-file.test \
+remake-renamed-m4-macro-and-file.test \
+remake-renamed-m4-macro.test \
 pr8365-remake-timing.test \
 regex.test \
 regex-obsolete.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a759958..fd573d5 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -782,6 +782,7 @@ interp2.test \
 java.test \
 java2.test \
 java3.test \
+java-check.test \
 javaprim.test \
 javasubst.test \
 java-extra.test \
@@ -1051,6 +1052,14 @@ remake10b.test \
 remake10c.test \
 remake11.test \
 remake12.test \
+remake-gnulib-add-acsubst.test \
+remake-gnulib-add-header.test \
+remake-gnulib-remove-header.test \
+remake-moved-m4-file.test \
+remake-deleted-m4-file.test \
+remake-renamed-m4-file.test \
+remake-renamed-m4-macro-and-file.test \
+remake-renamed-m4-macro.test \
 pr8365-remake-timing.test \
 regex.test \
 regex-obsolete.test \
diff --git a/tests/defs b/tests/defs
index f6237d3..e994a40 100644
--- a/tests/defs
+++ b/tests/defs
@@ -146,6 +146,34 @@ AUTOMAKE_fails ()
   AUTOMAKE_run 1 ${1+"$@"}
 }
 
+# using_gmake
+# -----------
+# Return success if $MAKE is GNU make, return failure otherwise.
+# Caches the result for speed reasons.
+using_gmake ()
+{
+  case $am__using_gmake in
+    yes)
+      return 0;;
+    no)
+      return 1;;
+    '')
+      # Use --version AND -v, because SGI Make doesn't fail on --version.
+      # Also grep for GNU because newer versions of FreeBSD make do
+      # not complain about `--version' (they seem to silently ignore it).
+      if $MAKE --version -v | grep GNU; then
+        am__using_gmake=yes
+        return 0
+      else
+        am__using_gmake=no
+        return 1
+      fi;;
+    *)
+      echo "invalid value for \$am__using_gmake: '$am__using_gmake'" >&2
+      Exit 99;;
+  esac
+}
+
 commented_sed_unindent_prog='
   /^$/b                    # Nothing to do for empty lines.
   x                        # Get x<indent> into pattern space.
@@ -182,7 +210,7 @@ unindent ()
 ## ----------------------------------------------------------- ##
 
 # Print it here, so that the user will see it also if the test
-# will be skipped due to some tool missing in $PATH itslef.
+# will be skipped due to some tool missing in $PATH itself.
 echo "$PATH"
 
 # Look for (and maybe set up) required tools and/or system features; skip
@@ -217,11 +245,8 @@ do
       etags --version -o /dev/null || exit 77
       ;;
     GNUmake)
-      # Use --version AND -v, because SGI Make doesn't fail on --version.
-      # Also grep for GNU because newer versions of FreeBSD make do
-      # not complain about `--version' (they seem to silently ignore it).
-      echo "$me: running $MAKE --version -v | grep GNU"
-      ( $MAKE --version -v | grep GNU ) || exit 77
+      echo "$me: determine if $MAKE is GNU make"
+      using_gmake || exit 77
       ;;
     gcc)
       # When gcc is required, export `CC=gcc' so that ./configure
diff --git a/tests/java-noinst.test b/tests/java-check.test
similarity index 54%
copy from tests/java-noinst.test
copy to tests/java-check.test
index 130ea63..fd3fc96 100755
--- a/tests/java-noinst.test
+++ b/tests/java-check.test
@@ -14,7 +14,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure that noinst_JAVA causes generated *.class files not to be 
installed.
+# Make sure that check_JAVA causes *.class files to be built only with
+# "make check", and not also with "make all".
+# See automake bug#8234.
 
 . ./defs || Exit 1
 
@@ -26,28 +28,40 @@ AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
 AC_OUTPUT
 END
 
-cat > Foo.java <<'END'
-class Foo { }
+cat > Makefile.am << 'END'
+check_JAVA = One.java Two.java
+END
+
+cat > One.java <<'END'
+class One { }
+END
+
+cat > Two.java <<'END'
+class Two { // Deliberately missing closing bracket.
 END
 
 $ACLOCAL
 $AUTOCONF
+$AUTOMAKE
+
+inst=`pwd`/_inst
 
-: > Makefile.in # Will be updated later.
+./configure --prefix="$inst"
 
-./configure --prefix="`pwd`/_inst"
+$MAKE
+ls | $EGREP '\.(class|stamp)$' && Exit 1
 
-# We need this hacky loop because multiple uses of the JAVA primary
-# in the same Makefile.am are not allowed.
+# Make Two.java compilable.
+echo '}' >> Two.java
 
-for prefix in '' nodist_ dist_; do
-  echo "${prefix}noinst_JAVA = Foo.java" > Makefile.am
-  $AUTOMAKE
-  ./config.status Makefile
-  $MAKE
-  test -f Foo.class
-  $MAKE install
-  test ! -d _inst
-done
+# "make check" should compile files in $(check_JAVA) ...
+$MAKE check
+ls -l # for debugging
+test -f One.class
+test -f Two.class
+# ... but should *not* install them.
+$FGREP checkdir Makefile && Exit 1
+$MAKE install
+test -d _inst && Exit 1
 
 :
diff --git a/tests/remake-deleted-m4-file.test 
b/tests/remake-deleted-m4-file.test
new file mode 100755
index 0000000..f71d882
--- /dev/null
+++ b/tests/remake-deleted-m4-file.test
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when an m4 file gets removed and the macros it
+# defined get inlined into the caller.  Try with both an indirect
+# call and a direct one.  This can be seen as testing the "deleted
+# header file" issue w.r.t. aclocal.m4 dependencies.  See also related
+# test `acloca22.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+FOO_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+macro_value='the_answer=42; AC_SUBST([the_answer])'
+
+mkdir m4
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO_MACRO], [BAR_MACRO])
+END
+
+cat > m4/bar.m4 <<END
+AC_DEFUN([BAR_MACRO], [$macro_value])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+$sleep
+
+sed -e "s|BAR_MACRO|$macro_value|" m4/foo.m4 > t
+mv -f t m4/foo.m4
+rm -f m4/bar.m4
+
+using_gmake || $MAKE Makefile
+$MAKE test
+
+$sleep
+
+sed -e "s|FOO_MACRO|$macro_value|" configure.in > t
+mv -f t configure.in
+rm -f m4/foo.m4
+
+using_gmake || $MAKE Makefile
+$MAKE test
+
+:
diff --git a/tests/remake-gnulib-add-acsubst.test 
b/tests/remake-gnulib-add-acsubst.test
new file mode 100755
index 0000000..74bd202
--- /dev/null
+++ b/tests/remake-gnulib-add-acsubst.test
@@ -0,0 +1,132 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when a new AC_SUBST'd variable is added, and C header
+# files are involved.
+# This test overlaps with others, and is not strictly necessary per se,
+# but it exercises a real use case (from gnulib, see:
+#  <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00005.html>
+# for more info).
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+MY_MACROS
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+BUILT_SOURCES = foo.h
+edit_h = sed -e 's|address@hidden@|@foovar@|g'
+foo.h: foo.in.h
+       $(edit_h) < $(srcdir)/foo.in.h > address@hidden
+       cat address@hidden;: for debugging
+       mv -f address@hidden $@
+EXTRA_DIST = foo.in.h
+MOSTLYCLEANFILES = foo.h foo.h-t
+END
+
+mkdir m4
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([MY_MACROS], [
+     FOO_MACRO
+dnl: ZAP_MACRO
+])
+END
+
+cat > m4/bar.m4 <<'END'
+AC_DEFUN([FOO_MACRO], [
+     foovar=42; AC_SUBST([foovar])
+dnl: barvar=47; AC_SUBST([barvar])
+])
+END
+
+cat > foo.in.h <<'END'
+#define foo @foovar@
+END
+
+cat > foo.c <<'END'
+#include "foo.h"
+int main (void) { return 0; }
+typedef int checkfoo[1 - 2 * (foo != 42)];
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+
+: AC_SUBST @barvar@ and add it to foo.h.
+
+$sleep
+
+sed -e 's/^dnl:/   /' m4/bar.m4 > t
+mv -f t m4/bar.m4
+cat m4/bar.m4
+
+cat >> foo.in.h <<'END'
+#define bar @barvar@
+END
+
+cat >> foo.c <<'END'
+typedef int checkbar[1 - 2 * (bar != 47)];
+END
+
+cat >> Makefile.am <<'END'
+edit_h += -e 's|address@hidden@|@barvar@|g'
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+
+: AC_SUBST @zapvar@ and add it to foo.h.
+# Do it in a slightly different way from how it was done for @address@hidden
+
+$sleep
+
+cat >> Makefile.am <<'END'
+edit_h += -e 's|address@hidden@|$(zapvar)|g'
+END
+
+cat >> foo.c <<'END'
+typedef int checkzap[1 - 2 * (zap != 163)];
+END
+
+sed -e 's/^dnl://' m4/foo.m4 > t
+mv -f t m4/foo.m4
+cat m4/foo.m4
+
+cat >> foo.in.h <<'END'
+#define zap @zapvar@
+END
+
+cat >> m4/bar.m4 <<'END'
+AC_DEFUN([ZAP_MACRO], [zapvar=163; AC_SUBST([zapvar])])
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+
+$MAKE distcheck
+
+:
diff --git a/tests/remake-gnulib-add-header.test 
b/tests/remake-gnulib-add-header.test
new file mode 100755
index 0000000..597a19a
--- /dev/null
+++ b/tests/remake-gnulib-add-header.test
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when a new C header "guarded" by AC_SUBST'd
+# variables is added.
+# This test overlaps with others, and is not strictly necessary per se,
+# but it exercises a real use case (from gnulib, see:
+#  <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00005.html>
+# for more info).
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_CC
+MY_MACROS
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I .
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+BUILT_SOURCES = $(STDIO_H)
+stdio.h: stdio.in.h
+       cp $(srcdir)/stdio.in.h $@
+MOSTLYCLEANFILES = stdio.h
+EXTRA_DIST = stdio.in.h
+check-local:
+       ls -l . $(srcdir)
+       if test -n '$(STDIO_H)'; then \
+           test -f stdio.h || exit 1; \
+       else \
+           test ! -f stdio.h || exit 1; \
+       fi
+END
+
+cat > macros.m4 <<'END'
+AC_DEFUN([MY_MACROS], [
+  override_stdio=false
+  if $override_stdio; then
+    STDIO_H=stdio.h
+    use_dummies=1
+  else
+    STDIO_H=
+    use_dummies=0
+  fi
+  AC_SUBST([STDIO_H])
+  AC_DEFINE_UNQUOTED([USE_DUMMIES], [$use_dummies],
+    [Whether to use dummy types.])
+])
+END
+
+cat > stdio.in.h <<'END'
+typedef struct dummyfile { void *p; } DUMMYFILE;
+END
+
+cat > foo.c <<'END'
+#include <config.h>
+#include <stdio.h>
+#if USE_DUMMIES
+DUMMYFILE *f;
+#else
+FILE *f;
+#endif
+int main () { return 0; }
+END
+
+$ACLOCAL -I .
+$AUTOHEADER
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+$MAKE
+ls -l
+test ! -f stdio.h
+# Also try our build rules in a VPATH build.
+$MAKE distcheck
+
+# No need to sleep here: "./configure" and "make distcheck" above
+# have already slept enough.
+
+sed -e 's/^\( *override_stdio\)=.*$/\1=:/' macros.m4 > t
+mv -f t macros.m4
+
+using_gmake || $MAKE Makefile
+$MAKE
+ls -l
+test -f stdio.h
+# Also try our build rules in a VPATH build.
+$MAKE distcheck
+
+:
diff --git a/tests/remake-gnulib-remove-header.test 
b/tests/remake-gnulib-remove-header.test
new file mode 100755
index 0000000..c28a078
--- /dev/null
+++ b/tests/remake-gnulib-remove-header.test
@@ -0,0 +1,134 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when a C header "guarded" by AC_SUBST'd variables
+# is not needed anymore, or when it's needed again.
+# This test requires some user-level machinery, overlaps with other tests,
+# and is not strictly necessary per se, but it exercises a real, important
+# use case (from gnulib, see:
+#  <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00005.html>
+# for more info).
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_CC
+MY_MACROS
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I .
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+BUILT_SOURCES = $(STDIO_H)
+if REPLACE_STDIO_H
+stdio.h: stdio.in.h $(top_builddir)/config.status
+       cp $(srcdir)/stdio.in.h $@
+else
+stdio.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES = stdio.h
+END
+
+cat > macros.m4 <<'END'
+AC_DEFUN([MY_MACROS], [
+  override_stdio=:
+  if $override_stdio; then
+    STDIO_H=stdio.h
+    use_dummies=1
+  else
+    STDIO_H=
+    use_dummies=0
+  fi
+  AC_SUBST([STDIO_H])
+  AC_DEFINE_UNQUOTED([USE_DUMMIES], [$use_dummies],
+    [Whether to use dummy types.])
+  AM_CONDITIONAL([REPLACE_STDIO_H], [test -n "$STDIO_H"])
+])
+END
+
+cat > stdio.in.h <<'END'
+typedef struct dummyfile { void *p; } DUMMYFILE;
+END
+
+cat > foo.c <<'END'
+#include <config.h>
+#include <stdio.h>
+#if USE_DUMMIES
+DUMMYFILE *f;
+#else
+FILE *f;
+#endif
+int main () { return 0; }
+END
+
+$ACLOCAL -I .
+$AUTOHEADER
+$AUTOMAKE
+$AUTOCONF
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  # Do not reject slow dependency extractors: we need dependency tracking.
+  $srcdir/configure --enable-dependency-tracking
+  # Skip the test if dependency tracking couldn't be activated.
+  $FGREP 'depmode=none' Makefile && Exit 77
+
+  $MAKE
+  ls -l
+  test -f stdio.h
+
+  # Simulate that we don't need our custom stdio.h anymore.
+
+  $sleep
+  sed -e 's/^\( *override_stdio\)=.*$/\1=false/' $srcdir/macros.m4 > t
+  diff $srcdir/macros.m4 t && Exit 99 # sanity check
+  mv -f t $srcdir/macros.m4
+
+  using_gmake || $MAKE Makefile
+  $MAKE
+  ls -l
+  test ! -f stdio.h
+
+  # And now simulate that we want our custom stdio.h back.
+
+  $sleep
+  sed -e 's/^\( *override_stdio\)=.*$/\1=:/' $srcdir/macros.m4 > t
+  diff $srcdir/macros.m4 t && Exit 99 # sanity check
+  mv -f t $srcdir/macros.m4
+
+  using_gmake || $MAKE Makefile
+  $MAKE
+  ls -l
+  test -f stdio.h
+
+  $MAKE distclean
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake-moved-m4-file.test b/tests/remake-moved-m4-file.test
new file mode 100755
index 0000000..55b0bce
--- /dev/null
+++ b/tests/remake-moved-m4-file.test
@@ -0,0 +1,78 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when m4 files get moved among different "include
+# dirs" (i.e. those passed to aclocal with `-I' option).
+
+. ./defs || Exit 1
+
+distdir=$me-1.0
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I d1 -I d2 -I d3
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir d1 d2 d3
+
+cat > d1/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO])
+END
+
+cat > d1/foo.m4 <<'END'
+AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I d1
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+# Move one file.
+mv d1/foo.m4 d2/foo.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/d2/foo.m4
+test ! -f $distdir/d1/foo.m4
+test -f $distdir/d1/macros.m4
+test ! -f $distdir/d2/macros.m4
+
+# Move both files at once.
+mv d1/macros.m4 d3/macros.m4
+mv d2/foo.m4 d3/foo.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/d3/foo.m4
+test -f $distdir/d3/macros.m4
+test ! -f $distdir/d1/foo.m4
+test ! -f $distdir/d2/foo.m4
+test ! -f $distdir/d1/macros.m4
+test ! -f $distdir/d2/macros.m4
+
+:
diff --git a/tests/remake-renamed-m4-file.test 
b/tests/remake-renamed-m4-file.test
new file mode 100755
index 0000000..b2ebd79
--- /dev/null
+++ b/tests/remake-renamed-m4-file.test
@@ -0,0 +1,85 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when m4 files get renamed.
+
+. ./defs || Exit 1
+
+distdir=$me-1.0
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir m4
+
+cat > m4/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO])
+END
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+# Rename one file at the time.
+
+mv m4/foo.m4 m4/bar.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/bar.m4
+test ! -f $distdir/m4/foo.m4
+
+mv m4/macros.m4 m4/defs.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/defs.m4
+test ! -f $distdir/m4/macros.m4
+
+# Rename both files at once.
+
+mv m4/bar.m4 m4/quux.m4
+mv m4/defs.m4 acinclude.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/quux.m4
+test -f $distdir/acinclude.m4
+test ! -f $distdir/m4/foo.m4
+test ! -f $distdir/m4/bar.m4
+test ! -f $distdir/m4/macros.m4
+test ! -f $distdir/m4/defs.m4
+
+:
diff --git a/tests/remake-renamed-m4-macro-and-file.test 
b/tests/remake-renamed-m4-macro-and-file.test
new file mode 100755
index 0000000..370c1ce
--- /dev/null
+++ b/tests/remake-renamed-m4-macro-and-file.test
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 2011 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 <http://www.gnu.org/licenses/>.
+
+# Test remake rules when an m4 file gets renamed and *simultaneously*
+# an m4 macro in it gets renamed.  Kudos to Bruno Haible for thinking
+# about this situation.
+
+. ./defs || Exit 1
+
+distdir=$me-1.0
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir m4
+
+cat > m4/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO_MACRO])
+END
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO_MACRO], [the_answer=42; AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+# Rename only one file and one macro.
+
+$sleep
+sed -e 's/FOO_MACRO/BAR_MACRO/' m4/foo.m4 > m4/bar.m4
+rm -f m4/foo.m4
+sed -e 's/FOO_MACRO/BAR_MACRO/' m4/macros.m4 > t
+mv -f t m4/macros.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/bar.m4
+test -f $distdir/m4/macros.m4
+test ! -f $distdir/m4/foo.m4
+
+# Rename both at once.
+
+$sleep
+sed -e 's/BAR_MACRO/QUUX_MACRO/' \
+  m4/bar.m4 > m4/quux.m4
+sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' \
+  m4/macros.m4 > m4/defs.m4
+rm -f m4/macros.m4 m4/bar.m4
+sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' configure.in > t
+mv -f t configure.in
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/quux.m4
+test -f $distdir/m4/defs.m4
+test ! -f $distdir/m4/bar.m4
+test ! -f $distdir/m4/macros.m4
+
+:
diff --git a/tests/yflags-force-override.test 
b/tests/remake-renamed-m4-macro.test
similarity index 54%
copy from tests/yflags-force-override.test
copy to tests/remake-renamed-m4-macro.test
index b76b529..82fcf45 100755
--- a/tests/yflags-force-override.test
+++ b/tests/remake-renamed-m4-macro.test
@@ -14,51 +14,59 @@
 # 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 that automake can cope with a definition of the $(YFLAGS) variable
-# in Makefile.am (even if that is extremely bad practice, because that
-# variable is user-reserved).
+# Test remake rules when the name of an m4 macro change.  Try both with
+# and without indirection.
 
-required=yacc
 . ./defs || Exit 1
 
 cat >> configure.in <<'END'
-AC_PROG_CC
-AC_PROG_YACC
+MY_MACRO
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-bin_PROGRAMS = foo
-foo_SOURCES = foo.y
-# Don't do this in a real-life Makefile.am!
-YFLAGS = -d -v
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
 END
 
-cat > foo.y << 'END'
-%{
-int yylex () { return 0; }
-void yyerror (char *s) { return; }
-int main () { return 0; }
-%}
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
+mkdir m4
 
-$ACLOCAL
-$AUTOMAKE -a -Wno-gnu
+cat > m4/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO_1])
+END
 
-$EGREP '(foo|YFLAGS)' Makefile.in # for debugging
-grep '^foo.h *:' Makefile.in
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO_1], [the_answer=42
+                   AC_SUBST([the_answer])])
+END
 
+$ACLOCAL -I m4
 $AUTOCONF
+$AUTOMAKE
+
 ./configure
+$MAKE test
+
+$sleep
+
+for x in macros foo; do
+  sed -e 's/FOO_1/FOO_2/' m4/$x.m4 > t
+  mv -f t m4/$x.m4
+done
+
+using_gmake || $MAKE Makefile
+$MAKE test
 
-$MAKE
+$sleep
 
-test -f foo.c
-test -f foo.h
-test -f foo.output
+for f in m4/macros.m4 configure.in; do
+  sed -e 's/MY_MACRO/YOUR_MACRO/' $f > t
+  mv -f t $f
+done
 
-$MAKE distcheck
+using_gmake || $MAKE Makefile
+$MAKE test
 
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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