Commit | Line | Data |
---|---|---|
d747cac4 DE |
1 | # Configure fragment invoked in the post-target section for subdirs |
2 | # wanting multilib support. | |
3 | # | |
4 | # It is advisable to support a few --enable/--disable options to let the | |
5 | # user select which libraries s/he really wants. | |
6 | # | |
7 | # Subdirectories wishing to use multilib should put the following lines | |
8 | # in the "post-target" section of configure.in. | |
9 | # | |
10 | # if [ "${srcdir}" = "." ] ; then | |
11 | # if [ "${with_target_subdir}" != "." ] ; then | |
953fbd65 | 12 | # . ${with_multisrctop}../../config-ml.in |
d747cac4 | 13 | # else |
953fbd65 | 14 | # . ${with_multisrctop}../config-ml.in |
d747cac4 DE |
15 | # fi |
16 | # else | |
17 | # . ${srcdir}/../config-ml.in | |
18 | # fi | |
19 | # | |
20 | # See librx/configure.in in the libg++ distribution for an example of how | |
21 | # to handle autoconf'd libraries. | |
22 | # | |
23 | # Things are complicated because 6 separate cases must be handled: | |
24 | # 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6. | |
25 | # | |
26 | # srcdir=. is special. It must handle make programs that don't handle VPATH. | |
27 | # To implement this, a symlink tree is built for each library and for each | |
28 | # multilib subdir. | |
29 | # | |
30 | # The build tree is layed out as | |
31 | # | |
32 | # ./ | |
33 | # libg++ | |
34 | # newlib | |
35 | # m68020/ | |
36 | # libg++ | |
37 | # newlib | |
38 | # m68881/ | |
39 | # libg++ | |
40 | # newlib | |
41 | # | |
42 | # The nice feature about this arrangement is that inter-library references | |
43 | # in the build tree work without having to care where you are. Note that | |
44 | # inter-library references also work in the source tree because symlink trees | |
45 | # are built when srcdir=. | |
46 | # | |
953fbd65 DE |
47 | # Unfortunately, trying to access the libraries in the build tree requires |
48 | # the user to manually choose which library to use as GCC won't be able to | |
49 | # find the right one. This is viewed as the lesser of two evils. | |
50 | # | |
d747cac4 DE |
51 | # Configure variables: |
52 | # ${with_target_subdir} = "." for native, or ${target_alias} for cross. | |
53 | # Set by top level Makefile. | |
54 | # ${with_multisrctop} = how many levels of multilibs there are in the source | |
55 | # tree. It exists to handle the case of configuring in the source tree: | |
56 | # ${srcdir} is not constant. | |
57 | # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881). | |
58 | # | |
59 | # Makefile variables: | |
60 | # MULTISRCTOP = number of multilib levels in source tree (+1 if cross) | |
953fbd65 DE |
61 | # (FIXME: note that this is different than ${with_multisrctop}. Check out.). |
62 | # MULTIBUILDTOP = number of multilib levels in build tree | |
d747cac4 DE |
63 | # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...) |
64 | # (only defined in each library's main Makefile). | |
65 | # MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000) | |
66 | # (only defined in each multilib subdir). | |
67 | ||
68 | # FIXME: Multilib is currently disabled by default for everything other than | |
69 | # newlib. It is up to each target to turn on multilib support for the other | |
70 | # libraries as desired. | |
71 | ||
72 | # We have to handle being invoked by both Cygnus configure and Autoconf. | |
953fbd65 DE |
73 | # |
74 | # Cygnus configure incoming variables: | |
75 | # srcdir, subdir, target, arguments | |
76 | # | |
77 | # Autoconf incoming variables: | |
78 | # srcdir, target, ac_configure_args | |
79 | # | |
80 | # We *could* figure srcdir and target out, but we'd have to do work that | |
81 | # our caller has already done to figure them out and requiring these two | |
82 | # seems reasonable. | |
d747cac4 DE |
83 | |
84 | if [ -n "${ac_configure_args}" ]; then | |
85 | Makefile=${ac_file-Makefile} | |
2a59259c DE |
86 | ml_config_shell=${CONFIG_SHELL-/bin/sh} |
87 | ml_arguments="${ac_configure_args}" | |
953fbd65 | 88 | ml_realsrcdir=${srcdir} |
d747cac4 DE |
89 | else |
90 | Makefile=${Makefile-Makefile} | |
2a59259c DE |
91 | ml_config_shell=${config_shell-/bin/sh} |
92 | ml_arguments="${arguments}" | |
953fbd65 DE |
93 | if [ -n "${subdir}" -a "${subdir}" != "." ] ; then |
94 | ml_realsrcdir=${srcdir}/${subdir} | |
95 | else | |
96 | ml_realsrcdir=${srcdir} | |
97 | fi | |
d747cac4 DE |
98 | fi |
99 | ||
100 | # Scan all the arguments and set all the ones we need. | |
101 | ||
2a59259c | 102 | for option in ${ml_arguments} |
d747cac4 DE |
103 | do |
104 | case $option in | |
105 | --*) ;; | |
106 | -*) option=-$option ;; | |
107 | esac | |
108 | ||
109 | case $option in | |
110 | --*=*) | |
111 | optarg=`echo $option | sed -e 's/^[^=]*=//'` | |
112 | ;; | |
113 | esac | |
114 | ||
115 | case $option in | |
116 | --disable-*) | |
117 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` | |
118 | eval $enableopt=no | |
119 | ;; | |
120 | --enable-*) | |
121 | case "$option" in | |
122 | *=*) ;; | |
123 | *) optarg=yes ;; | |
124 | esac | |
125 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
126 | eval $enableopt="$optarg" | |
127 | ;; | |
128 | --norecursion | --no*) | |
2a59259c | 129 | ml_norecursion=yes |
d747cac4 DE |
130 | ;; |
131 | --verbose | --v | --verb*) | |
2a59259c | 132 | ml_verbose=--verbose |
d747cac4 DE |
133 | ;; |
134 | --with-*) | |
135 | case "$option" in | |
136 | *=*) ;; | |
137 | *) optarg=yes ;; | |
138 | esac | |
139 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
140 | eval $withopt="$optarg" | |
141 | ;; | |
142 | --without-*) | |
143 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` | |
144 | eval $withopt=no | |
145 | ;; | |
146 | esac | |
147 | done | |
148 | ||
149 | # Only do this if --enable-multilib. | |
150 | if [ "${enable_multilib}" = yes ]; then | |
151 | ||
152 | # Compute whether this is the library's top level directory | |
153 | # (ie: not a multilib subdirectory, and not a subdirectory like libg++/src). | |
154 | # ${with_multisubdir} tells us we're in the right branch, but we could be | |
155 | # in a subdir of that. | |
156 | # ??? The previous version could void this test by separating the process into | |
157 | # two files: one that only the library's toplevel configure.in ran (to | |
158 | # configure the multilib subdirs), and another that all configure.in's ran to | |
159 | # update the Makefile. It seemed reasonable to collapse all multilib support | |
160 | # into one file, but it does leave us with having to perform this test. | |
161 | ml_toplevel_p=no | |
162 | if [ -z "${with_multisubdir}" ]; then | |
163 | if [ "${srcdir}" = "." ]; then | |
953fbd65 | 164 | # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. |
d747cac4 DE |
165 | # ${with_target_subdir} = "." for native, otherwise target alias. |
166 | if [ "${with_target_subdir}" = "." ]; then | |
953fbd65 | 167 | if [ -f ${ml_realsrcdir}/../config-ml.in ]; then |
d747cac4 DE |
168 | ml_toplevel_p=yes |
169 | fi | |
170 | else | |
953fbd65 | 171 | if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then |
d747cac4 DE |
172 | ml_toplevel_p=yes |
173 | fi | |
174 | fi | |
175 | else | |
953fbd65 DE |
176 | # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. |
177 | if [ -f ${ml_realsrcdir}/../config-ml.in ]; then | |
d747cac4 DE |
178 | ml_toplevel_p=yes |
179 | fi | |
180 | fi | |
181 | fi | |
182 | ||
183 | # If this is the library's top level directory, set multidirs to the | |
184 | # multilib subdirs to support. This lives at the top because we need | |
d1265690 | 185 | # `multidirs' set right away. |
d747cac4 DE |
186 | |
187 | if [ "${ml_toplevel_p}" = yes ]; then | |
188 | ||
d1265690 MM |
189 | multidirs= |
190 | for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do | |
191 | dir=`echo $i | sed -e 's/;.*$//'` | |
192 | if [ "${dir}" = "." ]; then | |
193 | true | |
194 | else | |
195 | if [ -z "${multidirs}" ]; then | |
196 | multidirs="${dir}" | |
197 | else | |
198 | multidirs="${multidirs} ${dir}" | |
199 | fi | |
200 | fi | |
201 | done | |
202 | ||
d747cac4 | 203 | case "${target}" in |
3130a391 | 204 | arc-*-elf*) |
d1265690 | 205 | if [ x$enable_biendian != xyes ] |
d747cac4 | 206 | then |
d1265690 | 207 | old_multidirs=${multidirs} |
3130a391 | 208 | multidirs="" |
d747cac4 | 209 | for x in ${old_multidirs}; do |
d1265690 | 210 | case "${x}" in |
3130a391 NC |
211 | *be*) : ;; |
212 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
213 | esac |
214 | done | |
215 | fi | |
d1265690 | 216 | ;; |
3130a391 NC |
217 | m32r-*-*) |
218 | if [ x$enable_m32rx = xno ] | |
219 | then | |
220 | old_multidirs=${multidirs} | |
221 | multidirs="" | |
222 | for x in ${old_multidirs}; do | |
223 | case "${x}" in | |
224 | *m32rx*) : ;; | |
225 | *) multidirs="${multidirs} ${x}" ;; | |
226 | esac | |
227 | done | |
228 | fi | |
229 | ;; | |
230 | m68*-*-*) | |
231 | if [ x$enable_softfloat = xno ] | |
d747cac4 DE |
232 | then |
233 | old_multidirs="${multidirs}" | |
234 | multidirs="" | |
235 | for x in ${old_multidirs}; do | |
236 | case "$x" in | |
3130a391 NC |
237 | *soft-float* ) : ;; |
238 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
239 | esac |
240 | done | |
241 | fi | |
3130a391 | 242 | if [ x$enable_m68881 = xno ] |
d747cac4 DE |
243 | then |
244 | old_multidirs="${multidirs}" | |
245 | multidirs="" | |
246 | for x in ${old_multidirs}; do | |
247 | case "$x" in | |
3130a391 NC |
248 | *m68881* ) : ;; |
249 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
250 | esac |
251 | done | |
252 | fi | |
3130a391 | 253 | if [ x$enable_m68000 = xno ] |
d747cac4 DE |
254 | then |
255 | old_multidirs="${multidirs}" | |
256 | multidirs="" | |
257 | for x in ${old_multidirs}; do | |
258 | case "$x" in | |
3130a391 NC |
259 | *m68000* ) : ;; |
260 | *) multidirs="${multidirs} ${x}" ;; | |
261 | esac | |
262 | done | |
263 | fi | |
264 | if [ x$enable_m68020 = xno ] | |
265 | then | |
266 | old_multidirs="${multidirs}" | |
267 | multidirs="" | |
268 | for x in ${old_multidirs}; do | |
269 | case "$x" in | |
270 | *m68020* ) : ;; | |
271 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
272 | esac |
273 | done | |
274 | fi | |
275 | ;; | |
3130a391 NC |
276 | mips*-*-*) |
277 | if [ x$enable_single_float = xno ] | |
d747cac4 DE |
278 | then |
279 | old_multidirs="${multidirs}" | |
280 | multidirs="" | |
281 | for x in ${old_multidirs}; do | |
282 | case "$x" in | |
3130a391 NC |
283 | *single* ) : ;; |
284 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
285 | esac |
286 | done | |
287 | fi | |
3130a391 | 288 | if [ x$enable_biendian = xno ] |
d747cac4 DE |
289 | then |
290 | old_multidirs="${multidirs}" | |
291 | multidirs="" | |
292 | for x in ${old_multidirs}; do | |
293 | case "$x" in | |
3130a391 NC |
294 | *el* ) : ;; |
295 | *eb* ) : ;; | |
296 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
297 | esac |
298 | done | |
299 | fi | |
3130a391 | 300 | if [ x$enable_softfloat = xno ] |
d747cac4 DE |
301 | then |
302 | old_multidirs="${multidirs}" | |
303 | multidirs="" | |
304 | for x in ${old_multidirs}; do | |
305 | case "$x" in | |
3130a391 NC |
306 | *soft-float* ) : ;; |
307 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
308 | esac |
309 | done | |
310 | fi | |
3130a391 NC |
311 | ;; |
312 | powerpc*-*-* | rs6000*-*-*) | |
313 | if [ x$enable_softfloat = xno ] | |
d747cac4 DE |
314 | then |
315 | old_multidirs="${multidirs}" | |
316 | multidirs="" | |
317 | for x in ${old_multidirs}; do | |
318 | case "$x" in | |
3130a391 NC |
319 | *soft-float* ) : ;; |
320 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
321 | esac |
322 | done | |
323 | fi | |
3130a391 | 324 | if [ x$enable_powercpu = xno ] |
d747cac4 DE |
325 | then |
326 | old_multidirs="${multidirs}" | |
327 | multidirs="" | |
328 | for x in ${old_multidirs}; do | |
329 | case "$x" in | |
3130a391 NC |
330 | power | */power | */power/* ) : ;; |
331 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
332 | esac |
333 | done | |
334 | fi | |
3130a391 | 335 | if [ x$enable_powerpccpu = xno ] |
d747cac4 DE |
336 | then |
337 | old_multidirs="${multidirs}" | |
338 | multidirs="" | |
339 | for x in ${old_multidirs}; do | |
340 | case "$x" in | |
3130a391 NC |
341 | *powerpc* ) : ;; |
342 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
343 | esac |
344 | done | |
345 | fi | |
3130a391 | 346 | if [ x$enable_powerpcos = xno ] |
d747cac4 DE |
347 | then |
348 | old_multidirs="${multidirs}" | |
349 | multidirs="" | |
350 | for x in ${old_multidirs}; do | |
351 | case "$x" in | |
3130a391 NC |
352 | *mcall-linux* | *mcall-solaris* ) : ;; |
353 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
354 | esac |
355 | done | |
356 | fi | |
3130a391 | 357 | if [ x$enable_biendian = xno ] |
d747cac4 DE |
358 | then |
359 | old_multidirs="${multidirs}" | |
360 | multidirs="" | |
361 | for x in ${old_multidirs}; do | |
362 | case "$x" in | |
3130a391 NC |
363 | *mlittle* | *mbig* ) : ;; |
364 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
365 | esac |
366 | done | |
367 | fi | |
d1265690 | 368 | if [ x$enable_sysv = xno ] |
d747cac4 DE |
369 | then |
370 | old_multidirs="${multidirs}" | |
371 | multidirs="" | |
372 | for x in ${old_multidirs}; do | |
373 | case "$x" in | |
3130a391 NC |
374 | *mcall-sysv* ) : ;; |
375 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
376 | esac |
377 | done | |
378 | fi | |
379 | if [ x$enable_aix = xno ] | |
380 | then | |
381 | old_multidirs="${multidirs}" | |
382 | multidirs="" | |
383 | for x in ${old_multidirs}; do | |
384 | case "$x" in | |
3130a391 NC |
385 | *mcall-aix* ) : ;; |
386 | *) multidirs="${multidirs} ${x}" ;; | |
d747cac4 DE |
387 | esac |
388 | done | |
389 | fi | |
390 | ;; | |
d747cac4 DE |
391 | esac |
392 | ||
3130a391 NC |
393 | # Remove extraneous blanks from multidirs. |
394 | # Tests like `if [ -n "$multidirs" ]' require it. | |
395 | multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'` | |
396 | ||
d747cac4 DE |
397 | # Add code to library's top level makefile to handle building the multilib |
398 | # subdirs. | |
399 | ||
400 | cat > Multi.tem <<\EOF | |
401 | ||
402 | # FIXME: There should be an @-sign in front of the `if'. | |
403 | # Leave out until this is tested a bit more. | |
404 | multi-do: | |
405 | if [ -z "$(MULTIDIRS)" ]; then \ | |
406 | true; \ | |
407 | else \ | |
408 | rootpre=`pwd`/; export rootpre; \ | |
409 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ | |
410 | lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ | |
411 | compiler="$(CC)"; \ | |
412 | for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ | |
413 | dir=`echo $$i | sed -e 's/;.*$$//'`; \ | |
414 | if [ "$${dir}" = "." ]; then \ | |
415 | true; \ | |
416 | else \ | |
417 | if [ -d ../$${dir}/$${lib} ]; then \ | |
418 | flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ | |
419 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ | |
420 | CFLAGS="$(CFLAGS) $${flags}" \ | |
421 | CXXFLAGS="$(CXXFLAGS) $${flags}" \ | |
422 | LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ | |
423 | LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ | |
424 | $(DO)); then \ | |
425 | true; \ | |
426 | else \ | |
427 | exit 1; \ | |
428 | fi; \ | |
429 | else true; \ | |
430 | fi; \ | |
431 | fi; \ | |
432 | done; \ | |
433 | fi | |
434 | ||
435 | # FIXME: There should be an @-sign in front of the `if'. | |
436 | # Leave out until this is tested a bit more. | |
437 | multi-clean: | |
438 | if [ -z "$(MULTIDIRS)" ]; then \ | |
439 | true; \ | |
440 | else \ | |
d1265690 | 441 | lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ |
d747cac4 DE |
442 | for dir in Makefile $(MULTIDIRS); do \ |
443 | if [ -f ../$${dir}/$${lib}/Makefile ]; then \ | |
444 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ | |
445 | then true; \ | |
446 | else exit 1; \ | |
447 | fi; \ | |
448 | else true; \ | |
449 | fi; \ | |
450 | done; \ | |
451 | fi | |
452 | EOF | |
453 | ||
454 | cat ${Makefile} Multi.tem > Makefile.tem | |
455 | rm -f ${Makefile} Multi.tem | |
456 | mv Makefile.tem ${Makefile} | |
457 | ||
458 | fi # ${ml_toplevel_p} = yes | |
459 | ||
2a59259c | 460 | if [ "${ml_verbose}" = --verbose ]; then |
953fbd65 | 461 | echo "Adding multilib support to Makefile in ${ml_realsrcdir}" |
d747cac4 DE |
462 | if [ "${ml_toplevel_p}" = yes ]; then |
463 | echo "multidirs=${multidirs}" | |
464 | fi | |
465 | echo "with_multisubdir=${with_multisubdir}" | |
466 | fi | |
467 | ||
468 | if [ "${srcdir}" = "." ]; then | |
469 | if [ "${with_target_subdir}" != "." ]; then | |
470 | ml_srcdotdot="../" | |
471 | else | |
472 | ml_srcdotdot="" | |
473 | fi | |
474 | else | |
475 | ml_srcdotdot="" | |
476 | fi | |
477 | ||
478 | if [ -z "${with_multisubdir}" ]; then | |
479 | ml_subdir= | |
480 | ml_builddotdot= | |
481 | : # ml_srcdotdot= # already set | |
482 | else | |
483 | ml_subdir="/${with_multisubdir}" | |
484 | # The '[^/][^/]*' appears that way to work around a SunOS sed bug. | |
485 | ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ | |
486 | if [ "$srcdir" = "." ]; then | |
487 | ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} | |
488 | else | |
489 | : # ml_srcdotdot= # already set | |
490 | fi | |
491 | fi | |
492 | ||
493 | if [ "${ml_toplevel_p}" = yes ]; then | |
494 | ml_do='$(MAKE)' | |
495 | ml_clean='$(MAKE)' | |
496 | else | |
497 | ml_do=true | |
498 | ml_clean=true | |
499 | fi | |
500 | ||
501 | # TOP is used by newlib and should not be used elsewhere for this purpose. | |
502 | # MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty | |
503 | # when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. | |
504 | # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can | |
505 | # delete TOP. Newlib may wish to continue to use TOP for its own purposes | |
506 | # of course. | |
507 | # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile) | |
508 | # and lists the subdirectories to recurse into. | |
509 | # MULTISUBDIR is non-empty in each cpu subdirectory's Makefile | |
510 | # (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with | |
511 | # a leading '/'. | |
512 | # MULTIDO is used for targets like all, install, and check where | |
513 | # $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed. | |
514 | # MULTICLEAN is used for the *clean targets. | |
515 | # | |
516 | # ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are | |
517 | # currently kept separate because we don't want the *clean targets to require | |
518 | # the existence of the compiler (which MULTIDO currently requires) and | |
519 | # therefore we'd have to record the directory options as well as names | |
520 | # (currently we just record the names and use --print-multi-lib to get the | |
521 | # options). | |
522 | ||
523 | sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ | |
524 | -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ | |
525 | -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ | |
526 | -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ | |
527 | -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ | |
528 | -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \ | |
529 | -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \ | |
530 | ${Makefile} > Makefile.tem | |
531 | rm -f ${Makefile} | |
532 | mv Makefile.tem ${Makefile} | |
533 | ||
534 | # If this is the library's top level, configure each multilib subdir. | |
535 | # This is done at the end because this is the loop that runs configure | |
536 | # in each multilib subdir and it seemed reasonable to finish updating the | |
537 | # Makefile before going on to configure the subdirs. | |
538 | ||
539 | if [ "${ml_toplevel_p}" = yes ]; then | |
540 | ||
541 | # We must freshly configure each subdirectory. This bit of code is | |
542 | # actually partially stolen from the main configure script. FIXME. | |
543 | ||
2a59259c | 544 | if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then |
d747cac4 | 545 | |
2a59259c | 546 | if [ "${ml_verbose}" = --verbose ]; then |
d747cac4 DE |
547 | echo "Running configure in multilib subdirs ${multidirs}" |
548 | echo "pwd: `pwd`" | |
549 | fi | |
550 | ||
551 | ml_origdir=`pwd` | |
552 | ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'` | |
553 | # cd to top-level-build-dir/${with_target_subdir} | |
554 | cd .. | |
555 | ||
2a59259c | 556 | for ml_dir in ${multidirs}; do |
d747cac4 | 557 | |
2a59259c DE |
558 | if [ "${ml_verbose}" = --verbose ]; then |
559 | echo "Running configure in multilib subdir ${ml_dir}" | |
d747cac4 DE |
560 | echo "pwd: `pwd`" |
561 | fi | |
562 | ||
2a59259c DE |
563 | if [ -d ${ml_dir} ]; then true; else mkdir ${ml_dir}; fi |
564 | if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi | |
d747cac4 | 565 | |
2a59259c DE |
566 | # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../ |
567 | dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` | |
d747cac4 DE |
568 | |
569 | case ${srcdir} in | |
570 | ".") | |
2a59259c | 571 | echo Building symlink tree in `pwd`/${ml_dir}/${ml_libdir} |
d747cac4 DE |
572 | if [ "${with_target_subdir}" != "." ]; then |
573 | ml_unsubdir="../" | |
574 | else | |
575 | ml_unsubdir="" | |
576 | fi | |
2a59259c | 577 | (cd ${ml_dir}/${ml_libdir}; |
d747cac4 | 578 | ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "") |
2a59259c DE |
579 | ml_newsrcdir="." |
580 | ml_srcdiroption= | |
d747cac4 DE |
581 | multisrctop=${dotdot} |
582 | ;; | |
583 | *) | |
584 | case "${srcdir}" in | |
585 | /*) # absolute path | |
2a59259c | 586 | ml_newsrcdir=${srcdir} |
d747cac4 DE |
587 | ;; |
588 | *) # otherwise relative | |
2a59259c | 589 | ml_newsrcdir=${dotdot}${srcdir} |
d747cac4 DE |
590 | ;; |
591 | esac | |
2a59259c | 592 | ml_srcdiroption="-srcdir=${ml_newsrcdir}" |
d747cac4 DE |
593 | multisrctop= |
594 | ;; | |
595 | esac | |
596 | ||
597 | case "${progname}" in | |
2a59259c DE |
598 | /*) ml_recprog=${progname} ;; |
599 | *) ml_recprog=${dotdot}${progname} ;; | |
d747cac4 DE |
600 | esac |
601 | ||
602 | # FIXME: POPDIR=${PWD=`pwd`} doesn't work here. | |
603 | ML_POPDIR=`pwd` | |
2a59259c | 604 | cd ${ml_dir}/${ml_libdir} |
d747cac4 | 605 | |
2a59259c DE |
606 | if [ -f ${ml_newsrcdir}/configure ]; then |
607 | ml_recprog=${ml_newsrcdir}/configure | |
d747cac4 | 608 | fi |
2a59259c DE |
609 | if eval ${ml_config_shell} ${ml_recprog} \ |
610 | --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \ | |
611 | ${ml_arguments} ${ml_srcdiroption} ; then | |
d747cac4 DE |
612 | true |
613 | else | |
614 | exit 1 | |
615 | fi | |
616 | ||
617 | cd ${ML_POPDIR} | |
618 | ||
619 | done | |
620 | ||
621 | cd ${ml_origdir} | |
622 | fi | |
623 | ||
624 | fi # ${ml_toplevel_p} = yes | |
625 | fi # ${enable_multilib} = yes |