Re: compile wrapper script with C++ file

2009-11-15 Thread Ralf Wildenhues
Hi David, and sorry for the long delay,

* David Byron wrote on Fri, Nov 13, 2009 at 08:18:35PM CET:
 On Friday September 4th, 2009, Eric Blake wrote: 
  According to David Byron on 8/14/2009 1:57 PM:
   I'm not sure whether this is something I'm doing wrong
   or something wrong with automake, autoconf or libtool.
   At the moment I'm leaning to autoconf + automake.
 
  compile is maintained by automake, so I've redirected your
  patch there.  FWIW, it looks okay to me, but Ralf will
  have to chime in.

As David already correctly noted, merely changing the compile script
is not sufficient; it would also need some AM_PROG_CXX_C_O macro.
I have some unfinished patches from long ago for that (C++ and Fortran)
for both Automake and Autoconf (which also needs likewise additions).

However, I never finished them, for they'd only really help some SCO C++
compiler, and a few Fortran compilers, but it still wouldn't help with
MSVC: first, it *has* an /Fo$object switch, then there are still lots of
other things that won't work, like /Fe$executable.  For most of these
issues, you can use a wrapper script like cccl, or cegcc, or a couple of
others I forgot now.  But then, you don't need above changes, and the
least you want on w32 with slow fork emulations is another wrapper
script (the `compile' one) sitting in between make, the compiler,
possibly libtool, and a wrapper script or compiler.

I'm not sure about the best way to proceed here, or what level of
emulation to add to `compile', but going just one step seems less
attractive than the current status quo or going even further.

Hope that helps.

Cheers,
Ralf




Re: Makefile broken after removing included *.am file

2009-11-15 Thread Ralf Wildenhues
Hi Peter,

* Peter Johansson wrote on Sun, Nov 15, 2009 at 04:37:24AM CET:
 I included a file in my Makefile.am, but then I decided it was not
 useful anymore so I removed the include statement and deleted the
 file. That resulted in a broken Makefile, and running `make all'
 resulted in:
 
 make: *** No rule to make target `aminclude.am', needed by
 `Makefile.in'.  Stop.
 
 This is very similar to the deleted header file problem for *.m4
 files that was fixed in version 1.11 by adding a stub rule. I
 suppose this problem could be solved in the same fashion.

Thanks for the bug report and the test; that sounds like a good
suggestion to me.

I am currently testing this patch series (generated changes elided).
Notes:

- This made me find a bug in the current remaking rules: if we remove
some subdir Makefile.am and also let, say, aclocal.m4 be out of date,
then remaking won't fail, but IMHO it is more likely that failure would
be expected.  After all, if I change some Makefile from being automake-
generated to being not automake-generated, after removing Makefile.am
and writing Makefile.in, I can go the extra mile and issue
  ./config.status some/Makefile

manually, to avoid failure.  Ensuring that failure happens otherwise is
addressed in the second patch.

- The first patch merely adds some coverage that a generated Makefile.am
works (and continues to work with further changes).

- I was going to put %MAKEFILE-AM% in $(am__makefile_in_deps) as well,
however they are not symmetric in all respects: if automake is invoked
without a Makefile argument, then it ignores Makefile.in files without
a corresponding Makefile.am file.  Having an empty dependency like
  $(srcdir)/Makefile.am:

will not make this any worse, but it felt weird enough anyway; also,
for C code we also don't introduce such an empty rule for the primary
.c source file either.

The patch series needs (trivial) fixing of include.test at least.

Cheers,
Ralf


From 0be2441c40c5ce68ec3b3bac32a852c3402be883 Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues ralf.wildenh...@gmx.de
Date: Sun, 15 Nov 2009 13:49:21 +0100
Subject: [PATCH 1/3] Ensure remaking Makefile.in works with a generated 
Makefile.am.

* tests/remake8.test: New test.
* tests/Makefile.am: Update.
---
 tests/Makefile.am  |1 +
 tests/Makefile.in  |1 +
 tests/remake8.test |   63 
 3 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100755 tests/remake8.test

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2c2e89a..935b3d0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -571,6 +571,7 @@ remake4.test \
 remake5.test \
 remake6.test \
 remake7.test \
+remake8.test \
 regex.test \
 req.test \
 reqd.test \
diff --git a/tests/remake8.test b/tests/remake8.test
new file mode 100755
index 000..b2c9573
--- /dev/null
+++ b/tests/remake8.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 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/.
+
+# Make sure remaking Makefile.in works with a generated Makefile.am.
+
+. ./defs || Exit 1
+set -e
+
+cat  configure.in  'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+cat  Makefile.am 'END'
+SUBDIRS = sub
+END
+
+cat  sub/Makefile.am.in 'END'
+$(srcdir)/Makefile.am: $(srcdir)/Makefile.am.in generated.am
+   cat $(srcdir)/Makefile.am.in $(srcdir)/generated.am  $@
+
+# `make check' should fail without the generated content.
+check-local: foo
+## generated content follows.
+END
+
+cp sub/Makefile.am.in sub/Makefile.am
+
+cat  sub/generated.am 'END'
+EXTRA_DIST = generated.am Makefile.am.in
+foo:
+   echo $@
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+mkdir build
+cd build
+../configure
+$MAKE
+
+$sleep
+
+touch ../sub/Makefile.am.in
+$MAKE
+$MAKE distcheck
+
+Exit 0
-- 
1.6.5.1.31.gad12b


From 1e543359949a364ef5ee97441e56b07735ad87ae Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues ralf.wildenh...@gmx.de
Date: Sun, 15 Nov 2009 13:50:51 +0100
Subject: [PATCH 2/3] WIP Ensure removing a Makefile.am provokes an error.

If some subdir Makefile.am was removed, and also some configure
input file was out of date, then the rebuilding rules might not
cause an error due to the removed Makefile.am: the toplevel
refresh rule invokes automake without arguments, which ignores
nonexistent Makefile.am files.

* lib/am/configure.am [!TOPDIR_P] (%MAKEFILE-IN%): 

coverage: a bunch of harmless corner cases

2009-11-15 Thread Ralf Wildenhues
I'm pushing these to perl-coverage and merging to master.
None of them fix a bug, they merely increase coverage of
rare code paths in automake.in (by roughly 0.1%, but hey).

Cheers,
Ralf

Coverage for corner cases in derive_suffix.

Ensure unrelatex SUFFIXES entries and unrelated inference rules
are ignored silently.
* tests/ext3.test: New test.
* tests/Makefile.am: Update.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8107dec..519b406 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -282,6 +282,7 @@ exeext4.test \
 exsource.test \
 ext.test \
 ext2.test \
+ext3.test \
 extra.test \
 extra3.test \
 extra4.test \
diff --git a/tests/ext3.test b/tests/ext3.test
new file mode 100755
index 000..0a691c5
--- /dev/null
+++ b/tests/ext3.test
@@ -0,0 +1,41 @@
+#! /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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/.
+
+# Cover corner cases of derive_suffix wrt. file extensions:
+# - extension declared with SUFFIXES but with no suffix rule for it
+# - extension with a suffix rule but none that leads us to $(OBJEXT)
+# In both cases, we don't try to create a rule; but we shouldn't
+# fail either, because magic might be happening behind our back.
+
+. ./defs || Exit 1
+
+set -e
+
+cat  configure.in  'END'
+END
+
+cat  Makefile.am  'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.goo
+SUFFIXES = .goo
+bar_SOURCES = bar.woo
+.woo.zoo: ; making a zoo $@ from a woo $
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+Exit 0

Coverage for user-provided _LINK variables.

* tests/link_override.test: New test.
* tests/Makefile.am: Adjust.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 03b04fa..8107dec 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -407,6 +407,7 @@ link_fc.test \
 link_fccxx.test \
 link_fcxx.test \
 link_f_only.test \
+link_override.test \
 lisp2.test \
 lisp3.test \
 lisp4.test \
diff --git a/tests/link_override.test b/tests/link_override.test
new file mode 100755
index 000..41788a1
--- /dev/null
+++ b/tests/link_override.test
@@ -0,0 +1,46 @@
+#! /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 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/.
+
+# Test to make sure _LINK variables are detected and used as documented.
+
+. ./defs || Exit 1
+
+set -e
+
+cat  configure.in  'END'
+AC_PROG_CC
+END
+
+cat  Makefile.am  'END'
+bin_PROGRAMS = foo bar baz boo
+foo_LINK = $(LINK)
+bar_LINK = $(LINK)
+bar_LDFLAGS = $(AM_LDFLAGS)
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+# We should use foo_LINK not LINK.
+grep '.\$(foo_LINK)' Makefile.in
+grep '.\$(LINK).*foo' Makefile.in  Exit 1
+
+# We should not override the user definition of bar_LINK.
+# IOW, bar_LDFLAGS is useless unless bar_LINK refers to it.
+grep '^ *bar_LINK *=.*bar_LDFLAGS' Makefile.in  Exit 1
+grep '.\$(bar_LINK).*bar' Makefile.in
+
+Exit 0

Coverage: warn about substitutions that need EXTRA_PRIMARY.

* tests/extra9.test: New test.
* tests/Makefile.am: Adjust.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d01293..03b04fa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -289,6 +289,7 @@ extra5.test \
 extra6.test \
 extra7.test \
 extra8.test \
+extra9.test \
 f90only.test \
 flavor.test \
 flibs.test \
diff --git a/tests/extra9.test b/tests/extra9.test
new file mode 100755
index 000..fefd385
--- /dev/null
+++ b/tests/extra9.test
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright (C) 2009  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU 

Re: Add missing bootstrap file

2009-11-15 Thread Alfred M. Szmidt
   Index: automake/m4/init.m4
   ===
   --- automake.orig/m4/init.m4
   +++ automake/m4/init.m4
   @@ -107,6 +107,7 @@ dnl is hooked onto _AC_COMPILER_EXEEXT e
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
  [AM_CONDITIONAL([am__EXEEXT], [test -n $EXEEXT])])])dnl
   +AM_SILENT_RULES([yes])
])

Why is this needed?  Maybe the problem can be solved in a better way.




Re: Add missing bootstrap file

2009-11-15 Thread Jan Engelhardt

[Note that this has nothing to do with the bootstrap file]


On Sunday 2009-11-15 17:44, Alfred M. Szmidt wrote:

   Index: automake/m4/init.m4
   ===
   --- automake.orig/m4/init.m4
   +++ automake/m4/init.m4
   @@ -107,6 +107,7 @@ dnl is hooked onto _AC_COMPILER_EXEEXT e
AC_CONFIG_COMMANDS_PRE(dnl
[m4_provide_if([_AM_COMPILER_EXEEXT],
  [AM_CONDITIONAL([am__EXEEXT], [test -n $EXEEXT])])])dnl
   +AM_SILENT_RULES([yes])
])

Why is this needed?  Maybe the problem can be solved in a better way.

Because I want it for everything that I run autoreconf on, regardless of 
whether a package added enough goo to enable it or not. It is thus 
needed in init.m4, because a previously-existing configure may not have 
included the verbosity messages at all.