diff --git a/configure b/configure
index 0b1d98a..ecaf81d 100755
--- a/configure
+++ b/configure
@@ -2245,7 +2245,7 @@ do_compare="$gcc_cv_prog_cmp_skip"


# Check for GMP and MPFR
-gmplibs="-lmpfr"
+gmplibs="-static -lmpfr"
gmpinc=
have_gmp=yes
# Specify a location for mpfr
diff --git a/configure.in b/configure.in
index ebd5d5b..98ea220 100644
--- a/configure.in
+++ b/configure.in
@@ -1049,7 +1049,7 @@ ACX_PROG_GNAT
ACX_PROG_CMP_IGNORE_INITIAL

# Check for GMP and MPFR
-gmplibs="-lmpfr"
+gmplibs="-static -lmpfr"
gmpinc=
have_gmp=yes
# Specify a location for mpfr
diff --git a/gcc/tlink.c b/gcc/tlink.c
index 081bc3f..bbcd64a 100644
--- a/gcc/tlink.c
+++ b/gcc/tlink.c
@@ -33,6 +33,16 @@ along with GCC; see the file COPYING3.  If not see

#define MAX_ITERATIONS 17

+/*
+ * SCO OpenServer 5.0.7/3.2 has no MAXPATHLEN, but it has PATH_MAX (256).
+ * in limits.h. But it is not usable under ordinal condition.
+ */
+#if !defined(MAXPATHLEN)
+#if defined(_SCO_DS)
+#define MAXPATHLEN     256
+#endif
+#endif
+
/* Defined in the automatically-generated underscore.c.  */
extern int prepends_underscore;

diff --git a/libstdc++-v3/include/c_std/std_cstring.h b/libstdc++-v3/include/c_std/std_cstring.h
index 5fef6b0..3b0bfd8 100644
--- a/libstdc++-v3/include/c_std/std_cstring.h
+++ b/libstdc++-v3/include/c_std/std_cstring.h
@@ -97,33 +97,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std)

  using ::memchr;

+#if !defined(_SCO_DS)
  inline void*
  memchr(void* __p, int __c, size_t __n)
  { return memchr(const_cast<const void*>(__p), __c, __n); }
+#endif

  using ::strchr;

+#if !defined(_SCO_DS)
  inline char*
  strchr(char* __s1, int __n)
  { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
+#endif

  using ::strpbrk;

+#if !defined(_SCO_DS)
  inline char*
  strpbrk(char* __s1, const char* __s2)
  { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
+#endif

  using ::strrchr;

+#if !defined(_SCO_DS)
  inline char*
  strrchr(char* __s1, int __n)
  { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
+#endif

  using ::strstr;

+#if !defined(_SCO_DS)
  inline char*
  strstr(char* __s1, const char* __s2)
  { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
+#endif

_GLIBCXX_END_NAMESPACE