ffi 1.15.5 → 1.16.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +76 -0
  4. data/Gemfile +1 -1
  5. data/README.md +3 -2
  6. data/Rakefile +10 -7
  7. data/ext/ffi_c/AbstractMemory.c +60 -36
  8. data/ext/ffi_c/AbstractMemory.h +3 -2
  9. data/ext/ffi_c/ArrayType.c +49 -13
  10. data/ext/ffi_c/ArrayType.h +1 -0
  11. data/ext/ffi_c/Buffer.c +86 -29
  12. data/ext/ffi_c/Call.c +17 -6
  13. data/ext/ffi_c/DynamicLibrary.c +89 -26
  14. data/ext/ffi_c/Function.c +244 -98
  15. data/ext/ffi_c/Function.h +1 -0
  16. data/ext/ffi_c/FunctionInfo.c +80 -24
  17. data/ext/ffi_c/LastError.c +25 -7
  18. data/ext/ffi_c/MappedType.c +66 -23
  19. data/ext/ffi_c/MappedType.h +0 -2
  20. data/ext/ffi_c/MemoryPointer.c +34 -7
  21. data/ext/ffi_c/MethodHandle.c +3 -1
  22. data/ext/ffi_c/Pointer.c +68 -29
  23. data/ext/ffi_c/Pointer.h +1 -0
  24. data/ext/ffi_c/Struct.c +155 -80
  25. data/ext/ffi_c/Struct.h +7 -4
  26. data/ext/ffi_c/StructByValue.c +48 -16
  27. data/ext/ffi_c/StructLayout.c +117 -48
  28. data/ext/ffi_c/Type.c +104 -36
  29. data/ext/ffi_c/Type.h +3 -1
  30. data/ext/ffi_c/Types.c +1 -1
  31. data/ext/ffi_c/Variadic.c +65 -23
  32. data/ext/ffi_c/compat.h +22 -22
  33. data/ext/ffi_c/extconf.rb +19 -2
  34. data/ext/ffi_c/ffi.c +4 -0
  35. data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
  36. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
  37. data/ext/ffi_c/libffi/.appveyor.yml +27 -9
  38. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
  39. data/ext/ffi_c/libffi/{.travis → .ci}/build-in-container.sh +4 -6
  40. data/ext/ffi_c/libffi/.ci/build.sh +124 -0
  41. data/ext/ffi_c/libffi/{.travis → .ci}/install.sh +14 -7
  42. data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
  43. data/ext/ffi_c/libffi/{.travis → .ci}/site.exp +5 -3
  44. data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
  45. data/ext/ffi_c/libffi/.github/workflows/build.yml +460 -0
  46. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +171 -0
  47. data/ext/ffi_c/libffi/.gitignore +10 -2
  48. data/ext/ffi_c/libffi/LICENSE +1 -1
  49. data/ext/ffi_c/libffi/Makefile.am +12 -5
  50. data/ext/ffi_c/libffi/Makefile.in +118 -51
  51. data/ext/ffi_c/libffi/README.md +144 -104
  52. data/ext/ffi_c/libffi/acinclude.m4 +10 -112
  53. data/ext/ffi_c/libffi/compile +348 -0
  54. data/ext/ffi_c/libffi/config.guess +623 -556
  55. data/ext/ffi_c/libffi/config.sub +75 -34
  56. data/ext/ffi_c/libffi/configure +4571 -3830
  57. data/ext/ffi_c/libffi/configure.ac +64 -28
  58. data/ext/ffi_c/libffi/configure.host +25 -6
  59. data/ext/ffi_c/libffi/doc/Makefile.in +9 -6
  60. data/ext/ffi_c/libffi/doc/libffi.texi +82 -33
  61. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  62. data/ext/ffi_c/libffi/fficonfig.h.in +12 -47
  63. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +163 -52
  64. data/ext/ffi_c/libffi/include/Makefile.am +1 -1
  65. data/ext/ffi_c/libffi/include/Makefile.in +10 -9
  66. data/ext/ffi_c/libffi/include/ffi.h.in +54 -50
  67. data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
  68. data/ext/ffi_c/libffi/include/ffi_common.h +29 -0
  69. data/ext/ffi_c/libffi/include/tramp.h +45 -0
  70. data/ext/ffi_c/libffi/install-sh +92 -69
  71. data/ext/ffi_c/libffi/libtool-version +2 -2
  72. data/ext/ffi_c/libffi/ltmain.sh +512 -315
  73. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
  74. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
  75. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -45
  76. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
  77. data/ext/ffi_c/libffi/man/Makefile.in +9 -6
  78. data/ext/ffi_c/libffi/missing +1 -1
  79. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +1 -1
  80. data/ext/ffi_c/libffi/msvcc.sh +1 -1
  81. data/ext/ffi_c/libffi/src/aarch64/ffi.c +146 -42
  82. data/ext/ffi_c/libffi/src/aarch64/internal.h +32 -0
  83. data/ext/ffi_c/libffi/src/aarch64/sysv.S +134 -42
  84. data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
  85. data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
  86. data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
  87. data/ext/ffi_c/libffi/src/arm/ffi.c +62 -17
  88. data/ext/ffi_c/libffi/src/arm/ffitarget.h +3 -3
  89. data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
  90. data/ext/ffi_c/libffi/src/arm/sysv.S +113 -42
  91. data/ext/ffi_c/libffi/src/closures.c +133 -47
  92. data/ext/ffi_c/libffi/src/dlmalloc.c +5 -0
  93. data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
  94. data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
  95. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +621 -0
  96. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
  97. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
  98. data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
  99. data/ext/ffi_c/libffi/src/mips/ffi.c +240 -65
  100. data/ext/ffi_c/libffi/src/mips/ffitarget.h +7 -0
  101. data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
  102. data/ext/ffi_c/libffi/src/mips/o32.S +61 -4
  103. data/ext/ffi_c/libffi/src/moxie/ffi.c +47 -22
  104. data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
  105. data/ext/ffi_c/libffi/src/pa/ffi.c +32 -33
  106. data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
  107. data/ext/ffi_c/libffi/src/pa/ffitarget.h +22 -8
  108. data/ext/ffi_c/libffi/src/pa/hpux32.S +83 -36
  109. data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
  110. data/ext/ffi_c/libffi/src/pa/linux.S +82 -35
  111. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +1 -1
  112. data/ext/ffi_c/libffi/src/powerpc/linux64.S +2 -0
  113. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +2 -0
  114. data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
  115. data/ext/ffi_c/libffi/src/prep_cif.c +22 -2
  116. data/ext/ffi_c/libffi/src/riscv/ffi.c +37 -4
  117. data/ext/ffi_c/libffi/src/sparc/ffi64.c +16 -0
  118. data/ext/ffi_c/libffi/src/tramp.c +716 -0
  119. data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
  120. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
  121. data/ext/ffi_c/libffi/src/x86/ffi.c +99 -37
  122. data/ext/ffi_c/libffi/src/x86/ffi64.c +67 -12
  123. data/ext/ffi_c/libffi/src/x86/ffitarget.h +9 -5
  124. data/ext/ffi_c/libffi/src/x86/ffiw64.c +43 -0
  125. data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
  126. data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
  127. data/ext/ffi_c/libffi/src/x86/sysv.S +172 -38
  128. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +91 -88
  129. data/ext/ffi_c/libffi/src/x86/unix64.S +96 -6
  130. data/ext/ffi_c/libffi/src/x86/win64.S +20 -7
  131. data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
  132. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
  133. data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
  134. data/ext/ffi_c/libffi/testsuite/Makefile.am +127 -114
  135. data/ext/ffi_c/libffi/testsuite/Makefile.in +137 -121
  136. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
  137. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
  138. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +80 -0
  139. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
  140. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
  141. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
  142. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +43 -21
  143. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
  144. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +1 -0
  145. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
  146. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
  147. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
  148. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
  149. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
  150. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
  151. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
  152. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
  153. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
  154. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
  155. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
  156. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
  157. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
  158. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
  159. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
  160. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
  161. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
  162. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
  163. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
  164. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
  165. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
  166. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
  167. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
  168. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
  169. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
  170. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
  171. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
  172. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
  173. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn0.c +3 -2
  174. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn1.c +2 -0
  175. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn2.c +2 -0
  176. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn3.c +21 -1
  177. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn4.c +2 -0
  178. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn5.c +2 -0
  179. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_fn6.c +2 -0
  180. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_loc_fn0.c +7 -6
  181. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure_simple.c +6 -0
  182. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_12byte.c +18 -0
  183. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_16byte.c +22 -0
  184. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_18byte.c +24 -0
  185. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_19byte.c +29 -0
  186. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_1_1byte.c +4 -0
  187. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte.c +19 -1
  188. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_20byte1.c +21 -1
  189. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_24byte.c +35 -3
  190. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_2byte.c +13 -0
  191. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3_1byte.c +19 -0
  192. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte1.c +13 -0
  193. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3byte2.c +13 -0
  194. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_3float.c +18 -0
  195. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4_1byte.c +22 -0
  196. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_4byte.c +13 -0
  197. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5_1_byte.c +29 -1
  198. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_5byte.c +19 -1
  199. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_64byte.c +24 -0
  200. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6_1_byte.c +28 -1
  201. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_6byte.c +24 -2
  202. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7_1_byte.c +39 -1
  203. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_7byte.c +25 -1
  204. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_8byte.c +14 -0
  205. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte1.c +14 -1
  206. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_9byte2.c +14 -2
  207. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_double.c +19 -1
  208. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_float.c +19 -1
  209. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble.c +20 -1
  210. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split.c +40 -25
  211. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_longdouble_split2.c +40 -3
  212. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_pointer.c +19 -1
  213. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint16.c +18 -1
  214. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint32.c +18 -3
  215. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_sint64.c +18 -1
  216. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint16.c +18 -1
  217. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint32.c +19 -1
  218. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_align_uint64.c +19 -1
  219. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_dbls_struct.c +3 -1
  220. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_double_va.c +9 -1
  221. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_float.c +4 -0
  222. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble.c +11 -1
  223. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_longdouble_va.c +22 -3
  224. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_schar.c +5 -1
  225. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshort.c +6 -1
  226. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_sshortchar.c +9 -1
  227. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_uchar.c +9 -1
  228. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushort.c +6 -2
  229. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_multi_ushortchar.c +9 -1
  230. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer.c +5 -0
  231. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_pointer_stack.c +10 -0
  232. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_schar.c +3 -0
  233. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sint.c +2 -0
  234. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_sshort.c +3 -0
  235. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_struct_va1.c +11 -0
  236. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar.c +3 -0
  237. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint.c +4 -0
  238. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uint_va.c +4 -0
  239. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulong_va.c +4 -0
  240. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ulonglong.c +2 -0
  241. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort.c +3 -0
  242. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -138
  243. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +21 -21
  244. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct.c +32 -9
  245. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct1.c +1 -1
  246. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct10.c +12 -0
  247. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct11.c +21 -5
  248. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
  249. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
  250. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct2.c +10 -1
  251. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct3.c +10 -1
  252. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct4.c +9 -0
  253. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct5.c +9 -0
  254. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct6.c +11 -0
  255. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct7.c +9 -0
  256. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct8.c +11 -0
  257. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct9.c +11 -0
  258. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
  259. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
  260. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
  261. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium.c +1 -1
  262. data/ext/ffi_c/libffi/testsuite/libffi.closures/stret_medium2.c +1 -1
  263. data/ext/ffi_c/libffi/testsuite/libffi.closures/testclosure.c +6 -1
  264. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest.cc +2 -1
  265. data/ext/ffi_c/libffi/testsuite/libffi.closures/unwindtest_ffi_call.cc +1 -0
  266. data/ext/ffi_c/libffi.bsd.mk +2 -2
  267. data/ext/ffi_c/libffi.gnu.mk +2 -2
  268. data/ext/ffi_c/rbffi.h +1 -1
  269. data/ffi.gemspec +3 -3
  270. data/lib/ffi/autopointer.rb +7 -22
  271. data/lib/ffi/compat.rb +43 -0
  272. data/lib/ffi/data_converter.rb +2 -2
  273. data/lib/ffi/dynamic_library.rb +89 -0
  274. data/lib/ffi/enum.rb +18 -11
  275. data/lib/ffi/ffi.rb +3 -0
  276. data/lib/ffi/function.rb +71 -0
  277. data/lib/ffi/library.rb +55 -71
  278. data/lib/ffi/library_path.rb +109 -0
  279. data/lib/ffi/managedstruct.rb +1 -1
  280. data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
  281. data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
  282. data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
  283. data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
  284. data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
  285. data/lib/ffi/platform.rb +15 -13
  286. data/lib/ffi/struct.rb +2 -1
  287. data/lib/ffi/struct_layout.rb +1 -1
  288. data/lib/ffi/struct_layout_builder.rb +1 -1
  289. data/lib/ffi/types.rb +32 -6
  290. data/lib/ffi/variadic.rb +19 -8
  291. data/lib/ffi/version.rb +1 -1
  292. data/samples/hello_ractor.rb +11 -0
  293. data/samples/qsort_ractor.rb +28 -0
  294. data.tar.gz.sig +0 -0
  295. metadata +100 -25
  296. metadata.gz.sig +0 -0
  297. data/ext/ffi_c/libffi/.travis/build-cross-in-container.sh +0 -14
  298. data/ext/ffi_c/libffi/.travis/build.sh +0 -142
  299. data/ext/ffi_c/libffi/.travis.yml +0 -83
  300. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_uchar_va.c +0 -44
  301. data/ext/ffi_c/libffi/testsuite/libffi.closures/cls_ushort_va.c +0 -44
  302. /data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
  303. /data/ext/ffi_c/libffi/{.travis → .ci}/bfin-sim.exp +0 -0
  304. /data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
  305. /data/ext/ffi_c/libffi/{.travis → .ci}/m32r-sim.exp +0 -0
  306. /data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +0 -0
  307. /data/ext/ffi_c/libffi/{.travis → .ci}/or1k-sim.exp +0 -0
  308. /data/ext/ffi_c/libffi/{.travis → .ci}/powerpc-eabisim.exp +0 -0
  309. /data/ext/ffi_c/libffi/{.travis → .ci}/wine-sim.exp +0 -0
  310. /data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
  311. /data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +0 -0
