summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-06-10 09:02:26 +0000
committermidipix <writeonce@midipix.org>2021-06-10 09:08:27 +0000
commita7594c5f888c4161d82af13f8e3d2bf82b25eca7 (patch)
tree801bc2808be1266ec9546dfd520b5a169a770a58
parent12dd178bd8723c8bc1634172e3fb06c3f00aab0f (diff)
downloadbcparser-a7594c5f888c4161d82af13f8e3d2bf82b25eca7.tar.bz2
bcparser-a7594c5f888c4161d82af13f8e3d2bf82b25eca7.tar.xz
build system: ccenv_set_cc(): enhanced host, cchost, and -dumpmachine logic.
-rw-r--r--sofort/ccenv/ccenv.sh29
1 files changed, 21 insertions, 8 deletions
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index bc0030a..a542823 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -501,13 +501,20 @@ ccenv_set_cc()
ccenv_errors=
if [ "$ccenv_cfgtype" = 'native' ]; then
+ ccenv_host=
+
if [ -n "$mb_native_host" ]; then
ccenv_host="$mb_native_host"
elif [ -n "$ccenv_dumpmachine_switch" ]; then
ccenv_host=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \
$ccenv_dumpmachine_switch 2>&3)
- else
+
+ elif command -v slibtool > /dev/null 2>&1; then
+ ccenv=$(slibtool --dumpmachine 2>/dev/null)
+ fi
+
+ if [ -z "$ccenv_host" ]; then
ccenv_machine=$(uname -m 2>/dev/null)
ccenv_system=$(uname -s 2>/dev/null)
@@ -537,15 +544,21 @@ ccenv_set_cc()
ccenv_cchost=$ccenv_host
elif [ -z "$ccenv_host" ]; then
- # assume that no -dumpmachine support means native build (fixme)
- ccenv_machine=$(uname -m 2>/dev/null)
- ccenv_system=$(uname -s 2>/dev/null)
+ # no -dumpmachine support and no --host argument implies native build
+ if command -v slibtool > /dev/null 2>&1; then
+ ccenv=$(slibtool --dumpmachine 2>/dev/null)
+ fi
- ccenv_machine="${ccenv_machine:-unknown}"
- ccenv_system="${ccenv_system:-anyos}"
+ if [ -z "$ccenv_host" ]; then
+ ccenv_machine=$(uname -m 2>/dev/null)
+ ccenv_system=$(uname -s 2>/dev/null)
+
+ ccenv_machine="${ccenv_machine:-unknown}"
+ ccenv_system="${ccenv_system:-anyos}"
- ccenv_host=$(printf '%s' "${ccenv_machine}-unknown-${ccenv_system}" \
- | tr '[[:upper:]]' '[[:lower:]]')
+ ccenv_host=$(printf '%s' "${ccenv_machine}-unknown-${ccenv_system}" \
+ | tr '[[:upper:]]' '[[:lower:]]')
+ fi
ccenv_cchost=$ccenv_host