#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization.  ##
## --------------------- ##

# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh

# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
  as_unset=unset
else
  as_unset=false
fi


# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '

# NLS nuisances.
for as_var in \
  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
  LC_TELEPHONE LC_TIME
do
  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
    eval $as_var=C; export $as_var
  else
    $as_unset $as_var
  fi
done

# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
  as_expr=expr
else
  as_expr=false
fi

if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
  as_basename=basename
else
  as_basename=false
fi


# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
	 X"$0" : 'X\(//\)$' \| \
	 X"$0" : 'X\(/\)$' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X/"$0" |
    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
  	  /^X\/\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`


# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  echo "#! /bin/sh" >conf$$.sh
  echo  "exit 0"   >>conf$$.sh
  chmod +x conf$$.sh
  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
    PATH_SEPARATOR=';'
  else
    PATH_SEPARATOR=:
  fi
  rm -f conf$$.sh
fi


  as_lineno_1=$LINENO
  as_lineno_2=$LINENO
  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  test "x$as_lineno_1" != "x$as_lineno_2" &&
  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
  # Find who we are.  Look in the path if we contain no path at all
  # relative or not.
  case $0 in
    *[\\/]* ) as_myself=$0 ;;
    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done

       ;;
  esac
  # We did not find ourselves, most probably we were run as `sh COMMAND'
  # in which case we are not to be found in the path.
  if test "x$as_myself" = x; then
    as_myself=$0
  fi
  if test ! -f "$as_myself"; then
    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
   { (exit 1); exit 1; }; }
  fi
  case $CONFIG_SHELL in
  '')
    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for as_base in sh bash ksh sh5; do
	 case $as_dir in
	 /*)
	   if ("$as_dir/$as_base" -c '
  as_lineno_1=$LINENO
  as_lineno_2=$LINENO
  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  test "x$as_lineno_1" != "x$as_lineno_2" &&
  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
	     CONFIG_SHELL=$as_dir/$as_base
	     export CONFIG_SHELL
	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
	   fi;;
	 esac
       done
done
;;
  esac

  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
  # uniformly replaced by the line number.  The first 'sed' inserts a
  # line-number line before each line; the second 'sed' does the real
  # work.  The second script uses 'N' to pair each line-number line
  # with the numbered line, and appends trailing '-' during
  # substitution so that $LINENO is not a special case at line end.
  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
  sed '=' <$as_myself |
    sed '
      N
      s,$,-,
      : loop
      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
      t loop
      s,-$,,
      s,^['$as_cr_digits']*\n,,
    ' >$as_me.lineno &&
  chmod +x $as_me.lineno ||
    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
   { (exit 1); exit 1; }; }

  # Don't try to exec as it changes $[0], causing all sort of problems
  # (the dirname of $[0] is not the place where we might find the
  # original and so on.  Autoconf is especially sensible to this).
  . ./$as_me.lineno
  # Exit status is that of the last command.
  exit
}


case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
  *c*,-n*) ECHO_N= ECHO_C='
' ECHO_T='	' ;;
  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac

if expr a : '\(a\)' >/dev/null 2>&1; then
  as_expr=expr
else
  as_expr=false
fi

rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
  # We could just check for DJGPP; but this test a) works b) is more generic
  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
  if test -f conf$$.exe; then
    # Don't use ln at all; we don't have any links
    as_ln_s='cp -p'
  else
    as_ln_s='ln -s'
  fi
elif ln conf$$.file conf$$ 2>/dev/null; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file

if mkdir -p . 2>/dev/null; then
  as_mkdir_p=:
else
  test -d ./-p && rmdir ./-p
  as_mkdir_p=false
fi

as_executable_p="test -f"

# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"

# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"


# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" 	$as_nl"

# CDPATH.
$as_unset CDPATH


# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`

exec 6>&1

#
# Initializations.
#
ac_default_prefix=/usr/local
ac_config_libobj_dir=.
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}

# Maximum number of lines to put in a shell here document.
# This variable seems obsolete.  It should probably be removed, and
# only ac_max_sed_lines should be used.
: ${ac_max_here_lines=38}

# Identity of this package.
PACKAGE_NAME=
PACKAGE_TARNAME=
PACKAGE_VERSION=
PACKAGE_STRING=
PACKAGE_BUGREPORT=

ac_unique_file="scripts/mmc.in"
ac_default_prefix=/usr/local/mercury-`. ./VERSION; echo $VERSION`
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
#  include <stdint.h>
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif"

ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS RECONFIGURE_ARGS build build_cpu build_vendor build_os host host_cpu host_vendor host_os FULLARCH CYGPATH VERSION PREFIX NONSHARED_LIB_DIR LIBDIR DEFAULT_MERCURY_DEBUGGER_INIT_DIR CONFIG_PREFIX CONFIG_LIBDIR BOOTSTRAP_MC ENABLE_GCC_BACK_END GCC_SRC_DIR ENABLE_ADITI_BACK_END GNU_MAKE MKFIFO MKNOD MKTEMP INSTALL_INFO TEXI2DVI LYNX DVIPS MAKEINFO INFO PERL HOSTNAMECMD CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GCC_PROG ALL_LOCAL_C_INCL_DIRS ALL_LOCAL_C_INCL_DIR_MMC_OPTS ALL_LOCAL_C_LIB_DIRS ALL_LOCAL_C_LIB_DIR_MMC_OPTS CPP EGREP RANLIB ac_ct_RANLIB OBJFILE_OPT AR ARFLAGS AR_LIBFILE_OPT LDFLAGS_FOR_DEBUG LD_LIBFLAGS_FOR_DEBUG LD_STRIP_FLAG LDFLAGS_FOR_TRACE LD_LIBFLAGS_FOR_TRACE USING_MICROSOFT_CL_COMPILER OBJ_SUFFIX LIB_SUFFIX LIB_PREFIX LIB_LIBPATH LINK_LIB LINK_LIB_SUFFIX LINK_OPT_SEP FIX_PATH_FOR_CC LN_S MMC_USE_SYMLINKS_OPT MATH_LIB ILASM GACUTIL MS_CL MS_CSC MS_DOTNET_SDK_DIR MS_DOTNET_LIBRARY_VERSION MS_VISUALCPP_DIR JAVAC JAVA_INTERPRETER JAR MR_WORD_TYPE MR_INTEGER_LENGTH_MODIFIER MR_INT_LEAST64_TYPE MR_INT_LEAST32_TYPE MR_INT_LEAST32_MAX MR_UINT_LEAST32_MAX MR_INT_LEAST16_TYPE MR_INT_LEAST16_MAX MR_UINT_LEAST16_MAX LOW_TAG_BITS BYTES_PER_WORD SYNC_TERM_SIZE BITS_PER_WORD HAVE_BOXED_FLOATS MR_FLOAT_IS_64_BIT MR_DOUBLE_IS_64_BIT MR_LONG_DOUBLE_IS_64_BIT MR_BIG_ENDIAN MR_LITTLE_ENDIAN MR_CAN_DO_PENDING_IO CFLAGS_FOR_REGS CFLAGS_FOR_GOTOS HAVE_ASM_LABELS ENABLE_DEEP_PROFILER CGIDIR CFLAGS_FOR_THREADS THREAD_LIBS LDFLAGS_FOR_THREADS LD_LIBFLAGS_FOR_THREADS DEFAULT_GRADE GRADE LIBGRADES LIBGRADE_OPTS NUM_REAL_R_REGS NUM_REAL_R_TEMPS HAVE_DELAY_SLOT AS CFLAGS_FOR_ANSI CFLAGS_FOR_WARNINGS CFLAGS_FOR_OPT CFLAGS_FOR_DEBUG MCFLAGS_FOR_CC LINK_EXE LD_STATIC_FLAGS DEFAULT_LINKAGE LINK_SHARED_OBJ LINK_SHARED_OBJ_SH ERROR_UNDEFINED ALLOW_UNDEFINED EXE_RPATH_OPT EXE_RPATH_SEP SHLIB_RPATH_OPT SHLIB_RPATH_SEP CFLAGS_FOR_PIC EXT_FOR_PIC_OBJECTS EXT_FOR_LINK_WITH_PIC_OBJECTS EXT_FOR_SHARED_LIB EXT_FOR_EXE USE_DLLS SHARED_LIBS SHARED_LIBS_SH SOCKET_LIBRARY NSL_LIBRARY DL_LIBRARY TRACE_LIBS_SYSTEM USE_MSVCRT TERMCAP_LIBRARY READLINE_LIBRARIES CSHPATH LIBOBJS LTLIBOBJS'
ac_subst_files='INIT_GRADE_OPTIONS PARSE_GRADE_OPTIONS FINAL_GRADE_OPTIONS PARSE_ML_OPTIONS CANONICAL_GRADE CONFIGURE_HELP'

# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
exec_prefix=NONE
no_create=
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
verbose=
x_includes=NONE
x_libraries=NONE

# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'

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

  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`

  # Accept the important Cygnus configure options, so we can diagnose typos.

  case $ac_option in

  -bindir | --bindir | --bindi | --bind | --bin | --bi)
    ac_prev=bindir ;;
  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
    bindir=$ac_optarg ;;

  -build | --build | --buil | --bui | --bu)
    ac_prev=build_alias ;;
  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
    build_alias=$ac_optarg ;;

  -cache-file | --cache-file | --cache-fil | --cache-fi \
  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
    ac_prev=cache_file ;;
  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
    cache_file=$ac_optarg ;;

  --config-cache | -C)
    cache_file=config.cache ;;

  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
    ac_prev=datadir ;;
  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
  | --da=*)
    datadir=$ac_optarg ;;

  -disable-* | --disable-*)
    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
   { (exit 1); exit 1; }; }
    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
    eval "enable_$ac_feature=no" ;;

  -enable-* | --enable-*)
    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
   { (exit 1); exit 1; }; }
    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
    case $ac_option in
      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
      *) ac_optarg=yes ;;
    esac
    eval "enable_$ac_feature='$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 ;;

  -gas | --gas | --ga | --g)
    # Obsolete; use --with-gas.
    with_gas=yes ;;

  -help | --help | --hel | --he | -h)
    ac_init_help=long ;;
  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
    ac_init_help=recursive ;;
  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
    ac_init_help=short ;;

  -host | --host | --hos | --ho)
    ac_prev=host_alias ;;
  -host=* | --host=* | --hos=* | --ho=*)
    host_alias=$ac_optarg ;;

  -includedir | --includedir | --includedi | --included | --include \
  | --includ | --inclu | --incl | --inc)
    ac_prev=includedir ;;
  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
  | --includ=* | --inclu=* | --incl=* | --inc=*)
    includedir=$ac_optarg ;;

  -infodir | --infodir | --infodi | --infod | --info | --inf)
    ac_prev=infodir ;;
  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
    infodir=$ac_optarg ;;

  -libdir | --libdir | --libdi | --libd)
    ac_prev=libdir ;;
  -libdir=* | --libdir=* | --libdi=* | --libd=*)
    libdir=$ac_optarg ;;

  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
  | --libexe | --libex | --libe)
    ac_prev=libexecdir ;;
  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
  | --libexe=* | --libex=* | --libe=*)
    libexecdir=$ac_optarg ;;

  -localstatedir | --localstatedir | --localstatedi | --localstated \
  | --localstate | --localstat | --localsta | --localst \
  | --locals | --local | --loca | --loc | --lo)
    ac_prev=localstatedir ;;
  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
    localstatedir=$ac_optarg ;;

  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
    ac_prev=mandir ;;
  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
    mandir=$ac_optarg ;;

  -nfp | --nfp | --nf)
    # Obsolete; use --without-fp.
    with_fp=no ;;

  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c | -n)
    no_create=yes ;;

  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
    no_recursion=yes ;;

  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
  | --oldin | --oldi | --old | --ol | --o)
    ac_prev=oldincludedir ;;
  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
    oldincludedir=$ac_optarg ;;

  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
    ac_prev=prefix ;;
  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
    prefix=$ac_optarg ;;

  -program-prefix | --program-prefix | --program-prefi | --program-pref \
  | --program-pre | --program-pr | --program-p)
    ac_prev=program_prefix ;;
  -program-prefix=* | --program-prefix=* | --program-prefi=* \
  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
    program_prefix=$ac_optarg ;;

  -program-suffix | --program-suffix | --program-suffi | --program-suff \
  | --program-suf | --program-su | --program-s)
    ac_prev=program_suffix ;;
  -program-suffix=* | --program-suffix=* | --program-suffi=* \
  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
    program_suffix=$ac_optarg ;;

  -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)
    ac_prev=program_transform_name ;;
  -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=*)
    program_transform_name=$ac_optarg ;;

  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil)
    silent=yes ;;

  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
    ac_prev=sbindir ;;
  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
  | --sbi=* | --sb=*)
    sbindir=$ac_optarg ;;

  -sharedstatedir | --sharedstatedir | --sharedstatedi \
  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
  | --sharedst | --shareds | --shared | --share | --shar \
  | --sha | --sh)
    ac_prev=sharedstatedir ;;
  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
  | --sha=* | --sh=*)
    sharedstatedir=$ac_optarg ;;

  -site | --site | --sit)
    ac_prev=site ;;
  -site=* | --site=* | --sit=*)
    site=$ac_optarg ;;

  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
    ac_prev=srcdir ;;
  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
    srcdir=$ac_optarg ;;

  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
  | --syscon | --sysco | --sysc | --sys | --sy)
    ac_prev=sysconfdir ;;
  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
    sysconfdir=$ac_optarg ;;

  -target | --target | --targe | --targ | --tar | --ta | --t)
    ac_prev=target_alias ;;
  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
    target_alias=$ac_optarg ;;

  -v | -verbose | --verbose | --verbos | --verbo | --verb)
    verbose=yes ;;

  -version | --version | --versio | --versi | --vers | -V)
    ac_init_version=: ;;

  -with-* | --with-*)
    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
      { echo "$as_me: error: invalid package name: $ac_package" >&2
   { (exit 1); exit 1; }; }
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    case $ac_option in
      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
      *) ac_optarg=yes ;;
    esac
    eval "with_$ac_package='$ac_optarg'" ;;

  -without-* | --without-*)
    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
      { echo "$as_me: error: invalid package name: $ac_package" >&2
   { (exit 1); exit 1; }; }
    ac_package=`echo $ac_package | sed 's/-/_/g'`
    eval "with_$ac_package=no" ;;

  --x)
    # Obsolete; use --with-x.
    with_x=yes ;;

  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
  | --x-incl | --x-inc | --x-in | --x-i)
    ac_prev=x_includes ;;
  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
    x_includes=$ac_optarg ;;

  -x-libraries | --x-libraries | --x-librarie | --x-librari \
  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
    ac_prev=x_libraries ;;
  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
    x_libraries=$ac_optarg ;;

  -*) { echo "$as_me: error: unrecognized option: $ac_option
Try \`$0 --help' for more information." >&2
   { (exit 1); exit 1; }; }
    ;;

  *=*)
    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
    # Reject names that are not valid shell variable names.
    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
   { (exit 1); exit 1; }; }
    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
    eval "$ac_envvar='$ac_optarg'"
    export $ac_envvar ;;

  *)
    # FIXME: should be removed in autoconf 3.0.
    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
    ;;

  esac
done

if test -n "$ac_prev"; then
  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
  { echo "$as_me: error: missing argument to $ac_option" >&2
   { (exit 1); exit 1; }; }
fi

# Be sure to have absolute paths.
for ac_var in exec_prefix prefix
do
  eval ac_val=$`echo $ac_var`
  case $ac_val in
    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
   { (exit 1); exit 1; }; };;
  esac
done

# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
	      localstatedir libdir includedir oldincludedir infodir mandir
do
  eval ac_val=$`echo $ac_var`
  case $ac_val in
    [\\/$]* | ?:[\\/]* ) ;;
    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
   { (exit 1); exit 1; }; };;
  esac
done

# There might be people who depend on the old broken behavior: `$host'
# used to hold the argument of --host etc.
# FIXME: To remove some day.
build=$build_alias
host=$host_alias
target=$target_alias

# FIXME: To remove some day.
if test "x$host_alias" != x; then
  if test "x$build_alias" = x; then
    cross_compiling=maybe
    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used." >&2
  elif test "x$build_alias" != "x$host_alias"; then
    cross_compiling=yes
  fi
fi

ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-

test "$silent" = yes && exec 6>/dev/null


# 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_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$0" : 'X\(//\)[^/]' \| \
	 X"$0" : 'X\(//\)$' \| \
	 X"$0" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$0" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
  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 "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
   { (exit 1); exit 1; }; }
  else
    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
   { (exit 1); exit 1; }; }
  fi
fi
(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
   { (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
ac_cv_env_build_alias_set=${build_alias+set}
ac_cv_env_build_alias_value=$build_alias
ac_env_host_alias_set=${host_alias+set}
ac_env_host_alias_value=$host_alias
ac_cv_env_host_alias_set=${host_alias+set}
ac_cv_env_host_alias_value=$host_alias
ac_env_target_alias_set=${target_alias+set}
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
ac_env_CC_set=${CC+set}
ac_env_CC_value=$CC
ac_cv_env_CC_set=${CC+set}
ac_cv_env_CC_value=$CC
ac_env_CFLAGS_set=${CFLAGS+set}
ac_env_CFLAGS_value=$CFLAGS
ac_cv_env_CFLAGS_set=${CFLAGS+set}
ac_cv_env_CFLAGS_value=$CFLAGS
ac_env_LDFLAGS_set=${LDFLAGS+set}
ac_env_LDFLAGS_value=$LDFLAGS
ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
ac_cv_env_LDFLAGS_value=$LDFLAGS
ac_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_env_CPPFLAGS_value=$CPPFLAGS
ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
ac_cv_env_CPPFLAGS_value=$CPPFLAGS
ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP

#
# Report the --help message.
#
if test "$ac_init_help" = "long"; then
  # Omit some internal or obsolete options to make the list less imposing.
  # This message is too long to be a string in the A/UX 3.1 sh.
  cat <<_ACEOF
\`configure' configures this package to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print \`checking...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for \`--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or \`..']

_ACEOF

  cat <<_ACEOF
Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
			  [$ac_default_prefix]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
			  [PREFIX]

By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
an installation prefix other than \`$ac_default_prefix' using \`--prefix',
for instance \`--prefix=\$HOME'.

For better control, use the options below.

Fine tuning of the installation directories:
  --bindir=DIR           user executables [EPREFIX/bin]
  --sbindir=DIR          system admin executables [EPREFIX/sbin]
  --libexecdir=DIR       program executables [EPREFIX/libexec]
  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
  --libdir=DIR           object code libraries [EPREFIX/lib]
  --includedir=DIR       C header files [PREFIX/include]
  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
  --infodir=DIR          info documentation [PREFIX/info]
  --mandir=DIR           man documentation [PREFIX/man]
_ACEOF

  cat <<\_ACEOF

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
_ACEOF
fi

if test -n "$ac_init_help"; then

  cat <<\_ACEOF

Optional Features:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]

  --enable-gcc-back-end   enable the Mercury compiler's GCC back-end interface
  --disable-aditi-back-end
                          disable the Mercury compiler's Aditi back-end
  --enable-deep-profiler=<directory>
                          install deep profiler CGI script in <directory>
  --enable-inefficient-grades
                          install inefficient versions of the library
  --disable-most-grades   install only the essential versions of the library
  --enable-nogc-grades   install no-gc versions of the library
  --enable-agc-grades   install accurate GC versions of the library
  --disable-prof-grades   do not install profiling versions of the library
  --disable-trail-grades  do not install trailing versions of the library
  --disable-par-grades    do not install thread-safe versions of the library
  --enable-mm-grades      install minimal model versions of the library
  --enable-hlc-prof-grades
                          install profiling versions of the high level C grade
  --disable-dotnet-grades do not install the .NET grades
  --disable-java-grade    do not install the Java grade
  --enable-libgrades=...
                          install exactly the given versions of the library.
			  The versions are specified using a comma-separated
			  list.

  --disable-extern-debug  disable the external (separate process) debugger
  --disable-dynamic-link  disable the use of dynamic linking
  --enable-new-mercuryfile-struct
                          enable new MercuryFile struct.

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-cc=<program>     Specify which C compiler to use.
  --with-msvcrt
                          use the MS Visual C runtime if using MS C compiler.
  --without-readline      Don't use the GPL'd GNU readline library

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
              headers in a nonstandard directory <include dir>
  CPP         C preprocessor

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.

_ACEOF
fi

if test "$ac_init_help" = "recursive"; then
  # If there are subdirs, report their specific --help.
  ac_popdir=`pwd`
  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
    test -d $ac_dir || continue
    ac_builddir=.

if test "$ac_dir" != .; then
  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
  # A "../" for each directory in $ac_dir_suffix.
  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
  ac_dir_suffix= ac_top_builddir=
fi

case $srcdir in
  .)  # No --srcdir option.  We are building in place.
    ac_srcdir=.
    if test -z "$ac_top_builddir"; then
       ac_top_srcdir=.
    else
       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
    fi ;;
  [\\/]* | ?:[\\/]* )  # Absolute path.
    ac_srcdir=$srcdir$ac_dir_suffix;
    ac_top_srcdir=$srcdir ;;
  *) # Relative path.
    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
    ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac

# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
  case "$ac_dir" in
  .) ac_abs_builddir=`pwd`;;
  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
  *) ac_abs_builddir=`pwd`/"$ac_dir";;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
  case ${ac_top_builddir}. in
  .) ac_abs_top_builddir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
  case $ac_srcdir in
  .) ac_abs_srcdir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
  case $ac_top_srcdir in
  .) ac_abs_top_srcdir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
  esac;;
esac

    cd $ac_dir
    # Check for guested configure; otherwise get Cygnus style configure.
    if test -f $ac_srcdir/configure.gnu; then
      echo
      $SHELL $ac_srcdir/configure.gnu  --help=recursive
    elif test -f $ac_srcdir/configure; then
      echo
      $SHELL $ac_srcdir/configure  --help=recursive
    elif test -f $ac_srcdir/configure.ac ||
	   test -f $ac_srcdir/configure.in; then
      echo
      $ac_configure --help
    else
      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
    fi
    cd "$ac_popdir"
  done
fi

test -n "$ac_init_help" && exit 0
if $ac_init_version; then
  cat <<\_ACEOF

Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
  exit 0
fi
exec 5>config.log
cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by $as_me, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ $0 $@

_ACEOF
{
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##

hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`

/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`

/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`

_ASUNAME

as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  echo "PATH: $as_dir"
done

} >&5

cat >&5 <<_ACEOF


## ----------- ##
## Core tests. ##
## ----------- ##

_ACEOF


# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
  for ac_arg
  do
    case $ac_arg in
    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
    | -silent | --silent | --silen | --sile | --sil)
      continue ;;
    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
    esac
    case $ac_pass in
    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
    2)
      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
      if test $ac_must_keep_next = true; then
	ac_must_keep_next=false # Got value, back to normal.
      else
	case $ac_arg in
	  *=* | --config-cache | -C | -disable-* | --disable-* \
	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
	  | -with-* | --with-* | -without-* | --without-* | --x)
	    case "$ac_configure_args0 " in
	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
	    esac
	    ;;
	  -* ) ac_must_keep_next=true ;;
	esac
      fi
      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
      # Get rid of the leading space.
      ac_sep=" "
      ;;
    esac
  done
done
$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }

# When interrupted or exit'd, cleanup temporary files, and complete
# config.log.  We remove comments because anyway the quotes in there
# would cause problems or look ugly.
# WARNING: Be sure not to use single quotes in there, as some shells,
# such as our DU 5.0 friend, will then `close' the trap.
trap 'exit_status=$?
  # Save into config.log some information that might help in debugging.
  {
    echo

    cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
## ---------------- ##
_ASBOX
    echo
    # The following way of writing the cache mishandles newlines in values,
{
  (set) 2>&1 |
    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
    *ac_space=\ *)
      sed -n \
	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
      ;;
    *)
      sed -n \
	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
      ;;
    esac;
}
    echo

    cat <<\_ASBOX
## ----------------- ##
## Output variables. ##
## ----------------- ##
_ASBOX
    echo
    for ac_var in $ac_subst_vars
    do
      eval ac_val=$`echo $ac_var`
      echo "$ac_var='"'"'$ac_val'"'"'"
    done | sort
    echo

    if test -n "$ac_subst_files"; then
      cat <<\_ASBOX
## ------------- ##
## Output files. ##
## ------------- ##
_ASBOX
      echo
      for ac_var in $ac_subst_files
      do
	eval ac_val=$`echo $ac_var`
	echo "$ac_var='"'"'$ac_val'"'"'"
      done | sort
      echo
    fi

    if test -s confdefs.h; then
      cat <<\_ASBOX
## ----------- ##
## confdefs.h. ##
## ----------- ##
_ASBOX
      echo
      sed "/^$/d" confdefs.h | sort
      echo
    fi
    test "$ac_signal" != 0 &&
      echo "$as_me: caught signal $ac_signal"
    echo "$as_me: exit $exit_status"
  } >&5
  rm -f core *.core &&
  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
    exit $exit_status
     ' 0
for ac_signal in 1 2 13 15; do
  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0

# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -rf conftest* confdefs.h
# AIX cpp loses on an empty file, so make sure it contains at least a newline.
echo >confdefs.h

# Predefined preprocessor variables.

cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF


cat >>confdefs.h <<_ACEOF
#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF


# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
  if test "x$prefix" != xNONE; then
    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  else
    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  fi
fi
for ac_site_file in $CONFIG_SITE; do
  if test -r "$ac_site_file"; then
    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
    sed 's/^/| /' "$ac_site_file" >&5
    . "$ac_site_file"
  fi
done

if test -r "$cache_file"; then
  # Some versions of bash will fail to source /dev/null (special
  # files actually), so we avoid doing that.
  if test -f "$cache_file"; then
    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
    case $cache_file in
      [\\/]* | ?:[\\/]* ) . $cache_file;;
      *)                      . ./$cache_file;;
    esac
  fi
else
  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
echo "$as_me: creating cache $cache_file" >&6;}
  >$cache_file
fi

# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
  eval ac_old_set=\$ac_cv_env_${ac_var}_set
  eval ac_new_set=\$ac_env_${ac_var}_set
  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
  eval ac_new_val="\$ac_env_${ac_var}_value"
  case $ac_old_set,$ac_new_set in
    set,)
      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
      ac_cache_corrupted=: ;;
    ,set)
      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
      ac_cache_corrupted=: ;;
    ,);;
    *)
      if test "x$ac_old_val" != "x$ac_new_val"; then
	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
echo "$as_me:   former value:  $ac_old_val" >&2;}
	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
echo "$as_me:   current value: $ac_new_val" >&2;}
	ac_cache_corrupted=:
      fi;;
  esac
  # Pass precious variables to config.status.
  if test "$ac_new_set" = set; then
    case $ac_new_val in
    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
    *) ac_arg=$ac_var=$ac_new_val ;;
    esac
    case " $ac_configure_args " in
      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
    esac
  fi
done
if $ac_cache_corrupted; then
  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
echo "$as_me: error: changes in the environment can compromise the build" >&2;}
  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
   { (exit 1); exit 1; }; }
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu



















TMPDIR=${TMPDIR=/tmp}

# AC_CHECK_TYPES does not exist in versions of autoconf before 2.50.
# AC_CHECK_TYPE is broken in versions of autoconf before 2.50.

#-----------------------------------------------------------------------------#
#
# Ensure that all messages are saved to a file `configure.log' by
# invoking ourself recursively without output piped into `tee configure.log'.
# The environment variable `SUPPRESS_LOG_FILE_RECURSION' is used to prevent
# infinite recursion.
#
if test "$SUPPRESS_LOG_FILE_RECURSION" != "yes"; then
	SUPPRESS_LOG_FILE_RECURSION=yes
	export SUPPRESS_LOG_FILE_RECURSION
	trap 0 1 2 3 13 15
	rm -f configure.exit_status
	{ case $# in
		0) ${CONFIG_SHELL-/bin/sh} "$0"      ;;
		*) ${CONFIG_SHELL-/bin/sh} "$0" "$@" ;;
	esac; echo $? > configure.exit_status; } | exec tee configure.log
	status=`cat configure.exit_status`
	rm -f configure.exit_status
	exit $status
fi

#-----------------------------------------------------------------------------#
# Work out the default arguments to configure when reconfiguring,
# for example when installing a binary distribution.
# Strip out --no-create and --no-recursion added by config.status.
# Remove any --prefix and --enable-reconfigure arguments passed by
# mercury_config.
# Also quote any args containing shell metacharacters.
#
# NOTE: Some macros, e.g. AC_CHECK_PROG, overwrite the argument list,
# so this must come before any uses of those macros.

prefix_arg=false
RECONFIGURE_ARGS=
for arg
do
    if test $prefix_arg = true
    then
        prefix_arg=false
    else
        case "$arg" in
            --no-create | --no-recursion) ;;
            --prefix) prefix_arg=true ;;
            --prefix=*) ;;
            --enable-reconfigure=*) ;;
            *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
		# The argument needs to be quoted.
                RECONFIGURE_ARGS="$RECONFIGURE_ARGS '$arg'"
                ;;
            *)
                RECONFIGURE_ARGS="$RECONFIGURE_ARGS $arg"
                ;;
       esac
    fi
done

#-----------------------------------------------------------------------------#
remake_dependencies=false
          ac_config_headers="$ac_config_headers runtime/mercury_conf.h"


ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
  if test -f $ac_dir/install-sh; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/install-sh -c"
    break
  elif test -f $ac_dir/install.sh; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/install.sh -c"
    break
  elif test -f $ac_dir/shtool; then
    ac_aux_dir=$ac_dir
    ac_install_sh="$ac_aux_dir/shtool install -c"
    break
  fi
done
if test -z "$ac_aux_dir"; then
  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
   { (exit 1); exit 1; }; }
fi
ac_config_guess="$SHELL $ac_aux_dir/config.guess"
ac_config_sub="$SHELL $ac_aux_dir/config.sub"
ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.

# Make sure we can run config.sub.
$ac_config_sub sun4 >/dev/null 2>&1 ||
  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
echo "$as_me: error: cannot run $ac_config_sub" >&2;}
   { (exit 1); exit 1; }; }

echo "$as_me:$LINENO: checking build system type" >&5
echo $ECHO_N "checking build system type... $ECHO_C" >&6
if test "${ac_cv_build+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_cv_build_alias=$build_alias
test -z "$ac_cv_build_alias" &&
  ac_cv_build_alias=`$ac_config_guess`
test -z "$ac_cv_build_alias" &&
  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
   { (exit 1); exit 1; }; }
ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
   { (exit 1); exit 1; }; }

fi
echo "$as_me:$LINENO: result: $ac_cv_build" >&5
echo "${ECHO_T}$ac_cv_build" >&6
build=$ac_cv_build
build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`


echo "$as_me:$LINENO: checking host system type" >&5
echo $ECHO_N "checking host system type... $ECHO_C" >&6
if test "${ac_cv_host+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_cv_host_alias=$host_alias
test -z "$ac_cv_host_alias" &&
  ac_cv_host_alias=$ac_cv_build_alias
ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
   { (exit 1); exit 1; }; }

fi
echo "$as_me:$LINENO: result: $ac_cv_host" >&5
echo "${ECHO_T}$ac_cv_host" >&6
host=$ac_cv_host
host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`


FULLARCH="$host"

cat >>confdefs.h <<_ACEOF
#define MR_FULLARCH "$FULLARCH"
_ACEOF

. ./VERSION
cat >>confdefs.h <<_ACEOF
#define MR_VERSION "$VERSION"
_ACEOF

if test "$prefix" = "NONE"; then
	PREFIX="$ac_default_prefix"
else
	PREFIX="$prefix"
fi
case "$PREFIX" in
    *\ *)
	{ { echo "$as_me:$LINENO: error: cannot install into a directory with a name containing
	spaces: \`$PREFIX.'" >&5
echo "$as_me: error: cannot install into a directory with a name containing
	spaces: \`$PREFIX.'" >&2;}
   { (exit 1); exit 1; }; }
	exit 1
	;;
esac

# Using `cygpath -m' gives a path that works under both
# Cygwin and native Windows, without causing quoting
# problems in shell scripts. (`cygpath -m' converts the
# path to Windows format, with '/' as the directory
# separator).
# Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CYGPATH+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$CYGPATH"; then
  ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -m"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo"
fi
fi
CYGPATH=$ac_cv_prog_CYGPATH
if test -n "$CYGPATH"; then
  echo "$as_me:$LINENO: result: $CYGPATH" >&5
echo "${ECHO_T}$CYGPATH" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


PREFIX="`$CYGPATH $PREFIX`"
LIBDIR="`$CYGPATH $PREFIX/lib/mercury`"
NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=$PREFIX/lib/nonshared}




DEFAULT_MERCURY_DEBUGGER_INIT_DIR=$LIBDIR/mdb

#-----------------------------------------------------------------------------#
case "$host" in
	mips-sgi-irix5.*)
		{ echo "$as_me:$LINENO: WARNING: *** Read README.IRIX-5 before proceeding!" >&5
echo "$as_me: WARNING: *** Read README.IRIX-5 before proceeding!" >&2;}
		;;
	*-*-bsdi*)
		{ echo "$as_me:$LINENO: WARNING: *** Read README.BSDI before proceeding!" >&5
echo "$as_me: WARNING: *** Read README.BSDI before proceeding!" >&2;}
		;;
esac
#-----------------------------------------------------------------------------#

# Don't document this -- it's only used by the mercury_config script
# to generate a new configuration for an already installed system.
# CONFIG_PREFIX is the PREFIX for a partial installation generated
# by mercury_config containing only the scripts and the configuration
# files, which uses the libraries and executables from a previous
# installation.
# Check whether --enable-reconfigure or --disable-reconfigure was given.
if test "${enable_reconfigure+set}" = set; then
  enableval="$enable_reconfigure"
  reconfiguring=yes
CONFIG_PREFIX="$enableval"
CONFIG_LIBDIR="$CONFIG_PREFIX/lib/mercury"
else
  reconfiguring=no
CONFIG_PREFIX="$PREFIX"
CONFIG_LIBDIR="$LIBDIR"

fi;

case "$CONFIG_PREFIX" in
	yes)	{ { echo "$as_me:$LINENO: error: missing argument to --enable-reconfigure=... option" >&5
echo "$as_me: error: missing argument to --enable-reconfigure=... option" >&2;}
   { (exit 1); exit 1; }; }
		exit 1
		;;
	no)	{ { echo "$as_me:$LINENO: error: invalid option --no-enable-reconfigure" >&5
echo "$as_me: error: invalid option --no-enable-reconfigure" >&2;}
   { (exit 1); exit 1; }; }
		exit 1
		;;
esac
CONFIG_PREFIX="`$CYGPATH $CONFIG_PREFIX`"
CONFIG_LIBDIR="`$CYGPATH $CONFIG_LIBDIR`"


#-----------------------------------------------------------------------------#

case "$host" in
	i386-pc-solaris2.8)	link_static_opt= ;;
	*powerpc*apple*darwin*) link_static_opt= ;;
	*)			link_static_opt="--linkage static" ;;
esac

echo "looking for an already installed Mercury compiler to bootstrap with..." 1>&6
# Extract the first word of "mmc", so it can be a program name with args.
set dummy mmc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_BOOTSTRAP_MC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $BOOTSTRAP_MC in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_BOOTSTRAP_MC="$BOOTSTRAP_MC" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_BOOTSTRAP_MC="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
BOOTSTRAP_MC=$ac_cv_path_BOOTSTRAP_MC

if test -n "$BOOTSTRAP_MC"; then
  echo "$as_me:$LINENO: result: $BOOTSTRAP_MC" >&5
echo "${ECHO_T}$BOOTSTRAP_MC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

if test "$BOOTSTRAP_MC" != ""; then
	echo "$as_me:$LINENO: checking whether the above mmc works and is sufficiently recent" >&5
echo $ECHO_N "checking whether the above mmc works and is sufficiently recent... $ECHO_C" >&6
	cat > conftest.m << EOF
		% this module contains features which didn't work in
		% previous versions of the Mercury compiler
		% We may also test to see if the installed compiler is
		% recent enough by checking what flags mmc takes.
		% Use [ ] for lists.
		:- module conftest.
		:- interface.
		:- import_module io.
		:- pred main(io__state::di, io__state::uo) is det.

		:- implementation.

		:- import_module int.

		main(!IO) :-
			return_rtti_version(Version),
			(
				Version >= 8,
				ac(2) ^ elem(3, 5) = 17
			->
				io.print("Hello, world\n", !IO)
			;
				io.print("Nope.\n", !IO)
			).

		:- type a    ---> ac(int).

		:- func a ^ elem(int, int) = int.
		:- mode in ^ elem(in,  in ) = out is det.

		ac(T) ^ elem(I, J) = T + I * J.

		:- pred return_rtti_version(int::out) is det.

		:- pragma foreign_proc("C", return_rtti_version(Version::out),
			[may_call_mercury, promise_pure, terminates], "
			Version = MR_RTTI_VERSION;
		").
EOF
	if
		# Test for the `--read-config-file-2003-03-01' option
		echo $BOOTSTRAP_MC conftest >&5 2>&1 &&
		$BOOTSTRAP_MC \
			--verbose \
			--read-config-file-2003-03-01 \
			--halt-at-warn $link_static_opt conftest \
			</dev/null >&5 2>&1 &&
		test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" &&
		# Test for the --record-term-sizes-as-words option.
		# Note that we need to set --grade to an LLDS grade
		# when doing this test because term size profiling
		# requires an LLDS grade.
		$BOOTSTRAP_MC \
			--grade none.gc \
			--record-term-sizes-as-words \
			--output-grade-string \
			</dev/null >&5 2>&1
	then
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	else
		BOOTSTRAP_MC=
		echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
		# This will only work if the user is working with a source
		# distribution which includes the pre-generated .C files.
		# So do a quick check now to ensure that we fail early with a
		# reasonable error message if they are not present.
		if	test -f compiler/top_level.c ||
		   	test -f compiler/Mercury/cs/top_level.c
		then
			true
		elif
			test -f $LIBDIR/bin/$FULLARCH/mercury_compile ||
			test -f $LIBDIR/bin/$FULLARCH/mercury_compile.exe
		then
			{ echo "$as_me:$LINENO: WARNING: using $LIBDIR/bin/$FULLARCH/mercury_compile to bootstrap" >&5
echo "$as_me: WARNING: using $LIBDIR/bin/$FULLARCH/mercury_compile to bootstrap" >&2;}
		else
			{ { echo "$as_me:$LINENO: error: You need a working Mercury compiler to bootstrap with" >&5
echo "$as_me: error: You need a working Mercury compiler to bootstrap with" >&2;}
   { (exit 1); exit 1; }; }
		fi
	fi
	rm -f conftest*
fi
#-----------------------------------------------------------------------------#
# Let the user specify which C compiler to use.

# Check whether --with-cc or --without-cc was given.
if test "${with_cc+set}" = set; then
  withval="$with_cc"
  mercury_cv_with_cc="$withval"
else
  mercury_cv_with_cc=""
fi;
case "$mercury_cv_with_cc" in
	yes)	{ { echo "$as_me:$LINENO: error: missing argument to --with-cc=... option" >&5
echo "$as_me: error: missing argument to --with-cc=... option" >&2;}
   { (exit 1); exit 1; }; }
		exit 1
		;;
	no)	{ { echo "$as_me:$LINENO: error: invalid option --without-cc" >&5
echo "$as_me: error: invalid option --without-cc" >&2;}
   { (exit 1); exit 1; }; }
		exit 1
		;;
	"")
		;;
	*)
		CC="$mercury_cv_with_cc"
		;;
esac
#-----------------------------------------------------------------------------#
#
# Find the GCC source code
# and determine whether or not to enable the GCC back-end interface.
#
# Check whether --enable-gcc-back-end or --disable-gcc-back-end was given.
if test "${enable_gcc_back_end+set}" = set; then
  enableval="$enable_gcc_back_end"
  enable_gcc_back_end="$enableval"
else
  enable_gcc_back_end=default
fi;
echo "$as_me:$LINENO: checking for GCC source directory" >&5
echo $ECHO_N "checking for GCC source directory... $ECHO_C" >&6
gcc_src_dir=not_found
case $enable_gcc_back_end in
	yes|no|default)
		# Search for the gcc source code;
		# first try in a subdirectory of this directory,
		# then one parallel to this directory,
		# and finally try one level up.
		for dir in gcc ../gcc ..; do
			if test -f $dir/gcc/tree.c; then
				gcc_src_dir="$dir"
				break
			fi
		done
		;;
	*)
		# The user has specified the gcc source directory via
		# `--enable-gcc-back-end=<directory>'.  Check that
		# they specified it correctly.
		gcc_src_dir="$enable_gcc_back_end"
		if test -f "$gcc_src_dir"/gcc/tree.c; then
			enable_gcc_back_end=yes
		else
			echo "$as_me:$LINENO: result: $gcc_src_dir" >&5
echo "${ECHO_T}$gcc_src_dir" >&6
			{ { echo "$as_me:$LINENO: error: --enable-gcc-back-end=$gcc_src_dir specified,
	but GCC source code not found in $gcc_src_dir" >&5
echo "$as_me: error: --enable-gcc-back-end=$gcc_src_dir specified,
	but GCC source code not found in $gcc_src_dir" >&2;}
   { (exit 1); exit 1; }; }
		fi
		;;
esac
echo "$as_me:$LINENO: result: $gcc_src_dir" >&5
echo "${ECHO_T}$gcc_src_dir" >&6
echo "$as_me:$LINENO: checking whether to enable the GCC back-end interface" >&5
echo $ECHO_N "checking whether to enable the GCC back-end interface... $ECHO_C" >&6
case $enable_gcc_back_end in
	yes|default)
		if test "$gcc_src_dir" = not_found; then
			case $enable_gcc_back_end in
				yes)
					echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
					{ { echo "$as_me:$LINENO: error: --enable-gcc-back-end specified, but gcc source
	code not found" >&5
echo "$as_me: error: --enable-gcc-back-end specified, but gcc source
	code not found" >&2;}
   { (exit 1); exit 1; }; }
					;;
				default)
					enable_gcc_back_end=no
					;;
			esac
		else
			enable_gcc_back_end=yes
		fi
		;;
	no)
		;;
esac
case $enable_gcc_back_end in
	yes)
		if test "$BOOTSTRAP_MC" = ""; then
			echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
			{ { echo "$as_me:$LINENO: error: --enable-gcc-back-end requires an already
	installed Mercury compiler" >&5
echo "$as_me: error: --enable-gcc-back-end requires an already
	installed Mercury compiler" >&2;}
   { (exit 1); exit 1; }; }
		else
			# This will regenerate compiler/maybe_mlds_to_gcc.m.
			remake_dependencies=true
		fi
		;;
esac

echo "$as_me:$LINENO: result: $enable_gcc_back_end" >&5
echo "${ECHO_T}$enable_gcc_back_end" >&6
ENABLE_GCC_BACK_END=$enable_gcc_back_end
GCC_SRC_DIR=$gcc_src_dir


#-----------------------------------------------------------------------------#
#
# Determine whether or not to enable the Aditi back-end.
#
# Check whether --enable-aditi-back-end or --disable-aditi-back-end was given.
if test "${enable_aditi_back_end+set}" = set; then
  enableval="$enable_aditi_back_end"
  enable_aditi_back_end="$enableval"
else
  enable_aditi_back_end=yes
fi;
echo "$as_me:$LINENO: checking whether to enable the Aditi back-end" >&5
echo $ECHO_N "checking whether to enable the Aditi back-end... $ECHO_C" >&6
case $enable_aditi_back_end in
	no)
		if test "$BOOTSTRAP_MC" = ""; then
			enable_aditi_back_end=yes
			echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
			{ echo "$as_me:$LINENO: WARNING: --disable-aditi-back-end requires an already
	installed Mercury compiler" >&5
echo "$as_me: WARNING: --disable-aditi-back-end requires an already
	installed Mercury compiler" >&2;}
		else
			# This will regenerate compiler/rl_out.m and
			# compiler/rl_file.m.
			echo "$as_me:$LINENO: result: $enable_aditi_back_end" >&5
echo "${ECHO_T}$enable_aditi_back_end" >&6
			remake_dependencies=true
		fi
		;;
esac
ENABLE_ADITI_BACK_END=$enable_aditi_back_end

#-----------------------------------------------------------------------------#
echo "looking for GNU Make..." 1>&6
for ac_prog in gmake make
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_GNU_MAKE+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$GNU_MAKE"; then
  ac_cv_prog_GNU_MAKE="$GNU_MAKE" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_GNU_MAKE="$ac_prog"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
GNU_MAKE=$ac_cv_prog_GNU_MAKE
if test -n "$GNU_MAKE"; then
  echo "$as_me:$LINENO: result: $GNU_MAKE" >&5
echo "${ECHO_T}$GNU_MAKE" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

  test -n "$GNU_MAKE" && break
done

if test "$GNU_MAKE" != ""; then
	case "`$GNU_MAKE -v bogus </dev/null 2>&1`" in
		"GNU Make"*)
			;;
		*)
			GNU_MAKE=
	esac
fi
if test "$GNU_MAKE" = ""; then
	{ { echo "$as_me:$LINENO: error: cannot find GNU Make" >&5
echo "$as_me: error: cannot find GNU Make" >&2;}
   { (exit 1); exit 1; }; }
	exit 1
else
	echo "found GNU Make: $GNU_MAKE" 1>&6
fi

#-----------------------------------------------------------------------------#
echo "looking for a way to create named pipes..." 1>&6

save_PATH="$PATH"
PATH="$PATH:/etc:/usr/etc:/sbin"

# Extract the first word of "mkfifo", so it can be a program name with args.
set dummy mkfifo; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_MKFIFO+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $MKFIFO in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MKFIFO="$MKFIFO" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MKFIFO="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
MKFIFO=$ac_cv_path_MKFIFO

if test -n "$MKFIFO"; then
  echo "$as_me:$LINENO: result: $MKFIFO" >&5
echo "${ECHO_T}$MKFIFO" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

if test "$MKFIFO" != ""; then
	# check that it really works
	tmp=$TMPDIR/fifo$$
	trap "rm -f $tmp" 1 2 3 13 15
	if $MKFIFO $tmp && test -p $tmp; then
		true
	else
		MKFIFO=""
	fi
	rm -f $tmp
fi
if test "$MKFIFO" = ""; then
	# Extract the first word of "mknod", so it can be a program name with args.
set dummy mknod; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_MKNOD+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $MKNOD in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MKNOD="$MKNOD" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MKNOD="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
MKNOD=$ac_cv_path_MKNOD

if test -n "$MKNOD"; then
  echo "$as_me:$LINENO: result: $MKNOD" >&5
echo "${ECHO_T}$MKNOD" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

	if test "$MKNOD" != ""; then
		# check that it really works
		tmp=$TMPDIR/fifo$$
		trap "rm -f $tmp" 1 2 3 13 15
		if $MKNOD $tmp p && test -p $tmp; then
			MKFIFO=mkfifo_using_mknod
		else
			MKNOD=
		fi
	fi
fi
if test "$MKFIFO" = ""; then
	{ echo "$as_me:$LINENO: WARNING: cannot find a working \`mkfifo' or \`mknod'" >&5
echo "$as_me: WARNING: cannot find a working \`mkfifo' or \`mknod'" >&2;}
	MKFIFO=none
	cat >>confdefs.h <<_ACEOF
#define MR_MKFIFO ""
_ACEOF

else
	cat >>confdefs.h <<_ACEOF
#define MR_MKFIFO "$MKFIFO"
_ACEOF

fi

test "$MKNOD" = "" && MKNOD=mknod


PATH="$save_PATH"
#-----------------------------------------------------------------------------#
echo "looking for a way to create temporary files..." 1>&6

# Extract the first word of "mktemp", so it can be a program name with args.
set dummy mktemp; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_MKTEMP+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $MKTEMP in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MKTEMP="$MKTEMP" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MKTEMP="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
MKTEMP=$ac_cv_path_MKTEMP

if test -n "$MKTEMP"; then
  echo "$as_me:$LINENO: result: $MKTEMP" >&5
echo "${ECHO_T}$MKTEMP" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

if test "$MKTEMP" != ""; then
	# check that it really works
	TMPFILE="`mktemp $TMPDIR/configure.XXXXXX < /dev/null`"
	case "$TMPFILE" in
		$TMPDIR/configure.*) rm -f $TMPFILE ;;
		*) MKTEMP="" ;;
	esac
fi
if test "$MKTEMP" = ""; then
	{ echo "$as_me:$LINENO: WARNING: cannot find a working \`mktemp'" >&5
echo "$as_me: WARNING: cannot find a working \`mktemp'" >&2;}
	MKTEMP=""
fi

#-----------------------------------------------------------------------------#
# Extract the first word of "install-info", so it can be a program name with args.
set dummy install-info; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_INSTALL_INFO+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $INSTALL_INFO in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_INSTALL_INFO="$INSTALL_INFO" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
INSTALL_INFO=$ac_cv_path_INSTALL_INFO

if test -n "$INSTALL_INFO"; then
  echo "$as_me:$LINENO: result: $INSTALL_INFO" >&5
echo "${ECHO_T}$INSTALL_INFO" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
# texi2dvi is currently broken on cygwin
case "$host" in
	*-cygwin*)
		TEXI2DVI="" ;;
	*)
		# Extract the first word of "texi2dvi", so it can be a program name with args.
set dummy texi2dvi; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_TEXI2DVI+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $TEXI2DVI in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_TEXI2DVI="$TEXI2DVI" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_TEXI2DVI="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
TEXI2DVI=$ac_cv_path_TEXI2DVI

if test -n "$TEXI2DVI"; then
  echo "$as_me:$LINENO: result: $TEXI2DVI" >&5
echo "${ECHO_T}$TEXI2DVI" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
 ;;
esac

#-----------------------------------------------------------------------------#
# Extract the first word of "lynx", so it can be a program name with args.
set dummy lynx; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_LYNX+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $LYNX in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_LYNX="$LYNX" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_LYNX="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
LYNX=$ac_cv_path_LYNX

if test -n "$LYNX"; then
  echo "$as_me:$LINENO: result: $LYNX" >&5
echo "${ECHO_T}$LYNX" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
# Extract the first word of "dvips", so it can be a program name with args.
set dummy dvips; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_DVIPS+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $DVIPS in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_DVIPS="$DVIPS" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_DVIPS="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
DVIPS=$ac_cv_path_DVIPS

if test -n "$DVIPS"; then
  echo "$as_me:$LINENO: result: $DVIPS" >&5
echo "${ECHO_T}$DVIPS" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
# Extract the first word of "makeinfo", so it can be a program name with args.
set dummy makeinfo; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_MAKEINFO+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $MAKEINFO in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MAKEINFO="$MAKEINFO" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MAKEINFO="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
MAKEINFO=$ac_cv_path_MAKEINFO

if test -n "$MAKEINFO"; then
  echo "$as_me:$LINENO: result: $MAKEINFO" >&5
echo "${ECHO_T}$MAKEINFO" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
# Extract the first word of "info", so it can be a program name with args.
set dummy info; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_INFO+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $INFO in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_INFO="$INFO" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_INFO="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
INFO=$ac_cv_path_INFO

if test -n "$INFO"; then
  echo "$as_me:$LINENO: result: $INFO" >&5
echo "${ECHO_T}$INFO" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PERL+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $PERL in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
PERL=$ac_cv_path_PERL

if test -n "$PERL"; then
  echo "$as_me:$LINENO: result: $PERL" >&5
echo "${ECHO_T}$PERL" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
# Extract the first word of "hostname uname", so it can be a program name with args.
set dummy hostname uname; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_HOSTNAMECMD+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $HOSTNAMECMD in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_HOSTNAMECMD="$HOSTNAMECMD" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_HOSTNAMECMD="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
HOSTNAMECMD=$ac_cv_path_HOSTNAMECMD

if test -n "$HOSTNAMECMD"; then
  echo "$as_me:$LINENO: result: $HOSTNAMECMD" >&5
echo "${ECHO_T}$HOSTNAMECMD" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

case "$HOSTNAMECMD" in
	*hostname)	HOSTNAMECMD="$HOSTNAMECMD -f" ;;
esac
cat >>confdefs.h <<_ACEOF
#define MR_HOSTNAMECMD "$HOSTNAMECMD"
_ACEOF

#-----------------------------------------------------------------------------#
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="${ac_tool_prefix}gcc"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
  echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

fi
if test -z "$ac_cv_prog_CC"; then
  ac_ct_CC=$CC
  # Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$ac_ct_CC"; then
  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_CC="gcc"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

  CC=$ac_ct_CC
else
  CC="$ac_cv_prog_CC"
fi

if test -z "$CC"; then
  if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="${ac_tool_prefix}cc"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
  echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

fi
if test -z "$ac_cv_prog_CC"; then
  ac_ct_CC=$CC
  # Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$ac_ct_CC"; then
  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_CC="cc"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

  CC=$ac_ct_CC
else
  CC="$ac_cv_prog_CC"
fi

fi
if test -z "$CC"; then
  # Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
  ac_prog_rejected=no
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
       ac_prog_rejected=yes
       continue
     fi
    ac_cv_prog_CC="cc"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

if test $ac_prog_rejected = yes; then
  # We found a bogon in the path, so make sure we never use it.
  set dummy $ac_cv_prog_CC
  shift
  if test $# != 0; then
    # We chose a different compiler from the bogus one.
    # However, it has the same basename, so the bogon will be chosen
    # first if we set CC to just the basename; use the full file name.
    shift
    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
  fi
fi
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
  echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

fi
if test -z "$CC"; then
  if test -n "$ac_tool_prefix"; then
  for ac_prog in cl
  do
    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$CC"; then
  ac_cv_prog_CC="$CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
  echo "$as_me:$LINENO: result: $CC" >&5
echo "${ECHO_T}$CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

    test -n "$CC" && break
  done
fi
if test -z "$CC"; then
  ac_ct_CC=$CC
  for ac_prog in cl
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$ac_ct_CC"; then
  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_CC="$ac_prog"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
echo "${ECHO_T}$ac_ct_CC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

  test -n "$ac_ct_CC" && break
done

  CC=$ac_ct_CC
fi

fi


test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&5
echo "$as_me: error: no acceptable C compiler found in \$PATH
See \`config.log' for more details." >&2;}
   { (exit 1); exit 1; }; }

# Provide some information about the compiler.
echo "$as_me:$LINENO:" \
     "checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
  (eval $ac_compiler --version </dev/null >&5) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
  (eval $ac_compiler -v </dev/null >&5) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
  (eval $ac_compiler -V </dev/null >&5) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }

cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
  (eval $ac_link_default) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; then
  # Find the output, starting from the most likely.  This scheme is
# not robust to junk in `.', hence go to wildcards (a.*) only as a last
# resort.

# Be careful to initialize this variable, since it used to be cached.
# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
ac_cv_exeext=
# b.out is created by i960 compilers.
for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
  test -f "$ac_file" || continue
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
	;;
    conftest.$ac_ext )
	# This is the source file.
	;;
    [ab].out )
	# We found the default executable, but exeext='' is most
	# certainly right.
	break;;
    *.* )
	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
	# FIXME: I believe we export ac_cv_exeext for Libtool,
	# but it would be cool to find out if it's true.  Does anybody
	# maintain Libtool? --akim.
	export ac_cv_exeext
	break;;
    * )
	break;;
  esac
done
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
See \`config.log' for more details." >&5
echo "$as_me: error: C compiler cannot create executables
See \`config.log' for more details." >&2;}
   { (exit 77); exit 77; }; }
fi

ac_exeext=$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_file" >&5
echo "${ECHO_T}$ac_file" >&6

# Check the compiler produces executables we can run.  If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether the C compiler works" >&5
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
  if { ac_try='./$ac_file'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
    cross_compiling=no
  else
    if test "$cross_compiling" = maybe; then
	cross_compiling=yes
    else
	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&5
echo "$as_me: error: cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details." >&2;}
   { (exit 1); exit 1; }; }
    fi
  fi
fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6

rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
# Check the compiler produces executables we can run.  If not, either
# the compiler is broken, or we cross compile.
echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $cross_compiling" >&5
echo "${ECHO_T}$cross_compiling" >&6

echo "$as_me:$LINENO: checking for suffix of executables" >&5
echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; then
  # If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
for ac_file in conftest.exe conftest conftest.*; do
  test -f "$ac_file" || continue
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
	  export ac_cv_exeext
	  break;;
    * ) break;;
  esac
done
else
  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." >&2;}
   { (exit 1); exit 1; }; }
fi

rm -f conftest$ac_cv_exeext
echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
echo "${ECHO_T}$ac_cv_exeext" >&6

rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
echo "$as_me:$LINENO: checking for suffix of object files" >&5
echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF
rm -f conftest.o conftest.obj
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; then
  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
       break;;
  esac
done
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&5
echo "$as_me: error: cannot compute suffix of object files: cannot compile
See \`config.log' for more details." >&2;}
   { (exit 1); exit 1; }; }
fi

rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
echo "${ECHO_T}$ac_cv_objext" >&6
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

int
main ()
{
#ifndef __GNUC__
       choke me
#endif

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_compiler_gnu=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_compiler_gnu=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu

fi
echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
CFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_prog_cc_g=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_prog_cc_g=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
  CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
  if test "$GCC" = yes; then
    CFLAGS="-g -O2"
  else
    CFLAGS="-g"
  fi
else
  if test "$GCC" = yes; then
    CFLAGS="-O2"
  else
    CFLAGS=
  fi
fi
echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
if test "${ac_cv_prog_cc_stdc+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
     char **p;
     int i;
{
  return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
  char *s;
  va_list v;
  va_start (v,p);
  s = g (p, va_arg (v,int));
  va_end (v);
  return s;
}

/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
   function prototypes and stuff, but not '\xHH' hex character constants.
   These don't provoke an error unfortunately, instead are silently treated
   as 'x'.  The following induces an error, until -std1 is added to get
   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
   array size at least.  It's necessary to write '\x00'==0 to get something
   that's true only with -std1.  */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];

