#! /bin/sh -e

# DP: - Install the shared Ada libraries as '.so.1', not '.so' to conform
# DP:   to the Debian policy.
# DP: - Don't include a runtime link path (-rpath), when linking binaries.
# DP: - Build the shared libraries on hppa-linux.
# DP: - Instead of building libada as a target library only, build it as
# DP:   both a host and, if different, target library.
# DP: - Build the GNAT tools in their top-level directory; do not use
# DP:   recursive makefiles.
# DP: - Link the GNAT tools dynamically.
# DP: - Fix a bug in src/gnattools/configure.ac whereby a nonexistent version
# DP:   of indepsw's body was selected.  Regenerate configure. (PR ada/27300)

# This patch seems large, but the hunks in Makefile.in are actually
# generated from Makefile.def using autogen.

dir=./
if [ $# -eq 3 -a "$2" = '-d' ]; then
    pdir="-d $3"
    dir="$3/"
elif [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch)
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
	cd ${dir} && autoconf
        ;;
    -unpatch)
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
        ;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1
esac
exit 0

Index: gcc/ada/config-lang.in
===================================================================
--- gcc/ada/config-lang.in.orig	2007-09-03 15:14:47.000000000 +0200
+++ gcc/ada/config-lang.in	2008-01-29 12:16:44.688811730 +0100
@@ -35,7 +35,7 @@
 outputs=ada/Makefile
 
 target_libs="target-libada"
-lang_dirs="gnattools"
+lang_dirs="libada gnattools"
 
 # Ada will not work until the front end starts emitting GIMPLE trees.
 build_by_default=no
Index: gcc/ada/link.c
===================================================================
--- gcc/ada/link.c.orig	2007-11-21 12:20:42.000000000 +0100
+++ gcc/ada/link.c	2008-01-29 12:16:44.688811730 +0100
@@ -146,8 +146,8 @@
 
 #elif defined (__FreeBSD__)
 const char *__gnat_object_file_option = "";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
+char *__gnat_run_path_option = "";
+char __gnat_shared_libgnat_default = SHARED;
 int __gnat_link_max = 8192;
 unsigned char __gnat_objlist_file_supported = 1;
 unsigned char __gnat_using_gnu_linker = 1;
@@ -155,8 +155,8 @@
 
 #elif defined (linux)
 const char *__gnat_object_file_option = "";
-const char *__gnat_run_path_option = "-Wl,-rpath,";
-char __gnat_shared_libgnat_default = STATIC;
+const char *__gnat_run_path_option = "";
+char __gnat_shared_libgnat_default = SHARED;
 int __gnat_link_max = 8192;
 unsigned char __gnat_objlist_file_supported = 1;
 unsigned char __gnat_using_gnu_linker = 1;
Index: gcc/ada/Makefile.in
===================================================================
--- gcc/ada/Makefile.in.orig	2008-01-29 12:10:06.222766372 +0100
+++ gcc/ada/Makefile.in	2008-01-29 12:17:55.465175005 +0100
@@ -114,7 +114,7 @@
 MAKEINFO = makeinfo
 TEXI2DVI = texi2dvi
 TEXI2PDF = texi2pdf
-GNATBIND_FLAGS = -static -x
+GNATBIND_FLAGS = -shared -x
 ADA_CFLAGS =
 ADAFLAGS = -W -Wall -gnatpg -gnata
 SOME_ADAFLAGS =-gnata
@@ -247,7 +247,6 @@
 LIBDEPS = $(LIBINTL_DEP) $(LIBIBERTY)
 # Default is no TGT_LIB; one might be passed down or something
 TGT_LIB =
-TOOLS_LIBS = $(EXTRA_GNATTOOLS_OBJS) targext.o link.o $(LIBGNAT) ../../../libiberty/libiberty.a $(SYSLIBS) $(TGT_LIB)
 
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
@@ -293,30 +292,6 @@
 # defined in this file into the environment.
 .NOEXPORT:
 
-# Lists of files for various purposes.
-
-GNATLINK_OBJS = gnatlink.o \
- a-except.o ali.o alloc.o butil.o casing.o csets.o debug.o fmap.o fname.o \
- gnatvsn.o hostparm.o indepsw.o interfac.o i-c.o i-cstrin.o namet.o opt.o \
- osint.o output.o rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
- sdefault.o snames.o stylesw.o switch.o system.o table.o targparm.o tree_io.o \
- types.o validsw.o widechar.o
-
-GNATMAKE_OBJS = a-except.o ali.o ali-util.o s-casuti.o \
- alloc.o atree.o binderr.o butil.o casing.o csets.o debug.o elists.o einfo.o\
- erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
- gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
- make.o makeusg.o makeutl.o mlib.o mlib-fil.o mlib-prj.o mlib-tgt.o \
- mlib-tgt-specific.o mlib-utl.o namet.o nlists.o opt.o osint.o osint-m.o output.o \
- prj.o prj-attr.o prj-attr-pm.o prj-com.o prj-dect.o prj-env.o prj-err.o prj-ext.o prj-nmsc.o \
- prj-pars.o prj-part.o prj-proc.o prj-strt.o prj-tree.o prj-util.o \
- rident.o s-exctab.o s-secsta.o s-stalib.o s-stoele.o \
- scans.o scng.o sdefault.o sfn_scan.o s-purexc.o s-htable.o \
- sinfo.o sinput.o sinput-c.o sinput-p.o \
- snames.o stand.o stringt.o styleg.o stylesw.o system.o validsw.o switch.o switch-m.o \
- table.o targparm.o tempdir.o tree_io.o types.o \
- uintp.o uname.o urealp.o usage.o widechar.o \
- $(EXTRA_GNATMAKE_OBJS)
 
 # Convert the target variable into a space separated list of architecture,
 # manufacturer, and operating system and assign each of those to its own
@@ -1017,6 +992,11 @@
   GMEM_LIB = gmemlib
 endif
 
+ifeq ($(strip $(filter-out hppa% unknown linux gnu,$(targ))),)
+  GNATLIB_SHARED = gnatlib-shared-dual
+  LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
 ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
   LIBGNAT_TARGET_PAIRS = \
   a-excpol.adb<a-excpol-abort.adb \
@@ -1666,128 +1646,6 @@
  a-[a-o]*.adb a-[p-z]*.adb a-[a-o]*.ads a-[p-z]*.ads g-*.ad? i-*.ad? \
  s-[a-o]*.adb s-[p-z]*.adb s-[a-o]*.ads s-[p-z]*.ads  
 
