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