Index: scripts/gccnewlib/base-chill.add
===================================================================
--- scripts/gccnewlib/base-chill.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/base-chill.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,24 +14,24 @@
 
 %files -n rtems-base-chill
-%dir /opt/rtems/info
-%doc /opt/rtems/info/chill.info*.gz
+%dir %{_prefix}/info
+%doc %{_prefix}/info/chill.info*.gz
 
 %post -n rtems-base-chill
-  if test -d $RPM_INSTALL_PREFIX/rtems/info; 
+  if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
-    rm -f $RPM_INSTALL_PREFIX/rtems/info/dir
-    f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'`
+    rm -f $RPM_INSTALL_PREFIX%{_prefix}/info/dir
+    f=`find $RPM_INSTALL_PREFIX%{_prefix}/info -name '*.info.gz'`
     test -n "$f" && for i in $f; do
-      install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir
+      install-info $i $RPM_INSTALL_PREFIX%{_prefix}/info/dir
     done
   fi
 
 %postun -n rtems-base-chill
-  if test -d $RPM_INSTALL_PREFIX/rtems/info; 
+  if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
-    rm -f $RPM_INSTALL_PREFIX/rtems/info/dir
-    f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'`
+    rm -f $RPM_INSTALL_PREFIX%{_prefix}/info/dir
+    f=`find $RPM_INSTALL_PREFIX%{_prefix}/info -name '*.info.gz'`
     test -n "$f" && for i in $f; do
-      install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir
+      install-info $i $RPM_INSTALL_PREFIX%{_prefix}/info/dir
     done
   fi
Index: scripts/gccnewlib/base-g77.add
===================================================================
--- scripts/gccnewlib/base-g77.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/base-g77.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,28 +14,28 @@
 
 %files -n rtems-base-g77
-%dir /opt/rtems/info
-%doc /opt/rtems/info/g77.info*.gz
+%dir %{_prefix}/info
+%doc %{_prefix}/info/g77.info*.gz
 
-%dir /opt/rtems/man
-%dir /opt/rtems/man/man1
-%doc /opt/rtems/man/man1/@target_alias@-g77.1
+%dir %{_prefix}/man
+%dir %{_prefix}/man/man1
+%doc %{_prefix}/man/man1/@target_alias@-g77.1
 
 %post -n rtems-base-g77
-  if test -d $RPM_INSTALL_PREFIX/rtems/info; 
+  if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
-    rm -f $RPM_INSTALL_PREFIX/rtems/info/dir
-    f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'`
+    rm -f $RPM_INSTALL_PREFIX%{_prefix}/info/dir
+    f=`find $RPM_INSTALL_PREFIX%{_prefix}/info -name '*.info.gz'`
     test -n "$f" && for i in $f; do
-      install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir
+      install-info $i $RPM_INSTALL_PREFIX%{_prefix}/info/dir
     done
   fi
 
 %postun -n rtems-base-g77
-  if test -d $RPM_INSTALL_PREFIX/rtems/info; 
+  if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
-    rm -f $RPM_INSTALL_PREFIX/rtems/info/dir
-    f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'`
+    rm -f $RPM_INSTALL_PREFIX%{_prefix}/info/dir
+    f=`find $RPM_INSTALL_PREFIX%{_prefix}/info -name '*.info.gz'`
     test -n "$f" && for i in $f; do
-      install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir
+      install-info $i $RPM_INSTALL_PREFIX%{_prefix}/info/dir
     done
   fi
Index: scripts/gccnewlib/base-gcc.add
===================================================================
--- scripts/gccnewlib/base-gcc.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/base-gcc.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,37 +14,37 @@
 
 %files -n rtems-base-gcc
-%dir /opt/rtems/info
-%doc /opt/rtems/info/cpp.info*.gz
-%doc /opt/rtems/info/gcc.info*.gz
-%doc /opt/rtems/info/libc.info*.gz
-%doc /opt/rtems/info/libm.info*.gz
+%dir %{_prefix}/info
+%doc %{_prefix}/info/cpp.info*.gz
+%doc %{_prefix}/info/gcc.info*.gz
+%doc %{_prefix}/info/libc.info*.gz
+%doc %{_prefix}/info/libm.info*.gz
 
