summaryrefslogtreecommitdiff
path: root/sofort/cfgtest/cfgtest.sh
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-06-08 23:40:14 +0000
committermidipix <writeonce@midipix.org>2021-06-08 23:40:14 +0000
commit399275024bf702c706d2ace4ad3a7b99f8533736 (patch)
treea162afbe41a0201682178afdcfe51d30ed2d1c86 /sofort/cfgtest/cfgtest.sh
parent95edccc2203f7e33a4b84afb35b84dd43e277d37 (diff)
downloadslibtool-399275024bf702c706d2ace4ad3a7b99f8533736.tar.bz2
slibtool-399275024bf702c706d2ace4ad3a7b99f8533736.tar.xz
build system: cfgtest: added cfgtest_macro_definition().
Diffstat (limited to 'sofort/cfgtest/cfgtest.sh')
-rw-r--r--sofort/cfgtest/cfgtest.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/sofort/cfgtest/cfgtest.sh b/sofort/cfgtest/cfgtest.sh
index 46c431f..fba7b24 100644
--- a/sofort/cfgtest/cfgtest.sh
+++ b/sofort/cfgtest/cfgtest.sh
@@ -261,6 +261,10 @@ cfgtest_common_init()
cfgtest_inc=
cfgtest_src="$cfgtest_code_snippet"
+ elif [ "$cfgtest_type" = 'macro' ]; then
+ cfgtest_inc=
+ cfgtest_src="$cfgtest_code_snippet"
+
elif [ "$cfgtest_type" = 'ldflag' ]; then
cfgtest_inc=
cfgtest_src=
@@ -544,6 +548,39 @@ cfgtest_code_snippet_asm()
}
+cfgtest_macro_definition()
+{
+ # init
+ cfgtest_prolog 'macro definition' "${1}"
+
+ cfgtest_code_snippet=$(printf '%s\n' \
+ "#ifndef ${1}" \
+ "#error macro ${1} is not defined." \
+ "#endif")
+
+ cfgtest_common_init 'macro'
+
+ # execute
+ cfgtest_ret=1
+
+ printf '%s' "$cfgtest_src" \
+ | eval $(printf '%s' "$cfgtest_cmd") \
+ > /dev/null 2>&3 \
+ || cfgtest_epilog 'macro' '(error)' "${1}" \
+ || return
+
+ # result
+ cfgtest_ret=0
+
+ printf 'cfgtest: %s compiler: above macro definition test compiled successfully.\n\n' \
+ "$mb_cfgtest_cfgtype" >&3
+
+ cfgtest_epilog 'macro' '(defined)'
+
+ return 0
+}
+
+
cfgtest_library_presence()
{
# init