[PATCHv2] Use toplevel configure for GMP and MPFR for gdb

Message ID 1668107159-16961-1-git-send-email-apinski@marvell.com
State Committed
Commit 991180627851801f1999d1ebbc0e569a17e47c74
Headers
Series [PATCHv2] Use toplevel configure for GMP and MPFR for gdb |

Commit Message

Peikes, Wendy via Gdb-patches Nov. 10, 2022, 7:05 p.m. UTC
  From: Andrew Pinski <apinski@marvell.com>

This patch uses the toplevel configure parts for GMP/MPFR for
gdb. The only thing is that gdb now requires MPFR for building.
Before it was a recommended but not required library.
Also this allows building of GMP and MPFR with the toplevel
directory just like how it is done for GCC.
We now error out in the toplevel configure of the version
of GMP and MPFR that is wrong.

OK after GDB 13 branches? Build gdb 3 ways:
with GMP and MPFR in the toplevel (static library used at that point for both)
With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
With neither GMP and MPFR in the toplevel (distro libraries used)

Changes from v1:
* Updated gdb/README and gdb/doc/gdb.texinfo.
* Regenerated using unmodified autoconf-2.69

Thanks,
Andrew Pinski

ChangeLog:
	* Makefile.def: Add configure-gdb dependencies
	on all-gmp and all-mpfr.
	* configure.ac: Split out MPC checking from MPFR.
	Require GMP and MPFR if the gdb directory exist.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

gdb/ChangeLog:

	PR bug/28500
	* configure.ac: Remove AC_LIB_HAVE_LINKFLAGS
	for gmp and mpfr.
	Use GMPLIBS and GMPINC which is provided by the
	toplevel configure.
	* Makefile.in (LIBGMP, LIBMPFR): Remove.
	(GMPLIBS, GMPINC): Add definition.
	(INTERNAL_CFLAGS_BASE): Add GMPINC.
	(CLIBS): Exchange LIBMPFR and LIBGMP
	for GMPLIBS.
	* target-float.c: Make the code conditional on
	HAVE_LIBMPFR unconditional.
	* top.c: Remove code checking HAVE_LIBMPFR.
	* configure: Regenerate.
	* config.in: Regenerate.
	* README: Update GMP/MPFR section of the config
	options.
	* doc/gdb.texinfo: Likewise.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28500
---
 Makefile.def        |    2 +
 Makefile.in         |    2 +
 configure           |   67 ++-
 configure.ac        |   45 +-
 gdb/Makefile.in     |   12 +-
 gdb/README          |   28 +-
 gdb/config.in       |    6 -
 gdb/configure       | 1014 +------------------------------------------
 gdb/configure.ac    |   31 +-
 gdb/doc/gdb.texinfo |   13 +-
 gdb/target-float.c  |    8 -
 gdb/top.c           |    8 -
 12 files changed, 142 insertions(+), 1094 deletions(-)
  

Comments

Jeff Law Nov. 16, 2022, 3:59 a.m. UTC | #1
On 11/10/22 12:05, apinski--- via Gcc-patches wrote:
> From: Andrew Pinski <apinski@marvell.com>
>
> This patch uses the toplevel configure parts for GMP/MPFR for
> gdb. The only thing is that gdb now requires MPFR for building.
> Before it was a recommended but not required library.
> Also this allows building of GMP and MPFR with the toplevel
> directory just like how it is done for GCC.
> We now error out in the toplevel configure of the version
> of GMP and MPFR that is wrong.
>
> OK after GDB 13 branches? Build gdb 3 ways:
> with GMP and MPFR in the toplevel (static library used at that point for both)
> With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
> With neither GMP and MPFR in the toplevel (distro libraries used)
>
> Changes from v1:
> * Updated gdb/README and gdb/doc/gdb.texinfo.
> * Regenerated using unmodified autoconf-2.69
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
> 	* Makefile.def: Add configure-gdb dependencies
> 	on all-gmp and all-mpfr.
> 	* configure.ac: Split out MPC checking from MPFR.
> 	Require GMP and MPFR if the gdb directory exist.
> 	* Makefile.in: Regenerate.
> 	* configure: Regenerate.
>
> gdb/ChangeLog:
>
> 	PR bug/28500
> 	* configure.ac: Remove AC_LIB_HAVE_LINKFLAGS
> 	for gmp and mpfr.
> 	Use GMPLIBS and GMPINC which is provided by the
> 	toplevel configure.
> 	* Makefile.in (LIBGMP, LIBMPFR): Remove.
> 	(GMPLIBS, GMPINC): Add definition.
> 	(INTERNAL_CFLAGS_BASE): Add GMPINC.
> 	(CLIBS): Exchange LIBMPFR and LIBGMP
> 	for GMPLIBS.
> 	* target-float.c: Make the code conditional on
> 	HAVE_LIBMPFR unconditional.
> 	* top.c: Remove code checking HAVE_LIBMPFR.
> 	* configure: Regenerate.
> 	* config.in: Regenerate.
> 	* README: Update GMP/MPFR section of the config
> 	options.
> 	* doc/gdb.texinfo: Likewise.

If the GDB folks confirm they want this behavior, then the toplevel bits 
are fine.

Jeff
  
Tom Tromey Nov. 16, 2022, 4:01 p.m. UTC | #2
>>>>> "Jeff" == Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

>> This patch uses the toplevel configure parts for GMP/MPFR for
>> gdb.

Jeff> If the GDB folks confirm they want this behavior, then the toplevel
Jeff> bits are fine.

I think we do, but my inclination is to wait until after GDB 13 branches.
CCing Joel to see what he thinks, as he handles the releases.

Tom
  
Jeff Law Nov. 16, 2022, 6:50 p.m. UTC | #3
On 11/16/22 09:01, Tom Tromey wrote:
>>>>>> "Jeff" == Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>>> This patch uses the toplevel configure parts for GMP/MPFR for
>>> gdb.
> Jeff> If the GDB folks confirm they want this behavior, then the toplevel
> Jeff> bits are fine.
>
> I think we do, but my inclination is to wait until after GDB 13 branches.
> CCing Joel to see what he thinks, as he handles the releases.

I think I may have cut too much context.  At some point I know I saw a 
note that it wouldn't be installed until after gdb-13 releases/branches.


jeff
  
Tom Tromey Dec. 20, 2022, 6:59 p.m. UTC | #4
>>>>> "Andrew" == apinski--- via Gdb-patches <gdb-patches@sourceware.org> writes:

Andrew> From: Andrew Pinski <apinski@marvell.com>
Andrew> This patch uses the toplevel configure parts for GMP/MPFR for
Andrew> gdb. The only thing is that gdb now requires MPFR for building.
Andrew> Before it was a recommended but not required library.
Andrew> Also this allows building of GMP and MPFR with the toplevel
Andrew> directory just like how it is done for GCC.
Andrew> We now error out in the toplevel configure of the version
Andrew> of GMP and MPFR that is wrong.

Andrew> OK after GDB 13 branches? Build gdb 3 ways:
Andrew> with GMP and MPFR in the toplevel (static library used at that point for both)
Andrew> With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
Andrew> With neither GMP and MPFR in the toplevel (distro libraries used)

I think it's fine to move forward with this now.
Thank you again for doing this.

Tom
  