@@ -1,12 +1,12 @@
1
- #! /bin/sh
1
+ #! /usr/bin/env sh
2
2
  ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
3
- ## by inline-source v2014-01-03.01
3
+ ## by inline-source v2019-02-19.15
4
4
 
5
- # libtool (GNU libtool) 2.4.6
5
+ # libtool (GNU libtool) 2.4.7
6
6
  # Provide generalized library-building support services.
7
7
  # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
8
 
9
- # Copyright (C) 1996-2015 Free Software Foundation, Inc.
9
+ # Copyright (C) 1996-2019, 2021-2022 Free Software Foundation, Inc.
10
10
  # This is free software; see the source for copying conditions. There is NO
11
11
  # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
12
 
@@ -31,8 +31,8 @@
31
31
 
32
32
  PROGRAM=libtool
33
33
  PACKAGE=libtool
34
- VERSION="2.4.6 Debian-2.4.6-14"
35
- package_revision=2.4.6
34
+ VERSION="2.4.7 Debian-2.4.7-5"
35
+ package_revision=2.4.7
36
36
 
37
37
 
38
38
  ## ------ ##
@@ -64,34 +64,25 @@ package_revision=2.4.6
64
64
  # libraries, which are installed to $pkgauxdir.
65
65
 
66
66
  # Set a version string for this script.
67
- scriptversion=2015-01-20.17; # UTC
67
+ scriptversion=2019-02-19.15; # UTC
68
68
 
69
69
  # General shell script boiler plate, and helper functions.
70
70
  # Written by Gary V. Vaughan, 2004
71
71
 
72
- # Copyright (C) 2004-2015 Free Software Foundation, Inc.
73
- # This is free software; see the source for copying conditions. There is NO
74
- # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
75
-
76
- # This program is free software; you can redistribute it and/or modify
77
- # it under the terms of the GNU General Public License as published by
78
- # the Free Software Foundation; either version 3 of the License, or
79
- # (at your option) any later version.
80
-
81
- # As a special exception to the GNU General Public License, if you distribute
82
- # this file as part of a program or library that is built using GNU Libtool,
83
- # you may include this file under the same distribution terms that you use
84
- # for the rest of that program.
85
-
86
- # This program is distributed in the hope that it will be useful,
87
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
88
- # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
89
- # General Public License for more details.
90
-
91
- # You should have received a copy of the GNU General Public License
92
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
72
+ # This is free software. There is NO warranty; not even for
73
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
74
+ #
75
+ # Copyright (C) 2004-2019, 2021 Bootstrap Authors
76
+ #
77
+ # This file is dual licensed under the terms of the MIT license
78
+ # <https://opensource.org/license/MIT>, and GPL version 2 or later
79
+ # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
80
+ # these licenses when using or redistributing this software or any of
81
+ # the files within it. See the URLs above, or the file `LICENSE`
82
+ # included in the Bootstrap distribution for the full license texts.
93
83
 
94
- # Please report bugs or propose patches to gary@gnu.org.
84
+ # Please report bugs or propose patches to:
85
+ # <https://github.com/gnulib-modules/bootstrap/issues>
95
86
 
96
87
 
97
88
  ## ------ ##
@@ -139,9 +130,12 @@ do
139
130
  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
140
131
  fi"
141
132
  done
142
-
143
- # CDPATH.
144
- (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
133
+ # These NLS vars are set unconditionally (bootstrap issue #24). Unset those
134
+ # in case the environment reset is needed later and the $save_* variant is not
135
+ # defined (see the code above).
136
+ LC_ALL=C
137
+ LANGUAGE=C
138
+ export LANGUAGE LC_ALL
145
139
 
146
140
  # Make sure IFS has a sensible default
147
141
  sp=' '
@@ -159,6 +153,26 @@ if test "${PATH_SEPARATOR+set}" != set; then
159
153
  fi
160
154
 
161
155
 
156
+ # func_unset VAR
157
+ # --------------
158
+ # Portably unset VAR.
159
+ # In some shells, an 'unset VAR' statement leaves a non-zero return
160
+ # status if VAR is already unset, which might be problematic if the
161
+ # statement is used at the end of a function (thus poisoning its return
162
+ # value) or when 'set -e' is active (causing even a spurious abort of
163
+ # the script in this case).
164
+ func_unset ()
165
+ {
166
+ { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
167
+ }
168
+
169
+
170
+ # Make sure CDPATH doesn't cause `cd` commands to output the target dir.
171
+ func_unset CDPATH
172
+
173
+ # Make sure ${,E,F}GREP behave sanely.
174
+ func_unset GREP_OPTIONS
175
+
162
176
 
163
177
  ## ------------------------- ##
164
178
  ## Locate command utilities. ##
@@ -259,7 +273,7 @@ test -z "$SED" && {
259
273
  rm -f conftest.in conftest.tmp conftest.nl conftest.out
260
274
  }
261
275
 
262
- func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
276
+ func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
263
277
  rm -f conftest.sed
264
278
  SED=$func_path_progs_result
265
279
  }
@@ -295,7 +309,7 @@ test -z "$GREP" && {
295
309
  rm -f conftest.in conftest.tmp conftest.nl conftest.out
296
310
  }
297
311
 
298
- func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
312
+ func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
299
313
  GREP=$func_path_progs_result
300
314
  }
