ffi 1.9.24 → 1.16.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (457) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/CHANGELOG.md +348 -0
  4. data/Gemfile +4 -5
  5. data/README.md +44 -17
  6. data/Rakefile +74 -148
  7. data/ext/ffi_c/AbstractMemory.c +89 -70
  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 +90 -38
  12. data/ext/ffi_c/Call.c +55 -56
  13. data/ext/ffi_c/Call.h +12 -6
  14. data/ext/ffi_c/ClosurePool.c +333 -0
  15. data/ext/ffi_c/{Closure.h → ClosurePool.h} +25 -13
  16. data/ext/ffi_c/DynamicLibrary.c +91 -33
  17. data/ext/ffi_c/Function.c +306 -235
  18. data/ext/ffi_c/Function.h +3 -5
  19. data/ext/ffi_c/FunctionInfo.c +87 -32
  20. data/ext/ffi_c/LastError.c +74 -15
  21. data/ext/ffi_c/LongDouble.c +12 -10
  22. data/ext/ffi_c/LongDouble.h +0 -4
  23. data/ext/ffi_c/MappedType.c +66 -23
  24. data/ext/ffi_c/MappedType.h +0 -2
  25. data/ext/ffi_c/MemoryPointer.c +37 -15
  26. data/ext/ffi_c/MemoryPointer.h +0 -4
  27. data/ext/ffi_c/MethodHandle.c +265 -38
  28. data/ext/ffi_c/MethodHandle.h +3 -2
  29. data/ext/ffi_c/Platform.c +5 -56
  30. data/ext/ffi_c/Pointer.c +93 -55
  31. data/ext/ffi_c/Pointer.h +1 -4
  32. data/ext/ffi_c/Struct.c +202 -134
  33. data/ext/ffi_c/Struct.h +18 -9
  34. data/ext/ffi_c/StructByValue.c +50 -23
  35. data/ext/ffi_c/StructLayout.c +135 -64
  36. data/ext/ffi_c/Thread.c +4 -228
  37. data/ext/ffi_c/Thread.h +1 -20
  38. data/ext/ffi_c/Type.c +105 -55
  39. data/ext/ffi_c/Type.h +3 -2
  40. data/ext/ffi_c/Types.c +8 -9
  41. data/ext/ffi_c/Types.h +3 -4
  42. data/ext/ffi_c/Variadic.c +88 -47
  43. data/ext/ffi_c/compat.h +26 -22
  44. data/ext/ffi_c/extconf.rb +75 -32
  45. data/ext/ffi_c/ffi.c +9 -10
  46. data/ext/ffi_c/libffi/.appveyor/site.exp +16 -0
  47. data/ext/ffi_c/libffi/.appveyor/unix-noexec.exp +7 -0
  48. data/ext/ffi_c/libffi/.appveyor.yml +53 -19
  49. data/ext/ffi_c/libffi/.ci/bfin-sim.exp +58 -0
  50. data/ext/ffi_c/libffi/.ci/build-cross-in-container.sh +18 -0
  51. data/ext/ffi_c/libffi/.ci/build-in-container.sh +10 -0
  52. data/ext/ffi_c/libffi/.ci/build.sh +124 -0
  53. data/ext/ffi_c/libffi/.ci/install.sh +78 -0
  54. data/ext/ffi_c/libffi/.ci/m32r-sim.exp +58 -0
  55. data/ext/ffi_c/libffi/{.travis → .ci}/moxie-sim.exp +1 -1
  56. data/ext/ffi_c/libffi/.ci/msvs-detect +1103 -0
  57. data/ext/ffi_c/libffi/.ci/or1k-sim.exp +58 -0
  58. data/ext/ffi_c/libffi/.ci/powerpc-eabisim.exp +58 -0
  59. data/ext/ffi_c/libffi/.ci/site.exp +29 -0
  60. data/ext/ffi_c/libffi/.ci/wine-sim.exp +55 -0
  61. data/ext/ffi_c/libffi/.circleci/config.yml +156 -0
  62. data/ext/ffi_c/libffi/.gitattributes +4 -0
  63. data/ext/ffi_c/libffi/.github/workflows/build.yml +460 -0
  64. data/ext/ffi_c/libffi/.github/workflows/emscripten.yml +171 -0
  65. data/ext/ffi_c/libffi/.gitignore +10 -2
  66. data/ext/ffi_c/libffi/{ChangeLog.libffi-3.1 → ChangeLog.old} +1407 -0
  67. data/ext/ffi_c/libffi/LICENSE +1 -1
  68. data/ext/ffi_c/libffi/LICENSE-BUILDTOOLS +5 -4
  69. data/ext/ffi_c/libffi/Makefile.am +64 -73
  70. data/ext/ffi_c/libffi/Makefile.in +553 -235
  71. data/ext/ffi_c/libffi/README.md +165 -100
  72. data/ext/ffi_c/libffi/acinclude.m4 +10 -112
  73. data/ext/ffi_c/libffi/compile +348 -0
  74. data/ext/ffi_c/libffi/config.guess +950 -662
  75. data/ext/ffi_c/libffi/config.sub +1362 -1306
  76. data/ext/ffi_c/libffi/configure +4909 -4096
  77. data/ext/ffi_c/libffi/configure.ac +93 -32
  78. data/ext/ffi_c/libffi/configure.host +76 -28
  79. data/ext/ffi_c/libffi/doc/Makefile.in +15 -8
  80. data/ext/ffi_c/libffi/doc/libffi.texi +107 -46
  81. data/ext/ffi_c/libffi/doc/version.texi +4 -4
  82. data/ext/ffi_c/libffi/fficonfig.h.in +22 -44
  83. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +165 -56
  84. data/ext/ffi_c/libffi/include/Makefile.am +1 -1
  85. data/ext/ffi_c/libffi/include/Makefile.in +17 -12
  86. data/ext/ffi_c/libffi/include/ffi.h.in +64 -48
  87. data/ext/ffi_c/libffi/include/ffi_cfi.h +21 -0
  88. data/ext/ffi_c/libffi/include/ffi_common.h +34 -1
  89. data/ext/ffi_c/libffi/include/tramp.h +45 -0
  90. data/ext/ffi_c/libffi/install-sh +107 -74
  91. data/ext/ffi_c/libffi/libffi.map.in +8 -12
  92. data/ext/ffi_c/libffi/libffi.xcodeproj/project.pbxproj +2 -48
  93. data/ext/ffi_c/libffi/libtool-version +2 -2
  94. data/ext/ffi_c/libffi/ltmain.sh +576 -284
  95. data/ext/ffi_c/libffi/m4/asmcfi.m4 +1 -1
  96. data/ext/ffi_c/libffi/m4/ax_append_flag.m4 +5 -26
  97. data/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 +18 -14
  98. data/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 +108 -72
  99. data/ext/ffi_c/libffi/m4/ax_check_compile_flag.m4 +5 -26
  100. data/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 +76 -44
  101. data/ext/ffi_c/libffi/m4/ax_configure_args.m4 +5 -26
  102. data/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 +7 -3
  103. data/ext/ffi_c/libffi/m4/ax_prepend_flag.m4 +51 -0
  104. data/ext/ffi_c/libffi/make_sunver.pl +333 -0
  105. data/ext/ffi_c/libffi/man/Makefile.in +15 -8
  106. data/ext/ffi_c/libffi/missing +8 -8
  107. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.sln +33 -0
  108. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj +130 -0
  109. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters +57 -0
  110. data/ext/ffi_c/libffi/msvc_build/aarch64/Ffi_staticLib.vcxproj.user +4 -0
  111. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/ffi.h +511 -0
  112. data/ext/ffi_c/libffi/msvc_build/aarch64/aarch64_include/fficonfig.h +219 -0
  113. data/ext/ffi_c/libffi/msvcc.sh +39 -14
  114. data/ext/ffi_c/libffi/src/aarch64/ffi.c +286 -98
  115. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +19 -3
  116. data/ext/ffi_c/libffi/src/aarch64/internal.h +33 -0
  117. data/ext/ffi_c/libffi/src/aarch64/sysv.S +142 -37
  118. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +506 -0
  119. data/ext/ffi_c/libffi/src/arc/arcompact.S +169 -94
  120. data/ext/ffi_c/libffi/src/arc/ffi.c +325 -148
  121. data/ext/ffi_c/libffi/src/arc/ffitarget.h +14 -0
  122. data/ext/ffi_c/libffi/src/arm/ffi.c +112 -10
  123. data/ext/ffi_c/libffi/src/arm/ffitarget.h +8 -1
  124. data/ext/ffi_c/libffi/src/arm/internal.h +10 -0
  125. data/ext/ffi_c/libffi/src/arm/sysv.S +117 -44
  126. data/ext/ffi_c/libffi/src/arm/sysv_msvc_arm32.S +311 -0
  127. data/ext/ffi_c/libffi/src/closures.c +189 -48
  128. data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
  129. data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
  130. data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
  131. data/ext/ffi_c/libffi/src/dlmalloc.c +6 -1
  132. data/ext/ffi_c/libffi/src/frv/ffi.c +1 -1
  133. data/ext/ffi_c/libffi/src/ia64/ffi.c +12 -0
  134. data/ext/ffi_c/libffi/src/ia64/unix.S +20 -2
  135. data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
  136. data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
  137. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
  138. data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
  139. data/ext/ffi_c/libffi/src/loongarch64/ffi.c +621 -0
  140. data/ext/ffi_c/libffi/src/loongarch64/ffitarget.h +82 -0
  141. data/ext/ffi_c/libffi/src/loongarch64/sysv.S +327 -0
  142. data/ext/ffi_c/libffi/src/m32r/ffi.c +31 -14
  143. data/ext/ffi_c/libffi/src/metag/ffi.c +1 -1
  144. data/ext/ffi_c/libffi/src/mips/ffi.c +245 -66
  145. data/ext/ffi_c/libffi/src/mips/ffitarget.h +8 -1
  146. data/ext/ffi_c/libffi/src/mips/n32.S +137 -28
  147. data/ext/ffi_c/libffi/src/mips/o32.S +63 -4
  148. data/ext/ffi_c/libffi/src/moxie/ffi.c +48 -23
  149. data/ext/ffi_c/libffi/src/or1k/ffi.c +25 -12
  150. data/ext/ffi_c/libffi/src/pa/ffi.c +62 -108
  151. data/ext/ffi_c/libffi/src/pa/ffi64.c +614 -0
  152. data/ext/ffi_c/libffi/src/pa/ffitarget.h +20 -11
  153. data/ext/ffi_c/libffi/src/pa/hpux32.S +87 -38
  154. data/ext/ffi_c/libffi/src/pa/hpux64.S +681 -0
  155. data/ext/ffi_c/libffi/src/pa/linux.S +109 -39
  156. data/ext/ffi_c/libffi/src/powerpc/ffi.c +6 -4
  157. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
  158. data/ext/ffi_c/libffi/src/powerpc/ffi_linux64.c +211 -32
  159. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +18 -7
  160. data/ext/ffi_c/libffi/src/powerpc/ffitarget.h +10 -4
  161. data/ext/ffi_c/libffi/src/powerpc/linux64.S +93 -28
  162. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +83 -5
  163. data/ext/ffi_c/libffi/src/powerpc/sysv.S +5 -7
  164. data/ext/ffi_c/libffi/src/powerpc/t-aix +5 -0
  165. data/ext/ffi_c/libffi/src/prep_cif.c +26 -4
  166. data/ext/ffi_c/libffi/src/riscv/ffi.c +79 -10
  167. data/ext/ffi_c/libffi/src/riscv/ffitarget.h +1 -0
  168. data/ext/ffi_c/libffi/src/riscv/sysv.S +86 -7
  169. data/ext/ffi_c/libffi/src/sparc/ffi64.c +16 -0
  170. data/ext/ffi_c/libffi/src/tramp.c +716 -0
  171. data/ext/ffi_c/libffi/src/wasm32/ffi.c +934 -0
  172. data/ext/ffi_c/libffi/src/wasm32/ffitarget.h +62 -0
  173. data/ext/ffi_c/libffi/src/x86/ffi.c +128 -49
  174. data/ext/ffi_c/libffi/src/x86/ffi64.c +89 -23
  175. data/ext/ffi_c/libffi/src/x86/ffitarget.h +21 -4
  176. data/ext/ffi_c/libffi/src/x86/ffiw64.c +63 -10
  177. data/ext/ffi_c/libffi/src/x86/internal.h +14 -0
  178. data/ext/ffi_c/libffi/src/x86/internal64.h +14 -0
  179. data/ext/ffi_c/libffi/src/x86/sysv.S +274 -45
  180. data/ext/ffi_c/libffi/src/x86/sysv_intel.S +998 -0
  181. data/ext/ffi_c/libffi/src/x86/unix64.S +190 -4
  182. data/ext/ffi_c/libffi/src/x86/win64.S +32 -10
  183. data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
  184. data/ext/ffi_c/libffi/src/xtensa/ffi.c +16 -8
  185. data/ext/ffi_c/libffi/src/xtensa/ffitarget.h +4 -0
  186. data/ext/ffi_c/libffi/src/xtensa/sysv.S +26 -16
  187. data/ext/ffi_c/libffi/testsuite/Makefile.am +127 -109
  188. data/ext/ffi_c/libffi/testsuite/Makefile.in +144 -88
  189. data/ext/ffi_c/libffi/testsuite/emscripten/build-tests.sh +54 -0
  190. data/ext/ffi_c/libffi/testsuite/emscripten/build.sh +63 -0
  191. data/ext/ffi_c/libffi/testsuite/emscripten/conftest.py +80 -0
  192. data/ext/ffi_c/libffi/testsuite/emscripten/node-tests.sh +48 -0
  193. data/ext/ffi_c/libffi/testsuite/emscripten/test.html +7 -0
  194. data/ext/ffi_c/libffi/testsuite/emscripten/test_libffi.py +51 -0
  195. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +71 -25
  196. data/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp +2 -2
  197. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/bhaible.exp +7 -2
  198. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +5 -4
  199. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
  200. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/testcases.c +5 -1
  201. data/ext/ffi_c/libffi/testsuite/libffi.call/bpo_38748.c +41 -0
  202. data/ext/ffi_c/libffi/testsuite/libffi.call/call.exp +12 -1
  203. data/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h +28 -3
  204. data/ext/ffi_c/libffi/testsuite/libffi.call/float2.c +9 -8
  205. data/ext/ffi_c/libffi/testsuite/libffi.call/float_va.c +3 -0
  206. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c +5 -0
  207. data/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c +4 -0
  208. data/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c +4 -0
  209. data/ext/ffi_c/libffi/testsuite/libffi.call/s55.c +60 -0
  210. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c +8 -9
  211. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen2.c +2 -2
  212. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen3.c +2 -2
  213. data/ext/ffi_c/libffi/testsuite/libffi.call/strlen4.c +2 -2
  214. data/ext/ffi_c/libffi/testsuite/libffi.call/struct10.c +1 -1
  215. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_2.c +63 -0
  216. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3.c +65 -0
  217. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_3f.c +65 -0
  218. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4.c +67 -0
  219. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_4f.c +67 -0
  220. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_big.c +93 -0
  221. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_by_value_small.c +61 -0
  222. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_2H.c +63 -0
  223. data/ext/ffi_c/libffi/testsuite/libffi.call/struct_return_8H.c +90 -0
  224. data/ext/ffi_c/libffi/testsuite/libffi.call/va_1.c +1 -119
  225. data/ext/ffi_c/libffi/testsuite/libffi.call/va_2.c +220 -0
  226. data/ext/ffi_c/libffi/testsuite/libffi.call/va_3.c +154 -0
  227. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct1.c +13 -0
  228. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct2.c +11 -0
  229. data/ext/ffi_c/libffi/testsuite/libffi.call/va_struct3.c +15 -0
  230. data/ext/ffi_c/libffi/testsuite/libffi.closures/closure.exp +67 -0
  231. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn0.c +3 -2
  232. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn1.c +2 -0
  233. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn2.c +2 -0
  234. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn3.c +21 -1
  235. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn4.c +2 -0
  236. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn5.c +2 -0
  237. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_fn6.c +2 -0
  238. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_loc_fn0.c +7 -6
  239. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/closure_simple.c +6 -0
  240. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_12byte.c +18 -0
  241. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_16byte.c +22 -0
  242. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_18byte.c +24 -0
  243. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_19byte.c +29 -0
  244. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_1_1byte.c +4 -0
  245. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte.c +19 -1
  246. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_20byte1.c +21 -1
  247. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_24byte.c +35 -3
  248. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_2byte.c +13 -0
  249. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3_1byte.c +19 -0
  250. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte1.c +13 -0
  251. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3byte2.c +13 -0
  252. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_3float.c +18 -0
  253. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4_1byte.c +22 -0
  254. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_4byte.c +13 -0
  255. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5_1_byte.c +29 -1
  256. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_5byte.c +19 -1
  257. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_64byte.c +24 -0
  258. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6_1_byte.c +28 -1
  259. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_6byte.c +24 -2
  260. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7_1_byte.c +39 -1
  261. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_7byte.c +25 -1
  262. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_8byte.c +14 -0
  263. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte1.c +14 -1
  264. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_9byte2.c +14 -2
  265. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_double.c +19 -1
  266. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_float.c +19 -1
  267. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble.c +20 -1
  268. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split.c +40 -25
  269. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_longdouble_split2.c +40 -3
  270. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_pointer.c +19 -1
  271. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint16.c +18 -1
  272. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint32.c +18 -3
  273. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_sint64.c +18 -1
  274. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint16.c +18 -1
  275. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint32.c +19 -1
  276. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_align_uint64.c +19 -1
  277. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_dbls_struct.c +3 -1
  278. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double_va.c +9 -1
  279. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_float.c +4 -0
  280. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble.c +11 -1
  281. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_longdouble_va.c +22 -3
  282. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_schar.c +5 -1
  283. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshort.c +6 -1
  284. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_sshortchar.c +9 -1
  285. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_uchar.c +9 -1
  286. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushort.c +6 -2
  287. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_multi_ushortchar.c +9 -1
  288. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer.c +5 -0
  289. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_pointer_stack.c +10 -0
  290. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_schar.c +3 -0
  291. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sint.c +2 -0
  292. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_sshort.c +3 -0
  293. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_struct_va1.c +11 -0
  294. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uchar.c +3 -0
  295. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint.c +4 -0
  296. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_uint_va.c +4 -0
  297. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulong_va.c +4 -0
  298. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ulonglong.c +2 -0
  299. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_ushort.c +3 -0
  300. data/ext/ffi_c/libffi/testsuite/libffi.closures/ffitest.h +1 -0
  301. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/huge_struct.c +24 -22
  302. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct.c +32 -9
  303. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct1.c +1 -1
  304. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct10.c +12 -0
  305. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct11.c +21 -5
  306. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct12.c +86 -0
  307. data/ext/ffi_c/libffi/testsuite/libffi.closures/nested_struct13.c +115 -0
  308. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct2.c +10 -1
  309. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct3.c +10 -1
  310. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct4.c +9 -0
  311. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct5.c +9 -0
  312. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct6.c +11 -0
  313. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct7.c +9 -0
  314. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct8.c +11 -0
  315. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/nested_struct9.c +11 -0
  316. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs1.c +86 -0
  317. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs2.c +102 -0
  318. data/ext/ffi_c/libffi/testsuite/libffi.closures/single_entry_structs3.c +101 -0
  319. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium.c +1 -1
  320. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_medium2.c +1 -1
  321. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/testclosure.c +6 -1
  322. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest.cc +2 -1
  323. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/unwindtest_ffi_call.cc +1 -0
  324. data/ext/ffi_c/libffi.bsd.mk +2 -2
  325. data/ext/ffi_c/libffi.darwin.mk +1 -1
  326. data/ext/ffi_c/libffi.gnu.mk +2 -2
  327. data/ext/ffi_c/rbffi.h +1 -3
  328. data/ffi.gemspec +15 -9
  329. data/lib/ffi/abstract_memory.rb +44 -0
  330. data/lib/ffi/autopointer.rb +8 -23
  331. data/lib/ffi/compat.rb +43 -0
  332. data/lib/ffi/data_converter.rb +67 -0
  333. data/lib/ffi/dynamic_library.rb +89 -0
  334. data/lib/ffi/enum.rb +18 -11
  335. data/lib/ffi/ffi.rb +6 -0
  336. data/lib/ffi/function.rb +71 -0
  337. data/lib/ffi/io.rb +3 -3
  338. data/lib/ffi/library.rb +65 -77
  339. data/lib/ffi/library_path.rb +109 -0
  340. data/lib/ffi/managedstruct.rb +3 -3
  341. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  342. data/lib/ffi/platform/aarch64-freebsd/types.conf +128 -0
  343. data/lib/ffi/platform/aarch64-freebsd12/types.conf +181 -0
  344. data/lib/ffi/platform/aarch64-linux/types.conf +81 -81
  345. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  346. data/lib/ffi/platform/aarch64-windows/types.conf +52 -0
  347. data/lib/ffi/platform/arm-freebsd/types.conf +152 -0
  348. data/lib/ffi/platform/arm-freebsd12/types.conf +152 -0
  349. data/lib/ffi/platform/arm-linux/types.conf +110 -82
  350. data/lib/ffi/platform/hppa1.1-linux/types.conf +178 -0
  351. data/lib/ffi/platform/hppa2.0-linux/types.conf +178 -0
  352. data/lib/ffi/platform/i386-cygwin/types.conf +1 -1
  353. data/lib/ffi/platform/i386-darwin/types.conf +63 -63
  354. data/lib/ffi/platform/i386-freebsd/types.conf +89 -89
  355. data/lib/ffi/platform/i386-freebsd12/types.conf +152 -0
  356. data/lib/ffi/platform/i386-gnu/types.conf +84 -84
  357. data/lib/ffi/platform/i386-linux/types.conf +77 -77
  358. data/lib/ffi/platform/i386-netbsd/types.conf +87 -87
  359. data/lib/ffi/platform/i386-openbsd/types.conf +89 -89
  360. data/lib/ffi/platform/i386-solaris/types.conf +96 -96
  361. data/lib/ffi/platform/i386-windows/types.conf +43 -96
  362. data/lib/ffi/platform/ia64-linux/types.conf +79 -79
  363. data/lib/ffi/platform/loongarch64-linux/types.conf +141 -0
  364. data/lib/ffi/platform/mips-linux/types.conf +79 -79
  365. data/lib/ffi/platform/mips64-linux/types.conf +81 -81
  366. data/lib/ffi/platform/mips64el-linux/types.conf +81 -81
  367. data/lib/ffi/platform/mipsel-linux/types.conf +79 -79
  368. data/lib/ffi/platform/mipsisa32r6-linux/types.conf +79 -79
  369. data/lib/ffi/platform/mipsisa32r6el-linux/types.conf +79 -79
  370. data/lib/ffi/platform/mipsisa64r6-linux/types.conf +81 -81
  371. data/lib/ffi/platform/mipsisa64r6el-linux/types.conf +81 -81
  372. data/lib/ffi/platform/powerpc-aix/types.conf +155 -155
  373. data/lib/ffi/platform/powerpc-darwin/types.conf +63 -63
  374. data/lib/ffi/platform/powerpc-linux/types.conf +108 -78
  375. data/lib/ffi/platform/powerpc-openbsd/types.conf +156 -0
  376. data/lib/ffi/platform/powerpc64-linux/types.conf +81 -81
  377. data/lib/ffi/platform/powerpc64le-linux/types.conf +100 -0
  378. data/lib/ffi/platform/riscv64-linux/types.conf +104 -0
  379. data/lib/ffi/platform/s390-linux/types.conf +79 -79
  380. data/lib/ffi/platform/s390x-linux/types.conf +79 -79
  381. data/lib/ffi/platform/sparc-linux/types.conf +79 -79
  382. data/lib/ffi/platform/sparc-solaris/types.conf +103 -103
  383. data/lib/ffi/platform/sparcv9-openbsd/types.conf +156 -0
  384. data/lib/ffi/platform/sparcv9-solaris/types.conf +103 -103
  385. data/lib/ffi/platform/sw_64-linux/types.conf +141 -0
  386. data/lib/ffi/platform/x86_64-cygwin/types.conf +1 -1
  387. data/lib/ffi/platform/x86_64-darwin/types.conf +88 -84
  388. data/lib/ffi/platform/x86_64-dragonflybsd/types.conf +130 -0
  389. data/lib/ffi/platform/x86_64-freebsd/types.conf +90 -90
  390. data/lib/ffi/platform/x86_64-freebsd12/types.conf +158 -0
  391. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  392. data/lib/ffi/platform/x86_64-linux/types.conf +107 -77
  393. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  394. data/lib/ffi/platform/x86_64-netbsd/types.conf +89 -89
  395. data/lib/ffi/platform/x86_64-openbsd/types.conf +86 -86
  396. data/lib/ffi/platform/x86_64-solaris/types.conf +96 -96
  397. data/lib/ffi/platform/x86_64-windows/types.conf +42 -110
  398. data/lib/ffi/platform.rb +43 -20
  399. data/lib/ffi/pointer.rb +26 -20
  400. data/lib/ffi/struct.rb +14 -68
  401. data/lib/ffi/struct_by_reference.rb +72 -0
  402. data/lib/ffi/struct_layout.rb +96 -0
  403. data/lib/ffi/struct_layout_builder.rb +1 -1
  404. data/lib/ffi/tools/const_generator.rb +11 -8
  405. data/lib/ffi/tools/generator.rb +47 -2
  406. data/lib/ffi/tools/generator_task.rb +13 -17
  407. data/lib/ffi/tools/struct_generator.rb +6 -5
  408. data/lib/ffi/tools/types_generator.rb +7 -4
  409. data/lib/ffi/types.rb +33 -7
  410. data/lib/ffi/variadic.rb +20 -18
  411. data/lib/ffi/version.rb +1 -1
  412. data/lib/ffi.rb +10 -3
  413. data/rakelib/ffi_gem_helper.rb +65 -0
  414. data/samples/getlogin.rb +1 -1
  415. data/samples/getpid.rb +1 -1
  416. data/samples/gettimeofday.rb +8 -8
  417. data/samples/hello.rb +2 -1
  418. data/samples/hello_ractor.rb +11 -0
  419. data/samples/inotify.rb +1 -1
  420. data/samples/pty.rb +1 -2
  421. data/samples/qsort.rb +0 -1
  422. data/samples/qsort_ractor.rb +28 -0
  423. data.tar.gz.sig +0 -0
  424. metadata +252 -153
  425. metadata.gz.sig +0 -0
  426. data/.gitignore +0 -22
  427. data/.gitmodules +0 -3
  428. data/.travis.yml +0 -52
  429. data/.yardopts +0 -5
  430. data/appveyor.yml +0 -22
  431. data/ext/ffi_c/Closure.c +0 -54
  432. data/ext/ffi_c/DataConverter.c +0 -91
  433. data/ext/ffi_c/StructByReference.c +0 -190
  434. data/ext/ffi_c/StructByReference.h +0 -50
  435. data/ext/ffi_c/libffi/.travis/build.sh +0 -34
  436. data/ext/ffi_c/libffi/.travis/install.sh +0 -22
  437. data/ext/ffi_c/libffi/.travis/site.exp +0 -18
  438. data/ext/ffi_c/libffi/.travis.yml +0 -34
  439. data/ext/ffi_c/libffi/ChangeLog.libffi +0 -584
  440. data/ext/ffi_c/libffi/ChangeLog.libgcj +0 -40
  441. data/ext/ffi_c/libffi/ChangeLog.v1 +0 -764
  442. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar_va.c +0 -44
  443. data/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort_va.c +0 -44
  444. data/ext/ffi_c/win32/stdbool.h +0 -8
  445. data/ext/ffi_c/win32/stdint.h +0 -201
  446. data/samples/sample_helper.rb +0 -6
  447. data/ext/ffi_c/libffi/{.travis → .ci}/ar-lib +0 -0
  448. data/ext/ffi_c/libffi/{.travis → .ci}/compile +0 -0
  449. data/ext/ffi_c/libffi/testsuite/libffi.call/{pyobjc-tc.c → pyobjc_tc.c} +0 -0
  450. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_double.c +0 -0
  451. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_args.c +0 -0
  452. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/cls_many_mixed_float_double.c +0 -0
  453. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/err_bad_abi.c +0 -0
  454. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/problem1.c +0 -0
  455. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large.c +0 -0
  456. data/ext/ffi_c/libffi/testsuite/{libffi.call → libffi.closures}/stret_large2.c +0 -0
  457. data/lib/ffi/platform/{sparc64-linux → sparcv9-linux}/types.conf +79 -79
