aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@marvell.com>2022-11-08 07:57:18 +0000
committerAndrew Pinski <apinski@marvell.com>2022-12-21 16:49:23 +0000
commit991180627851801f1999d1ebbc0e569a17e47c74 (patch)
tree5f62540378658e09c3c0ea899545cdb1e5bbb0ae /configure.ac
parent68ce1575fc902958a9b1d197e2c79ea842a7776d (diff)
downloadgdb-991180627851801f1999d1ebbc0e569a17e47c74.zip
gdb-991180627851801f1999d1ebbc0e569a17e47c74.tar.gz
gdb-991180627851801f1999d1ebbc0e569a17e47c74.tar.bz2
Use toplevel configure for GMP and MPFR for gdb
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
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac45
1 files changed, 38 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index 36267d8..3a1eb03 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