1 dnl Autoconf macros for libassuan
2 dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4 dnl This file is free software; as a special exception the author gives
5 dnl unlimited permission to copy and/or distribute it, with or without
6 dnl modifications, as long as this notice is preserved.
8 dnl This file is distributed in the hope that it will be useful, but
9 dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 dnl Common code used for libassuan detection [internal]
14 dnl Returns ok set to yes or no.
16 AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
17 [ AC_ARG_WITH(libassuan-prefix,
18 AC_HELP_STRING([--with-libassuan-prefix=PFX],
19 [prefix where LIBASSUAN is installed (optional)]),
20 libassuan_config_prefix="$withval", libassuan_config_prefix="")
21 if test x$libassuan_config_prefix != x ; then
22 libassuan_config_args="$libassuan_config_args --prefix=$libassuan_config_prefix"
23 if test x${LIBASSUAN_CONFIG+set} != xset ; then
24 LIBASSUAN_CONFIG=$libassuan_config_prefix/bin/libassuan-config
27 AC_PATH_PROG(LIBASSUAN_CONFIG, libassuan-config, no)
29 tmp=ifelse([$1], ,1:0.9.2,$1)
30 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
31 req_libassuan_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
32 min_libassuan_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
35 min_libassuan_version="$tmp"
38 if test "$LIBASSUAN_CONFIG" != "no" ; then
39 libassuan_version=`$LIBASSUAN_CONFIG --version`
41 libassuan_version_major=`echo $libassuan_version | \
42 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
43 libassuan_version_minor=`echo $libassuan_version | \
44 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
45 libassuan_version_micro=`echo $libassuan_version | \
46 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
48 AC_MSG_CHECKING(for LIBASSUAN ifelse([$2], ,,[$2 ])- version >= $min_libassuan_version)
50 if test "$LIBASSUAN_CONFIG" != "no" ; then
51 ifelse([$2], ,,[if `$LIBASSUAN_CONFIG --thread=$2 2> /dev/null` ; then])
52 req_major=`echo $min_libassuan_version | \
53 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
54 req_minor=`echo $min_libassuan_version | \
55 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
56 req_micro=`echo $min_libassuan_version | \
57 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
58 if test "$libassuan_version_major" -gt "$req_major"; then
61 if test "$libassuan_version_major" -eq "$req_major"; then
62 if test "$libassuan_version_minor" -gt "$req_minor"; then
65 if test "$libassuan_version_minor" -eq "$req_minor"; then
66 if test "$libassuan_version_micro" -ge "$req_micro"; then
76 if test $ok = yes; then
77 AC_MSG_RESULT([yes ($libassuan_version)])
82 if test $ok = yes; then
83 if test "$req_libassuan_api" -gt 0 ; then
84 tmp=`$LIBASSUAN_CONFIG --api-version 2>/dev/null || echo 0`
85 if test "$tmp" -gt 0 ; then
86 AC_MSG_CHECKING([LIBASSUAN ifelse([$2], ,,[$2 ])API version])
87 if test "$req_libassuan_api" -eq "$tmp" ; then
91 AC_MSG_RESULT([does not match. want=$req_libassuan_api got=$tmp.])
99 dnl AM_CHECK_LIBASSUAN([MINIMUM-VERSION,
100 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
101 dnl Test whether libassuan has at least MINIMUM-VERSION. This is
102 dnl used to test for features only available in newer versions.
104 AC_DEFUN([AM_CHECK_LIBASSUAN],
105 [ _AM_PATH_LIBASSUAN_COMMON($1)
106 if test $ok = yes; then
107 ifelse([$2], , :, [$2])
109 ifelse([$3], , :, [$3])
116 dnl AM_PATH_LIBASSUAN([MINIMUM-VERSION,
117 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
118 dnl Test for libassuan and define LIBASSUAN_CFLAGS and LIBASSUAN_LIBS
120 AC_DEFUN([AM_PATH_LIBASSUAN],
121 [ _AM_PATH_LIBASSUAN_COMMON($1)
122 if test $ok = yes; then
123 LIBASSUAN_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --cflags`
124 LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --libs`
125 ifelse([$2], , :, [$2])
129 ifelse([$3], , :, [$3])
131 AC_SUBST(LIBASSUAN_CFLAGS)
132 AC_SUBST(LIBASSUAN_LIBS)
136 dnl AM_PATH_LIBASSUAN_PTH([MINIMUM-VERSION,
137 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
138 dnl Test for libassuan and define LIBASSUAN_PTH_CFLAGS and LIBASSUAN_PTH_LIBS
140 AC_DEFUN([AM_PATH_LIBASSUAN_PTH],
141 [ _AM_PATH_LIBASSUAN_COMMON($1,pth)
142 if test $ok = yes; then
143 LIBASSUAN_PTH_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pth --cflags`
144 LIBASSUAN_PTH_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pth --libs`
145 ifelse([$2], , :, [$2])
147 LIBASSUAN_PTH_CFLAGS=""
148 LIBASSUAN_PTH_LIBS=""
149 ifelse([$3], , :, [$3])
151 AC_SUBST(LIBASSUAN_PTH_CFLAGS)
152 AC_SUBST(LIBASSUAN_PTH_LIBS)
156 dnl AM_PATH_LIBASSUAN_PTHREAD([MINIMUM-VERSION,
157 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
158 dnl Test for libassuan and define LIBASSUAN_PTHREAD_CFLAGS
159 dnl and LIBASSUAN_PTHREAD_LIBS
161 AC_DEFUN([AM_PATH_LIBASSUAN_PTHREAD],
162 [ _AM_PATH_LIBASSUAN_COMMON($1,pthread)
163 if test $ok = yes; then
164 LIBASSUAN_PTHREAD_CFLAGS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pthread --cflags`
165 LIBASSUAN_PTHREAD_LIBS=`$LIBASSUAN_CONFIG $libassuan_config_args --thread=pthread --libs`
166 ifelse([$2], , :, [$2])
168 LIBASSUAN_PTHREAD_CFLAGS=""
169 LIBASSUAN_PTHREAD_LIBS=""
170 ifelse([$3], , :, [$3])
172 AC_SUBST(LIBASSUAN_PTHREAD_CFLAGS)
173 AC_SUBST(LIBASSUAN_PTHREAD_LIBS)