Imported Upstream version 3.1.0
[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 -a -n "$SVN" && (cd $srcdir > /dev/null ; $SVN info . ) > conftemp.svn; then
39         SVN_REV=`$GREP Revision: conftemp.svn|cut -d: -f 2|cut -c2-`
40         SVN_URL=`$GREP URL: conftemp.svn|cut -d: -f 2-|cut -c2-`
41         SVN_PATH=`$GREP URL: conftemp.svn|cut -d "/" -f 7-`
42         SVN_TYPE=`echo ${SVN_PATH} |cut -d "/" -f 1`
43         SVN_BRANCH=`echo "${SVN_PATH}"| cut -d "/" -f 2`
44         url=`$GREP URL: conftemp.svn|cut -d: -f 2-|cut -c2-`
45         ( echo '#define BUILT_REV "'$SVN_REV'"'
46           echo '#define BUILT_BRANCH "'$SVN_BRANCH'"'
47         ) > common-src/svn-info.h
48
49         AC_MSG_RESULT([updated])
50     else
51         # Makefiles will be upset if the file doesn't exist, so double-check
52         if test -f common-src/svn-info.h; then
53             : # all good
54             AC_MSG_RESULT([not changed])
55         else
56             echo '/* no information available */' > common-src/svn-info.h
57             AC_MSG_RESULT([not available])
58         fi
59     fi
60
61     rm -f conftemp.svn
62 ])
63
64 # SYNOPSIS
65 #
66 #   AMANDA_GET_GIT_INFO
67 #
68 # OVERVIEW
69 #
70 #   If the build is in a git working copy, and if an git client
71 #   is available, then set GIT_SHA1
72 #
73 AC_DEFUN([AMANDA_GET_GIT_INFO],
74 [
75     AC_REQUIRE([AMANDA_INIT_PROGS])
76     AC_REQUIRE([AMANDA_PROG_GREP])
77
78     AC_PATH_PROG(GIT, git,, $LOCSYSPATH)
79     AC_MSG_CHECKING([git revision information])
80     if test -d $srcdir/.git -a -n "$GIT"; then
81         GIT_SHA1=`(cd $srcdir > /dev/null ; $GIT rev-parse HEAD | cut -c -8 )`
82         if test -n "$GIT_SHA1"; then
83             AC_MSG_RESULT([$GIT_SHA1])
84         else
85             AC_MSG_RESULT(['git rev-parse HEAD' failed])
86         fi
87     else 
88         AC_MSG_RESULT([not available])
89     fi
90
91     rm -f conftemp.git
92 ])