int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
int
main ()
{
return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
  ;
  return 0;
}
_ACEOF
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX			-qlanglvl=ansi
# Ultrix and OSF/1	-std1
# HP-UX 10.20 and later	-Ae
# HP-UX older versions	-Aa -D_HPUX_SOURCE
# SVR4			-Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
  CC="$ac_save_CC $ac_arg"
  rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_prog_cc_stdc=$ac_arg
break
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

fi
rm -f conftest.err conftest.$ac_objext
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC

fi

case "x$ac_cv_prog_cc_stdc" in
  x|xno)
    echo "$as_me:$LINENO: result: none needed" >&5
echo "${ECHO_T}none needed" >&6 ;;
  *)
    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
    CC="$CC $ac_cv_prog_cc_stdc" ;;
esac

# Some people use a C++ compiler to compile C.  Since we use `exit',
# in C++ we need to declare it.  In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
# the declaration of exit, since it's the most demanding environment.
cat >conftest.$ac_ext <<_ACEOF
#ifndef __cplusplus
  choke me
#endif
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  for ac_declaration in \
   '' \
   'extern "C" void std::exit (int) throw (); using std::exit;' \
   'extern "C" void std::exit (int); using std::exit;' \
   'extern "C" void exit (int) throw ();' \
   'extern "C" void exit (int);' \
   'void exit (int);'
do
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_declaration
#include <stdlib.h>
int
main ()
{
exit (42);
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  :
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

continue
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_declaration
int
main ()
{
exit (42);
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  break
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
  echo '#ifdef __cplusplus' >>confdefs.h
  echo $ac_declaration      >>confdefs.h
  echo '#endif'             >>confdefs.h
fi

else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu



echo "$as_me:$LINENO: checking whether C compiler needs -no-cpp-precomp" >&5
echo $ECHO_N "checking whether C compiler needs -no-cpp-precomp... $ECHO_C" >&6
if test "${mercury_cv_cpp_precomp+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

	>conftest.c
	if	test "$GCC" = yes &&
		$CC -v -c conftest.c 2>&1 | \
			grep "cpp-precomp.*-smart" > /dev/null
	then
		mercury_cv_cpp_precomp=yes
	else
		mercury_cv_cpp_precomp=no
	fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_cpp_precomp" >&5
echo "${ECHO_T}$mercury_cv_cpp_precomp" >&6
if test $mercury_cv_cpp_precomp = yes; then
	CC="$CC -no-cpp-precomp"
fi



# AC_PROG_CC sets GCC to yes if $CC is GNU C.
if test "$GCC" = "yes"; then
	GCC_PROG=$CC
else
	# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_GCC_PROG+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $GCC_PROG in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_GCC_PROG="$GCC_PROG" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_GCC_PROG="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
GCC_PROG=$ac_cv_path_GCC_PROG

if test -n "$GCC_PROG"; then
  echo "$as_me:$LINENO: result: $GCC_PROG" >&5
echo "${ECHO_T}$GCC_PROG" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

fi




# We need to ensure that CFLAGS does not contain `-g', because
# on some (broken) distributions of Linux (specifically Debian 0.93R6),
# the `-lc' and `-lg' libraries have different contents; specifically,
# only the latter contains memalign().  We need to make sure that the
# test for memalign() doesn't use `-g', since `ml' doesn't use `-g'.
CFLAGS="-O"

# we also need to add the appropriate `-I' options so that the test programs
# can #include various Mercury runtime headers.
case "$MERCURY_CONF_RECONFIGURE" in
	"")
		CPPFLAGS="-Iruntime -Iruntime/machdeps -Itrace $CPPFLAGS"
		;;
	*)
		# We're generating a new configuration for
		# an existing installation.
		CPPFLAGS="-I$PREFIX/lib/mercury/inc $CPPFLAGS"
		;;
