Re: Dynamic package version numbers with Autoconf and Automake (was: Re: Automake 1.12.0b test release)

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

 



The script I intend to use to obtain package information is in the GraphicsMagick repository and produces information gleaned from a 'version.sh' script which has the smarts to produce some obvious variable names.

echo `./scripts/pkginfo.sh package_bugreport`
graphicsmagick-bugs@xxxxxxxxxxxxxxxxxxxxx

% echo `./scripts/pkginfo.sh package_name`
GraphicsMagick

% echo `./scripts/pkginfo.sh package_version`
1.4.020120814

It is intended to be used like this in configure.ac:

AC_INIT(m4_esyscmd([scripts/pkginfo.sh package_name]),
        m4_esyscmd([scripts/pkginfo.sh package_version]),
        m4_esyscmd([scripts/pkginfo.sh package_bugreport]))

Unfortunately, the values passed to AC_INIT are cached so even if the configure script is run again, it uses the cached values rather than the new values.

The script:

#!/bin/sh
#
# Print the package version based on content of $srcdir/version.sh.
#
# This script is expected to be run under the context of a configure
# script (via AC_INIT) to dynamically determine the package version.
me=$0
info=$1
srcdir=`dirname $0`/..
value=
nl='
'
. version.sh

case "${info}" in
  package_bugreport )
    value="${PACKAGE_BUGREPORT}"
    ;;
  package_name )
    value="${PACKAGE_NAME}"
    ;;
  package_version )
    value="${PACKAGE_VERSION}${PACKAGE_VERSION_ADDENDUM}"
    ;;
  * )
    echo "$me: Must supply argument {package_bugreport, package_name, package_version}"
    exit 1
    ;;
esac

# Omit the trailing newline, so that m4_esyscmd can use the result directly.
echo "${value}" | tr -d "$nl"

--
Bob Friesenhahn
bfriesen@xxxxxxxxxxxxxxxxxxx, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux