summaryrefslogtreecommitdiff
path: root/sofort
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-19 10:04:45 -0500
committermidipix <writeonce@midipix.org>2018-12-19 20:16:27 -0500
commit73a6fde0f8771174fe7ae0465d5cee57955f0714 (patch)
treed89b9b23850004f6fce97ce3555a9b9eadaace40 /sofort
parent9bebc0ff1652d6c84083f94506d25488e362355e (diff)
downloadsbpython2-73a6fde0f8771174fe7ae0465d5cee57955f0714.tar.bz2
sbpython2-73a6fde0f8771174fe7ae0465d5cee57955f0714.tar.xz
build system: config-time test framework: added cfgtest_decl_presence.
Diffstat (limited to 'sofort')
-rw-r--r--sofort/cfgtest.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/sofort/cfgtest.sh b/sofort/cfgtest.sh
index bd661c0..57aca7c 100644
--- a/sofort/cfgtest.sh
+++ b/sofort/cfgtest.sh
@@ -157,6 +157,39 @@ cfgtest_interface_presence()
return 0
}
+
+cfgtest_decl_presence()
+{
+ mb_internal_cflags=''
+
+ for mb_header in $mb_cfgtest_headers; do
+ mb_internal_cflags="$mb_internal_cflags --include=$mb_header"
+ done
+
+ printf 'void * any = (void *)%s;' "$@" \
+ | $mb_cfgtest_cc -S -xc - -o - \
+ $mb_cfgtest_cflags \
+ $mb_internal_cflags \
+ > /dev/null 2>/dev/null \
+ || return 1
+
+ # does the argument solely consist of the macro or enum member name?
+ mb_internal_str=$(printf '%s' "$@" | tr -d '[a-z][A-Z][0-9][_]')
+
+ if [ -n "$mb_internal_str" ]; then
+ return 0
+ fi
+
+ mb_internal_str=$(printf '%s%s' '-DHAVE_DECL_' "$@" \
+ | sed -e 's/\./_/g' \
+ | tr "[:lower:]" "[:upper:]")
+
+ cfgtest_cflags_append "$mb_internal_str"
+
+ return 0
+}
+
+
cfgtest_library_presence()
{
printf 'int main(void){return 0;}' \