-LIBGNAT=../rts/libgnat.a 
-
-GCC_LINK=$(CC) -static-libgcc $(ADA_INCLUDES)
-
-# when compiling the tools, the runtime has to be first on the path so that
-# it hides the runtime files lying with the rest of the sources
-ifeq ($(TOOLSCASE),native)
-  vpath %.ads ../rts ../
-  vpath %.adb ../rts ../
-  vpath %.c   ../rts ../
-  vpath %.h   ../rts ../
-endif
-
-# in the cross tools case, everything is compiled with the native 
-# gnatmake/link. Therefore only -I needs to be modified in ADA_INCLUDES
-ifeq ($(TOOLSCASE),cross)
-  vpath %.ads ../
-  vpath %.adb ../
-  vpath %.c   ../
-  vpath %.h   ../
-endif
-
-../../gnatchop$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatchop --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatchop 
-	$(GNATLINK) -v gnatchop -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnat$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatcmd --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatcmd 
-	$(GNATLINK) -v gnatcmd -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatkr$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatkr --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatkr 
-	$(GNATLINK) -v gnatkr -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatls$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatls --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatls 
-	$(GNATLINK) -v gnatls -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatname$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatname --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatname 
-	$(GNATLINK) -v gnatname -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gprmake$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gprmake --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gprmake
-	$(GNATLINK) -v gprmake -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatprep$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatprep --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatprep 
-	$(GNATLINK) -v gnatprep -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatxref$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatxref --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatxref 
-	$(GNATLINK) -v gnatxref -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatfind$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatfind --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatfind 
-	$(GNATLINK) -v gnatfind -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatclean$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatclean --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatclean
-	$(GNATLINK) -v gnatclean -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatsym$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatsym
-	$(GNATLINK) -v gnatsym -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnatdll$(exeext): 
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) $(GNATBIND_FLAGS) gnatdll
-	$(GNATLINK) -v gnatdll -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../vxaddr2line$(exeext): targext.o
-	$(GNATMAKE) -c  $(ADA_INCLUDES) vxaddr2line --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vxaddr2line 
-	$(GNATLINK) -v vxaddr2line -o $@ --GCC="$(GCC_LINK)" targext.o $(CLIB)
-
-gnatmake-re:  link.o targext.o
-	$(GNATMAKE) $(ADA_INCLUDES) -u sdefault --GCC="$(CC) $(MOST_ADA_FLAGS)"
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatmake --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatmake 
-	$(GNATLINK) -v gnatmake -o ../../gnatmake$(exeext) \
-		--GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-# Note the use of the "mv" command in order to allow gnatlink to be linked with
-# with the former version of gnatlink itself which cannot override itself.
-gnatlink-re:  link.o targext.o
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatlink --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlink 
-	$(GNATLINK) -v gnatlink -o ../../gnatlinknew$(exeext) \
-		    --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-	$(MV)  ../../gnatlinknew$(exeext)  ../../gnatlink$(exeext)
-  
-# Needs to be built with CC=gcc
-# Since the RTL should be built with the latest compiler, remove the
-#  stamp target in the parent directory whenever gnat1 is rebuilt
-
-# Likewise for the tools
-../../gnatmake$(exeext): $(P) b_gnatm.o link.o targext.o $(GNATMAKE_OBJS)
-	$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatm.o $(GNATMAKE_OBJS) \
-		    $(TOOLS_LIBS)
-
-../../gnatlink$(exeext): $(P) b_gnatl.o link.o targext.o $(GNATLINK_OBJS)
-	$(GCC_LINK) $(ALL_CFLAGS) $(LDFLAGS) -o $@ b_gnatl.o $(GNATLINK_OBJS) \
-		    $(TOOLS_LIBS)
-
-../../gnatbl$(exeext): gnatbl.o
-	$(GCC_LINK) -o $@ $(ALL_CFLAGS) $(LDFLAGS) gnatbl.o $(TOOLS_LIBS)
-
-gnatbl.o: gnatbl.c adaint.h
-	$(CC) $(ALL_CFLAGS) $(INCLUDES) -c $< $(OUTPUT_OPTION)
-
 ../stamp-gnatlib:
 	@if [ ! -f stamp-gnatlib ] ; \
 	then \
@@ -1823,12 +1681,10 @@
 #     permission is required.
 	for file in gnat gnarl; do \
 	   if [ -f rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
-	      $(INSTALL) rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
+	      $(INSTALL) rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
 			 $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
-	   fi; \
-	   if [ -f rts/lib$${file}$(soext) ]; then \
-	      $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
-	      $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
+	      $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
+	      $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext); \
 	   fi; \
 	done
 # This copy must be done preserving the date on the original file.
@@ -1838,18 +1694,6 @@
 	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb
 	cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads
 
