Fix handling of duplicate -arch or -framework options

See #23356
This commit is contained in:
Paul Cornett 2023-03-17 11:56:59 -07:00
parent 8ad0f52da0
commit 30181a9dd9
2 changed files with 11 additions and 5 deletions

6
configure vendored
View file

@ -43239,7 +43239,11 @@ dedup_flags()
{
printf "%s " "$@" |
awk 'BEGIN { RS=" "; ORS=" " }
{ if ($0=="-arch" || $0=="-framework" || !seen[$0]++) print }'
{
if ($0=="") next
if ($0=="-arch" || $0=="-framework") { x=$0; next }
if (x!="") x=x " " $0; else x=$0; if (!seen[x]++) print x; x=""
}'
}
WX_CPPFLAGS=`dedup_flags "$CPPFLAGS"`

View file

@ -7865,14 +7865,16 @@ dnl Set the flags to be used for the library build itself using the flag names
dnl used everywhere above.
dnl
dnl Also get rid of duplicates in the flags, which results in dramatically
dnl shorter build logs and so is well worth it (but preserve some special
dnl flags which are explicitly allowed to occur multiple times, as all their
dnl occurrences must be preserved).
dnl shorter build logs and so is well worth it.
dedup_flags()
{
printf "%s " "$@" |
awk 'BEGIN { RS=" "; ORS=" " }
{ if ($0=="-arch" || $0=="-framework" || !seen[[$0]]++) print }'
{
if ($0=="") next
if ($0=="-arch" || $0=="-framework") { x=$0; next }
if (x!="") x=x " " $0; else x=$0; if (!seen[[x]]++) print x; x=""
}'
}
WX_CPPFLAGS=`dedup_flags "$CPPFLAGS"`