summaryrefslogtreecommitdiff
path: root/sofort
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-01-06 09:56:19 +0000
committermidipix <writeonce@midipix.org>2020-01-06 22:22:17 +0000
commit1c0167b11412742bb206803e3a6a4f24f250ca2a (patch)
tree8b0a640f782b97769dd8d9ddb62e39c3e73c6362 /sofort
parent826492e37d7b457b91f8ec353cfd99734aaffb7a (diff)
downloadsbpython3-1c0167b11412742bb206803e3a6a4f24f250ca2a.tar.bz2
sbpython3-1c0167b11412742bb206803e3a6a4f24f250ca2a.tar.xz
build system: cfgtest_header_{presence|absence}(): config.log integration.
Diffstat (limited to 'sofort')
-rw-r--r--sofort/cfgtest/cfgtest.sh90
1 files changed, 79 insertions, 11 deletions
diff --git a/sofort/cfgtest/cfgtest.sh b/sofort/cfgtest/cfgtest.sh
index 09ad82c..074800a 100644
--- a/sofort/cfgtest/cfgtest.sh
+++ b/sofort/cfgtest/cfgtest.sh
@@ -52,6 +52,36 @@ cfgtest_native_section()
}
+cfgtest_prolog()
+{
+ cfgtest_line_dots='.......................'
+ cfgtest_line_dots="${cfgtest_line_dots}${cfgtest_line_dots}"
+ cfgtest_tool_desc=" == trying ${mb_cfgtest_cfgtype} ${1}: ${2}"
+ cfgtest_tool_dlen="${#cfgtest_line_dots}"
+
+ printf '\n%s\n' '________________________' >&3
+ printf "cfgtest: probing for ${mb_cfgtest_cfgtype} ${1}: ${2}\n\n" >&3
+ printf "%${cfgtest_tool_dlen}.${cfgtest_tool_dlen}s" \
+ "${cfgtest_tool_desc} ${mb_line_dots}"
+}
+
+
+cfgtest_epilog()
+{
+ cfgtest_line_dots='.......................'
+ cfgtest_tool_dlen="$((${#cfgtest_line_dots} - ${#1}))"
+
+ printf "%${cfgtest_tool_dlen}.${cfgtest_tool_dlen}s %s.\n" \
+ "${cfgtest_line_dots}" "${1}"
+
+ if [ "${1}" = '-----' ]; then
+ printf '\n\ncfgtest: interface is missing or cannot be used.\n' >&3
+ printf '%s\n' '------------------------' >&3
+ return 1
+ fi
+}
+
+
cfgtest_makevar_append()
{
mb_internal_str='+='
@@ -103,14 +133,27 @@ cfgtest_ldflags_append()
cfgtest_header_presence()
{
- $mb_cfgtest_cc -E -xc - \
- $mb_cfgtest_cflags \
- --include="$@" \
- < /dev/null \
- > /dev/null 2>/dev/null \
+ cfgtest_prolog 'header' "${1}"
+
+ printf '%s -E -xc - \\\n' "$mb_cfgtest_cc" >&3
+
+ for cfgtest_cflag in $mb_cfgtest_cflags; do
+ printf '\t%s \\\n' "$cfgtest_cflag" >&3
+ done
+
+ printf '\t%s\n\n' '--include='"${1}" >&3
+
+ cfgtest_cmd=$(printf '%s -E -xc - %s %s' \
+ "$mb_cfgtest_cc" "$mb_cfgtest_cflags" \
+ '--include='"${1}")
+
+ $(printf '%s' "$cfgtest_cmd") \
+ < /dev/null \
+ > /dev/null 2>&3 \
+ || cfgtest_epilog '-----' \
|| return
- mb_internal_str=$(printf '%s%s' '-DHAVE_' "$@" \
+ mb_internal_str=$(printf '%s%s' '-DHAVE_' "${1}" \
| sed -e 's/\./_/g' -e 's@/@_@g' \
| tr "[:lower:]" "[:upper:]")
@@ -119,16 +162,35 @@ cfgtest_header_presence()
else
cfgtest_makevar_append "$mb_internal_str"
fi
+
+ printf 'cfgtest: %s header <%s> was found and may be included.\n' \
+ "$mb_cfgtest_cfgtype" "${1}" >&3
+ printf '%s\n' '------------------------' >&3
+
+ cfgtest_epilog "${1}"
}
cfgtest_header_absence()
{
- $mb_cfgtest_cc -E -xc - \
- $mb_cfgtest_cflags \
- --include="$@" \
- < /dev/null \
- > /dev/null 2>/dev/null \
+ cfgtest_prolog 'header absence' "${1}"
+
+ printf '%s -E -xc - \\\n' "$mb_cfgtest_cc" >&3
+
+ for cfgtest_cflag in $mb_cfgtest_cflags; do
+ printf '\t%s \\\n' "$cfgtest_cflag" >&3
+ done
+
+ printf '\t%s\n\n' '--include='"${1}" >&3
+
+ cfgtest_cmd=$(printf '%s -E -xc - %s %s' \
+ "$mb_cfgtest_cc" "$mb_cfgtest_cflags" \
+ '--include='"${1}")
+
+ $(printf '%s' "$cfgtest_cmd") \
+ < /dev/null \
+ > /dev/null 2>&3 \
+ && cfgtest_epilog "${1}" \
&& return
mb_internal_str=$(printf '%s%s' '-DHAVE_NO_' "$@" \
@@ -140,6 +202,12 @@ cfgtest_header_absence()
else
cfgtest_makevar_append "$mb_internal_str"
fi
+
+ printf 'cfgtest: %s header <%s> may not be included.\n' \
+ "$mb_cfgtest_cfgtype" "${1}" >&3
+ printf '%s\n' '------------------------' >&3
+
+ cfgtest_epilog '-----'
}