-../stamp-gnatlib2:
-	$(RM) rts/s-*.ali
-	$(RM) rts/s-*$(objext)
-	$(RM) rts/a-*.ali
-	$(RM) rts/a-*$(objext)
-	$(RM) rts/*.ali
-	$(RM) rts/*$(objext)
-	$(RM) rts/*$(arext)
-	$(RM) rts/*$(soext)
-	touch ../stamp-gnatlib2
-	$(RM) ../stamp-gnatlib
-
 # NOTE: The $(foreach ...) commands assume ";" is the valid separator between
 #       successive target commands. Although the Gnu make documentation
 #       implies this is true on all systems, I suspect it may not be, So care
@@ -1859,7 +1703,7 @@
 
 # GNULLI Begin ###########################################################
 
-../stamp-gnatlib1: Makefile ../stamp-gnatlib2
+../stamp-gnatlib1: Makefile
 	$(RMDIR) rts
 	$(MKDIR) rts
 	$(CHMOD) u+w rts
@@ -1885,7 +1729,7 @@
 # Example: cd rts; ar rc libfoo.a $(LONG_LIST_OF_OBJS)
 # is guaranteed to overflow the buffer.
 
-gnatlib: ../stamp-gnatlib1 ../stamp-gnatlib2
+gnatlib: ../stamp-gnatlib1
 	$(MAKE) -C rts \
 		CC="`echo \"$(GCC_FOR_TARGET)\" \
 		| sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
@@ -1924,64 +1768,75 @@
 		  rts/memtrack.o
 		$(RANLIB_FOR_TARGET) rts/libgmem$(arext)
         endif
-	$(CHMOD) a-wx rts/*.ali
 	touch ../stamp-gnatlib
 
 # Warning: this target assumes that LIBRARY_VERSION has been set correctly.
-gnatlib-shared-default:
-	$(MAKE) $(FLAGS_TO_PASS) \
-             GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
-	     THREAD_KIND="$(THREAD_KIND)" \
-             gnatlib
-	$(RM) rts/libgna*$(soext)
+gnatlib-shared-default: ../stamp-gnatlib1
+	$(MAKE) -C rts \
+		CC="`echo \"$(GCC_FOR_TARGET)\" \
+		| sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
+	        INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
+                CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
+		srcdir=$(fsrcdir) \
+	        -f ../Makefile $(LIBGNAT_OBJS)
+	$(MAKE) -C rts \
+		CC="`echo \"$(GCC_FOR_TARGET)\" \
+		| sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
+	        ADA_INCLUDES="" \
+                CFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+	        ADAFLAGS="$(GNATLIBFLAGS)" \
+	        THREAD_KIND="$(THREAD_KIND)" \
+		srcdir=$(fsrcdir) \
+	        -f ../Makefile \
+	        $(GNATRTL_OBJS)
+	$(RM) rts/libgna*$(soext) rts/libgna*$(soext).1
 	cd rts; ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
 		$(TARGET_LIBGCC2_CFLAGS) \
-		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
 		$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
 		g-trasym.o convert_addresses.o \
-		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		$(SO_OPTS)libgnat$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
 		$(MISCLIB) -lm
 	cd rts; ../../xgcc -B../../ -shared $(GNATLIBCFLAGS) \
 		$(TARGET_LIBGCC2_CFLAGS) \
-		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
 		$(GNATRTL_TASKING_OBJS) \
-		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+		$(SO_OPTS)libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext).1 \
 		$(THREADSLIB)
-	cd rts; $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
-		libgnat$(soext)
-	cd rts; $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
-		libgnarl$(soext)
+	cd rts; for lib in gnat gnarl; do \
+		l=lib$${lib}$(hyphen)$(LIBRARY_VERSION)$(soext); \
+		$(LN_S) $$l.1 $$l; \
+	done
+# Delete the object files, lest they be linked statically into the tools
+# executables.  Only the .ali, .a and .so files must remain.
+	rm -f rts/*.o
+	$(CHMOD) a-wx rts/*.ali
 
 gnatlib-shared-dual:
 	$(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
 	     THREAD_KIND="$(THREAD_KIND)" \
-             gnatlib-shared-default
-	$(MV) rts/libgna*$(soext) .
-	$(RM) ../stamp-gnatlib2
+             gnatlib
+	$(RM) rts/*.o rts/*.ali
 	$(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
 	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
 	     THREAD_KIND="$(THREAD_KIND)" \
-             gnatlib
-	$(MV) libgna*$(soext) rts
+             gnatlib-shared-default
 
 gnatlib-shared-dual-win32:
 	$(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
+	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
 	     THREAD_KIND="$(THREAD_KIND)" \
-             gnatlib-shared-win32
-	$(MV) rts/libgna*$(soext) .
-	$(RM) ../stamp-gnatlib2
+             gnatlib
+	$(RM) rts/*.o rts/*.ali
 	$(MAKE) $(FLAGS_TO_PASS) \
              GNATLIBFLAGS="$(GNATLIBFLAGS)" \
-	     GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
+	     GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
 	     THREAD_KIND="$(THREAD_KIND)" \
-             gnatlib
-	$(MV) libgna*$(soext) rts
+             gnatlib-shared-win32
 
 # ??? we need to add the option to support auto-import of arrays/records to
 # the GNATLIBFLAGS when this will be supported by GNAT. At this point we will
@@ -2090,22 +1945,6 @@
 gnat-cross: force
 	make $(GNAT1_ADA_OBJS) CC="gcc -B../stage1/" CFLAGS="-S -gnatp"
 
-# Compiling object files from source files.
-
-# Note that dependencies on obstack.h are not written
-# because that file is not part of GCC.
-# Dependencies on gvarargs.h are not written
-# because all that file does, when not compiling with GCC,
-# is include the system varargs.h.
-
-b_gnatl.c : $(GNATLINK_OBJS)
-	$(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatl.c gnatlink.ali
-b_gnatl.o : b_gnatl.c
-
-b_gnatm.c : $(GNATMAKE_OBJS)
-	$(GNATBIND) -C $(ADA_INCLUDES) -o b_gnatm.c gnatmake.ali
-b_gnatm.o : b_gnatm.c
-
 ADA_INCLUDE_DIR = $(libsubdir)/adainclude
 ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
 
@@ -2225,19 +2064,3 @@
 .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
 
 force:
-
-# Gnatlbr, Vms_help, and Gnat.hlp are only used on VMS
-
-../../gnatlbr$(exeext): ../../prefix.o
-	$(GNATMAKE) -c $(ADA_INCLUDES) gnatlbr --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatlbr
-	$(GNATLINK) -v gnatlbr -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../vms_help$(exeext):
-	$(GNATMAKE) -c $(ADA_INCLUDES) vms_help --GCC="$(CC) $(ALL_ADAFLAGS)"
-	$(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vms_help
-	$(GNATLINK) -v vms_help -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnat.hlp: ../../vms_help$(exeext)
-	../../vms_help$(exeext) $(fsrcdir)/gnat.help_in \
-	                        $(fsrcdir)/vms_data.ads ../../gnat.hlp
Index: gnattools/Makefile.in
===================================================================
--- gnattools/Makefile.in.orig	2007-07-05 10:19:48.000000000 +0200
+++ gnattools/Makefile.in	2008-01-29 12:16:44.696811771 +0100
@@ -18,6 +18,8 @@
 # Default target; must be first.
 all: gnattools
 
+.SUFFIXES:
+
 # Standard autoconf-set variables.
 SHELL = @SHELL@
 srcdir = @srcdir@
@@ -32,112 +34,16 @@
 LN_S=@LN_S@
 target_noncanonical=@target_noncanonical@
 
-# Variables for the user (or the top level) to override.
-objext=.o
-TRACE=no
-ADA_FOR_BUILD=
-ADA_FOR_TARGET=
-LDFLAGS=
-PWD_COMMAND = $${PWDCMD-pwd}
-
-# The tedious process of getting CFLAGS right.
-CFLAGS=-g
-LOOSE_WARN = -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-GCC_WARN_CFLAGS = $(LOOSE_WARN) $(NOCOMMON_FLAG)
-
-ADA_CFLAGS=
-T_ADA_CFLAGS=
-# HPPA is literally the only target which sets X_ADA_CFLAGS
-X_ADA_CFLAGS=@x_ada_cflags@
-ALL_ADA_CFLAGS=$(X_ADA_CFLAGS) $(T_ADA_CFLAGS) $(ADA_CFLAGS)
-
-# Variables for gnattools.
-ADAFLAGS= -gnatpg -gnata
-ADA_INCLUDE_DIR = $(libsubdir)/adainclude
-ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
-
-# For finding the GCC build dir, which is used far too much
-GCC_DIR=../gcc
-# Include fragment generated by GCC configure; shared with libada for now.
-include $(GCC_DIR)/libada-mk
-# Variables based on those gleaned from the GCC makefile.  :-P
-libsubdir=$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)
-
-# Get possible host-specific override for libsubdir (ick).
-xmake_file=$(subst /config,/../gcc/config,$(gcc_xmake_file))
-ifneq ($(xmake_file),)
-include $(xmake_file)
-endif
-
-# Absolute srcdir for gcc/ada (why do we want absolute?  I dunno)
-fsrcdir := $(shell cd $(srcdir)/../gcc/ada/; ${PWD_COMMAND})
-
-# Useful "subroutines" for the excess includes
-INCLUDES_FOR_SUBDIR = -I. -I.. -I../.. -I$(fsrcdir) -I$(fsrcdir)/../config \
-	-I$(fsrcdir)/../../include -I$(fsrcdir)/..
-ADA_INCLUDES_FOR_SUBDIR = -I. -I$(fsrcdir)
-
-# Variables for gnattools1, native
-TOOLS_FLAGS_TO_PASS_1= \
-	"CC=../../xgcc -B../../" \
-	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
-	"LDFLAGS=$(LDFLAGS)" \
-	"ADAFLAGS=$(ADAFLAGS)" \
-	"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
-	"ADA_INCLUDES=-I- -I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
-	"exeext=$(exeext)" \
-	"fsrcdir=$(fsrcdir)" \
-	"srcdir=$(fsrcdir)" \
-	"GNATBIND=../../gnatbind" \
-	"TOOLSCASE=native"
-
-# Variables for regnattools
-TOOLS_FLAGS_TO_PASS_1re= \
-	"CC=../../xgcc -B../../" \
-	"CFLAGS=$(CFLAGS)" \
-	"ADAFLAGS=$(ADAFLAGS)" \
-	"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
-	"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)"\
-	"exeext=$(exeext)" \
-	"fsrcdir=$(fsrcdir)" \
-	"srcdir=$(fsrcdir)" \
-	"GNATMAKE=../../gnatmake" \
-	"GNATLINK=../../gnatlink" \
-	"GNATBIND=../../gnatbind" \
-	"TOOLSCASE=cross" \
-	"INCLUDES="
-
-# Variables for gnattools2, native
-TOOLS_FLAGS_TO_PASS_NATIVE= \
-	"CC=../../xgcc -B../../" \
-	"CFLAGS=$(CFLAGS)" \
-	"ADAFLAGS=$(ADAFLAGS)" \
-	"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
-	"ADA_INCLUDES=-I../rts $(ADA_INCLUDES_FOR_SUBDIR)" \
-	"exeext=$(exeext)" \
-	"fsrcdir=$(fsrcdir)" \
-	"srcdir=$(fsrcdir)" \
-	"GNATMAKE=../../gnatmake" \
-	"GNATLINK=../../gnatlink" \
-	"GNATBIND=../../gnatbind" \
-	"TOOLSCASE=native"
-
-# Variables for gnattools, cross
-TOOLS_FLAGS_TO_PASS_CROSS= \
-	"CC=$(CC)" \
-	"CFLAGS=$(CFLAGS) $(WARN_CFLAGS)" \
-	"LDFLAGS=$(LDFLAGS)" \
-	"ADAFLAGS=$(ADAFLAGS)"	\
-	"INCLUDES=$(INCLUDES_FOR_SUBDIR)" \
-	"ADA_INCLUDES=-I$(RTS_DIR)../adainclude -I$(RTS_DIR) $(ADA_INCLUDES_FOR_SUBDIR)" \
-	"exeext=$(exeext)" \
-	"fsrcdir=$(fsrcdir)" \
-	"srcdir=$(fsrcdir)" \
-	"GNATMAKE=gnatmake" \
-	"GNATLINK=gnatlink" \
-	"GNATBIND=gnatbind" \
-	"TOOLSCASE=cross" \
-	"LIBGNAT="
+CFLAGS=-O2 -Wall
+INCLUDES = -I@srcdir@/../gcc/ada -I@srcdir@/../gcc
+ADA_CFLAGS=-O2 -gnatn
+ADA_INCLUDES=-nostdinc -I- -I. -I../gcc/ada/rts -I@srcdir@/../gcc/ada
+LIB_VERSION=$(strip $(shell grep ' Library_Version :' \
+              @srcdir@/../gcc/ada/gnatvsn.ads | sed -e 's/.*"\(.*\)".*/\1/'))
+ADA_LIBS := -L../gcc/ada/rts -lgnat-$(LIB_VERSION)
+
+# We will use the just-built compiler to compile and link everything.
+GCC=../gcc/xgcc -B../gcc/
 
 # File lists
 # ----------
