source: rtems/acinclude.m4 @ 7d9818c

Last change on this file since 7d9818c was 7d9818c, checked in by Ralf Corsepius <ralf.corsepius@…>, on Mar 13, 2003 at 11:03:53 AM

2003-03-13 Ralf Corsepius <corsepiu@…>

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