-%dir /opt/rtems/bin
-/opt/rtems/bin/gcov@exe_ext@
+%dir %{_prefix}/bin
+%{_prefix}/bin/gcov@exe_ext@
 
-%dir /opt/rtems/man
-%dir /opt/rtems/man/man1
-%doc /opt/rtems/man/man1/cccp.1
+%dir %{_prefix}/man
+%dir %{_prefix}/man/man1
+%doc %{_prefix}/man/man1/cccp.1
 
-%dir /opt/rtems/include
-/opt/rtems/include/g++-3
+%dir %{_prefix}/include
+%{_prefix}/include/g++-3
 
 %post -n rtems-base-gcc
-  if test -d $RPM_INSTALL_PREFIX/rtems/info; 
+  if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
-    rm -f $RPM_INSTALL_PREFIX/rtems/info/dir
-    f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'`
+    rm -f $RPM_INSTALL_PREFIX%{_prefix}/info/dir
+    f=`find $RPM_INSTALL_PREFIX%{_prefix}/info -name '*.info.gz'`
     test -n "$f" && for i in $f; do
-      install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir
+      install-info $i $RPM_INSTALL_PREFIX%{_prefix}/info/dir
     done
   fi
 
 %postun -n rtems-base-gcc
-  if test -d $RPM_INSTALL_PREFIX/rtems/info; 
+  if test -d $RPM_INSTALL_PREFIX%{_prefix}/info; 
   then
-    rm -f $RPM_INSTALL_PREFIX/rtems/info/dir
-    f=`find $RPM_INSTALL_PREFIX/rtems/info -name '*.info.gz'`
+    rm -f $RPM_INSTALL_PREFIX%{_prefix}/info/dir
+    f=`find $RPM_INSTALL_PREFIX%{_prefix}/info -name '*.info.gz'`
     test -n "$f" && for i in $f; do
-      install-info $i $RPM_INSTALL_PREFIX/rtems/info/dir
+      install-info $i $RPM_INSTALL_PREFIX%{_prefix}/info/dir
     done
   fi
Index: scripts/gccnewlib/base-gcj.add
===================================================================
--- scripts/gccnewlib/base-gcj.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/base-gcj.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,7 +14,7 @@
 
 %files -n rtems-base-gcj
-%dir /opt/rtems/bin
-/opt/rtems/bin/jcf-dump@exe_ext@
-/opt/rtems/bin/jv-scan@exe_ext@
-/opt/rtems/bin/gcjh@exe_ext@
+%dir %{_prefix}/bin
+%{_prefix}/bin/jcf-dump@exe_ext@
+%{_prefix}/bin/jv-scan@exe_ext@
+%{_prefix}/bin/gcjh@exe_ext@
 
Index: scripts/gccnewlib/gccnewlib.add
===================================================================
--- scripts/gccnewlib/gccnewlib.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/gccnewlib.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -6,4 +6,6 @@
 # please send bugfixes or comments to joel@OARcorp.com
 #
+
+%define	_prefix	@prefix@
 
 Vendor:       OAR Corporation
@@ -23,8 +25,8 @@
 # gcc 2.95.x
 Source0:	ftp://ftp.gnu.org/pub/gnu/gcc/gcc-everything-@gcc_version@.tar.gz
-Source1:	ftp://sourceware.cygnus.com/pub/newlib/newlib-@newlib_version@.tar.gz
+Source1:	ftp://sources.redhat.com/pub/newlib/newlib-@newlib_version@.tar.gz
 Patch0:		gcc-@gcc_version@-rtems-@gcc_patch_version@.diff
 Patch1:		newlib-@newlib_version@-rtems-@newlib_patch_version@.diff
-Buildroot:	/tmp/@target_alias@-gcc-newlib
+Buildroot:	%{_tmppath}/%{name}
 
 #
