2004-09-30 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Thu, 30 Sep 2004 01:06:19 +0000 (01:06 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Thu, 30 Sep 2004 01:06:19 +0000 (01:06 +0000)
* gpgme.m4: Implement the --api-version check.

gpgme/ChangeLog
gpgme/gpgme.m4

index 099faa9eb4a5b1de9f991876d9b55dfcb984cbfd..ea8efb4611ac3a81afc71d03dcb2323606dae0d7 100644 (file)
@@ -1,5 +1,7 @@
 2004-09-30  Marcus Brinkmann  <marcus@g10code.de>
 
+       * 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.
index 5e3793f797e6d9626dc20cdddeac2cfae3558fc2..1915f550e7d094e5c341e8504ac4ba77adfae9b3 100644 (file)
@@ -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`