@@ -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-2"
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. ##
@@ -387,7 +430,7 @@ EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
387
430
  # putting '$debug_cmd' at the start of all your functions, you can get
388
431
  # bash to show function call trace with:
389
432
  #
390
- # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
433
+ # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
391
434
  debug_cmd=${debug_cmd-":"}
392
435
  exit_cmd=:
393
436
 
@@ -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=2014-01-07.03; # 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.
1386
-
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.
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.
1391
1547
 
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/>.
1548
+ # Please report bugs or propose patches to:
1549
+ # <https://github.com/gnulib-modules/bootstrap/issues>
1394
1550
 
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=2014-01-07.03; # 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=2014-01-07.03; # 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.
@@ -1530,24 +1706,23 @@ func_run_hooks ()
1530
1706
  {
1531
1707
  $debug_cmd
1532
1708
 
1709
+ _G_rc_run_hooks=false
1710
+
1533
1711
  case " $hookable_fns " in
1534
1712
  *" $1 "*) ;;
1535
- *) func_fatal_error "'$1' does not support hook funcions.n" ;;
1713
+ *) func_fatal_error "'$1' does not support hook functions." ;;
1536
1714
  esac
1537
1715
 
1538
1716
  eval _G_hook_fns=\$$1_hooks; shift
1539
1717
 
