diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog
index 3427243..f87be65 100644
--- a/libcilkrts/ChangeLog
+++ b/libcilkrts/ChangeLog
@@ -1,3 +1,13 @@
+2013-10-31  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	PR other/58925
+	* configure.ac: Added target_alias and GCC_LIBSTDCXX_RAW_CXX_FLAGS
+	fields.
+	* configure: Regenerated.
+	* aclocal.m4: Likewise.
+	* Makefile.in: Likewise.
+	* Makefile.am: Added gcc_version field.
+
 2013-10-30  Balaji V. Iyer  <balaji.v.iyer@intel.com>
 
 	* configure.ac: Changed a case statement to include i386.
diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am
index f332cfb..a3b07ef 100644
--- a/libcilkrts/Makefile.am
+++ b/libcilkrts/Makefile.am
@@ -47,6 +47,9 @@ AM_CFLAGS = $(GENERAL_FLAGS) -std=c99
 AM_CPPFLAGS = $(GENERAL_FLAGS)
 AM_LDFLAGS = -lpthread -ldl
 
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
 # Target list.
 toolexeclib_LTLIBRARIES = libcilkrts.la
 
diff --git a/libcilkrts/Makefile.in b/libcilkrts/Makefile.in
index 35e2705..9f459cc 100644
--- a/libcilkrts/Makefile.in
+++ b/libcilkrts/Makefile.in
@@ -122,8 +122,10 @@ DIST_COMMON = $(srcdir)/include/internal/rev.mk README ChangeLog \
 @MAC_LINKER_SCRIPT_TRUE@am__append_2 = -Wl,-exported_symbols_list,$(srcdir)/runtime/mac-symbols.txt
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
+	$(top_srcdir)/../config/depstand.m4 \
 	$(top_srcdir)/../config/lead-dot.m4 \
+	$(top_srcdir)/../config/libstdc++-raw-cxx.m4 \
 	$(top_srcdir)/../config/multi.m4 \
 	$(top_srcdir)/../config/override.m4 \
 	$(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
@@ -243,6 +245,8 @@ LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
+LIBSTDCXX_RAW_CXX_CXXFLAGS = @LIBSTDCXX_RAW_CXX_CXXFLAGS@
+LIBSTDCXX_RAW_CXX_LDFLAGS = @LIBSTDCXX_RAW_CXX_LDFLAGS@
 LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
@@ -323,6 +327,7 @@ sysconfdir = @sysconfdir@
 target = @target@
 target_alias = @target_alias@
 target_cpu = @target_cpu@
+target_noncanonical = @target_noncanonical@
 target_os = @target_os@
 target_vendor = @target_vendor@
 toolexecdir = @toolexecdir@
@@ -346,6 +351,9 @@ AM_CFLAGS = $(GENERAL_FLAGS) -std=c99
 AM_CPPFLAGS = $(GENERAL_FLAGS)
 AM_LDFLAGS = -lpthread -ldl
 
+# May be used by toolexeclibdir.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+
 # Target list.
 toolexeclib_LTLIBRARIES = libcilkrts.la
 libcilkrts_la_SOURCES = \
diff --git a/libcilkrts/aclocal.m4 b/libcilkrts/aclocal.m4
index 68107ca..c24d0b6 100644
--- a/libcilkrts/aclocal.m4
+++ b/libcilkrts/aclocal.m4
@@ -968,8 +968,10 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
 m4_include([../config/lead-dot.m4])
+m4_include([../config/libstdc++-raw-cxx.m4])
 m4_include([../config/multi.m4])
 m4_include([../config/override.m4])
 m4_include([../libtool.m4])
diff --git a/libcilkrts/configure b/libcilkrts/configure
index a2dd79c..41deb9f 100644
--- a/libcilkrts/configure
+++ b/libcilkrts/configure
@@ -681,6 +681,9 @@ am__isrc
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+LIBSTDCXX_RAW_CXX_LDFLAGS
+LIBSTDCXX_RAW_CXX_CXXFLAGS
+target_noncanonical
 target_os
 target_vendor
 target_cpu
@@ -2366,6 +2369,36 @@ test -n "$target_alias" &&
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
+target_alias=${target_alias-$host_alias}
+
+ case ${build_alias} in
+  "") build_noncanonical=${build} ;;
+  *) build_noncanonical=${build_alias} ;;
+esac
+
+ case ${host_alias} in
+  "") host_noncanonical=${build_noncanonical} ;;
+  *) host_noncanonical=${host_alias} ;;
+esac
+
+ case ${target_alias} in
+  "") target_noncanonical=${host_noncanonical} ;;
+  *) target_noncanonical=${target_alias} ;;
+esac
+
+
+
+
+
+  LIBSTDCXX_RAW_CXX_CXXFLAGS="\
+    -I\$(top_builddir)/../libstdc++-v3/include \
+    -I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \
+    -I\$(top_srcdir)/../libstdc++-v3/libsupc++"
+  LIBSTDCXX_RAW_CXX_LDFLAGS="\
+    \$(top_builddir)/../libstdc++-v3/src/libstdc++.la"
+
+
+
 am__api_version='1.11'
 
 # Find a good install program.  We prefer a C program (faster),
@@ -4878,7 +4911,7 @@ case ${enable_version_specific_runtime_libs} in
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
     toolexecdir='$(libdir)/gcc/$(target_alias)'
-   toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
     ;;
   no)
     if test -n "$with_cross_host" &&
@@ -11024,7 +11057,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11027 "configure"
+#line 11060 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11130,7 +11163,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11133 "configure"
+#line 11166 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libcilkrts/configure.ac b/libcilkrts/configure.ac
index d322616..4582d80 100644
--- a/libcilkrts/configure.ac
+++ b/libcilkrts/configure.ac
@@ -37,6 +37,9 @@ AC_PREREQ([2.64])
 # Needed to define ${target}.  Needs to be very early to avoid annoying
 # warning about calling AC_ARG_PROGRAM before AC_CANONICAL_SYSTEM
 AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+AC_SUBST(target_alias)
+GCC_LIBSTDCXX_RAW_CXX_FLAGS
 AM_INIT_AUTOMAKE(foreign no-dist)
 
 AM_MAINTAINER_MODE
@@ -86,7 +89,7 @@ case ${enable_version_specific_runtime_libs} in
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
     toolexecdir='$(libdir)/gcc/$(target_alias)'
-   toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
     ;;
   no)
     if test -n "$with_cross_host" &&
