Index: scripts/ChangeLog
===================================================================
--- scripts/ChangeLog	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/ChangeLog	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -1,2 +1,25 @@
+2003-09-02	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* Makefile.am, configure.ac,
+	autotools/autoconf-rtems.spec.in, autotools/automake-rtems.spec.in,
+	binutils/Makefile.am, binutils/base-binutils.add, 
+	binutils/binutils.add, binutils/mkspec.in, 
+	binutils/target-binutils.add,
+	common/common.add.in,
+	cpukit/Makefile.am,
+	gcc3newlib/Makefile.am, gcc3newlib/base-g77.add,
+	gcc3newlib/base-gcc.add, gcc3newlib/base-gcj.add,
+	gcc3newlib/base-gnat.add, gcc3newlib/gccnewlib.add,
+	gcc3newlib/mkspec.in, gcc3newlib/target-c++.add,
+	gcc3newlib/target-g77.add, gcc3newlib/target-gcc.add,
+	gcc3newlib/target-gcj.add, gcc3newlib/target-gnat.add,
+	gcc3newlib/target-objc.add, 
+	gccnewlib/Makefile.am,
+	gdb/Makefile.am,
+	rtems/Makefile.am,
+	rtemsdoc/Makefile.am:
+	Merger from rtems-4-6-branch.
+	* common/common.am: New.
+
 2003-08-23	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: scripts/Makefile.am
===================================================================
--- scripts/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -11,11 +11,9 @@
     mkgccnewlibspec mkrpms mkspec
 
-TEMPLATES =
-
-noinst_DATA = setup.def $(TEMPLATES)
+noinst_DATA = setup.def
 
 EXTRA_DIST = $(noinst_DATA) $(noinst_SCRIPTS)
 
-CONFIGURE_DEPENDENCIES = setup.cache
+CONFIG_STATUS_DEPENDENCIES = setup.cache
 setup.cache: setup.def
 	cp setup.def $@
Index: scripts/autotools/autoconf-rtems.spec.in
===================================================================
--- scripts/autotools/autoconf-rtems.spec.in	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/autotools/autoconf-rtems.spec.in	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -11,5 +11,5 @@
 
 %if "%{_prefix}" != "/usr"
-%define name			%{_name}-rtems
+%define name			@rpmprefix@%{_name}-rtems
 %define _infodir		%{_prefix}/info
 %define _mandir			%{_prefix}/man
@@ -25,5 +25,5 @@
 Copyright:    GPL
 URL:          http://www.gnu.org/software/autoconf
-Group:        rtems
+Group:        @rpmgroup@
 Autoreqprov:  on
 Version:      %{rpmvers}
Index: scripts/autotools/automake-rtems.spec.in
===================================================================
--- scripts/autotools/automake-rtems.spec.in	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/autotools/automake-rtems.spec.in	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -12,6 +12,6 @@
 
 %if "%{_prefix}" != "/usr"
-%define name			%{_name}-rtems
-%define requirements		autoconf-rtems >= 2.54
+%define name			@rpmprefix@%{_name}-rtems
+%define requirements		@rpmprefix@autoconf-rtems >= 2.54
 %define _infodir		%{_prefix}/info
 %define _mandir			%{_prefix}/man
@@ -26,5 +26,5 @@
 
 Copyright:    GPL
-Group:        rtems
+Group:        @rpmgroup@
 Autoreqprov:  on
 Version:      %{rpmvers}
Index: scripts/binutils/Makefile.am
===================================================================
--- scripts/binutils/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/binutils/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,4 +3,5 @@
 ##
 
+include $(top_srcdir)/common/common.am
 
 MKBINUTILSSPEC = $(SHELL) ./mkspec
@@ -14,4 +15,5 @@
 	cat $^ > $@
 CLEANFILES = binutils.spec.in
+RPM_SPECS_DATA =
 
 MKBINUTILSSPEC_DEPS = mkspec binutils.spec.in \
@@ -20,53 +22,58 @@
 arm-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache arm-rtems > $@
+RPM_SPECS_DATA += arm-rtems-$(BINUTILSVERS).spec
 
 c4x-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache c4x-rtems > $@
+RPM_SPECS_DATA += c4x-rtems-$(BINUTILSVERS).spec
 
 h8300-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache h8300-rtems > $@
+RPM_SPECS_DATA += h8300-rtems-$(BINUTILSVERS).spec
 
 hppa1.1-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache hppa1.1-rtems > $@