Andrew Pinski Dec. 21, 2022, 3:45 a.m. UTC | #5
On Tue, Dec 20, 2022 at 10:59 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Andrew" == apinski--- via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Andrew> From: Andrew Pinski <apinski@marvell.com>
> Andrew> This patch uses the toplevel configure parts for GMP/MPFR for
> Andrew> gdb. The only thing is that gdb now requires MPFR for building.
> Andrew> Before it was a recommended but not required library.
> Andrew> Also this allows building of GMP and MPFR with the toplevel
> Andrew> directory just like how it is done for GCC.
> Andrew> We now error out in the toplevel configure of the version
> Andrew> of GMP and MPFR that is wrong.
>
> Andrew> OK after GDB 13 branches? Build gdb 3 ways:
> Andrew> with GMP and MPFR in the toplevel (static library used at that point for both)
> Andrew> With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
> Andrew> With neither GMP and MPFR in the toplevel (distro libraries used)
>
> I think it's fine to move forward with this now.
> Thank you again for doing this.

Just to double check this is an approval?

Jeff,
  Just to double check this is still ok for gcc repo even if we are in stage 3?

Thanks,
Andrew Pinski


>
> Tom
  
Jeff Law Dec. 21, 2022, 2:56 p.m. UTC | #6
On 12/20/22 20:45, Andrew Pinski wrote:
> On Tue, Dec 20, 2022 at 10:59 AM Tom Tromey <tom@tromey.com> wrote:
>>
>>>>>>> "Andrew" == apinski--- via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
>> Andrew> From: Andrew Pinski <apinski@marvell.com>
>> Andrew> This patch uses the toplevel configure parts for GMP/MPFR for
>> Andrew> gdb. The only thing is that gdb now requires MPFR for building.
>> Andrew> Before it was a recommended but not required library.
>> Andrew> Also this allows building of GMP and MPFR with the toplevel
>> Andrew> directory just like how it is done for GCC.
>> Andrew> We now error out in the toplevel configure of the version
>> Andrew> of GMP and MPFR that is wrong.
>>
>> Andrew> OK after GDB 13 branches? Build gdb 3 ways:
>> Andrew> with GMP and MPFR in the toplevel (static library used at that point for both)
>> Andrew> With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
>> Andrew> With neither GMP and MPFR in the toplevel (distro libraries used)
>>
>> I think it's fine to move forward with this now.
>> Thank you again for doing this.
> 
> Just to double check this is an approval?
> 
> Jeff,
>    Just to double check this is still ok for gcc repo even if we are in stage 3?
Yea, it was submitted prior to stage1 closing and approved for GCC once 
the GDB folks signed off.

jeff
  
Tom Tromey Dec. 21, 2022, 3:03 p.m. UTC | #7
>> I think it's fine to move forward with this now.
>> Thank you again for doing this.

Andrew> Just to double check this is an approval?

Yes, sorry for being unclear.

Tom
  
Clément Chigot Jan. 3, 2023, 10:52 a.m. UTC | #8
Hi guys,

Since this patch, binutils without mpfr and gmp is unable to build
when gdb is disabled (with configure option --disable-gdb). But
AFAICT, these libraries are not required if gdb isn't there.
Moreover, the following error looks wrong to me when gdb is explicitly
requested not to be built.
  | configure: error: Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
  | Try the --with-gmp and/or --with-mpfr options to specify

Thus, I'm wondering if there are any plans to also use gmp and mpfr in
binutils without gdb (adding Nick for that) ? In this case, we would
want to change the error message.
Or is this patch only meant for gdb and should be adjusted for --disable-gdb ?

Thanks,
Clément
  
Nick Clifton Jan. 3, 2023, 11:51 a.m. UTC | #9
Hi Clément,

> Since this patch, binutils without mpfr and gmp is unable to build
> when gdb is disabled (with configure option --disable-gdb). But
> AFAICT, these libraries are not required if gdb isn't there.

Agreed - binutils does not use them.

> Moreover, the following error looks wrong to me when gdb is explicitly
> requested not to be built.
>    | configure: error: Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
>    | Try the --with-gmp and/or --with-mpfr options to specify

Yup - the message should not be generated if gdb is not being built.

> Thus, I'm wondering if there are any plans to also use gmp and mpfr in
> binutils without gdb (adding Nick for that) ? 

No - there are none.

> Or is this patch only meant for gdb and should be adjusted for --disable-gdb ?

It should be adjusted.

Cheers
   Nick
  
Andrew Pinski Jan. 3, 2023, 11:52 a.m. UTC | #10
On Tue, Jan 3, 2023 at 2:52 AM Clément Chigot <chigot@adacore.com> wrote:
>
> Hi guys,
>
> Since this patch, binutils without mpfr and gmp is unable to build
> when gdb is disabled (with configure option --disable-gdb).

The issue only happens if you are building from git repo. the release
versions of binutils does NOT include the gdb directory so it does not
matter.

Thanks,
Andrew Pinski


> But
> AFAICT, these libraries are not required if gdb isn't there.
> Moreover, the following error looks wrong to me when gdb is explicitly
> requested not to be built.
>   | configure: error: Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
>   | Try the --with-gmp and/or --with-mpfr options to specify
>
> Thus, I'm wondering if there are any plans to also use gmp and mpfr in
> binutils without gdb (adding Nick for that) ? In this case, we would
> want to change the error message.
> Or is this patch only meant for gdb and should be adjusted for --disable-gdb ?
>
> Thanks,
> Clément
  
Clément Chigot Jan. 3, 2023, 1:12 p.m. UTC | #11
Hi Andrew,

On Tue, Jan 3, 2023 at 12:52 PM Andrew Pinski <pinskia@gmail.com> wrote:
>
> On Tue, Jan 3, 2023 at 2:52 AM Clément Chigot <chigot@adacore.com> wrote:
> >
> > Hi guys,
> >
> > Since this patch, binutils without mpfr and gmp is unable to build
> > when gdb is disabled (with configure option --disable-gdb).
>
> The issue only happens if you are building from git repo. the release
> versions of binutils does NOT include the gdb directory so it does not
> matter.

This is the toplevel configure raising an error. The fact that the gdb
directory is embedded or not in the release doesn't matter here.
Moreover, we still want to be able to build from the git repository
with --disable-gdb.

Anyway, Nick answers confirm my idea. The toplevel configure should be
adjusted for --disable-gdb.
I'll take care of that.

Thanks,
Clément
  

Patch

diff --git a/Makefile.def b/Makefile.def
index acdcd625ed6..d5976e61d98 100644
--- a/Makefile.def
+++ b/Makefile.def
@@ -418,6 +418,8 @@  dependencies = { module=configure-isl; on=all-gmp; };
 dependencies = { module=all-intl; on=all-libiconv; };
 
 // Host modules specific to gdb.
+dependencies = { module=configure-gdb; on=all-gmp; };
+dependencies = { module=configure-gdb; on=all-mpfr; };
 dependencies = { module=configure-gdb; on=all-intl; };
 dependencies = { module=configure-gdb; on=configure-sim; };
 dependencies = { module=configure-gdb; on=all-bfd; };
