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,364 @@
1
+ #! /bin/sh
2
+ # Wrapper for compilers which do not understand '-c -o'.
3
+
4
+ scriptversion=2025-02-03.05; # UTC
5
+
6
+ # Copyright (C) 1999-2025 Free Software Foundation, Inc.
7
+ # Written by Tom Tromey <tromey@cygnus.com>.
8
+ #
9
+ # This program is free software; you can redistribute it and/or modify
10
+ # it under the terms of the GNU General Public License as published by
11
+ # the Free Software Foundation; either version 2, or (at your option)
12
+ # any later version.
13
+ #
14
+ # This program is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ # GNU General Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License
20
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
21
+
22
+ # As a special exception to the GNU General Public License, if you
23
+ # distribute this file as part of a program that contains a
24
+ # configuration script generated by Autoconf, you may include it under
25
+ # the same distribution terms that you use for the rest of that program.
26
+
27
+ # This file is maintained in Automake, please report
28
+ # bugs to <bug-automake@gnu.org> or send patches to
29
+ # <automake-patches@gnu.org>.
30
+
31
+ nl='
32
+ '
33
+
34
+ # We need space, tab and new line, in precisely that order. Quoting is
35
+ # there to prevent tools from complaining about whitespace usage.
36
+ IFS=" "" $nl"
37
+
38
+ file_conv=
39
+
40
+ # func_file_conv build_file unneeded_conversions
41
+ # Convert a $build file to $host form and store it in $file
42
+ # Currently only supports Windows hosts. If the determined conversion
43
+ # type is listed in (the comma separated) UNNEEDED_CONVERSIONS, no
44
+ # conversion will take place.
45
+ func_file_conv ()
46
+ {
47
+ file=$1
48
+ case $file in
49
+ / | /[!/]*) # absolute file, and not a UNC file
50
+ if test -z "$file_conv"; then
51
+ # lazily determine how to convert abs files
52
+ case `uname -s` in
53
+ MINGW*)
54
+ if test -n "$MSYSTEM" && (cygpath --version) >/dev/null 2>&1; then
55
+ # MSYS2 environment.
56
+ file_conv=cygwin
57
+ else
58
+ # Original MinGW environment.
59
+ file_conv=mingw
60
+ fi
61
+ ;;
62
+ MSYS*)
63
+ # Old MSYS environment, or MSYS2 with 32-bit MSYS2 shell.
64
+ file_conv=cygwin
65
+ ;;
66
+ CYGWIN*)
67
+ # Cygwin environment.
68
+ file_conv=cygwin
69
+ ;;
70
+ *)
71
+ file_conv=wine
72
+ ;;
73
+ esac
74
+ fi
75
+ case $file_conv/,$2, in
76
+ *,$file_conv,*)
77
+ # This is the optimization mentioned above:
78
+ # If UNNEEDED_CONVERSIONS contains $file_conv, don't convert.
79
+ ;;
80
+ mingw/*)
81
+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
82
+ ;;
83
+ cygwin/*)
84
+ file=`cygpath -w "$file" || echo "$file"`
85
+ ;;
86
+ wine/*)
87
+ file=`winepath -w "$file" || echo "$file"`
88
+ ;;
89
+ esac
90
+ ;;
91
+ esac
92
+ }
93
+
94
+ # func_cl_dashL linkdir
95
+ # Make cl look for libraries in LINKDIR
96
+ func_cl_dashL ()
97
+ {
98
+ func_file_conv "$1"
99
+ if test -z "$lib_path"; then
100
+ lib_path=$file
101
+ else
102
+ lib_path="$lib_path;$file"
103
+ fi
104
+ linker_opts="$linker_opts -LIBPATH:$file"
105
+ }
106
+
107
+ # func_cl_dashl library
108
+ # Do a library search-path lookup for cl
109
+ func_cl_dashl ()
110
+ {
111
+ lib=$1
112
+ found=no
113
+ save_IFS=$IFS
114
+ IFS=';'
115
+ for dir in $lib_path $LIB
116
+ do
117
+ IFS=$save_IFS
118
+ if $shared && test -f "$dir/$lib.dll.lib"; then
119
+ found=yes
120
+ lib=$dir/$lib.dll.lib
121
+ break
122
+ fi
123
+ if test -f "$dir/$lib.lib"; then
124
+ found=yes
125
+ lib=$dir/$lib.lib
126
+ break
127
+ fi
128
+ if test -f "$dir/lib$lib.a"; then
129
+ found=yes
130
+ lib=$dir/lib$lib.a
131
+ break
132
+ fi
133
+ done
134
+ IFS=$save_IFS
135
+
136
+ if test "$found" != yes; then
137
+ lib=$lib.lib
138
+ fi
139
+ }
140
+
141
+ # func_cl_wrapper cl arg...
142
+ # Adjust compile command to suit cl
143
+ func_cl_wrapper ()
144
+ {
145
+ # Assume a capable shell
146
+ lib_path=
147
+ shared=:
148
+ linker_opts=
149
+ for arg
150
+ do
151
+ if test -n "$eat"; then
152
+ eat=
153
+ else
154
+ case $1 in
155
+ -o)
156
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
157
+ eat=1
158
+ case $2 in
159
+ *.o | *.lo | *.[oO][bB][jJ])
160
+ func_file_conv "$2"
161
+ set x "$@" -Fo"$file"
162
+ shift
163
+ ;;
164
+ *)
165
+ func_file_conv "$2"
166
+ set x "$@" -Fe"$file"
167
+ shift
168
+ ;;
169
+ esac
170
+ ;;
171
+ -I)
172
+ eat=1
173
+ func_file_conv "$2" mingw
174
+ set x "$@" -I"$file"
175
+ shift
176
+ ;;
177
+ -I*)
178
+ func_file_conv "${1#-I}" mingw
179
+ set x "$@" -I"$file"
180
+ shift
181
+ ;;
182
+ -l)
183
+ eat=1
184
+ func_cl_dashl "$2"
185
+ set x "$@" "$lib"
186
+ shift
187
+ ;;
188
+ -l*)
189
+ func_cl_dashl "${1#-l}"
190
+ set x "$@" "$lib"
191
+ shift
192
+ ;;
193
+ -L)
194
+ eat=1
195
+ func_cl_dashL "$2"
196
+ ;;
197
+ -L*)
198
+ func_cl_dashL "${1#-L}"
199
+ ;;
200
+ -static)
201
+ shared=false
202
+ ;;
203
+ -Wl,*)
204
+ arg=${1#-Wl,}
205
+ save_ifs="$IFS"; IFS=','
206
+ for flag in $arg; do
207
+ IFS="$save_ifs"
208
+ linker_opts="$linker_opts $flag"
209
+ done
210
+ IFS="$save_ifs"
211
+ ;;
212
+ -Xlinker)
213
+ eat=1
214
+ linker_opts="$linker_opts $2"
215
+ ;;
216
+ -*)
217
+ set x "$@" "$1"
218
+ shift
219
+ ;;
220
+ *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
221
+ func_file_conv "$1"
222
+ set x "$@" -Tp"$file"
223
+ shift
224
+ ;;
225
+ *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
226
+ func_file_conv "$1" mingw
227
+ set x "$@" "$file"
228
+ shift
229
+ ;;
230
+ *)
231
+ set x "$@" "$1"
232
+ shift
233
+ ;;
234
+ esac
235
+ fi
236
+ shift
237
+ done
238
+ if test -n "$linker_opts"; then
239
+ linker_opts="-link$linker_opts"
240
+ fi
241
+ exec "$@" $linker_opts
242
+ exit 1
243
+ }
244
+
245
+ eat=
246
+
247
+ case $1 in
248
+ '')
249
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
250
+ exit 1;
251
+ ;;
252
+ -h | --h*)
253
+ cat <<\EOF
254
+ Usage: compile [--help] [--version] PROGRAM [ARGS]
255
+
256
+ Wrapper for compilers which do not understand '-c -o'.
257
+ Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
258
+ arguments, and rename the output as expected.
259
+
260
+ If you are trying to build a whole package this is not the
261
+ right script to run: please start by reading the file 'INSTALL'.
262
+
263
+ Report bugs to <bug-automake@gnu.org>.
264
+ GNU Automake home page: <https://www.gnu.org/software/automake/>.
265
+ General help using GNU software: <https://www.gnu.org/gethelp/>.
266
+ EOF
267
+ exit $?
268
+ ;;
269
+ -v | --v*)
270
+ echo "compile (GNU Automake) $scriptversion"
271
+ exit $?
272
+ ;;
273
+ cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
274
+ clang-cl | *[/\\]clang-cl | clang-cl.exe | *[/\\]clang-cl.exe | \
275
+ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
276
+ func_cl_wrapper "$@" # Doesn't return...
277
+ ;;
278
+ esac
279
+
280
+ ofile=
281
+ cfile=
282
+
283
+ for arg
284
+ do
285
+ if test -n "$eat"; then
286
+ eat=
287
+ else
288
+ case $1 in
289
+ -o)
290
+ # configure might choose to run compile as 'compile cc -o foo foo.c'.
291
+ # So we strip '-o arg' only if arg is an object.
292
+ eat=1
293
+ case $2 in
294
+ *.o | *.obj)
295
+ ofile=$2
296
+ ;;
297
+ *)
298
+ set x "$@" -o "$2"
299
+ shift
300
+ ;;
301
+ esac
302
+ ;;
303
+ *.c)
304
+ cfile=$1
305
+ set x "$@" "$1"
306
+ shift
307
+ ;;
308
+ *)
309
+ set x "$@" "$1"
310
+ shift
311
+ ;;
312
+ esac
313
+ fi
314
+ shift
315
+ done
316
+
317
+ if test -z "$ofile" || test -z "$cfile"; then
318
+ # If no '-o' option was seen then we might have been invoked from a
319
+ # pattern rule where we don't need one. That is ok -- this is a
320
+ # normal compilation that the losing compiler can handle. If no
321
+ # '.c' file was seen then we are probably linking. That is also
322
+ # ok.
323
+ exec "$@"
324
+ fi
325
+
326
+ # Name of file we expect compiler to create.
327
+ cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
328
+
329
+ # Create the lock directory.
330
+ # Note: use '[/\\:.-]' here to ensure that we don't use the same name
331
+ # that we are using for the .o file. Also, base the name on the expected
332
+ # object file name, since that is what matters with a parallel build.
333
+ lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
334
+ while true; do
335
+ if mkdir "$lockdir" >/dev/null 2>&1; then
336
+ break
337
+ fi
338
+ sleep 1
339
+ done
340
+ # FIXME: race condition here if user kills between mkdir and trap.
341
+ trap "rmdir '$lockdir'; exit 1" 1 2 15
342
+
343
+ # Run the compile.
344
+ "$@"
345
+ ret=$?
346
+
347
+ if test -f "$cofile"; then
348
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
349
+ elif test -f "${cofile}bj"; then
350
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
351
+ fi
352
+
353
+ rmdir "$lockdir"
354
+ exit $ret
355
+
356
+ # Local Variables:
357
+ # mode: shell-script
358
+ # sh-indentation: 2
359
+ # eval: (add-hook 'before-save-hook 'time-stamp nil t)
360
+ # time-stamp-start: "scriptversion="
361
+ # time-stamp-format: "%:y-%02m-%02d.%02H"
362
+ # time-stamp-time-zone: "UTC0"
363
+ # time-stamp-end: "; # UTC"
364
+ # End: