--- configure
+++ configure
@@ -38,14 +38,8 @@
   return 0;
 }
 EOF
-CXX=unknown;
-for i in "CC" "g++" "cc" "$CC"; do
-  if $i -c $tmp_file.C 2>/dev/null; then
-    CXX="$i";
-    break;
-  fi;
-done;
-if test "$CXX" = unknown; then
+CXX=${CXX:-unknown}
+if ! $CXX -c $tmp_file.C 2>/dev/null; then
   $echo "Error: Could not find a working C++ compiler.";
   exit 1;
 fi;
