OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [config-ml.in] - Blame information for rev 157

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
# Configure fragment invoked in the post-target section for subdirs
2
# wanting multilib support.
3
#
4
# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5
# 2005, 2006, 2007  Free Software Foundation, Inc.
6
#
7
# This file is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
# Boston, MA 02110-1301, USA.
21
#
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
26
#
27
# Please report bugs to 
28
# and send patches to .
29
 
30
# It is advisable to support a few --enable/--disable options to let the
31
# user select which libraries s/he really wants.
32
#
33
# Subdirectories wishing to use multilib should put the following lines
34
# in the "post-target" section of configure.in.
35
#
36
# if [ "${srcdir}" = "." ] ; then
37
#   if [ "${with_target_subdir}" != "." ] ; then
38
#     . ${with_multisrctop}../../config-ml.in
39
#   else
40
#     . ${with_multisrctop}../config-ml.in
41
#   fi
42
# else
43
#   . ${srcdir}/../config-ml.in
44
# fi
45
#
46
#
47
# Things are complicated because 6 separate cases must be handled:
48
# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6.
49
#
50
# srcdir=. is special.  It must handle make programs that don't handle VPATH.
51
# To implement this, a symlink tree is built for each library and for each
52
# multilib subdir.
53
#
54
# The build tree is layed out as
55
#
56
# ./
57
#   newlib
58
#   m68020/
59
#          newlib
60
#          m68881/
61
#                 newlib
62
#
63
# The nice feature about this arrangement is that inter-library references
64
# in the build tree work without having to care where you are.  Note that
65
# inter-library references also work in the source tree because symlink trees
66
# are built when srcdir=.
67
#
68
# Unfortunately, trying to access the libraries in the build tree requires
69
# the user to manually choose which library to use as GCC won't be able to
70
# find the right one.  This is viewed as the lesser of two evils.
71
#
72
# Configure variables:
73
# ${with_target_subdir} = "." for native, or ${target_alias} for cross.
74
# Set by top level Makefile.
75
# ${with_multisrctop} = how many levels of multilibs there are in the source
76
# tree.  It exists to handle the case of configuring in the source tree:
77
# ${srcdir} is not constant.
78
# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881).
79
#
80
# Makefile variables:
81
# MULTISRCTOP = number of multilib levels in source tree (+1 if cross)
82
# (FIXME: note that this is different than ${with_multisrctop}.  Check out.).
83
# MULTIBUILDTOP = number of multilib levels in build tree
84
# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...)
85
# (only defined in each library's main Makefile).
86
# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000)
87
# (only defined in each multilib subdir).
88
 
89
# FIXME: Multilib is currently disabled by default for everything other than
90
# newlib.  It is up to each target to turn on multilib support for the other
91
# libraries as desired.
92
 
93
# Autoconf incoming variables:
94
# srcdir, host, ac_configure_args
95
#
96
# We *could* figure srcdir and host out, but we'd have to do work that
97
# our caller has already done to figure them out and requiring these two
98
# seems reasonable.
99
# Note that `host' in this case is GCC's `target'.  Target libraries are
100
# configured for a particular host.
101
 
102
Makefile=${ac_file-Makefile}
103
ml_config_shell=${CONFIG_SHELL-/bin/sh}
104
ml_realsrcdir=${srcdir}
105
 
106
# Scan all the arguments and set all the ones we need.
107
 
108
ml_verbose=--verbose
109
for option in ${ac_configure_args}
110
do
111
  # strip single quotes surrounding individual options
112
  case $option in
113
  \'*\') eval option=$option ;;
114
  esac
115
 
116
  case $option in
117
  --*) ;;
118
  -*) option=-$option ;;
119
  esac
120
 
121
  case $option in
122
  --*=*)
123
        optarg=`echo $option | sed -e 's/^[^=]*=//'`
124
        ;;
125
  esac
126
 
127
  case $option in
128
  --disable-*)
129
        enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
130
        eval $enableopt=no
131
        ;;
132
  --enable-*)
133
        case "$option" in
134
        *=*)    ;;
135
        *)      optarg=yes ;;
136
        esac
137
        enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
138
        eval $enableopt="$optarg"
139
        ;;
140
  --norecursion | --no-recursion)
141
        ml_norecursion=yes
142
        ;;
143
  --silent | --sil* | --quiet | --q*)
144
        ml_verbose=--silent
145
        ;;
146
  --verbose | --v | --verb*)
147
        ml_verbose=--verbose
148
        ;;
149
  --with-*)
150
        case "$option" in
151
        *=*)    ;;
152
        *)      optarg=yes ;;
153
        esac
154
        withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
155
        eval $withopt="$optarg"
156
        ;;
157
  --without-*)
158
        withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
159
        eval $withopt=no
160
        ;;
161
  esac
162
done
163
 
164
# Only do this if --enable-multilib.
165
if [ "${enable_multilib}" = yes ]; then
166
 
167
# Compute whether this is the library's top level directory
168
# (ie: not a multilib subdirectory, and not a subdirectory like newlib/src).
169
# ${with_multisubdir} tells us we're in the right branch, but we could be
170
# in a subdir of that.
171
# ??? The previous version could void this test by separating the process into
172
# two files: one that only the library's toplevel configure.in ran (to
173
# configure the multilib subdirs), and another that all configure.in's ran to
174
# update the Makefile.  It seemed reasonable to collapse all multilib support
175
# into one file, but it does leave us with having to perform this test.
176
ml_toplevel_p=no
177
if [ -z "${with_multisubdir}" ]; then
178
  if [ "${srcdir}" = "." ]; then
179
    # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
180
    # ${with_target_subdir} = "." for native, otherwise target alias.
181
    if [ "${with_target_subdir}" = "." ]; then
182
      if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
183
        ml_toplevel_p=yes
184
      fi
185
    else
186
      if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then
187
        ml_toplevel_p=yes
188
      fi
189
    fi
190
  else
191
    # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}.
192
    if [ -f ${ml_realsrcdir}/../config-ml.in ]; then
193
      ml_toplevel_p=yes
194
    fi
195
  fi
196
fi
197
 
198
# If this is the library's top level directory, set multidirs to the
199
# multilib subdirs to support.  This lives at the top because we need
200
# `multidirs' set right away.
201
 
202
if [ "${ml_toplevel_p}" = yes ]; then
203
 
204
multidirs=
205
for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
206
  dir=`echo $i | sed -e 's/;.*$//'`
207
  if [ "${dir}" = "." ]; then
208
    true
209
  else
210
    if [ -z "${multidirs}" ]; then
211
      multidirs="${dir}"
212
    else
213
      multidirs="${multidirs} ${dir}"
214
    fi
215
  fi
216
done
217
 
218
# Target libraries are configured for the host they run on, so we check
219
# $host here, not $target.
220
 
221
case "${host}" in
222
arc-*-elf*)
223
        if [ x$enable_biendian != xyes ]
224
        then
225
          old_multidirs=${multidirs}
226
          multidirs=""
227
          for x in ${old_multidirs}; do
228
            case "${x}" in
229
              *be*) : ;;
230
              *) multidirs="${multidirs} ${x}" ;;
231
            esac
232
          done
233
        fi
234
        ;;
235
arm-*-*)
236
        if [ x"$enable_fpu" = xno ]
237
        then
238
          old_multidirs=${multidirs}
239
          multidirs=""
240
          for x in ${old_multidirs}; do
241
            case "${x}" in
242
              *fpu*) : ;;
243
              *) multidirs="${multidirs} ${x}" ;;
244
            esac
245
          done
246
        fi
247
        if [ x"$enable_26bit" = xno ]
248
        then
249
          old_multidirs=${multidirs}
250
          multidirs=""
251
          for x in ${old_multidirs}; do
252
            case "${x}" in
253
              *26bit*) : ;;
254
              *) multidirs="${multidirs} ${x}" ;;
255
            esac
256
          done
257
        fi
258
        if [ x"$enable_underscore" = xno ]
259
        then
260
          old_multidirs=${multidirs}
261
          multidirs=""
262
          for x in ${old_multidirs}; do
263
            case "${x}" in
264
              *under*) : ;;
265
              *) multidirs="${multidirs} ${x}" ;;
266
            esac
267
          done
268
        fi
269
        if [ x"$enable_interwork" = xno ]
270
        then
271
          old_multidirs=${multidirs}
272
          multidirs=""
273
          for x in ${old_multidirs}; do
274
            case "${x}" in
275
              *interwork*) : ;;
276
              *) multidirs="${multidirs} ${x}" ;;
277
            esac
278
          done
279
        fi
280
        if [ x$enable_biendian = xno ]
281
        then
282
          old_multidirs="${multidirs}"
