build: Make gpgme.m4 use gpgrt-config with *.pc.

* src/gpgme.m4 (_AM_PATH_GPGME_CONFIG): Use gpgrt-config with gpgme.pc
when possible.
(AM_PATH_GPGME_GLIB): Likewise with gpgme-glib.pc.

--

Keeping AM_PATH_GPGME_PTHREAD, as is, untouched.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2018-11-12 10:01:16 +09:00
parent a76e145a10
commit 60828a505a

View File

@ -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,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: 2014-10-02
# Last-changed: 2018-11-12
AC_DEFUN([_AM_PATH_GPGME_CONFIG],
@ -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