source: rtems/acinclude.m4 @ a77cd066

4.104.114.84.95
Last change on this file since a77cd066 was 3959276e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/26/03 at 05:32:03

2003-11-26 Ralf Corsepius <corsepiu@…>

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