#!/bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically by autoconf.
# modified by Tristan Gingold ( Sun Apr 17 14:57:51 GMT+0100 1994 )
#  for Checker. Use part of gas-2.2/configure
#
# Copyright (C) 1991 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [TARGET]
# --gas --nfp --host are ignored.

set +u # Make sure unset variables are ok.

progname=$0
symbolic_link='ln -s'
hard_link=ln
config_files='Makefile machine.h symtab.c string.h'
arguments=$*
fatal=
lang=English

for arg in $*; do
  # Handle --srcdir with a space before the argument.
  if test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  # Handle --host with a space before the argument.
  elif test x$next_host = xyes; then next_host=
  else
    case $arg in
     --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
	case $srcdir in
	"")
		srcdir=`echo $arg | sed 's/[+-]*s[a-z]*=//'` ;;
	*)
		echo '***' Can only configure for one srcdir at a time.
		fatal=yes ;;
	esac
	;;
     --srcdir | --srcdi | --srcd | --src | --sr | --s)
	next_srcdir=yes ;;
     --host=* | --hos=* | --ho=* | --h=*)
	case $host in
	"")
        	host=`echo $arg | sed 's/[+-]*s[a-z]*=//'` ;
		echo $host is ignored ;;
	*)
		echo '***' Can only configure for one host at a time.
		fatal=yes ;;
	esac
	;;
     --host | --hos | --ho | --h)
	next_host=yes ;;
     --gas | --ga | --g) ;;
     --nfp | --nf | --n) ;;
     -help | --help)
	fatal=true ;;
     -norecursion | --no*) ;;
     -with*=* | --with*=*)
	withopt=`echo $arg | sed 's:^-*\(with[^=]*\)=.*$:\1:;s/-/_/g'`
	withval=`echo ${arg} | sed 's:^-*with[^=]*=\(.*\)$:\1:'`
	eval $withopt="$withval"
	;;
     -with* | --with*)
	withopt=`echo ${arg} | sed 's:^-*with:with:;s/-/_/g'`
	eval $withopt=yes
	;;
     -*)
	echo Option unknown: $arg
	fatal=true ;;
     *)
	target=`echo $arg | sed 's/[+-]*s[a-z]*=//'` ;;
    esac
  fi
done

if test x$fatal != x; then
        echo "Usage: configure HOST" ;
        echo ;
        echo "Options: [defaults in brackets]" ;
#        echo " --prefix=MYDIR            configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
#        echo " --exec-prefix=MYDIR       configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
        echo " --help                    print this message. [normal config]" ;
#        echo " --norecursion             configure this directory only. [recurse]" ;
#        echo " --program-prefix=FOO      install programs with FOO prepended to their names. [ \"\" ]" ;
#        echo " --program-suffix=FOO      install programs with FOO appended to their names. [ \"\" ]" ;
#        echo " --program-transform-name=FOO      install programs with names transformed by sed pattern FOO. [ \"\" ]" ;
#        echo " --site=SITE               configure with site specific makefile for SITE" ;
        echo " --srcdir=DIR              find the sources in DIR. [\".\" or \"..\"]" ;
#        echo " --target=TARGET           configure for TARGET.  [TARGET = HOST]" ;
#        echo " --tmpdir=TMPDIR           create temporary files in TMPDIR.  [ TMPDIR = \"/tmp\" ]" ;
#        echo " --nfp                     configure the compilers default to soft floating point. [hard float]" ;
        echo " --with-FOO, --with-FOO=BAR specify that FOO is available"
#        echo " --without-FOO             specify that FOO is NOT available"
        echo ;
        echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
        echo ;
#        if test -r config.status ; then
#                cat config.status
#        fi

        exit 1
fi

# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
unique_file=checker.h

# Find the source files, if location was not specified.
if test x$srcdir = x; then
  srcdirdefaulted=yes; srcdir=.
  if test ! -r $unique_file; then srcdir=..; fi
fi
if test ! -r $srcdir/$unique_file; then
  if test x$srcdirdefaulted = xyes; then
    echo "configure: Can not find sources in \`.' or \`..'." 1>&2
  else
    echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  fi
  exit 1
