Hello Ralf,
On Tue, Mar 28, 2006 at 03:36:25PM +0200, Ralf Wildenhues wrote:
> > As we both know, the reason is that the first parameter of
> > AC_CONFIG_FOOS is split by whitespace before any expansion.
this was also true for Autoconf 2.59.
> Backwards compatible to what?
To previous version, of course.
Let me make some experiments with Autoconf 2.59:
Your overquoted example:
$ cat configure.ac
AC_INIT(a,1,b)
AC_DEFUN([FOO],
[AC_CONFIG_FILES([m4_default([$1], [foobar])])])
FOO
FOO([baz])
AC_OUTPUT
$ ../autoconf
configure.ac:4: /usr/bin/m4: Warning: Too few arguments to built-in
`m4_bpatsubst'
autom4te: /usr/bin/m4 failed with exit status: 1
$
If I remove the extra quotes around m4_default, things work.
And what about the `ifelse' case? Let's try this:
$ cat configure.ac
AC_INIT(a,1,b)
AC_DEFUN([FOO],
[AC_CONFIG_FILES([ifelse([$1],,[foobar],[$1])])])
FOO
FOO([baz])
AC_OUTPUT
$ ../autoconf
$
Wow! It worked! But please note that the real reason is that there are
no spaces in the argument list of `ifelse'.
And the generated configure is corrupted:
$ grep foobar configure
ac_config_files="$ac_config_files ifelse([],,[foobar],[])"
ac_config_files="$ac_config_files ifelse([baz],,[foobar],[baz])"
"foobar" ) CONFIG_FILES="$CONFIG_FILES foobar" ;;
$
> It breaks the AC_PREFIX_CONFIG_H macro.
Well I haven't tried this macro specifically.
But because of the above, I believe that things are reasonably backward
compatible. In the examples above, you have to use m4_default/m4_if
unquoted and it was this way in 2.59, too.
Hope this clarifies it,
Stepan