diff --git a/Makefile.in b/Makefile.in
index cb39e4790d6..d0666c75b00 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -63748,6 +63748,8 @@  configure-libcc1: maybe-configure-gcc
 all-libcc1: maybe-all-gcc
 all-c++tools: maybe-all-gcc
 all-utils: maybe-all-libiberty
+configure-gdb: maybe-all-gmp
+configure-gdb: maybe-all-mpfr
 configure-gdb: maybe-all-intl
 configure-gdb: maybe-all-bfd
 configure-gdb: maybe-all-libiconv
diff --git a/configure b/configure
index 7bcb894d1fe..a891eeae4c0 100755
--- a/configure
+++ b/configure
@@ -8025,7 +8025,20 @@  _ACEOF
 
 
 # Check for GMP, MPFR and MPC
-gmplibs="-lmpc -lmpfr -lgmp"
+require_gmp=no
+require_mpc=no
+if test -d ${srcdir}/gcc ; then
+  require_gmp=yes
+  require_mpc=yes
+fi
+if test -d ${srcdir}/gdb ; then
+  require_gmp=yes
+fi
+
+gmplibs="-lmpfr -lgmp"
+if test x"$require_mpc" = "xyes" ; then
+  gmplibs="-lmpc $gmplibs"
+fi
 gmpinc=
 have_gmp=no
 
@@ -8160,7 +8173,7 @@  if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp;
   have_gmp=yes
 fi
 
-if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
+if test "x$require_gmp" = xyes && test "x$have_gmp" = xno; then
   have_gmp=yes
   saved_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $gmpinc"
@@ -8270,7 +8283,7 @@  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   fi
 
   # Check for the MPC header version.
-  if test x"$have_gmp" = xyes ; then
+  if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes ; then
     # Check for the recommended and required versions of MPC.
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of mpc.h" >&5
 $as_echo_n "checking for the correct version of mpc.h... " >&6; }
@@ -8324,18 +8337,17 @@  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   if test x"$have_gmp" = xyes; then
     saved_LIBS="$LIBS"
     LIBS="$LIBS $gmplibs"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of the gmp/mpfr/mpc libraries" >&5
-$as_echo_n "checking for the correct version of the gmp/mpfr/mpc libraries... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of the gmp/mpfr libraries" >&5
+$as_echo_n "checking for the correct version of the gmp/mpfr libraries... " >&6; }
     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <mpc.h>
