Blame m4/gpg-error.m4

Packit 0680ba
# gpg-error.m4 - autoconf macro to detect libgpg-error.
Packit 0680ba
# Copyright (C) 2002, 2003, 2004 g10 Code GmbH
Packit 0680ba
#
Packit 0680ba
# This file is free software; as a special exception the author gives
Packit 0680ba
# unlimited permission to copy and/or distribute it, with or without
Packit 0680ba
# modifications, as long as this notice is preserved.
Packit 0680ba
#
Packit 0680ba
# This file is distributed in the hope that it will be useful, but
Packit 0680ba
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
Packit 0680ba
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 0680ba
Packit 0680ba
dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION,
Packit 0680ba
dnl                   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
Packit 0680ba
dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS
Packit 0680ba
dnl
Packit 0680ba
AC_DEFUN([AM_PATH_GPG_ERROR],
Packit 0680ba
[
Packit 0680ba
  dnl --with-libgpg-error-prefix=PFX is the preferred name for this option,
Packit 0680ba
  dnl since that is consistent with how our three siblings use the directory/
Packit 0680ba
  dnl package name in --with-$dir_name-prefix=PFX.
Packit 0680ba
  AC_ARG_WITH(libgpg-error-prefix,
Packit 0680ba
            AC_HELP_STRING([--with-libgpg-error-prefix=PFX],
Packit 0680ba
                           [prefix where GPG Error is installed (optional)]),
Packit 0680ba
     gpg_error_config_prefix="$withval", gpg_error_config_prefix="")
Packit 0680ba
Packit 0680ba
  dnl Accept --with-gpg-error-prefix and make it work the same as
Packit 0680ba
  dnl --with-libgpg-error-prefix above, for backwards compatibility,
Packit 0680ba
  dnl but do not document this old, inconsistently-named option.
Packit 0680ba
  AC_ARG_WITH(gpg-error-prefix,,
Packit 0680ba
     gpg_error_config_prefix="$withval", gpg_error_config_prefix="")
Packit 0680ba
Packit 0680ba
  if test x$gpg_error_config_prefix != x ; then
Packit 0680ba
     if test x${GPG_ERROR_CONFIG+set} != xset ; then
Packit 0680ba
        GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config
Packit 0680ba
     fi
Packit 0680ba
  fi
Packit 0680ba
Packit 0680ba
  AC_PATH_TOOL(GPG_ERROR_CONFIG, gpg-error-config, no)
Packit 0680ba
  min_gpg_error_version=ifelse([$1], ,0.0,$1)
Packit 0680ba
  AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
Packit 0680ba
  ok=no
Packit 0680ba
  if test "$GPG_ERROR_CONFIG" != "no" ; then
Packit 0680ba
    req_major=`echo $min_gpg_error_version | \
Packit 0680ba
               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
Packit 0680ba
    req_minor=`echo $min_gpg_error_version | \
Packit 0680ba
               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
Packit 0680ba
    gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
Packit 0680ba
    major=`echo $gpg_error_config_version | \
Packit 0680ba
               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
Packit 0680ba
    minor=`echo $gpg_error_config_version | \
Packit 0680ba
               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
Packit 0680ba
    if test "$major" -gt "$req_major"; then
Packit 0680ba
        ok=yes
Packit 0680ba
    else
Packit 0680ba
        if test "$major" -eq "$req_major"; then
Packit 0680ba
            if test "$minor" -ge "$req_minor"; then
Packit 0680ba
               ok=yes
Packit 0680ba
            fi
Packit 0680ba
        fi
Packit 0680ba
    fi
Packit 0680ba
  fi
Packit 0680ba
  if test $ok = yes; then
Packit 0680ba
    GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
Packit 0680ba
    GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
Packit 0680ba
    AC_MSG_RESULT([yes ($gpg_error_config_version)])
Packit 0680ba
    ifelse([$2], , :, [$2])
Packit 0680ba
    if test x"$host" != x ; then
Packit 0680ba
      gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none`
Packit 0680ba
      if test x"$gpg_error_config_host" != xnone ; then
Packit 0680ba
        if test x"$gpg_error_config_host" != x"$host" ; then
Packit 0680ba
  AC_MSG_WARN([[
Packit 0680ba
***
Packit 0680ba
*** The config script $GPG_ERROR_CONFIG was
Packit 0680ba
*** built for $gpg_error_config_host and thus may not match the
Packit 0680ba
*** used host $host.
Packit 0680ba
*** You may want to use the configure option --with-gpg-error-prefix
Packit 0680ba
*** to specify a matching config script.
Packit 0680ba
***]])
Packit 0680ba
        fi
Packit 0680ba
      fi
Packit 0680ba
    fi
Packit 0680ba
  else
Packit 0680ba
    GPG_ERROR_CFLAGS=""
Packit 0680ba
    GPG_ERROR_LIBS=""
Packit 0680ba
    AC_MSG_RESULT(no)
Packit 0680ba
    ifelse([$3], , :, [$3])
Packit 0680ba
  fi
Packit 0680ba
  AC_SUBST(GPG_ERROR_CFLAGS)
Packit 0680ba
  AC_SUBST(GPG_ERROR_LIBS)
Packit 0680ba
])