summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-05-05 14:46:25 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2023-05-05 14:48:02 +0200
commitb2366908835cda4817196f554ba4c8bfa55a3719 (patch)
treea756c103203b5fdd2f0606a0d25ccafed6008b65
parent0d35d779351a30d8b2bb6c27bca94acf56d6143d (diff)
downloadrules-cc-b2366908835cda4817196f554ba4c8bfa55a3719.tar.gz
rules: Test symbol and macro separately for auto config
-rw-r--r--CC/auto/RULES20
1 files changed, 15 insertions, 5 deletions
diff --git a/CC/auto/RULES b/CC/auto/RULES
index 7d27ff6..e04289c 100644
--- a/CC/auto/RULES
+++ b/CC/auto/RULES
@@ -97,7 +97,8 @@
, "pairs. The first element of each pair is the define name and the"
, "second argument is another pair. This pair's first value is the C"
, "symbol to search for and the second value is a list with the header"
- , "file names to consider for searching."
+ , "file names to consider for searching. If the header file defines the"
+ , "symbol as a macro it is considered available and assumed to work."
]
, "have_cxxsymbol":
[ "Set a define to \"1\" if the specified C++ symbol is defined by one of"
@@ -105,7 +106,8 @@
, "pairs. The first element of each pair is the define name and the"
, "second argument is another pair. This pair's first value is the C++"
, "symbol to search for and the second value is a list with the header"
- , "file names to consider for searching."
+ , "file names to consider for searching. If the header file defines the"
+ , "symbol as a macro it is considered available and assumed to work."
]
, "size_ctype":
[ "Set a define to size of the specified C type. Must contain a list of"
@@ -300,13 +302,21 @@
, "shift"
, "DEFINE=\"/* #undef $DEF */\""
, "for INC in \"$@\"; do"
- , " cat > test.$LANG << EOF"
+ , " cat > test_symbol.$LANG << EOF"
, "#include \"$INC\""
- , "#ifndef $SYMBOL"
, "void* __test = &$SYMBOL;"
+ , "EOF"
+ , " if $CC @$LANG.flags -c test_symbol.$LANG -I ./include 2>/dev/null; then"
+ , " DEFINE=\"#define $DEF 1\""
+ , " break"
+ , " fi"
+ , " cat > test_macro.$LANG << EOF"
+ , "#include \"$INC\""
+ , "#ifndef $SYMBOL"
+ , "#error not defined as macro"
, "#endif"
, "EOF"
- , " if $CC @$LANG.flags -c test.$LANG -I ./include 2>/dev/null; then"
+ , " if $CC @$LANG.flags -c test_macro.$LANG -I ./include 2>/dev/null; then"
, " DEFINE=\"#define $DEF 1\""
, " break"
, " fi"