esac

#-----------------------------------------------------------------------------#
# Make sure we search /usr/local/include and /usr/local/lib for
# header files and libraries.  GNU C normally searches /usr/local/include
# by default, but (inconsistently) on some systems, such as Solaris,
# it does _not_ search /usr/local/lib.
# The user might also be using a different C compiler that
# doesn't search either of those by default.


echo "$as_me:$LINENO: checking whether to pass -I/usr/local/include to C compiler" >&5
echo $ECHO_N "checking whether to pass -I/usr/local/include to C compiler... $ECHO_C" >&6
ALL_LOCAL_C_INCL_DIRS=""
ALL_LOCAL_C_INCL_DIR_MMC_OPTS=""

if test "$GCC" = yes -o "$USING_MICROSOFT_CL_COMPILER" = yes; then
	# Don't add -I/usr/local/include, since it causes a warning
	# with gcc 3.1, and gcc already searches /usr/local/include.
	# Microsoft compilers don't understand Unix pathnames.
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
else
	# It's some other compiler.  We don't know if it searches
	# /usr/local/include by default, so add it.
	if test -d /usr/local/include/.; then
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		ALL_LOCAL_C_INCL_DIRS="-I/usr/local/include "
		ALL_LOCAL_C_INCL_DIR_MMC_OPTS="--c-include-directory /usr/local/include "
	else
		echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
	fi
fi



CPPFLAGS="$ALL_LOCAL_C_INCL_DIRS $CPPFLAGS"

echo "$as_me:$LINENO: checking whether to pass -L/usr/local/lib to the linker" >&5
echo $ECHO_N "checking whether to pass -L/usr/local/lib to the linker... $ECHO_C" >&6

# Microsoft compilers don't understand Unix pathnames.
if test "$USING_MICROSOFT_CL_COMPILER" = no -a -d /usr/local/lib/.; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	ALL_LOCAL_C_LIB_DIRS=/usr/local/lib
	ALL_LOCAL_C_LIB_DIR_MMC_OPTS="-L/usr/local/lib -R/usr/local/lib"
else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
	ALL_LOCAL_C_LIB_DIRS=
	ALL_LOCAL_C_LIB_DIR_MMC_OPTS=
fi



for dir in $ALL_LOCAL_C_LIB_DIRS kludge_for_broken_shells
do
	if test "$dir" != "kludge_for_broken_shells"; then
		LIBS="-L$dir $LIBS"
	fi
done

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
  if test "${ac_cv_prog_CPP+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
      # Double quotes because CPP needs to be expanded
    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
    do
      ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
  # Use a header file that comes with gcc, so configuring glibc
  # with a fresh cross-compiler works.
  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  # <limits.h> exists even on freestanding compilers.
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp. "Syntax error" is here to catch this case.
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
		     Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  :
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  # Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext

  # OK, works on sane cases.  Now check whether non-existent headers
  # can be detected and how.
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  # Broken: success on invalid input.
continue
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  # Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext

done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
  break
fi

    done
    ac_cv_prog_CPP=$CPP

fi
  CPP=$ac_cv_prog_CPP
else
  ac_cv_prog_CPP=$CPP
fi
echo "$as_me:$LINENO: result: $CPP" >&5
echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
  # Use a header file that comes with gcc, so configuring glibc
  # with a fresh cross-compiler works.
  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  # <limits.h> exists even on freestanding compilers.
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp. "Syntax error" is here to catch this case.
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
		     Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  :
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  # Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext

  # OK, works on sane cases.  Now check whether non-existent headers
  # can be detected and how.
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  # Broken: success on invalid input.
continue
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  # Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext

done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
  :
else
  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&5
echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details." >&2;}
   { (exit 1); exit 1; }; }
fi

ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for use of a Microsoft C compiler" >&5
echo $ECHO_N "checking for use of a Microsoft C compiler... $ECHO_C" >&6


echo "$as_me:$LINENO: checking for egrep" >&5
echo $ECHO_N "checking for egrep... $ECHO_C" >&6
if test "${ac_cv_prog_egrep+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
    then ac_cv_prog_egrep='grep -E'
    else ac_cv_prog_egrep='egrep'
    fi
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
echo "${ECHO_T}$ac_cv_prog_egrep" >&6
 EGREP=$ac_cv_prog_egrep


cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

#ifdef _MSC_VER
	yes
#endif

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "yes" >/dev/null 2>&1; then
  ac_microsoft=yes
 echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
  ac_microsoft=no
 echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
rm -f conftest*


LDFLAGS_FOR_TRACE=
LD_LIBFLAGS_FOR_TRACE=
if test "$ac_microsoft" = "yes" ; then
	# Use MS-style file names and command-line options
	OBJ_SUFFIX="obj"
	LIB_SUFFIX="lib"
	LIB_PREFIX="lib"
	LIB_LIBPATH="/LIBPATH:"
	LINK_LIB=""
	LINK_LIB_SUFFIX=".lib"
	LINK_OPT_SEP="/link"

	OBJFILE_OPT="/Fo"
	AR="lib"
	ARFLAGS=""
	AR_LIBFILE_OPT="/OUT:"

	LDFLAGS_FOR_DEBUG="/DEBUG"
	LD_LIBFLAGS_FOR_DEBUG="/DEBUG"
	LD_STRIP_FLAG=

	USING_MICROSOFT_CL_COMPILER="yes"

	case "$CYGPATH" in "echo")
		{ echo "$as_me:$LINENO: WARNING: cygpath required with Microsoft Visual C++" >&5
echo "$as_me: WARNING: cygpath required with Microsoft Visual C++" >&2;} ;;
	esac
	FIX_PATH_FOR_CC="$CYGPATH"

		# MS doesn't use a ranlib.
	RANLIB="echo"

else
	# Use Unix-style file names and command-line options
	OBJ_SUFFIX="o"
	LIB_SUFFIX="a"
	LIB_PREFIX=""
	LIB_LIBPATH="-L"
	LINK_LIB="-l"
	LINK_LIB_SUFFIX=""
	LINK_OPT_SEP=""

	OBJFILE_OPT="-o "
	AR="ar"
	ARFLAGS="cr"
	AR_LIBFILE_OPT=""

	LD_STRIP_FLAG="-s"
	LDFLAGS_FOR_DEBUG="-g"
	LD_LIBFLAGS_FOR_DEBUG="-g"

	#
	# On Linux ELF, the linker option `-export-dynamic' is needed to make
	# symbols exported for use in code linked in with dlopen(),
	# which is used for interactive queries in the
	# Mercury debugger.  For gcc, this linker option can be enabled by
	# passing either `-rdynamic' or `-Wl,-export-dynamic' to gcc;
	# we use the former.  For lcc 4.2, we need to use `-Wl-export-dynamic'.
	#
	case $FULLARCH in
		*-linux*aout) ;; # no special options needed
		*-linux*)
			case "$CC" in
			lcc*) LDFLAGS_FOR_TRACE="-Wl-export-dynamic" ;;
			*) LDFLAGS_FOR_TRACE="-rdynamic" ;;
			esac
			;;
	esac

	USING_MICROSOFT_CL_COMPILER="no"

	FIX_PATH_FOR_CC=echo

	if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_RANLIB+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$RANLIB"; then
  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
  echo "$as_me:$LINENO: result: $RANLIB" >&5
echo "${ECHO_T}$RANLIB" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

fi
if test -z "$ac_cv_prog_RANLIB"; then
  ac_ct_RANLIB=$RANLIB
  # Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test -n "$ac_ct_RANLIB"; then
  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_RANLIB="ranlib"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

  RANLIB=$ac_ct_RANLIB
else
  RANLIB="$ac_cv_prog_RANLIB"
fi


	# On MacOS 10.1 (and other MacOS systems?),
	# we need to pass the `-c' option to ranlib.
	# Otherwise, "common" symbols, i.e. "int foo;" without an initializer,
	# do not get included in the archive table of contents, and so
	# don't get found during linking.  Whose !@#$ing idea was it to make
	# that brain-damaged and non-standard-conforming mode the default?

	case "$host" in *-apple-darwin*)
		RANLIB="$RANLIB -c"

		;;
	esac
fi





















#-----------------------------------------------------------------------------#
# Check for `-lm': some systems, e.g. MacOS X (Darwin), don't have it.
# The result of this check may be overridden below.
echo "$as_me:$LINENO: checking for sin in -lm" >&5
echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6
if test "${ac_cv_lib_m_sin+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lm  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char sin ();
int
main ()
{
sin ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_m_sin=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_m_sin=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5
echo "${ECHO_T}$ac_cv_lib_m_sin" >&6
if test $ac_cv_lib_m_sin = yes; then
  MATH_LIB=-lm
else
  MATH_LIB=
fi


#-----------------------------------------------------------------------------#
# If we're compiling the compiler with MS Visual C++ or `gcc -mno-cygwin',
# don't use symlinks when installing -- the generated compiler executable
# will not be able to follow them.
#
# When cross-compiling from Cygwin to Mingw (and perhaps also on
# native Mingw?), `-lm' exists, but it is not needed and in fact we must
# not use it, because if we do then it causes cygwin1.dll to be linked in.
MMC_USE_SYMLINKS_OPT=
LN_S="ln -s"
case "$host" in
    *cygwin*)
	case "$CC" in
	    # cl is the Microsoft C compiler
	    *gcc*-mno-cygwin* | *cl* | *CL*)
		MMC_USE_SYMLINKS_OPT=--no-use-symlinks
		MATH_LIB=
		LN_S=false
		;;
	esac ;;
esac





#-----------------------------------------------------------------------------#
# Microsoft.NET configuration
#

# Extract the first word of "ilasm", so it can be a program name with args.
set dummy ilasm; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_ILASM+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $ILASM in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_ILASM="$ILASM" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_ILASM="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
ILASM=$ac_cv_path_ILASM

if test -n "$ILASM"; then
  echo "$as_me:$LINENO: result: $ILASM" >&5
echo "${ECHO_T}$ILASM" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

# Extract the first word of "gacutil", so it can be a program name with args.
set dummy gacutil; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_GACUTIL+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $GACUTIL in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_GACUTIL="$GACUTIL" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_GACUTIL="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
GACUTIL=$ac_cv_path_GACUTIL

if test -n "$GACUTIL"; then
  echo "$as_me:$LINENO: result: $GACUTIL" >&5
echo "${ECHO_T}$GACUTIL" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


echo "$as_me:$LINENO: checking for Microsoft.NET Framework SDK" >&5
echo $ECHO_N "checking for Microsoft.NET Framework SDK... $ECHO_C" >&6
if test "${mercury_cv_microsoft_dotnet+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

if test "$ILASM" != ""; then

	MS_DOTNET_SDK_DIR=`expr "$ILASM" : '\(.*\)[/\\]*[bB]in[/\\]*ilasm'`

	mercury_cv_microsoft_dotnet="yes"
else
	MS_DOTNET_SDK_DIR=""
	mercury_cv_microsoft_dotnet="no"
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_microsoft_dotnet" >&5
echo "${ECHO_T}$mercury_cv_microsoft_dotnet" >&6
ILASM=`basename "$ILASM"`
GACUTIL=`basename "$GACUTIL"`

# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_MS_CL+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $MS_CL in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MS_CL="$MS_CL" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MS_CL="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
MS_CL=$ac_cv_path_MS_CL

if test -n "$MS_CL"; then
  echo "$as_me:$LINENO: result: $MS_CL" >&5
echo "${ECHO_T}$MS_CL" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

echo "$as_me:$LINENO: checking for Microsoft.NET Visual C++" >&5
echo $ECHO_N "checking for Microsoft.NET Visual C++... $ECHO_C" >&6
if test "${mercury_cv_microsoft_visual_cpp+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

if test "$MS_CL" != ""; then

	MS_VISUALCPP_DIR=`expr "$MS_CL" : '\(.*\)[/\\]*[bB]in[/\\]*cl'`

	mercury_cv_microsoft_visual_cpp="yes"
else
	MS_VISUALCPP_DIR=""
	mercury_cv_microsoft_visual_cpp="no"
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_microsoft_visual_cpp" >&5
echo "${ECHO_T}$mercury_cv_microsoft_visual_cpp" >&6
MS_CL=`basename "$MS_CL"`

# Check for the C# (C sharp) compiler.
# Extract the first word of "csc", so it can be a program name with args.
set dummy csc; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_MS_CSC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $MS_CSC in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MS_CSC="$MS_CSC" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MS_CSC="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
MS_CSC=$ac_cv_path_MS_CSC

if test -n "$MS_CSC"; then
  echo "$as_me:$LINENO: result: $MS_CSC" >&5
echo "${ECHO_T}$MS_CSC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

MS_CSC=`basename "$MS_CSC"`

# We default to the Beta 2 version of the library
mercury_cv_microsoft_dotnet_library_version=1.0.2411.0
if	test $mercury_cv_microsoft_dotnet = "yes" &&
	test "$MS_CSC" != "";
then
	echo "$as_me:$LINENO: checking version of .NET libraries" >&5
echo $ECHO_N "checking version of .NET libraries... $ECHO_C" >&6
	cat > conftest.cs << EOF
	using System;
	using System.Reflection;
	public class version {
	    public static void Main()
	    {
		Assembly asm = Assembly.Load("mscorlib");
		AssemblyName name = asm.GetName();
		Version version = name.Version;
		Console.Write(version);
		Console.Write("\n");
	    }
	}
EOF
	if
		echo $MS_CSC conftest.cs >&5 2>&1 && \
			$MS_CSC conftest.cs  >&5 2>&1 && \
			./conftest > conftest.out 2>&1
	then
		mercury_cv_microsoft_dotnet_library_version=`cat conftest.out`
		echo "$as_me:$LINENO: result: $mercury_cv_microsoft_dotnet_library_version" >&5
echo "${ECHO_T}$mercury_cv_microsoft_dotnet_library_version" >&6
		rm -f conftest*
	else
		rm -f conftest*
		if test "$enable_dotnet_grades" = "yes"; then
			{ { echo "$as_me:$LINENO: error: unable to determine version" >&5
echo "$as_me: error: unable to determine version" >&2;}
   { (exit 1); exit 1; }; }
			exit 1
		else
			{ echo "$as_me:$LINENO: WARNING: unable to determine version" >&5
echo "$as_me: WARNING: unable to determine version" >&2;}
		fi
	fi
fi
MS_DOTNET_LIBRARY_VERSION=$mercury_cv_microsoft_dotnet_library_version










#-----------------------------------------------------------------------------#
# Java configuration
#

# jikes requires the usual Java SDK to run, so if we checked for javac first,
# then that's what we'd get. If the user has jikes installed, then that
# probably means that they want to use it, so we check for jikes before javac.
for ac_prog in jikes javac gcj
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_JAVAC+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $JAVAC in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_JAVAC="$JAVAC" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
JAVAC=$ac_cv_path_JAVAC

if test -n "$JAVAC"; then
  echo "$as_me:$LINENO: result: $JAVAC" >&5
echo "${ECHO_T}$JAVAC" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

  test -n "$JAVAC" && break
done

case "$JAVAC" in *gcj)
	JAVAC="$JAVAC -C" ;;
esac
# Extract the first word of "java gij", so it can be a program name with args.
set dummy java gij; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_JAVA_INTERPRETER+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $JAVA_INTERPRETER in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_JAVA_INTERPRETER="$JAVA_INTERPRETER" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_JAVA_INTERPRETER="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
JAVA_INTERPRETER=$ac_cv_path_JAVA_INTERPRETER

if test -n "$JAVA_INTERPRETER"; then
  echo "$as_me:$LINENO: result: $JAVA_INTERPRETER" >&5
echo "${ECHO_T}$JAVA_INTERPRETER" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

# Extract the first word of "jar", so it can be a program name with args.
set dummy jar; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_JAR+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $JAR in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_JAR="$JAR" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
JAR=$ac_cv_path_JAR

if test -n "$JAR"; then
  echo "$as_me:$LINENO: result: $JAR" >&5
echo "${ECHO_T}$JAR" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


if test "${mercury_cv_java+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

if test "$JAVAC" != "" -a "$JAVA_INTERPRETER" != "" -a "$JAR" != ""; then
	echo "$as_me:$LINENO: checking if the above Java SDK works and is sufficiently recent" >&5
echo $ECHO_N "checking if the above Java SDK works and is sufficiently recent... $ECHO_C" >&6
	cat > conftest.java << EOF
		// This program simply retrieves the constant
		// specifying the version number of the Java SDK and
		// checks it is at least 1.2, printing "Hello, world"
		// if successful.
		public class conftest {
		    public static void main (String[] args) {
			float	version;
			String	strVer = System.getProperty(
					"java.specification.version");

			try {
				version = Float.valueOf(strVer).floatValue();
			}
			catch (NumberFormatException e) {
				System.out.println("ERROR: \"java." +
						"specification.version\" " +
						"constant has incorrect " +
						"format.\nGot \"" + strVer +
						"\", expected a number.");
				version = 0f;
			}

			if (version >= 1.2f) {
				System.out.println("Hello, world\n");
			} else {
				System.out.println("Nope, sorry.\n");
			}
		    }
		}
EOF
	if
		echo $JAVAC conftest.java >&5 2>&1 &&
		$JAVAC conftest.java >&5 2>&1 &&
		echo $JAVA_INTERPRETER conftest > conftest.out 2>&5 &&
		$JAVA_INTERPRETER conftest > conftest.out 2>&5 &&
		test "`tr -d '\015' < conftest.out`" = "Hello, world"
	then
		mercury_cv_java="yes"
	else
		mercury_cv_java="no"
	fi
	echo "$as_me:$LINENO: result: $mercury_cv_java" >&5
echo "${ECHO_T}$mercury_cv_java" >&6
else
	if test "$JAVAC" = ""; then
		JAVAC="javac"
	fi
	if test "$JAVA_INTERPRETER" = ""; then
		JAVA_INTERPRETER="java"
	fi
	if test "$JAR" = ""; then
		JAR="jar"
	fi
	mercury_cv_java="no"
fi

fi