301
315
 
@@ -360,6 +374,35 @@ sed_double_backslash="\
360
374
  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
361
375
  s/\n//g"
362
376
 
377
+ # require_check_ifs_backslash
378
+ # ---------------------------
379
+ # Check if we can use backslash as IFS='\' separator, and set
380
+ # $check_ifs_backshlash_broken to ':' or 'false'.
381
+ require_check_ifs_backslash=func_require_check_ifs_backslash
382
+ func_require_check_ifs_backslash ()
383
+ {
384
+ _G_save_IFS=$IFS
385
+ IFS='\'
386
+ _G_check_ifs_backshlash='a\\b'
387
+ for _G_i in $_G_check_ifs_backshlash
388
+ do
389
+ case $_G_i in
390
+ a)
391
+ check_ifs_backshlash_broken=false
392
+ ;;
393
+ '')
394
+ break
395
+ ;;
396
+ *)
397
+ check_ifs_backshlash_broken=:
398
+ break
399
+ ;;
400
+ esac
401
+ done
402
+ IFS=$_G_save_IFS
403
+ require_check_ifs_backslash=:
404
+ }
405
+
363
406
 
364
407
  ## ----------------- ##
365
408
  ## Global variables. ##
@@ -580,16 +623,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then
580
623
  {
581
624
  $debug_cmd
582
625
 
583
- func_quote_for_eval "$2"
584
- eval "$1+=\\ \$func_quote_for_eval_result"
626
+ func_quote_arg pretty "$2"
627
+ eval "$1+=\\ \$func_quote_arg_result"
585
628
  }'
586
629
  else
587
630
  func_append_quoted ()
588
631
  {
589
632
  $debug_cmd
590
633
 
591
- func_quote_for_eval "$2"
592
- eval "$1=\$$1\\ \$func_quote_for_eval_result"
634
+ func_quote_arg pretty "$2"
635
+ eval "$1=\$$1\\ \$func_quote_arg_result"
593
636
  }
594
637
  fi
595
638
 
@@ -1091,85 +1134,203 @@ func_relative_path ()
1091
1134
  }
1092
1135
 
1093
1136
 
1094
- # func_quote_for_eval ARG...
1095
- # --------------------------
1096
- # Aesthetically quote ARGs to be evaled later.
1097
- # This function returns two values:
1098
- # i) func_quote_for_eval_result
1099
- # double-quoted, suitable for a subsequent eval
1100
- # ii) func_quote_for_eval_unquoted_result
1101
- # has all characters that are still active within double
1102
- # quotes backslashified.
1103
- func_quote_for_eval ()
1137
+ # func_quote_portable EVAL ARG
1138
+ # ----------------------------
1139
+ # Internal function to portably implement func_quote_arg. Note that we still
1140
+ # keep attention to performance here so we as much as possible try to avoid
1141
+ # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
1142
+ func_quote_portable ()
1104
1143
  {
1105
1144
  $debug_cmd
1106
1145
 
1107
- func_quote_for_eval_unquoted_result=
1108
- func_quote_for_eval_result=
1109
- while test 0 -lt $#; do
1110
- case $1 in
1111
- *[\\\`\"\$]*)
1112
- _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
1113
- *)
1114
- _G_unquoted_arg=$1 ;;
1115
- esac
1116
- if test -n "$func_quote_for_eval_unquoted_result"; then
1117
- func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
1118
- else
1119
- func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
1146
+ $require_check_ifs_backslash
1147
+
1148
+ func_quote_portable_result=$2
1149
+
1150
+ # one-time-loop (easy break)
1151
+ while true
1152
+ do
1153
+ if $1; then
1154
+ func_quote_portable_result=`$ECHO "$2" | $SED \
1155
+ -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
1156
+ break
1120
1157
  fi
1121
1158
 
1122
- case $_G_unquoted_arg in
1123
- # Double-quote args containing shell metacharacters to delay
1124
- # word splitting, command substitution and variable expansion
1125
- # for a subsequent eval.
1126
- # Many Bourne shells cannot handle close brackets correctly
1127
- # in scan sets, so we specify it separately.
1128
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1129
- _G_quoted_arg=\"$_G_unquoted_arg\"
1159
+ # Quote for eval.
1160
+ case $func_quote_portable_result in
1161
+ *[\\\`\"\$]*)
1162
+ # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string
1163
+ # contains the shell wildcard characters.
1164
+ case $check_ifs_backshlash_broken$func_quote_portable_result in
1165
+ :*|*[\[\*\?]*)
1166
+ func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
1167
+ | $SED "$sed_quote_subst"`
1168
+ break
1169
+ ;;
1170
+ esac
1171
+
1172
+ func_quote_portable_old_IFS=$IFS
1173
+ for _G_char in '\' '`' '"' '$'
1174
+ do
1175
+ # STATE($1) PREV($2) SEPARATOR($3)
1176
+ set start "" ""
1177
+ func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
1178
+ IFS=$_G_char
1179
+ for _G_part in $func_quote_portable_result
1180
+ do
1181
+ case $1 in
1182
+ quote)
1183
+ func_append func_quote_portable_result "$3$2"
1184
+ set quote "$_G_part" "\\$_G_char"
1185
+ ;;
1186
+ start)
1187
+ set first "" ""
1188
+ func_quote_portable_result=
1189
+ ;;
1190
+ first)
1191
+ set quote "$_G_part" ""
1192
+ ;;
1193
+ esac
1194
+ done
1195
+ done
1196
+ IFS=$func_quote_portable_old_IFS
1130
1197
  ;;
1131
- *)
1132
- _G_quoted_arg=$_G_unquoted_arg
1133
- ;;
1198
+ *) ;;
1134
1199
  esac
1135
-
1136
- if test -n "$func_quote_for_eval_result"; then
1137
- func_append func_quote_for_eval_result " $_G_quoted_arg"
1138
- else
1139
- func_append func_quote_for_eval_result "$_G_quoted_arg"
1140
- fi
1141
- shift
1200
+ break
1142
1201
  done
1202
+
1203
+ func_quote_portable_unquoted_result=$func_quote_portable_result
1204
+ case $func_quote_portable_result in
1205
+ # double-quote args containing shell metacharacters to delay
1206
+ # word splitting, command substitution and variable expansion
1207
+ # for a subsequent eval.
1208
+ # many bourne shells cannot handle close brackets correctly
1209
+ # in scan sets, so we specify it separately.
1210
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1211
+ func_quote_portable_result=\"$func_quote_portable_result\"
1212
+ ;;
1213
+ esac
1143
1214
  }
1144
1215
 
1145
1216
 
1146
- # func_quote_for_expand ARG
1147
- # -------------------------
1148
- # Aesthetically quote ARG to be evaled later; same as above,
1149
- # but do not quote variable references.
1150
- func_quote_for_expand ()
1151
- {
1152
- $debug_cmd
1217
+ # func_quotefast_eval ARG
1218
+ # -----------------------
1219
+ # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
1220
+ # but optimized for speed. Result is stored in $func_quotefast_eval.
1221
+ if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
1222
+ printf -v _GL_test_printf_tilde %q '~'
1223
+ if test '\~' = "$_GL_test_printf_tilde"; then
1224
+ func_quotefast_eval ()
1225
+ {
1226
+ printf -v func_quotefast_eval_result %q "$1"
1227
+ }
1228
+ else
1229
+ # Broken older Bash implementations. Make those faster too if possible.
1230
+ func_quotefast_eval ()
1231
+ {
1232
+ case $1 in
1233
+ '~'*)
1234
+ func_quote_portable false "$1"
1235
+ func_quotefast_eval_result=$func_quote_portable_result
1236
+ ;;
1237
+ *)
1238
+ printf -v func_quotefast_eval_result %q "$1"
1239
+ ;;
1240
+ esac
1241
+ }
1242
+ fi
1243
+ else
1244
+ func_quotefast_eval ()
1245
+ {
1246
+ func_quote_portable false "$1"
1247
+ func_quotefast_eval_result=$func_quote_portable_result
1248
+ }
1249
+ fi
1153
1250
 
1154
- case $1 in
1155
- *[\\\`\"]*)
1156
- _G_arg=`$ECHO "$1" | $SED \
1157
- -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
1158
- *)
1159
- _G_arg=$1 ;;
1251
+
1252
+ # func_quote_arg MODEs ARG
1253
+ # ------------------------
1254
+ # Quote one ARG to be evaled later. MODEs argument may contain zero or more
1255
+ # specifiers listed below separated by ',' character. This function returns two
1256
+ # values:
1257
+ # i) func_quote_arg_result
1258
+ # double-quoted (when needed), suitable for a subsequent eval
1259
+ # ii) func_quote_arg_unquoted_result
1260
+ # has all characters that are still active within double
1261
+ # quotes backslashified. Available only if 'unquoted' is specified.
1262
+ #
1263
+ # Available modes:
1264
+ # ----------------
1265
+ # 'eval' (default)
1266
+ # - escape shell special characters
1267
+ # 'expand'
1268
+ # - the same as 'eval'; but do not quote variable references
1269
+ # 'pretty'
1270
+ # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
1271
+ # be used later in func_quote to get output like: 'echo "a b"' instead
1272
+ # of 'echo a\ b'. This is slower than default on some shells.
1273
+ # 'unquoted'
1274
+ # - produce also $func_quote_arg_unquoted_result which does not contain
1275
+ # wrapping double-quotes.
1276
+ #
1277
+ # Examples for 'func_quote_arg pretty,unquoted string':
1278
+ #
1279
+ # string | *_result | *_unquoted_result
1280
+ # ------------+-----------------------+-------------------
1281
+ # " | \" | \"
1282
+ # a b | "a b" | a b
1283
+ # "a b" | "\"a b\"" | \"a b\"
1284
+ # * | "*" | *
1285
+ # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
1286
+ #
1287
+ # Examples for 'func_quote_arg pretty,unquoted,expand string':
1288
+ #
1289
+ # string | *_result | *_unquoted_result
1290
+ # --------------+---------------------+--------------------
1291
+ # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
1292
+ func_quote_arg ()
1293
+ {
1294
+ _G_quote_expand=false
1295
+ case ,$1, in
1296
+ *,expand,*)
1297
+ _G_quote_expand=:
1298
+ ;;
1160
1299
  esac
1161
1300
 
1162
- case $_G_arg in
1163
- # Double-quote args containing shell metacharacters to delay
1164
- # word splitting and command substitution for a subsequent eval.
1165
- # Many Bourne shells cannot handle close brackets correctly
1166
- # in scan sets, so we specify it separately.
1167
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1168
- _G_arg=\"$_G_arg\"
1301
+ case ,$1, in
1302
+ *,pretty,*|*,expand,*|*,unquoted,*)
1303
+ func_quote_portable $_G_quote_expand "$2"
1304
+ func_quote_arg_result=$func_quote_portable_result
1305
+ func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
1306
+ ;;
1307
+ *)
1308
+ # Faster quote-for-eval for some shells.
1309
+ func_quotefast_eval "$2"
1310
+ func_quote_arg_result=$func_quotefast_eval_result
1169
1311
  ;;