@@ -146,17 +52,136 @@
 EXTRA_GNATTOOLS = @EXTRA_GNATTOOLS@
 TOOLS_TARGET_PAIRS = @TOOLS_TARGET_PAIRS@
 
-# These are built by gnatmake, and in both native and cross configurations.
-GNATTOOLS2_FILES = \
-	../../gnatchop$(exeext) \
-	../../gnat$(exeext) \
-	../../gnatkr$(exeext) \
-	../../gnatls$(exeext) \
-	../../gnatprep$(exeext) \
-	../../gnatxref$(exeext) \
-	../../gnatfind$(exeext) \
-	../../gnatname$(exeext) \
-	../../gnatclean$(exeext)
+# Stage 1 builds xgcc and gnatbind; we can use them to build
+# gnatmake-static and gnatlink-static, then use gnatmake-static and
+# gnatlink-static to build the other tools.  The reason we first build
+# statically-linked versions of gnatmake and gnatlink is so we can run
+# them with confidence on all build platforms, without LD_LIBRARY_PATH
+# or some such variable.
+
+# The tools we will build using gnatmake-static and gnatlink-static.
+TOOLS := gnat gnatbind gnatchop gnatclean gnatfind gnatkr gnatls gnatlink
+TOOLS += gnatmake gnatname gnatprep gnatxref gprmake
+
+# Since we don't have gnatmake, we must specify the full list of
+# object files necessary to build gnatmake and gnatlink.
+# TODO: remove from these lists the objects that are part of
+# libgnatvsn and libgnatprj.
+GNATLINK_OBJS = \
+ali.o \
+alloc.o \
+butil.o \
+casing.o \
+csets.o \
+debug.o \
+fmap.o \
+fname.o \
+gnatlink.o \
+gnatvsn.o \
+hostparm.o \
+indepsw.o \
+namet.o \
+opt.o \
+osint.o \
+output.o \
+prefix.o \
+rident.o \
+sdefault.o \
+snames.o \
+stylesw.o \
+switch.o \
+table.o \
+targparm.o \
+tree_io.o \
+types.o \
+validsw.o \
+version.o \
+widechar.o
+
+GNATMAKE_OBJS = \
+ali-util.o \
+ali.o \
+alloc.o \
+atree.o \
+binderr.o \
+butil.o \
+casing.o \
+csets.o \
+debug.o \
+einfo.o\
+elists.o \
+err_vars.o \
+erroutc.o \
+errutil.o \
+fmap.o \
+fname-sf.o \
+fname-uf.o \
+fname.o \
+gnatmake.o \
+gnatvsn.o \
+hostparm.o \
+krunch.o \
+lib.o \
+make.o \
+makeusg.o \
+makeutl.o \
+mlib-fil.o \
+mlib-prj.o \
+mlib-tgt.o \
+mlib-tgt-specific.o \
+mlib-utl.o \
+mlib.o \
+namet.o \
+nlists.o \
+opt.o \
+osint-m.o \
+osint.o \
+output.o \
+prefix.o \
+prj-attr-pm.o \
+prj-attr.o \
+prj-com.o \
+prj-dect.o \
+prj-env.o \
+prj-err.o \
+prj-ext.o \
+prj-nmsc.o \
+prj-pars.o \
+prj-part.o \
+prj-proc.o \
+prj-strt.o \
+prj-tree.o \
+prj-util.o \
+prj.o \
+rident.o \
+scans.o \
+scng.o \
+sdefault.o \
+sfn_scan.o \
+sinfo.o \
+sinput-c.o \
+sinput-p.o \
+sinput.o \
+snames.o \
+stand.o \
+stringt.o \
+styleg.o \
+stylesw.o \
+switch-m.o \
+switch.o \
+table.o \
+targparm.o \
+tempdir.o \
+tree_io.o \
+types.o \
+uintp.o \
+uname.o \
+urealp.o \
+usage.o \
+validsw.o \
+version.o \
+widechar.o \
+$(EXTRA_GNATMAKE_OBJS)
 
 # Makefile targets
 # ----------------
@@ -164,126 +189,106 @@
 .PHONY: gnattools gnattools-native gnattools-cross regnattools
 gnattools: @default_gnattools_target@
 
-# Sanity check
-$(GCC_DIR)/stamp-gnatlib:
-	@if [ ! -f $(GCC_DIR)/stamp-gnatlib ] ; \
-        then \
-          echo "Cannot build gnattools while gnatlib is out of date or unbuilt" ; \
-          false; \
-        else \
-          true; \
-        fi
-
-
 # Build directory for the tools. Let's copy the target-dependent
 # sources using the same mechanism as for gnatlib. The other sources are
