Annotation of gforth/configure, revision 1.3

1.1       pazsan      1: #!/bin/sh
                      2: # Configuration script for GNU FORTH
                      3: #   Copyright (C) 1994 Free Software Foundation, Inc.
                      4: 
                      5: #This file is part of GNU CC.
                      6: 
                      7: #GNU FORTH is free software; you can redistribute it and/or modify
                      8: #it under the terms of the GNU General Public License as published by
                      9: #the Free Software Foundation; either version 2, or (at your option)
                     10: #any later version.
                     11: 
                     12: #GNU FORTH is distributed in the hope that it will be useful,
                     13: #but WITHOUT ANY WARRANTY; without even the implied warranty of
                     14: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     15: #GNU General Public License for more details.
                     16: 
                     17: #You should have received a copy of the GNU General Public License
                     18: #along with GNU FORTH; see the file COPYING.  If not, write to
                     19: #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
                     20: 
                     21: # This file is a derivate of configure for GNU CC
                     22: 
                     23: #
                     24: # Shell script to create proper links to machine-dependent files in
                     25: # preparation for compiling gcc.
                     26: #
                     27: # Options: --srcdir=DIR                specifies directory where sources are.
                     28: #         --host=HOST          specifies host configuration.
                     29: #         --target=TARGET      specifies target configuration.
                     30: #         --build=TARGET       specifies configuration of machine you are
                     31: #                              using to compile GCC.
                     32: #         --prefix=DIR         specifies directory to install in.
                     33: #         --exec-prefix=DIR    specifies directory to install executables in.
                     34: #         --direct-threade  specifies direct threading
                     35: #
                     36: # If configure succeeds, it leaves its status in config.status.
                     37: # If configure fails after disturbing the status quo, 
                     38: #      config.status is removed.
                     39: #
                     40: 
                     41: progname=$0
                     42: 
                     43: # Default --srcdir to the directory where the script is found, 
                     44: # if a directory was specified.
                     45: # The second sed call is to convert `.//configure' to `./configure'.
                     46: srcdir=`echo $0 | sed 's|//|/|' | sed 's|/[^/]*$||'`
                     47: if [ x$srcdir = x$0 ]
                     48: then
                     49: srcdir=
                     50: fi
                     51: 
                     52: host=
                     53: threading=
                     54: 
                     55: # Default prefix to /usr/local.
                     56: prefix=/usr/local
                     57: 
                     58: # local_prefix specifies where to find the directory /usr/local/include
                     59: # We don't use $(prefix) for this
                     60: # because we always want GCC to search /usr/local/include
                     61: # even if GCC is installed somewhere other than /usr/local.
                     62: # Think THREE TIMES before specifying any other value for this!
                     63: # DO NOT make this use $prefix!
                     64: local_prefix=/usr/local
                     65: # Default is to let the Makefile set exec_prefix from $(prefix)
                     66: exec_prefix='$(prefix)'
                     67: #
                     68: 
                     69: remove=rm
                     70: hard_link=ln
                     71: symbolic_link='ln -s'
                     72: copy=cp
                     73: 
                     74: # Record all the arguments, to write them in config.status.
                     75: arguments=$*
                     76: 
                     77: #for Test
                     78: #remove="echo rm"
                     79: #hard_link="echo ln"
                     80: #symbolic_link="echo ln -s"
                     81: 
                     82: target=
                     83: host=
                     84: build=
                     85: name1=
                     86: name2=