1170
1312
  esac
1313
+ }
1314
+
1171
1315
 
1172
- func_quote_for_expand_result=$_G_arg
1316
+ # func_quote MODEs ARGs...
1317
+ # ------------------------
1318
+ # Quote all ARGs to be evaled later and join them into single command. See
1319
+ # func_quote_arg's description for more info.
1320
+ func_quote ()
1321
+ {
1322
+ $debug_cmd
1323
+ _G_func_quote_mode=$1 ; shift
1324
+ func_quote_result=
1325
+ while test 0 -lt $#; do
1326
+ func_quote_arg "$_G_func_quote_mode" "$1"
1327
+ if test -n "$func_quote_result"; then
1328
+ func_append func_quote_result " $func_quote_arg_result"
1329
+ else
1330
+ func_append func_quote_result "$func_quote_arg_result"
1331
+ fi
1332
+ shift
1333
+ done
1173
1334
  }
1174
1335
 
1175
1336
 
@@ -1215,8 +1376,8 @@ func_show_eval ()
1215
1376
  _G_cmd=$1
1216
1377
  _G_fail_exp=${2-':'}
1217
1378
 
1218
- func_quote_for_expand "$_G_cmd"
1219
- eval "func_notquiet $func_quote_for_expand_result"
1379
+ func_quote_arg pretty,expand "$_G_cmd"
1380
+ eval "func_notquiet $func_quote_arg_result"
1220
1381
 
1221
1382
  $opt_dry_run || {
1222
1383
  eval "$_G_cmd"
@@ -1241,8 +1402,8 @@ func_show_eval_locale ()
1241
1402
  _G_fail_exp=${2-':'}
1242
1403
 
1243
1404
  $opt_quiet || {
1244
- func_quote_for_expand "$_G_cmd"
1245
- eval "func_echo $func_quote_for_expand_result"
1405
+ func_quote_arg expand,pretty "$_G_cmd"
1406
+ eval "func_echo $func_quote_arg_result"
1246
1407
  }
1247
1408
 
1248
1409
  $opt_dry_run || {
@@ -1369,30 +1530,26 @@ func_lt_ver ()
1369
1530
  # End:
1370
1531
  #! /bin/sh
1371
1532
 
1372
- # Set a version string for this script.
1373
- scriptversion=2015-10-07.11; # UTC
1374
-
1375
1533
  # A portable, pluggable option parser for Bourne shell.
1376
1534
  # Written by Gary V. Vaughan, 2010
1377
1535
 
1378
- # Copyright (C) 2010-2015 Free Software Foundation, Inc.
1379
- # This is free software; see the source for copying conditions. There is NO
1380
- # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1381
-
1382
- # This program is free software: you can redistribute it and/or modify
1383
- # it under the terms of the GNU General Public License as published by
1384
- # the Free Software Foundation, either version 3 of the License, or
1385
- # (at your option) any later version.
1536
+ # This is free software. There is NO warranty; not even for
1537
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1538
+ #
1539
+ # Copyright (C) 2010-2019, 2021 Bootstrap Authors
1540
+ #
1541
+ # This file is dual licensed under the terms of the MIT license
1542
+ # <https://opensource.org/license/MIT>, and GPL version 2 or later
1543
+ # <http://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
1544
+ # these licenses when using or redistributing this software or any of
1545
+ # the files within it. See the URLs above, or the file `LICENSE`
1546
+ # included in the Bootstrap distribution for the full license texts.
1386
1547
 
1387
- # This program is distributed in the hope that it will be useful,
1388
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
1389
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1390
- # GNU General Public License for more details.
1548
+ # Please report bugs or propose patches to:
1549
+ # <https://github.com/gnulib-modules/bootstrap/issues>
1391
1550
 
1392
- # You should have received a copy of the GNU General Public License
1393
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
1394
-
1395
- # Please report bugs or propose patches to gary@gnu.org.
1551
+ # Set a version string for this script.
1552
+ scriptversion=2019-02-19.15; # UTC
1396
1553
 
1397
1554
 
1398
1555
  ## ------ ##
@@ -1415,7 +1572,7 @@ scriptversion=2015-10-07.11; # UTC
1415
1572
  #
1416
1573
  # In order for the '--version' option to work, you will need to have a
1417
1574
  # suitably formatted comment like the one at the top of this file
1418
- # starting with '# Written by ' and ending with '# warranty; '.
1575
+ # starting with '# Written by ' and ending with '# Copyright'.
1419
1576
  #
1420
1577
  # For '-h' and '--help' to work, you will also need a one line
1421
1578
  # description of your script's purpose in a comment directly above the
@@ -1427,7 +1584,7 @@ scriptversion=2015-10-07.11; # UTC
1427
1584
  # to display verbose messages only when your user has specified
1428
1585
  # '--verbose'.
1429
1586
  #
1430
- # After sourcing this file, you can plug processing for additional
1587
+ # After sourcing this file, you can plug in processing for additional
1431
1588
  # options by amending the variables from the 'Configuration' section
1432
1589
  # below, and following the instructions in the 'Option parsing'
1433
1590
  # section further down.
@@ -1476,8 +1633,8 @@ fatal_help="Try '\$progname --help' for more information."
1476
1633
  ## ------------------------- ##
1477
1634
 
1478
1635
  # This section contains functions for adding, removing, and running hooks
1479
- # to the main code. A hook is just a named list of of function, that can
1480
- # be run in order later on.
1636
+ # in the main code. A hook is just a list of function names that can be
1637
+ # run in order later on.
1481
1638
 
1482
1639
  # func_hookable FUNC_NAME
1483
1640
  # -----------------------
@@ -1510,7 +1667,8 @@ func_add_hook ()
1510
1667
 
1511
1668
  # func_remove_hook FUNC_NAME HOOK_FUNC
1512
1669
  # ------------------------------------
1513
- # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
1670
+ # Remove HOOK_FUNC from the list of hook functions to be called by
1671
+ # FUNC_NAME.
1514
1672
  func_remove_hook ()
1515
1673
  {
1516
1674
  $debug_cmd
@@ -1519,10 +1677,28 @@ func_remove_hook ()
1519
1677
  }
1520
1678
 
1521
1679
 
1680
+ # func_propagate_result FUNC_NAME_A FUNC_NAME_B
1681
+ # ---------------------------------------------
1682
+ # If the *_result variable of FUNC_NAME_A _is set_, assign its value to
1683
+ # *_result variable of FUNC_NAME_B.
1684
+ func_propagate_result ()
1685
+ {
1686
+ $debug_cmd
1687
+
1688
+ func_propagate_result_result=:
1689
+ if eval "test \"\${${1}_result+set}\" = set"
1690
+ then
1691
+ eval "${2}_result=\$${1}_result"
1692
+ else
1693
+ func_propagate_result_result=false
1694
+ fi
1695
+ }
1696
+
1697
+
1522
1698
  # func_run_hooks FUNC_NAME [ARG]...
1523
1699
  # ---------------------------------
1524
1700
  # Run all hook functions registered to FUNC_NAME.
1525
- # It is assumed that the list of hook functions contains nothing more
1701
+ # It's assumed that the list of hook functions contains nothing more
1526
1702
  # than a whitespace-delimited list of legal shell function names, and
1527
1703
  # no effort is wasted trying to catch shell meta-characters or preserve
1528
1704
  # whitespace.
@@ -1534,22 +1710,19 @@ func_run_hooks ()
1534
1710
 
1535
1711
  case " $hookable_fns " in
1536
1712
  *" $1 "*) ;;
1537
- *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1713
+ *) func_fatal_error "'$1' does not support hook functions." ;;
1538
1714
  esac
