aboutsummaryrefslogtreecommitdiff
path: root/m4/libgcrypt.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/libgcrypt.m4')
-rw-r--r--m4/libgcrypt.m478
1 files changed, 47 insertions, 31 deletions
diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4
index 75863ba9..d89fe113 100644
--- a/m4/libgcrypt.m4
+++ b/m4/libgcrypt.m4
@@ -1,47 +1,62 @@
1dnl Autoconf macros for libgcrypt 1# libgcrypt.m4 - Autoconf macros to detect libgcrypt
2dnl Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc. 2# Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH
3dnl Copyright (C) 2014 Karlson2k (Evgeny Grin) 3#
4dnl 4# This file is free software; as a special exception the author gives
5dnl This file is free software; as a special exception the author gives 5# unlimited permission to copy and/or distribute it, with or without
6dnl unlimited permission to copy and/or distribute it, with or without 6# modifications, as long as this notice is preserved.
7dnl modifications, as long as this notice is preserved. 7#
8dnl 8# This file is distributed in the hope that it will be useful, but
9dnl This file is distributed in the hope that it will be useful, but 9# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the 10# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11#
12# Last-changed: 2014-10-02
12 13
13 14
14dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, 15dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
15dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) 16dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
16dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. 17dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
17dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed 18dnl MINIMUM-VERSION is a string with the version number optionalliy prefixed
18dnl with the API version to also check the API compatibility. Example: 19dnl with the API version to also check the API compatibility. Example:
19dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed 20dnl a MINIMUM-VERSION of 1:1.2.5 won't pass the test unless the installed
20dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using 21dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
21dnl this features allows to prevent build against newer versions of libgcrypt 22dnl this feature prevents building against newer versions of libgcrypt
22dnl with a changed API. 23dnl with a changed API.
23dnl 24dnl
24dnl Updated by Karlson2k to be more tolerant to host tools variations. 25dnl If a prefix option is not used, the config script is first
26dnl searched in $SYSROOT/bin and then along $PATH. If the used
27dnl config script does not match the host specification the script
28dnl is added to the gpg_config_script_warn variable.
25dnl 29dnl
26AC_DEFUN([AM_PATH_LIBGCRYPT], 30AC_DEFUN([AM_PATH_LIBGCRYPT],
27[ AC_REQUIRE([AC_CANONICAL_HOST]) 31[ AC_REQUIRE([AC_CANONICAL_HOST])
28 AC_REQUIRE([AC_PROG_GREP])
29 AC_REQUIRE([AC_PROG_SED])
30 AC_ARG_WITH(libgcrypt-prefix, 32 AC_ARG_WITH(libgcrypt-prefix,
31 AC_HELP_STRING([--with-libgcrypt-prefix=PFX], 33 AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
32 [prefix where LIBGCRYPT is installed (optional)]), 34 [prefix where LIBGCRYPT is installed (optional)]),
33 libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") 35 libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
34 if test x$libgcrypt_config_prefix != x ; then 36 if test x"${LIBGCRYPT_CONFIG}" = x ; then
35 if test x${LIBGCRYPT_CONFIG+set} != xset ; then 37 if test x"${libgcrypt_config_prefix}" != x ; then
36 LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config 38 LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
39 else
40 case "${SYSROOT}" in
41 /*)
42 if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
43 LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
44 fi
45 ;;
46 '')
47 ;;
48 *)
49 AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
50 ;;
51 esac
37 fi 52 fi
38 fi 53 fi
39 54
40 AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no) 55 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
41 tmp=ifelse([$1], ,1:1.2.0,$1) 56 tmp=ifelse([$1], ,1:1.2.0,$1)
42 if echo "$tmp" | $GREP ':' >/dev/null 2>/dev/null ; then 57 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
43 req_libgcrypt_api=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\1/'` 58 req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
44 min_libgcrypt_version=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\2/'` 59 min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
45 else 60 else
46 req_libgcrypt_api=0 61 req_libgcrypt_api=0
47 min_libgcrypt_version="$tmp" 62 min_libgcrypt_version="$tmp"
@@ -51,18 +66,18 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
51 ok=no 66 ok=no
52 if test "$LIBGCRYPT_CONFIG" != "no" ; then 67 if test "$LIBGCRYPT_CONFIG" != "no" ; then
53 req_major=`echo $min_libgcrypt_version | \ 68 req_major=`echo $min_libgcrypt_version | \
54 $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` 69 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
55 req_minor=`echo $min_libgcrypt_version | \ 70 req_minor=`echo $min_libgcrypt_version | \
56 $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` 71 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
57 req_micro=`echo $min_libgcrypt_version | \ 72 req_micro=`echo $min_libgcrypt_version | \
58 $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` 73 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
59 libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` 74 libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
60 major=`echo $libgcrypt_config_version | \ 75 major=`echo $libgcrypt_config_version | \
61 $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` 76 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
62 minor=`echo $libgcrypt_config_version | \ 77 minor=`echo $libgcrypt_config_version | \
63 $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` 78 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
64 micro=`echo $libgcrypt_config_version | \ 79 micro=`echo $libgcrypt_config_version | \
65 $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` 80 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
66 if test "$major" -gt "$req_major"; then 81 if test "$major" -gt "$req_major"; then
67 ok=yes 82 ok=yes
68 else 83 else
@@ -113,8 +128,9 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
113*** built for $libgcrypt_config_host and thus may not match the 128*** built for $libgcrypt_config_host and thus may not match the
114*** used host $host. 129*** used host $host.
115*** You may want to use the configure option --with-libgcrypt-prefix 130*** You may want to use the configure option --with-libgcrypt-prefix
116*** to specify a matching config script. 131*** to specify a matching config script or use \$SYSROOT.
117***]]) 132***]])
133 gpg_config_script_warn="$gpg_config_script_warn libgcrypt"
118 fi 134 fi
119 fi 135 fi
120 else 136 else