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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [configure] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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