1540
1718
  for _G_hook in $_G_hook_fns; do
1541
- eval $_G_hook '"$@"'
1542
-
1543
- # store returned options list back into positional
1544
- # parameters for next 'cmd' execution.
1545
- eval _G_hook_result=\$${_G_hook}_result
1546
- eval set dummy "$_G_hook_result"; shift
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
1724
+ fi
1547
1725
  done
1548
-
1549
- func_quote_for_eval ${1+"$@"}
1550
- func_run_hooks_result=$func_quote_for_eval_result
1551
1726
  }
1552
1727
 
1553
1728
 
@@ -1557,10 +1732,18 @@ func_run_hooks ()
1557
1732
  ## --------------- ##
1558
1733
 
1559
1734
  # In order to add your own option parsing hooks, you must accept the
1560
- # full positional parameter list in your hook function, remove any
1561
- # options that you action, and then pass back the remaining unprocessed
1562
- # options in '<hooked_function_name>_result', escaped suitably for
1563
- # 'eval'. Like this:
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).
1745
+ #
1746
+ # Like this:
1564
1747
  #
1565
1748
  # my_options_prep ()
1566
1749
  # {
@@ -1570,9 +1753,8 @@ func_run_hooks ()
1570
1753
  # usage_message=$usage_message'
1571
1754
  # -s, --silent don'\''t print informational messages
