summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-12-20 17:33:23 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-12-20 17:33:23 +0000
commitba748523d172d32b4c7d6207f6c2c5444c8f93a3 (patch)
tree7fe6e24d8b195b0dec0138a29712948e81aa8b25
parentf92cc34b38355c462fd394f098a561d403bc42e9 (diff)
downloadrtems-ba748523d172d32b4c7d6207f6c2c5444c8f93a3.tar.bz2
2001-12-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Reworked for multilibs, reflect changes to aclocal/*.m4. * aclocal/subdirs.m4: New file. * aclocal/multi.m4: New file, adopted from autoconf-2.52 w/ modifications. * aclocal/check-posix.m4: Apply AS_IF. * aclocal/config-subdirs.m4: Reflect changes to other m4-macros. * aclocal/env-rtemsbsp.m4: Add PROJECT_INCLUDE, PROJECT_RELEASE. Add AM_CONDITIONAL(MULTILIB). Adapt GCC_SPECS to multilibs. * aclocal/env-rtemscpu.m4: Remove RTEMS_BSP. Add support for MULTIBUILDTOP, MULTISUBDIR. Adapt GCC_SPECS to multilibs. Add PROJECT_INCLUDE, PROJECT_RELEASE, includedir, libdir. * aclocal/multilib.m4: Fix m4-quoting, adopt automake-1.5's OUTPUT_COMMANDS. * aclocal/project-root.m4: Remove PROJECT_INCLUDE, PROJECT_RELEASE. * aclocal/rtems-debug.m4: Minor cleanups. * aclocal/rtems-top.m4: Minor cleanups. * automake/compile.am: Further steps towards automake's rules.
-rw-r--r--ChangeLog20
-rw-r--r--aclocal/check-posix.m47
-rw-r--r--aclocal/config-subdirs.m4160
-rw-r--r--aclocal/env-rtemsbsp.m411
-rw-r--r--aclocal/env-rtemscpu.m436
-rw-r--r--aclocal/multi.m453
-rw-r--r--aclocal/multilib.m411
-rw-r--r--aclocal/project-root.m46
-rw-r--r--aclocal/rtems-debug.m416
-rw-r--r--aclocal/rtems-top.m44
-rw-r--r--aclocal/subdirs.m4393
-rw-r--r--automake/compile.am10
-rw-r--r--configure.ac71
13 files changed, 536 insertions, 262 deletions
diff --git a/ChangeLog b/ChangeLog
index 202e4a0524..6efe576057 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2001-12-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
+
+ * configure.ac: Reworked for multilibs, reflect changes to aclocal/*.m4.
+ * aclocal/subdirs.m4: New file.
+ * aclocal/multi.m4: New file, adopted from autoconf-2.52 w/
+ modifications.
+ * aclocal/check-posix.m4: Apply AS_IF.
+ * aclocal/config-subdirs.m4: Reflect changes to other m4-macros.
+ * aclocal/env-rtemsbsp.m4: Add PROJECT_INCLUDE, PROJECT_RELEASE.
+ Add AM_CONDITIONAL(MULTILIB). Adapt GCC_SPECS to multilibs.
+ * aclocal/env-rtemscpu.m4: Remove RTEMS_BSP. Add support for
+ MULTIBUILDTOP, MULTISUBDIR. Adapt GCC_SPECS to multilibs.
+ Add PROJECT_INCLUDE, PROJECT_RELEASE, includedir, libdir.
+ * aclocal/multilib.m4: Fix m4-quoting, adopt automake-1.5's
+ OUTPUT_COMMANDS.
+ * aclocal/project-root.m4: Remove PROJECT_INCLUDE, PROJECT_RELEASE.
+ * aclocal/rtems-debug.m4: Minor cleanups.
+ * aclocal/rtems-top.m4: Minor cleanups.
+ * automake/compile.am: Further steps towards automake's rules.
+
2001-12-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* automake/multilib.am: include @RTEMS_BSP@.cfg, cleanup.
diff --git a/aclocal/check-posix.m4 b/aclocal/check-posix.m4
index b98f382165..7512f663f5 100644
--- a/aclocal/check-posix.m4
+++ b/aclocal/check-posix.m4
@@ -30,8 +30,7 @@ AC_SUBST(HAS_POSIX_API)dnl
AC_DEFUN(RTEMS_DEFINE_POSIX_API,
[AC_REQUIRE([RTEMS_CHECK_POSIX_API])dnl
-if test x"${HAS_POSIX_API}" = x"yes";
-then
- AC_DEFINE_UNQUOTED(RTEMS_POSIX_API,1,[if posix api is supported])
-fi
+AS_IF(
+ [test x"${HAS_POSIX_API}" = x"yes"],
+ [AC_DEFINE_UNQUOTED(RTEMS_POSIX_API,1,[if posix api is supported])])
])
diff --git a/aclocal/config-subdirs.m4 b/aclocal/config-subdirs.m4
index 719e44e40f..7711645014 100644
--- a/aclocal/config-subdirs.m4
+++ b/aclocal/config-subdirs.m4
@@ -86,163 +86,3 @@ AC_DEFUN(_RTEMS_SUB_SRCDIR,[
ac_sub_configure=
fi
])
-
-AC_DEFUN(RTEMS_TARGET_CONFIG_PREPARE,[
-# Record target_configdirs and the configure arguments in Makefile.
-targargs=`echo "${ac_configure_args}" | \
- sed -e 's/--no[[^ ]]*//' \
- -e 's/--cache[[a-z-]]*=[[^ ]]*//' \
- -e 's/--ho[[a-z-]]*=[[^ ]]*//' \
- -e 's/--bu[[a-z-]]*=[[^ ]]*//' \
- -e 's/--ta[[a-z-]]*=[[^ ]]*//'`;
-
-targargs="--host=${target_alias} --build=${build} ${targargs}"
-AC_SUBST(targargs)
-])
-
-AC_DEFUN(RTEMS_TARGET_CONFIG_SUBDIRS,[
-#
-# TARGET_CONFIG_SUBDIRS
-#
-if test "$no_recursion" != yes; then
- if test $target != $build; then
- # Remove --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- for ac_arg in $targargs; do
- if test -n "$ac_prev"; then
- ac_prev=
- continue
- fi
- case "$ac_arg" in
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
- esac
- done
-
- if test -n "$target_configdirs" && test -d $target_subdir;
- then :;
- else
- AS_MKDIR_P(["$target_subdir"])
- fi
-
- for ac_config_dir in $target_configdirs; do
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- if test ! -d $srcdir/$ac_config_dir; then
- continue
- fi
-
- _RTEMS_PUSH_BUILDDIR([$target_subdir/$ac_config_dir])
-
- _RTEMS_SUB_SRCDIR([$ac_config_dir],[$target_subdir])
-
- # The recursion is here.
- if test -n "$ac_sub_configure"; then
-
- # Make the cache file name correct relative to the subdirectory.
- ac_sub_cache_file=$cache_file
- _RTEMS_GIVEN_INSTALL
-
- echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
- # The eval makes quoting arguments work.
- CC=${CC_FOR_TARGET}; export CC;
- if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
- $ac_sub_configure_args --srcdir=$ac_sub_srcdir \
- --with-target-subdir=$target_subdir \
- --cache-file=$ac_sub_cache_file \
- --exec-prefix="\${prefix}/$target_subdir"
- then :
- else
- AC_MSG_ERROR([$ac_sub_configure failed for $ac_config_dir])
- fi
- fi
-
- _RTEMS_POP_BUILDDIR
- done
- fi
-fi
-])
-
-AC_DEFUN(RTEMS_HOST_CONFIG_PREPARE,[
-# Record host_configdirs and the configure arguments in Makefile.
-hostargs=`echo "${ac_configure_args}" | \
- sed -e 's/--no[[^ ]]*//' \
- -e 's/--cache[[a-z-]]*=[[^ ]]*//' \
- -e 's/--ho[[a-z-]]*=[[^ ]]*//' \
- -e 's/--bu[[a-z-]]*=[[^ ]]*//' \
- -e 's/--ta[[a-z-]]*=[[^ ]]*//'`;
-
-hostargs="--host=${host_alias} --build=${build} --target=${target_alias} ${hostargs}"
-AC_SUBST(hostargs)
-])
-
-AC_DEFUN(RTEMS_HOST_CONFIG_SUBDIRS,[
-#
-# HOST_CONFIG_SUBDIRS
-#
-if test "$no_recursion" != yes; then
-
- if test $build != $host; then
- # Remove --srcdir arguments so they do not pile up.
- ac_sub_configure_args=
- ac_prev=
- for ac_arg in $hostargs; do
- if test -n "$ac_prev"; then
- ac_prev=
- continue
- fi
- case "$ac_arg" in
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- ;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
- esac
- done
-
- if test -n "$host_configdirs" && test -d $host_subdir;
- then :;
- else
- AS_MKDIR_P(["$host_subdir"])
- fi
-
- for ac_config_dir in $host_configdirs; do
- # Do not complain, so a configure script can configure whichever
- # parts of a large source tree are present.
- if test ! -d $srcdir/$ac_config_dir; then
- continue
- fi
-
- _RTEMS_PUSH_BUILDDIR([$host_subdir/$ac_config_dir])
-
- _RTEMS_SUB_SRCDIR([$ac_config_dir],[$host_subdir])
-
- # The recursion is here.
- if test -n "$ac_sub_configure"; then
-
- # Make the cache file name correct relative to the subdirectory.
- ac_sub_cache_file=$cache_file
- _RTEMS_GIVEN_INSTALL
-
- echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
- CC=${CC_FOR_HOST-$host_alias-gcc}; export CC;
- # The eval makes quoting arguments work.
- if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
- $ac_sub_configure_args --srcdir=$ac_sub_srcdir \
- --with-target-subdir=$host_subdir \
- --cache-file=$ac_sub_cache_file
- then :
- else
- AC_MSG_ERROR([$ac_sub_configure failed for $ac_config_dir])
- fi
- fi
-
- _RTEMS_POP_BUILDDIR
- done
- fi
-fi
-])
diff --git a/aclocal/env-rtemsbsp.m4 b/aclocal/env-rtemsbsp.m4
index 43fb2a6b43..ae84ca53a6 100644
--- a/aclocal/env-rtemsbsp.m4
+++ b/aclocal/env-rtemsbsp.m4
@@ -24,9 +24,15 @@ AC_SUBST(RTEMS_BSP)
RTEMS_BSP_SPECS="-specs bsp_specs -qrtems"
AC_SUBST(RTEMS_BSP_SPECS)
-GCC_SPECS="-B\$(PROJECT_ROOT)/ -B\$(PROJECT_ROOT)/$RTEMS_BSP/lib/"
+GCC_SPECS="-B\$(PROJECT_ROOT)/lib/ -B\$(PROJECT_ROOT)/$RTEMS_BSP/lib/"
AC_SUBST(GCC_SPECS)
+PROJECT_INCLUDE="\$(PROJECT_ROOT)/$RTEMS_BSP/lib/include"
+AC_SUBST(PROJECT_INCLUDE)
+
+PROJECT_RELEASE="\$(PROJECT_ROOT)/$RTEMS_BSP"
+AC_SUBST(PROJECT_RELEASE)
+
RTEMS_ROOT=$PROJECT_ROOT/c/$RTEMS_BSP
AC_SUBST(RTEMS_ROOT)
@@ -34,7 +40,8 @@ RTEMS_ENABLE_BARE
AC_SUBST(BARE_CPU_MODEL)
AC_SUBST(BARE_CPU_CFLAGS)
-AM_CONDITIONAL(RTEMS_CONFIG_PER_BSP, true);
+AM_CONDITIONAL([RTEMS_CONFIG_PER_BSP],[true])
+AM_CONDITIONAL([MULTILIB],[false])
includedir="\${exec_prefix}/\$(RTEMS_BSP)/lib/include"
])
diff --git a/aclocal/env-rtemscpu.m4 b/aclocal/env-rtemscpu.m4
index 613ea83ca2..796f875db4 100644
--- a/aclocal/env-rtemscpu.m4
+++ b/aclocal/env-rtemscpu.m4
@@ -3,22 +3,38 @@ dnl $Id$
AC_DEFUN(RTEMS_ENV_RTEMSCPU,
[AC_REQUIRE([RTEMS_ENABLE_MULTILIB])
-if test x"$multilib" = x"no"; then
- RTEMS_ENV_RTEMSBSP
- RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
-else
+if test x"$multilib" = x"yes"; then
## FIXME: There is no multilib BSP
- rtems_cv_RTEMS_BSP="multilib"
- RTEMS_BSP="$rtems_cv_RTEMS_BSP"
- AC_SUBST(RTEMS_BSP)
-
RTEMS_BSP_SPECS=""
AC_SUBST(RTEMS_BSP_SPECS)
- GCC_SPECS="-B\$(PROJECT_ROOT)/ -B\$(PROJECT_ROOT)/lib/"
+ if test -n "$with_multisubdir"; then
+ MULTIBUILDTOP=`echo "/$with_multisubdir" | sed 's,/[[^\\/]]*,../,g'`
+ fi
+ AC_SUBST(MULTIBUILDTOP)
+
+ if test -n "$with_multisubdir"; then
+ MULTISUBDIR="/$with_multisubdir"
+ fi
+ AC_SUBST(MULTISUBDIR)
+
+ PROJECT_ROOT="${RTEMS_TOPdir}/\$(MULTIBUILDTOP)\$(top_builddir)"
+ GCC_SPECS="-isystem \$(PROJECT_ROOT)/lib/include"
AC_SUBST(GCC_SPECS)
- RTEMS_ROOT=$PROJECT_ROOT/c
+ PROJECT_INCLUDE="\$(PROJECT_ROOT)/lib/include"
+ AC_SUBST(PROJECT_INCLUDE)
+
+ PROJECT_RELEASE="\$(PROJECT_ROOT)"
+ AC_SUBST(PROJECT_RELEASE)
+
+ RTEMS_ROOT=${PROJECT_ROOT}
AC_SUBST(RTEMS_ROOT)
+
+ includedir="\${exec_prefix}/lib/include"
+ libdir="${libdir}\$(MULTISUBDIR)"
+else
+ RTEMS_ENV_RTEMSBSP
+ RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
fi
])
diff --git a/aclocal/multi.m4 b/aclocal/multi.m4
new file mode 100644
index 0000000000..08d1783dd5
--- /dev/null
+++ b/aclocal/multi.m4
@@ -0,0 +1,53 @@
+#serial 99
+
+AC_DEFUN(AC_ENABLE_MULTILIB,
+[
+AC_ARG_ENABLE(multilib,
+AC_HELP_STRING([--enable-multilib],
+[build many library versions (default=no)]),
+[case "${enableval}" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
+ esac], [multilib=no])dnl
+
+AM_CONDITIONAL(MULTILIB,test x"${multilib}" = x"yes")
+
+dnl We may get other options which we don't document:
+dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
+
+if test "[$]{srcdir}" = "."; then
+ if test "[$]{with_target_subdir}" != "."; then
+ multilib_basedir="[$]{srcdir}/[$]{with_multisrctop}../ifelse([$2],,,[$2])"
+ else
+ multilib_basedir="[$]{srcdir}/[$]{with_multisrctop}ifelse([$2],,,[$2])"
+ fi
+else
+ multilib_basedir="[$]{srcdir}/ifelse([$2],,,[$2])"
+fi
+AC_SUBST(multilib_basedir)
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+AC_OUTPUT_COMMANDS(
+[case " $CONFIG_FILES " in
+ *" ]m4_if([$1],,Makefile,[$1])[ "*)
+ ac_file=]m4_if([$1],,Makefile,[$1])[ . ${multilib_basedir}/config-ml.in
+esac],
+[
+ srcdir=${srcdir}
+ host=${host}
+ target=${target}
+ with_multisrctop="${with_multisrctop}"
+ with_target_subdir="${with_target_subdir}"
+ with_multisubdir="${with_multisubdir}"
+ ac_configure_args="${multilib_arg} ${ac_configure_args}"
+ CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ multilib_basedir=${multilib_basedir}
+ CC="${CC}"]
+)
+])
diff --git a/aclocal/multilib.m4 b/aclocal/multilib.m4
index 7fc63ea221..b3f308ca2e 100644
--- a/aclocal/multilib.m4
+++ b/aclocal/multilib.m4
@@ -16,7 +16,7 @@ AC_HELP_STRING([--enable-multilib],
AM_CONDITIONAL(MULTILIB,test x"${multilib}" = x"yes")
])
-AC_DEFUN(RTEMS_ENABLE_MULTILIB_MASTER,
+AC_DEFUN([RTEMS_ENABLE_MULTILIB_MASTER],
[
AC_REQUIRE([RTEMS_ENABLE_MULTILIB])
@@ -41,10 +41,11 @@ else
fi
AC_OUTPUT_COMMANDS(
-[if test -n "$CONFIG_FILES"; then
- ac_file=]ifelse([$1],,Makefile,[$1])[ \
- . ${multilib_basedir}/../config-ml.in
-fi],[
+[case " $CONFIG_FILES " in
+ *" ]m4_if([$1],,Makefile,[$1])[ "*)
+ ac_file=]m4_if([$1],,Makefile,[$1])[ . ${multilib_basedir}/config-ml.in
+esac],
+[
srcdir=${srcdir}
host=${host}
target=${target}
diff --git a/aclocal/project-root.m4 b/aclocal/project-root.m4
index 1f5fb677f5..b520b94b5a 100644
--- a/aclocal/project-root.m4
+++ b/aclocal/project-root.m4
@@ -18,11 +18,5 @@ AC_REQUIRE([RTEMS_TOP])
PACKHEX="\$(PROJECT_TOPdir)/tools/build/packhex"
AC_SUBST(PACKHEX)
-
-PROJECT_INCLUDE="\$(PROJECT_ROOT)/$RTEMS_BSP/lib/include"
-AC_SUBST(PROJECT_INCLUDE)
-
-PROJECT_RELEASE="\$(PROJECT_ROOT)/$RTEMS_BSP"
-AC_SUBST(PROJECT_RELEASE)
])
diff --git a/aclocal/rtems-debug.m4 b/aclocal/rtems-debug.m4
index e68e4b707f..9a9f15a33f 100644
--- a/aclocal/rtems-debug.m4
+++ b/aclocal/rtems-debug.m4
@@ -4,18 +4,16 @@ AC_DEFUN(RTEMS_ENABLE_RTEMS_DEBUG,
[
AC_ARG_ENABLE(rtems-debug,
AC_HELP_STRING([--enable-rtems-debug],[enable RTEMS_DEBUG]),
-[case "${enableval}" in
- yes) RTEMS_DEBUG=yes ;;
- no) RTEMS_DEBUG=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for RTEMS_DEBUG]) ;;
-esac],[RTEMS_DEBUG=no])
+[case "${enable_rtems_debug}" in
+ yes) enable_rtems_debug=yes ;;
+ no) enable_rtems_debug=no ;;
+ *) AC_MSG_ERROR([bad value ${enable_rtems_debug} for RTEMS_DEBUG]) ;;
+esac],[enable_rtems_debug=no])
])
AC_DEFUN(RTEMS_CHECK_RTEMS_DEBUG,
[AC_REQUIRE([RTEMS_ENABLE_RTEMS_DEBUG])
-if test x"${RTEMS_DEBUG}" = x"yes";
-then
- AC_DEFINE_UNQUOTED(RTEMS_DEBUG,1,[if RTEMS_DEBUG is enabled])
-fi
+AS_IF([test x"${enable_rtems_debug}" = x"yes"]
+ [AC_DEFINE_UNQUOTED(RTEMS_DEBUG,1,[if RTEMS_DEBUG is enabled])])
])
diff --git a/aclocal/rtems-top.m4 b/aclocal/rtems-top.m4
index 039db16caa..1ec8aa204a 100644
--- a/aclocal/rtems-top.m4
+++ b/aclocal/rtems-top.m4
@@ -36,10 +36,10 @@ AC_SUBST(PROJECT_TOPdir)
if test "$with_target_subdir" = "." ; then
# Native
-PROJECT_ROOT=${RTEMS_TOPdir}/'$(top_builddir)';
+PROJECT_ROOT="${RTEMS_TOPdir}/\$(top_builddir)"
else
# Cross
-PROJECT_ROOT=${RTEMS_TOPdir}/'$(top_builddir)'
+PROJECT_ROOT="${RTEMS_TOPdir}/\$(top_builddir)"
fi
AC_SUBST(PROJECT_ROOT)
diff --git a/aclocal/subdirs.m4 b/aclocal/subdirs.m4
new file mode 100644
index 0000000000..491811b019
--- /dev/null
+++ b/aclocal/subdirs.m4
@@ -0,0 +1,393 @@
+## All tools belong in one of the 3 categories, and are assigned above.
+## ${HOST_CONFIGDIRS_LIST} is directories we build using the host tools.
+## ${TARGET_CONFIGDIRS_LIST} is directories we build using the target tools.
+## ${BUILD_CONFIGDIRS_LIST} is directories we build using the build tools
+
+
+dnl RTEMS_ARG_VAR(VAR,HELP-STRING)
+dnl An internal macros to have help strings pretty
+dnl printed with configure --help, without letting autoconf spoil config subdir
+dnl environments by trying to propagate them
+dnl Stripped down version of autoconf-2.52's AC_ARG_VAR.
+
+AC_DEFUN([_RTEMS_ARG_VAR],
+[
+m4_expand_once([m4_divert_once([HELP_VAR],
+[AC_HELP_STRING([$1], [$2], [ ])])],
+ [$0($1)])dnl
+])
+
+AC_DEFUN([_RTEMS_SUBST_IFNOT],
+[AS_IF([`echo " [$]$1 " | grep " $2 " > /dev/null`],
+ [],
+ [AC_SUBST([$1],["[$]$1 $2"])])
+])
+
+AC_DEFUN([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS],
+[
+AC_CONFIG_COMMANDS_PRE([
+_RTEMS_BUILD_CONFIG_PREPARE
+_RTEMS_HOST_CONFIG_PREPARE
+_RTEMS_TARGET_CONFIG_PREPARE
+
+if test $build = $host;
+then
+ if test $host = $target;
+ then
+ dnl b=h, h=t, t=b
+ BUILD_SUBDIRS="${build_configdirs}"
+ build_configdirs="${build_configdirs}"
+ HOST_SUBDIRS=""
+ host_configdirs=""
+ TARGET_SUBDIRS=""
+ target_configdirs=""
+ else
+ dnl b=h, h!=t, t!=b
+ BUILD_SUBDIRS="${build_configdirs}"
+ build_configdirs="${build_configdirs}"
+ HOST_SUBDIRS=""
+ host_configdirs=""
+ TARGET_SUBDIRS=`echo "${target_configdirs}" | \
+ 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
+ BUILD_SUBDIRS="${build_configdirs}"
+ build_configdirs="${build_configdirs}"
+ HOST_SUBDIRS=`echo "${host_configdirs}" | \
+ sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
+ host_configdirs="${host_configdirs}"
+ TARGET_SUBDIRS=""
+ target_configdirs=""
+ else
+ if test $build = $target;
+ then
+ dnl b!=h, h!=t, b=t
+ BUILD_SUBDIRS="${build_configdirs}"
+ build_configdirs="${build_configdirs}"
+ HOST_SUBDIRS=`echo "${host_configdirs}" | \
+ sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
+ host_configdirs="${host_configdirs}"
+ TARGET_SUBDIRS=""
+ target_configdirs=""
+ else
+ dnl b!=h, h!=t, b!=t
+ BUILD_SUBDIRS="${build_configdirs}"
+ build_configdirs="${build_configdirs}"
+ HOST_SUBDIRS=`echo "${host_configdirs}" | \
+ sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
+ host_configdirs="${host_configdirs}"
+ TARGET_SUBDIRS=`echo "${target_configdirs}" | \
+ sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
+ target_configdirs="${target_configdirs}"
+ fi
+ fi
+fi
+
+AC_SUBST(HOST_SUBDIRS)
+AC_SUBST(TARGET_SUBDIRS)
+AC_SUBST(BUILD_SUBDIRS)
+])
+
+ AC_CONFIG_COMMANDS_POST([
+ _RTEMS_OUTPUT_SUBDIRS([build],[BUILD])
+ _RTEMS_OUTPUT_SUBDIRS([host],[HOST])
+ _RTEMS_OUTPUT_SUBDIRS([target],[TARGET])
+ ])
+])
+
+dnl _RTEMS_SRCPATHS(BUILD-DIR-NAME)
+dnl ----------------------------
+dnl Inputs:
+dnl - BUILD-DIR-NAME is `top-build -> build' and `top-src -> src'
+dnl - `$srcdir' is `top-build -> top-src'
+dnl
+dnl Outputs:
+dnl - `ac_builddir' is `.', for symmetry only.
+dnl - `ac_top_builddir' is `build -> top_build'.
+dnl If not empty, has a trailing slash.
+dnl - `ac_srcdir' is `build -> src'.
+dnl - `ac_top_srcdir' is `build -> top-src'.
+dnl
+dnl and `ac_buildpath' etc., the absolute paths.
+m4_define([_RTEMS_SRCPATHS],
+[
+m4_if([$2],,
+[dstdir=$1],
+[case "$2" in
+"." | "" ) # No subdir was given
+ dstdir=$1;;
+* ) # A subdir was given
+ dstdir=$2/$1;;
+esac])
+ac_builddir=.
+
+if test $dstdir != .; then
+ # 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
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [[\\/]]* | ?:[[\\/]]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_srcdir_suffix;
+ ac_top_srcdir=$srcdir;
+ ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_srcdir_suffix;
+ ac_top_srcdir=$ac_top_builddir$srcdir;
+ ;;
+esac
+dnl Don't blindly perform a `cd $1/$ac_foo && pwd` since $ac_foo can be
+dnl absolute.
+
+ac_buildpath=`cd $dstdir && cd $ac_builddir && pwd`
+ac_top_buildpath=`cd $dstdir && cd $ac_top_builddir && pwd`
+ac_srcpath=`cd $dstdir && cd $ac_srcdir && pwd`
+ac_top_srcpath=`cd $dstdir && cd $ac_top_srcdir && pwd`
+])# _AC_SRCPATHS
+
+dnl _RTEMS_OUTPUT_SUBDIRS([host|target|build],[HOST|TARGET|BUILD])
+AC_DEFUN([_RTEMS_OUTPUT_SUBDIRS],[
+m4_ifdef([_RTEMS_$2_CONFIGDIRS_LIST],
+[
+_RTEMS_ARG_VAR([CC_FOR_$2],
+ [c-compiler to be used for $1 subdirs (default: auto-detected)])
+if test "$no_recursion" != yes; then
+
+ if test -n "${$2_SUBDIRS}"; then
+ ac_sub_configure_args=
+ ac_prev=
+ for ac_arg in $$1args; do
+ if test -n "$ac_prev"; then
+ ac_prev=
+ continue
+ fi
+ case $ac_arg in
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
+ | --c=*)
+ ;;
+ --config-cache | -C)
+ ;;
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ ;;
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ ;;
+ *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ esac
+ done
+
+ case "$$1_subdir" in
+ "." ) ;;
+ * )
+ ac_sub_configure_args="$ac_sub_configure_args --with-target-subdir=$$1_subdir --exec-prefix=\${prefix}/$$1_subdir"
+ ;;
+ esac
+
+ # make sure that $1_subdir is not empty
+ test -n "$$1_subdir" || $1_subdir="."
+
+ ac_popdir=`pwd`
+ for ac_dir in $$1_configdirs; do
+
+ # Do not complain, so a configure script can configure whichever
+ # parts of a large source tree are present.
+ test -d $srcdir/$ac_dir || continue
+
+ AC_MSG_NOTICE([configuring in $$1_subdir/$ac_dir])
+ AS_MKDIR_P(["$$1_subdir/$ac_dir"])
+ _RTEMS_SRCPATHS(["$ac_dir"],["$$1_subdir"])
+
+ cd $$1_subdir/$ac_dir
+
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
+ elif test -f $ac_srcdir/configure; then
+ ac_sub_configure="$SHELL '$ac_srcdir/configure'"
+ elif test -f $ac_srcdir/configure.in; then
+ ac_sub_configure=$ac_configure
+ else
+ AC_MSG_WARN([no configuration information is in $ac_dir])
+ ac_sub_configure=
+ fi
+
+ # The recursion is here.
+ if test -n "$ac_sub_configure"; then
+ # Make the cache file name correct relative to the subdirectory.
+ case $cache_file in
+ [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file=$ac_top_builddir$cache_file ;;
+ esac
+
+ AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args \
+ --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
+ # The eval makes quoting arguments work.
+ eval CC=[$]CC_FOR_$2 \
+ $ac_sub_configure $ac_sub_configure_args \
+ --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
+ AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
+ fi
+
+ cd $ac_popdir
+ done
+ fi
+fi
+])
+])
+
+## PUBLIC: RTEMS_BUILD_CONFIG_SUBDIRS(build_subdir)
+# tools to be built for the build environment
+AC_DEFUN([RTEMS_BUILD_CONFIG_SUBDIRS],[
+m4_append([_RTEMS_BUILD_CONFIGDIRS_LIST],[ $1])
+dnl Always append to build_configdirs
+AC_SUBST(build_configdirs,"$build_configdirs $1")
+
+m4_divert_text([DEFAULTS],
+ [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
+m4_expand_once([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS])
+])
+
+AC_DEFUN(_RTEMS_BUILD_CONFIG_PREPARE,[
+# Record the configure arguments in Makefile.
+m4_ifdef([_RTEMS_BUILD_CONFIGDIRS_LIST],
+[
+buildargs=`echo "${ac_configure_args}" | \
+ sed -e 's/--no[[^ ]]*//' \
+ -e 's/--cache[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--ho[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--bu[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--ta[[a-z-]]*=[[^ ]]*//' \
+ -e 's/[[^ ]]*alias=[[^ ]]*//g'` ;
+
+buildargs="--host=${build} --build=${build} --target=${target_alias} ${buildargs}"
+AC_SUBST(buildargs)
+
+build_subdir="."
+],[])
+])
+
+## PUBLIC: RTEMS_HOST_CONFIG_SUBDIR(host_subdir)
+# libraries to be build for the host environment
+AC_DEFUN([RTEMS_HOST_CONFIG_SUBDIRS],[
+m4_append([_RTEMS_HOST_CONFIGDIRS_LIST],[ $1])dnl
+
+if test $build = $host;
+then
+ if test $host = $target;
+ then
+ _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
+ else
+ _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
+ fi
+else
+ if test $host = $target;
+ then
+ _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
+ else
+ if test $build = $target;
+ then
+ _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
+ else
+ _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
+ fi
+ fi
+fi
+
+m4_divert_text([DEFAULTS],
+ [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
+m4_expand_once([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS])
+])
+
+AC_DEFUN(_RTEMS_HOST_CONFIG_PREPARE,[
+m4_ifdef([_RTEMS_HOST_CONFIGDIRS_LIST],
+[
+# Record configure arguments in Makefile.
+hostargs=`echo "${ac_configure_args}" | \
+ sed -e 's/--no[[^ ]]*//' \
+ -e 's/--cache[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--ho[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--bu[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--ta[[a-z-]]*=[[^ ]]*//' \
+ -e 's/[[^ ]]*alias=[[^ ]]*//g'` ;
+
+hostargs="--host=${host_alias} --build=${build} --target=${target_alias} ${hostargs}"
+AC_SUBST(hostargs)
+
+host_subdir="${host_alias}"
+],[])
+])
+
+## PUBLIC: RTEMS_TARGET(target_subdir)
+# tools to be build for the target environment
+AC_DEFUN([RTEMS_TARGET_CONFIG_SUBDIRS],[
+m4_append([_RTEMS_TARGET_CONFIGDIRS_LIST],[ $1])
+
+if test $build = $host;
+then
+ if test $host = $target;
+ then
+ _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
+ else
+ _RTEMS_SUBST_IFNOT([target_configdirs],[$1])
+ fi
+else
+ if test $host = $target;
+ then
+ _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
+ else
+ if test $build = $target;
+ then
+ _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
+ else
+ _RTEMS_SUBST_IFNOT([target_configdirs],[$1])
+ fi
+ fi
+fi
+
+m4_divert_text([DEFAULTS],
+ [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
+m4_expand_once([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS])
+])
+
+AC_DEFUN(_RTEMS_TARGET_CONFIG_PREPARE,[
+m4_ifdef([_RTEMS_TARGET_CONFIGDIRS_LIST],
+[
+# Record the configure arguments in Makefile.
+targetargs=`echo "${ac_configure_args}" | \
+ sed -e 's/--no[[^ ]]*//' \
+ -e 's/--cache[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--ho[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--bu[[a-z-]]*=[[^ ]]*//' \
+ -e 's/--ta[[a-z-]]*=[[^ ]]*//' \
+ -e 's/[[^ ]]*alias=[[^ ]]*//g'` ;
+
+targetargs="--host=${target_alias} --build=${build} --target=${target_alias} ${targetargs}"
+AC_SUBST(targetargs)
+
+target_subdir="${target_alias}"
+],[])
+])
diff --git a/automake/compile.am b/automake/compile.am
index 575fce520a..39b26a9055 100644
--- a/automake/compile.am
+++ b/automake/compile.am
@@ -118,14 +118,14 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-CXXLD = $(CXX)
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AS = $(CC)
-ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS) -o $@
+ASCOMPILE = $(AS) $(AM_ASFLAGS) $(ASFLAGS)
${ARCH}/%.o: %.c
${COMPILE} -o $@ -c $<
@@ -143,7 +143,7 @@ ${ARCH}/%.o: %.C
${CXXCOMPILE} -o $@ -c $<
${ARCH}/%.o: %.S
- ${ASCOMPILE} -DASM -c $<
+ ${ASCOMPILE} -DASM -o $@ -c $<
# Make foo.rel from foo.o
${ARCH}/%.rel: ${ARCH}/%.o
@@ -176,7 +176,7 @@ depend-am: $(C_FILES) $(CC_FILES) $(S_FILES)
## Replace foo.o with $(ARCH)/foo.o
## Replace $(ARCH) value with string $(ARCH)
## so that it will for debug and profile cases
- $(COMPILE) $(AM_CPPFLAGS) $(AM_CFLAGS) -M $^ | \
+ $(COMPILE) -M $^ | \
sed -e 's?^\(.*\)\.o[ ]*:?$$(ARCH)/\1.o:?' \
-e 's?$(ARCH)/?$$(ARCH)/?' >$(DEPEND).tmp
mv $(DEPEND).tmp $(DEPEND)
@@ -204,7 +204,7 @@ LINK_FILES =\
if RTEMS_USE_GCC
if RTEMS_USE_GCC272
define make-rel
- $(LINK) -nostdlib -Wl,-r $(XLDFLAGS) -o $@ $^
+ $(LINK) -nostdlib -Wl,-r $(XLDFLAGS) $^
endef
else
## gcc >= 2.8
diff --git a/configure.ac b/configure.ac
index 0140082bcb..4dc63d6478 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@
AC_PREREQ(2.52)
AC_INIT
AC_CONFIG_SRCDIR([c])
-RTEMS_TOP(.)
+RTEMS_TOP([.])
# Abort if trying to build inside of the source tree.
if test -f VERSION; then
@@ -33,6 +33,7 @@ RTEMS_ENABLE_LIBCDIR
RTEMS_ENABLE_TESTS
RTEMS_ENABLE_RTEMS_DEBUG
RTEMS_ENABLE_RTEMSBSP(dummy)
+RTEMS_ENABLE_MULTILIB
if test $host != $build; then
AC_MSG_WARN([]
@@ -53,64 +54,18 @@ fi
# these tools are built for the build environment
#
-build_tools="tools/update"
+RTEMS_BUILD_CONFIG_SUBDIRS([tools/update])
-# these libraries are built for the host environment
-#
-host_libs=""
-
-# these tools are built for the host environment
-#
-host_tools="tools/build tools/cpu"
-
-# these libraries are built for the target environment, and are built after
-# the host libraries and the host tools (which may be a cross compiler)
-#
-target_libs="c"
-
-# these tools are built using the target libs, and are intended to run only
-# in the target environment
-#
-target_tools=""
-
-## All tools belong in one of the five categories, and are assigned above.
-## ${host_configdirs} is directories we build using the host tools.
-## ${target_configdirs} is directories we build using the target tools.
-#
-host_configdirs="${host_libs} ${host_tools}"
-AC_SUBST(host_configdirs)
-
-target_configdirs="${target_libs} ${target_tools}"
-AC_SUBST(target_configdirs)
-
-RTEMS_TARGET_CONFIG_PREPARE
-target_subdir=${target_alias}
-
-RTEMS_HOST_CONFIG_PREPARE
-host_subdir=${host_alias}
+RTEMS_HOST_CONFIG_SUBDIRS([tools/build])
+RTEMS_HOST_CONFIG_SUBDIRS([tools/cpu])
-if test $build = $host;
-then
- BUILD_SUBDIRS="$build_tools $host_configdirs"
-
- if test $build = $target;
- then
- BUILD_SUBDIRS="$BUILD_SUBDIRS $target_configdirs";
- else
- TARGET_SUBDIRS=`echo "$target_configdirs" | \
- sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
- fi
-else
-## If building Canadian cross, disable the target directories
- target_configdirs=""
- BUILD_SUBDIRS="$build_tools"
- TARGET_SUBDIRS=`echo "$host_configdirs" | \
- sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
+RTEMS_TARGET_CONFIG_SUBDIRS([c/make])
+if test x"$enable_multilib" = x"yes"; then
+RTEMS_TARGET_CONFIG_SUBDIRS([c/src/exec])
+# FIXME: Not yet
+# RTEMS_TARGET_CONFIG_SUBDIRS([c/src/lib])
fi
-
-AC_CONFIG_SUBDIRS($BUILD_SUBDIRS)
-AC_SUBST(TARGET_SUBDIRS)
-AC_SUBST(BUILD_SUBDIRS)
+RTEMS_TARGET_CONFIG_SUBDIRS([c])
AC_CONFIG_FILES([Makefile
tools/Makefile
@@ -119,7 +74,5 @@ make/custom/Makefile
make/Templates/Makefile
make/compilers/Makefile
doc/Makefile])
-AC_OUTPUT
-RTEMS_TARGET_CONFIG_SUBDIRS
-RTEMS_HOST_CONFIG_SUBDIRS
+AC_OUTPUT