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,79 @@
1
+ #! /bin/sh
2
+ set -e
3
+
4
+ # Record certain build tool versions for use as a cache key.
5
+ autotools_ver=
6
+
7
+ # Log the identities and versions of the build tools.
8
+ for tool in \
9
+ "${CC-cc}" \
10
+ "${NM-nm}" \
11
+ "${AUTOCONF-autoconf}" \
12
+ "${AUTOMAKE-automake}" \
13
+ "${LIBTOOLIZE-libtoolize}" \
14
+ "${PKG_CONFIG-pkg-config}" \
15
+ "${PERL-perl}" \
16
+ "${CPANM-cpanm}" \
17
+ "${PERLCRITIC-perlcritic}" \
18
+ "${PERLTIDY-perltidy}" \
19
+ "${PYTHON-python3}" \
20
+ "${GCOV-gcov}" \
21
+ "${LCOV-lcov}" \
22
+ "${LLVM_COV-llvm-cov}" \
23
+ "${VALGRIND-valgrind}"
24
+ do
25
+ # $tool might include mandatory command-line arguments.
26
+ # Interpret it the same way Make would.
27
+ set fnord $tool; shift # word-split $tool and load it into "$@"
28
+
29
+ echo ::group::"$1"
30
+ if command -V "$1"; then
31
+ echo + "$@" --version
32
+ "$@" --version
33
+ fi
34
+ echo ::endgroup::
35
+
36
+ case "$1" in
37
+ (*autoconf*)
38
+ autotools_ver="${autotools_ver}ac$("$@" --version 2>&1 |
39
+ sed -Ene '1{s/^[^\(]+\([^\)]+\) //;p}'
40
+ )"
41
+ ;;
42
+
43
+ (*automake*)
44
+ autotools_ver="${autotools_ver}am$("$@" --version |
45
+ sed -Ene '1{s/^[^\(]+\([^\)]+\) //;p}'
46
+ )"
47
+ ;;
48
+
49
+ (*libtoolize*)
50
+ autotools_ver="${autotools_ver}lt$("$@" --version |
51
+ sed -Ene '1{s/^[^\(]+\([^\)]+\) //;p}'
52
+ )"
53
+ ;;
54
+
55
+ (*pkg-config*)
56
+ autotools_ver="${autotools_ver}pk$("$@" --version |
57
+ sed -Ene '1{s/^[^\(]+\([^\)]+\) //;p}'
58
+ )"
59
+ ;;
60
+
61
+ (*python*)
62
+ echo ::group::passlib
63
+ "$@" -c '
64
+ try:
65
+ import passlib
66
+ import os.path
67
+ print("passlib is " + os.path.dirname(passlib.__file__))
68
+ print("passlib: version " + passlib.__version__)
69
+ except ModuleNotFoundError:
70
+ print("passlib is not installed")
71
+ '
72
+ echo ::endgroup::
73
+ ;;
74
+ esac
75
+ done
76
+
77
+ set fnord; shift # clear $@
78
+ echo "autotools-ver=$autotools_ver" >> $GITHUB_OUTPUT
79
+ exit 0
@@ -0,0 +1,22 @@
1
+ #! /bin/sh
2
+
3
+ generate_secure_token() {
4
+ echo head --bytes 64 /dev/urandom | sha512sum --binary | cut --fields 1 --delimiter ' '
5
+ }
6
+
7
+ dump_log () {
8
+ if [ -s "$1" ]; then
9
+ stop_command_token="$(generate_secure_token)"
10
+ echo "::group::$1"
11
+ echo "::stop-commands::$stop_command_token"
12
+ cat "$1"
13
+ echo "::$stop_command_token::"
14
+ echo '::endgroup::'
15
+ unset stop_command_token
16
+ fi
17
+ }
18
+
19
+ dump_log config.log
20
+ find . -name 'test-suite*.log' -printf '%P\n' | while read -r ts; do
21
+ dump_log "$ts"
22
+ done
@@ -0,0 +1,2 @@
1
+ #! /bin/sh
2
+ exec llvm-cov gcov "$@"
@@ -0,0 +1,10 @@
1
+ #!/bin/bash
2
+
3
+ export DEB_BUILD_MAINT_OPTIONS="${DEB_BUILD_MAINT_OPTIONS:-hardening=+all optimize=-lto}"
4
+
5
+ export CPPFLAGS="${CPPFLAGS} $(dpkg-buildflags --get CPPFLAGS)"
6
+ export CFLAGS="${CFLAGS} $(dpkg-buildflags --get CFLAGS)"
7
+ export CXXFLAGS="${CXXFLAGS} $(dpkg-buildflags --get CXXFLAGS)"
8
+ export LDFLAGS="${LDFLAGS} $(dpkg-buildflags --get LDFLAGS)"
9
+
10
+ $PWD/configure "$@"
@@ -0,0 +1,24 @@
1
+ #! /bin/sh
2
+ set -e
3
+
4
+ case "$CC" in
5
+ (*clang*)
6
+ GCOV=$(pwd)/build-aux/ci/clang-gcov-wrapper ;;
7
+ (*)
8
+ GCOV=gcov ;;
9
+ esac
10
+
11
+ unpruned=$(mktemp --tmpdir all-coverage.XXXXXXXXXX.info)
12
+ trap 'rm -f "'"$unpruned"'"' 0
13
+
14
+ set -x
15
+ # Merge all of the gcov output into one overview file using lcov,
16
+ # then prune data for the tests themselves, and for system libraries.
17
+
18
+ lcov --gcov-tool "$GCOV" --rc branch_coverage=1 \
19
+ --directory . --output-file "$unpruned" \
20
+ --capture
21
+
22
+ lcov --gcov-tool "$GCOV" --rc branch_coverage=1 \
23
+ --directory . --output-file "$1" --ignore-errors unused \
24
+ --remove "$unpruned" '/usr/*' '*test*' '*gen-des-tables*'
@@ -0,0 +1,46 @@
1
+ # ============================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
3
+ # ============================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # For every FLAG1, FLAG2 it is checked whether the compiler works with the
12
+ # flag. If it does, the flag is added FLAGS-VARIABLE
13
+ #
14
+ # If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
15
+ # CFLAGS) is used. During the check the flag is always added to the
16
+ # current language's flags.
17
+ #
18
+ # If EXTRA-FLAGS is defined, it is added to the current language's default
19
+ # flags (e.g. CFLAGS) when the check is done. The check is thus made with
20
+ # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
21
+ # force the compiler to issue an error when a bad flag is given.
22
+ #
23
+ # INPUT gives an alternative input source to AC_COMPILE_IFELSE.
24
+ #
25
+ # NOTE: This macro depends on the AX_APPEND_FLAG and
26
+ # AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
27
+ # AX_APPEND_LINK_FLAGS.
28
+ #
29
+ # LICENSE
30
+ #
31
+ # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
32
+ #
33
+ # Copying and distribution of this file, with or without modification, are
34
+ # permitted in any medium without royalty provided the copyright notice
35
+ # and this notice are preserved. This file is offered as-is, without any
36
+ # warranty.
37
+
38
+ #serial 7
39
+
40
+ AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
41
+ [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
42
+ AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
43
+ for flag in $1; do
44
+ AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
45
+ done
46
+ ])dnl AX_APPEND_COMPILE_FLAGS
@@ -0,0 +1,50 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
12
+ # added in between.
13
+ #
14
+ # If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
15
+ # CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
16
+ # FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
17
+ # FLAG.
18
+ #
19
+ # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
20
+ #
21
+ # LICENSE
22
+ #
23
+ # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
24
+ # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
25
+ #
26
+ # Copying and distribution of this file, with or without modification, are
27
+ # permitted in any medium without royalty provided the copyright notice
28
+ # and this notice are preserved. This file is offered as-is, without any
29
+ # warranty.
30
+
31
+ #serial 8
32
+
33
+ AC_DEFUN([AX_APPEND_FLAG],
34
+ [dnl
35
+ AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
36
+ AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
37
+ AS_VAR_SET_IF(FLAGS,[
38
+ AS_CASE([" AS_VAR_GET(FLAGS) "],
39
+ [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
40
+ [
41
+ AS_VAR_APPEND(FLAGS,[" $1"])
42
+ AC_RUN_LOG([: FLAGS="$FLAGS"])
43
+ ])
44
+ ],
45
+ [
46
+ AS_VAR_SET(FLAGS,[$1])
47
+ AC_RUN_LOG([: FLAGS="$FLAGS"])
48
+ ])
49
+ AS_VAR_POPDEF([FLAGS])dnl
50
+ ])dnl AX_APPEND_FLAG
@@ -0,0 +1,53 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # Check whether the given FLAG works with the current language's compiler
12
+ # or gives an error. (Warnings, however, are ignored)
13
+ #
14
+ # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
15
+ # success/failure.
16
+ #
17
+ # If EXTRA-FLAGS is defined, it is added to the current language's default
18
+ # flags (e.g. CFLAGS) when the check is done. The check is thus made with
19
+ # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
20
+ # force the compiler to issue an error when a bad flag is given.
21
+ #
22
+ # INPUT gives an alternative input source to AC_COMPILE_IFELSE.
23
+ #
24
+ # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
25
+ # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
26
+ #
27
+ # LICENSE
28
+ #
29
+ # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
30
+ # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
31
+ #
32
+ # Copying and distribution of this file, with or without modification, are
33
+ # permitted in any medium without royalty provided the copyright notice
34
+ # and this notice are preserved. This file is offered as-is, without any
35
+ # warranty.
36
+
37
+ #serial 6
38
+
39
+ AC_DEFUN([AX_CHECK_COMPILE_FLAG],
40
+ [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
41
+ AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
42
+ AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
43
+ ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
44
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
45
+ AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
46
+ [AS_VAR_SET(CACHEVAR,[yes])],
47
+ [AS_VAR_SET(CACHEVAR,[no])])
48
+ _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
49
+ AS_VAR_IF(CACHEVAR,yes,
50
+ [m4_default([$2], :)],
51
+ [m4_default([$3], :)])
52
+ AS_VAR_POPDEF([CACHEVAR])dnl
53
+ ])dnl AX_CHECK_COMPILE_FLAGS
@@ -0,0 +1,142 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_check_vscript.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_CHECK_VSCRIPT
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # Check whether the linker supports version scripts. Version scripts are
12
+ # used when building shared libraries to bind symbols to version nodes
13
+ # (helping to detect incompatibilities) or to limit the visibility of
14
+ # non-public symbols.
15
+ #
16
+ # Output:
17
+ #
18
+ # If version scripts are supported, VSCRIPT_LDFLAGS will contain the
19
+ # appropriate flag to pass to the linker. On GNU systems this would
20
+ # typically be "-Wl,--version-script", and on Solaris it would typically
21
+ # be "-Wl,-M".
22
+ #
23
+ # Two Automake conditionals are also set:
24
+ #
25
+ # HAVE_VSCRIPT is true if the linker supports version scripts with
26
+ # entries that use simple wildcards, like "local: *".
27
+ #
28
+ # HAVE_VSCRIPT_COMPLEX is true if the linker supports version scripts with
29
+ # pattern matching wildcards, like "global: Java_*".
30
+ #
31
+ # On systems that do not support symbol versioning, such as Mac OS X, both
32
+ # conditionals will be false. They will also be false if the user passes
33
+ # "--disable-symvers" on the configure command line.
34
+ #
35
+ # Example:
36
+ #
37
+ # configure.ac:
38
+ #
39
+ # AX_CHECK_VSCRIPT
40
+ #
41
+ # Makefile.am:
42
+ #
43
+ # if HAVE_VSCRIPT
44
+ # libfoo_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libfoo.map
45
+ # endif
46
+ #
47
+ # if HAVE_VSCRIPT_COMPLEX
48
+ # libbar_la_LDFLAGS += $(VSCRIPT_LDFLAGS),@srcdir@/libbar.map
49
+ # endif
50
+ #
51
+ # LICENSE
52
+ #
53
+ # Copyright (c) 2014 Kevin Cernekee <cernekee@gmail.com>
54
+ #
55
+ # Copying and distribution of this file, with or without modification, are
56
+ # permitted in any medium without royalty provided the copyright notice
57
+ # and this notice are preserved. This file is offered as-is, without any
58
+ # warranty.
59
+
60
+ #serial 2
61
+
62
+ # _AX_CHECK_VSCRIPT(flag, global-sym, action-if-link-succeeds, [junk-file=no])
63
+ AC_DEFUN([_AX_CHECK_VSCRIPT], [
64
+ AC_LANG_PUSH([C])
65
+ ax_check_vscript_save_flags="$LDFLAGS"
66
+ echo "V1 { global: $2; local: *; };" > conftest.map
67
+ AS_IF([test x$4 = xyes], [
68
+ echo "{" >> conftest.map
69
+ ])
70
+ LDFLAGS="$LDFLAGS -Wl,$1,conftest.map"
71
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[int show, hide;]], [])], [$3])
72
+ LDFLAGS="$ax_check_vscript_save_flags"
73
+ rm -f conftest.map
74
+ AC_LANG_POP([C])
75
+ ]) dnl _AX_CHECK_VSCRIPT
76
+
77
+ AC_DEFUN([AX_CHECK_VSCRIPT], [
78
+
79
+ AC_ARG_ENABLE([symvers],
80
+ AS_HELP_STRING([--disable-symvers],
81
+ [disable library symbol versioning [default=auto]]),
82
+ [want_symvers=$enableval],
83
+ [want_symvers=yes]
84
+ )
85
+
86
+ AS_IF([test x$want_symvers = xyes], [
87
+
88
+ dnl First test --version-script and -M with a simple wildcard.
89
+
90
+ AC_CACHE_CHECK([linker version script flag], ax_cv_check_vscript_flag, [
91
+ ax_cv_check_vscript_flag=unsupported
92
+ _AX_CHECK_VSCRIPT([--version-script], [show], [
93
+ ax_cv_check_vscript_flag=--version-script
94
+ ])
95
+ AS_IF([test x$ax_cv_check_vscript_flag = xunsupported], [
96
+ _AX_CHECK_VSCRIPT([-M], [show], [ax_cv_check_vscript_flag=-M])
97
+ ])
98
+
99
+ dnl The linker may interpret -M (no argument) as "produce a load map."
100
+ dnl If "-M conftest.map" doesn't fail when conftest.map contains
101
+ dnl obvious syntax errors, assume this is the case.
102
+
103
+ AS_IF([test x$ax_cv_check_vscript_flag != xunsupported], [
104
+ _AX_CHECK_VSCRIPT([$ax_cv_check_vscript_flag], [show],
105
+ [ax_cv_check_vscript_flag=unsupported], [yes])
106
+ ])
107
+ ])
108
+
109
+ dnl If the simple wildcard worked, retest with a complex wildcard.
110
+
111
+ AS_IF([test x$ax_cv_check_vscript_flag != xunsupported], [
112
+ ax_check_vscript_flag=$ax_cv_check_vscript_flag
113
+ AC_CACHE_CHECK([if version scripts can use complex wildcards],
114
+ ax_cv_check_vscript_complex_wildcards, [
115
+ ax_cv_check_vscript_complex_wildcards=no
116
+ _AX_CHECK_VSCRIPT([$ax_cv_check_vscript_flag], [sh*], [
117
+ ax_cv_check_vscript_complex_wildcards=yes])
118
+ ])
119
+ ax_check_vscript_complex_wildcards="$ax_cv_check_vscript_complex_wildcards"
120
+ ], [
121
+ ax_check_vscript_flag=
122
+ ax_check_vscript_complex_wildcards=no
123
+ ])
124
+ ], [
125
+ AC_MSG_CHECKING([linker version script flag])
126
+ AC_MSG_RESULT([disabled])
127
+
128
+ ax_check_vscript_flag=
129
+ ax_check_vscript_complex_wildcards=no
130
+ ])
131
+
132
+ AS_IF([test x$ax_check_vscript_flag != x], [
133
+ VSCRIPT_LDFLAGS="-Wl,$ax_check_vscript_flag"
134
+ AC_SUBST([VSCRIPT_LDFLAGS])
135
+ ])
136
+
137
+ AM_CONDITIONAL([HAVE_VSCRIPT],
138
+ [test x$ax_check_vscript_flag != x])
139
+ AM_CONDITIONAL([HAVE_VSCRIPT_COMPLEX],
140
+ [test x$ax_check_vscript_complex_wildcards = xyes])
141
+
142
+ ]) dnl AX_CHECK_VSCRIPT
@@ -0,0 +1,246 @@
1
+ # ===========================================================================
2
+ # https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
3
+ # ===========================================================================
4
+ #
5
+ # SYNOPSIS
6
+ #
7
+ # AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
8
+ #
9
+ # DESCRIPTION
10
+ #
11
+ # This macro checks if the compiler supports one of GCC's function
12
+ # attributes; many other compilers also provide function attributes with
13
+ # the same syntax. Compiler warnings are used to detect supported
14
+ # attributes as unsupported ones are ignored by default so quieting
15
+ # warnings when using this macro will yield false positives.
16
+ #
17
+ # The ATTRIBUTE parameter holds the name of the attribute to be checked.
18
+ #
19
+ # If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
20
+ #
21
+ # The macro caches its result in the ax_cv_have_func_attribute_<attribute>
22
+ # variable.
23
+ #
24
+ # The macro currently supports the following function attributes:
25
+ #
26
+ # alias
27
+ # aligned
28
+ # alloc_size
29
+ # always_inline
30
+ # artificial
31
+ # cold
32
+ # const
33
+ # constructor
34
+ # constructor_priority for constructor attribute with priority
35
+ # deprecated
36
+ # destructor
37
+ # dllexport
38
+ # dllimport
39
+ # error
40
+ # externally_visible
41
+ # fallthrough
42
+ # flatten
43
+ # format
44
+ # format_arg
45
+ # gnu_format
46
+ # gnu_inline
47
+ # hot
48
+ # ifunc
49
+ # leaf
50
+ # malloc
51
+ # noclone
52
+ # noinline
53
+ # nonnull
54
+ # noreturn
55
+ # nothrow
56
+ # optimize
57
+ # pure
58
+ # sentinel
59
+ # sentinel_position
60
+ # unused
61
+ # used
62
+ # visibility
63
+ # warning
64
+ # warn_unused_result
65
+ # weak
66
+ # weakref
67
+ # symver
68
+ #
69
+ # Unsupported function attributes will be tested with a prototype
70
+ # returning an int and not accepting any arguments and the result of the
71
+ # check might be wrong or meaningless so use with care.
72
+ #
73
+ # LICENSE
74
+ #
75
+ # Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
76
+ #
77
+ # Copying and distribution of this file, with or without modification, are
78
+ # permitted in any medium without royalty provided the copyright notice
79
+ # and this notice are preserved. This file is offered as-is, without any
80
+ # warranty.
81
+
82
+ #serial 13
83
+
84
+ AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
85
+ AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
86
+
87
+ AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
88
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
89
+ m4_case([$1],
90
+ [alias], [
91
+ int foo( void ) { return 0; }
92
+ int bar( void ) __attribute__(($1("foo")));
93
+ ],
94
+ [aligned], [
95
+ int foo( void ) __attribute__(($1(32)));
96
+ ],
97
+ [alloc_size], [
98
+ void *foo(int a) __attribute__(($1(1)));
99
+ ],
100
+ [always_inline], [
101
+ inline __attribute__(($1)) int foo( void ) { return 0; }
102
+ ],
103
+ [artificial], [
104
+ inline __attribute__(($1)) int foo( void ) { return 0; }
105
+ ],
106
+ [cold], [
107
+ int foo( void ) __attribute__(($1));
108
+ ],
109
+ [const], [
110
+ int foo( void ) __attribute__(($1));
111
+ ],
112
+ [constructor_priority], [
113
+ int foo( void ) __attribute__((__constructor__(65535/2)));
114
+ ],
115
+ [constructor], [
116
+ int foo( void ) __attribute__(($1));
117
+ ],
118
+ [deprecated], [
119
+ int foo( void ) __attribute__(($1("")));
120
+ ],
121
+ [destructor], [
122
+ int foo( void ) __attribute__(($1));
123
+ ],
124
+ [dllexport], [
125
+ __attribute__(($1)) int foo( void ) { return 0; }
126
+ ],
127
+ [dllimport], [
128
+ int foo( void ) __attribute__(($1));
129
+ ],
130
+ [error], [
131
+ int foo( void ) __attribute__(($1("")));
132
+ ],
133
+ [externally_visible], [
134
+ int foo( void ) __attribute__(($1));
135
+ ],
136
+ [fallthrough], [
137
+ void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }};
138
+ ],
139
+ [flatten], [
140
+ int foo( void ) __attribute__(($1));
141
+ ],
142
+ [format], [
143
+ int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
144
+ ],
145
+ [gnu_format], [
146
+ int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2)));
147
+ ],
148
+ [format_arg], [
149
+ char *foo(const char *p) __attribute__(($1(1)));
150
+ ],
151
+ [gnu_inline], [
152
+ inline __attribute__(($1)) int foo( void ) { return 0; }
153
+ ],
154
+ [hot], [
155
+ int foo( void ) __attribute__(($1));
156
+ ],
157
+ [ifunc], [
158
+ int my_foo( void ) { return 0; }
159
+ static int (*resolve_foo(void))(void) { return my_foo; }
160
+ int foo( void ) __attribute__(($1("resolve_foo")));
161
+ ],
162
+ [leaf], [
163
+ __attribute__(($1)) int foo( void ) { return 0; }
164
+ ],
165
+ [malloc], [
166
+ void *foo( void ) __attribute__(($1));
167
+ ],
168
+ [noclone], [
169
+ int foo( void ) __attribute__(($1));
170
+ ],
171
+ [noinline], [
172
+ __attribute__(($1)) int foo( void ) { return 0; }
173
+ ],
174
+ [nonnull], [
175
+ int foo(char *p) __attribute__(($1(1)));
176
+ ],
177
+ [noreturn], [
178
+ void foo( void ) __attribute__(($1));
179
+ ],
180
+ [nothrow], [
181
+ int foo( void ) __attribute__(($1));
182
+ ],
183
+ [optimize], [
184
+ __attribute__(($1(3))) int foo( void ) { return 0; }
185
+ ],
186
+ [pure], [
187
+ int foo( void ) __attribute__(($1));
188
+ ],
189
+ [sentinel], [
190
+ int foo(void *p, ...) __attribute__(($1));
191
+ ],
192
+ [sentinel_position], [
193
+ int foo(void *p, ...) __attribute__(($1(1)));
194
+ ],
195
+ [returns_nonnull], [
196
+ void *foo( void ) __attribute__(($1));
197
+ ],
198
+ [unused], [
199
+ int foo( void ) __attribute__(($1));
200
+ ],
201
+ [used], [
202
+ int foo( void ) __attribute__(($1));
203
+ ],
204
+ [visibility], [
205
+ int foo_def( void ) __attribute__(($1("default")));
206
+ int foo_hid( void ) __attribute__(($1("hidden")));
207
+ int foo_int( void ) __attribute__(($1("internal")));
208
+ int foo_pro( void ) __attribute__(($1("protected")));
209
+ ],
210
+ [warning], [
211
+ int foo( void ) __attribute__(($1("")));
212
+ ],
213
+ [warn_unused_result], [
214
+ int foo( void ) __attribute__(($1));
215
+ ],
216
+ [weak], [
217
+ int foo( void ) __attribute__(($1));
218
+ ],
219
+ [weakref], [
220
+ static int foo( void ) { return 0; }
221
+ static int bar( void ) __attribute__(($1("foo")));
222
+ ],
223
+ [symver], [
224
+ __attribute__(($1("foo@2.0"))) void bar( void ) {}
225
+ ],
226
+ [
227
+ m4_warn([syntax], [Unsupported attribute $1, the test may fail])
228
+ int foo( void ) __attribute__(($1));
229
+ ]
230
+ )], [])
231
+ ],
232
+ dnl GCC doesn't exit with an error if an unknown attribute is
233
+ dnl provided but only outputs a warning, so accept the attribute
234
+ dnl only if no warning were issued.
235
+ [AS_IF([grep -q -e -Wattributes -e -Wunknown-attributes -e error -e warning conftest.err],
236
+ [AS_VAR_SET([ac_var], [no])],
237
+ [AS_VAR_SET([ac_var], [yes])])],
238
+ [AS_VAR_SET([ac_var], [no])])
239
+ ])
240
+
241
+ AS_IF([test yes = AS_VAR_GET([ac_var])],
242
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
243
+ [Define to 1 if the system has the `$1' function attribute])], [])
244
+
245
+ AS_VAR_POPDEF([ac_var])
246
+ ])