source: rtems/c/src/aclocal/target.m4 @ 4778c6e0

4.11
Last change on this file since 4778c6e0 was 1756b781, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jun 1, 2008 at 9:02:21 AM

Allow emtpy RTEMS_BUILD_SUBDIRS.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1dnl $Id$
2
3## HACK: Work-around to structural issue with RTEMS
4## The macros below violate most autoconf and canonicalization standards
5AC_DEFUN([RTEMS_CONFIG_BUILD_SUBDIRS],
6[AC_REQUIRE([_RTEMS_OUTPUT_BUILD_SUBDIRS])
7RTEMS_BUILD_SUBDIRS="$RTEMS_BUILD_SUBDIRS [$1]"
8])
9
10dnl Derived from automake-1.4's AC_OUTPUT_SUBDIRS
11AC_DEFUN([_RTEMS_OUTPUT_BUILD_SUBDIRS],
12[AC_CONFIG_COMMANDS([bsp-tools],
13[
14# HACK: This is a blantant hack and breaks Canadian crosses
15build_alias="$build_alias"
16host_alias="$build_alias"
17if test "$no_recursion" != yes; then
18  if test x"$build_alias" != x"$host_alias"; then
19    target_subdir="$host_alias"
20  else
21    target_subdir="."
22  fi
23  RTEMS_CONFIGURE_ARGS_QUOTE([ac_sub_configure_args],
24    [
25    -host* | --host* ) ;;
26    --host ) ac_prev=host_alias;;
27    -target* | --target* ) ;;
28    -target ) ac_prev=target_alias ;;
29    -build* | --build* ) ;;
30    -build ) ac_prev_build_alias ;;
31    CFLAGS=* );; # HACK: Strip CFLAGS
32    *_alias=* ) ;; # HACK: Workaround to autoconf passing *_alias
33    ],
34    [rtems_configure_args])
35
36  for rtems_config_dir in : $RTEMS_BUILD_SUBDIRS; do test "x$rtems_config_dir" = x: && continue
37
38    # Do not complain, so a configure script can configure whichever
39    # parts of a large source tree are present.
40    if test ! -d $srcdir/$rtems_config_dir; then
41      continue
42    fi
43
44    _RTEMS_PUSH_BUILDDIR([$rtems_config_dir])
45
46    _RTEMS_SUB_SRCDIR([$rtems_config_dir])
47
48    # The recursion is here.
49    if test -n "$ac_sub_configure"; then
50#      ac_sub_cache_file=./config.cache
51      ac_sub_cache_file=/dev/null
52      _RTEMS_GIVEN_INSTALL
53
54      echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
55      # The eval makes quoting arguments work.
56      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
57        $ac_sub_configure_args \
58        --srcdir=$ac_sub_srcdir \
59        --with-target-subdir=$target_subdir \
60        --cache-file=$ac_sub_cache_file
61      then :
62      else
63        AC_MSG_ERROR([$ac_sub_configure failed for $rtems_config_dir])
64      fi
65    fi
66
67    _RTEMS_POP_BUILDDIR
68  done
69fi],
70[
71RTEMS_BUILD_SUBDIRS="$RTEMS_BUILD_SUBDIRS"
72rtems_configure_args="$ac_configure_args"
73])
74])
75
76dnl
77dnl Misc utility macros for subdir handling to work around missing abilities
78dnl in autoconf, automake and structural issues with RTEMS
79dnl
80dnl Contains parts derived from autoconf-2.13 AC_OUTPUT_SUBDIRS and Cygnus'
81dnl configure.in.
82dnl
83
84dnl
85dnl _RTEMS_PUSH_BUILDDIR(SUBDIR)
86dnl
87AC_DEFUN([_RTEMS_PUSH_BUILDDIR],
88[
89# _RTEMS_PUSH_BUILDDIR
90    echo configuring in $1
91    case "$srcdir" in
92    .) ;;
93    *) AS_MKDIR_P([$1])
94      ;;
95    esac
96
97    ac_popdir=`pwd`
98    cd $1
99])
100
101dnl
102dnl _RTEMS_POP_BUILDDIR
103dnl
104AC_DEFUN([_RTEMS_POP_BUILDDIR],
105[
106  cd "$ac_popdir"
107])
108
109dnl
110dnl _RTEMS_GIVEN_INSTALL
111dnl
112AC_DEFUN([_RTEMS_GIVEN_INSTALL],
113[
114ifdef([AC_PROVIDE_AC_PROG_INSTALL],[ 
115  case "$ac_given_INSTALL" in
116  [[\\/]]* | ?:[[\\/]]*) INSTALL="$ac_given_INSTALL" ;;
117  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
118  esac
119])dnl
120])
121
122dnl
123dnl _RTEMS_SUB_SRCDIR(AC_CONFIG_DIR[,TARGET_SUBDIR])
124dnl
125AC_DEFUN([_RTEMS_SUB_SRCDIR],[
126# _RTEMS_SUB_SRCDIR
127    _RTEMS_ADJUST_SRCDIR(ac_sub_srcdir,$1,$2)
128
129    # Check for configure
130    if test -f $ac_sub_srcdir/configure; then
131      ac_sub_configure=$ac_sub_srcdir/configure
132    else
133      AC_MSG_WARN([no configuration information is in $1])
134      ac_sub_configure=
135    fi
136])
Note: See TracBrowser for help on using the repository browser.