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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib/] [configure] - Blame information for rev 39

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

Line No. Rev Author Line
1 39 lampret
#!/bin/sh
2
 
3
### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
4
 
5
# Configuration script
6
# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
7
# Free Software Foundation, Inc.
8
 
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
 
23
# This file was originally written by K. Richard Pixley.
24
 
25
#
26
# Shell script to create proper links to machine-dependent files in
27
# preparation for compilation.
28
#
29
# If configure succeeds, it leaves its status in config.status.
30
# If configure fails after disturbing the status quo,
31
#       config.status is removed.
32
#
33
 
34
export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
35
 
36
remove=rm
37
hard_link=ln
38
symbolic_link='ln -s'
39
 
40
#for Test
41
#remove="echo rm"
42
#hard_link="echo ln"
43
#symbolic_link="echo ln -s"
44
 
45
# clear some things potentially inherited from environment.
46
 
47
Makefile=Makefile
48
Makefile_in=Makefile.in
49
arguments=
50
build_alias=
51
cache_file=config.cache
52
cache_file_option=
53
configdirs=
54
diroptions=
55
exec_prefix=
56
exec_prefixoption=
57
fatal=
58
floating_point=default
59
gas=default
60
host_alias=NOHOST
61
host_makefile_frag=
62
moveifchange=
63
norecursion=
64
other_options=
65
package_makefile_frag=
66
package_makefile_rules_frag=
67
prefix=/usr/local
68
progname=
69
program_prefix=
70
program_prefixoption=
71
program_suffix=
72
program_suffixoption=
73
program_transform_name=
74
program_transform_nameoption=
75
redirect=
76
removing=
77
site=
78
site_makefile_frag=
79
site_option=
80
srcdir=
81
srctrigger=
82
subdirs=
83
target_alias=NOTARGET
84
target_makefile_frag=
85
undefs=NOUNDEFS
86
version="$Revision: 1.1.1.1 $"
87
x11=default
88
bindir='${exec_prefix}/bin'
89
sbindir='${exec_prefix}/sbin'
90
libexecdir='${exec_prefix}/libexec'
91
datadir='${prefix}/share'
92
sysconfdir='${prefix}/etc'
93
sharedstatedir='${prefix}/com'
94
localstatedir='${prefix}/var'
95
libdir='${exec_prefix}/lib'
96
includedir='${prefix}/include'
97
oldincludedir='/usr/include'
98
infodir='${prefix}/info'
99
mandir='${prefix}/man'
100
 
101
### we might need to use some other shell than /bin/sh for running subshells
102
 
103
### If we are on Windows, search for the shell.  This will permit people
104
### to not have /bin/sh, but to be able to see /SOME/PATH/sh configure
105
### without also having to set CONFIG_SHELL.  This code will work when
106
### using bash, which sets OSTYPE.
107
case "${OSTYPE}" in
108
*win32*)
109
  if [ x${CONFIG_SHELL} = x ]; then
110
    if [ ! -f /bin/sh ]; then
111
      if [ x${SHELL} != x ] && [ -f ${SHELL} ]; then
112
        CONFIG_SHELL=${SHELL}
113
        export CONFIG_SHELL
114
      else
115
        for prog in sh sh.exe bash bash.exe; do
116
          IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
117
          for dir in $PATH; do
118
            test -z "$dir" && dir=.
119
            if test -f $dir/$prog; then
120
              CONFIG_SHELL=$dir/$prog
121
              export CONFIG_SHELL
122
              break
123
            fi
124
          done
125
          IFS="$save_ifs"
126
          test -n "${CONFIG_SHELL}" && break
127
        done
128
      fi
129
    fi
130
  fi
131
  ;;
132
esac
133
 
134
config_shell=${CONFIG_SHELL-/bin/sh}
135
 
136
NO_EDIT="This file was generated automatically by configure.  Do not edit."
137
 
138
## this is a little touchy and won't always work, but...
139
##
140
## if the argv[0] starts with a slash then it is an absolute name that can (and
141
## must) be used as is.
142
##
143
## otherwise, if argv[0] has no slash in it, we can assume that it is on the
144
## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
145
##
146
 
147
progname=$0
148
# if PWD already has a value, it is probably wrong.
149
if [ -n "$PWD" ]; then PWD=`pwd`; fi
150
 
151
case "${progname}" in
152
/*) ;;
153
*/*) ;;
154
*)
155
        PATH=$PATH:${PWD=`pwd`} ; export PATH
156
        ;;
157
esac
158
 
159
# Loop over all args
160
 
161
while :
162
do
163
 
164
# Break out if there are no more args
165
        case $# in
166
        0)
167
                break
168
                ;;
169
        esac
170
 
171
# Get the first arg, and shuffle
172
        option=$1
173
        shift
174
 
175
# Make all options have two hyphens
176
        orig_option=$option     # Save original for error messages
177
        case $option in
178
        --*) ;;
179
        -*) option=-$option ;;
180
        esac
181
 
182
# Split out the argument for options that take them
183
        case $option in
184
        --*=*)
185
                optarg=`echo $option | sed -e 's/^[^=]*=//'`
186
                arguments="$arguments $option"
187
                ;;
188
# These options have mandatory values.  Since we didn't find an = sign,
189
# the value must be in the next argument
190
        --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
191
                optarg=$1
192
                shift
193
                arguments="$arguments $option=$optarg"
194
                ;;
195
        --v)
196
                arguments="$arguments -v"
197
                ;;
198
        --*)
199
                arguments="$arguments $option"
200
                ;;
201
        esac
202
 
203
# Now, process the options
204
        case $option in
205
 
206
        --bi*)
207
                bindir=$optarg
208
                diroptions="$diroptions --bindir=$optarg"
209
                ;;
210
        --build* | --bu*)
211
                case "$build_alias" in
212
                "") build_alias=$optarg ;;
213
                *) echo '***' Can only configure for one build machine at a time.  1>&2
214
                   fatal=yes
215
                   ;;
216
                esac
217
                ;;
218
        --cache*)
219
                cache_file=$optarg
220
                ;;
221
        --da*)
222
                datadir=$optarg
223
                diroptions="$diroptions --datadir=$optarg"
224
                ;;
225
        --disable-*)
226
                enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
227
                eval $enableopt=no
228
                disableoptions="$disableoptions $option"
229
                ;;
230
        --enable-*)
231
                case "$option" in
