xcrypt 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +106 -0
  3. data/ext/libxcrypt/AUTHORS +38 -0
  4. data/ext/libxcrypt/COPYING.LIB +502 -0
  5. data/ext/libxcrypt/ChangeLog +239 -0
  6. data/ext/libxcrypt/INSTALL +380 -0
  7. data/ext/libxcrypt/LICENSING +152 -0
  8. data/ext/libxcrypt/Makefile.am +704 -0
  9. data/ext/libxcrypt/Makefile.in +4110 -0
  10. data/ext/libxcrypt/NEWS +630 -0
  11. data/ext/libxcrypt/README +1 -0
  12. data/ext/libxcrypt/README.md +179 -0
  13. data/ext/libxcrypt/THANKS +13 -0
  14. data/ext/libxcrypt/TODO +1 -0
  15. data/ext/libxcrypt/TODO.md +100 -0
  16. data/ext/libxcrypt/aclocal.m4 +2617 -0
  17. data/ext/libxcrypt/autogen.sh +33 -0
  18. data/ext/libxcrypt/autom4te.cache/output.0 +19884 -0
  19. data/ext/libxcrypt/autom4te.cache/output.1 +19884 -0
  20. data/ext/libxcrypt/autom4te.cache/output.2 +19884 -0
  21. data/ext/libxcrypt/autom4te.cache/output.3 +19885 -0
  22. data/ext/libxcrypt/autom4te.cache/requests +714 -0
  23. data/ext/libxcrypt/autom4te.cache/traces.0 +4088 -0
  24. data/ext/libxcrypt/autom4te.cache/traces.1 +1060 -0
  25. data/ext/libxcrypt/autom4te.cache/traces.2 +4088 -0
  26. data/ext/libxcrypt/autom4te.cache/traces.3 +1060 -0
  27. data/ext/libxcrypt/build-aux/ci/ci-log-dependency-versions +79 -0
  28. data/ext/libxcrypt/build-aux/ci/ci-log-logfiles +22 -0
  29. data/ext/libxcrypt/build-aux/ci/clang-gcov-wrapper +2 -0
  30. data/ext/libxcrypt/build-aux/ci/configure-wrapper +10 -0
  31. data/ext/libxcrypt/build-aux/ci/summarize-coverage +24 -0
  32. data/ext/libxcrypt/build-aux/m4/ax_append_compile_flags.m4 +46 -0
  33. data/ext/libxcrypt/build-aux/m4/ax_append_flag.m4 +50 -0
  34. data/ext/libxcrypt/build-aux/m4/ax_check_compile_flag.m4 +53 -0
  35. data/ext/libxcrypt/build-aux/m4/ax_check_vscript.m4 +142 -0
  36. data/ext/libxcrypt/build-aux/m4/ax_gcc_func_attribute.m4 +246 -0
  37. data/ext/libxcrypt/build-aux/m4/ax_require_defined.m4 +37 -0
  38. data/ext/libxcrypt/build-aux/m4/ax_valgrind_check.m4 +239 -0
  39. data/ext/libxcrypt/build-aux/m4/libtool.m4 +8488 -0
  40. data/ext/libxcrypt/build-aux/m4/ltoptions.m4 +467 -0
  41. data/ext/libxcrypt/build-aux/m4/ltsugar.m4 +124 -0
  42. data/ext/libxcrypt/build-aux/m4/ltversion.m4 +24 -0
  43. data/ext/libxcrypt/build-aux/m4/lt~obsolete.m4 +99 -0
  44. data/ext/libxcrypt/build-aux/m4/pkg_compat.m4 +88 -0
  45. data/ext/libxcrypt/build-aux/m4/zw_alignment.m4 +90 -0
  46. data/ext/libxcrypt/build-aux/m4/zw_automodern.m4 +307 -0
  47. data/ext/libxcrypt/build-aux/m4/zw_detect_asan.m4 +24 -0
  48. data/ext/libxcrypt/build-aux/m4/zw_endianness.m4 +152 -0
  49. data/ext/libxcrypt/build-aux/m4/zw_ld_wrap.m4 +47 -0
  50. data/ext/libxcrypt/build-aux/m4/zw_prog_perl.m4 +40 -0
  51. data/ext/libxcrypt/build-aux/m4/zw_simple_warnings.m4 +150 -0
  52. data/ext/libxcrypt/build-aux/m4/zw_static_assert.m4 +68 -0
  53. data/ext/libxcrypt/build-aux/m4-autogen/compile +364 -0
  54. data/ext/libxcrypt/build-aux/m4-autogen/config.guess +1815 -0
  55. data/ext/libxcrypt/build-aux/m4-autogen/config.sub +2354 -0
  56. data/ext/libxcrypt/build-aux/m4-autogen/depcomp +792 -0
  57. data/ext/libxcrypt/build-aux/m4-autogen/install-sh +541 -0
  58. data/ext/libxcrypt/build-aux/m4-autogen/ltmain.sh +11524 -0
  59. data/ext/libxcrypt/build-aux/m4-autogen/missing +236 -0
  60. data/ext/libxcrypt/build-aux/m4-autogen/test-driver +160 -0
  61. data/ext/libxcrypt/build-aux/scripts/BuildCommon.pm +712 -0
  62. data/ext/libxcrypt/build-aux/scripts/check-perlcritic-config +76 -0
  63. data/ext/libxcrypt/build-aux/scripts/compute-symver-floor +116 -0
  64. data/ext/libxcrypt/build-aux/scripts/expand-selected-hashes +80 -0
  65. data/ext/libxcrypt/build-aux/scripts/gen-crypt-h +131 -0
  66. data/ext/libxcrypt/build-aux/scripts/gen-crypt-hashes-h +141 -0
  67. data/ext/libxcrypt/build-aux/scripts/gen-crypt-symbol-vers-h +150 -0
  68. data/ext/libxcrypt/build-aux/scripts/gen-libcrypt-map +67 -0
  69. data/ext/libxcrypt/build-aux/scripts/move-if-change +84 -0
  70. data/ext/libxcrypt/build-aux/scripts/skip-if-exec-format-error +78 -0
  71. data/ext/libxcrypt/codecov.yml +4 -0
  72. data/ext/libxcrypt/config.h.in +303 -0
  73. data/ext/libxcrypt/configure +19885 -0
  74. data/ext/libxcrypt/configure.ac +549 -0
  75. data/ext/libxcrypt/doc/crypt.3 +512 -0
  76. data/ext/libxcrypt/doc/crypt.5 +343 -0
  77. data/ext/libxcrypt/doc/crypt_checksalt.3 +106 -0
  78. data/ext/libxcrypt/doc/crypt_gensalt.3 +285 -0
  79. data/ext/libxcrypt/doc/crypt_gensalt_ra.3 +1 -0
  80. data/ext/libxcrypt/doc/crypt_gensalt_rn.3 +1 -0
  81. data/ext/libxcrypt/doc/crypt_preferred_method.3 +68 -0
  82. data/ext/libxcrypt/doc/crypt_r.3 +1 -0
  83. data/ext/libxcrypt/doc/crypt_ra.3 +1 -0
  84. data/ext/libxcrypt/doc/crypt_rn.3 +1 -0
  85. data/ext/libxcrypt/lib/alg-des-tables.c +3858 -0
  86. data/ext/libxcrypt/lib/alg-des.c +269 -0
  87. data/ext/libxcrypt/lib/alg-des.h +74 -0
  88. data/ext/libxcrypt/lib/alg-gost3411-2012-const.h +313 -0
  89. data/ext/libxcrypt/lib/alg-gost3411-2012-core.c +238 -0
  90. data/ext/libxcrypt/lib/alg-gost3411-2012-core.h +51 -0
  91. data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.c +78 -0
  92. data/ext/libxcrypt/lib/alg-gost3411-2012-hmac.h +46 -0
  93. data/ext/libxcrypt/lib/alg-gost3411-2012-precalc.h +1426 -0
  94. data/ext/libxcrypt/lib/alg-gost3411-2012-ref.h +67 -0
  95. data/ext/libxcrypt/lib/alg-hmac-sha1.c +140 -0
  96. data/ext/libxcrypt/lib/alg-hmac-sha1.h +35 -0
  97. data/ext/libxcrypt/lib/alg-md4.c +270 -0
  98. data/ext/libxcrypt/lib/alg-md4.h +43 -0
  99. data/ext/libxcrypt/lib/alg-md5.c +291 -0
  100. data/ext/libxcrypt/lib/alg-md5.h +43 -0
  101. data/ext/libxcrypt/lib/alg-sha1.c +288 -0
  102. data/ext/libxcrypt/lib/alg-sha1.h +34 -0
  103. data/ext/libxcrypt/lib/alg-sha256.c +630 -0
  104. data/ext/libxcrypt/lib/alg-sha256.h +123 -0
  105. data/ext/libxcrypt/lib/alg-sha512.c +311 -0
  106. data/ext/libxcrypt/lib/alg-sha512.h +81 -0
  107. data/ext/libxcrypt/lib/alg-sm3-hmac.c +113 -0
  108. data/ext/libxcrypt/lib/alg-sm3-hmac.h +42 -0
  109. data/ext/libxcrypt/lib/alg-sm3.c +449 -0
  110. data/ext/libxcrypt/lib/alg-sm3.h +63 -0
  111. data/ext/libxcrypt/lib/alg-yescrypt-common.c +713 -0
  112. data/ext/libxcrypt/lib/alg-yescrypt-opt.c +1568 -0
  113. data/ext/libxcrypt/lib/alg-yescrypt-platform.c +106 -0
  114. data/ext/libxcrypt/lib/alg-yescrypt.h +360 -0
  115. data/ext/libxcrypt/lib/byteorder.h +164 -0
  116. data/ext/libxcrypt/lib/crypt-bcrypt.c +1061 -0
  117. data/ext/libxcrypt/lib/crypt-des-obsolete.c +215 -0
  118. data/ext/libxcrypt/lib/crypt-des.c +491 -0
  119. data/ext/libxcrypt/lib/crypt-gensalt-static.c +40 -0
  120. data/ext/libxcrypt/lib/crypt-gost-yescrypt.c +182 -0
  121. data/ext/libxcrypt/lib/crypt-md5.c +232 -0
  122. data/ext/libxcrypt/lib/crypt-nthash.c +134 -0
  123. data/ext/libxcrypt/lib/crypt-obsolete.h +40 -0
  124. data/ext/libxcrypt/lib/crypt-pbkdf1-sha1.c +260 -0
  125. data/ext/libxcrypt/lib/crypt-port.h +514 -0
  126. data/ext/libxcrypt/lib/crypt-scrypt.c +247 -0
  127. data/ext/libxcrypt/lib/crypt-sha256.c +308 -0
  128. data/ext/libxcrypt/lib/crypt-sha512.c +323 -0
  129. data/ext/libxcrypt/lib/crypt-sm3-yescrypt.c +189 -0
  130. data/ext/libxcrypt/lib/crypt-sm3.c +308 -0
  131. data/ext/libxcrypt/lib/crypt-static.c +44 -0
  132. data/ext/libxcrypt/lib/crypt-sunmd5.c +314 -0
  133. data/ext/libxcrypt/lib/crypt-yescrypt.c +177 -0
  134. data/ext/libxcrypt/lib/crypt.c +421 -0
  135. data/ext/libxcrypt/lib/crypt.h.in +249 -0
  136. data/ext/libxcrypt/lib/gen-des-tables.c +363 -0
  137. data/ext/libxcrypt/lib/hashes.conf +59 -0
  138. data/ext/libxcrypt/lib/libcrypt.map.in +48 -0
  139. data/ext/libxcrypt/lib/libcrypt.minver +97 -0
  140. data/ext/libxcrypt/lib/libxcrypt.pc.in +15 -0
  141. data/ext/libxcrypt/lib/util-base64.c +26 -0
  142. data/ext/libxcrypt/lib/util-gensalt-sha.c +88 -0
  143. data/ext/libxcrypt/lib/util-get-random-bytes.c +154 -0
  144. data/ext/libxcrypt/lib/util-make-failure-token.c +48 -0
  145. data/ext/libxcrypt/lib/util-xbzero.c +43 -0
  146. data/ext/libxcrypt/lib/util-xstrcpy.c +42 -0
  147. data/ext/libxcrypt/lib/xcrypt.h.in +58 -0
  148. data/ext/libxcrypt/libxcrypt.spec.rpkg +481 -0
  149. data/ext/libxcrypt/rpkg.conf +2 -0
  150. data/ext/libxcrypt/rpkg.macros +86 -0
  151. data/ext/libxcrypt/test/TestCommon.pm +326 -0
  152. data/ext/libxcrypt/test/alg-des.c +80 -0
  153. data/ext/libxcrypt/test/alg-gost3411-2012-hmac.c +90 -0
  154. data/ext/libxcrypt/test/alg-gost3411-2012.c +191 -0
  155. data/ext/libxcrypt/test/alg-hmac-sha1.c +187 -0
  156. data/ext/libxcrypt/test/alg-md4.c +111 -0
  157. data/ext/libxcrypt/test/alg-md5.c +134 -0
  158. data/ext/libxcrypt/test/alg-pbkdf-hmac-sha256.c +269 -0
  159. data/ext/libxcrypt/test/alg-sha1.c +111 -0
  160. data/ext/libxcrypt/test/alg-sha256.c +141 -0
  161. data/ext/libxcrypt/test/alg-sha512.c +170 -0
  162. data/ext/libxcrypt/test/alg-sm3-hmac.c +149 -0
  163. data/ext/libxcrypt/test/alg-sm3.c +168 -0
  164. data/ext/libxcrypt/test/alg-yescrypt.c +466 -0
  165. data/ext/libxcrypt/test/badsalt.c +726 -0
  166. data/ext/libxcrypt/test/badsetting.c +350 -0
  167. data/ext/libxcrypt/test/byteorder.c +254 -0
  168. data/ext/libxcrypt/test/checksalt.c +265 -0
  169. data/ext/libxcrypt/test/compile-strong-alias.c +43 -0
  170. data/ext/libxcrypt/test/crypt-badargs.c +392 -0
  171. data/ext/libxcrypt/test/crypt-gost-yescrypt.c +149 -0
  172. data/ext/libxcrypt/test/crypt-nested-call.c +180 -0
  173. data/ext/libxcrypt/test/crypt-sm3-yescrypt.c +149 -0
  174. data/ext/libxcrypt/test/crypt-too-long-phrase.c +157 -0
  175. data/ext/libxcrypt/test/des-cases.h +196 -0
  176. data/ext/libxcrypt/test/des-obsolete.c +206 -0
  177. data/ext/libxcrypt/test/des-obsolete_r.c +207 -0
  178. data/ext/libxcrypt/test/explicit-bzero.c +334 -0
  179. data/ext/libxcrypt/test/gensalt-bcrypt_x.c +54 -0
  180. data/ext/libxcrypt/test/gensalt-extradata.c +246 -0
  181. data/ext/libxcrypt/test/gensalt-nested-call.c +126 -0
  182. data/ext/libxcrypt/test/gensalt-nthash.c +65 -0
  183. data/ext/libxcrypt/test/gensalt.c +599 -0
  184. data/ext/libxcrypt/test/getrandom-fallbacks.c +295 -0
  185. data/ext/libxcrypt/test/getrandom-interface.c +211 -0
  186. data/ext/libxcrypt/test/ka-table-gen.py +945 -0
  187. data/ext/libxcrypt/test/ka-table.inc +5849 -0
  188. data/ext/libxcrypt/test/ka-tester.c +240 -0
  189. data/ext/libxcrypt/test/preferred-method.c +133 -0
  190. data/ext/libxcrypt/test/short-outbuf.c +119 -0
  191. data/ext/libxcrypt/test/special-char-salt.c +1160 -0
  192. data/ext/libxcrypt/test/symbols-compat.pl +137 -0
  193. data/ext/libxcrypt/test/symbols-renames.pl +107 -0
  194. data/ext/libxcrypt/test/symbols-static.pl +87 -0
  195. data/ext/xcrypt/xcrypt.c +9 -0
  196. data/lib/xcrypt/ffi.rb +76 -0
  197. data/lib/xcrypt/version.rb +5 -0
  198. data/lib/xcrypt.rb +89 -0
  199. metadata +267 -0
