1# 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 12dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, 13dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) 14dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS 15dnl 16AC_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_TOOL(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 ($gpg_error_config_version)]) 55 ifelse([$2], , :, [$2]) 56 if test x"$host" != x ; then 57 gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none` 58 if test x"$gpg_error_config_host" != xnone ; then 59 if test x"$gpg_error_config_host" != x"$host" ; then 60 AC_MSG_WARN([[ 61*** 62*** The config script $GPG_ERROR_CONFIG was 63*** built for $gpg_error_config_host and thus may not match the 64*** used host $host. 65*** You may want to use the configure option --with-gpg-error-prefix 66*** to specify a matching config script. 67***]]) 68 fi 69 fi 70 fi 71 else 72 GPG_ERROR_CFLAGS="" 73 GPG_ERROR_LIBS="" 74 AC_MSG_RESULT(no) 75 ifelse([$3], , :, [$3]) 76 fi 77 AC_SUBST(GPG_ERROR_CFLAGS) 78 AC_SUBST(GPG_ERROR_LIBS) 79]) 80