232
                *=*)    ;;
233
                *)      optarg=yes ;;
234
                esac
235
 
236
                enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
237
                eval "$enableopt='$optarg'"
238
                enableoptions="$enableoptions '$option'"
239
                ;;
240
        --exec-prefix* | --ex*)
241
                exec_prefix=$optarg
242
                exec_prefixoption="--exec-prefix=$optarg"
243
                ;;
244
        --gas | --g*)
245
                gas=yes
246
                ;;
247
        --help | --he*)
248
                fatal=yes
249
                ;;
250
        --host* | --ho*)
251
                case $host_alias in
252
                NOHOST) host_alias=$optarg ;;
253
                *) echo '***' Can only configure for one host at a time.  1>&2
254
                   fatal=yes
255
                   ;;
256
                esac
257
                ;;
258
        --inc*)
259
                includedir=$optarg
260
                diroptions="$diroptions --includedir=$optarg"
261
                ;;
262
        --inf*)
263
                infodir=$optarg
264
                diroptions="$diroptions --infodir=$optarg"
265
                ;;
266
        --libd*)
267
                libdir=$optarg
268
                diroptions="$diroptions --libdir=$optarg"
269
                ;;
270
        --libe*)
271
                libexecdir=$optarg
272
                diroptions="$diroptions --libexecdir=$optarg"
273
                ;;
274
        --lo*)
275
                localstatedir=$optarg
276
                diroptions="$diroptions --localstatedir=$optarg"
277
                ;;
278
        --ma*)
279
                mandir=$optarg
280
                diroptions="$diroptions --mandir=$optarg"
281
                ;;
282
        --nfp | --nf*)
283
                floating_point=no
284
                floating_pointoption="--nfp"
285
                ;;
286
        --norecursion | --no*)
287
                norecursion=yes
288
                ;;
289
        --ol*)
290
                oldincludedir=$optarg
291
                diroptions="$diroptions --oldincludedir=$optarg"
292
                ;;
293
        --prefix* | --pre*)
294
                prefix=$optarg
295
                prefixoption="--prefix=$optarg"
296
                ;;
297
        --program-prefix* | --program-p*)
298
                program_prefix=$optarg
299
                program_prefixoption="--program-prefix=$optarg"
300
                ;;
301
        --program-suffix* | --program-s*)
302
                program_suffix=$optarg
303
                program_suffixoption="--program-suffix=$optarg"
304
                ;;
305
        --program-transform-name* | --program-t*)
306
                # Double any backslashes or dollar signs in the argument
307
                program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
308
                program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
309
                ;;
310
        --rm)
311
                removing=--rm
312
                ;;
313
        --sb*)
314
                sbindir=$optarg
315
                diroptions="$diroptions --sbindir=$optarg"
316
                ;;
317
        --sh*)
318
                sharedstatedir=$optarg
319
                diroptions="$diroptions --sharedstatedir=$optarg"
320
                ;;
321
        --silent | --sil* | --quiet | --q*)
322
                redirect=">/dev/null"
323
                verbose=--silent
324
                ;;
325
        --site* | --sit*)
326
                site=$optarg
327
                site_option="--site=$optarg"
328
                ;;
329
        --srcdir*/ | --sr*/)
330
                # Remove trailing slashes.  Otherwise, when the file name gets
331
                # bolted into an object file as debug info, it has two slashes
332
                # in it.  Ordinarily this is ok, but emacs takes double slash
333
                # to mean "forget the first part".
334
                srcdir=`echo $optarg | sed -e 's:/$::'`
335
                ;;
336
        --srcdir* | --sr*)
337
                srcdir=$optarg
338
                ;;
339
        --sy*)
340
                sysconfdir=$optarg
341
                diroptions="$diroptions --sysconfdir=$optarg"
342
                ;;
343
        --target* | --ta*)
344
                case $target_alias in
345
                NOTARGET) target_alias=$optarg ;;
346
                *) echo '***' Can only configure for one target at a time.  1>&2
347
                   fatal=yes
348
                   ;;
349
                esac
350
                ;;
351
        --tmpdir* | --tm*)
352
                TMPDIR=$optarg
353
                tmpdiroption="--tmpdir=$optarg"
354
                ;;
355
        --verbose | --v | --verb*)
356
                redirect=
357
                verbose=--verbose
358
                ;;
359
        --version | --V | --vers*)
360
                echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
361
                exit 0
362
                ;;
363
        --with-*)
364
                case "$option" in
365
                *=*)    ;;
366
                *)      optarg=yes ;;
367
                esac
368
 
369
                withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
370
                eval $withopt="$optarg"
371
                withoptions="$withoptions $option"
372
                ;;
373
        --without-*)
374
                withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
375
                eval $withopt=no
376
                withoutoptions="$withoutoptions $option"
377
                ;;
378
        --x)    with_x=yes
379
                withoptions="$withoptions --with-x"
380
                ;;
381
        --x-i* | --x-l*) other_options="$other_options $orig_option"
382
                ;;
383
        --*)
384
                echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
385
                exit 1
386
                ;;
387
        *)
388
                case $undefs in
389
                NOUNDEFS) undefs=$option ;;
390
                *) echo '***' Can only configure for one host and one target at a time.  1>&2
391
                   fatal=yes
392
                   ;;
393
                esac
394
                ;;
395
        esac
396
done
397
 
398
# process host and target
399
 
400
# Do some error checking and defaulting for the host and target type.
401
# The inputs are:
402
#    configure --host=HOST --target=TARGET UNDEFS
403
#
404
# The rules are:
405
# 1. You aren't allowed to specify --host, --target, and undefs at the
406
#    same time.
407
# 2. Host defaults to undefs.
408
# 3. If undefs is not specified, then host defaults to the current host,
409
#    as determined by config.guess.
410
# 4. Target defaults to undefs.
411
# 5. If undefs is not specified, then target defaults to host.
412
 
413
case "${fatal}" in
414
"")
415
        # Make sure that host, target & undefs aren't all specified at the
416
        # same time.
417
        case $host_alias---$target_alias---$undefs in
418
        NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
419
                ;;
420
        *) echo '***' Can only configure for one host and one target at a time.  1>&2
421
           fatal=yes
422
           break 2
423
                ;;
424
        esac
425
 
426
        # Now, do defaulting for host.
427
        case $host_alias in
428
        NOHOST)
429
                case $undefs in
430
                NOUNDEFS)
