diff --git a/ChangeLog b/ChangeLog
index f3132b4f06d115eb01a49fa2474c1bf496d194b6..86c63a2166893ed6075367015146319e81f4b003 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-09-04  Jason Merrill  <jason@redhat.com>
+
+	* configure.ac: Fix --enable-languages=all.
+
 2012-09-04  Christophe Lyon  <christophe.lyon@st.com>
 
 	* MAINTAINERS (Write After Approval): Add myself.
diff --git a/configure b/configure
index 0f655b8640b77f53080ec249f4a059fb15bd0625..cd06e4ef0d65daa9cd63d5c3ca30bc001c6accd7 100755
--- a/configure
+++ b/configure
@@ -6112,6 +6112,7 @@ if test -d ${srcdir}/gcc; then
 	  boot_language=yes
 	fi
 
+        add_this_lang=no
         case ,${enable_languages}, in
           *,${language},*)
             # Language was explicitly selected; include it
@@ -6122,10 +6123,9 @@ if test -d ${srcdir}/gcc; then
             ;;
           *,all,*)
             # 'all' was selected, select it if it is a default language
-            add_this_lang=${build_by_default}
-            ;;
-          *)
-            add_this_lang=no
+	    if test "$language" != "c"; then
+	      add_this_lang=${build_by_default}
+	    fi
             ;;
         esac
 
diff --git a/configure.ac b/configure.ac
index 02174b387bc4de41884cbc1567867e60c2b69818..9bee624ec1c8ffd238207b79e3850d42d160d70d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1758,6 +1758,7 @@ if test -d ${srcdir}/gcc; then
 	  boot_language=yes
 	fi
 
+        add_this_lang=no
         case ,${enable_languages}, in
           *,${language},*)
             # Language was explicitly selected; include it
@@ -1768,10 +1769,9 @@ if test -d ${srcdir}/gcc; then
             ;;
           *,all,*)
             # 'all' was selected, select it if it is a default language
-            add_this_lang=${build_by_default}
-            ;;
-          *)
-            add_this_lang=no
+	    if test "$language" != "c"; then
+	      add_this_lang=${build_by_default}
+	    fi
             ;;
         esac