@@ -59,5 +61,5 @@
 %prep
 # untar the sources inside @target_alias@-gcc-newlib
-%setup -c -n @target_alias@-gcc-newlib -a 0 -a 1
+%setup -c -n %{name} -a 0 -a 1
 
 %patch0 -p0
@@ -71,7 +73,12 @@
   cd build
 
-  ../gcc-@gcc_version@/configure --target=@target_alias@ \
+# HACK: This should be %{target} != %{build}, but SuSE's rpm screws it.
+%if "%{target_os}" != "%{build_os}"
+  CONFIGURE_ARGS="--build=%{_build} --host=%{_target}"
+%endif
+
+  ../gcc-@gcc_version@/configure $CONFIGURE_ARGS --target=@target_alias@ \
     --with-gnu-as --with-gnu-ld --with-newlib --verbose \
-    --enable-threads --prefix=/opt/rtems @GCCLANGS@
+    --enable-threads --prefix=%{_prefix} @GCCLANGS@
 
   make all
@@ -83,9 +90,9 @@
   # If it doesn't find it, gcc doesn't install @target_alias@/bin/gcc
   ../gcc-@gcc_version@/mkinstalldirs \
-    $RPM_BUILD_ROOT/opt/rtems/@target_alias@/bin
+    $RPM_BUILD_ROOT%{_prefix}/@target_alias@/bin
 
-  make prefix=$RPM_BUILD_ROOT/opt/rtems install
+  make prefix=$RPM_BUILD_ROOT%{_prefix} install
   cd @target_alias@/newlib
-  make prefix=$RPM_BUILD_ROOT/opt/rtems install-info
+  make prefix=$RPM_BUILD_ROOT%{_prefix} install-info
 
   # cd back to build/
@@ -94,22 +101,22 @@
   # Bug in gcc-2.95.x: It bogusly tries to share cpp for all targets.
   # Rename it to target_alias-cpp
-  if test -f $RPM_BUILD_ROOT/opt/rtems/bin/cpp@exe_ext@;
+  if test -f $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@;
   then
-    mv $RPM_BUILD_ROOT/opt/rtems/bin/cpp@exe_ext@ \
-      $RPM_BUILD_ROOT/opt/rtems/bin/@target_alias@-cpp@exe_ext@
+    mv $RPM_BUILD_ROOT%{_prefix}/bin/cpp@exe_ext@ \
+      $RPM_BUILD_ROOT%{_prefix}/bin/@target_alias@-cpp@exe_ext@
   fi
 
   # gzip info files