fi
SRCDIR=$srcdir
if test $srcdir != .; then
  VPATH='VPATH = $(srcdir)' ;
  case $srcdir in
    /*|~*) ;;
    *) srcdir=`pwd`/$srcdir ;; # Make relative path absolute.
  esac
fi

# The Bourne shell writes "command not found" to /dev/tty, so if we get
# a usage message on stderr, we have the program.
#
# ksh and zsh write "command not found" to stderr, but test -n does not
# want any output if there is no program.  So we use the `type' builtin
# instead for them (and bash).
if test "$RANDOM" = "$RANDOM"; then
  checkfor='test -n "`$checkprog $checkargs 2>&1`"'
else
  checkfor='type $checkprog >/dev/null'
fi

if test x$target = x; then
  echo " Guess your system"
  guessprg=`echo $progname | sed 's/configure/config.guess/'`
  target=`$guessprg`
  arguments="$arguments $target"
fi

echo " Checking for gcc"
checkprog=gcc checkargs=''
test -z "$CC" && eval $checkfor && CC='gcc'
CC=${CC-cc}

# Make sure to not get the incompatible SysV /etc/install and
# /usr/sbin/install, which might be in PATH before a BSD-like install,
# or the SunOS /usr/etc/install directory, or the AIX /bin/install,
# or the AFS install, which mishandles nonexistent args.  (Sigh.)
if test -z "$INSTALL"; then
  echo " Checking for install"
  saveifs="$IFS"; IFS="${IFS}:"
  for dir in $PATH; do
    test -z "$dir" && dir=.
    case $dir in
    /etc|/usr/sbin|/usr/etc|/usr/afsws/bin) ;;
    *)
      if test -f $dir/install; then
	if grep dspmsg $dir/install >/dev/null 2>&1; then
	  : # AIX
	else
	  INSTALL="$dir/install -c"
	  INSTALL_PROGRAM='$(INSTALL)'
	  INSTALL_DATA='$(INSTALL) -m 644'
	  break
	fi
      fi
      ;;
    esac
  done
  IFS="$saveifs"
fi
INSTALL=${INSTALL-cp}
INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}

# Try to know the language.
if test x$with_lang != x; then
  language=$with_lang
fi
if test x$with_language != x; then
  language=$with_language
fi
case $language in
  English | english | American | american | Eng | eng | US)
	echo "Your language is English" ;
	lang=English ;;
  French | french | francais | Fr | fr)
	echo "Your language is French" ;
	lang=French ;;
  yes)
	echo "Please, specify a language (-with-language=xxx)" ;;
  "")
	lang=English;;
  *)
	echo "Warning: Checker doesn't support this language: $language" ;
	echo "         Checker only knows English and French" ;;
     
esac

case $target in
  [Ii][34]86-*-[Ll]inux | [Ii][34]86-[Ll]inux)
	echo This target \( $target \) is known. ;
	machine_h=$SRCDIR/config/i386/Linux/machine.h ;
	symtab_c=$SRCDIR/config/obj-formats/gnu.a.out.c ;
	string_h=$SRCDIR/config/i386/Linux/string.h ;
	confdir=$SRCDIR/config/i386/Linux ;;
  *)
	echo $target unknown. ;
	exit 1 ;;
esac

trap 'for dir in .; do rm -f $dir/Makefile; done; rm -f config.status; exit 1' 1 3 15

for dir in .; do
  test -d $dir || mkdir $dir
  echo " Creating $dir/Makefile"
  echo '# Generated automatically from Makefile.in by configure.' > $dir/Makefile
  sed -e "
s,@VPATH@,$VPATH,g
s,@SRCDIR@,$SRCDIR,g
s,@CONFDIR@,$confdir,g
s,@CC@,$CC,g
s,@INSTALL@,$INSTALL,g
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
s,@INSTALL_DATA@,$INSTALL_DATA,g
s,@CONFIG_FILES@,$config_files,g
s,@LANGUAGE@,$lang,g
" $srcdir/$dir/Makefile.in >> $dir/Makefile
done

rm -f machine.h symtab.c string.h
echo " Link $machine_h to machine.h"
$symbolic_link $machine_h machine.h 2> /dev/null || $hard_link $machine_h machine.h
echo " Link $symtab_c to symtab.c"
$symbolic_link $symtab_c symtab.c 2> /dev/null || $hard_link $symtab_c symatb.c
echo " Link $string_h to string.h"
$symbolic_link $string_h string.h 2> /dev/null || $hard_link $string_h string.h

trap 'rm -f config.status; exit 1' 1 3 15
echo " Creating config.status"
rm -f config.status
cat > config.status <<EOF
#!/bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null`:
#
# $0 $*

for arg
do
  case "\$arg" in
    -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    exec /bin/sh $0 $* ;;
    *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  esac
done

trap 'rm -f Makefile; exit 1' 1 3 15
CC='$CC'
INSTALL='$INSTALL'
INSTALL_PROGRAM='$INSTALL_PROGRAM'
INSTALL_DATA='$INSTALL_DATA'
LIBS='$LIBS'
SRCDIR='$SRCDIR'
DEFS='$DEFS'
prefix='$prefix'
exec_prefix='$exec_prefix'
confdir='$confdir'
config_files='$config_files'
lang='$lang'
srcdir='$SRCDIR'
EOF
cat >> config.status <<\EOF

top_srcdir=$srcdir
for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  srcdir=$top_srcdir
  # Remove last slash and all that follows it.  Not all systems have dirname.
  dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  if test "$dir" != "$file"; then
    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
    test ! -d $dir && mkdir $dir
  fi
  echo creating $file
  rm -f $file
  echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  sed -e "
s,@VPATH@,$VPATH,g
s,@SRCDIR@,$SRCDIR,g
s,@CONFDIR@,$confdir,g
s,@CC@,$CC,g
s,@INSTALL@,$INSTALL,g
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
s,@INSTALL_DATA@,$INSTALL_DATA,g
s,@CONFIG_FILES@,$config_files,g
s,@LANGUAGE@,$lang,g
" $top_srcdir/${file}.in >> $file
fi; done

exit 0
EOF

#echo " Creating config.status"
#echo "#!/bin/sh
## Generated automatically by configure.
#$progname $arguments
#" > config.status
chmod +x config.status

echo
echo "To compile Checker, do 'make dep; make'"
echo "To install Checker, do 'make install'"

# EOF