diff options
Diffstat (limited to 'm4/libgcrypt.m4')
-rw-r--r-- | m4/libgcrypt.m4 | 78 |
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 @@ | |||
1 | dnl Autoconf macros for libgcrypt | 1 | # libgcrypt.m4 - Autoconf macros to detect libgcrypt |
2 | dnl Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc. | 2 | # Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH |
3 | dnl Copyright (C) 2014 Karlson2k (Evgeny Grin) | 3 | # |
4 | dnl | 4 | # This file is free software; as a special exception the author gives |
5 | dnl This file is free software; as a special exception the author gives | 5 | # unlimited permission to copy and/or distribute it, with or without |
6 | dnl unlimited permission to copy and/or distribute it, with or without | 6 | # modifications, as long as this notice is preserved. |
7 | dnl modifications, as long as this notice is preserved. | 7 | # |
8 | dnl | 8 | # This file is distributed in the hope that it will be useful, but |
9 | dnl 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 |
10 | dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the | 10 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11 | dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | # |
12 | # Last-changed: 2014-10-02 | ||
12 | 13 | ||
13 | 14 | ||
14 | dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, | 15 | dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, |
15 | dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) | 16 | dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) |
16 | dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. | 17 | dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. |
17 | dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed | 18 | dnl MINIMUM-VERSION is a string with the version number optionalliy prefixed |
18 | dnl with the API version to also check the API compatibility. Example: | 19 | dnl with the API version to also check the API compatibility. Example: |
19 | dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed | 20 | dnl a MINIMUM-VERSION of 1:1.2.5 won't pass the test unless the installed |
20 | dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using | 21 | dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using |
21 | dnl this features allows to prevent build against newer versions of libgcrypt | 22 | dnl this feature prevents building against newer versions of libgcrypt |
22 | dnl with a changed API. | 23 | dnl with a changed API. |
23 | dnl | 24 | dnl |
24 | dnl Updated by Karlson2k to be more tolerant to host tools variations. | 25 | dnl If a prefix option is not used, the config script is first |
26 | dnl searched in $SYSROOT/bin and then along $PATH. If the used | ||
27 | dnl config script does not match the host specification the script | ||
28 | dnl is added to the gpg_config_script_warn variable. | ||
25 | dnl | 29 | dnl |
26 | AC_DEFUN([AM_PATH_LIBGCRYPT], | 30 | AC_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 |