1572
1755
  # '
1573
- #
1574
- # func_quote_for_eval ${1+"$@"}
1575
- # my_options_prep_result=$func_quote_for_eval_result
1756
+ # # No change in '$@' (ignored completely by this hook). Leave
1757
+ # # my_options_prep_result variable intact.
1576
1758
  # }
1577
1759
  # func_add_hook func_options_prep my_options_prep
1578
1760
  #
@@ -1581,25 +1763,36 @@ func_run_hooks ()
1581
1763
  # {
1582
1764
  # $debug_cmd
1583
1765
  #
1584
- # # Note that for efficiency, we parse as many options as we can
1766
+ # args_changed=false
1767
+ #
1768
+ # # Note that, for efficiency, we parse as many options as we can
1585
1769
  # # recognise in a loop before passing the remainder back to the
1586
1770
  # # caller on the first unrecognised argument we encounter.
1587
1771
  # while test $# -gt 0; do
1588
1772
  # opt=$1; shift
1589
1773
  # case $opt in
1590
- # --silent|-s) opt_silent=: ;;
1774
+ # --silent|-s) opt_silent=:
1775
+ # args_changed=:
1776
+ # ;;
1591
1777
  # # Separate non-argument short options:
1592
1778
  # -s*) func_split_short_opt "$_G_opt"
