#!/bin/sh

# Optional configure script for GP
#
# Copyright (C) 2000-2006 Free Software Foundation, Inc.
#
# Author: Frank Heckenbach <frank@pascal.gnu.de>
#
# Parts copied from GCC's configure script,
# Copyright (C) 1992, 93, 94, 95, 96 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, version 2.
#
# 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; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

ac_default_prefix=/usr/local
bindir=NONE
exec_prefix=NONE
infodir=NONE
mandir=NONE
no_create=
prefix=$ac_default_prefix
srcdir=
datadir=NONE
target=NONE

ac_prev=
for ac_option
do

  # If the previous option needs an argument, assign it.
  if test -n "$ac_prev"; then
    eval "$ac_prev=\$ac_option"
    ac_prev=
    continue
  fi

  case "$ac_option" in
  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) ac_optarg= ;;
  esac

  case "$ac_option" in

  -bindir | --bindir | --bindi | --bind | --bin | --bi)
    ac_prev=bindir ;;
  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
    bindir="$ac_optarg" ;;
  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
    ac_prev=datadir ;;
  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
  | --da=*)
    datadir="$ac_optarg" ;;
  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  | --exec | --exe | --ex)
    ac_prev=exec_prefix ;;
  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  | --exec=* | --exe=* | --ex=*)
    exec_prefix="$ac_optarg" ;;
  -infodir | --infodir | --infodi | --infod | --info | --inf)
    ac_prev=infodir ;;
  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
    infodir="$ac_optarg" ;;
  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
    ac_prev=mandir ;;
  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
    mandir="$ac_optarg" ;;
  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c)
    no_create=yes ;;
  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
    ac_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
    prefix="$ac_optarg" ;;
  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
    ac_prev=srcdir ;;
  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
    srcdir="$ac_optarg" ;;
  -target | --target | --targe | --targ | --tar | --ta | --t)
    ac_prev=target ;;
  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
    target="$ac_optarg" ;;

  -h | -help | --help | --hel | --he)
    cat << EOF
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message and exit
  --no-create             do not create output files
  --version               print version information and exit
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [$ac_default_prefix]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  --target=TARGET         configure for TARGET [current system]
EOF
    exit 0 ;;

  -version | --version | --versio | --versi | --vers)
    echo "GP configure script"
    exit 0 ;;

  # Ignore options recognized by other configure scripts
  -build* | --build* | --buil* | --bui* | --bu*) ;;
  -cache-file* | --cache-file* | --cache-fil* | --cache-fi* \
  | --cache-f* | --cache-* | --cache* | --cach* | --cac* | --ca* | --c*) ;;
  -disable-* | --disable-*) ;;
  -enable-* | --enable-*)   ;;
  -gas | --gas | --ga | --g) ;;
  -host* | --host* | --hos* | --ho*) ;;
  -includedir* | --includedir* | --includedi* | --included* | --include* \
  | --includ* | --inclu* | --incl* | --inc*) ;;
  -libdir* | --libdir* | --libdi* | --libd*) ;;
  -libexecdir* | --libexecdir* | --libexecdi* | --libexecd* | --libexec* \
  | --libexe* | --libex* | --libe*) ;;
  -localstatedir* | --localstatedir* | --localstatedi* | --localstated* \
  | --localstate* | --localstat* | --localsta* | --localst* \
  | --locals* | --local* | --loca* | --loc* | --lo*) ;;
  -nfp | --nfp | --nf) ;;
  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
  -oldincludedir* | --oldincludedir* | --oldincludedi* | --oldincluded* \
  | --oldinclude* | --oldinclud* | --oldinclu* | --oldincl* | --oldinc* \
  | --oldin* | --oldi* | --old* | --ol* | --o*) ;;
  -program-prefix* | --program-prefix* | --program-prefi* \
  | --program-pref* | --program-pre* | --program-pr* | --program-p*) ;;
  -program-suffix* | --program-suffix* | --program-suffi* \
  | --program-suff* | --program-suf* | --program-su* | --program-s*) ;;
  -program-transform-name* | --program-transform-name* \
  | --program-transform-nam* | --program-transform-na* \
  | --program-transform-n* | --program-transform-* \
  | --program-transform* | --program-transfor* \
  | --program-transfo* | --program-transf* \
  | --program-trans* | --program-tran* \
  | --progr-tra* | --program-tr* | --program-t*) ;;
  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil) ;;
  -sbindir* | --sbindir* | --sbindi* | --sbind* | --sbin* \
  | --sbi* | --sb*) ;;
  -sharedstatedir* | --sharedstatedir* | --sharedstatedi* \
  | --sharedstated* | --sharedstate* | --sharedstat* | --sharedsta* \
  | --sharedst* | --shareds* | --shared* | --share* | --shar* \
  | --sha* | --sh*) ;;
  -site* | --site* | --sit*) ;;
  -sysconfdir* | --sysconfdir* | --sysconfdi* | --sysconfd* | --sysconf* \
  | --syscon* | --sysco* | --sysc* | --sys* | --sy*) ;;
  -v | -verbose | --verbose | --verbos | --verbo | --verb) ;;
  -with-* | --with-*) ;;
  -without-* | --without-*) ;;
  --x) ;;
  -x-includes* | --x-includes* | --x-include* | --x-includ* | --x-inclu* \
  | --x-incl* | --x-inc* | --x-in* | --x-i*) ;;
  -x-libraries* | --x-libraries* | --x-librarie* | --x-librari* \
  | --x-librar* | --x-libra* | --x-libr* | --x-lib* | --x-li* | --x-l*) ;;

  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
    ;;

  *)
    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
      echo "configure: warning: $ac_option: invalid host type" 1>&2
    fi
    if test "x$target" != xNONE; then
      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
    fi
    target="$ac_option"
    ;;

  esac
done

# 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.
ac_unique_file=gp.pas

# Find the source files, if location was not specified.
if test -z "$srcdir"; then
  ac_srcdir_defaulted=yes
  # Try the directory containing this script, then its parent.
  ac_prog=$0
  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  srcdir=$ac_confdir
  if test ! -r $srcdir/$ac_unique_file; then
    srcdir=..
  fi
else
  ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
  if test "$ac_srcdir_defaulted" = yes; then
    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
  else
    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  fi
fi
srcdir=`cd "$srcdir"; pwd`

if [ "$no_create" != yes ]; then
  if [ -r Makefile.cfg ]; then mv Makefile.cfg Makefile.cfg.old; fi
  (
    echo "# This file was created automatically by $0"
    echo "# Do not modify manually!"
    if [ "$target" != NONE ]; then echo "TARGET=$target-"; fi
    if [ "$srcdir" != NONE ]; then echo "srcdir=$srcdir"; fi
    if [ "$prefix" != NONE ]; then echo "prefix=$prefix"; fi
    if [ "$exec_prefix" != NONE ]; then echo "exec_prefix=$exec_prefix"; fi
    if [ "$bindir" != NONE ]; then echo "bindir=$bindir"; fi
    if [ "$datadir" != NONE ]; then echo "datadir=$datadir"; fi
    if [ "$infodir" != NONE ]; then echo "infodir=$infodir"; fi
    if [ "$mandir" != NONE ]; then echo "mandir=$mandir"; fi
  ) > Makefile.cfg
  echo "Created Makefile.cfg"
  if [ "$srcdir" != `pwd` ]; then
    if [ -r Makefile ]; then mv Makefile Makefile.old; fi
    (
      echo "# This file was created automatically by $0"
      echo "# Do not modify manually!"
      echo "include $srcdir/Makefile"
    ) > Makefile
    echo "Created Makefile"
  fi
fi
