From 6f6cc52e2091155b9b2654181676737814f02530 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sun, 27 May 2012 19:45:40 +0200 Subject: [PATCH] Use spec file as the authorative source of the package info/version number. --- base/Makefile.am | 3 +- components/configfile/Makefile.am | 3 +- components/configrpc/Makefile.am | 3 +- components/demo/Makefile.am | 3 +- components/discovery/Makefile.am | 3 +- config/ax_set_version_info.m4 | 178 ++++++++++++++++++++ config/ax_spec_file.m4 | 133 +++++++++++++++ config/ax_spec_package_version.m4 | 260 ++++++++++++++++++++++++++++++ configure.ac | 11 +- icinga/Makefile.am | 3 +- icinga2.spec.in => icinga2.spec | 2 +- jsonrpc/Makefile.am | 3 +- 12 files changed, 592 insertions(+), 13 deletions(-) create mode 100644 config/ax_set_version_info.m4 create mode 100644 config/ax_spec_file.m4 create mode 100644 config/ax_spec_package_version.m4 rename icinga2.spec.in => icinga2.spec (97%) diff --git a/base/Makefile.am b/base/Makefile.am index d95298b78..e0edbd3b1 100644 --- a/base/Makefile.am +++ b/base/Makefile.am @@ -56,7 +56,8 @@ libbase_la_CXXFLAGS = \ libbase_la_LDFLAGS = \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ libbase_la_LIBADD = \ $(LIBLTDL) \ diff --git a/components/configfile/Makefile.am b/components/configfile/Makefile.am index f8c21db42..1c20458b3 100644 --- a/components/configfile/Makefile.am +++ b/components/configfile/Makefile.am @@ -18,7 +18,8 @@ configfile_la_CXXFLAGS = \ configfile_la_LDFLAGS = \ -module \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ configfile_la_LIBADD = \ $(BOOST_LDFLAGS) \ diff --git a/components/configrpc/Makefile.am b/components/configrpc/Makefile.am index d961db8f3..a79279e43 100644 --- a/components/configrpc/Makefile.am +++ b/components/configrpc/Makefile.am @@ -17,7 +17,8 @@ configrpc_la_CXXFLAGS = \ configrpc_la_LDFLAGS = \ -module \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ configrpc_la_LIBADD = \ $(BOOST_LDFLAGS) \ diff --git a/components/demo/Makefile.am b/components/demo/Makefile.am index 41bdafe6e..99ac01c77 100644 --- a/components/demo/Makefile.am +++ b/components/demo/Makefile.am @@ -18,7 +18,8 @@ demo_la_CXXFLAGS = \ demo_la_LDFLAGS = \ -module \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ demo_la_LIBADD = \ $(BOOST_LDFLAGS) \ diff --git a/components/discovery/Makefile.am b/components/discovery/Makefile.am index 2feee2c03..9f627eb84 100644 --- a/components/discovery/Makefile.am +++ b/components/discovery/Makefile.am @@ -20,7 +20,8 @@ discovery_la_CXXFLAGS = \ discovery_la_LDFLAGS = \ -module \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ discovery_la_LIBADD = \ $(BOOST_LDFLAGS) \ diff --git a/config/ax_set_version_info.m4 b/config/ax_set_version_info.m4 new file mode 100644 index 000000000..b2cb6e249 --- /dev/null +++ b/config/ax_set_version_info.m4 @@ -0,0 +1,178 @@ +dnl @synopsis AX_SET_VERSION_INFO [(VERSION [,PREFIX])] +dnl @synopsis default $1 = $PACKAGE_VERSION +dnl @synopsis default $2 = +dnl +dnl This macro is the successor of AC_SET_RELEASEINFO_VERSIONINFO but +dnl it can be used in parallel because it uses all different variables. +dnl +dnl check the $VERSION number and cut the two last digit-sequences off +dnl which will form a -version-info in a @VERSION_INFO@ ac_subst while +dnl the rest is going to the -release name in a @RELEASE_INFO@ +dnl ac_subst. +dnl +dnl you should keep these two seperate - the release-name may contain +dnl alpha-characters and can be modified later with extra release-hints +dnl e.g. RELEASE_INFO="$RELEASE_INFO-debug" for a debug version of your +dnl lib. The $VERSION_INFO however should not be touched. +dnl +dnl example: a VERSION="2.4.18" will be transformed into +dnl +dnl RELEASE_INFO = -release 2 +dnl VERSION_INFO = -versioninfo 4:18 +dnl +dnl then use these two variables and push them to your libtool linker +dnl +dnl libtest_la_LIBADD = @RELEASE_INFO@ @VERSION_INFO@ +dnl +dnl and for a linux-target this will tell libtool to install the lib as +dnl +dnl libmy.so libmy.la libmy.a libmy-2.so.4 libmy-2.so.4.0.18 +dnl +dnl and executables will get link-resolve-infos for libmy-2.so.4 - +dnl therefore the patch-level is ignored during ldso linking, and ldso +dnl will use the one with the highest patchlevel. Using just "-release +dnl $(VERSION)" during libtool-linking would not do that - omitting the +dnl -version-info will libtool install libmy.so libmy.la libmy.a +dnl libmy-2.4.18.so and executables would get hardlinked with the +dnl 2.4.18 version of your lib. +dnl +dnl This background does also explain the default dll name for a win32 +dnl target : libtool will choose to make up libmy-2-4.dll for this +dnl version spec. +dnl +dnl this macro does also set the usual three parts of a version spec +dnl $MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION but does not ac_subst +dnl for the plain AX_SET_VERSION_INFO macro. Use instead one of the +dnl numbered macros AX_SET_VERSION_INFO1 (use first number for release +dnl part) or that AX_SET_VERSION_INFO2 (use the first two numbers for +dnl release part). +dnl +dnl You may add sublevel parts like "1.4.2-ac5" where the sublevel is +dnl just killed from these version/release substvars. That allows to +dnl grab the version off a .spec file like with AX_SPEC_PACKAGE_VERSION +dnl where the $VERSION is used to name a tarball or distpack like +dnl mylib-2.2.9pre4 +dnl +dnl Unlike earlier macros, you can use this one to break up different +dnl VERSIONs and put them into different variables, just hint with +dnl PREFIX-setting - i.e. _VERSION(2.4.5,TEST) will set variables named +dnl TEST_MAJOR_VERSION=2... and of course $TEST_RELEASE_INFO etc. (for +dnl the moment, it needs to be a literal prefix *sigh*) +dnl +dnl @category Misc +dnl @author Guido U. Draheim +dnl @version 2006-10-13 +dnl @license GPLWithACException + +AC_DEFUN([AX_SET_VERSION_INFO1],[dnl +AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl +AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl +AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl +AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl +AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl +AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl +test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION" +AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl +ifelse($1,,$PACKAGE_VERSION,$1) ) + MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )` + MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'` + MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'` + MICRO="$MINOR" + MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'` + MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'` + PATCH="$MICRO" + MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'` + PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'` + if test "_$MICRO" = "_" ; then MICRO="0" ; fi + if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi + MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'` + LTREL="-release $MAJOR" + LTVER="-version-info $MINOR:$MICRO" +AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)]) +AC_SUBST(MAJOR) +AC_SUBST(MINOR) +AC_SUBST(MICRO) +AC_SUBST(PATCH) +AC_SUBST(LTREL) +AC_SUBST(LTVER) +AS_VAR_POPDEF([LTVER])dnl +AS_VAR_POPDEF([LTREL])dnl +AS_VAR_POPDEF([PATCH])dnl +AS_VAR_POPDEF([MICRO])dnl +AS_VAR_POPDEF([MINOR])dnl +AS_VAR_POPDEF([MAJOR])dnl +]) + +AC_DEFUN([AX_SET_VERSION_INFO2],[dnl +AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl +AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl +AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl +AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl +AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl +AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl +test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION" +AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl +ifelse($1,,$PACKAGE_VERSION,$1) ) + MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )` + MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'` + MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'` + MICRO="$MINOR" + MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'` + MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'` + PATCH="$MICRO" + MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'` + PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'` + test "_$MICRO" != "_" || MICRO="0" + if test "_$MINOR" != "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi + MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'` + LTREL="-release $MAJOR.$MINOR" + LTVER="-version-info 0:$MICRO" +AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)]) +AC_SUBST(MAJOR) +AC_SUBST(MINOR) +AC_SUBST(MICRO) +AC_SUBST(PATCH) +AC_SUBST(LTREL) +AC_SUBST(LTVER) +AS_VAR_POPDEF([LTVER])dnl +AS_VAR_POPDEF([LTREL])dnl +AS_VAR_POPDEF([PATCH])dnl +AS_VAR_POPDEF([MICRO])dnl +AS_VAR_POPDEF([MINOR])dnl +AS_VAR_POPDEF([MAJOR])dnl +]) + +AC_DEFUN([AX_SET_VERSION_INFO],[dnl +AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl +AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl +AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl +AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl +AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl +AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl +test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION" +AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl +ifelse($1,,$PACKAGE_VERSION,$1) ) + MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )` + MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'` + MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'` + MICRO="$MINOR" + MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'` + MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'` + PATCH="$MICRO" + MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'` + PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/[[-.]]//'` + if test "_$MICRO" = "_" ; then MICRO="0" ; fi + if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi + MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'` + LTREL="-release $MAJOR" + LTVER="-version-info $MINOR:$MICRO" +AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)]) +AC_SUBST(LTREL) +AC_SUBST(LTVER) +AS_VAR_POPDEF([LTVER])dnl +AS_VAR_POPDEF([LTREL])dnl +AS_VAR_POPDEF([PATCH])dnl +AS_VAR_POPDEF([MICRO])dnl +AS_VAR_POPDEF([MINOR])dnl +AS_VAR_POPDEF([MAJOR])dnl +]) diff --git a/config/ax_spec_file.m4 b/config/ax_spec_file.m4 new file mode 100644 index 000000000..271c5c080 --- /dev/null +++ b/config/ax_spec_file.m4 @@ -0,0 +1,133 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_spec_file.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_SPEC_FILE [(rpmspecfile [,subdirpath])] +# +# DESCRIPTION +# +# set the specfile - if no argument has been given then check whether the +# ac_unique_file looks like a .spec file and use it. This macro is +# ac_REQUIRED by many AX_SPEC_ routines. +# +# the AX_SPEC_EXTRACT macro is a helper used by many AX_SPEC_ routines and +# therefore placed here to be automatically included in the macro set of +# (older) aclocal/acinclude. +# +# AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]]) +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AC_DEFUN([AX_SPEC_FILE], +[ AC_MSG_CHECKING([rpm spec file]) + if test ".$1" != "." ; then + ax_spec_file_="$1" + ax_spec_file=`basename $1` + else + case ".$ac_unique_file" in + *.spec) ax_spec_file="$ac_unique_file" + ax_spec_file_="$ac_unique_file" ;; + *) ax_spec_file="TODO" + if test ".$PACKAGE" != "." + then ax_spec_file_="$PACKAGE.spec" + else ax_spec_file_="README" + fi + cat m4_ifset([AS_MESSAGE_LOG_FD],[>&AS_MESSAGE_LOG_FD],[>>config.log]) < +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AX_SPEC_PACKAGE_LICENSE],[AC_REQUIRE([AX_SPEC_FILE])dnl + AS_VAR_PUSHDEF([VAR],[PACKAGE_LICENSE])dnl + AC_MSG_CHECKING([for spec license type]) + if test ".$VAR" = "." ; then if test ! -f $ax_spec_file + then k="(w/o spec)" + else k="" + AX_SPEC_EXTRACT(VAR,[license],m4_ifval($1,$1)) + VAR=`echo $VAR | sed -e 's/ *License//g'` + fi fi + test ".$VAR" = "." && k="(fallback)" + ifelse($2,,[dnl here the defaults for LICENSE / COPYRIGHT + if test ".$VAR" = "." ; then + for ac_file in "$srcdir/COPYING" "$srcdir/COPYING" "$srcdir/LICENSE" ; do + test -f "$ac_file" || continue +dnl http://www.ibiblio.org/osrt/omf/omf_elements "16. Rights" + if grep "GNU LESSER GENERAL PUBLIC LICENSE" "$ac_file" >/dev/null + then VAR="GNU LGPL" ; break + elif grep "GNU GENERAL PUBLIC LICENSE" "$ac_file" >/dev/null + then VAR="GNU GPL" ; break + elif grep "MOZILLA PUBLIC LICENSE" "$ac_file" >/dev/null + then VAR="MPL" ; break + elif grep "Mozilla Public License" "$ac_file" >/dev/null + then VAR="MPL" ; break + elif grep -i "artistic license" "$ac_file" >/dev/null + then VAR="Artistic" ; break + elif grep -i "artistic control" "$ac_file" >/dev/null + then VAR="Artistic" ; break + elif grep -i "semblance of artistic" "$ac_file" >/dev/null + then VAR="Artistic" ; break + elif grep -i "above copyright notice" "$ac_file" >/dev/null + then VAR="BSD" ; break + fi + done + if test ".$VAR" = "." ; then + if test "$srcdir/COPYING.LIB" ; then VAR="GNU LGPL" + elif test ".$ltmain" != "." ; then VAR="GNU LGPL" + else VAR="GNU GPL" + fi + fi + fi + ],[test ".$VAR" = "." && VAR="$2"]) + test "$VAR" = "GPL" && VAR="GNU GPL" + test "$VAR" = "LGPL" && VAR="GNU LGPL" + AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k]) + AS_VAR_POPDEF([VAR])dnl +]) + +AC_DEFUN([AX_SPEC_PACKAGE_SUMMARY],[AC_REQUIRE([AX_SPEC_FILE])dnl + AS_VAR_PUSHDEF([VAR],[PACKAGE_SUMMARY])dnl + AC_MSG_CHECKING([for spec summary]) + if test ".$VAR" = "." ; then if test ! -f $ax_spec_file + then k="(w/o spec)" + else k="" + AX_SPEC_EXTRACT(VAR,[summary],m4_ifval($1,$1)) + fi fi + test ".$VAR" = "." && k="(fallback)" + ifelse($2,,[dnl here the defaults for SUMMARY + if test ".$VAR" = "." ; then VAR="$PACKAGE" + test ".$VAR" = "." && VAR="foo" + test ".$ltmain" != "." && VAR="$VAR library" + fi + ],[test ".$VAR" = "." && VAR="$2"]) + AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k]) + AS_VAR_POPDEF([VAR])dnl +]) + +AC_DEFUN([AX_SPEC_PACKAGE_ICON],[AC_REQUIRE([AX_SPEC_FILE])dnl + AS_VAR_PUSHDEF([VAR],[PACKAGE_ICON])dnl + AC_MSG_CHECKING([for spec icon]) + if test ".$VAR" = "." ; then if test ! -f $ax_spec_file + then k="(w/o spec)" + else k="" + AX_SPEC_EXTRACT(VAR,[icon],m4_ifval($1,$1)) + fi fi + test ".$VAR" = "." && k="(fallback)" + ifelse($2,,[dnl here the defaults for ICON + if test ".$VAR" = "." ; then VAR="$PACKAGE-icon.png" ; fi + ],[test ".$VAR" = "." && VAR="$2"]) + AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k]) + AS_VAR_POPDEF([VAR])dnl +]) + +AC_DEFUN([AX_SPEC_PACKAGE_CATEGORY],[AC_REQUIRE([AX_SPEC_FILE])dnl + AS_VAR_PUSHDEF([VAR],[PACKAGE_CATEGORY])dnl + AC_MSG_CHECKING([for spec category]) + if test ".$VAR" = "." ; then if test ! -f $ax_spec_file + then k="(w/o spec)" + else k="" + AX_SPEC_EXTRACT(VAR,[group],m4_ifval($1,$1)) + VAR=`echo $VAR | sed -e 's/ /-/g'` + fi fi + test ".$VAR" = "." && k="(fallback)" + ifelse($2,,[dnl here the defaults for CATEGORY + if test ".$VAR" = "." ; then if test ".$ltmain" != "." + then VAR="Development/Library" + else VAR="Development/Other" + fi fi + ],[test ".$VAR" = "." && VAR="$2"]) + AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k]) + AS_VAR_POPDEF([VAR])dnl +]) + +AC_DEFUN([AX_SPEC_PACKAGE_NAME],[AC_REQUIRE([AX_SPEC_FILE])dnl + AS_VAR_PUSHDEF([VAR],[PACKAGE_NAME])dnl + AC_MSG_CHECKING([for spec package]) + if test ".$VAR" = "." ; then if test ! -f $ax_spec_file + then k="(w/o spec)" + else k="" + AX_SPEC_EXTRACT(VAR,[name],m4_ifval($1,$1)) + VAR=`echo $VAR | sed -e 's/ /-/g'` + fi fi + test ".$VAR" = "." && k="(fallback)" + ifelse($2,,[dnl here the defaults for PACKAGE + test ".$VAR" = "." && VAR=`basename $ax_spec_file .spec` + test ".$VAR" = ".README" && VAR="TODO" + test ".$VAR" = ".TODO" && VAR="foo" + ],[test ".$VAR" = "." && VAR="$2"]) + test "VAR" = "PACKAGE_NAME" && test ".$PACKAGE" = "." && PACKAGE="$VAR" + AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k]) + AS_VAR_POPDEF([VAR])dnl +]) + +AC_DEFUN([AX_SPEC_PACKAGE_VERSION_],[AC_REQUIRE([AX_SPEC_FILE])dnl + AS_VAR_PUSHDEF([VAR],[PACKAGE_VERSION])dnl + AC_MSG_CHECKING([for spec version]) + if test ".$VAR" = "." ; then if test ! -f $ax_spec_file + then k="(w/o spec)" + else k="" + AX_SPEC_EXTRACT(VAR,[version],m4_ifval($1,$1)) + VAR=`echo $VAR | sed -e 's/ /-/g'` + fi fi + test ".$VAR" = "." && k="(fallback)" + ifelse($2,,[dnl here the defaults for VERSION + test ".$VAR" = "." && VAR=`date +0.%y.%W%w` + ],[test ".$VAR" = "." && VAR="$2"]) + test "VAR" = "PACKAGE_VERSION" && test ".$VERSION" = "." && VERSION="$VAR" + case "$VAR" in # note we set traditional VERSION before cleaning things up + *.*.) VAR="$VAR"`date +%W%w` ;; + *.*.*) ;; + *.) VAR="$VAR"`date +%y.%W%w` ;; + *.*) VAR="$VAR.0" ;; + *) VAR=AS_TR_SH([$VAR]) ; VAR="$VAR.`date +%y.%W%w`" ;; + esac + VAR=`echo $VAR | sed -e "s/[[.]][0]\\([0-9]\\)/.\\1/g"` + AC_MSG_RESULT([m4_ifval([$1],[$1 = ])$VAR $k]) + AS_VAR_POPDEF([VAR])dnl +]) + +dnl for compatibility, we define ax_spec_package_version +dnl to do all of ax_spec_package_name as well. +AC_DEFUN([AX_SPEC_PACKAGE_VERSION],[AC_REQUIRE([AX_SPEC_FILE])dnl + ifelse($1,, + AC_MSG_WARN([please use ax_spec_package_AND_version now!]), + AC_MSG_ERROR([please use ax_spec_package_AND_version now!])) + AX_SPEC_PACKAGE_NAME + AX_SPEC_PACKAGE_VERSION_ + +]) + +AC_DEFUN([AX_SPEC_PACKAGE_AND_VERSION],[ + m4_ifset([m4_ax_spec_file],,[AX_SPEC_FILE($1)]) + AX_SPEC_PACKAGE_NAME + AX_SPEC_PACKAGE_VERSION_ +]) + +AC_DEFUN([AX_SPEC_DEFAULTS],[ + m4_ifset([m4_ax_spec_file],,[AX_SPEC_FILE($1)]) + AX_SPEC_PACKAGE_NAME + AX_SPEC_PACKAGE_VERSION_ + AX_SPEC_PACKAGE_LICENSE + AX_SPEC_PACKAGE_SUMMARY + AX_SPEC_PACKAGE_CATEGORY + AX_SPEC_PACKAGE_ICON +]) diff --git a/configure.ac b/configure.ac index 199e4556a..4f97147c7 100644 --- a/configure.ac +++ b/configure.ac @@ -17,11 +17,13 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ******************************************************************************/ -AC_INIT([icinga2], [2.0]) -AC_SUBST([LIBRARY_VERSION], [2:0:0]) +AC_INIT +AX_SPEC_FILE([icinga2.spec]) +AX_SPEC_DEFAULTS +AX_SET_VERSION_INFO AC_CONFIG_AUX_DIR([config]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([1.11]) +AM_INIT_AUTOMAKE($PACKAGE,$VERSION) AM_SILENT_RULES([yes]) AC_PROG_CXX @@ -35,7 +37,7 @@ AX_CXX_COMPILE_STDCXX_0X AX_CXX_GCC_ABI_DEMANGLE AX_PTHREAD -LT_INIT([dlopen, disable-static]) +LT_INIT([dlopen disable-static]) LT_CONFIG_LTDL_DIR([ltdl]) LTDL_INIT @@ -86,5 +88,4 @@ icinga-app/Makefile jsonrpc/Makefile mmatch/Makefile Doxyfile -icinga2.spec ]) diff --git a/icinga/Makefile.am b/icinga/Makefile.am index 3881655ff..70e4a90ba 100644 --- a/icinga/Makefile.am +++ b/icinga/Makefile.am @@ -31,7 +31,8 @@ libicinga_la_CXXFLAGS = \ libicinga_la_LDFLAGS = \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ libicinga_la_LIBADD = \ $(BOOST_LDFLAGS) \ diff --git a/icinga2.spec.in b/icinga2.spec similarity index 97% rename from icinga2.spec.in rename to icinga2.spec index 88fcfd403..16b7fc975 100644 --- a/icinga2.spec.in +++ b/icinga2.spec @@ -1,6 +1,6 @@ Summary: network monitoring application Name: icinga2 -Version: @VERSION@ +Version: 2.0 Release: 1%{?dist} License: GPL Group: Applications/System diff --git a/jsonrpc/Makefile.am b/jsonrpc/Makefile.am index e4eb2d1e7..f568de0ea 100644 --- a/jsonrpc/Makefile.am +++ b/jsonrpc/Makefile.am @@ -27,7 +27,8 @@ libjsonrpc_la_CXXFLAGS = \ libjsonrpc_la_LDFLAGS = \ -no-undefined \ - -version-info @LIBRARY_VERSION@ + @RELEASE_INFO@ \ + @VERSION_INFO@ libjsonrpc_la_LIBADD = \ $(BOOST_LDFLAGS) \