1593
1779
  # set dummy "$func_split_short_opt_name" \
1594
1780
  # "-$func_split_short_opt_arg" ${1+"$@"}
1595
1781
  # shift
1782
+ # args_changed=:
1596
1783
  # ;;
1597
- # *) set dummy "$_G_opt" "$*"; shift; break ;;
1784
+ # *) # Make sure the first unrecognised option "$_G_opt"
1785
+ # # is added back to "$@" in case we need it later,
1786
+ # # if $args_changed was set to 'true'.
1787
+ # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1598
1788
  # esac
1599
1789
  # done
1600
1790
  #
1601
- # func_quote_for_eval ${1+"$@"}
1602
- # my_silent_option_result=$func_quote_for_eval_result
1791
+ # # Only call 'func_quote' here if we processed at least one argument.
1792
+ # if $args_changed; then
1793
+ # func_quote eval ${1+"$@"}
1794
+ # my_silent_option_result=$func_quote_result
1795
+ # fi
1603
1796
  # }
1604
1797
  # func_add_hook func_parse_options my_silent_option
1605
1798
  #
@@ -1610,17 +1803,26 @@ func_run_hooks ()
1610
1803
  #
1611
1804
  # $opt_silent && $opt_verbose && func_fatal_help "\
1612
1805
  # '--silent' and '--verbose' options are mutually exclusive."
1613
- #
1614
- # func_quote_for_eval ${1+"$@"}
1615
- # my_option_validation_result=$func_quote_for_eval_result
1616
1806
  # }
1617
1807
  # func_add_hook func_validate_options my_option_validation
1618
1808
  #
1619
- # You'll alse need to manually amend $usage_message to reflect the extra
1809
+ # You'll also need to manually amend $usage_message to reflect the extra
1620
1810
  # options you parse. It's preferable to append if you can, so that
1621
1811
  # multiple option parsing hooks can be added safely.
1622
1812
 
1623
1813
 
1814
+ # func_options_finish [ARG]...
1815
+ # ----------------------------
1816
+ # Finishing the option parse loop (call 'func_options' hooks ATM).
1817
+ func_options_finish ()
1818
+ {
1819
+ $debug_cmd
1820
+
1821
+ func_run_hooks func_options ${1+"$@"}
1822
+ func_propagate_result func_run_hooks func_options_finish
1823
+ }
1824
+
1825
+
1624
1826
  # func_options [ARG]...
1625
1827
  # ---------------------
1626
1828
  # All the functions called inside func_options are hookable. See the
@@ -1630,17 +1832,27 @@ func_options ()
1630
1832
  {
1631
1833
  $debug_cmd
1632
1834
 
1633
- func_options_prep ${1+"$@"}
1634
- eval func_parse_options \
1635
- ${func_options_prep_result+"$func_options_prep_result"}
1636
- eval func_validate_options \
1637
- ${func_parse_options_result+"$func_parse_options_result"}
1835
+ _G_options_quoted=false
1638
1836
 
1639
- eval func_run_hooks func_options \
1640
- ${func_validate_options_result+"$func_validate_options_result"}
1837
+ for my_func in options_prep parse_options validate_options options_finish
1838
+ do
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=:
1846
+ fi
1847
+ done
1641
1848
 
1642
- # save modified positional parameters for caller
1643
- func_options_result=$func_run_hooks_result
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
+ }
1644
1856
  }
1645
1857
 
1646
1858
 
@@ -1649,9 +1861,8 @@ func_options ()
1649
1861
  # All initialisations required before starting the option parse loop.
1650
1862
  # Note that when calling hook functions, we pass through the list of
1651
1863
  # positional parameters. If a hook function modifies that list, and
1652
- # needs to propogate that back to rest of this script, then the complete
1653
- # modified list must be put in 'func_run_hooks_result' before
1654
- # returning.
1864
+ # needs to propagate that back to rest of this script, then the complete
1865
+ # modified list must be put in 'func_run_hooks_result' before returning.
1655
1866
  func_hookable func_options_prep
1656
1867
  func_options_prep ()
1657
1868
  {
@@ -1662,9 +1873,7 @@ func_options_prep ()
1662
1873
  opt_warning_types=
1663
1874
 
1664
1875
  func_run_hooks func_options_prep ${1+"$@"}
1665
-
1666
- # save modified positional parameters for caller
1667
- func_options_prep_result=$func_run_hooks_result
1876
+ func_propagate_result func_run_hooks func_options_prep
1668
1877
  }
1669
1878
 
1670
1879
 
@@ -1676,25 +1885,32 @@ func_parse_options ()
1676
1885
  {
1677
1886
  $debug_cmd
1678
1887
 
1679
- func_parse_options_result=
1680
-
1888
+ _G_parse_options_requote=false
1681
1889
  # this just eases exit handling
1682
1890
  while test $# -gt 0; do
1683
1891
  # Defer to hook functions for initial option parsing, so they
1684
1892
  # get priority in the event of reusing an option name.
1685
1893
  func_run_hooks func_parse_options ${1+"$@"}
1686
-
1687
- # Adjust func_parse_options positional parameters to match
1688
- eval set dummy "$func_run_hooks_result"; shift
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
1901
+ fi
1689
1902
 
1690
1903
  # Break out of the loop if we already parsed every option.
1691
1904
  test $# -gt 0 || break
1692
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.
1908
+ _G_match_parse_options=:
1693
1909
  _G_opt=$1
1694
1910
  shift
1695
1911
  case $_G_opt in
1696
1912
  --debug|-x) debug_cmd='set -x'
1697
- func_echo "enabling shell trace mode"
1913
+ func_echo "enabling shell trace mode" >&2
1698
1914
  $debug_cmd
1699
1915
  ;;
1700
1916
 
@@ -1704,7 +1920,10 @@ func_parse_options ()
1704
1920
  ;;
1705
1921
 
1706
1922
  --warnings|--warning|-W)
1707
- test $# = 0 && func_missing_arg $_G_opt && break
1923
+ if test $# = 0 && func_missing_arg $_G_opt; then
1924
+ _G_parse_options_requote=:
1925
+ break
1926
+ fi
1708
1927
  case " $warning_categories $1" in
1709
1928
  *" $1 "*)
1710
1929
  # trailing space prevents matching last $1 above
@@ -1757,15 +1976,24 @@ func_parse_options ()
1757
1976
  shift
1758
1977
  ;;
1759
1978
 
1760
- --) break ;;
1979
+ --) _G_parse_options_requote=: ; break ;;
1761
1980
  -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
1762
- *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
1981
+ *) set dummy "$_G_opt" ${1+"$@"}; shift
1982
+ _G_match_parse_options=false
1983
+ break
1984
+ ;;
1763
1985
  esac
1986
+
1987
+ if $_G_match_parse_options; then
1988
+ _G_parse_options_requote=:
1989
+ fi
1764
1990
  done
1765
1991
 
