diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 950ff94b4667264ae23121ae7781d282fa07b04f..969c8048825c95e84ac2d7a926820f52f5d3b60a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2007-09-07  Danny Smith  <dannysmith@users.sourceforge.net>
+
+	PR libstdc++/33203
+	* configure.host (error_constants_dir):  New variable,
+	defaulting to os/generic.
+	( mingw32*): Overide default.
+	* configure.ac (ERROR_CONSTANTS_SRCDIR): New.
+	* configure: Regenerate.
+	* include/Makefile.am (host_headers): Add
+	$(ERROR_CONSTANTS_SRCDIR)/error_constants.h .
+	* include/Makefile.in: Regenerate.
+	* include/std/system_error (enum posix_errno): Remove.
+	Include <bits/error_constants.h> instead.
+	* config/os/mingw32/error_constants.h: New.
+	* config/os/generic/error_constants.h: New.
+
 2007-09-06  Benjamin Kosnik  <bkoz@redhat.com>
 
 	* testsuite/lib/libstdc++.exp: Check CXXFLAGS.
diff --git a/libstdc++-v3/config/os/generic/error_constants.h b/libstdc++-v3/config/os/generic/error_constants.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b0a6bf2799b1f06a8b405e5518b6eefc173421d
--- /dev/null
+++ b/libstdc++-v3/config/os/generic/error_constants.h
@@ -0,0 +1,157 @@
+// Specific definitions for generic platforms  -*- C++ -*-
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file error_constants.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#  define _GLIBCXX_ERROR_CONSTANTS 1
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+ enum posix_errno
+    {
+      address_family_not_supported = 		EAFNOSUPPORT,
+      address_in_use = 				EADDRINUSE,
+      address_not_available = 			EADDRNOTAVAIL,
+      already_connected = 			EISCONN,
+      argument_list_too_long = 			E2BIG,
+      argument_out_of_domain = 			EDOM,
+      bad_address = 				EFAULT,
+      bad_file_descriptor = 			EBADF,
+
+#ifdef _GLIBCXX_HAVE_EBADMSG
+      bad_message = 				EBADMSG,
+#endif
+
+      broken_pipe = 				EPIPE,
+      connection_aborted = 			ECONNABORTED,
+      connection_already_in_progress = 		EALREADY,
+      connection_refused = 			ECONNREFUSED,
+      connection_reset = 			ECONNRESET,
+      cross_device_link = 			EXDEV,
+      destination_address_required = 		EDESTADDRREQ,
+      device_or_resource_busy = 		EBUSY,
+      directory_not_empty = 			ENOTEMPTY,
+      executable_format_error = 		ENOEXEC,
+      file_exists = 	       			EEXIST,
+      file_too_large = 				EFBIG,
+      filename_too_long = 			ENAMETOOLONG,
+      function_not_supported = 			ENOSYS,
+      host_unreachable = 			EHOSTUNREACH,
+      identifier_removed = 			EIDRM,
+      illegal_byte_sequence = 			EILSEQ,
+      inappropriate_io_control_operation = 	ENOTTY,
+      interrupted = 				EINTR,
+      invalid_argument = 			EINVAL,
+      invalid_seek = 				ESPIPE,
+      io_error = 				EIO,
+      is_a_directory = 				EISDIR,
+      message_size = 				EMSGSIZE,
+      network_down = 				ENETDOWN,
+      network_reset = 				ENETRESET,
+      network_unreachable = 			ENETUNREACH,
+      no_buffer_space = 			ENOBUFS,
+      no_child_process = 			ECHILD,
+
+#ifdef _GLIBCXX_HAVE_ENOLINK
+      no_link = 				ENOLINK,
+#endif
+      no_lock_available = 			ENOLCK,
+
+#ifdef _GLIBCXX_HAVE_ENODATA
+      no_message_available = 			ENODATA, 
+#endif
+
+      no_message = 				ENOMSG, 
+      no_protocol_option = 			ENOPROTOOPT,
+      no_space_on_device = 			ENOSPC,
+
+#ifdef _GLIBCXX_HAVE_ENOSR
+      no_stream_resources = 			ENOSR,
+#endif
+
+      no_such_device_or_address = 		ENXIO,
+      no_such_device = 				ENODEV,
+      no_such_file_or_directory = 		ENOENT,
+      no_such_process = 			ESRCH,
+      not_a_directory = 			ENOTDIR,
+      not_a_socket = 				ENOTSOCK,
+
+#ifdef _GLIBCXX_HAVE_ENOSTR
+      not_a_stream = 				ENOSTR,
+#endif
+
+      not_connected = 				ENOTCONN,
+      not_enough_memory = 			ENOMEM,
+      not_supported = 				ENOTSUP,
+      operation_canceled = 			ECANCELED,
+      operation_in_progress = 			EINPROGRESS,
+      operation_not_permitted = 		EPERM,
+      operation_not_supported = 		EOPNOTSUPP,
+      operation_would_block = 			EWOULDBLOCK,
+#ifdef _GLIBCXX_HAVE_EOWNERDEAD
+      owner_dead = 				EOWNERDEAD,
+#endif
+      permission_denied = 			EACCES,
+#ifdef _GLIBCXX_HAVE_EPROTO
+      protocol_error = 				EPROTO,
+#endif
+      protocol_not_supported = 			EPROTONOSUPPORT,
+      read_only_file_system = 			EROFS,
+      resource_deadlock_would_occur = 		EDEADLK,
+      resource_unavailable_try_again = 		EAGAIN,
+      result_out_of_range = 			ERANGE,
+#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
+      state_not_recoverable = 			ENOTRECOVERABLE,
+#endif
+
+#ifdef _GLIBCXX_HAVE_ETIME
+      stream_timeout = 				ETIME,
+#endif
+
+      text_file_busy = 				ETXTBSY,
+      timed_out = 				ETIMEDOUT,
+      too_many_files_open_in_system = 		ENFILE,
+      too_many_files_open = 			EMFILE,
+      too_many_links = 				EMLINK,
+      too_many_synbolic_link_levels = 		ELOOP,
+      value_too_large = 			EOVERFLOW,
+      wrong_protocol_type = 			EPROTOTYPE,
+      no_posix_equivalent = 1L << 16
+    };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/libstdc++-v3/config/os/mingw32/error_constants.h b/libstdc++-v3/config/os/mingw32/error_constants.h
new file mode 100644
index 0000000000000000000000000000000000000000..85d9273582fc12c76a754a53932fb3456aa657f0
--- /dev/null
+++ b/libstdc++-v3/config/os/mingw32/error_constants.h
@@ -0,0 +1,131 @@
+// Specific definitions for mingw32 platform  -*- C++ -*-
+
+// Copyright (C) 2007 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file error_constants.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_ERROR_CONSTANTS
+#  define _GLIBCXX_ERROR_CONSTANTS
+
+#include <bits/c++config.h>
+#include <cerrno>
+
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+// Most of the commented-out error codes are socket-related and could be
+// replaced bu Winsock WSA-prefixed equivalents. 
+  enum posix_errno
+    {
+//    address_family_not_supported = 		EAFNOSUPPORT,
+//    address_in_use = 				EADDRINUSE,
+//    address_not_available = 			EADDRNOTAVAIL,
+//    already_connected = 			EISCONN,
+      argument_list_too_long = 			E2BIG,
+      argument_out_of_domain = 			EDOM,
+      bad_address = 				EFAULT,
+      bad_file_descriptor = 			EBADF,
+//    bad_message = 				EBADMSG,
+      broken_pipe = 				EPIPE,
+//    connection_aborted = 			ECONNABORTED,
+//    connection_already_in_progress = 		EALREADY,
+//    connection_refused = 			ECONNREFUSED,
+//    connection_reset = 			ECONNRESET,
+//    cross_device_link = 			EXDEV,
+//    destination_address_required = 		EDESTADDRREQ,
+      device_or_resource_busy = 		EBUSY,
+      directory_not_empty = 			ENOTEMPTY,
+      executable_format_error = 		ENOEXEC,
+      file_exists = 	       			EEXIST,
+      file_too_large = 				EFBIG,
+      filename_too_long = 			ENAMETOOLONG,
+      function_not_supported = 			ENOSYS,
+//    host_unreachable = 			EHOSTUNREACH,
+//    identifier_removed = 			EIDRM,
+      illegal_byte_sequence = 			EILSEQ,
+      inappropriate_io_control_operation = 	ENOTTY,
+      interrupted = 				EINTR,
+      invalid_argument = 			EINVAL,
+      invalid_seek = 				ESPIPE,
+      io_error = 				EIO,
+      is_a_directory = 				EISDIR,
+//    message_size = 				EMSGSIZE,
+//    network_down = 				ENETDOWN,
+//    network_reset = 				ENETRESET,
+//    network_unreachable = 			ENETUNREACH,
+//    no_buffer_space = 			ENOBUFS,
+//    no_child_process = 			ECHILD,
+//    no_link = 				ENOLINK,
+      no_lock_available = 			ENOLCK,
+//    no_message_available = 			ENODATA, 
+//    no_message = 				ENOMSG, 
+//    no_protocol_option = 			ENOPROTOOPT,
+//    no_space_on_device = 			ENOSPC,
+//    no_stream_resources = 			ENOSR,
+      no_such_device_or_address = 		ENXIO,
+      no_such_device = 				ENODEV,
+      no_such_file_or_directory = 		ENOENT,
+      no_such_process = 			ESRCH,
+      not_a_directory = 			ENOTDIR,
+//    not_a_socket = 				ENOTSOCK,
+//    not_a_stream = 				ENOSTR,
+//    not_connected = 				ENOTCONN,
+      not_enough_memory = 			ENOMEM,
+//    not_supported = 				ENOTSUP,
+//    operation_canceled = 			ECANCELED,
+//    operation_in_progress = 			EINPROGRESS,
+//    operation_not_permitted = 		EPERM,
+//    operation_not_supported = 		EOPNOTSUPP,
+//    operation_would_block = 			EWOULDBLOCK,
+//    owner_dead = 				EOWNERDEAD,
+      permission_denied = 			EACCES,
+//    protocol_error = 				EPROTO,
+//    protocol_not_supported = 			EPROTONOSUPPORT,
+      read_only_file_system = 			EROFS,
+      resource_deadlock_would_occur = 		EDEADLK,
+      resource_unavailable_try_again = 		EAGAIN,
+      result_out_of_range = 			ERANGE,
+//    state_not_recoverable = 			ENOTRECOVERABLE,
+//    stream_timeout = 				ETIME,
+//    text_file_busy = 				ETXTBSY,
+//    timed_out = 				ETIMEDOUT,
+      too_many_files_open_in_system = 		ENFILE,
+      too_many_files_open = 			EMFILE,
+      too_many_links = 				EMLINK,
+ //   too_many_synbolic_link_levels = 		ELOOP,
+ //   value_too_large = 			EOVERFLOW,
+ //   wrong_protocol_type = 			EPROTOTYPE,
+      no_posix_equivalent = 1L << 16
+   };
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 0e6eb2f8101603f0dd6256634c027826d8c365dc..e2371b936c28c88270856c1c7dfe8e53f20abd51 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -458,7 +458,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM lt_ECHO LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE EXTRA_CXX_FLAGS glibcxx_thread_h WERROR SECTION_FLAGS SECTION_LDFLAGS OPT_LDFLAGS LIBMATHOBJS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -93835,6 +93835,7 @@ ATOMICITY_SRCDIR=config/${atomicity_dir}
 ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
 CPU_DEFINES_SRCDIR=config/${cpu_defines_dir}
 OS_INC_SRCDIR=config/${os_include_dir}
