build: Relax requirement of gpg-error-config.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 25 Oct 2018 11:44:51 +0000 (20:44 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 25 Oct 2018 11:44:51 +0000 (20:44 +0900)
* npth.m4: Don't require AM_PATH_GPG_ERROR.

--

New gpgrt-config is completely optional.  Configuring with old
npth-config script is still supported (with no gpg-error).
With new npth.pc file, developer can use PKG_CHECK_MODULES
in pkg.m4 or npth.m4 with AM_PATH_GPG_ERROR in gpg-error.m4.

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

diff --git a/npth.m4 b/npth.m4
index 5796544..095d375 100644 (file)
--- a/npth.m4
+++ b/npth.m4
@@ -1,5 +1,5 @@
 # npth.m4 - autoconf macro to detect NPTH.
-# Copyright (C) 2002, 2003, 2004, 2011 g10 Code GmbH
+# Copyright (C) 2002, 2003, 2004, 2011, 2018 g10 Code GmbH
 #
 # This file is free software; as a special exception the author gives
 # unlimited permission to copy and/or distribute it, with or without
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 AC_DEFUN([_AM_PATH_NPTH_CONFIG],
-[ AC_REQUIRE([AM_PATH_GPG_ERROR])
-  AC_ARG_WITH(npth-prefix,
+[ AC_ARG_WITH(npth-prefix,
             AC_HELP_STRING([--with-npth-prefix=PFX],
                            [prefix where NPTH is installed (optional)]),
      npth_config_prefix="$withval", npth_config_prefix="")
   if test "x$npth_config_prefix" != x ; then
       NPTH_CONFIG="$npth_config_prefix/bin/npth-config"
+  fi
+  if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if CC=$CC $GPGRT_CONFIG npth >/dev/null 2>&1; then
+      NPTH_CONFIG="$GPGRT_CONFIG npth"
+    else
+      NPTH_CONFIG=no
+    fi
   else
-      NPTH_CONFIG="$GPG_ERROR_CONFIG npth"
+    AC_PATH_PROG(NPTH_CONFIG, npth-config, no)
   fi
 
   if test "$NPTH_CONFIG" != "no" ; then