fi],
ADDITIONAL_LOAD_PATH=)
AC_SUBST(ADDITIONAL_LOAD_PATH)])
+
+AC_DEFUN([AC_PATH_GPG],
+ [AC_PATH_PROG(GPG, gpg)
+ AC_ARG_WITH(gpg,
+ AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
+ GPG=$withval, NO_OVERRIDE=yes)
+ AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
+ AC_SUBST(GPG)
+ dnl Check for GnuPG version requirement.
+ GPG_VERSION=unknown
+ ok=maybe
+ if test -z "$GPG" -o "x$GPG" = "xno"; then
+ ok=no
+ else
+ if test ! -x "$GPG"; then
+ AC_MSG_WARN([GnuPG not executable, version check disabled])
+ ok=no
+ fi
+ fi
+ if test "$ok" = "maybe"; then
+ AC_MSG_CHECKING(for GnuPG >= $1)
+ req_major=`echo $1 | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+ req_minor=`echo $1 | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+ req_micro=`echo $1 | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+ gpg_version=`$GPG --version | grep ^gpg`
+ major=`echo $gpg_version | \
+ sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+ minor=`echo $gpg_version | \
+ sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+ micro=`echo $gpg_version | \
+ sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+ GPG_VERSION=`echo $gpg_version | sed 's/^gpg (GnuPG) //'`
+
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test "$ok" = "yes"; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([GnuPG must be at least version $1])
+ ifelse([$3], , :, [$3])
+ fi
+ fi
+ AM_CONDITIONAL(RUN_GPG_TESTS, test "$ok" = "yes")
+ AC_SUBST(GPG_PATH)])
\ No newline at end of file