+RPM_SPECS_DATA += hppa1.1-rtems-$(BINUTILSVERS).spec
 
 i386-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache i386-rtems > $@
+RPM_SPECS_DATA += i386-rtems-$(BINUTILSVERS).spec
 
 i960-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache i960-rtems > $@
+RPM_SPECS_DATA += i960-rtems-$(BINUTILSVERS).spec
 
 m68k-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache m68k-rtems > $@
+RPM_SPECS_DATA += m68k-rtems-$(BINUTILSVERS).spec
 
 mips64orion-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache mips64orion-rtems > $@
+RPM_SPECS_DATA += mips64orion-rtems-$(BINUTILSVERS).spec
+
 mips-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache mips-rtems > $@
+RPM_SPECS_DATA += mips-rtems-$(BINUTILSVERS).spec
 
 or32-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache or32-rtems > $@
+RPM_SPECS_DATA += or32-rtems-$(BINUTILSVERS).spec
 
 powerpc-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache powerpc-rtems > $@
+RPM_SPECS_DATA += powerpc-rtems-$(BINUTILSVERS).spec
 
 sh-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache sh-rtems > $@
+RPM_SPECS_DATA += sh-rtems-$(BINUTILSVERS).spec
 
 sh-rtemself-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache sh-rtemself > $@
+RPM_SPECS_DATA += sh-rtemself-$(BINUTILSVERS).spec
 
 sparc-rtems-$(BINUTILSVERS).spec: $(MKBINUTILSSPEC_DEPS)
 	$(MKBINUTILSSPEC) -cfg $(top_builddir)/setup.cache sparc-rtems > $@
+RPM_SPECS_DATA += sparc-rtems-$(BINUTILSVERS).spec
 
-RPM_SPECS_DATA = \
-    arm-rtems-$(BINUTILSVERS).spec \
-    c4x-rtems-$(BINUTILSVERS).spec h8300-rtems-$(BINUTILSVERS).spec \
-    hppa1.1-rtems-$(BINUTILSVERS).spec \
-    i386-rtems-$(BINUTILSVERS).spec i960-rtems-$(BINUTILSVERS).spec \
-    m68k-rtems-$(BINUTILSVERS).spec \
-    mips-rtems-$(BINUTILSVERS).spec mips64orion-rtems-$(BINUTILSVERS).spec \
-    or32-rtems-$(BINUTILSVERS).spec \
-    powerpc-rtems-$(BINUTILSVERS).spec sh-rtems-$(BINUTILSVERS).spec \
-    sh-rtemself-$(BINUTILSVERS).spec sparc-rtems-$(BINUTILSVERS).spec
 CLEANFILES += $(RPM_SPECS_DATA)
 
Index: scripts/binutils/base-binutils.add
===================================================================
--- scripts/binutils/base-binutils.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/binutils/base-binutils.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -2,11 +2,10 @@
 # rtems-base-binutils
 # ==============================================================
-%package -n rtems-base-binutils
-Provides:	rtems-base-binutils
+%package -n %{rpmprefix}rtems-base-binutils
 Summary:      base package for rtems binutils
-Group: rtems
+Group: %{rpmgroup}
 PreReq:		/sbin/install-info
 
-%description -n rtems-base-binutils
+%description -n %{rpmprefix}rtems-base-binutils
 
 RTEMS is an open source operating system for embedded systems.
@@ -14,5 +13,5 @@
 This is the base for binutils regardless of target CPU.
 
-%post -n rtems-base-binutils
+%post -n %{rpmprefix}rtems-base-binutils
   if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
@@ -24,5 +23,5 @@
   fi
 
-%postun -n rtems-base-binutils
+%postun -n %{rpmprefix}rtems-base-binutils
   if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
@@ -34,5 +33,5 @@
   fi
 
-%files -n rtems-base-binutils -f files
+%files -n %{rpmprefix}rtems-base-binutils -f files
 %defattr(-,root,root)
 %dir %{_prefix}/info
@@ -43,5 +42,4 @@
 %doc %{_prefix}/info/ld.info.gz
 %if "%{binutils_version}" < "2.14"
-# binutils >= 2.14 ships monolytic infos.
 %doc %{_prefix}/info/as.info-*.gz
 %doc %{_prefix}/info/bfd.info-?.gz
Index: scripts/binutils/binutils.add
===================================================================
--- scripts/binutils/binutils.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/binutils/binutils.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -1,8 +1,9 @@
 
-%define binutils_version	@binutils_version@
+%define binutils_version     @binutils_version@
+%define binutils_target      @target_alias@
 
-Name:         @target_alias@-binutils-collection
-Summary:      binutils for target @target_alias@
-Group:        rtems
+Name:         %{rpmprefix}%{binutils_target}-binutils-collection
+Summary:      binutils for target %{binutils_target}
+Group:        %{rpmgroup}
 Release:      @Release@
 License:      GPL/LGPL
@@ -38,6 +39,6 @@
 
 %prep
-# untar the sources inside @target_alias@-binutils
-%setup -c -n @target_alias@-binutils
+# untar the sources inside %{binutils_target}-binutils
+%setup -c -n %{binutils_target}-binutils
 @PATCH2@
   test -d build || mkdir build
@@ -47,5 +48,5 @@
   ../binutils-%{binutils_version}/configure \
     --build=%_build --host=%_host \
-    --target=@target_alias@ \
+    --target=%{binutils_target} \
     --verbose --prefix=%{_prefix} --disable-nls
 
@@ -63,5 +64,5 @@
     $RPM_BUILD_ROOT%{_prefix}/share/locale
 
-  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-c++filt%{_exeext}
+  rm -f $RPM_BUILD_ROOT%{_prefix}/bin/%{binutils_target}-c++filt%{_exeext}
 # gzip info files
   gzip -9qf $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
Index: scripts/binutils/mkspec.in
===================================================================
--- scripts/binutils/mkspec.in	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/binutils/mkspec.in	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -58,4 +58,6 @@
     -e "s%@target_alias\@%${target_alias}%g" \
     -e "s%@prefix\@%@prefix@%g" \
+    -e "s,@rpmprefix\@,@rpmprefix@,g" \
+    -e "s%@rpmgroup\@%@rpmgroup@%g" \
     -e "s%@binutils_version\@%${binutils_version}%g" \
     -e "s%@binutils_patch_version\@%${binutils_patch_version}%g" \
Index: scripts/binutils/target-binutils.add
===================================================================
--- scripts/binutils/target-binutils.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/binutils/target-binutils.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -1,49 +1,48 @@
 # ==============================================================
-# @target_alias@-binutils
+# %{binutils_target}-binutils
 # ==============================================================
-%package -n @target_alias@-binutils
-Provides:	@target_alias@-binutils
-Summary:      rtems binutils for @target_alias@
-Group: rtems
-Requires: rtems-base-binutils
+%package -n %{rpmprefix}%{binutils_target}-binutils
+Summary:      rtems binutils for %{binutils_target}
+Group: %{rpmgroup}
+Requires: %{rpmprefix}rtems-base-binutils
 Autoreqprov:  	off
 
-%description -n @target_alias@-binutils
+%description -n %{rpmprefix}%{binutils_target}-binutils
 
 RTEMS is an open source operating system for embedded systems.
 
-This is the GNU binutils for RTEMS targetting @target_alias@.
+This is the GNU binutils for RTEMS targetting %{binutils_target}.
 
-%files -n @target_alias@-binutils
+%files -n %{rpmprefix}%{binutils_target}-binutils
 %defattr(-,root,root)
-%doc %{_prefix}/man/man1/@target_alias@-*.1*
+%doc %{_prefix}/man/man1/%{binutils_target}-*.1*
 
 %dir %{_prefix}/bin
-%{_prefix}/bin/@target_alias@-addr2line%{_exeext}
-%{_prefix}/bin/@target_alias@-ar%{_exeext}
-%{_prefix}/bin/@target_alias@-as%{_exeext}
+%{_prefix}/bin/%{binutils_target}-addr2line%{_exeext}
+%{_prefix}/bin/%{binutils_target}-ar%{_exeext}
+%{_prefix}/bin/%{binutils_target}-as%{_exeext}
 # c++filt now comes from gcc
-# %{_prefix}/bin/@target_alias@-c++filt%{_exeext}
+# %{_prefix}/bin/%{binutils_target}-c++filt%{_exeext}
 # deleted as of 2.13
