m4-discuss
[Top][All Lists]
Advanced

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

Re: How to dinamically set VERSION for AC_INIT


From: Eric Blake
Subject: Re: How to dinamically set VERSION for AC_INIT
Date: Fri, 14 Dec 2007 08:15:55 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[adding m4-discuss for a discussion on syscmd/esyscmd behavior]

According to Eric Blake on 12/14/2007 8:05 AM:
> According to Andreas Schwab on 12/14/2007 7:56 AM:
>> AC_INIT(my-fine-package, m4_esyscmd([./version.sh | tr -d '\n']))
> 
>> Note that you need to manually remove the final newline, unlike command
>> substitutions m4_esyscmd does not do that for you.
> 
> Hmm - m4's esyscmd does not strip the newline, but maybe we can make
> m4sugar's m4_esyscmd do so.  What do you think?

At any rate, m4_esyscmd([./version.sh | tr -d '\n']) spawns more processes
than using m4 to strip the newline, so even if we don't change the
semantics of m4_esyscmd, we probably should provide an m4 macro that makes
it easy to strip it, rather than requiring the use of tr during the esyscmd.

Speaking of which, m4's implementation of esyscmd could possibly be
optimized to directly exec the target program if there are no shell
metacharacters in the string to be invoked, rather than always going
through sh.  I'm not sure how many implementations of system(3)/popen(3)
already do this optimization, but I know that not all of them do it.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHYp4r84KuGfSFAYARAgA4AJwKVUWS8iQWfphfxWROGJgoIJFPowCghqL+
5iNAYqklfS/VeJNn2u5X+N4=
=E7q6
-----END PGP SIGNATURE-----




reply via email to

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