Imported Upstream version 3.1.0
[debian/amanda] / config / amanda / version.m4
index f1ecb8ae5a642ab7811f424258a6d571d5f34225..da26e94eace944adc3506e799f53b13676e55acc 100644 (file)
@@ -1,5 +1,21 @@
 # Amanda version handling macros
 
+AC_DEFUN([AMANDA_VERSION],
+[
+    AMANDA_GET_SVN_INFO
+    AMANDA_GET_GIT_INFO
+
+    if test -f FULL_VERSION; then
+       VERSION=`cat FULL_VERSION`
+    else if test -f $srcdir/FULL_VERSION; then
+       VERSION=`cat $srcdir/FULL_VERSION`
+    else
+       VERSION=`cat $srcdir/VERSION`
+    fi
+    fi
+    AC_MSG_NOTICE("version: $VERSION")
+])
+
 # SYNOPSIS
 #
 #   AMANDA_SNAPSHOT_STAMP
@@ -35,24 +51,38 @@ AC_DEFUN([AMANDA_SNAPSHOT_STAMP],
 #   Set the version number of this release of Amanda from the VERSION
 #   string, which is set in AM_INIT_AUTOMAKE.  Sets VERSION_MAJOR,
 #   VERSION_MINOR, VERSION_PATCH, and VERSION_COMMENT to the 
-#   corresponding components of VERSION, and VERSION_SUFFIX to a
-#   version-specific filename suffix.
+#   corresponding components of VERSION.  These four variables are
+#   also AC_DEFINE'd
 #
 AC_DEFUN([AMANDA_SPLIT_VERSION],
 [
     changequote(,)
     VERSION_MAJOR=`expr "$VERSION" : '\([0-9]*\)'`
     VERSION_MINOR=`expr "$VERSION" : '[0-9]*\.\([0-9]*\)'`
-    VERSION_PATCH=`expr "$VERSION" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
-    VERSION_COMMENT=\"`expr "$VERSION" : '[0-9]*\.[0-9]*\.[0-9]*\(.*\)'`\"
+    if test -z "$VERSION_MINOR"; then
+       VERSION_MINOR=0
+       VERSION_PATCH=0
+       VERSION_COMMENT=\"`expr "$VERSION" : '[0-9]*\(.*\)'`\"
+    else
+       VERSION_PATCH=`expr "$VERSION" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+       if test -z "$VERSION_PATCH"; then
+           VERSION_PATCH=0
+           VERSION_COMMENT=\"`expr "$VERSION" : '[0-9]*\.[0-9]*\(.*\)'`\"
+       else
+           VERSION_COMMENT=\"`expr "$VERSION" : '[0-9]*\.[0-9]*\.[0-9]*\(.*\)'`\"
+       fi
+    fi
     changequote([,])
 
-    VERSION_SUFFIX="$VERSION"
     AC_SUBST(VERSION_MAJOR)
     AC_SUBST(VERSION_MINOR)
     AC_SUBST(VERSION_PATCH)
     AC_SUBST(VERSION_COMMENT)
-    AC_SUBST(VERSION_SUFFIX)
+
+    AC_DEFINE_UNQUOTED([VERSION_MAJOR], [$VERSION_MAJOR], [major Amanda version number])
+    AC_DEFINE_UNQUOTED([VERSION_MINOR], [$VERSION_MINOR], [minor Amanda version number])
+    AC_DEFINE_UNQUOTED([VERSION_PATCH], [$VERSION_PATCH], [Amanda patch number])
+    AC_DEFINE_UNQUOTED([VERSION_COMMENT], [$VERSION_COMMENT], [Amanda version information beyond patch])
 ])
 
 # SYNOPSIS
@@ -61,55 +91,11 @@ AC_DEFUN([AMANDA_SPLIT_VERSION],
 #
 # DESCRIPTION
 #
-#   Implement the --with-suffixes option.  If it is given, then set
-#   program_transform_name appropriately and AC_DEFINE USE_VERSION_SUFFIXES to 1.
-#   USE_VERSION_SUFFIXES is substituted with the value 'no' or 'yes'.
+#   Deprectated --with-suffixes option.
 #
 AC_DEFUN([AMANDA_WITH_SUFFIXES],
 [
-    AC_ARG_WITH(suffixes,
-       [  --with-suffixes        install binaries with version string appended to name],
-       USE_VERSION_SUFFIXES=$withval,
-       : ${USE_VERSION_SUFFIXES=no}
-    )
-
-    case "$USE_VERSION_SUFFIXES" in
-    y | ye | yes) USE_VERSION_SUFFIXES=yes
-       AC_DEFINE(USE_VERSION_SUFFIXES, 1,
-           [Define to have programs use version suffixes when calling other programs.])
-
-       program_suffix="-$VERSION_SUFFIX"
-       # This is from the output of configure.in.
-       if test "x$program_transform_name" = xs,x,x,; then
-           program_transform_name=
-       else
-           # Double any \ or $.  echo might interpret backslashes.
-           cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
-           program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
-           rm -f conftestsed
-       fi
-       test "x$program_prefix" != xNONE &&
-           program_transform_name="s,^,${program_prefix},; $program_transform_name"
-       # Use a double $ so make ignores it.
-       test "x$program_suffix" != xNONE &&
-           program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-       # sed with no file args requires a program.
-       test "x$program_transform_name" = "" && program_transform_name="xs,x,x,"
-       # Remove empty command
-       cat <<\EOF_SED > conftestsed
-s,\;\;,\;,g; s,\; \$,,g; s,\;$,,g
-EOF_SED
-       program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
-       rm -f conftestsed
-      ;;
-    n | no) USE_VERSION_SUFFIXES=no
-      ;;
-    *) AC_MSG_ERROR([*** You must not supply an argument to --with-suffixes option.])
-      ;;
-    esac
-
-    AC_SUBST(USE_VERSION_SUFFIXES)
+    AC_ARG_WITH(suffixes, [], [
+       AMANDA_MSG_WARN([** --with-suffixes is deprecated])
+    ])
 ])