1766
- # save modified positional parameters for caller
1767
- func_quote_for_eval ${1+"$@"}
1768
- func_parse_options_result=$func_quote_for_eval_result
1992
+ if $_G_parse_options_requote; then
1993
+ # save modified positional parameters for caller
1994
+ func_quote eval ${1+"$@"}
1995
+ func_parse_options_result=$func_quote_result
1996
+ fi
1769
1997
  }
1770
1998
 
1771
1999
 
@@ -1782,12 +2010,10 @@ func_validate_options ()
1782
2010
  test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
1783
2011
 
1784
2012
  func_run_hooks func_validate_options ${1+"$@"}
2013
+ func_propagate_result func_run_hooks func_validate_options
1785
2014
 
1786
2015
  # Bail if the options were screwed!
1787
2016
  $exit_cmd $EXIT_FAILURE
1788
-
1789
- # save modified positional parameters for caller
1790
- func_validate_options_result=$func_run_hooks_result
1791
2017
  }
1792
2018
 
1793
2019
 
@@ -1843,8 +2069,8 @@ func_missing_arg ()
1843
2069
 
1844
2070
  # func_split_equals STRING
1845
2071
  # ------------------------
1846
- # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
1847
- # 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.
1848
2074
  test -z "$_G_HAVE_XSI_OPS" \
1849
2075
  && (eval 'x=a/b/c;
1850
2076
  test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
@@ -1859,8 +2085,9 @@ then
1859
2085
 
1860
2086
  func_split_equals_lhs=${1%%=*}
1861
2087
  func_split_equals_rhs=${1#*=}
1862
- test "x$func_split_equals_lhs" = "x$1" \
1863
- && func_split_equals_rhs=
2088
+ if test "x$func_split_equals_lhs" = "x$1"; then
2089
+ func_split_equals_rhs=
2090
+ fi
1864
2091
  }'
1865
2092
  else
1866
2093
  # ...otherwise fall back to using expr, which is often a shell builtin.
@@ -1870,7 +2097,7 @@ else
1870
2097
 
1871
2098
  func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
1872
2099
  func_split_equals_rhs=
1873
- test "x$func_split_equals_lhs" = "x$1" \
2100
+ test "x$func_split_equals_lhs=" = "x$1" \
1874
2101
  || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
1875
2102
  }
1876
2103
  fi #func_split_equals
@@ -1896,7 +2123,7 @@ else
1896
2123
  {
1897
2124
  $debug_cmd
1898
2125
 
1899
- func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
2126
+ func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'`
1900
2127
  func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
1901
2128
  }
1902
2129
  fi #func_split_short_opt
@@ -1938,31 +2165,44 @@ func_usage_message ()
1938
2165
  # func_version
1939
2166
  # ------------
1940
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.
1941
2177
  func_version ()
1942
2178
  {
1943
2179
  $debug_cmd
1944
2180
 
1945
2181
  printf '%s\n' "$progname $scriptversion"
1946
2182
  $SED -n '
1947
- /(C)/!b go
1948
- :more
1949
- /\./!{
1950
- N
1951
- s|\n# | |
1952
- b more
1953
- }
1954
- :go
1955
- /^# Written by /,/# warranty; / {
1956
- s|^# ||
1957
- s|^# *$||
1958
- s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
1959
- p
2183
+ /^# Written by /!b
2184
+ s|^# ||; p; n
2185
+
2186
+ :fwd2blnk
2187
+ /./ {
2188
+ n
2189
+ b fwd2blnk
1960
2190
  }
1961
- /^# Written by / {
1962
- s|^# ||
1963
- p
2191
+ p; n
2192
+
2193
+ :holdwrnt
2194
+ s|^# ||
2195
+ s|^# *$||
2196
+ /^Copyright /!{
2197
+ /./H
2198
+ n
2199
+ b holdwrnt
1964
2200
  }
1965
- /^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"
1966
2206
 
1967
2207
  exit $?
1968
2208
  }
@@ -1972,12 +2212,12 @@ func_version ()
1972
2212
  # mode: shell-script
1973
2213
  # sh-indentation: 2
1974
2214
  # eval: (add-hook 'before-save-hook 'time-stamp)
1975
- # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
2215
+ # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
1976
2216
  # time-stamp-time-zone: "UTC"
1977
2217
  # End:
1978
2218
 
1979
2219
  # Set a version string.
1980
- scriptversion='(GNU libtool) 2.4.6'
2220
+ scriptversion='(GNU libtool) 2.4.7'
1981
2221
 
1982
2222
 
1983
2223
  # func_echo ARG...
@@ -2068,7 +2308,7 @@ include the following information:
2068
2308
  compiler: $LTCC
2069
2309
  compiler flags: $LTCFLAGS
2070
2310
  linker: $LD (gnu? $with_gnu_ld)
2071
- version: $progname $scriptversion Debian-2.4.6-2
2311
+ version: $progname $scriptversion Debian-2.4.7-5
2072
2312
  automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2073
2313
  autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2074
2314
 
@@ -2124,7 +2364,7 @@ fi
2124
2364
  # a configuration failure hint, and exit.
2125
2365
  func_fatal_configuration ()
2126
2366
  {
2127
- func__fatal_error ${1+"$@"} \
2367
+ func_fatal_error ${1+"$@"} \
2128
2368
  "See the $PACKAGE documentation for more information." \
2129
2369
  "Fatal configuration error."
2130
2370
  }
@@ -2270,6 +2510,10 @@ libtool_options_prep ()
2270
2510
  nonopt=
2271
2511
  preserve_args=
2272
2512
 
2513
+ _G_rc_lt_options_prep=:
2514
+
2515
+ _G_rc_lt_options_prep=:
2516
+
2273
2517
  # Shorthand for --mode=foo, only valid as the first argument
2274
2518
  case $1 in
2275
2519
  clean|clea|cle|cl)
@@ -2293,11 +2537,16 @@ libtool_options_prep ()
2293
2537
  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
2294
2538
  shift; set dummy --mode uninstall ${1+"$@"}; shift
2295
2539
  ;;
2540
+ *)
2541
+ _G_rc_lt_options_prep=false
2542
+ ;;
2296
2543
  esac
2297
2544
 
2298
- # Pass back the list of options.
2299
- func_quote_for_eval ${1+"$@"}
2300
- libtool_options_prep_result=$func_quote_for_eval_result
2545
+ if $_G_rc_lt_options_prep; then
2546
+ # Pass back the list of options.
2547
+ func_quote eval ${1+"$@"}
2548
+ libtool_options_prep_result=$func_quote_result
2549
+ fi
2301
2550
  }
2302
2551
  func_add_hook func_options_prep libtool_options_prep
2303
2552
 
@@ -2309,9 +2558,12 @@ libtool_parse_options ()
2309
2558
  {
2310
2559
  $debug_cmd
2311
2560
 
2561
+ _G_rc_lt_parse_options=false
2562
+
2312
2563
  # Perform our own loop to consume as many options as possible in
2313
2564
  # each iteration.
2314
2565
  while test $# -gt 0; do
2566
+ _G_match_lt_parse_options=:
2315
2567
  _G_opt=$1
2316
2568
  shift
2317
2569
  case $_G_opt in
@@ -2386,15 +2638,20 @@ libtool_parse_options ()
2386
2638
  func_append preserve_args " $_G_opt"
2387
2639
  ;;
2388
2640
 
2389
- # An option not handled by this hook function:
2390
- *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
2641
+ # An option not handled by this hook function:
2642
+ *) set dummy "$_G_opt" ${1+"$@"} ; shift
2643
+ _G_match_lt_parse_options=false
2644
+ break
2645
+ ;;
2391
2646
  esac
2647
+ $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
2392
2648
  done
2393
2649
 
2394
-
2395
- # save modified positional parameters for caller
2396
- func_quote_for_eval ${1+"$@"}
2397
- libtool_parse_options_result=$func_quote_for_eval_result
2650
+ if $_G_rc_lt_parse_options; then
2651
+ # save modified positional parameters for caller
2652
+ func_quote eval ${1+"$@"}
2653
+ libtool_parse_options_result=$func_quote_result
2654
+ fi
2398
2655
  }
