diff -Nur squid-3.1.11.orig/configure.ac squid-3.1.11/configure.ac
--- squid-3.1.11.orig/configure.ac	2011-02-08 05:07:06.000000000 +0100
+++ squid-3.1.11/configure.ac	2011-03-04 23:03:25.000000000 +0100
@@ -3913,6 +3913,9 @@
 fi
 AC_SUBST(XTRA_LIBS)
 
+CXX_FOR_BUILD="g++"
+AC_SUBST(CXX_FOR_BUILD)
+
 dnl Clean up after OSF/1 core dump bug
 rm -f core 
 
diff -Nur squid-3.1.11.orig/src/Makefile.am squid-3.1.11/src/Makefile.am
--- squid-3.1.11.orig/src/Makefile.am	2011-02-08 05:05:51.000000000 +0100
+++ squid-3.1.11/src/Makefile.am	2011-03-04 23:16:39.000000000 +0100
@@ -732,6 +732,8 @@
 # Make location configure settings available to the code
 DEFS += -DDEFAULT_CONFIG_FILE=\"$(DEFAULT_CONFIG_FILE)\" -DDEFAULT_SQUID_DATA_DIR=\"$(datadir)\" -DDEFAULT_SQUID_CONFIG_DIR=\"$(sysconfdir)\"
 
+CXX_FOR_BUILD ?= @CXX_FOR_BUILD@
+
 snmp_core.o snmp_agent.o: ../snmplib/libsnmp.a $(top_srcdir)/include/cache_snmp.h
 
 globals.cc: globals.h mk-globals-c.pl
@@ -753,6 +755,11 @@
 squid.conf.default squid.conf.documented: cf_parser.cci
 	true
 
+cf_gen$(EXEEXT): $(cf_gen_SOURCES) $(cf_gen_DEPENDENCIES)
+	$(CXX_FOR_BUILD) -o $@ $(srcdir)/cf_gen.cc \
+		$(top_srcdir)/lib/util.c $(top_srcdir)/compat/assert.cc \
+		-DNDEBUG -DBUILD_HOST_TOOL ${INCLUDES} ${CXXFLAGS_FOR_BUILD}
+
 cf_parser.cci: cf.data cf_gen$(EXEEXT)
 	./cf_gen cf.data $(srcdir)/cf.data.depend
 
