summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-05-26 21:21:30 +0000
committermidipix <writeonce@midipix.org>2021-05-26 21:28:44 +0000
commitdaf24eb299903c5201388d9a4cc00943ed6dbbf3 (patch)
treea3a354718ce5ac46f0e2ce2cdc7e2b6a05c3a79b /configure
parentcf9e58ae96bf7da07d970f781af4dab102b1e751 (diff)
downloadsbmake-daf24eb299903c5201388d9a4cc00943ed6dbbf3.tar.bz2
sbmake-daf24eb299903c5201388d9a4cc00943ed6dbbf3.tar.xz
build system: config_host(): improved logging, strict posix conformance.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure51
1 files changed, 46 insertions, 5 deletions
diff --git a/configure b/configure
index b2632a9..6099868 100755
--- a/configure
+++ b/configure
@@ -848,15 +848,56 @@ config_cfghost()
config_host()
{
+ # init
output_step_prolog ${mb_script} 'config_host'
- # verify configuration for the host's (cross-)compiler
- ${mb_make} -s host.tag \
- -f "$mb_makefile" \
- && output_step_epilog \
- && return 0
+ mb_cfghost_cc="$ccenv_host_cc"
+ mb_cfghost_tmpname='ccenv/c3RyaWN0X21vZGUK.c'
+
+ mb_cfghost_cflags=$(${mb_make} -n -f "$mb_makefile" \
+ .cflags-host)
+
+ mb_cfghost_cflags="${mb_cfghost_cflags#*: }"
+
+ printf 'int main(void){return 0;}' \
+ > "$mb_cfghost_tmpname"
+
+ # log
+ printf '\n' >&3
+
+ printf '%s\n' \
+ '#' \
+ '# verify that that following combination of' \
+ '# host compiler and host cflags is working.' \
+ '#' \
+ >&3
+
+ printf '\n%s' "$mb_cfghost_cc $ccenv_tmpname -o a.out" >&3
+
+ for mb_cfghost_cflag in $mb_cfghost_cflags; do
+ printf ' \\\n\t%s' "$mb_cfghost_cflag" >&3
+ done
+
+ printf '\n\n' >&3
+
+ # execute
+ if eval $mb_cfghost_cc "$ccenv_tmpname" -o a.out \
+ $(printf '%s' "$mb_cfghost_cflags") \
+ 2>&3; then
+ rm a.out
+ rm $mb_cfghost_tmpname
+ mb_cfghost_ret=0
+ else
+ mb_cfghost_ret=1
+ fi
+
+ if [ $mb_cfghost_ret = 0 ]; then
+ output_step_epilog
+ return 0
+ fi
# should never happen
+ error_msg
error_msg "configure was able to generate a Makefile for the selected host,"
error_msg "however the host-targeting compiler was found to be missing"
error_msg "at least one of the required headers or features."