Following recent discussion of using non-static version numbers in AC_INIT or removing the AC_INIT arguments completely in favour of a more dynamic mechanism, I've switched on of my projects to do this:
(sbuild_m4_chomp and sbuild_m4_esyscmd_s are taken from Eric Blake's patch for autoconf 2.64 (I'm using 2.63 so needed to include the missing code.) dnl m4 magic from Eric Blake <[email protected]>, prior to automake inclusion m4_define([sbuild_m4_chomp], [m4_format([[%.*s]], m4_bregexp(m4_translit([$1], [ ]]m4_dquote(_m4_defn([m4_cr_all]))[, [/]]m4_format([%255s], [])[), [/*$]), [$1])]) m4_define([sbuild_m4_esyscmd_s], [sbuild_m4_chomp(m4_esyscmd([$1]))]) AC_PREREQ(2.59) dnl Quoting the first argument results in a bizarrely corrupted package tarname AC_INIT(sbuild_m4_esyscmd_s([sed -ne '/^Package:/{s/Package:[[:space:]][[:space:]]*//p;q}' VERSION]), [sbuild_m4_esyscmd_s([sed -ne '/^Version:/{s/Version:[[:space:]][[:space:]]*//p;q}' VERSION])], [sbuild_m4_esyscmd_s([sed -ne '/^Maintained-By:/{s/Maintained-By:[[:space:]][[:space:]]*//p;q}' VERSION])]) The VERSION file contains (generated from git release tag name and metadata): Package: sbuild Version: 0.58.3 Release-Date: 17 May 2009 Released-By: Roger Leigh <[email protected]> Git-Tag: sbuild-0.58.3 This results in the following in configure: # Identity of this package. PACKAGE_NAME='sbuild' PACKAGE_TARNAME='sbuild' PACKAGE_VERSION='0.58.3' PACKAGE_STRING='sbuild 0.58.3' PACKAGE_BUGREPORT='[email protected]' However, if I was to correctly quote the first argument to AC_INIT: AC_INIT([sbuild_m4_esyscmd_s([sed -ne '/^Package:/{s/Package:[[:space:]][[:space:]]*//p;q}' VERSION])], [sbuild_m4_esyscmd_s([sed -ne '/^Version:/{s/Version:[[:space:]][[:space:]]*//p;q}' VERSION])], [sbuild_m4_esyscmd_s([sed -ne '/^Maintained-By:/{s/Maintained-By:[[:space:]][[:space:]]*//p;q}' VERSION])]) I get this: # Identity of this package. PACKAGE_NAME='sbuild' PACKAGE_TARNAME='--sed--ne----package---s-package----space------space------p-q---version--' PACKAGE_VERSION='0.58.3' PACKAGE_STRING='sbuild 0.58.3' PACKAGE_BUGREPORT='' While the package name is correct, the tarname is transliterated junk and the bug reporting address is empty. The version is correct. I can't understand why PACKAGE_TARNAME is being handled in some special manner which results in this mess rather than just using the expanded form as for PACKAGE_NAME. What is the reason for this, and if it's buggy please could it be fixed? Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
signature.asc
Description: Digital signature
