Re: [PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.

2010-07-27 Thread Ralf Wildenhues
Hello Stefano,

* Stefano Lattarini wrote on Tue, Jul 27, 2010 at 10:58:24PM CEST:
> Subject: [PATCH 1/2] Bootstrap: let the user choose which autoconf to 
> use.

Well, you should change

> +AUTOCONF=${AUTOCONF-autoconf}

to
  : ${AUTOCONF=autoconf}

But even then, when developing Automake you will need to be extra
careful to never let autoconf be invoked from the rebuild rules; because
then, it will run plain "autoconf" and not the $AUTOCONF that you set.
So the safe thing to do is to ensure you have the right autoconf early
in $PATH.

The second patch is not ok.  The code prior to your patch already allows
the person running bootstrap to set PERL.  Changing that from an
absolute file name to a non-absolute one is a bad idea, it breaks
several test setups I have, and I've never had any complaints from
people who move their perl installation.

Cheers,
Ralf



Re: [PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.

2010-07-27 Thread Eric Blake
On 07/27/2010 03:37 PM, Stefano Lattarini wrote:
>>> I'm used to this variant, with less typing:
>>> : ${AUTOCONF=autoconf}
>>>
>>> But your way works, too.
> Can you confirm it's as portable as the ways suggested in the autoconf 
> manual?  If yes, do you think it could be an useful addition to that 
> manual?

The autoconf manual already states that ${var:=value} doesn't work, and
that if value occupies more than one word, then you need to use quotes
or an intermediate shell variable.  Then there is the Ultrix bug, where
you need var=${var="$val"} to avoid 8-bit cleanliness issues, and the
Solaris bug where $val containing } causes parse problems, leading to
this recommended construct when you are defaulting to an unknown
intermediate value:

  test "${var+set}" = set || var={value}

But by itself, ${var=value} is portable, where value is not a shell
substitution.

http://www.gnu.org/software/autoconf/manual/autoconf.html#Shell-Substitutions

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.

2010-07-27 Thread Stefano Lattarini
Hi Eric.

At Tuesday 27 July 2010, Eric Blake wrote:
> On 07/27/2010 03:08 PM, Eric Blake wrote:
> > On 07/27/2010 02:58 PM, Stefano Lattarini wrote:
> >> +# Let user choose which version of autoconf to use.
> >> +AUTOCONF=${AUTOCONF-autoconf}
> >> +
> > 
> > I'm used to this variant, with less typing:
> > : ${AUTOCONF=autoconf}
> > 
> > But your way works, too.
Can you confirm it's as portable as the ways suggested in the autoconf 
manual?  If yes, do you think it could be an useful addition to that 
manual?

Thanks,
   Stefano



Re: [PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.

2010-07-27 Thread Eric Blake
On 07/27/2010 03:08 PM, Eric Blake wrote:
> On 07/27/2010 02:58 PM, Stefano Lattarini wrote:
>> +# Let user choose which version of autoconf to use.
>> +AUTOCONF=${AUTOCONF-autoconf}
>> +
> 
> I'm used to this variant, with less typing:
> 
> : ${AUTOCONF=autoconf}
> 
> But your way works, too.

Huh, I just realized that:

: ${var=val}

might be less efficient, if $var is already defined and contains
globbing characters.  To avoid wasting time on (unnecessary) file name
expansion, it is faster to use

: "${var=val}"

even though both variants should (normally) have the same end result.

In particular, on cygwin, doing globs can cause a side effect - if you
ever cause a glob() to take place on a string containing a backslash,
cygwin will warn on the console (but thankfully not pollute stderr)
about your potential use of non-POSIX filenames.  The bash-completion
package applied several patches earlier this year to avoid globs, in
part because of that cygwin side-effect.  I should probably document
that in the autoconf manual.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.

2010-07-27 Thread Eric Blake
On 07/27/2010 02:58 PM, Stefano Lattarini wrote:
> +# Let user choose which version of autoconf to use.
> +AUTOCONF=${AUTOCONF-autoconf}
> +

I'm used to this variant, with less typing:

: ${AUTOCONF=autoconf}

But your way works, too.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


[PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.

2010-07-27 Thread Stefano Lattarini
Separated in two patches for easier cherry-picking.  For maint.

Regards,
   Stefano

-*-*-

Subject: [PATCH 1/2] Bootstrap: let the user choose which autoconf to 
use.

* bootstrap ($AUTOCONF): New variable, from the environment.
Use it instead of calling "autoconf" directly.
---
 ChangeLog |6 ++
 bootstrap |5 -
 2 files changed, 10 insertions(+), 1 deletions(-)

-*-*-

* bootstrap ($PERL): Let the user override it from the
environment.
Do not explicitly look for perl in $PATH anymore.
($PATH_SEPARATOR): Removed, it's no more needed.
---
 ChangeLog |6 ++
 bootstrap |   32 ++--
 2 files changed, 8 insertions(+), 30 deletions(-)
From e634c0a0639a9760e3806a6b36cb103867ccaff2 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini 
Date: Tue, 27 Jul 2010 22:44:54 +0200
Subject: [PATCH 1/2] Bootstrap: let the user choose which autoconf to use.

* bootstrap ($AUTOCONF): New variable, from the environment.
Use it instead of calling "autoconf" directly.
---
 ChangeLog |6 ++
 bootstrap |5 -
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7edcae8..4107f75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-27  Stefano Lattarini  
+
+	Bootstrap: let the user choose which autoconf to use.
+	* bootstrap ($AUTOCONF): New variable, from the environment.
+	Use it instead of calling "autoconf" directly.
+
 2010-07-21  Stefano Lattarini  
 
 	Modernize and improve test scripts `subdir*.test'.
diff --git a/bootstrap b/bootstrap
index 7766bd3..5a7a3ce 100755
--- a/bootstrap
+++ b/bootstrap
@@ -35,6 +35,9 @@ set -e
 # Set program basename.
 me=`echo "$0" | sed 's,^.*/,,'`
 
+# Let user choose which version of autoconf to use.
+AUTOCONF=${AUTOCONF-autoconf}
+
 # Find perl.  Code based on Autoconf, but without non-POSIX support.
 if test -z "$PERL"; then
   save_IFS=$IFS
@@ -133,7 +136,7 @@ cd ..
 
 # Run the autotools.
 $PERL ./aclocal.tmp -I m4
-autoconf
+$AUTOCONF
 $PERL ./automake.tmp
 
 # Remove temporary files and directories.
-- 
1.7.1

From e32586b1f85ee2a6ccb323874cd0b8922e5c5cb8 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini 
Date: Tue, 27 Jul 2010 22:50:38 +0200
Subject: [PATCH 2/2] Bootstrap: let the user choose which perl to use.

* bootstrap ($PERL): Let the user override it from the
environment.
Do not explicitly look for perl in $PATH anymore.
($PATH_SEPARATOR): Removed, it's no more needed.
---
 ChangeLog |6 ++
 bootstrap |   32 ++--
 2 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4107f75..705b487 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-07-27  Stefano Lattarini  
 
+	Bootstrap: let the user choose which perl to use.
+	* bootstrap ($PERL): Let the user override it from the
+	environment.
+	Do not explicitly look for perl in $PATH anymore.
+	($PATH_SEPARATOR): Removed, it's no more needed.
+
 	Bootstrap: let the user choose which autoconf to use.
 	* bootstrap ($AUTOCONF): New variable, from the environment.
 	Use it instead of calling "autoconf" directly.
diff --git a/bootstrap b/bootstrap
index 5a7a3ce..ba21315 100755
--- a/bootstrap
+++ b/bootstrap
@@ -19,43 +19,15 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see .
 
-# Find the path separator.
-# (Snippet copied from configure's initialization in Autoconf 2.65)
-if test "${PATH_SEPARATOR+set}" != set; then
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-(PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-  PATH_SEPARATOR=';'
-  }
-fi
-
 # Don't ignore failures.
 set -e
 
 # Set program basename.
 me=`echo "$0" | sed 's,^.*/,,'`
 
-# Let user choose which version of autoconf to use.
+# Let user choose which version of autoconf and perl to use.
 AUTOCONF=${AUTOCONF-autoconf}
-
-# Find perl.  Code based on Autoconf, but without non-POSIX support.
-if test -z "$PERL"; then
-  save_IFS=$IFS
-  IFS=$PATH_SEPARATOR
-  for dir in $PATH; do
-IFS=$save_IFS
-test -z "$dir" && dir=.
-if test -x "$dir/perl" && test ! -d "$dir/perl"; then
-  PERL="$dir/perl"
-  break
-fi
-  done
-fi
-
-if test -z "$PERL"; then
-  echo "$me: cannot find perl" >&2
-  exit 1
-fi
+PERL=${PERL-perl}
 
 # Variables to substitute.
 VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac`
-- 
1.7.1



Re: Document current policy for development with git.

2010-07-27 Thread Eric Blake
On 07/27/2010 01:43 PM, Ralf Wildenhues wrote:
> Hi Stefano, all,
> 
> I've rewritten the HACKING section on development with git a bit to
> better reflect what I currently think is a good way to go on.  Patch
> for maint.  Comments appreciated.
> 
> FYI, I am waiting for regenerating the in-tree files with Autoconf 2.67
> until the official tarballs have come out.

The official tarballs are available, just not at ftp.gnu.org yet.

http://people.redhat.com/eblake/autoconf/
http://lists.gnu.org/archive/html/autoconf-patches/2010-07/msg00087.html

[What a pain, waiting for gnupload to actually work with my new key -
it's been more than a week now]

Back on topic, your patch to HACKING looks nice.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: Document current policy for development with git.

2010-07-27 Thread Stefano Lattarini
At Tuesday 27 July 2010, Ralf Wildenhues wrote:
> Hi Stefano, all,
> 
> I've rewritten the HACKING section on development with git a bit to
> better reflect what I currently think is a good way to go on. 
> Patch for maint.  Comments appreciated.
> 
> FYI, I am waiting for regenerating the in-tree files with Autoconf
> 2.67 until the official tarballs have come out.
See the "tangential issue" below about this...

> Thanks,
> Ralf
> 
> Document current policy for development with git.
> 
> * HACKING (Working with git): Overhaul.
> Prompted by suggestion from Stefano Lattarini.
> 
> diff --git a/HACKING b/HACKING
> index ee85917..8facbeb 100644
> --- a/HACKING
> +++ b/HACKING
> @@ -92,28 +92,46 @@
> 
> 
>  
> -= Working with git/CVS
> += Working with git
> 
>  * To regenerate dependent files created by aclocal and automake,
>use the `bootstrap' script.  It uses the code from the source
>tree, so the resulting files (aclocal.m4 and Makefile.in) should
>be the same as you would get if you install this version of
> -  automake and use it to generate those files.
> +  automake and use it to generate those files.  Be sure to have the
> +  latest stable version of Autoconf installed.
Somewhat of a tangetial issue here...
I suggest that we modify the bootstrap script to offer an easy way to
override which autoconf command is used (currently there is just a call
to "autoconf" directly).  This might help developers who want their
systems to stick with older autoconf by default -- they might have
/usr/bin/autoconf or /usr/local/bin/autoconf being, say, autoconf 2.64,
and have autoconf 2.67 installed only as /usr/local/bin/autoconf-2.67.
Ideally they should be able to do:
  $ AUTOCONF=autoconf-2.67 ./bootstrap
and have everything working seamlessly.  WDYT?

>  * Dependent files aclocal.m4, configure and Makefile.in in all
>directories should be up to date in the git repository, so that
>the changes in them can be easily noticed and analyzed.
> 
> -* Avoid merge commits on the master branch of the public git repository.
> -  For unpublished changes in your development tree, it's easiest to
> -  rebase against the current master before applying them, this preserves
> -  a linear history.
> -
> -* For changes to appear in more than one branch, apply them to the
> -  master branch and then cherry-pick them to the stable branch from
> -  master if possible.  This keeps the master uncluttered and preserves
> -  meta-data on the stable branches.
> -
> +* The git tree currently carries a number of branches: master for the
> +  current development, and release branches named branch-X.Y.  The maint
> +  branch serves as common ground for both master and the active release
> +  branches.  Changes intended for both should be applied to maint, which
> +  should then be merged to release branches and master, of course after
> +  suitable testing.  It is advisable to merge only after a set of related
> +  commits have been applied.
I like the wording.  However, I'd also like to see a simple example, such as
the one you provided me with in a previous mail (which helped me a lot).  Do
you think this would be overkill?

> +* For bug fixes of long-standing bugs, it may be useful to commit them to
> +  a new branch based off of the commit that introduced the bug, and merge
> +  this bugfix branch into active branches that descend from the buggy commit.
Good and clear.

> +* There may be a number of longer-lived feature branches for new 
> developments.
> +  They should be based off of a common ancestor of all active branches to
> +  which the feature should be merged later.  The next branch may serve as
> +  common ground for feature merging and testing, should they not be ready
> +  for master yet.
Shouldn't we mention the "next" branch before, together with master and maint
and branch-X.Y? That would make things clearer IMHO.  For the rest, good
and clear.

> +* master and release branches should not be rewound, i.e., should always
> +  fast-forward, except maybe for privacy issues.
What about adding this too?
``... privacy issues (e.g. if a developer has mistakenly pushed a commit
containing private or sensitive data)''

> +  The maint branch should not
> +  be rewound except maybe after retiring a release branch or a new stable
> +  release.  For next, and for feature branches, the announcement for the
> +  branch should document rewinding policy.
> +
> +* In order for rebasing and merging of ChangeLog entries to work seamlessly,
> +  install and configure git-merge-changelog, currently available as gnulib
> +  module.
Good and clear.

Thanks,
   Stefano



Re: Avoid syntax error if IF-TRUE part of AM_COND_IF is empty.

2010-07-27 Thread Eric Blake
On 07/27/2010 01:33 PM, Ralf Wildenhues wrote:
> Adding this patch to maint to fix the glitch at least for the IF-TRUE
> case.  It's unfortunately not fixable as nicely in the IF-FALSE case
> since we don't want to override $? there.
> 
> @@ -27,8 +27,8 @@ AC_DEFUN([AM_COND_IF],
>  [m4_ifndef([_AM_COND_VALUE_$1],
>  [m4_fatal([$0: no such condition "$1"])])dnl
>  _AM_COND_IF([$1])dnl
> -if _AM_COND_VALUE_$1; then
> -  m4_default([$2], [:])
> +if _AM_COND_VALUE_$1; then :
> +  m4_n([$2])[]dnl

Rather than open-coding the shell if, why not use:

AS_IF([_AM_COND_VALUE_$1],
[m4_n([$2])[]dnl
  m4_ifval([$3], [_AM_COND_ELSE([$1])],
[body of else])

which (should) take care of an empty else for you as well, if AS_IF is
up to par (and if not, report that on the autoconf list).

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: trivial typo

2010-07-27 Thread Ralf Wildenhues
Hi Patrick,

* Patrick Welche wrote on Sat, Jul 10, 2010 at 06:48:30PM CEST:
> -Script are not distributed by default; as we have just seen, those
> +Scripts are not distributed by default; as we have just seen, those

Thanks!  Committed to my maint branch, will be pushed out within the
next couple of days.

Cheers,
Ralf

2010-07-27  Patrick Welche(tiny change)

Fix typo in the manual.
* doc/automake.texi (Scripts): Fix typo.

diff --git a/doc/automake.texi b/doc/automake.texi
index c6067f9..0fd233b 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6912,7 +6912,7 @@ Scripts
 dist_bin_SCRIPTS = my_script
 @end example
 
-Script are not distributed by default; as we have just seen, those
+Scripts are not distributed by default; as we have just seen, those
 that should be distributed can be specified using a @code{dist_}
 prefix as with other primaries.
 



Document current policy for development with git.

2010-07-27 Thread Ralf Wildenhues
Hi Stefano, all,

I've rewritten the HACKING section on development with git a bit to
better reflect what I currently think is a good way to go on.  Patch
for maint.  Comments appreciated.

FYI, I am waiting for regenerating the in-tree files with Autoconf 2.67
until the official tarballs have come out.

Thanks,
Ralf

Document current policy for development with git.

* HACKING (Working with git): Overhaul.
Prompted by suggestion from Stefano Lattarini.

diff --git a/HACKING b/HACKING
index ee85917..8facbeb 100644
--- a/HACKING
+++ b/HACKING
@@ -92,28 +92,46 @@
 
 
 
-= Working with git/CVS
+= Working with git
 
 * To regenerate dependent files created by aclocal and automake,
   use the `bootstrap' script.  It uses the code from the source
   tree, so the resulting files (aclocal.m4 and Makefile.in) should
   be the same as you would get if you install this version of
-  automake and use it to generate those files.
+  automake and use it to generate those files.  Be sure to have the
+  latest stable version of Autoconf installed.
 
 * Dependent files aclocal.m4, configure and Makefile.in in all
   directories should be up to date in the git repository, so that
   the changes in them can be easily noticed and analyzed.
 
-* Avoid merge commits on the master branch of the public git repository.
-  For unpublished changes in your development tree, it's easiest to
-  rebase against the current master before applying them, this preserves
-  a linear history.
-
-* For changes to appear in more than one branch, apply them to the
-  master branch and then cherry-pick them to the stable branch from
-  master if possible.  This keeps the master uncluttered and preserves
-  meta-data on the stable branches.
-
+* The git tree currently carries a number of branches: master for the
+  current development, and release branches named branch-X.Y.  The maint
+  branch serves as common ground for both master and the active release
+  branches.  Changes intended for both should be applied to maint, which
+  should then be merged to release branches and master, of course after
+  suitable testing.  It is advisable to merge only after a set of related
+  commits have been applied.
+
+* For bug fixes of long-standing bugs, it may be useful to commit them to
+  a new branch based off of the commit that introduced the bug, and merge
+  this bugfix branch into active branches that descend from the buggy commit.
+
+* There may be a number of longer-lived feature branches for new developments.
+  They should be based off of a common ancestor of all active branches to
+  which the feature should be merged later.  The next branch may serve as
+  common ground for feature merging and testing, should they not be ready
+  for master yet.
+
+* master and release branches should not be rewound, i.e., should always
+  fast-forward, except maybe for privacy issues.  The maint branch should not
+  be rewound except maybe after retiring a release branch or a new stable
+  release.  For next, and for feature branches, the announcement for the
+  branch should document rewinding policy.
+
+* In order for rebasing and merging of ChangeLog entries to work seamlessly,
+  install and configure git-merge-changelog, currently available as gnulib
+  module.
 
 
 = Test suite



Fix AM_COND_IF for gone-invalid condition shell expression.

2010-07-27 Thread Ralf Wildenhues
Fixing this kind of nasty (silent wrong-code) bug, for maint.
Hope AM_COND_IF hasn't seen a lot of uses this way yet.

Cheers,
Ralf

Fix AM_COND_IF for gone-invalid condition shell expression.

* m4/cond-if.m4 (AM_COND_IF): test contents of $COND_TRUE
variable, rather than re-evaluating the shell expression for
the condition.
* tests/cond40.test: Extend test.
* NEWS: Update.

diff --git a/NEWS b/NEWS
index b8a0f08..b3d4131 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,9 @@ Bugs fixed in 1.11.0a:
 
   - The `dist-xz' option now uses `xz -9' for maximum compression.
 
+  - The AM_COND_IF macro also works if the shell expression for the conditional
+is no longer valid for the condition.
+
 * Long standing bugs:
 
   - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python'
diff --git a/m4/cond-if.m4 b/m4/cond-if.m4
index 2500422..3a25e32 100644
--- a/m4/cond-if.m4
+++ b/m4/cond-if.m4
@@ -6,7 +6,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 3
 
 # _AM_COND_IF
 # _AM_COND_ELSE
@@ -20,14 +20,14 @@ m4_define([_AM_COND_ENDIF])
 
 # AM_COND_IF(COND, [IF-TRUE], [IF-FALSE])
 # ---
-# If the shell condition matching COND is true, execute IF-TRUE,
-# otherwise execute IF-FALSE.  Allow automake to learn about conditional
-# instantiating macros (the AC_CONFIG_FOOS).
+# If the shell condition COND is true, execute IF-TRUE, otherwise execute
+# IF-FALSE.  Allow automake to learn about conditional instantiating macros
+# (the AC_CONFIG_FOOS).
 AC_DEFUN([AM_COND_IF],
 [m4_ifndef([_AM_COND_VALUE_$1],
   [m4_fatal([$0: no such condition "$1"])])dnl
 _AM_COND_IF([$1])dnl
-if _AM_COND_VALUE_$1; then :
+if test -z "$$1_TRUE"; then :
   m4_n([$2])[]dnl
 m4_ifval([$3],
 [_AM_COND_ELSE([$1])dnl
diff --git a/tests/cond40.test b/tests/cond40.test
index d30f0ab..c0bde5c 100755
--- a/tests/cond40.test
+++ b/tests/cond40.test
@@ -35,9 +35,14 @@ AM_COND_IF([COND],
 AM_COND_IF([COND],
   [AC_CONFIG_FILES([file1])])
 
-AM_CONDITIONAL([COND1], [test "$cond1" = yes])
-AM_CONDITIONAL([COND2], [test "$cond2" = yes])
-AM_CONDITIONAL([COND3], [test "$cond3" = yes])
+# Things should work even at a time when the shell expressions
+# for the conditional are not valid any more.
+ok=$cond1
+AM_CONDITIONAL([COND1], [test "$ok" = yes])
+ok=$cond2
+AM_CONDITIONAL([COND2], [test "$ok" = yes])
+ok=$cond3
+AM_CONDITIONAL([COND3], [test "$ok" = yes])
 
 AM_COND_IF([COND1],
   [AM_COND_IF([COND2], [FOO([file2])],



Avoid syntax error if IF-TRUE part of AM_COND_IF is empty.

2010-07-27 Thread Ralf Wildenhues
Adding this patch to maint to fix the glitch at least for the IF-TRUE
case.  It's unfortunately not fixable as nicely in the IF-FALSE case
since we don't want to override $? there.

Cheers,
Ralf

Avoid syntax error if IF-TRUE part of AM_COND_IF expands empty.

* m4/cond-if.m4 (AM_COND_IF): Ensure IF-TRUE part is never empty
to avoid shell syntax error if the m4 expansion is empty.
* tests/cond40.test: Enhance test.

diff --git a/m4/cond-if.m4 b/m4/cond-if.m4
index 9f2611e..2500422 100644
--- a/m4/cond-if.m4
+++ b/m4/cond-if.m4
@@ -1,12 +1,12 @@
 # AM_COND_IF-*- Autoconf -*-
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
+# serial 2
 
 # _AM_COND_IF
 # _AM_COND_ELSE
@@ -27,8 +27,8 @@ AC_DEFUN([AM_COND_IF],
 [m4_ifndef([_AM_COND_VALUE_$1],
   [m4_fatal([$0: no such condition "$1"])])dnl
 _AM_COND_IF([$1])dnl
-if _AM_COND_VALUE_$1; then
-  m4_default([$2], [:])
+if _AM_COND_VALUE_$1; then :
+  m4_n([$2])[]dnl
 m4_ifval([$3],
 [_AM_COND_ELSE([$1])dnl
 else
diff --git a/tests/cond40.test b/tests/cond40.test
index be94fe3..d30f0ab 100755
--- a/tests/cond40.test
+++ b/tests/cond40.test
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+#! /bin/sh
+# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
@@ -28,6 +28,10 @@ AC_DEFUN([FOO],
 [AC_CONFIG_FILES([$1])])
 
 AM_CONDITIONAL([COND], [test "$cond" = yes])
+# Next lines should not cause a shell syntax error.
+AM_COND_IF([COND])
+AM_COND_IF([COND],
+  [AC_SUBST([BAR])])
 AM_COND_IF([COND],
   [AC_CONFIG_FILES([file1])])
 



Coverage: bogus option to AM_INIT_AUTOMAKE.

2010-07-27 Thread Ralf Wildenhues
I'm adding this trivial coverage addition to maint.

Cheers,
Ralf

Coverage: bogus option to AM_INIT_AUTOMAKE.

* tests/init2.test: New test.
* tests/Makefile.am: Update.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 568be8a..4fc4d15 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -353,6 +353,7 @@ include.test \
 include2.test \
 info.test \
 init.test \
+init2.test \
 insh2.test \
 install2.test \
 installdir.test \
diff --git a/tests/init2.test b/tests/init2.test
new file mode 100755
index 000..31631d7
--- /dev/null
+++ b/tests/init2.test
@@ -0,0 +1,32 @@
+#! /bin/sh
+# Copyright (C) 2010 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 .
+
+# Make sure we give a sensible error message when AM_INIT_AUTOMAKE
+# contains junk.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >configure.in <