1
# ===========================================================================
2
# http://autoconf-archive.cryp.to/ac_spec_package_version.html
3
# ===========================================================================
7
# Use AX_SPEC_PACKAGE_VERSION.
11
# AC_SPEC_PACKAGE_VERSION(rpmspecfile)
15
# set PACKAGE and VERSION from the defines in the given specfile default
16
# to basename and currentde if rpmspecfile is not found
24
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
26
# This program is free software; you can redistribute it and/or modify it
27
# under the terms of the GNU General Public License as published by the
28
# Free Software Foundation; either version 2 of the License, or (at your
29
# option) any later version.
31
# This program is distributed in the hope that it will be useful, but
32
# WITHOUT ANY WARRANTY; without even the implied warranty of
33
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
34
# Public License for more details.
36
# You should have received a copy of the GNU General Public License along
37
# with this program. If not, see <http://www.gnu.org/licenses/>.
39
# As a special exception, the respective Autoconf Macro's copyright owner
40
# gives unlimited permission to copy, distribute and modify the configure
41
# scripts that are the output of Autoconf when processing the Macro. You
42
# need not follow the terms of the GNU General Public License when using
43
# or distributing such scripts, even though portions of the text of the
44
# Macro appear in them. The GNU General Public License (GPL) does govern
45
# all other use of the material that constitutes the Autoconf Macro.
47
# This special exception to the GPL applies to versions of the Autoconf
48
# Macro released by the Autoconf Macro Archive. When you make and
49
# distribute a modified version of the Autoconf Macro, you may extend this
50
# special exception to the GPL to apply to your modified version as well.
52
AC_DEFUN([AC_SPEC_PACKAGE_VERSION],[dnl
53
pushdef([specfile], ac_spec_package_version_file)
54
specfile=`basename $1`
55
AC_MSG_CHECKING( $specfile package version)
57
AC_MSG_ERROR( no rpm spec file given )
60
for i in $1 $srcdir/$1 $srcdir/../$1 ; do
61
if test -f "$i" ; then
66
if test ! -f $specfile ; then
69
if test -z "$PACKAGE" ; then
70
i=`grep -i '^name:' $specfile | head -1 | sed -e 's/.*://'`
71
PACKAGE=`echo $i | sed -e 's/ /-/'`
73
if test -z "$VERSION" ; then
74
i=`grep -i '^version:' $specfile | head -1 | sed -e 's/.*://'`
75
VERSION=`echo $i | sed -e 's/ /-/'`
78
if test -z "$PACKAGE" ; then
79
PACKAGE=`basename $specfile .spec`
81
if test -z "$VERSION" ; then
82
VERSION=`date +%Y.%m.%d`
84
AC_MSG_RESULT( $PACKAGE $VERSION $k )