fedf4bb3465b71369301b8156f7f3092f0fc8961
[debian/amanda] / config / amanda / config.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_CONFIG_LCOAL
4 #
5 # OVERVIEW
6 #
7 #   Invoke ./config.local, if it exists
8 #
9 AC_DEFUN([AMANDA_CONFIG_LOCAL],
10 [
11     if test -f config.local; then
12         echo "running local script ./config.local"
13         . ./config.local
14     fi
15 ])
16
17 # SYNOPSIS
18 #
19 #   AMANDA_GET_SVN_INFO
20 #
21 # OVERVIEW
22 #
23 #   If the build is in a Subversion working copy, and if an svn client
24 #   is available, then update common-src/svn-info.h to reflect the current
25 #   revision and branch.
26 #
27 #   If these things are not available, then the file is not updated, and
28 #   any previous contents are used.  If the file does not exist, it is
29 #   created.
30 #
31 AC_DEFUN([AMANDA_GET_SVN_INFO],
32 [
33     AC_REQUIRE([AMANDA_INIT_PROGS])
34     AC_REQUIRE([AMANDA_PROG_GREP])
35
36     AC_PATH_PROG(SVN, svn,, $LOCSYSPATH)
37     AC_MSG_CHECKING([Subversion revision information])
38     if test -d $srcdir/.svn && test -n "$SVN" && (cd $srcdir > /dev/null ; $SVN info . ) > conftemp.svn; then
39         rev=`$GREP Revision: conftemp.svn|cut -d: -f 2|cut -c2-`
40         url=`$GREP URL: conftemp.svn|cut -d: -f 2-|cut -c2-`
41         ( echo '#define BUILT_REV "'$rev'"'
42           echo '#define BUILT_BRANCH "'`basename "$url"`'"'
43         ) > common-src/svn-info.h
44
45         AC_MSG_RESULT([updated])
46     else
47         # Makefiles will be upset if the file doesn't exist, so double-check
48         if test -f common-src/svn-info.h; then
49             : # all good
50             AC_MSG_RESULT([not changed])
51         else
52             echo '/* no information available */' > common-src/svn-info.h
53             AC_MSG_RESULT([not available])
54         fi
55     fi
56
57     rm -f conftemp.svn
58 ])