We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8e6e237 commit c0a2d90Copy full SHA for c0a2d90
bin/ruby-build
@@ -252,9 +252,7 @@ require_gcc() {
252
253
locate_gcc() {
254
local gcc gccs
255
- shopt -s nullglob
256
- gccs=( /usr/bin/gcc-* )
257
- shopt -u nullglob
+ IFS=: gccs=($(gccs_in_path))
258
259
verify_gcc "$CC" ||
260
verify_gcc "$(command -v gcc || true)" || {
@@ -266,6 +264,22 @@ locate_gcc() {
266
264
return 1
267
265
}
268
+gccs_in_path() {
+ local gcc path paths
269
+ local gccs=()
270
+ IFS=: paths=($PATH)
271
+
272
+ shopt -s nullglob
273
+ for path in "${paths[@]}"; do
274
+ for gcc in "$path"/gcc-*; do
275
+ gccs["${#gccs[@]}"]="$gcc"
276
+ done
277
278
+ shopt -u nullglob
279
280
+ printf :%s "${gccs[@]}"
281
+}
282
283
verify_gcc() {
284
local gcc="$1"
285
if [ -z "$gcc" ]; then
0 commit comments