1 # Amanda version handling macros
5 # AMANDA_SNAPSHOT_STAMP
9 # If srcdir contains a file named SNAPSHOT, with a line matching
10 # Snapshot Date: [0-9]*
11 # then set add the date to VERSION and set
12 # SNAPSHOT_STAMP=SNAPSHOT.
14 AC_DEFUN([AMANDA_SNAPSHOT_STAMP],
16 if test -f "$srcdir/SNAPSHOT"; then
17 cat < "$srcdir/SNAPSHOT"
19 snapdate=`sed -n '/^Snapshot Date: \([0-9]*\)/ s//\1/p' < $srcdir/SNAPSHOT`
21 test -z "$snapdate" || VERSION="$VERSION-$snapdate"
22 SNAPSHOT_STAMP=SNAPSHOT
26 AC_SUBST(SNAPSHOT_STAMP)
31 # AMANDA_SPLIT_VERSION
35 # Set the version number of this release of Amanda from the VERSION
36 # string, which is set in AM_INIT_AUTOMAKE. Sets VERSION_MAJOR,
37 # VERSION_MINOR, VERSION_PATCH, and VERSION_COMMENT to the
38 # corresponding components of VERSION, and VERSION_SUFFIX to a
39 # version-specific filename suffix.
41 AC_DEFUN([AMANDA_SPLIT_VERSION],
44 VERSION_MAJOR=`expr "$VERSION" : '\([0-9]*\)'`
45 VERSION_MINOR=`expr "$VERSION" : '[0-9]*\.\([0-9]*\)'`
46 VERSION_PATCH=`expr "$VERSION" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
47 VERSION_COMMENT=\"`expr "$VERSION" : '[0-9]*\.[0-9]*\.[0-9]*\(.*\)'`\"
50 VERSION_SUFFIX="$VERSION"
51 AC_SUBST(VERSION_MAJOR)
52 AC_SUBST(VERSION_MINOR)
53 AC_SUBST(VERSION_PATCH)
54 AC_SUBST(VERSION_COMMENT)
55 AC_SUBST(VERSION_SUFFIX)
60 # AMANDA_WITH_SUFFIXES
64 # Implement the --with-suffixes option. If it is given, then set
65 # program_transform_name appropriately and AC_DEFINE USE_VERSION_SUFFIXES to 1.
66 # USE_VERSION_SUFFIXES is substituted with the value 'no' or 'yes'.
68 AC_DEFUN([AMANDA_WITH_SUFFIXES],
71 [ --with-suffixes install binaries with version string appended to name],
72 USE_VERSION_SUFFIXES=$withval,
73 : ${USE_VERSION_SUFFIXES=no}
76 case "$USE_VERSION_SUFFIXES" in
77 y | ye | yes) USE_VERSION_SUFFIXES=yes
78 AC_DEFINE(USE_VERSION_SUFFIXES, 1,
79 [Define to have programs use version suffixes when calling other programs.])
81 program_suffix="-$VERSION_SUFFIX"
82 # This is from the output of configure.in.
83 if test "x$program_transform_name" = xs,x,x,; then
84 program_transform_name=
86 # Double any \ or $. echo might interpret backslashes.
87 cat <<\EOF_SED > conftestsed
88 s,\\,\\\\,g; s,\$,$$,g
90 program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
93 test "x$program_prefix" != xNONE &&
94 program_transform_name="s,^,${program_prefix},; $program_transform_name"
95 # Use a double $ so make ignores it.
96 test "x$program_suffix" != xNONE &&
97 program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
99 # sed with no file args requires a program.
100 test "x$program_transform_name" = "" && program_transform_name="xs,x,x,"
101 # Remove empty command
102 cat <<\EOF_SED > conftestsed
103 s,\;\;,\;,g; s,\; \$,,g; s,\;$,,g
105 program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
108 n | no) USE_VERSION_SUFFIXES=no
110 *) AC_MSG_ERROR([*** You must not supply an argument to --with-suffixes option.])
114 AC_SUBST(USE_VERSION_SUFFIXES)