autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CONFIG_FILES and chmod


From: Eric Blake
Subject: Re: AC_CONFIG_FILES and chmod
Date: Tue, 16 Jun 2009 20:19:23 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:

> > m4_esyscmd([for f in foo bar;
> >         do echo "AC_CONFIG_FILES([$f],[chmod +x $f])"; done])
> > 
> > Eric, is that safe?

No.  The echo statement didn't provide enough [] quoting, so you are in effect 
invoking:

AC_CONFIG_FILES(foo,chmod +x foo)
AC_CONFIG_FILES(bar,chmod +x bar)

Where you really wanted:

AC_CONFIG_FILES([foo],[chmod +x foo])
AC_CONFIG_FILES([bar],[chmod +x bar])

> That may be safe, I haven't checked, but in any case it is very ugly.
> Please do not use m4_esyscmd unless it cannot be helped at all, it's
> an ugly crutch and will only lead to problems.

I agree - why spawn another process to do something that m4 already does 
perfectly fine by itself?  Especially when it is so hard to get m4_esyscmd to 
have the right level of quoting.

> 
> You can use
>   m4_foreach_w([my_file], [autoconf autoheader ...],
>                [AC_CONFIG_FILES([my_file], [chmod +x my_file])])

I haven't tested this, but it seems like you are passing "my_file" as the tag 
rather than "autoconf", "autoheader".  In other words, I think you want the 
my_file temporary variable expanded prior to invoking AC_CONFIG_FILES.  Also, 
expanding my_file rather than using m4_defn([my_file]) can lead to surprises if 
any of your list of files contains $ or another macro name.

So to be safe, I would write this as follows (also using newer m4sugar features 
for efficiency):

m4_define([my_CONFIG_EXEC_FILE],
  [AC_CONFIG_FILES([$1], [chmod +x $1])])
m4_map_args([my_CONFIG_EXEC_FILE(], [)],
  [autoconf], [autoheader], ...)

-- 
Eric Blake







reply via email to

[Prev in Thread] Current Thread [Next in Thread]