-# %{_prefix}/bin/@target_alias@-gasp%{_exeext}
-%{_prefix}/bin/@target_alias@-ld%{_exeext}
-%{_prefix}/bin/@target_alias@-nm%{_exeext}
-%{_prefix}/bin/@target_alias@-objcopy%{_exeext}
-%{_prefix}/bin/@target_alias@-objdump%{_exeext}
-%{_prefix}/bin/@target_alias@-ranlib%{_exeext}
-%{_prefix}/bin/@target_alias@-readelf%{_exeext}
-%{_prefix}/bin/@target_alias@-size%{_exeext}
-%{_prefix}/bin/@target_alias@-strings%{_exeext}
-%{_prefix}/bin/@target_alias@-strip%{_exeext}
+# %{_prefix}/bin/%{binutils_target}-gasp%{_exeext}
+%{_prefix}/bin/%{binutils_target}-ld%{_exeext}
+%{_prefix}/bin/%{binutils_target}-nm%{_exeext}
+%{_prefix}/bin/%{binutils_target}-objcopy%{_exeext}
+%{_prefix}/bin/%{binutils_target}-objdump%{_exeext}
+%{_prefix}/bin/%{binutils_target}-ranlib%{_exeext}
+%{_prefix}/bin/%{binutils_target}-readelf%{_exeext}
+%{_prefix}/bin/%{binutils_target}-size%{_exeext}
+%{_prefix}/bin/%{binutils_target}-strings%{_exeext}
+%{_prefix}/bin/%{binutils_target}-strip%{_exeext}
 
-%dir %{_prefix}/@target_alias@
-%dir %{_prefix}/@target_alias@/bin
-%{_prefix}/@target_alias@/bin/ar%{_exeext}
-%{_prefix}/@target_alias@/bin/as%{_exeext}
-%{_prefix}/@target_alias@/bin/ld%{_exeext}
-%{_prefix}/@target_alias@/bin/nm%{_exeext}
-%{_prefix}/@target_alias@/bin/ranlib%{_exeext}
-%{_prefix}/@target_alias@/bin/strip%{_exeext}
+%dir %{_prefix}/%{binutils_target}
+%dir %{_prefix}/%{binutils_target}/bin
+%{_prefix}/%{binutils_target}/bin/ar%{_exeext}
+%{_prefix}/%{binutils_target}/bin/as%{_exeext}
+%{_prefix}/%{binutils_target}/bin/ld%{_exeext}
+%{_prefix}/%{binutils_target}/bin/nm%{_exeext}
+%{_prefix}/%{binutils_target}/bin/ranlib%{_exeext}
+%{_prefix}/%{binutils_target}/bin/strip%{_exeext}
 
-%dir %{_prefix}/@target_alias@/lib
-%{_prefix}/@target_alias@/lib/ldscripts
+%dir %{_prefix}/%{binutils_target}/lib
+%{_prefix}/%{binutils_target}/lib/ldscripts
Index: scripts/common/common.add.in
===================================================================
--- scripts/common/common.add.in	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/common/common.add.in	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -6,4 +6,12 @@
 
 %define	_prefix			@prefix@
+%if "%{_prefix}" != "/usr"
+%define _infodir		%{_prefix}/info
+%define _mandir			%{_prefix}/man
+%endif
+
+%define rpmprefix		@rpmprefix@
+%define rpmgroup		@rpmgroup@
+
 %define _defaultbuildroot 	%{_tmppath}/%{name}-%{version}-root
 %ifos cygwin cygwin32
@@ -13,6 +21,6 @@
 %endif
 
-# Without this, RPM-4.x' rpm-brp-strip screws up on cross-binaries
-%define __os_install_post %{nil}
+# Work around to a bug in rpm-4.2
+%define __os_install_post	%{nil}
 
 Vendor: 	OARCorp
Index: scripts/common/common.am
===================================================================
--- scripts/common/common.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
+++ scripts/common/common.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -0,0 +1,4 @@
+$(top_builddir)/common/common.add: $(top_builddir)/config.status $(top_srcdir)/common/common.add.in
+	cd $(top_builddir) && $(SHELL) ./config.status common/common.add
+$(top_builddir)/common/clean.add: $(top_builddir)/config.status $(top_srcdir)/common/clean.add.in
+	cd $(top_builddir) && $(SHELL) ./config.status common/clean.add
Index: scripts/configure.ac
===================================================================
--- scripts/configure.ac	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/configure.ac	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -5,5 +5,5 @@
 AC_CONFIG_SRCDIR([binutils])
 RTEMS_TOP([..])
-AC_PREFIX_DEFAULT([/opt/rtems])
+
 AM_INIT_AUTOMAKE([no-define foreign 1.7.2])
 
@@ -12,4 +12,15 @@
 test -f ./setup.cache || cp ${srcdir}/setup.def ./setup.cache
 . ./setup.cache
