source: rtems/aclocal/config-subdirs.m4 @ a86c171

4.104.114.84.95
Last change on this file since a86c171 was a86c171, checked in by Joel Sherrill <joel.sherrill@…>, on 05/24/01 at 20:01:10

2001-05-16 Ralf Corsepius <corsepiu@…>

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