Use git(1) only if present

The GIT_REVISION is set as the result of 'git describe'.
If git is not installed the old code generated an error:
$ dh_autoreconf -a
sh: 1: git: not found
sh: 1: git: not found

Thanks to Thomas Hood for the bug report
https://groups.google.com/d/msg/nfc-tools-devel/Skd03b1wUcg/xnQThAPXPCYJ
This commit is contained in:
Ludovic Rousseau 2013-02-05 19:39:45 +01:00
parent c2fe7673dd
commit 4e89c61813

View file

@ -8,9 +8,10 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER(config.h)
# GIT revison
define([git_revision], esyscmd([sh -c "git describe"]))
GIT_REVISION=git_revision
AC_DEFINE_UNQUOTED([GIT_REVISION], ["$GIT_REVISION"], [GIT revision])
GIT_REVISION=`which git > /dev/null && git describe`
if test x"$GIT_REVISION" != x""; then
AC_DEFINE_UNQUOTED([GIT_REVISION], ["$GIT_REVISION"], [GIT revision])
fi
AM_INIT_AUTOMAKE
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])