+
+AC_ARG_ENABLE([rpmprefix],
+[  --enable-rpmprefix=<rpmprefix>      prefix rpms],
+[case $enable_rpmprefix in
+yes ) rpmprefix="rtems-"]RTEMS_API["-";;
+no ) rpmprefix="%{nil}";;
+* ) AS_IF([test -z "$enable_rpmprefix"],
+      [rpmprefix="%{nil}"],
+      [rpmprefix="$enable_rpmprefix"]);;
+esac],
+[rpmprefix="rtems-"]RTEMS_API["-"])
 
 AC_MSG_CHECKING(for rpm SPECS directory)
@@ -67,4 +78,6 @@
 AC_SUBST(BSPVERS)
 AC_SUBST(RPM_CPU)
+AC_SUBST(rpmprefix,$rpmprefix)
+AC_SUBST(rpmgroup,[Rtems/][RTEMS_API])
 
 AC_CONFIG_FILES([Makefile
Index: scripts/cpukit/Makefile.am
===================================================================
--- scripts/cpukit/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/cpukit/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,4 +3,5 @@
 ##
 
+include $(top_srcdir)/common/common.am
 
 MKSPEC = $(SHELL) ./mkspec
Index: scripts/gcc3newlib/Makefile.am
===================================================================
--- scripts/gcc3newlib/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -2,4 +2,6 @@
 ## $Id$
 ##
+
+include $(top_srcdir)/common/common.am
 
 MKSPEC = $(SHELL) ./mkspec
Index: scripts/gcc3newlib/base-g77.add
===================================================================
--- scripts/gcc3newlib/base-g77.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/base-g77.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,16 +3,15 @@
 # rtems-base-g77
 # ==============================================================
-%package -n rtems-base-g77
-Provides:	rtems-base-g77
+%package -n %{rpmprefix}rtems-base-g77
 Summary:      rtems base package for gcc/g77 compiler
-Group: rtems
+Group: %{rpmgroup}
 Requires: rtems-base-gcc
 
-%description -n rtems-base-g77
+%description -n %{rpmprefix}rtems-base-g77
 RTEMS is an open source operating system for embedded systems.
 
 This is the files for gcc/g77 that are shared by all targets.
 
-%files -n rtems-base-g77
+%files -n %{rpmprefix}rtems-base-g77
 %defattr(-,root,root)
 %dir %{_prefix}/info
@@ -23,5 +22,5 @@
 %doc %{_prefix}/man/man1/%{gcc_target}-g77.1*
 
-%post -n rtems-base-g77
+%post -n %{rpmprefix}rtems-base-g77
   if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
@@ -33,5 +32,5 @@
   fi
 
-%postun -n rtems-base-g77
+%postun -n %{rpmprefix}rtems-base-g77
   if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
Index: scripts/gcc3newlib/base-gcc.add
===================================================================
--- scripts/gcc3newlib/base-gcc.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/base-gcc.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -1,11 +1,10 @@
 # ==============================================================
-# rtems-base-gcc
+# %{rpmprefix}rtems-base-gcc
 # ==============================================================
-%package -n rtems-base-gcc
-Provides:	rtems-base-gcc
+%package -n %{rpmprefix}rtems-base-gcc
 Summary:      	base package for rtems gcc and newlib C Library 
-Group: rtems
+Group: %{rpmgroup}
 
-%description -n rtems-base-gcc
+%description -n %{rpmprefix}rtems-base-gcc
 
 RTEMS is an open source operating system for embedded systems.
@@ -13,5 +12,5 @@
 This is the files for gcc and newlib that are shared by all targets.
 
-%files -n rtems-base-gcc
+%files -n %{rpmprefix}rtems-base-gcc
 %defattr(-,root,root)
 %dir %{_prefix}/info
@@ -34,5 +33,5 @@
 %dir %{_prefix}/include
 
-%post -n rtems-base-gcc
+%post -n %{rpmprefix}rtems-base-gcc
   if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
@@ -44,5 +43,5 @@
   fi
 
-%postun -n rtems-base-gcc
+%postun -n %{rpmprefix}rtems-base-gcc
   if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
Index: scripts/gcc3newlib/base-gcj.add
===================================================================
--- scripts/gcc3newlib/base-gcj.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/base-gcj.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,16 +3,15 @@
 # rtems-base-gcj
 # ==============================================================
-%package -n rtems-base-gcj
-Provides:	rtems-base-gcj
+%package -n %{rpmprefix}rtems-base-gcj
 Summary:      base package for rtems gcc/java compiler (gcj).
-Group: rtems
-Requires: rtems-base-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}rtems-base-gcc
 
-%description -n rtems-base-gcj
+%description -n %{rpmprefix}rtems-base-gcj
 RTEMS is an open source operating system for embedded systems.
 
 This is the files for gcc/java (gcj) that are shared by all targets.
 
-%files -n rtems-base-gcj
+%files -n %{rpmprefix}rtems-base-gcj
 %defattr(-,root,root)
 %dir %{_prefix}/bin
Index: scripts/gcc3newlib/base-gnat.add
===================================================================
--- scripts/gcc3newlib/base-gnat.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/base-gnat.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,15 +3,14 @@
 # rtems-base-gnat
 # ==============================================================
-%package -n rtems-base-gnat
-Provides:	rtems-base-gnat
+%package -n %{rpmprefix}rtems-base-gnat
 Summary:	gcc/gnat tools
-Group: rtems
+Group: %{rpmgroup}
 
-%description -n rtems-base-gnat
+%description -n %{rpmprefix}rtems-base-gnat
 RTEMS is an open source operating system for embedded systems.
 
 This is the gcc/gnat tools for the gcc/gnat compiler
 
-%files -n rtems-base-gnat
+%files -n %{rpmprefix}rtems-base-gnat
 %defattr(-,root,root)
 %dir %{_prefix}/bin
Index: scripts/gcc3newlib/gccnewlib.add
===================================================================
--- scripts/gcc3newlib/gccnewlib.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/gccnewlib.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -5,7 +5,7 @@
 %define gcc_target	@target_alias@
 
-Name:         %{gcc_target}-gcc-newlib
+Name:         %{rpmprefix}%{gcc_target}-gcc-newlib
 Summary:      gcc and newlib C Library for %{gcc_target}.
-Group:	      rtems
+Group: %{rpmgroup}
 Release:      @Release@
 License:      gcc is GPL/LGPL ; newlib no has restrictions on run-time usage
@@ -15,14 +15,18 @@
 
 Version:      	gcc%{gcc_version}newlib%{newlib_version}
-# gcc 3.x and gcc 2.9
-# Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}.tar.gz
-Source0:      ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}.tar.bz2
-# gcc 2.95.x
-# Source0:	ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}.tar.bz2
+%if "%{gcc_version}" >= "3.2.2"
+Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
+%else
+%if "%{gcc_version}" >= "3.0"
+Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.gz
+%else
+Source0: ftp://ftp.gnu.org/pub/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}-everything.tar.gz
+%endif
+%endif
 Source1:	ftp://sources.redhat.com/pub/newlib/newlib-%{newlib_version}.tar.gz
 @PATCH1@
 @PATCH3@
 BuildPreReq:	texinfo >= 4.2