1.2       pazsan     87: debugging=-g
1.1       pazsan     88: 
                     89: for arg in $*;
                     90: do
                     91:   case $next_arg in
                     92:   --srcdir)
                     93:     srcdir=$arg
                     94:     next_arg=
                     95:     ;;
                     96:   --host)
                     97:     host=$arg
                     98:     next_arg=
                     99:     ;;
                    100:   --target)
                    101:     target=$arg
                    102:     next_arg=
                    103:     ;;
                    104:   --build)
                    105:     build=$arg
                    106:     next_arg=
                    107:     ;;
                    108:   --prefix)
                    109:     prefix=$arg
                    110:     next_arg=
                    111:     ;;
                    112:   --exec-prefix)
                    113:     exec_prefix=$arg
                    114:     next_arg=
                    115:     ;;
                    116:   --direct-threaded)
                    117:     threading=-DDIRECT_THREADED
                    118:     next_arg=
                    119:     ;;
                    120:   *)
                    121:     case $arg in
                    122:       -*)
                    123:        if [ x$name1 != x ]
                    124:        then
                    125:                echo "Positional arguments must be last." 1>&2
                    126:                exit 1
                    127:        fi
                    128:        ;;
                    129:     esac
                    130: 
                    131:     case $arg in
                    132:      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
                    133:        next_arg=--srcdir
                    134:        ;;
                    135:      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
                    136:        srcdir=`echo $arg | sed 's/-*s[a-z]*=//'`
                    137:        ;;
                    138:      -host | --host | --hos | --ho)
                    139:        next_arg=--host
                    140:        ;;
                    141:      -host=* | --host=* | --hos=* | --ho=*)
                    142:        host=`echo $arg | sed 's/-*h[a-z]*=//'`
                    143:        ;; 
                    144:      -target | --target | --targe | --targ | --tar | --ta | --t)
                    145:        next_arg=--target
                    146:        ;;
                    147:      -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
                    148:        target=`echo $arg | sed 's/-*t[a-z]*=//'`
                    149:        ;; 
                    150:      -build | --build | --buil | --bui | --bu | --b)
                    151:        next_arg=--build
                    152:        ;;
                    153:      -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
                    154:        build=`echo $arg | sed 's/-*b[a-z]*=//'`
                    155:        ;; 
                    156:      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
                    157:        next_arg=--prefix
                    158:        ;;
                    159:      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
                    160:        prefix=`echo $arg | sed 's/-*p[a-z]*=//'`
                    161:        ;;
                    162:      -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre \
                    163:        | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
                    164:        next_arg=--exec-prefix
                    165:        ;;
                    166:      -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* \
                    167:        | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* \
                    168:        | --exe=* | --ex=* | --e=*)
                    169:        exec_prefix=`echo $arg | sed 's/-*e[-a-z]*=//'`
                    170:    ;;
                    171:      -direct-threaded | --direct-threade | --direct-thread | --direct-threa \
                    172:    | --direct-thre | --direct-thr | --direct-th | --direct-t | --direct- \
                    173:    | --direct | --direc | --dire | --dir | --di | --d)
                    174:     threading=-DDIRECT_THREADED
1.2       pazsan    175:    ;;
                    176:      -without-debug | --without-debu | --without-deb | --without-de \
                    177:    | --without-d)
                    178:     debugging=
                    179:    ;;
