# Amanda version handling macros
+# SYNOPSIS
+#
+# AMANDA_INIT_VERSION
+#
+# DESCRIPTION
+#
+# Create a macro, AMANDA_F_VERSION using only m4 which can expand
+# legally before AC_INIT. AC_INIT requires the version to be a
+# string not a shell variable. Include FULL_VERSION if it exists, otherwise
+# use VERSION. -I dirs are searched for FULL_VERSION and VERSION.
+#
+AC_DEFUN([AMANDA_INIT_VERSION],
+[
+ m4_syscmd([test -f FULL_VERSION])
+ m4_if(m4_sysval, [0],
+ [
+ m4_define([AMANDA_F_VERSION], m4_chomp(m4_include([FULL_VERSION])))
+ ],
+ [
+ m4_define([AMANDA_F_VERSION], m4_chomp(m4_include([VERSION])))
+
+ ])
+ VERSION=AMANDA_F_VERSION
+])
+
+AC_DEFUN([AMANDA_VERSION],
+[
+ AMANDA_GET_SVN_INFO
+ AMANDA_GET_GIT_INFO
+
+ AC_MSG_NOTICE("version: $VERSION")
+])
+
# SYNOPSIS
#
# AMANDA_SNAPSHOT_STAMP
# DESCRIPTION
#
# Set the version number of this release of Amanda from the VERSION
-# string, which is set in AM_INIT_AUTOMAKE. Sets VERSION_MAJOR,
+# string, which is set in AC_INIT. 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
#
# 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])
+ ])
])