283
          multidirs=""
284
          for x in ${old_multidirs}; do
285
            case "$x" in
286
              *le* ) : ;;
287
              *be* ) : ;;
288
              *) multidirs="${multidirs} ${x}" ;;
289
            esac
290
          done
291
        fi
292
        if [ x"$enable_nofmult" = xno ]
293
        then
294
          old_multidirs="${multidirs}"
295
          multidirs=""
296
          for x in ${old_multidirs}; do
297
            case "$x" in
298
              *nofmult* ) : ;;
299
              *) multidirs="${multidirs} ${x}" ;;
300
            esac
301
          done
302
        fi
303
        ;;
304
m68*-*-*)
305
        if [ x$enable_softfloat = xno ]
306
        then
307
          old_multidirs="${multidirs}"
308
          multidirs=""
309
          for x in ${old_multidirs}; do
310
            case "$x" in
311
              *soft-float* ) : ;;
312
              *) multidirs="${multidirs} ${x}" ;;
313
            esac
314
          done
315
        fi
316
        if [ x$enable_m68881 = xno ]
317
        then
318
          old_multidirs="${multidirs}"
319
          multidirs=""
320
          for x in ${old_multidirs}; do
321
            case "$x" in
322
              *m68881* ) : ;;
323
              *) multidirs="${multidirs} ${x}" ;;
324
            esac
325
          done
326
        fi
327
        if [ x$enable_m68000 = xno ]
328
        then
329
          old_multidirs="${multidirs}"
330
          multidirs=""
331
          for x in ${old_multidirs}; do
332
            case "$x" in
333
              *m68000* ) : ;;
334
              *) multidirs="${multidirs} ${x}" ;;
335
            esac
336
          done
337
        fi
338
        if [ x$enable_m68020 = xno ]
339
        then
340
          old_multidirs="${multidirs}"
341
          multidirs=""
342
          for x in ${old_multidirs}; do
343
            case "$x" in
344
              *m68020* ) : ;;
345
              *) multidirs="${multidirs} ${x}" ;;
346
            esac
347
          done
348
        fi
349
        ;;
350
mips*-*-*)
351
        if [ x$enable_single_float = xno ]
352
        then
353
          old_multidirs="${multidirs}"
354
          multidirs=""
355
          for x in ${old_multidirs}; do
356
            case "$x" in
357
              *single* ) : ;;
358
              *) multidirs="${multidirs} ${x}" ;;
359
            esac
360
          done
361
        fi
362
        if [ x$enable_biendian = xno ]
363
        then
364
          old_multidirs="${multidirs}"
365
          multidirs=""
366
          for x in ${old_multidirs}; do
367
            case "$x" in
368
              *el* ) : ;;
369
              *eb* ) : ;;
370
              *) multidirs="${multidirs} ${x}" ;;
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
              *) multidirs="${multidirs} ${x}" ;;
382
            esac
383
          done
384
        fi
385
        case " $multidirs " in
386
        *" mabi=64 "*)
387
          # We will not be able to create libraries with -mabi=64 if
388
          # we cannot even link a trivial program.  It usually
389
          # indicates the 64bit libraries are missing.
390
          if echo 'main() {}' > conftest.c &&
391
             ${CC-gcc} -mabi=64 conftest.c -o conftest; then
392
            :
393
          else
394
            echo Could not link program with -mabi=64, disabling it.
395
            old_multidirs="${multidirs}"
396
            multidirs=""
397
            for x in ${old_multidirs}; do
398
              case "$x" in
399
              *mabi=64* ) : ;;
400
              *) multidirs="${multidirs} ${x}" ;;
401
              esac
402
            done
403
          fi
404
          rm -f conftest.c conftest
405
          ;;
406
        esac
407
        ;;
408
powerpc*-*-* | rs6000*-*-*)
409
        if [ x$enable_aix64 = xno ]
410
        then
411
          old_multidirs="${multidirs}"
412
          multidirs=""
413
          for x in ${old_multidirs}; do
414
            case "$x" in
415
              *ppc64* ) : ;;
416
              *) multidirs="${multidirs} ${x}" ;;
417
            esac
418
          done
419
        fi
420
        if [ x$enable_pthread = xno ]
421
        then
422
          old_multidirs="${multidirs}"
423
          multidirs=""
424
          for x in ${old_multidirs}; do
425
            case "$x" in
426
              *pthread* ) : ;;