#-----------------------------------------------------------------------------#
mercury_check_for_functions () {

    for mercury_cv_func in "$@"
    do
	mercury_cv_func_define="MR_HAVE_`echo $mercury_cv_func | \
		tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`"
	as_ac_var=`echo "ac_cv_func_$mercury_cv_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $mercury_cv_func" >&5
echo $ECHO_N "checking for $mercury_cv_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
/* Define $mercury_cv_func to an innocuous variant, in case <limits.h> declares $mercury_cv_func.
   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
#define $mercury_cv_func innocuous_$mercury_cv_func

/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char $mercury_cv_func (); below.
    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
    <limits.h> exists even on freestanding compilers.  */

#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif

#undef $mercury_cv_func

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char $mercury_cv_func ();
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_$mercury_cv_func) || defined (__stub___$mercury_cv_func)
choke me
#else
char (*f) () = $mercury_cv_func;
#endif
#ifdef __cplusplus
}
#endif

int
main ()
{
return f != $mercury_cv_func;
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  eval "$as_ac_var=yes"
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

eval "$as_ac_var=no"
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then

		cat >>confdefs.h <<_ACEOF
#define $mercury_cv_func_define 1
_ACEOF


fi

    done
}

# Don't try to use mprotect() on gnu-win32, since it is broken
# (at least for version b18, anyway) and trying it can crash Win95.
case "$host" in
	*-cygwin*)
		ac_cv_func_mprotect=no ;;
esac

mercury_check_for_functions \
		sysconf getpagesize gethostname \
		mprotect memalign memmove \
		sigaction siginterrupt setitimer \
		snprintf _snprintf vsnprintf _vsnprintf strerror \
		open close dup dup2 fdopen fileno fstat stat lstat isatty \
		getpid setpgid fork execlp wait kill \
		grantpt unlockpt ptsname tcgetattr tcsetattr ioctl \
		access sleep opendir readdir closedir mkdir symlink readlink

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>

int
main ()
{

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_header_stdc=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_header_stdc=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext

if test $ac_cv_header_stdc = yes; then
  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <string.h>

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "memchr" >/dev/null 2>&1; then
  :
else
  ac_cv_header_stdc=no
fi
rm -f conftest*

fi

if test $ac_cv_header_stdc = yes; then
  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <stdlib.h>

_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  $EGREP "free" >/dev/null 2>&1; then
  :
else
  ac_cv_header_stdc=no
fi
rm -f conftest*

fi

if test $ac_cv_header_stdc = yes; then
  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
  if test "$cross_compiling" = yes; then
  :
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <ctype.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
# define ISLOWER(c) \
		   (('a' <= (c) && (c) <= 'i') \
		     || ('j' <= (c) && (c) <= 'r') \
		     || ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif

#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int
main ()
{
  int i;
  for (i = 0; i < 256; i++)
    if (XOR (islower (i), ISLOWER (i))
	|| toupper (i) != TOUPPER (i))
      exit(2);
  exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  :
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
ac_cv_header_stdc=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then

cat >>confdefs.h <<\_ACEOF
#define STDC_HEADERS 1
_ACEOF

fi

# On IRIX 5.3, sys/types and inttypes.h are conflicting.









for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
		  inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default

#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  eval "$as_ac_Header=yes"
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

eval "$as_ac_Header=no"
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
  cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF

fi

done



    for mercury_cv_header in \
		unistd.h sys/wait.h sys/siginfo.h sys/signal.h ucontext.h \
		asm/sigcontext.h sys/param.h sys/time.h sys/times.h \
		sys/types.h sys/stat.h fcntl.h termios.h sys/ioctl.h \
		sys/stropts.h windows.h dirent.h; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
  # Is the header compilable?
echo "$as_me:$LINENO: checking $mercury_cv_header usability" >&5
echo $ECHO_N "checking $mercury_cv_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
#include <$mercury_cv_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_header_compiler=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6

# Is the header present?
echo "$as_me:$LINENO: checking $mercury_cv_header presence" >&5
echo $ECHO_N "checking $mercury_cv_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <$mercury_cv_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  ac_header_preproc=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  yes:no: )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&2;}
    ac_header_preproc=yes
    ;;
  no:yes:* )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $mercury_cv_header: present but cannot be compiled" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $mercury_cv_header: see the Autoconf documentation" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&2;}
    (
      cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists.  ##
## ------------------------------------------ ##
_ASBOX
    ) |
      sed "s/^/$as_me: WARNING:     /" >&2
    ;;
esac
echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6

fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then

		cat >>confdefs.h <<_ACEOF
#define $mercury_cv_header_define 1
_ACEOF

		eval "$mercury_cv_header_define=1"

fi


    done


if test "$MR_HAVE_UCONTEXT_H" != 1; then

    for mercury_cv_header in sys/ucontext.h; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
  # Is the header compilable?
echo "$as_me:$LINENO: checking $mercury_cv_header usability" >&5
echo $ECHO_N "checking $mercury_cv_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
#include <$mercury_cv_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_header_compiler=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6

# Is the header present?
echo "$as_me:$LINENO: checking $mercury_cv_header presence" >&5
echo $ECHO_N "checking $mercury_cv_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <$mercury_cv_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  ac_header_preproc=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  yes:no: )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&2;}
    ac_header_preproc=yes
    ;;
  no:yes:* )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $mercury_cv_header: present but cannot be compiled" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $mercury_cv_header: see the Autoconf documentation" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&2;}
    (
      cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists.  ##
## ------------------------------------------ ##
_ASBOX
    ) |
      sed "s/^/$as_me: WARNING:     /" >&2
    ;;
esac
echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6

fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then

		cat >>confdefs.h <<_ACEOF
#define $mercury_cv_header_define 1
_ACEOF

		eval "$mercury_cv_header_define=1"

fi


    done

fi
#-----------------------------------------------------------------------------#
#
# check the basics of sigaction
#
if test "$ac_cv_func_sigaction" = yes; then
	echo "$as_me:$LINENO: checking for \`sigaction' field name" >&5
echo $ECHO_N "checking for \`sigaction' field name... $ECHO_C" >&6
	if test "${mercury_cv_sigaction_field+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_sigaction_field=sa_handler
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */


	#include <signal.h>
	#include <stdlib.h>

	#define FAULT_ADDRESS ((int *)112)

	extern void handler(int signum, siginfo_t *info, void *context);

	int main() {
		struct sigaction act;
		act.sa_flags = SA_SIGINFO;
		act.sa_sigaction = handler;
		if (sigemptyset(&act.sa_mask) != 0)
			exit(1);
		if (sigaction(SIGSEGV, &act, NULL) != 0)
			exit(1);
		/* provoke a SIGSEGV */
		(*FAULT_ADDRESS)++;
		exit(1);
	}

	void handler(int signum, siginfo_t *info, void *context) {
		if (signum == SIGSEGV &&
		    info->si_signo == SIGSEGV &&
		    info->si_code > 0 &&
		    (int *)info->si_addr == FAULT_ADDRESS)
		{
			exit(0);
		} else {
			exit(1);
		}
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_sigaction_field=sa_sigaction
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_sigaction_field=sa_handler
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi

	echo "$as_me:$LINENO: result: $mercury_cv_sigaction_field" >&5
echo "${ECHO_T}$mercury_cv_sigaction_field" >&6
	cat >>confdefs.h <<_ACEOF
#define MR_SIGACTION_FIELD $mercury_cv_sigaction_field
_ACEOF

	if test $mercury_cv_sigaction_field = sa_sigaction; then
		cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGINFO 1
_ACEOF

	fi
fi
#
# check the basics of sigcontext_struct
#
echo "$as_me:$LINENO: checking for working \`sigcontext_struct' in second arg" >&5
echo $ECHO_N "checking for working \`sigcontext_struct' in second arg... $ECHO_C" >&6
if test "${mercury_cv_sigcontext_struct_2arg+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  mercury_cv_sigcontext_struct_2arg=no
if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* see runtime/mercury_signal.h for documentation of this code */

#define sigcontext_struct sigcontext

#define __KERNEL__
#include <signal.h>
#undef __KERNEL__

#ifdef MR_HAVE_ASM_SIGCONTEXT_H
#include <asm/sigcontext.h>
#endif

#include "mercury_faultaddr.h"

#include <stdio.h>

extern void handler(int signum, struct sigcontext_struct info);

#define FAULT_ADDRESS ((int *)112)

int main() {
	signal(SIGSEGV, (void (*)(int))handler);

	/* provoke a SIGSEGV */
	(*FAULT_ADDRESS)++;

	exit(1);
}

void handler(int signum, struct sigcontext_struct context) {
	int *addr;
	addr = (int *) MR_GET_FAULT_ADDR(context);
	if (signum == SIGSEGV && addr == FAULT_ADDRESS) {
		exit(0);
	} else {
		exit(1);
	}
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_sigcontext_struct_2arg=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi

echo "$as_me:$LINENO: result: $mercury_cv_sigcontext_struct_2arg" >&5
echo "${ECHO_T}$mercury_cv_sigcontext_struct_2arg" >&6

if test $mercury_cv_sigcontext_struct_2arg = no; then
	#
	# check for a sigcontext_struct in the third argument of
	# the signal handler (Linux-68k has this).
	#
	echo "$as_me:$LINENO: checking for working \`sigcontext_struct' in third arg" >&5
echo $ECHO_N "checking for working \`sigcontext_struct' in third arg... $ECHO_C" >&6
	if test "${mercury_cv_sigcontext_struct_3arg+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  mercury_cv_sigcontext_struct_3arg=no

	if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	/* see runtime/mercury_signal.h for documentation of this code */

	#define sigcontext_struct sigcontext

	#define __KERNEL__
	#include <signal.h>
	#undef __KERNEL__

	#ifdef MR_HAVE_ASM_SIGCONTEXT_H
	#include <asm/sigcontext.h>
	#endif

	#include "mercury_faultaddr.h"

	#include <stdio.h>

	extern void handler(int signum, int code, struct
		sigcontext_struct info);

	#define FAULT_ADDRESS ((int *)112)

	int main() {
		signal(SIGSEGV, (void (*)(int))handler);

		/* provoke a SIGSEGV */
		(*FAULT_ADDRESS)++;

		exit(1);
	}

	void handler(int signum, int code, struct sigcontext_struct context) {
		int *addr;
		addr = (int *) MR_GET_FAULT_ADDR(context);
		if (signum == SIGSEGV && addr == FAULT_ADDRESS) {
			exit(0);
		} else {
			exit(1);
		}
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_sigcontext_struct_3arg=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi

	echo "$as_me:$LINENO: result: $mercury_cv_sigcontext_struct_3arg" >&5
echo "${ECHO_T}$mercury_cv_sigcontext_struct_3arg" >&6
else
	mercury_cv_sigcontext_struct_3arg=no
fi

mercury_cv_sigcontext_struct=no

if test $mercury_cv_sigcontext_struct_2arg = yes; then
	mercury_cv_sigcontext_struct=yes
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGCONTEXT_STRUCT_2ARG 1
_ACEOF

fi

if test $mercury_cv_sigcontext_struct_3arg = yes; then
	mercury_cv_sigcontext_struct=yes
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGCONTEXT_STRUCT_3ARG 1
_ACEOF

fi

if test $mercury_cv_sigcontext_struct = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGCONTEXT_STRUCT 1
_ACEOF

	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGINFO 1
_ACEOF


	#
	# check for sigcontext_struct.eip
	#
	echo "$as_me:$LINENO: checking for \`sigcontext_struct' pc access at signals" >&5
echo $ECHO_N "checking for \`sigcontext_struct' pc access at signals... $ECHO_C" >&6
	if test "${mercury_cv_pc_access+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  mercury_cv_pc_access=no
	if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	/* see runtime/mercury_signal.h for documentation of this code */

	#define sigcontext_struct sigcontext

	#define __KERNEL__
	#include <signal.h>
	#undef __KERNEL__

	#ifdef MR_HAVE_ASM_SIGCONTEXT_H
	#include <asm/sigcontext.h>
	#endif

	#include "mercury_faultaddr.h"

	#include <stdio.h>

	#if MR_HAVE_SIGCONTEXT_STRUCT_3ARG
	extern void handler(int signum, int code,
			struct sigcontext_struct context);
	#else
	extern void handler(int signum, struct sigcontext_struct context);
	#endif

	#define FAULT_ADDRESS ((int *)112)

	int main() {
		signal(SIGSEGV, (void (*)(int))handler);

		/* provoke a SIGSEGV */
		(*FAULT_ADDRESS)++;

		exit(1);
	}

	#if MR_HAVE_SIGCONTEXT_STRUCT_3ARG
	void handler(int signum, int code, struct sigcontext_struct context) {
	#else
	void handler(int signum, struct sigcontext_struct context) {
	#endif
		int *addr;
		long pc;
		addr = (int *) MR_GET_FAULT_ADDR(context);
		pc = (long) context.eip;
		if (signum == SIGSEGV && addr == FAULT_ADDRESS && pc != 0) {
			exit(0);
		} else {
			exit(1);
		}
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_pc_access=eip
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi

	echo "$as_me:$LINENO: result: $mercury_cv_pc_access" >&5
echo "${ECHO_T}$mercury_cv_pc_access" >&6
	if test $mercury_cv_pc_access != no; then
		cat >>confdefs.h <<_ACEOF
#define MR_PC_ACCESS $mercury_cv_pc_access
_ACEOF

	fi
else
	echo "$as_me:$LINENO: checking for \`siginfo_t'" >&5
echo $ECHO_N "checking for \`siginfo_t'... $ECHO_C" >&6
	if test "${mercury_cv_siginfo_t+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  mercury_cv_siginfo_t=no
	if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <signal.h>
	#ifdef MR_HAVE_SYS_SIGINFO_H
	#include <sys/siginfo.h>
	#endif
	#ifdef MR_HAVE_SYS_SIGNAL_H
	#include <sys/signal.h>
	#endif
	#ifdef MR_HAVE_UCONTEXT_H
	#include <ucontext.h>
	#endif
	#ifdef MR_HAVE_SYS_UCONTEXT_H
	#include <sys/ucontext.h>
	#endif
	int save_signum = 0;
	int save_cause;
	int save_pc;
	extern void handler(int signum, siginfo_t *info, void *context);
	int main() {
		struct sigaction act;
		act.sa_flags = SA_SIGINFO;
		act.$mercury_cv_sigaction_field = handler;
		if (sigemptyset(&act.sa_mask) != 0)
			exit(1);
		if (sigaction(SIGSEGV, &act, NULL) != 0)
			exit(1);
		if (kill(getpid(), SIGSEGV) != 0)
			exit(1);
		if (save_signum == 0)
			exit(1);
		exit(0);
	}
	void handler(int signum, siginfo_t *info, void *context) {
		save_signum = signum;
		save_cause = info->si_code;
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_siginfo_t=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi

	echo "$as_me:$LINENO: result: $mercury_cv_siginfo_t" >&5
echo "${ECHO_T}$mercury_cv_siginfo_t" >&6
	if test $mercury_cv_siginfo_t = yes; then
		cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGINFO_T 1
_ACEOF

		cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_SIGINFO 1
_ACEOF


		echo "$as_me:$LINENO: checking for \`siginfo' pc access at signals" >&5
echo $ECHO_N "checking for \`siginfo' pc access at signals... $ECHO_C" >&6
		if test "${mercury_cv_pc_access+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  mercury_cv_pc_access=no
		if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

		#include <stdio.h>
		#include <signal.h>
		#include <sys/siginfo.h>
		#ifdef MR_HAVE_UCONTEXT_H
		#include <ucontext.h>
		#else
		#include <sys/ucontext.h>
		#endif
		int save_signum = 0;
		int save_cause;
		int save_pc;
		extern void handler(int signum, siginfo_t *info, void *context);
		int main() {
			struct sigaction act;
			act.sa_flags = SA_SIGINFO;
			act.$mercury_cv_sigaction_field = handler;
			if (sigemptyset(&act.sa_mask) != 0)
				exit(1);
			if (sigaction(SIGSEGV, &act, NULL) != 0)
				exit(1);
			if (kill(getpid(), SIGSEGV) != 0)
				exit(1);
			if (save_signum == 0)
				exit(1);
			exit(0);
		}
		void handler(int signum, siginfo_t *info, void *context) {
			save_signum = signum;
			save_cause = info->si_code;
			/* Don't use array indexing - the square brackets
			   are autoconf quote characters */
			save_pc = *(((ucontext_t *) context)->uc_mcontext.gregs
					+ REG_PC);
		}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_pc_access=REG_PC;mercury_cv_pc_access_greg=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
		if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

		#include <stdio.h>
		#include <signal.h>
		#include <sys/siginfo.h>
		#ifdef MR_HAVE_UCONTEXT_H
		#include <ucontext.h>
		#else
		#include <sys/ucontext.h>
		#endif
		int save_signum = 0;
		int save_cause;
		int save_pc;
		extern void handler(int signum, siginfo_t *info, void *context);
		int main() {
			struct sigaction act;
			act.sa_flags = SA_SIGINFO;
			act.$mercury_cv_sigaction_field = handler;
			if (sigemptyset(&act.sa_mask) != 0)
				exit(1);
			if (sigaction(SIGSEGV, &act, NULL) != 0)
				exit(1);
			if (kill(getpid(), SIGSEGV) != 0)
				exit(1);
			if (save_signum == 0)
				exit(1);
			exit(0);
		}
		void handler(int signum, siginfo_t *info, void *context) {
			save_signum = signum;
			save_cause = info->si_code;
			save_pc = *(((ucontext_t *) context)->uc_mcontext.gregs
					+ CTX_EPC);
		}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_pc_access=CTX_EPC;mercury_cv_pc_access_greg=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
		if test "$cross_compiling" = yes; then
  true
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

		#include <stdio.h>
		#include <signal.h>
		#include <sys/siginfo.h>
		#ifdef MR_HAVE_UCONTEXT_H
		#include <ucontext.h>
		#else
		#include <sys/ucontext.h>
		#endif
		int save_signum = 0;
		int save_cause;
		int save_pc;
		extern void handler(int signum, siginfo_t *info, void *context);
		int main() {
			struct sigaction act;
			act.sa_flags = SA_SIGINFO;
			act.$mercury_cv_sigaction_field = handler;
			if (sigemptyset(&act.sa_mask) != 0)
				exit(1);
			if (sigaction(SIGSEGV, &act, NULL) != 0)
				exit(1);
			if (kill(getpid(), SIGSEGV) != 0)
				exit(1);
			if (save_signum == 0)
				exit(1);
			exit(0);
		}
		void handler(int signum, siginfo_t *info, void *context) {
			save_signum = signum;
			save_cause = info->si_code;
			save_pc = ((ucontext_t *) context)->uc_mcontext.sc_pc;
		}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_pc_access=sc_pc;mercury_cv_pc_access_greg=no
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
true
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

		echo "$as_me:$LINENO: result: $mercury_cv_pc_access" >&5
echo "${ECHO_T}$mercury_cv_pc_access" >&6
		if test $mercury_cv_pc_access != no; then
			cat >>confdefs.h <<_ACEOF
#define MR_PC_ACCESS $mercury_cv_pc_access
_ACEOF

			if test $mercury_cv_pc_access_greg != no; then
				cat >>confdefs.h <<\_ACEOF
#define MR_PC_ACCESS_GREG 1
_ACEOF

			fi
		fi
	fi
fi
#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for an integer type with the same size as a pointer" >&5
echo $ECHO_N "checking for an integer type with the same size as a pointer... $ECHO_C" >&6
if test "${mercury_cv_word_type+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_word_type=unknown
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(int) == sizeof(void *))
		{
			fprintf(fp, "int\n");
			exit(0);
		}

		if (sizeof(long) == sizeof(void *))
		{
			fprintf(fp, "long\n");
			exit(0);
		}

		fprintf(fp, "unknown\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_word_type=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_word_type=unknown
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

if test "$mercury_cv_word_type" = unknown; then
	if test "$cross_compiling" = yes; then
  mercury_cv_word_type=unknown
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(long long) == sizeof(void *))
		{
			fprintf(fp, "long long\n");
			exit(0);
		}

		fprintf(fp, "unknown\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_word_type=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_word_type=unknown
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $mercury_cv_word_type" >&5
echo "${ECHO_T}$mercury_cv_word_type" >&6
cat >>confdefs.h <<_ACEOF
#define MR_WORD_TYPE $mercury_cv_word_type
_ACEOF

MR_WORD_TYPE=$mercury_cv_word_type


if test "$mercury_cv_word_type" = int; then
	cat >>confdefs.h <<_ACEOF
#define MR_INTEGER_LENGTH_MODIFIER ""
_ACEOF

elif test "$mercury_cv_word_type" = long; then
	cat >>confdefs.h <<_ACEOF
#define MR_INTEGER_LENGTH_MODIFIER "l"
_ACEOF

elif test "$mercury_cv_word_type" = "long long"; then
	cat >>confdefs.h <<_ACEOF
#define MR_INTEGER_LENGTH_MODIFIER "ll"
_ACEOF

else
	{ { echo "$as_me:$LINENO: error: Cannot determine the length modifier for the MR_Integer type." >&5
echo "$as_me: error: Cannot determine the length modifier for the MR_Integer type." >&2;}
   { (exit 1); exit 1; }; }
fi


#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for an integer type of at least 64 bits" >&5
echo $ECHO_N "checking for an integer type of at least 64 bits... $ECHO_C" >&6
if test "${mercury_cv_int_least64_type+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_int_least64_type=unknown
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <limits.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(int) * CHAR_BIT >= 64)
		{
			fprintf(fp, "int\n");
			exit(0);
		}

		if (sizeof(long) * CHAR_BIT >= 64)
		{
			fprintf(fp, "long\n");
			exit(0);
		}

		fprintf(fp, "unknown\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_int_least64_type=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_int_least64_type=unknown
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

if test "$mercury_cv_int_least64_type" = unknown; then
	if test "$cross_compiling" = yes; then
  mercury_cv_int_least64_type=unknown
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <limits.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(long long) * CHAR_BIT >= 64)
		{
			fprintf(fp, "long long\n");
			exit(0);
		}

		fprintf(fp, "unknown\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_int_least64_type=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_int_least64_type=unknown
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
# Uncomment the following line to test how the system behaves
# in the absence of a 64-bit integer type.
# mercury_cv_int_least64_type=unknown
echo "$as_me:$LINENO: result: $mercury_cv_int_least64_type" >&5
echo "${ECHO_T}$mercury_cv_int_least64_type" >&6
if test "$mercury_cv_int_least64_type" != unknown; then
	cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST64_TYPE $mercury_cv_int_least64_type
_ACEOF

	MR_INT_LEAST64_TYPE=$mercury_cv_int_least64_type

fi
#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for an integer type of at least 32 bits" >&5
echo $ECHO_N "checking for an integer type of at least 32 bits... $ECHO_C" >&6
if test "${mercury_cv_int_least32_type+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_int_least32_type=unknown
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <limits.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(int) * CHAR_BIT >= 32)
		{
			fprintf(fp, "int\n");
			exit(0);
		}

		if (sizeof(long) * CHAR_BIT >= 32)
		{
			fprintf(fp, "long\n");
			exit(0);
		}

		fprintf(fp, "unknown\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_int_least32_type=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_int_least32_type=unknown
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_int_least32_type" >&5
echo "${ECHO_T}$mercury_cv_int_least32_type" >&6
cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST32_TYPE $mercury_cv_int_least32_type
_ACEOF

MR_INT_LEAST32_TYPE=$mercury_cv_int_least32_type


if test "$mercury_cv_int_least32_type" = int; then
	cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST32_MAX INT_MAX
_ACEOF

	cat >>confdefs.h <<_ACEOF
#define MR_UINT_LEAST32_MAX UINT_MAX
_ACEOF

elif test "$mercury_cv_int_least32_type" = long; then
	cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST32_MAX LONG_MAX
_ACEOF

	cat >>confdefs.h <<_ACEOF
#define MR_UINT_LEAST32_MAX ULONG_MAX
_ACEOF

else
	{ { echo "$as_me:$LINENO: error: Cannot find the name of the max values
	for MR_INT_LEAST32_TYPE." >&5
echo "$as_me: error: Cannot find the name of the max values
	for MR_INT_LEAST32_TYPE." >&2;}
   { (exit 1); exit 1; }; }
fi


#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for pid_t" >&5
echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
if test "${ac_cv_type_pid_t+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
int
main ()
{
if ((pid_t *) 0)
  return 0;
if (sizeof (pid_t))
  return 0;
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_type_pid_t=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_type_pid_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
echo "${ECHO_T}$ac_cv_type_pid_t" >&6
if test $ac_cv_type_pid_t = yes; then
  :
else

cat >>confdefs.h <<_ACEOF
#define pid_t int
_ACEOF

fi


echo "$as_me:$LINENO: checking for dev_t" >&5
echo $ECHO_N "checking for dev_t... $ECHO_C" >&6
if test "${ac_cv_type_dev_t+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
int
main ()
{
if ((dev_t *) 0)
  return 0;
if (sizeof (dev_t))
  return 0;
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_type_dev_t=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_type_dev_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_dev_t" >&5
echo "${ECHO_T}$ac_cv_type_dev_t" >&6
if test $ac_cv_type_dev_t = yes; then

cat >>confdefs.h <<_ACEOF
#define HAVE_DEV_T 1
_ACEOF


fi
echo "$as_me:$LINENO: checking for ino_t" >&5
echo $ECHO_N "checking for ino_t... $ECHO_C" >&6
if test "${ac_cv_type_ino_t+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
int
main ()
{
if ((ino_t *) 0)
  return 0;
if (sizeof (ino_t))
  return 0;
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_type_ino_t=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_type_ino_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_ino_t" >&5
echo "${ECHO_T}$ac_cv_type_ino_t" >&6
if test $ac_cv_type_ino_t = yes; then

cat >>confdefs.h <<_ACEOF
#define HAVE_INO_T 1
_ACEOF


fi

case "$ac_cv_type_dev_t" in
	yes) cat >>confdefs.h <<_ACEOF
#define MR_HAVE_DEV_T 1
_ACEOF
 ;;
esac
case "$ac_cv_type_ino_t" in
	yes) cat >>confdefs.h <<_ACEOF
#define MR_HAVE_INO_T 1
_ACEOF
 ;;
esac

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking for an integer type of at least 16 bits" >&5
echo $ECHO_N "checking for an integer type of at least 16 bits... $ECHO_C" >&6
if test "${mercury_cv_int_least16_type+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_int_least16_type=unknown
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <limits.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(short) * CHAR_BIT >= 16)
		{
			fprintf(fp, "short\n");
			exit(0);
		}

		if (sizeof(int) * CHAR_BIT >= 16)
		{
			fprintf(fp, "int\n");
			exit(0);
		}

		fprintf(fp, "unknown\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_int_least16_type=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_int_least16_type=unknown
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_int_least16_type" >&5
echo "${ECHO_T}$mercury_cv_int_least16_type" >&6
cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST16_TYPE $mercury_cv_int_least16_type
_ACEOF

MR_INT_LEAST16_TYPE=$mercury_cv_int_least16_type


if test "$mercury_cv_int_least16_type" = short; then
	cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST16_MAX SHRT_MAX
_ACEOF

	cat >>confdefs.h <<_ACEOF
#define MR_UINT_LEAST16_MAX USHRT_MAX
_ACEOF

elif test "$mercury_cv_int_least16_type" = int; then
	cat >>confdefs.h <<_ACEOF
#define MR_INT_LEAST16_MAX INT_MAX
_ACEOF

	cat >>confdefs.h <<_ACEOF
#define MR_UINT_LEAST16_MAX UINT_MAX
_ACEOF

else
	{ { echo "$as_me:$LINENO: error: Cannot find the name of the max value for MR_INT_LEAST16_TYPE." >&5
echo "$as_me: error: Cannot find the name of the max value for MR_INT_LEAST16_TYPE." >&2;}
   { (exit 1); exit 1; }; }
fi



#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking the number of low tag bits available" >&5
echo $ECHO_N "checking the number of low tag bits available... $ECHO_C" >&6
if test "${mercury_cv_low_tag_bits+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_low_tag_bits=0
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <stdlib.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.tags", "w");
		if (fp == NULL)
			exit(1);

		if (sizeof(void *) == 4)
		{
			fprintf(fp, "2\n");
			exit(0);
		}
		if (sizeof(void *) == 8)
		{
			fprintf(fp, "3\n");
			exit(0);
		}
		if (sizeof(void *) == 16)
		{
			fprintf(fp, "4\n");
			exit(0);
		}
		fprintf(fp, "0\n");
		exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_low_tag_bits=`cat conftest.tags`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_low_tag_bits=0
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_low_tag_bits" >&5
echo "${ECHO_T}$mercury_cv_low_tag_bits" >&6
if test "$mercury_cv_low_tag_bits" -lt 2; then
	if test "$BOOTSTRAP_MC" = ""; then
		{ { echo "$as_me:$LINENO: error: cannot bootstrap: low tag bits less than 2" >&5
echo "$as_me: error: cannot bootstrap: low tag bits less than 2" >&2;}
   { (exit 1); exit 1; }; }
		exit 1
	fi
fi
if test "$mercury_cv_low_tag_bits" -gt 2; then
	if test "$BOOTSTRAP_MC" = ""; then
		{ echo "$as_me:$LINENO: WARNING: bootstrapping using only 2 low tag bits" >&5
echo "$as_me: WARNING: bootstrapping using only 2 low tag bits" >&2;}
		mercury_cv_low_tag_bits=2
	fi
fi
cat >>confdefs.h <<_ACEOF
#define MR_LOW_TAG_BITS $mercury_cv_low_tag_bits
_ACEOF

LOW_TAG_BITS=$mercury_cv_low_tag_bits

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking the number of bytes per word" >&5
echo $ECHO_N "checking the number of bytes per word... $ECHO_C" >&6
if test "${mercury_cv_bytes_per_word+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_bytes_per_word=0
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <stdlib.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.wordbytes", "w");
		if (fp == NULL)
			exit(1);
		fprintf(fp, "%d\n", sizeof(void *));

		exit(0);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_bytes_per_word=`cat conftest.wordbytes`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_bytes_per_word=0
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_bytes_per_word" >&5
echo "${ECHO_T}$mercury_cv_bytes_per_word" >&6
cat >>confdefs.h <<_ACEOF
#define MR_BYTES_PER_WORD $mercury_cv_bytes_per_word
_ACEOF

BYTES_PER_WORD=$mercury_cv_bytes_per_word

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking the number of words in a synchronization term" >&5
echo $ECHO_N "checking the number of words in a synchronization term... $ECHO_C" >&6
if test "${mercury_cv_sync_term_size+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_sync_term_size=0
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <stdlib.h>
	#include <pthread.h>
	int main() {
		struct {
			pthread_mutex_t lock;
			int		count;
			void		*parent;
		} x;
		FILE *fp;

		fp = fopen("conftest.syncsize", "w");
		if (fp == NULL)
			exit(1);
		fprintf(fp, "%d\n", (sizeof(void *) - 1 + sizeof(x))/
				sizeof(void *));

		exit(0);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_sync_term_size=`cat conftest.syncsize`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_sync_term_size=0
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_sync_term_size" >&5
echo "${ECHO_T}$mercury_cv_sync_term_size" >&6
cat >>confdefs.h <<_ACEOF
#define MR_SYNC_TERM_SIZE $mercury_cv_sync_term_size
_ACEOF

SYNC_TERM_SIZE=$mercury_cv_sync_term_size

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking the number of bits per word" >&5
echo $ECHO_N "checking the number of bits per word... $ECHO_C" >&6
if test "${mercury_cv_bits_per_word+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_bits_per_word=0
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdio.h>
	#include <stdlib.h>
	#include <limits.h>
	int main() {
		FILE *fp;

		fp = fopen("conftest.wordbits", "w");
		if (fp == NULL)
			exit(1);
		fprintf(fp, "%d\n", CHAR_BIT * sizeof(void *));

		exit(0);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_bits_per_word=`cat conftest.wordbits`
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_bits_per_word=0
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_bits_per_word" >&5
echo "${ECHO_T}$mercury_cv_bits_per_word" >&6
cat >>confdefs.h <<_ACEOF
#define MR_BITS_PER_WORD $mercury_cv_bits_per_word
_ACEOF

BITS_PER_WORD=$mercury_cv_bits_per_word

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether we can use unboxed floats" >&5
echo $ECHO_N "checking whether we can use unboxed floats... $ECHO_C" >&6
if test "${mercury_cv_unboxed_floats+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_unboxed_floats=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	int main() {
		if (sizeof(double) == sizeof(void *))
			exit(0);
		else
			exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_unboxed_floats=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_unboxed_floats=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_unboxed_floats" >&5
echo "${ECHO_T}$mercury_cv_unboxed_floats" >&6
if test "$mercury_cv_unboxed_floats" = yes; then
	if test "$BOOTSTRAP_MC" = ""; then
		{ echo "$as_me:$LINENO: WARNING: Mercury compiler not yet installed -
****	cannot use unboxed floats, bootstrapping using boxed floats
****	after installation is complete you may want to reinstall
****	from scratch so you can use unboxed floats, which are more
****	efficient." >&5
echo "$as_me: WARNING: Mercury compiler not yet installed -
****	cannot use unboxed floats, bootstrapping using boxed floats
****	after installation is complete you may want to reinstall
****	from scratch so you can use unboxed floats, which are more
****	efficient." >&2;}
		mercury_cv_unboxed_floats=no
	fi
fi
if test "$mercury_cv_unboxed_floats" = yes; then
	HAVE_BOXED_FLOATS="--unboxed-float"
else
	cat >>confdefs.h <<\_ACEOF
#define MR_BOXED_FLOAT 1
_ACEOF

	HAVE_BOXED_FLOATS="--no-unboxed-float"
fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether float is 64-bit" >&5
echo $ECHO_N "checking whether float is 64-bit... $ECHO_C" >&6
if test "${mercury_cv_float_is_64_bit+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_float_is_64_bit=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <limits.h>
	int main() {
		if (sizeof(float) * CHAR_BIT == 64)
			exit(0);
		else
			exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_float_is_64_bit=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_float_is_64_bit=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_float_is_64_bit" >&5
echo "${ECHO_T}$mercury_cv_float_is_64_bit" >&6
if test "$mercury_cv_float_is_64_bit" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_FLOAT_IS_64_BIT 1
_ACEOF

fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether double is 64-bit" >&5
echo $ECHO_N "checking whether double is 64-bit... $ECHO_C" >&6
if test "${mercury_cv_double_is_64_bit+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_double_is_64_bit=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <limits.h>
	int main() {
		if (sizeof(double) * CHAR_BIT == 64)
			exit(0);
		else
			exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_double_is_64_bit=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_double_is_64_bit=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_double_is_64_bit" >&5
echo "${ECHO_T}$mercury_cv_double_is_64_bit" >&6
if test "$mercury_cv_double_is_64_bit" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_DOUBLE_IS_64_BIT 1
_ACEOF

fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether long double is 64-bit" >&5
echo $ECHO_N "checking whether long double is 64-bit... $ECHO_C" >&6
if test "${mercury_cv_long_double_is_64_bit+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_long_double_is_64_bit=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <limits.h>
	int main() {
		if (sizeof(long double) * CHAR_BIT == 64)
			exit(0);
		else
			exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_long_double_is_64_bit=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_long_double_is_64_bit=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_long_double_is_64_bit" >&5
echo "${ECHO_T}$mercury_cv_long_double_is_64_bit" >&6
if test "$mercury_cv_long_double_is_64_bit" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_LONG_DOUBLE_IS_64_BIT 1
_ACEOF

fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether architecture is big-endian" >&5
echo $ECHO_N "checking whether architecture is big-endian... $ECHO_C" >&6
if test "${mercury_cv_is_bigender+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_is_bigender=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	int main() {
		int		x = 1;
		unsigned char	*x_p;

		x_p = (unsigned char*) &x;

		if (*x_p == 0)
			exit(0);
		else
			exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_is_bigender=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_is_bigender=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_is_bigender" >&5
echo "${ECHO_T}$mercury_cv_is_bigender" >&6
if test "$mercury_cv_is_bigender" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_BIG_ENDIAN 1
_ACEOF

fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether architecture is little-endian" >&5
echo $ECHO_N "checking whether architecture is little-endian... $ECHO_C" >&6
if test "${mercury_cv_is_littleender+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_is_littleender=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	int main() {
		int		x = 1;
		unsigned char	*x_p;

		x_p = (unsigned char*) &x;

		if (*x_p == 1)
			exit(0);
		else
			exit(1);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_is_littleender=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_is_littleender=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_is_littleender" >&5
echo "${ECHO_T}$mercury_cv_is_littleender" >&6
if test "$mercury_cv_is_littleender" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_LITTLE_ENDIAN 1
_ACEOF

fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether we can use files as locks" >&5
echo $ECHO_N "checking whether we can use files as locks... $ECHO_C" >&6
if test "${mercury_cv_have_ocreat_oexcl+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

		#ifdef MR_HAVE_SYS_TYPES_H
		#include <sys/types.h>
		#endif
		#ifdef MR_HAVE_SYS_STAT_H
		#include <sys/stat.h>
		#endif
		#ifdef MR_HAVE_FCNTL_H
		#include <fcntl.h>
		#endif

int
main ()
{

	#if defined(O_CREAT) && defined(O_EXCL)

	#else
	/*
	** As these macros are not defined the compilation must fail.
	** Unmatched brackets should do that for us.
	*/
		}
	#endif

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_ocreat_oexcl=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_ocreat_oexcl=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext

fi

echo "$as_me:$LINENO: result: $mercury_cv_have_ocreat_oexcl" >&5
echo "${ECHO_T}$mercury_cv_have_ocreat_oexcl" >&6
if test "$mercury_cv_have_ocreat_oexcl" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_OCREAT_OEXCL 1
_ACEOF

fi
#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking return values of system" >&5
echo $ECHO_N "checking return values of system... $ECHO_C" >&6
if test "${mercury_cv_normal_system_retval+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <sys/wait.h>
int
main ()
{

	#if defined (WIFEXITED) && defined (WEXITSTATUS) && \
		defined (WIFSIGNALED) && defined (WTERMSIG)

	#else
	/*
	** As these macros are not defined the compilation must fail.
	** Unmatched brackets should do that for us.
	*/
		}
	#endif

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_normal_system_retval=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_normal_system_retval=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <stdlib.h>
	#ifdef MR_HAVE_SYS_WAIT_H
	#include <sys/wait.h>
	#endif
	int main() {
		#if defined (WIFEXITED) && defined (WEXITSTATUS) && \
			defined (WIFSIGNALED) && defined (WTERMSIG)
		/*
		** All the necessary macros for handling the return values of
		** system() are defined, so we do not need to test the return
		** value of system()
		*/
		exit(0);

		#else
		/*
		** Normal return values from system() are considered to be
		** when high 8 bits of the return value give the exit
		** status, and the low 8 bits give the signal number which
		** killed the process.
		*/
			if( system("exit 0") == 0 &&
					system("exit 42") == 42 << 8 ) {
					/* && system("kill -9 $$") == 9 */
				exit(0);
			} else {
				exit(1);
			}
		#endif
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_normal_system_retval=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_normal_system_retval=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_normal_system_retval" >&5
echo "${ECHO_T}$mercury_cv_normal_system_retval" >&6
if test "$mercury_cv_normal_system_retval" = no; then
		# Warn since VC++6 compiler fails this test
	{ echo "$as_me:$LINENO: WARNING: Unable to interpret return values from system" >&5
echo "$as_me: WARNING: Unable to interpret return values from system" >&2;}
fi
#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking to see if we can handle contexts blocking on IO" >&5
echo $ECHO_N "checking to see if we can handle contexts blocking on IO... $ECHO_C" >&6
if test "${mercury_cv_can_do_pending_io+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_can_do_pending_io=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <sys/types.h>
	#include <sys/time.h>
	int main() {
		fd_set f;
		struct timeval zero;
		int err;

		FD_ZERO(&f);
		zero.tv_sec = 0;
		zero.tv_usec = 0;
		err = select(1, &f, &f, &f, &zero);
		exit(err != 0);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_can_do_pending_io=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_can_do_pending_io=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_can_do_pending_io" >&5
echo "${ECHO_T}$mercury_cv_can_do_pending_io" >&6
if test "$mercury_cv_can_do_pending_io" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_CAN_DO_PENDING_IO 1
_ACEOF

fi

#-----------------------------------------------------------------------------#
#
# On sparc, x86, and probably on other architectures,
# if we're using non-local gotos, then for egcs 1.1, we need
# `-fno-gcse -fno-function-cse', and for gcc 2.8 we need `-fno-function-cse'.
# Otherwise gcc generates code which initializes registers in the function
# prologue and expects them to be valid later on, which doesn't work with
# non-local gotos, since we jump directly into the middle of a function.
# (Actually I don't know if `-fno-functions-cse' is really needed.
# Maybe you can get away without it.  But better to err on the safe side...)
#
# For alpha and for mips, and probably on other architectures, when using
# non-local gotos we need -fomit-frame-pointer, otherwise when compiling
# with --no-c-optimize we run into a problem similar to the one above:
# Gcc generates code which initializes the frame pointer in the
# function prologue, and then expects it to be valid later on, which
# doesn't work with non-local gotos, since we jump directly into the
# middle of a function.
#
# For Irix 5, gcc labels don't work with shared libraries,
# so if we're using gcc labels, we need to use non-shared libraries,
# which means passing -non_shared and -mno-abicalls and also setting
# LIBRARY_PATH.
#
# For x86, gcc global registers only work with -fno-builtin
# and -fno-omit-frame-pointer.
#
# NB. Any changes here may also require changes to scripts/mgnuc.in.
#
CFLAGS_FOR_REGS=
CFLAGS_FOR_GOTOS=
LIBRARY_PATH_FOR_GOTOS=
case $ac_cv_c_compiler_gnu in yes)
    case "`$CC --version < /dev/null`" in
	2.8*) CFLAGS_FOR_GOTOS="-fno-defer-pop -fno-function-cse" ;;
	*)    CFLAGS_FOR_GOTOS="-fno-defer-pop -fno-function-cse -fno-gcse" ;;
    esac
    case "$host" in
	mips-sgi-irix5.*)
		# Non-local gotos don't work with shared libraries on Irix 5,
		# which causes lots of complications.
		# Now that we have the hlc back-end, it's not worth
		# supporting them.
		echo "Mercury no longer supports gcc non-local on Irix 5" 1>&6
		mercury_cv_asm_labels=no
		mercury_cv_gcc_labels=no
		CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -non_shared -mno-abicalls"
		LIBRARY_PATH_FOR_GOTOS="$NONSHARED_LIB_DIR:/usr/lib/nonshared"
		;;
    esac
    case "$host" in
	mips-*)
		CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
		;;
	i*86-*)
		CFLAGS_FOR_REGS="-fno-builtin -fno-omit-frame-pointer"
		;;
	# We need a special-case hack here, because the auto-config
	# gets it wrong on the Alpha: the little example program
	# works fine in fast.gc mode, but big programs don't,
	# due to problems with the `gp' register.  Ideally we
	# ought to write a big enough example program to trigger
	# the problem, but that would be too much work.
	alpha*-dec-*)
		echo "asm labels work on the Alpha but plain gcc labels do not" 1>&6
		mercury_cv_asm_labels=yes
		mercury_cv_gcc_labels=no
		CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
		;;
	# Similarly for rs6000
	rs6000-*)
		echo "gcc labels do not work on the RS/6000" 1>&6
		mercury_cv_asm_labels=no
		mercury_cv_gcc_labels=no
		;;
    # On hppa64 and ia64 the test programs appear to work, but larger
    # programs die with an Illegal Instruction fault.
    hppa64-*)
		echo "gcc labels do not work on HPPA64" 1>&6
		mercury_cv_asm_labels=no
		mercury_cv_gcc_labels=no
		;;
    ia64-*)
		echo "gcc labels do not work on IA64" 1>&6
		mercury_cv_asm_labels=no
		mercury_cv_gcc_labels=no
		;;
    # On s390 and s390x the configure test goes into an infinite loop, so we
    # need to avoid running it.
    s390*)
		echo "gcc labels do not work on S/390" 1>&6
		mercury_cv_asm_labels=no
		mercury_cv_gcc_labels=no
		;;
	sparc*)
		case "`$CC --version < /dev/null`" in 2.8*)
			{ echo "$as_me:$LINENO: WARNING: Mercury might not work with gcc 2.8 on sparc!
****	We advise using gcc 2.95.x." >&5
echo "$as_me: WARNING: Mercury might not work with gcc 2.8 on sparc!
****	We advise using gcc 2.95.x." >&2;}
			;;
		esac
		;;
    esac
    ;;
esac


#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether we can use gcc labels" >&5
echo $ECHO_N "checking whether we can use gcc labels... $ECHO_C" >&6

# Set env vars for compiling with gcc non-local gotos
save_CC="$CC"
save_LIBRARY_PATH="$LIBRARY_PATH"
CC="$CC $CFLAGS_FOR_GOTOS"
if test "$LIBRARY_PATH_FOR_GOTOS" != ""; then
	LIBRARY_PATH="$LIBRARY_PATH_FOR_GOTOS:$LIBRARY_PATH"
	export LIBRARY_PATH
fi

if test "${mercury_cv_gcc_labels+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_gcc_labels=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	void *entry_foo_1;
	void *entry_bar_1;
	void *succip;
	int global;
	void *dummy_identity_function(void *);
	foo() {
		entry_foo_1 = && foo_1;
		goto *dummy_identity_function(&&return_label);
	return_label:
		return;
	foo_1:
		if (global != 42) exit(1);
		goto *entry_bar_1;
	}
	bar() {
		entry_bar_1 = && bar_1;
		goto *dummy_identity_function(&&return_label);
	return_label:
		return;
	bar_1:
		if (global != 42) exit(1);
		goto *succip;
	}
	main() {
		global = 42;
		foo();
		bar();
		succip = &&last;
		goto *dummy_identity_function(&&return_label);
	return_label:
		goto *entry_foo_1;
		exit(1);
	last:
		if (global != 42) exit(1);
		exit(0);
	}
	void *dummy_identity_function(void *p) {
		return p;
	}

_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_gcc_labels=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_gcc_labels=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_gcc_labels" >&5
echo "${ECHO_T}$mercury_cv_gcc_labels" >&6
if test "$mercury_cv_gcc_labels" = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_GCC_LABELS 1
_ACEOF

fi

if test $mercury_cv_gcc_labels = yes; then
	echo "$as_me:$LINENO: checking whether we can use asm labels" >&5
echo $ECHO_N "checking whether we can use asm labels... $ECHO_C" >&6

	if test "${mercury_cv_asm_labels+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_asm_labels=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	void *volatile volatile_global_pointer;
	extern void mercury__label1 (void) __asm__("entry_" "mercury__label1" );
	main() {
		void *addr;

		volatile_global_pointer = &&mercury__label1;
		addr = &mercury__label1;
		goto *addr;
		exit(1);

	mercury__label1:
		__asm__(".globl entry_" "mercury__label1" "\n" "entry_"
			"mercury__label1" ":\n"
			"/* this is a comment */");
		exit(0);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_asm_labels=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_asm_labels=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

	echo "$as_me:$LINENO: result: $mercury_cv_asm_labels" >&5
echo "${ECHO_T}$mercury_cv_asm_labels" >&6
else
	mercury_cv_asm_labels=${mercury_cv_asm_labels-no}
fi
HAVE_ASM_LABELS=$mercury_cv_asm_labels

if test $HAVE_ASM_LABELS = 1; then
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_ASM_LABELS 1
_ACEOF

fi

# Restore env vars modified above
CC="$save_CC"
LIBRARY_PATH="$save_LIBRARY_PATH"

#-----------------------------------------------------------------------------#
# We need to ensure that runtime/mercury_conf.h exists, since some of the
# programs we attempt to compile below indirectly include it.
test -f runtime/mercury_conf.h || {
	cat > runtime/mercury_conf.h <<EOF
#define MR_WORD_TYPE $MR_WORD_TYPE
EOF
}
#-----------------------------------------------------------------------------#
if test $mercury_cv_gcc_labels = yes || test $mercury_cv_asm_labels = yes; then
	echo "$as_me:$LINENO: checking whether we can use gcc labels and global registers" >&5
echo $ECHO_N "checking whether we can use gcc labels and global registers... $ECHO_C" >&6

	# Set env vars for compiling with gcc non-local gotos and registers
	save_CC="$CC"
	save_LIBRARY_PATH="$LIBRARY_PATH"
	CC="$CC $CFLAGS_FOR_GOTOS $CFLAGS_FOR_REGS"
	if test "$LIBRARY_PATH_FOR_GOTOS" != ""; then
		LIBRARY_PATH="$LIBRARY_PATH_FOR_GOTOS:$LIBRARY_PATH"
		export LIBRARY_PATH
	fi

	if test "${mercury_cv_gcc_model_fast+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_gcc_model_fast=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#define MR_USE_GCC_NONLOCAL_GOTOS
	#define MR_USE_GCC_GLOBAL_REGISTERS
	#include "mercury_engine.h"

	MercuryEngine MR_engine_base;

	main() {
		MR_mr0 = 20;
		MR_mr7 = 22;
		if (MR_mr0 + MR_mr7 != 42)
			exit(1);
		exit(0);
	}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_gcc_model_fast=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_gcc_model_fast=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

	echo "$as_me:$LINENO: result: $mercury_cv_gcc_model_fast" >&5
echo "${ECHO_T}$mercury_cv_gcc_model_fast" >&6

	# Restore env vars modified above
	CC="$save_CC"
	LIBRARY_PATH="$save_LIBRARY_PATH"
else
	mercury_cv_gcc_model_fast=no
fi
#-----------------------------------------------------------------------------#

echo "$as_me:$LINENO: checking whether we can use global registers without gcc labels" >&5
echo $ECHO_N "checking whether we can use global registers without gcc labels... $ECHO_C" >&6

# Set env vars for compiling with gcc registers
save_CC="$CC"
CC="$CC $CFLAGS_FOR_REGS"

if test "${mercury_cv_gcc_model_reg+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_gcc_model_reg=no
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

#define MR_USE_GCC_GLOBAL_REGISTERS
#include "mercury_engine.h"

MercuryEngine MR_engine_base;

main() {
	MR_mr0 = 20;
	MR_mr7 = 22;
	if (MR_mr0 + MR_mr7 != 42)
		exit(1);
	exit(0);
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_gcc_model_reg=yes
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_gcc_model_reg=no
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_gcc_model_reg" >&5
echo "${ECHO_T}$mercury_cv_gcc_model_reg" >&6

# Restore env vars modified above
CC="$save_CC"

#-----------------------------------------------------------------------------#

echo "$as_me:$LINENO: checking whether we can support profiling on this system" >&5
echo $ECHO_N "checking whether we can support profiling on this system... $ECHO_C" >&6
if test "${mercury_cv_profiling+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* The following code comes from runtime/prof.c */
#include	<unistd.h>
#include	<errno.h>
#include	<string.h>
#include	<signal.h>

#ifdef MR_HAVE_SYS_PARAM_H
#include	<sys/param.h>
#endif

#ifdef MR_HAVE_SYS_TIME_H
#include	<sys/time.h>
#endif

/*
** if HZ is not defined, we may be able to use sysconf(_SC_CLK_TCK) instead
*/
#if !defined(HZ) && defined(MR_HAVE_SYSCONF) && defined(_SC_CLK_TCK)
#define HZ ((int)sysconf(_SC_CLK_TCK))
#endif

#if !defined(HZ) || !defined(SIGPROF) || !defined(MR_HAVE_SETITIMER)
#error "Time profiling not supported on this system"
#endif

_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  mercury_cv_profiling=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  mercury_cv_profiling=no
fi
rm -f conftest.err conftest.$ac_ext
fi

echo "$as_me:$LINENO: result: $mercury_cv_profiling" >&5
echo "${ECHO_T}$mercury_cv_profiling" >&6

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking if C compiler is egcs" >&5
echo $ECHO_N "checking if C compiler is egcs... $ECHO_C" >&6
case "`$CC --version < /dev/null 2>&1`" in
    egcs-*)
	mercury_cv_egcs=yes
	;;
    *)
	mercury_cv_egcs=no
	;;
esac
echo "$as_me:$LINENO: result: $mercury_cv_egcs" >&5
echo "${ECHO_T}$mercury_cv_egcs" >&6
#-----------------------------------------------------------------------------#
#
# Add an option that disables the deep profiler.
#
# Check whether --enable-deep-profiler or --disable-deep-profiler was given.
if test "${enable_deep_profiler+set}" = set; then
  enableval="$enable_deep_profiler"
  enable_deep_profiler="$enableval"
else
  enable_deep_profiler=default
fi;
echo "$as_me:$LINENO: checking whether to enable the deep profiler" >&5
echo $ECHO_N "checking whether to enable the deep profiler... $ECHO_C" >&6

# We test for all the features needed by the deep profiler.
if test "$MR_HAVE_SYS_TYPES_H" = 1 && \
	test "$MR_HAVE_SYS_STAT_H" = 1 && \
	test "$MR_HAVE_FCNTL_H" = 1 && \
	test "$MR_HAVE_UNISTD_H" = 1 && \
	test "$MR_HAVE_DIRENT_H" = 1 && \
	test "$ac_cv_func_getpid" = yes && \
	test "$ac_cv_func_fork" = yes && \
	test "$ac_cv_func_opendir" = yes && \
	test "$ac_cv_func_readdir" = yes && \
	test "$ac_cv_func_closedir" = yes && \
	test "$mercury_cv_have_ocreat_oexcl" = yes
then
    mercury_cv_can_enable_deep_profiler=yes
    cat >>confdefs.h <<\_ACEOF
#define MR_DEEP_PROFILER_ENABLED 1
_ACEOF

else
    mercury_cv_can_enable_deep_profiler=no
fi

# on x86, gcc version egcs-1.1.2 has a bug which causes it to get
# an internal compiler error when compiling library/random.c
# (when that file was build with mmc --intermodule-optimization -O4)
# So if we're using an egcs version of gcc, disable deep profiling.
case "$host" in i*86-*-*)
    case "$mercury_cv_egcs" in yes)
	mercury_cv_can_enable_deep_profiler=no ;;
    esac ;;
