This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [CFT] in-tree GMP/MPFR, one more round
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- Cc: Nick Clifton <nickc at redhat dot com>, "Kaveh R. GHAZI" <ghazi at caip dot rutgers dot edu>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 08 Jan 2007 12:05:15 +0100
- Subject: Re: [CFT] in-tree GMP/MPFR, one more round
- References: <45A2253C.4060208@lu.unisi.ch>
Paolo Bonzini wrote:
This patch is the final set of changes needed for in-tree GMP/MPFR.
Changes from the last iteration are that GMP and MPFR are only built
statically, and they are not installed.
And here's the patch.
Paolo
2006-11-27 Paolo Bonzini <bonzini@gnu.org>
* configure.in (build_configargs, host_configargs, target_configargs):
Remove build/host/target parameters.
(host_libs): Add gmp and mpfr.
(GMP tests): Reorganize to allow in-tree GMP/MPFR.
* Makefile.def (gmp, mpfr): New.
(gcc): Remove target.
* Makefile.tpl (build_os, build_vendor, host_os, host_vendor,
target_os, target_vendor): New.
(configure): Add host_alias/target_alias arguments. Adjust invocations.
* Makefile.in: Regenerate.
Index: configure.in
===================================================================
--- configure.in (revision 120574)
+++ configure.in (working copy)
@@ -123,7 +123,7 @@ build_tools="build-texinfo build-byacc b
# these libraries are used by various programs built for the host environment
#
-host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber"
+host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr"
# these tools are built for the host environment
# Note, the powerpc-eabi build depends on sim occurring before gdb in order to
@@ -1053,9 +1053,10 @@ ACX_PROG_GNAT
ACX_PROG_CMP_IGNORE_INITIAL
# Check for GMP and MPFR
-gmplibs="-lmpfr"
+gmplibs="-lgmp -lmpfr"
gmpinc=
-have_gmp=yes
+have_gmp=no
+
# Specify a location for mpfr
# check for this first so it ends up on the link line before gmp.
AC_ARG_WITH(mpfr-dir, [ --with-mpfr-dir=PATH This option has been REMOVED],
@@ -1079,14 +1080,21 @@ fi
if test "x$with_mpfr_lib" != x; then
gmplibs="-L$with_mpfr_lib $gmplibs"
fi
+if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
+ gmplibs="-L ../mpfr/.libs -L ../${build_subdir}/mpfr/_libs $gmplibs"
+ gmpinc="-I ../mpfr -I${srcdir}/../mpfr"
+ # Do not test the mpfr version. Assume that it is sufficient, since
+ # it is in the source tree, and the library has not been built yet
+ # but it would be included on the link line in the version check below
+ # hence making the test fail.
+ have_gmp=yes
+fi
# Specify a location for gmp
AC_ARG_WITH(gmp-dir, [ --with-gmp-dir=PATH This option has been REMOVED],
AC_MSG_ERROR([The --with-gmp-dir=PATH option has been removed.
Use --with-gmp=PATH or --with-gmp-include=PATH plus --with-gmp-lib=PATH]))
-gmplibs="$gmplibs -lgmp"
-
AC_ARG_WITH(gmp, [ --with-gmp=PATH Specify prefix directory for the installed GMP package
Equivalent to --with-gmp-include=PATH/include
plus --with-gmp-lib=PATH/lib])
@@ -1104,42 +1112,53 @@ fi
if test "x$with_gmp_lib" != x; then
gmplibs="-L$with_gmp_lib $gmplibs"
fi
+if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
+ gmplibs="-L ../gmp/.libs -L ../${build_subdir}/gmp/_libs $gmplibs"
+ gmpinc="-I ../gmp -I${srcdir}/../gmp"
+ # Do not test the gmp version. Assume that it is sufficient, since
+ # it is in the source tree, and the library has not been built yet
+ # but it would be included on the link line in the version check below
+ # hence making the test fail.
+ have_gmp=yes
+fi
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS $gmpinc"
-# Check GMP actually works
-AC_MSG_CHECKING([for correct version of gmp.h])
-AC_TRY_COMPILE([#include "gmp.h"],[
-#if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1)
-choke me
-#endif
-], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
-
-if test x"$have_gmp" = xyes; then
- saved_LIBS="$LIBS"
- LIBS="$LIBS $gmplibs"
- dnl MPFR 2.2.0 is acceptable but buggy, MPFR 2.2.1 is better.
- AC_MSG_CHECKING([for correct version of mpfr.h])
- AC_TRY_LINK([#include <gmp.h>
-#include <mpfr.h>],[
-#if MPFR_VERSION < MPFR_VERSION_NUM(2,2,0)
- choke me
-#endif
- mpfr_t n; mpfr_init(n);
-], [AC_TRY_LINK([#include <gmp.h>
-#include <mpfr.h>],[
-#if MPFR_VERSION < MPFR_VERSION_NUM(2,2,1)
+if test -d ${srcdir}/gcc && test "x$have_gmp" == xno; then
+ have_gmp=yes
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $gmpinc"
+ # Check GMP actually works
+ AC_MSG_CHECKING([for correct version of gmp.h])
+ AC_TRY_COMPILE([#include "gmp.h"],[
+ #if __GNU_MP_VERSION < 4 || (__GNU_MP_VERSION == 4 && __GNU_MP_VERSION_MINOR < 1)
choke me
-#endif
- mpfr_t n; mpfr_init(n);
-], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
- [AC_MSG_RESULT([no]); have_gmp=no])
- LIBS="$saved_LIBS"
-fi
-CFLAGS="$saved_CFLAGS"
+ #endif
+ ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
-if test -d ${srcdir}/gcc && test x$have_gmp != xyes; then
- AC_MSG_ERROR([Building GCC requires GMP 4.1+ and MPFR 2.2.1+.
+ if test x"$have_gmp" = xyes; then
+ saved_LIBS="$LIBS"
+ LIBS="$LIBS $gmplibs"
+ dnl MPFR 2.2.0 is acceptable but buggy, MPFR 2.2.1 is better.
+ AC_MSG_CHECKING([for correct version of mpfr.h])
+ AC_TRY_LINK([#include <gmp.h>
+ #include <mpfr.h>],[
+ #if MPFR_VERSION < MPFR_VERSION_NUM(2,2,0)
+ choke me
+ #endif
+ mpfr_t n; mpfr_init(n);
+ ], [AC_TRY_LINK([#include <gmp.h>
+ #include <mpfr.h>],[
+ #if MPFR_VERSION < MPFR_VERSION_NUM(2,2,1)
+ choke me
+ #endif
+ mpfr_t n; mpfr_init(n);
+ ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
+ [AC_MSG_RESULT([no]); have_gmp=no])
+ LIBS="$saved_LIBS"
+ fi
+ CFLAGS="$saved_CFLAGS"
+
+ if test x$have_gmp != xyes; then
+ AC_MSG_ERROR([Building GCC requires GMP 4.1+ and MPFR 2.2.1+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
@@ -1147,6 +1166,7 @@ See also http://gcc.gnu.org/install/prer
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
# Flags needed for both GMP and/or MPFR
@@ -2086,7 +2106,7 @@ baseargs="$baseargs --program-transform-
# For the build-side libraries, we just need to pretend we're native,
# and not use the same cache file. Multilibs are neither needed nor
# desired.
-build_configargs="--cache-file=../config.cache --build=${build_alias} --host=${build_alias} --target=${target_alias} ${baseargs}"
+build_configargs="--cache-file=../config.cache ${baseargs}"
# For host modules, accept cache file option, or specification as blank.
case "${cache_file}" in
@@ -2100,7 +2120,7 @@ esac
# Host dirs don't like to share a cache file either, horribly enough.
# This seems to be due to autoconf 2.5x stupidity.
-host_configargs="--cache-file=./config.cache --build=${build_alias} --host=${host_alias} --target=${target_alias} ${extra_host_args} ${baseargs}"
+host_configargs="--cache-file=./config.cache ${extra_host_args} ${baseargs}"
target_configargs=${baseargs}
@@ -2136,7 +2156,7 @@ fi
# Pass the appropriate --build, --host, --target and --cache-file arguments.
# We need to pass --target, as newer autoconf's requires consistency
# for target_alias and gcc doesn't manage it consistently.
-target_configargs="--cache-file=./config.cache --build=${build_alias} --host=${target_alias} --target=${target_alias} ${target_configargs}"
+target_configargs="--cache-file=./config.cache ${target_configargs}"
FLAGS_FOR_TARGET=
case " $target_configdirs " in
Index: Makefile.def
===================================================================
--- Makefile.def (revision 120574)
+++ Makefile.def (working copy)
@@ -61,10 +61,19 @@ host_modules= { module= fixincludes;
host_modules= { module= flex; no_check_cross= true; };
host_modules= { module= gas; bootstrap=true; };
host_modules= { module= gcc; bootstrap=true;
- target="`if [ -f stage_last ]; then echo quickstrap ; else echo all; fi`";
extra_make_flags="$(EXTRA_GCC_FLAGS)"; };
host_modules= { module= gawk; };
host_modules= { module= gettext; };
+host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
+ extra_configure_args='--disable-shared';
+ no_install= true;
+ host="none-${host_vendor}-${host_os}";
+ target="none-${host_vendor}-${host_os}"; };
+host_modules= { module= mpfr; lib_path=.libs; bootstrap=true;
+ extra_configure_args='--disable-shared --with-gmp-build=../gmp';
+ no_install= true;
+ host="none-${host_vendor}-${host_os}";
+ target="none-${host_vendor}-${host_os}"; };
host_modules= { module= gnuserv; };
host_modules= { module= gprof; };
host_modules= { module= gzip; };
@@ -275,7 +285,9 @@ dependencies = { module=configure-gcc; o
dependencies = { module=configure-gcc; on=all-gas; };
dependencies = { module=configure-gcc; on=all-ld; };
dependencies = { module=all-gcc; on=all-libiberty; hard=true; };
+dependencies = { module=all-gcc; on=all-gmp; };
dependencies = { module=all-gcc; on=all-intl; };
+dependencies = { module=all-gcc; on=all-mpfr; };
dependencies = { module=all-gcc; on=all-build-texinfo; };
dependencies = { module=all-gcc; on=all-build-bison; };
dependencies = { module=all-gcc; on=all-build-byacc; };
@@ -298,6 +310,8 @@ dependencies = { module=all-fixincludes;
dependencies = { module=all-gnattools; on=all-target-libada; };
+dependencies = { module=configure-mpfr; on=all-gmp; };
+
// Host modules specific to gdb.
dependencies = { module=configure-gdb; on=configure-intl; };
dependencies = { module=configure-gdb; on=configure-sim; };
Index: Makefile.tpl
===================================================================
--- Makefile.tpl (revision 120574)
+++ Makefile.tpl (working copy)
@@ -29,10 +29,16 @@ in
VPATH=@srcdir@
build_alias=@build_alias@
+build_vendor=@build_vendor@
+build_os=@build_os@
build=@build@
host_alias=@host_alias@
+host_vendor=@host_vendor@
+host_os=@host_os@
host=@host@
target_alias=@target_alias@
+target_vendor=@target_vendor@
+target_os=@target_os@
target=@target@
program_transform_name = @program_transform_name@
@@ -779,7 +785,8 @@ configure-[+prefix+][+module+]: [+ IF bo
libsrcdir="$$s/[+module+]"; \
[+ IF no-config-site +]rm -f no-such-file || : ; \
CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) $${libsrcdir}/configure \
- [+args+] $${srcdiroption} [+extra_configure_flags+] \
+ [+args+] --build=${build_alias} --host=[+host_alias+] \
+ --target=[+target_alias+] $${srcdiroption} [+extra_configure_flags+] \
|| exit 1
@endif [+prefix+][+module+]
@@ -821,7 +828,8 @@ configure-stage[+id+]-[+prefix+][+module
srcdiroption="--srcdir=$${topdir}/[+module+]"; \
libsrcdir="$$s/[+module+]"; \
$(SHELL) $${libsrcdir}/configure \
- [+args+] $${srcdiroption} \
+ [+args+] --build=${build_alias} --host=[+host_alias+] \
+ --target=[+target_alias+] $${srcdiroption} \
[+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \
[+stage_configure_flags+] [+extra_configure_flags+]
@endif [+prefix+][+module+]-bootstrap
@@ -837,7 +845,7 @@ all-[+prefix+][+module+]: stage_current
@endif gcc-bootstrap
@if [+prefix+][+module+]
TARGET-[+prefix+][+module+]=[+
- IF target +][+target+][+ ELSE +]all[+ ENDIF target +]
+ IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +]
maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+]
all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +]
@: $(MAKE); $(unstage)[+ ENDIF bootstrap +]
@@ -894,6 +902,8 @@ clean-stage[+id+]-[+prefix+][+module+]:
# --------------------------------------
[+ FOR build_modules +]
[+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)"
+ host_alias=(get "host" "${build_alias}")
+ target_alias=(get "target" "${target_alias}")
args="$(BUILD_CONFIGARGS)" no-config-site=true +]
[+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" +]
@@ -906,6 +916,8 @@ clean-stage[+id+]-[+prefix+][+module+]:
[+ configure prefix="" subdir="$(HOST_SUBDIR)"
exports="$(HOST_EXPORTS)"
poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)"
+ host_alias=(get "host" "${host_alias}")
+ target_alias=(get "target" "${target_alias}")
args="$(HOST_CONFIGARGS)" +]
[+ all prefix="" subdir="$(HOST_SUBDIR)"
@@ -1003,6 +1015,8 @@ maybe-[+make_target+]-[+module+]: [+make
[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
check_multilibs=true
exports="$(RAW_CXX_TARGET_EXPORTS)"
+ host_alias=(get "host" "${target_alias}")
+ target_alias=(get "target" "${target_alias}")
args="$(TARGET_CONFIGARGS)" no-config-site=true +]
[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"
@@ -1012,6 +1026,8 @@ maybe-[+make_target+]-[+module+]: [+make
[+ configure prefix="target-" subdir="$(TARGET_SUBDIR)"
check_multilibs=true
exports="$(NORMAL_TARGET_EXPORTS)"
+ host_alias=(get "host" "${target_alias}")
+ target_alias=(get "target" "${target_alias}")
args="$(TARGET_CONFIGARGS)" no-config-site=true +]
[+ all prefix="target-" subdir="$(TARGET_SUBDIR)"