]> granicus.if.org Git - icinga2/commitdiff
Use spec file as the authorative source of the package info/version number.
authorGunnar Beutner <gunnar@beutner.name>
Sun, 27 May 2012 17:45:40 +0000 (19:45 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Sun, 27 May 2012 17:50:48 +0000 (19:50 +0200)
12 files changed:
base/Makefile.am
components/configfile/Makefile.am
components/configrpc/Makefile.am
components/demo/Makefile.am
components/discovery/Makefile.am
config/ax_set_version_info.m4 [new file with mode: 0644]
config/ax_spec_file.m4 [new file with mode: 0644]
config/ax_spec_package_version.m4 [new file with mode: 0644]
configure.ac
icinga/Makefile.am
icinga2.spec [moved from icinga2.spec.in with 97% similarity]
jsonrpc/Makefile.am

index d95298b78d7cfb02f3fedf2c84defa7416ece394..e0edbd3b17e259f6b9a119fae9dd1e1f3d79595c 100644 (file)
@@ -56,7 +56,8 @@ libbase_la_CXXFLAGS = \
 
 libbase_la_LDFLAGS = \
        -no-undefined \
-       -version-info @LIBRARY_VERSION@
+       @RELEASE_INFO@ \
+       @VERSION_INFO@
 
 libbase_la_LIBADD = \
        $(LIBLTDL) \
index f8c21db421cced2f6b5e2b0abde615f3a1ea956c..1c20458b303105192308a16a67ba3407fb65dd30 100644 (file)
@@ -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) \
index d961db8f32942400d996416525a98c94ad3bd1e4..a79279e4316aa3831555654902c6f1948cba7ec6 100644 (file)
@@ -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) \
index 41bdafe6e17bec2a87afcb3db2a35e559a0dea70..99ac01c77fec35dbecc0dd771d9d63bbe9795ba4 100644 (file)
@@ -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) \
index 2feee2c03bb015484c224b763e8f5ffd792889ca..9f627eb8487ab4b631fd4ace73944120805d24ae 100644 (file)
@@ -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 (file)
index 0000000..b2cb6e2
--- /dev/null
@@ -0,0 +1,178 @@
+dnl @synopsis AX_SET_VERSION_INFO [(VERSION [,PREFIX])]
+dnl @synopsis default $1 = $PACKAGE_VERSION
+dnl @synopsis default $2 = <none>
+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 <guidod@gmx.de>
+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 (file)
index 0000000..271c5c0
--- /dev/null
@@ -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 <guidod@gmx.de>
+#
+#   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 <http://www.gnu.org/licenses/>.
+#
+#   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]) <<EOF
+         no ax_spec_file argument has been given, using defaults of
+         (1) $ax_spec_file_
+         (2) $ax_spec_file
+EOF
+         ;;
+    esac
+  fi
+  # find specfile
+  for i in ifelse($2,,,$2) . $srcdir $srcdir/.. .. ; do
+    if test -f "$i/$ax_spec_file_" ; then
+      ax_spec_dir="$i"
+      ax_spec_file="$ax_spec_dir/$ax_spec_file_"
+      break
+    fi
+    if test -f "$i/$ax_spec_file" ; then
+      ax_spec_dir="$i"
+      ax_spec_file="$ax_spec_dir/$ax_spec_file"
+      break
+    fi
+  done
+  case "$ax_spec_file" in
+   ./*) if test "$ax_spec_file" = "./$ax_spec_file_" ; then
+          ax_spec_file="$ax_spec_file_"
+        fi
+        AC_MSG_RESULT([$ax_spec_file]) ;;
+   */*) AC_MSG_RESULT([$ax_spec_file]) ;;
+   *)   AC_MSG_ERROR([no rpm spec file found]) ;;
+  esac
+  m4_define([m4_ax_spec_file],[ax_spec_file])
+])
+
+dnl AX_SPEC_EXTRACT(shellvar [,specvar [,defaultvalue]])
+
+AC_DEFUN([AX_SPEC_EXTRACT],
+[
+    if test ".$[]$1" = "." ; then
+    $1=`grep -i '^[[    ]]*m4_ifval([$2],[$2],[$1])[[   ]]*:' dnl
+  "$ax_spec_file" | sed -e 's/.*:[[     ]]*//' dnl
+    -e 's/[[    ]][[    ]]*/ /g' -e 's/^ //' -e 's/ $[]//' -e 'q'`
+    if test ".$[]$1" = "." ; then
+  for $1 in $2 $1 m4_tolower([$1]) ; do
+    $1=`echo "$[]$1" | sed -e 's/^%//g'`
+    $1=`sed dnl
+    -e  "/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]/!d"  dnl
+    -e "s/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]*//" dnl
+    -e 's/[[    ]][[    ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file`
+    test ".$1" != "." && break
+  done
+    fi
+  case ".$[]$1" in
+    .%{*)
+    $1=`echo "$[]$1" | sed -e 's/%{//' -e 's/}$[]//'`
+    $1=`sed dnl
+   -e  "/^%[[   ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]/!d"  dnl
+   -e "s/^%[[   ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]*//" dnl
+   -e 's/[[     ]][[    ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file` ;;
+    .%*)
+    $1=`echo "$[]$1" | sed -e 's/%//'`
+    $1=`sed dnl
+    -e  "/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]/!d"  dnl
+    -e "s/^%[[  ]]*def[]ine[[   ]][[    ]]*$[]$1[[      ]]*//" dnl
+    -e 's/[[    ]][[    ]]*/ /' -e 's/ $[]//' -e 'q' $ax_spec_file` ;;
+  esac
+  m4_ifval([$3],[test ".$[]$1" = "." && $1="$3"])
+    fi # test ".$[]$1" = "."
+])
diff --git a/config/ax_spec_package_version.m4 b/config/ax_spec_package_version.m4
new file mode 100644 (file)
index 0000000..be29033
--- /dev/null
@@ -0,0 +1,260 @@
+# ===========================================================================
+#  http://www.gnu.org/software/autoconf-archive/ax_spec_package_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_SPEC_PACKAGE_AND_VERSION ([specfile])
+#   AX_SPEC_PACKAGE_NAME ([shellvar],[defaultvalue])
+#   AX_SPEC_PACKAGE_VERSION ([shellvar],[defaultvalue])
+#   AX_SPEC_PACKAGE_SUMMARY ([shellvar],[defaultvalue])
+#   AX_SPEC_PACKAGE_LICENSE ([shellvar],[defaultvalue])
+#   AX_SPEC_PACKAGE_CATEGORY ([shellvar],[defaultvalue])
+#   AX_SPEC_PACKAGE_ICON ([shellvar],[defaultvalue])
+#   AX_SPEC_DEFAULTS([specfile])
+#
+# DESCRIPTION
+#
+#   set PACKAGE from the given specfile - default to basename of the
+#   rpmspecfile if no "name:" could be found in the spec file.
+#
+#   set VERSION from the given specfile - default to a date-derived value if
+#   no "version:" could be found in the spec file.
+#
+#   this macro builds on top of AX_SPEC_FILE / AX_SPEC_EXTRACT
+#
+#   more specific: if not "name:" or "%define name" was found in the
+#   myproject.spec file then the PACKAGE var is set to the basename
+#   "myproject". When no spec file was present then it will usually default
+#   to "TODO".
+#
+#   The version spec looks for "version:" or "%define version" in the spec
+#   file. When no such value was seen or no spec file had been present then
+#   the value is set to `date +0.%y.%W%w`.
+#
+#   the version value itself is sanitized somewhat with making it to always
+#   carry atleast three digits (1.2.3) and clensing superflous "0" chars
+#   around from generating numbers elsewhere.
+#
+#   additional macros are provided that extract a specific value from the
+#   spec file, among these:
+#
+#   set PACKAGE_SUMMARY from the given specfile - default to package and try
+#   to detect a type suffix if "summary:" was not in the spec file
+#
+#   set PACKAGE_LICENSE from the given specfile - if no "license:" tag was
+#   given in the spec file then various COPYING files are grepped to have a
+#   guess and the final fallback will be GNU GPL (or GNU LGPL).
+#
+#   set PACKAGE_ICON from the given specfile - if no "icon:" tag was given
+#   in the spec file then we default to $PACKAGE-icon.png
+#
+#   the final AX_SPEC_INIT(specfile) will initialize all variables to its
+#   defaults according to the spec file given.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
+#
+#   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 <http://www.gnu.org/licenses/>.
+#
+#   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
+])
index 199e4556a18bb96f1fa9affbf89fbc441e43372f..4f97147c72350cbdf96bae033e11aac7abff07c8 100644 (file)
  * 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
 ])
index 3881655ff772ba123e60c4683bf3e65385de4f14..70e4a90baa21c0687ca5bcbc9f5487d2067b629e 100644 (file)
@@ -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) \
similarity index 97%
rename from icinga2.spec.in
rename to icinga2.spec
index 88fcfd40380944e71e88580112e267bf769d118f..16b7fc97578eb1969965082c06144e64954a0470 100644 (file)
@@ -1,6 +1,6 @@
 Summary: network monitoring application
 Name: icinga2
-Version: @VERSION@
+Version: 2.0
 Release: 1%{?dist}
 License: GPL
 Group: Applications/System
index e4eb2d1e71ed25b3638a826d29ed3e81de51f33b..f568de0eafdfb4366d40ae933a7fdb91ffa79995 100644 (file)
@@ -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) \