gpg-error.m4 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION,
  12. dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  13. dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS
  14. dnl
  15. AC_DEFUN([AM_PATH_GPG_ERROR],
  16. [ AC_ARG_WITH(gpg-error-prefix,
  17. AC_HELP_STRING([--with-gpg-error-prefix=PFX],
  18. [prefix where GPG Error is installed (optional)]),
  19. gpg_error_config_prefix="$withval", gpg_error_config_prefix="")
  20. if test x$gpg_error_config_prefix != x ; then
  21. if test x${GPG_ERROR_CONFIG+set} != xset ; then
  22. GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config
  23. fi
  24. fi
  25. AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
  26. min_gpg_error_version=ifelse([$1], ,0.0,$1)
  27. AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
  28. ok=no
  29. if test "$GPG_ERROR_CONFIG" != "no" ; then
  30. req_major=`echo $min_gpg_error_version | \
  31. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  32. req_minor=`echo $min_gpg_error_version | \
  33. sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  34. gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
  35. major=`echo $gpg_error_config_version | \
  36. sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
  37. minor=`echo $gpg_error_config_version | \
  38. sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
  39. if test "$major" -gt "$req_major"; then
  40. ok=yes
  41. else
  42. if test "$major" -eq "$req_major"; then
  43. if test "$minor" -ge "$req_minor"; then
  44. ok=yes
  45. fi
  46. fi
  47. fi
  48. fi
  49. if test $ok = yes; then
  50. GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
  51. GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
  52. AC_MSG_RESULT(yes)
  53. ifelse([$2], , :, [$2])
  54. else
  55. GPG_ERROR_CFLAGS=""
  56. GPG_ERROR_LIBS=""
  57. AC_MSG_RESULT(no)
  58. ifelse([$3], , :, [$3])
  59. fi
  60. AC_SUBST(GPG_ERROR_CFLAGS)
  61. AC_SUBST(GPG_ERROR_LIBS)
  62. ])