From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1314) id 248873858D1E; Wed, 21 Dec 2022 17:19:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 248873858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671643160; bh=hkvnhInIXlnHmAjNbAEDfbxRKRKxNo0ENwHANXa/ZHU=; h=From:To:Subject:Date:From; b=LtOV54cMIyt1pC2PM1l44t/1mCVRQLWp+11acfIC/Sqh6sLLAcod1/83vK4ABCT8p mL78jvCnE/KHafemLcAl/1fsNBytKPUhfFziA6o6BnkNgF2WYmKM0YJAhljUFDjLjq +DfqyrbzycCwUv/ltB4yrhnusmGgPgDBwCce+nQ4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Pinski To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4833] [PATCH] Use toplevel configure for GMP and MPFR for gdb X-Act-Checkin: gcc X-Git-Author: Andrew Pinski X-Git-Refname: refs/heads/trunk X-Git-Oldrev: fdc7469cf597ec11229ddfc3e9c7a06f3d0fba9d X-Git-Newrev: 91e0d22025e0bf2af2e364cb7214a05512a0c431 Message-Id: <20221221171920.248873858D1E@sourceware.org> Date: Wed, 21 Dec 2022 17:19:20 +0000 (GMT) List-Id: https://gcc.gnu.org/g:91e0d22025e0bf2af2e364cb7214a05512a0c431 commit r13-4833-g91e0d22025e0bf2af2e364cb7214a05512a0c431 Author: Andrew Pinski Date: Wed Dec 21 16:58:40 2022 +0000 [PATCH] Use toplevel configure for GMP and MPFR for gdb [Sync'ed from the binutils-gdb repo] 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. Diff: --- Makefile.def | 2 ++ Makefile.in | 2 ++ configure | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- configure.ac | 45 +++++++++++++++++++++++++++++++++------- 4 files changed, 101 insertions(+), 15 deletions(-) diff --git a/Makefile.def b/Makefile.def index 5f44190154e..86d15f1982f 100644 --- a/Makefile.def +++ b/Makefile.def @@ -415,6 +415,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 83e250f21a9..d66e6208fa2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -66503,6 +66503,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 2b86f25656b..d6716e38e99 100755 --- a/configure +++ b/configure @@ -7906,7 +7906,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 @@ -8041,7 +8054,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" @@ -8151,7 +8164,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; } @@ -8205,18 +8218,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 +#include int main () { mpfr_t n; mpfr_t x; - mpc_t c; int t; mpfr_init (n); mpfr_init (x); @@ -8225,6 +8237,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 +int +main () +{ + + mpc_t c; mpc_init2 (c, 53); mpc_set_ui_ui (c, 1, 1, MPC_RNDNN); mpc_cosh (c, c, MPC_RNDNN); @@ -8253,7 +8296,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 @@ -8262,6 +8306,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 c5191ce24ae..737c1a1172b 100644 --- a/configure.ac +++ b/configure.ac @@ -1482,7 +1482,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 @@ -1597,7 +1610,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" @@ -1637,7 +1650,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 ],[ @@ -1656,11 +1669,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 ],[ + AC_MSG_CHECKING([for the correct version of the gmp/mpfr libraries]) + AC_TRY_LINK([#include ],[ mpfr_t n; mpfr_t x; - mpc_t c; int t; mpfr_init (n); mpfr_init (x); @@ -1669,6 +1681,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_t c; mpc_init2 (c, 53); mpc_set_ui_ui (c, 1, 1, MPC_RNDNN); mpc_cosh (c, c, MPC_RNDNN); @@ -1684,7 +1707,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 @@ -1693,6 +1717,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