summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-06-13 07:28:30 +0000
committermidipix <writeonce@midipix.org>2021-06-13 07:29:09 +0000
commit8917cbdf95a70908015fa7236eebdb584b5f8a3e (patch)
tree7c041ee4eaad0c2adf94ebd58378eef146c12675
parente5fd9a3645a339ca40c0f1d9ed93a73ea7a2047e (diff)
downloaddalist-8917cbdf95a70908015fa7236eebdb584b5f8a3e.tar.bz2
dalist-8917cbdf95a70908015fa7236eebdb584b5f8a3e.tar.xz
build system: configure, ccenv: enhanced --sysroot logic.
-rwxr-xr-xconfigure9
-rw-r--r--sofort/ccenv/ccenv.sh6
2 files changed, 14 insertions, 1 deletions
diff --git a/configure b/configure
index 459e57d..b32b086 100755
--- a/configure
+++ b/configure
@@ -813,8 +813,15 @@ config_ccenv()
output_section_break
ccenv_set_native_variables
+ # implicit --sysroot for use with pkgconf and friends
+ if [ -z "$mb_sysroot" ]; then
+ mb_sysroot="$ccenv_host_sysroot"
+ fi
+
# require --sysroot when cross-compiling
- if [ "$mb_cchost" != "$mb_native_cchost" ] && [ -z "$mb_sysroot" ]; then
+ if [ "$mb_cchost" != "$mb_native_cchost" ] \
+ && [ "$ccenv_host_cc" != "$ccenv_native_cc" ] \
+ && [ -z "$mb_sysroot" ]; then
mb_pretty=$(printf "%-${#mb_package}s" '')
error_msg ' !!'
diff --git a/sofort/ccenv/ccenv.sh b/sofort/ccenv/ccenv.sh
index 464b309..a13aa07 100644
--- a/sofort/ccenv/ccenv.sh
+++ b/sofort/ccenv/ccenv.sh
@@ -28,8 +28,10 @@
# variables available to cfgdefs.sh and cfgfini.sh:
# ccenv_host_cflags: expanded cflags, valid for the host compiler
# ccenv_host_ldflags: expanded ldflags, valid for the host compiler
+# ccenv_host_sysroot: host sysroot, as reported by the host compiler
# ccenv_native_cflags: expanded cflags, valid for the native compiler
# ccenv_native_ldflags: expanded ldflags, valid for the native compiler
+# ccenv_native_sysroot: native sysroot, as reported by the native compiler
ccenv_usage()
{
@@ -1507,8 +1509,12 @@ ccenv_output_defs()
ccenv_cflags="${ccenv_cflags#*: }"
ccenv_ldflags="${ccenv_ldflags#*: }"
+ ccenv_sysroot=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \
+ -print-sysroot 2>/dev/null || true)
+
eval 'ccenv_'${ccenv_cfgtype}'_cflags'=\'$ccenv_cflags\'
eval 'ccenv_'${ccenv_cfgtype}'_ldflags'=\'$ccenv_ldflags\'
+ eval 'ccenv_'${ccenv_cfgtype}'_sysroot'=\'$ccenv_sysroot\'
eval 'ccenv_'${ccenv_cfgtype}'_cc'=\'$ccenv_cc\'
eval 'ccenv_'${ccenv_cfgtype}'_cc_environment'=\'$ccenv_cc_environment\'