* [CFT] in-tree GMP/MPFR, one more round
@ 2007-01-08 11:04 Paolo Bonzini
2007-01-08 11:05 ` Paolo Bonzini
0 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2007-01-08 11:04 UTC (permalink / raw)
To: Nick Clifton, Kaveh R. GHAZI, GCC Patches
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.
Ciao,
Paolo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-08 11:04 [CFT] in-tree GMP/MPFR, one more round Paolo Bonzini
@ 2007-01-08 11:05 ` Paolo Bonzini
2007-01-08 17:53 ` DJ Delorie
2007-01-08 18:21 ` Kaveh R. GHAZI
0 siblings, 2 replies; 10+ messages in thread
From: Paolo Bonzini @ 2007-01-08 11:05 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Nick Clifton, Kaveh R. GHAZI, GCC Patches
[-- Attachment #1: Type: text/plain, Size: 236 bytes --]
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
[-- Attachment #2: gmp-in-tree.patch --]
[-- Type: text/plain, Size: 13050 bytes --]
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)"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-08 11:05 ` Paolo Bonzini
@ 2007-01-08 17:53 ` DJ Delorie
2007-01-09 8:34 ` Paolo Bonzini
2007-01-08 18:21 ` Kaveh R. GHAZI
1 sibling, 1 reply; 10+ messages in thread
From: DJ Delorie @ 2007-01-08 17:53 UTC (permalink / raw)
To: paolo.bonzini; +Cc: gcc-patches
> + gmplibs="-L ../mpfr/.libs -L ../${build_subdir}/mpfr/_libs $gmplibs"
> + gmpinc="-I ../mpfr -I${srcdir}/../mpfr"
This looks like it would only work one subdirectory down from the top.
Can we make it more independent of how far down the tree we are?
> + gmplibs="-L ../gmp/.libs -L ../${build_subdir}/gmp/_libs $gmplibs"
> + gmpinc="-I ../gmp -I${srcdir}/../gmp"
Likewise.
> + host_alias=(get "host" "${build_alias}")
> + target_alias=(get "target" "${target_alias}")
What's this syntax?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-08 11:05 ` Paolo Bonzini
2007-01-08 17:53 ` DJ Delorie
@ 2007-01-08 18:21 ` Kaveh R. GHAZI
1 sibling, 0 replies; 10+ messages in thread
From: Kaveh R. GHAZI @ 2007-01-08 18:21 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Nick Clifton, GCC Patches
On Mon, 8 Jan 2007, Paolo Bonzini wrote:
> 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
Hi Paolo - I tried the patch out on solaris2.10 and I ran into several
problems. I assume you tested your patch and since it "worked" for you I
believe it's because you have a gmp/mpfr installed in /usr that gcc can
find which masks these problems, there's no way it could work otherwise
AFAICT. Since you bypass the version checks you won't see anyting
unusual. On my solaris2 box where there is no "system" gmp/mpfr it
doesn't work.
+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}"; };
First problem is the above hunk where you set extra_configure_args.
There is no such variable AFAICT. It should be extra_configure_flags.
(i.e. "flags" not "args".) There is another (mistaken?) instance of the
_args variant in fixincludes module, I'm not sure what problems that
causes. Anyway, because this variable isn't set correctly, the shared
libaries get built, and mpfr configure can't find gmp.h so it bombs. You
won't notice this if the header is also in a system area.
+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"
Second problem in gmpinc above. When building gcc, there is no -I flag
telling gcc where to find mpfr.h. Also, srcdir should be resolved in the
gcc/Makefile, not at the top level Makefile especially so that relative
paths work. I.e. GMPINC should reference $(srcdir) in gcc/Makefile.in,
and not have the paths resolved already. I couldn't figure out the
shell/Makefile quoting magic to get that working though. Again you won't
notice this if the mpfr.h header is also in a system area and maybe if in
addition you use hard paths.
The third problem below.
+gmplibs="-lgmp -lmpfr"
This link order won't work for static libs (at least on solaris2.) I
think I mentioned this last time. I get an error linking cc1 because of
missing gmp functions. You need to put -lmpfr first so any gmp functions
used in libmpfr.a are pulled in from a following library. This might have
worked for you because it built the shared libs from problem #1 and that
masked the problem. I believe in the shared case, it doesn't error.
Anyway, by fixing all three problems I was able to build a c-only
--disable-bootstrap mainline using in-tree gmp/mpfr and a parallel build.
I haven't figured out how to fix #2 for real though, I had to hand massage
the GMPINC def in gcc/Makefile to get it going.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-08 17:53 ` DJ Delorie
@ 2007-01-09 8:34 ` Paolo Bonzini
2007-01-09 14:58 ` Sebastian Pop
2007-01-09 16:04 ` Kaveh R. GHAZI
0 siblings, 2 replies; 10+ messages in thread
From: Paolo Bonzini @ 2007-01-09 8:34 UTC (permalink / raw)
To: DJ Delorie; +Cc: gcc-patches, Kaveh R. GHAZI
[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]
DJ Delorie wrote:
>> + gmplibs="-L ../mpfr/.libs -L ../${build_subdir}/mpfr/_libs $gmplibs"
>> + gmpinc="-I ../mpfr -I${srcdir}/../mpfr"
>
> This looks like it would only work one subdirectory down from the top.
> Can we make it more independent of how far down the tree we are?
>
>> + gmplibs="-L ../gmp/.libs -L ../${build_subdir}/gmp/_libs $gmplibs"
>> + gmpinc="-I ../gmp -I${srcdir}/../gmp"
>
> Likewise.
Yes, I can do it with $$r and $$s.
gmplibs='-L $$r/mpfr/.libs -L $$r/mpfr/_libs '"$gmplibs"
gmpinc='-I $$r/mpfr -I $$s/mpfr '"$gmpinc"
This should also fix problem #2 that Kaveh pointed out.
>> + host_alias=(get "host" "${build_alias}")
>> + target_alias=(get "target" "${target_alias}")
>
> What's this syntax?
Instead of a string, you can use a Scheme expression. This means "the
parameter host (or target), with a default of ${build_alias}". The
problem is that you cannot nest [+ host "${build_alias}" +] within
another [+ ... +].
This version should fix all the problems that Kaveh reported, looking at
the generated files. I ask for testing precisely because all my systems
have gmp and mpfr in the "usual" places.
Paolo
[-- Attachment #2: gmp-in-tree.patch --]
[-- Type: text/plain, Size: 13507 bytes --]
2007-01-09 Paolo Bonzini <bonzini@gnu.org>
Nick Clifton <nickc@redhat.com>
Kaveh R. Ghazi <ghazi@caip.rutgets.edu>
* 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.
* configure: Regenerate.
* 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="-lmpfr -lgmp"
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 $$r/mpfr/.libs -L $$r/mpfr/_libs '"$gmplibs"
+ gmpinc='-I $$r/mpfr -I $$s/mpfr '"$gmpinc"
+ # 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 $$r/gmp/.libs -L $$r/gmp/_libs '"$gmplibs"
+ gmpinc='-I $$r/gmp -I$$s/gmp '"$gmpinc"
+ # 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)
@@ -30,8 +30,7 @@ build_modules= { module= byacc; };
build_modules= { module= flex; };
build_modules= { module= m4; };
build_modules= { module= texinfo; };
-build_modules= { module= fixincludes;
- extra_configure_args='--target=$(target)'; };
+build_modules= { module= fixincludes; };
host_modules= { module= ash; };
host_modules= { module= autoconf; };
@@ -61,10 +60,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_flags='--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_flags='--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 +283,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 +308,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)"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-09 8:34 ` Paolo Bonzini
@ 2007-01-09 14:58 ` Sebastian Pop
2007-01-09 15:40 ` Paolo Bonzini
2007-01-09 16:04 ` Kaveh R. GHAZI
1 sibling, 1 reply; 10+ messages in thread
From: Sebastian Pop @ 2007-01-09 14:58 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: gcc-patches
With your patch and
autogen Makefile.def
autoconf213
I got this error:
gcc -g -fkeep-inline-functions -DIN_GCC -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-Wmissing-format-attribute -fno-common -DHAVE_CONFIG_H -o Tcollect2
\
collect2.o tlink.o intl.o version.o ../libcpp/libcpp.a
./../intl/libintl.a -liconv ../libiberty/libiberty.a
../libdecnumber/libdecnumber.a -L /Users/seb/gcc/trunk/boo/gmp/.libs
-L /Users/seb/gcc/trunk/boo/gmp/_libs -L
/Users/seb/gcc/trunk/boo/mpfr/.libs -L
/Users/seb/gcc/trunk/boo/mpfr/_libs -lmpfr -lgmp
/usr/bin/ld: -L: directory name missing
collect2: ld returned 1 exit status
Seems like you inserted an extra space between -L and the path?
Sebastian
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-09 14:58 ` Sebastian Pop
@ 2007-01-09 15:40 ` Paolo Bonzini
0 siblings, 0 replies; 10+ messages in thread
From: Paolo Bonzini @ 2007-01-09 15:40 UTC (permalink / raw)
To: Sebastian Pop; +Cc: gcc-patches
> gcc -g -fkeep-inline-functions -DIN_GCC -W -Wall -Wwrite-strings
> -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
> -Wmissing-format-attribute -fno-common -DHAVE_CONFIG_H -o Tcollect2
> \
> collect2.o tlink.o intl.o version.o ../libcpp/libcpp.a
> ./../intl/libintl.a -liconv ../libiberty/libiberty.a
> ../libdecnumber/libdecnumber.a -L /Users/seb/gcc/trunk/boo/gmp/.libs
> -L /Users/seb/gcc/trunk/boo/gmp/_libs -L
> /Users/seb/gcc/trunk/boo/mpfr/.libs -L
> /Users/seb/gcc/trunk/boo/mpfr/_libs -lmpfr -lgmp
> /usr/bin/ld: -L: directory name missing
> collect2: ld returned 1 exit status
>
> Seems like you inserted an extra space between -L and the path?
I think it depends on the system binutils whether it is valid or not. I
removed it.
Paolo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-09 8:34 ` Paolo Bonzini
2007-01-09 14:58 ` Sebastian Pop
@ 2007-01-09 16:04 ` Kaveh R. GHAZI
2007-01-11 11:22 ` Paolo Bonzini
1 sibling, 1 reply; 10+ messages in thread
From: Kaveh R. GHAZI @ 2007-01-09 16:04 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: DJ Delorie, gcc-patches
On Tue, 9 Jan 2007, Paolo Bonzini wrote:
> This version should fix all the problems that Kaveh reported, looking at
> the generated files. I ask for testing precisely because all my systems
> have gmp and mpfr in the "usual" places.
> Paolo
I was able to compile a C-only --disable-bootstrap with your patch. I was
also able to do a C-only complete bootstrap. I'll do an all-languages
complete bootstrap later just to be sure, but I think it looks good.
Thanks very much!
Then I tried "make check" and it failed as per PR29404. I think it's
critically important to have "make check" working for in-tree builds of
gmp and mpfr, their web pages specifically recommend checking because they
are often miscompiled. However your patch is not to blame since the issue
also occurs with libiberty and probably any library we bootstrap.
The issue in the PR is that each library's testcases are compiled and/or
linked with the stage1 compiler (cc in my case) but the libraries
(libiberty.a, libgmp.a, libmpfr.a) were compiled with gcc stage3. So in
the link step we're missing libgcc and have missing symbols. Also some of
the configure steps in stage3 chose gcc defaults which no longer hold when
testcases are compiled with stage1 cc, like __attribute__. I recall this
working for at least libiberty at some point, so it may be fallout from
switching to top level bootstrap or the autogen Makefile.in or something
like that. I'm not sure. Also most likely you won't notice any of this
if you use gcc for stage1.
A second problem, mpfr testcases can't find gmp.h so they all fail to
compile, most likely even if gcc is used for stage1.
I think a fix needs to teach all libraries that they should use stage3 gcc
for compiling and linking (if a bootstrap was done). And we also need to
tell mpfr-check where to find gmp.h.
If you could help with this issue after your initial patch goes in, I
would very much appreciate it.
Thanks,
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-09 16:04 ` Kaveh R. GHAZI
@ 2007-01-11 11:22 ` Paolo Bonzini
2007-01-12 5:59 ` Kaveh R. GHAZI
0 siblings, 1 reply; 10+ messages in thread
From: Paolo Bonzini @ 2007-01-11 11:22 UTC (permalink / raw)
To: Kaveh R. GHAZI; +Cc: DJ Delorie, gcc-patches
> I think a fix needs to teach all libraries that they should use stage3 gcc
> for compiling and linking (if a bootstrap was done). And we also need to
> tell mpfr-check where to find gmp.h.
The two are separate. The second is because the path in
--with-gmp-build=../gmp should actually be absolute, as in
$$r/$(HOST_SUBDIR)/gmp. I committed the patch with this change.
The first is the real PR29404, and I'll look at it next week.
Paolo
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [CFT] in-tree GMP/MPFR, one more round
2007-01-11 11:22 ` Paolo Bonzini
@ 2007-01-12 5:59 ` Kaveh R. GHAZI
0 siblings, 0 replies; 10+ messages in thread
From: Kaveh R. GHAZI @ 2007-01-12 5:59 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: DJ Delorie, gcc-patches
On Thu, 11 Jan 2007, Paolo Bonzini wrote:
> > I think a fix needs to teach all libraries that they should use stage3 gcc
> > for compiling and linking (if a bootstrap was done). And we also need to
> > tell mpfr-check where to find gmp.h.
>
> The two are separate. The second is because the path in
> --with-gmp-build=../gmp should actually be absolute, as in
> $$r/$(HOST_SUBDIR)/gmp. I committed the patch with this change.
I tested a fresh checkout of mainline and the --with-gmp-build= change
appears to have fixed that problem. Thanks for all your efforts.
> The first is the real PR29404, and I'll look at it next week.
> Paolo
That would be great, thanks again.
--Kaveh
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-01-12 5:59 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-08 11:04 [CFT] in-tree GMP/MPFR, one more round Paolo Bonzini
2007-01-08 11:05 ` Paolo Bonzini
2007-01-08 17:53 ` DJ Delorie
2007-01-09 8:34 ` Paolo Bonzini
2007-01-09 14:58 ` Sebastian Pop
2007-01-09 15:40 ` Paolo Bonzini
2007-01-09 16:04 ` Kaveh R. GHAZI
2007-01-11 11:22 ` Paolo Bonzini
2007-01-12 5:59 ` Kaveh R. GHAZI
2007-01-08 18:21 ` Kaveh R. GHAZI
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).