Remove duplicated flags from {C,CPP,CXX,LD}FLAGS in configure

This results in much shorter compilation lines and hence much shorter
build logs, which makes examining them simpler.

There should be no real changes, as we should never use duplicated
options intentionally.
This commit is contained in:
Vadim Zeitlin 2020-02-12 01:18:04 +01:00
parent b9df145b79
commit 273e2e7343
2 changed files with 21 additions and 8 deletions

12
configure vendored
View File

@ -40373,10 +40373,14 @@ case "${host}" in
;;
esac
WX_CPPFLAGS=$CPPFLAGS
WX_CFLAGS=$CFLAGS
WX_CXXFLAGS=$CXXFLAGS
WX_LDFLAGS=$LDFLAGS
dedup_flags () { printf %s "$@" | awk -v RS=' +' -v ORS=' ' '!seen[$0]++'; }
WX_CPPFLAGS=`dedup_flags "$CPPFLAGS"`
WX_CFLAGS=`dedup_flags "$CFLAGS"`
WX_CXXFLAGS=`dedup_flags "$CXXFLAGS"`
LDFLAGS=`printf %s "$LDFLAGS" | sed 's/-framework */-framework_/g'`
WX_LDFLAGS=`dedup_flags "$LDFLAGS" | sed 's/-framework_/-framework /g'`
CPPFLAGS=$USER_CPPFLAGS
CFLAGS=$USER_CFLAGS

View File

@ -8269,10 +8269,19 @@ esac
dnl Set the flags to be used for the library build itself using the flag names
dnl used everywhere above.
WX_CPPFLAGS=$CPPFLAGS
WX_CFLAGS=$CFLAGS
WX_CXXFLAGS=$CXXFLAGS
WX_LDFLAGS=$LDFLAGS
dnl
dnl Also get rid of duplicates in the flags, which results in dramatically
dnl shorter build logs and so is well worth it.
dedup_flags () { printf %s "$@" | awk -v RS=' +' -v ORS=' ' '!seen[[$0]]++'; }
WX_CPPFLAGS=`dedup_flags "$CPPFLAGS"`
WX_CFLAGS=`dedup_flags "$CFLAGS"`
WX_CXXFLAGS=`dedup_flags "$CXXFLAGS"`
dnl For link flags we can use "-framework" multiple times and all of their
dnl occurrences need to be preserved, so add extra pre/post-processing.
LDFLAGS=`printf %s "$LDFLAGS" | sed 's/-framework */-framework_/g'`
WX_LDFLAGS=`dedup_flags "$LDFLAGS" | sed 's/-framework_/-framework /g'`
dnl Restore the original user-specified flags values, we won't run any tests
dnl using them any more.