-  gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info 2>/dev/null
-  gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info-? 2>/dev/null
-  gzip -f $RPM_BUILD_ROOT/opt/rtems/info/*.info-?? 2>/dev/null
+  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info 2>/dev/null
+  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-? 2>/dev/null
+  gzip -f $RPM_BUILD_ROOT%{_prefix}/info/*.info-?? 2>/dev/null
 
   rm -f dirs ;
-  echo "%dir /opt/rtems/lib" >> dirs ;
-  echo "%dir /opt/rtems/lib/gcc-lib" >> dirs ;
-  echo "%dir /opt/rtems/lib/gcc-lib/@target_alias@" >> dirs ;
+  echo "%dir %{_prefix}/lib" >> dirs ;
+  echo "%dir %{_prefix}/lib/gcc-lib" >> dirs ;
+  echo "%dir %{_prefix}/lib/gcc-lib/@target_alias@" >> dirs ;
 
   # Collect multilib subdirectories
-  TGTDIR="/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@"
+  TGTDIR="%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@"
   f=`gcc/xgcc --print-multi-lib | sed -e 's,;.*$,,'`
   for i in $f; do
@@ -145,5 +152,5 @@
 %clean
 # let rpm --clean remove BuildRoot iif using the default BuildRoot
-  test "$RPM_BUILD_ROOT" = "/tmp/@target_alias@-gcc-newlib" && \
+  test "$RPM_BUILD_ROOT" = "%{_tmppath}/%{name}" && \
     rm -rf $RPM_BUILD_ROOT
 
Index: scripts/gccnewlib/target-chill.add
===================================================================
--- scripts/gccnewlib/target-chill.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/target-chill.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,5 +14,5 @@
 
 %files -n @target_alias@-chill -f build/files.chill
-%dir /opt/rtems/bin
-/opt/rtems/bin/@target_alias@-chill
+%dir %{_prefix}/bin
+%{_prefix}/bin/@target_alias@-chill
 
Index: scripts/gccnewlib/target-g77.add
===================================================================
--- scripts/gccnewlib/target-g77.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/target-g77.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,6 +14,6 @@
 
 %files -n @target_alias@-g77 -f build/files.g77
-%dir /opt/rtems/bin
-/opt/rtems/bin/@target_alias@-g77@exe_ext@
+%dir %{_prefix}/bin
+%{_prefix}/bin/@target_alias@-g77@exe_ext@
 
-/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@/f771@exe_ext@
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/f771@exe_ext@
Index: scripts/gccnewlib/target-gcc.add
===================================================================
--- scripts/gccnewlib/target-gcc.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/target-gcc.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,16 +14,16 @@
 
 %files -n @target_alias@-gcc -f build/files.gcc
-%doc /opt/rtems/man/man1/@target_alias@-gcc.1
-%doc /opt/rtems/man/man1/@target_alias@-g++.1
+%doc %{_prefix}/man/man1/@target_alias@-gcc.1
+%doc %{_prefix}/man/man1/@target_alias@-g++.1
 
-/opt/rtems/bin/@target_alias@-cpp@exe_ext@
-/opt/rtems/bin/@target_alias@-c++@exe_ext@
-/opt/rtems/bin/@target_alias@-g++@exe_ext@
-/opt/rtems/bin/@target_alias@-gcc@exe_ext@
-/opt/rtems/bin/@target_alias@-protoize@exe_ext@
-/opt/rtems/bin/@target_alias@-unprotoize@exe_ext@
+%{_prefix}/bin/@target_alias@-cpp@exe_ext@
+%{_prefix}/bin/@target_alias@-c++@exe_ext@
+%{_prefix}/bin/@target_alias@-g++@exe_ext@
+%{_prefix}/bin/@target_alias@-gcc@exe_ext@
+%{_prefix}/bin/@target_alias@-protoize@exe_ext@
+%{_prefix}/bin/@target_alias@-unprotoize@exe_ext@
 
-%dir /opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@/include
+%dir %{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/include
 
-/opt/rtems/@target_alias@
+%{_prefix}/@target_alias@
 
Index: scripts/gccnewlib/target-gcj.add
===================================================================
--- scripts/gccnewlib/target-gcj.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/target-gcj.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,8 +14,8 @@
 
 %files -n @target_alias@-gcj -f build/files.gcj
-%dir /opt/rtems/bin
-/opt/rtems/bin/@target_alias@-gcj@exe_ext@
+%dir %{_prefix}/bin
+%{_prefix}/bin/@target_alias@-gcj@exe_ext@
 
-/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@/jc1@exe_ext@
-/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@/jvgenmain@exe_ext@
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/jc1@exe_ext@
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/jvgenmain@exe_ext@
 
Index: scripts/gccnewlib/target-objc.add
===================================================================
--- scripts/gccnewlib/target-objc.add	(revision 0671af64eaf164d6e49eb25ecbb6e3bf30cea086)
+++ scripts/gccnewlib/target-objc.add	(revision 4b3af7a41115b9b59e8a9f67291df9fa458a4b68)
@@ -14,4 +14,4 @@
 
 %files -n @target_alias@-objc -f build/files.objc
-/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@/cc1obj@exe_ext@
-/opt/rtems/lib/gcc-lib/@target_alias@/@gcc_version@/include/objc
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/cc1obj@exe_ext@
+%{_prefix}/lib/gcc-lib/@target_alias@/@gcc_version@/include/objc
