Debian Codegraph @

m4/ax_git_current_branch.m4

raw
1 # -*- Autoconf -*-
2 #
3 # SYNOPSIS
4 #
5 # AX_GIT_CURRENT_BRANCH()
6 #
7 # DESCRIPTION
8 #
9 # Sets the ax_git_current_branch variable to the current git branch, if any,
10 # otherwise it lets it unset.
11 #
12 # LICENSE
13 #
14 # Copyright (c) 2016-2017 Enrico M. Crisostomo <[email protected]>
15 #
16 # This program is free software: you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by the
18 # Free Software Foundation, either version 3 of the License, or (at your
19 # option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful, but
22 # WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
24 # Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License along
27 # with this program. If not, see <http://www.gnu.org/licenses/>.
28 #
29 # As a special exception, the respective Autoconf Macro's copyright owner
30 # gives unlimited permission to copy, distribute and modify the configure
31 # scripts that are the output of Autoconf when processing the Macro. You
32 # need not follow the terms of the GNU General Public License when using
33 # or distributing such scripts, even though portions of the text of the
34 # Macro appear in them. The GNU General Public License (GPL) does govern
35 # all other use of the material that constitutes the Autoconf Macro.
36 #
37 # This special exception to the GPL applies to versions of the Autoconf
38 # Macro released by the Autoconf Archive. When you make and distribute a
39 # modified version of the Autoconf Macro, you may extend this special
40 # exception to the GPL to apply to your modified version as well.
41
42 #serial 2
43
44 AC_DEFUN_ONCE([AX_GIT_CURRENT_BRANCH],[dnl
45 EMC_PATH_PROG([GIT], [git], [], [], [git path])
46 AS_VAR_SET_IF([GIT],
47 [
48 AC_MSG_CHECKING([for current git branch])
49 AS_VAR_SET([ax_git_current_branch], [$("${GIT}" rev-parse --symbolic-full-name --abbrev-ref HEAD)])
50 AS_IF(dnl
51 [test $? -eq 0],
52 [AC_MSG_RESULT([${ax_git_current_branch}])],
53 [
54 AC_MSG_RESULT([])
55 AC_MSG_WARN([An error occurred while invoking git])
56 AS_UNSET([ax_git_current_branch])
57 ])
58 AC_SUBST([ax_git_current_branch])
59 ], [])
60 ])dnl AX_GIT_CURRENT_BRANCH