From 3aa01a95eed7226df259ecdac27925ebe332a444 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 15 Jan 2021 14:50:55 +0000 Subject: [PATCH] getconf detection: cope with new compiler messages conf.sh checks for undefined symbols by parsing compiler output and looking for strings of capital letters and underscores. Modern gcc produces suggestions for replacement variables too, for example: error: '_SC_CLOCKRES_MIN' undeclared here (not in a function); did you mean _POSIX_CLOCKRES_MIN? _SC_CLOCKRES_MIN, ^~~~~~~~~~~~~~~~ _POSIX_CLOCKRES_MIN This causes good variables to be excluded along with bad, causing differences between the builtin and system getconf commands. src/lib/libast/comp/conf.sh: - Only use lines containing 'error:' and ignore everything starting from 'did you mean:'. (Note this scripts sets the locale to C.) Patch from @citrus-it: https://github.com/citrus-it/ast/commit/061a4b1da12400cc1902dd7bdc7c3fc438bd9ff0 --- src/lib/libast/comp/conf.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/libast/comp/conf.sh b/src/lib/libast/comp/conf.sh index b87eae05a..f1d845408 100644 --- a/src/lib/libast/comp/conf.sh +++ b/src/lib/libast/comp/conf.sh @@ -833,7 +833,8 @@ unsigned int conf[] = { [ -f $tmp.1.e ] || cp $tmp.e $tmp.1.e snl='\ ' - sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" $tmp.e | + grep 'error:' $tmp.e | sed "s/did you mean.*//" | + sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" | grep '^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$' | sort -u > $tmp.n cmp -s $tmp.n $tmp.p && break