npth.m4: Better backward compatibility.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 26 Oct 2018 01:26:34 +0000 (10:26 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 26 Oct 2018 01:26:34 +0000 (10:26 +0900)
* npth.m4: Don't assume npth-config is newer.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
npth.m4

diff --git a/npth.m4 b/npth.m4
index d36c39d..f5a73db 100644 (file)
--- a/npth.m4
+++ b/npth.m4
@@ -30,7 +30,11 @@ AC_DEFUN([_AM_PATH_NPTH_CONFIG],
   fi
 
   if test "$NPTH_CONFIG" != "no" ; then
   fi
 
   if test "$NPTH_CONFIG" != "no" ; then
-    npth_version=`CC=$CC $NPTH_CONFIG --modversion`
+    if test -z "$use_gpgrt_config"; then
+      npth_version=`CC=$CC $NPTH_CONFIG --version`
+    else
+      npth_version=`CC=$CC $NPTH_CONFIG --modversion`
+    fi
   fi
   npth_version_major=`echo $npth_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
   fi
   npth_version_major=`echo $npth_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
@@ -80,26 +84,34 @@ AC_DEFUN([AM_PATH_NPTH],
     AC_MSG_RESULT(no)
   fi
   if test $ok = yes; then
     AC_MSG_RESULT(no)
   fi
   if test $ok = yes; then
-     # If we have a recent NPTH, we should also check that the
-     # API is compatible.
-     if test "$req_npth_api" -gt 0 ; then
+    # If we have a recent NPTH, we should also check that the
+    # API is compatible.
+    if test "$req_npth_api" -gt 0 ; then
+      if test -z "$use_gpgrt_config"; then
         tmp=`CC=$CC $NPTH_CONFIG --variable=api_version 2>/dev/null || echo 0`
         tmp=`CC=$CC $NPTH_CONFIG --variable=api_version 2>/dev/null || echo 0`
-        if test "$tmp" -gt 0 ; then
-           AC_MSG_CHECKING([NPTH API version])
-           if test "$req_npth_api" -eq "$tmp" ; then
-             AC_MSG_RESULT([okay])
-           else
-             ok=no
-             AC_MSG_RESULT([does not match. want=$req_npth_api got=$tmp])
-           fi
+      else
+        tmp=`CC=$CC $NPTH_CONFIG --api-version 2>/dev/null || echo 0`
+      fi
+      if test "$tmp" -gt 0 ; then
+        AC_MSG_CHECKING([NPTH API version])
+        if test "$req_npth_api" -eq "$tmp" ; then
+          AC_MSG_RESULT([okay])
+        else
+          ok=no
+          AC_MSG_RESULT([does not match. want=$req_npth_api got=$tmp])
         fi
         fi
-     fi
+      fi
+    fi
   fi
   if test $ok = yes; then
     NPTH_CFLAGS=`CC=$CC $NPTH_CONFIG --cflags`
     NPTH_LIBS=`CC=$CC $NPTH_CONFIG --libs`
     ifelse([$2], , :, [$2])
   fi
   if test $ok = yes; then
     NPTH_CFLAGS=`CC=$CC $NPTH_CONFIG --cflags`
     NPTH_LIBS=`CC=$CC $NPTH_CONFIG --libs`
     ifelse([$2], , :, [$2])
-    npth_config_host=`CC=$CC $NPTH_CONFIG --variable=host 2>/dev/null || echo none`
+    if test -z "$use_gpgrt_config"; then
+      npth_config_host=`CC=$CC $NPTH_CONFIG --host 2>/dev/null || echo none`
+    else
+      npth_config_host=`CC=$CC $NPTH_CONFIG --variable=host 2>/dev/null || echo none`
+    fi
     if test x"$npth_config_host" != xnone ; then
       if test x"$npth_config_host" != x"$host" ; then
         AC_MSG_WARN([[
     if test x"$npth_config_host" != xnone ; then
       if test x"$npth_config_host" != x"$host" ; then
         AC_MSG_WARN([[