-# accessed using the vpath directive in ada/Makefile.in
+# accessed using the vpath directive.
+
+stamp-gnattools-sources:
+	$(LN_S) ../gcc/ada/sdefault.adb .
+	$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
+	          rm -f $(word 1,$(subst <, ,$(PAIR)));\
+	          $(LN_S) @srcdir@/../gcc/ada/$(word 2,$(subst <, ,$(PAIR))) \
+	                  $(word 1,$(subst <, ,$(PAIR)));)
+	touch $@
+
+gnattools-native: ../gcc/ada/rts/libgnat-$(LIB_VERSION).so
+gnattools-native: stamp-gnattools-sources
+gnattools-native: $(TOOLS) gnatbl
+
+$(TOOLS) gnatcmd: | gnatmake-static gnatlink-static
+
+vpath %.c @srcdir@/../gcc/ada:@srcdir@/../gcc
+vpath %.h @srcdir@/../gcc/ada
+vpath %.adb .:@srcdir@/../gcc/ada
+vpath %.ads @srcdir@/../gcc/ada
+
+# Because the just-built gcc is a host tool like us, we can use some
+# of its object files, e.g. prefix.o and version.o.
+vpath prefix.o ../gcc
+vpath version.o ../gcc
+
+# gnatlink
+
+gnatlink-static: $(GNATLINK_OBJS) b_gnatl.o link.o
+	$(GCC) -o $@ $^ \
+	   ../gcc/ada/rts/libgnat.a \
+	   ../libiberty/libiberty.a
+
+gnatlink: $(GNATLINK_OBJS) b_gnatl.o link.o
+	$(GCC) -o $@ $^ $(ADA_LIBS) ../libiberty/libiberty.a
+
+b_gnatl.o: b_gnatl.c adaint.h
+	$(GCC) -c -o $@ $(CFLAGS) $<
+
+b_gnatl.c: $(GNATLINK_OBJS)
+	../gcc/gnatbind -C -o $@ $(ADA_INCLUDES) gnatlink.ali
+
+# gnatmake
+
+gnatmake-static: $(GNATMAKE_OBJS) b_gnatm.o link.o
+	$(GCC) -o $@ $(ADA_CFLAGS) $^ \
+	   ../gcc/ada/rts/libgnat.a \
+	   ../libiberty/libiberty.a
+
+gnatmake: $(GNATMAKE_OBJS) b_gnatm.o link.o
+	$(GCC) -o $@ $(ADA_CFLAGS) $^ $(ADA_LIBS) ../libiberty/libiberty.a
+
+b_gnatm.o: b_gnatm.c adaint.h
+	$(GCC) -c -o $@ $(CFLAGS) $<
+
+b_gnatm.c: $(GNATMAKE_OBJS) adaint.h
+	../gcc/gnatbind -C -o $@ $(ADA_INCLUDES) gnatmake.ali
+
+# Other tools
+gnatkr: version.o
+	./gnatmake-static -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \
+	   --GCC="$(GCC)" \
+	   --GNATBIND=../gcc/gnatbind
+	./gnatlink-static -o $@ $@.ali $^ $(ADA_INCLUDES) $(ADA_LIBS) \
+	   --GCC="$(GCC) $(ADA_INCLUDES)" 
+
+gnat: gnatcmd
+	cp -lp $< $@
+
+gnatbind gnatchop gnatclean gnatcmd gnatfind gnatls gnatname gnatprep gnatxref gprmake: \
+link.o version.o prefix.o
+	./gnatmake-static -c -b $@ $(ADA_CFLAGS) $(ADA_INCLUDES) \
+	   --GCC="$(GCC)" \
+	   --GNATBIND=../gcc/gnatbind
+	./gnatlink-static -o $@ $@.ali $^ $(ADA_INCLUDES) $(ADA_LIBS) \
+	   ../libiberty/libiberty.a \
+	   --GCC="$(GCC) $(ADA_INCLUDES)"
+
+gnatbl: gnatbl.c link.o version.o prefix.o
+	$(GCC) -o $@ $< $(CFLAGS) \
+	   -I../gcc -I@srcdir@/../gcc/config -I@srcdir@/../gcc \
+	   -I@srcdir@/../include \
+	   $(filter-out %.c,$^) \
+	   $(ADA_LIBS) ../libiberty/libiberty.a
+
+# Force compiling sdefault.adb, not .ads, to produce sdefault.o
+sdefault.o: sdefault.adb
+
+sdefault.adb: stamp-gnattools-sources
+
+%.o: %.adb
+	$(GCC) -c -o $@ $< $(ADA_CFLAGS) $(ADA_INCLUDES)
+
+%.o: %.ads
+	$(GCC) -c -o $@ $< $(ADA_CFLAGS) $(ADA_INCLUDES)
 
-$(GCC_DIR)/stamp-tools:
-	-rm -rf $(GCC_DIR)/ada/tools
-	-mkdir -p $(GCC_DIR)/ada/tools
-	-(cd $(GCC_DIR)/ada/tools; $(LN_S) ../sdefault.adb .)
-	-$(foreach PAIR,$(TOOLS_TARGET_PAIRS), \
-	          rm -f $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));\
-	          $(LN_S) $(fsrcdir)/$(word 2,$(subst <, ,$(PAIR))) \
-	                $(GCC_DIR)/ada/tools/$(word 1,$(subst <, ,$(PAIR)));)
-	touch $(GCC_DIR)/stamp-tools
-
-# gnatmake/link tools cannot always be built with gnatmake/link for bootstrap 
-# reasons: gnatmake should be built with a recent compiler, a recent compiler
-# may not generate ALI files compatible with an old gnatmake so it is important
-# to be able to build gnatmake without a version of gnatmake around. Once 
-# everything has been compiled once, gnatmake can be recompiled with itself 
-# (see target regnattools) 
-gnattools-native: $(GCC_DIR)/stamp-tools $(GCC_DIR)/stamp-gnatlib
-	# gnattools1
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_1) \
-	  ../../gnatmake$(exeext) ../../gnatlink$(exeext) ../../gnatbl$(exeext)
-	# gnattools2
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_NATIVE) \
-	  $(GNATTOOLS2_FILES)
-
-# gnatmake/link can be built with recent gnatmake/link if they are available.
-# This is especially convenient for building cross tools or for rebuilding
-# the tools when the original bootstrap has already be done.
-regnattools: $(GCC_DIR)/stamp-gnatlib
-	# gnattools1-re
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_1re) \
-	  gnatmake-re gnatlink-re
-	# gnattools2
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_NATIVE) \
-	  $(GNATTOOLS2_FILES)
-
-# For cross builds of gnattools,
-# put the host RTS dir first in the PATH to hide the default runtime
-# files that are among the sources
-# FIXME: This should be done in configure.
-RTS_DIR:=$(strip $(subst \,/,$(shell gnatls -v | grep adalib )))
-gnattools-cross: $(GCC_DIR)/stamp-tools
-	# gnattools1-re
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_CROSS) INCLUDES="" \
-	  gnatmake-re gnatlink-re
-	# gnattools2
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_CROSS) \
-	  $(GNATTOOLS2_FILES)
-	# gnattools4 (cross only)
-	$(MAKE) -C $(GCC_DIR)/ada/tools -f ../Makefile \
-	  $(TOOLS_FLAGS_TO_PASS_CROSS) \
-	  top_buildir=../../.. \
-           ../../vxaddr2line$(exeext)
-	# Rename cross tools to where the GCC makefile wants them when
-	# installing.  FIXME: installation should be done elsewhere.
-	if [ -f $(GCC_DIR)/gnatbind$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatbind$(exeext) $(GCC_DIR)/gnatbind-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatbl$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatbl$(exeext) $(GCC_DIR)/gnatbl-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatchop$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatchop$(exeext) $(GCC_DIR)/gnatchop-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnat$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnat$(exeext) $(GCC_DIR)/gnat-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatkr$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatkr$(exeext) $(GCC_DIR)/gnatkr-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatlink$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatlink$(exeext) $(GCC_DIR)/gnatlink-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatls$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatls$(exeext) $(GCC_DIR)/gnatls-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatmake$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatmake$(exeext) $(GCC_DIR)/gnatmake-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatmem$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatmem$(exeext) $(GCC_DIR)/gnatmem-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatname$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatname$(exeext) $(GCC_DIR)/gnatname-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatprep$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatprep$(exeext) $(GCC_DIR)/gnatprep-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatxref$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatxref$(exeext) $(GCC_DIR)/gnatxref-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatfind$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatfind$(exeext) $(GCC_DIR)/gnatfind-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatclean$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatclean$(exeext) $(GCC_DIR)/gnatclean-cross$(exeext); \
-	fi
-	if [ -f $(GCC_DIR)/gnatsym$(exeext) ] ; then \
-	  mv $(GCC_DIR)/gnatsym$(exeext) $(GCC_DIR)/gnatsym-cross$(exeext); \
-	fi
+%.o: %.c
+	$(GCC) -c -o $@ $< $(CFLAGS) $(INCLUDES)
 
 # Other
 # -----
@@ -311,6 +316,7 @@
 
 # Installation rules.
 install:
+	$(INSTALL) -s gnatmake gnatlink $(TOOLS) gnatbl $(DESTDIR)$(bindir)
 
 install-info:
 
@@ -320,8 +326,10 @@
 
 # Cleaning rules.
 mostlyclean:
+	$(RM) gnatmake gnatlink $(TOOLS) gnatbl *.o *.ali
 
 clean:
+	$(RM) *.ads *.adb stamp-gnattools-sources
 
 distclean:
 	$(RM) Makefile config.status config.log
Index: libada/Makefile.in
===================================================================
--- libada/Makefile.in.orig	2007-03-04 01:29:34.000000000 +0100
+++ libada/Makefile.in	2008-01-29 12:16:44.696811771 +0100
@@ -49,7 +49,7 @@
 
 # For finding the GCC build dir, which is used far too much
 host_subdir = @host_subdir@
-GCC_DIR=../../$(host_subdir)/gcc
+GCC_DIR=../$(host_subdir)/gcc
 # Include fragment generated by GCC configure.
 include $(GCC_DIR)/libada-mk
 
Index: Makefile.def
===================================================================
--- Makefile.def.orig	2007-11-21 12:21:09.000000000 +0100
+++ Makefile.def	2008-01-29 12:16:44.696811771 +0100
@@ -116,7 +116,20 @@
                 missing=distclean;
                 missing=maintainer-clean; };
 host_modules= { module= utils; no_check=true; };