+ERROR_CONSTANTS_SRCDIR=config/${error_constants_dir}
 ABI_TWEAKS_SRCDIR=config/${abi_tweaks_dir}
 
 
@@ -95437,6 +95438,7 @@ s,@ATOMIC_WORD_SRCDIR@,$ATOMIC_WORD_SRCDIR,;t t
 s,@CPU_DEFINES_SRCDIR@,$CPU_DEFINES_SRCDIR,;t t
 s,@ABI_TWEAKS_SRCDIR@,$ABI_TWEAKS_SRCDIR,;t t
 s,@OS_INC_SRCDIR@,$OS_INC_SRCDIR,;t t
+s,@ERROR_CONSTANTS_SRCDIR@,$ERROR_CONSTANTS_SRCDIR,;t t
 s,@glibcxx_prefixdir@,$glibcxx_prefixdir,;t t
 s,@gxx_include_dir@,$gxx_include_dir,;t t
 s,@glibcxx_toolexecdir@,$glibcxx_toolexecdir,;t t
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 4ad8d0ebfad2f480f624ae725d9f7c6367826de1..a89e21df8a85219c76d15d0cf1223db3b1e38fd5 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -329,12 +329,14 @@ ATOMICITY_SRCDIR=config/${atomicity_dir}
 ATOMIC_WORD_SRCDIR=config/${atomic_word_dir}
 CPU_DEFINES_SRCDIR=config/${cpu_defines_dir}
 OS_INC_SRCDIR=config/${os_include_dir}
