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.

142 lines
5.6 KiB

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