427
              *) multidirs="${multidirs} ${x}" ;;
428
            esac
429
          done
430
        fi
431
        if [ x$enable_softfloat = xno ]
432
        then
433
          old_multidirs="${multidirs}"
434
          multidirs=""
435
          for x in ${old_multidirs}; do
436
            case "$x" in
437
              *soft-float* ) : ;;
438
              *) multidirs="${multidirs} ${x}" ;;
439
            esac
440
          done
441
        fi
442
        if [ x$enable_powercpu = xno ]
443
        then
444
          old_multidirs="${multidirs}"
445
          multidirs=""
446
          for x in ${old_multidirs}; do
447
            case "$x" in
448
              power | */power | */power/* ) : ;;
449
              *) multidirs="${multidirs} ${x}" ;;
450
            esac
451
          done
452
        fi
453
        if [ x$enable_powerpccpu = xno ]
454
        then
455
          old_multidirs="${multidirs}"
456
          multidirs=""
457
          for x in ${old_multidirs}; do
458
            case "$x" in
459
              *powerpc* ) : ;;
460
              *) multidirs="${multidirs} ${x}" ;;
461
            esac
462
          done
463
        fi
464
        if [ x$enable_powerpcos = xno ]
465
        then
466
          old_multidirs="${multidirs}"
467
          multidirs=""
468
          for x in ${old_multidirs}; do
469
            case "$x" in
470
              *mcall-linux* | *mcall-solaris* ) : ;;
471
              *) multidirs="${multidirs} ${x}" ;;
472
            esac
473
          done
474
        fi
475
        if [ x$enable_biendian = xno ]
476
        then
477
          old_multidirs="${multidirs}"
478
          multidirs=""
479
          for x in ${old_multidirs}; do
480
            case "$x" in
481
              *mlittle* | *mbig* ) : ;;
482
              *) multidirs="${multidirs} ${x}" ;;
483
            esac
484
          done
485
        fi
486
        if [ x$enable_sysv = xno ]
487
        then
488
          old_multidirs="${multidirs}"
489
          multidirs=""
490
          for x in ${old_multidirs}; do
491
            case "$x" in
492
              *mcall-sysv* ) : ;;
493
              *) multidirs="${multidirs} ${x}" ;;
494
            esac
495
          done
496
        fi
497
        ;;
498
sparc*-*-*)
499
        case " $multidirs " in
500
        *" m64 "*)
501
          # We will not be able to create libraries with -m64 if
502
          # we cannot even link a trivial program.  It usually
503
          # indicates the 64bit libraries are missing.
504
          if echo 'main() {}' > conftest.c &&
505
             ${CC-gcc} -m64 conftest.c -o conftest; then
506
            :
507
          else
508
            echo Could not link program with -m64, disabling it.
509
            old_multidirs="${multidirs}"
510
            multidirs=""
511
            for x in ${old_multidirs}; do
512
              case "$x" in
513
              *m64* ) : ;;
514
              *) multidirs="${multidirs} ${x}" ;;
515
              esac
516
            done
517
          fi
518
          rm -f conftest.c conftest
519
          ;;
520
        esac
521
        ;;
522
esac
523
 
524
# Remove extraneous blanks from multidirs.
525
# Tests like `if [ -n "$multidirs" ]' require it.
526
multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'`
527
 
528
# Add code to library's top level makefile to handle building the multilib
529
# subdirs.
530
 
531
cat > Multi.tem <<\EOF
532
 
533
PWD_COMMAND=$${PWDCMD-pwd}
534
 
535
# FIXME: There should be an @-sign in front of the `if'.
536
# Leave out until this is tested a bit more.
537
multi-do:
538
        if [ -z "$(MULTIDIRS)" ]; then \
539
          true; \
540
        else \
541
          rootpre=`${PWD_COMMAND}`/; export rootpre; \
542
          srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \
543
          lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \
544
          compiler="$(CC)"; \
545
          for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \
546
            dir=`echo $$i | sed -e 's/;.*$$//'`; \
547
            if [ "$${dir}" = "." ]; then \
548
              true; \
549
            else \
550
              if [ -d ../$${dir}/$${lib} ]; then \
551
                flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
552
                if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \
553
                                CFLAGS="$(CFLAGS) $${flags}" \
554
                                CCASFLAGS="$(CCASFLAGS) $${flags}" \
555
                                FCFLAGS="$(FCFLAGS) $${flags}" \
556
                                FFLAGS="$(FFLAGS) $${flags}" \
557
                                ADAFLAGS="$(ADAFLAGS) $${flags}" \
558
                                prefix="$(prefix)" \
559
                                exec_prefix="$(exec_prefix)" \
560
                                GCJFLAGS="$(GCJFLAGS) $${flags}" \
561
                                CXXFLAGS="$(CXXFLAGS) $${flags}" \
562
                                LIBCFLAGS="$(LIBCFLAGS) $${flags}" \
563
                                LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \
564
                                LDFLAGS="$(LDFLAGS) $${flags}" \
565
                                MULTIFLAGS="$${flags}" \
566
                                DESTDIR="$(DESTDIR)" \
567
                                INSTALL="$(INSTALL)" \
568
                                INSTALL_DATA="$(INSTALL_DATA)" \
569
                                INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \
570
                                INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \
571
                                $(DO)); then \
572
                  true; \
573
                else \
574
                  exit 1; \
575
                fi; \
576
              else true; \
577
              fi; \
578
            fi; \
579
          done; \
580
        fi
581
 
582
# FIXME: There should be an @-sign in front of the `if'.
583
# Leave out until this is tested a bit more.
584
multi-clean:
585
        if [ -z "$(MULTIDIRS)" ]; then \
586
          true; \
587
        else \
588
          lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
589
          for dir in : $(MULTIDIRS); do \
590
            test $$dir != : || continue; \
591
EOF
592
cat >>Multi.tem <
593
            if [ -f ../\$\${dir}/\$\${lib}/${Makefile} ]; then \\
594
EOF
595
cat >>Multi.tem <<\EOF
596
              if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \
597
              then true; \
598
              else exit 1; \
599
              fi; \
600
            else true; \
601
            fi; \
602
          done; \
603
        fi
604
EOF
605
 
606
cat ${Makefile} Multi.tem > Makefile.tem
607
rm -f ${Makefile} Multi.tem
608
mv Makefile.tem ${Makefile}
609
 
610
fi # ${ml_toplevel_p} = yes
611
 
612
if [ "${ml_verbose}" = --verbose ]; then
613
  echo "Adding multilib support to ${Makefile} in ${ml_realsrcdir}"
614
  if [ "${ml_toplevel_p}" = yes ]; then
615
    echo "multidirs=${multidirs}"
616
  fi
617
  echo "with_multisubdir=${with_multisubdir}"
618
fi
619
 
620
if [ "${srcdir}" = "." ]; then
621
  if [ "${with_target_subdir}" != "." ]; then
622
    ml_srcdotdot="../"
623
  else
624
    ml_srcdotdot=""
625
  fi
626
else
627
  ml_srcdotdot=""
628
fi
629
 
630
if [ -z "${with_multisubdir}" ]; then
631
  ml_subdir=
632
  ml_builddotdot=
633
  : # ml_srcdotdot= # already set
634
else
635
  ml_subdir="/${with_multisubdir}"
636
  # The '[^/][^/]*' appears that way to work around a SunOS sed bug.
637
  ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/
638
  if [ "$srcdir" = "." ]; then
639
    ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot}
640
  else
641
    : # ml_srcdotdot= # already set
642
  fi
643
fi
644
 
645
if [ "${ml_toplevel_p}" = yes ]; then
646
  ml_do='$(MAKE)'
647
  ml_clean='$(MAKE)'
648
else
649
  ml_do=true
650
  ml_clean=true
651
fi
652
 
653
# TOP is used by newlib and should not be used elsewhere for this purpose.
654
# MULTI{SRC,BUILD}TOP are the proper ones to use.  MULTISRCTOP is empty
655
# when srcdir != builddir.  MULTIBUILDTOP is always some number of ../'s.
656
# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can
657
# delete TOP.  Newlib may wish to continue to use TOP for its own purposes
658
# of course.
659
# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile)
660
# and lists the subdirectories to recurse into.
661
# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile
662
# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with
663
# a leading '/'.
664
# MULTIDO is used for targets like all, install, and check where
665
# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed.
666
# MULTICLEAN is used for the *clean targets.
667
#
668
# ??? It is possible to merge MULTIDO and MULTICLEAN into one.  They are
669
# currently kept separate because we don't want the *clean targets to require
670
# the existence of the compiler (which MULTIDO currently requires) and
671
# therefore we'd have to record the directory options as well as names
672
# (currently we just record the names and use --print-multi-lib to get the
673
# options).
674
 
675
sed -e "s:^TOP[         ]*=[    ]*\([./]*\)[    ]*$:TOP = ${ml_builddotdot}\1:" \
676
    -e "s:^MULTISRCTOP[         ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \
677
    -e "s:^MULTIBUILDTOP[       ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \
678
    -e "s:^MULTIDIRS[   ]*=.*$:MULTIDIRS = ${multidirs}:" \
679
    -e "s:^MULTISUBDIR[         ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \
680
    -e "s:^MULTIDO[     ]*=.*$:MULTIDO = $ml_do:" \
681
    -e "s:^MULTICLEAN[  ]*=.*$:MULTICLEAN = $ml_clean:" \
682
        ${Makefile} > Makefile.tem
683
rm -f ${Makefile}
684
mv Makefile.tem ${Makefile}
685
 
686
# If this is the library's top level, configure each multilib subdir.
687
# This is done at the end because this is the loop that runs configure
688
# in each multilib subdir and it seemed reasonable to finish updating the
689
# Makefile before going on to configure the subdirs.
690
 
691
if [ "${ml_toplevel_p}" = yes ]; then
692
 
693
# We must freshly configure each subdirectory.  This bit of code is
694
# actually partially stolen from the main configure script.  FIXME.
695
 
696
if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
697
 
698
  if [ "${ml_verbose}" = --verbose ]; then
699
    echo "Running configure in multilib subdirs ${multidirs}"
700
    echo "pwd: `${PWDCMD-pwd}`"
701
  fi
702
 
703
  ml_origdir=`${PWDCMD-pwd}`
704
  ml_libdir=`echo "$ml_origdir" | sed -e 's,^.*/,,'`
