source: rtems/aclocal/subdirs.m4 @ ba748523

4.104.114.84.95
Last change on this file since ba748523 was ba748523, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 20, 2001 at 5:33:23 PM

2001-12-20 Ralf Corsepius <corsepiu@…>

  • 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.
  • Property mode set to 100644
File size: 11.3 KB
Line 
1## All tools belong in one of the 3 categories, and are assigned above.
2## ${HOST_CONFIGDIRS_LIST} is directories we build using the host tools.
3## ${TARGET_CONFIGDIRS_LIST} is directories we build using the target tools.
4## ${BUILD_CONFIGDIRS_LIST} is directories we build using the build tools
5
6
7dnl RTEMS_ARG_VAR(VAR,HELP-STRING)
8dnl An internal macros to have help strings pretty
9dnl printed with configure --help, without letting autoconf spoil config subdir
10dnl environments by trying to propagate them
11dnl Stripped down version of autoconf-2.52's AC_ARG_VAR.
12
13AC_DEFUN([_RTEMS_ARG_VAR],
14[
15m4_expand_once([m4_divert_once([HELP_VAR],
16[AC_HELP_STRING([$1], [$2], [              ])])],
17      [$0($1)])dnl
18])
19
20AC_DEFUN([_RTEMS_SUBST_IFNOT],
21[AS_IF([`echo " [$]$1 " | grep " $2 " > /dev/null`],
22  [],
23  [AC_SUBST([$1],["[$]$1 $2"])])
24])
25
26AC_DEFUN([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS],
27[
28AC_CONFIG_COMMANDS_PRE([
29_RTEMS_BUILD_CONFIG_PREPARE
30_RTEMS_HOST_CONFIG_PREPARE
31_RTEMS_TARGET_CONFIG_PREPARE
32
33if test $build = $host;
34then
35  if test $host = $target;
36  then
37    dnl b=h, h=t, t=b
38    BUILD_SUBDIRS="${build_configdirs}"
39    build_configdirs="${build_configdirs}"
40    HOST_SUBDIRS=""
41    host_configdirs=""
42    TARGET_SUBDIRS=""
43    target_configdirs=""
44  else
45    dnl b=h, h!=t, t!=b
46    BUILD_SUBDIRS="${build_configdirs}"
47    build_configdirs="${build_configdirs}"
48    HOST_SUBDIRS=""
49    host_configdirs=""
50    TARGET_SUBDIRS=`echo "${target_configdirs}" | \
51      sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
52    target_configdirs="${target_configdirs}"
53  fi
54else
55  if test $host = $target;
56  then
57    dnl b!=h, h=t, b!=t
58    BUILD_SUBDIRS="${build_configdirs}"
59    build_configdirs="${build_configdirs}"
60    HOST_SUBDIRS=`echo "${host_configdirs}" | \
61      sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
62    host_configdirs="${host_configdirs}"
63    TARGET_SUBDIRS=""
64    target_configdirs=""
65  else
66    if test $build = $target;
67    then
68    dnl b!=h, h!=t, b=t
69      BUILD_SUBDIRS="${build_configdirs}"
70      build_configdirs="${build_configdirs}"
71      HOST_SUBDIRS=`echo "${host_configdirs}" | \
72        sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
73      host_configdirs="${host_configdirs}"
74      TARGET_SUBDIRS=""
75      target_configdirs=""
76    else
77    dnl b!=h, h!=t, b!=t
78      BUILD_SUBDIRS="${build_configdirs}"
79      build_configdirs="${build_configdirs}"
80      HOST_SUBDIRS=`echo "${host_configdirs}" | \
81        sed -e "s%\([[^ ]][[^ ]]*\)%$host_alias/\1%g"`
82      host_configdirs="${host_configdirs}"
83      TARGET_SUBDIRS=`echo "${target_configdirs}" | \
84        sed -e "s%\([[^ ]][[^ ]]*\)%$target_alias/\1%g"`
85      target_configdirs="${target_configdirs}"
86    fi
87  fi
88fi
89
90AC_SUBST(HOST_SUBDIRS)
91AC_SUBST(TARGET_SUBDIRS)
92AC_SUBST(BUILD_SUBDIRS)
93])
94
95  AC_CONFIG_COMMANDS_POST([
96    _RTEMS_OUTPUT_SUBDIRS([build],[BUILD])
97    _RTEMS_OUTPUT_SUBDIRS([host],[HOST])
98    _RTEMS_OUTPUT_SUBDIRS([target],[TARGET])
99  ])
100])
101
102dnl _RTEMS_SRCPATHS(BUILD-DIR-NAME)
103dnl ----------------------------
104dnl Inputs:
105dnl   - BUILD-DIR-NAME is `top-build -> build' and `top-src -> src'
106dnl   - `$srcdir' is `top-build -> top-src'
107dnl
108dnl Outputs:
109dnl - `ac_builddir' is `.', for symmetry only.
110dnl - `ac_top_builddir' is `build -> top_build'.
111dnl      If not empty, has a trailing slash.
112dnl - `ac_srcdir' is `build -> src'.
113dnl - `ac_top_srcdir' is `build -> top-src'.
114dnl
115dnl and `ac_buildpath' etc., the absolute paths.
116m4_define([_RTEMS_SRCPATHS],
117[
118m4_if([$2],,
119[dstdir=$1],
120[case "$2" in
121"." | "" )      # No subdir was given
122  dstdir=$1;;
123* )             # A subdir was given
124  dstdir=$2/$1;;
125esac])
126ac_builddir=.
127
128if test $dstdir != .; then
129  # Strip off leading ./
130  ac_builddir_suffix=/`echo $dstdir | sed 's,^\.[[\\/]],,'`
131  ac_srcdir_suffix=/`echo $1 | sed 's,^\.[[\\/]],,'`
132  # A "../" for each directory in $ac_dir_suffix.
133  ac_top_builddir=`echo "$ac_builddir_suffix" | sed 's,/[[^\\/]]*,../,g'`
134else
135  ac_dir_suffix= ac_top_builddir=
136fi
137
138case $srcdir in
139  .)  # No --srcdir option.  We are building in place.
140    ac_srcdir=.
141    if test -z "$ac_top_builddir"; then
142       ac_top_srcdir=.
143    else
144       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
145    fi ;;
146  [[\\/]]* | ?:[[\\/]]* )  # Absolute path.
147    ac_srcdir=$srcdir$ac_srcdir_suffix;
148    ac_top_srcdir=$srcdir;
149    ;;
150  *) # Relative path.
151    ac_srcdir=$ac_top_builddir$srcdir$ac_srcdir_suffix;
152    ac_top_srcdir=$ac_top_builddir$srcdir;
153    ;;
154esac
155dnl Don't blindly perform a `cd $1/$ac_foo && pwd` since $ac_foo can be
156dnl absolute.
157
158ac_buildpath=`cd $dstdir && cd $ac_builddir && pwd`
159ac_top_buildpath=`cd $dstdir && cd $ac_top_builddir && pwd`
160ac_srcpath=`cd $dstdir && cd $ac_srcdir && pwd`
161ac_top_srcpath=`cd $dstdir && cd $ac_top_srcdir && pwd`
162])# _AC_SRCPATHS
163
164dnl _RTEMS_OUTPUT_SUBDIRS([host|target|build],[HOST|TARGET|BUILD])
165AC_DEFUN([_RTEMS_OUTPUT_SUBDIRS],[
166m4_ifdef([_RTEMS_$2_CONFIGDIRS_LIST],
167[
168_RTEMS_ARG_VAR([CC_FOR_$2],
169  [c-compiler to be used for $1 subdirs (default: auto-detected)])
170if test "$no_recursion" != yes; then
171
172 if test -n "${$2_SUBDIRS}"; then
173  ac_sub_configure_args=
174  ac_prev=
175  for ac_arg in $$1args; do
176    if test -n "$ac_prev"; then
177      ac_prev=
178      continue
179    fi
180    case $ac_arg in
181    -cache-file | --cache-file | --cache-fil | --cache-fi \
182    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
183      ac_prev=cache_file ;;
184    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
185    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
186    | --c=*)
187      ;;
188    --config-cache | -C)
189      ;;
190    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
191      ac_prev=srcdir ;;
192    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
193      ;;
194    -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
195      ac_prev=prefix ;;
196    -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
197      ;;
198    *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
199    esac
200  done
201
202  case "$$1_subdir" in
203  "." ) ;;
204  * )
205    ac_sub_configure_args="$ac_sub_configure_args --with-target-subdir=$$1_subdir --exec-prefix=\${prefix}/$$1_subdir"
206    ;;
207  esac
208
209  # make sure that $1_subdir is not empty
210  test -n "$$1_subdir" || $1_subdir="."
211
212  ac_popdir=`pwd`
213  for ac_dir in $$1_configdirs; do
214
215    # Do not complain, so a configure script can configure whichever
216    # parts of a large source tree are present.
217    test -d $srcdir/$ac_dir || continue
218
219    AC_MSG_NOTICE([configuring in $$1_subdir/$ac_dir])
220    AS_MKDIR_P(["$$1_subdir/$ac_dir"])
221    _RTEMS_SRCPATHS(["$ac_dir"],["$$1_subdir"])
222
223    cd $$1_subdir/$ac_dir
224
225    # Check for guested configure; otherwise get Cygnus style configure.
226    if test -f $ac_srcdir/configure.gnu; then
227      ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'"
228    elif test -f $ac_srcdir/configure; then
229      ac_sub_configure="$SHELL '$ac_srcdir/configure'"
230    elif test -f $ac_srcdir/configure.in; then
231      ac_sub_configure=$ac_configure
232    else
233      AC_MSG_WARN([no configuration information is in $ac_dir])
234      ac_sub_configure=
235    fi
236
237    # The recursion is here.
238    if test -n "$ac_sub_configure"; then
239      # Make the cache file name correct relative to the subdirectory.
240      case $cache_file in
241      [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
242      *) # Relative path.
243        ac_sub_cache_file=$ac_top_builddir$cache_file ;;
244      esac
245
246      AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args \
247           --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
248      # The eval makes quoting arguments work.
249      eval CC=[$]CC_FOR_$2 \
250        $ac_sub_configure $ac_sub_configure_args \
251          --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
252        AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
253    fi
254
255    cd $ac_popdir
256  done
257 fi
258fi
259])
260])
261
262## PUBLIC: RTEMS_BUILD_CONFIG_SUBDIRS(build_subdir)
263# tools to be built for the build environment
264AC_DEFUN([RTEMS_BUILD_CONFIG_SUBDIRS],[
265m4_append([_RTEMS_BUILD_CONFIGDIRS_LIST],[ $1])
266dnl Always append to build_configdirs
267AC_SUBST(build_configdirs,"$build_configdirs $1")
268
269m4_divert_text([DEFAULTS],
270               [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
271m4_expand_once([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS])
272])
273
274AC_DEFUN(_RTEMS_BUILD_CONFIG_PREPARE,[
275# Record the configure arguments in Makefile.
276m4_ifdef([_RTEMS_BUILD_CONFIGDIRS_LIST],
277[
278buildargs=`echo "${ac_configure_args}" | \
279        sed -e 's/--no[[^       ]]*//' \
280            -e 's/--cache[[a-z-]]*=[[^  ]]*//' \
281            -e 's/--ho[[a-z-]]*=[[^     ]]*//' \
282            -e 's/--bu[[a-z-]]*=[[^     ]]*//' \
283            -e 's/--ta[[a-z-]]*=[[^     ]]*//' \
284            -e 's/[[^   ]]*alias=[[^    ]]*//g'` ;
285
286buildargs="--host=${build} --build=${build} --target=${target_alias} ${buildargs}"
287AC_SUBST(buildargs)
288
289build_subdir="."
290],[])
291])
292
293## PUBLIC: RTEMS_HOST_CONFIG_SUBDIR(host_subdir)
294# libraries to be build for the host environment
295AC_DEFUN([RTEMS_HOST_CONFIG_SUBDIRS],[
296m4_append([_RTEMS_HOST_CONFIGDIRS_LIST],[ $1])dnl
297
298if test $build = $host;
299then
300  if test $host = $target;
301  then
302    _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
303  else
304    _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
305  fi
306else
307  if test $host = $target;
308  then
309    _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
310  else
311    if test $build = $target;
312    then
313      _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
314    else
315      _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
316    fi
317  fi
318fi
319
320m4_divert_text([DEFAULTS],
321               [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
322m4_expand_once([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS])
323])
324
325AC_DEFUN(_RTEMS_HOST_CONFIG_PREPARE,[
326m4_ifdef([_RTEMS_HOST_CONFIGDIRS_LIST],
327[
328# Record configure arguments in Makefile.
329hostargs=`echo "${ac_configure_args}" | \
330        sed -e 's/--no[[^       ]]*//' \
331            -e 's/--cache[[a-z-]]*=[[^  ]]*//' \
332            -e 's/--ho[[a-z-]]*=[[^     ]]*//' \
333            -e 's/--bu[[a-z-]]*=[[^     ]]*//' \
334            -e 's/--ta[[a-z-]]*=[[^     ]]*//' \
335            -e 's/[[^   ]]*alias=[[^    ]]*//g'` ;
336
337hostargs="--host=${host_alias} --build=${build} --target=${target_alias} ${hostargs}"
338AC_SUBST(hostargs)
339
340host_subdir="${host_alias}"
341],[])
342])
343
344## PUBLIC: RTEMS_TARGET(target_subdir)
345# tools to be build for the target environment
346AC_DEFUN([RTEMS_TARGET_CONFIG_SUBDIRS],[
347m4_append([_RTEMS_TARGET_CONFIGDIRS_LIST],[ $1])
348
349if test $build = $host;
350then
351  if test $host = $target;
352  then
353    _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
354  else
355    _RTEMS_SUBST_IFNOT([target_configdirs],[$1])
356  fi
357else
358  if test $host = $target;
359  then
360    _RTEMS_SUBST_IFNOT([host_configdirs],[$1])
361  else
362    if test $build = $target;
363    then
364      _RTEMS_SUBST_IFNOT([build_configdirs],[$1])
365    else
366      _RTEMS_SUBST_IFNOT([target_configdirs],[$1])
367    fi
368  fi
369fi
370
371m4_divert_text([DEFAULTS],
372               [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
373m4_expand_once([_RTEMS_COMMANDS_POST_CONFIG_SUBDIRS])
374])
375
376AC_DEFUN(_RTEMS_TARGET_CONFIG_PREPARE,[
377m4_ifdef([_RTEMS_TARGET_CONFIGDIRS_LIST],
378[
379# Record the configure arguments in Makefile.
380targetargs=`echo "${ac_configure_args}" | \
381        sed -e 's/--no[[^       ]]*//' \
382            -e 's/--cache[[a-z-]]*=[[^  ]]*//' \
383            -e 's/--ho[[a-z-]]*=[[^     ]]*//' \
384            -e 's/--bu[[a-z-]]*=[[^     ]]*//' \
385            -e 's/--ta[[a-z-]]*=[[^     ]]*//' \
386            -e 's/[[^   ]]*alias=[[^    ]]*//g'` ;
387
388targetargs="--host=${target_alias} --build=${build} --target=${target_alias} ${targetargs}"
389AC_SUBST(targetargs)
390
391target_subdir="${target_alias}"
392],[])
393])
Note: See TracBrowser for help on using the repository browser.