build: Relax build requirements.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 26 Oct 2018 00:46:07 +0000 (09:46 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 26 Oct 2018 00:46:07 +0000 (09:46 +0900)
* m4/gpg-error.m4: Update.
* m4/ksba.m4: Update.
* m4/libgcrypt.m4: Update.
* configure.ac (NEED_GPG_ERROR_VERSION): Don't require newer.
* src/ntbtls.m4: Don't require AM_PATH_GPG_ERROR.  Use GPGRT_CONFIG
when it is confirmed that it is available and working well.  Fall back
to detecting NTBTLS_CONFIG, if not.

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

index f4e7aef..af15467 100644 (file)
@@ -61,7 +61,7 @@ NTBTLS_CONFIG_API_VERSION=1
 
 # Minimum versions for required libraries
 
-NEED_GPG_ERROR_VERSION=1.33
+NEED_GPG_ERROR_VERSION=1.17
 
 NEED_LIBGCRYPT_API=1
 NEED_LIBGCRYPT_VERSION=1.6.0
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 e7d2641..1333979 100644 (file)
@@ -1,5 +1,5 @@
 # ksba.m4 - autoconf macro to detect ksba
-#       Copyright (C) 2002 g10 Code GmbH
+#       Copyright (C) 2002, 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
@@ -21,18 +21,36 @@ dnl this features allows to prevent build against newer versions of libksba
 dnl with a changed API.
 dnl
 AC_DEFUN([AM_PATH_KSBA],
-[AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AM_PATH_GPG_ERROR])
- AC_ARG_WITH(ksba-prefix,
-            AC_HELP_STRING([--with-ksba-prefix=PFX],
-                           [prefix where KSBA is installed (optional)]),
+[ AC_REQUIRE([AC_CANONICAL_HOST])
+  dnl --with-libksba-prefix=PFX is the preferred name for this option,
+  dnl since that is consistent with how our three siblings use the directory/
+  dnl package name in --with-$dir_name-prefix=PFX.
+  AC_ARG_WITH(libksba-prefix,
+              AC_HELP_STRING([--with-libksba-prefix=PFX],
+                             [prefix where KSBA is installed (optional)]),
      ksba_config_prefix="$withval", ksba_config_prefix="")
+
+  dnl Accept --with-ksba-prefix and make it work the same as
+  dnl --with-libksba-prefix above, for backwards compatibility,
+  dnl but do not document this old, inconsistently-named option.
+  AC_ARG_WITH(ksba-prefix,,
+     ksba_config_prefix="$withval", ksba_config_prefix="")
+
   if test x$ksba_config_prefix != x ; then
     if test x${KSBA_CONFIG+set} != xset ; then
       KSBA_CONFIG=$ksba_config_prefix/bin/ksba-config
     fi
-  else
-    KSBA_CONFIG="$GPG_ERROR_CONFIG ksba"
+  fi
+
+  use_gpgrt_config=""
+  if test x"$KSBA_CONFIG" != x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if CC=$CC $GPGRT_CONFIG libksba >/dev/null 2>&1; then
+      LIBKSBA_CONFIG="$GPGRT_CONFIG libksba"
+      use_gpgrt_config=yes
+    fi
+  fi
+  if test -z "$use_gpgrt_config"; then
+    AC_PATH_PROG(LIBKSBA_CONFIG, ksba-config, no)
   fi
 
   tmp=ifelse([$1], ,1:1.0.0,$1)
index df6469d..e674293 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-24
+# 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,25 @@ 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
 
+  use_gpgrt_config=""
+  if test x"${LIBGCRYPT_CONFIG}" = x -a 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"
+      use_gpgrt_config=yes
+    fi
+  fi
+  if test -z "$use_gpgrt_config"; then
+    AC_PATH_PROG(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/'`
@@ -105,7 +113,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
      # If we have a recent libgcrypt, we should also check that the
      # API is compatible
      if test "$req_libgcrypt_api" -gt 0 ; then
-        tmp=`CC=$CC $LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+        tmp=`CC=$CC $LIBGCRYPT_CONFIG --variable=api_version 2>/dev/null || echo 0`
         if test "$tmp" -gt 0 ; then
            AC_MSG_CHECKING([LIBGCRYPT API version])
            if test "$req_libgcrypt_api" -eq "$tmp" ; then
@@ -121,7 +129,7 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
     LIBGCRYPT_CFLAGS=`CC=$CC $LIBGCRYPT_CONFIG --cflags`
     LIBGCRYPT_LIBS=`CC=$CC $LIBGCRYPT_CONFIG --libs`
     ifelse([$2], , :, [$2])
-    libgcrypt_config_host=`CC=$CC $LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
+    libgcrypt_config_host=`CC=$CC $LIBGCRYPT_CONFIG --variable=host 2>/dev/null || echo none`
     if test x"$libgcrypt_config_host" != xnone ; then
       if test x"$libgcrypt_config_host" != x"$host" ; then
   AC_MSG_WARN([[
index b6ef715..67d314a 100644 (file)
@@ -23,7 +23,6 @@ dnl with a changed API.
 dnl
 AC_DEFUN([AM_PATH_NTBTLS],
 [ AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_REQUIRE([AM_PATH_GPG_ERROR])
   AC_ARG_WITH(ntbtls-prefix,
             AC_HELP_STRING([--with-ntbtls-prefix=PFX],
                            [prefix where NTBTLS is installed (optional)]),
@@ -39,16 +38,25 @@ AC_DEFUN([AM_PATH_NTBTLS],
            fi
            ;;
          '')
-           NTBTLS_CONFIG="$GPG_ERROR_CONFIG ntbtls"
            ;;
           *)
-           NTBTLS_CONFIG="$GPG_ERROR_CONFIG ntbtls"
            AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
            ;;
        esac
      fi
   fi
 
+  use_gpgrt_config=""
+  if test x"${NTBTLS_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if CC=$CC $GPGRT_CONFIG ntbtls >/dev/null 2>&1; then
+      NTBTLS_CONFIG="$GPGRT_CONFIG ntbtls"
+      use_gpgrt_config=yes
+    fi
+  fi
+  if test -z "$use_gpgrt_config"; then
+    AC_PATH_PROG(NTBTLS_CONFIG, ntbtls-config, no)
+  fi
+
   tmp=ifelse([$1], ,1:1.0.0,$1)
   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
      req_ntbtls_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`