705
  # cd to top-level-build-dir/${with_target_subdir}
706
  cd ..
707
 
708
  for ml_dir in ${multidirs}; do
709
 
710
    if [ "${ml_verbose}" = --verbose ]; then
711
      echo "Running configure in multilib subdir ${ml_dir}"
712
      echo "pwd: `${PWDCMD-pwd}`"
713
    fi
714
 
715
    if [ -d ${ml_dir} ]; then true; else
716
      # ``mkdir -p ${ml_dir}'' See also mkinstalldirs.
717
      pathcomp=""
718
      for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do
719
        pathcomp="$pathcomp$d"
720
        case "$pathcomp" in
721
          -* ) pathcomp=./$pathcomp ;;
722
        esac
723
        if test ! -d "$pathcomp"; then
724
           echo "mkdir $pathcomp" 1>&2
725
           mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
726
        fi
727
        if test ! -d "$pathcomp"; then
728
           exit $lasterr
729
        fi
730
        pathcomp="$pathcomp/"
731
      done
732
    fi
733
    if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi
734
 
735
    # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../
736
    dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'`
737
 
738
    case ${srcdir} in
739
    ".")
740
      echo "Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}"
741
      if [ "${with_target_subdir}" != "." ]; then
742
        ml_unsubdir="../"
743
      else
