-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Stefano Sabatini on 12/14/2007 7:45 AM: > > |It is preferable that the arguments of `AC_INIT' be static, i.e., > |there should not be any shell computation, but they can be > |computed by M4. > > So my question is: how can I compute with M4 the value to put in the > AC_INIT macro (sorry I'm an M4 newbie).
Use m4_esyscmd. Here's how the latest autoconf (will become autoconf 2.62) does it: AC_INIT([GNU Autoconf], m4_esyscmd([build-aux/git-version-gen . .version]), [EMAIL PROTECTED]) where build-aux/git-version-gen is the script that computes a version number based on how many commits in git have occurred since the last baseline stored in .version. > Also, do you think is this approach a sane way to assign the > AC_PACKAGE_VERSION to an autoconfigured package? It must be, if autoconf does so itself! One thing to be aware of is build dependencies - if the script will generate a different result after your edits, you have to rerun autoconf to pick up the version change, and propagating it through the entire compilation can be a bit time-consuming. Therefore, autoconf also has a GNUMakefile that guarantees that when 'make dist' is run, that the version is updated correctly, while avoiding recompilation due to version changes during normal development. And yes, we could probably document these tricks better in the manual. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----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 iD8DBQFHYpt084KuGfSFAYARAozoAJ9gmrnmwTk4vDkoHIFQhO2ugGLE5wCgjBUe g0VYKinptypz6eH5/0nhofk= =dtOq -----END PGP SIGNATURE----- _______________________________________________ Autoconf mailing list Autoconf@gnu.org http://lists.gnu.org/mailman/listinfo/autoconf