1 |
werner |
36 |
# gpg-error.m4 - autoconf macro to detect libgpg-error. |
2 |
|
|
# Copyright (C) 2002, 2003, 2004 g10 Code GmbH |
3 |
|
|
# |
4 |
|
|
# 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 |
|
|
# modifications, as long as this notice is preserved. |
7 |
|
|
# |
8 |
|
|
# 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 |
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11 |
|
|
|
12 |
|
|
dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, |
13 |
|
|
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) |
14 |
|
|
dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS |
15 |
|
|
dnl |
16 |
|
|
AC_DEFUN([AM_PATH_GPG_ERROR], |
17 |
|
|
[ AC_ARG_WITH(gpg-error-prefix, |
18 |
|
|
AC_HELP_STRING([--with-gpg-error-prefix=PFX], |
19 |
|
|
[prefix where GPG Error is installed (optional)]), |
20 |
|
|
gpg_error_config_prefix="$withval", gpg_error_config_prefix="") |
21 |
|
|
if test x$gpg_error_config_prefix != x ; then |
22 |
|
|
if test x${GPG_ERROR_CONFIG+set} != xset ; then |
23 |
|
|
GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config |
24 |
|
|
fi |
25 |
|
|
fi |
26 |
|
|
|
27 |
|
|
AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) |
28 |
|
|
min_gpg_error_version=ifelse([$1], ,0.0,$1) |
29 |
|
|
AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) |
30 |
|
|
ok=no |
31 |
|
|
if test "$GPG_ERROR_CONFIG" != "no" ; then |
32 |
|
|
req_major=`echo $min_gpg_error_version | \ |
33 |
|
|
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
34 |
|
|
req_minor=`echo $min_gpg_error_version | \ |
35 |
|
|
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
36 |
|
|
gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version` |
37 |
|
|
major=`echo $gpg_error_config_version | \ |
38 |
|
|
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
39 |
|
|
minor=`echo $gpg_error_config_version | \ |
40 |
|
|
sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
41 |
|
|
if test "$major" -gt "$req_major"; then |
42 |
|
|
ok=yes |
43 |
|
|
else |
44 |
|
|
if test "$major" -eq "$req_major"; then |
45 |
|
|
if test "$minor" -ge "$req_minor"; then |
46 |
|
|
ok=yes |
47 |
|
|
fi |
48 |
|
|
fi |
49 |
|
|
fi |
50 |
|
|
fi |
51 |
|
|
if test $ok = yes; then |
52 |
|
|
GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` |
53 |
|
|
GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` |
54 |
|
|
AC_MSG_RESULT(yes) |
55 |
|
|
ifelse([$2], , :, [$2]) |
56 |
|
|
else |
57 |
|
|
GPG_ERROR_CFLAGS="" |
58 |
|
|
GPG_ERROR_LIBS="" |
59 |
|
|
AC_MSG_RESULT(no) |
60 |
|
|
ifelse([$3], , :, [$3]) |
61 |
|
|
fi |
62 |
|
|
AC_SUBST(GPG_ERROR_CFLAGS) |
63 |
|
|
AC_SUBST(GPG_ERROR_LIBS) |
64 |
|
|
]) |
65 |
|
|
|