Index: ChangeLog
===================================================================
--- ChangeLog	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ ChangeLog	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -1,2 +1,14 @@
+2002-02-05	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* aclocal/check-newlib.m4: Apply AS_IF.
+	* aclocal/config-subdirs.m4: Remove _RTEMS_PUSH_BUILDDIR,
+	_RTEMS_POP_BUILDDIR, _RTEMS_GIVEN_INSTALL, _RTEMS_SUB_SRCDIR.
+	* aclocal/subdirs.m4: Fix comments, apply AS_IF.
+	* aclocal/sysv-ipc.m4: Reflect autoconf-2.5x canonicalization
+	changes.
+	* aclocal/target.m4: Add _RTEMS_PUSH_BUILDDIR, _RTEMS_POP_BUILDDIR,
+	_RTEMS_GIVEN_INSTALL, _RTEMS_SUB_SRCDIR.
+	* automake/compile.am: Remove librtemsall from LINK_FILES.
+
 2001-12-20	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: aclocal/check-newlib.m4
===================================================================
--- aclocal/check-newlib.m4	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ aclocal/check-newlib.m4	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -15,19 +15,17 @@
 
 dnl some versions of newlib provide rtems_provides_crt0()
-    if test -z "$rtems_cv_use_newlib"; then
-      AC_TRY_LINK(
+    AS_IF([test -z "$rtems_cv_use_newlib"],
+      [AC_TRY_LINK(
         [extern void rtems_provides_crt0() ;],
         [rtems_provides_crt0()],
         rtems_cv_use_newlib="yes",
-        rtems_cv_use_newlib="no")
-    fi
+        rtems_cv_use_newlib="no")]
+    )
   ])
-RTEMS_USE_NEWLIB="$rtems_cv_use_newlib"
-AC_SUBST(RTEMS_USE_NEWLIB)
+  RTEMS_USE_NEWLIB="$rtems_cv_use_newlib"
+  AC_SUBST(RTEMS_USE_NEWLIB)
 
-if test x"${RTEMS_USE_NEWLIB}" = x"yes";
-then
-  AC_DEFINE_UNQUOTED(RTEMS_NEWLIB,1,[if using newlib])
-  AC_DEFINE_UNQUOTED(MALLOC_PROVIDED,1,[if malloc is provided])
-fi
+  AS_IF([test x"${RTEMS_USE_NEWLIB}" = x"yes"],
+    [ AC_DEFINE_UNQUOTED(RTEMS_NEWLIB,1,[if using newlib])]
+  )
 ])
Index: aclocal/config-subdirs.m4
===================================================================
--- aclocal/config-subdirs.m4	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ aclocal/config-subdirs.m4	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -8,42 +8,4 @@
 dnl configure.in.
 dnl
-
-dnl
-dnl _RTEMS_PUSH_BUILDDIR(SUBDIR)
-dnl
-AC_DEFUN(_RTEMS_PUSH_BUILDDIR,
-[
-# _RTEMS_PUSH_BUILDDIR
-    echo configuring in $1
-    case "$srcdir" in
-    .) ;;
-    *) AS_MKDIR_P([$1])
-      ;;
-    esac
-
-    ac_popdir=`pwd`
-    cd $1
-])
-
-dnl
-dnl _RTEMS_POP_BUILDDIR
-dnl
-AC_DEFUN(_RTEMS_POP_BUILDDIR,
-[
-  cd $ac_popdir
-])
-
-dnl
-dnl _RTEMS_GIVEN_INSTALL
-dnl
-AC_DEFUN(_RTEMS_GIVEN_INSTALL,
-[
-ifdef([AC_PROVIDE_AC_PROG_INSTALL],[  
-  case "$ac_given_INSTALL" in
-  [[\\/]]* | ?:[[\\/]]*) INSTALL="$ac_given_INSTALL" ;;
-  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-  esac
-])dnl
-])
 
 dnl
@@ -71,18 +33,2 @@
     esac
 ])
-
-dnl
-dnl _RTEMS_SUB_SRCDIR(AC_CONFIG_DIR[,TARGET_SUBDIR])
-dnl
-AC_DEFUN(_RTEMS_SUB_SRCDIR,[
-# _RTEMS_SUB_SRCDIR
-    _RTEMS_ADJUST_SRCDIR(ac_sub_srcdir,$1,$2)
-
-    # Check for configure
-    if test -f $ac_sub_srcdir/configure; then
-      ac_sub_configure=$ac_sub_srcdir/configure
-    else
-      AC_MSG_WARN([no configuration information is in $1])
-      ac_sub_configure=
-    fi
-])
Index: aclocal/subdirs.m4
===================================================================
--- aclocal/subdirs.m4	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ aclocal/subdirs.m4	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -1,3 +1,3 @@
-## All tools belong in one of the 3 categories, and are assigned above.
+## All directories belong in one of 3 categories.
 ## ${HOST_CONFIGDIRS_LIST} is directories we build using the host tools.
 ## ${TARGET_CONFIGDIRS_LIST} is directories we build using the target tools.
@@ -31,9 +31,8 @@
 _RTEMS_TARGET_CONFIG_PREPARE
 
-if test $build = $host;
-then
-  if test $host = $target;
-  then
-    dnl b=h, h=t, t=b
+AS_IF([test $build = $host],
+[
+  AS_IF([test $host = $target],
+  [dnl b=h, h=t, t=b
     BUILD_SUBDIRS="${build_configdirs}"
     build_configdirs="${build_configdirs}"
@@ -41,7 +40,6 @@
     host_configdirs=""
     TARGET_SUBDIRS=""
-    target_configdirs=""
-  else
-    dnl b=h, h!=t, t!=b
+    target_configdirs=""],
+  [dnl b=h, h!=t, t!=b
     BUILD_SUBDIRS="${build_configdirs}"
     build_configdirs="${build_configdirs}"
@@ -51,9 +49,8 @@
       sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
     target_configdirs="${target_configdirs}"
-  fi
-else
-  if test $host = $target;
-  then
-    dnl b!=h, h=t, b!=t
+  ])
+],[
+  AS_IF([test $host = $target],
+  [ dnl b!=h, h=t, b!=t
     BUILD_SUBDIRS="${build_configdirs}"
     build_configdirs="${build_configdirs}"
@@ -62,9 +59,8 @@
     host_configdirs="${host_configdirs}"
     TARGET_SUBDIRS=""
-    target_configdirs=""
-  else
-    if test $build = $target;
-    then
-    dnl b!=h, h!=t, b=t
+    target_configdirs=""],
+  [
+    AS_IF([test $build = $target],
+    [dnl b!=h, h!=t, b=t
       BUILD_SUBDIRS="${build_configdirs}"
       build_configdirs="${build_configdirs}"
@@ -73,7 +69,6 @@
       host_configdirs="${host_configdirs}"
       TARGET_SUBDIRS=""
-      target_configdirs=""
-    else
-    dnl b!=h, h!=t, b!=t
+      target_configdirs=""],
+    [dnl b!=h, h!=t, b!=t
       BUILD_SUBDIRS="${build_configdirs}"
       build_configdirs="${build_configdirs}"
@@ -84,7 +79,7 @@
         sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
       target_configdirs="${target_configdirs}"
-    fi
-  fi
-fi
+    ])
+  ])
+])
 
 AC_SUBST(HOST_SUBDIRS)
@@ -126,13 +121,13 @@
 ac_builddir=.
 