-BuildPreReq:	%{gcc_target}-binutils
+BuildPreReq:	%{rpmprefix}%{gcc_target}-binutils
 #
 # The original sources are not included in the source RPM.
@@ -58,5 +62,5 @@
 %else
 # default to not building gcj
-%define _gcj	%{?gnat:%gcj}%{!?gcj:0}
+%define _gcj	%{?gcj:%gcj}%{!?gcj:0}
 %endif
 
@@ -178,4 +182,6 @@
   languages="$languages,ada"
 %endif
+
+  export PATH="%{_bindir}:${PATH}"
   ../gcc-%{gcc_version}/configure \
     --build=%_build --host=%_host \
@@ -192,4 +198,10 @@
   test -d gcc/include || mkdir -p gcc/include
   cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
+%endif
+
+%if %build_cxx
+%if "%{gcc_version}" >= "3.3"
+  make -C %{gcc_target}/libiberty CFLAGS="$RPM_OPT_FLAGS" c++filt
+%endif
 %endif
 
@@ -227,4 +239,5 @@
 
 %install
+  export PATH="%{_bindir}:${PATH}"
   cd build
 # Bug in gcc-2.95.1: It doesn't build this installation directory
@@ -264,4 +277,12 @@
       $RPM_BUILD_ROOT%{_prefix}/bin/%{gcc_target}-cpp%{_exeext}
   fi
+%endif
+
+%if %build_cxx
+%if "%{gcc_version}" >= "3.3"
+  install -d $RPM_BUILD_ROOT%{_prefix}/bin
+  install -c -m 755 %{gcc_target}/libiberty/c++filt%{_exeext} \
+     $RPM_BUILD_ROOT%{_prefix}/bin/%{target_alias}-c++filt%{_exeext}
+%endif
 %endif
 
