File:  [gforth] / gforth / Attic / configure
Revision 1.1: download - view: text, annotated - select for diffs
Fri Nov 11 16:10:11 1994 UTC (29 years, 4 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
* added Backspaces for fast editing.
* modified GNU configure!!!

    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=
   87: 
   88: for arg in $*;
   89: do
   90:   case $next_arg in
   91:   --srcdir)
   92:     srcdir=$arg
   93:     next_arg=
   94:     ;;
   95:   --host)
   96:     host=$arg
   97:     next_arg=
   98:     ;;
   99:   --target)
  100:     target=$arg
  101:     next_arg=
  102:     ;;
  103:   --build)
  104:     build=$arg
  105:     next_arg=
  106:     ;;
  107:   --prefix)
  108:     prefix=$arg
  109:     next_arg=
  110:     ;;
  111:   --exec-prefix)
  112:     exec_prefix=$arg
  113:     next_arg=
  114:     ;;
  115:   --direct-threaded)
  116:     threading=-DDIRECT_THREADED
  117:     next_arg=
  118:     ;;
  119:   *)
  120:     case $arg in
  121:       -*)
  122: 	if [ x$name1 != x ]
  123: 	then
  124: 		echo "Positional arguments must be last." 1>&2
  125: 		exit 1
  126: 	fi
  127: 	;;
  128:     esac
  129: 
  130:     case $arg in
  131:      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
  132: 	next_arg=--srcdir
  133: 	;;
  134:      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
  135: 	srcdir=`echo $arg | sed 's/-*s[a-z]*=//'`
  136: 	;;
  137:      -host | --host | --hos | --ho)
  138: 	next_arg=--host
  139: 	;;
  140:      -host=* | --host=* | --hos=* | --ho=*)
  141: 	host=`echo $arg | sed 's/-*h[a-z]*=//'`
  142: 	;; 
  143:      -target | --target | --targe | --targ | --tar | --ta | --t)
  144: 	next_arg=--target
  145: 	;;
  146:      -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
  147: 	target=`echo $arg | sed 's/-*t[a-z]*=//'`
  148: 	;; 
  149:      -build | --build | --buil | --bui | --bu | --b)
  150: 	next_arg=--build
  151: 	;;
  152:      -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
  153: 	build=`echo $arg | sed 's/-*b[a-z]*=//'`
  154: 	;; 
  155:      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  156: 	next_arg=--prefix
  157: 	;;
  158:      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  159: 	prefix=`echo $arg | sed 's/-*p[a-z]*=//'`
  160: 	;;
  161:      -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre \
  162: 	| --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  163: 	next_arg=--exec-prefix
  164: 	;;
  165:      -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* \
  166: 	| --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* \
  167: 	| --exe=* | --ex=* | --e=*)
  168: 	exec_prefix=`echo $arg | sed 's/-*e[-a-z]*=//'`
  169:    ;;
  170:      -direct-threaded | --direct-threade | --direct-thread | --direct-threa \
  171:    | --direct-thre | --direct-thr | --direct-th | --direct-t | --direct- \
  172:    | --direct | --direc | --dire | --dir | --di | --d)
  173:     threading=-DDIRECT_THREADED
  174: 	;;
  175:      -with-* | --with-*) ;; #ignored
  176:      -without-* | --without-*) ;; #ignored
  177:      -enable-* | --enable-*) ;; #ignored
  178:      -x | --x) ;; # ignored
  179:      --he*) ;; # ignored for now (--help)
  180:      --vers*) ;; # ignored for now (--version)
  181:      --verb*) ;; # ignored for now (--verbose)
  182:      --program-*) ;; #ignored (--program-prefix, --program-suffix)
  183:      --c*) ;; #ignored (--cache-file)
  184:      --q*) ;; #ignored (--quiet)
  185:      --si*) ;; #ignored (--silent)
  186:      -*)
  187: 	echo "Invalid option \`$arg'" 1>&2
  188: 	exit 1
  189: 	;;
  190:      *)
  191: # Allow configure HOST TARGET.  If just one name is given, it is used
  192: # as both unless a host was previously given, in which case it is
  193: # just the target.
  194: 	if [ x$name1 != x ]
  195: 	then
  196: 		if [ x$name2 != x ]
  197: 		then
  198: 			echo "More than two configuration names." 1>&2
  199: 			exit 1
  200: 		fi
  201: 		name2=$arg
  202: 	elif [ x$host != x ]
  203: 	then
  204: 		name1=$host
  205: 		name2=$arg
  206: 		host=
  207: 	else
  208: 		name1=$arg
  209: 	fi
  210: 	;;
  211:     esac
  212:   esac
  213: done
  214: 
  215: if [ x$name1 != x ]
  216: then
  217: 	if [ x$name2 = x ]
  218: 	then
  219: 		name2=$name1
  220: 	fi
  221: 
  222: 	if [ x$host != x ]
  223: 	then
  224: 		echo "Duplicate specification of host." 1>&2
  225: 		exit 1
  226: 	fi
  227: 
  228: 	if [ x$target != x ]
  229: 	then
  230: 		echo "Duplicate specification of target." 1>&2
  231: 		exit 1
  232: 	fi
  233: 
  234: 	host=$name1
  235: 	build=$name1
  236: 	target=$name2
  237: fi
  238: 
  239: # Find the source files, if location was not specified.
  240: if [ x$srcdir = x ]
  241: then
  242: 	srcdirdefaulted=1
  243: 	srcdir=.
  244: 	if [ ! -r tree.c ]
  245: 	then
  246: 		srcdir=..
  247: 	fi
  248: fi
  249: 
  250: if [ ! -r ${srcdir}/engine.c ]
  251: then
  252: 	if [ x$srcdirdefaulted = x ]
  253: 	then
  254: 	  echo "$progname: Can't find compiler sources in \`${srcdir}'" 1>&2
  255: 	else
  256: 	  echo "$progname: Can't find compiler sources in \`.' or \`..'" 1>&2
  257: 	fi
  258: 	exit 1
  259: fi
  260: 
  261: if [ -r ${srcdir}/config.status ] && [ x$srcdir != x. ]
  262: then
  263: 	echo "$progname: \`configure' has been run in \`${srcdir}'" 1>&2
  264: 	exit 1
  265: fi
  266: 
  267: # Complain if an arg is missing
  268: if [ x$build = x ]
  269: then
  270: 	# If host was specified, always use it for build also to avoid
  271: 	# confusion.  If someone wants a cross compiler where build != host,
  272: 	# then they must specify build explicitly.  Since this case is
  273: 	# extremely rare, it does not matter that it is slightly inconvenient.
  274: 	if [ x$host != x ]
  275: 	then
  276: 		build=$host
  277: 	
  278: 	# This way of testing the result of a command substitution is
  279: 	# defined by Posix.2 (section 3.9.1) as well as traditional shells.
  280: 	elif build=`${srcdir}/config.guess`
  281: 	then
  282: 		echo "This appears to be a ${build} system." 1>&2
  283: 
  284: 	elif [ x$target != x ]
  285: 	then
  286: 		echo 'Config.guess failed to determine the host type.  Defaulting to target.'
  287: 		build=$target
  288: 	else
  289: 		echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  290: 		echo "\
  291: Usage: `basename $progname` [--host=HOST] [--build=BUILD]
  292:        [--prefix=DIR] [--exec-pref=DIR] TARGET" 1>&2
  293: 	echo "Where HOST, TARGET and BUILD are three-part configuration names " 1>&2
  294: 		if [ -r config.status ]
  295: 		then
  296: 			tail +2 config.status 1>&2
  297: 		fi
  298: 		exit 1
  299: 	fi
  300: fi
  301: 
  302: # If $host was not specified, use $build.
  303: if [ x$host = x ]
  304: then
  305: 	host=$build
  306: fi
  307: 
  308: # If $target was not specified, use $host.
  309: if [ x$target = x ]
  310: then
  311: 	target=$host
  312: fi
  313: 
  314: # Validate the specs, and canonicalize them.
  315: canon_build=`/bin/sh $srcdir/config.sub $build` || exit 1
  316: canon_host=`/bin/sh $srcdir/config.sub $host` || exit 1
  317: canon_target=`/bin/sh $srcdir/config.sub $target` || exit 1
  318: 
  319: # Decode the host machine, then the target machine.
  320: # For the host machine, we save the xm_file variable as host_xm_file;
  321: # then we decode the target machine and forget everything else
  322: # that came from the host machine.
  323: 
  324: cpu=
  325: bigendian=
  326: extra_lib=
  327: extra_obs=
  328: 
  329: case $target in
  330: 	# Support site-specific machine types.
  331: 	hppa*)
  332: 		cpu=hppa.h
  333: 		bigendian=1
  334: 		if [ x$threading = x ]
  335: 		then
  336: 			extra_obs="getopt1.o getopt.o"
  337: 		else
  338: 			extra_obs="getopt1.o getopt.o cache.o"
  339: 		fi
  340: 		flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
  341: 		defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
  342: 		;;
  343: 	sparc*)
  344: 		cpu=sparc.h
  345: 		bigendian=1
  346: 		extra_obs="getopt1.o getopt.o"
  347: 		flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
  348: 		defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
  349: 		;;
  350: 	i[345]86*)
  351: 		cpu=386.h
  352: 		bigendian=0
  353: 		extra_obs="getopt1.o getopt.o"
  354: 		flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
  355: 		defines="-D_POSIX_VERSION -DUSE_GETOPT $threading"
  356: 		;;
  357: 	mips-dec-ultrix*)
  358: 		cpu=decstation.h
  359: 		bigendian=0
  360: 		flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
  361: 		defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
  362: 		;;
  363: 	m68k*)
  364: 		cpu=apollo68k.h
  365: 		bigendian=1
  366: 		extra_obs="getopt1.o getopt.o"
  367: 		flags="-fforce-mem -fforce-addr -fomit-frame-pointer -fno-defer-pop -fcaller-saves"
  368: 		defines="-DUSE_TOS -DUSE_FTOS -D_POSIX_VERSION -DUSE_GETOPT $threading"
  369: 		;;
  370: 	*)
  371: 		;;
  372: esac
  373: 
  374: if [ x$cpu = x ]
  375: then
  376: 	echo "Unknown Machine $machine"
  377: 	exit 1
  378: fi
  379: 
  380: rm -f machine.h
  381: rm -f gforth.fi
  382: ln -s $cpu machine.h
  383: if [ x$bigendian = x1 ]
  384: then
  385: 	ln -s kernl32b.fi gforth.fi
  386: else
  387: 	ln -s kernl32l.fi gforth.fi
  388: fi
  389: 
  390: sed -e "s|^XCFLAGS[	]*=*\(.*\)$|XCFLAGS = \1 $flags|" \
  391:     -e "s|^XDEFINES[	]*=*\(.*\)$|XDEFINES = \1 $defines|" \
  392:     -e "s|^OBJECTS[	]*=*\(.*\)$|OBJECTS = \1 $extra_obs|" \
  393:     Makefile.in > Makefile
  394: 
  395: exit 0
  396: 

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