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.