744
        ml_unsubdir=""
745
      fi
746
      (cd ${ml_dir}/${ml_libdir};
747
       ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
748
      if [ -f ${ml_dir}/${ml_libdir}/${Makefile} ]; then
749
        if [ x"${MAKE}" = x ]; then
750
          (cd ${ml_dir}/${ml_libdir}; make distclean)
751
        else
752
          (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
753
        fi
754
      fi
755
      ml_newsrcdir="."
756
      ml_srcdiroption=
757
      multisrctop=${dotdot}
758
      ;;
759
    *)
760
      case "${srcdir}" in
761
      /* | [A-Za-z]:[\\/]* ) # absolute path
762
        ml_newsrcdir=${srcdir}
763
        ;;
764
      *) # otherwise relative
765
        ml_newsrcdir=${dotdot}${srcdir}
766
        ;;
767
      esac
768
      ml_srcdiroption="-srcdir=${ml_newsrcdir}"
769
      multisrctop=
770
      ;;
771
    esac
772
 
773
    case "${progname}" in
774
    /* | [A-Za-z]:[\\/]* )     ml_recprog=${progname} ;;
775
    *)      ml_recprog=${dotdot}${progname} ;;
776
    esac
777
 
778
    # FIXME: POPDIR=${PWD=`pwd`} doesn't work here.
779
    ML_POPDIR=`${PWDCMD-pwd}`
780
    cd ${ml_dir}/${ml_libdir}
781
 
782
    if [ -f ${ml_newsrcdir}/configure ]; then
783
      ml_recprog="${ml_newsrcdir}/configure"
784
    fi
785
 
786
    # find compiler flag corresponding to ${ml_dir}
787
    for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do
788
      dir=`echo $i | sed -e 's/;.*$//'`
789
      if [ "${dir}" = "${ml_dir}" ]; then
790
        flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`
791
        break
792
      fi
793
    done
794
    ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags"'
795
 
796
    if [ "${with_target_subdir}" = "." ]; then
797
        CC_=$CC' '
798
        CXX_=$CXX' '
799
        F77_=$F77' '
800
        GCJ_=$GCJ' '
801
        GFORTRAN_=$GFORTRAN' '
802
    else
803
        # Create a regular expression that matches any string as long
804
        # as ML_POPDIR.
805
        popdir_rx=`echo "${ML_POPDIR}" | sed 's,.,.,g'`
806
        CC_=
807
        for arg in ${CC}; do
808
          case $arg in
809
          -[BIL]"${ML_POPDIR}"/*)
810
            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"`' ' ;;
811
          "${ML_POPDIR}"/*)
812
            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"`' ' ;;
813
          *)
814
            CC_="${CC_}${arg} " ;;
815
          esac
816
        done
817
 
818
        CXX_=
819
        for arg in ${CXX}; do
820
          case $arg in
821
          -[BIL]"${ML_POPDIR}"/*)
822
            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"`' ' ;;
823
          "${ML_POPDIR}"/*)
824
            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"`' ' ;;
825
          *)
826
            CXX_="${CXX_}${arg} " ;;
827
          esac
828
        done
829
 
830
        F77_=
831
        for arg in ${F77}; do
832
          case $arg in
833
          -[BIL]"${ML_POPDIR}"/*)
834
            F77_="${F77_}"`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"`' ' ;;
835
          "${ML_POPDIR}"/*)
836
            F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
837
          *)
838
            F77_="${F77_}${arg} " ;;
839
          esac
840
        done
841
 
842
        GCJ_=
843
        for arg in ${GCJ}; do
844
          case $arg in
845
          -[BIL]"${ML_POPDIR}"/*)
846
            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"`' ' ;;
847
          "${ML_POPDIR}"/*)
848
            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"`' ' ;;
849
          *)
850
            GCJ_="${GCJ_}${arg} " ;;
851
          esac
852
        done
853
 
854
        GFORTRAN_=
855
        for arg in ${GFORTRAN}; do
856
          case $arg in
857
          -[BIL]"${ML_POPDIR}"/*)
858
            GFORTRAN_="${GFORTRAN_}"`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"`' ' ;;
859
          "${ML_POPDIR}"/*)
860
            GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;;
861
          *)
862
            GFORTRAN_="${GFORTRAN_}${arg} " ;;
863
          esac
864
        done
865
 
866
        if test "x${LD_LIBRARY_PATH+set}" = xset; then
867
          LD_LIBRARY_PATH_=
868
          for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do
869
            case "$arg" in
870
            "${ML_POPDIR}"/*)
871
              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"`
872
              ;;
873
            esac
874
            if test "x$LD_LIBRARY_PATH_" != x; then
875
              LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg
876
            else
877
              LD_LIBRARY_PATH_=$arg
878
            fi
879
          done
880
          ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_"
881
        fi
882
 
883
        if test "x${SHLIB_PATH+set}" = xset; then
884
          SHLIB_PATH_=
885
          for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do
886
            case "$arg" in
887
            "${ML_POPDIR}"/*)
888
              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"`
889
              ;;
890
            esac
891
            if test "x$SHLIB_PATH_" != x; then
892
              SHLIB_PATH_=$SHLIB_PATH_:$arg
893
            else
894
              SHLIB_PATH_=$arg
895
            fi
896
          done
897
          ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_"
898
        fi
899
    fi
900
 
901
    if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \
902
        --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \
903
        ${ac_configure_args} ${ml_config_env} ${ml_srcdiroption} ; then
904
      true
905
    else
906
      exit 1
907
    fi
908
 
909
    cd "${ML_POPDIR}"
910
 
911
  done
912
 
913
  cd "${ml_origdir}"
914
fi
915
 
916
fi # ${ml_toplevel_p} = yes
917
fi # ${enable_multilib} = yes

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.