1.1       pazsan    180:      -with-* | --with-*) ;; #ignored
                    181:      -without-* | --without-*) ;; #ignored
                    182:      -enable-* | --enable-*) ;; #ignored
                    183:      -x | --x) ;; # ignored
                    184:      --he*) ;; # ignored for now (--help)
                    185:      --vers*) ;; # ignored for now (--version)
                    186:      --verb*) ;; # ignored for now (--verbose)
                    187:      --program-*) ;; #ignored (--program-prefix, --program-suffix)
                    188:      --c*) ;; #ignored (--cache-file)
                    189:      --q*) ;; #ignored (--quiet)
                    190:      --si*) ;; #ignored (--silent)
                    191:      -*)
                    192:        echo "Invalid option \`$arg'" 1>&2
                    193:        exit 1
                    194:        ;;
                    195:      *)
                    196: # Allow configure HOST TARGET.  If just one name is given, it is used
                    197: # as both unless a host was previously given, in which case it is
                    198: # just the target.
                    199:        if [ x$name1 != x ]
                    200:        then
                    201:                if [ x$name2 != x ]
                    202:                then
                    203:                        echo "More than two configuration names." 1>&2
                    204:                        exit 1
                    205:                fi
                    206:                name2=$arg
                    207:        elif [ x$host != x ]
                    208:        then
                    209:                name1=$host
                    210:                name2=$arg
                    211:                host=
                    212:        else
                    213:                name1=$arg
                    214:        fi
                    215:        ;;
                    216:     esac
                    217:   esac
                    218: done
                    219: 
                    220: if [ x$name1 != x ]
                    221: then
                    222:        if [ x$name2 = x ]
                    223:        then
                    224:                name2=$name1
                    225:        fi
                    226: 
                    227:        if [ x$host != x ]
                    228:        then
                    229:                echo "Duplicate specification of host." 1>&2
                    230:                exit 1
                    231:        fi
                    232: 
                    233:        if [ x$target != x ]
                    234:        then
                    235:                echo "Duplicate specification of target." 1>&2
                    236:                exit 1
                    237:        fi
                    238: 
                    239:        host=$name1
                    240:        build=$name1
                    241:        target=$name2
                    242: fi
                    243: 
                    244: # Find the source files, if location was not specified.
                    245: if [ x$srcdir = x ]
                    246: then
                    247:        srcdirdefaulted=1
                    248:        srcdir=.
                    249:        if [ ! -r tree.c ]
                    250:        then
                    251:                srcdir=..
                    252:        fi
                    253: fi
                    254: 
                    255: if [ ! -r ${srcdir}/engine.c ]
                    256: then
                    257:        if [ x$srcdirdefaulted = x ]
                    258:        then
                    259:          echo "$progname: Can't find compiler sources in \`${srcdir}'" 1>&2
                    260:        else
                    261:          echo "$progname: Can't find compiler sources in \`.' or \`..'" 1>&2
                    262:        fi
                    263:        exit 1
                    264: fi
                    265: 
                    266: if [ -r ${srcdir}/config.status ] && [ x$srcdir != x. ]
                    267: then
                    268:        echo "$progname: \`configure' has been run in \`${srcdir}'" 1>&2
                    269:        exit 1
                    270: fi
                    271: 
                    272: # Complain if an arg is missing
                    273: if [ x$build = x ]
                    274: then
                    275:        # If host was specified, always use it for build also to avoid
                    276:        # confusion.  If someone wants a cross compiler where build != host,
                    277:        # then they must specify build explicitly.  Since this case is
                    278:        # extremely rare, it does not matter that it is slightly inconvenient.
                    279:        if [ x$host != x ]
                    280:        then
                    281:                build=$host
                    282:        
                    283:        # This way of testing the result of a command substitution is
                    284:        # defined by Posix.2 (section 3.9.1) as well as traditional shells.
                    285:        elif build=`${srcdir}/config.guess`
                    286:        then
                    287:                echo "This appears to be a ${build} system." 1>&2
                    288: 
                    289:        elif [ x$target != x ]
                    290:        then
                    291:                echo 'Config.guess failed to determine the host type.  Defaulting to target.'
                    292:                build=$target
                    293:        else
                    294:                echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
                    295:                echo "\
                    296: Usage: `basename $progname` [--host=HOST] [--build=BUILD]
                    297:        [--prefix=DIR] [--exec-pref=DIR] TARGET" 1>&2
                    298:        echo "Where HOST, TARGET and BUILD are three-part configuration names " 1>&2
                    299:                if [ -r config.status ]
                    300:                then
                    301:                        tail +2 config.status 1>&2
                    302:                fi
                    303:                exit 1
                    304:        fi
                    305: fi
                    306: 
                    307: # If $host was not specified, use $build.
                    308: if [ x$host = x ]
                    309: then
                    310:        host=$build
                    311: fi
                    312: 
                    313: # If $target was not specified, use $host.
                    314: if [ x$target = x ]
                    315: then
                    316:        target=$host
                    317: fi
                    318: 
                    319: # Validate the specs, and canonicalize them.
                    320: canon_build=`/bin/sh $srcdir/config.sub $build` || exit 1
                    321: canon_host=`/bin/sh $srcdir/config.sub $host` || exit 1
                    322: canon_target=`/bin/sh $srcdir/config.sub $target` || exit 1
                    323: 
                    324: # Decode the host machine, then the target machine.
                    325: # For the host machine, we save the xm_file variable as host_xm_file;
                    326: # then we decode the target machine and forget everything else
                    327: # that came from the host machine.
                    328: 
                    329: cpu=
                    330: bigendian=
                    331: extra_lib=
                    332: extra_obs=
                    333: 
                    334: case $target in
                    335:        # Support site-specific machine types.
                    336:        hppa*)
                    337:                cpu=hppa.h
                    338:                bigendian=1
                    339:                if [ x$threading = x ]
                    340:                then
                    341:                        extra_obs="getopt1.o getopt.o"
                    342:                else
                    343:                        extra_obs="getopt1.o getopt.o cache.o"
                    344:                fi
                    345:                flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
                    346:                defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
                    347:                ;;
                    348:        sparc*)
                    349:                cpu=sparc.h
                    350:                bigendian=1
                    351:                extra_obs="getopt1.o getopt.o"
                    352:                flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
                    353:                defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
                    354:                ;;
                    355:        i[345]86*)
                    356:                cpu=386.h
                    357:                bigendian=0
                    358:                extra_obs="getopt1.o getopt.o"
                    359:                flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
                    360:                defines="-D_POSIX_VERSION -DUSE_GETOPT $threading"
                    361:                ;;
                    362:        mips-dec-ultrix*)
                    363:                cpu=decstation.h
                    364:                bigendian=0
                    365:                flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
                    366:                defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
                    367:                ;;
                    368:        m68k*)
                    369:                cpu=apollo68k.h
                    370:                bigendian=1
                    371:                extra_obs="getopt1.o getopt.o"
                    372:                flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
                    373:                defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
                    374:                ;;
                    375:        *)
                    376:                ;;
                    377: esac
                    378: 
                    379: if [ x$cpu = x ]
                    380: then
                    381:        echo "Unknown Machine $machine"
                    382:        exit 1
                    383: fi
                    384: 
                    385: rm -f machine.h
                    386: rm -f gforth.fi
                    387: ln -s $cpu machine.h
                    388: if [ x$bigendian = x1 ]
                    389: then
                    390:        ln -s kernl32b.fi gforth.fi
                    391: else
                    392:        ln -s kernl32l.fi gforth.fi
                    393: fi
                    394: 
1.3     ! pazsan    395: if [ x$bigendian = x1 ]
        !           396: then
        !           397:    kernalswap='s|kernl32l.fi kernl32b.fi|kernl32b.fi kernl32l.fi|'
        !           398:    kernalexec='-e'
        !           399: fi
        !           400: 
1.2       pazsan    401: sed -e "s|^XCFLAGS[     ]*=*\(.*\)$|XCFLAGS    = \1 $flags|" \
                    402:     -e "s|^XDEFINES[    ]*=*\(.*\)$|XDEFINES   = \1 $defines|" \
                    403:     -e "s|^OBJECTS[     ]*=*\(.*\)$|OBJECTS    = \1 $extra_obs|" \
                    404:     -e "s|^CFLAGS[      ]*=*\(.*\)$|CFLAGS     = $debugging\1|" \
                    405:     -e "s|^LDFLAGS[     ]*=*\(.*\)$|LDFLAGS    = $debugging\1|" \
1.3     ! pazsan    406:     $kernalexec "$kernalswap" \
1.1       pazsan    407:     Makefile.in > Makefile
                    408: 
                    409: exit 0
                    410: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>