1539
1715
 
1540
1716
  eval _G_hook_fns=\$$1_hooks; shift
1541
1717
 
1542
1718
  for _G_hook in $_G_hook_fns; do
1543
- if eval $_G_hook '"$@"'; then
1544
- # store returned options list back into positional
1545
- # parameters for next 'cmd' execution.
1546
- eval _G_hook_result=\$${_G_hook}_result
1547
- eval set dummy "$_G_hook_result"; shift
1548
- _G_rc_run_hooks=:
1719
+ func_unset "${_G_hook}_result"
1720
+ eval $_G_hook '${1+"$@"}'
1721
+ func_propagate_result $_G_hook func_run_hooks
1722
+ if $func_propagate_result_result; then
1723
+ eval set dummy "$func_run_hooks_result"; shift
1549
1724
  fi
1550
1725
  done
1551
-
1552
- $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
1553
1726
  }
1554
1727
 
1555
1728
 
@@ -1559,14 +1732,16 @@ func_run_hooks ()
1559
1732
  ## --------------- ##
1560
1733
 
1561
1734
  # In order to add your own option parsing hooks, you must accept the
1562
- # full positional parameter list in your hook function, you may remove/edit
1563
- # any options that you action, and then pass back the remaining unprocessed
1564
- # options in '<hooked_function_name>_result', escaped suitably for
1565
- # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
1566
- # hook's caller know that it should pay attention to
1567
- # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
1568
- # arguments are left untouched by the hook and therefore caller will ignore the
1569
- # result variable.
1735
+ # full positional parameter list from your hook function. You may remove
1736
+ # or edit any options that you action, and then pass back the remaining
1737
+ # unprocessed options in '<hooked_function_name>_result', escaped
1738
+ # suitably for 'eval'.
1739
+ #
1740
+ # The '<hooked_function_name>_result' variable is automatically unset
1741
+ # before your hook gets called; for best performance, only set the
1742
+ # *_result variable when necessary (i.e. don't call the 'func_quote'
1743
+ # function unnecessarily because it can be an expensive operation on some
1744
+ # machines).
1570
1745
  #
1571
1746
  # Like this:
1572
1747
  #
@@ -1578,11 +1753,8 @@ func_run_hooks ()
1578
1753
  # usage_message=$usage_message'
1579
1754
  # -s, --silent don'\''t print informational messages
1580
1755
  # '
1581
- # # No change in '$@' (ignored completely by this hook). There is
1582
- # # no need to do the equivalent (but slower) action:
1583
- # # func_quote_for_eval ${1+"$@"}
1584
- # # my_options_prep_result=$func_quote_for_eval_result
1585
- # false
1756
+ # # No change in '$@' (ignored completely by this hook). Leave
1757
+ # # my_options_prep_result variable intact.
1586
1758
  # }
1587
1759
  # func_add_hook func_options_prep my_options_prep
1588
1760
  #
@@ -1593,7 +1765,7 @@ func_run_hooks ()
1593
1765
  #
1594
1766
  # args_changed=false
1595
1767
  #
1596
- # # Note that for efficiency, we parse as many options as we can
1768
+ # # Note that, for efficiency, we parse as many options as we can
1597
1769
  # # recognise in a loop before passing the remainder back to the
1598
1770
  # # caller on the first unrecognised argument we encounter.
1599
1771
  # while test $# -gt 0; do
@@ -1610,18 +1782,17 @@ func_run_hooks ()
1610
1782
  # args_changed=:
1611
1783
  # ;;
1612
1784
  # *) # Make sure the first unrecognised option "$_G_opt"
1613
- # # is added back to "$@", we could need that later
1614
- # # if $args_changed is true.
1785
+ # # is added back to "$@" in case we need it later,
1786
+ # # if $args_changed was set to 'true'.
1615
1787
  # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1616
1788
  # esac
1617
1789
  # done
1618
1790
  #
1791
+ # # Only call 'func_quote' here if we processed at least one argument.
1619
1792
  # if $args_changed; then
1620
- # func_quote_for_eval ${1+"$@"}
1621
- # my_silent_option_result=$func_quote_for_eval_result
1793
+ # func_quote eval ${1+"$@"}
1794
+ # my_silent_option_result=$func_quote_result
1622
1795
  # fi
1623
- #
1624
- # $args_changed
1625
1796
  # }
1626
1797
  # func_add_hook func_parse_options my_silent_option
1627
1798
  #
@@ -1632,8 +1803,6 @@ func_run_hooks ()
1632
1803
  #
1633
1804
  # $opt_silent && $opt_verbose && func_fatal_help "\
1634
1805
  # '--silent' and '--verbose' options are mutually exclusive."
1635
- #
1636
- # false
1637
1806
  # }
1638
1807
  # func_add_hook func_validate_options my_option_validation
1639
1808
  #
@@ -1649,13 +1818,8 @@ func_options_finish ()
1649
1818
  {
1650
1819
  $debug_cmd
1651
1820
 
1652
- _G_func_options_finish_exit=false
1653
- if func_run_hooks func_options ${1+"$@"}; then
1654
- func_options_finish_result=$func_run_hooks_result
1655
- _G_func_options_finish_exit=:
1656
- fi
1657
-
1658
- $_G_func_options_finish_exit
1821
+ func_run_hooks func_options ${1+"$@"}
1822
+ func_propagate_result func_run_hooks func_options_finish
1659
1823
  }
1660
1824
 
1661
1825
 
@@ -1668,28 +1832,27 @@ func_options ()
1668
1832
  {
1669
1833
  $debug_cmd
1670
1834
 
1671
- _G_rc_options=false
1835
+ _G_options_quoted=false
1672
1836
 
1673
1837
  for my_func in options_prep parse_options validate_options options_finish
1674
1838
  do
1675
- if eval func_$my_func '${1+"$@"}'; then
1676
- eval _G_res_var='$'"func_${my_func}_result"
1677
- eval set dummy "$_G_res_var" ; shift
1678
- _G_rc_options=:
1839
+ func_unset func_${my_func}_result
1840
+ func_unset func_run_hooks_result
1841
+ eval func_$my_func '${1+"$@"}'
1842
+ func_propagate_result func_$my_func func_options
1843
+ if $func_propagate_result_result; then
1844
+ eval set dummy "$func_options_result"; shift
1845
+ _G_options_quoted=:
1679
1846
  fi
1680
1847
  done
1681
1848
 
1682
- # Save modified positional parameters for caller. As a top-level
1683
- # options-parser function we always need to set the 'func_options_result'
1684
- # variable (regardless the $_G_rc_options value).
1685
- if $_G_rc_options; then
1686
- func_options_result=$_G_res_var
1687
- else
1688
- func_quote_for_eval ${1+"$@"}
1689
- func_options_result=$func_quote_for_eval_result
1690
- fi
1691
-
1692
- $_G_rc_options
1849
+ $_G_options_quoted || {
1850
+ # As we (func_options) are top-level options-parser function and
1851
+ # nobody quoted "$@" for us yet, we need to do it explicitly for
1852
+ # caller.
1853
+ func_quote eval ${1+"$@"}
1854
+ func_options_result=$func_quote_result
1855
+ }
1693
1856
  }
1694
1857
 
1695
1858
 
@@ -1699,8 +1862,7 @@ func_options ()
1699
1862
  # Note that when calling hook functions, we pass through the list of
1700
1863
  # positional parameters. If a hook function modifies that list, and
1701
1864
  # needs to propagate that back to rest of this script, then the complete
1702
- # modified list must be put in 'func_run_hooks_result' before
1703
- # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
1865
+ # modified list must be put in 'func_run_hooks_result' before returning.
1704
1866
  func_hookable func_options_prep
1705
1867
  func_options_prep ()
1706
1868
  {
@@ -1710,14 +1872,8 @@ func_options_prep ()
1710
1872
  opt_verbose=false
1711
1873
  opt_warning_types=
1712
1874
 
1713
- _G_rc_options_prep=false
1714
- if func_run_hooks func_options_prep ${1+"$@"}; then
1715
- _G_rc_options_prep=:
1716
- # save modified positional parameters for caller
1717
- func_options_prep_result=$func_run_hooks_result
1718
- fi
1719
-
1720
- $_G_rc_options_prep
1875
+ func_run_hooks func_options_prep ${1+"$@"}
1876
+ func_propagate_result func_run_hooks func_options_prep
1721
1877
  }
1722
1878
 
1723
1879
 