2399
2656
  func_add_hook func_parse_options libtool_parse_options
2400
2657
 
@@ -2451,8 +2708,8 @@ libtool_validate_options ()
2451
2708
  }
2452
2709
 
2453
2710
  # Pass back the unparsed argument list
2454
- func_quote_for_eval ${1+"$@"}
2455
- libtool_validate_options_result=$func_quote_for_eval_result
2711
+ func_quote eval ${1+"$@"}
2712
+ libtool_validate_options_result=$func_quote_result
2456
2713
  }
2457
2714
  func_add_hook func_validate_options libtool_validate_options
2458
2715
 
@@ -3418,8 +3675,8 @@ func_mode_compile ()
3418
3675
  esac
3419
3676
  done
3420
3677
 
3421
- func_quote_for_eval "$libobj"
3422
- test "X$libobj" != "X$func_quote_for_eval_result" \
3678
+ func_quote_arg pretty "$libobj"
3679
+ test "X$libobj" != "X$func_quote_arg_result" \
3423
3680
  && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
3424
3681
  && func_warning "libobj name '$libobj' may not contain shell special characters."
3425
3682
  func_dirname_and_basename "$obj" "/" ""
@@ -3492,8 +3749,8 @@ compiler."
3492
3749
 
3493
3750
  func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
3494
3751
  srcfile=$func_to_tool_file_result
3495
- func_quote_for_eval "$srcfile"
3496
- qsrcfile=$func_quote_for_eval_result
3752
+ func_quote_arg pretty "$srcfile"
3753
+ qsrcfile=$func_quote_arg_result
3497
3754
 
3498
3755
  # Only build a PIC object if we are building libtool libraries.
3499
3756
  if test yes = "$build_libtool_libs"; then
@@ -3648,7 +3905,8 @@ This mode accepts the following additional options:
3648
3905
  -prefer-non-pic try to build non-PIC objects only
3649
3906
  -shared do not build a '.o' file suitable for static linking
3650
3907
  -static only build a '.o' file suitable for static linking
3651
- -Wc,FLAG pass FLAG directly to the compiler
3908
+ -Wc,FLAG
3909
+ -Xcompiler FLAG pass FLAG directly to the compiler
3652
3910
 
3653
3911
  COMPILE-COMMAND is a command to be used in creating a 'standard' object file
3654
3912
  from the given SOURCEFILE.
@@ -3754,6 +4012,8 @@ The following components of LINK-COMMAND are treated specially:
3754
4012
  -weak LIBNAME declare that the target provides the LIBNAME interface
3755
4013
  -Wc,FLAG
3756
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
3757
4017
  -Wl,FLAG
3758
4018
  -Xlinker FLAG pass linker-specific FLAG directly to the linker
3759
4019
  -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
@@ -4096,8 +4356,8 @@ func_mode_install ()
4096
4356
  case $nonopt in *shtool*) :;; *) false;; esac
4097
4357
  then
4098
4358
  # Aesthetically quote it.
4099
- func_quote_for_eval "$nonopt"
4100
- install_prog="$func_quote_for_eval_result "
4359
+ func_quote_arg pretty "$nonopt"
4360
+ install_prog="$func_quote_arg_result "
4101
4361
  arg=$1
4102
4362
  shift
4103
4363
  else
@@ -4107,8 +4367,8 @@ func_mode_install ()
4107
4367
 
4108
4368
  # The real first argument should be the name of the installation program.
4109
4369
  # Aesthetically quote it.
4110
- func_quote_for_eval "$arg"
4111
- func_append install_prog "$func_quote_for_eval_result"
4370
+ func_quote_arg pretty "$arg"
4371
+ func_append install_prog "$func_quote_arg_result"
4112
4372
  install_shared_prog=$install_prog
4113
4373
  case " $install_prog " in
4114
4374
  *[\\\ /]cp\ *) install_cp=: ;;
@@ -4165,12 +4425,12 @@ func_mode_install ()
4165
4425
  esac
4166
4426
 
4167
4427
  # Aesthetically quote the argument.
4168
- func_quote_for_eval "$arg"
4169
- func_append install_prog " $func_quote_for_eval_result"
4428
+ func_quote_arg pretty "$arg"
4429
+ func_append install_prog " $func_quote_arg_result"
4170
4430
  if test -n "$arg2"; then
4171
- func_quote_for_eval "$arg2"
4431
+ func_quote_arg pretty "$arg2"
4172
4432
  fi
4173
- func_append install_shared_prog " $func_quote_for_eval_result"
4433
+ func_append install_shared_prog " $func_quote_arg_result"
4174
4434
  done
4175
4435
 
4176
4436
  test -z "$install_prog" && \
@@ -4181,8 +4441,8 @@ func_mode_install ()
4181
4441
 
4182
4442
  if test -n "$install_override_mode" && $no_mode; then
4183
4443
  if $install_cp; then :; else
4184
- func_quote_for_eval "$install_override_mode"
4185
- 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"
4186
4446
  fi
4187
4447
  fi
4188
4448
 
@@ -4478,8 +4738,8 @@ func_mode_install ()
4478
4738
  relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
4479
4739
 
4480
4740
  $opt_quiet || {
4481
- func_quote_for_expand "$relink_command"
4482
- eval "func_echo $func_quote_for_expand_result"
4741
+ func_quote_arg expand,pretty "$relink_command"
4742
+ eval "func_echo $func_quote_arg_result"
4483
4743
  }
4484
4744
  if eval "$relink_command"; then :
4485
4745
  else
@@ -5258,7 +5518,8 @@ else
5258
5518
  if test \"\$libtool_execute_magic\" != \"$magic\"; then
5259
5519
  file=\"\$0\""
5260
5520
 
5261
- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
5521
+ func_quote_arg pretty "$ECHO"
5522
+ qECHO=$func_quote_arg_result
5262
5523
  $ECHO "\
5263
5524
 
5264
5525
  # A function that is used when there is no print builtin or printf.
@@ -5268,7 +5529,7 @@ func_fallback_echo ()
5268
5529
  \$1
5269
5530
  _LTECHO_EOF'
5270
5531
  }
5271
- ECHO=\"$qECHO\"
5532
+ ECHO=$qECHO
5272
5533
  fi
5273
5534
 
5274
5535
  # Very basic option parsing. These options are (a) specific to
@@ -6611,9 +6872,9 @@ func_mode_link ()
6611
6872
  while test "$#" -gt 0; do
6612
6873
  arg=$1
6613
6874
  shift
6614
- func_quote_for_eval "$arg"
6615
- qarg=$func_quote_for_eval_unquoted_result
6616
- 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"
6617
6878
 
6618
6879
  # If the previous option needs an argument, assign it.
6619
6880
  if test -n "$prev"; then
@@ -6849,6 +7110,13 @@ func_mode_link ()
6849
7110
  prev=
6850
7111
  continue
6851
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
+ ;;
6852
7120
  xcclinker)
6853
7121
  func_append linker_flags " $qarg"
6854
7122
  func_append compiler_flags " $qarg"
@@ -7019,7 +7287,7 @@ func_mode_link ()
7019
7287
  # These systems don't actually have a C library (as such)
7020
7288
  test X-lc = "X$arg" && continue
7021
7289
  ;;
7022
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7290
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*)
7023
7291
  # Do not include libc due to us having libc/libc_r.
7024
7292
  test X-lc = "X$arg" && continue
7025
7293
  ;;
@@ -7039,7 +7307,7 @@ func_mode_link ()
7039
7307
  esac
7040
7308
  elif test X-lc_r = "X$arg"; then
7041
7309
  case $host in
7042
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
7310
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*)
7043
7311
  # Do not include libc_r directly, use -pthread flag.
7044
7312
  continue
7045
7313
  ;;
@@ -7069,8 +7337,20 @@ func_mode_link ()
7069
7337
  prev=xcompiler
7070
7338
  continue
7071
7339
  ;;
7072
-
7073
- -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 \
7074
7354
  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
7075
7355
  func_append compiler_flags " $arg"
