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

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