Index: scripts/gcc3newlib/mkspec.in
===================================================================
--- scripts/gcc3newlib/mkspec.in	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/mkspec.in	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -70,4 +70,6 @@
     -e "s%@target_alias\@%${target_alias}%g" \
     -e "s%@prefix\@%@prefix@%g" \
+    -e "s,@rpmprefix\@,@rpmprefix@,g" \
+    -e "s%@rpmgroup\@%@rpmgroup@%g" \
     -e "s,@rpm_build_root\@,${rpm_build_root},g" \
     -e "s%@gcc_version\@%${gcc3_version}%g" \
Index: scripts/gcc3newlib/target-c++.add
===================================================================
--- scripts/gcc3newlib/target-c++.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/target-c++.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,16 +3,15 @@
 # %{gcc_target}-c++
 # ==============================================================
-%package -n %{gcc_target}-c++
-Provides:	%{gcc_target}-c++
+%package -n %{rpmprefix}%{gcc_target}-c++
 Summary:      gcc/g++ compiler (c++) for %{gcc_target}
-Group: rtems
-Requires: rtems-base-gcc %{gcc_target}-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}rtems-base-gcc %{rpmprefix}%{gcc_target}-gcc
 
-%description -n %{gcc_target}-c++
+%description -n %{rpmprefix}%{gcc_target}-c++
 RTEMS is an open source operating system for embedded systems.
 
 This is the gcc/g++ compiler for %{gcc_target}
 
-%files -n %{gcc_target}-c++ -f build/files.g++
+%files -n %{rpmprefix}%{gcc_target}-c++ -f build/files.g++
 %defattr(-,root,root)
 %doc %{_prefix}/man/man1/%{gcc_target}-g++.1*
@@ -21,7 +20,5 @@
 %{_prefix}/bin/%{gcc_target}-c++%{_exeext}
 %{_prefix}/bin/%{gcc_target}-g++%{_exeext}
-%if "{gcc_version}" < "3.3"
 %{_prefix}/bin/%{gcc_target}-c++filt%{_exeext}
-%endif
 
 %{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}/cc1plus%{_exeext}
Index: scripts/gcc3newlib/target-g77.add
===================================================================
--- scripts/gcc3newlib/target-g77.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/target-g77.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,16 +3,15 @@
 # %{gcc_target}-g77
 # ==============================================================
-%package -n %{gcc_target}-g77
-Provides:	%{gcc_target}-g77
+%package -n %{rpmprefix}%{gcc_target}-g77
 Summary:	gcc/g77 compiler for %{gcc_target}
-Group: rtems
-Requires: rtems-base-g77 %{gcc_target}-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}rtems-base-g77 %{rpmprefix}%{gcc_target}-gcc
 
-%description -n %{gcc_target}-g77
+%description -n %{rpmprefix}%{gcc_target}-g77
 RTEMS is an open source operating system for embedded systems.
 
 This is the gcc/g77 compiler for %{gcc_target}
 
-%files -n %{gcc_target}-g77 -f build/files.g77
+%files -n %{rpmprefix}%{gcc_target}-g77 -f build/files.g77
 %defattr(-,root,root)
 %dir %{_prefix}/bin
Index: scripts/gcc3newlib/target-gcc.add
===================================================================
--- scripts/gcc3newlib/target-gcc.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/target-gcc.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -2,16 +2,15 @@
 # %{gcc_target}-gcc
 # ==============================================================
-%package -n %{gcc_target}-gcc
-Provides:	%{gcc_target}-gcc
+%package -n %{rpmprefix}%{gcc_target}-gcc
 Summary:      	rtems gcc and newlib C Library for %{gcc_target}
-Group: rtems
-Requires: %{gcc_target}-binutils rtems-base-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}%{gcc_target}-binutils %{rpmprefix}rtems-base-gcc
 
-%description -n %{gcc_target}-gcc
+%description -n %{rpmprefix}%{gcc_target}-gcc
 RTEMS is an open source operating system for embedded systems.
 
 This is gcc and newlib C Library for %{gcc_target}.
 
-%files -n %{gcc_target}-gcc -f build/files.gcc
+%files -n %{rpmprefix}%{gcc_target}-gcc -f build/files.gcc
 %defattr(-,root,root)
 %doc %{_prefix}/man/man1/%{gcc_target}-gcc.1*
Index: scripts/gcc3newlib/target-gcj.add
===================================================================
--- scripts/gcc3newlib/target-gcj.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/target-gcj.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,16 +3,15 @@
 # %{gcc_target}-gcj
 # ==============================================================
