2010-07-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ 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.
+
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.
- 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'
# 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
# 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
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])],