@@ -1729,27 +1885,32 @@ func_parse_options ()
1729
1885
  {
1730
1886
  $debug_cmd
1731
1887
 
1732
- func_parse_options_result=
1733
-
1734
- _G_rc_parse_options=false
1888
+ _G_parse_options_requote=false
1735
1889
  # this just eases exit handling
1736
1890
  while test $# -gt 0; do
1737
1891
  # Defer to hook functions for initial option parsing, so they
1738
1892
  # get priority in the event of reusing an option name.
1739
- if func_run_hooks func_parse_options ${1+"$@"}; then
1740
- eval set dummy "$func_run_hooks_result"; shift
1741
- _G_rc_parse_options=:
1893
+ func_run_hooks func_parse_options ${1+"$@"}
1894
+ func_propagate_result func_run_hooks func_parse_options
1895
+ if $func_propagate_result_result; then
1896
+ eval set dummy "$func_parse_options_result"; shift
1897
+ # Even though we may have changed "$@", we passed the "$@" array
1898
+ # down into the hook and it quoted it for us (because we are in
1899
+ # this if-branch). No need to quote it again.
1900
+ _G_parse_options_requote=false
1742
1901
  fi
1743
1902
 
1744
1903
  # Break out of the loop if we already parsed every option.
1745
1904
  test $# -gt 0 || break
1746
1905
 
1906
+ # We expect that one of the options parsed in this function matches
1907
+ # and thus we remove _G_opt from "$@" and need to re-quote.
1747
1908
  _G_match_parse_options=:
1748
1909
  _G_opt=$1
1749
1910
  shift
1750
1911
  case $_G_opt in
1751
1912
  --debug|-x) debug_cmd='set -x'
1752
- func_echo "enabling shell trace mode"
1913
+ func_echo "enabling shell trace mode" >&2
1753
1914
  $debug_cmd
1754
1915
  ;;
1755
1916
 
@@ -1760,7 +1921,7 @@ func_parse_options ()
1760
1921
 
1761
1922
  --warnings|--warning|-W)
1762
1923
  if test $# = 0 && func_missing_arg $_G_opt; then
1763
- _G_rc_parse_options=:
1924
+ _G_parse_options_requote=:
1764
1925
  break
1765
1926
  fi
1766
1927
  case " $warning_categories $1" in
@@ -1815,7 +1976,7 @@ func_parse_options ()
1815
1976
  shift
1816
1977
  ;;
1817
1978
 
1818
- --) _G_rc_parse_options=: ; break ;;
1979
+ --) _G_parse_options_requote=: ; break ;;
1819
1980
  -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1820
1981
  *) set dummy "$_G_opt" ${1+"$@"}; shift
1821
1982
  _G_match_parse_options=false
@@ -1823,17 +1984,16 @@ func_parse_options ()
1823
1984
  ;;
1824
1985
  esac
1825
1986
 
1826
- $_G_match_parse_options && _G_rc_parse_options=:
1987
+ if $_G_match_parse_options; then
1988
+ _G_parse_options_requote=:
1989
+ fi
1827
1990
  done
1828
1991
 
1829
-
1830
- if $_G_rc_parse_options; then
1992
+ if $_G_parse_options_requote; then
1831
1993
  # save modified positional parameters for caller
1832
- func_quote_for_eval ${1+"$@"}
1833
- func_parse_options_result=$func_quote_for_eval_result
1994
+ func_quote eval ${1+"$@"}
1995
+ func_parse_options_result=$func_quote_result
1834
1996
  fi
1835
-
1836
- $_G_rc_parse_options
1837
1997
  }
1838
1998
 
1839
1999
 
@@ -1846,21 +2006,14 @@ func_validate_options ()
1846
2006
  {
1847
2007
  $debug_cmd
1848
2008
 
1849
- _G_rc_validate_options=false
1850
-
1851
2009
  # Display all warnings if -W was not given.
1852
2010
  test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1853
2011
 
1854
- if func_run_hooks func_validate_options ${1+"$@"}; then
1855
- # save modified positional parameters for caller
1856
- func_validate_options_result=$func_run_hooks_result
1857
- _G_rc_validate_options=:
1858
- fi
2012
+ func_run_hooks func_validate_options ${1+"$@"}
2013
+ func_propagate_result func_run_hooks func_validate_options
1859
2014
 
1860
2015
  # Bail if the options were screwed!
1861
2016
  $exit_cmd $EXIT_FAILURE
1862
-
1863
- $_G_rc_validate_options
1864
2017
  }
1865
2018
 
1866
2019
 
@@ -1916,8 +2069,8 @@ func_missing_arg ()
1916
2069
 
1917
2070
  # func_split_equals STRING
1918
2071
  # ------------------------
1919
- # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1920
- # splitting STRING at the '=' sign.
2072
+ # Set func_split_equals_lhs and func_split_equals_rhs shell variables
2073
+ # after splitting STRING at the '=' sign.
1921
2074
  test -z "$_G_HAVE_XSI_OPS" \
1922
2075
  && (eval 'x=a/b/c;
1923
2076
  test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
@@ -1932,8 +2085,9 @@ then
1932
2085
 
1933
2086
  func_split_equals_lhs=${1%%=*}
1934
2087
  func_split_equals_rhs=${1#*=}
1935
- test "x$func_split_equals_lhs" = "x$1" \
1936
- && func_split_equals_rhs=
2088
+ if test "x$func_split_equals_lhs" = "x$1"; then
2089
+ func_split_equals_rhs=
2090
+ fi
1937
2091
  }'
1938
2092
  else
1939
2093
  # ...otherwise fall back to using expr, which is often a shell builtin.
@@ -1943,7 +2097,7 @@ else
1943
2097
 
1944
2098
  func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1945
2099
  func_split_equals_rhs=
1946
- test "x$func_split_equals_lhs" = "x$1" \
2100
+ test "x$func_split_equals_lhs=" = "x$1" \
1947
2101
  || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1948
2102
  }
1949
2103
  fi #func_split_equals
@@ -1969,7 +2123,7 @@ else
1969
2123
  {
1970
2124
  $debug_cmd
1971
2125
 
1972
- func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2126
+ func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'`
1973
2127
  func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1974
2128
  }
1975
2129
  fi #func_split_short_opt
@@ -2011,31 +2165,44 @@ func_usage_message ()
2011
2165
  # func_version
2012
2166
  # ------------
2013
2167
  # Echo version message to standard output and exit.
2168
+ # The version message is extracted from the calling file's header
2169
+ # comments, with leading '# ' stripped:
2170
+ # 1. First display the progname and version
2171
+ # 2. Followed by the header comment line matching /^# Written by /
2172
+ # 3. Then a blank line followed by the first following line matching
2173
+ # /^# Copyright /
2174
+ # 4. Immediately followed by any lines between the previous matches,
2175
+ # except lines preceding the intervening completely blank line.
2176
+ # For example, see the header comments of this file.
2014
2177
  func_version ()
2015
2178
  {
2016
2179
  $debug_cmd
2017
2180
 
2018
2181
  printf '%s\n' "$progname $scriptversion"
2019
2182
  $SED -n '
2020
- /(C)/!b go
2021
- :more
2022
- /\./!{
2023
- N
2024
- s|\n# | |
2025
- b more
2026
- }
2027
- :go
2028
- /^# Written by /,/# warranty; / {
2029
- s|^# ||
2030
- s|^# *$||
2031
- s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2032
- p
2183
+ /^# Written by /!b
2184
+ s|^# ||; p; n
2185
+
2186
+ :fwd2blnk
2187
+ /./ {
2188
+ n
2189
+ b fwd2blnk
2033
2190
  }
2034
- /^# Written by / {
2035
- s|^# ||
2036
- p
2191
+ p; n
2192
+
2193
+ :holdwrnt
2194
+ s|^# ||
2195
+ s|^# *$||
2196
+ /^Copyright /!{
2197
+ /./H
2198
+ n
2199
+ b holdwrnt
2037
2200
  }
2038
- /^warranty; /q' < "$progpath"
2201
+
2202
+ s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
2203
+ G
2204
+ s|\(\n\)\n*|\1|g
2205
+ p; q' < "$progpath"
2039
2206
 
2040
2207
  exit $?
2041
2208
  }
@@ -2045,12 +2212,12 @@ func_version ()
2045
2212
  # mode: shell-script
2046
2213
  # sh-indentation: 2
2047
2214
  # eval: (add-hook 'before-save-hook 'time-stamp)
2048
- # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2215
+ # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2049
2216
  # time-stamp-time-zone: "UTC"
2050
2217
  # End:
2051
2218
 
2052
2219
  # Set a version string.
2053
- scriptversion='(GNU libtool) 2.4.6'
2220
+ scriptversion='(GNU libtool) 2.4.7'
2054
2221
 
2055
2222
 
2056
2223
  # func_echo ARG...
@@ -2141,7 +2308,7 @@ include the following information:
2141
2308
  compiler: $LTCC
2142
2309
  compiler flags: $LTCFLAGS
2143
2310
  linker: $LD (gnu? $with_gnu_ld)
2144
- version: $progname $scriptversion Debian-2.4.6-14
2311
+ version: $progname $scriptversion Debian-2.4.7-5
2145
2312
  automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2146
2313
  autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2147
2314
 
@@ -2197,7 +2364,7 @@ fi
2197
2364
  # a configuration failure hint, and exit.
2198
2365
  func_fatal_configuration ()
2199
2366
  {
2200
- func__fatal_error ${1+"$@"} \
2367
+ func_fatal_error ${1+"$@"} \
2201
2368
  "See the $PACKAGE documentation for more information." \
2202
2369
  "Fatal configuration error."
2203
2370
  }
@@ -2345,6 +2512,8 @@ libtool_options_prep ()
2345
2512
 
2346
2513
  _G_rc_lt_options_prep=:
2347
2514
 
2515
+ _G_rc_lt_options_prep=:
2516
+
2348
2517
  # Shorthand for --mode=foo, only valid as the first argument
2349
2518
  case $1 in
2350
2519
  clean|clea|cle|cl)
@@ -2375,11 +2544,9 @@ libtool_options_prep ()
2375
2544
 
