OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
4.9 KiB

  1. --- /dev/null 2013-02-11 15:41:37.050360923 +0100
  2. +++ ./m4/libgcrypt.m4 2013-02-12 02:03:28.939730614 +0100
  3. @@ -0,0 +1,123 @@
  4. +dnl Autoconf macros for libgcrypt
  5. +dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
  6. +dnl
  7. +dnl This file is free software; as a special exception the author gives
  8. +dnl unlimited permission to copy and/or distribute it, with or without
  9. +dnl modifications, as long as this notice is preserved.
  10. +dnl
  11. +dnl This file is distributed in the hope that it will be useful, but
  12. +dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
  13. +dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. +
  15. +
  16. +dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
  17. +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  18. +dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
  19. +dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
  20. +dnl with the API version to also check the API compatibility. Example:
  21. +dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
  22. +dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
  23. +dnl this features allows to prevent build against newer versions of libgcrypt
  24. +dnl with a changed API.
  25. +dnl
  26. +AC_DEFUN([AM_PATH_LIBGCRYPT],
  27. +[ AC_ARG_WITH(libgcrypt-prefix,
  28. + AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
  29. + [prefix where LIBGCRYPT is installed (optional)]),
  30. + libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
  31. + if test x$libgcrypt_config_prefix != x ; then
  32. + if test x${LIBGCRYPT_CONFIG+set} != xset ; then
  33. + LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
  34. + fi
  35. + fi
  36. +
  37. + AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
  38. + tmp=ifelse([$1], ,1:1.2.0,$1)
  39. + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
  40. + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
  41. + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
  42. + else
  43. + req_libgcrypt_api=0
  44. + min_libgcrypt_version="$tmp"
  45. + fi
  46. +
  47. + AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
  48. + ok=no
  49. + if test "$LIBGCRYPT_CONFIG" != "no" ; then
  50. + req_major=`echo $min_libgcrypt_version | \
  51. + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  52. + req_minor=`echo $min_libgcrypt_version | \
  53. + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  54. + req_micro=`echo $min_libgcrypt_version | \
  55. + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
  56. + libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
  57. + major=`echo $libgcrypt_config_version | \
  58. + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
  59. + minor=`echo $libgcrypt_config_version | \
  60. + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
  61. + micro=`echo $libgcrypt_config_version | \
  62. + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
  63. + if test "$major" -gt "$req_major"; then
  64. + ok=yes
  65. + else
  66. + if test "$major" -eq "$req_major"; then
  67. + if test "$minor" -gt "$req_minor"; then
  68. + ok=yes
  69. + else
  70. + if test "$minor" -eq "$req_minor"; then
  71. + if test "$micro" -ge "$req_micro"; then
  72. + ok=yes
  73. + fi
  74. + fi
  75. + fi
  76. + fi
  77. + fi
  78. + fi
  79. + if test $ok = yes; then
  80. + AC_MSG_RESULT([yes ($libgcrypt_config_version)])
  81. + else
  82. + AC_MSG_RESULT(no)
  83. + fi
  84. + if test $ok = yes; then
  85. + # If we have a recent libgcrypt, we should also check that the
  86. + # API is compatible
  87. + if test "$req_libgcrypt_api" -gt 0 ; then
  88. + tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
  89. + if test "$tmp" -gt 0 ; then
  90. + AC_MSG_CHECKING([LIBGCRYPT API version])
  91. + if test "$req_libgcrypt_api" -eq "$tmp" ; then
  92. + AC_MSG_RESULT([okay])
  93. + else
  94. + ok=no
  95. + AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
  96. + fi
  97. + fi
  98. + fi
  99. + fi
  100. + if test $ok = yes; then
  101. + LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
  102. + LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
  103. + ifelse([$2], , :, [$2])
  104. + if test x"$host" != x ; then
  105. + libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
  106. + if test x"$libgcrypt_config_host" != xnone ; then
  107. + if test x"$libgcrypt_config_host" != x"$host" ; then
  108. + AC_MSG_WARN([[
  109. +***
  110. +*** The config script $LIBGCRYPT_CONFIG was
  111. +*** built for $libgcrypt_config_host and thus may not match the
  112. +*** used host $host.
  113. +*** You may want to use the configure option --with-libgcrypt-prefix
  114. +*** to specify a matching config script.
  115. +***]])
  116. + fi
  117. + fi
  118. + fi
  119. + else
  120. + LIBGCRYPT_CFLAGS=""
  121. + LIBGCRYPT_LIBS=""
  122. + ifelse([$3], , :, [$3])
  123. + fi
  124. + AC_SUBST(LIBGCRYPT_CFLAGS)
  125. + AC_SUBST(LIBGCRYPT_LIBS)
  126. +])