diff mbox series

[v1,1/5] bootstrap: Fix warnings

Message ID 2e8998e2ff0bb8a49b1069219b8b99d34485a933.1664412180.git.geoff@infradead.org
State New
Headers show
Series *** SUBJECT HERE *** | expand

Commit Message

Geoff Levand Sept. 29, 2022, 12:52 a.m. UTC
Fixes bootstrap/autotools warnings like these:

  warning: The macro `AC_GNU_SOURCE' is obsolete.
  warning: The macro `AC_TRY_LINK' is obsolete.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 .gitignore   |  3 +++
 configure.ac | 21 +++++++++---------
 m4/gpgme.m4  | 60 ++++++++++++++++++++++++++++++++++++++++++----------
 3 files changed, 63 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index 77b16f3..6845ec8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,10 +5,13 @@  autom4te.cache/*
 compile
 config.guess
 config.h.in
+config.h.in~
 config.log
 config.rpath
+config.rpath~
 config.sub
 configure
+configure~
 cscope.out
 depcomp
 install-sh
diff --git a/configure.ac b/configure.ac
index 6683be6..524a23d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,7 +25,7 @@  AC_PREFIX_DEFAULT([/usr/local])
 AS_IF([test "x$CFLAGS" = "x"], [AC_SUBST([CFLAGS], [""])])
 
 AC_PROG_CC
-AC_PROG_LEX
+AC_PROG_LEX(yywrap)
 if test -z "$($LEX --version)"; then
 	AC_MSG_ERROR([[Please install flex/lex]])
 fi
@@ -36,7 +36,6 @@  fi
 AC_PROG_INSTALL
 
 AM_INIT_AUTOMAKE
-AC_GNU_SOURCE
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION(0.18.1)
 if test "$USE_NLS" = "yes" -a -z "$($MSGFMT --version)"; then
@@ -121,19 +120,21 @@  AC_CHECK_HEADERS([varargs.h])
 
 dnl Checking for va_copy availability
 AC_MSG_CHECKING([for va_copy])
-AC_TRY_LINK([#include <stdarg.h>
-va_list ap1,ap2;], [va_copy(ap1,ap2);],
-have_va_copy=yes,
-have_va_copy=no)
+
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
+va_list ap1,ap2;]], [[va_copy(ap1,ap2);]])],
+[have_va_copy=yes],
+[have_va_copy=no])
+
 AC_MSG_RESULT($have_va_copy)
 if test x"$have_va_copy" = x"yes"; then
     AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
 else
     AC_MSG_CHECKING([for __va_copy])
-    AC_TRY_LINK([#include <stdarg.h>
-    va_list ap1,ap2;], [__va_copy(ap1,ap2);],
-    have___va_copy=yes,
-    have___va_copy=no)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
+    va_list ap1,ap2;]], [[__va_copy(ap1,ap2);]])],
+    [have___va_copy=yes],
+    [have___va_copy=no])
     AC_MSG_RESULT($have___va_copy)
     if test x"$have___va_copy" = x"yes"; then
         AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
diff --git a/m4/gpgme.m4 b/m4/gpgme.m4
index 6c2be44..c749a5d 100644
--- a/m4/gpgme.m4
+++ b/m4/gpgme.m4
@@ -1,5 +1,5 @@ 
 # gpgme.m4 - autoconf macro to detect GPGME.
-# Copyright (C) 2002, 2003, 2004, 2014 g10 Code GmbH
+# Copyright (C) 2002, 2003, 2004, 2014, 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
@@ -9,12 +9,12 @@ 
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
-# Last-changed: 2014-10-02
+# Last-changed: 2020-11-20
 
 
 AC_DEFUN([_AM_PATH_GPGME_CONFIG],
 [ AC_ARG_WITH(gpgme-prefix,
-            AC_HELP_STRING([--with-gpgme-prefix=PFX],
+            AS_HELP_STRING([--with-gpgme-prefix=PFX],
                            [prefix where GPGME is installed (optional)]),
      gpgme_config_prefix="$withval", gpgme_config_prefix="")
   if test x"${GPGME_CONFIG}" = x ; then
@@ -36,10 +36,24 @@  AC_DEFUN([_AM_PATH_GPGME_CONFIG],
      fi
   fi
 
-  AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
+  use_gpgrt_config=""
+  if test x"${GPGME_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
+    if $GPGRT_CONFIG gpgme --exists; then
+      GPGME_CONFIG="$GPGRT_CONFIG gpgme"
+      AC_MSG_NOTICE([Use gpgrt-config as gpgme-config])
+      use_gpgrt_config=yes
+    fi
+  fi
+  if test -z "$use_gpgrt_config"; then
+    AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
+  fi
 
   if test "$GPGME_CONFIG" != "no" ; then
-    gpgme_version=`$GPGME_CONFIG --version`
+    if test -z "$use_gpgrt_config"; then
+      gpgme_version=`$GPGME_CONFIG --version`
+    else
+      gpgme_version=`$GPGME_CONFIG --modversion`
+    fi
   fi
   gpgme_version_major=`echo $gpgme_version | \
                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
@@ -52,12 +66,16 @@  AC_DEFUN([_AM_PATH_GPGME_CONFIG],
 
 AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK],
 [
-    gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
+    if test -z "$use_gpgrt_config"; then
+      gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
+    else
+      gpgme_config_host=`$GPGME_CONFIG --variable=host 2>/dev/null || echo none`
+    fi
     if test x"$gpgme_config_host" != xnone ; then
       if test x"$gpgme_config_host" != x"$host" ; then
   AC_MSG_WARN([[
 ***
-*** The config script $GPGME_CONFIG was
+*** The config script "$GPGME_CONFIG" was
 *** built for $gpgme_config_host and thus may not match the
 *** used host $host.
 *** You may want to use the configure option --with-gpgme-prefix
@@ -118,7 +136,11 @@  AC_DEFUN([AM_PATH_GPGME],
      # 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 -z "$use_gpgrt_config"; then
+          tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        else
+          tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
+        fi
         if test "$tmp" -gt 0 ; then
            if test "$req_gpgme_api" -ne "$tmp" ; then
              ok=no
@@ -258,7 +280,11 @@  AC_DEFUN([AM_PATH_GPGME_GLIB],
      # 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 -z "$use_gpgrt_config"; then
+          tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
+        else
+          tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
+        fi
         if test "$tmp" -gt 0 ; then
            if test "$req_gpgme_api" -ne "$tmp" ; then
              ok=no
@@ -267,8 +293,20 @@  AC_DEFUN([AM_PATH_GPGME_GLIB],
      fi
   fi
   if test $ok = yes; then
-    GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
-    GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
+    if test -z "$use_gpgrt_config"; then
+      GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
+      GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
+    else
+      if $GPGRT_CONFIG gpgme-glib --exists; then
+        GPGME_CONFIG="$GPGRT_CONFIG gpgme-glib"
+        GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --cflags`
+        GPGME_GLIB_LIBS=`$GPGME_CONFIG --libs`
+      else
+        ok = no
+      fi
+    fi
+  fi
+  if test $ok = yes; then
     AC_MSG_RESULT(yes)
     ifelse([$2], , :, [$2])
     _AM_PATH_GPGME_CONFIG_HOST_CHECK