2376
2545
  if $_G_rc_lt_options_prep; then
2377
2546
  # Pass back the list of options.
2378
- func_quote_for_eval ${1+"$@"}
2379
- libtool_options_prep_result=$func_quote_for_eval_result
2547
+ func_quote eval ${1+"$@"}
2548
+ libtool_options_prep_result=$func_quote_result
2380
2549
  fi
2381
-
2382
- $_G_rc_lt_options_prep
2383
2550
  }
2384
2551
  func_add_hook func_options_prep libtool_options_prep
2385
2552
 
@@ -2482,11 +2649,9 @@ libtool_parse_options ()
2482
2649
 
2483
2650
  if $_G_rc_lt_parse_options; then
2484
2651
  # save modified positional parameters for caller
2485
- func_quote_for_eval ${1+"$@"}
2486
- libtool_parse_options_result=$func_quote_for_eval_result
2652
+ func_quote eval ${1+"$@"}
2653
+ libtool_parse_options_result=$func_quote_result
2487
2654
  fi
2488
-
2489
- $_G_rc_lt_parse_options
2490
2655
  }
2491
2656
  func_add_hook func_parse_options libtool_parse_options
2492
2657
 
@@ -2543,8 +2708,8 @@ libtool_validate_options ()
2543
2708
  }
2544
2709
 
2545
2710
  # Pass back the unparsed argument list
2546
- func_quote_for_eval ${1+"$@"}
2547
- libtool_validate_options_result=$func_quote_for_eval_result
2711
+ func_quote eval ${1+"$@"}
2712
+ libtool_validate_options_result=$func_quote_result
2548
2713
  }
2549
2714
  func_add_hook func_validate_options libtool_validate_options
2550
2715
 
@@ -3510,8 +3675,8 @@ func_mode_compile ()
3510
3675
  esac
3511
3676
  done
3512
3677
 
3513
- func_quote_for_eval "$libobj"
3514
- test "X$libobj" != "X$func_quote_for_eval_result" \
3678
+ func_quote_arg pretty "$libobj"
3679
+ test "X$libobj" != "X$func_quote_arg_result" \
3515
3680
  && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3516
3681
  && func_warning "libobj name '$libobj' may not contain shell special characters."
3517
3682
  func_dirname_and_basename "$obj" "/" ""
@@ -3584,8 +3749,8 @@ compiler."
3584
3749
 
3585
3750
  func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3586
3751
  srcfile=$func_to_tool_file_result
3587
- func_quote_for_eval "$srcfile"
3588
- qsrcfile=$func_quote_for_eval_result
3752
+ func_quote_arg pretty "$srcfile"
3753
+ qsrcfile=$func_quote_arg_result
3589
3754
 
3590
3755
  # Only build a PIC object if we are building libtool libraries.
3591
3756
  if test yes = "$build_libtool_libs"; then
@@ -3740,7 +3905,8 @@ This mode accepts the following additional options:
3740
3905
  -prefer-non-pic try to build non-PIC objects only
3741
3906
  -shared do not build a '.o' file suitable for static linking
3742
3907
  -static only build a '.o' file suitable for static linking
3743
- -Wc,FLAG pass FLAG directly to the compiler
3908
+ -Wc,FLAG
3909
+ -Xcompiler FLAG pass FLAG directly to the compiler
3744
3910
 
3745
3911
  COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3746
3912
  from the given SOURCEFILE.
@@ -3846,6 +4012,8 @@ The following components of LINK-COMMAND are treated specially:
3846
4012
  -weak LIBNAME declare that the target provides the LIBNAME interface
3847
4013
  -Wc,FLAG
3848
4014
  -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
4015
+ -Wa,FLAG
4016
+ -Xassembler FLAG pass linker-specific FLAG directly to the assembler
3849
4017
  -Wl,FLAG
3850
4018
  -Xlinker FLAG pass linker-specific FLAG directly to the linker
3851
4019
  -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
@@ -4188,8 +4356,8 @@ func_mode_install ()
4188
4356
  case $nonopt in *shtool*) :;; *) false;; esac
4189
4357
  then
4190
4358
  # Aesthetically quote it.
4191
- func_quote_for_eval "$nonopt"
4192
- install_prog="$func_quote_for_eval_result "
4359
+ func_quote_arg pretty "$nonopt"
4360
+ install_prog="$func_quote_arg_result "
4193
4361
  arg=$1
4194
4362
  shift
4195
4363
  else
@@ -4199,8 +4367,8 @@ func_mode_install ()
4199
4367
 
4200
4368
  # The real first argument should be the name of the installation program.
4201
4369
  # Aesthetically quote it.
4202
- func_quote_for_eval "$arg"
4203
- func_append install_prog "$func_quote_for_eval_result"
4370
+ func_quote_arg pretty "$arg"
4371
+ func_append install_prog "$func_quote_arg_result"
4204
4372
  install_shared_prog=$install_prog
4205
4373
  case " $install_prog " in
4206
4374
  *[\\\ /]cp\ *) install_cp=: ;;
@@ -4257,12 +4425,12 @@ func_mode_install ()
4257
4425
  esac
4258
4426
 
4259
4427
  # Aesthetically quote the argument.
4260
- func_quote_for_eval "$arg"
4261
- func_append install_prog " $func_quote_for_eval_result"
4428
+ func_quote_arg pretty "$arg"
4429
+ func_append install_prog " $func_quote_arg_result"
4262
4430
  if test -n "$arg2"; then
4263
- func_quote_for_eval "$arg2"
4431
+ func_quote_arg pretty "$arg2"
4264
4432
  fi
4265
- func_append install_shared_prog " $func_quote_for_eval_result"
4433
+ func_append install_shared_prog " $func_quote_arg_result"
4266
4434
  done
4267
4435
 
4268
4436
  test -z "$install_prog" && \
@@ -4273,8 +4441,8 @@ func_mode_install ()
4273
4441
 
4274
4442
  if test -n "$install_override_mode" && $no_mode; then
4275
4443
  if $install_cp; then :; else
4276
- func_quote_for_eval "$install_override_mode"
4277
- func_append install_shared_prog " -m $func_quote_for_eval_result"
4444
+ func_quote_arg pretty "$install_override_mode"
4445
+ func_append install_shared_prog " -m $func_quote_arg_result"
4278
4446
  fi
4279
4447
  fi
4280
4448
 
@@ -4570,8 +4738,8 @@ func_mode_install ()
4570
4738
  relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4571
4739
 
4572
4740
  $opt_quiet || {
4573
- func_quote_for_expand "$relink_command"
4574
- eval "func_echo $func_quote_for_expand_result"
4741
+ func_quote_arg expand,pretty "$relink_command"
4742
+ eval "func_echo $func_quote_arg_result"
4575
4743
  }
4576
4744
  if eval "$relink_command"; then :
4577
4745
  else
@@ -5350,7 +5518,8 @@ else
5350
5518
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
5351
5519
  file=\"\$0\""
5352
5520
 
5353
- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5521
+ func_quote_arg pretty "$ECHO"
5522
+ qECHO=$func_quote_arg_result
5354
5523
  $ECHO "\
5355
5524
 
5356
5525
  # A function that is used when there is no print builtin or printf.
@@ -5360,7 +5529,7 @@ func_fallback_echo ()
5360
5529
  \$1
5361
5530
  _LTECHO_EOF'
5362
5531
  }
5363
- ECHO=\"$qECHO\"
5532
+ ECHO=$qECHO
5364
5533
  fi
5365
5534
 
5366
5535
  # Very basic option parsing. These options are (a) specific to
@@ -6703,9 +6872,9 @@ func_mode_link ()
6703
6872
  while test "$#" -gt 0; do
6704
6873
  arg=$1
6705
6874
  shift
6706
- func_quote_for_eval "$arg"
6707
- qarg=$func_quote_for_eval_unquoted_result
6708
- func_append libtool_args " $func_quote_for_eval_result"
6875
+ func_quote_arg pretty,unquoted "$arg"
6876
+ qarg=$func_quote_arg_unquoted_result
6877
+ func_append libtool_args " $func_quote_arg_result"
6709
6878
 
6710
6879
  # If the previous option needs an argument, assign it.
6711
6880
  if test -n "$prev"; then
@@ -6941,6 +7110,13 @@ func_mode_link ()
6941
7110
  prev=
6942
7111
  continue
6943
7112
  ;;
7113
+ xassembler)
7114
+ func_append compiler_flags " -Xassembler $qarg"
7115
+ prev=
7116
+ func_append compile_command " -Xassembler $qarg"
7117
+ func_append finalize_command " -Xassembler $qarg"
7118
+ continue
7119
+ ;;
6944
7120
  xcclinker)
6945
7121
  func_append linker_flags " $qarg"
6946
7122
  func_append compiler_flags " $qarg"
@@ -7111,7 +7287,7 @@ func_mode_link ()
7111
7287
  # These systems don't actually have a C library (as such)
7112
7288
  test X-lc = "X$arg" && continue
7113
7289
  ;;
7114
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7290
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*)
7115
7291
  # Do not include libc due to us having libc/libc_r.
7116
7292
  test X-lc = "X$arg" && continue
7117
7293
  ;;
@@ -7131,7 +7307,7 @@ func_mode_link ()
7131
7307
  esac
7132
7308
  elif test X-lc_r = "X$arg"; then
7133
7309
  case $host in
7134
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7310
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*)
7135
7311
  # Do not include libc_r directly, use -pthread flag.
7136
7312
  continue
7137
7313
  ;;
