1 dnl Autoconf macros for libgpg-error
3 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION,
4 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
5 dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS
7 AC_DEFUN([AM_PATH_GPG_ERROR],
8 [ AC_ARG_WITH(gpg-error-prefix,
9 AC_HELP_STRING([--with-gpg-error-prefix=PFX],
10 [prefix where GPG Error is installed (optional)]),
11 gpg_error_config_prefix="$withval", gpg_error_config_prefix="")
12 if test x$gpg_error_config_prefix != x ; then
13 if test x${GPG_ERROR_CONFIG+set} != xset ; then
14 GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config
18 AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
19 min_gpg_error_version=ifelse([$1], ,0.0,$1)
20 AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
22 if test "$GPG_ERROR_CONFIG" != "no" ; then
23 req_major=`echo $min_gpg_error_version | \
24 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
25 req_minor=`echo $min_gpg_error_version | \
26 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
27 gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
28 major=`echo $gpg_error_config_version | \
29 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
30 minor=`echo $gpg_error_config_version | \
31 sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
32 if test "$major" -gt "$req_major"; then
35 if test "$major" -eq "$req_major"; then
36 if test "$minor" -ge "$req_minor"; then
42 if test $ok = yes; then
43 GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
44 GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
46 ifelse([$2], , :, [$2])
51 ifelse([$3], , :, [$3])
53 AC_SUBST(GPG_ERROR_CFLAGS)
54 AC_SUBST(GPG_ERROR_LIBS)