diff -Naurd mpfr-2.3.1-a/acinclude.m4 mpfr-2.3.1-b/acinclude.m4
--- mpfr-2.3.1-a/acinclude.m4	2008-01-23 13:36:46.000000000 +0000
+++ mpfr-2.3.1-b/acinclude.m4	2008-01-23 13:36:46.000000000 +0000
@@ -286,6 +286,9 @@
 dnl    important to run the test below.
 if test "$enable_thread_safe" = yes; then
 AC_CACHE_CHECK([for TLS support], mpfr_cv_working_tls, [
+saved_CPPFLAGS="$CPPFLAGS"
+# The -I$srcdir is necessary when objdir is different from srcdir.
+CPPFLAGS="$CPPFLAGS -I$srcdir"
 AC_RUN_IFELSE([
 #define MPFR_USE_THREAD_SAFE 1
 #include "mpfr-thread.h"
@@ -297,6 +300,7 @@
      [AC_MSG_RESULT(no)
       AC_MSG_ERROR([please configure with --disable-thread-safe])],
      [mpfr_cv_working_tls="cannot test, assume yes"])
+CPPFLAGS="$saved_CPPFLAGS"
 ])
 fi
 ])
diff -Naurd mpfr-2.3.1-a/configure mpfr-2.3.1-b/configure
--- mpfr-2.3.1-a/configure	2008-01-29 08:51:07.000000000 +0000
+++ mpfr-2.3.1-b/configure	2008-05-10 23:49:37.000000000 +0000
@@ -7528,6 +7528,9 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
+saved_CPPFLAGS="$CPPFLAGS"
+# The -I$srcdir is necessary when objdir is different from srcdir.
+CPPFLAGS="$CPPFLAGS -I$srcdir"
 if test "$cross_compiling" = yes; then
   mpfr_cv_working_tls="cannot test, assume yes"
 else
@@ -7578,6 +7581,7 @@
 fi
 
 
+CPPFLAGS="$saved_CPPFLAGS"
 
 fi
 { echo "$as_me:$LINENO: result: $mpfr_cv_working_tls" >&5
@@ -9278,7 +9282,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 9281 "configure"' > conftest.$ac_ext
+  echo '#line 9285 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -11103,11 +11107,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11106: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11110: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11110: \$? = $ac_status" >&5
+   echo "$as_me:11114: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -11393,11 +11397,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11396: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11400: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11400: \$? = $ac_status" >&5
+   echo "$as_me:11404: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -11497,11 +11501,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11500: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11504: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11504: \$? = $ac_status" >&5
+   echo "$as_me:11508: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13859,7 +13863,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13862 "configure"
+#line 13866 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -13959,7 +13963,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 13962 "configure"
+#line 13966 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16379,11 +16383,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16382: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16386: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16386: \$? = $ac_status" >&5
+   echo "$as_me:16390: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16483,11 +16487,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16486: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16490: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16490: \$? = $ac_status" >&5
+   echo "$as_me:16494: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18060,11 +18064,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18063: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18067: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:18067: \$? = $ac_status" >&5
+   echo "$as_me:18071: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -18164,11 +18168,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18167: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18171: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:18171: \$? = $ac_status" >&5
+   echo "$as_me:18175: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20364,11 +20368,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:20367: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20371: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:20371: \$? = $ac_status" >&5
+   echo "$as_me:20375: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -20654,11 +20658,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:20657: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20661: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:20661: \$? = $ac_status" >&5
+   echo "$as_me:20665: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -20758,11 +20762,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:20761: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:20765: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:20765: \$? = $ac_status" >&5
+   echo "$as_me:20769: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized