Index: ChangeLog
===================================================================
--- ChangeLog	(revision e8ee071750e3aea184393642d636a2c3b6104d0d)
+++ ChangeLog	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
@@ -1,2 +1,12 @@
+2003-06-12	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+	* configure.ac: Remove "BLEEDING EDGE" warning.
+	Put docs into RTEMS_BUILD_CONFIG_SUBDIRS.
+	* acinclude.m4: Add AC_PREREQ(2.57).
+	Major overhaul (PR 412).
+	* aclocal/prog-cc.m4: Add RTEMS_GCC_ISYSTEM.
+	* aclocal/gcc-isystem.m4: New.
+	* Makefile.am: Add aclocal/gcc-isystem.m4.
+
 2003-05-16	Ralf Corsepius <corsepiu@faw.uni-ulm.de>
 
Index: Makefile.am
===================================================================
--- Makefile.am	(revision e8ee071750e3aea184393642d636a2c3b6104d0d)
+++ Makefile.am	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
@@ -31,5 +31,5 @@
     aclocal/rtems-test-no-pause.m4 aclocal/rtems-top.m4 \
     aclocal/target.m4 aclocal/tool-paths.m4 aclocal/bspopts.m4 \
-    aclocal/ppc.m4 aclocal/bsp-configure.m4
+    aclocal/ppc.m4 aclocal/bsp-configure.m4 aclocal/gcc-isystem.m4
 
 noinst_SCRIPTS = bootstrap
Index: acinclude.m4
===================================================================
--- acinclude.m4	(revision e8ee071750e3aea184393642d636a2c3b6104d0d)
+++ acinclude.m4	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
@@ -4,4 +4,5 @@
 ## ${BUILD_CONFIGDIRS_LIST} is directories we build using the build tools
 
+AC_PREREQ(2.57)
 
 dnl RTEMS_ARG_VAR(VAR,HELP-STRING)
@@ -43,7 +44,41 @@
 AC_CONFIG_COMMANDS_PRE([
 
-test -z "$host_alias" && host_alias="$host"
-test -z "$build_alias" && build_alias="$build"
-test -z "$target_alias" && target_alias="$target"
+if test -z "${build_alias}"; then
+# build_alias is empty
+  if test -z "${host_alias}"; then
+  # host_alias is empty
+    if test -z "${target_alias}"; then
+    : target_alias is empty
+    else
+    : target_alias is not empty
+    fi
+  else
+  # host_alias is not empty
+    if test -z "${target_alias}"; then
+    : target_alias is empty
+    target_alias="${host_alias}"
+    else
+    : target_alias is not empty
+    fi
+  fi
+else
+# build_alias is not empty
+  if test -z "${host_alias}"; then
+  # host_alias is empty
+    if test -z "${target_alias}"; then
+    : target_alias is empty
+    else
+    : target_alias is not empty
+    fi
+  else
+  # host_alias is not empty
+    if test -z "${target_alias}"; then
+    : target_alias is empty
+    target_alias="${host_alias}"
+    else
+    : target_alias is not empty
+    fi
+  fi
+fi
 
 _RTEMS_BUILD_CONFIG_PREPARE
@@ -51,54 +86,28 @@
 _RTEMS_TARGET_CONFIG_PREPARE
 
+build_subdir="."
 build_SUBDIRS="${build_configdirs}"
 build_configdirs="${build_configdirs}"
 
-AS_IF([test $build = $host],
+AS_IF([test $build != $host],
 [dnl
-  AS_IF([test $host = $target],
-  [dnl b=h, h=t, t=b
-    host_SUBDIRS="${host_configdirs}"
-    host_configdirs="${host_configdirs}"
-    target_SUBDIRS="${target_configdirs}"
-    target_configdirs="${target_configdirs}"],
-  [dnl b=h, h!=t, t!=b
-    host_SUBDIRS="${host_configdirs}"
-    host_configdirs="${host_configdirs}"
-    target_SUBDIRS=`echo "${target_configdirs}" | \
-      sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
-    target_configdirs="${target_configdirs}"
-  ])
+  host_subdir="${host_alias-$host}"
+  host_SUBDIRS=`echo "${host_configdirs}" | \
+        sed -e "s%\([[^ ]][[^ ]]*\)%$host_subdir/\1%g"`
+  host_configdirs="${host_configdirs}"
 ],[dnl
-  AS_IF([test $host = $target],
-  [ dnl b!=h, h=t, b!=t
-    host_SUBDIRS=`echo "${host_configdirs}" | \
-      sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
-    host_configdirs="${host_configdirs}"
-    AS_IF([test x"$enable_experimental" = x"yes" ],[
-      target_SUBDIRS=`echo "${target_configdirs}" | \
-        sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
-      target_configdirs="${target_configdirs}"
-    ])
-  ],[dnl
-    AS_IF([test $build = $target],
-    [dnl b!=h, h!=t, b=t
-      host_SUBDIRS=`echo "${host_configdirs}" | \
-        sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
-      host_configdirs="${host_configdirs}"
-      AS_IF([test x"$enable_experimental" = x"yes" ],[
-        target_SUBDIRS="${target_configdirs}"
-        target_configdirs="${target_configdirs}"
-      ])
-    ],[dnl b!=h, h!=t, b!=t
-      host_SUBDIRS=`echo "${host_configdirs}" | \
-        sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
-      host_configdirs="${host_configdirs}"
-      AS_IF([test x"$enable_experimental" = x"yes" ],[
-        target_SUBDIRS=`echo "${target_configdirs}" | \
-          sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
-        target_configdirs="${target_configdirs}"
-      ])
-    ])
-  ])
+  host_SUBDIRS="${host_configdirs}"
+  host_configdirs="${host_configdirs}"
+])
+
+AS_IF([test $build != $target],
+[dnl
+  target_subdir="${target_alias-$target}"
+  target_SUBDIRS=`echo "${target_configdirs}" | \
+      sed -e "s%\([[^ ]][[^ ]]*\)%$target_subdir/\1%g"`
+  target_configdirs="${target_configdirs}"
+],[dnl
+  target_SUBDIRS="${target_configdirs}"
+  target_configdirs="${target_configdirs}"
 ])
 
@@ -331,9 +340,9 @@
 m4_expand_once([_RTEMS_CONFIGURE_ARGS_PRUNE([buildargs])])
 eval buildargs_prune $ac_configure_args
-buildargs="'--host=${build}' '--build=${build}' ${buildargs}"
-test -n "${target_alias}" && \
-buildargs="${buildargs} --target='${target_alias}'"
-build_subdir="."
+buildargs="'--host=${build_alias-$build}' '--build=${build_alias-$build}' ${buildargs}"
+buildargs="${buildargs} '--target=${target_alias-$target}'"
 ],[])
