annotate mcabber/macros/missing/libgcrypt.m4 @ 1302:1abddbec502a

Provide libotr and libgcrypt m4 macros
author Mikael Berthe <mikael@lilotux.net>
date Thu, 30 Aug 2007 09:57:01 +0200
parents
children
rev   line source
1302
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
1 dnl Autoconf macros for libgcrypt
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
2 dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
3 dnl
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
4 dnl This file is free software; as a special exception the author gives
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
5 dnl unlimited permission to copy and/or distribute it, with or without
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
6 dnl modifications, as long as this notice is preserved.
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
7 dnl
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
8 dnl This file is distributed in the hope that it will be useful, but
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
9 dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
10 dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
11
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
12
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
13 dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
14 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
15 dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
16 dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
17 dnl with the API version to also check the API compatibility. Example:
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
18 dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
19 dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
20 dnl this features allows to prevent build against newer versions of libgcrypt
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
21 dnl with a changed API.
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
22 dnl
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
23 AC_DEFUN([AM_PATH_LIBGCRYPT],
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
24 [ AC_ARG_WITH(libgcrypt-prefix,
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
25 AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
26 [prefix where LIBGCRYPT is installed (optional)]),
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
27 libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
28 if test x$libgcrypt_config_prefix != x ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
29 if test x${LIBGCRYPT_CONFIG+set} != xset ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
30 LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
31 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
32 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
33
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
34 AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
35 tmp=ifelse([$1], ,1:1.2.0,$1)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
36 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
37 req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
38 min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
39 else
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
40 req_libgcrypt_api=0
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
41 min_libgcrypt_version="$tmp"
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
42 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
43
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
44 AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
45 ok=no
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
46 if test "$LIBGCRYPT_CONFIG" != "no" ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
47 req_major=`echo $min_libgcrypt_version | \
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
48 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
49 req_minor=`echo $min_libgcrypt_version | \
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
50 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
51 req_micro=`echo $min_libgcrypt_version | \
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
52 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
53 libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
54 major=`echo $libgcrypt_config_version | \
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
55 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
56 minor=`echo $libgcrypt_config_version | \
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
57 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
58 micro=`echo $libgcrypt_config_version | \
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
59 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
60 if test "$major" -gt "$req_major"; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
61 ok=yes
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
62 else
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
63 if test "$major" -eq "$req_major"; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
64 if test "$minor" -gt "$req_minor"; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
65 ok=yes
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
66 else
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
67 if test "$minor" -eq "$req_minor"; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
68 if test "$micro" -ge "$req_micro"; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
69 ok=yes
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
70 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
71 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
72 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
73 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
74 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
75 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
76 if test $ok = yes; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
77 AC_MSG_RESULT(yes)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
78 else
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
79 AC_MSG_RESULT(no)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
80 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
81 if test $ok = yes; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
82 # If we have a recent libgcrypt, we should also check that the
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
83 # API is compatible
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
84 if test "$req_libgcrypt_api" -gt 0 ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
85 tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
86 if test "$tmp" -gt 0 ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
87 AC_MSG_CHECKING([LIBGCRYPT API version])
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
88 if test "$req_libgcrypt_api" -eq "$tmp" ; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
89 AC_MSG_RESULT(okay)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
90 else
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
91 ok=no
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
92 AC_MSG_RESULT([does not match (want=$req_libgcrypt_api got=$tmp)])
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
93 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
94 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
95 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
96 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
97 if test $ok = yes; then
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
98 LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
99 LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
100 ifelse([$2], , :, [$2])
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
101 else
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
102 LIBGCRYPT_CFLAGS=""
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
103 LIBGCRYPT_LIBS=""
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
104 ifelse([$3], , :, [$3])
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
105 fi
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
106 AC_SUBST(LIBGCRYPT_CFLAGS)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
107 AC_SUBST(LIBGCRYPT_LIBS)
1abddbec502a Provide libotr and libgcrypt m4 macros
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
108 ])