source: rtems/aclocal/config-subdirs.m4 @ 37b5d78

4.104.114.84.95
Last change on this file since 37b5d78 was 37b5d78, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 14, 2001 at 5:30:22 PM

2001-09-14 Ralf Corsepius <corsepiu@…>

  • aclocal/canonical-target-name.m4: Use AC_CANONICAL_TARGET instead of AC_CANONICAL_SYSTEM.
  • aclocal/config-subdirs.m4: Use AS_MKDIR_P instead of mkinstalldirs and mkdir.
  • aclocal/target.m4: Obsolete RTEMS_OUTPUT_BUILD_SUBDIRS, hack RTEMS_CONFIG_BUILD_SUBDIRS, introduce _RTEMS_OUTPUT_BUILD_SUBDIRS.
  • Property mode set to 100644
File size: 6.2 KB
Line 
1dnl $Id$
2
3dnl
4dnl Misc utility macros for subdir handling to work around missing abilities
5dnl in autoconf, automake and structural issues with RTEMS
6dnl
7dnl Contains parts derived from autoconf-2.13 AC_OUTPUT_SUBDIRS and Cygnus'
8dnl configure.in.
9dnl
10
11dnl
12dnl _RTEMS_PUSH_BUILDDIR(SUBDIR)
13dnl
14AC_DEFUN(_RTEMS_PUSH_BUILDDIR,
15[
16# _RTEMS_PUSH_BUILDDIR
17    echo configuring in $1
18    case "$srcdir" in
19    .) ;;
20    *) AS_MKDIR_P([$1])
21      ;;
22    esac
23
24    ac_popdir=`pwd`
25    cd $1
26])
27
28dnl
29dnl _RTEMS_POP_BUILDDIR
30dnl
31AC_DEFUN(_RTEMS_POP_BUILDDIR,
32[
33  cd $ac_popdir
34])
35
36dnl
37dnl _RTEMS_GIVEN_INSTALL
38dnl
39AC_DEFUN(_RTEMS_GIVEN_INSTALL,
40[
41ifdef([AC_PROVIDE_AC_PROG_INSTALL],[ 
42  case "$ac_given_INSTALL" in
43  [[\\/]]* | ?:[[\\/]]*) INSTALL="$ac_given_INSTALL" ;;
44  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
45  esac
46])dnl
47])
48
49dnl
50dnl _AC_DOTS(PATH)
51dnl
52AC_DEFUN(_AC_DOTS,[
53# A "../" for each directory in $1.
54    ac_dots=`echo $1 | \
55             sed -e 's%^\./%%' -e 's%[[^/]]$%&/%' -e 's%[[^/]]*/%../%g'`
56])
57
58dnl
59dnl _RTEMS_ADJUST_SRCDIR(REVAR,CONFIG_DIR[,TARGET_SUBDIR])
60dnl
61AC_DEFUN(_RTEMS_ADJUST_SRCDIR,[
62    _AC_DOTS(ifelse([$3], ,[$2],[$3/$2]))
63
64    case "$srcdir" in
65    .) # No --srcdir option.  We are building in place.
66      $1=$srcdir ;;
67    [[\\/]]* | ?:[[\\/]]*) # Absolute path.
68      $1=$srcdir/$2 ;;
69    *) # Relative path.
70      $1=$ac_dots$srcdir/$2 ;;
71    esac
72])
73
74dnl
75dnl _RTEMS_SUB_SRCDIR(AC_CONFIG_DIR[,TARGET_SUBDIR])
76dnl
77AC_DEFUN(_RTEMS_SUB_SRCDIR,[
78# _RTEMS_SUB_SRCDIR
79    _RTEMS_ADJUST_SRCDIR(ac_sub_srcdir,$1,$2)
80
81    # Check for configure
82    if test -f $ac_sub_srcdir/configure; then
83      ac_sub_configure=$ac_sub_srcdir/configure
84    else
85      AC_MSG_WARN([no configuration information is in $1])
86      ac_sub_configure=
87    fi
88])
89
90AC_DEFUN(RTEMS_TARGET_CONFIG_PREPARE,[
91# Record target_configdirs and the configure arguments in Makefile.
92targargs=`echo "${ac_configure_args}" | \
93        sed -e 's/--no[[^       ]]*//' \
94            -e 's/--cache[[a-z-]]*=[[^  ]]*//' \
95            -e 's/--ho[[a-z-]]*=[[^     ]]*//' \
96            -e 's/--bu[[a-z-]]*=[[^     ]]*//' \
97            -e 's/--ta[[a-z-]]*=[[^     ]]*//'`;
98
99targargs="--host=${target_alias} --build=${build} ${targargs}"
100AC_SUBST(targargs)
101])
102
103AC_DEFUN(RTEMS_TARGET_CONFIG_SUBDIRS,[
104#
105# TARGET_CONFIG_SUBDIRS
106#
107if test "$no_recursion" != yes; then
108 if test $target != $build; then
109  # Remove --srcdir arguments so they do not pile up.
110  ac_sub_configure_args=
111  ac_prev=
112  for ac_arg in $targargs; do
113    if test -n "$ac_prev"; then
114      ac_prev=
115      continue
116    fi
117    case "$ac_arg" in
118    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
119      ac_prev=srcdir ;;
120    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
121      ;;
122    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
123    esac
124  done
125
126  if test -n "$target_configdirs" && test -d $target_subdir;
127  then :;
128  else
129    AS_MKDIR_P(["$target_subdir"])
130  fi
131
132  for ac_config_dir in $target_configdirs; do
133    # Do not complain, so a configure script can configure whichever
134    # parts of a large source tree are present.
135    if test ! -d $srcdir/$ac_config_dir; then
136      continue
137    fi
138
139    _RTEMS_PUSH_BUILDDIR([$target_subdir/$ac_config_dir])
140
141    _RTEMS_SUB_SRCDIR([$ac_config_dir],[$target_subdir])
142
143    # The recursion is here.
144    if test -n "$ac_sub_configure"; then
145
146      # Make the cache file name correct relative to the subdirectory.
147      ac_sub_cache_file=$cache_file
148      _RTEMS_GIVEN_INSTALL
149
150      echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
151      # The eval makes quoting arguments work.
152      CC=${CC_FOR_TARGET}; export CC;
153      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
154        $ac_sub_configure_args --srcdir=$ac_sub_srcdir \
155        --with-target-subdir=$target_subdir \
156        --cache-file=$ac_sub_cache_file \
157        --exec-prefix="\${prefix}/$target_subdir"
158      then :
159      else
160        AC_MSG_ERROR([$ac_sub_configure failed for $ac_config_dir])
161      fi
162    fi
163
164    _RTEMS_POP_BUILDDIR
165  done
166 fi
167fi
168])
169
170AC_DEFUN(RTEMS_HOST_CONFIG_PREPARE,[
171# Record host_configdirs and the configure arguments in Makefile.
172hostargs=`echo "${ac_configure_args}" | \
173        sed -e 's/--no[[^       ]]*//' \
174            -e 's/--cache[[a-z-]]*=[[^  ]]*//' \
175            -e 's/--ho[[a-z-]]*=[[^     ]]*//' \
176            -e 's/--bu[[a-z-]]*=[[^     ]]*//' \
177            -e 's/--ta[[a-z-]]*=[[^     ]]*//'`;
178
179hostargs="--host=${host_alias} --build=${build} --target=${target_alias} ${hostargs}"
180AC_SUBST(hostargs)
181])
182
183AC_DEFUN(RTEMS_HOST_CONFIG_SUBDIRS,[
184#
185# HOST_CONFIG_SUBDIRS
186#
187if test "$no_recursion" != yes; then
188
189 if test $build != $host; then
190  # Remove --srcdir arguments so they do not pile up.
191  ac_sub_configure_args=
192  ac_prev=
193  for ac_arg in $hostargs; do
194    if test -n "$ac_prev"; then
195      ac_prev=
196      continue
197    fi
198    case "$ac_arg" in
199    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
200      ac_prev=srcdir ;;
201    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
202      ;;
203    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
204    esac
205  done
206
207  if test -n "$host_configdirs" && test -d $host_subdir;
208  then :;
209  else
210    AS_MKDIR_P(["$host_subdir"])
211  fi
212
213  for ac_config_dir in $host_configdirs; do
214    # Do not complain, so a configure script can configure whichever
215    # parts of a large source tree are present.
216    if test ! -d $srcdir/$ac_config_dir; then
217      continue
218    fi
219
220    _RTEMS_PUSH_BUILDDIR([$host_subdir/$ac_config_dir])
221
222    _RTEMS_SUB_SRCDIR([$ac_config_dir],[$host_subdir])
223
224    # The recursion is here.
225    if test -n "$ac_sub_configure"; then
226
227      # Make the cache file name correct relative to the subdirectory.
228      ac_sub_cache_file=$cache_file
229      _RTEMS_GIVEN_INSTALL
230
231      echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir"
232      CC=${CC_FOR_HOST-$host_alias-gcc}; export CC;
233      # The eval makes quoting arguments work.
234      if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure \
235        $ac_sub_configure_args --srcdir=$ac_sub_srcdir \
236        --with-target-subdir=$host_subdir \
237        --cache-file=$ac_sub_cache_file
238      then :
239      else
240        AC_MSG_ERROR([$ac_sub_configure failed for $ac_config_dir])
241      fi
242    fi
243
244    _RTEMS_POP_BUILDDIR
245  done
246 fi
247fi
248])
Note: See TracBrowser for help on using the repository browser.