0003-fix-am-path-libgcrypt-no-found.patch 5.7 KB

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