|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Generating file listsI want to store a list of files determined at configure time into
shell variable, which then gets substituted into a Makefile.in. So, I did this: SYSHEAD_LIST=$srcdir/include/sys/*.h AC_SUBST([SYSHEAD_LIST]) That didn't work as expected, though. It just substituted the string literal. How do I get the desired effect? _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
|
|
Re: Generating file listsHello,
* NightStrike wrote on Fri, Oct 16, 2009 at 07:17:49PM CEST: > I want to store a list of files determined at configure time into > shell variable, which then gets substituted into a Makefile.in. So, I > did this: > > SYSHEAD_LIST=$srcdir/include/sys/*.h > AC_SUBST([SYSHEAD_LIST]) > > That didn't work as expected, though. It just substituted the string literal. > > How do I get the desired effect? Either SYSHEAD_LIST=`echo $srcdir/include/sys/*.h` or set x $srcdir/include/sys/*.h shift SYSHEAD_LIST="$*" This is purely a shell question. Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
|
|
Re: Generating file listsOn Fri, Oct 16, 2009 at 1:22 PM, Ralf Wildenhues <Ralf.Wildenhues@...> wrote:
> Hello, > > * NightStrike wrote on Fri, Oct 16, 2009 at 07:17:49PM CEST: >> I want to store a list of files determined at configure time into >> shell variable, which then gets substituted into a Makefile.in. So, I >> did this: >> >> SYSHEAD_LIST=$srcdir/include/sys/*.h >> AC_SUBST([SYSHEAD_LIST]) >> >> That didn't work as expected, though. It just substituted the string literal. >> >> How do I get the desired effect? > > Either > SYSHEAD_LIST=`echo $srcdir/include/sys/*.h` > > or > set x $srcdir/include/sys/*.h > shift > SYSHEAD_LIST="$*" Which is more autoconfy-correct? > This is purely a shell question. Well, doing it my way worked fine on the command line, both in bash and sh, so I was confused. _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
|
|
Re: Generating file lists* NightStrike wrote on Fri, Oct 16, 2009 at 07:24:36PM CEST:
> On Fri, Oct 16, 2009 at 1:22 PM, Ralf Wildenhues wrote: > > SYSHEAD_LIST=`echo $srcdir/include/sys/*.h` > > > > or > > set x $srcdir/include/sys/*.h > > shift > > SYSHEAD_LIST="$*" > > Which is more autoconfy-correct? Both have drawbacks and advantages. The first has a problem if $srcdir starts with a hyphen (not realistic; that would break lots of other places as well) or has other special characters; you could use AS_ECHO instead though as a remedy. The second does not fork, which is nice. But note that inside a macro, $* has relevance to M4, so you might need to write $][* or $[]*, depending on quotation level. > > This is purely a shell question. > > Well, doing it my way worked fine on the command line, both in bash > and sh, so I was confused. But the expansion that you hoped to happen did in fact only happen later in your testing. Try this on the command line: f=* echo "$f" echo $f Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
|
|
Re: Generating file listsOn Fri, Oct 16, 2009 at 1:32 PM, Ralf Wildenhues <Ralf.Wildenhues@...> wrote:
> * NightStrike wrote on Fri, Oct 16, 2009 at 07:24:36PM CEST: >> On Fri, Oct 16, 2009 at 1:22 PM, Ralf Wildenhues wrote: >> > SYSHEAD_LIST=`echo $srcdir/include/sys/*.h` >> > >> > or >> > set x $srcdir/include/sys/*.h >> > shift >> > SYSHEAD_LIST="$*" >> >> Which is more autoconfy-correct? > > Both have drawbacks and advantages. The first has a problem if $srcdir > starts with a hyphen (not realistic; that would break lots of other > places as well) or has other special characters; you could use AS_ECHO > instead though as a remedy. The second does not fork, which is nice. > But note that inside a macro, $* has relevance to M4, so you might need > to write $][* or $[]*, depending on quotation level. Thanks for the synopsis of both. I'll go with the first. I use AS_ECHO everywhere anyway. >> > This is purely a shell question. >> >> Well, doing it my way worked fine on the command line, both in bash >> and sh, so I was confused. > > But the expansion that you hoped to happen did in fact only happen later > in your testing. Try this on the command line: > f=* > echo "$f" > echo $f As always, Ralf, your perception is astounding. That's exactly how I tested it, and you're entirely right. If I do 'set' to look at the environment directly, it contains just the wildcard, not the expansion. Darn. Foiled again! _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
|
|
Re: Generating file listsOn Fri, Oct 16, 2009 at 1:52 PM, NightStrike <nightstrike@...> wrote:
> On Fri, Oct 16, 2009 at 1:32 PM, Ralf Wildenhues <Ralf.Wildenhues@...> wrote: >> * NightStrike wrote on Fri, Oct 16, 2009 at 07:24:36PM CEST: >>> On Fri, Oct 16, 2009 at 1:22 PM, Ralf Wildenhues wrote: >>> > SYSHEAD_LIST=`echo $srcdir/include/sys/*.h` >>> > >>> > or >>> > set x $srcdir/include/sys/*.h >>> > shift >>> > SYSHEAD_LIST="$*" >>> >>> Which is more autoconfy-correct? >> >> Both have drawbacks and advantages. The first has a problem if $srcdir >> starts with a hyphen (not realistic; that would break lots of other >> places as well) or has other special characters; you could use AS_ECHO >> instead though as a remedy. The second does not fork, which is nice. >> But note that inside a macro, $* has relevance to M4, so you might need >> to write $][* or $[]*, depending on quotation level. > > Thanks for the synopsis of both. I'll go with the first. I use > AS_ECHO everywhere anyway. Ok, so I tried to be fancy and do this: AS_VAR_APPEND([SYSHEAD_LIST],[AS_ECHO([$srcdir/include/sys/*.h])]) But that results in $SYSHEAD_LIST being equal to "printf". Darn. I was hoping to be able to keep appending more files to this list. Am I not using AS_VAR_APPEND right? _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
|
|
Re: Generating file lists* NightStrike wrote on Fri, Oct 16, 2009 at 08:51:15PM CEST:
> Ok, so I tried to be fancy and do this: > > AS_VAR_APPEND([SYSHEAD_LIST],[AS_ECHO([$srcdir/include/sys/*.h])]) > > But that results in $SYSHEAD_LIST being equal to "printf". Darn. You'd still need to put the AS_ECHO in a `...` command substitution. > I was hoping to be able to keep appending more files to this list. Am > I not using AS_VAR_APPEND right? You are using it right, but it doesn't assume the second argument is a command. Cheers, Ralf _______________________________________________ Autoconf mailing list Autoconf@... http://lists.gnu.org/mailman/listinfo/autoconf |
| Free embeddable forum powered by Nabble | Forum Help |