431
                        # Neither --host option nor undefs were present.
432
                        # Call config.guess.
433
                        guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
434
                        if host_alias=`${config_shell} ${guesssys}`
435
                        then
436
                                # If the string we are going to use for
437
                                # the target is a prefix of the string
438
                                # we just guessed for the host, then
439
                                # assume we are running native, and force
440
                                # the same string for both target and host.
441
                                case $target_alias in
442
                                NOTARGET) ;;
443
                                *)
444
                                        if expr $host_alias : $target_alias >/dev/null
445
                                        then
446
                                                host_alias=$target_alias
447
                                        fi
448
                                        ;;
449
                                esac
450
                                echo "Configuring for a ${host_alias} host." 1>&2
451
                                arguments="--host=$host_alias $arguments"
452
                        else
453
                                echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
454
                                fatal=yes
455
                        fi
456
                        ;;
457
                *)
458
                        host_alias=$undefs
459
                        arguments="--host=$host_alias $arguments"
460
                        undefs=NOUNDEFS
461
                        ;;
462
                esac
463
        esac
464
 
465
        # Do defaulting for target.  If --target option isn't present, default
466
        # to undefs.  If undefs isn't present, default to host.
467
        case $target_alias in
468
        NOTARGET)
469
                case $undefs in
470
                NOUNDEFS)
471
                        target_alias=$host_alias
472
                        ;;
473
                *)
474
                        target_alias=$undefs
475
                        arguments="--target=$target_alias $arguments"
476
                        ;;
477
                esac
478
        esac
479
        ;;
480
*) ;;
481
esac
482
 
483
if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
484
        exec 1>&2
485
        echo Usage: configure [OPTIONS] [HOST]
486
        echo
487
        echo Options: [defaults in brackets]
488
        echo ' --prefix=MYDIR            install into MYDIR [/usr/local]'
489
        echo ' --exec-prefix=MYDIR       install host-dependent files into MYDIR [/usr/local]'
490
        echo ' --help                    print this message [normal config]'
491
        echo ' --build=BUILD             configure for building on BUILD [BUILD=HOST]'
492
        echo ' --host=HOST               configure for HOST [determined via config.guess]'
493
        echo ' --norecursion             configure this directory only [recurse]'
494
        echo ' --program-prefix=FOO      prepend FOO to installed program names [""]'
495
        echo ' --program-suffix=FOO      append FOO to installed program names [""]'
496
        echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
497
        echo ' --site=SITE               configure with site-specific makefile for SITE'
498
        echo ' --srcdir=DIR              find the sources in DIR [. or ..]'
499
        echo ' --target=TARGET   configure for TARGET [TARGET=HOST]'
500
        echo ' --tmpdir=TMPDIR   create temporary files in TMPDIR [/tmp]'
501
        echo ' --nfp                     configure for software floating point [hard float]'
502
        echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
503
        echo ' --without-FOO             package FOO is NOT available'
504
        echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
505
        echo ' --disable-FOO             do not include feature FOO'
506
        echo
507
        echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
508
        echo
509
        if [ -r config.status ] ; then
510
                cat config.status
511
        fi
512
 
513
        exit 1
514
fi
515
 
516
configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
517
moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
518
 
519
# this is a hack.  sun4 must always be a valid host alias or this will fail.
520
if ${config_shell} ${configsub} sun4 >/dev/null 2>&1 ; then
521
        true
522
else
523
        echo '***' cannot find config.sub.  1>&2
524
        exit 1
525
fi
526
 
527
touch config.junk
528
if ${config_shell} ${moveifchange} config.junk config.trash ; then
529
        true
530
else
531
        echo '***' cannot find move-if-change.  1>&2
532
        exit 1
533
fi
534
rm -f config.junk config.trash
535
 
536
case "${srcdir}" in
537
"")
538
        if [ -r configure.in ] ; then
539
                srcdir=.
540
        else
541
                if [ -r ${progname}.in ] ; then
542
                        srcdir=`echo ${progname} | sed 's:/configure$::'`
543
                else
544
                        echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
545
                        exit 1
546
                fi
547
        fi
548
        ;;
549
*)
550
        # Set srcdir to "." if that's what it is.
551
        # This is important for multilib support.
552
        if [ ! -d ${srcdir} ] ; then
553
                echo "Invalid source directory ${srcdir}" >&2
554
                exit 1
555
        fi
556
        pwd=`pwd`
557
        srcpwd=`cd ${srcdir} ; pwd`
558
        if [ "${pwd}" = "${srcpwd}" ] ; then
559
                srcdir=.
560
        fi
561
esac
562
 
563
### warn about some conflicting configurations.
564
 
565
case "${srcdir}" in
566
".") ;;
567
*)
568
        if [ -f ${srcdir}/config.status ] ; then
569
                echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
570
                exit 1
571
        fi
572
esac
573
 
574
 
575
# default exec_prefix
576
case "${exec_prefixoption}" in
577
"") exec_prefix="\$(prefix)" ;;
578
*) ;;
579
esac
580
 
581
### break up ${srcdir}/configure.in.
582
case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
583
"")
584
        echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
585
        # Check for a directory that's been converted to use autoconf since
586
        # it was last configured.
587
        if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
588
          echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
589
          if [ -r ${srcdir}/configure ] ; then
590
            echo '***' Running the local configure script. 1>&2
591
            case "${cache_file}" in
592
            "") cache_file_option= ;;
593
            *)  cache_file_option="--cache-file=${cache_file}" ;;
594
            esac
595
            srcdiroption="--srcdir=${srcdir}"
596
            case "${build_alias}" in
597
            "") buildopt= ;;
598
            *)  buildopt="--build=${build_alias}" ;;
599
            esac
600
            eval exec ${config_shell} ${srcdir}/configure ${verbose} \
601
                ${buildopt} --host=${host_alias} --target=${target_alias} \
602
                ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
603
                ${srcdiroption} ${diroptions} \
604
                ${program_prefixoption} ${program_suffixoption} \
605
                ${program_transform_nameoption} ${site_option} \
606
                ${withoptions} ${withoutoptions} \
607
                ${enableoptions} ${disableoptions} ${floating_pointoption} \
608
                ${cache_file_option} ${removing} ${other_options} ${redirect}
609
          else
610
            echo '***' There is no configure script present though. 1>&2
611
          fi
612
        fi
613
        exit 1
614
        ;;
