build-sys: Quieten scm_display_error() checks.
[geda-gaf.git] / m4 / geda-git.m4
blobb5f13989b9ca1399eff7f7dea0b9053a35e53249
1 # geda-git.m4                                           -*-Autoconf-*-
2 # serial 2
4 dnl Generic checks relating to git tools & repositories
5 dnl Copyright (C) 2009-2011  Peter Brett <peter@peter-b.co.uk>
6 dnl
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2 of the License, or
10 dnl (at your option) any later version.
11 dnl
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 dnl GNU General Public License for more details.
16 dnl
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 # Check if git is available, and which git to use.
22 AC_DEFUN([AX_PROG_GIT],
24   AC_PREREQ([2.60])dnl
25   AC_ARG_VAR([GIT], [Path to git executable])
26   AC_CHECK_PROG([GIT], [git], [git], [no])
27 ])dnl AX_PROG_GIT
29 # Check if the source directory is a git repository
30 AC_DEFUN([AX_GIT_REPO],
32   AC_PREREQ([2.60])dnl
33   AC_REQUIRE([AX_PROG_GIT])dnl
35   HAVE_GIT_REPO=no
36   if test "X$GIT" != "Xno"; then
37     AC_MSG_CHECKING([if the source directory is a git repository])
38     if (cd $srcdir && $GIT rev-parse --git-dir > /dev/null 2>&1); then
39       AC_MSG_RESULT([yes])
40       HAVE_GIT_REPO=yes
41     else
42       AC_MSG_RESULT([no])
43     fi
44   fi
46   AC_SUBST([HAVE_GIT_REPO])
47 ])dnl AX_GIT_REPO