From 5c4008a1766e8ca06b0e78faa508d73229fc7e98 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 30 Sep 2004 01:06:19 +0000 Subject: [PATCH] 2004-09-30 Marcus Brinkmann * gpgme.m4: Implement the --api-version check. --- gpgme/ChangeLog | 2 ++ gpgme/gpgme.m4 | 67 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 099faa9..ea8efb4 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,5 +1,7 @@ 2004-09-30 Marcus Brinkmann + * gpgme.m4: Implement the --api-version check. + * rungpg.c (read_status): Move the polling of the output data pipe to just before removing the command fd, from just before adding it. This avoids buffering problems. diff --git a/gpgme/gpgme.m4 b/gpgme/gpgme.m4 index 5e3793f..1915f55 100644 --- a/gpgme/gpgme.m4 +++ b/gpgme/gpgme.m4 @@ -9,6 +9,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + AC_DEFUN([_AM_PATH_GPGME_CONFIG], [ AC_ARG_WITH(gpgme-prefix, AC_HELP_STRING([--with-gpgme-prefix=PFX], @@ -34,7 +35,15 @@ dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS. dnl AC_DEFUN([AM_PATH_GPGME], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl - min_gpgme_version=ifelse([$1], ,0.4.2,$1) + tmp=ifelse([$1], ,1:0.4.2,$1) + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_gpgme_api=0 + min_gpgme_version="$tmp" + fi + AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then @@ -60,6 +69,18 @@ AC_DEFUN([AM_PATH_GPGME], fi fi fi + if test $ok = yes; then + # If we have a recent GPGME, we should also check that the + # API is compatible. + if test "$req_gpgme_api" -gt 0 ; then + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + if test "$req_gpgme_api" -ne "$tmp" ; then + ok=no + fi + fi + fi + fi if test $ok = yes; then GPGME_CFLAGS=`$GPGME_CONFIG --cflags` GPGME_LIBS=`$GPGME_CONFIG --libs` @@ -81,7 +102,15 @@ dnl Test for libgpgme and define GPGME_PTH_CFLAGS and GPGME_PTH_LIBS. dnl AC_DEFUN([AM_PATH_GPGME_PTH], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl - min_gpgme_version=ifelse([$1], ,0.4.2,$1) + tmp=ifelse([$1], ,1:0.4.2,$1) + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_gpgme_api=0 + min_gpgme_version="$tmp" + fi + AC_MSG_CHECKING(for GPGME Pth - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then @@ -109,6 +138,18 @@ AC_DEFUN([AM_PATH_GPGME_PTH], fi fi fi + if test $ok = yes; then + # If we have a recent GPGME, we should also check that the + # API is compatible. + if test "$req_gpgme_api" -gt 0 ; then + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + if test "$req_gpgme_api" -ne "$tmp" ; then + ok=no + fi + fi + fi + fi if test $ok = yes; then GPGME_PTH_CFLAGS=`$GPGME_CONFIG --thread=pth --cflags` GPGME_PTH_LIBS=`$GPGME_CONFIG --thread=pth --libs` @@ -131,7 +172,15 @@ dnl and GPGME_PTHREAD_LIBS. dnl AC_DEFUN([AM_PATH_GPGME_PTHREAD], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl - min_gpgme_version=ifelse([$1], ,0.4.2,$1) + tmp=ifelse([$1], ,1:0.4.2,$1) + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_gpgme_api=0 + min_gpgme_version="$tmp" + fi + AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then @@ -159,6 +208,18 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD], fi fi fi + if test $ok = yes; then + # If we have a recent GPGME, we should also check that the + # API is compatible. + if test "$req_gpgme_api" -gt 0 ; then + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + if test "$req_gpgme_api" -ne "$tmp" ; then + ok=no + fi + fi + fi + fi if test $ok = yes; then GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags` GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs` -- 2.26.2