615
*) ;;
616
esac
617
 
618
case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
619
"")
620
        echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
621
        exit 1
622
        ;;
623
*) ;;
624
esac
625
 
626
case "${TMPDIR}" in
627
"") TMPDIR=/tmp ; export TMPDIR ;;
628
*) ;;
629
esac
630
 
631
# keep this filename short for &%*%$*# 14 char file names
632
tmpfile=${TMPDIR}/cONf$$
633
# Note that under many versions of sh a trap handler for 0 will *override* any
634
# exit status you explicitly specify!  At this point, the only non-error exit
635
# is at the end of the script; these actions are duplicated there, minus
636
# the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
637
# trap handler, or you'll lose.
638
trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
639
 
640
# split ${srcdir}/configure.in into common, per-host, per-target,
641
# and post-target parts.  Post-target is optional.
642
sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
643
sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
644
if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
645
  sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
646
  sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
647
else
648
  sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
649
  echo >${tmpfile}.pos
650
fi
651
 
652
### do common part of configure.in
653
 
654
. ${tmpfile}.com
655
 
656
# some sanity checks on configure.in
657
case "${srctrigger}" in
658
"")
659
        echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
660
        exit 1
661
        ;;
662
*) ;;
663
esac
664
 
665
case "${build_alias}" in
666
"")
667
        if result=`${config_shell} ${configsub} ${host_alias}` ; then
668
            build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
669
            build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
670
            build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
671
            build=${build_cpu}-${build_vendor}-${build_os}
672
            build_alias=${host_alias}
673
        fi
674
        ;;
675
*)
676
        if result=`${config_shell} ${configsub} ${build_alias}` ; then
677
            buildopt="--build=${build_alias}"
678
            build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
679
            build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
680
            build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
681
            build=${build_cpu}-${build_vendor}-${build_os}
682
        else
683
            echo "Unrecognized build system name ${build_alias}." 1>&2
684
            exit 1
685
        fi
686
        ;;
687
esac
688
 
689
if result=`${config_shell} ${configsub} ${host_alias}` ; then
690
    true
691
else
692
    echo "Unrecognized host system name ${host_alias}." 1>&2
693
    exit 1
694
fi
695
host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
696
host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
697
host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
698
host=${host_cpu}-${host_vendor}-${host_os}
699
 
700
. ${tmpfile}.hst
701
 
702
if result=`${config_shell} ${configsub} ${target_alias}` ; then
703
    true
704
else
705
    echo "Unrecognized target system name ${target_alias}." 1>&2
706
    exit 1
707
fi
708
target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
709
target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
710
target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
711
target=${target_cpu}-${target_vendor}-${target_os}
712
 
713
. ${tmpfile}.tgt
714
 
715
# Find the source files, if location was not specified.
716
case "${srcdir}" in
717
"")
718
        srcdirdefaulted=1
719
        srcdir=.
720
        if [ ! -r ${srctrigger} ] ; then
721
                srcdir=..
722
        fi
723
        ;;
724
*) ;;
725
esac
726
 
727
if [ ! -r ${srcdir}/${srctrigger} ] ; then
728
        case "${srcdirdefaulted}" in
729
        "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
730
        *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
731
        esac
732
 
733
        echo '***' \(At least ${srctrigger} is missing.\) 1>&2
734
        exit 1
735
fi
736
 
737
# Some systems (e.g., one of the i386-aix systems the gas testers are
738
# using) don't handle "\$" correctly, so don't use it here.
739
tooldir='$(exec_prefix)'/${target_alias}
740
 
741
if [ "${host_alias}" != "${target_alias}" ] ; then
742
    if [ "${program_prefixoption}" = "" ] ; then
743
        if [ "${program_suffixoption}" = "" ] ; then
744
            if [ "${program_transform_nameoption}" = "" ] ; then
745
                program_prefix=${target_alias}- ;
746
            fi
747
        fi
748
    fi
749
fi
750
 
751
# Merge program_prefix and program_suffix onto program_transform_name.
752
# (program_suffix used to use $, but it's hard to preserve $ through both
753
# make and sh.)
754
if [ "${program_suffix}" != "" ] ; then
755
    program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
756
fi
757
 
758
if [ "${program_prefix}" != "" ] ; then
759
    program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
760
fi
761
 
762
# If CC and CXX are not set in the environment, and the Makefile
763
# exists, try to extract them from it.  This is to handle running
764
# ./config.status by hand.
765
if [ -z "${CC}" -a -r Makefile ]; then
766
  sed -n -e ':loop