-%package -n %{gcc_target}-gcj
-Provides:	%{gcc_target}-gcj
+%package -n %{rpmprefix}%{gcc_target}-gcj
 Summary:      gcc/java compiler (gcj) for %{gcc_target}
-Group: rtems
-Requires: rtems-base-gcj %{gcc_target}-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}rtems-base-gcj %{rpmprefix}%{gcc_target}-gcc
 
-%description -n %{gcc_target}-gcj
+%description -n %{rpmprefix}%{gcc_target}-gcj
 RTEMS is an open source operating system for embedded systems.
 
 This is the gcc/java compiler for %{gcc_target}
 
-%files -n %{gcc_target}-gcj -f build/files.gcj
+%files -n %{rpmprefix}%{gcc_target}-gcj -f build/files.gcj
 %defattr(-,root,root)
 %dir %{_prefix}/bin
Index: scripts/gcc3newlib/target-gnat.add
===================================================================
--- scripts/gcc3newlib/target-gnat.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/target-gnat.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,18 +3,16 @@
 # %{gcc_target}-gnat
 # ==============================================================
-%package -n %{gcc_target}-gnat
-Provides:	%{gcc_target}-gnat
+%package -n %{rpmprefix}%{gcc_target}-gnat
 Summary:	gcc/gnat compiler for %{gcc_target}
-Group: rtems
-Requires: rtems-base-gnat %{gcc_target}-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}rtems-base-gnat %{rpmprefix}%{gcc_target}-gcc
 
-%description -n %{gcc_target}-gnat
+%description -n %{rpmprefix}%{gcc_target}-gnat
 RTEMS is an open source operating system for embedded systems.
 
 This is the gcc/gnat compiler for %{gcc_target}
 
-%files -n %{gcc_target}-gnat
+%files -n %{rpmprefix}%{gcc_target}-gnat
 %defattr(-,root,root)
-# %files -n %{gcc_target}-gnat -f build/files.gnat
 %dir %{_prefix}/bin
 %{_prefix}/bin/%{gcc_target}-gnat*
Index: scripts/gcc3newlib/target-objc.add
===================================================================
--- scripts/gcc3newlib/target-objc.add	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gcc3newlib/target-objc.add	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,16 +3,15 @@
 # %{gcc_target}-objc
 # ==============================================================
-%package -n %{gcc_target}-objc
-Provides:	%{gcc_target}-objc
+%package -n %{rpmprefix}%{gcc_target}-objc
 Summary:      gcc/objc compiler for %{gcc_target}
-Group: rtems
-Requires: %{gcc_target}-gcc
+Group: %{rpmgroup}
+Requires: %{rpmprefix}%{gcc_target}-gcc
 
-%description -n %{gcc_target}-objc
+%description -n %{rpmprefix}%{gcc_target}-objc
 RTEMS is an open source operating system for embedded systems.
 
 This is the gcc/objc compiler for %{gcc_target}
 
-%files -n %{gcc_target}-objc -f build/files.objc
+%files -n %{rpmprefix}%{gcc_target}-objc -f build/files.objc
 %defattr(-,root,root)
 %{_prefix}/lib/gcc-lib/%{gcc_target}/%{gcc_version}/cc1obj%{_exeext}
Index: scripts/gccnewlib/Makefile.am
===================================================================
--- scripts/gccnewlib/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gccnewlib/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,4 +3,5 @@
 ##
 
+include $(top_srcdir)/common/common.am
 
 MKGCCNEWLIBSPEC = $(SHELL) $(top_builddir)/mkgccnewlibspec
Index: scripts/gdb/Makefile.am
===================================================================
--- scripts/gdb/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/gdb/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -2,4 +2,6 @@
 ## $Id$
 ##
+
+include $(top_srcdir)/common/common.am
 
 MKSPEC = $(SHELL) ./mkspec
Index: scripts/rtems/Makefile.am
===================================================================
--- scripts/rtems/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/rtems/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -3,4 +3,5 @@
 ##
 
+include $(top_srcdir)/common/common.am
 
 MKBSPSPEC = $(SHELL) $(top_builddir)/mkbspspec
Index: scripts/rtemsdoc/Makefile.am
===================================================================
--- scripts/rtemsdoc/Makefile.am	(revision ac3786b4dc6a575c50e354e4168f3146aba9667f)
+++ scripts/rtemsdoc/Makefile.am	(revision 087a6c86f55b8ddbd6a5bc1961e28a044225475f)
@@ -2,4 +2,6 @@
 ## $Id$
 ##
+
+include ${top_srcdir}/common/common.am
 
 CLEANFILES =