+ERROR_CONSTANTS_SRCDIR=config/${error_constants_dir}
 ABI_TWEAKS_SRCDIR=config/${abi_tweaks_dir}
 AC_SUBST(ATOMICITY_SRCDIR)
 AC_SUBST(ATOMIC_WORD_SRCDIR)
 AC_SUBST(CPU_DEFINES_SRCDIR)
 AC_SUBST(ABI_TWEAKS_SRCDIR)
 AC_SUBST(OS_INC_SRCDIR)
+AC_SUBST(ERROR_CONSTANTS_SRCDIR)
 
 
 # Determine cross-compile flags and AM_CONDITIONALs.
diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
index 6fe4140be79ed3b37b2c988d652ebceab4fd4b1f..b916abacc7e2960379299cae9ad50c149d73d8ee 100644
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -42,6 +42,10 @@
 #   cpu_defines_dir        location of cpu_defines.h
 #                          defaults to generic.
 #
+#
+#   error_constants_dir    location of error_constants.h
+#                          defaults to os/generic.
+#
 # It possibly modifies the following variables:
 #
 #   OPT_LDFLAGS            extra flags to pass when linking the library, of
@@ -71,6 +75,7 @@ atomicity_dir="cpu/generic"
 cpu_defines_dir="cpu/generic"
 try_cpu=generic
 abi_tweaks_dir="cpu/generic"