-host_modules= { module= gnattools; };
+host_modules= { module= libada; no_install=true; no_check=true;
+		missing= info;
+		missing= dvi;
+		missing= html;
+		missing= TAGS;
+		missing= install-info;
+		missing= installcheck; };
+host_modules= { module= gnattools; no_check=true;
+		missing= info;
+		missing= dvi;
+		missing= html;
+		missing= TAGS;
+		missing= install-info;
+		missing= installcheck; };
 
 target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; };
 target_modules = { module= libmudflap; lib_path=.libs; };
@@ -141,7 +154,13 @@
 target_modules = { module= boehm-gc; };
 target_modules = { module= qthreads; };
 target_modules = { module= rda; };
-target_modules = { module= libada; };
+target_modules = { module= libada; no_install=true; no_check=true;
+		   missing= info;
+		   missing= dvi;
+		   missing= html;
+		   missing= TAGS;
+		   missing= install-info;
+		   missing= installcheck; };
 target_modules = { module= libgomp; lib_path=.libs; };
 
 // These are (some of) the make targets to be done in each subdirectory.
@@ -311,7 +330,7 @@
 
 dependencies = { module=all-fixincludes; on=all-libiberty; };
 
-dependencies = { module=all-gnattools; on=all-target-libada; };
+dependencies = { module=all-gnattools; on=all-libada; };
 
 dependencies = { module=configure-mpfr; on=all-gmp; };
 
Index: Makefile.in
===================================================================
--- Makefile.in.orig	2008-01-13 22:19:42.000000000 +0100
+++ Makefile.in	2008-01-29 12:16:44.740811997 +0100
@@ -699,6 +699,7 @@
     maybe-configure-tk \
     maybe-configure-libtermcap \
     maybe-configure-utils \
+    maybe-configure-libada \
     maybe-configure-gnattools
 .PHONY: configure-target
 configure-target:  \
@@ -849,6 +850,7 @@
 all-host: maybe-all-tk
 all-host: maybe-all-libtermcap
 all-host: maybe-all-utils
+all-host: maybe-all-libada
 all-host: maybe-all-gnattools
 
 .PHONY: all-target
@@ -962,6 +964,7 @@
 info-host: maybe-info-tk
 info-host: maybe-info-libtermcap
 info-host: maybe-info-utils
+info-host: maybe-info-libada
 info-host: maybe-info-gnattools
 
 .PHONY: info-target
@@ -1068,6 +1071,7 @@
 dvi-host: maybe-dvi-tk
 dvi-host: maybe-dvi-libtermcap
 dvi-host: maybe-dvi-utils
+dvi-host: maybe-dvi-libada
 dvi-host: maybe-dvi-gnattools
 
 .PHONY: dvi-target
@@ -1174,6 +1178,7 @@
 pdf-host: maybe-pdf-tk
 pdf-host: maybe-pdf-libtermcap
 pdf-host: maybe-pdf-utils
+pdf-host: maybe-pdf-libada
 pdf-host: maybe-pdf-gnattools
 
 .PHONY: pdf-target
@@ -1280,6 +1285,7 @@
 html-host: maybe-html-tk
 html-host: maybe-html-libtermcap
 html-host: maybe-html-utils
+html-host: maybe-html-libada
 html-host: maybe-html-gnattools
 
 .PHONY: html-target
@@ -1386,6 +1392,7 @@
 TAGS-host: maybe-TAGS-tk
 TAGS-host: maybe-TAGS-libtermcap
 TAGS-host: maybe-TAGS-utils
+TAGS-host: maybe-TAGS-libada
 TAGS-host: maybe-TAGS-gnattools
 
 .PHONY: TAGS-target
@@ -1492,6 +1499,7 @@
 install-info-host: maybe-install-info-tk
 install-info-host: maybe-install-info-libtermcap
 install-info-host: maybe-install-info-utils
+install-info-host: maybe-install-info-libada
 install-info-host: maybe-install-info-gnattools
 
 .PHONY: install-info-target
@@ -1598,6 +1606,7 @@
 install-pdf-host: maybe-install-pdf-tk
 install-pdf-host: maybe-install-pdf-libtermcap
 install-pdf-host: maybe-install-pdf-utils
+install-pdf-host: maybe-install-pdf-libada
 install-pdf-host: maybe-install-pdf-gnattools
 
 .PHONY: install-pdf-target
@@ -1704,6 +1713,7 @@
 install-html-host: maybe-install-html-tk
 install-html-host: maybe-install-html-libtermcap
 install-html-host: maybe-install-html-utils
+install-html-host: maybe-install-html-libada
 install-html-host: maybe-install-html-gnattools
 
 .PHONY: install-html-target
@@ -1810,6 +1820,7 @@
 installcheck-host: maybe-installcheck-tk
 installcheck-host: maybe-installcheck-libtermcap
 installcheck-host: maybe-installcheck-utils
+installcheck-host: maybe-installcheck-libada
 installcheck-host: maybe-installcheck-gnattools
 
 .PHONY: installcheck-target
@@ -1916,6 +1927,7 @@
 mostlyclean-host: maybe-mostlyclean-tk
 mostlyclean-host: maybe-mostlyclean-libtermcap
 mostlyclean-host: maybe-mostlyclean-utils
+mostlyclean-host: maybe-mostlyclean-libada
 mostlyclean-host: maybe-mostlyclean-gnattools
 
 .PHONY: mostlyclean-target
@@ -2022,6 +2034,7 @@
 clean-host: maybe-clean-tk
 clean-host: maybe-clean-libtermcap
 clean-host: maybe-clean-utils
+clean-host: maybe-clean-libada
 clean-host: maybe-clean-gnattools
 
 .PHONY: clean-target
@@ -2128,6 +2141,7 @@
 distclean-host: maybe-distclean-tk
 distclean-host: maybe-distclean-libtermcap
 distclean-host: maybe-distclean-utils
+distclean-host: maybe-distclean-libada
 distclean-host: maybe-distclean-gnattools
 
 .PHONY: distclean-target
