build: Relax build requirements.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 26 Oct 2018 00:09:51 +0000 (09:09 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 26 Oct 2018 00:09:51 +0000 (09:09 +0900)
* m4/gpg-error.m4: Update from libgpg-error 1.33.
* src/libgcrypt.m4: Don't require AM_PATH_GPG_ERROR.  Use GPGRT_CONFIG
instead of libgcrypt-config when it is confirmed that it is available
and working well.
* configure.ac (AM_PATH_GPG_ERROR): No requirement for newer version
(It was because of new gpgrt-config which supports *.pc files).

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
configure.ac
m4/gpg-error.m4
src/libgcrypt.m4

index 5cb4b37..cdce339 100644 (file)
@@ -72,7 +72,7 @@ LIBGCRYPT_CONFIG_API_VERSION=1
 
 # If you change the required gpg-error version, please remove
 # unnecessary error code defines in src/gcrypt-int.h.
-NEED_GPG_ERROR_VERSION=1.33
+NEED_GPG_ERROR_VERSION=1.25
 
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_SRCDIR([src/libgcrypt.vers])
index 0f46cd6..f89a4ee 100644 (file)
@@ -62,15 +62,21 @@ AC_DEFUN([AM_PATH_GPG_ERROR],
 
   AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
   min_gpg_error_version=ifelse([$1], ,1.33,$1)
-  AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
   ok=no
-  if test "$GPG_ERROR_CONFIG" != "no" \
-     && test -f "$GPG_ERROR_CONFIG" ; then
+  if test "$GPG_ERROR_CONFIG" = "no"; then
+    AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no)
+    if CC=$CC $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then
+      GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error"
+      gpg_error_config_version=`CC=$CC $GPG_ERROR_CONFIG --modversion`
+    fi
+  else
+    gpg_error_config_version=`CC=$CC $GPG_ERROR_CONFIG --version`
+  fi
+  if test "$GPG_ERROR_CONFIG" != "no"; then
     req_major=`echo $min_gpg_error_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
     req_minor=`echo $min_gpg_error_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
-    gpg_error_config_version=`CC=$CC $GPG_ERROR_CONFIG --version`
     major=`echo $gpg_error_config_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
     minor=`echo $gpg_error_config_version | \
@@ -84,7 +90,14 @@ AC_DEFUN([AM_PATH_GPG_ERROR],
             fi
         fi
     fi
+    if test -z "$GPGRT_CONFIG"; then
+      if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then
+        AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no)
+        GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error"
+      fi
+    fi
   fi
+  AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
   if test $ok = yes; then
     GPG_ERROR_CFLAGS=`CC=$CC $GPG_ERROR_CONFIG --cflags`
     GPG_ERROR_LIBS=`CC=$CC $GPG_ERROR_CONFIG --libs`
index e1a158e..ccbc377 100644 (file)
@@ -9,7 +9,7 @@
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
-# Last-changed: 2018-10-25
+# Last-changed: 2018-10-26
 
 
 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
@@ -29,7 +29,6 @@ dnl is added to the gpg_config_script_warn variable.
 dnl
 AC_DEFUN([AM_PATH_LIBGCRYPT],
 [ AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_REQUIRE([AM_PATH_GPG_ERROR])
   AC_ARG_WITH(libgcrypt-prefix,
             AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
                            [prefix where LIBGCRYPT is installed (optional)]),
@@ -45,16 +44,26 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
            fi
            ;;
          '')
-           LIBGCRYPT_CONFIG="$GPG_ERROR_CONFIG libgcrypt"
            ;;
           *)
-           LIBGCRYPT_CONFIG="$GPG_ERROR_CONFIG libgcrypt"
            AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
            ;;
        esac
      fi
   fi
 
+  if test x"${LIBGCRYPT_CONFIG}" = x ; then
+    if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+      if CC=$CC $GPGRT_CONFIG libgcrypt >/dev/null 2>&1; then
+        LIBGCRYPT_CONFIG="$GPGRT_CONFIG libgcrypt"
+        libgcrypt_config_by_gpgrt=yes
+      fi
+    fi
+  fi
+  if test -z "$libgcrypt_config_by_gpgrt"; then
+    AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+  fi
+
   tmp=ifelse([$1], ,1:1.2.0,$1)
   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
      req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`