esac

mercury_cv_default_cgi_dir=/usr/lib/cgi-bin
case $enable_deep_profiler in
	default)
		if test -d $mercury_cv_default_cgi_dir; then
			mercury_cv_enable_deep_profiler=$mercury_cv_can_enable_deep_profiler
			mercury_cv_cgi_dir=$mercury_cv_default_cgi_dir
		else
			mercury_cv_enable_deep_profiler=no
		fi
		;;
	no)
		mercury_cv_enable_deep_profiler=no
		;;
	*)
		if test $enable_deep_profiler = yes; then
			mercury_cv_cgi_dir=$mercury_cv_default_cgi_dir
		else
			mercury_cv_cgi_dir=$enable_deep_profiler
		fi

		if test $mercury_cv_can_enable_deep_profiler = no; then
			echo "$as_me:$LINENO: result: $enable_deep_profiler" >&5
echo "${ECHO_T}$enable_deep_profiler" >&6
			{ { echo "$as_me:$LINENO: error: --enable-deep-profiler specified but system
	does not support it" >&5
echo "$as_me: error: --enable-deep-profiler specified but system
	does not support it" >&2;}
   { (exit 1); exit 1; }; }
		fi

		mercury_cv_enable_deep_profiler=yes
		;;
esac

if test $mercury_cv_enable_deep_profiler = yes; then
	if test -d $mercury_cv_cgi_dir; then
		true
	else
		echo "$as_me:$LINENO: result: $enable_deep_profiler" >&5
echo "${ECHO_T}$enable_deep_profiler" >&6
		{ { echo "$as_me:$LINENO: error: CGI script directory $mercury_cv_cgi_dir does not exist" >&5
echo "$as_me: error: CGI script directory $mercury_cv_cgi_dir does not exist" >&2;}
   { (exit 1); exit 1; }; }
	fi
fi

echo "$as_me:$LINENO: result: $mercury_cv_enable_deep_profiler" >&5
echo "${ECHO_T}$mercury_cv_enable_deep_profiler" >&6
ENABLE_DEEP_PROFILER=$mercury_cv_enable_deep_profiler

CGIDIR=$mercury_cv_cgi_dir

#-----------------------------------------------------------------------------#

# Figure out which flavour of pthreads to use, since none of the
# implementations seem to be exactly the same
case $host in
	alpha*-dec-osf*)
		mercury_cv_use_digital_unix_threads=yes ;;

	*)
		mercury_cv_use_digital_unix_threads=no ;;
esac

if test $mercury_cv_use_digital_unix_threads = yes; then
	cat >>confdefs.h <<\_ACEOF
#define MR_DIGITAL_UNIX_PTHREADS 1
_ACEOF

fi

# Figure out what options we need to pass to the C compiler
# for multithreading.   We may need to pass different
# options to tell (a) the Mercury runtime & library
# (b) the boehm collector and (c) the C library
# that they need to be thread-safe.
#
# For Linux, Irix, Solaris, and HPUX,
# the thread-enabled version of the Boehm
# collector contains a reference to dlopen(), so
# if threads are enabled, we need to link with the
# appropriate extra library for that (-ldl on Linux
# and Solaris, -lrt on HPUX, and nothing on Irix).
# XXX That should only be done if conservative GC
#     is enabled.
#
# Note that changes here may require changes in scripts/ml.in.
LDFLAGS_FOR_THREADS=
LD_LIBFLAGS_FOR_THREADS=
case "$host" in
	*solaris*)
		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DSOLARIS_THREADS \
			-D_SOLARIS_PTHREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
		THREAD_LIBS="-lpthread -ldl"
		;;

	*linux*)
		# Note that for old versions of Linux / glibc,
		# you may also need to make sure that you don't
		# pass -ansi to gcc.
		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DLINUX_THREADS \
			-D_THREAD_SAFE -D_REENTRANT"
		THREAD_LIBS="-lpthread -ldl"
		;;

	*cygwin*)
		THREAD_LIBS=""
		case "$CC" in
			*cl* | *CL*)	# cl is the Microsoft C compiler
				CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DWIN32_THREADS /MD"
				LDFLAGS_FOR_THREADS="/MD"
				LD_LIBFLAGS_FOR_THREADS="/MD"
				;;
			*)
				CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE" ;;
		esac
		;;

	# Theoretically we should change this check to *apple*darwin*)
	# as darwin should be the same whether or not we are on a powerpc or
	# an i386, but since we don't have access to an i386 with darwin
	# installed to test this, we currently restrict ourselves to the
	# powerpc architecture.
	*powerpc*apple*darwin*)
		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DGC_DARWIN_THREADS"
		THREAD_LIBS=""
		;;

###	# The threads stuff on Digital Unix (OSF) is not yet enabled because
###	# the Boehm garbage collector doesn't support threads on that platform
###	# XXX probably we should enable it but report an error if you try to
###	#     use an *.par.gc* grade
###	# XXX is this fixed in the Boehm collector now?
###	*-osf*)
###		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE"
###		THREAD_LIBS="-lpthreads -lmach -lc_r"
###		;;

###	# The threads stuff on HPUX is not yet enabled because
###	# we don't have an HPUX box to test it on.
###	*hpux*)
###		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE" # XXX incomplete
###		THREAD_LIBS="-lpthread -lrt" ;;

###	# The threads stuff on IRIX is not yet enabled because
###	# we don't have an IRIX box to test it on.
###	# (XXX perhaps we should enable it anyway, so it is easier to test?)
###	*irix*)
###		CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DIRIX_THREADS"
###		THREAD_LIBS="-lpthread"
###		;;

	*)
		# Multithreading not (yet) supported on other architectures.
		# For multithreading, we need (1) Posix threads and
		# (2) a port of the Boehm gc for that architecture
		# that works with threads.
		CFLAGS_FOR_THREADS=""
		;;
esac





#-----------------------------------------------------------------------------#

#
# Figure out which is the best grade to use for various different purposes.
# In particular, choose the default grade for compiling applications.
#

# BEST_LLDS_BASE_GRADE is the most efficient of the LLDS->C base grades.

if test $mercury_cv_asm_labels = yes; then
	if test $mercury_cv_gcc_model_fast = yes; then
		BEST_LLDS_BASE_GRADE=asm_fast
	else
		BEST_LLDS_BASE_GRADE=asm_jump
	fi
elif test $mercury_cv_gcc_labels = yes; then
	if test $mercury_cv_gcc_model_fast = yes; then
		BEST_LLDS_BASE_GRADE=fast
	else
		BEST_LLDS_BASE_GRADE=jump
	fi
else
	if test $mercury_cv_gcc_model_reg = yes; then
		BEST_LLDS_BASE_GRADE=reg
	else
		BEST_LLDS_BASE_GRADE=none
	fi
fi

# BEST_DEBUG_BASE_GRADE is the most efficient base grade that supports
# debugging (`--trace deep').

BEST_DEBUG_BASE_GRADE=$BEST_LLDS_BASE_GRADE

# DEFAULT_BASE_GRADE is the best overall base grade; it should be reasonably
# efficient, and it should support debugging unless that would compromise
# efficiency too much.

case $BEST_LLDS_BASE_GRADE in
	none|fast|jump)
		DEFAULT_BASE_GRADE=hlc
		;;
	asm_fast|asm_jump|reg)
		DEFAULT_BASE_GRADE=$BEST_LLDS_BASE_GRADE
		;;
	*)
		{ { echo "$as_me:$LINENO: error: invalid BEST_LLDS_BASE_GRADE $BEST_LLDS_BASE_GRADE" >&5
echo "$as_me: error: invalid BEST_LLDS_BASE_GRADE $BEST_LLDS_BASE_GRADE" >&2;}
   { (exit 1); exit 1; }; }
		;;
esac

# DEFAULT_GRADE is the default grade used to compile applications.
# This is the same as DEFAULT_BASE_GRADE except that we also want to
# enable conservative garbage collection by default.
# We also allow users to override the default grade by setting
# "DEFAULT_GRADE" in the environment before invoking configure.
if test "$DEFAULT_GRADE" = ""; then
	DEFAULT_GRADE=$DEFAULT_BASE_GRADE.gc
fi

echo "using grade \`$DEFAULT_GRADE' as the default grade for applications" 1>&6


#-----------------------------------------------------------------------------#

#
# Choose which grade to use for the compiler.
#

# BEST_GRADE_FOR_COMPILER is the best grade for compiling
# the Mercury compiler, if there is already an installed Mercury compiler.

BEST_GRADE_FOR_COMPILER=hlc.gc

# BOOTSTRAP_GRADE is the most efficient grade which we can use to bootstrap
# the compiler from the source distribution, if there is no installed Mercury
# compiler.  This grade needs to be one for which the C files are
# compatible with the C files that we ship in the source distribution,
# which are generated with grade hlc.gc.

BOOTSTRAP_GRADE=hlc.gc

# Choose whether to use $BOOTSTRAP_GRADE or $BEST_GRADE_FOR_COMPILER,
# and if necessary remove the previously built C files.

if test "$BEST_GRADE_FOR_COMPILER" != "$BOOTSTRAP_GRADE"; then
	if test "$BOOTSTRAP_MC" = ""; then
		GRADE="$BOOTSTRAP_GRADE"
		{ echo "$as_me:$LINENO: WARNING: Mercury compiler not yet installed
****	cannot use grade \`$BEST_GRADE_FOR_COMPILER'
****	using grade \`$GRADE' to compile the compiler
****	after installation is complete you should reinstall
****	from scratch so you can use the more efficient
****	grade \`$BEST_GRADE_FOR_COMPILER'." >&5
echo "$as_me: WARNING: Mercury compiler not yet installed
****	cannot use grade \`$BEST_GRADE_FOR_COMPILER'
****	using grade \`$GRADE' to compile the compiler
****	after installation is complete you should reinstall
****	from scratch so you can use the more efficient
****	grade \`$BEST_GRADE_FOR_COMPILER'." >&2;}

	else
		GRADE=$BEST_GRADE_FOR_COMPILER
		echo "using grade \`$GRADE' to compile the compiler
	compiler and library will be rebuilt with new grade
	installation may take a long time" 1>&6
		find library compiler browser analysis profiler deep_profiler \
			-name \*.c -o -name \*.c_date | \
			xargs rm > /dev/null 2>&1
	fi
else
	GRADE=$BEST_GRADE_FOR_COMPILER
	echo "using grade \`$GRADE' to compile the compiler" 1>&6
fi


#-----------------------------------------------------------------------------#

#
# Define options for selecting which grades of the library to install
#

# Check whether --enable-inefficient-grades or --disable-inefficient-grades was given.
if test "${enable_inefficient_grades+set}" = set; then
  enableval="$enable_inefficient_grades"
  enable_inefficient_grades="$enableval"
else
  enable_inefficient_grades=no
fi;

# Check whether --enable-most-grades or --disable-most-grades was given.
if test "${enable_most_grades+set}" = set; then
  enableval="$enable_most_grades"
  enable_most_grades="$enableval"
else
  enable_most_grades=yes
fi;

# Check whether --enable-nogc-grades or --disable-nogc-grades was given.
if test "${enable_nogc_grades+set}" = set; then
  enableval="$enable_nogc_grades"
  enable_nogc_grades="$enableval"
else
  enable_nogc_grades=no
fi;

# Check whether --enable-agc-grades or --disable-agc-grades was given.
if test "${enable_agc_grades+set}" = set; then
  enableval="$enable_agc_grades"
  enable_agc_grades="$enableval"
else
  enable_agc_grades=no
fi;

# Check whether --enable-prof-grades or --disable-prof-grades was given.
if test "${enable_prof_grades+set}" = set; then
  enableval="$enable_prof_grades"
  enable_prof_grades="$enableval"
else
  enable_prof_grades=yes
fi;

# Check whether --enable-trail-grades or --disable-trail-grades was given.
if test "${enable_trail_grades+set}" = set; then
  enableval="$enable_trail_grades"
  enable_trail_grades="$enableval"
else
  enable_trail_grades=yes
fi;

# Check whether --enable-par-grades or --disable-par-grades was given.
if test "${enable_par_grades+set}" = set; then
  enableval="$enable_par_grades"
  enable_par_grades="$enableval"
else
  enable_par_grades=yes
fi;

# Check whether --enable-mm-grades or --disable-mm-grades was given.
if test "${enable_mm_grades+set}" = set; then
  enableval="$enable_mm_grades"
  enable_mm_grades="$enableval"
else
  enable_mm_grades=no
fi;

# Check whether --enable-hlc-prof-grades or --disable-hlc-prof-grades was given.
if test "${enable_hlc_prof_grades+set}" = set; then
  enableval="$enable_hlc_prof_grades"
  enable_hlc_prof_grades="$enableval"
else
  enable_hlc_prof_grades=no
fi;

# Check whether --enable-dotnet-grades or --disable-dotnet-grades was given.
if test "${enable_dotnet_grades+set}" = set; then
  enableval="$enable_dotnet_grades"
  enable_dotnet_grades="$enableval"
else
  enable_dotnet_grades=yes
fi;

# Check whether --enable-java-grade or --disable-java-grade was given.
if test "${enable_java_grade+set}" = set; then
  enableval="$enable_java_grade"
  enable_java_grade="$enableval"
else
  enable_java_grade=yes
fi;

# Check whether --enable-libgrades or --disable-libgrades was given.
if test "${enable_libgrades+set}" = set; then
  enableval="$enable_libgrades"
  enable_libgrades_given=yes;enable_libgrades="$enableval"
else
  enable_libgrades_given=no
fi;

if test "$enable_most_grades" = no; then
	enable_inefficient_grades=no
	enable_nogc_grades=no
	enable_agc_grades=no
	enable_prof_grades=no
	enable_trail_grades=no
	enable_mm_grades=no
	enable_hlc_prof_grades=no
	enable_par_grades=no
	enable_dotnet_grades=no
	enable_java_grade=no
fi

#-----------------------------------------------------------------------------#

#
# Choose which grades of the library to install
#

# Compute all the LLDS base grades.
ALL_LLDS_BASE_GRADES="none"
if test $mercury_cv_gcc_model_reg = yes; then
	ALL_LLDS_BASE_GRADES="$ALL_LLDS_BASE_GRADES reg"
fi
if test $mercury_cv_gcc_labels = yes; then
	ALL_LLDS_BASE_GRADES="$ALL_LLDS_BASE_GRADES jump"
	if test $mercury_cv_gcc_model_fast = yes; then
		ALL_LLDS_BASE_GRADES="$ALL_LLDS_BASE_GRADES fast"
	fi
fi
if test $mercury_cv_asm_labels = yes; then
	if test $mercury_cv_gcc_labels = yes; then
		ALL_LLDS_BASE_GRADES="$ALL_LLDS_BASE_GRADES asm_jump"
	fi
	if test $mercury_cv_gcc_model_fast = yes; then
		ALL_LLDS_BASE_GRADES="$ALL_LLDS_BASE_GRADES asm_fast"
	fi
fi

# Start with the selected LLDS base grades:
# normally just the best LLDS base grade,
# unless --enable-inefficient-grades was selected,
# in which case we use all the LLDS grades.

if test "$enable_inefficient_grades" = yes; then
	BASE_LIBGRADES="$ALL_LLDS_BASE_GRADES"
else
	BASE_LIBGRADES="$BEST_LLDS_BASE_GRADE"
fi

# Find all the corresponding `.gc' (--conservative-gc) grades.
# Use both `.gc' and non-`.gc' versions, unless --disable-nogc-grades was set,
# in which case use only the `.gc' versions.

GC_LIBGRADES=""
for grade in $BASE_LIBGRADES; do
	GC_LIBGRADES="$GC_LIBGRADES $grade.gc"
done

if test "$enable_nogc_grades" = yes; then
	LIBGRADES="$BASE_LIBGRADES $GC_LIBGRADES"
else
	LIBGRADES="$GC_LIBGRADES"
fi

# Add `hlc' (--high-level-code, i.e. MLDS back-end) grades
LIBGRADES="$LIBGRADES hlc.gc"
if test "$enable_inefficient_grades" = yes -a "$GCC" = yes ; then
    LIBGRADES="$LIBGRADES hlc_nest.gc"
fi

# Add `.agc' (--gc accurate) grades
# Currently only hlc.agc is supported.
if test "$enable_agc_grades" = yes; then
    LIBGRADES="$LIBGRADES hlc.agc"
fi

# Add grades for profiling.
if test "$enable_prof_grades" = yes; then
	# Add `.prof' (--profiling) grades, if time profiling is supported.
	# We want to allow profiling of any installed grade which is likely
	# to be the most efficient grade for some application.
	# This means we want to support time profiling for
	#	- both GC and non-GC grades
	#	  since non-GC grades might be best for some applications.
	#	- both LLDS and hlc grades
	# It's also convenient if we support a time profiling variant of
	# the default grade, if this is not the same as the most efficient
	# grade.
	if test $mercury_cv_profiling = yes; then
		# Start with profiling versions of the default grade
		LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.prof"
		if test "$enable_nogc_grades" = yes; then
			LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.prof"
		fi
		# Add profiling versions of the best LLDS grade,
		# if this is different than the default grade
		if test $BEST_LLDS_BASE_GRADE != $DEFAULT_BASE_GRADE; then
			LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.prof"
			if test "$enable_nogc_grades" = yes; then
				LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.prof"
			fi
		fi
		# Add profiling versions of the hlc grade,
		# if this is different than the ones added above.
		if test $enable_hlc_prof_grades = "yes" &&
		   test hlc != $DEFAULT_BASE_GRADE &&
		   test hlc != $BEST_LLDS_BASE_GRADE
		then
			LIBGRADES="$LIBGRADES hlc.gc.prof"
			if test "$enable_nogc_grades" = yes; then
				LIBGRADES="$LIBGRADES hlc.prof"
			fi
		fi
	fi

	# Add a `.memprof' (--memory-profiling) grade.
	# Hopefully memory allocation should be pretty much
	# independent of the grade, so we don't need to support
	# both GC and non-GC versions, or both LLDS and MLDS versions.
	LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.memprof"

	# Add a `.profdeep' (--deep-profiling) grade,
	# if deep profiling is enabled.
	if test $mercury_cv_enable_deep_profiler = yes; then
		LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.profdeep"
	fi
fi

if test "$enable_trail_grades" = yes; then
	# add `.tr' (--trailing) grades
	LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.tr"
	if test "$enable_inefficient_grades" = yes; then
		if test "$enable_nogc_grades" = yes; then
			LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.tr"
		else
			LIBGRADES="$LIBGRADES"
		fi
		if test $mercury_cv_profiling = yes &&
		   test "$enable_prof_grades" = yes
		then
			LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.prof.tr"
		fi
	fi
fi

# add `.mm' (--minimal-model) grades
if test "$enable_mm_grades" = yes; then
	LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.mm \
		$BEST_LLDS_BASE_GRADE.gc.mm.debug"
fi

# add `.debug' (--debug) grades
LIBGRADES="$LIBGRADES $BEST_DEBUG_BASE_GRADE.gc.tr.debug"

# Add the .par (thread-safe) grade, if it is supported for this system
if test "$enable_par_grades" = yes -a "$CFLAGS_FOR_THREADS" != ""; then
	LIBGRADES="$LIBGRADES hlc.par.gc"
fi

# add .NET back-end grades
if test $mercury_cv_microsoft_dotnet = yes -a "$enable_dotnet_grades" = yes
then
    LIBGRADES="$LIBGRADES il"
fi

# add Java back-end grade, if Java is installed
if test $mercury_cv_java = yes -a "$enable_java_grade" = yes
then
    LIBGRADES="$LIBGRADES java"
fi

# Allow the user to override the default list of library grades

if test "$enable_libgrades_given" = yes; then
	if test "$enable_libgrades" = no; then
		{ { echo "$as_me:$LINENO: error: --enable-libgrades requires a comma-separated
	list of grades as argument" >&5
echo "$as_me: error: --enable-libgrades requires a comma-separated
	list of grades as argument" >&2;}
   { (exit 1); exit 1; }; }

	elif test "$enable_libgrades" = yes; then
		{ { echo "$as_me:$LINENO: error: --enable-libgrades requires a comma-separated
	list of grades as argument" >&5
echo "$as_me: error: --enable-libgrades requires a comma-separated
	list of grades as argument" >&2;}
   { (exit 1); exit 1; }; }

	else
		# Generate only the grades specified by the user.
		raw_grades=`echo $enable_libgrades | sed 's/,/ /g'`
		canonical_grades=""
		grade_error=false
		for raw_grade in $raw_grades
		do
			if ! test -x scripts/canonical_grade
			then
				canonical_grades="$canonical_grades $raw_grade"
			elif scripts/canonical_grade --grade $raw_grade > .confgrade
			then
				canonical_grades="$canonical_grades `cat .confgrade`"
			else
				echo "--enable-libgrades: $raw_grade is not a grade" 1>&6
				grade_error=true
			fi
		done

		rm -f .confgrade > /dev/null 2>&1

		if $grade_error
		then
			{ { echo "$as_me:$LINENO: error: invalid grade(s) specified for --enable-libgrades" >&5
echo "$as_me: error: invalid grade(s) specified for --enable-libgrades" >&2;}
   { (exit 1); exit 1; }; }
		fi

		LIBGRADES=$canonical_grades
	fi
fi

echo "using \`$LIBGRADES' as the set of library grades to install" 1>&6

LIBGRADE_OPTS=
for libgrade in $LIBGRADES
do
	LIBGRADE_OPTS="$LIBGRADE_OPTS --libgrade $libgrade"
done




#-----------------------------------------------------------------------------#

# Determine how many of the r registers (r1, r2, ...) are real registers.
# Determine how many temporaries may be allocated real registers.
# Find out whether branch instructions have a delay slot.

case "$host" in
	i*86-*)
		# NUM_REAL_REGS=3
		# but succip and sp are real regs, so subtract 2
		NUM_REAL_R_REGS=1
		NUM_REAL_R_TEMPS=0
		HAVE_DELAY_SLOT=
		;;
	alpha*-*)
		# NUM_REAL_REGS=7
		# but succip, sp, and hp are real regs, so subtract 3
		NUM_REAL_R_REGS=4
		NUM_REAL_R_TEMPS=6
		HAVE_DELAY_SLOT=
		;;
	mips-*)
		# NUM_REAL_REGS=8
		# but succip, sp, and hp are real regs, so subtract 3
		NUM_REAL_R_REGS=5
		NUM_REAL_R_TEMPS=6
		HAVE_DELAY_SLOT=--have-delay-slot
		;;
	rs6000-*|powerpc-*)
		# NUM_REAL_REGS=10
		# but succip, sp, hp, maxfr, and curfr are real regs,
		# so subtract 5
		NUM_REAL_R_REGS=5
		NUM_REAL_R_TEMPS=6
		HAVE_DELAY_SLOT=
		;;
	sparc-*)
		# NUM_REAL_REGS=10
		# but succip, sp, hp, maxfr, and curfr are real regs,
		# so subtract 5
		NUM_REAL_R_REGS=5
		NUM_REAL_R_TEMPS=6
		HAVE_DELAY_SLOT=--have-delay-slot
		;;
	hppa-*)
		# NUM_REAL_REGS=8
		# but succip, sp, and hp are real regs, so subtract 3
		NUM_REAL_R_REGS=5
		NUM_REAL_R_TEMPS=6
		HAVE_DELAY_SLOT=
		;;
	*)
		NUM_REAL_R_REGS=0
		NUM_REAL_R_TEMPS=6
		HAVE_DELAY_SLOT=
		;;