@@ -7161,8 +7337,20 @@ func_mode_link ()
7161
7337
  prev=xcompiler
7162
7338
  continue
7163
7339
  ;;
7164
-
7165
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
7340
+ # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199.
7341
+ -pthread)
7342
+ case $host in
7343
+ *solaris2*) ;;
7344
+ *)
7345
+ case "$new_inherited_linker_flags " in
7346
+ *" $arg "*) ;;
7347
+ * ) func_append new_inherited_linker_flags " $arg" ;;
7348
+ esac
7349
+ ;;
7350
+ esac
7351
+ continue
7352
+ ;;
7353
+ -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
7166
7354
  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7167
7355
  func_append compiler_flags " $arg"
7168
7356
  func_append compile_command " $arg"
@@ -7303,9 +7491,9 @@ func_mode_link ()
7303
7491
  save_ifs=$IFS; IFS=,
7304
7492
  for flag in $args; do
7305
7493
  IFS=$save_ifs
7306
- func_quote_for_eval "$flag"
7307
- func_append arg " $func_quote_for_eval_result"
7308
- func_append compiler_flags " $func_quote_for_eval_result"
7494
+ func_quote_arg pretty "$flag"
7495
+ func_append arg " $func_quote_arg_result"
7496
+ func_append compiler_flags " $func_quote_arg_result"
7309
7497
  done
7310
7498
  IFS=$save_ifs
7311
7499
  func_stripname ' ' '' "$arg"
@@ -7319,16 +7507,21 @@ func_mode_link ()
7319
7507
  save_ifs=$IFS; IFS=,
7320
7508
  for flag in $args; do
7321
7509
  IFS=$save_ifs
7322
- func_quote_for_eval "$flag"
7323
- func_append arg " $wl$func_quote_for_eval_result"
7324
- func_append compiler_flags " $wl$func_quote_for_eval_result"
7325
- func_append linker_flags " $func_quote_for_eval_result"
7510
+ func_quote_arg pretty "$flag"
7511
+ func_append arg " $wl$func_quote_arg_result"
7512
+ func_append compiler_flags " $wl$func_quote_arg_result"
7513
+ func_append linker_flags " $func_quote_arg_result"
7326
7514
  done
7327
7515
  IFS=$save_ifs
7328
7516
  func_stripname ' ' '' "$arg"
7329
7517
  arg=$func_stripname_result
7330
7518
  ;;
7331
7519
 
7520
+ -Xassembler)
7521
+ prev=xassembler
7522
+ continue
7523
+ ;;
7524
+
7332
7525
  -Xcompiler)
7333
7526
  prev=xcompiler
7334
7527
  continue
@@ -7346,8 +7539,8 @@ func_mode_link ()
7346
7539
 
7347
7540
  # -msg_* for osf cc
7348
7541
  -msg_*)
7349
- func_quote_for_eval "$arg"
7350
- arg=$func_quote_for_eval_result
7542
+ func_quote_arg pretty "$arg"
7543
+ arg=$func_quote_arg_result
7351
7544
  ;;
7352
7545
 
7353
7546
  # Flags to be passed through unchanged, with rationale:
@@ -7370,12 +7563,13 @@ func_mode_link ()
7370
7563
  # -fuse-ld=* Linker select flags for GCC
7371
7564
  # -static-* direct GCC to link specific libraries statically
7372
7565
  # -fcilkplus Cilk Plus language extension features for C/C++
7566
+ # -Wa,* Pass flags directly to the assembler
7373
7567
  -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7374
7568
  -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7375
7569
  -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7376
- -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
7377
- func_quote_for_eval "$arg"
7378
- arg=$func_quote_for_eval_result
7570
+ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus|-Wa,*)
7571
+ func_quote_arg pretty "$arg"
7572
+ arg=$func_quote_arg_result
7379
7573
  func_append compile_command " $arg"
7380
7574
  func_append finalize_command " $arg"
7381
7575
  func_append compiler_flags " $arg"
@@ -7396,15 +7590,15 @@ func_mode_link ()
7396
7590
  continue
7397
7591
  else
7398
7592
  # Otherwise treat like 'Some other compiler flag' below
7399
- func_quote_for_eval "$arg"
7400
- arg=$func_quote_for_eval_result
7593
+ func_quote_arg pretty "$arg"
7594
+ arg=$func_quote_arg_result
7401
7595
  fi
7402
7596
  ;;
7403
7597
 
7404
7598
  # Some other compiler flag.
7405
7599
  -* | +*)
7406
- func_quote_for_eval "$arg"
7407
- arg=$func_quote_for_eval_result
7600
+ func_quote_arg pretty "$arg"
7601
+ arg=$func_quote_arg_result
7408
7602
  ;;
7409
7603
 
7410
7604
  *.$objext)
@@ -7524,8 +7718,8 @@ func_mode_link ()
7524
7718
  *)
7525
7719
  # Unknown arguments in both finalize_command and compile_command need
7526
7720
  # to be aesthetically quoted because they are evaled later.
7527
- func_quote_for_eval "$arg"
7528
- arg=$func_quote_for_eval_result
7721
+ func_quote_arg pretty "$arg"
7722
+ arg=$func_quote_arg_result
7529
7723
  ;;
7530
7724
  esac # arg
7531
7725
 
@@ -8733,7 +8927,7 @@ func_mode_link ()
8733
8927
  test CXX = "$tagname" && {
8734
8928
  case $host_os in
8735
8929
  linux*)
8736
- case `$CC -V 2>&1 | sed 5q` in
8930
+ case `$CC -V 2>&1 | $SED 5q` in
8737
8931
  *Sun\ C*) # Sun C++ 5.9
8738
8932
  func_suncc_cstd_abi
8739
8933
 
@@ -8906,7 +9100,7 @@ func_mode_link ()
8906
9100
  #
8907
9101
  case $version_type in
8908
9102
  # correct linux to gnu/linux during the next big refactor
8909
- darwin|freebsd-elf|linux|osf|windows|none)
9103
+ darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none)
8910
9104
  func_arith $number_major + $number_minor
8911
9105
  current=$func_arith_result
8912
9106
  age=$number_minor
@@ -9000,7 +9194,7 @@ func_mode_link ()
9000
9194
  versuffix=.$current.$revision
9001
9195
  ;;
9002
9196
 
9003
- freebsd-elf)
9197
+ freebsd-elf | midnightbsd-elf)
9004
9198
  func_arith $current - $age
9005
9199
  major=.$func_arith_result
9006
9200
  versuffix=$major.$age.$revision
@@ -9226,7 +9420,7 @@ func_mode_link ()
9226
9420
  *-*-netbsd*)
9227
9421
  # Don't link with libc until the a.out ld.so is fixed.
9228
9422
  ;;
9229
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9423
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
9230
9424
  # Do not include libc due to us having libc/libc_r.
9231
9425
  ;;
9232
9426
  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -10037,8 +10231,8 @@ EOF
10037
10231
  for cmd in $concat_cmds; do
10038
10232
  IFS=$save_ifs
10039
10233
  $opt_quiet || {
10040
- func_quote_for_expand "$cmd"
10041
- eval "func_echo $func_quote_for_expand_result"
10234
+ func_quote_arg expand,pretty "$cmd"
10235
+ eval "func_echo $func_quote_arg_result"
10042
10236
  }
10043
10237
  $opt_dry_run || eval "$cmd" || {
10044
10238
  lt_exit=$?
@@ -10131,8 +10325,8 @@ EOF
10131
10325
  eval cmd=\"$cmd\"
10132
10326
  IFS=$save_ifs
10133
10327
  $opt_quiet || {
10134
- func_quote_for_expand "$cmd"
10135
- eval "func_echo $func_quote_for_expand_result"
10328
+ func_quote_arg expand,pretty "$cmd"
10329
+ eval "func_echo $func_quote_arg_result"
10136
10330
  }
10137
10331
  $opt_dry_run || eval "$cmd" || {
10138
10332
  lt_exit=$?
@@ -10606,12 +10800,13 @@ EOF
10606
10800
  elif eval var_value=\$$var; test -z "$var_value"; then
10607
10801
  relink_command="$var=; export $var; $relink_command"
10608
10802
  else
10609
- func_quote_for_eval "$var_value"
10610
- relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
10803
+ func_quote_arg pretty "$var_value"
10804
+ relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
10611
10805
  fi
10612
10806
  done
10613
- relink_command="(cd `pwd`; $relink_command)"
10614
- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
10807
+ func_quote eval cd "`pwd`"
10808
+ func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
10809
+ relink_command=$func_quote_arg_unquoted_result
10615
10810
  fi
10616
10811
 
10617
10812
  # Only actually do things if not in dry run mode.
@@ -10851,13 +11046,15 @@ EOF
10851
11046
  elif eval var_value=\$$var; test -z "$var_value"; then
10852
11047
  relink_command="$var=; export $var; $relink_command"
10853
11048
  else
10854
- func_quote_for_eval "$var_value"
10855
- relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
11049
+ func_quote_arg pretty,unquoted "$var_value"
11050
+ relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
10856
11051
  fi
10857
11052
  done
10858
11053
  # Quote the link command for shipping.
10859
- relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10860
- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
11054
+ func_quote eval cd "`pwd`"
11055
+ relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
11056
+ func_quote_arg pretty,unquoted "$relink_command"
11057
+ relink_command=$func_quote_arg_unquoted_result
10861
11058
  if test yes = "$hardcode_automatic"; then
10862
11059
  relink_command=
10863
11060
  fi