Annotation of gforth/configure, revision 1.5

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

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