Improve sorting of flags.
--- a/make/autoconf/configure.ac Mon Feb 26 09:56:12 2018 +0100
+++ b/make/autoconf/configure.ac Mon Feb 26 10:19:03 2018 +0100
@@ -198,15 +198,32 @@
FLAGS_SETUP_COMPILER_FLAGS_MISC
#FIXME: REMOVE
-JVM_CFLAGS=`$ECHO $JVM_CFLAGS | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
-CFLAGS_JDKLIB=`$ECHO $CFLAGS_JDKLIB | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
-CFLAGS_JDKEXE=`$ECHO $CFLAGS_JDKEXE | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
-CXXFLAGS_JDKLIB=`$ECHO $CXXFLAGS_JDKLIB | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
-CXXFLAGS_JDKEXE=`$ECHO $CXXFLAGS_JDKEXE | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
+FLAGS_SORT_FLAGS(JVM_CFLAGS)
+FLAGS_SORT_FLAGS(CFLAGS_JDKLIB)
+FLAGS_SORT_FLAGS(CFLAGS_JDKEXE)
+FLAGS_SORT_FLAGS(CXXFLAGS_JDKLIB)
+FLAGS_SORT_FLAGS(CXXFLAGS_JDKEXE)
+FLAGS_SORT_FLAGS(JVM_LDFLAGS)
+FLAGS_SORT_FLAGS(LDFLAGS_JDKLIB)
+FLAGS_SORT_FLAGS(LDFLAGS_JDKEXE)
+FLAGS_SORT_FLAGS(JVM_CFLAGS)
+FLAGS_SORT_FLAGS(LDFLAGS_CXX_JDK)
-JVM_LDFLAGS=`$ECHO $JVM_LDFLAGS | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
-LDFLAGS_JDKLIB=`$ECHO $LDFLAGS_JDKLIB | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
-LDFLAGS_JDKEXE=`$ECHO $LDFLAGS_JDKEXE | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
+FLAGS_SORT_FLAGS(CFLAGS_TESTLIB)
+FLAGS_SORT_FLAGS(CXXFLAGS_TESTLIB)
+FLAGS_SORT_FLAGS(CFLAGS_TESTEXE)
+FLAGS_SORT_FLAGS(CXXFLAGS_TESTEXE)
+FLAGS_SORT_FLAGS(LDFLAGS_TESTLIB)
+FLAGS_SORT_FLAGS(LDFLAGS_TESTEXE)
+
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_CFLAGS_JDKLIB)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_CXXFLAGS_JDKLIB)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_LDFLAGS_JDKLIB)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_CFLAGS_JDKEXE)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_CXXFLAGS_JDKEXE)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_LDFLAGS_JDKEXE)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_JVM_CFLAGS)
+FLAGS_SORT_FLAGS(OPENJDK_BUILD_JVM_LDFLAGS)
# Setup debug symbols (need objcopy from the toolchain for that)
JDKOPT_SETUP_DEBUG_SYMBOLS
--- a/make/autoconf/flags.m4 Mon Feb 26 09:56:12 2018 +0100
+++ b/make/autoconf/flags.m4 Mon Feb 26 10:19:03 2018 +0100
@@ -27,6 +27,13 @@
m4_include([flags-ldflags.m4])
m4_include([flags-other.m4])
+# Sort the flags in a given variable, and remove superfluous whitespace.
+#
+# $1 = name of variable to sort
+AC_DEFUN([FLAGS_SORT_FLAGS], [
+ $1=`$ECHO ${$1} | $TR ' ' '\n' | $SORT | $TR '\n' ' '`
+])
+
################################################################################
#
# Setup ABI profile (for arm)