Index: scripts/ChangeLog
===================================================================
--- scripts/ChangeLog	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/ChangeLog	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -1,2 +1,12 @@
+2001-10-15	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* mkbinutilsspec.in: Guard sed-pattern against autoconf.
+	* mkgccnewlibspec.in: Guard sed-pattern against autoconf, remove
+	Target_alias.
+	* mkgdbspec.in: Guard sed-pattern against autoconf.
+	* mkbspspec.in: Guard sed-pattern against autoconf.
+	* configure.ac: Rework check for RPM_SPECSdir.
+	* autotools/automake-rtems.spec: Update to automake-1.5.
+
 2001-10-11	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: scripts/autotools/automake-rtems.spec
===================================================================
--- scripts/autotools/automake-rtems.spec	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/autotools/automake-rtems.spec	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -3,6 +3,6 @@
 #
 
-%define rpmvers 1.4_p5
-%define srcvers	1.4-p5
+%define rpmvers 1.5
+%define srcvers	1.5
 
 %define _defaultbuildroot	/var/tmp/%{name}-%{srcvers}-root
Index: scripts/configure.ac
===================================================================
--- scripts/configure.ac	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/configure.ac	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -22,23 +22,31 @@
 . ./setup.cache
 
-# Some linux distributions use /usr/src/packages
+AC_MSG_CHECKING(for rpm SPECS directory)
+# Allow users to override RPM_SPECSdir from the environment.
+if test x"$RPM_SPECSdir" = x"$RPM_SPECSdir";
+then
+# SuSE uses /usr/src/packages
 # redhat uses /usr/src/redhat
+# MDK is reported to use /usr/src/RPM
 # others might use /usr/src
-AC_MSG_CHECKING(for rpm SPECS directory)
-if test -d /usr/src/packages/SPECS;
-then
-  RPM_SPECSdir=/usr/src/packages/SPECS;
-elif test -d /usr/src/redhat/SPECS;
-then
-  RPM_SPECSdir=/usr/src/redhat/SPECS;
-elif test -d /usr/src/SPECS;
-then
-  RPM_SPECSdir=/usr/src/SPECS;
-elif test -d /usr/local/src/redhat/SPECS;
-then
-  RPM_SPECSdir=/usr/local/src/redhat/SPECS;
+  rpmpath="/usr:/usr/local"
+  rpmdirs="src/packages:src/redhat:src/RPM:src"
+  save_IFS="$IFS"; IFS=":"
+  for d in $rpmdirs; do
+    for p in $rpmpath; do
+      list="$p/$d:$list"
+    done
+  done
+  for d in $list; do
+    if test -d $d/SPECS; then
+      RPM_SPECSdir="$d/SPECS";
+      break;
+    fi
+  done
+  IFS="$save_IFS"
 fi
+
 if test x"$RPM_SPECSdir" = x"" ; then
-AC_MSG_ERROR(not found)
+AC_MSG_ERROR([not found])
 fi
 AC_MSG_RESULT($RPM_SPECSdir)
Index: scripts/mkbinutilspec.in
===================================================================
--- scripts/mkbinutilspec.in	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/mkbinutilspec.in	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -51,10 +51,10 @@
 specfile=${dst}/$target_alias-binutils-${binutils_version}.spec
 
-sed -e "s%@Release@%${binutils_rpm_release}%g" \
-    -e "s%@rpm_build_root@%${rpm_build_root}%g" \
-    -e "s%@target_alias@%${target_alias}%g" \
-    -e "s%@binutils_version@%${binutils_version}%g" \
-    -e "s%@binutils_patch_version@%${binutils_patch_version}%g" \
-    -e "s%@exe_ext@%${exe_ext}%g" \
+sed -e "s%@Release\@%${binutils_rpm_release}%g" \
+    -e "s%@rpm_build_root\@%${rpm_build_root}%g" \
+    -e "s%@target_alias\@%${target_alias}%g" \
+    -e "s%@binutils_version\@%${binutils_version}%g" \
+    -e "s%@binutils_patch_version\@%${binutils_patch_version}%g" \
+    -e "s%@exe_ext\@%${exe_ext}%g" \
 < ${RTEMS_DIR}/binutils/binutils.spec.in \
 > ${specfile}
