--- src/qt/qtbase/configure.orig	2015-12-12 12:58:05 UTC
+++ src/qt/qtbase/configure
@@ -51,6 +51,7 @@ mactests="$relpath/config.tests/mac"
 WHICH="$unixtests/which.test"
 
 PERL=`$WHICH perl 2>/dev/null`
+export CXX=${CXX}
 
 # find out which awk we want to use, prefer gawk, then nawk, then regular awk
 AWK=
@@ -2791,11 +2792,19 @@ if [ -z "$PLATFORM" ]; then
      ULTRIX:*)
         PLATFORM=ultrix-g++
         ;;
+#     FreeBSD:10.[0-9]*)
+#        echo "=== ($UNAME_RELEASE) ==="
+#        PLATFORM=freebsd-clang
+#        ;;
      FreeBSD:*)
-        PLATFORM=freebsd-g++
+        PLATFORM=freebsd-clang
         PLATFORM_NOTES="
             - Also available for FreeBSD: freebsd-icc
         "
+        type g++   >/dev/null && PLATFORM=freebsd-g++
+        type g++46 >/dev/null && PLATFORM=freebsd-g++46
+        type g++48 >/dev/null && PLATFORM=freebsd-g++48
+        type g++49 >/dev/null && PLATFORM=freebsd-g++49
         ;;
      OpenBSD:*)
         PLATFORM=openbsd-g++
@@ -6359,7 +6368,7 @@ case "$XPLATFORM" in
 	;;
     *-g++*)
 	# Check gcc's version
-	case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in
+	case "$(${TEST_COMPILER} -dumpversion)" in
 	    4*|3.4*)
 		;;
             3.3*)