esac




#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether the assembler does not handle .type" >&5
echo $ECHO_N "checking whether the assembler does not handle .type... $ECHO_C" >&6
if test "${mercury_cv_cannot_grok_asm_type_directive+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

	case "$host" in
		*-sunos4.*)
			mercury_cv_cannot_grok_asm_type_directive=yes
			;;
		*)
			mercury_cv_cannot_grok_asm_type_directive=no
			;;
	esac

fi

echo "$as_me:$LINENO: result: $mercury_cv_cannot_grok_asm_type_directive" >&5
echo "${ECHO_T}$mercury_cv_cannot_grok_asm_type_directive" >&6
if test $mercury_cv_cannot_grok_asm_type_directive = "yes"; then
	cat >>confdefs.h <<\_ACEOF
#define MR_CANNOT_GROK_ASM_TYPE_DIRECTIVE 1
_ACEOF

fi
#-----------------------------------------------------------------------------#
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_AS+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  case $AS in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_AS="$AS" # Let the user override the test with a path.
  ;;
  *)
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for ac_exec_ext in '' $ac_executable_extensions; do
  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_AS="$as_dir/$ac_word$ac_exec_ext"
    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
done

  ;;
esac
fi
AS=$ac_cv_path_AS

if test -n "$AS"; then
  echo "$as_me:$LINENO: result: $AS" >&5
echo "${ECHO_T}$AS" >&6
else
  echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

echo "$as_me:$LINENO: checking whether the assembler does full preprocessing" >&5
echo $ECHO_N "checking whether the assembler does full preprocessing... $ECHO_C" >&6

if test "${mercury_cv_asm_does_full_preprocessing+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else

if test "$AS" != ""; then
	# check that it really works
	cat > conftest.s << EOF

# define foo(x) \
	/* foo */

	foo(x)
EOF
	if
		echo $AS conftest.s >&5 2>&1 &&
		$AS conftest.s </dev/null >&5 2>&1
	then
		mercury_cv_asm_does_full_preprocessing="yes"
	else
		mercury_cv_asm_does_full_preprocessing="no"
	fi
	rm -f conftest*
else
	mercury_cv_asm_does_full_preprocessing="no"
fi

fi

echo "$as_me:$LINENO: result: $mercury_cv_asm_does_full_preprocessing" >&5
echo "${ECHO_T}$mercury_cv_asm_does_full_preprocessing" >&6
if test $mercury_cv_asm_does_full_preprocessing = "no"; then
	AS="$GCC_PROG -c -x assembler-with-cpp"
fi

#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether structure assignment conflicts with global registers" >&5
echo $ECHO_N "checking whether structure assignment conflicts with global registers... $ECHO_C" >&6
if test "${mercury_cv_cannot_use_structure_assignment+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  if test "$cross_compiling" = yes; then
  mercury_cv_cannot_use_structure_assignment=yes
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */



/* MR_USE_GCC_GLOBAL_REGISTERS are essential to the purpose of the test. */
/* We define MR_USE_GCC_NONLOCAL_GOTOS because some platforms (e.g. SPARCs) */
/* cannot have MR_USE_GCC_GLOBAL_REGISTERS without it. */
#define	MR_USE_GCC_GLOBAL_REGISTERS
#define MR_USE_GCC_NONLOCAL_GOTOS
#include "mercury_imp.h"
#include "mercury_trace_spy.h"

MR_Spy_Point	spied_procs[2];

int main() {
	spied_procs[1] = spied_procs[0];
#if __GNUC__ >= 3
	/* gcc 3.1 seems to have problems with structure assignment
	   and global registers, but which this simple test case
	   doesn't trigger.  So just force the test to fail for gcc 3.x. */
	exit(1);
#else
	exit(0);
#endif

}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_cannot_use_structure_assignment=no
else
  echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

( exit $ac_status )
mercury_cv_cannot_use_structure_assignment=yes
fi
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi

echo "$as_me:$LINENO: result: $mercury_cv_cannot_use_structure_assignment" >&5
echo "${ECHO_T}$mercury_cv_cannot_use_structure_assignment" >&6
if test $mercury_cv_cannot_use_structure_assignment = "yes"; then
	cat >>confdefs.h <<\_ACEOF
#define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT 1
_ACEOF

fi
#-----------------------------------------------------------------------------#
echo "$as_me:$LINENO: checking whether Mercury supports shared libraries on this system" >&5
echo $ECHO_N "checking whether Mercury supports shared libraries on this system... $ECHO_C" >&6
# We ought to use $target here rather than $host - but we don't
# support cross-compilation at the moment anyhow.

# set up some default values that should work on most systems
# see Mmake.common.in for documentation on the meaning of these variables
LINK_EXE=$CC
LINK_SHARED_OBJ="$CC -shared"
LINK_SHARED_OBJ_SH="$CC -shared"
if test "$GCC" = "yes"; then
	SHARED_LIBS="\`$CC -print-libgcc-file-name\` \$(MATH_LIB) -lc"
	SHARED_LIBS_SH="\`$CC -print-libgcc-file-name\` \$MATH_LIB -lc"
else
	SHARED_LIBS='$(MATH_LIB) -lc'
	SHARED_LIBS_SH='$MATH_LIB -lc'
fi
EXE_RPATH_OPT="-Wl,-rpath,"
EXE_RPATH_SEP=" -Wl,-rpath,"
SHLIB_RPATH_OPT="-Wl,-rpath,"
SHLIB_RPATH_SEP=" -Wl,-rpath,"
CFLAGS_FOR_PIC="-fpic -DMR_PIC"
EXT_FOR_PIC_OBJECTS=pic_o
# Object files with extension $EXT_FOR_LINK_WITH_PIC_OBJECTS are used
# in executables which are linked with shared Mercury libraries.
# EXT_FOR_LINK_WITH_PIC_OBJECTS should be `lpic_o' if `-DMR_PIC_REG'
# has any effect (currently only on x86), or `o' otherwise.
EXT_FOR_LINK_WITH_PIC_OBJECTS=lpic_o
EXT_FOR_SHARED_LIB=$LIB_SUFFIX
USE_DLLS=no
# The following variables specify options to $LINK_SHARED_OBJ to
# allow/disallow unresolved symbols when building shared libraries.
ALLOW_UNDEFINED=""
ERROR_UNDEFINED=""
DEFAULT_LINKAGE="shared"

case "$host" in
	i*86-*-linux|i*86-*-linux-gnu)
		case $ac_cv_c_compiler_gnu in
		yes)
			echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
			EXT_FOR_SHARED_LIB=so
			echo "$as_me:$LINENO: checking if linker supports --no-undefined" >&5
echo $ECHO_N "checking if linker supports --no-undefined... $ECHO_C" >&6
			rm -f conftest*
			echo "int main(void) { return 0; }" > conftest.c
			$CC -Wl,--no-undefined -o conftest conftest.c
			if test -f conftest; then
				echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
				ERROR_UNDEFINED="-Wl,--no-undefined"

				echo "$as_me:$LINENO: checking for ld-linux.so" >&5
echo $ECHO_N "checking for ld-linux.so... $ECHO_C" >&6
				rm -f conftest*
				echo "int main(void) { return 0; }" > conftest.c
				$CC -o conftest conftest.c
				ld_linux=`ldd ./conftest | \
					awk '/ld-linux/{print $1;}'`
				case $ld_linux in /lib/ld-linux.so*)
					echo "$as_me:$LINENO: result: $ld_linux" >&5
echo "${ECHO_T}$ld_linux" >&6
					SHARED_LIBS="$SHARED_LIBS $ld_linux"
					SHARED_LIBS_SH="$SHARED_LIBS_SH $ld_linux"
					;;
				*)
					echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
					;;
				esac
			else
				echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
			fi
			rm -f conftest*
			;;
		*)
			case "$CC" in
			lcc*)
				echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
				EXT_FOR_SHARED_LIB=so
				EXE_RPATH_OPT="-Wl-rpath -Wl"
				EXE_RPATH_SEP=" -Wl-rpath -Wl"
				SHLIB_RPATH_OPT="-Wl-rpath -Wl"
				SHLIB_RPATH_SEP=" -Wl-rpath -Wl"
				;;
			*)
				echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
				;;
			esac
		esac
		# Shared libraries are not the default on x86 systems that
		# use ELF -- see README.Linux
		DEFAULT_LINKAGE=static
		;;
	m68*-linux|m68*-linux-gnu)
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		EXT_FOR_SHARED_LIB=so
		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
		;;
	i*86-*-freebsd*)
		# From Cornelis van der Laan <nils@ims.uni-stuttgart.de>
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		LINK_SHARED_OBJ="ld -Bshareable"
		LINK_SHARED_OBJ_SH="ld -Bshareable"
		EXT_FOR_SHARED_LIB=so
		# From Kevet Duncombe <dunc@acm.org> tested on FreeBSD 2.2.5
		EXE_RPATH_OPT="-R"
		EXE_RPATH_SEP=" -R"
		SHLIB_RPATH_OPT="-R"
		SHLIB_RPATH_SEP=" -R"
		DEFAULT_LINKAGE=static
		;;
	i*86-*-solaris2.*)
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6

		# XXX For Solaris/SPARC, we don't link in libgcc.a.
		# Why not?  Do we need to do the same thing for Solaris/x86?
		#SHARED_LIBS="$(MATH_LIB) -lc"	# don't link in libgcc.a
		#SHARED_LIBS_SH="$MATH_LIB -lc"	# don't link in libgcc.a

		# XXX We need -mimpure-text because libraries such as
		# libreadline.a might be installed with only the .a rather
		# than the .so, and not compiled with -fpic,
		# and we need to link against them when creating shared libs.
		LINK_SHARED_OBJ="$CC -shared -mimpure-text"
		LINK_SHARED_OBJ_SH="$CC -shared -mimpure-text"

		# XXX We should use the following.
		# However, this causes problems on mundroo.cs.mu.oz.au,
		# due to the readline library being installed only as
		# libreadline.a, with no corresponding libreadline.so.
		#ERROR_UNDEFINED="-Wl,-z,defs"

		EXE_RPATH_OPT="-R"
		EXE_RPATH_SEP=" -R"
		SHLIB_RPATH_OPT="-R"
		SHLIB_RPATH_SEP=" -R"
		EXT_FOR_SHARED_LIB=so
		DEFAULT_LINKAGE=static
		;;
	sparc-sun-solaris2.*)
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		SHARED_LIBS="$(MATH_LIB) -lc"	# don't link in libgcc.a
		SHARED_LIBS_SH="$MATH_LIB -lc"	# don't link in libgcc.a
		LINK_SHARED_OBJ="$CC -shared -mimpure-text"
		LINK_SHARED_OBJ_SH="$CC -shared -mimpure-text"
		ERROR_UNDEFINED="-Wl,-z,defs"
		EXE_RPATH_OPT="-R"
		EXE_RPATH_SEP=" -R"
		SHLIB_RPATH_OPT="-R"
		SHLIB_RPATH_SEP=" -R"
		CFLAGS_FOR_PIC="-fpic -DMR_PIC"	# used only for libgc.{a,so}
		EXT_FOR_PIC_OBJECTS=o
		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
		#
		# Note that despite the above definition of CFLAGS_FOR_PIC,
		# we don't use `-fpic' for shared libraries on Solaris
		# (the definition of EXT_FOR_PIC_OBJECTS=o means that
		# CFLAGS_FOR_PIC will be used only for building libgc.a
		# and libgc.so.)
		#
		# The reason for this is that shared libraries work without
		# it (well, at least they are shared on disk -- although the
		# code is not shared at runtime), and using `-fpic' would
		# reduce efficiency.
		#
		# It works because the Solaris dynamic linker will
		# actually do the fixups at runtime for non-PIC code.
		# (The code is mapped copy-on-write, and when the linker
		# does the fixups, it gets copied.  Hence the lack of
		# runtime sharing.)
		# We need to link with `gcc -shared -mimpure-text'
		# rather than `gcc -shared', because `gcc -shared'
		# passes `-z text' to the linker, which causes it to
		# report an error if any runtime fixups would be needed.
		#
		# If you *do* use `-fpic', you must also use `-DMR_PIC'.
		#
		# See runtime/mercury_goto.h for the code that handles PIC
		# on SPARCs.
		# Note that mixing PIC and non-PIC code is fine on SPARCs
		# (though it doesn't work on x86s, due to the use of `ebx'
		# in runtime/machdeps/i386_regs.h).

		EXT_FOR_SHARED_LIB=so
		;;
	alpha*-dec-osf*)
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		if test "$GCC_PROG" != ""; then
		    # use gcc to link shared objects
		    LINK_SHARED_OBJ="$GCC_PROG -shared \
		    -Wl,-O3,-update_registry,\$(SO_LOCATIONS_DIR)so_locations"
		    LINK_SHARED_OBJ_SH="gcc -shared \
		    -Wl,-O3,-update_registry,\${SO_LOCATIONS_DIR}so_locations"
		    ERROR_UNDEFINED="-Wl,-error_unresolved"
		    EXE_RPATH_OPT="-Wl,-rpath,"
		    SHLIB_RPATH_OPT="-Wl,-rpath,"
		else
		    # use cc to link shared objects
		    LINK_SHARED_OBJ="cc -shared \
		    -update_registry \$(SO_LOCATIONS_DIR)so_locations"
		    LINK_SHARED_OBJ_SH="cc -shared \
		    -update_registry \${SO_LOCATIONS_DIR}so_locations"
		    ERROR_UNDEFINED="-error_unresolved"
		    EXE_RPATH_OPT="-rpath "
		    SHLIB_RPATH_OPT="-rpath "
		fi
		EXE_RPATH_SEP=":"
		SHLIB_RPATH_SEP=":"
		EXT_FOR_SHARED_LIB=so
		# -fpic not needed on Alpha/OSF, since it is the default
		CFLAGS_FOR_PIC=
		EXT_FOR_PIC_OBJECTS=o
		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
		;;
	mips-sgi-irix5.*)
		LINK_SHARED_OBJ="ld -shared \
			-update_registry \$(SO_LOCATIONS_DIR)so_locations \
			-quickstart_info -rdata_shared"
		LINK_SHARED_OBJ_SH="ld -shared \
			-update_registry \${SO_LOCATIONS_DIR}so_locations \
			-quickstart_info -rdata_shared"
		ERROR_UNDEFINED="-no_unresolved"
		EXE_RPATH_OPT="-Wl,-rpath,"
		EXE_RPATH_SEP=":"
		SHLIB_RPATH_OPT="-rpath "
		SHLIB_RPATH_SEP=":"
		# -fpic not needed on IRIX, since it is the default
		CFLAGS_FOR_PIC=
		EXT_FOR_PIC_OBJECTS=o
		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
		# shared libraries are incompatible with gcc non-local gotos,
		case "$GRADE" in
		reg.gc | none.gc | hlc.gc)
			echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
			EXT_FOR_SHARED_LIB=so
			;;
		*)
			EXT_FOR_SHARED_LIB=a
			echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
			echo "$as_me:$LINENO: result: Read README.IRIX-5" >&5
echo "${ECHO_T}Read README.IRIX-5" >&6
			;;
		esac
		;;
	*-cygwin*)
		# disabled for now, since it hasn't been tested
		# xxx_MSG_RESULT(yes)
		# EXT_FOR_SHARED_LIB=dll
		# USE_DLLS=yes
		echo "$as_me:$LINENO: result: disabled for now because it is untested" >&5
echo "${ECHO_T}disabled for now because it is untested" >&6

		CFLAGS_FOR_PIC=
		EXT_FOR_PIC_OBJECTS=o
		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
		DEFAULT_LINKAGE=static
		;;
	*)
		# CFLAGS_FOR_PIC is used by boehm_gc/Makefile when creating
		# libgc.a.  If the system doesn't support shared libraries,
		# then we should set it to empty, not `-fpic'.
		CFLAGS_FOR_PIC=
		EXT_FOR_PIC_OBJECTS=o
		EXT_FOR_LINK_WITH_PIC_OBJECTS=o
		DEFAULT_LINKAGE=static
		echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
		;;
esac

#-----------------------------------------------------------------------------#
# Note that changes here may require changes in scripts/mgnuc.in.

case "$CC" in
    *gcc*)
	COMPILER=gcc
	CFLAGS_FOR_ANSI="-ansi"

	# For a full list of the other gcc warnings that we don't
	# enable, and why, see scripts/mgnuc.in.
	CFLAGS_FOR_WARNINGS="-Wall -Wwrite-strings -Wshadow -Wmissing-prototypes -Wno-unused -Wno-uninitialized -Wstrict-prototypes"

	CFLAGS_FOR_OPT="-O2 -fomit-frame-pointer"
	CFLAGS_FOR_DEBUG="-g"
	MCFLAGS_FOR_CC=
	;;
    *lcc*)
	COMPILER=lcc
	CFLAGS_FOR_ANSI=

	# turn off all warnings due to spurious warnings.
	CFLAGS_FOR_WARNINGS="-w"

	CFLAGS_FOR_OPT=
	CFLAGS_FOR_DEBUG="-g"
	MCFLAGS_FOR_CC=
	;;
    *cl* | *CL*)
	COMPILER=cl
	CFLAGS_FOR_ANSI=
	CFLAGS_FOR_WARNINGS=
	CFLAGS_FOR_OPT=
	CFLAGS_FOR_DEBUG="/Zi"

	# Using the MSVC compiler implies that we must use a maximum jump
	# table size of 512 to avoid a fixed limit in the compiler.
	MCFLAGS_FOR_CC="--max-jump-table-size 512"
	;;
    cc* | */cc*)
	COMPILER=cc
	CFLAGS_FOR_ANSI=
	CFLAGS_FOR_OPT="-O"
	CFLAGS_FOR_WARNINGS=
	CFLAGS_FOR_DEBUG="-g"
	MCFLAGS_FOR_CC=
	;;
    *)
	COMPILER=unknown
	CFLAGS_FOR_ANSI=
	CFLAGS_FOR_OPT="-O"
	CFLAGS_FOR_WARNINGS=
	CFLAGS_FOR_DEBUG="-g"
	MCFLAGS_FOR_CC=
	;;
esac







#-----------------------------------------------------------------------------#
# Work out how to link statically.
# Note that changes here may require changes in scripts/ml.in.

LD_STATIC_FLAGS=
case $COMPILER in gcc|lcc)
	LD_STATIC_FLAGS=-static
	;;
esac
case $FULLARCH in
	*-linux*)
		# On Linux, if we're linking statically, we need to
		# pass `-defsym _DYNAMIC=0' to the linker, to avoid
		# undefined references to _DYNAMIC in
		# boehm_gc/dyn_load.c.
		# (We might eventually need similar treatment
		# for other OSs too)
		case $COMPILER in
		gcc)
			LD_STATIC_FLAGS="-static -Wl-defsym -Wl_DYNAMIC=0"
			;;
		lcc)
			# for lcc 4.1, we need to use "-Wl,".
			# for lcc 4.2, we need to use "-Wl" without the comma,
			# like we do for gcc.
			echo "$as_me:$LINENO: checking whether lcc requires comma after -Wl" >&5
echo $ECHO_N "checking whether lcc requires comma after -Wl... $ECHO_C" >&6
			LD_STATIC_FLAGS="-static -Wl-defsym -Wl_DYNAMIC=0"
			rm -f conftest*
			echo "int main() { return 0; }" > conftest.c
			if
				echo $CC $LD_STATIC_FLAGS conftest.c \
					>&5 2>&1 &&
				$CC $LD_STATIC_FLAGS conftest.c \
					>&5 2>&1
			then
				echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
			else
				echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
			        LD_STATIC_FLAGS="-static -Wl,-defsym -Wl,_DYNAMIC=0"
			fi
			rm -f conftest*
			;;
		esac
		;;
	alpha*-dec-osf*)
		case $COMPILER in cc)
			LD_STATIC_FLAGS=-non_shared
			;;
		esac
		;;
	*-sun-solaris*)
		case $COMPILER in cc)
			LD_STATIC_FLAGS="-B static"
			;;
		esac
		;;