-if test $dstdir != .; then
-  # Strip off leading ./
+AS_IF([test $dstdir != .],
+[ # Strip off leading ./
   ac_builddir_suffix=/`echo $dstdir | sed 's,^\.[[\\/]],,'`
   ac_srcdir_suffix=/`echo $1 | sed 's,^\.[[\\/]],,'`
   # A "../" for each directory in $ac_dir_suffix.
   ac_top_builddir=`echo "$ac_builddir_suffix" | sed 's,/[[^\\/]]*,../,g'`
-else
+],[
   ac_dir_suffix= ac_top_builddir=
-fi
+])
 
 case $srcdir in
@@ -261,5 +256,5 @@
 
 ## PUBLIC: RTEMS_BUILD_CONFIG_SUBDIRS(build_subdir)
-# tools to be built for the build environment
+# subdirs to be built for the build environment
 AC_DEFUN([RTEMS_BUILD_CONFIG_SUBDIRS],[
 m4_append([_RTEMS_BUILD_CONFIGDIRS_LIST],[ $1])
@@ -291,6 +286,6 @@
 ])
 
-## PUBLIC: RTEMS_HOST_CONFIG_SUBDIR(host_subdir)
-# libraries to be build for the host environment
+## PUBLIC: RTEMS_HOST_CONFIG_SUBDIRS(host_subdir)
+# subdirs to be build for the host environment
 AC_DEFUN([RTEMS_HOST_CONFIG_SUBDIRS],[
 m4_append([_RTEMS_HOST_CONFIGDIRS_LIST],[ $1])dnl
@@ -342,6 +337,6 @@
 ])
 
