]>
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} | |
2a59259c DE |
75 | ml_config_shell=${CONFIG_SHELL-/bin/sh} |
76 | ml_arguments="${ac_configure_args}" | |
d747cac4 DE |
77 | else |
78 | Makefile=${Makefile-Makefile} | |
2a59259c DE |
79 | ml_config_shell=${config_shell-/bin/sh} |
80 | ml_arguments="${arguments}" | |
d747cac4 DE |
81 | fi |
82 | ||
83 | # Scan all the arguments and set all the ones we need. | |
84 | ||
2a59259c | 85 | for option in ${ml_arguments} |
d747cac4 DE |
86 | do |
87 | case $option in | |
88 | --*) ;; | |
89 | -*) option=-$option ;; | |
90 | esac | |
91 | ||
92 | case $option in | |
93 | --*=*) | |
94 | optarg=`echo $option | sed -e 's/^[^=]*=//'` | |
95 | ;; | |
96 | esac | |
97 | ||
98 | case $option in | |
99 | --disable-*) | |
100 | enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` | |
101 | eval $enableopt=no | |
102 | ;; | |
103 | --enable-*) | |
104 | case "$option" in | |
105 | *=*) ;; | |
106 | *) optarg=yes ;; | |
107 | esac | |
108 | enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
109 | eval $enableopt="$optarg" | |
110 | ;; | |
111 | --norecursion | --no*) | |
2a59259c | 112 | ml_norecursion=yes |
d747cac4 DE |
113 | ;; |
114 | --verbose | --v | --verb*) | |
2a59259c | 115 | ml_verbose=--verbose |
d747cac4 DE |
116 | ;; |
117 | --with-*) | |
118 | case "$option" in | |
119 | *=*) ;; | |
120 | *) optarg=yes ;; | |
121 | esac | |
122 | withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` | |
123 | eval $withopt="$optarg" | |
124 | ;; | |
125 | --without-*) | |
126 | withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` | |
127 | eval $withopt=no | |
128 | ;; | |
129 | esac | |
130 | done | |
131 | ||
132 | # Only do this if --enable-multilib. | |
133 | if [ "${enable_multilib}" = yes ]; then | |
134 | ||
135 | # Compute whether this is the library's top level directory | |
136 | # (ie: not a multilib subdirectory, and not a subdirectory like libg++/src). | |
137 | # ${with_multisubdir} tells us we're in the right branch, but we could be | |
138 | # in a subdir of that. | |
139 | # ??? The previous version could void this test by separating the process into | |
140 | # two files: one that only the library's toplevel configure.in ran (to | |
141 | # configure the multilib subdirs), and another that all configure.in's ran to | |
142 | # update the Makefile. It seemed reasonable to collapse all multilib support | |
143 | # into one file, but it does leave us with having to perform this test. | |
144 | ml_toplevel_p=no | |
145 | if [ -z "${with_multisubdir}" ]; then | |
146 | if [ "${srcdir}" = "." ]; then | |
147 | # ${with_target_subdir} = "." for native, otherwise target alias. | |
148 | if [ "${with_target_subdir}" = "." ]; then | |
149 | if [ -f ../config-ml.in ]; then | |
150 | ml_toplevel_p=yes | |
151 | fi | |
152 | else | |
153 | if [ -f ../../config-ml.in ]; then | |
154 | ml_toplevel_p=yes | |
155 | fi | |
156 | fi | |
157 | else | |
158 | if [ -f ${srcdir}/../config-ml.in ]; then | |
159 | ml_toplevel_p=yes | |
160 | fi | |
161 | fi | |
162 | fi | |
163 | ||
164 | # If this is the library's top level directory, set multidirs to the | |
165 | # multilib subdirs to support. This lives at the top because we need | |
d1265690 | 166 | # `multidirs' set right away. |
d747cac4 DE |
167 | |
168 | if [ "${ml_toplevel_p}" = yes ]; then | |
169 | ||
d1265690 MM |
170 | multidirs= |
171 | for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do | |
172 | dir=`echo $i | sed -e 's/;.*$//'` | |
173 | if [ "${dir}" = "." ]; then | |
174 | true | |
175 | else | |
176 | if [ -z "${multidirs}" ]; then | |
177 | multidirs="${dir}" | |
178 | else | |
179 | multidirs="${multidirs} ${dir}" | |
180 | fi | |
181 | fi | |
182 | done | |
183 | ||
d747cac4 DE |
184 | case "${target}" in |
185 | # start-sanitize-arc | |
186 | arc-sbp-elf*) | |
d1265690 | 187 | if [ x$enable_biendian != xyes ] |
d747cac4 | 188 | then |
d1265690 MM |
189 | old_multidirs=${multidirs} |
190 | multidirs= | |
d747cac4 | 191 | for x in ${old_multidirs}; do |
d1265690 MM |
192 | case "${x}" in |
193 | *be*) ;; | |
194 | *) if [ x"$multidirs" = x ]; then | |
195 | multidirs="$x"; | |
196 | else | |
197 | multidirs="${multidirs} ${x}"; | |
198 | fi | |
199 | ;; | |
d747cac4 DE |
200 | esac |
201 | done | |
202 | fi | |
d1265690 MM |
203 | ;; |
204 | # end-sanitize-arc | |
205 | mips*-*-*) | |
206 | if [ x$enable_single_float = xno ] | |
d747cac4 DE |
207 | then |
208 | old_multidirs="${multidirs}" | |
209 | multidirs="" | |
210 | for x in ${old_multidirs}; do | |
211 | case "$x" in | |
d1265690 | 212 | *single* ) : ;; |
d747cac4 DE |
213 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
214 | esac | |
215 | done | |
216 | fi | |
d1265690 | 217 | if [ x$enable_biendian = xno ] |
d747cac4 DE |
218 | then |
219 | old_multidirs="${multidirs}" | |
220 | multidirs="" | |
221 | for x in ${old_multidirs}; do | |
222 | case "$x" in | |
d1265690 MM |
223 | *el* ) : ;; |
224 | *eb* ) : ;; | |
d747cac4 DE |
225 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
226 | esac | |
227 | done | |
228 | fi | |
d1265690 | 229 | if [ x$enable_softfloat = xno ] |
d747cac4 DE |
230 | then |
231 | old_multidirs="${multidirs}" | |
232 | multidirs="" | |
233 | for x in ${old_multidirs}; do | |
234 | case "$x" in | |
d1265690 | 235 | *soft-float* ) : ;; |
d747cac4 DE |
236 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
237 | esac | |
238 | done | |
239 | fi | |
240 | ;; | |
d1265690 | 241 | powerpc*-*-* | rs6000*-*-*) |
d747cac4 DE |
242 | if [ x$enable_softfloat = xno ] |
243 | then | |
244 | old_multidirs="${multidirs}" | |
245 | multidirs="" | |
246 | for x in ${old_multidirs}; do | |
247 | case "$x" in | |
248 | *soft-float* ) : ;; | |
249 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
250 | esac | |
251 | done | |
252 | fi | |
253 | if [ x$enable_commoncpu = xno ] | |
254 | then | |
255 | old_multidirs="${multidirs}" | |
256 | multidirs="" | |
257 | for x in ${old_multidirs}; do | |
258 | case "$x" in | |
259 | *common* ) : ;; | |
260 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
261 | esac | |
262 | done | |
263 | fi | |
d1265690 | 264 | if [ x$enable_powercpu = xno ] |
d747cac4 DE |
265 | then |
266 | old_multidirs="${multidirs}" | |
267 | multidirs="" | |
268 | for x in ${old_multidirs}; do | |
269 | case "$x" in | |
d1265690 | 270 | power | */power | */power/* ) : ;; |
d747cac4 DE |
271 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
272 | esac | |
273 | done | |
274 | fi | |
d1265690 | 275 | if [ x$enable_power2cpu = xno ] |
d747cac4 DE |
276 | then |
277 | old_multidirs="${multidirs}" | |
278 | multidirs="" | |
279 | for x in ${old_multidirs}; do | |
280 | case "$x" in | |
d1265690 | 281 | *power2* ) : ;; |
d747cac4 DE |
282 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
283 | esac | |
284 | done | |
285 | fi | |
d1265690 | 286 | if [ x$enable_powerpccpu = xno ] |
d747cac4 DE |
287 | then |
288 | old_multidirs="${multidirs}" | |
289 | multidirs="" | |
290 | for x in ${old_multidirs}; do | |
291 | case "$x" in | |
d1265690 | 292 | *powerpc* ) : ;; |
d747cac4 DE |
293 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
294 | esac | |
295 | done | |
296 | fi | |
d1265690 | 297 | if [ x$enable_601cpu = xno ] |
d747cac4 DE |
298 | then |
299 | old_multidirs="${multidirs}" | |
300 | multidirs="" | |
301 | for x in ${old_multidirs}; do | |
302 | case "$x" in | |
d1265690 | 303 | *601* ) : ;; |
d747cac4 DE |
304 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
305 | esac | |
306 | done | |
307 | fi | |
d747cac4 DE |
308 | if [ x$enable_biendian = xno ] |
309 | then | |
310 | old_multidirs="${multidirs}" | |
311 | multidirs="" | |
312 | for x in ${old_multidirs}; do | |
313 | case "$x" in | |
314 | *endian* ) : ;; | |
315 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
316 | esac | |
317 | done | |
318 | fi | |
d747cac4 DE |
319 | if [ x$enable_relocatable = xno ] |
320 | then | |
321 | old_multidirs="${multidirs}" | |
322 | multidirs="" | |
323 | for x in ${old_multidirs}; do | |
324 | case "$x" in | |
325 | *relocatable* ) : ;; | |
326 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
327 | esac | |
328 | done | |
329 | fi | |
d1265690 | 330 | if [ x$enable_sysv = xno ] |
d747cac4 DE |
331 | then |
332 | old_multidirs="${multidirs}" | |
333 | multidirs="" | |
334 | for x in ${old_multidirs}; do | |
335 | case "$x" in | |
d1265690 | 336 | *sysv* ) : ;; |
d747cac4 DE |
337 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; |
338 | esac | |
339 | done | |
340 | fi | |
341 | if [ x$enable_aix = xno ] | |
342 | then | |
343 | old_multidirs="${multidirs}" | |
344 | multidirs="" | |
345 | for x in ${old_multidirs}; do | |
346 | case "$x" in | |
347 | *aix* ) : ;; | |
348 | *) if [ x"$multidirs" = x ]; then multidirs="$x"; else multidirs="${multidirs} ${x}"; fi ;; | |
349 | esac | |
350 | done | |
351 | fi | |
352 | ;; | |
d747cac4 DE |
353 | esac |
354 | ||
355 | # Add code to library's top level makefile to handle building the multilib | |
356 | # subdirs. | |
357 | ||
358 | cat > Multi.tem <<\EOF | |
359 | ||
360 | # FIXME: There should be an @-sign in front of the `if'. | |
361 | # Leave out until this is tested a bit more. | |
362 | multi-do: | |
363 | if [ -z "$(MULTIDIRS)" ]; then \ | |
364 | true; \ | |
365 | else \ | |
366 | rootpre=`pwd`/; export rootpre; \ | |
367 | srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ | |
368 | lib=`echo $${rootpre} | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ | |
369 | compiler="$(CC)"; \ | |
370 | for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ | |
371 | dir=`echo $$i | sed -e 's/;.*$$//'`; \ | |
372 | if [ "$${dir}" = "." ]; then \ | |
373 | true; \ | |
374 | else \ | |
375 | if [ -d ../$${dir}/$${lib} ]; then \ | |
376 | flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ | |
377 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ | |
378 | CFLAGS="$(CFLAGS) $${flags}" \ | |
379 | CXXFLAGS="$(CXXFLAGS) $${flags}" \ | |
380 | LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ | |
381 | LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ | |
382 | $(DO)); then \ | |
383 | true; \ | |
384 | else \ | |
385 | exit 1; \ | |
386 | fi; \ | |
387 | else true; \ | |
388 | fi; \ | |
389 | fi; \ | |
390 | done; \ | |
391 | fi | |
392 | ||
393 | # FIXME: There should be an @-sign in front of the `if'. | |
394 | # Leave out until this is tested a bit more. | |
395 | multi-clean: | |
396 | if [ -z "$(MULTIDIRS)" ]; then \ | |
397 | true; \ | |
398 | else \ | |
d1265690 | 399 | lib=`pwd | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ |
d747cac4 DE |
400 | for dir in Makefile $(MULTIDIRS); do \ |
401 | if [ -f ../$${dir}/$${lib}/Makefile ]; then \ | |
402 | if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ | |
403 | then true; \ | |
404 | else exit 1; \ | |
405 | fi; \ | |
406 | else true; \ | |
407 | fi; \ | |
408 | done; \ | |
409 | fi | |
410 | EOF | |
411 | ||
412 | cat ${Makefile} Multi.tem > Makefile.tem | |
413 | rm -f ${Makefile} Multi.tem | |
414 | mv Makefile.tem ${Makefile} | |
415 | ||
416 | fi # ${ml_toplevel_p} = yes | |
417 | ||
2a59259c | 418 | if [ "${ml_verbose}" = --verbose ]; then |
d747cac4 DE |
419 | echo "Adding multilib support to Makefile in `pwd`" |
420 | if [ "${ml_toplevel_p}" = yes ]; then | |
421 | echo "multidirs=${multidirs}" | |
422 | fi | |
423 | echo "with_multisubdir=${with_multisubdir}" | |
424 | fi | |
425 | ||
426 | if [ "${srcdir}" = "." ]; then | |
427 | if [ "${with_target_subdir}" != "." ]; then | |
428 | ml_srcdotdot="../" | |
429 | else | |
430 | ml_srcdotdot="" | |
431 | fi | |
432 | else | |
433 | ml_srcdotdot="" | |
434 | fi | |
435 | ||
436 | if [ -z "${with_multisubdir}" ]; then | |
437 | ml_subdir= | |
438 | ml_builddotdot= | |
439 | : # ml_srcdotdot= # already set | |
440 | else | |
441 | ml_subdir="/${with_multisubdir}" | |
442 | # The '[^/][^/]*' appears that way to work around a SunOS sed bug. | |
443 | ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ | |
444 | if [ "$srcdir" = "." ]; then | |
445 | ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} | |
446 | else | |
447 | : # ml_srcdotdot= # already set | |
448 | fi | |
449 | fi | |
450 | ||
451 | if [ "${ml_toplevel_p}" = yes ]; then | |
452 | ml_do='$(MAKE)' | |
453 | ml_clean='$(MAKE)' | |
454 | else | |
455 | ml_do=true | |
456 | ml_clean=true | |
457 | fi | |
458 | ||
459 | # TOP is used by newlib and should not be used elsewhere for this purpose. | |
460 | # MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty | |
461 | # when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. | |
462 | # FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can | |
463 | # delete TOP. Newlib may wish to continue to use TOP for its own purposes | |
464 | # of course. | |
465 | # MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile) | |
466 | # and lists the subdirectories to recurse into. | |
467 | # MULTISUBDIR is non-empty in each cpu subdirectory's Makefile | |
468 | # (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with | |
469 | # a leading '/'. | |
470 | # MULTIDO is used for targets like all, install, and check where | |
471 | # $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed. | |
472 | # MULTICLEAN is used for the *clean targets. | |
473 | # | |
474 | # ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are | |
475 | # currently kept separate because we don't want the *clean targets to require | |
476 | # the existence of the compiler (which MULTIDO currently requires) and | |
477 | # therefore we'd have to record the directory options as well as names | |
478 | # (currently we just record the names and use --print-multi-lib to get the | |
479 | # options). | |
480 | ||
481 | sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ | |
482 | -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ | |
483 | -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ | |
484 | -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ | |
485 | -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ | |
486 | -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \ | |
487 | -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \ | |
488 | ${Makefile} > Makefile.tem | |
489 | rm -f ${Makefile} | |
490 | mv Makefile.tem ${Makefile} | |
491 | ||
492 | # If this is the library's top level, configure each multilib subdir. | |
493 | # This is done at the end because this is the loop that runs configure | |
494 | # in each multilib subdir and it seemed reasonable to finish updating the | |
495 | # Makefile before going on to configure the subdirs. | |
496 | ||
497 | if [ "${ml_toplevel_p}" = yes ]; then | |
498 | ||
499 | # We must freshly configure each subdirectory. This bit of code is | |
500 | # actually partially stolen from the main configure script. FIXME. | |
501 | ||
2a59259c | 502 | if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then |
d747cac4 | 503 | |
2a59259c | 504 | if [ "${ml_verbose}" = --verbose ]; then |
d747cac4 DE |
505 | echo "Running configure in multilib subdirs ${multidirs}" |
506 | echo "pwd: `pwd`" | |
507 | fi | |
508 | ||
509 | ml_origdir=`pwd` | |
510 | ml_libdir=`echo $ml_origdir | sed -e 's,^.*/,,'` | |
511 | # cd to top-level-build-dir/${with_target_subdir} | |
512 | cd .. | |
513 | ||
2a59259c | 514 | for ml_dir in ${multidirs}; do |
d747cac4 | 515 | |
2a59259c DE |
516 | if [ "${ml_verbose}" = --verbose ]; then |
517 | echo "Running configure in multilib subdir ${ml_dir}" | |
d747cac4 DE |
518 | echo "pwd: `pwd`" |
519 | fi | |
520 | ||
2a59259c DE |
521 | if [ -d ${ml_dir} ]; then true; else mkdir ${ml_dir}; fi |
522 | if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi | |
d747cac4 | 523 | |
2a59259c DE |
524 | # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../ |
525 | dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` | |
d747cac4 DE |
526 | |
527 | case ${srcdir} in | |
528 | ".") | |
2a59259c | 529 | echo Building symlink tree in `pwd`/${ml_dir}/${ml_libdir} |
d747cac4 DE |
530 | if [ "${with_target_subdir}" != "." ]; then |
531 | ml_unsubdir="../" | |
532 | else | |
533 | ml_unsubdir="" | |
534 | fi | |
2a59259c | 535 | (cd ${ml_dir}/${ml_libdir}; |
d747cac4 | 536 | ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "") |
2a59259c DE |
537 | ml_newsrcdir="." |
538 | ml_srcdiroption= | |
d747cac4 DE |
539 | multisrctop=${dotdot} |
540 | ;; | |
541 | *) | |
542 | case "${srcdir}" in | |
543 | /*) # absolute path | |
2a59259c | 544 | ml_newsrcdir=${srcdir} |
d747cac4 DE |
545 | ;; |
546 | *) # otherwise relative | |
2a59259c | 547 | ml_newsrcdir=${dotdot}${srcdir} |
d747cac4 DE |
548 | ;; |
549 | esac | |
2a59259c | 550 | ml_srcdiroption="-srcdir=${ml_newsrcdir}" |
d747cac4 DE |
551 | multisrctop= |
552 | ;; | |
553 | esac | |
554 | ||
555 | case "${progname}" in | |
2a59259c DE |
556 | /*) ml_recprog=${progname} ;; |
557 | *) ml_recprog=${dotdot}${progname} ;; | |
d747cac4 DE |
558 | esac |
559 | ||
560 | # FIXME: POPDIR=${PWD=`pwd`} doesn't work here. | |
561 | ML_POPDIR=`pwd` | |
2a59259c | 562 | cd ${ml_dir}/${ml_libdir} |
d747cac4 | 563 | |
2a59259c DE |
564 | if [ -f ${ml_newsrcdir}/configure ]; then |
565 | ml_recprog=${ml_newsrcdir}/configure | |
d747cac4 | 566 | fi |
2a59259c DE |
567 | if eval ${ml_config_shell} ${ml_recprog} \ |
568 | --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \ | |
569 | ${ml_arguments} ${ml_srcdiroption} ; then | |
d747cac4 DE |
570 | true |
571 | else | |
572 | exit 1 | |
573 | fi | |
574 | ||
575 | cd ${ML_POPDIR} | |
576 | ||
577 | done | |
578 | ||
579 | cd ${ml_origdir} | |
580 | fi | |
581 | ||
582 | fi # ${ml_toplevel_p} = yes | |
583 | fi # ${enable_multilib} = yes |