esac
# we can't put the call to MSG_CHECKING at the start of the case statement
# above, because of the nested check in the lcc case.  So we just put it
# here immediately before the MSG_RESULT call.
echo "$as_me:$LINENO: checking options for static linking" >&5
echo $ECHO_N "checking options for static linking... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $LD_STATIC_FLAGS" >&5
echo "${ECHO_T}$LD_STATIC_FLAGS" >&6
case "$LD_STATIC_FLAGS" in "")
	{ echo "$as_me:$LINENO: WARNING: \`mmc --linkage static' and \`ml --static' not implemented with
****	this C compiler (\`$CC')." >&5
echo "$as_me: WARNING: \`mmc --linkage static' and \`ml --static' not implemented with
****	this C compiler (\`$CC')." >&2;}
esac


#-----------------------------------------------------------------------------#

case "$host" in
	*-cygwin*)
		EXT_FOR_EXE=".exe"
		;;
	*)
		EXT_FOR_EXE=
		;;
esac

#-----------------------------------------------------------------------------#





















if test $USE_DLLS = "yes"; then
	cat >>confdefs.h <<\_ACEOF
#define MR_USE_DLLS 1
_ACEOF

fi
#-----------------------------------------------------------------------------#
if test "$BOOTSTRAP_MC" = ""; then
	BOOTSTRAP_MC=mmc
fi
BOOTSTRAP_MC="$BOOTSTRAP_MC $HAVE_BOXED_FLOATS --conf-low-tag-bits $LOW_TAG_BITS --bits-per-word $BITS_PER_WORD --bytes-per-word $BYTES_PER_WORD"

#-----------------------------------------------------------------------------#

# The following allows us to share some subroutines between the
# `ml' and `mgnuc' scripts.

top=`pwd`
INIT_GRADE_OPTIONS=$top/scripts/init_grade_options.sh-subr
PARSE_GRADE_OPTIONS=$top/scripts/parse_grade_options.sh-subr
FINAL_GRADE_OPTIONS=$top/scripts/final_grade_options.sh-subr
PARSE_ML_OPTIONS=$top/scripts/parse_ml_options.sh-subr
CANONICAL_GRADE=$top/scripts/canonical_grade.sh-subr






# mercury_config includes configure.help to include the help for configure
# in its `--help' output and man page.
${CONFIG_SHELL-/bin/sh} "$0" --help | sed -e 's/`/\\`/g' > configure.help
CONFIGURE_HELP=$top/configure.help


#-----------------------------------------------------------------------------#
#
# Check for the POSIX struct tms and times() function.
# This is used for the time__times procedure in library/times.m.
#
echo "$as_me:$LINENO: checking for struct tms and times function" >&5
echo $ECHO_N "checking for struct tms and times function... $ECHO_C" >&6
if test "${mercury_cv_have_posix_times+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <sys/types.h>
	#include <sys/times.h>

int
main ()
{

	struct tms t;
	long Ut, St, CUt, CSt;
	long Ret;

	Ret = (long) times(&t);

	Ut = (long) t.tms_utime;
	St = (long) t.tms_stime;
	CUt = (long) t.tms_cutime;
	CSt = (long) t.tms_cstime;

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_posix_times=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_posix_times=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
fi


#
# figure out whether the test succeeded
#
if test "$mercury_cv_have_posix_times" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_POSIX_TIMES 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

#-----------------------------------------------------------------------------#
#
# Check for the WIN32 Sleep function
#
echo "$as_me:$LINENO: checking for Sleep function" >&5
echo $ECHO_N "checking for Sleep function... $ECHO_C" >&6
if test "${mercury_cv_have_capital_s_sleep+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <windows.h>

int
main ()
{

	Sleep(1);

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_capital_s_sleep=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_capital_s_sleep=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
fi


if test "$mercury_cv_have_capital_s_sleep" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<\_ACEOF
#define MR_HAVE_CAPITAL_S_SLEEP 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

#-----------------------------------------------------------------------------#
#
# Check for the various IEEE predicates
#


    for mercury_cv_header in ieeefp.h; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
  # Is the header compilable?
echo "$as_me:$LINENO: checking $mercury_cv_header usability" >&5
echo $ECHO_N "checking $mercury_cv_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
#include <$mercury_cv_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_header_compiler=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6

# Is the header present?
echo "$as_me:$LINENO: checking $mercury_cv_header presence" >&5
echo $ECHO_N "checking $mercury_cv_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <$mercury_cv_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  ac_header_preproc=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  yes:no: )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&2;}
    ac_header_preproc=yes
    ;;
  no:yes:* )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $mercury_cv_header: present but cannot be compiled" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $mercury_cv_header: see the Autoconf documentation" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&2;}
    (
      cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists.  ##
## ------------------------------------------ ##
_ASBOX
    ) |
      sed "s/^/$as_me: WARNING:     /" >&2
    ;;
esac
echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6

fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then

		cat >>confdefs.h <<_ACEOF
#define $mercury_cv_header_define 1
_ACEOF

		eval "$mercury_cv_header_define=1"

fi


    done




echo "$as_me:$LINENO: checking for isnan function" >&5
echo $ECHO_N "checking for isnan function... $ECHO_C" >&6
mercury_cv_ieee_func_define="MR_HAVE_`echo isnan | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <math.h>
#ifdef MR_HAVE_IEEEFP_H
	#include <ieeefp.h>
#endif

int
main ()
{

	float f;
	isnan(f);

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_ieee_func=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_ieee_func=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext

if test "$mercury_cv_have_ieee_func" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<_ACEOF
#define $mercury_cv_ieee_func_define 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi



echo "$as_me:$LINENO: checking for isnanf function" >&5
echo $ECHO_N "checking for isnanf function... $ECHO_C" >&6
mercury_cv_ieee_func_define="MR_HAVE_`echo isnanf | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <math.h>
#ifdef MR_HAVE_IEEEFP_H
	#include <ieeefp.h>
#endif

int
main ()
{

	float f;
	isnanf(f);

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_ieee_func=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_ieee_func=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext

if test "$mercury_cv_have_ieee_func" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<_ACEOF
#define $mercury_cv_ieee_func_define 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi



echo "$as_me:$LINENO: checking for isinf function" >&5
echo $ECHO_N "checking for isinf function... $ECHO_C" >&6
mercury_cv_ieee_func_define="MR_HAVE_`echo isinf | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <math.h>
#ifdef MR_HAVE_IEEEFP_H
	#include <ieeefp.h>
#endif

int
main ()
{

	float f;
	isinf(f);

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_ieee_func=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_ieee_func=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext

if test "$mercury_cv_have_ieee_func" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<_ACEOF
#define $mercury_cv_ieee_func_define 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi



echo "$as_me:$LINENO: checking for isinff function" >&5
echo $ECHO_N "checking for isinff function... $ECHO_C" >&6
mercury_cv_ieee_func_define="MR_HAVE_`echo isinff | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

	#include <math.h>
#ifdef MR_HAVE_IEEEFP_H
	#include <ieeefp.h>
#endif

int
main ()
{

	float f;
	isinff(f);

  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_have_ieee_func=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_have_ieee_func=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext

if test "$mercury_cv_have_ieee_func" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<_ACEOF
#define $mercury_cv_ieee_func_define 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi


#-----------------------------------------------------------------------------#
#
# Check whether sockets work (we need them for the external debugger)
#

#
# check whether we need -lsocket
#
echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6
if test "${ac_cv_lib_socket_socket+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char socket ();
int
main ()
{
socket ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_socket_socket=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_socket_socket=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6
if test $ac_cv_lib_socket_socket = yes; then
  SOCKET_LIBRARY=-lsocket
else
  SOCKET_LIBRARY=""
fi


#
# check whether we need -lnsl
#
echo "$as_me:$LINENO: checking for inet_addr in -lnsl" >&5
echo $ECHO_N "checking for inet_addr in -lnsl... $ECHO_C" >&6
if test "${ac_cv_lib_nsl_inet_addr+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lnsl  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char inet_addr ();
int
main ()
{
inet_addr ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_nsl_inet_addr=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_nsl_inet_addr=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_addr" >&5
echo "${ECHO_T}$ac_cv_lib_nsl_inet_addr" >&6
if test $ac_cv_lib_nsl_inet_addr = yes; then
  NSL_LIBRARY=-lnsl
else
  NSL_LIBRARY=""
fi


#
# temporarily add -lsocket to LIBS, for use by TRY_LINK
#
save_LIBS="$LIBS"
LIBS="$LIBS $SOCKET_LIBRARY $NSL_LIBRARY"

#
# use TRY_LINK to see whether we can use sockets
#
echo "$as_me:$LINENO: checking whether we can use sockets (for Morphine)" >&5
echo $ECHO_N "checking whether we can use sockets (for Morphine)... $ECHO_C" >&6
if test "${mercury_cv_sockets_work+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */


	/*
	** The following code was copied from
	** runtime/mercury_trace_external.c
	*/

	#include <stdio.h>
	#include <string.h>
	#include <errno.h>
	#include <stdarg.h>
	#include <stdlib.h>
	#include <sys/types.h>
	#include <unistd.h>
	#include <sys/socket.h>
	#include <sys/un.h>
	#include <arpa/inet.h>
	#include <netinet/in.h>
	#include <netdb.h>

	static int MR_debug_socket = 1;

	void
	fatal_error(const char *s)
	{
		fprintf(stderr, "", s);
		exit(1);
	}

int
main ()
{

	/* this is the body of the test function */
	{
		int fd;
		int len;
		FILE *file_in;
		FILE *file_out;
		int addr_family;
		char *unix_socket;
		char *inet_socket;
		struct sockaddr_un unix_address;
		struct sockaddr_in inet_address;
		struct sockaddr* addr;

		/*
		** We presume that the user's program has been invoked from
		** within the debugger (e.g. Opium).
		** The debugger (or the user) should set the
		** MERCURY_DEBUGGER_UNIX_SOCKET or MERCURY_DEBUGGER_INET_SOCKET
		** environment variable to tell the user's program which socket
		** it needs to connect to.
		*/
		unix_socket = getenv("MERCURY_DEBUGGER_UNIX_SOCKET");
		inet_socket = getenv("MERCURY_DEBUGGER_INET_SOCKET");
		if (unix_socket == NULL && inet_socket == NULL) {
			fatal_error("you must set either the "
				"MERCURY_DEBUGGER_UNIX_SOCKET\n"
				"or MERCURY_DEBUGGER_INET_SOCKET "
				"environment variable");
		}
		if (unix_socket != NULL && inet_socket != NULL) {
			fatal_error("you must set only one of the "
				"MERCURY_DEBUGGER_UNIX_SOCKET "
				"and MERCURY_DEBUGGER_INET_SOCKET\n"
				"environment variables");
		}
		if (unix_socket) {

			addr_family = AF_UNIX;
			(memset)(&unix_address, 0, sizeof(unix_address));
			unix_address.sun_family = AF_UNIX;
			strcpy(unix_address.sun_path, unix_socket);
			addr = (struct sockaddr *) &unix_address;
			len = strlen(unix_address.sun_path) +
				sizeof(unix_address.sun_family);
		} else {
			char hostname[255];
			char port_string[255];
			unsigned short port;
			int host_addr;

			/*
			** Parse the MERCURY_DEBUGGER_INET_SOCKET environment variable.
			** It should be in the format "<hostname> <port>",
			** where <hostname> is numeric (e.g. "123.456.78.90").
			*/

			if (sscanf(inet_socket, "%254s %254s", hostname, port_string)
				!= 2)
			{
				fatal_error("MERCURY_DEBUGGER_INET_SOCKET invalid");
			}
			host_addr = inet_addr(hostname);
			if (host_addr == -1) {
				fatal_error("MERCURY_DEBUGGER_INET_SOCKET: "
					"invalid address");
			}
			if (sscanf(port_string, "%hu", &port) != 1) {
				fatal_error("MERCURY_DEBUGGER_INET_SOCKET: "
					"invalid port");
			}

			fprintf(stderr, "Mercury runtime: host = %s, port = %d\n",
					hostname, port);

			inet_address.sin_family = AF_INET;
			inet_address.sin_addr.s_addr = host_addr;
			inet_address.sin_port = htons(port);
			addr_family = AF_INET;
			addr = (struct sockaddr *) &inet_address;
			len = sizeof(inet_address);
		}

		/*
		** Open the socket.
		*/

		fd = socket(addr_family, SOCK_STREAM, 0);
		if (fd < 0) {
			fprintf(stderr, "Mercury runtime: socket() failed: %s\n",
				strerror(errno));
			fatal_error("cannot open socket for debugger");
		} else if (MR_debug_socket) {
			fprintf(stderr,"Mercury runtime: creation of socket ok\n");
		}

		/*
		** Connect to the socket
		*/
		if (connect(fd, addr, len) < 0) {
			fprintf(stderr, "Mercury runtime: connect() failed: %s\n",
				strerror(errno));
			fatal_error("can't connect to debugger socket");
		} else if (MR_debug_socket) {
			fprintf(stderr, "Mercury runtime: connection to socket: ok\n");
		}

		/*
		** Convert the socket fd to a Mercury stream
		*/
		file_in = fdopen(fd, "r");
		file_out = fdopen(fd, "w");
		if ((file_in == NULL)||(file_out == NULL)) {
			fprintf(stderr, "Mercury runtime: fdopen() failed: %s\n",
				strerror(errno));
			fatal_error("cannot open debugger socket");
		} else if (MR_debug_socket) {
			fprintf(stderr, "Mercury runtime: fdopen(): ok\n");
		}
	}


  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  mercury_cv_sockets_work=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

mercury_cv_sockets_work=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
fi


#
# figure out whether the test succeeded
#
if test "$mercury_cv_sockets_work" = yes; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

#
# restore the previous value of LIBS
#
LIBS="$save_LIBS"

#-----------------------------------------------------------------------------#
#
# Add an option that enables the external debugger support.
# By default, external debugger support is enabled if and only if
# sockets work.  But it is also possible to explicitly disable this
# by passing the `--disable-extern-debug' option.  This is needed on
# some platforms because the test for sockets working sometimes gets
# some false positives (e.g. if they work with dynamic linking but
# not static linking, then the test will pass, but it will cause
# problems later on when we try to link things statically).
#
# Check whether --enable-extern-debug or --disable-extern-debug was given.
if test "${enable_extern_debug+set}" = set; then
  enableval="$enable_extern_debug"
  mercury_cv_enable_extern_debug="$enableval"
else
  mercury_cv_enable_extern_debug="$mercury_cv_sockets_work"
fi;

echo "$as_me:$LINENO: checking whether to enable the external debugger" >&5
echo $ECHO_N "checking whether to enable the external debugger... $ECHO_C" >&6
if test "$mercury_cv_enable_extern_debug" = "yes"; then
	if test "$mercury_cv_sockets_work" = yes; then
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		cat >>confdefs.h <<\_ACEOF
#define MR_USE_EXTERNAL_DEBUGGER 1
_ACEOF

	else
		echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
		{ { echo "$as_me:$LINENO: error: Cannot enable external debugger because sockets do not work" >&5
echo "$as_me: error: Cannot enable external debugger because sockets do not work" >&2;}
   { (exit 1); exit 1; }; }
	fi
else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6

	# don't link with the socket library if we're not going to use it
	SOCKET_LIBRARY=
	NSL_LIBRARY=
fi



#-----------------------------------------------------------------------------#
#
# Check for dynamic linking, unless the --disable-dynamic-link option
# was specified.
#
# Check whether --enable-dynamic-link or --disable-dynamic-link was given.
if test "${enable_dynamic_link+set}" = set; then
  enableval="$enable_dynamic_link"
  mercury_cv_enable_dynamic_link="$enableval"
else
  mercury_cv_enable_dynamic_link=yes
fi;
if test "$mercury_cv_enable_dynamic_link" = "yes"; then

    for mercury_cv_header in dlfcn.h; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
  # Is the header compilable?
echo "$as_me:$LINENO: checking $mercury_cv_header usability" >&5
echo $ECHO_N "checking $mercury_cv_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
#include <$mercury_cv_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_header_compiler=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6

# Is the header present?
echo "$as_me:$LINENO: checking $mercury_cv_header presence" >&5
echo $ECHO_N "checking $mercury_cv_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <$mercury_cv_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  ac_header_preproc=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  yes:no: )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&2;}
    ac_header_preproc=yes
    ;;
  no:yes:* )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $mercury_cv_header: present but cannot be compiled" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $mercury_cv_header: see the Autoconf documentation" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&2;}
    (
      cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists.  ##
## ------------------------------------------ ##
_ASBOX
    ) |
      sed "s/^/$as_me: WARNING:     /" >&2
    ;;
esac
echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6

fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then

		cat >>confdefs.h <<_ACEOF
#define $mercury_cv_header_define 1
_ACEOF

		eval "$mercury_cv_header_define=1"

fi


    done

	echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char dlopen ();
int
main ()
{
dlopen ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_dl_dlopen=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_dl_dlopen=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
if test $ac_cv_lib_dl_dlopen = yes; then
  DL_LIBRARY="-ldl"
else
  DL_LIBRARY=""
fi



	# temporarily add $DL_LIBRARY to LIBS while we check for dlopen etc.
	save_LIBS="$LIBS"
	LIBS="$LIBS $DL_LIBRARY"

	mercury_check_for_functions dlopen dlclose dlsym dlerror

	# restore old value of LIBS
	LIBS="$save_LIBS"
fi

TRACE_LIBS_SYSTEM="$SOCKET_LIBRARY $NSL_LIBRARY $DL_LIBRARY"

#-----------------------------------------------------------------------------#

echo "$as_me:$LINENO: checking whether to enable the new MercuryFile struct" >&5
echo $ECHO_N "checking whether to enable the new MercuryFile struct... $ECHO_C" >&6
# Check whether --enable-new-mercuryfile-struct or --disable-new-mercuryfile-struct was given.
if test "${enable_new_mercuryfile_struct+set}" = set; then
  enableval="$enable_new_mercuryfile_struct"
  ac_new_mercuryfile_struct=yes
else
  ac_new_mercuryfile_struct=no
fi;

if test "$ac_new_mercuryfile_struct" = "yes"; then
	echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
	cat >>confdefs.h <<\_ACEOF
#define MR_NEW_MERCURYFILE_STRUCT 1
_ACEOF

else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi

#-----------------------------------------------------------------------------#


# Check whether --with-msvcrt or --without-msvcrt was given.
if test "${with_msvcrt+set}" = set; then
  withval="$with_msvcrt"
  mercury_cv_msvcrt=yes
else
  mercury_cv_msvcrt=no
fi;

echo "$as_me:$LINENO: checking whether to use the MS Visual C Runtime" >&5
echo $ECHO_N "checking whether to use the MS Visual C Runtime... $ECHO_C" >&6
if test "$mercury_cv_msvcrt" = "yes"; then
	if test "$ac_microsoft" = "yes"; then
		echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
		USE_MSVCRT=yes
	else
		echo "$as_me:$LINENO: result: no as not using the MS C compiler" >&5
echo "${ECHO_T}no as not using the MS C compiler" >&6
		USE_MSVCRT=no
	fi
else
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
	USE_MSVCRT=no
fi


#-----------------------------------------------------------------------------#


# Check whether --with-readline or --without-readline was given.
if test "${with_readline+set}" = set; then
  withval="$with_readline"
  mercury_cv_with_readline="$withval"
else
  mercury_cv_with_readline=yes
fi;

if test "$mercury_cv_with_readline" = yes; then

	# check for the readline header files

    for mercury_cv_header in readline/readline.h readline/history.h; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
  # Is the header compilable?
echo "$as_me:$LINENO: checking $mercury_cv_header usability" >&5
echo $ECHO_N "checking $mercury_cv_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
$ac_includes_default
#include <$mercury_cv_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  (eval $ac_compile) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest.$ac_objext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_header_compiler=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6

# Is the header present?
echo "$as_me:$LINENO: checking $mercury_cv_header presence" >&5
echo $ECHO_N "checking $mercury_cv_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */
#include <$mercury_cv_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } >/dev/null; then
  if test -s conftest.err; then
    ac_cpp_err=$ac_c_preproc_warn_flag
    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  else
    ac_cpp_err=
  fi
else
  ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
  ac_header_preproc=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

  ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  yes:no: )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $mercury_cv_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the compiler's result" >&2;}
    ac_header_preproc=yes
    ;;
  no:yes:* )
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $mercury_cv_header: present but cannot be compiled" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $mercury_cv_header:     check for missing prerequisite headers?" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $mercury_cv_header: see the Autoconf documentation" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $mercury_cv_header:     section \"Present But Cannot Be Compiled\"" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $mercury_cv_header: proceeding with the preprocessor's result" >&2;}
    { echo "$as_me:$LINENO: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $mercury_cv_header: in the future, the compiler will take precedence" >&2;}
    (
      cat <<\_ASBOX
## ------------------------------------------ ##
## Report this to the AC_PACKAGE_NAME lists.  ##
## ------------------------------------------ ##
_ASBOX
    ) |
      sed "s/^/$as_me: WARNING:     /" >&2
    ;;
esac
echo "$as_me:$LINENO: checking for $mercury_cv_header" >&5
echo $ECHO_N "checking for $mercury_cv_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6

fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then

		cat >>confdefs.h <<_ACEOF
#define $mercury_cv_header_define 1
_ACEOF

		eval "$mercury_cv_header_define=1"

fi


    done


	# check for the libraries that readline depends on
	echo 'looking for termcap or curses (needed by readline)...' 1>&6
	echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6
if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-ltermcap  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char tgetent ();
int
main ()
{
tgetent ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_termcap_tgetent=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_termcap_tgetent=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6
if test $ac_cv_lib_termcap_tgetent = yes; then
  mercury_cv_termcap_lib=-ltermcap
else
  echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6
if test "${ac_cv_lib_curses_tgetent+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lcurses  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char tgetent ();
int
main ()
{
tgetent ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_curses_tgetent=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_curses_tgetent=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5
echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6
if test $ac_cv_lib_curses_tgetent = yes; then
  mercury_cv_termcap_lib=-lcurses
else
  echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6
if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lncurses  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char tgetent ();
int
main ()
{
tgetent ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_ncurses_tgetent=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_ncurses_tgetent=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5
echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6
if test $ac_cv_lib_ncurses_tgetent = yes; then
  mercury_cv_termcap_lib=-lncurses
else
  mercury_cv_termcap_lib=''
fi

fi

fi


	# check for the readline library
	echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6
if test "${ac_cv_lib_readline_readline+set}" = set; then
  echo $ECHO_N "(cached) $ECHO_C" >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline $mercury_cv_termcap_lib $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h.  */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h.  */

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char readline ();
int
main ()
{
readline ();
  ;
  return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  (eval $ac_link) 2>conftest.er1
  ac_status=$?
  grep -v '^ *+' conftest.er1 >conftest.err
  rm -f conftest.er1
  cat conftest.err >&5
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); } &&
	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; } &&
	 { ac_try='test -s conftest$ac_exeext'
  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  (eval $ac_try) 2>&5
  ac_status=$?
  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  (exit $ac_status); }; }; then
  ac_cv_lib_readline_readline=yes
else
  echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_readline_readline=no
fi
rm -f conftest.err conftest.$ac_objext \
      conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6
if test $ac_cv_lib_readline_readline = yes; then
  mercury_cv_have_readline=yes
else
  mercury_cv_have_readline=no
fi

else
	mercury_cv_have_readline=no
fi

# Now figure out whether we can use readline, and define variables according.
# Note that on most systems, we don't actually need the header files in
# order to use readline. (Ain't C grand? ;-).

if test $mercury_cv_have_readline = no; then
	TERMCAP_LIBRARY=""
	READLINE_LIBRARIES=""
	cat >>confdefs.h <<\_ACEOF
#define MR_NO_USE_READLINE 1
_ACEOF

else
	TERMCAP_LIBRARY="$mercury_cv_termcap_lib"
	READLINE_LIBRARIES="-lreadline $TERMCAP_LIBRARY"
fi




#-----------------------------------------------------------------------------#

mercury_check_c_files () {
    c_dir=$1
    c_date_dir=$2

    for c_file in $c_dir/*.c
    do
        case $c_file in
        */'*.c')
            ;;
        */*_init.c)
            some_kept=true
            ;;
        *)
            sed -e '/END_OF_C_GRADE_INFO/q' < $c_file > confscratch
            if grep "TAG_BITS=$mercury_cv_low_tag_bits" \
                    confscratch > /dev/null 2>&1 \
                && grep "UNBOXED_FLOAT=$mercury_cv_unboxed_floats" \
                    confscratch > /dev/null 2>&1
            then
                some_kept=true
            else
                c_date_file="$c_date_dir/`basename $c_file .c`.c_date"
                to_delete="$to_delete $c_file $c_date_file"
            fi
            ;;
        esac
    done
}

some_kept=false
to_delete=""
if test "$BOOTSTRAP_MC" != "" ; then
    echo "checking whether any C files need to be rebuilt..." 1>&6
    for directory in library compiler profiler deep_profiler browser
    do
        mercury_check_c_files $directory $directory
        mercury_check_c_files $directory/Mercury/cs $directory/Mercury/c_dates
    done
    if test "$to_delete" = "" ; then
        case $some_kept in
          true)
            echo "no - they are compatible with autoconfigured settings" 1>&6
            ;;
          false)
            echo "there are no existing Mercury-generated C files" 1>&6
            ;;
          esac
    else
        case $some_kept in
          true)
            echo "the following C files must be rebuilt in a grade
	that is consistent with autoconfigured settings
	$to_delete" 1>&6
            ;;
          false)
            echo "all Mercury generated C files must be rebuilt
	in a grade that is consistent with the
	autoconfigured settings" 1>&6
            ;;
        esac
        echo "installation may take longer than usual" 1>&6
    fi
    rm -f confscratch $to_delete
fi
#-----------------------------------------------------------------------------#

echo "$as_me:$LINENO: checking for C shell executable" >&5
echo $ECHO_N "checking for C shell executable... $ECHO_C" >&6
cshpath=""
for prog in tcsh csh
do
	for dir in `echo $PATH | tr ':' ' '`
	do
		if test -x "$dir/$prog"
		then
			if test "$cshpath" = ""
			then
				cshpath="$dir/$prog"
			fi
		fi
	done
done

if test "$cshpath" = ""
then
	echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
	CSHPATH="no csh path"
else
	echo "$as_me:$LINENO: result: $cshpath" >&5
echo "${ECHO_T}$cshpath" >&6
	CSHPATH="$cshpath"
fi


#-----------------------------------------------------------------------------#

# Any new entries here may need to be handled by scripts/mercury_config.
                                                                                                                                                                                                                                                                    ac_config_files="$ac_config_files Mmake.common scripts/Mmake.vars scripts/mmc scripts/mercury.bat scripts/mprof scripts/mercury_update_interface scripts/mgnuc scripts/parse_ml_options.sh-subr scripts/ml scripts/c2init scripts/mmake scripts/mdb scripts/mdbrc scripts/mdprof scripts/canonical_grade scripts/mkfifo_using_mknod bindist/bindist.INSTALL bindist/bindist.Makefile scripts/mercury_config scripts/Mercury.config scripts/Mercury.config.bootstrap tools/lmc tools/dotime runtime/mercury_dotnet.cs java/runtime/Constants.java java/runtime/Native.java"
          ac_config_commands="$ac_config_commands default"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs, see configure's option --config-cache.
# It is not useful on other systems.  If it contains results you don't
# want to keep, you may remove or edit it.
#
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.

_ACEOF

# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
{
  (set) 2>&1 |
    case `(ac_space=' '; set | grep ac_space) 2>&1` in
    *ac_space=\ *)
      # `set' does not quote correctly, so add quotes (double-quote
      # substitution turns \\\\ into \\, and sed turns \\ into \).
      sed -n \
	"s/'/'\\\\''/g;
	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
      ;;
    *)
      # `set' quotes correctly as required by POSIX, so do not add quotes.
      sed -n \
	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
      ;;
    esac;
} |
  sed '
     t clear
     : clear
     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
     t end
     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
     : end' >>confcache
if diff $cache_file confcache >/dev/null 2>&1; then :; else
  if test -w $cache_file; then
    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
    cat confcache >$cache_file
  else
    echo "not updating unwritable cache $cache_file"
  fi
fi
rm -f confcache

test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'

# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
s/^\([^=]*=[	 ]*\):*/\1/;
s/:*$//;
s/^[^=]*=[	 ]*$//;
}'
fi

DEFS=-DHAVE_CONFIG_H

ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
  # 1. Remove the extension, and $U if already installed.
  ac_i=`echo "$ac_i" |
	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
  # 2. Add them.
  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs

LTLIBOBJS=$ac_ltlibobjs



: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
echo "$as_me: creating $CONFIG_STATUS" >&6;}
cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
# Compiler output produced by configure, useful for debugging
# configure, is in config.log if it exists.

debug=false
ac_cs_recheck=false
ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF
## --------------------- ##
## M4sh Initialization.  ##
## --------------------- ##

# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  set -o posix
fi
DUALCASE=1; export DUALCASE # for MKS sh

# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
  as_unset=unset
else
  as_unset=false
fi


# Work around bugs in pre-3.0 UWIN ksh.
$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '

# NLS nuisances.
for as_var in \
  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
  LC_TELEPHONE LC_TIME
do
  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
    eval $as_var=C; export $as_var
  else
    $as_unset $as_var
  fi
done

# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1; then
  as_expr=expr
else
  as_expr=false
fi

if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
  as_basename=basename
else
  as_basename=false
fi


# Name of the executable.
as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
	 X"$0" : 'X\(//\)$' \| \
	 X"$0" : 'X\(/\)$' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X/"$0" |
    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
  	  /^X\/\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`


# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  echo "#! /bin/sh" >conf$$.sh
  echo  "exit 0"   >>conf$$.sh
  chmod +x conf$$.sh
  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
    PATH_SEPARATOR=';'
  else
    PATH_SEPARATOR=:
  fi
  rm -f conf$$.sh
fi


  as_lineno_1=$LINENO
  as_lineno_2=$LINENO
  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  test "x$as_lineno_1" != "x$as_lineno_2" &&
  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
  # Find who we are.  Look in the path if we contain no path at all
  # relative or not.
  case $0 in
    *[\\/]* ) as_myself=$0 ;;
    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
done

       ;;
  esac
  # We did not find ourselves, most probably we were run as `sh COMMAND'
  # in which case we are not to be found in the path.
  if test "x$as_myself" = x; then
    as_myself=$0
  fi
  if test ! -f "$as_myself"; then
    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
   { (exit 1); exit 1; }; }
  fi
  case $CONFIG_SHELL in
  '')
    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  for as_base in sh bash ksh sh5; do
	 case $as_dir in
	 /*)
	   if ("$as_dir/$as_base" -c '
  as_lineno_1=$LINENO
  as_lineno_2=$LINENO
  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
  test "x$as_lineno_1" != "x$as_lineno_2" &&
  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
	     CONFIG_SHELL=$as_dir/$as_base
	     export CONFIG_SHELL
	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
	   fi;;
	 esac
       done
done
;;
  esac

  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
  # uniformly replaced by the line number.  The first 'sed' inserts a
  # line-number line before each line; the second 'sed' does the real
  # work.  The second script uses 'N' to pair each line-number line
  # with the numbered line, and appends trailing '-' during
  # substitution so that $LINENO is not a special case at line end.
  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
  sed '=' <$as_myself |
    sed '
      N
      s,$,-,
      : loop
      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
      t loop
      s,-$,,
      s,^['$as_cr_digits']*\n,,
    ' >$as_me.lineno &&
  chmod +x $as_me.lineno ||
    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
   { (exit 1); exit 1; }; }

  # Don't try to exec as it changes $[0], causing all sort of problems
  # (the dirname of $[0] is not the place where we might find the
  # original and so on.  Autoconf is especially sensible to this).
  . ./$as_me.lineno
  # Exit status is that of the last command.
  exit
}


case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
  *c*,-n*) ECHO_N= ECHO_C='
' ECHO_T='	' ;;
  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac

if expr a : '\(a\)' >/dev/null 2>&1; then
  as_expr=expr
else
  as_expr=false
fi

rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
  # We could just check for DJGPP; but this test a) works b) is more generic
  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
  if test -f conf$$.exe; then
    # Don't use ln at all; we don't have any links
    as_ln_s='cp -p'
  else
    as_ln_s='ln -s'
  fi
elif ln conf$$.file conf$$ 2>/dev/null; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file

if mkdir -p . 2>/dev/null; then
  as_mkdir_p=:
else
  test -d ./-p && rmdir ./-p
  as_mkdir_p=false
fi

as_executable_p="test -f"

# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"

# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"


# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" 	$as_nl"

# CDPATH.
$as_unset CDPATH

exec 6>&1

# Open the log real soon, to keep \$[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.  Logging --version etc. is OK.
exec 5>>config.log
{
  echo
  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
} >&5
cat >&5 <<_CSEOF

This file was extended by $as_me, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@

_CSEOF
echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
echo >&5
_ACEOF

# Files that config.status was made for.
if test -n "$ac_config_files"; then
  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
fi

if test -n "$ac_config_headers"; then
  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
fi

if test -n "$ac_config_links"; then
  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
fi

if test -n "$ac_config_commands"; then
  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
fi

cat >>$CONFIG_STATUS <<\_ACEOF

ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.

Usage: $0 [OPTIONS] [FILE]...

  -h, --help       print this help, then exit
  -V, --version    print version number, then exit
  -q, --quiet      do not print progress messages
  -d, --debug      don't remove temporary files
      --recheck    update $as_me by reconfiguring in the same conditions
  --file=FILE[:TEMPLATE]
		   instantiate the configuration file FILE
  --header=FILE[:TEMPLATE]
		   instantiate the configuration header FILE

Configuration files:
$config_files

Configuration headers:
$config_headers

Configuration commands:
$config_commands

Report bugs to <bug-autoconf@gnu.org>."
_ACEOF

cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
config.status
configured by $0, generated by GNU Autoconf 2.59,
  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF
# If no file are specified by the user, then we need to provide default
# value.  By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
  case $1 in
  --*=*)
    ac_option=`expr "x$1" : 'x\([^=]*\)='`
    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
    ac_shift=:
    ;;
  -*)
    ac_option=$1
    ac_optarg=$2
    ac_shift=shift
    ;;
  *) # This is not an option, so the user has probably given explicit
     # arguments.
     ac_option=$1
     ac_need_defaults=false;;
  esac

  case $ac_option in
  # Handling of the options.
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    ac_cs_recheck=: ;;
  --version | --vers* | -V )
    echo "$ac_cs_version"; exit 0 ;;
  --he | --h)
    # Conflict between --help and --header
    { { echo "$as_me:$LINENO: error: ambiguous option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: ambiguous option: $1
Try \`$0 --help' for more information." >&2;}
   { (exit 1); exit 1; }; };;
  --help | --hel | -h )
    echo "$ac_cs_usage"; exit 0 ;;
  --debug | --d* | -d )
    debug=: ;;
  --file | --fil | --fi | --f )
    $ac_shift
    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
    ac_need_defaults=false;;
  --header | --heade | --head | --hea )
    $ac_shift
    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
    ac_need_defaults=false;;
  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil | --si | --s)
    ac_cs_silent=: ;;

  # This is an error.
  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
Try \`$0 --help' for more information." >&5
echo "$as_me: error: unrecognized option: $1
Try \`$0 --help' for more information." >&2;}
   { (exit 1); exit 1; }; } ;;

  *) ac_config_targets="$ac_config_targets $1" ;;

  esac
  shift
done

ac_configure_extra_args=

if $ac_cs_silent; then
  exec 6>/dev/null
  ac_configure_extra_args="$ac_configure_extra_args --silent"
fi

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi

_ACEOF

cat >>$CONFIG_STATUS <<_ACEOF
#
# INIT-COMMANDS section.
#

reconfiguring=$reconfiguring


_ACEOF



cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
  case "$ac_config_target" in
  # Handling of arguments.
  "Mmake.common" ) CONFIG_FILES="$CONFIG_FILES Mmake.common" ;;
  "scripts/Mmake.vars" ) CONFIG_FILES="$CONFIG_FILES scripts/Mmake.vars" ;;
  "scripts/mmc" ) CONFIG_FILES="$CONFIG_FILES scripts/mmc" ;;
  "scripts/mercury.bat" ) CONFIG_FILES="$CONFIG_FILES scripts/mercury.bat" ;;
  "scripts/mprof" ) CONFIG_FILES="$CONFIG_FILES scripts/mprof" ;;
  "scripts/mercury_update_interface" ) CONFIG_FILES="$CONFIG_FILES scripts/mercury_update_interface" ;;
  "scripts/mgnuc" ) CONFIG_FILES="$CONFIG_FILES scripts/mgnuc" ;;
  "scripts/parse_ml_options.sh-subr" ) CONFIG_FILES="$CONFIG_FILES scripts/parse_ml_options.sh-subr" ;;
  "scripts/ml" ) CONFIG_FILES="$CONFIG_FILES scripts/ml" ;;
  "scripts/c2init" ) CONFIG_FILES="$CONFIG_FILES scripts/c2init" ;;
  "scripts/mmake" ) CONFIG_FILES="$CONFIG_FILES scripts/mmake" ;;
  "scripts/mdb" ) CONFIG_FILES="$CONFIG_FILES scripts/mdb" ;;
  "scripts/mdbrc" ) CONFIG_FILES="$CONFIG_FILES scripts/mdbrc" ;;
  "scripts/mdprof" ) CONFIG_FILES="$CONFIG_FILES scripts/mdprof" ;;
  "scripts/canonical_grade" ) CONFIG_FILES="$CONFIG_FILES scripts/canonical_grade" ;;
  "scripts/mkfifo_using_mknod" ) CONFIG_FILES="$CONFIG_FILES scripts/mkfifo_using_mknod" ;;
  "bindist/bindist.INSTALL" ) CONFIG_FILES="$CONFIG_FILES bindist/bindist.INSTALL" ;;
  "bindist/bindist.Makefile" ) CONFIG_FILES="$CONFIG_FILES bindist/bindist.Makefile" ;;
  "scripts/mercury_config" ) CONFIG_FILES="$CONFIG_FILES scripts/mercury_config" ;;
  "scripts/Mercury.config" ) CONFIG_FILES="$CONFIG_FILES scripts/Mercury.config" ;;
  "scripts/Mercury.config.bootstrap" ) CONFIG_FILES="$CONFIG_FILES scripts/Mercury.config.bootstrap" ;;
  "tools/lmc" ) CONFIG_FILES="$CONFIG_FILES tools/lmc" ;;
  "tools/dotime" ) CONFIG_FILES="$CONFIG_FILES tools/dotime" ;;
  "runtime/mercury_dotnet.cs" ) CONFIG_FILES="$CONFIG_FILES runtime/mercury_dotnet.cs" ;;
  "java/runtime/Constants.java" ) CONFIG_FILES="$CONFIG_FILES java/runtime/Constants.java" ;;
  "java/runtime/Native.java" ) CONFIG_FILES="$CONFIG_FILES java/runtime/Native.java" ;;
  "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
  "runtime/mercury_conf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS runtime/mercury_conf.h" ;;
  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
   { (exit 1); exit 1; }; };;
  esac
done

# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used.  Set only those that are not.
# We use the long form for the default assignment because of an extremely
# bizarre bug on SunOS 4.1.3.
if $ac_need_defaults; then
  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi

# Have a temporary directory for convenience.  Make it in the build tree
# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
  trap '{ (exit 1); exit 1; }' 1 2 13 15
}

# Create a (secure) tmp directory for tmp files.

{
  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
  test -n "$tmp" && test -d "$tmp"
}  ||
{
  tmp=./confstat$$-$RANDOM
  (umask 077 && mkdir $tmp)
} ||
{
   echo "$me: cannot create a temporary directory in ." >&2
   { (exit 1); exit 1; }
}

_ACEOF

cat >>$CONFIG_STATUS <<_ACEOF

#
# CONFIG_FILES section.
#

# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
if test -n "\$CONFIG_FILES"; then
  # Protect against being on the right side of a sed subst in config.status.
  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
s,@SHELL@,$SHELL,;t t
s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
s,@exec_prefix@,$exec_prefix,;t t
s,@prefix@,$prefix,;t t
s,@program_transform_name@,$program_transform_name,;t t
s,@bindir@,$bindir,;t t
s,@sbindir@,$sbindir,;t t
s,@libexecdir@,$libexecdir,;t t
s,@datadir@,$datadir,;t t
s,@sysconfdir@,$sysconfdir,;t t
s,@sharedstatedir@,$sharedstatedir,;t t
s,@localstatedir@,$localstatedir,;t t
s,@libdir@,$libdir,;t t
s,@includedir@,$includedir,;t t
s,@oldincludedir@,$oldincludedir,;t t
s,@infodir@,$infodir,;t t
s,@mandir@,$mandir,;t t
s,@build_alias@,$build_alias,;t t
s,@host_alias@,$host_alias,;t t
s,@target_alias@,$target_alias,;t t
s,@DEFS@,$DEFS,;t t
s,@ECHO_C@,$ECHO_C,;t t
s,@ECHO_N@,$ECHO_N,;t t
s,@ECHO_T@,$ECHO_T,;t t
s,@LIBS@,$LIBS,;t t
s,@RECONFIGURE_ARGS@,$RECONFIGURE_ARGS,;t t
s,@build@,$build,;t t
s,@build_cpu@,$build_cpu,;t t
s,@build_vendor@,$build_vendor,;t t
s,@build_os@,$build_os,;t t
s,@host@,$host,;t t
s,@host_cpu@,$host_cpu,;t t
s,@host_vendor@,$host_vendor,;t t
s,@host_os@,$host_os,;t t
s,@FULLARCH@,$FULLARCH,;t t
s,@CYGPATH@,$CYGPATH,;t t
s,@VERSION@,$VERSION,;t t
s,@PREFIX@,$PREFIX,;t t
s,@NONSHARED_LIB_DIR@,$NONSHARED_LIB_DIR,;t t
s,@LIBDIR@,$LIBDIR,;t t
s,@DEFAULT_MERCURY_DEBUGGER_INIT_DIR@,$DEFAULT_MERCURY_DEBUGGER_INIT_DIR,;t t
s,@CONFIG_PREFIX@,$CONFIG_PREFIX,;t t
s,@CONFIG_LIBDIR@,$CONFIG_LIBDIR,;t t
s,@BOOTSTRAP_MC@,$BOOTSTRAP_MC,;t t
s,@ENABLE_GCC_BACK_END@,$ENABLE_GCC_BACK_END,;t t
s,@GCC_SRC_DIR@,$GCC_SRC_DIR,;t t
s,@ENABLE_ADITI_BACK_END@,$ENABLE_ADITI_BACK_END,;t t
s,@GNU_MAKE@,$GNU_MAKE,;t t
s,@MKFIFO@,$MKFIFO,;t t
s,@MKNOD@,$MKNOD,;t t
s,@MKTEMP@,$MKTEMP,;t t
s,@INSTALL_INFO@,$INSTALL_INFO,;t t
s,@TEXI2DVI@,$TEXI2DVI,;t t
s,@LYNX@,$LYNX,;t t
s,@DVIPS@,$DVIPS,;t t
s,@MAKEINFO@,$MAKEINFO,;t t
s,@INFO@,$INFO,;t t
s,@PERL@,$PERL,;t t
s,@HOSTNAMECMD@,$HOSTNAMECMD,;t t
s,@CC@,$CC,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@LDFLAGS@,$LDFLAGS,;t t
s,@CPPFLAGS@,$CPPFLAGS,;t t
s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@EXEEXT@,$EXEEXT,;t t
s,@OBJEXT@,$OBJEXT,;t t
s,@GCC_PROG@,$GCC_PROG,;t t
s,@ALL_LOCAL_C_INCL_DIRS@,$ALL_LOCAL_C_INCL_DIRS,;t t
s,@ALL_LOCAL_C_INCL_DIR_MMC_OPTS@,$ALL_LOCAL_C_INCL_DIR_MMC_OPTS,;t t
s,@ALL_LOCAL_C_LIB_DIRS@,$ALL_LOCAL_C_LIB_DIRS,;t t
s,@ALL_LOCAL_C_LIB_DIR_MMC_OPTS@,$ALL_LOCAL_C_LIB_DIR_MMC_OPTS,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@OBJFILE_OPT@,$OBJFILE_OPT,;t t
s,@AR@,$AR,;t t
s,@ARFLAGS@,$ARFLAGS,;t t
s,@AR_LIBFILE_OPT@,$AR_LIBFILE_OPT,;t t
s,@LDFLAGS_FOR_DEBUG@,$LDFLAGS_FOR_DEBUG,;t t
s,@LD_LIBFLAGS_FOR_DEBUG@,$LD_LIBFLAGS_FOR_DEBUG,;t t
s,@LD_STRIP_FLAG@,$LD_STRIP_FLAG,;t t
s,@LDFLAGS_FOR_TRACE@,$LDFLAGS_FOR_TRACE,;t t
s,@LD_LIBFLAGS_FOR_TRACE@,$LD_LIBFLAGS_FOR_TRACE,;t t
s,@USING_MICROSOFT_CL_COMPILER@,$USING_MICROSOFT_CL_COMPILER,;t t
s,@OBJ_SUFFIX@,$OBJ_SUFFIX,;t t
s,@LIB_SUFFIX@,$LIB_SUFFIX,;t t
s,@LIB_PREFIX@,$LIB_PREFIX,;t t
s,@LIB_LIBPATH@,$LIB_LIBPATH,;t t
s,@LINK_LIB@,$LINK_LIB,;t t
s,@LINK_LIB_SUFFIX@,$LINK_LIB_SUFFIX,;t t
s,@LINK_OPT_SEP@,$LINK_OPT_SEP,;t t
s,@FIX_PATH_FOR_CC@,$FIX_PATH_FOR_CC,;t t
s,@LN_S@,$LN_S,;t t
s,@MMC_USE_SYMLINKS_OPT@,$MMC_USE_SYMLINKS_OPT,;t t
s,@MATH_LIB@,$MATH_LIB,;t t
s,@ILASM@,$ILASM,;t t
s,@GACUTIL@,$GACUTIL,;t t
s,@MS_CL@,$MS_CL,;t t
s,@MS_CSC@,$MS_CSC,;t t
s,@MS_DOTNET_SDK_DIR@,$MS_DOTNET_SDK_DIR,;t t
s,@MS_DOTNET_LIBRARY_VERSION@,$MS_DOTNET_LIBRARY_VERSION,;t t
s,@MS_VISUALCPP_DIR@,$MS_VISUALCPP_DIR,;t t
s,@JAVAC@,$JAVAC,;t t
s,@JAVA_INTERPRETER@,$JAVA_INTERPRETER,;t t
s,@JAR@,$JAR,;t t
s,@MR_WORD_TYPE@,$MR_WORD_TYPE,;t t
s,@MR_INTEGER_LENGTH_MODIFIER@,$MR_INTEGER_LENGTH_MODIFIER,;t t
s,@MR_INT_LEAST64_TYPE@,$MR_INT_LEAST64_TYPE,;t t
s,@MR_INT_LEAST32_TYPE@,$MR_INT_LEAST32_TYPE,;t t
s,@MR_INT_LEAST32_MAX@,$MR_INT_LEAST32_MAX,;t t
s,@MR_UINT_LEAST32_MAX@,$MR_UINT_LEAST32_MAX,;t t
s,@MR_INT_LEAST16_TYPE@,$MR_INT_LEAST16_TYPE,;t t
s,@MR_INT_LEAST16_MAX@,$MR_INT_LEAST16_MAX,;t t
s,@MR_UINT_LEAST16_MAX@,$MR_UINT_LEAST16_MAX,;t t
s,@LOW_TAG_BITS@,$LOW_TAG_BITS,;t t
s,@BYTES_PER_WORD@,$BYTES_PER_WORD,;t t
s,@SYNC_TERM_SIZE@,$SYNC_TERM_SIZE,;t t
s,@BITS_PER_WORD@,$BITS_PER_WORD,;t t
s,@HAVE_BOXED_FLOATS@,$HAVE_BOXED_FLOATS,;t t
s,@MR_FLOAT_IS_64_BIT@,$MR_FLOAT_IS_64_BIT,;t t
s,@MR_DOUBLE_IS_64_BIT@,$MR_DOUBLE_IS_64_BIT,;t t
s,@MR_LONG_DOUBLE_IS_64_BIT@,$MR_LONG_DOUBLE_IS_64_BIT,;t t
s,@MR_BIG_ENDIAN@,$MR_BIG_ENDIAN,;t t
s,@MR_LITTLE_ENDIAN@,$MR_LITTLE_ENDIAN,;t t
s,@MR_CAN_DO_PENDING_IO@,$MR_CAN_DO_PENDING_IO,;t t
s,@CFLAGS_FOR_REGS@,$CFLAGS_FOR_REGS,;t t
s,@CFLAGS_FOR_GOTOS@,$CFLAGS_FOR_GOTOS,;t t
s,@HAVE_ASM_LABELS@,$HAVE_ASM_LABELS,;t t
s,@ENABLE_DEEP_PROFILER@,$ENABLE_DEEP_PROFILER,;t t
s,@CGIDIR@,$CGIDIR,;t t
s,@CFLAGS_FOR_THREADS@,$CFLAGS_FOR_THREADS,;t t
s,@THREAD_LIBS@,$THREAD_LIBS,;t t
s,@LDFLAGS_FOR_THREADS@,$LDFLAGS_FOR_THREADS,;t t
s,@LD_LIBFLAGS_FOR_THREADS@,$LD_LIBFLAGS_FOR_THREADS,;t t
s,@DEFAULT_GRADE@,$DEFAULT_GRADE,;t t
s,@GRADE@,$GRADE,;t t
s,@LIBGRADES@,$LIBGRADES,;t t
s,@LIBGRADE_OPTS@,$LIBGRADE_OPTS,;t t
s,@NUM_REAL_R_REGS@,$NUM_REAL_R_REGS,;t t
s,@NUM_REAL_R_TEMPS@,$NUM_REAL_R_TEMPS,;t t
s,@HAVE_DELAY_SLOT@,$HAVE_DELAY_SLOT,;t t
s,@AS@,$AS,;t t
s,@CFLAGS_FOR_ANSI@,$CFLAGS_FOR_ANSI,;t t
s,@CFLAGS_FOR_WARNINGS@,$CFLAGS_FOR_WARNINGS,;t t
s,@CFLAGS_FOR_OPT@,$CFLAGS_FOR_OPT,;t t
s,@CFLAGS_FOR_DEBUG@,$CFLAGS_FOR_DEBUG,;t t
s,@MCFLAGS_FOR_CC@,$MCFLAGS_FOR_CC,;t t
s,@LINK_EXE@,$LINK_EXE,;t t
s,@LD_STATIC_FLAGS@,$LD_STATIC_FLAGS,;t t
s,@DEFAULT_LINKAGE@,$DEFAULT_LINKAGE,;t t
s,@LINK_SHARED_OBJ@,$LINK_SHARED_OBJ,;t t
s,@LINK_SHARED_OBJ_SH@,$LINK_SHARED_OBJ_SH,;t t
s,@ERROR_UNDEFINED@,$ERROR_UNDEFINED,;t t
s,@ALLOW_UNDEFINED@,$ALLOW_UNDEFINED,;t t
s,@EXE_RPATH_OPT@,$EXE_RPATH_OPT,;t t
s,@EXE_RPATH_SEP@,$EXE_RPATH_SEP,;t t
s,@SHLIB_RPATH_OPT@,$SHLIB_RPATH_OPT,;t t
s,@SHLIB_RPATH_SEP@,$SHLIB_RPATH_SEP,;t t
s,@CFLAGS_FOR_PIC@,$CFLAGS_FOR_PIC,;t t
s,@EXT_FOR_PIC_OBJECTS@,$EXT_FOR_PIC_OBJECTS,;t t
s,@EXT_FOR_LINK_WITH_PIC_OBJECTS@,$EXT_FOR_LINK_WITH_PIC_OBJECTS,;t t
s,@EXT_FOR_SHARED_LIB@,$EXT_FOR_SHARED_LIB,;t t
s,@EXT_FOR_EXE@,$EXT_FOR_EXE,;t t
s,@USE_DLLS@,$USE_DLLS,;t t
s,@SHARED_LIBS@,$SHARED_LIBS,;t t
s,@SHARED_LIBS_SH@,$SHARED_LIBS_SH,;t t
s,@SOCKET_LIBRARY@,$SOCKET_LIBRARY,;t t
s,@NSL_LIBRARY@,$NSL_LIBRARY,;t t
s,@DL_LIBRARY@,$DL_LIBRARY,;t t
s,@TRACE_LIBS_SYSTEM@,$TRACE_LIBS_SYSTEM,;t t
s,@USE_MSVCRT@,$USE_MSVCRT,;t t
s,@TERMCAP_LIBRARY@,$TERMCAP_LIBRARY,;t t
s,@READLINE_LIBRARIES@,$READLINE_LIBRARIES,;t t
s,@CSHPATH@,$CSHPATH,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
/@INIT_GRADE_OPTIONS@/r $INIT_GRADE_OPTIONS
s,@INIT_GRADE_OPTIONS@,,;t t
/@PARSE_GRADE_OPTIONS@/r $PARSE_GRADE_OPTIONS
s,@PARSE_GRADE_OPTIONS@,,;t t
/@FINAL_GRADE_OPTIONS@/r $FINAL_GRADE_OPTIONS
s,@FINAL_GRADE_OPTIONS@,,;t t
/@PARSE_ML_OPTIONS@/r $PARSE_ML_OPTIONS
s,@PARSE_ML_OPTIONS@,,;t t
/@CANONICAL_GRADE@/r $CANONICAL_GRADE
s,@CANONICAL_GRADE@,,;t t
/@CONFIGURE_HELP@/r $CONFIGURE_HELP
s,@CONFIGURE_HELP@,,;t t
CEOF

_ACEOF

  cat >>$CONFIG_STATUS <<\_ACEOF
  # Split the substitutions into bite-sized pieces for seds with
  # small command number limits, like on Digital OSF/1 and HP-UX.
  ac_max_sed_lines=48
  ac_sed_frag=1 # Number of current file.
  ac_beg=1 # First line for current file.
  ac_end=$ac_max_sed_lines # Line after last line for current file.
  ac_more_lines=:
  ac_sed_cmds=
  while $ac_more_lines; do
    if test $ac_beg -gt 1; then
      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
    else
      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
    fi
    if test ! -s $tmp/subs.frag; then
      ac_more_lines=false
    else
      # The purpose of the label and of the branching condition is to
      # speed up the sed processing (if there are no `@' at all, there
      # is no need to browse any of the substitutions).
      # These are the two extra sed commands mentioned above.
      (echo ':t
  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
      if test -z "$ac_sed_cmds"; then
	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
      else
	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
      fi
      ac_sed_frag=`expr $ac_sed_frag + 1`
      ac_beg=$ac_end
      ac_end=`expr $ac_end + $ac_max_sed_lines`
    fi
  done
  if test -z "$ac_sed_cmds"; then
    ac_sed_cmds=cat
  fi
fi # test -n "$CONFIG_FILES"

_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  case $ac_file in
  - | *:- | *:-:* ) # input from stdin
	cat >$tmp/stdin
	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  * )   ac_file_in=$ac_file.in ;;
  esac

  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$ac_file" : 'X\(//\)[^/]' \| \
	 X"$ac_file" : 'X\(//\)$' \| \
	 X"$ac_file" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
  { if $as_mkdir_p; then
    mkdir -p "$ac_dir"
  else
    as_dir="$ac_dir"
    as_dirs=
    while test ! -d "$as_dir"; do
      as_dirs="$as_dir $as_dirs"
      as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
    done
    test ! -n "$as_dirs" || mkdir $as_dirs
  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
   { (exit 1); exit 1; }; }; }

  ac_builddir=.

if test "$ac_dir" != .; then
  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
  # A "../" for each directory in $ac_dir_suffix.
  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
  ac_dir_suffix= ac_top_builddir=
fi

case $srcdir in
  .)  # No --srcdir option.  We are building in place.
    ac_srcdir=.
    if test -z "$ac_top_builddir"; then
       ac_top_srcdir=.
    else
       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
    fi ;;
  [\\/]* | ?:[\\/]* )  # Absolute path.
    ac_srcdir=$srcdir$ac_dir_suffix;
    ac_top_srcdir=$srcdir ;;
  *) # Relative path.
    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
    ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac

# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
  case "$ac_dir" in
  .) ac_abs_builddir=`pwd`;;
  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
  *) ac_abs_builddir=`pwd`/"$ac_dir";;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
  case ${ac_top_builddir}. in
  .) ac_abs_top_builddir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
  case $ac_srcdir in
  .) ac_abs_srcdir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
  case $ac_top_srcdir in
  .) ac_abs_top_srcdir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
  esac;;
esac



  # Let's still pretend it is `configure' which instantiates (i.e., don't
  # use $as_me), people would be surprised to read:
  #    /* config.h.  Generated by config.status.  */
  if test x"$ac_file" = x-; then
    configure_input=
  else
    configure_input="$ac_file.  "
  fi
  configure_input=$configure_input"Generated from `echo $ac_file_in |
				     sed 's,.*/,,'` by configure."

  # First look for the input files in the build tree, otherwise in the
  # src tree.
  ac_file_inputs=`IFS=:
    for f in $ac_file_in; do
      case $f in
      -) echo $tmp/stdin ;;
      [\\/$]*)
	 # Absolute (can't be DOS-style, as IFS=:)
	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
   { (exit 1); exit 1; }; }
	 echo "$f";;
      *) # Relative
	 if test -f "$f"; then
	   # Build tree
	   echo "$f"
	 elif test -f "$srcdir/$f"; then
	   # Source tree
	   echo "$srcdir/$f"
	 else
	   # /dev/null tree
	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
   { (exit 1); exit 1; }; }
	 fi;;
      esac
    done` || { (exit 1); exit 1; }

  if test x"$ac_file" != x-; then
    { echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}
    rm -f "$ac_file"
  fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
  sed "$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s,@configure_input@,$configure_input,;t t
s,@srcdir@,$ac_srcdir,;t t
s,@abs_srcdir@,$ac_abs_srcdir,;t t
s,@top_srcdir@,$ac_top_srcdir,;t t
s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
s,@builddir@,$ac_builddir,;t t
s,@abs_builddir@,$ac_abs_builddir,;t t
s,@top_builddir@,$ac_top_builddir,;t t
s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
  rm -f $tmp/stdin
  if test x"$ac_file" != x-; then
    mv $tmp/out $ac_file
  else
    cat $tmp/out
    rm -f $tmp/out
  fi

done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF

#
# CONFIG_HEADER section.
#

# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s,^\([	 ]*\)#\([	 ]*define[	 ][	 ]*\)'
ac_dB='[	 ].*$,\1#\2'
ac_dC=' '
ac_dD=',;t'
# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_uA='s,^\([	 ]*\)#\([	 ]*\)undef\([	 ][	 ]*\)'
ac_uB='$,\1#\2define\3'
ac_uC=' '
ac_uD=',;t'

for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
  case $ac_file in
  - | *:- | *:-:* ) # input from stdin
	cat >$tmp/stdin
	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
  * )   ac_file_in=$ac_file.in ;;
  esac

  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
echo "$as_me: creating $ac_file" >&6;}

  # First look for the input files in the build tree, otherwise in the
  # src tree.
  ac_file_inputs=`IFS=:
    for f in $ac_file_in; do
      case $f in
      -) echo $tmp/stdin ;;
      [\\/$]*)
	 # Absolute (can't be DOS-style, as IFS=:)
	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
   { (exit 1); exit 1; }; }
	 # Do quote $f, to prevent DOS paths from being IFS'd.
	 echo "$f";;
      *) # Relative
	 if test -f "$f"; then
	   # Build tree
	   echo "$f"
	 elif test -f "$srcdir/$f"; then
	   # Source tree
	   echo "$srcdir/$f"
	 else
	   # /dev/null tree
	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
   { (exit 1); exit 1; }; }
	 fi;;
      esac
    done` || { (exit 1); exit 1; }
  # Remove the trailing spaces.
  sed 's/[	 ]*$//' $ac_file_inputs >$tmp/in

_ACEOF

# Transform confdefs.h into two sed scripts, `conftest.defines' and
# `conftest.undefs', that substitutes the proper values into
# config.h.in to produce config.h.  The first handles `#define'
# templates, and the second `#undef' templates.
# And first: Protect against being on the right side of a sed subst in
# config.status.  Protect against being in an unquoted here document
# in config.status.
rm -f conftest.defines conftest.undefs
# Using a here document instead of a string reduces the quoting nightmare.
# Putting comments in sed scripts is not portable.
#
# `end' is used to avoid that the second main sed command (meant for
# 0-ary CPP macros) applies to n-ary macro definitions.
# See the Autoconf documentation for `clear'.
cat >confdef2sed.sed <<\_ACEOF
s/[\\&,]/\\&/g
s,[\\$`],\\&,g
t clear
: clear
s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*\)\(([^)]*)\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
t end
s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
: end
_ACEOF
# If some macros were called several times there might be several times
# the same #defines, which is useless.  Nevertheless, we may not want to
# sort them, since we want the *last* AC-DEFINE to be honored.
uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
rm -f confdef2sed.sed

# This sed command replaces #undef with comments.  This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >>conftest.undefs <<\_ACEOF
s,^[	 ]*#[	 ]*undef[	 ][	 ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
_ACEOF

# Break up conftest.defines because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
echo '  if grep "^[	 ]*#[	 ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
echo '  :' >>$CONFIG_STATUS
rm -f conftest.tail
while grep . conftest.defines >/dev/null
do
  # Write a limited-size here document to $tmp/defines.sed.
  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
  # Speed up: don't consider the non `#define' lines.
  echo '/^[	 ]*#[	 ]*define/!b' >>$CONFIG_STATUS
  # Work around the forget-to-reset-the-flag bug.
  echo 't clr' >>$CONFIG_STATUS
  echo ': clr' >>$CONFIG_STATUS
  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
  echo 'CEOF
  sed -f $tmp/defines.sed $tmp/in >$tmp/out
  rm -f $tmp/in
  mv $tmp/out $tmp/in
' >>$CONFIG_STATUS
  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
  rm -f conftest.defines
  mv conftest.tail conftest.defines
done
rm -f conftest.defines
echo '  fi # grep' >>$CONFIG_STATUS
echo >>$CONFIG_STATUS

# Break up conftest.undefs because some shells have a limit on the size
# of here documents, and old seds have small limits too (100 cmds).
echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
rm -f conftest.tail
while grep . conftest.undefs >/dev/null
do
  # Write a limited-size here document to $tmp/undefs.sed.
  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
  # Speed up: don't consider the non `#undef'
  echo '/^[	 ]*#[	 ]*undef/!b' >>$CONFIG_STATUS
  # Work around the forget-to-reset-the-flag bug.
  echo 't clr' >>$CONFIG_STATUS
  echo ': clr' >>$CONFIG_STATUS
  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
  echo 'CEOF
  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
  rm -f $tmp/in
  mv $tmp/out $tmp/in
' >>$CONFIG_STATUS
  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
  rm -f conftest.undefs
  mv conftest.tail conftest.undefs
done
rm -f conftest.undefs

cat >>$CONFIG_STATUS <<\_ACEOF
  # Let's still pretend it is `configure' which instantiates (i.e., don't
  # use $as_me), people would be surprised to read:
  #    /* config.h.  Generated by config.status.  */
  if test x"$ac_file" = x-; then
    echo "/* Generated by configure.  */" >$tmp/config.h
  else
    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
  fi
  cat $tmp/in >>$tmp/config.h
  rm -f $tmp/in
  if test x"$ac_file" != x-; then
    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
echo "$as_me: $ac_file is unchanged" >&6;}
    else
      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$ac_file" : 'X\(//\)[^/]' \| \
	 X"$ac_file" : 'X\(//\)$' \| \
	 X"$ac_file" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
      { if $as_mkdir_p; then
    mkdir -p "$ac_dir"
  else
    as_dir="$ac_dir"
    as_dirs=
    while test ! -d "$as_dir"; do
      as_dirs="$as_dir $as_dirs"
      as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
    done
    test ! -n "$as_dirs" || mkdir $as_dirs
  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
   { (exit 1); exit 1; }; }; }

      rm -f $ac_file
      mv $tmp/config.h $ac_file
    fi
  else
    cat $tmp/config.h
    rm -f $tmp/config.h
  fi