767
/\\$/ N
768
s/\\\n//g
769
t loop
770
/^CC[   ]*=/ s/CC[      ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
771
  CC=`tail -1 Makefile.cc`
772
  rm -f Makefile.cc
773
fi
774
 
775
if [ -z "${CFLAGS}" -a -r Makefile ]; then
776
  sed -n -e ':loop
777
/\\$/ N
778
s/\\\n//g
779
t loop
780
/^CFLAGS[       ]*=/ s/CFLAGS[  ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
781
  CFLAGS=`tail -1 Makefile.cc`
782
  rm -f Makefile.cc
783
fi
784
 
785
if [ -z "${CXX}" -a -r Makefile ]; then
786
  sed -n -e ':loop
787
/\\$/ N
788
s/\\\n//g
789
t loop
790
/^CXX[  ]*=/ s/CXX[     ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
791
  CXX=`tail -1 Makefile.cc`
792
  rm -f Makefile.cc
793
fi
794
 
795
if [ -z "${CXXFLAGS}" -a -r Makefile ]; then
796
  sed -n -e ':loop
797
/\\$/ N
798
s/\\\n//g
799
t loop
800
/^CXXFLAGS[     ]*=/ s/CXXFLAGS[        ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
801
  CXXFLAGS=`tail -1 Makefile.cc`
802
  rm -f Makefile.cc
803
fi
804
 
805
# Generate a default definition for YACC.  This is used if the makefile can't
806
# locate bison or byacc in objdir.
807
 
808
for prog in 'bison -y' byacc yacc
809
do
810
  set dummy $prog; tmp=$2
811
  IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
812
  for dir in $PATH; do
813
    test -z "$dir" && dir=.
814
    if test -f $dir/$tmp; then
815
      DEFAULT_YACC="$prog"
816
      break
817
    fi
818
  done
819
  IFS="$save_ifs"
820
 
821
  test -n "$DEFAULT_YACC" && break
822
done
823
 
824
# Generate a default definition for LEX.  This is used if the makefile can't
825
# locate flex in objdir.
826
 
827
for prog in flex lex
828
do
829
  set dummy $prog; tmp=$2
830
  IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
831
  for dir in $PATH; do
832
    test -z "$dir" && dir=.
833
    if test -f $dir/$tmp; then
834
      DEFAULT_LEX="$prog"
835
      break
836
    fi
837
  done
838
  IFS="$save_ifs"
839
 
840
  test -n "$DEFAULT_LEX" && break
841
done
842
 
843
if [ "${build}" != "${host}" ]; then
844
  # If we are doing a Canadian Cross, in which the host and build systems
845
  # are not the same, we set reasonable default values for the tools.
846
 
847
  tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
848
  tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
849
  tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
850
  tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
851
  tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
852
  tools="${tools} WINDRES WINDRES_FOR_TARGET YACC"
853
 
854
  for var in ${tools}; do
855
    if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
856
      sed -n -e ':loop
857
/\\$/ N
858
s/\\\n//g
859
t loop
860
/^'"${var}"'[   ]*=/ s/'"${var}"'[      ]*=[    ]*\(.*\)/\1/p' \
861
        < Makefile > Makefile.v
862
      t=`tail -1 Makefile.v`
863
      if [ -n "${t}" ]; then
864
        eval "${var}='${t}'"
865
      fi
866
      rm -f Makefile.v
867
    fi
868
  done
869
 
870
  AR=${AR-${host_alias}-ar}
871
  AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
872
  AS=${AS-${host_alias}-as}
873
  AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
874
  BISON=${BISON-bison}
875
  CC=${CC-${host_alias}-gcc}
876
  CFLAGS=${CFLAGS-"-g -O2"}
877
  CXX=${CXX-${host_alias}-c++}
878
  CXXFLAGS=${CXXFLAGS-"-g -O2"}
879
  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
880
  CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
881
  CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
882
  DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
883
  DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
884
  GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
885
  HOST_PREFIX=${build_alias}-
886
  HOST_PREFIX_1=${build_alias}-
887
  LD=${LD-${host_alias}-ld}
888
  LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
889
  MAKEINFO=${MAKEINFO-makeinfo}
890
  NM=${NM-${host_alias}-nm}
891
  NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
892
  RANLIB=${RANLIB-${host_alias}-ranlib}
893
  RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
894
  WINDRES=${WINDRES-${host_alias}-windres}
895
  WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
896
 
897
  if [ -z "${YACC}" ]; then
898
    IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
899
    for dir in $PATH; do
900
      test -z "$dir" && dir=.
901
      if test -f $dir/bison; then
902
        YACC="bison -y"
903
        break
904
      fi
905
      if test -f $dir/byacc; then
906
        YACC=byacc
907
        break
908
      fi
909
      if test -f $dir/yacc; then
910
        YACC=yacc
911
        break
912
      fi
913
    done
914
    IFS="$save_ifs"
915
    if [ -z "${YACC}" ]; then
916
      YACC="bison -y"
917
    fi
918
  fi
919
 
920
  if [ -z "${LEX}" ]; then
921
    IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
922
    for dir in $PATH; do
923
      test -z "$dir" && dir=.
924
      if test -f $dir/flex; then
925
        LEX=flex
926
        break
927
      fi
928
      if test -f $dir/lex; then
929
        LEX=lex
930
        break
931
      fi
932
    done
933
    IFS="$save_ifs"
934
    LEX=${LEX-flex}
935
  fi
936
 
937
  # Export variables which autoconf might try to set.
938
  export AS
939
  export AR
940
  export CC_FOR_BUILD
941
  export DLLTOOL
942
  export LD
943
  export NM
944
  export RANLIB
945
  export WINDRES
946
else
947
  # If CC is still not set, try to get gcc.
948
  if [ -z "${CC}" ]; then
949
    IFS="${IFS=         }"; save_ifs="$IFS"; IFS="${IFS}:"
950
    for dir in $PATH; do
951
      test -z "$dir" && dir=.
952
      if test -f $dir/gcc; then
953
        CC="gcc"
954
        echo 'void f(){}' > conftest.c
955
        if test -z "`${CC} -g -c conftest.c 2>&1`"; then
956
          CFLAGS=${CFLAGS-"-g -O2"}
957
          CXXFLAGS=${CXXFLAGS-"-g -O2"}
958
        else
959
          CFLAGS=${CFLAGS-"-O2"}
960
          CXXFLAGS=${CXXFLAGS-"-O2"}
961
        fi
962
        rm -f conftest*
963
        break
964
      fi
965
    done
966
    IFS="$save_ifs"
967
    CC=${CC-cc}
968
  fi
969
 
970
  CXX=${CXX-"c++"}
971
  CFLAGS=${CFLAGS-"-g"}
972
  CXXFLAGS=${CXXFLAGS-"-g -O2"}
973
fi
974
 
975
export CC
976
export CXX
977
export CFLAGS
978
export CXXFLAGS
979
 
980
# FIXME: This should be in configure.in, not configure
981
case "$host" in
982
        *go32*)
983
            enable_gdbtk=no ;;
984
        *msdosdjgpp*)
985
            enable_gdbtk=no ;;
986
esac
987
 
988
# FIXME: This should be in configure.in, not configure
989
# Determine whether gdb needs tk/tcl or not.
990
if [ "$enable_gdbtk" != "no" ]; then
991
        GDB_TK="all-tcl all-tk all-itcl all-tix all-libgui"
992
else
993
        GDB_TK=""
994
fi
995
 
996
for subdir in . ${subdirs} ; do
997
 
998
    # ${subdir} is relative path from . to the directory we're currently
999
    # configuring.
1000
    # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
1001
    invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
1002
 
1003
    ### figure out what to do with srcdir
1004
    case "${srcdir}" in
1005
        ".")  # no -srcdir option.  We're building in place.
1006
                makesrcdir=. ;;
1007
        /*) # absolute path
1008
                makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
1009
                ;;
1010
        *) # otherwise relative
1011
                case "${subdir}" in
1012
                .) makesrcdir=${srcdir} ;;
1013
                *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
1014
                esac
1015
                ;;
1016
    esac
1017
 
1018
    if [ "${subdir}/" != "./" ] ; then
1019
        Makefile=${subdir}/Makefile
1020
    fi
1021
 
1022
    if [ ! -d ${subdir} ] ; then
1023
        if mkdir ${subdir} ; then
1024
                true
1025
        else
1026
                echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
1027
                exit 1
1028
        fi
1029
    fi
1030
 
1031
    case "${removing}" in
1032
    "")
1033
        case "${subdir}" in
1034
        .) ;;
1035
        *) eval echo Building in ${subdir} ${redirect} ;;
1036
        esac
1037
 
1038
        # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
1039
        # Set up the list of links to be made.
1040
        # ${links} is the list of link names, and ${files} is the list of names to link to.
1041
 
1042
        # Make the links.
1043
        configlinks="${links}"
1044
        if [ -r ${subdir}/config.status ] ; then
1045
                mv -f ${subdir}/config.status ${subdir}/config.back
1046
        fi
1047
        while [ -n "${files}" ] ; do
1048
                # set file to car of files, files to cdr of files
1049
                set ${files}; file=$1; shift; files=$*
1050
                set ${links}; link=$1; shift; links=$*
1051
 
1052
                if [ ! -r ${srcdir}/${file} ] ; then
1053
                        echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
1054
                        echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
1055
                        exit 1
1056
                fi
1057
 
1058
                ${remove} -f ${link}
1059
                # Make a symlink if possible, otherwise try a hard link
1060
                if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
1061
                        true
1062
                else
1063
                        # We need to re-remove the file because Lynx leaves a
1064
                        # very strange directory there when it fails an NFS symlink.
1065
                        ${remove} -r -f ${link}
1066
                        ${hard_link} ${srcdir}/${file} ${link}
1067
                fi
1068
                if [ ! -r ${link} ] ; then
1069
                        echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
1070
                        exit 1
1071
                fi
1072
 
1073
                echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
1074
        done
1075
 
1076
        # Create a .gdbinit file which runs the one in srcdir
1077
        # and tells GDB to look there for source files.
1078
 
1079
        if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
1080
                case ${srcdir} in
1081
                .) ;;
1082
                *) cat > ${subdir}/.gdbinit <
1083
# ${NO_EDIT}
1084
dir ${makesrcdir}
1085
dir .
1086
source ${makesrcdir}/.gdbinit
1087
EOF
1088
                        ;;
1089
                esac
1090
        fi
1091
 
1092
        # Install a makefile, and make it set VPATH
1093
        # if necessary so that the sources are found.
1094
        # Also change its value of srcdir.
1095
        # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
1096
        # been somewhat optimized and is perhaps a bit twisty.
1097
 
1098
        # code is order so as to try to sed the smallest input files we know.
1099
        # so do these separately because I don't trust the order of sed -e expressions.
1100
 
1101
        # the five makefile fragments MUST end up in the resulting Makefile in this order:
1102
        # package macros, target, host, site, and package rules.
1103
 
1104
        if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
1105
 
1106
            # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
1107
            rm -f ${subdir}/${Makefile}.tem
1108
            case "${package_makefile_rules_frag}" in
1109
              "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
1110
              *)
1111
                      if [ ! -f ${package_makefile_rules_frag} ] ; then
1112
                              package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
1113
                      fi
1114
                      if [ -f ${package_makefile_rules_frag} ] ; then
1115
                              sed -e "/^####/  r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
1116
                      else
1117
                              echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
1118
                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
1119
                              cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
1120
                      fi
1121
            esac
1122
            # working copy now in ${Makefile}.tem
1123
 
1124
            # Conditionalize for this site.
1125
            rm -f ${Makefile}
1126
              case "${site}" in
1127
              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1128
              *)
1129
                      site_makefile_frag=${srcdir}/config/ms-${site}
1130
 
1131
                      if [ -f ${site_makefile_frag} ] ; then
1132
                              sed -e "/^####/  r ${site_makefile_frag}" ${subdir}/Makefile.tem \
1133
                                      > ${Makefile}
1134
                      else
1135
                              mv ${subdir}/Makefile.tem ${Makefile}
1136
                              site_makefile_frag=
1137
                      fi
1138
                      ;;
1139
            esac
1140
            # working copy now in ${Makefile}
1141
 
1142
            # Conditionalize the makefile for this host.
1143
            rm -f ${subdir}/Makefile.tem
1144
            case "${host_makefile_frag}" in
1145
              "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1146
              *)
1147
                      if [ ! -f ${host_makefile_frag} ] ; then
1148
                              host_makefile_frag=${srcdir}/${host_makefile_frag}
1149
                      fi
1150
                      if [ -f ${host_makefile_frag} ] ; then
1151
                              sed -e "/^####/  r ${host_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1152
                      else
1153
                              echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
1154
                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
1155
                              mv ${Makefile} ${subdir}/Makefile.tem
1156
                      fi
1157
            esac
1158
            # working copy now in ${subdir)/Makefile.tem
1159
 
1160
            # Conditionalize the makefile for this target.
1161
            rm -f ${Makefile}
1162
            case "${target_makefile_frag}" in
1163
              "") mv ${subdir}/Makefile.tem ${Makefile} ;;
1164
              *)
1165
                      if [ ! -f ${target_makefile_frag} ] ; then
1166
                              target_makefile_frag=${srcdir}/${target_makefile_frag}
1167
                      fi
1168
                      if [ -f ${target_makefile_frag} ] ; then
1169
                              sed -e "/^####/  r ${target_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
1170
                      else
1171
                              mv ${subdir}/Makefile.tem ${Makefile}
1172
                              target_makefile_frag=
1173
                      fi
1174
                      ;;
1175
            esac
1176
            # working copy now in ${Makefile}
1177
 
1178
            # Emit the default values of this package's macros.
1179
            rm -f ${subdir}/Makefile.tem
1180
            case "${package_makefile_frag}" in
1181
              "") mv ${Makefile} ${subdir}/Makefile.tem ;;
1182
              *)
1183
                      if [ ! -f ${package_makefile_frag} ] ; then
1184
                              package_makefile_frag=${srcdir}/${package_makefile_frag}
1185
                      fi
1186
                      if [ -f ${package_makefile_frag} ] ; then
1187
                              sed -e "/^####/  r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
1188
                      else
1189
                              echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
1190
                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
1191
                              mv ${Makefile} ${subdir}/Makefile.tem
1192
                      fi
1193
            esac
1194
            # real copy now in ${subdir}/Makefile.tem
1195
 
1196
            # prepend warning about editting, and a bunch of variables.
1197
            rm -f ${Makefile}
1198
            cat > ${Makefile} <
1199
# ${NO_EDIT}
1200
VPATH = ${makesrcdir}
1201
links = ${configlinks}
1202
host_alias = ${host_alias}
1203
host_cpu = ${host_cpu}
1204
host_vendor = ${host_vendor}
1205
host_os = ${host_os}
1206
host_canonical = ${host_cpu}-${host_vendor}-${host_os}
1207
target_alias = ${target_alias}
1208
target_cpu = ${target_cpu}
1209
target_vendor = ${target_vendor}
1210
target_os = ${target_os}
1211
target_canonical = ${target_cpu}-${target_vendor}-${target_os}
1212
EOF
1213
            case "${build}" in
1214
              "") ;;
1215
              *)  cat >> ${Makefile} << EOF
1216
build_alias = ${build_alias}
1217
build_cpu = ${build_cpu}
1218
build_vendor = ${build_vendor}
1219
build_os = ${build_os}
1220
build_canonical = ${build_cpu}-${build_vendor}-${build_os}
1221
EOF
1222
            esac
1223
 
1224
            case "${package_makefile_frag}" in
1225
              "") ;;
1226
              /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
1227
              *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
1228
            esac
1229
 
1230
            case "${target_makefile_frag}" in
1231
              "") ;;
1232
              /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
1233
              *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
1234
            esac
1235
 
1236
            case "${host_makefile_frag}" in
1237
              "") ;;
1238
              /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
1239
              *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
1240
            esac
1241
 
1242
            if [ "${site_makefile_frag}" != "" ] ; then
1243
                echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
1244
            fi
1245
 
1246
            # provide a proper gxx_include_dir to all subdirs.
1247
            # Note, if you change the default, make sure to fix both here
1248
            # and in the gcc subdirectory.
1249
            if test -z "${with_gxx_include_dir}"; then
1250
                echo gxx_include_dir = '${prefix}/include/g++' >> ${Makefile}
1251
            else
1252
                echo gxx_include_dir = ${with_gxx_include_dir} >> ${Makefile}
1253
            fi
1254
 
1255
            # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
1256
            # remove any form feeds.
1257
            if [ -z "${subdirs}" ]; then
1258
                rm -f ${subdir}/Makefile.tm2
1259
                sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
1260
                    -e "s:^NONSUBDIRS[  ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
1261
                    ${subdir}/Makefile.tem > ${subdir}/Makefile.tm2
1262
                rm -f ${subdir}/Makefile.tem
1263
                mv ${subdir}/Makefile.tm2 ${subdir}/Makefile.tem
1264
            fi
1265
            sed     -e "s|^prefix[      ]*=.*$|prefix = ${prefix}|" \
1266
                    -e "s|^exec_prefix[         ]*=.*$|exec_prefix = ${exec_prefix}|" \
1267
                    -e "s|^bindir[      ]*=.*$|bindir = ${bindir}|" \
1268
                    -e "s|^sbindir[     ]*=.*$|sbindir = ${sbindir}|" \
1269
                    -e "s|^libexecdir[  ]*=.*$|libexecdir = ${libexecdir}|" \
1270
                    -e "s|^datadir[     ]*=.*$|datadir = ${datadir}|" \
1271
                    -e "s|^sysconfdir[  ]*=.*$|sysconfdir = ${sysconfdir}|" \
1272
                    -e "s|^sharedstatedir[      ]*=.*$|sharedstatedir = ${sharedstatedir}|" \
1273
                    -e "s|^localstatedir[       ]*=.*$|localstatedir = ${localstatedir}|" \
1274
                    -e "s|^libdir[      ]*=.*$|libdir = ${libdir}|" \
1275
                    -e "s|^includedir[  ]*=.*$|includedir = ${includedir}|" \
1276
                    -e "s|^oldincludedir[       ]*=.*$|oldincludedir = ${oldincludedir}|" \
1277
                    -e "s|^infodir[     ]*=.*$|infodir = ${infodir}|" \
1278
                    -e "s|^mandir[      ]*=.*$|mandir = ${mandir}|" \
1279
                    -e "/^CC[   ]*=/{
1280
                        :loop1
1281
                        /\\\\$/ N
1282
                        s/\\\\\\n//g
1283
                        t loop1
1284
                        s%^CC[  ]*=.*$%CC = ${CC}%
1285
                        }" \
1286
                    -e "/^CXX[  ]*=/{
1287
                        :loop2
1288
                        /\\\\$/ N
1289
                        s/\\\\\\n//g
1290
                        t loop2
1291
                        s%^CXX[         ]*=.*$%CXX = ${CXX}%
1292
                        }" \
1293
                    -e "/^CFLAGS[       ]*=/{
1294
                        :loop3
1295
                        /\\\\$/ N
1296
                        s/\\\\\\n//g
1297
                        t loop3
1298
                        s%^CFLAGS[      ]*=.*$%CFLAGS = ${CFLAGS}%
1299
                        }" \
1300
                    -e "/^CXXFLAGS[     ]*=/{
1301
                        :loop4
1302
                        /\\\\$/ N
1303
                        s/\\\\\\n//g
1304
                        t loop4
1305
                        s%^CXXFLAGS[    ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
1306
                        }" \
1307
                    -e "s|^SHELL[        ]*=.*$|SHELL = ${config_shell}|" \
1308
                    -e "s|^srcdir[      ]*=.*$|srcdir = ${makesrcdir}|" \
1309
                    -e "s///" \
1310
                    -e "s:^program_prefix[      ]*=.*$:program_prefix = ${program_prefix}:" \
1311
                    -e "s:^program_suffix[      ]*=.*$:program_suffix = ${program_suffix}:" \
1312
                    -e "s:^program_transform_name[      ]*=.*$:program_transform_name = ${program_transform_name}:" \
1313
                    -e "s|^tooldir[     ]*=.*$|tooldir = ${tooldir}|" \
1314
                    -e "s:^DEFAULT_YACC[         ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
1315
                    -e "s:^DEFAULT_LEX[  ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
1316
                    ${subdir}/Makefile.tem >> ${Makefile}
1317
            sed -e "s:^GDB_TK[   ]*=.*$:GDB_TK = ${GDB_TK}:" ${Makefile} >${Makefile}.tem
1318
            mv -f ${Makefile}.tem ${Makefile}
1319
 
1320
            # If this is a Canadian Cross, preset the values of many more
1321
            # tools.
1322
            if [ "${build}" != "${host}" ]; then
1323
                for var in ${tools}; do
1324
                    val=`eval 'echo $'"${var}"`
1325
                    sed -e "/^${var}[   ]*=/{
1326
                           :loop1
1327
                           /\\\\$/ N
1328
                           /\\\\$/ b loop1
1329
                           s/\\\\\\n//g
1330
                           s%^${var}[   ]*=.*$%${var} = ${val}%
1331
                           }" ${Makefile} > ${Makefile}.tem
1332
                    mv -f ${Makefile}.tem ${Makefile}
1333
                done
1334
            fi
1335
 
1336
            # final copy now in ${Makefile}
1337
 
1338
        else
1339
           echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
1340
        fi
1341
 
1342
        rm -f ${subdir}/Makefile.tem
1343
 
1344
        case "${host_makefile_frag}" in
1345
        "") using= ;;
1346
        *) using="and \"${host_makefile_frag}\"" ;;
1347
        esac
1348
 
1349
        case "${target_makefile_frag}" in
1350
        "") ;;
1351
        *) using="${using} and \"${target_makefile_frag}\"" ;;
1352
        esac
1353
 
1354
        case "${site_makefile_frag}" in
1355
        "") ;;
1356
        *) using="${using} and \"${site_makefile_frag}\"" ;;
1357
        esac
1358
 
1359
        newusing=`echo "${using}" | sed 's/and/using/'`
1360
        using=${newusing}
1361
        echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
1362
 
1363
        . ${tmpfile}.pos
1364
 
1365
        # describe the chosen configuration in config.status.
1366
        # Make that file a shellscript which will reestablish
1367
        # the same configuration.  Used in Makefiles to rebuild
1368
        # Makefiles.
1369
 
1370
        case "${norecursion}" in
1371
        "") arguments="${arguments} --norecursion" ;;
1372
        *) ;;
1373
        esac
1374
 
1375
        if [ ${subdir} = . ] ; then
1376
            echo "#!/bin/sh
1377
# ${NO_EDIT}
1378
# This directory was configured as follows:
1379
${progname}" ${arguments}  "
1380
# ${using}" > ${subdir}/config.new
1381
        else
1382
            echo "#!/bin/sh
1383
# ${NO_EDIT}
1384
# This directory was configured as follows:
1385
cd ${invsubdir}
1386
${progname}" ${arguments}  "
1387
# ${using}" > ${subdir}/config.new
1388
        fi
1389
        chmod a+x ${subdir}/config.new
1390
        if [ -r ${subdir}/config.back ] ; then
1391
                mv -f ${subdir}/config.back ${subdir}/config.status
1392
        fi
1393
        ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
1394
        ;;
1395
 
1396
    *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
1397
    esac
1398
done
1399
 
1400
# If there are subdirectories, then recur.
1401
if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
1402
        for configdir in ${configdirs} ; do
1403
 
1404
                if [ -d ${srcdir}/${configdir} ] ; then
1405
                        eval echo Configuring ${configdir}... ${redirect}
1406
                        case "${srcdir}" in
1407
                        ".") ;;
1408
                        *)
1409
                                if [ ! -d ./${configdir} ] ; then
1410
                                        if mkdir ./${configdir} ; then
1411
                                                true
1412
                                        else
1413
                                                echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
1414
                                                exit 1
1415
                                        fi
1416
                                fi
1417
                                ;;
1418
                        esac
1419
 
1420
                        POPDIR=${PWD=`pwd`}
1421
                        cd ${configdir}
1422
 
1423
### figure out what to do with srcdir
1424
                        case "${srcdir}" in
1425
                        ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
1426
                        /*) # absolute path
1427
                                newsrcdir=${srcdir}/${configdir}
1428
                                srcdiroption="--srcdir=${newsrcdir}"
1429
                                ;;
1430
                        ?:*) # absolute path on win32
1431
                                newsrcdir=${srcdir}/${configdir}
1432
                                srcdiroption="--srcdir=${newsrcdir}"
1433
                                ;;
1434
                        *) # otherwise relative
1435
                                newsrcdir=../${srcdir}/${configdir}
1436
                                srcdiroption="--srcdir=${newsrcdir}"
1437
                                ;;
1438
                        esac
1439
 
1440
                        # Handle --cache-file=../XXX
1441
                        case "${cache_file}" in
1442
                        "") # empty
1443
                                ;;
1444
                        /*) # absolute path
1445
                                cache_file_option="--cache-file=${cache_file}"
1446
                                ;;
1447
                        ?:*) # absolute path on win32
1448
                                cache_file_option="--cache-file=${cache_file}"
1449
                                ;;
1450
                        *) # relative path
1451
                                cache_file_option="--cache-file=../${cache_file}"
1452
                                ;;
1453
                        esac
1454
 
1455
### check for guested configure, otherwise fix possibly relative progname
1456
                        if [ -f ${newsrcdir}/configure ] ; then
1457
                                recprog=${newsrcdir}/configure
1458
                        elif [ -f ${newsrcdir}/configure.in ] ; then
1459
                                case "${progname}" in
1460
                                /*)     recprog=${progname} ;;
1461
                                ?:*)    recprog=${progname} ;;
1462
                                *)      recprog=../${progname} ;;
1463
                                esac
1464
                        else
1465
                                eval echo No configuration information in ${configdir} ${redirect}
1466
                                recprog=
1467
                        fi
1468
 
1469
### The recursion line is here.
1470
                        if [ ! -z "${recprog}" ] ; then
1471
                                if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
1472
                                        ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
1473
                                        ${srcdiroption} ${diroptions} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
1474
                                        true
1475
                                else
1476
                                        echo Configure in `pwd` failed, exiting. 1>&2
1477
                                        exit 1
1478
                                fi
1479
                        fi
1480
 
1481
                        cd ${POPDIR}
1482
                fi
1483
        done
1484
fi
1485
 
1486
# Perform the same cleanup as the trap handler, minus the "exit 1" of course,
1487
# and reset the trap handler.
1488
rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
1489
trap 0
1490
 
1491
exit 0
1492
 
1493
#
1494
# Local Variables:
1495
# fill-column: 131
1496
# End:
1497
#
1498
 
1499
# end of configure

powered by: WebSVN 2.1.0

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