]>
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 | |
12 | # . ${srcdir}/${with_multisrctop}../../config-ml.in | |
13 | # else | |
14 | # . ${srcdir}/${with_multisrctop}../config-ml.in | |
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 | # | |
47 | # Configure variables: | |
48 | # ${with_target_subdir} = "." for native, or ${target_alias} for cross. | |
49 | # Set by top level Makefile. | |
50 | # ${with_multisrctop} = how many levels of multilibs there are in the source | |
51 | # tree. It exists to handle the case of configuring in the source tree: | |
52 | # ${srcdir} is not constant. | |
53 | # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881). | |
54 | # | |
55 | # Makefile variables: | |
56 | # MULTISRCTOP = number of multilib levels in source tree (+1 if cross) | |
57 | # MULITBUILDTOP = number of multilib levels in build tree | |
58 | # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...) | |
59 | # (only defined in each library's main Makefile). | |
60 | # MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000) | |
61 | # (only defined in each multilib subdir). | |
62 | ||
63 | # FIXME: Multilib is currently disabled by default for everything other than | |
64 | # newlib. It is up to each target to turn on multilib support for the other | |
65 | # libraries as desired. | |
66 | ||
67 | # We have to handle being invoked by both Cygnus configure and Autoconf. | |
68 | # We except both to define `srcdir' and `target' (we *could* figure them | |
69 | # out, but we'd have to do work that they're already done to figure them out). | |
70 | # We expect Cygnus configure to define `arguments' and Autoconf to define | |
71 | # `ac_configure_args'. | |
72 | ||
73 | if [ -n "${ac_configure_args}" ]; then | |
74 | Makefile=${ac_file-Makefile} | |
75 | config_shell=${CONFIG_SHELL-/bin/sh} | |
76 | arguments="${ac_configure_args}" | |
77 | else | |
78 | Makefile=${Makefile-Makefile} | |
79 | config_shell=${config_shell-/bin/sh} | |
80 | fi | |
81 | ||
82 | # Scan all the arguments and set all the ones we need. | |
83 | ||
84 | for option in $arguments | |
85 | do | |
86 | case $option in | |
87 | --*) ;; | |
88 | -*) option=-$option ;; | |
89 | esac | |
90 | ||
91 | case $option in | |
92 | --*=*) | |
93 | optarg=`echo $option | sed -e 's/^[^=]*=//'` | |
94 | ;; | |
95 | esac | |
96 | ||
97 | case $option in | |
98 | --disable-*) | |
99 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` | |
100 | eval $enableopt=no | |
101 | ;; | |
102 | --enable-*) | |
103 | case "$option" in | |
104 | *=*) ;; | |
105 | *) optarg=yes ;; | |
106 | esac | |
107 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
108 | eval $enableopt="$optarg" | |
109 | ;; | |
110 | --norecursion | --no*) | |
111 | norecursion=yes | |
112 | ;; | |
113 | --verbose | --v | --verb*) | |
114 | verbose=--verbose | |
115 | ;; | |
116 | --with-*) | |
117 | case "$option" in | |
118 | *=*) ;; | |
119 | *) optarg=yes ;; | |
120 | esac | |
121 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
122 | eval $withopt="$optarg" | |
123 | ;; | |
124 | --without-*) | |
125 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` | |
126 | eval $withopt=no | |
127 | ;; | |
128 | esac | |
129 | done | |
130 | ||
131 | # Only do this if --enable-multilib. | |
132 | if [ "${enable_multilib}" = yes ]; then | |
133 | ||
134 | # Compute whether this is the library's top level directory | |
135 | # (ie: not a multilib subdirectory, and not a subdirectory like libg++/src). | |
136 | # ${with_multisubdir} tells us we're in the right branch, but we could be | |
137 | # in a subdir of that. | |
138 | # ??? The previous version could void this test by separating the process into | |
139 | # two files: one that only the library's toplevel configure.in ran (to | |
140 | # configure the multilib subdirs), and another that all configure.in's ran to | |
141 | # update the Makefile. It seemed reasonable to collapse all multilib support | |
142 | # into one file, but it does leave us with having to perform this test. | |
143 | ml_toplevel_p=no | |
144 | if [ -z "${with_multisubdir}" ]; then | |
145 | if [ "${srcdir}" = "." ]; then | |
146 | # ${with_target_subdir} = "." for native, otherwise target alias. | |
147 | if [ "${with_target_subdir}" = "." ]; then | |
148 | if [ -f ../config-ml.in ]; then | |
149 | ml_toplevel_p=yes | |
150 | fi | |
151 | else | |
152 | if [ -f ../../config-ml.in ]; then | |
153 | ml_toplevel_p=yes | |
154 | fi | |
155 | fi | |
156 | else | |
157 | if [ -f ${srcdir}/../config-ml.in ]; then | |
158 | ml_toplevel_p=yes | |
159 | fi | |
160 | fi | |
161 | fi | |
162 | ||
163 | # If this is the library's top level directory, set multidirs to the | |
164 | # multilib subdirs to support. This lives at the top because we need | |
165 | # `multidirs' set right away, and this section is subject to frequent | |
166 | # editing (addition of new targets, etc.). | |
167 | ||
168 | if [ "${ml_toplevel_p}" = yes ]; then | |
169 | ||
170 | case "${target}" in | |
171 | # start-sanitize-arc | |
172 | arc-sbp-elf*) | |
173 | if [ x$enable_biendian = xyes ] | |
174 | then | |
175 | multidirs="be host graphics audio be/host be/graphics be/audio" | |
176 | else | |
177 | multidirs="host graphics audio" | |
178 | fi | |
179 | ;; | |
180 | arc-*-*) | |
181 | multidirs="be" | |
182 | ;; | |
183 | # end-sanitize-arc | |
184 | hppa*-*-*) | |
185 | multidirs="soft-float" | |
186 | ;; | |
187 | #m68*-*-aout* | m68*-*-coff* | m68*-*-elf* | m68*-*-vxworks*) | |
188 | # multidirs="m68000 m68020 m68881 msoft-float m68000/m68881 m68000/msoft-float m68020/m68881 m68020/msoft-float" | |
189 | # ;; | |
190 | m68*-*-aout* | m68*-*-coff* | m68*-*-elf* | m68*-*-vxworks*) | |
191 | multidirs="m68000 m68000/m68881" | |
192 | ;; | |
193 | i960-*-*) | |
194 | multidirs=float | |
195 | ;; | |
196 | sparclite-*-* | sparclitefrw*-*-*) | |
197 | multidirs="mfpu msoft-float mflat mno-flat mfpu/mflat mfpu/mno-flat msoft-float/mflat msoft-float/mno-flat" | |
198 | ;; | |
199 | sparc-*-* | sparcfrw*-*-*) | |
200 | multidirs="soft v8 soft/v8" | |
201 | ;; | |
202 | z8k-*-coff) | |
203 | multidirs="z8001 std z8001/std" | |
204 | ;; | |
205 | h8300-*-*) | |
206 | multidirs=h8300h | |
207 | ;; | |
208 | h8500-*-*) | |
209 | multidirs="mbig msmall mcompact mmedium" | |
210 | ;; | |
211 | # start-sanitize-jaguar | |
212 | jaguar-*-*) | |
213 | multidirs="be" | |
214 | ;; | |
215 | # end-sanitize-jaguar | |
216 | sh-*-*) | |
217 | multidirs="ml m2 ml/m2" | |
218 | # start-sanitize-sh3e | |
219 | multidirs="ml m2 ml/m2 m3e ml/m3e" | |
220 | # end-sanitize-sh3e | |
221 | ;; | |
222 | mips*-*-*) | |
223 | # Note that not all of these will be built for a particular | |
224 | # target; what is build depends upon the output gcc | |
225 | # --print-multi-lib. We configure them all, to make our life | |
226 | # simpler here. If somebody cares about configuration | |
227 | # efficiency, they will need to switch off on the various | |
228 | # targets to configure just the directories needed for that | |
229 | # target. | |
230 | # | |
231 | # In the long run, it would be better to configure based on | |
232 | # the output of gcc --print-multi-lib, but, to do that, we | |
233 | # would have to build gcc before configuring newlib. | |
234 | # | |
235 | # Default to including the single-float directories. | |
236 | if [ x$enable_single_float = x ]; then | |
237 | enable_single_float=yes | |
238 | fi | |
239 | if [ x$enable_single_float = xyes ]; then | |
240 | multidirs="soft-float single el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 single/el single/eb single/mips1 single/mips3 single/el/mips1 single/el/mips3 single/eb/mips1 single/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3" | |
241 | else | |
242 | multidirs="soft-float el eb mips1 mips3 soft-float/el soft-float/eb soft-float/mips1 soft-float/mips3 soft-float/el/mips1 soft-float/el/mips3 soft-float/eb/mips1 soft-float/eb/mips3 el/mips1 el/mips3 eb/mips1 eb/mips3" | |
243 | fi | |
244 | if [ x$enable_biendian = xno ] | |
245 | then | |
246 | old_multidirs="${multidirs}" | |
247 | multidirs="" | |
248 | for x in ${old_multidirs}; do | |
249 | case "$x" in | |
250 | *endian* ) : ;; | |
251 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
252 | esac | |
253 | done | |
254 | fi | |
255 | if [ x$enable_softfloat = xno ] | |
256 | then | |
257 | old_multidirs="${multidirs}" | |
258 | multidirs="" | |
259 | for x in ${old_multidirs}; do | |
260 | case "$x" in | |
261 | *soft-float* ) : ;; | |
262 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
263 | esac | |
264 | done | |
265 | fi | |
266 | if [ x$enable_relocatable = xno ] | |
267 | then | |
268 | old_multidirs="${multidirs}" | |
269 | multidirs="" | |
270 | for x in ${old_multidirs}; do | |
271 | case "$x" in | |
272 | *relocatable* ) : ;; | |
273 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
274 | esac | |
275 | done | |
276 | fi | |
277 | if [ x$enable_sysv = xno ] | |
278 | then | |
279 | old_multidirs="${multidirs}" | |
280 | multidirs="" | |
281 | for x in ${old_multidirs}; do | |
282 | case "$x" in | |
283 | *sysv* ) : ;; | |
284 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
285 | esac | |
286 | done | |
287 | fi | |
288 | ;; | |
289 | powerpc-ibm-aix* | rs6000-ibm-aix*) | |
290 | multidirs="soft-float common soft-float/common" | |
291 | if [ x$enable_softfloat = xno ] | |
292 | then | |
293 | old_multidirs="${multidirs}" | |
294 | multidirs="" | |
295 | for x in ${old_multidirs}; do | |
296 | case "$x" in | |
297 | *soft-float* ) : ;; | |
298 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
299 | esac | |
300 | done | |
301 | fi | |
302 | if [ x$enable_commoncpu = xno ] | |
303 | then | |
304 | old_multidirs="${multidirs}" | |
305 | multidirs="" | |
306 | for x in ${old_multidirs}; do | |
307 | case "$x" in | |
308 | *common* ) : ;; | |
309 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
310 | esac | |
311 | done | |
312 | fi | |
313 | ;; | |
314 | powerpc-*-eabiaix*) | |
315 | multidirs="soft-float relocatable little sysv little/sysv relocatable/little relocatable/sysv relocatable/little/sysv soft-float/relocatable soft-float/little soft-float/sysv soft-float/little/sysv soft-float/relocatable/little soft-float/relocatable/sysv soft-float/relocatable/little/sysv" | |
316 | if [ x$enable_biendian = xno ] | |
317 | then | |
318 | old_multidirs="${multidirs}" | |
319 | multidirs="" | |
320 | for x in ${old_multidirs}; do | |
321 | case "$x" in | |
322 | *endian* ) : ;; | |
323 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
324 | esac | |
325 | done | |
326 | fi | |
327 | if [ x$enable_softfloat = xno ] | |
328 | then | |
329 | old_multidirs="${multidirs}" | |
330 | multidirs="" | |
331 | for x in ${old_multidirs}; do | |
332 | case "$x" in | |
333 | *soft-float* ) : ;; | |
334 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
335 | esac | |
336 | done | |
337 | fi | |
338 | if [ x$enable_relocatable = xno ] | |
339 | then | |
340 | old_multidirs="${multidirs}" | |
341 | multidirs="" | |
342 | for x in ${old_multidirs}; do | |
343 | case "$x" in | |
344 | *relocatable* ) : ;; | |
345 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
346 | esac | |
347 | done | |
348 | fi | |
349 | if [ x$enable_sysv = xno ] | |
350 | then | |
351 | old_multidirs="${multidirs}" | |
352 | multidirs="" | |
353 | for x in ${old_multidirs}; do | |
354 | case "$x" in | |
355 | *sysv* ) : ;; | |
356 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
357 | esac | |
358 | done | |
359 | fi | |
360 | ;; | |
361 | powerpc-*-eabi* | powerpc-*-elf* | powerpc-*-sysv4*) | |
362 | multidirs="soft-float relocatable little aix little/aix relocatable/little relocatable/aix relocatable/little/aix soft-float/relocatable soft-float/little soft-float/aix soft-float/little/aix soft-float/relocatable/little soft-float/relocatable/aix soft-float/relocatable/little/aix aixdesc soft-float/aixdesc" | |
363 | if [ x$enable_biendian = xno ] | |
364 | then | |
365 | old_multidirs="${multidirs}" | |
366 | multidirs="" | |
367 | for x in ${old_multidirs}; do | |
368 | case "$x" in | |
369 | *endian* ) : ;; | |
370 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
371 | esac | |
372 | done | |
373 | fi | |
374 | if [ x$enable_softfloat = xno ] | |
375 | then | |
376 | old_multidirs="${multidirs}" | |
377 | multidirs="" | |
378 | for x in ${old_multidirs}; do | |
379 | case "$x" in | |
380 | *soft-float* ) : ;; | |
381 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
382 | esac | |
383 | done | |
384 | fi | |
385 | if [ x$enable_relocatable = xno ] | |
386 | then | |
387 | old_multidirs="${multidirs}" | |
388 | multidirs="" | |
389 | for x in ${old_multidirs}; do | |
390 | case "$x" in | |
391 | *relocatable* ) : ;; | |
392 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
393 | esac | |
394 | done | |
395 | fi | |
396 | if [ x$enable_aix = xno ] | |
397 | then | |
398 | old_multidirs="${multidirs}" | |
399 | multidirs="" | |
400 | for x in ${old_multidirs}; do | |
401 | case "$x" in | |
402 | *aix* ) : ;; | |
403 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
404 | esac | |
405 | done | |
406 | fi | |
407 | ;; | |
408 | powerpcle-*-eabi* | powerpcle-*-elf* | powerpcle-*-sysv4*) | |
409 | multidirs="soft-float relocatable big aix big/aix relocatable/big relocatable/aix relocatable/big/aix soft-float/relocatable soft-float/big soft-float/aix soft-float/big/aix soft-float/relocatable/big soft-float/relocatable/aix soft-float/relocatable/big/aix" | |
410 | if [ x$enable_biendian = xno ] | |
411 | then | |
412 | old_multidirs="${multidirs}" | |
413 | multidirs="" | |
414 | for x in ${old_multidirs}; do | |
415 | case "$x" in | |
416 | *endian* ) : ;; | |
417 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
418 | esac | |
419 | done | |
420 | fi | |
421 | if [ x$enable_softfloat = xno ] | |
422 | then | |
423 | old_multidirs="${multidirs}" | |
424 | multidirs="" | |
425 | for x in ${old_multidirs}; do | |
426 | case "$x" in | |
427 | *soft-float* ) : ;; | |
428 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
429 | esac | |
430 | done | |
431 | fi | |
432 | if [ x$enable_relocatable = xno ] | |
433 | then | |
434 | old_multidirs="${multidirs}" | |
435 | multidirs="" | |
436 | for x in ${old_multidirs}; do | |
437 | case "$x" in | |
438 | *relocatable* ) : ;; | |
439 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
440 | esac | |
441 | done | |
442 | fi | |
443 | if [ x$enable_aix = xno ] | |
444 | then | |
445 | old_multidirs="${multidirs}" | |
446 | multidirs="" | |
447 | for x in ${old_multidirs}; do | |
448 | case "$x" in | |
449 | *aix* ) : ;; | |
450 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
451 | esac | |
452 | done | |
453 | fi | |
454 | ;; | |
455 | *) | |
456 | multidirs= | |
457 | ;; | |
458 | esac | |
459 | ||
460 | # Add code to library's top level makefile to handle building the multilib | |
461 | # subdirs. | |
462 | ||
463 | cat > Multi.tem <<\EOF | |
464 | ||
465 | # FIXME: There should be an @-sign in front of the `if'. | |
466 | # Leave out until this is tested a bit more. | |
467 | multi-do: | |
468 | if [ -z "$(MULTIDIRS)" ]; then \ | |
469 | true; \ | |
470 | else \ | |
471 | rootpre=`pwd`/; export rootpre; \ | |
472 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ | |
473 | lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ | |
474 | compiler="$(CC)"; \ | |
475 | for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ | |
476 | dir=`echo $$i | sed -e 's/;.*$$//'`; \ | |
477 | if [ "$${dir}" = "." ]; then \ | |
478 | true; \ | |
479 | else \ | |
480 | if [ -d ../$${dir}/$${lib} ]; then \ | |
481 | flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ | |
482 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ | |
483 | CFLAGS="$(CFLAGS) $${flags}" \ | |
484 | CXXFLAGS="$(CXXFLAGS) $${flags}" \ | |
485 | LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ | |
486 | LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ | |
487 | $(DO)); then \ | |
488 | true; \ | |
489 | else \ | |
490 | exit 1; \ | |
491 | fi; \ | |
492 | else true; \ | |
493 | fi; \ | |
494 | fi; \ | |
495 | done; \ | |
496 | fi | |
497 | ||
498 | # FIXME: There should be an @-sign in front of the `if'. | |
499 | # Leave out until this is tested a bit more. | |
500 | multi-clean: | |
501 | if [ -z "$(MULTIDIRS)" ]; then \ | |
502 | true; \ | |
503 | else \ | |
504 | lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ | |
505 | for dir in Makefile $(MULTIDIRS); do \ | |
506 | if [ -f ../$${dir}/$${lib}/Makefile ]; then \ | |
507 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ | |
508 | then true; \ | |
509 | else exit 1; \ | |
510 | fi; \ | |
511 | else true; \ | |
512 | fi; \ | |
513 | done; \ | |
514 | fi | |
515 | EOF | |
516 | ||
517 | cat ${Makefile} Multi.tem > Makefile.tem | |
518 | rm -f ${Makefile} Multi.tem | |
519 | mv Makefile.tem ${Makefile} | |
520 | ||
521 | fi # ${ml_toplevel_p} = yes | |
522 | ||
523 | if [ "${verbose}" = --verbose ]; then | |
524 | echo "Adding multilib support to Makefile in `pwd`" | |
525 | if [ "${ml_toplevel_p}" = yes ]; then | |
526 | echo "multidirs=${multidirs}" | |
527 | fi | |
528 | echo "with_multisubdir=${with_multisubdir}" | |
529 | fi | |
530 | ||
531 | if [ "${srcdir}" = "." ]; then | |
532 | if [ "${with_target_subdir}" != "." ]; then | |
533 | ml_srcdotdot="../" | |
534 | else | |
535 | ml_srcdotdot="" | |
536 | fi | |
537 | else | |
538 | ml_srcdotdot="" | |
539 | fi | |
540 | ||
541 | if [ -z "${with_multisubdir}" ]; then | |
542 | ml_subdir= | |
543 | ml_builddotdot= | |
544 | : # ml_srcdotdot= # already set | |
545 | else | |
546 | ml_subdir="/${with_multisubdir}" | |
547 | # The '[^/][^/]*' appears that way to work around a SunOS sed bug. | |
548 | ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ | |
549 | if [ "$srcdir" = "." ]; then | |
550 | ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} | |
551 | else | |
552 | : # ml_srcdotdot= # already set | |
553 | fi | |
554 | fi | |
555 | ||
556 | if [ "${ml_toplevel_p}" = yes ]; then | |
557 | ml_do='$(MAKE)' | |
558 | ml_clean='$(MAKE)' | |
559 | else | |
560 | ml_do=true | |
561 | ml_clean=true | |
562 | fi | |
563 | ||
564 | # TOP is used by newlib and should not be used elsewhere for this purpose. | |
565 | # MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty | |
566 | # when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. | |
567 | # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can | |
568 | # delete TOP. Newlib may wish to continue to use TOP for its own purposes | |
569 | # of course. | |
570 | # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile) | |
571 | # and lists the subdirectories to recurse into. | |
572 | # MULTISUBDIR is non-empty in each cpu subdirectory's Makefile | |
573 | # (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with | |
574 | # a leading '/'. | |
575 | # MULTIDO is used for targets like all, install, and check where | |
576 | # $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed. | |
577 | # MULTICLEAN is used for the *clean targets. | |
578 | # | |
579 | # ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are | |
580 | # currently kept separate because we don't want the *clean targets to require | |
581 | # the existence of the compiler (which MULTIDO currently requires) and | |
582 | # therefore we'd have to record the directory options as well as names | |
583 | # (currently we just record the names and use --print-multi-lib to get the | |
584 | # options). | |
585 | ||
586 | sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ | |
587 | -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ | |
588 | -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ | |
589 | -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ | |
590 | -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ | |
591 | -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \ | |
592 | -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \ | |
593 | ${Makefile} > Makefile.tem | |
594 | rm -f ${Makefile} | |
595 | mv Makefile.tem ${Makefile} | |
596 | ||
597 | # If this is the library's top level, configure each multilib subdir. | |
598 | # This is done at the end because this is the loop that runs configure | |
599 | # in each multilib subdir and it seemed reasonable to finish updating the | |
600 | # Makefile before going on to configure the subdirs. | |
601 | ||
602 | if [ "${ml_toplevel_p}" = yes ]; then | |
603 | ||
604 | # We must freshly configure each subdirectory. This bit of code is | |
605 | # actually partially stolen from the main configure script. FIXME. | |
606 | ||
607 | if [ -n "${multidirs}" ] && [ -z "${norecursion}" ]; then | |
608 | ||
609 | if [ "${verbose}" = --verbose ]; then | |
610 | echo "Running configure in multilib subdirs ${multidirs}" | |
611 | echo "pwd: `pwd`" | |
612 | fi | |
613 | ||
614 | ml_origdir=`pwd` | |
615 | ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'` | |
616 | # cd to top-level-build-dir/${with_target_subdir} | |
617 | cd .. | |
618 | ||
619 | for dir in ${multidirs}; do | |
620 | ||
621 | if [ "${verbose}" = --verbose ]; then | |
622 | echo "Running configure in multilib subdir ${dir}" | |
623 | echo "pwd: `pwd`" | |
624 | fi | |
625 | ||
626 | if [ -d ${dir} ]; then true; else mkdir ${dir}; fi | |
627 | if [ -d ${dir}/${ml_libdir} ]; then true; else mkdir ${dir}/${ml_libdir}; fi | |
628 | ||
629 | # Eg: if ${dir} = m68000/m68881, dotdot = ../../ | |
630 | dotdot=../`echo ${dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` | |
631 | ||
632 | case ${srcdir} in | |
633 | ".") | |
634 | echo Building symlink tree in `pwd`/${dir}/${ml_libdir} | |
635 | if [ "${with_target_subdir}" != "." ]; then | |
636 | ml_unsubdir="../" | |
637 | else | |
638 | ml_unsubdir="" | |
639 | fi | |
640 | (cd ${dir}/${ml_libdir}; | |
641 | ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "") | |
642 | newsrcdir="." | |
643 | srcdiroption= | |
644 | multisrctop=${dotdot} | |
645 | ;; | |
646 | *) | |
647 | case "${srcdir}" in | |
648 | /*) # absolute path | |
649 | newsrcdir=${srcdir} | |
650 | ;; | |
651 | *) # otherwise relative | |
652 | newsrcdir=${dotdot}${srcdir} | |
653 | ;; | |
654 | esac | |
655 | srcdiroption="-srcdir=${newsrcdir}" | |
656 | multisrctop= | |
657 | ;; | |
658 | esac | |
659 | ||
660 | case "${progname}" in | |
661 | /*) recprog=${progname} ;; | |
662 | *) recprog=${dotdot}${progname} ;; | |
663 | esac | |
664 | ||
665 | # FIXME: POPDIR=${PWD=`pwd`} doesn't work here. | |
666 | ML_POPDIR=`pwd` | |
667 | cd ${dir}/${ml_libdir} | |
668 | ||
669 | if [ -f ${newsrcdir}/configure ]; then | |
670 | recprog=${newsrcdir}/configure | |
671 | fi | |
f3d4003e | 672 | if eval ${config_shell} ${recprog} \ |
d747cac4 DE |
673 | --with-multisubdir=${dir} --with-multisrctop=${multisrctop} \ |
674 | $arguments ${srcdiroption} ; then | |
675 | true | |
676 | else | |
677 | exit 1 | |
678 | fi | |
679 | ||
680 | cd ${ML_POPDIR} | |
681 | ||
682 | done | |
683 | ||
684 | cd ${ml_origdir} | |
685 | fi | |
686 | ||
687 | fi # ${ml_toplevel_p} = yes | |
688 | fi # ${enable_multilib} = yes |