Index: scripts/mkbspspec.in
===================================================================
--- scripts/mkbspspec.in	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/mkbspspec.in	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -51,10 +51,10 @@
 specfile=${dst}/$target_alias-$bsp-${rtems_version}.spec
 
-sed -e "s%@Release@%${rtems_rpm_release}%g" \
-    -e "s%@bsp@%${bsp}%g" \
-    -e "s%@rtems_version@%${rtems_version}%g" \
-    -e "s%@rpm_build_root@%${rpm_build_root}%g" \
-    -e "s%@target_alias@%${target_alias}%g" \
-    -e "s%@exe_ext@%${exe_ext}%g" \
+sed -e "s%@Release\@%${rtems_rpm_release}%g" \
+    -e "s%@bsp\@%${bsp}%g" \
+    -e "s%@rtems_version\@%${rtems_version}%g" \
+    -e "s%@rpm_build_root\@%${rpm_build_root}%g" \
+    -e "s%@target_alias\@%${target_alias}%g" \
+    -e "s%@exe_ext\@%${exe_ext}%g" \
 < ${RTEMS_DIR}/rtems/rtems.spec.in \
 > ${specfile}
Index: scripts/mkgccnewlibspec.in
===================================================================
--- scripts/mkgccnewlibspec.in	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/mkgccnewlibspec.in	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -58,12 +58,12 @@
 specfile=${dst}/${target_alias}-gcc-${gcc_version}-newlib-${newlib_version}.spec
 
-sed -e "s%@Release@%${gccnewlib_rpm_release}%g" \
-    -e "s%@Target_alias@%${target_alias}%g" \
-    -e "s%@rpm_build_root@%${rpm_build_root}%g" \
-    -e "s%@gcc_version@%${gcc_version}%g" \
-    -e "s%@gcc_patch_version@%${gcc_patch_version}%g" \
-    -e "s%@newlib_version@%${newlib_version}%g" \
-    -e "s%@newlib_patch_version@%${newlib_patch_version}%g" \
-    -e "s%@exe_ext@%${exe_ext}%g" \
+sed -e "s%@Release\@%${gccnewlib_rpm_release}%g" \
+    -e "s%@target_alias\@%${target_alias}%g" \
+    -e "s%@rpm_build_root\@%${rpm_build_root}%g" \
+    -e "s%@gcc_version\@%${gcc_version}%g" \
+    -e "s%@gcc_patch_version\@%${gcc_patch_version}%g" \
+    -e "s%@newlib_version\@%${newlib_version}%g" \
+    -e "s%@newlib_patch_version\@%${newlib_patch_version}%g" \
+    -e "s%@exe_ext\@%${exe_ext}%g" \
 < ${specsrc} \
 > ${specfile}
Index: scripts/mkgdbspec.in
===================================================================
--- scripts/mkgdbspec.in	(revision 76c6828d8a37855a88ee41db57a7be09340df00e)
+++ scripts/mkgdbspec.in	(revision 64cc4bb5af9eaac1b1c9d30f675d7205bfcf99e5)
@@ -66,11 +66,11 @@
 esac
 
-sed -e "s%@Release@%${gdb_rpm_release}%g" \
-    -e "s%@rpm_build_root@%${rpm_build_root}%g" \
-    -e "s%@target_alias@%${target_alias}%g" \
-    -e "s%@gdb_version@%${gdb_version}%g" \
-    -e "s%@gdb_patch_version@%${gdb_patch_version}%g" \
-    -e "s%@extra_configure_arguments@%${extra_configure_arguments}%g" \
-    -e "s%@exe_ext@%${exe_ext}%g" \
+sed -e "s%@Release\@%${gdb_rpm_release}%g" \
+    -e "s%@rpm_build_root\@%${rpm_build_root}%g" \
+    -e "s%@target_alias\@%${target_alias}%g" \
+    -e "s%@gdb_version\@%${gdb_version}%g" \
+    -e "s%@gdb_patch_version\@%${gdb_patch_version}%g" \
+    -e "s%@extra_configure_arguments\@%${extra_configure_arguments}%g" \
+    -e "s%@exe_ext\@%${exe_ext}%g" \
 < ${RTEMS_DIR}/gdb/gdb.spec.in \
 > ${specfile}