-## PUBLIC: RTEMS_TARGET(target_subdir)
-# tools to be build for the target environment
+## PUBLIC: RTEMS_TARGET_CONFIG_SUBDIRS(target_subdir)
+# subdirs to be build for the target environment
 AC_DEFUN([RTEMS_TARGET_CONFIG_SUBDIRS],[
 m4_append([_RTEMS_TARGET_CONFIGDIRS_LIST],[ $1])
Index: aclocal/sysv-ipc.m4
===================================================================
--- aclocal/sysv-ipc.m4	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ aclocal/sysv-ipc.m4	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -19,5 +19,5 @@
 AC_DEFUN(RTEMS_UNION_SEMUN,
 [
-AC_CACHE_CHECK([whether $RTEMS_HOST defines union semun],
+AC_CACHE_CHECK([whether $host defines union semun],
   rtems_cv_HAS_UNION_SEMUN,
   [AC_TRY_COMPILE([
@@ -36,6 +36,6 @@
 AC_DEFUN(RTEMS_SYSV_SEM,
 [AC_REQUIRE([AC_PROG_CC]) 
-AC_REQUIRE([RTEMS_CANONICAL_HOST])
-AC_CACHE_CHECK(whether $RTEMS_HOST supports System V semaphores,
+# AC_REQUIRE([RTEMS_CANONICAL_HOST])
+AC_CACHE_CHECK(whether $host supports System V semaphores,
 rtems_cv_sysv_sem,
 [
@@ -70,6 +70,6 @@
 AC_DEFUN(RTEMS_SYSV_SHM,
 [AC_REQUIRE([AC_PROG_CC]) 
-AC_REQUIRE([RTEMS_CANONICAL_HOST])
-AC_CACHE_CHECK(whether $RTEMS_HOST supports System V shared memory,
+# AC_REQUIRE([RTEMS_CANONICAL_HOST])
+AC_CACHE_CHECK(whether $host supports System V shared memory,
 rtems_cv_sysv_shm,
 [
@@ -93,6 +93,6 @@
 AC_DEFUN(RTEMS_SYSV_MSG,
 [AC_REQUIRE([AC_PROG_CC]) 
-AC_REQUIRE([RTEMS_CANONICAL_HOST])
-AC_CACHE_CHECK(whether $RTEMS_HOST supports System V messages,
+# AC_REQUIRE([RTEMS_CANONICAL_HOST])
+AC_CACHE_CHECK(whether $host supports System V messages,
 rtems_cv_sysv_msg,
 [
@@ -115,5 +115,5 @@
 
 AC_DEFUN(RTEMS_CHECK_SYSV_UNIX,
-[AC_REQUIRE([RTEMS_CANONICAL_HOST])
+[# AC_REQUIRE([RTEMS_CANONICAL_HOST])
 if test "$RTEMS_CPU" = "unix" ; then
   RTEMS_UNION_SEMUN
Index: aclocal/target.m4
===================================================================
--- aclocal/target.m4	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ aclocal/target.m4	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -89,2 +89,65 @@
 ## FIXME: This is obsolete. Only kept for backward compatibility
 AU_DEFUN([RTEMS_OUTPUT_BUILD_SUBDIRS],[])
+
+
+dnl
+dnl Misc utility macros for subdir handling to work around missing abilities
+dnl in autoconf, automake and structural issues with RTEMS
+dnl
+dnl Contains parts derived from autoconf-2.13 AC_OUTPUT_SUBDIRS and Cygnus'
+dnl configure.in.
+dnl
+
+dnl
+dnl _RTEMS_PUSH_BUILDDIR(SUBDIR)
+dnl
+AC_DEFUN(_RTEMS_PUSH_BUILDDIR,
+[
+# _RTEMS_PUSH_BUILDDIR
+    echo configuring in $1
+    case "$srcdir" in
+    .) ;;
+    *) AS_MKDIR_P([$1])
+      ;;
+    esac
+
+    ac_popdir=`pwd`
+    cd $1
+])
+
+dnl
+dnl _RTEMS_POP_BUILDDIR
+dnl
+AC_DEFUN(_RTEMS_POP_BUILDDIR,
+[
+  cd $ac_popdir
+])
+
+dnl
+dnl _RTEMS_GIVEN_INSTALL
+dnl
+AC_DEFUN(_RTEMS_GIVEN_INSTALL,
+[
+ifdef([AC_PROVIDE_AC_PROG_INSTALL],[  
+  case "$ac_given_INSTALL" in
+  [[\\/]]* | ?:[[\\/]]*) INSTALL="$ac_given_INSTALL" ;;
+  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+  esac
+])dnl
+])
+
+dnl
+dnl _RTEMS_SUB_SRCDIR(AC_CONFIG_DIR[,TARGET_SUBDIR])
+dnl
+AC_DEFUN(_RTEMS_SUB_SRCDIR,[
+# _RTEMS_SUB_SRCDIR
+    _RTEMS_ADJUST_SRCDIR(ac_sub_srcdir,$1,$2)
+
+    # Check for configure
+    if test -f $ac_sub_srcdir/configure; then
+      ac_sub_configure=$ac_sub_srcdir/configure
+    else
+      AC_MSG_WARN([no configuration information is in $1])
+      ac_sub_configure=
+    fi
+])
Index: automake/compile.am
===================================================================
--- automake/compile.am	(revision d04956892ad514d1e514c99c79afddadf6a9511d)
+++ automake/compile.am	(revision a0ea6f10629730e343169614c7c3935048cbf16b)
@@ -60,5 +60,6 @@
 
 ### FIXME: False if using multilibbed RTEMS
-LINK_LIBS_RTEMS = $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
+LINK_LIBS_RTEMS = $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
+   $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA) \
 
 LINK_LIBS_GCC272 = $(LINK_LIBS_RTEMS) $(LIBC_LIBC) $(LIBC_LIBGCC)
@@ -200,5 +201,6 @@
     $(OBJS) \
     $(MANAGERS_NOT_WANTED:%=$(PROJECT_RELEASE)/lib/no-%$(LIB_VARIANT).rel) \
-    $(PROJECT_RELEASE)/lib/librtemsall$(LIBSUFFIX_VA)
+    $(PROJECT_RELEASE)/lib/librtemsbsp$(LIBSUFFIX_VA) \
+    $(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA) \
 
 if RTEMS_USE_GCC