+error_constants_dir="os/generic"
 
 # HOST-SPECIFIC OVERRIDES
 # Set any CPU-dependent bits.
@@ -161,6 +166,7 @@ fi
 
 # Set any OS-dependent bits.
 # Set the os_include_dir.
+# Set the error_costants_dir.
 # Set c_model, c_compatibility here.
 # If atomic ops and/or numeric limits are OS-specific rather than
 # CPU-specifc, set those here too.
@@ -238,6 +244,7 @@ case "${host_os}" in
     ;;
   mingw32*)
     os_include_dir="os/mingw32"
+    error_constants_dir="os/mingw32"
     ;;
   netbsd*)
     os_include_dir="os/bsd/netbsd"
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 367e3af9badd2a276c18c2040543bf6bf57caaa4..53ede2bc3f58836eaa76634fc2d56b4ad02d7eda 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -756,6 +756,7 @@ host_headers = \
 	${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
 	${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
 	${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h \
+	${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
 	${glibcxx_srcdir}/include/precompiled/stdc++.h \
 	${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
 	${glibcxx_srcdir}/include/precompiled/extc++.h 
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 5a0aa1c305cb7256d0b7d113f00634363f51f21d..4f779a0de626412b54915169ecb9b04cfc70335d 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -118,6 +118,7 @@ ENABLE_SYMVERS_GNU_TRUE = @ENABLE_SYMVERS_GNU_TRUE@
 ENABLE_SYMVERS_TRUE = @ENABLE_SYMVERS_TRUE@
 ENABLE_VISIBILITY_FALSE = @ENABLE_VISIBILITY_FALSE@
 ENABLE_VISIBILITY_TRUE = @ENABLE_VISIBILITY_TRUE@
+ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
 EXEEXT = @EXEEXT@
 EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
 FGREP = @FGREP@
@@ -983,6 +984,7 @@ host_headers = \
 	${glibcxx_srcdir}/$(ATOMIC_WORD_SRCDIR)/atomic_word.h \
 	${glibcxx_srcdir}/$(ABI_TWEAKS_SRCDIR)/cxxabi_tweaks.h \
 	${glibcxx_srcdir}/$(CPU_DEFINES_SRCDIR)/cpu_defines.h \
+	${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
 	${glibcxx_srcdir}/include/precompiled/stdc++.h \
 	${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
 	${glibcxx_srcdir}/include/precompiled/extc++.h 
diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error
index 9758d5ebb7a3be917405fecbf929a5652e6c5ead..495360caf05a03dfb0ea123dc86e3c38deccea0c 100644
--- a/libstdc++-v3/include/std/system_error
+++ b/libstdc++-v3/include/std/system_error
@@ -41,7 +41,7 @@
 #endif
 
 #include <bits/c++config.h>
-#include <cerrno>
+#include <bits/error_constants.h>
 #include <iosfwd>
 #include <stdexcept>
 
@@ -53,118 +53,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   extern const error_category& system_category;
 
-  enum posix_errno
-    {
-      address_family_not_supported = 		EAFNOSUPPORT,
-      address_in_use = 				EADDRINUSE,
-      address_not_available = 			EADDRNOTAVAIL,
-      already_connected = 			EISCONN,
-      argument_list_too_long = 			E2BIG,
-      argument_out_of_domain = 			EDOM,
-      bad_address = 				EFAULT,
-      bad_file_descriptor = 			EBADF,
-
-#ifdef _GLIBCXX_HAVE_EBADMSG
-      bad_message = 				EBADMSG,
-#endif
-
-      broken_pipe = 				EPIPE,
-      connection_aborted = 			ECONNABORTED,
-      connection_already_in_progress = 		EALREADY,
-      connection_refused = 			ECONNREFUSED,
-      connection_reset = 			ECONNRESET,
-      cross_device_link = 			EXDEV,
-      destination_address_required = 		EDESTADDRREQ,
-      device_or_resource_busy = 		EBUSY,
-      directory_not_empty = 			ENOTEMPTY,
-      executable_format_error = 		ENOEXEC,
-      file_exists = 	       			EEXIST,
-      file_too_large = 				EFBIG,
-      filename_too_long = 			ENAMETOOLONG,
-      function_not_supported = 			ENOSYS,
-      host_unreachable = 			EHOSTUNREACH,
-      identifier_removed = 			EIDRM,
-      illegal_byte_sequence = 			EILSEQ,
-      inappropriate_io_control_operation = 	ENOTTY,
-      interrupted = 				EINTR,
-      invalid_argument = 			EINVAL,
-      invalid_seek = 				ESPIPE,
-      io_error = 				EIO,
-      is_a_directory = 				EISDIR,
-      message_size = 				EMSGSIZE,
-      network_down = 				ENETDOWN,
-      network_reset = 				ENETRESET,
-      network_unreachable = 			ENETUNREACH,
-      no_buffer_space = 			ENOBUFS,
-      no_child_process = 			ECHILD,
-
-#ifdef _GLIBCXX_HAVE_ENOLINK
-      no_link = 				ENOLINK,
-#endif
-      no_lock_available = 			ENOLCK,
-
-#ifdef _GLIBCXX_HAVE_ENODATA
-      no_message_available = 			ENODATA, 
-#endif
-
-      no_message = 				ENOMSG, 
-      no_protocol_option = 			ENOPROTOOPT,
-      no_space_on_device = 			ENOSPC,
-
-#ifdef _GLIBCXX_HAVE_ENOSR
-      no_stream_resources = 			ENOSR,
-#endif
-
-      no_such_device_or_address = 		ENXIO,
-      no_such_device = 				ENODEV,
-      no_such_file_or_directory = 		ENOENT,
-      no_such_process = 			ESRCH,
-      not_a_directory = 			ENOTDIR,
-      not_a_socket = 				ENOTSOCK,
-
-#ifdef _GLIBCXX_HAVE_ENOSTR
-      not_a_stream = 				ENOSTR,
-#endif
-
-      not_connected = 				ENOTCONN,
-      not_enough_memory = 			ENOMEM,
-      not_supported = 				ENOTSUP,
-      operation_canceled = 			ECANCELED,
-      operation_in_progress = 			EINPROGRESS,
-      operation_not_permitted = 		EPERM,
-      operation_not_supported = 		EOPNOTSUPP,
-      operation_would_block = 			EWOULDBLOCK,
-#ifdef _GLIBCXX_HAVE_EOWNERDEAD
-      owner_dead = 				EOWNERDEAD,
-#endif
-      permission_denied = 			EACCES,
-#ifdef _GLIBCXX_HAVE_EPROTO
-      protocol_error = 				EPROTO,
-#endif
-      protocol_not_supported = 			EPROTONOSUPPORT,
-      read_only_file_system = 			EROFS,
-      resource_deadlock_would_occur = 		EDEADLK,
-      resource_unavailable_try_again = 		EAGAIN,
-      result_out_of_range = 			ERANGE,
-#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE
-      state_not_recoverable = 			ENOTRECOVERABLE,
-#endif
-
-#ifdef _GLIBCXX_HAVE_ETIME
-      stream_timeout = 				ETIME,
-#endif
-
-      text_file_busy = 				ETXTBSY,
-      timed_out = 				ETIMEDOUT,
-      too_many_files_open_in_system = 		ENFILE,
-      too_many_files_open = 			EMFILE,
-      too_many_links = 				EMLINK,
-      too_many_synbolic_link_levels = 		ELOOP,
-      value_too_large = 			EOVERFLOW,
-      wrong_protocol_type = 			EPROTOTYPE,
-      no_posix_equivalent = 1L << 16
-    };
-
   struct error_category
   {
     error_category() { }