829bd8 build system: ccenv_set_cc(): no -dumpmachine compilers: improved logic.

Authored and Committed by midipix 3 years ago
    build system: ccenv_set_cc(): no -dumpmachine compilers: improved logic.
    
        
file modified
+19 -3
sofort/ccenv/ccenv.sh CHANGED
@@ -501,11 +501,20 @@ ccenv_set_cc()
501
501
ccenv_errors=
502
502
503
503
if [ "$ccenv_cfgtype" = 'native' ]; then
504
- if [ -n "$ccenv_dumpmachine_switch" ]; then
504
+ if [ -n "$mb_native_host" ]; then
505
+ ccenv_host="$mb_native_host"
506
+
507
+ elif [ -n "$ccenv_dumpmachine_switch" ]; then
505
508
ccenv_host=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \
506
509
$ccenv_dumpmachine_switch 2>&3)
507
510
else
508
- ccenv_host=$(printf '%s' $(uname -m)-$(uname -p)-$(uname -o) \
511
+ ccenv_machine=$(uname -m 2>/dev/null)
512
+ ccenv_system=$(uname -s 2>/dev/null)
513
+
514
+ ccenv_machine="${ccenv_machine:-unknown}"
515
+ ccenv_system="${ccenv_system:-anyos}"
516
+
517
+ ccenv_host=$(printf '%s' "${ccenv_machine}-unknown-${ccenv_system}" \
509
518
| tr '[[:upper:]]' '[[:lower:]]')
510
519
fi
511
520
@@ -529,8 +538,15 @@ ccenv_set_cc()
529
538
530
539
elif [ -z "$ccenv_host" ]; then
531
540
# assume that no -dumpmachine support means native build (fixme)
532
- ccenv_host=$(printf '%s' $(uname -m)-$(uname -p)-$(uname -o) \
541
+ ccenv_machine=$(uname -m 2>/dev/null)
542
+ ccenv_system=$(uname -s 2>/dev/null)
543
+
544
+ ccenv_machine="${ccenv_machine:-unknown}"
545
+ ccenv_system="${ccenv_system:-anyos}"
546
+
547
+ ccenv_host=$(printf '%s' "${ccenv_machine}-unknown-${ccenv_system}" \
533
548
| tr '[[:upper:]]' '[[:lower:]]')
549
+
534
550
ccenv_cchost=$ccenv_host
535
551
536
552
elif [ -n "$ccenv_dumpmachine_switch" ]; then