From ad2e266a5886981cf5d1bb5b62463072ff4a95dd Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 13 Jul 2006 03:49:13 +0000 Subject: [PATCH] * acinclude.m4 (AC_PATH_GPG): New macro. * configure.ac: Check gpg version. Suggested by Max Froumentin --- ChangeLog | 6 ++++++ acinclude.m4 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 2 ++ 3 files changed, 70 insertions(+) diff --git a/ChangeLog b/ChangeLog index 27ddb45..f93833b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-07-13 Daiki Ueno + + * acinclude.m4 (AC_PATH_GPG): New macro. + * configure.ac: Check gpg version. + Suggested by Max Froumentin + 2006-07-10 Daiki Ueno * epg.el (epg--status-ERRSIG): Don't remove the last verify-result. diff --git a/acinclude.m4 b/acinclude.m4 index ad09542..e39c972 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -357,3 +357,65 @@ AC_DEFUN([AC_ADD_LOAD_PATH], 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 diff --git a/configure.ac b/configure.ac index 5f13102..c871887 100644 --- a/configure.ac +++ b/configure.ac @@ -9,5 +9,7 @@ AC_PATH_PACKAGEDIR AM_CONDITIONAL(XEMACS, test ${EMACS_FLAVOR} = xemacs) +AC_PATH_GPG(1.4.3,,AC_MSG_ERROR([No suitable version of gpg])) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT -- 1.7.10.4