done
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF

#
# CONFIG_COMMANDS section.
#
for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$ac_dest" : 'X\(//\)[^/]' \| \
	 X"$ac_dest" : 'X\(//\)$' \| \
	 X"$ac_dest" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$ac_dest" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
  { if $as_mkdir_p; then
    mkdir -p "$ac_dir"
  else
    as_dir="$ac_dir"
    as_dirs=
    while test ! -d "$as_dir"; do
      as_dirs="$as_dir $as_dirs"
      as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| \
	 .     : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
  	  /^X\(\/\/\)$/{ s//\1/; q; }
  	  /^X\(\/\).*/{ s//\1/; q; }
  	  s/.*/./; q'`
    done
    test ! -n "$as_dirs" || mkdir $as_dirs
  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
   { (exit 1); exit 1; }; }; }

  ac_builddir=.

if test "$ac_dir" != .; then
  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
  # A "../" for each directory in $ac_dir_suffix.
  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
else
  ac_dir_suffix= ac_top_builddir=
fi

case $srcdir in
  .)  # No --srcdir option.  We are building in place.
    ac_srcdir=.
    if test -z "$ac_top_builddir"; then
       ac_top_srcdir=.
    else
       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
    fi ;;
  [\\/]* | ?:[\\/]* )  # Absolute path.
    ac_srcdir=$srcdir$ac_dir_suffix;
    ac_top_srcdir=$srcdir ;;
  *) # Relative path.
    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
    ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac

# Do not use `cd foo && pwd` to compute absolute paths, because
# the directories may not exist.
case `pwd` in
.) ac_abs_builddir="$ac_dir";;
*)
  case "$ac_dir" in
  .) ac_abs_builddir=`pwd`;;
  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
  *) ac_abs_builddir=`pwd`/"$ac_dir";;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_builddir=${ac_top_builddir}.;;
*)
  case ${ac_top_builddir}. in
  .) ac_abs_top_builddir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_srcdir=$ac_srcdir;;
*)
  case $ac_srcdir in
  .) ac_abs_srcdir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
  esac;;
esac
case $ac_abs_builddir in
.) ac_abs_top_srcdir=$ac_top_srcdir;;
*)
  case $ac_top_srcdir in
  .) ac_abs_top_srcdir=$ac_abs_builddir;;
  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
  esac;;
esac


  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
echo "$as_me: executing $ac_dest commands" >&6;}
  case $ac_dest in
    default )
# Only do this when compiling the source, not when reconfiguring
# an installation.
case $reconfiguring in no)
	for header in $CONFIG_HEADERS ; do
		if test "$header" = "runtime/mercury_conf.h"; then
			touch runtime/mercury_conf.h.date
		fi
	done
	# conftest.junk is used to avoid a warning if there
	# are no files in the list passed to chmod
	touch conftest.junk
	chmod +x `echo $CONFIG_FILES | \
		sed -e 's/[^ ]*Mmake.common//' ` conftest.junk
	rm -f conftest.junk

	# The --prefix is hard-coded in the scripts, which are regenerated
	# every time you run configure, and also (unfortunately) in the .so
	# files.  The following rm commands are here to ensure that things
	# will work correctly if you rerun configure with a new --prefix and
	# then don't do a `make clean' before running `make'.
	rm -f runtime/libmer_rt.so library/libmer_std.so bytecode/libmbi.so
	rm -f trace/libmer_trace.so browser/libmer_browse.so
	;;
esac ;;
  esac
done
_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF

{ (exit 0); exit 0; }
_ACEOF
chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save


# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
# Unfortunately, on DOS this fails, as config.log is still kept open
# by configure, so config.status won't be able to write to it; its
# output is simply discarded.  So we exec the FD to /dev/null,
# effectively closing config.log, so it can be properly (re)opened and
# appended to by config.status.  When coming back to configure, we
# need to make the FD available again.
if test "$no_create" != yes; then
  ac_cs_success=:
  ac_config_status_args=
  test "$silent" = yes &&
    ac_config_status_args="$ac_config_status_args --quiet"
  exec 5>/dev/null
  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
  exec 5>>config.log
  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
  # would make configure fail if this is the last instruction.
  $ac_cs_success || { (exit 1); exit 1; }
fi


case "$remake_dependencies.$reconfiguring" in "true.no")
	echo "regenerating dependencies to enable GCC backend
	and/or disable Aditi backend." 1>&6

	MMAKE_DIR=`pwd`/scripts scripts/mmake depend || exit 1
	;;
esac

#-----------------------------------------------------------------------------#