7076
7356
  func_append compile_command " $arg"
@@ -7211,9 +7491,9 @@ func_mode_link ()
7211
7491
  save_ifs=$IFS; IFS=,
7212
7492
  for flag in $args; do
7213
7493
  IFS=$save_ifs
7214
- func_quote_for_eval "$flag"
7215
- func_append arg " $func_quote_for_eval_result"
7216
- 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"
7217
7497
  done
7218
7498
  IFS=$save_ifs
7219
7499
  func_stripname ' ' '' "$arg"
@@ -7227,16 +7507,21 @@ func_mode_link ()
7227
7507
  save_ifs=$IFS; IFS=,
7228
7508
  for flag in $args; do
7229
7509
  IFS=$save_ifs
7230
- func_quote_for_eval "$flag"
7231
- func_append arg " $wl$func_quote_for_eval_result"
7232
- func_append compiler_flags " $wl$func_quote_for_eval_result"
7233
- 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"
7234
7514
  done
7235
7515
  IFS=$save_ifs
7236
7516
  func_stripname ' ' '' "$arg"
7237
7517
  arg=$func_stripname_result
7238
7518
  ;;
7239
7519
 
7520
+ -Xassembler)
7521
+ prev=xassembler
7522
+ continue
7523
+ ;;
7524
+
7240
7525
  -Xcompiler)
7241
7526
  prev=xcompiler
7242
7527
  continue
@@ -7254,8 +7539,8 @@ func_mode_link ()
7254
7539
 
7255
7540
  # -msg_* for osf cc
7256
7541
  -msg_*)
7257
- func_quote_for_eval "$arg"
7258
- arg=$func_quote_for_eval_result
7542
+ func_quote_arg pretty "$arg"
7543
+ arg=$func_quote_arg_result
7259
7544
  ;;
7260
7545
 
7261
7546
  # Flags to be passed through unchanged, with rationale:
@@ -7275,12 +7560,16 @@ func_mode_link ()
7275
7560
  # -specs=* GCC specs files
7276
7561
  # -stdlib=* select c++ std lib with clang
7277
7562
  # -fsanitize=* Clang/GCC memory and address sanitizer
7563
+ # -fuse-ld=* Linker select flags for GCC
7564
+ # -static-* direct GCC to link specific libraries statically
7565
+ # -fcilkplus Cilk Plus language extension features for C/C++
7566
+ # -Wa,* Pass flags directly to the assembler
7278
7567
  -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
7279
7568
  -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
7280
7569
  -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
7281
- -specs=*|-fsanitize=*)
7282
- func_quote_for_eval "$arg"
7283
- 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
7284
7573
  func_append compile_command " $arg"
7285
7574
  func_append finalize_command " $arg"
7286
7575
  func_append compiler_flags " $arg"
@@ -7301,15 +7590,15 @@ func_mode_link ()
7301
7590
  continue
7302
7591
  else
7303
7592
  # Otherwise treat like 'Some other compiler flag' below
7304
- func_quote_for_eval "$arg"
7305
- arg=$func_quote_for_eval_result
7593
+ func_quote_arg pretty "$arg"
7594
+ arg=$func_quote_arg_result
7306
7595
  fi
7307
7596
  ;;
7308
7597
 
7309
7598
  # Some other compiler flag.
7310
7599
  -* | +*)
7311
- func_quote_for_eval "$arg"
7312
- arg=$func_quote_for_eval_result
7600
+ func_quote_arg pretty "$arg"
7601
+ arg=$func_quote_arg_result
7313
7602
  ;;
7314
7603
 
7315
7604
  *.$objext)
@@ -7429,8 +7718,8 @@ func_mode_link ()
7429
7718
  *)
7430
7719
  # Unknown arguments in both finalize_command and compile_command need
7431
7720
  # to be aesthetically quoted because they are evaled later.
7432
- func_quote_for_eval "$arg"
7433
- arg=$func_quote_for_eval_result
7721
+ func_quote_arg pretty "$arg"
7722
+ arg=$func_quote_arg_result
7434
7723
  ;;
7435
7724
  esac # arg
7436
7725
 
@@ -8638,7 +8927,7 @@ func_mode_link ()
8638
8927
  test CXX = "$tagname" && {
8639
8928
  case $host_os in
8640
8929
  linux*)
8641
- case `$CC -V 2>&1 | sed 5q` in
8930
+ case `$CC -V 2>&1 | $SED 5q` in
8642
8931
  *Sun\ C*) # Sun C++ 5.9
8643
8932
  func_suncc_cstd_abi
8644
8933
 
@@ -8811,7 +9100,7 @@ func_mode_link ()
8811
9100
  #
8812
9101
  case $version_type in
8813
9102
  # correct linux to gnu/linux during the next big refactor
8814
- darwin|freebsd-elf|linux|osf|windows|none)
9103
+ darwin|freebsd-elf|linux|midnightbsd-elf|osf|windows|none)
8815
9104
  func_arith $number_major + $number_minor
8816
9105
  current=$func_arith_result
8817
9106
  age=$number_minor
@@ -8905,7 +9194,7 @@ func_mode_link ()
8905
9194
  versuffix=.$current.$revision
8906
9195
  ;;
8907
9196
 
8908
- freebsd-elf)
9197
+ freebsd-elf | midnightbsd-elf)
8909
9198
  func_arith $current - $age
8910
9199
  major=.$func_arith_result
8911
9200
  versuffix=$major.$age.$revision
@@ -9131,7 +9420,7 @@ func_mode_link ()
9131
9420
  *-*-netbsd*)
9132
9421
  # Don't link with libc until the a.out ld.so is fixed.
9133
9422
  ;;
9134
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
9423
+ *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
9135
9424
  # Do not include libc due to us having libc/libc_r.
9136
9425
  ;;
9137
9426
  *-*-sco3.2v5* | *-*-sco5v6*)
@@ -9942,8 +10231,8 @@ EOF
9942
10231
  for cmd in $concat_cmds; do
9943
10232
  IFS=$save_ifs
9944
10233
  $opt_quiet || {
9945
- func_quote_for_expand "$cmd"
9946
- eval "func_echo $func_quote_for_expand_result"
10234
+ func_quote_arg expand,pretty "$cmd"
10235
+ eval "func_echo $func_quote_arg_result"
9947
10236
  }
9948
10237
  $opt_dry_run || eval "$cmd" || {
9949
10238
  lt_exit=$?
@@ -10036,8 +10325,8 @@ EOF
10036
10325
  eval cmd=\"$cmd\"
10037
10326
  IFS=$save_ifs
10038
10327
  $opt_quiet || {
10039
- func_quote_for_expand "$cmd"
10040
- eval "func_echo $func_quote_for_expand_result"
10328
+ func_quote_arg expand,pretty "$cmd"
10329
+ eval "func_echo $func_quote_arg_result"
10041
10330
  }
10042
10331
  $opt_dry_run || eval "$cmd" || {
10043
10332
  lt_exit=$?
@@ -10511,12 +10800,13 @@ EOF
10511
10800
  elif eval var_value=\$$var; test -z "$var_value"; then
10512
10801
  relink_command="$var=; export $var; $relink_command"
10513
10802
  else
10514
- func_quote_for_eval "$var_value"
10515
- 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"
10516
10805
  fi
10517
10806
  done
10518
- relink_command="(cd `pwd`; $relink_command)"
10519
- 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
10520
10810
  fi
10521
10811
 
10522
10812
  # Only actually do things if not in dry run mode.
@@ -10756,13 +11046,15 @@ EOF
10756
11046
  elif eval var_value=\$$var; test -z "$var_value"; then
10757
11047
  relink_command="$var=; export $var; $relink_command"
10758
11048
  else
10759
- func_quote_for_eval "$var_value"
10760
- 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"
10761
11051
  fi
10762
11052
  done
10763
11053
  # Quote the link command for shipping.
10764
- relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
10765
- 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
10766
11058
  if test yes = "$hardcode_automatic"; then
10767
11059
  relink_command=
10768
11060
  fi