+#include <mpfr.h>
 int
 main ()
 {
 
     mpfr_t n;
     mpfr_t x;
-    mpc_t c;
     int t;
     mpfr_init (n);
     mpfr_init (x);
@@ -8344,6 +8356,37 @@  main ()
     mpfr_subnormalize (x, t, MPFR_RNDN);
     mpfr_clear(n);
     mpfr_clear(x);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; have_gmp=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LIBS="$saved_LIBS"
+  fi
+
+  # Now check the MPC library
+  if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes; then
+    saved_LIBS="$LIBS"
+    LIBS="$LIBS $gmplibs"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the correct version of the mpc libraries" >&5
+$as_echo_n "checking for the correct version of the mpc libraries... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <mpc.h>
+int
+main ()
+{
+
+    mpc_t c;
     mpc_init2 (c, 53);
     mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
     mpc_cosh (c, c, MPC_RNDNN);
@@ -8372,7 +8415,8 @@  rm -f core conftest.err conftest.$ac_objext \
 # The library versions listed in the error message below should match
 # the HARD-minimums enforced above.
   if test x$have_gmp != xyes; then
-    as_fn_error $? "Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
+    if test -d ${srcdir}/gcc ; then
+      as_fn_error $? "Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
 Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
 their locations.  Source code for these libraries can be found at
 their respective hosting sites as well as at
@@ -8381,6 +8425,13 @@  http://gcc.gnu.org/install/prerequisites.html for additional info.  If
 you obtained GMP, MPFR and/or MPC from a vendor distribution package,
 make sure that you have installed both the libraries and the header
 files.  They may be located in separate packages." "$LINENO" 5
+    else
+      as_fn_error $? "Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
+Try the --with-gmp and/or --with-mpfr options to specify
+their locations.  If you obtained GMP and/or MPFR from a vendor
+distribution package, make sure that you have installed both the libraries
+and the header files.  They may be located in separate packages." "$LINENO" 5
+    fi
   fi
 fi
 
diff --git a/configure.ac b/configure.ac
index aab451467bd..84cc267faa4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1578,7 +1578,20 @@  AC_SUBST(PGO_BUILD_LTO_CFLAGS)
 _LT_CHECK_OBJDIR
 
 # Check for GMP, MPFR and MPC
-gmplibs="-lmpc -lmpfr -lgmp"
+require_gmp=no
+require_mpc=no
+if test -d ${srcdir}/gcc ; then
+  require_gmp=yes
+  require_mpc=yes
+fi
+if test -d ${srcdir}/gdb ; then
+  require_gmp=yes
+fi
+
+gmplibs="-lmpfr -lgmp"
+if test x"$require_mpc" = "xyes" ; then
+  gmplibs="-lmpc $gmplibs"
+fi
 gmpinc=
 have_gmp=no
 
@@ -1693,7 +1706,7 @@  if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp;
   have_gmp=yes
 fi
 
-if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
+if test "x$require_gmp" = xyes && test "x$have_gmp" = xno; then
   have_gmp=yes
   saved_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $gmpinc"
@@ -1733,7 +1746,7 @@  if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
   fi
 
   # Check for the MPC header version.
-  if test x"$have_gmp" = xyes ; then
+  if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes ; then
     # Check for the recommended and required versions of MPC.
     AC_MSG_CHECKING([for the correct version of mpc.h])
     AC_TRY_COMPILE([#include <mpc.h>],[
@@ -1752,11 +1765,10 @@  if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
   if test x"$have_gmp" = xyes; then
     saved_LIBS="$LIBS"
     LIBS="$LIBS $gmplibs"
-    AC_MSG_CHECKING([for the correct version of the gmp/mpfr/mpc libraries])
-    AC_TRY_LINK([#include <mpc.h>],[
+    AC_MSG_CHECKING([for the correct version of the gmp/mpfr libraries])
+    AC_TRY_LINK([#include <mpfr.h>],[
     mpfr_t n;
     mpfr_t x;
-    mpc_t c;
     int t;
     mpfr_init (n);
     mpfr_init (x);
@@ -1765,6 +1777,17 @@  if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
     mpfr_subnormalize (x, t, MPFR_RNDN);
     mpfr_clear(n);
     mpfr_clear(x);
+    ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
+    LIBS="$saved_LIBS"
+  fi
+
+  # Now check the MPC library
+  if test "x$require_mpc" = xyes && test x"$have_gmp" = xyes; then
+    saved_LIBS="$LIBS"
+    LIBS="$LIBS $gmplibs"
+    AC_MSG_CHECKING([for the correct version of the mpc libraries])
+    AC_TRY_LINK([#include <mpc.h>],[
+    mpc_t c;
     mpc_init2 (c, 53);
     mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
     mpc_cosh (c, c, MPC_RNDNN);
@@ -1780,7 +1803,8 @@  if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
 # The library versions listed in the error message below should match
 # the HARD-minimums enforced above.
   if test x$have_gmp != xyes; then
-    AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
+    if test -d ${srcdir}/gcc ; then
+      AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
 Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
 their locations.  Source code for these libraries can be found at
 their respective hosting sites as well as at
@@ -1789,6 +1813,13 @@  http://gcc.gnu.org/install/prerequisites.html for additional info.  If
 you obtained GMP, MPFR and/or MPC from a vendor distribution package,
 make sure that you have installed both the libraries and the header
 files.  They may be located in separate packages.])
+    else
+      AC_MSG_ERROR([Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
+Try the --with-gmp and/or --with-mpfr options to specify
+their locations.  If you obtained GMP and/or MPFR from a vendor
+distribution package, make sure that you have installed both the libraries
+and the header files.  They may be located in separate packages.])
+    fi
   fi
 fi
 
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index fb4d42c7baa..993bb6f1eda 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -208,11 +208,9 @@  LIBXXHASH = @LIBXXHASH@
 # Where is libipt?  This will be empty if libipt was not available.
 LIBIPT = @LIBIPT@
 
-# Where is libgmp?
-LIBGMP = @LIBGMP@
-
-# Where is libmpfr?  This will be empty if libmpfr was not available.
-LIBMPFR = @LIBMPFR@
+# How to find GMP and MPFR
+GMPLIBS = @GMPLIBS@
+GMPINC = @GMPINC@
 
 # GNU source highlight library.
 SRCHIGH_LIBS = @SRCHIGH_LIBS@
@@ -633,7 +631,7 @@  INTERNAL_CFLAGS_BASE = \
 	$(ZSTD_CFLAGS) $(BFD_CFLAGS) $(INCLUDE_CFLAGS) $(LIBDECNUMBER_CFLAGS) \
 	$(INTL_CFLAGS) $(INCGNU) $(INCSUPPORT) $(LIBBACKTRACE_INC) \
 	$(ENABLE_CFLAGS) $(INTERNAL_CPPFLAGS) $(SRCHIGH_CFLAGS) \
-	$(TOP_CFLAGS) $(PTHREAD_CFLAGS) $(DEBUGINFOD_CFLAGS)
+	$(TOP_CFLAGS) $(PTHREAD_CFLAGS) $(DEBUGINFOD_CFLAGS) $(GMPINC)
 INTERNAL_WARN_CFLAGS = $(INTERNAL_CFLAGS_BASE) $(GDB_WARN_CFLAGS)
 INTERNAL_CFLAGS = $(INTERNAL_WARN_CFLAGS) $(GDB_WERROR_CFLAGS)
 
@@ -658,7 +656,7 @@  CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) $(ZSTD_LIBS) \
 	@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
 	$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
 	$(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \
-	$(LIBMPFR) $(LIBGMP) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
+	$(GMPLIBS) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
 	$(DEBUGINFOD_LIBS) $(LIBBABELTRACE_LIB)
 CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(CTF_DEPS) \
 	$(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) \
diff --git a/gdb/README b/gdb/README
index 406df046053..fbe480f0d60 100644
--- a/gdb/README
+++ b/gdb/README
@@ -484,22 +484,32 @@  more obscure GDB `configure' options are not listed here.
      not have liblzma installed, you can get the latest version from
      `https://tukaani.org/xz/'.
 
-`--with-libgmp-prefix=DIR'
+`--with-gmp=DIR'
+`--with-gmp-lib=LIBDIR'
+`--with-gmp-include=INCDIR'
      Build GDB using the GMP library installed at the directory DIR.
      If your host does not have GMP installed, you can get the latest
      version at `https://gmplib.org/'.
-
-`--with-mpfr'
-     Build GDB with GNU MPFR, a library for multiple-precision
-     floating-point computation with correct rounding.  (Done by
-     default if GNU MPFR is installed and found at configure time.)
+     The `--with-gmp=gmpinstalldir` option is shorthand for
+     `--with-gmp-lib=gmpinstalldir/lib` and
+     `--with-gmp-include=gmpinstalldir/include`.
+
+`--with-mpfr=DIR'
+`--with-mpfr-lib=LIBDIR'
+`--with-mpfr-include=INCDIR'
+     Build GDB using GNU MPFR installed at the directory DIR,
+     a library for multiple-precision floating-point computation
+     with correct rounding.
      This library is used to emulate target floating-point arithmetic
      during expression evaluation when the target uses different
-     floating-point formats than the host.  If GNU MPFR is not
-     available, GDB will fall back to using host floating-point
-     arithmetic.  If your host does not have GNU MPFR installed, you
+     floating-point formats than the host.
+     If your host does not have GNU MPFR installed, you
      can get the latest version from `https://www.mpfr.org/'.
 
+     The `--with-mpfr=mpfrinstalldir` option is shorthand for
+     `--with-mpfr-lib=mpfrinstalldir/lib` and
+     `--with-mpfr-include=mpfrinstalldir/include`.
+
 `--with-python[=PYTHON]'
      Build GDB with Python scripting support.  (Done by default if
      libpython is present and found at configure time.)  Python makes
diff --git a/gdb/config.in b/gdb/config.in
index 736e6be1c48..7da131ebf04 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -241,9 +241,6 @@ 
 /* Define if you have the expat library. */
 #undef HAVE_LIBEXPAT
 
-/* Define if you have the gmp library. */
-#undef HAVE_LIBGMP
-
 /* Define to 1 if you have the `libiconvlist' function. */
 #undef HAVE_LIBICONVLIST
 
@@ -256,9 +253,6 @@ 
 /* Define to 1 if you have the `m' library (-lm). */
 #undef HAVE_LIBM
 
-/* Define if you have the mpfr library. */
-#undef HAVE_LIBMPFR
-
 /* Define to 1 if you have the <libunwind-ia64.h> header file. */
 #undef HAVE_LIBUNWIND_IA64_H
 
diff --git a/gdb/configure b/gdb/configure
index b54ac671fe3..3a98d94dbac 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -739,12 +739,8 @@  PYTHON_LIBS
 PYTHON_CPPFLAGS
 PYTHON_CFLAGS
 python_prog_path
-LTLIBMPFR
-LIBMPFR
-HAVE_LIBMPFR
-LTLIBGMP
-LIBGMP
-HAVE_LIBGMP
+GMPINC
+GMPLIBS
 LTLIBEXPAT
 LIBEXPAT
 HAVE_LIBEXPAT
@@ -934,11 +930,6 @@  with_jit_reader_dir
 with_expat
 with_libexpat_prefix
 with_libexpat_type
-with_libgmp_prefix
-with_libgmp_type
-with_mpfr
-with_libmpfr_prefix
-with_libmpfr_type
 with_python
 with_python_libdir
 with_guile
@@ -995,6 +986,8 @@  YACC
 YFLAGS
 ZSTD_CFLAGS
 ZSTD_LIBS
+GMPLIBS
+GMPINC
 XMKMF'
 ac_subdirs_all='testsuite
 gdbtk'
@@ -1697,13 +1690,6 @@  Optional Packages:
   --with-libexpat-prefix[=DIR]  search for libexpat in DIR/include and DIR/lib
   --without-libexpat-prefix     don't search for libexpat in includedir and libdir
   --with-libexpat-type=TYPE     type of library to search for (auto/static/shared)
-  --with-libgmp-prefix[=DIR]  search for libgmp in DIR/include and DIR/lib
-  --without-libgmp-prefix     don't search for libgmp in includedir and libdir
-  --with-libgmp-type=TYPE     type of library to search for (auto/static/shared)
-  --with-mpfr             include MPFR support (auto/yes/no)
-  --with-libmpfr-prefix[=DIR]  search for libmpfr in DIR/include and DIR/lib
-  --without-libmpfr-prefix     don't search for libmpfr in includedir and libdir
-  --with-libmpfr-type=TYPE     type of library to search for (auto/static/shared)
   --with-python[=PYTHON]  include python support
                           (auto/yes/no/<python-program>)
   --with-python-libdir[=DIR]
@@ -1768,6 +1754,8 @@  Some influential environment variables:
               default value of `-d' given by some make applications.
   ZSTD_CFLAGS C compiler flags for ZSTD, overriding pkg-config
   ZSTD_LIBS   linker flags for ZSTD, overriding pkg-config
+  GMPLIBS     How to link GMP
+  GMPINC      How to find GMP include files
   XMKMF       Path to xmkmf, Makefile generator for X Window System
 
 Use these variables to override the choices made by `configure' or to help
@@ -11451,7 +11439,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11454 "configure"
+#line 11442 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11557,7 +11545,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11560 "configure"
+#line 11548 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19758,995 +19746,9 @@  done
   fi
 fi
 
-# Verify that we have a usable GMP library.
 
 
 
-
-
-
-
-
-    use_additional=yes
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
-
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-
-# Check whether --with-libgmp-prefix was given.
-if test "${with_libgmp_prefix+set}" = set; then :
-  withval=$with_libgmp_prefix;
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
-
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/lib"
-      fi
-    fi
-
-fi
-
-
-# Check whether --with-libgmp-type was given.
-if test "${with_libgmp_type+set}" = set; then :
-  withval=$with_libgmp_type;  with_libgmp_type=$withval
-else
-   with_libgmp_type=auto
-fi
-
-  lib_type=`eval echo \$with_libgmp_type`
-
-      LIBGMP=
-  LTLIBGMP=
-  INCGMP=
-  rpathdirs=
-  ltrpathdirs=
-  names_already_handled=
-  names_next_round='gmp '
-  while test -n "$names_next_round"; do
-    names_this_round="$names_next_round"
-    names_next_round=
-    for name in $names_this_round; do
-      already_handled=
-      for n in $names_already_handled; do
-        if test "$n" = "$name"; then
-          already_handled=yes
-          break
-        fi
-      done
-      if test -z "$already_handled"; then
-        names_already_handled="$names_already_handled $name"
-                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
-        eval value=\"\$HAVE_LIB$uppername\"
-        if test -n "$value"; then
-          if test "$value" = yes; then
-            eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIBGMP="${LIBGMP}${LIBGMP:+ }$value"
-            eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }$value"
-          else
-                                    :
-          fi
-        else
-                              found_dir=
-          found_la=
-          found_so=
-          found_a=
-          if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
-              found_dir="$additional_libdir"
-              found_so="$additional_libdir/lib$name.$shlibext"
-              if test -f "$additional_libdir/lib$name.la"; then
-                found_la="$additional_libdir/lib$name.la"
-              fi
-            elif test x$lib_type != xshared; then
-              if test -f "$additional_libdir/lib$name.$libext"; then
-                found_dir="$additional_libdir"
-                found_a="$additional_libdir/lib$name.$libext"
-                if test -f "$additional_libdir/lib$name.la"; then
-                  found_la="$additional_libdir/lib$name.la"
-                fi
-              fi
-            fi
-          fi
-          if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIBGMP; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-              case "$x" in
-                -L*)
-                  dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
-                    found_dir="$dir"
-                    found_so="$dir/lib$name.$shlibext"
-                    if test -f "$dir/lib$name.la"; then
-                      found_la="$dir/lib$name.la"
-                    fi
-                  elif test x$lib_type != xshared; then
-                    if test -f "$dir/lib$name.$libext"; then
-                      found_dir="$dir"
-                      found_a="$dir/lib$name.$libext"
-                      if test -f "$dir/lib$name.la"; then
-                        found_la="$dir/lib$name.la"
-                      fi
-                    fi
-                  fi
-                  ;;
-              esac
-              if test "X$found_dir" != "X"; then
-                break
-              fi
-            done
-          fi
-          if test "X$found_dir" != "X"; then
-                        LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }-L$found_dir -l$name"
-            if test "X$found_so" != "X"; then
-                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
-                                LIBGMP="${LIBGMP}${LIBGMP:+ }$found_so"
-              else
-                                                                                haveit=
-                for x in $ltrpathdirs; do
-                  if test "X$x" = "X$found_dir"; then
-                    haveit=yes
-                    break
-                  fi
-                done
-                if test -z "$haveit"; then
-                  ltrpathdirs="$ltrpathdirs $found_dir"
-                fi
-                                if test "$hardcode_direct" = yes; then
-                                                      LIBGMP="${LIBGMP}${LIBGMP:+ }$found_so"
-                else
-                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-                                                            LIBGMP="${LIBGMP}${LIBGMP:+ }$found_so"
-                                                            haveit=
-                    for x in $rpathdirs; do
-                      if test "X$x" = "X$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      rpathdirs="$rpathdirs $found_dir"
-                    fi
-                  else
-                                                                                haveit=
-                    for x in $LDFLAGS $LIBGMP; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                      if test "X$x" = "X-L$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      LIBGMP="${LIBGMP}${LIBGMP:+ }-L$found_dir"
-                    fi
-                    if test "$hardcode_minus_L" != no; then
-                                                                                        LIBGMP="${LIBGMP}${LIBGMP:+ }$found_so"
-                    else
-                                                                                                                                                                                LIBGMP="${LIBGMP}${LIBGMP:+ }-l$name"
-                    fi
-                  fi
-                fi
-              fi
-            else
-              if test "X$found_a" != "X"; then
-                                LIBGMP="${LIBGMP}${LIBGMP:+ }$found_a"
-              else
-                                                LIBGMP="${LIBGMP}${LIBGMP:+ }-L$found_dir -l$name"
-              fi
-            fi
-                        additional_includedir=
-            case "$found_dir" in
-              */lib | */lib/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
-                additional_includedir="$basedir/include"
-                ;;
-            esac
-            if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
-                haveit=
-                if test "X$additional_includedir" = "X/usr/local/include"; then
-                  if test -n "$GCC"; then
-                    case $host_os in
-                      linux*) haveit=yes;;
-                    esac
-                  fi
-                fi
-                if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INCGMP; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                    if test "X$x" = "X-I$additional_includedir"; then
-                      haveit=yes
-                      break
-                    fi
-                  done
-                  if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
-                                            INCGMP="${INCGMP}${INCGMP:+ }-I$additional_includedir"
-                    fi
-                  fi
-                fi
-              fi
-            fi
-                        if test -n "$found_la"; then
-                                                        save_libdir="$libdir"
-              case "$found_la" in
-                */* | *\\*) . "$found_la" ;;
-                *) . "./$found_la" ;;
-              esac
-              libdir="$save_libdir"
-                            for dep in $dependency_libs; do
-                case "$dep" in
-                  -L*)
-                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
-                      haveit=
-                      if test "X$additional_libdir" = "X/usr/local/lib"; then
-                        if test -n "$GCC"; then
-                          case $host_os in
-                            linux*) haveit=yes;;
-                          esac
-                        fi
-                      fi
-                      if test -z "$haveit"; then
-                        haveit=
-                        for x in $LDFLAGS $LIBGMP; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LIBGMP="${LIBGMP}${LIBGMP:+ }-L$additional_libdir"
-                          fi
-                        fi
-                        haveit=
-                        for x in $LDFLAGS $LTLIBGMP; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }-L$additional_libdir"
-                          fi
-                        fi
-                      fi
-                    fi
-                    ;;
-                  -R*)
-                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
-                    if test "$enable_rpath" != no; then
-                                                                  haveit=
-                      for x in $rpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        rpathdirs="$rpathdirs $dir"
-                      fi
-                                                                  haveit=
-                      for x in $ltrpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        ltrpathdirs="$ltrpathdirs $dir"
-                      fi
-                    fi
-                    ;;
-                  -l*)
-                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
-                    ;;
-                  *.la)
-                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                    ;;
-                  *)
-                                        LIBGMP="${LIBGMP}${LIBGMP:+ }$dep"
-                    LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }$dep"
-                    ;;
-                esac
-              done
-            fi
-          else
-                                                            if test "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
-              LIBGMP="${LIBGMP}${LIBGMP:+ }-l$name"
-              LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }-l$name"
-            else
-              LIBGMP="${LIBGMP}${LIBGMP:+ }-l:lib$name.$libext"
-              LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }-l:lib$name.$libext"
-            fi
-          fi
-        fi
-      fi
-    done
-  done
-  if test "X$rpathdirs" != "X"; then
-    if test -n "$hardcode_libdir_separator"; then
-                        alldirs=
-      for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-      done
-            acl_save_libdir="$libdir"
-      libdir="$alldirs"
-      eval flag=\"$hardcode_libdir_flag_spec\"
-      libdir="$acl_save_libdir"
-      LIBGMP="${LIBGMP}${LIBGMP:+ }$flag"
-    else
-            for found_dir in $rpathdirs; do
-        acl_save_libdir="$libdir"
-        libdir="$found_dir"
-        eval flag=\"$hardcode_libdir_flag_spec\"
-        libdir="$acl_save_libdir"
-        LIBGMP="${LIBGMP}${LIBGMP:+ }$flag"
-      done
-    fi
-  fi
-  if test "X$ltrpathdirs" != "X"; then
-            for found_dir in $ltrpathdirs; do
-      LTLIBGMP="${LTLIBGMP}${LTLIBGMP:+ }-R$found_dir"
-    done
-  fi
-
-
-        ac_save_CPPFLAGS="$CPPFLAGS"
-
-  for element in $INCGMP; do
-    haveit=
-    for x in $CPPFLAGS; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      if test "X$x" = "X$element"; then
-        haveit=yes
-        break
-      fi
-    done
-    if test -z "$haveit"; then
-      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
-    fi
-  done
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgmp" >&5
-$as_echo_n "checking for libgmp... " >&6; }
-if ${ac_cv_libgmp+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    ac_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIBGMP"
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <gmp.h>
-int
-main ()
-{
-mpz_t n;
-                       mpz_init (n);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_libgmp=yes
-else
-  ac_cv_libgmp=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LIBS="$ac_save_LIBS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libgmp" >&5
-$as_echo "$ac_cv_libgmp" >&6; }
-  if test "$ac_cv_libgmp" = yes; then
-    HAVE_LIBGMP=yes
-
-$as_echo "#define HAVE_LIBGMP 1" >>confdefs.h
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libgmp" >&5
-$as_echo_n "checking how to link with libgmp... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGMP" >&5
-$as_echo "$LIBGMP" >&6; }
-  else
-    HAVE_LIBGMP=no
-            CPPFLAGS="$ac_save_CPPFLAGS"
-    LIBGMP=
-    LTLIBGMP=
-  fi
-
-
-
-
-
-
-if test "$HAVE_LIBGMP" != yes; then
-  as_fn_error $? "GMP is missing or unusable" "$LINENO" 5
-fi
-
-
-# Check whether --with-mpfr was given.
-if test "${with_mpfr+set}" = set; then :
-  withval=$with_mpfr;
-else
-  with_mpfr=auto
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use MPFR" >&5
-$as_echo_n "checking whether to use MPFR... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_mpfr" >&5
-$as_echo "$with_mpfr" >&6; }
-
-if test "${with_mpfr}" = no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MPFR support disabled; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: MPFR support disabled; some features may be unavailable." >&2;}
-  HAVE_LIBMPFR=no
-else
-
-
-
-
-
-
-
-
-    use_additional=yes
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-
-    eval additional_includedir=\"$includedir\"
-    eval additional_libdir=\"$libdir\"
-
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-
-# Check whether --with-libmpfr-prefix was given.
-if test "${with_libmpfr_prefix+set}" = set; then :
-  withval=$with_libmpfr_prefix;
-    if test "X$withval" = "Xno"; then
-      use_additional=no
-    else
-      if test "X$withval" = "X"; then
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-
-          eval additional_includedir=\"$includedir\"
-          eval additional_libdir=\"$libdir\"
-
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      else
-        additional_includedir="$withval/include"
-        additional_libdir="$withval/lib"
-      fi
-    fi
-
-fi
-
-
-# Check whether --with-libmpfr-type was given.
-if test "${with_libmpfr_type+set}" = set; then :
-  withval=$with_libmpfr_type;  with_libmpfr_type=$withval
-else
-   with_libmpfr_type=auto
-fi
-
-  lib_type=`eval echo \$with_libmpfr_type`
-
-      LIBMPFR=
-  LTLIBMPFR=
-  INCMPFR=
-  rpathdirs=
-  ltrpathdirs=
-  names_already_handled=
-  names_next_round='mpfr gmp'
-  while test -n "$names_next_round"; do
-    names_this_round="$names_next_round"
-    names_next_round=
-    for name in $names_this_round; do
-      already_handled=
-      for n in $names_already_handled; do
-        if test "$n" = "$name"; then
-          already_handled=yes
-          break
-        fi
-      done
-      if test -z "$already_handled"; then
-        names_already_handled="$names_already_handled $name"
-                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
-        eval value=\"\$HAVE_LIB$uppername\"
-        if test -n "$value"; then
-          if test "$value" = yes; then
-            eval value=\"\$LIB$uppername\"
-            test -z "$value" || LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$value"
-            eval value=\"\$LTLIB$uppername\"
-            test -z "$value" || LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }$value"
-          else
-                                    :
-          fi
-        else
-                              found_dir=
-          found_la=
-          found_so=
-          found_a=
-          if test $use_additional = yes; then
-            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
-              found_dir="$additional_libdir"
-              found_so="$additional_libdir/lib$name.$shlibext"
-              if test -f "$additional_libdir/lib$name.la"; then
-                found_la="$additional_libdir/lib$name.la"
-              fi
-            elif test x$lib_type != xshared; then
-              if test -f "$additional_libdir/lib$name.$libext"; then
-                found_dir="$additional_libdir"
-                found_a="$additional_libdir/lib$name.$libext"
-                if test -f "$additional_libdir/lib$name.la"; then
-                  found_la="$additional_libdir/lib$name.la"
-                fi
-              fi
-            fi
-          fi
-          if test "X$found_dir" = "X"; then
-            for x in $LDFLAGS $LTLIBMPFR; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-              case "$x" in
-                -L*)
-                  dir=`echo "X$x" | sed -e 's/^X-L//'`
-                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
-                    found_dir="$dir"
-                    found_so="$dir/lib$name.$shlibext"
-                    if test -f "$dir/lib$name.la"; then
-                      found_la="$dir/lib$name.la"
-                    fi
-                  elif test x$lib_type != xshared; then
-                    if test -f "$dir/lib$name.$libext"; then
-                      found_dir="$dir"
-                      found_a="$dir/lib$name.$libext"
-                      if test -f "$dir/lib$name.la"; then
-                        found_la="$dir/lib$name.la"
-                      fi
-                    fi
-                  fi
-                  ;;
-              esac
-              if test "X$found_dir" != "X"; then
-                break
-              fi
-            done
-          fi
-          if test "X$found_dir" != "X"; then
-                        LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }-L$found_dir -l$name"
-            if test "X$found_so" != "X"; then
-                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
-                                LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$found_so"
-              else
-                                                                                haveit=
-                for x in $ltrpathdirs; do
-                  if test "X$x" = "X$found_dir"; then
-                    haveit=yes
-                    break
-                  fi
-                done
-                if test -z "$haveit"; then
-                  ltrpathdirs="$ltrpathdirs $found_dir"
-                fi
-                                if test "$hardcode_direct" = yes; then
-                                                      LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$found_so"
-                else
-                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
-                                                            LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$found_so"
-                                                            haveit=
-                    for x in $rpathdirs; do
-                      if test "X$x" = "X$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      rpathdirs="$rpathdirs $found_dir"
-                    fi
-                  else
-                                                                                haveit=
-                    for x in $LDFLAGS $LIBMPFR; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                      if test "X$x" = "X-L$found_dir"; then
-                        haveit=yes
-                        break
-                      fi
-                    done
-                    if test -z "$haveit"; then
-                      LIBMPFR="${LIBMPFR}${LIBMPFR:+ }-L$found_dir"
-                    fi
-                    if test "$hardcode_minus_L" != no; then
-                                                                                        LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$found_so"
-                    else
-                                                                                                                                                                                LIBMPFR="${LIBMPFR}${LIBMPFR:+ }-l$name"
-                    fi
-                  fi
-                fi
-              fi
-            else
-              if test "X$found_a" != "X"; then
-                                LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$found_a"
-              else
-                                                LIBMPFR="${LIBMPFR}${LIBMPFR:+ }-L$found_dir -l$name"
-              fi
-            fi
-                        additional_includedir=
-            case "$found_dir" in
-              */lib | */lib/)
-                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
-                additional_includedir="$basedir/include"
-                ;;
-            esac
-            if test "X$additional_includedir" != "X"; then
-                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
-                haveit=
-                if test "X$additional_includedir" = "X/usr/local/include"; then
-                  if test -n "$GCC"; then
-                    case $host_os in
-                      linux*) haveit=yes;;
-                    esac
-                  fi
-                fi
-                if test -z "$haveit"; then
-                  for x in $CPPFLAGS $INCMPFR; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                    if test "X$x" = "X-I$additional_includedir"; then
-                      haveit=yes
-                      break
-                    fi
-                  done
-                  if test -z "$haveit"; then
-                    if test -d "$additional_includedir"; then
-                                            INCMPFR="${INCMPFR}${INCMPFR:+ }-I$additional_includedir"
-                    fi
-                  fi
-                fi
-              fi
-            fi
-                        if test -n "$found_la"; then
-                                                        save_libdir="$libdir"
-              case "$found_la" in
-                */* | *\\*) . "$found_la" ;;
-                *) . "./$found_la" ;;
-              esac
-              libdir="$save_libdir"
-                            for dep in $dependency_libs; do
-                case "$dep" in
-                  -L*)
-                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
-                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
-                      haveit=
-                      if test "X$additional_libdir" = "X/usr/local/lib"; then
-                        if test -n "$GCC"; then
-                          case $host_os in
-                            linux*) haveit=yes;;
-                          esac
-                        fi
-                      fi
-                      if test -z "$haveit"; then
-                        haveit=
-                        for x in $LDFLAGS $LIBMPFR; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LIBMPFR="${LIBMPFR}${LIBMPFR:+ }-L$additional_libdir"
-                          fi
-                        fi
-                        haveit=
-                        for x in $LDFLAGS $LTLIBMPFR; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-                          if test "X$x" = "X-L$additional_libdir"; then
-                            haveit=yes
-                            break
-                          fi
-                        done
-                        if test -z "$haveit"; then
-                          if test -d "$additional_libdir"; then
-                                                        LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }-L$additional_libdir"
-                          fi
-                        fi
-                      fi
-                    fi
-                    ;;
-                  -R*)
-                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
-                    if test "$enable_rpath" != no; then
-                                                                  haveit=
-                      for x in $rpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        rpathdirs="$rpathdirs $dir"
-                      fi
-                                                                  haveit=
-                      for x in $ltrpathdirs; do
-                        if test "X$x" = "X$dir"; then
-                          haveit=yes
-                          break
-                        fi
-                      done
-                      if test -z "$haveit"; then
-                        ltrpathdirs="$ltrpathdirs $dir"
-                      fi
-                    fi
-                    ;;
-                  -l*)
-                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
-                    ;;
-                  *.la)
-                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                    ;;
-                  *)
-                                        LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$dep"
-                    LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }$dep"
-                    ;;
-                esac
-              done
-            fi
-          else
-                                                            if test "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
-              LIBMPFR="${LIBMPFR}${LIBMPFR:+ }-l$name"
-              LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }-l$name"
-            else
-              LIBMPFR="${LIBMPFR}${LIBMPFR:+ }-l:lib$name.$libext"
-              LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }-l:lib$name.$libext"
-            fi
-          fi
-        fi
-      fi
-    done
-  done
-  if test "X$rpathdirs" != "X"; then
-    if test -n "$hardcode_libdir_separator"; then
-                        alldirs=
-      for found_dir in $rpathdirs; do
-        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
-      done
-            acl_save_libdir="$libdir"
-      libdir="$alldirs"
-      eval flag=\"$hardcode_libdir_flag_spec\"
-      libdir="$acl_save_libdir"
-      LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$flag"
-    else
-            for found_dir in $rpathdirs; do
-        acl_save_libdir="$libdir"
-        libdir="$found_dir"
-        eval flag=\"$hardcode_libdir_flag_spec\"
-        libdir="$acl_save_libdir"
-        LIBMPFR="${LIBMPFR}${LIBMPFR:+ }$flag"
-      done
-    fi
-  fi
-  if test "X$ltrpathdirs" != "X"; then
-            for found_dir in $ltrpathdirs; do
-      LTLIBMPFR="${LTLIBMPFR}${LTLIBMPFR:+ }-R$found_dir"
-    done
-  fi
-
-
-        ac_save_CPPFLAGS="$CPPFLAGS"
-
-  for element in $INCMPFR; do
-    haveit=
-    for x in $CPPFLAGS; do
-
-  acl_save_prefix="$prefix"
-  prefix="$acl_final_prefix"
-  acl_save_exec_prefix="$exec_prefix"
-  exec_prefix="$acl_final_exec_prefix"
-  eval x=\"$x\"
-  exec_prefix="$acl_save_exec_prefix"
-  prefix="$acl_save_prefix"
-
-      if test "X$x" = "X$element"; then
-        haveit=yes
-        break
-      fi
-    done
-    if test -z "$haveit"; then
-      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
-    fi
-  done
-
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmpfr" >&5
-$as_echo_n "checking for libmpfr... " >&6; }
-if ${ac_cv_libmpfr+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-    ac_save_LIBS="$LIBS"
-    LIBS="$LIBS $LIBMPFR"
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <mpfr.h>
-int
-main ()
-{
-mpfr_exp_t exp; mpfr_t x;
-			 mpfr_frexp (&exp, x, x, MPFR_RNDN);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_libmpfr=yes
-else
-  ac_cv_libmpfr=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-    LIBS="$ac_save_LIBS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libmpfr" >&5
-$as_echo "$ac_cv_libmpfr" >&6; }
-  if test "$ac_cv_libmpfr" = yes; then
-    HAVE_LIBMPFR=yes
-
-$as_echo "#define HAVE_LIBMPFR 1" >>confdefs.h
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libmpfr" >&5
-$as_echo_n "checking how to link with libmpfr... " >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBMPFR" >&5
-$as_echo "$LIBMPFR" >&6; }
-  else
-    HAVE_LIBMPFR=no
-            CPPFLAGS="$ac_save_CPPFLAGS"
-    LIBMPFR=
-    LTLIBMPFR=
-  fi
-
-
-
-
-
-
-  if test "$HAVE_LIBMPFR" != yes; then
-    if test "$with_mpfr" = yes; then
-      as_fn_error $? "MPFR is missing or unusable" "$LINENO" 5
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: MPFR is missing or unusable; some features may be unavailable." >&5
-$as_echo "$as_me: WARNING: MPFR is missing or unusable; some features may be unavailable." >&2;}
-    fi
-  fi
-fi
-
 # --------------------- #
 # Check for libpython.  #
 # --------------------- #
diff --git a/gdb/configure.ac b/gdb/configure.ac
index 12561d4d2de..11769a9a74a 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -653,35 +653,8 @@  else
   fi
 fi
 
-# Verify that we have a usable GMP library.
-AC_LIB_HAVE_LINKFLAGS([gmp], [], [#include <gmp.h>],
-                      [mpz_t n;
-                       mpz_init (n);])
-if test "$HAVE_LIBGMP" != yes; then
-  AC_MSG_ERROR([GMP is missing or unusable])
-fi
-
-AC_ARG_WITH(mpfr,
-  AS_HELP_STRING([--with-mpfr], [include MPFR support (auto/yes/no)]),
-  [], [with_mpfr=auto])
-AC_MSG_CHECKING([whether to use MPFR])
-AC_MSG_RESULT([$with_mpfr])
-
-if test "${with_mpfr}" = no; then
-  AC_MSG_WARN([MPFR support disabled; some features may be unavailable.])
-  HAVE_LIBMPFR=no
-else
-  AC_LIB_HAVE_LINKFLAGS([mpfr], [gmp], [#include <mpfr.h>],
-			[mpfr_exp_t exp; mpfr_t x;
-			 mpfr_frexp (&exp, x, x, MPFR_RNDN);])
-  if test "$HAVE_LIBMPFR" != yes; then
-    if test "$with_mpfr" = yes; then
-      AC_MSG_ERROR([MPFR is missing or unusable])
-    else
-      AC_MSG_WARN([MPFR is missing or unusable; some features may be unavailable.])
-    fi
-  fi
-fi
+AC_ARG_VAR(GMPLIBS,[How to link GMP])
+AC_ARG_VAR(GMPINC,[How to find GMP include files])
 
 # --------------------- #
 # Check for libpython.  #
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index ea66f4ee42d..878a7d229a2 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -39202,7 +39202,8 @@  make program.  Other variants of @code{make} will not work.
 This library may be included with your operating system distribution;
 if it is not, you can get the latest version from
 @url{https://gmplib.org/}. If GMP is installed at an unusual path,
-you can use the @option{--with-libgmp-prefix} option to specify
+you can use the @option{--with-gmp} option or options
+@option{--with-gmp-include} and @option{--with-gmp-lib} to specify
 its location.
 
 @end table
@@ -39284,18 +39285,18 @@  automatically.  If it is installed in an unusual path, you can use the
 
 @item MPFR
 @anchor{MPFR}
-@value{GDBN} can use the GNU MPFR multiple-precision floating-point
+@value{GDBN} now uses the GNU MPFR multiple-precision floating-point
 library.  This library may be included with your operating system
 distribution; if it is not, you can get the latest version from
 @url{http://www.mpfr.org}.  The @file{configure} script will search
 for this library in several standard locations; if it is installed
-in an unusual path, you can use the @option{--with-libmpfr-prefix}
-option to specify its location.
+in an unusual path, you can use the @option{--with-mpfr} option or options
+@option{--with-mpfr-include} and @option{--with-mpfr-lib} to specify
+its location.
 
 GNU MPFR is used to emulate target floating-point arithmetic during
 expression evaluation when the target uses different floating-point
-formats than the host.  If GNU MPFR it is not available, @value{GDBN}
-will fall back to using host floating-point arithmetic.
+formats than the host.
 
 @item Python
 @value{GDBN} can be scripted using Python language.  @xref{Python}.
diff --git a/gdb/target-float.c b/gdb/target-float.c
index d0bf9babf60..4dfb6369002 100644
--- a/gdb/target-float.c
+++ b/gdb/target-float.c
@@ -1156,8 +1156,6 @@  host_float_ops<T>::compare (const gdb_byte *x, const struct type *type_x,
 /* Implementation of target_float_ops using the MPFR library
    mpfr_t as intermediate type.  */
 
-#ifdef HAVE_LIBMPFR
-
 #define MPFR_USE_INTMAX_T
 
 #include <mpfr.h>
@@ -1715,8 +1713,6 @@  mpfr_float_ops::compare (const gdb_byte *x, const struct type *type_x,
     return 1;
 }
 
-#endif
-
 
 /* Helper routines operating on decimal floating-point data.  */
 
@@ -2266,11 +2262,7 @@  get_target_float_ops (enum target_float_ops_kind kind)
 	 use the largest host floating-point type as intermediate format.  */
       case target_float_ops_kind::binary:
 	{
-#ifdef HAVE_LIBMPFR
 	  static mpfr_float_ops binary_float_ops;
-#else
-	  static host_float_ops<long double> binary_float_ops;
-#endif
 	  return &binary_float_ops;
 	}
 
diff --git a/gdb/top.c b/gdb/top.c
index e9794184f07..4e014b321d3 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1588,14 +1588,6 @@  This GDB was configured as follows:\n\
 "));
 #endif
 
-#if HAVE_LIBMPFR
-  gdb_printf (stream, _("\
-	     --with-mpfr\n\
-"));
-#else
-  gdb_printf (stream, _("\
-	     --without-mpfr\n\
-"));
 #endif
 #if HAVE_LIBXXHASH
   gdb_printf (stream, _("\