@@ -2234,6 +2248,7 @@
 maintainer-clean-host: maybe-maintainer-clean-tk
 maintainer-clean-host: maybe-maintainer-clean-libtermcap
 maintainer-clean-host: maybe-maintainer-clean-utils
+maintainer-clean-host: maybe-maintainer-clean-libada
 maintainer-clean-host: maybe-maintainer-clean-gnattools
 
 .PHONY: maintainer-clean-target
@@ -2394,6 +2409,7 @@
     maybe-check-tk \
     maybe-check-libtermcap \
     maybe-check-utils \
+    maybe-check-libada \
     maybe-check-gnattools
 
 .PHONY: check-target
@@ -2526,6 +2542,7 @@
     maybe-install-tk \
     maybe-install-libtermcap \
     maybe-install-utils \
+    maybe-install-libada \
     maybe-install-gnattools
 
 .PHONY: install-host
@@ -2599,6 +2616,7 @@
     maybe-install-tk \
     maybe-install-libtermcap \
     maybe-install-utils \
+    maybe-install-libada \
     maybe-install-gnattools
 
 .PHONY: install-target
@@ -38875,6 +38893,321 @@
 
 
 
+.PHONY: configure-libada maybe-configure-libada
+maybe-configure-libada:
+@if gcc-bootstrap
+configure-libada: stage_current
+@endif gcc-bootstrap
+@if libada
+maybe-configure-libada: configure-libada
+configure-libada: 
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	test ! -f $(HOST_SUBDIR)/libada/Makefile || exit 0; \
+	$(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/libada ; \
+	$(HOST_EXPORTS) \
+	echo Configuring in $(HOST_SUBDIR)/libada; \
+	cd "$(HOST_SUBDIR)/libada" || exit 1; \
+	case $(srcdir) in \
+	  /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
+	  *) topdir=`echo $(HOST_SUBDIR)/libada/ | \
+		sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
+	esac; \
+	srcdiroption="--srcdir=$${topdir}/libada"; \
+	libsrcdir="$$s/libada"; \
+	$(SHELL) $${libsrcdir}/configure \
+	  $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
+	  --target=${target_alias} $${srcdiroption}  \
+	  || exit 1
+@endif libada
+
+
+
+
+
+.PHONY: all-libada maybe-all-libada
+maybe-all-libada:
+@if gcc-bootstrap
+all-libada: stage_current
+@endif gcc-bootstrap
+@if libada
+TARGET-libada=all
+maybe-all-libada: all-libada
+all-libada: configure-libada
+	@: $(MAKE); $(unstage)
+	@r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(FLAGS_TO_PASS)  $(TARGET-libada))
+@endif libada
+
+
+
+
+.PHONY: check-libada maybe-check-libada
+maybe-check-libada:
+@if libada
+maybe-check-libada: check-libada
+
+check-libada:
+
+@endif libada
+
+.PHONY: install-libada maybe-install-libada
+maybe-install-libada:
+@if libada
+maybe-install-libada: install-libada
+
+install-libada:
+
+@endif libada
+
+# Other targets (info, dvi, pdf, etc.)
+
+.PHONY: maybe-info-libada info-libada
+maybe-info-libada:
+@if libada
+maybe-info-libada: info-libada
+
+# libada doesn't support info.
+info-libada:
+
+@endif libada
+
+.PHONY: maybe-dvi-libada dvi-libada
+maybe-dvi-libada:
+@if libada
+maybe-dvi-libada: dvi-libada
+
+# libada doesn't support dvi.
+dvi-libada:
+
+@endif libada
+
+.PHONY: maybe-pdf-libada pdf-libada
+maybe-pdf-libada:
+@if libada
+maybe-pdf-libada: pdf-libada
+
+pdf-libada: \
+    configure-libada 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing pdf in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          pdf) \
+	  || exit 1
+
+@endif libada
+
+.PHONY: maybe-html-libada html-libada
+maybe-html-libada:
+@if libada
+maybe-html-libada: html-libada
+
+# libada doesn't support html.
+html-libada:
+
+@endif libada
+
+.PHONY: maybe-TAGS-libada TAGS-libada
+maybe-TAGS-libada:
+@if libada
+maybe-TAGS-libada: TAGS-libada
+
+# libada doesn't support TAGS.
+TAGS-libada:
+
+@endif libada
+
+.PHONY: maybe-install-info-libada install-info-libada
+maybe-install-info-libada:
+@if libada
+maybe-install-info-libada: install-info-libada
+
+# libada doesn't support install-info.
+install-info-libada:
+
+@endif libada
+
+.PHONY: maybe-install-pdf-libada install-pdf-libada
+maybe-install-pdf-libada:
+@if libada
+maybe-install-pdf-libada: install-pdf-libada
+
+install-pdf-libada: \
+    configure-libada \
+    pdf-libada 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-pdf in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-pdf) \
+	  || exit 1
+
+@endif libada
+
+.PHONY: maybe-install-html-libada install-html-libada
+maybe-install-html-libada:
+@if libada
+maybe-install-html-libada: install-html-libada
+
+install-html-libada: \
+    configure-libada \
+    html-libada 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing install-html in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          install-html) \
+	  || exit 1
+
+@endif libada
+
+.PHONY: maybe-installcheck-libada installcheck-libada
+maybe-installcheck-libada:
+@if libada
+maybe-installcheck-libada: installcheck-libada
+
+# libada doesn't support installcheck.
+installcheck-libada:
+
+@endif libada
+
+.PHONY: maybe-mostlyclean-libada mostlyclean-libada
+maybe-mostlyclean-libada:
+@if libada
+maybe-mostlyclean-libada: mostlyclean-libada
+
+mostlyclean-libada: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing mostlyclean in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          mostlyclean) \
+	  || exit 1
+
+@endif libada
+
+.PHONY: maybe-clean-libada clean-libada
+maybe-clean-libada:
+@if libada
+maybe-clean-libada: clean-libada
+
+clean-libada: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing clean in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          clean) \
+	  || exit 1
+
+@endif libada
+
+.PHONY: maybe-distclean-libada distclean-libada
+maybe-distclean-libada:
+@if libada
+maybe-distclean-libada: distclean-libada
+
+distclean-libada: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing distclean in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          distclean) \
+	  || exit 1
+
+@endif libada
+
+.PHONY: maybe-maintainer-clean-libada maintainer-clean-libada
+maybe-maintainer-clean-libada:
+@if libada
+maybe-maintainer-clean-libada: maintainer-clean-libada
+
+maintainer-clean-libada: 
+	@: $(MAKE); $(unstage)
+	@[ -f ./libada/Makefile ] || exit 0; \
+	r=`${PWD_COMMAND}`; export r; \
+	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
+	$(HOST_EXPORTS) \
+	for flag in $(EXTRA_HOST_FLAGS) ; do \
+	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
+	done; \
+	echo "Doing maintainer-clean in libada" ; \
+	(cd $(HOST_SUBDIR)/libada && \
+	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
+	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
+	          "RANLIB=$${RANLIB}" \
+	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
+	          maintainer-clean) \
+	  || exit 1
+
+@endif libada
+
+
+
 .PHONY: configure-gnattools maybe-configure-gnattools
 maybe-configure-gnattools:
 @if gcc-bootstrap
@@ -38934,12 +39267,6 @@
 maybe-check-gnattools: check-gnattools
 
 check-gnattools:
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(FLAGS_TO_PASS)  check)
 
 @endif gnattools
 
@@ -38965,24 +39292,8 @@
 @if gnattools
 maybe-info-gnattools: info-gnattools
 
-info-gnattools: \
-    configure-gnattools 
-	@: $(MAKE); $(unstage)
-	@[ -f ./gnattools/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing info in gnattools" ; \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          info) \
-	  || exit 1
+# gnattools doesn't support info.
+info-gnattools:
 
 @endif gnattools
 
@@ -38991,24 +39302,8 @@
 @if gnattools
 maybe-dvi-gnattools: dvi-gnattools
 
-dvi-gnattools: \
-    configure-gnattools 
-	@: $(MAKE); $(unstage)
-	@[ -f ./gnattools/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing dvi in gnattools" ; \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          dvi) \
-	  || exit 1
+# gnattools doesn't support dvi.
+dvi-gnattools:
 
 @endif gnattools
 
@@ -39043,24 +39338,8 @@
 @if gnattools
 maybe-html-gnattools: html-gnattools
 
-html-gnattools: \
-    configure-gnattools 
-	@: $(MAKE); $(unstage)
-	@[ -f ./gnattools/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing html in gnattools" ; \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          html) \
-	  || exit 1
+# gnattools doesn't support html.
+html-gnattools:
 
 @endif gnattools
 
@@ -39069,24 +39348,8 @@
 @if gnattools
 maybe-TAGS-gnattools: TAGS-gnattools
 
-TAGS-gnattools: \
-    configure-gnattools 
-	@: $(MAKE); $(unstage)
-	@[ -f ./gnattools/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing TAGS in gnattools" ; \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          TAGS) \
-	  || exit 1
+# gnattools doesn't support TAGS.
+TAGS-gnattools:
 
 @endif gnattools
 
@@ -39095,25 +39358,8 @@
 @if gnattools
 maybe-install-info-gnattools: install-info-gnattools
 
-install-info-gnattools: \
-    configure-gnattools \
-    info-gnattools 
-	@: $(MAKE); $(unstage)
-	@[ -f ./gnattools/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing install-info in gnattools" ; \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          install-info) \
-	  || exit 1
+# gnattools doesn't support install-info.
+install-info-gnattools:
 
 @endif gnattools
 
@@ -39176,24 +39422,8 @@
 @if gnattools
 maybe-installcheck-gnattools: installcheck-gnattools
 
-installcheck-gnattools: \
-    configure-gnattools 
-	@: $(MAKE); $(unstage)
-	@[ -f ./gnattools/Makefile ] || exit 0; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(HOST_EXPORTS) \
-	for flag in $(EXTRA_HOST_FLAGS) ; do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	echo "Doing installcheck in gnattools" ; \
-	(cd $(HOST_SUBDIR)/gnattools && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	          installcheck) \
-	  || exit 1
+# gnattools doesn't support installcheck.
+installcheck-gnattools:
 
 @endif gnattools
 
@@ -48296,13 +48526,8 @@
 @if target-libada
 maybe-check-target-libada: check-target-libada
 
+# Dummy target for uncheckable module.
 check-target-libada:
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(TARGET_FLAGS_TO_PASS)   check)
 
 @endif target-libada
 
@@ -48311,13 +48536,8 @@
 @if target-libada
 maybe-install-target-libada: install-target-libada
 
-install-target-libada: installdirs
-	@: $(MAKE); $(unstage)
-	@r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(TARGET_FLAGS_TO_PASS)  install)
+# Dummy target for uninstallable.
+install-target-libada:
 
 @endif target-libada
 
@@ -48328,24 +48548,8 @@
 @if target-libada
 maybe-info-target-libada: info-target-libada
 
-info-target-libada: \
-    configure-target-libada 
-	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing info in $(TARGET_SUBDIR)/libada" ; \
-	for flag in $(EXTRA_TARGET_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	           info) \
-	  || exit 1
+# libada doesn't support info.
+info-target-libada:
 
 @endif target-libada
 
@@ -48354,24 +48558,8 @@
 @if target-libada
 maybe-dvi-target-libada: dvi-target-libada
 
-dvi-target-libada: \
-    configure-target-libada 
-	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing dvi in $(TARGET_SUBDIR)/libada" ; \
-	for flag in $(EXTRA_TARGET_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	           dvi) \
-	  || exit 1
+# libada doesn't support dvi.
+dvi-target-libada:
 
 @endif target-libada
 
@@ -48406,24 +48594,8 @@
 @if target-libada
 maybe-html-target-libada: html-target-libada
 
-html-target-libada: \
-    configure-target-libada 
-	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing html in $(TARGET_SUBDIR)/libada" ; \
-	for flag in $(EXTRA_TARGET_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	           html) \
-	  || exit 1
+# libada doesn't support html.
+html-target-libada:
 
 @endif target-libada
 
@@ -48432,24 +48604,8 @@
 @if target-libada
 maybe-TAGS-target-libada: TAGS-target-libada
 
-TAGS-target-libada: \
-    configure-target-libada 
-	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing TAGS in $(TARGET_SUBDIR)/libada" ; \
-	for flag in $(EXTRA_TARGET_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	           TAGS) \
-	  || exit 1
+# libada doesn't support TAGS.
+TAGS-target-libada:
 
 @endif target-libada
 
@@ -48458,25 +48614,8 @@
 @if target-libada
 maybe-install-info-target-libada: install-info-target-libada
 
-install-info-target-libada: \
-    configure-target-libada \
-    info-target-libada 
-	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing install-info in $(TARGET_SUBDIR)/libada" ; \
-	for flag in $(EXTRA_TARGET_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	           install-info) \
-	  || exit 1
+# libada doesn't support install-info.
+install-info-target-libada:
 
 @endif target-libada
 
@@ -48539,24 +48678,8 @@
 @if target-libada
 maybe-installcheck-target-libada: installcheck-target-libada
 
-installcheck-target-libada: \
-    configure-target-libada 
-	@: $(MAKE); $(unstage)
-	@[ -f $(TARGET_SUBDIR)/libada/Makefile ] || exit 0 ; \
-	r=`${PWD_COMMAND}`; export r; \
-	s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
-	$(NORMAL_TARGET_EXPORTS) \
-	echo "Doing installcheck in $(TARGET_SUBDIR)/libada" ; \
-	for flag in $(EXTRA_TARGET_FLAGS); do \
-	  eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
-	done; \
-	(cd $(TARGET_SUBDIR)/libada && \
-	  $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
-	          "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
-	          "RANLIB=$${RANLIB}" \
-	          "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
-	           installcheck) \
-	  || exit 1
+# libada doesn't support installcheck.
+installcheck-target-libada:
 
 @endif target-libada
 
@@ -51490,7 +51613,7 @@
 all-stageprofile-libcpp: maybe-all-stageprofile-intl
 all-stagefeedback-libcpp: maybe-all-stagefeedback-intl
 all-fixincludes: maybe-all-libiberty
-all-gnattools: maybe-all-target-libada
+all-gnattools: maybe-all-libada
 configure-mpfr: maybe-all-gmp
 
 configure-stage1-mpfr: maybe-all-stage1-gmp
Index: configure.ac
===================================================================
--- configure.ac.orig	2008-01-29 12:10:06.002765243 +0100
+++ configure.ac	2008-01-29 12:16:44.744812017 +0100
@@ -155,7 +155,7 @@
 
 # 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 gmp mpfr"
+host_libs="intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber gmp mpfr libada"
 
 # these tools are built for the host environment
 # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
@@ -263,7 +263,7 @@
 
 # Similarly, some are only suitable for cross toolchains.
 # Remove these if host=target.
-cross_only="target-libgloss target-newlib target-opcodes"
+cross_only="target-libgloss target-newlib target-opcodes target-libada"
 
 case $is_cross_compiler in
   no) skipdirs="${skipdirs} ${cross_only}" ;;