From 273e2e73439d5cc8ddb74b5e88ccafc69ef13c96 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 12 Feb 2020 01:18:04 +0100 Subject: [PATCH] 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. --- configure | 12 ++++++++---- configure.in | 17 +++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 9d0d940e56..75b39aa55c 100755 --- a/configure +++ b/configure @@ -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 diff --git a/configure.in b/configure.in index b1648b6d70..ccf8691dd8 100644 --- a/configure.in +++ b/configure.in @@ -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.