@@ -0,0 +1,37 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_require_defined.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_REQUIRE_DEFINED(MACRO)
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
12
+ # been defined and thus are available for use. This avoids random issues
13
+ # where a macro isn't expanded. Instead the configure script emits a
14
+ # non-fatal:
15
+ #
16
+ # ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
17
+ #
18
+ # It's like AC_REQUIRE except it doesn't expand the required macro.
19
+ #
20
+ # Here's an example:
21
+ #
22
+ # AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
23
+ #
24
+ # LICENSE
25
+ #
26
+ # Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
27
+ #
28
+ # Copying and distribution of this file, with or without modification, are
29
+ # permitted in any medium without royalty provided the copyright notice
30
+ # and this notice are preserved. This file is offered as-is, without any
31
+ # warranty.
32
+
33
+ #serial 2
34
+
35
+ AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
36
+ m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
37
+ ])dnl AX_REQUIRE_DEFINED
@@ -0,0 +1,239 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_VALGRIND_DFLT(memcheck|helgrind|drd|sgcheck, on|off)
8
+ # AX_VALGRIND_CHECK()
9
+ #
10
+ # DESCRIPTION
11
+ #
12
+ # AX_VALGRIND_CHECK checks whether Valgrind is present and, if so, allows
13
+ # running `make check` under a variety of Valgrind tools to check for
14
+ # memory and threading errors.
15
+ #
16
+ # Defines VALGRIND_CHECK_RULES which should be substituted in your
17
+ # Makefile; and $enable_valgrind which can be used in subsequent configure
18
+ # output. VALGRIND_ENABLED is defined and substituted, and corresponds to
19
+ # the value of the --enable-valgrind option, which defaults to being
20
+ # enabled if Valgrind is installed and disabled otherwise. Individual
21
+ # Valgrind tools can be disabled via --disable-valgrind-<tool>, the
22
+ # default is configurable via the AX_VALGRIND_DFLT command or is to use
23
+ # all commands not disabled via AX_VALGRIND_DFLT. All AX_VALGRIND_DFLT
24
+ # calls must be made before the call to AX_VALGRIND_CHECK.
25
+ #
26
+ # If unit tests are written using a shell script and automake's
27
+ # LOG_COMPILER system, the $(VALGRIND) variable can be used within the
28
+ # shell scripts to enable Valgrind, as described here:
29
+ #
30
+ # https://www.gnu.org/software/gnulib/manual/html_node/Running-self_002dtests-under-valgrind.html
31
+ #
32
+ # Usage example:
33
+ #
34
+ # configure.ac:
35
+ #
36
+ # AX_VALGRIND_DFLT([sgcheck], [off])
37
+ # AX_VALGRIND_CHECK
38
+ #
39
+ # in each Makefile.am with tests:
40
+ #
41
+ # @VALGRIND_CHECK_RULES@
42
+ # VALGRIND_SUPPRESSIONS_FILES = my-project.supp
43
+ # EXTRA_DIST = my-project.supp
44
+ #
45
+ # This results in a "check-valgrind" rule being added. Running `make
46
+ # check-valgrind` in that directory will recursively run the module's test
47
+ # suite (`make check`) once for each of the available Valgrind tools (out
48
+ # of memcheck, helgrind and drd) while the sgcheck will be skipped unless
49
+ # enabled again on the commandline with --enable-valgrind-sgcheck. The
50
+ # results for each check will be output to test-suite-$toolname.log. The
51
+ # target will succeed if there are zero errors and fail otherwise.
52
+ #
53
+ # Alternatively, a "check-valgrind-$TOOL" rule will be added, for $TOOL in
54
+ # memcheck, helgrind, drd and sgcheck. These are useful because often only
55
+ # some of those tools can be ran cleanly on a codebase.
56
+ #
57
+ # The macro supports running with and without libtool.
58
+ #
59
+ # LICENSE
60
+ #
61
+ # Copyright (c) 2014, 2015, 2016 Philip Withnall <philip.withnall@collabora.co.uk>
62
+ #
63
+ # Copying and distribution of this file, with or without modification, are
64
+ # permitted in any medium without royalty provided the copyright notice
65
+ # and this notice are preserved. This file is offered as-is, without any
66
+ # warranty.
67
+
68
+ #serial 23
69
+
70
+ dnl Configured tools
71
+ m4_define([valgrind_tool_list], [[memcheck], [helgrind], [drd], [sgcheck]])
72
+ m4_set_add_all([valgrind_exp_tool_set], [sgcheck])
73
+ m4_foreach([vgtool], [valgrind_tool_list],
74
+ [m4_define([en_dflt_valgrind_]vgtool, [on])])
75
+
76
+ AC_DEFUN([AX_VALGRIND_DFLT],[
77
+ m4_define([en_dflt_valgrind_$1], [$2])
78
+ ])dnl
79
+
80
+ AC_DEFUN([AX_VALGRIND_CHECK],[
81
+ AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
82
+ m4_foreach([vgtool], [valgrind_tool_list],
83
+ [AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)])
84
+
85
+ dnl Check for --enable-valgrind
86
+ AC_ARG_ENABLE([valgrind],
87
+ [AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests])],
88
+ [enable_valgrind=$enableval],[enable_valgrind=])
89
+
90
+ AS_IF([test "$enable_valgrind" != "no"],[
91
+ # Check for Valgrind.
92
+ AC_PATH_PROG([VALGRIND],[valgrind])
93
+ AS_IF([test "$VALGRIND" = ""],[
94
+ AS_IF([test "$enable_valgrind" = "yes"],[
95
+ AC_MSG_ERROR([Could not find valgrind; either install it or reconfigure with --disable-valgrind])
96
+ ],[
97
+ enable_valgrind=no
98
+ ])
99
+ ],[
100
+ enable_valgrind=yes
101
+ ])
102
+ ])
103
+
104
+ AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"])
105
+ AC_SUBST([VALGRIND_ENABLED],[$enable_valgrind])
106
+
107
+ # Check for Valgrind tools we care about.
108
+ [valgrind_enabled_tools=]
109
+ m4_foreach([vgtool],[valgrind_tool_list],[
110
+ AC_ARG_ENABLE([valgrind-]vgtool,
111
+ m4_if(m4_defn([en_dflt_valgrind_]vgtool),[off],dnl
112
+ [AS_HELP_STRING([--enable-valgrind-]vgtool, [Whether to use ]vgtool[ during the Valgrind tests])],dnl
113
+ [AS_HELP_STRING([--disable-valgrind-]vgtool, [Whether to skip ]vgtool[ during the Valgrind tests])]),
114
+ [enable_valgrind_]vgtool[=$enableval],
115
+ [enable_valgrind_]vgtool[=])
116
+ AS_IF([test "$enable_valgrind" = "no"],[
117
+ enable_valgrind_]vgtool[=no],
118
+ [test "$enable_valgrind_]vgtool[" ]dnl
119
+ m4_if(m4_defn([en_dflt_valgrind_]vgtool), [off], [= "yes"], [!= "no"]),[
120
+ AC_CACHE_CHECK([for Valgrind tool ]vgtool,
121
+ [ax_cv_valgrind_tool_]vgtool,[
122
+ ax_cv_valgrind_tool_]vgtool[=no
123
+ m4_set_contains([valgrind_exp_tool_set],vgtool,
124
+ [m4_define([vgtoolx],[exp-]vgtool)],
125
+ [m4_define([vgtoolx],vgtool)])
126
+ AS_IF([`$VALGRIND --tool=]vgtoolx[ --help >/dev/null 2>&1`],[
127
+ ax_cv_valgrind_tool_]vgtool[=yes
128
+ ])
129
+ ])
130
+ AS_IF([test "$ax_cv_valgrind_tool_]vgtool[" = "no"],[
131
+ AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[
132
+ AC_MSG_ERROR([Valgrind does not support ]vgtool[; reconfigure with --disable-valgrind-]vgtool)
133
+ ],[
134
+ enable_valgrind_]vgtool[=no
135
+ ])
136
+ ],[
137
+ enable_valgrind_]vgtool[=yes
138
+ ])
139
+ ])
140
+ AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[
141
+ valgrind_enabled_tools="$valgrind_enabled_tools ]m4_bpatsubst(vgtool,[^exp-])["
142
+ ])
143
+ AC_SUBST([ENABLE_VALGRIND_]vgtool,[$enable_valgrind_]vgtool)
144
+ ])
145
+ AC_SUBST([valgrind_tools],["]m4_join([ ], valgrind_tool_list)["])
146
+ AC_SUBST([valgrind_enabled_tools],[$valgrind_enabled_tools])
147
+
148
+ [VALGRIND_CHECK_RULES='
149
+ # Valgrind check
150
+ #
151
+ # Optional:
152
+ # - VALGRIND_SUPPRESSIONS_FILES: Space-separated list of Valgrind suppressions
153
+ # files to load. (Default: empty)
154
+ # - VALGRIND_FLAGS: General flags to pass to all Valgrind tools.
155
+ # (Default: --num-callers=30)
156
+ # - VALGRIND_$toolname_FLAGS: Flags to pass to Valgrind $toolname (one of:
157
+ # memcheck, helgrind, drd, sgcheck). (Default: various)
158
+
159
+ # Optional variables
160
+ VALGRIND_SUPPRESSIONS ?= $(addprefix --suppressions=,$(VALGRIND_SUPPRESSIONS_FILES))
161
+ VALGRIND_FLAGS ?= --num-callers=30
162
+ VALGRIND_memcheck_FLAGS ?= --leak-check=full --show-reachable=no
163
+ VALGRIND_helgrind_FLAGS ?= --history-level=approx
164
+ VALGRIND_drd_FLAGS ?=
165
+ VALGRIND_sgcheck_FLAGS ?=
166
+
167
+ # Internal use
168
+ valgrind_log_files = $(addprefix test-suite-,$(addsuffix .log,$(valgrind_tools)))
169
+
170
+ valgrind_memcheck_flags = --tool=memcheck $(VALGRIND_memcheck_FLAGS)
171
+ valgrind_helgrind_flags = --tool=helgrind $(VALGRIND_helgrind_FLAGS)
172
+ valgrind_drd_flags = --tool=drd $(VALGRIND_drd_FLAGS)
173
+ valgrind_sgcheck_flags = --tool=exp-sgcheck $(VALGRIND_sgcheck_FLAGS)
174
+
175
+ valgrind_quiet = $(valgrind_quiet_$(V))
176
+ valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY))
177
+ valgrind_quiet_0 = --quiet
178
+ valgrind_v_use = $(valgrind_v_use_$(V))
179
+ valgrind_v_use_ = $(valgrind_v_use_$(AM_DEFAULT_VERBOSITY))
180
+ valgrind_v_use_0 = @echo " USE " $(patsubst check-valgrind-%-local,%,$''@):;
181
+
182
+ # Support running with and without libtool.
183
+ ifneq ($(LIBTOOL),)
184
+ valgrind_lt = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=execute
185
+ else
186
+ valgrind_lt =
187
+ endif
188
+
189
+ # Use recursive makes in order to ignore errors during check
190
+ check-valgrind-local:
191
+ ifeq ($(VALGRIND_ENABLED),yes)
192
+ $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k \
193
+ $(foreach tool, $(valgrind_enabled_tools), check-valgrind-$(tool))
194
+ else
195
+ @echo "Need to reconfigure with --enable-valgrind"
196
+ endif
197
+
198
+ # Valgrind running
199
+ VALGRIND_TESTS_ENVIRONMENT = \
200
+ $(TESTS_ENVIRONMENT) \
201
+ env VALGRIND=$(VALGRIND) \
202
+ G_SLICE=always-malloc,debug-blocks \
203
+ G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly
204
+
205
+ VALGRIND_LOG_COMPILER = \
206
+ $(valgrind_lt) \
207
+ $(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS)
208
+
209
+ define valgrind_tool_rule
210
+ check-valgrind-$(1)-local:
211
+ ifeq ($$(VALGRIND_ENABLED)-$$(ENABLE_VALGRIND_$(1)),yes-yes)
212
+ ifneq ($$(TESTS),)
213
+ $$(valgrind_v_use)$$(MAKE) check-TESTS \
214
+ TESTS_ENVIRONMENT="$$(VALGRIND_TESTS_ENVIRONMENT)" \
215
+ LOG_COMPILER="$$(VALGRIND_LOG_COMPILER)" \
216
+ LOG_FLAGS="$$(valgrind_$(1)_flags)" \
217
+ TEST_SUITE_LOG=test-suite-$(1).log
218
+ endif
219
+ else ifeq ($$(VALGRIND_ENABLED),yes)
220
+ @echo "Need to reconfigure with --enable-valgrind-$(1)"
221
+ else
222
+ @echo "Need to reconfigure with --enable-valgrind"
223
+ endif
224
+ endef
225
+
226
+ $(foreach tool,$(valgrind_tools),$(eval $(call valgrind_tool_rule,$(tool))))
227
+
228
+ A''M_DISTCHECK_CONFIGURE_FLAGS ?=
229
+ A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind
230
+
231
+ MOSTLYCLEANFILES ?=
232
+ MOSTLYCLEANFILES += $(valgrind_log_files)
233
+
234
+ .PHONY: check-valgrind $(addprefix check-valgrind-,$(valgrind_tools))
235
+ ']
236
+
237
+ AC_SUBST([VALGRIND_CHECK_RULES])
238
+ m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])])
239
+ ])