On Sun, Dec 19, 2010 at 14:13 UTC, Ralf Wildenhues <ralf.wildenh...@gmx.de> wrote: > * Dave Hart wrote on Sun, Dec 19, 2010 at 02:47:58PM CET: >> On Sun, Dec 19, 2010 at 10:48 UTC, Ralf Wildenhues wrote: >> > * Dave Hart wrote on Sat, Dec 18, 2010 at 07:57:13PM CET: >> >> m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], >> >> [m4_ifndef([$1_TRUE], >> >> [m4_fatal([$0: no such condition "$1"])])dnl >> >> if test -z "$$1_TRUE"; then : >> >> m4_n([$2])[]dnl >> >> m4_ifval([$3], >> >> [else >> >> $3 >> >> ])dnl >> >> fi[]dnl >> >> ])]) >> > >> > Looks ok to me. If you experience problems later, please report back. >> >> When tested as above, my AM_COND_IF replacement was occurring with >> Automake 1.11, leading me to change the m4_fatal message to make it >> clear it was coming from a AM_COND_IF imposter. Substituting >> m4_define for AC_DEFUN cured the problem. Is it inappropriate to try >> to conditionalize AC_DEFUN under m4_ifndef? > > Can you show the error you got, and maybe also a small example how you > got it? I'm not sure I fully understand otherwise. > > Normally, AC_DEFUN under m4_ifndef should work ok. Hmm, you might want > to move the AC_DEFUN to a new line, as aclocal essentially greps for it.
The error I got was AM_COND_IF: no such condition "..." which was coming from the replacement AM_COND_IF despite using Automake 1.11. I can no longer reproduce that failure, so it was probably a result of my own misunderstanding. Now it's working for me with Automake 1.10 and 1.11 with AC_DEFUN on its own line, or combined with the prior. > With m4_define, you need to ensure yourself that the .m4 file you put > this in is included in aclocal.m4 (or configure.ac). Good to know, thanks. I removed the "no such condition" check because $1_TRUE is not m4_define()d and I didn't want to get into redefining AM_CONDITIONAL simply to enable this check in the AM_COND_IF backport. Here's what I've hopefully settled on: dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however dnl AM_COND_IF is new to Automake 1.11. To use it on new Automake without dnl requiring same, a fallback implementation for older Autoconf is provided. dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code dnl is correct only in terms of m4sh generated script. m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF], [ if test -z "$$1_TRUE"; then : m4_n([$2])[]dnl m4_ifval([$3], [else $3 ])dnl fi[]dnl ])]) Thanks for all the assistance, Dave Hart