From: Ralf Wildenhues Date: Tue, 27 Jul 2010 19:20:04 +0000 (+0200) Subject: Avoid syntax error if IF-TRUE part of AM_COND_IF expands empty. X-Git-Tag: v1.11.1b~67^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f92ad1d0a8d323a94c0abf5ad28fa2f31e9cd50;p=thirdparty%2Fautomake.git 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. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index e8ffcf847..231230120 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-07-27 Ralf Wildenhues + 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. + Coverage: bogus option to AM_INIT_AUTOMAKE. * tests/init2.test: New test. * tests/Makefile.am: Update. diff --git a/m4/cond-if.m4 b/m4/cond-if.m4 index 9f2611ecb..250042247 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 be94fe347..d30f0abf9 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])])