+AC_SUBST(buildargs)
+AC_SUBST(build_subdir)
 ])
 
@@ -356,7 +365,8 @@
 m4_expand_once([_RTEMS_CONFIGURE_ARGS_PRUNE([hostargs])])
 eval hostargs_prune $ac_configure_args
-hostargs="'--host=${host_alias}' '--build=${build}' '--target=${target_alias}' ${hostargs}"
-host_subdir="${host_alias}"
+hostargs="'--host=${host_alias-$host}' '--build=${build_alias-$build}' '--target=${target_alias-$target}' ${hostargs}"
 ],[])
+AC_SUBST(hostargs)
+AC_SUBST(host_subdir)
 ])
 
@@ -379,6 +389,7 @@
 m4_expand_once([_RTEMS_CONFIGURE_ARGS_PRUNE([targetargs])])
 eval targetargs_prune $ac_configure_args
-targetargs="'--host=${target_alias}' '--build=${build}' '--target=${target_alias}' ${targetargs}"
-target_subdir="${target_alias}"
+targetargs="'--host=${target_alias-$target}' '--build=${build_alias-$build}' '--target=${target_alias-$target}' ${targetargs}"
 ],[])
-])
+AC_SUBST(targetargs)
+AC_SUBST(target_subdir)
+])
Index: aclocal/gcc-isystem.m4
===================================================================
--- aclocal/gcc-isystem.m4	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
+++ aclocal/gcc-isystem.m4	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
@@ -0,0 +1,25 @@
+dnl
+dnl $Id$
+dnl
+dnl Check whether the gcc accepts -isystem
+dnl
+
+AC_DEFUN(RTEMS_GCC_ISYSTEM,
+[AC_REQUIRE([RTEMS_PROG_CC])
+AC_CACHE_CHECK(whether $CC accepts -isystem,rtems_cv_gcc_isystem,
+[
+rtems_cv_gcc_isystem=no
+if test x"$GCC" = x"yes"; then
+cat << EOF > conftest.h
+int conftest123();
+EOF
+cat << EOF > conftest.c
+#include <conftest.h>
+int conftest123() {}
+EOF
+  if test -z "`${CC} -isystem./ -c conftest.c 2>&1`";then
+    rtems_cv_gcc_isystem=yes
+  fi
+fi
+rm -f conftest*
+])])
Index: aclocal/prog-cc.m4
===================================================================
--- aclocal/prog-cc.m4	(revision e8ee071750e3aea184393642d636a2c3b6104d0d)
+++ aclocal/prog-cc.m4	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
@@ -27,9 +27,12 @@
 dnl check target cc
 RTEMS_PROG_CC
-dnl check if the compiler supports --specs
-RTEMS_GCC_SPECS
+dnl check if the compiler supports -isystem
+RTEMS_GCC_ISYSTEM
 dnl check if the target compiler may use --pipe
 RTEMS_GCC_PIPE
 test "$rtems_cv_gcc_pipe" = "yes" && CC="$CC --pipe"
+
+dnl check if the compiler supports --specs
+RTEMS_GCC_SPECS
 
 if test "$GCC" = yes; then
@@ -37,3 +40,9 @@
 m4_if([$1],,[],[RTEMS_CFLAGS="$RTEMS_CFLAGS $1"])
 fi
+
+AS_IF([test x"$rtems_cv_gcc_isystem" = x"yes"],[
+  RTEMS_CPPFLAGS="-isystem \$(PROJECT_INCLUDE)"],[
+  RTEMS_CPPFLAGS="-I\$(PROJECT_INCLUDE)"
 ])
+AC_SUBST(RTEMS_CPPFLAGS)
+])
Index: configure.ac
===================================================================
--- configure.ac	(revision e8ee071750e3aea184393642d636a2c3b6104d0d)
+++ configure.ac	(revision 040e70a04f5a23f5f80e320ab0f9fbcd14878f1f)
@@ -38,15 +38,4 @@
     (default:disabled)])])
 
-if test $host != $build; then
-AC_MSG_WARN([]
-[*** *** *** WARNING *** *** ***]
-[]
-[Entering BEYOND BLEEDING EDGE TERRITORY]
-[]
-[You are trying to build RTEMS Canadian cross]
-[If you really mean it, feel free to continue ...]
-[*** *** *** *** *** *** *** ***])
-fi
-
 ## NOTES:
 ## * tools/build are host-native tools to be installed on the host.
@@ -62,5 +51,5 @@
 
 AS_IF([test x"${enable_docs}" = x"yes"],
-  [RTEMS_HOST_CONFIG_SUBDIRS([doc])])
+  [RTEMS_BUILD_CONFIG_SUBDIRS([doc])])
 
 AS_IF([test x"$enable_multilib" = x"yes"],[
