#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
#
# Copyright (C) 1992-1996, 1998-2012 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 more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
else
  case `(set -o) 2>/dev/null` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi


as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='print -r --'
  as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='printf %s\n'
  as_echo_n='printf %s'
else
  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
    as_echo_n='/usr/ucb/echo -n'
  else
    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
    as_echo_n_body='eval
      arg=$1;
      case $arg in #(
      *"$as_nl"*)
	expr "X$arg" : "X\\(.*\\)$as_nl";
	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
      esac;
      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
    '
    export as_echo_n_body
    as_echo_n='sh -c $as_echo_n_body as_echo'
  fi
  export as_echo_body
  as_echo='sh -c $as_echo_body as_echo'
fi

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  PATH_SEPARATOR=:
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
      PATH_SEPARATOR=';'
  }
fi


# IFS
# We need space, tab and new line, in precisely that order.  Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" ""	$as_nl"

# Find who we are.  Look in the path if we contain no directory separator.
as_myself=
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
IFS=$as_save_IFS

     ;;
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
  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
  exit 1
fi

# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there.  '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '

# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE

# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

# Use a proper internal environment variable to ensure we don't fall
  # into an infinite loop, continuously re-executing ourselves.
  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
    _as_can_reexec=no; export _as_can_reexec;
    # We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
  *v*x* | *x*v* ) as_opts=-vx ;;
  *v* ) as_opts=-v ;;
  *x* ) as_opts=-x ;;
  * ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
as_fn_exit 255
  fi
  # We don't want this to propagate to other subprocesses.
          { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '\${1+\"\$@\"}'='\"\$@\"'
  setopt NO_GLOB_SUBST
else
  case \`(set -o) 2>/dev/null\` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi
"
  as_required="as_fn_return () { (exit \$1); }
as_fn_success () { as_fn_return 0; }
as_fn_failure () { as_fn_return 1; }
as_fn_ret_success () { return 0; }
as_fn_ret_failure () { return 1; }

exitcode=0
as_fn_success || { exitcode=1; echo as_fn_success failed.; }
as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :

else
  exitcode=1; echo positional parameters were not saved.
fi
test x\$exitcode = x0 || exit 1
test -x / || exit 1"
  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
test \$(( 1 + 1 )) = 2 || exit 1"
  if (eval "$as_required") 2>/dev/null; then :
  as_have_required=yes
else
  as_have_required=no
fi
  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :

else
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  as_found=:
  case $as_dir in #(
	 /*)
	   for as_base in sh bash ksh sh5; do
	     # Try only shells that exist, to save several forks.
	     as_shell=$as_dir/$as_base
	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
  CONFIG_SHELL=$as_shell as_have_required=yes
		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
  break 2
fi
fi
	   done;;
       esac
  as_found=false
done
$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
  CONFIG_SHELL=$SHELL as_have_required=yes
fi; }
IFS=$as_save_IFS


      if test "x$CONFIG_SHELL" != x; then :
  export CONFIG_SHELL
             # We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
# Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
case $- in # ((((
  *v*x* | *x*v* ) as_opts=-vx ;;
  *v* ) as_opts=-v ;;
  *x* ) as_opts=-x ;;
  * ) as_opts= ;;
esac
exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
# Admittedly, this is quite paranoid, since all the known shells bail
# out after a failed `exec'.
$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
exit 255
fi

    if test x$as_have_required = xno; then :
  $as_echo "$0: This script requires a shell more modern than all"
  $as_echo "$0: the shells that I found on your system."
  if test x${ZSH_VERSION+set} = xset ; then
    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
  else
    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
$0: including any error possibly output before this
$0: message. Then install a modern shell, or manually run
$0: the script under such a shell if you do have one."
  fi
  exit 1
fi
fi
fi
SHELL=${CONFIG_SHELL-/bin/sh}
export SHELL
# Unset more variables known to interfere with behavior of common tools.
CLICOLOR_FORCE= GREP_OPTIONS=
unset CLICOLOR_FORCE GREP_OPTIONS

## --------------------- ##
## M4sh Shell Functions. ##
## --------------------- ##
# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
  { eval $1=; unset $1;}
}
as_unset=as_fn_unset

# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
  return $1
} # as_fn_set_status

# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
  set +e
  as_fn_set_status $1
  exit $1
} # as_fn_exit

# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{

  case $as_dir in #(
  -*) as_dir=./$as_dir;;
  esac
  test -d "$as_dir" || eval $as_mkdir_p || {
    as_dirs=
    while :; do
      case $as_dir in #(
      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
      *) as_qdir=$as_dir;;
      esac
      as_dirs="'$as_qdir' $as_dirs"
      as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`
      test -d "$as_dir" && break
    done
    test -z "$as_dirs" || eval "mkdir $as_dirs"
  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"


} # as_fn_mkdir_p

# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
  test -f "$1" && test -x "$1"
} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
  eval 'as_fn_append ()
  {
    eval $1+=\$2
  }'
else
  as_fn_append ()
  {
    eval $1=\$$1\$2
  }
fi # as_fn_append

# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
  eval 'as_fn_arith ()
  {
    as_val=$(( $* ))
  }'
else
  as_fn_arith ()
  {
    as_val=`expr "$@" || test $? -eq 1`
  }
fi # as_fn_arith


# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2
  as_fn_exit $as_status
} # as_fn_error

if expr a : '\(a\)' >/dev/null 2>&1 &&
   test "X`expr 00001 : '.*\(...\)'`" = X001; 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

if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
  as_dirname=dirname
else
  as_dirname=false
fi

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

# 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


  as_lineno_1=$LINENO as_lineno_1a=$LINENO
  as_lineno_2=$LINENO as_lineno_2a=$LINENO
  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
  sed -n '
    p
    /[$]LINENO/=
  ' <$as_myself |
    sed '
      s/[$]LINENO.*/&-/
      t lineno
      b
      :lineno
      N
      :loop
      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
      t loop
      s/-\n.*//
    ' >$as_me.lineno &&
  chmod +x "$as_me.lineno" ||
    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }

  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
  # already done that, so ensure we don't try to do so again and fall
  # in an infinite loop.  This has already happened in practice.
  _as_can_reexec=no; export _as_can_reexec
  # 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 sensitive to this).
  . "./$as_me.lineno"
  # Exit status is that of the last command.
  exit
}

ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
  case `echo 'xy\c'` in
  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
  xy)  ECHO_C='\c';;
  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
       ECHO_T='	';;
  esac;;
*)
  ECHO_N='-n';;
esac

rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
  rm -f conf$$.dir/conf$$.file
else
  rm -f conf$$.dir
  mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
  if ln -s conf$$.file conf$$ 2>/dev/null; then
    as_ln_s='ln -s'
    # ... but there are two gotchas:
    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    # In both cases, we have to default to `cp -pR'.
    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
      as_ln_s='cp -pR'
  elif ln conf$$.file conf$$ 2>/dev/null; then
    as_ln_s=ln
  else
    as_ln_s='cp -pR'
  fi
else
  as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null

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

as_test_x='test -x'
as_executable_p=as_fn_executable_p

# 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'"


test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1

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

#
# Initializations.
#
ac_default_prefix=/usr/local
ac_clean_files=
ac_config_libobj_dir=.
LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=

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

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>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif"

ac_subst_vars='LTLIBOBJS
LIBOBJS
STANDARD_MCFLAGS
TESTS_MDB_DOC
TESTS_MDB_INIT_DIR
CSHPATH
DEFAULT_WEB_BROWSER_CMD
WEB_BROWSER
YFLAGS
YACC
LEXLIB
LEX_OUTPUT_ROOT
LEX
INSTALL_METHOD_OPT
HWLOC_STATIC_LIBS
HWLOC_CFLAGS
HWLOC_LIBS
libhwloc_LIBS
libhwloc_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
READLINE_LIBRARIES
TERMCAP_LIBRARY
LDFLAGS_FOR_LTO
CFLAGS_FOR_LTO
LLVM_NM
LLVM_RANLIB
LLVM_AR
GCC_NM
GCC_RANLIB
GCC_AR
USE_LINK_TIME_OPT
USE_MSVCRT
TRACE_BASE_LIBS_SYSTEM
DL_LIBRARY
NSL_LIBRARY
SOCKET_LIBRARY
DEMANGLE
BOOTSTRAP_MC_ARGS
BOOTSTRAP_MC_COMPILER
LDFLAGS_FOR_SANITIZERS
CFLAGS_FOR_SANITIZERS
SHARED_LIBS_SH
SHARED_LIBS
USE_DLLS
TARGET_ENV_TYPE
HOST_ENV_TYPE
EXT_FOR_EXE
EXT_FOR_SHARED_LIB
EXT_FOR_PIC_OBJECTS
CFLAGS_FOR_PIC
SHLIB_INSTALL_NAME_FLAG
SHLIB_USE_INSTALL_NAME
SHLIB_RPATH_SEP
SHLIB_RPATH_OPT
EXE_RPATH_SEP
EXE_RPATH_OPT
ALLOW_UNDEFINED
ERROR_UNDEFINED
LINK_SHARED_OBJ_SH
LINK_SHARED_OBJ
DEFAULT_LINKAGE
LD_STATIC_FLAGS
LINK_EXE
C_COMPILER_TYPE
OPT_FLAGS_FOR_CLANG
MCFLAGS_FOR_CC
CFLAGS_FOR_NO_STRICT_ALIASING
CFLAGS_FOR_DEBUG
CFLAGS_FOR_OPT
CFLAGS_FOR_WARNINGS
SET_MACOSX_DEPLOYMENT_TARGET
AS
HAVE_DELAY_SLOT
NUM_REAL_R_TEMPS
NUM_REAL_R_REGS
LIBGRADE_OPTS
LIBGRADES
GRADE
DEFAULT_GRADE
SYMPREFIX
BOEHM_HAVE_DL_ITERATE_PTR
BOEHM_NO_GETCONTEXT
BOEHM_NEED_ATOMIC_OPS_ASM
BOEHM_CFLAGS_FOR_THREADS
ENABLE_BOEHM_PARALLEL_MARK
ENABLE_BOEHM_THREAD_LOCAL_ALLOC
LD_LIBFLAGS_FOR_THREADS
LDFLAGS_FOR_THREADS
THREAD_LIBS
CFLAGS_FOR_THREADS
CGIDIR
ENABLE_DEEP_PROFILER
HAVE_ASM_LABELS
CFLAGS_FOR_GOTOS
CFLAGS_FOR_REGS
MR_DARWIN_SETJMP_WORKAROUND
MR_BZERO_NEEDS_STRINGS_HEADER
MR_HAVE_SCHED_CPUSET_MACROS
MR_CAN_DO_PENDING_IO
MR_LITTLE_ENDIAN
MR_BIG_ENDIAN
SYNC_TERM_SIZE
HAVE_BOXED_INT64S
MR_LONG_DOUBLE_IS_64_BIT
MR_DOUBLE_IS_64_BIT
MR_FLOAT_IS_64_BIT
HAVE_BOXED_FLOATS
MR_LONG_IS_64_BIT
MR_INT_IS_32_BIT
MR_ROBDD_LOG_BITS_PER_WORD
MR_ROBDD_BITS_PER_WORD
BITS_PER_WORD
BYTES_PER_WORD
LOW_TAG_BITS
MR_UINT_LEAST16_MAX
MR_INT_LEAST16_MAX
MR_INT_LEAST16_TYPE
MR_UINT_LEAST32_MAX
MR_INT_LEAST32_MAX
MR_INT_LEAST32_TYPE
MR_INT_LEAST64_TYPE
MR_ROBDD_int_max
MR_INTEGER_LENGTH_MODIFIER
MR_ROBDD_uint
MR_ROBDD_int
MR_WORD_TYPE
HAVE_GETOPT
JAVAC_FLAGS_FOR_HEAP_SIZE_CONFIG
JAVAC_FLAGS_FOR_HEAP_SIZE_MMAKE
JAR
JAVA_INTERPRETER
JAVAC
CSHARP_DELAYSIGN_FLAG
MS_VISUALCPP_DIR
MS_DOTNET_LIBRARY_VERSION
MS_DOTNET_SDK_DIR
CSHARP_COMPILER_TYPE
CSC
CANDIDATE_CSC
CLI_INTERPRETER
MS_AL
GACUTIL
ILASM
MATH_LIB
MMC_USE_SYMLINKS_OPT
LN_S
FIX_PATH_FOR_WINDOWS
FIX_PATH_FOR_CC
LINK_OPT_SEP
LINK_LIB_SUFFIX
LINK_LIB
LIB_LIBPATH
LIB_PREFIX
LIB_SUFFIX
OBJ_SUFFIX
USING_MICROSOFT_CL_COMPILER
LD_LIBFLAGS_FOR_TRACE
LDFLAGS_FOR_TRACE
STRIP_EXE_STATIC_FLAGS
STRIP_EXE_SHARED_FLAGS
LD_STRIP_FLAG
LD_LIBFLAGS_FOR_DEBUG
LDFLAGS_FOR_DEBUG
AR_LIBFILE_OPT
ARFLAGS
EXEFILE_OPT
OBJFILE_OPT
RANLIBFLAGS
NM
STRIP_EXE
AR
RANLIB
RESTRICTED_COMMAND_LINE_OPT
EGREP
GREP
CPP
ALL_LOCAL_C_LIB_DIR_MMC_OPTS
ALL_LOCAL_C_LIB_DIRS
ALL_LOCAL_C_INCL_DIR_MMC_OPTS
ALL_LOCAL_C_INCL_DIRS
CFLAGS_FOR_NO_INFINITE_RECURSION
CFLAGS_FOR_ERRMSG_FILTER
ENABLE_BOEHM_XOPEN_SOURCE
GCC_PROG
HOSTNAMECMD
PERL
INFO
MAKEINFO
DVIPS
LYNX
PDFTEX
TEXI2DVI
INSTALL_INFO
INSTALL_WINDOWS_SCRIPTS
MKTEMP
MKNOD
MKFIFO
GNU_MAKE
ENABLE_BOEHM_USE_MUNMAP
ENABLE_BOEHM_USE_MMAP
ENABLE_BOEHM_LARGE_CONFIG
BOOTSTRAP_MC
CONFIG_LIBDIR
CONFIG_PREFIX
MMC_INVOKE_CMD
DEFAULT_MERCURY_DEBUGGER_DOC
DEFAULT_MERCURY_DEBUGGER_INIT_DIR
LIBDIR
NONSHARED_LIB_DIR
PREFIX
VERSION
CYGPATHU
CYGPATH
BUILD_C_PROGS_FOR_BUILD_SYSTEM
CROSS_COMPILING
INSTALLABLE_PREFIX
FULLARCH
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
BOEHM_WINDOWS_CPU_TYPE
OBJEXT
EXEEXT
ac_ct_CC
CPPFLAGS
LDFLAGS
CFLAGS
CC
PACKAGE
RECONFIGURE_ARGS
target_alias
host_alias
build_alias
LIBS
ECHO_T
ECHO_N
ECHO_C
DEFS
mandir
localedir
libdir
psdir
pdfdir
dvidir
htmldir
infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
datadir
datarootdir
libexecdir
sbindir
bindir
program_transform_name
prefix
exec_prefix
PACKAGE_URL
PACKAGE_BUGREPORT
PACKAGE_STRING
PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
SHELL'
ac_subst_files='INIT_GRADE_OPTIONS
PARSE_GRADE_OPTIONS
FINAL_GRADE_OPTIONS
PARSE_ML_OPTIONS
CANONICAL_GRADE
MGNUC_FILE_OPTS
CONFIGURE_HELP'
ac_user_opts='
enable_option_checking
with_pkgversion
with_cc
enable_reconfigure
enable_gc_large_config
enable_gc_mmap
enable_gc_munmap
enable_shared_libs
enable_symlinks
with_csharp_compiler
enable_javac_flags_for_heap_size
enable_deep_profiler
with_gc_win32_pthreads
with_llds_base_grade
with_default_grade
enable_inefficient_grades
enable_most_grades
enable_nogc_grades
enable_agc_grades
enable_debug_grades
enable_decl_debug_grades
enable_ssdebug_grades
enable_prof_grades
enable_old_prof_grades
enable_trail_grades
enable_par_grades
enable_mm_grades
enable_mmos_grades
enable_dmm_grades
enable_hlc_prof_grades
enable_hlc_gdb_grades
enable_rbmm_grades
enable_stseg_grades
enable_minimal_install
enable_csharp_grade
enable_java_grade
enable_libgrades
enable_additional_libgrades
with_macosx_deployment_target
enable_sanitizers
enable_extern_debug
enable_dynamic_link
enable_new_mercuryfile_struct
enable_tagged_trail
with_msvcrt
enable_lto
with_readline
with_editline
with_hwloc
with_cp
'
      ac_precious_vars='build_alias
host_alias
target_alias
CC
CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
libhwloc_CFLAGS
libhwloc_LIBS
YACC
YFLAGS'


# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
ac_unrecognized_opts=
ac_unrecognized_sep=
# 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.
# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datarootdir='${prefix}/share'
datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
infodir='${datarootdir}/info'
htmldir='${docdir}'
dvidir='${docdir}'
pdfdir='${docdir}'
psdir='${docdir}'
libdir='${exec_prefix}/lib'
localedir='${datarootdir}/locale'
mandir='${datarootdir}/man'

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

  case $ac_option in
  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
  *=)   ac_optarg= ;;
  *)    ac_optarg=yes ;;
  esac

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

  case $ac_dashdash$ac_option in
  --)
    ac_dashdash=yes ;;

  -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)
    ac_prev=datadir ;;
  -datadir=* | --datadir=* | --datadi=* | --datad=*)
    datadir=$ac_optarg ;;

  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
  | --dataroo | --dataro | --datar)
    ac_prev=datarootdir ;;
  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
    datarootdir=$ac_optarg ;;

  -disable-* | --disable-*)
    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid feature name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"enable_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval enable_$ac_useropt=no ;;

  -docdir | --docdir | --docdi | --doc | --do)
    ac_prev=docdir ;;
  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
    docdir=$ac_optarg ;;

  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
    ac_prev=dvidir ;;
  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
    dvidir=$ac_optarg ;;

  -enable-* | --enable-*)
    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid feature name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"enable_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval enable_$ac_useropt=\$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 ;;

  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
    ac_prev=htmldir ;;
  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
  | --ht=*)
    htmldir=$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 ;;

  -localedir | --localedir | --localedi | --localed | --locale)
    ac_prev=localedir ;;
  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
    localedir=$ac_optarg ;;

  -localstatedir | --localstatedir | --localstatedi | --localstated \
  | --localstate | --localstat | --localsta | --localst | --locals)
    ac_prev=localstatedir ;;
  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
    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 ;;

  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
    ac_prev=pdfdir ;;
  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
    pdfdir=$ac_optarg ;;

  -psdir | --psdir | --psdi | --psd | --ps)
    ac_prev=psdir ;;
  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
    psdir=$ac_optarg ;;

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

  -runstatedir | --runstatedir | --runstatedi | --runstated \
  | --runstate | --runstat | --runsta | --runst | --runs \
  | --run | --ru | --r)
    ac_prev=runstatedir ;;
  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
  | --run=* | --ru=* | --r=*)
    runstatedir=$ac_optarg ;;

  -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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid package name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"with_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval with_$ac_useropt=\$ac_optarg ;;

  -without-* | --without-*)
    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
    # Reject names that are not valid shell variable names.
    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
      as_fn_error $? "invalid package name: $ac_useropt"
    ac_useropt_orig=$ac_useropt
    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
    case $ac_user_opts in
      *"
"with_$ac_useropt"
"*) ;;
      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
	 ac_unrecognized_sep=', ';;
    esac
    eval with_$ac_useropt=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 ;;

  -*) as_fn_error $? "unrecognized option: \`$ac_option'
Try \`$0 --help' for more information"
    ;;

  *=*)
    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
    # Reject names that are not valid shell variable names.
    case $ac_envvar in #(
      '' | [0-9]* | *[!_$as_cr_alnum]* )
      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
    esac
    eval $ac_envvar=\$ac_optarg
    export $ac_envvar ;;

  *)
    # FIXME: should be removed in autoconf 3.0.
    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
      $as_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'`
  as_fn_error $? "missing argument to $ac_option"
fi

if test -n "$ac_unrecognized_opts"; then
  case $enable_option_checking in
    no) ;;
    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
  esac
fi

# Check all directory arguments for consistency.
for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
		datadir sysconfdir sharedstatedir localstatedir includedir \
		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
		libdir localedir mandir runstatedir
do
  eval ac_val=\$$ac_var
  # Remove trailing slashes.
  case $ac_val in
    */ )
      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
      eval $ac_var=\$ac_val;;
  esac
  # Be sure to have absolute directory names.
  case $ac_val in
    [\\/$]* | ?:[\\/]* )  continue;;
    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
  esac
  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
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
  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


ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
  as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
  as_fn_error $? "pwd does not report name of working directory"


# 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 the parent directory.
  ac_confdir=`$as_dirname -- "$as_myself" ||
$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_myself" : 'X\(//\)[^/]' \| \
	 X"$as_myself" : 'X\(//\)$' \| \
	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_myself" |
    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
  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
	pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
  srcdir=.
fi
# Remove unnecessary trailing slashes from srcdir.
# Double slashes in file names in object file debugging info
# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
for ac_var in $ac_precious_vars; do
  eval ac_env_${ac_var}_set=\${${ac_var}+set}
  eval ac_env_${ac_var}_value=\$${ac_var}
  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
  eval ac_cv_env_${ac_var}_value=\$${ac_var}
done

#
# 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 \`..']

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]
  --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]
  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
  --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR]
_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-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]

  --disable-gc-large-config
                          disable large heaps when using conservative GC
  --disable-gc-mmap       use sbrk instead of mmap when using Boehm GC
  --disable-gc-munmap     disable unmapping of unused pages when using Boehm
                          GC
  --disable-shared-libs   do not build shared version of the library even if
                          that is supported
  --enable-symlinks       enable symbolic links. This is the default on all
                          systems except Windows. On Windows you can force
                          symbolic links to be used by giving this option.
                          Note that symbolic links will only work on Windows
                          if you are using the Cygwin version of GCC.
  --enable-javac-flags-for-heap-size
                          enable maximum heap size option for Java compiler
  --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
  --disable-debug-grades  do not install the debugging versions of the library
  --disable-decl-debug-grades
                          do not install the declarative debugging versions of
                          the library
  --enable-ssdebug-grades install the ssdebug versions of the library
  --disable-prof-grades   do not install profiling versions of the library
  --disable-old-prof-grades
                          do not install non-deep 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-mmos-grades    install experimental minimal model own stack
                          versions of the library
  --enable-dmm-grades     install minimal model debug versions of the library
  --enable-hlc-prof-grades
                          install profiling versions of the high level C grade
  --enable-hlc-gdb-grades install a version of the high level C grade that
                          supports debuggers for C
  --enable-rbmm-grades    install experimental region-based memory management
                          versions of the library
  --enable-stseg-grades   install stack segments versions of the library
  --enable-minimal-install
                          install the minimal system required to bootstrap
                          Mercury
  --disable-csharp-grade  do not install the C# grade
  --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.
  --enable-additional-libgrades=...
                          install the given versions of the library in
                          addition to those requested by other options. The
                          versions are specified using a comma-separated list.
  --enable-sanitizers     enable AddressSanitizer and
                          UndefinedBehaviorSanitizer
  --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.
  --disable-tagged-trail  do not use tagged trail entries, even if they are
                          supported.
  --enable-lto            Enable link-time optimization for C grades
                          (experimental)

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-pkgversion=<pkgversion>
                          Specify the package version for version messages.
  --with-cc=<program>     Specify which C compiler to use.
  --with-csharp-compiler=<compiler>
                          Specify which C Sharp compiler to use (default:
                          autodetect)
  --with-gc-win32-pthreads
                          Force the use of pthreads-win32 or winpthreads with
                          Boehm GC. This is the default for MinGW if detected.
  --with-llds-base-grade=<base_grade>
                          Force the use of <base_grade> as the base LLDS
                          grade. <base_grade> must be one of asm_fast, reg or
                          none
  --with-default-grade=GRADE
                          Have the built compiler default to using GRADE
  --with-macosx-deployment-target=<target>
                          Specify the deployment target on Mac OS X.
  --with-msvcrt           use the MS Visual C runtime if using MS C compiler.
  --without-readline      Do not use the GPL GNU readline library
  --without-editline      Do not use the NetBSD editline library (libedit)
  --with-hwloc            Use libhwloc in support of thread pinning
                          (developers only)
  --with-cp               Use the cp command for file copying by the Mercury
                          compiler. The is the default except when using MSVC
                          or on MinGW.

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>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  libhwloc_CFLAGS
              C compiler flags for libhwloc, overriding pkg-config
  libhwloc_LIBS
              linker flags for libhwloc, overriding pkg-config
  YACC        The `Yet Another Compiler Compiler' implementation to use.
              Defaults to the first program found out of: `bison -y', `byacc',
              `yacc'.
  YFLAGS      The list of arguments that will be passed by default to $YACC.
              This script will default YFLAGS to the empty string to avoid a
              default value of `-d' given by some make applications.

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

Report bugs to the package provider.
_ACEOF
ac_status=$?
fi

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

case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
  # A ".." for each directory in $ac_dir_suffix.
  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
  case $ac_top_builddir_sub in
  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
  esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix

case $srcdir in
  .)  # We are building in place.
    ac_srcdir=.
    ac_top_srcdir=$ac_top_builddir_sub
    ac_abs_top_srcdir=$ac_pwd ;;
  [\\/]* | ?:[\\/]* )  # Absolute name.
    ac_srcdir=$srcdir$ac_dir_suffix;
    ac_top_srcdir=$srcdir
    ac_abs_top_srcdir=$srcdir ;;
  *) # Relative name.
    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
    ac_top_srcdir=$ac_top_build_prefix$srcdir
    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix

    cd "$ac_dir" || { ac_status=$?; continue; }
    # Check for guested 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
    else
      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
    fi || ac_status=$?
    cd "$ac_pwd" || { ac_status=$?; break; }
  done
fi

test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
  cat <<\_ACEOF
configure
generated by GNU Autoconf 2.69

Copyright (C) 2012 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
fi

## ------------------------ ##
## Autoconf initialization. ##
## ------------------------ ##

# ac_fn_c_try_compile LINENO
# --------------------------
# Try to compile conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_compile ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  rm -f conftest.$ac_objext
  if { { ac_try="$ac_compile"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compile") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    grep -v '^ *+' conftest.err >conftest.er1
    cat conftest.er1 >&5
    mv -f conftest.er1 conftest.err
  fi
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; } && {
	 test -z "$ac_c_werror_flag" ||
	 test ! -s conftest.err
       } && test -s conftest.$ac_objext; then :
  ac_retval=0
else
  $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

	ac_retval=1
fi
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  as_fn_set_status $ac_retval

} # ac_fn_c_try_compile

# ac_fn_c_try_cpp LINENO
# ----------------------
# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_cpp ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  if { { ac_try="$ac_cpp conftest.$ac_ext"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    grep -v '^ *+' conftest.err >conftest.er1
    cat conftest.er1 >&5
    mv -f conftest.er1 conftest.err
  fi
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; } > conftest.i && {
	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
	 test ! -s conftest.err
       }; then :
  ac_retval=0
else
  $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

    ac_retval=1
fi
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  as_fn_set_status $ac_retval

} # ac_fn_c_try_cpp

# ac_fn_c_try_link LINENO
# -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded.
ac_fn_c_try_link ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  rm -f conftest.$ac_objext conftest$ac_exeext
  if { { ac_try="$ac_link"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_link") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    grep -v '^ *+' conftest.err >conftest.er1
    cat conftest.er1 >&5
    mv -f conftest.er1 conftest.err
  fi
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; } && {
	 test -z "$ac_c_werror_flag" ||
	 test ! -s conftest.err
       } && test -s conftest$ac_exeext && {
	 test "$cross_compiling" = yes ||
	 test -x conftest$ac_exeext
       }; then :
  ac_retval=0
else
  $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

	ac_retval=1
fi
  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
  # interfere with the next link command; also delete a directory that is
  # left behind by Apple's compiler.  We do this before executing the actions.
  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  as_fn_set_status $ac_retval

} # ac_fn_c_try_link

# ac_fn_c_check_func LINENO FUNC VAR
# ----------------------------------
# Tests whether FUNC exists, setting the cache variable VAR accordingly
ac_fn_c_check_func ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
#define $2 innocuous_$2

/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char $2 (); 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 $2

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char $2 ();
/* 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_$2 || defined __stub___$2
choke me
#endif

int
main ()
{
return $2 ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  eval "$3=yes"
else
  eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
fi
eval ac_res=\$$3
	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_func

# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
# ---------------------------------------------
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
# accordingly.
ac_fn_c_check_decl ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  as_decl_name=`echo $2|sed 's/ *(.*//'`
  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if eval \${$3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$4
int
main ()
{
#ifndef $as_decl_name
#ifdef __cplusplus
  (void) $as_decl_use;
#else
  (void) $as_decl_name;
#endif
#endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  eval "$3=yes"
else
  eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_decl

# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
# the include files in INCLUDES and setting the cache variable VAR
# accordingly.
ac_fn_c_check_header_mongrel ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  if eval \${$3+:} false; then :
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
  $as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
else
  # Is the header compilable?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
$as_echo_n "checking $2 usability... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  ac_header_compiler=yes
else
  ac_header_compiler=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
$as_echo "$ac_header_compiler" >&6; }

# Is the header present?
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
$as_echo_n "checking $2 presence... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <$2>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
  ac_header_preproc=yes
else
  ac_header_preproc=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
$as_echo "$ac_header_preproc" >&6; }

# So?  What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
  yes:no: )
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
    ;;
  no:yes:* )
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
    ;;
esac
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  eval "$3=\$ac_header_compiler"
fi
eval ac_res=\$$3
	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_header_mongrel

# ac_fn_c_try_run LINENO
# ----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
# that executables *can* be run.
ac_fn_c_try_run ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  if { { ac_try="$ac_link"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_link") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
  { { case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_try") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; }; then :
  ac_retval=0
else
  $as_echo "$as_me: program exited with status $ac_status" >&5
       $as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

       ac_retval=$ac_status
fi
  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
  as_fn_set_status $ac_retval

} # ac_fn_c_try_run

# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  eval "$3=yes"
else
  eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_header_compile

# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
# variable VAR accordingly.
ac_fn_c_check_type ()
{
  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
if eval \${$3+:} false; then :
  $as_echo_n "(cached) " >&6
else
  eval "$3=no"
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$4
int
main ()
{
if (sizeof ($2))
	 return 0;
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
$4
int
main ()
{
if (sizeof (($2)))
	    return 0;
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

else
  eval "$3=yes"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno

} # ac_fn_c_check_type
cat >config.log <<_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.69.  Invocation command line was

  $ $0 $@

_ACEOF
exec 5>>config.log
{
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`
/usr/bin/hostinfo      = `(/usr/bin/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=.
    $as_echo "PATH: $as_dir"
  done
IFS=$as_save_IFS

} >&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_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=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
    esac
    case $ac_pass in
    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
    2)
      as_fn_append 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
      as_fn_append ac_configure_args " '$ac_arg'"
      ;;
    esac
  done
done
{ ac_configure_args0=; unset ac_configure_args0;}
{ ac_configure_args1=; unset 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: Use '\'' to represent an apostrophe within the trap.
# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
trap 'exit_status=$?
  # Save into config.log some information that might help in debugging.
  {
    echo

    $as_echo "## ---------------- ##
## Cache variables. ##
## ---------------- ##"
    echo
    # The following way of writing the cache mishandles newlines in values,
(
  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
    eval ac_val=\$$ac_var
    case $ac_val in #(
    *${as_nl}*)
      case $ac_var in #(
      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      esac
      case $ac_var in #(
      _ | IFS | as_nl) ;; #(
      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
      *) { eval $ac_var=; unset $ac_var;} ;;
      esac ;;
    esac
  done
  (set) 2>&1 |
    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
    *${as_nl}ac_space=\ *)
      sed -n \
	"s/'\''/'\''\\\\'\'''\''/g;
	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
      ;; #(
    *)
      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
      ;;
    esac |
    sort
)
    echo

    $as_echo "## ----------------- ##
## Output variables. ##
## ----------------- ##"
    echo
    for ac_var in $ac_subst_vars
    do
      eval ac_val=\$$ac_var
      case $ac_val in
      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
      esac
      $as_echo "$ac_var='\''$ac_val'\''"
    done | sort
    echo

    if test -n "$ac_subst_files"; then
      $as_echo "## ------------------- ##
## File substitutions. ##
## ------------------- ##"
      echo
      for ac_var in $ac_subst_files
      do
	eval ac_val=\$$ac_var
	case $ac_val in
	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
	esac
	$as_echo "$ac_var='\''$ac_val'\''"
      done | sort
      echo
    fi

    if test -s confdefs.h; then
      $as_echo "## ----------- ##
## confdefs.h. ##
## ----------- ##"
      echo
      cat confdefs.h
      echo
    fi
    test "$ac_signal" != 0 &&
      $as_echo "$as_me: caught signal $ac_signal"
    $as_echo "$as_me: exit $exit_status"
  } >&5
  rm -f core *.core core.conftest.* &&
    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
    exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0

# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h

$as_echo "/* confdefs.h */" > 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

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


# Let the site file select an alternate cache file if it wants to.
# Prefer an explicitly selected file to automatically selected ones.
ac_site_file1=NONE
ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
  # We do not want a PATH search for config.site.
  case $CONFIG_SITE in #((
    -*)  ac_site_file1=./$CONFIG_SITE;;
    */*) ac_site_file1=$CONFIG_SITE;;
    *)   ac_site_file1=./$CONFIG_SITE;;
  esac
elif test "x$prefix" != xNONE; then
  ac_site_file1=$prefix/share/config.site
  ac_site_file2=$prefix/etc/config.site
else
  ac_site_file1=$ac_default_prefix/share/config.site
  ac_site_file2=$ac_default_prefix/etc/config.site
fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
  test "x$ac_site_file" = xNONE && continue
  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
    sed 's/^/| /' "$ac_site_file" >&5
    . "$ac_site_file" \
      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "failed to load site script $ac_site_file
See \`config.log' for more details" "$LINENO" 5; }
  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.  DJGPP emulates it as a regular file.
  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
    case $cache_file in
      [\\/]* | ?:[\\/]* ) . "$cache_file";;
      *)                      . "./$cache_file";;
    esac
  fi
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_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 $ac_precious_vars; 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,)
      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
      ac_cache_corrupted=: ;;
    ,set)
      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
$as_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
	# differences in whitespace do not lead to failure.
	ac_old_val_w=`echo x $ac_old_val`
	ac_new_val_w=`echo x $ac_new_val`
	if test "$ac_old_val_w" != "$ac_new_val_w"; then
	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
	  ac_cache_corrupted=:
	else
	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
	  eval $ac_var=\$ac_old_val
	fi
	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
      fi;;
  esac
  # Pass precious variables to config.status.
  if test "$ac_new_set" = set; then
    case $ac_new_val in
    *\'*) ac_arg=$ac_var=`$as_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.
      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
    esac
  fi
done
if $ac_cache_corrupted; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
## -------------------- ##
## Main body of script. ##
## -------------------- ##

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}



#-----------------------------------------------------------------------------#
#
# 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.
#

# XXX Currently this is commented out because autoconf 2.60 breaks
# how this works.
#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.
# Strip out any site or system specific configuration files since their
# presence when reconfiguring will result in the command line used to invoke
# configure being invalid.

# 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=*)
                ;;
            *config.site)
                ;;
            *" "*|*"    "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
                # The argument needs to be quoted.
                RECONFIGURE_ARGS="$RECONFIGURE_ARGS '$arg'"
                ;;
            *)
                RECONFIGURE_ARGS="$RECONFIGURE_ARGS $arg"
                ;;
       esac
    fi
done


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

ac_config_headers="$ac_config_headers runtime/mercury_conf.h robdd/robdd_conf.h"

DEFAULT_PREFIX="/usr/local/mercury-`. ./VERSION; echo $VERSION`"


#-----------------------------------------------------------------------------#
#
# Let the user specify an optional package version.
#


# Check whether --with-pkgversion was given.
if test "${with_pkgversion+set}" = set; then :
  withval=$with_pkgversion; PACKAGE="$withval"
else
  PACKAGE=
fi


case "$PACKAGE" in
    yes)
        as_fn_error $? "missing argument to --with-pkgversion=... option" "$LINENO" 5
        exit 1
        ;;
esac
cat >>confdefs.h <<_ACEOF
#define MR_PKGVERSION "$PACKAGE"
_ACEOF



#-----------------------------------------------------------------------------#
#
# Let the user specify which C compiler to use.
#


# Check whether --with-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)
        as_fn_error $? "missing argument to --with-cc=... option" "$LINENO" 5
        exit 1
        ;;
    no)
        as_fn_error $? "invalid option --without-cc" "$LINENO" 5
        exit 1
        ;;
    "")
        ;;
    *)
        CC="$mercury_cv_with_cc"
        ;;
esac

#-----------------------------------------------------------------------------#
#
# Determine what C compiler to use.
#

# The code in config.guess that distinguishes between the i*86 and x86_64
# versions of Darwin needs to use the C compiler to make that distinction.
# In particular, if we wish to build a 32-bit Mercury installation on an
# x86_64 machine, then we need to tell configure that we are using the
# 32-bit C compiler. If we didn't call the AC_PROG_CC macro at this point,
# then configure's --with-cc option would not do that.

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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="${ac_tool_prefix}gcc"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_CC="gcc"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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

  if test "x$ac_ct_CC" = x; then
    CC=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    CC=$ac_ct_CC
  fi
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="${ac_tool_prefix}cc"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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


  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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_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"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
$as_echo "$CC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$CC"; then
  if test -n "$ac_tool_prefix"; then
  for ac_prog in cl.exe
  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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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


    test -n "$CC" && break
  done
fi
if test -z "$CC"; then
  ac_ct_CC=$CC
  for ac_prog in cl.exe
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_CC="$ac_prog"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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


  test -n "$ac_ct_CC" && break
done

  if test "x$ac_ct_CC" = x; then
    CC=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    CC=$ac_ct_CC
  fi
fi

fi


test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "no acceptable C compiler found in \$PATH
See \`config.log' for more details" "$LINENO" 5; }

# Provide some information about the compiler.
$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
set X $ac_compile
ac_compiler=$2
for ac_option in --version -v -V -qversion; do
  { { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    sed '10a\
... rest of stderr output deleted ...
         10q' conftest.err >conftest.er1
    cat conftest.er1 >&5
  fi
  rm -f conftest.er1 conftest.err
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
done

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

int
main ()
{

  ;
  return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files a.out a.out.dSYM 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.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`

# The possible output files:
ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"

ac_rmfiles=
for ac_file in $ac_files
do
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
  esac
done
rm -f $ac_rmfiles

if { { ac_try="$ac_link_default"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_link_default") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; then :
  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile.  We should not override ac_cv_exeext if it was cached,
# so that the user can short-circuit this test for compilers unknown to
# Autoconf.
for ac_file in $ac_files ''
do
  test -f "$ac_file" || continue
  case $ac_file in
    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
	;;
    [ab].out )
	# We found the default executable, but exeext='' is most
	# certainly right.
	break;;
    *.* )
	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
	then :; else
	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
	fi
	# We set ac_cv_exeext here because the later test for it is not
	# safe: cross compilers may not add the suffix if given an `-o'
	# argument, so we may need to know it at that point already.
	# Even if this section looks crufty: it has the advantage of
	# actually working.
	break;;
    * )
	break;;
  esac
done
test "$ac_cv_exeext" = no && ac_cv_exeext=

else
  ac_file=''
fi
if test -z "$ac_file"; then :
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "C compiler cannot create executables
See \`config.log' for more details" "$LINENO" 5; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
$as_echo_n "checking for C compiler default output file name... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext

rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_link") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
	  break;;
    * ) break;;
  esac
done
else
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }

rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <stdio.h>
int
main ()
{
FILE *f = fopen ("conftest.out", "w");
 return ferror (f) || fclose (f) != 0;

  ;
  return 0;
}
_ACEOF
ac_clean_files="$ac_clean_files conftest.out"
# Check that the compiler produces executables we can run.  If not, either
# the compiler is broken, or we cross compile.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
$as_echo_n "checking whether we are cross compiling... " >&6; }
if test "$cross_compiling" != yes; then
  { { ac_try="$ac_link"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_link") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
  if { ac_try='./conftest$ac_cv_exeext'
  { { case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_try") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; }; then
    cross_compiling=no
  else
    if test "$cross_compiling" = maybe; then
	cross_compiling=yes
    else
	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run C compiled programs.
If you meant to cross compile, use \`--host'.
See \`config.log' for more details" "$LINENO" 5; }
    fi
  fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
$as_echo "$cross_compiling" >&6; }

rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if ${ac_cv_objext+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

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

{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot compute suffix of object files: cannot compile
See \`config.log' for more details" "$LINENO" 5; }
fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
$as_echo "$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
if ${ac_cv_c_compiler_gnu+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

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

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  ac_compiler_gnu=yes
else
  ac_compiler_gnu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu

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

int
main ()
{

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  ac_cv_prog_cc_g=yes
else
  CFLAGS=""
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :

else
  ac_c_werror_flag=$ac_save_c_werror_flag
	 CFLAGS="-g"
	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  ac_cv_prog_cc_g=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   ac_c_werror_flag=$ac_save_c_werror_flag
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
$as_echo "$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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
if ${ac_cv_prog_cc_c89+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_cv_prog_cc_c89=no
ac_save_CC=$CC
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <stdarg.h>
#include <stdio.h>
struct stat;
/* 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 -std 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 -std.  */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];

/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
   inside strings and character constants.  */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 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
for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
  CC="$ac_save_CC $ac_arg"
  if ac_fn_c_try_compile "$LINENO"; then :
  ac_cv_prog_cc_c89=$ac_arg
fi
rm -f core conftest.err conftest.$ac_objext
  test "x$ac_cv_prog_cc_c89" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC

fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
  x)
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
$as_echo "none needed" >&6; } ;;
  xno)
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
$as_echo "unsupported" >&6; } ;;
  *)
    CC="$CC $ac_cv_prog_cc_c89"
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
if test "x$ac_cv_prog_cc_c89" != xno; then :

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



# Ensure that AC_CANONICAL_HOST uses the value of CC we just determined.
#
export CC

# NOTE: AC_PROG_CC will set the variable GCC if it thinks the C compiler is
# GCC. However, it also sets it if the C compiler is clang -- because they
# both define __GNUC__ -- do *NOT* use the GCC variable to check the C compiler
# type, instead use the value of C_COMPILER_TYPE (defined below).


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what the C compiler type really is" >&5
$as_echo_n "checking what the C compiler type really is... " >&6; }

# MSVC uses different command line options to most other C compilers.
# Try to determine whether CC is MSVC based on the usage message.
#
$CC 2>&1 | grep "^Microsoft" >/dev/null
if test $? -eq 0
then
    cc_out_opt="-Fe"
    nologo_opt="-nologo"
else
    cc_out_opt="-o "
    nologo_opt=
fi

cat > conftest.c << EOF

#include <stdio.h>

int main(int argc, char **argv)
{
    #if defined(__clang__)
       printf("clang");
    #elif defined(__GNUC__)
       printf("gcc");
    #elif defined(_MSC_VER)
       #if defined(_M_IX86)
          printf("msvc_x86");
       #elif defined(_M_X64)
          printf("msvc_x64");
       #else
          printf("unknown");
       #endif
    #else
       printf("unknown");
    #endif

    return 0;
}
EOF

echo "$CC $nologo_opt ${cc_out_opt}conftest conftest.c" >&5 2>&1
if
    # We direct the output to /dev/null because it appears to be
    # the only way to shut some C compilers up.
    $CC $nologo_opt ${cc_out_opt}conftest conftest.c 2>&1 > /dev/null
then
    if ${mercury_cv_cc_type+:} false; then :
  $as_echo_n "(cached) " >&6
else
  mercury_cv_cc_type=`./conftest`
fi

else
    # This shouldn't happen as we have already checked for this.
    as_fn_error $? "unexpected: $CC cannot create executable" "$LINENO" 5
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_cc_type" >&5
$as_echo "$mercury_cv_cc_type" >&6; }


MERCURY_HAVE_CLANG=no
MERCURY_HAVE_GCC=no
MERCURY_HAVE_MSVC=no

case "$mercury_cv_cc_type" in
    clang)
        MERCURY_HAVE_CLANG=yes



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what the clang version is" >&5
$as_echo_n "checking what the clang version is... " >&6; }

raw_clang_version=$($CC -dumpversion)

# The major version number should always be present.
# For GCC we allow for a suffix after the second or third number that should
# be ignored; it seems prudent to do the same for clang here as well.
mercury_cv_clang_version=`echo "${raw_clang_version%-*}" | tr . ' ' | {
    read -r major minor patchlevel ignore;
    case $major in
	[0-9]*) ;;
	*) major=u ;;
    esac;
    case $minor in
	[0-9]*) ;;
	*) minor=u ;;
    esac;
    case $patchlevel in
	[0-9]*) ;;
	*) patchlevel=u ;;
    esac;
    echo "${major}_${minor}_${patchlevel}";
    }`

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_clang_version" >&5
$as_echo "$mercury_cv_clang_version" >&6; }

        C_COMPILER_TYPE="clang_${mercury_cv_clang_version}"
        ;;

    gcc)
        MERCURY_HAVE_GCC=yes



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what the gcc version is" >&5
$as_echo_n "checking what the gcc version is... " >&6; }

# -dumpfullversion has only been supported since GCC 7; if it is available we
# prefer its output since it is guaranteed to be in the form major.minor.patch.
# (It turns out that mingw32 gcc -dumpfullversion on Debian 12 reports
# "12-win32" anyway.)
raw_gcc_version=$($CC -dumpfullversion 2>/dev/null || $CC -dumpversion)

# The major version number should always be present.
# The minor version number and patchlevel are not always present.
# MinGW-w64 may add a suffix "-win32" or "-posix" that should be ignored.
#
# We use backticks for this command substitution because old versions of
# bash fail to parse this command with $() syntax.
# In particular, MacOS 14 and earlier use bash 3.2 as /bin/sh.
mercury_cv_gcc_version=`echo "${raw_gcc_version%-*}" | tr . ' ' | {
    read -r major minor patchlevel ignore;
    case $major in
	[0-9]*) ;;
	*) major=u ;;
    esac;
    case $minor in
	[0-9]*) ;;
	*) minor=u ;;
    esac;
    case $patchlevel in
	[0-9]*) ;;
	*) patchlevel=u ;;
    esac;
    echo "${major}_${minor}_${patchlevel}";
    }`

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_gcc_version" >&5
$as_echo "$mercury_cv_gcc_version" >&6; }

        C_COMPILER_TYPE="gcc_${mercury_cv_gcc_version}"
        ;;

    msvc_x86|msvc_x64)
        MERCURY_HAVE_MSVC=yes



cat > conftest.c << EOF

#include <stdio.h>

int main(int argc, char **argv)
{

    printf("%d", _MSC_VER);
    return 0;
}
EOF

echo "$CC conftest.c -Fecontest" >&5 2>&1
if
    $CC conftest.c -Feconftest > /dev/null
then
    mercury_cv_msvc_version=`./conftest`
else
    # This shouldn't happen as we have already checked for this.
    as_fn_error $? "unexpected: $CC cannot create executable" "$LINENO" 5
fi

        C_COMPILER_TYPE="${mercury_cv_cc_type}_${mercury_cv_msvc_version}"
        ;;

    *)
        C_COMPILER_TYPE="unknown"
        ;;
esac

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

# Work out what CPU type we need to pass to boehm_gc/NT_MAKEFILE.

case "$mercury_cv_cc_type" in
    msvc_x64) BOEHM_WINDOWS_CPU_TYPE="x64" ;;
    *) BOEHM_WINDOWS_CPU_TYPE="x86" ;;
esac



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

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
  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi

# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.


# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "x$host_alias" = x; then
  ac_cv_host=$ac_cv_build
else
  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac


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"
    if test -d "$PREFIX"
    then
        INSTALLABLE_PREFIX=yes
    else
        INSTALLABLE_PREFIX=no
    fi
else
    PREFIX="$prefix"
    # the directory may be created later
    INSTALLABLE_PREFIX=yes
fi

case "$PREFIX" in
    *\ *)
        as_fn_error $? "cannot install into a directory with a name containing
    spaces: '$PREFIX.'" "$LINENO" 5
        exit 1
        ;;
esac

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

case "$cross_compiling" in
    yes)
        CROSS_COMPILING=yes
        BUILD_C_PROGS_FOR_BUILD_SYSTEM=cc
        HOST_TOOL_PREFIX="$host-"
        ;;
    *)
        CROSS_COMPILING=no
        BUILD_C_PROGS_FOR_BUILD_SYSTEM="$CC"
        HOST_TOOL_PREFIX=
        ;;
esac




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

# Versions of Xcode 11 up until 11.4 ship with a broken version of clang.
# NOTE: what we are checking for below is Apple version for clang, Xcode 11.4
# has Apple clang version 11.0.3.

if test "$MERCURY_HAVE_CLANG" = yes
then
    case "$host" in *apple*darwin*)
        $CC -v 2>&1 | grep Apple | {
            read apple llvm version versionnum rest
            case $versionnum in 11.0.[012])
               { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
**** Note that this version of Xcode 11 has bugs that prevent Mercury programs
**** from working correctly.  Please use Xcode 11.4 or later.
**** See README.MacOS for further details." >&5
$as_echo "$as_me: WARNING:
**** Note that this version of Xcode 11 has bugs that prevent Mercury programs
**** from working correctly.  Please use Xcode 11.4 or later.
**** See README.MacOS for further details." >&2;}
            ;;
            esac }
         ;;
    esac
fi

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

# Ensure that the user does not try to build MSYS executables; we do not
# (currently) support that.

case "$host" in *-pc-msys)
    as_fn_error $? "
***** The $host architecture is not supported.
***** You probably meant to use one of: x86_64-pc-mingw32, x86_64-pc-mingw64." "$LINENO" 5
    ;;
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CYGPATH+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATH="cygpath -m"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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


# Extract the first word of "cygpath", so it can be a program name with args.
set dummy cygpath; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CYGPATHU+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$CYGPATHU"; then
  ac_cv_prog_CYGPATHU="$CYGPATHU" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_CYGPATHU="cygpath -u"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  test -z "$ac_cv_prog_CYGPATHU" && ac_cv_prog_CYGPATHU="echo"
fi
fi
CYGPATHU=$ac_cv_prog_CYGPATHU
if test -n "$CYGPATHU"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATHU" >&5
$as_echo "$CYGPATHU" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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

DEFAULT_MERCURY_DEBUGGER_DOC=$DEFAULT_MERCURY_DEBUGGER_INIT_DIR/mdb_doc


#-----------------------------------------------------------------------------#
# MMC_INVOKE_CMD is the command used to invoke mercury_compile in scripts/mmc.
# On MSYS (MinGW) we cannot use exec, since exec will not find the file because
# it will expect a path relative to the MSYS home directory and will not work
# with a full Windows path. A full Windows path, however must be used for the
# prefix so that mercury_compile will find the standard library.
#
case "$host" in
    *mingw*)
        MMC_INVOKE_CMD=
        ;;
    *)  MMC_INVOKE_CMD=exec
        ;;
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 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)
        as_fn_error $? "missing argument to --enable-reconfigure=... option" "$LINENO" 5
        exit 1
        ;;
    no)
        as_fn_error $? "invalid option --no-enable-reconfigure" "$LINENO" 5
        exit 1
        ;;
esac
CONFIG_PREFIX="`$CYGPATH $CONFIG_PREFIX`"
CONFIG_LIBDIR="`$CYGPATH $CONFIG_LIBDIR`"


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

case "$build" in
    i*86-*-solaris2.*)  link_static_opt= ;;
    *solaris2.10)       link_static_opt= ;;
    *apple*darwin*)     link_static_opt= ;;
    *linux*)            link_static_opt= ;;
    *cygwin*)           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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_BOOTSTRAP_MC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_BOOTSTRAP_MC="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
BOOTSTRAP_MC=$ac_cv_path_BOOTSTRAP_MC
if test -n "$BOOTSTRAP_MC"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOTSTRAP_MC" >&5
$as_echo "$BOOTSTRAP_MC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


# Ignore the Microsoft Management Console, which if executed will pop up with
# an annoying error message.
case $BOOTSTRAP_MC in
    *Windows*|*system32*|*WINNT*)
        BOOTSTRAP_MC=
        echo "ignoring Microsoft Management Console" 1>&6
        ;;
esac

DETECTED_MC="$BOOTSTRAP_MC"
if test "$BOOTSTRAP_MC" != ""
then
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the above mmc works and is sufficiently recent" >&5
$as_echo_n "checking whether the above mmc works and is sufficiently recent... " >&6; }
    cat > conftest.m << EOF
        % This module contains features which did not 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 bool, char, string, int, list, uint32, univ.

        :- mutable(global_var,
            int,
            561,
            ground,
            [untrailed, attach_to_io_state, thread_local]
        ).

        :- type abs_enum ---> yes ; no.
        :- type abs_enum where type_is_abstract_enum(1).

        main(!IO) :-
            return_rtti_version(Version),
            p(T),
            q(T, _),
            get_global_var(Global, !IO),
            (
                % If you change the minimum RTTI version, you also
                % need to update the Mercury clause for return_rtti_version
                % below.
                Version >= 8,
                ac(2) ^ elem(3, 5) = 17,
                (1 .. 2) = [1, 2],
                Global = 561
            ->
                trace [io(!S)] (
                    io.print("Hello, ", !S)
                ),
                promise_pure (
                    semipure io.unsafe_get_io_state(UIO0),
                    io.print("world\n", UIO0, UIO),
                    impure io.unsafe_set_io_state(UIO)
                )
            ;
                Words = string.words_separator(char.is_alpha, "xx yy"),
                io.write(Words, !IO)
            ).

        :- type t    ---> a ; b ; c(int).

        :- type bear ---> brown ; black ; teddy.
        :- pragma foreign_export_enum("Java", bear/0).

        :- pred check_int64(int64::out) is det.
        :- pragma no_inline(pred(check_int64/1)).

        check_int64(561i64).

        :- pred my_uint_xor(uint32::in, uint32::out) is det.

        my_uint_xor(A, B) :-
            disable_warning [unknown_format_calls] (
                561u32 = uint32.xor(A, B)
            ).

        :- pred p(t::out) is det.

        p(b).

        :- pred q(t::in, int::out) is det.
        :- pragma obsolete(q/2, [p/1]).

        q(T, N) :-
            (
                T = a : t,
                N = 0 : int
            ;
                ( T = b ; T = c(_) ),
                N = 1
            ).

        :- 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_decl("C", local, "
        typedef enum {
            enum1, enum2
        } Enum;
        ").

        :- type c_enum
            --->    c_enum_1
            ;       c_enum_2.

        :- pragma foreign_enum("C", c_enum/0, [
            c_enum_1 - "enum1",
            c_enum_2 - "enum2"
        ]).

        :- type x ---> x.
        :- pragma foreign_type("C", x, "MR_Integer",
            [can_pass_as_mercury_type, stable]).
        :- pragma foreign_type("C#", x, "object").

        :- pragma foreign_proc("C", return_rtti_version(Version::out),
            [may_call_mercury, promise_pure, terminates,
              does_not_affect_liveness, will_not_modify_trail],
        "
            Version = MR_RTTI_VERSION;
        ").

        % XXX the non-C backends do not currently define an equivalent
        % to MR_RTTI_VERSION.
        return_rtti_version(8).

        % The code below is the hard_coded/disjs_in_switch test case.
        % The compiler now depends on the installed compiler handling
        % code like this test case correctly.

        :- type tp
            --->    f(int)
            ;       g(int, int)
            ;       h(float)
            ;       i(string).

        :- pred p(tp::in, string::out) is det.
        :- pragma require_switch_arms_in_type_order(pred(p/2)).

        p(T, U) :-
            (
                ( T = f(_)
                ; T = g(_, _)
                ),
                disable_warning [suspicious_recursion] (
                    U = "f or g"
                )
            ;
                ( T = h(_)
                ; T = i(_)
                ),
                U = "h or i"
            ).

        :- pred ext(int::out) is det.
        :- pragma external_pred(ext/1).

        :- type psv_t
            --->    psv_t1
            ;       psv_t2
            ;       psv_t3
            ;       psv_t4
            ;       psv_t5
            ;       psv_t6
            ;       psv_t7
            ;       psv_t8.

        :- type psv_u
            --->    psv_u1
            ;       psv_u2.

        :- pred preferred_switch_var(psv_t::in, psv_u::in, int::out)
            is semidet.

        preferred_switch_var(T, U, N) :-
            require_switch_arms_semidet [T]
            (
                T = psv_t1,
                U = psv_u1,
                N = 11
            ;
                T = psv_t2,
                U = psv_u2,
                N = 22
            ;
                T = psv_t3,
                U = psv_u1,
                N = 31
            ;
                T = psv_t4,
                U = psv_u2,
                N = 42
            ).
EOF

    # When this script has been invoked with --prefix=..., these variables
    # will have values by the time we get here, but the values will be the
    # ones appropriate to the system *we will install*, not the system that is
    # *already installed*, i.e. the bootstrap compiler. If we don't temporarily
    # unset these variables, the bootstrap test will fail because the Mercury
    # compiler won't find the (to-be-installed-later) .int files for the
    # standard library modules it needs.
    SAVE_MERCURY_CONFIG_DIR="${MERCURY_CONFIG_DIR}"
    SAVE_MERCURY_DEFAULT_GRADE="${MERCURY_DEFAULT_GRADE}"
    SAVE_MERCURY_STDLIB_DIR="${MERCURY_STDLIB_DIR}"
    unset MERCURY_CONFIG_DIR
    unset MERCURY_DEFAULT_GRADE
    unset MERCURY_STDLIB_DIR

    if
        echo $BOOTSTRAP_MC conftest >&5 2>&1 &&
        $BOOTSTRAP_MC \
            --verbose \
            $link_static_opt conftest \
            --inrange-2025-10-01 \
            --warn-include-and-non-include \
            --allow-ho-insts-as-modes \
            --no-ssdb \
            </dev/null >&5 2>&1 &&
        test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" &&
        $BOOTSTRAP_MC \
            --grade none.gc \
            --warn-potentially-ambiguous-pragma \
            --no-detect-libgrades \
            --output-grade-string \
            --shlib-linker-install-name-flag "-dummy_flag" \
            --ranlib-flags "" \
            </dev/null >&5 2>&1
    then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
    else
        BOOTSTRAP_MC=
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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/mercury_compile.c ||
            test -f compiler/Mercury/cs/mercury_compile.c
        then
            true
        elif
            test -f $PREFIX/bin/mercury_compile ||
            test -f $PREFIX/bin/mercury_compile.exe
        then
            # This variable is used to let the tests in the following section
            # know that we are going to attempt to bootstrap with the compiler
            # $PREFIX/bin.
            bootstrap_from_prefix="yes"
            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using $PREFIX/bin/mercury_compile to bootstrap" >&5
$as_echo "$as_me: WARNING: using $PREFIX/bin/mercury_compile to bootstrap" >&2;}
        else
            as_fn_error $? "You need a working Mercury compiler to bootstrap with" "$LINENO" 5
        fi
    fi
    rm -f conftest*

    export MERCURY_CONFIG_DIR="${SAVE_MERCURY_CONFIG_DIR}"
    export MERCURY_DEFAULT_GRADE="${SAVE_MERCURY_DEFAULT_GRADE}"
    export MERCURY_STDLIB_DIR="${SAVE_MERCURY_STDLIB_DIR}"
fi

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

if test "$BOOTSTRAP_MC" = ""
then
    # If we do not have a working bootstrap Mercury compiler, then work out
    # whether any .c files we do have were compiled with high level code or
    # not. At this point we only check a single file -- this is enough to
    # allow us to determine a value for BOOTSTRAP_GRADE below -- we check
    # any other pre-generated .c files as part of the call to
    # mercury_check_c_files() later on.
    #
    if test -f compiler/mercury_compile.c
    then
        highlevel_code=`grep "HIGHLEVEL_CODE=.*" compiler/mercury_compile.c`
    else
        if test -f compiler/Mercury/cs/mercury_compile.c
        then
            highlevel_code=`grep "HIGHLEVEL_CODE=.*" compiler/Mercury/cs/mercury_compile.c`
        else
            # If we are going to attempt to bootstrap from a compiler in
            # $PREFIX/bin (see the above section), then it is ok if we do not
            # have any pre-generated .c files; if not, then we cannot continue.
            #
            if test "$bootstrap_from_prefix" != "yes"
            then
                as_fn_error $? "You need a working Mercury compiler to bootstrap with" "$LINENO" 5
            fi
        fi
    fi

    case "$highlevel_code" in

        *yes)
            BOOTSTRAP_HLC="yes"
            ;;

        *no)
            BOOTSTRAP_HLC="no"
            ;;

        "")
            # This corresponds to the case where we compile using
            # $PREFIX/bin/mercury_compile. Since we can (hopefully)
            # regenerate any .c files, it is irrelevant whether we used
            # --highlevel-code or not when compiling any existing ones.
            ;;

        *)
            as_fn_error $? "Cannot determine what code model pre-generated .c files use." "$LINENO" 5
            ;;
    esac
fi

#-----------------------------------------------------------------------------#
#
# Determine whether to define LARGE_CONFIG when compiling boehm_gc.
#

# Check whether --enable-gc-large-config was given.
if test "${enable_gc_large_config+set}" = set; then :
  enableval=$enable_gc_large_config; enable_gc_large_config="$enableval"
else
  enable_gc_large_config=yes
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable large heaps when using conservative GC" >&5
$as_echo_n "checking whether to enable large heaps when using conservative GC... " >&6; }
case "$enable_gc_large_config" in
    yes)
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        ENABLE_BOEHM_LARGE_CONFIG=-DLARGE_CONFIG
        ;;
    no)
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        ENABLE_BOEHM_LARGE_CONFIG=
        ;;
    *)
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unexpected argument to --enable-gc-large-config" >&5
$as_echo "$as_me: WARNING: unexpected argument to --enable-gc-large-config" >&2;}
        ENABLE_BOEHM_LARGE_CONFIG=-DLARGE_CONFIG
        ;;
esac


#-----------------------------------------------------------------------------#
#
# Determine whether to define USE_MMAP, USE_MUNMAP when compiling boehm_gc.
#

# Check whether --enable-gc-mmap was given.
if test "${enable_gc_mmap+set}" = set; then :
  enableval=$enable_gc_mmap; enable_gc_mmap="$enableval"
else
  enable_gc_mmap=yes
fi


# Check whether --enable-gc-munmap was given.
if test "${enable_gc_munmap+set}" = set; then :
  enableval=$enable_gc_munmap; enable_gc_munmap="$enableval"
else
  enable_gc_munmap=yes
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable unmapping of unused pages when using Boehm GC" >&5
$as_echo_n "checking whether to enable unmapping of unused pages when using Boehm GC... " >&6; }
case "$enable_gc_munmap" in
    yes)
        # --enable-gc-munmap implies --enable-gc-mmap
        enable_gc_mmap=yes
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        ;;
    no)
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        ;;
    *)
        as_fn_error $? "unexpected argument to --enable-gc-munmap" "$LINENO" 5
        ;;
esac

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use mmap for Boehm GC" >&5
$as_echo_n "checking whether to use mmap for Boehm GC... " >&6; }
case "$enable_gc_mmap" in
    yes|no)
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_gc_mmap" >&5
$as_echo "$enable_gc_mmap" >&6; }
        ;;
    *)
        as_fn_error $? "unexpected argument to --enable-gc-mmap" "$LINENO" 5
        ;;
esac

if test "$enable_gc_mmap" = yes; then
    ENABLE_BOEHM_USE_MMAP="-DUSE_MMAP"
else
    ENABLE_BOEHM_USE_MMAP=
fi
if test "$enable_gc_munmap" = yes; then
    ENABLE_BOEHM_USE_MUNMAP="-DUSE_MUNMAP"
else
    ENABLE_BOEHM_USE_MUNMAP=
fi



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

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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GNU_MAKE+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_GNU_MAKE="$ac_prog"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
GNU_MAKE=$ac_cv_prog_GNU_MAKE
if test -n "$GNU_MAKE"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNU_MAKE" >&5
$as_echo "$GNU_MAKE" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
    as_fn_error $? "cannot find GNU Make" "$LINENO" 5
    exit 1
else
    echo "found GNU Make: $GNU_MAKE" 1>&6
fi


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

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

# Neither mkfifo or mknod exist in a working state on MinGW, so on that
# platform we skip the following tests in order to avoid emitting extra
# warnings.
#
case "$host" in
    *mingw*)
        echo "named pipes not available for MinGW" 1>&6
        cat >>confdefs.h <<_ACEOF
#define MR_MKFIFO ""
_ACEOF

        MKFIFO=none
        MKNOD=""
    ;;

    *)

        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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MKFIFO+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MKFIFO="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
MKFIFO=$ac_cv_path_MKFIFO
if test -n "$MKFIFO"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKFIFO" >&5
$as_echo "$MKFIFO" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MKNOD+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MKNOD="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
MKNOD=$ac_cv_path_MKNOD
if test -n "$MKNOD"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKNOD" >&5
$as_echo "$MKNOD" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find a working 'mkfifo' or 'mknod'" >&5
$as_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

        PATH="$save_PATH"
    ;;
esac


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


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

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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MKTEMP+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MKTEMP="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
MKTEMP=$ac_cv_path_MKTEMP
if test -n "$MKTEMP"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKTEMP" >&5
$as_echo "$MKTEMP" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find a working 'mktemp'" >&5
$as_echo "$as_me: WARNING: cannot find a working 'mktemp'" >&2;}
    MKTEMP=""
fi


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

# Determine if we should install Windows-specific files such as the batch
# files. We only do this where there is a chance they can be useful.

INSTALL_WINDOWS_SCRIPTS=no
case "$host" in
    *mingw*)
        INSTALL_WINDOWS_SCRIPTS=yes
        ;;
    *)
        if test "$ac_microsoft" = "yes"
        then
            INSTALL_WINDOWS_SCRIPTS=yes
        else
            INSTALL_WINDOWS_SCRIPTS=no
        fi
        ;;
esac


#-----------------------------------------------------------------------------#
# Extract the first word of "install-info", so it can be a program name with args.
set dummy install-info; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_INSTALL_INFO+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
INSTALL_INFO=$ac_cv_path_INSTALL_INFO
if test -n "$INSTALL_INFO"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_INFO" >&5
$as_echo "$INSTALL_INFO" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "texi2dvi", so it can be a program name with args.
set dummy texi2dvi; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_TEXI2DVI+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_TEXI2DVI="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
TEXI2DVI=$ac_cv_path_TEXI2DVI
if test -n "$TEXI2DVI"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TEXI2DVI" >&5
$as_echo "$TEXI2DVI" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "pdftex", so it can be a program name with args.
set dummy pdftex; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PDFTEX+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $PDFTEX in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_PDFTEX="$PDFTEX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_PDFTEX="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
PDFTEX=$ac_cv_path_PDFTEX
if test -n "$PDFTEX"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PDFTEX" >&5
$as_echo "$PDFTEX" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "lynx", so it can be a program name with args.
set dummy lynx; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_LYNX+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_LYNX="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
LYNX=$ac_cv_path_LYNX
if test -n "$LYNX"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LYNX" >&5
$as_echo "$LYNX" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "dvips", so it can be a program name with args.
set dummy dvips; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_DVIPS+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_DVIPS="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
DVIPS=$ac_cv_path_DVIPS
if test -n "$DVIPS"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DVIPS" >&5
$as_echo "$DVIPS" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "makeinfo", so it can be a program name with args.
set dummy makeinfo; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MAKEINFO+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MAKEINFO="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
MAKEINFO=$ac_cv_path_MAKEINFO
if test -n "$MAKEINFO"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKEINFO" >&5
$as_echo "$MAKEINFO" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "info", so it can be a program name with args.
set dummy info; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_INFO+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_INFO="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
INFO=$ac_cv_path_INFO
if test -n "$INFO"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INFO" >&5
$as_echo "$INFO" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



#-----------------------------------------------------------------------------#
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PERL+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
PERL=$ac_cv_path_PERL
if test -n "$PERL"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
$as_echo "$PERL" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_HOSTNAMECMD+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_HOSTNAMECMD="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
HOSTNAMECMD=$ac_cv_path_HOSTNAMECMD
if test -n "$HOSTNAMECMD"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOSTNAMECMD" >&5
$as_echo "$HOSTNAMECMD" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


case "$HOSTNAMECMD" in
    *hostname)
        # OS X uses BSD's hostname command which outputs
        # the fully qualified domain name by default. It
        # doesn't have a `-f' flag.
        # XXX We should probably check that the user isn't
        # using GNU's hostname on OS X instead.
        case "$host" in
            *apple*darwin*)
                HOSTNAMECMD="$HOSTNAMECMD"
                ;;
            *)
                HOSTNAMECMD="$HOSTNAMECMD -f"
                ;;
        esac
        ;;
esac
cat >>confdefs.h <<_ACEOF
#define MR_HOSTNAMECMD "$HOSTNAMECMD"
_ACEOF

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



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler needs -no-cpp-precomp" >&5
$as_echo_n "checking whether C compiler needs -no-cpp-precomp... " >&6; }
if ${mercury_cv_cpp_precomp+:} false; then :
  $as_echo_n "(cached) " >&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

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


if test "$MERCURY_HAVE_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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_GCC_PROG+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_GCC_PROG="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
GCC_PROG=$ac_cv_path_GCC_PROG
if test -n "$GCC_PROG"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_PROG" >&5
$as_echo "$GCC_PROG" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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 need to define _XOPEN_SOURCE when building boehm on Darwin 10
# so that we don't get errors about the functions in ucontext.h being
# deprecated.
case "$host" in
    *apple*darwin*10*)
        ENABLE_BOEHM_XOPEN_SOURCE="-D_XOPEN_SOURCE"
        ;;
    *)
        ENABLE_BOEHM_XOPEN_SOURCE=
        ;;
esac


# 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 are generating a new configuration for an existing installation.
        CPPFLAGS="-I$PREFIX/lib/mercury/inc $CPPFLAGS"
        ;;
esac

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

# Test whether specific command line options are supported by the C compiler.
# We do this by attempting to compile a program with the option whose presence
# we are testing for. This will not work for MSVC since it prints a warning
# about any unknown options and then proceeds as normal. There is no way to
# tell it to treat that warning as an error (in particular, this warning is not
# affected by the -WX option).

if test "$MERCURY_HAVE_MSVC" = "yes"
then

    CFLAGS_FOR_ERRMSG_FILTER=""
    CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS=
    CFLAGS_FOR_NO_REORDER_FUNCTIONS=""
    CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS=
    CFLAGS_FOR_NO_INFINITE_RECURSION=

else

cat > conftest.c << EOF
    struct MR_TypeInfo_Almost_Struct {
        int MR_almost;
    };

    struct MR_TypeCtorInfo_Struct {
        int MR_tci1;
        int MR_tci2;
    };

    typedef struct MR_TypeCtorInfo_Struct       *MR_TypeCtorInfo;
    typedef const struct MR_TypeInfo_Almost_Struct  *MR_TypeInfo;

    struct MR_FA_TypeInfo_Struct1 {
        MR_TypeCtorInfo MR_ti_type_ctor_info;
        MR_TypeInfo MR_ti_fixed_arity_arg_typeinfos1;
    };

    extern  const struct MR_FA_TypeInfo_Struct1 ML_type_ctor_info;

    MR_TypeInfo
    f(void)
    {
        MR_TypeInfo x;

        x = (MR_TypeInfo) &ML_type_ctor_info;
        return x;
    }
EOF

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can make error messages filterable" >&5
$as_echo_n "checking whether we can make error messages filterable... " >&6; }
    if $CC -ftrack-macro-expansion=0 -fno-diagnostics-show-caret -c conftest.c \
        </dev/null >&5 2>&1
    then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        CFLAGS_FOR_ERRMSG_FILTER="-ftrack-macro-expansion=0 -fno-diagnostics-show-caret"
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        CFLAGS_FOR_ERRMSG_FILTER=""
    fi

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use -fno-move-loop-invariants" >&5
$as_echo_n "checking whether we can use -fno-move-loop-invariants... " >&6; }
    if $CC -fno-move-loop-invariants -c conftest.c \
        </dev/null >&5 2>&1
    then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS="-fno-move-loop-invariants"
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS=
    fi

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use -fno-reorder-functions" >&5
$as_echo_n "checking whether we can use -fno-reorder-functions... " >&6; }
    if $CC -fno-reorder-functions -c conftest.c \
        </dev/null >&5 2>&1
    then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        CFLAGS_FOR_NO_REORDER_FUNCTIONS="-fno-reorder-functions"
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        CFLAGS_FOR_NO_REORDER_FUNCTIONS=""
    fi

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use -fno-tree-dominator-opts" >&5
$as_echo_n "checking whether we can use -fno-tree-dominator-opts... " >&6; }
    if $CC -fno-tree-dominator-opts -c conftest.c \
        </dev/null >&5 2>&1
    then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS="-fno-tree-dominator-opts"
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS=
    fi

    rm -f conftest*

    # We need to disable the infinite recursion warning in GCC 12 and later
    # when running some of the tests in tests/valid. The tests will fail
    # otherwise since we also enable -Werror.
    case "$C_COMPILER_TYPE" in
        gcc_1[2-9]_*)
            CFLAGS_FOR_NO_INFINITE_RECURSION="-Wno-infinite-recursion"
            ;;
        *)
            CFLAGS_FOR_NO_INFINITE_RECURSION=
            ;;
    esac

fi



#-----------------------------------------------------------------------------#
# 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.


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to pass -I/usr/local/include to C compiler" >&5
$as_echo_n "checking whether to pass -I/usr/local/include to C compiler... " >&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.
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
else
	# It is 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
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "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
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
	fi
fi



CPPFLAGS="$ALL_LOCAL_C_INCL_DIRS $CPPFLAGS"

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to pass -L/usr/local/lib to the linker" >&5
$as_echo_n "checking whether to pass -L/usr/local/lib to the linker... " >&6; }

# Microsoft compilers don't understand Unix pathnames.
if test "$USING_MICROSOFT_CL_COMPILER" = no -a -d /usr/local/lib/.; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "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
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
$as_echo_n "checking how to run the C preprocessor... " >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
  if ${ac_cv_prog_CPP+:} false; then :
  $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
		     Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :

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

  # OK, works on sane cases.  Now check whether nonexistent headers
  # can be detected and how.
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <ac_nonexistent.h>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
  # Broken: success on invalid input.
continue
else
  # Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext

done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.i 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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
$as_echo "$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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
		     Syntax error
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :

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

  # OK, works on sane cases.  Now check whether nonexistent headers
  # can be detected and how.
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <ac_nonexistent.h>
_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
  # Broken: success on invalid input.
continue
else
  # Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.i conftest.$ac_ext

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

else
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
See \`config.log' for more details" "$LINENO" 5; }
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


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
if ${ac_cv_path_GREP+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -z "$GREP"; then
  ac_path_GREP_found=false
  # Loop through the user's path and test for each of PROGNAME-LIST
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_prog in grep ggrep; do
    for ac_exec_ext in '' $ac_executable_extensions; do
      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
      as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
  # Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
  ac_count=0
  $as_echo_n 0123456789 >"conftest.in"
  while :
  do
    cat "conftest.in" "conftest.in" >"conftest.tmp"
    mv "conftest.tmp" "conftest.in"
    cp "conftest.in" "conftest.nl"
    $as_echo 'GREP' >> "conftest.nl"
    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
    as_fn_arith $ac_count + 1 && ac_count=$as_val
    if test $ac_count -gt ${ac_path_GREP_max-0}; then
      # Best one so far, save it but keep looking for a better one
      ac_cv_path_GREP="$ac_path_GREP"
      ac_path_GREP_max=$ac_count
    fi
    # 10*(2^10) chars as input seems more than enough
    test $ac_count -gt 10 && break
  done
  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac

      $ac_path_GREP_found && break 3
    done
  done
  done
IFS=$as_save_IFS
  if test -z "$ac_cv_path_GREP"; then
    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
  fi
else
  ac_cv_path_GREP=$GREP
fi

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
$as_echo "$ac_cv_path_GREP" >&6; }
 GREP="$ac_cv_path_GREP"


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
if ${ac_cv_path_EGREP+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
   then ac_cv_path_EGREP="$GREP -E"
   else
     if test -z "$EGREP"; then
  ac_path_EGREP_found=false
  # Loop through the user's path and test for each of PROGNAME-LIST
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
    for ac_prog in egrep; do
    for ac_exec_ext in '' $ac_executable_extensions; do
      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
      as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
  # Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
  ac_count=0
  $as_echo_n 0123456789 >"conftest.in"
  while :
  do
    cat "conftest.in" "conftest.in" >"conftest.tmp"
    mv "conftest.tmp" "conftest.in"
    cp "conftest.in" "conftest.nl"
    $as_echo 'EGREP' >> "conftest.nl"
    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
    as_fn_arith $ac_count + 1 && ac_count=$as_val
    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
      # Best one so far, save it but keep looking for a better one
      ac_cv_path_EGREP="$ac_path_EGREP"
      ac_path_EGREP_max=$ac_count
    fi
    # 10*(2^10) chars as input seems more than enough
    test $ac_count -gt 10 && break
  done
  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac

      $ac_path_EGREP_found && break 3
    done
  done
  done
IFS=$as_save_IFS
  if test -z "$ac_cv_path_EGREP"; then
    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
  fi
else
  ac_cv_path_EGREP=$EGREP
fi

   fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
 EGREP="$ac_cv_path_EGREP"


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for use of a Microsoft C compiler" >&5
$as_echo_n "checking for use of a Microsoft C compiler... " >&6; }


cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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
else
  ac_microsoft=no

fi
rm -f conftest*


if test "$ac_microsoft" = "yes"
then
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

# Determine if we are on a system which has a restricted command line length.
# This is true if we are building under mingw or using the MS C compiler.
RESTRICTED_COMMAND_LINE_OPT=
case "$host" in
    *mingw*)
        RESTRICTED_COMMAND_LINE_OPT=--restricted-command-line
        ;;
    *)
        if test "$ac_microsoft" = "yes"
        then
            RESTRICTED_COMMAND_LINE_OPT=--restricted-command-line
        else
            RESTRICTED_COMMAND_LINE_OPT=
        fi
        ;;
esac


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"
    EXEFILE_OPT="-Fe"
    AR="lib"
    ARFLAGS="-nologo"
    AR_LIBFILE_OPT="-OUT:"

    LDFLAGS_FOR_DEBUG="-DEBUG"
    LD_LIBFLAGS_FOR_DEBUG="-DEBUG"
    LD_STRIP_FLAG=
    STRIP_EXE=
    STRIP_EXE_SHARED_FLAGS=
    STRIP_EXE_STATIC_FLAGS=

    USING_MICROSOFT_CL_COMPILER="yes"
    FIX_PATH_FOR_CC="$CYGPATH"
    FIX_PATH_FOR_WINDOWS="$CYGPATH"

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

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 "
    EXEFILE_OPT="-o "
    if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AR+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$AR"; then
  ac_cv_prog_AR="$AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_AR="${ac_tool_prefix}ar"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
$as_echo "$AR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_AR"; then
  ac_ct_AR=$AR
  # Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_AR+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_AR"; then
  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_AR="ar"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
$as_echo "$ac_ct_AR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_AR" = x; then
    AR="ar"
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    AR=$ac_ct_AR
  fi
else
  AR="$ac_cv_prog_AR"
fi

    ARFLAGS="cr"
    AR_LIBFILE_OPT=""

    case "$host" in
        *apple*darwin*)
            # The `-s' linker option is deprecated on Darwin 9+ and has no
            # effect other than causing the linker to emit a warning. Call the
            # strip tool directly.
            LD_STRIP_FLAG=""
            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_STRIP_EXE+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$STRIP_EXE"; then
  ac_cv_prog_STRIP_EXE="$STRIP_EXE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_STRIP_EXE="${ac_tool_prefix}strip"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
STRIP_EXE=$ac_cv_prog_STRIP_EXE
if test -n "$STRIP_EXE"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP_EXE" >&5
$as_echo "$STRIP_EXE" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_STRIP_EXE"; then
  ac_ct_STRIP_EXE=$STRIP_EXE
  # Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_STRIP_EXE+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_STRIP_EXE"; then
  ac_cv_prog_ac_ct_STRIP_EXE="$ac_ct_STRIP_EXE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_STRIP_EXE="strip"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_STRIP_EXE=$ac_cv_prog_ac_ct_STRIP_EXE
if test -n "$ac_ct_STRIP_EXE"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP_EXE" >&5
$as_echo "$ac_ct_STRIP_EXE" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_STRIP_EXE" = x; then
    STRIP_EXE="strip"
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    STRIP_EXE=$ac_ct_STRIP_EXE
  fi
else
  STRIP_EXE="$ac_cv_prog_STRIP_EXE"
fi

            STRIP_EXE_SHARED_FLAGS="-x"
            STRIP_EXE_STATIC_FLAGS=""
            ;;
        *)
            LD_STRIP_FLAG="-s"
            STRIP_EXE=""
            STRIP_EXE_SHARED_FLAGS=""
            STRIP_EXE_STATIC_FLAGS=""
            ;;
    esac

    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.
    case $FULLARCH in
        *-linux*)
            LDFLAGS_FOR_TRACE="-rdynamic"
            ;;
    esac

    USING_MICROSOFT_CL_COMPILER="no"

    FIX_PATH_FOR_CC=echo
    FIX_PATH_FOR_WINDOWS=echo
    case "$host" in
        *mingw*)
            FIX_PATH_FOR_WINDOWS="$CYGPATH"
        ;;
    esac

    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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_RANLIB+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
$as_echo "$RANLIB" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_RANLIB="ranlib"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

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

  if test "x$ac_ct_RANLIB" = x; then
    RANLIB=":"
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    RANLIB=$ac_ct_RANLIB
  fi
else
  RANLIB="$ac_cv_prog_RANLIB"
fi

    RANLIBFLAGS=""

    # 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*)
            RANLIBFLAGS="-c"
            ;;
    esac
fi

if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}nm", so it can be a program name with args.
set dummy ${ac_tool_prefix}nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_NM+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$NM"; then
  ac_cv_prog_NM="$NM" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_NM="${ac_tool_prefix}nm"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
NM=$ac_cv_prog_NM
if test -n "$NM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NM" >&5
$as_echo "$NM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_NM"; then
  ac_ct_NM=$NM
  # Extract the first word of "nm", so it can be a program name with args.
set dummy nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_NM+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_NM"; then
  ac_cv_prog_ac_ct_NM="$ac_ct_NM" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_NM="nm"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_NM=$ac_cv_prog_ac_ct_NM
if test -n "$ac_ct_NM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NM" >&5
$as_echo "$ac_ct_NM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_NM" = x; then
    NM="nm"
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    NM=$ac_ct_NM
  fi
else
  NM="$ac_cv_prog_NM"
fi




























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

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char sin ();
int
main ()
{
return sin ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_m_sin=yes
else
  ac_cv_lib_m_sin=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sin" >&5
$as_echo "$ac_cv_lib_m_sin" >&6; }
if test "x$ac_cv_lib_m_sin" = xyes; then :
  MATH_LIB=-lm
else
  MATH_LIB=
fi


#-----------------------------------------------------------------------------#
#
# Check whether the user wants to disable the use of shared libraries.
#

# Check whether --enable-shared-libs was given.
if test "${enable_shared_libs+set}" = set; then :
  enableval=$enable_shared_libs; mercury_cv_enable_shared_libs="$enableval"
else
  mercury_cv_enable_shared_libs=yes
fi


#-----------------------------------------------------------------------------#
#
# Check whether to use symbolic links.
#

enable_symlinks_opt=no
# Check whether --enable-symlinks was given.
if test "${enable_symlinks+set}" = set; then :
  enableval=$enable_symlinks; enable_symlinks_opt=yes
fi


# If we're compiling the compiler on Windows, don't use symlinks when
# installing unless the --enable-symlinks option is given.
#
# 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*)
        MATH_LIB=
        if test "$enable_symlinks_opt" != "yes"; then
            MMC_USE_SYMLINKS_OPT=--no-use-symlinks
            LN_S=false
        fi
        ;;
    *mingw*)
        MATH_LIB=
        if test "$enable_symlinks_opt" != "yes"; then
            MMC_USE_SYMLINKS_OPT=--no-use-symlinks
            LN_S=false
        fi
        ;;
esac





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


# Check whether --with-csharp-compiler was given.
if test "${with_csharp_compiler+set}" = set; then :
  withval=$with_csharp_compiler; mercury_cv_with_csharp_compiler="$withval"
else
  mercury_cv_with_csharp_compiler=""
fi


# Extract the first word of "ilasm", so it can be a program name with args.
set dummy ilasm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ILASM+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_ILASM="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
ILASM=$ac_cv_path_ILASM
if test -n "$ILASM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ILASM" >&5
$as_echo "$ILASM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


# Extract the first word of "gacutil", so it can be a program name with args.
set dummy gacutil; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_GACUTIL+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_GACUTIL="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
GACUTIL=$ac_cv_path_GACUTIL
if test -n "$GACUTIL"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GACUTIL" >&5
$as_echo "$GACUTIL" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Microsoft.NET Framework SDK" >&5
$as_echo_n "checking for Microsoft.NET Framework SDK... " >&6; }
if ${mercury_cv_microsoft_dotnet+:} false; then :
  $as_echo_n "(cached) " >&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

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_microsoft_dotnet" >&5
$as_echo "$mercury_cv_microsoft_dotnet" >&6; }
ILASM=`basename "$ILASM"`
GACUTIL=`basename "$GACUTIL"`

# Check for the assembly linker.
# ilalink is the DotGNU assembly linker.
for ac_prog in al ilalink
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_MS_AL+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $MS_AL in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_MS_AL="$MS_AL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_MS_AL="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
MS_AL=$ac_cv_path_MS_AL
if test -n "$MS_AL"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MS_AL" >&5
$as_echo "$MS_AL" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


  test -n "$MS_AL" && break
done

MS_AL=`basename "$MS_AL"`

# Check for an implementation of the Common Language Infrastructure.
for ac_prog in mono
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CLI_INTERPRETER+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $CLI_INTERPRETER in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_CLI_INTERPRETER="$CLI_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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_CLI_INTERPRETER="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
CLI_INTERPRETER=$ac_cv_path_CLI_INTERPRETER
if test -n "$CLI_INTERPRETER"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CLI_INTERPRETER" >&5
$as_echo "$CLI_INTERPRETER" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


  test -n "$CLI_INTERPRETER" && break
done


# Check for the C# (C sharp) compiler.
# csc is the Microsoft C# compiler.
# mcs is the Mono C# compiler targetting all runtime versions.
# (dmcs and gmcs are older aliases for the Mono C# compiler
# which we do not use.)

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, we kill variables containing newlines.
# 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.
(
  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
    eval ac_val=\$$ac_var
    case $ac_val in #(
    *${as_nl}*)
      case $ac_var in #(
      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      esac
      case $ac_var in #(
      _ | IFS | as_nl) ;; #(
      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
      *) { eval $ac_var=; unset $ac_var;} ;;
      esac ;;
    esac
  done

  (set) 2>&1 |
    case $as_nl`(ac_space=' '; set) 2>&1` in #(
    *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
      ;;
    esac |
    sort
) |
  sed '
     /^ac_cv_env_/b end
     t clear
     :clear
     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
     t end
     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
     :end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
  if test -w "$cache_file"; then
    if test "x$cache_file" != "x/dev/null"; then
      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
      if test ! -f "$cache_file" || test -h "$cache_file"; then
	cat confcache >"$cache_file"
      else
        case $cache_file in #(
        */* | ?:*)
	  mv -f confcache "$cache_file"$$ &&
	  mv -f "$cache_file"$$ "$cache_file" ;; #(
        *)
	  mv -f confcache "$cache_file" ;;
	esac
      fi
    fi
  else
    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
  fi
fi
rm -f confcache
case "$mercury_cv_with_csharp_compiler" in
    no)
        as_fn_error $? "invalid option --without-csharp-compiler" "$LINENO" 5
        exit 1
        ;;
    yes)
        as_fn_error $? "missing argument to --with-csharp-compiler=... option" "$LINENO" 5
        exit 1
        ;;
    "")
        CSC_COMPILERS="csc mcs"
        ;;
    *)
        CSC_COMPILERS="$mercury_cv_with_csharp_compiler"
        ;;
esac

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a C sharp compiler" >&5
$as_echo_n "checking for a C sharp compiler... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
for CANDIDATE_CSC0 in $CSC_COMPILERS; do
    unset CANDIDATE_CSC
    unset ac_cv_path_CANDIDATE_CSC
    if test -r "$cache_file"; then
  # Some versions of bash will fail to source /dev/null (special files
  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
    case $cache_file in
      [\\/]* | ?:[\\/]* ) . "$cache_file";;
      *)                      . "./$cache_file";;
    esac
  fi
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
$as_echo "$as_me: creating cache $cache_file" >&6;}
  >$cache_file
fi

    # Extract the first word of "$CANDIDATE_CSC0", so it can be a program name with args.
set dummy $CANDIDATE_CSC0; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CANDIDATE_CSC+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $CANDIDATE_CSC in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_CANDIDATE_CSC="$CANDIDATE_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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_CANDIDATE_CSC="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
CANDIDATE_CSC=$ac_cv_path_CANDIDATE_CSC
if test -n "$CANDIDATE_CSC"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CANDIDATE_CSC" >&5
$as_echo "$CANDIDATE_CSC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



    if test -z "$CANDIDATE_CSC"; then
        continue;
    fi
    CANDIDATE_CSC=`basename "$CANDIDATE_CSC"`

# Check that the compiler is suitable.
    case "$CANDIDATE_CSC" in
         csc*)
             # The Microsoft C# compiler and the Chicken Scheme compiler share
             # the same executable name, so if we find an executable named csc
             # above, check that it is actually the Microsoft C# compiler,
             # and if it is not, then try to use one of the other instead.
             $CANDIDATE_CSC 2>&1 | grep "^Microsoft" >/dev/null
             if test $? -ne 0
             then
                 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CANDIDATE_CSC is not the Microsoft C sharp compiler" >&5
$as_echo "$as_me: WARNING: $CANDIDATE_CSC is not the Microsoft C sharp compiler" >&2;}
                 continue;
             else
                 CSC="$CANDIDATE_CSC"
                 break;
             fi
        ;;

        *mcs)
            # We want to check that the 'mcs' compiler supports generics.
            # We test all the mono C sharp compilers in order to be more
            # defensive.
            { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CANDIDATE_CSC supports C sharp generics" >&5
$as_echo_n "checking whether $CANDIDATE_CSC supports C sharp generics... " >&6; }

            cat > conftest.cs << EOF
    using System;
    using System.Collections.Generic;

    class Hello
    {
        private class ExampleClass { }

        static void Main()
        {
            Console.WriteLine("Hello world!");

            // Declare a list of type int.
            List<int> list1 = new List<int>();

            // Declare a list of type string.
            List<string> list2 = new List<string>();

            // Declare a list of type ExampleClass.
            List<ExampleClass> list3 = new List<ExampleClass>();
        }
    }
EOF
            echo $CANDIDATE_CSC conftest.cs >&5 2>&1
            OUTPUT=$($CANDIDATE_CSC conftest.cs 2>&1)
            RESULT=$?
            rm -f conftest.cs conftest.exe
            echo $OUTPUT >&5
            echo returned $RESULT >&5
            if echo $OUTPUT | grep CS1644 > /dev/null; then
                # This compiler does not support generics.
                { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                continue;
            elif test $RESULT -ne 0; then
                { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $CANDIDATE_CSC returned exit code $RESULT" >&5
$as_echo "$as_me: WARNING: $CANDIDATE_CSC returned exit code $RESULT" >&2;}
                continue;
            else
                { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
                CSC="$CANDIDATE_CSC"
                break;
            fi
        ;;

        *)
            CSC="$CANDIDATE_CSC"
            break;
        ;;
    esac
done

# If the user specified one or more compilers and we couldn't find any,
# then abort configuration.
if test "$mercury_cv_with_csharp_compiler" != "" -a "$CSC" = ""; then
    as_fn_error $? "No suitable C sharp compiler could be found." "$LINENO" 5
    exit 1
fi

case "$CSC" in
    csc*)
        CSHARP_COMPILER_TYPE=microsoft
    ;;

    mcs*)
        CSHARP_COMPILER_TYPE=mono
    ;;

    *)
        CSHARP_COMPILER_TYPE=unknown
    ;;
esac

# 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 "$CSC" != "";
then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking version of .NET libraries" >&5
$as_echo_n "checking version of .NET libraries... " >&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 $CSC conftest.cs >&5 2>&1 && \
			$CSC conftest.cs  >&5 2>&1 && \
			$CLI_INTERPRETER ./conftest.exe > conftest.out 2>&1
	then
		mercury_cv_microsoft_dotnet_library_version=`cat conftest.out`
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_microsoft_dotnet_library_version" >&5
$as_echo "$mercury_cv_microsoft_dotnet_library_version" >&6; }
		rm -f conftest*
	else
		rm -f conftest*
		if test "$enable_dotnet_grades" = "yes"; then
			as_fn_error $? "unable to determine version" "$LINENO" 5
			exit 1
		else
			{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to determine version" >&5
$as_echo "$as_me: WARNING: unable to determine version" >&2;}
		fi
	fi
fi
MS_DOTNET_LIBRARY_VERSION=$mercury_cv_microsoft_dotnet_library_version












# The Roslyn (i.e. Microsoft) C# compiler does not support signing assemblies
# with a strong name on non-Windows platforms.  If we are using that compiler
# on a non-Windows platform then only delay sign the assembly.

CSHARP_DELAYSIGN_FLAG=
if test "$CSHARP_COMPILER_TYPE" = "microsoft"; then
    case "$host" in
        *cygwin* | *mingw*)
            CSHARP_DELAYSIGN_FLAG=
        ;;

        *)
            CSHARP_DELAYSIGN_FLAG="--csharp-flag -delaysign"
        ;;
    esac
fi



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


# On Windows, the Java SDK has a high chance of being installed in a path
# containing spaces. The simplest solution is to keep only the basename.
# Everything will still work so long as the executables can be found on the
# PATH later.
for ac_prog in javac
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_JAVAC+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_JAVAC="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
JAVAC=$ac_cv_path_JAVAC
if test -n "$JAVAC"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVAC" >&5
$as_echo "$JAVAC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


  test -n "$JAVAC" && break
done

case "$JAVAC" in
    *" "*)
        JAVAC=`basename "$JAVAC"`
        ;;
esac
# Extract the first word of "java", so it can be a program name with args.
set dummy java; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_JAVA_INTERPRETER+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_JAVA_INTERPRETER="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
JAVA_INTERPRETER=$ac_cv_path_JAVA_INTERPRETER
if test -n "$JAVA_INTERPRETER"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAVA_INTERPRETER" >&5
$as_echo "$JAVA_INTERPRETER" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


case "$JAVA_INTERPRETER" in
    *" "*)
        JAVA_INTERPRETER=`basename "$JAVA_INTERPRETER"`
        ;;
esac
# Extract the first word of "jar", so it can be a program name with args.
set dummy jar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_JAR+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_JAR="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
JAR=$ac_cv_path_JAR
if test -n "$JAR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JAR" >&5
$as_echo "$JAR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


case "$JAR" in
    *" "*)
        JAR=`basename "$JAR"`
        ;;
esac

if ${mercury_cv_java+:} false; then :
  $as_echo_n "(cached) " >&6
else

if test "$JAVAC" != "" -a "$JAVA_INTERPRETER" != "" -a "$JAR" != ""; then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the above Java SDK works and is sufficiently recent" >&5
$as_echo_n "checking if the above Java SDK works and is sufficiently recent... " >&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.8, 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.8f) {
				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 &&
		CLASSPATH=. "$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
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_java" >&5
$as_echo "$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







# Check whether --enable-javac-flags-for-heap-size was given.
if test "${enable_javac_flags_for_heap_size+set}" = set; then :
  enableval=$enable_javac_flags_for_heap_size; enable_javac_flags_for_heap_size="$enableval"
else
  enable_javac_flags_for_heap_size=yes
fi


case "$enable_javac_flags_for_heap_size" in
    yes)

# The default maximum heap size is too small to build the standard library
# and other programs, so we need to increase it. The option to do that
# is non-standard, so we have to check that it is accepted.
if ${mercury_cv_javac_flags_for_heap_size+:} false; then :
  $as_echo_n "(cached) " >&6
else

if test "$mercury_cv_java" = "yes"
then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the Java compiler accepts the max heap size option" >&5
$as_echo_n "checking if the Java compiler accepts the max heap size option... " >&6; }
	# There are three versions of this. The '_test' version is the one
	# we test here; the '_mmake' version is the one that gets included
	# in the Mmake.vars file and the '_config' verison is the version
	# that gets included in the Mercury.config file.
	# The difference between the three versions is how much we need to
	# escape the double quotes; in particular we need to ensure that they
	# are *not* escaped in Mmake.vars and *are* escaped in Mercury.config.
	# The latter is necessary in order for --restricted-command-line to work.
	mercury_cv_javac_flags_for_heap_size_test="-J-Xmx256m"
	mercury_cv_javac_flags_for_heap_size_mmake="-J\"-Xmx1024m\""
	mercury_cv_javac_flags_for_heap_size_config="-J\\\"-Xmx1024m\\\""
	if "$JAVAC" "$mercury_cv_javac_flags_for_heap_size_test" -version \
                > /dev/null 2>&1
        then
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
	else
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
		mercury_cv_javac_flags_for_heap_size=
	fi
else
	mercury_cv_javac_flags_for_heap_size=
fi

fi


        JAVAC_FLAGS_FOR_HEAP_SIZE_MMAKE=$mercury_cv_javac_flags_for_heap_size_mmake
        JAVAC_FLAGS_FOR_HEAP_SIZE_CONFIG=$mercury_cv_javac_flags_for_heap_size_config
        ;;
    no)
        JAVAC_FLAGS_FOR_HEAP_SIZE_MMAKE=
        JAVAC_FLAGS_FOR_HEAP_SIZE_CONFIG=
        ;;
esac



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

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=`$as_echo "ac_cv_func_$mercury_cv_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$mercury_cv_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :

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


fi

    done
}

mercury_check_for_stdio_functions () {
    for mercury_cv_stdio_func in "$@"
    do
        mercury_cv_stdio_func_define="MR_HAVE_`echo $mercury_cv_stdio_func | \
            tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`"
        as_ac_Symbol=`$as_echo "ac_cv_have_decl_$mercury_cv_stdio_func" | $as_tr_sh`
ac_fn_c_check_decl "$LINENO" "$mercury_cv_stdio_func" "$as_ac_Symbol" "#include <stdio.h>
"
if eval test \"x\$"$as_ac_Symbol"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define $mercury_cv_stdio_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
        ;;
    *mingw*)
        ac_cv_func_mprotect=no
        ;;
esac

# Do not try to use sleep() on MinGW or MinGW64 as it isn't available
# *despite* what the standard autoconf tests report.
#
# The MinGW64 implementation of mkstemp is broken; it isn't supported on
# MinGW32.
#
case "$host" in
    *mingw*)
        ac_cv_func_sleep=no
        ac_cv_func_mkstemp=no
        ;;
esac

mercury_check_for_functions \
        sysconf getpagesize gethostname \
        mmap mprotect memalign posix_memalign sbrk memmove \
        sigaction siginterrupt setitimer \
        strerror strerror_r strerror_s \
        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 \
        gettimeofday setenv putenv _putenv posix_spawn sched_setaffinity \
        sched_getaffinity sched_getcpu sched_yield mkstemp mkdtemp \
        setrlimit getcontext dl_iterate_phdr chmod

mercury_check_for_stdio_functions \
        snprintf _snprintf vsnprintf _vsnprintf

save_LIBS="$LIBS"
LIBS="$MATH_LIB"
mercury_check_for_functions \
        fma
LIBS="$save_LIBS"

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

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

int
main ()
{

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  ac_cv_header_stdc=yes
else
  ac_cv_header_stdc=no
fi
rm -f core 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <ctype.h>
#include <stdlib.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))
      return 2;
  return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :

else
  ac_cv_header_stdc=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then

$as_echo "#define STDC_HEADERS 1" >>confdefs.h

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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
  cat >>confdefs.h <<_ACEOF
#define `$as_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 \
        sys/param.h sys/time.h sys/times.h \
        sys/types.h sys/stat.h fcntl.h termios.h sys/ioctl.h \
        sys/resource.h sys/stropts.h windows.h dirent.h getopt.h malloc.h \
        semaphore.h pthread.h time.h spawn.h fenv.h sys/mman.h sys/sem.h \
        sched.h utmpx.h dispatch/dispatch.h sys/select.h ; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`$as_echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$mercury_cv_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"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=`$as_echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$mercury_cv_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :

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

		eval "$mercury_cv_header_define=1"

fi


    done

fi

#-----------------------------------------------------------------------------#
#
# Check whether we can set the FP rounding mode.
#


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fesetround function" >&5
$as_echo_n "checking for fesetround function... " >&6; }
mercury_cv_math_func_define="MR_HAVE_`echo fesetround | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

save_libs="$LIBS"
LIBS="$MATH_LIB $LIBS"

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

#ifdef MR_HAVE_FENV_H
	#include <fenv.h>
#endif

int
main ()
{


	int i = 0;
	fesetround(i);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_math_func=yes
else
  mercury_cv_have_math_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

LIBS="$save_libs"

if test "$mercury_cv_have_math_func" = "yes"
then
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
	cat >>confdefs.h <<_ACEOF
#define $mercury_cv_math_func_define 1
_ACEOF

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


#-----------------------------------------------------------------------------#
#
# Check whether we have __builtin_bswap builtin functions.
#

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have __builtin_bswap16" >&5
$as_echo_n "checking whether we have __builtin_bswap16... " >&6; }
if ${mercury_cv_have_builtin_bswap16+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{
__builtin_bswap16(1);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_builtin_bswap16=yes
else
  mercury_cv_have_builtin_bswap16=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_have_builtin_bswap16" >&5
$as_echo "$mercury_cv_have_builtin_bswap16" >&6; }
if test "$mercury_cv_have_builtin_bswap16" = yes; then
    $as_echo "#define MR_HAVE_BUILTIN_BSWAP16 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have __builtin_bswap32" >&5
$as_echo_n "checking whether we have __builtin_bswap32... " >&6; }
if ${mercury_cv_have_builtin_bswap32+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{
__builtin_bswap32(1);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_builtin_bswap32=yes
else
  mercury_cv_have_builtin_bswap32=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_have_builtin_bswap32" >&5
$as_echo "$mercury_cv_have_builtin_bswap32" >&6; }
if test "$mercury_cv_have_builtin_bswap32" = yes; then
    $as_echo "#define MR_HAVE_BUILTIN_BSWAP32 1" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we have __builtin_bswap64" >&5
$as_echo_n "checking whether we have __builtin_bswap64... " >&6; }
if ${mercury_cv_have_builtin_bswap64+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{
__builtin_bswap64(1);
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_builtin_bswap64=yes
else
  mercury_cv_have_builtin_bswap64=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_have_builtin_bswap64" >&5
$as_echo "$mercury_cv_have_builtin_bswap64" >&6; }
if test "$mercury_cv_have_builtin_bswap64" = yes; then
    $as_echo "#define MR_HAVE_BUILTIN_BSWAP64 1" >>confdefs.h

fi

#-----------------------------------------------------------------------------#
#
# Check whether getopt() is available.
#

ac_fn_c_check_func "$LINENO" "getopt" "ac_cv_func_getopt"
if test "x$ac_cv_func_getopt" = xyes; then :
  HAVE_GETOPT=yes
else
  HAVE_GETOPT=no
fi



#-----------------------------------------------------------------------------#
#
# Check the basics of SA_SIGINFO and siginfo_t.
#

if test "$ac_cv_func_sigaction" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SA_SIGINFO and siginfo_t" >&5
$as_echo_n "checking for SA_SIGINFO and siginfo_t... " >&6; }
if ${mercury_cv_siginfo_t+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

        #include <stdio.h>
        #include <stdlib.h>
        #include <signal.h>
        #include <unistd.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.sa_sigaction = 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) {
            if (save_signum == signum) {
                // We are stuck in a loop! Seen on Ubuntu 18.04.5 amd64
                // when using gcc -m32 to target x86.
                exit(2);
            }
            save_signum = signum;
            save_cause = info->si_code;
        }

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_siginfo_t=yes
else
  mercury_cv_siginfo_t=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_siginfo_t" >&5
$as_echo "$mercury_cv_siginfo_t" >&6; }
else
    mercury_cv_siginfo_t=no
fi
if test "$mercury_cv_siginfo_t" = yes; then
    $as_echo "#define MR_HAVE_SIGINFO_T 1" >>confdefs.h

    $as_echo "#define MR_HAVE_SIGINFO 1" >>confdefs.h


    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PC access from signal handler context" >&5
$as_echo_n "checking for PC access from signal handler context... " >&6; }
    if ${mercury_cv_pc_access+:} false; then :
  $as_echo_n "(cached) " >&6
else

        mercury_cv_pc_access=no
        mercury_cv_pc_access_greg=no
        # Which register contains the program counter:
        #   x86-64  REG_RIP
        #   i386    REG_EIP
        #   SPARC   REG_PC
        #   MIPS    CTX_EPC
        for try_reg in REG_RIP REG_EIP REG_PC CTX_EPC ; do
            if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

                    #define _GNU_SOURCE /* for register constants */
                    #include <stdio.h>
                    #include <stdlib.h>
                    #include <signal.h>
                    #include <unistd.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.sa_sigaction = 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) {
                        ucontext_t *uc = (ucontext_t *) context;
                        save_signum = signum;
                        save_cause = info->si_code;
                        save_pc = uc->uc_mcontext.gregs[$try_reg];
                    }

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_pc_access=$try_reg;mercury_cv_pc_access_greg=yes
else
  true
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi

            if test "$mercury_cv_pc_access" != no; then
                break
            fi
        done

fi

    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_pc_access" >&5
$as_echo "$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
            $as_echo "#define MR_PC_ACCESS_GREG 1" >>confdefs.h

        fi
    fi
fi

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an integer type with the same size as a pointer" >&5
$as_echo_n "checking for an integer type with the same size as a pointer... " >&6; }
if ${mercury_cv_word_type+:} false; then :
  $as_echo_n "(cached) " >&6
else


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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(int) == sizeof(void *) ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_word_type=int
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long) == sizeof(void *) ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_word_type=long
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long long) == sizeof(void *) ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_word_type="long long"
else
  mercury_cv_word_type=unknown
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_word_type" >&5
$as_echo "$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


cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_int $mercury_cv_word_type
_ACEOF


cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_uint unsigned $mercury_cv_word_type
_ACEOF



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

    cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_int_max INT_MAX
_ACEOF

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

    cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_int_max LONG_MAX
_ACEOF

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

    cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_int_max LLONG_MAX
_ACEOF

else
    as_fn_error $? "Cannot determine the length modifier for the MR_Integer type." "$LINENO" 5
fi



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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an integer type of at least 64 bits" >&5
$as_echo_n "checking for an integer type of at least 64 bits... " >&6; }
if ${mercury_cv_int_least64_type+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(int) * CHAR_BIT >= 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least64_type=int
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long) * CHAR_BIT >= 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least64_type=long
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long long) * CHAR_BIT >= 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least64_type="long long"
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(__int64) * CHAR_BIT >= 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least64_type=__int64
else
  mercury_cv_int_least64_type=unknown
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


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
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_int_least64_type" >&5
$as_echo "$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

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an integer type of at least 32 bits" >&5
$as_echo_n "checking for an integer type of at least 32 bits... " >&6; }
if ${mercury_cv_int_least32_type+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(int) * CHAR_BIT >= 32 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least32_type=int
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long) * CHAR_BIT >= 32 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least32_type=long
else
  mercury_cv_int_least32_type=unknown
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_int_least32_type" >&5
$as_echo "$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
    as_fn_error $? "Cannot find the name of the max values
    for MR_INT_LEAST32_TYPE." "$LINENO" 5
fi


#-----------------------------------------------------------------------------#
ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
if test "x$ac_cv_type_pid_t" = xyes; then :

else

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

fi


ac_fn_c_check_type "$LINENO" "dev_t" "ac_cv_type_dev_t" "$ac_includes_default"
if test "x$ac_cv_type_dev_t" = xyes; then :

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


fi
ac_fn_c_check_type "$LINENO" "ino_t" "ac_cv_type_ino_t" "$ac_includes_default"
if test "x$ac_cv_type_ino_t" = xyes; 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

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an integer type of at least 16 bits" >&5
$as_echo_n "checking for an integer type of at least 16 bits... " >&6; }
if ${mercury_cv_int_least16_type+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(short) * CHAR_BIT >= 16 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least16_type=short
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(int) * CHAR_BIT >= 16 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_least16_type=int
else
  mercury_cv_int_least16_type=unknown
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_int_least16_type" >&5
$as_echo "$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
    as_fn_error $? "Cannot find the name of the max value for MR_INT_LEAST16_TYPE." "$LINENO" 5
fi



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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of low tag bits available" >&5
$as_echo_n "checking the number of low tag bits available... " >&6; }
if ${mercury_cv_low_tag_bits+:} false; then :
  $as_echo_n "(cached) " >&6
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) == 4 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_low_tag_bits=2
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) == 8 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_low_tag_bits=3
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) == 16 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_low_tag_bits=4
else
  mercury_cv_low_tag_bits=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_low_tag_bits" >&5
$as_echo "$mercury_cv_low_tag_bits" >&6; }
if test "$mercury_cv_low_tag_bits" -lt 2; then
    if test "$BOOTSTRAP_MC" = ""; then
        as_fn_error $? "cannot bootstrap: low tag bits less than 2" "$LINENO" 5
        exit 1
    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


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of bytes per word" >&5
$as_echo_n "checking the number of bytes per word... " >&6; }
if ${mercury_cv_bytes_per_word+:} false; then :
  $as_echo_n "(cached) " >&6
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) == 4 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_bytes_per_word=4
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) == 8 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_bytes_per_word=8
else
  mercury_cv_bytes_per_word=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_bytes_per_word" >&5
$as_echo "$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


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the number of bits per word" >&5
$as_echo_n "checking the number of bits per word... " >&6; }
if ${mercury_cv_bits_per_word+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) * CHAR_BIT == 32 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_bits_per_word=32
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(void *) * CHAR_BIT == 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_bits_per_word=64
else
  mercury_cv_bits_per_word=0
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_bits_per_word" >&5
$as_echo "$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


cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_BITS_PER_WORD $mercury_cv_bits_per_word
_ACEOF


case "$mercury_cv_bits_per_word" in
    32)
        mercury_cv_log_bits_per_word=5
        $as_echo "#define MR_MERCURY_IS_32_BITS 1" >>confdefs.h

        ;;
    64)
        mercury_cv_log_bits_per_word=6
        $as_echo "#define MR_MERCURY_IS_64_BITS 1" >>confdefs.h

        ;;
    *)
        as_fn_error $? "unexpected number of bits per word: expected 32 or 64" "$LINENO" 5
        ;;
esac
cat >>confdefs.h <<_ACEOF
#define MR_ROBDD_LOG_BITS_PER_WORD $mercury_cv_log_bits_per_word
_ACEOF



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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether int is 32-bit" >&5
$as_echo_n "checking whether int is 32-bit... " >&6; }
if ${mercury_cv_int_is_32_bit+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(int) * CHAR_BIT == 32 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_int_is_32_bit=yes
else
  mercury_cv_int_is_32_bit=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_int_is_32_bit" >&5
$as_echo "$mercury_cv_int_is_32_bit" >&6; }
if test "$mercury_cv_int_is_32_bit" = yes; then
    $as_echo "#define MR_INT_IS_32_BIT 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether long is 64-bit" >&5
$as_echo_n "checking whether long is 64-bit... " >&6; }
if ${mercury_cv_long_is_64_bit+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long) * CHAR_BIT == 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_long_is_64_bit=yes
else
  mercury_cv_long_is_64_bit=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_long_is_64_bit" >&5
$as_echo "$mercury_cv_long_is_64_bit" >&6; }
if test "$mercury_cv_long_is_64_bit" = yes; then
    $as_echo "#define MR_LONG_IS_64_BIT 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use unboxed floats" >&5
$as_echo_n "checking whether we can use unboxed floats... " >&6; }
if ${mercury_cv_unboxed_floats+:} false; then :
  $as_echo_n "(cached) " >&6
else

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

int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(double) == sizeof(void *) ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_unboxed_floats=yes
else
  mercury_cv_unboxed_floats=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_unboxed_floats" >&5
$as_echo "$mercury_cv_unboxed_floats" >&6; }
if test "$mercury_cv_unboxed_floats" = yes; then
    HAVE_BOXED_FLOATS="--unboxed-float"
else
    $as_echo "#define MR_BOXED_FLOAT 1" >>confdefs.h

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


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether float is 64-bit" >&5
$as_echo_n "checking whether float is 64-bit... " >&6; }
if ${mercury_cv_float_is_64_bit+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(float) * CHAR_BIT == 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_float_is_64_bit=yes
else
  mercury_cv_float_is_64_bit=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_float_is_64_bit" >&5
$as_echo "$mercury_cv_float_is_64_bit" >&6; }
if test "$mercury_cv_float_is_64_bit" = yes; then
    $as_echo "#define MR_FLOAT_IS_64_BIT 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether double is 64-bit" >&5
$as_echo_n "checking whether double is 64-bit... " >&6; }
if ${mercury_cv_double_is_64_bit+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(double) * CHAR_BIT == 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_double_is_64_bit=yes
else
  mercury_cv_double_is_64_bit=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_double_is_64_bit" >&5
$as_echo "$mercury_cv_double_is_64_bit" >&6; }
if test "$mercury_cv_double_is_64_bit" = yes; then
    $as_echo "#define MR_DOUBLE_IS_64_BIT 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether long double is 64-bit" >&5
$as_echo_n "checking whether long double is 64-bit... " >&6; }
if ${mercury_cv_long_double_is_64_bit+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <limits.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(long double) * CHAR_BIT == 64 ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_long_double_is_64_bit=yes
else
  mercury_cv_long_double_is_64_bit=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_long_double_is_64_bit" >&5
$as_echo "$mercury_cv_long_double_is_64_bit" >&6; }
if test "$mercury_cv_long_double_is_64_bit" = yes; then
    $as_echo "#define MR_LONG_DOUBLE_IS_64_BIT 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use unboxed 64-bit integers" >&5
$as_echo_n "checking whether we can use unboxed 64-bit integers... " >&6; }
if ${mercury_cv_unboxed_int64s+:} false; then :
  $as_echo_n "(cached) " >&6
else

    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <stdint.h>
int
main ()
{

	    struct mercury_static_assert {
		int static_assert_expr : ( sizeof(uint64_t) == sizeof(void *) ) ? 1 : -1;
	    };

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_unboxed_int64s=yes
else
  mercury_cv_unboxed_int64s=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_unboxed_int64s" >&5
$as_echo "$mercury_cv_unboxed_int64s" >&6; }
if test "$mercury_cv_unboxed_int64s" = yes; then
    HAVE_BOXED_INT64S="--unboxed-int64s"
else
    $as_echo "#define MR_BOXED_INT64S 1" >>confdefs.h

    HAVE_BOXED_INT64S="--no-unboxed-int64s"
fi


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

# The number of detstack slots (words) that a MR_SyncTerm occupies.
SYNC_TERM_SIZE=3

cat >>confdefs.h <<_ACEOF
#define MR_SYNC_TERM_SIZE $SYNC_TERM_SIZE
_ACEOF


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether architecture is big-endian" >&5
$as_echo_n "checking whether architecture is big-endian... " >&6; }
if ${mercury_cv_is_bigender+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            #include <stdlib.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
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_is_bigender=yes
else
  mercury_cv_is_bigender=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_is_bigender" >&5
$as_echo "$mercury_cv_is_bigender" >&6; }
if test "$mercury_cv_is_bigender" = yes; then
    $as_echo "#define MR_BIG_ENDIAN 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether architecture is little-endian" >&5
$as_echo_n "checking whether architecture is little-endian... " >&6; }
if ${mercury_cv_is_littleender+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            #include <stdlib.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
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_is_littleender=yes
else
  mercury_cv_is_littleender=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_is_littleender" >&5
$as_echo "$mercury_cv_is_littleender" >&6; }
if test "$mercury_cv_is_littleender" = yes; then
    $as_echo "#define MR_LITTLE_ENDIAN 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use files as locks" >&5
$as_echo_n "checking whether we can use files as locks... " >&6; }
if ${mercury_cv_have_ocreat_oexcl+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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
                /* Deliberate syntax error. */
                }
            #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_have_ocreat_oexcl=yes
else
  mercury_cv_have_ocreat_oexcl=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_have_ocreat_oexcl" >&5
$as_echo "$mercury_cv_have_ocreat_oexcl" >&6; }
if test "$mercury_cv_have_ocreat_oexcl" = yes; then
    $as_echo "#define MR_HAVE_OCREAT_OEXCL 1" >>confdefs.h

fi

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return values of system" >&5
$as_echo_n "checking return values of system... " >&6; }
if ${mercury_cv_normal_system_retval+:} false; then :
  $as_echo_n "(cached) " >&6
else

    if test "$cross_compiling" = yes; then :

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

                #include <sys/wait.h>

int
main ()
{

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

                #else
                    /* Deliberate syntax error. */
                    }
                #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_normal_system_retval=yes
else
  mercury_cv_normal_system_retval=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_normal_system_retval=yes
else
  mercury_cv_normal_system_retval=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_normal_system_retval" >&5
$as_echo "$mercury_cv_normal_system_retval" >&6; }
if test "$mercury_cv_normal_system_retval" = no; then
        # Warn since VC++6 compiler fails this test
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to interpret return values from system" >&5
$as_echo "$as_me: WARNING: Unable to interpret return values from system" >&2;}
fi

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if we can handle contexts blocking on IO" >&5
$as_echo_n "checking to see if we can handle contexts blocking on IO... " >&6; }
if ${mercury_cv_can_do_pending_io+:} false; then :
  $as_echo_n "(cached) " >&6
else

    if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            #ifdef MR_HAVE_SYS_SELECT_H
            #include <sys/select.h>
            #endif
            #include <sys/types.h>
            #include <sys/time.h>
            #include <stdlib.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
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_can_do_pending_io=yes
else
  mercury_cv_can_do_pending_io=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_can_do_pending_io" >&5
$as_echo "$mercury_cv_can_do_pending_io" >&6; }
if test "$mercury_cv_can_do_pending_io" = yes; then
    $as_echo "#define MR_CAN_DO_PENDING_IO 1" >>confdefs.h

fi


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched.h cpuset macros" >&5
$as_echo_n "checking for sched.h cpuset macros... " >&6; }
if ${mercury_cv_have_sched_cpuset_macros+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            #define _GNU_SOURCE
            #ifdef MR_HAVE_SCHED_H
            #include <sched.h>
            #endif

int
main ()
{

            #if defined(CPU_ALLOC) && defined(CPU_COUNT_S)
            #else
                /* Deliberate syntax error. */
                }
            #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_have_sched_cpuset_macros=yes
else
  mercury_cv_have_sched_cpuset_macros=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_have_sched_cpuset_macros" >&5
$as_echo "$mercury_cv_have_sched_cpuset_macros" >&6; }
if test "$mercury_cv_have_sched_cpuset_macros" = yes; then
    $as_echo "#define MR_HAVE_SCHED_CPUSET_MACROS 1" >>confdefs.h

fi


#-----------------------------------------------------------------------------#
# There is a problem on some BSD based systems that FD_ZERO is defined
# defined in terms of bzero() but the appropriate header file for bzero()
# is not automatically included. The following deals with this situation
# on MacOS 10.3. (It appears to be fixed in MacOS 10.4.)

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to see if strings.h is needed for bzero" >&5
$as_echo_n "checking to see if strings.h is needed for bzero... " >&6; }
if ${mercury_cv_bzero_needs_strings_header+:} false; then :
  $as_echo_n "(cached) " >&6
else

    save_CC="$CC"

    case "$CC" in
        *gcc*)
            CC="$CC -Wall -Werror"
            ;;
    esac

    cat > conftest.c << EOF
        #ifdef MR_BZERO_NEEDS_STRINGS_HEADER
            #include <strings.h>
        #endif
        #include <sys/types.h>
        #include <sys/time.h>
        #include <unistd.h>

        void MR_fd_zero(fd_set *fdset);

        void
        MR_fd_zero(fd_set *fdset)
        {
            FD_ZERO(fdset);
        }
EOF

    if $CC -c conftest.c < /dev/null >&5 2>&1
    then
        mercury_cv_bzero_needs_strings_header=no
    else
        if $CC -DMR_BZERO_NEEDS_STRINGS_HEADER -c conftest.c \
            < /dev/null >&5 2>&1
        then
            mercury_cv_bzero_needs_strings_header=yes
        else
            mercury_cv_bzero_needs_strings_header=no
        fi
    fi

    rm -f conftest*
    CC="$save_CC"

fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_bzero_needs_strings_header" >&5
$as_echo "$mercury_cv_bzero_needs_strings_header" >&6; }
if test "$mercury_cv_bzero_needs_strings_header" = yes; then
    $as_echo "#define MR_BZERO_NEEDS_STRINGS_HEADER 1" >>confdefs.h

fi


#-----------------------------------------------------------------------------#
#
# With some versions of gcc on Darwin __builtin_setjmp is broken.
# (See gcc bug 22099)

# XXX we should only disable the use of __builtin_setjmp for those
# versions of gcc that are broken - the problem will be fixed in gcc 4.2
case "$host" in
    i*86*apple*darwin*)
        $as_echo "#define MR_DARWIN_SETJMP_WORKAROUND 1" >>confdefs.h

        ;;
esac



#-----------------------------------------------------------------------------#
#
# On sparc, x86, and probably on other architectures,
# if we are 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 x86, x86-64 and possibly other architectures, when using non-local
# gotos with gcc 4.x we need `-fno-move-loop-invariants'.
#
# For x86-64 and possibly other architectures, when using gcc specific
# features and parallelism with gcc 4.6 and 4.7 (and possibly future
# versions), we need -fno-reorder-functions to avoid segmentation faults.
# We don't yet know exactly which grades are affected.
#
# For mips and ARM, 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 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
    CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_MOVE_LOOP_INVARIANTS"
    case "$host" in
        mips-*)
            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
            ;;
        i*86-*|x86_64*)
            # On x86-64 and x86, GCC labels do not work correctly with
            # -ftree-dominator-opts.
            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS"
            CFLAGS_FOR_REGS="-fno-builtin -fno-omit-frame-pointer"

            # An old hack allowing non-local gotos to work with PIC on x86
            # will no longer work with GCC 5+ (see mercury_goto.h).
            pic_conflicts_with_nonlocal_gotos=no
            case $C_COMPILER_TYPE in
                gcc_3_*|gcc_4_*)
                    ;;
                gcc_*)

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler targets x86" >&5
$as_echo_n "checking whether C compiler targets x86... " >&6; }

if ${mercury_cv_cc_targets_x86+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

            #ifdef __i386__
            #else
            #error "target is not x86"
            #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_cc_targets_x86=yes
else
  mercury_cv_cc_targets_x86=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_cc_targets_x86" >&5
$as_echo "$mercury_cv_cc_targets_x86" >&6; }

                    if test "$mercury_cv_cc_targets_x86" = yes
                    then
                        if test "$mercury_cv_enable_shared_libs" = yes
                        then
                            case "$host" in
                                *cygwin*|*mingw*)
                                    # Windows DLLs do not use PIC, and
                                    # we do not support DLLs yet anyway.
                                    ;;
                                *)
                                    # Assume shared libraries use PIC.
                                    pic_conflicts_with_nonlocal_gotos=yes
                                    ;;
                            esac
                        else

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler generates PIC" >&5
$as_echo_n "checking whether C compiler generates PIC... " >&6; }

if ${mercury_cv_cc_generates_pic+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{

            #if defined(__PIC__) || defined(__pic__)
            #else
            #error "not PIC"
            #endif

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_cc_generates_pic=yes
else
  mercury_cv_cc_generates_pic=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_cc_generates_pic" >&5
$as_echo "$mercury_cv_cc_generates_pic" >&6; }

                            pic_conflicts_with_nonlocal_gotos="$mercury_cv_cc_generates_pic"
                        fi
                    fi
                    ;;
            esac
            if test "$pic_conflicts_with_nonlocal_gotos" = yes
            then
                echo "gcc labels do not work with PIC on x86" 1>&6
                mercury_cv_asm_labels=no
                mercury_cv_gcc_labels=no
            fi

            # In asm_fast grades the compiler seg faults during stage 3 library
            # compilation; we disable their use on Windows until this is fixed.
            case "$host" in
               *mingw*|*cygwin*)
                echo "gcc labels do not currently work on Windows" 1>&6
                mercury_cv_asm_labels=no
                mercury_cv_gcc_labels=no
                ;;
            esac
            ;;
        rs6000-*)
            echo "gcc labels do not work on the RS/6000" 1>&6
            mercury_cv_asm_labels=no
            mercury_cv_gcc_labels=no
            ;;
        arm*-*)
            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fomit-frame-pointer"
            ;;
        # On hppa64, ia64 and powerpc64 the test programs appear to work, but
        # larger programs die with an Illegal Instruction fault.
        # On powerpc (POWER) the test program enters an infinite loop;
        # this is likely true for the other architectures which have not been
        # tested recently.
        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
            ;;
        powerpc*-*)
            echo "gcc labels do not work on PPC/PPC64" 1>&6
            mercury_cv_asm_labels=no
            mercury_cv_gcc_labels=no
            ;;
        # On s390 the configure test goes into an infinite loop, so we need
        # to avoid running it.
        #
        # s390 systems can report themselves as s390-ibm-linux-gnu
        # or s390x-ibm-linux-gnu (and possibly others).
        s390*)
            echo "gcc labels do not work on S/390" 1>&6
            mercury_cv_asm_labels=no
            mercury_cv_gcc_labels=no
            ;;
        aarch64*)
            # On aarch64 GCC labels do not work correctly with
            # -ftree-dominator-opts.
            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_TREE_DOMINATOR_OPTS"
            CFLAGS_FOR_REGS="-fomit-frame-pointer"
            # GCC labels do not work correctly on aarch64 when generating PIC
            # with GCC 9+.
            case $C_COMPILER_TYPE in
                gcc_3_*|gcc_4_*|gcc_5_*|gcc_6_*|gcc_7_*|gcc_8_*)
                    ;;
                gcc_*)
                    echo "gcc labels do not work with PIC on aarch64" 1>&6
                    mercury_cv_asm_labels=no
                    mercury_cv_gcc_labels=no
                    ;;
            esac
            ;;
    esac
    ;;
esac

# GCC's basic block vectorizer produces code that is not compatible with
# non-local gotos for GCC 11 and 12. We disable that optimisation for now.
# (See Github issue #103 and Mantis issue #561.)
case "$host" in x86_64*)
    case $C_COMPILER_TYPE in
        gcc_1[1-9]_*)
            CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS -fno-tree-slp-vectorize"
            ;;
    esac
    ;;
esac

# Determine if $CFLAGS_FOR_NO_REORDER_FUNCTIONS is needed.
case "$C_COMPILER_TYPE" in
    # Check if the option is not required, and otherwise include the option.
    # No need to check gcc < 3.3 as the option didn't exist.
    gcc_3* | gcc_4_1* | gcc_4_2* | gcc_4_3* | gcc_4_4* | gcc_4_5*)
        ;;
    *)
        # XXX Pass -fno-reorder-functions when using GCC 4.6 onwards with
        # the global register or non-local goto extensions. This works around
        # problems in *.par* grades. (See bug #294 for further details.)
        CFLAGS_FOR_REGS="$CFLAGS_FOR_REGS $CFLAGS_FOR_NO_REORDER_FUNCTIONS"
        CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_NO_REORDER_FUNCTIONS"
        ;;
esac

# When we use nonlocal gotos, gcc generates warnings about labels of the form
# mercury__<modulename>__<predname> being used but not defined. The labels
# actually ARE defined, but with assembly code giving them names of the form
# _entry_mercury__<modulename>__<predname>. The assembly code makes them global
# symbols using the "_entry_" names. The generated code does refer to the
# labels using the "entry-less" names as well, and the gcc code generator
# processes those references just fine, but some other part of gcc seems
# to forget that fact when it generates the warnings. We therefore filter
# out those warnings with util/mfiltercc.
#
# Versions of gcc from 4.8 onward generate this warning not on a single line,
# which is what mfiltercc looks for, but as a very long multiline message,
# tracing the several macros involved, and putting arrow (carets) under their
# definitions, like this:
#
# /home/public/mercury-install-2014-01-10/lib/mercury/inc/mercury_goto.h:30:12: warning: ‘mercury__nrev__nreverse_2_0’ used but never defined [enabled by default]
#   MR_PASTE2(mercury__, label)
#             ^
# /home/public/mercury-install-2014-01-10/lib/mercury/inc/mercury_goto.h:881:14: note: in definition of macro ‘MR_declare_static’
#   static void label(void) __asm__("_entry_" MR_STRINGIFY(label))
#               ^
# /home/public/mercury-install-2014-01-10/lib/mercury/inc/mercury_std.h:268:26: note: in expansion of macro ‘MR_PASTE2_2’
#  #define MR_PASTE2(a,b)   MR_PASTE2_2(a,b)
#                           ^
# /home/public/mercury-install-2014-01-10/lib/mercury/inc/mercury_goto.h:30:2: note: in expansion of macro ‘MR_PASTE2’
#   MR_PASTE2(mercury__, label)
#   ^
# /home/public/mercury-install-2014-01-10/lib/mercury/inc/mercury_goto.h:1672:20: note: in expansion of macro ‘MR_add_prefix’
#   MR_declare_static(MR_add_prefix(e));
#                     ^
# nrev.c:79:1: note: in expansion of macro ‘MR_decl_static’
#  MR_decl_static(nrev__nreverse_2_0)
#  ^
#
# The problem is, mfiltercc removes the first line, but lets the rest through.
# This will confuse users even more than the unfiltered error message would,
# since they get the all the context but no information about the supposed
# "error" itself. For gcc versions that by default generate such long error
# messages, the inclusion of CFLAGS_FOR_ERRMSG_FILTER in CFLAGS_FOR_GOTOS
# will cause them to deviate from this default and switch them off.
#
# We *could* try to find a way to define labels that gcc does not complain
# about, at all. However, given that we *have* to use assembly code to make
# internal labels globally visible, any technique we could use to do that
# would be very vulnerable: it would be quite likely to be broken by new
# versions of gcc. Our current mechanism is vulnerable in the same way,
# but after such breakage, having to fix the mechanism to make it work
# is easier than having to fix it to make it work *and* to make it
# warning-free.
#
CFLAGS_FOR_GOTOS="$CFLAGS_FOR_GOTOS $CFLAGS_FOR_ERRMSG_FILTER"




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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use gcc labels" >&5
$as_echo_n "checking whether we can use gcc labels... " >&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 ${mercury_cv_gcc_labels+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            extern void     exit(int);
            void            *entry_foo_1;
            void            *entry_bar_1;
            void            *succip;
            int             global;
            void            *dummy_identity_function(void *);

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

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_gcc_labels=yes
else
  mercury_cv_gcc_labels=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_gcc_labels" >&5
$as_echo "$mercury_cv_gcc_labels" >&6; }
if test "$mercury_cv_gcc_labels" = yes; then
    $as_echo "#define MR_HAVE_GCC_LABELS 1" >>confdefs.h

fi

if test "$mercury_cv_gcc_labels" = yes; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use asm labels" >&5
$as_echo_n "checking whether we can use asm labels... " >&6; }

    if ${mercury_cv_asm_labels+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            #include <stdlib.h>
            void *volatile volatile_global_pointer;
            extern void mercury__label1 (void)
                __asm__("entry_" "mercury__label1" );
            int 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
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_asm_labels=yes
else
  mercury_cv_asm_labels=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_asm_labels" >&5
$as_echo "$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
    $as_echo "#define MR_HAVE_ASM_LABELS 1" >>confdefs.h

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
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use gcc labels and global registers" >&5
$as_echo_n "checking whether we can use gcc labels and global registers... " >&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 ${mercury_cv_gcc_model_fast+:} false; then :
  $as_echo_n "(cached) " >&6
else

    if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

            #define MR_USE_GCC_NONLOCAL_GOTOS
            #define MR_USE_GCC_GLOBAL_REGISTERS
            #include "mercury_engine.h"
            MercuryEngine MR_engine_base;
            int main() {
                MR_mr0 = 20;
                MR_mr7 = 22;
                if (MR_mr0 + MR_mr7 != 42)
                    exit(1);
                exit(0);
            }

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_gcc_model_fast=yes
else
  mercury_cv_gcc_model_fast=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_gcc_model_fast" >&5
$as_echo "$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

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use global registers without gcc labels" >&5
$as_echo_n "checking whether we can use global registers without gcc labels... " >&6; }

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

if ${mercury_cv_gcc_model_reg+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

        #define MR_USE_GCC_GLOBAL_REGISTERS
        #include "mercury_engine.h"
        MercuryEngine MR_engine_base;
        int main() {
            MR_mr0 = 20;
            MR_mr7 = 22;
            if (MR_mr0 + MR_mr7 != 42)
                exit(1);
            exit(0);
        }

_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_gcc_model_reg=yes
else
  mercury_cv_gcc_model_reg=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_gcc_model_reg" >&5
$as_echo "$mercury_cv_gcc_model_reg" >&6; }

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

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can support time profiling on this system" >&5
$as_echo_n "checking whether we can support time profiling on this system... " >&6; }
if ${mercury_cv_profiling+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

        /* The following code comes from runtime/mercury_timing.h */
        #include    <errno.h>
        #include    <limits.h>
        #include    <string.h>
        #include    <signal.h>

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

        #ifdef MR_HAVE_UNISTD_H
        #include    <unistd.h>
        #endif

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

        #ifdef HZ
          #define MR_CLOCK_TICKS_PER_SECOND     HZ
        #elif defined(MR_HAVE_SYSCONF) && defined(_SC_CLK_TCK)
          #define MR_CLOCK_TICKS_PER_SECOND     ((int) sysconf(_SC_CLK_TCK))
        #elif defined(CLOCKS_PER_SEC)
          #define MR_CLOCK_TICKS_PER_SECOND     CLOCKS_PER_SEC
        #elif defined(CLK_TCK)
          #define MR_CLOCK_TICKS_PER_SECOND     CLK_TCK
        #else
          /* just leave it undefined */
        #endif

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

_ACEOF
if ac_fn_c_try_cpp "$LINENO"; then :
  mercury_cv_profiling=yes
else
  mercury_cv_profiling=no
fi
rm -f conftest.err conftest.i conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_profiling" >&5
$as_echo "$mercury_cv_profiling" >&6; }

#-----------------------------------------------------------------------------#
#
# Add an option that disables the deep profiler
#

# Check whether --enable-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


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the deep profiler" >&5
$as_echo_n "checking whether to enable the deep profiler... " >&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
    $as_echo "#define MR_DEEP_PROFILER_ENABLED 1" >>confdefs.h

else
    mercury_cv_can_enable_deep_profiler=no
fi

case "$host" in
    *apple*darwin*)
        mercury_cv_default_cgi_dir=/Library/WebServer/CGI-Executables
        ;;
    *)
        mercury_cv_default_cgi_dir=/usr/lib/cgi-bin
        ;;
esac

mercury_cv_cgi_dir_must_exist=no
case "$enable_deep_profiler" in
    default)
        mercury_cv_enable_deep_profiler=$mercury_cv_can_enable_deep_profiler
        mercury_cv_cgi_dir=$mercury_cv_default_cgi_dir
        ;;
    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
            mercury_cv_cgi_dir_must_exist=yes
        fi

        if test $mercury_cv_can_enable_deep_profiler = no; then
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_deep_profiler" >&5
$as_echo "$enable_deep_profiler" >&6; }
            as_fn_error $? "--enable-deep-profiler specified but system
    does not support it" "$LINENO" 5
        fi

        mercury_cv_enable_deep_profiler=yes
        ;;
esac

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_enable_deep_profiler" >&5
$as_echo "$mercury_cv_enable_deep_profiler" >&6; }

if test $mercury_cv_enable_deep_profiler = yes; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to install deep profiler CGI script" >&5
$as_echo_n "checking where to install deep profiler CGI script... " >&6; }
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_cgi_dir" >&5
$as_echo "$mercury_cv_cgi_dir" >&6; }
    if test -d $mercury_cv_cgi_dir; then
        true
    else
        if test $mercury_cv_cgi_dir_must_exist = yes; then
            as_fn_error $? "$mercury_cv_cgi_dir does not exist." "$LINENO" 5
        else
            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $mercury_cv_cgi_dir does not exist." >&5
$as_echo "$as_me: WARNING: $mercury_cv_cgi_dir does not exist." >&2;}
        fi
    fi
fi

ENABLE_DEEP_PROFILER=$mercury_cv_enable_deep_profiler

CGIDIR=$mercury_cv_cgi_dir


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

# Check if we are using a pthreads implementation on Win32.
# NOTE: we currently only support this on MinGW or MinGW-w64.

if test "$MR_HAVE_PTHREAD_H" = 1
then
    case "$host" in
        *mingw*)

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we are using pthreads-win32" >&5
$as_echo_n "checking if we are using pthreads-win32... " >&6; }

cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <pthread.h>
int
main ()
{

        #ifndef PTW32_VERSION
            #error I suppose not
        #endif
        int self_id(void)
        {
            return (int) pthread_self().p;
        }

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_have_pthreads_win32=yes
else
  mercury_cv_have_pthreads_win32=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_have_pthreads_win32" >&5
$as_echo "$mercury_cv_have_pthreads_win32" >&6; }

            if test $mercury_cv_have_pthreads_win32 = "yes"
            then
                $as_echo "#define MR_PTHREADS_WIN32 1" >>confdefs.h

            fi
            WIN32_GC_THREADLIB="-DGC_WIN32_PTHREADS"
            ;;
        *)
            # XXX Building with GC_WIN32_THREADS instead of GC_WIN32_PTHREADS
            # can lead to trouble if the Mercury implementation makes pthread
            # calls which are not intercepted by Boehm GC.
            WIN32_GC_THREADLIB="-DGC_WIN32_THREADS"
            ;;
    esac
else
    WIN32_GC_THREADLIB="-DGC_WIN32_THREADS"
fi


# Check whether --with-gc-win32-pthreads was given.
if test "${with_gc_win32_pthreads+set}" = set; then :
  withval=$with_gc_win32_pthreads; with_gc_win32_pthreads="$withval"
else
  with_gc_win32_pthreads="no"
fi


case "$with_gc_win32_pthreads" in
    yes)
        # Force the use of a MinGW* pthreads library with the Boehm GC.
        WIN32_GC_THREADLIB="-DGC_WIN32_PTHREADS"
        ;;
    no)
        ;;
    *)
        as_fn_error $? "unexpected argument to --with-gc-win32-pthreads" "$LINENO" 5
        ;;
esac

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

# 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 and
# library (b) the Boehm collector and (c) the C library that they need to be
# thread-safe.
#
# For Linux, 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 and -lrt on HPUX).
# 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=
ENABLE_BOEHM_THREAD_LOCAL_ALLOC=
ENABLE_BOEHM_PARALLEL_MARK=

# This following variable is used for passing any other C compiler
# flags to the version of the Boehm GC built in parallel grades.
#
BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS"

BOEHM_NEED_ATOMIC_OPS_ASM=no

# This should be set if both the system malloc and Boehm GC (in the default
# configuration) may both call sbrk.
avoid_sbrk=

case "$host" in
    *solaris*)
        CFLAGS_FOR_THREADS="-DGC_THREADS -D_REENTRANT"
        THREAD_LIBS="-lpthread -lrt -ldl"
        ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
        ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
        case "$host" in
            sparc*)
                if test "$mercury_cv_cc_type" != gcc; then
                    # See boehm_gc/Makefile.direct
                    BOEHM_NEED_ATOMIC_OPS_ASM=yes
                fi
                ;;
        esac
        ;;

    *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="-DGC_THREADS -D_THREAD_SAFE -D_REENTRANT"
        THREAD_LIBS="-lpthread -ldl"
        ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
        ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
        # HBLKSIZE and CPP_LOG_HBLKSIZE control a poorly-documented parameter
        # in the Boehm GC, this parameter indirectly controls the size of
        # thread-local free lists among other things.
        # CPP_LOG_HBLKSIZE must always be the base-2 log of HBLKSIZE.
        # (With the current collector these settings only appear to work
        # correctly on Linux.)
        # XXX disabled as it aborts on GC_free when --enable-gc-munmap is used
        # BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS -DHBLKSIZE=32768 \
        # -DCPP_LOG_HBLKSIZE=15"
        avoid_sbrk=yes
        ;;

    *cygwin*)
        THREAD_LIBS=""
        case "$mercury_cv_cc_type" in
            msvc*)
                CFLAGS_FOR_THREADS="-DGC_THREADS -MD"
                LDFLAGS_FOR_THREADS="-MD"
                LD_LIBFLAGS_FOR_THREADS="-MD"
                ;;
            *)
                CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB"
                BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS $WIN32_GC_THREADLIB"
                ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
                ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
                ;;
        esac
        # avoid_sbrk?
        ;;

    i*86-pc-mingw*)
        THREAD_LIBS=""
        case "$mercury_cv_cc_type" in
            msvc*)
                CFLAGS_FOR_THREADS="-DGC_THREADS -MD"
                LDFLAGS_FOR_THREADS="-MD"
                LD_LIBFLAGS_FOR_THREADS="-MD"
                ;;
            *)
                if test "$MR_HAVE_PTHREAD_H" = 1
                then
                    # By default the MinGW port of GCC targets the i386
                    # architecture. We need to tell it to target a later
                    # architecture for the GCC built-in atomic ops to be
                    # available.
                    CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -march=i686"
                    BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS $WIN32_GC_THREADLIB"
                    THREAD_LIBS="-lpthread"
                else
                    # The compiler is unconditionally linked against the thread
                    # libraries so if pthreads is not present then we need to
                    # set THREAD_LIBS to empty in order to avoid linker errors.
                    CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB"
                    BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS $WIN32_GC_THREADLIB"
                    THREAD_LIBS=
                fi
                ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
                ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
                ;;
        esac
        ;;

    *-w64-mingw*|x86_64-pc-mingw*)
        THREAD_LIBS=""
        case "$mercury_cv_cc_type" in
            msvc*)
                CFLAGS_FOR_THREADS="-DGC_THREADS -MD"
                LDFLAGS_FOR_THREADS="-MD"
                LD_LIBFLAGS_FOR_THREADS="-MD"
                ;;
            *)
                CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB"
                BOEHM_CFLAGS_FOR_THREADS="-DGC_THREADS $WIN32_GC_THREADLIB"
                THREAD_LIBS="-lpthread"
                ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
                ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
                ;;
        esac
        ;;

    *apple*darwin*)
        CFLAGS_FOR_THREADS="-DGC_THREADS"
        THREAD_LIBS=""
        ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
        ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
        ;;

    *-freebsd*)
        CFLAGS_FOR_THREADS="-DGC_THREADS"
        THREAD_LIBS="-lpthread"
        ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
        ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
        avoid_sbrk=yes
        ;;

    *-openbsd*)
        CFLAGS_FOR_THREADS="-DGC_THREADS -D_REENTRANT"
        THREAD_LIBS="-lpthread"
        ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
        ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
        avoid_sbrk=yes
        ;;

    *-aix*)
        CFLAGS_FOR_THREADS="-DGC_THREADS -D_THREAD_SAFE"
        THREAD_LIBS="-lpthread"
        ENABLE_BOEHM_THREAD_LOCAL_ALLOC="-DTHREAD_LOCAL_ALLOC"
        ENABLE_BOEHM_PARALLEL_MARK="-DPARALLEL_MARK"
        avoid_sbrk=yes  # assumed
        ;;

    *)
        # 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=""
        BOEHM_CFLAGS_FOR_THREADS=""
        ;;
esac

if test "$avoid_sbrk" = yes; then
    if test "$ac_cv_func_mmap" = yes; then
        BOEHM_CFLAGS_FOR_THREADS="$BOEHM_CFLAGS_FOR_THREADS -DUSE_MMAP"
        if test "$enable_gc_mmap" = no; then
            { $as_echo "$as_me:${as_lineno-$LINENO}: using mmap for Boehm GC in threaded grades" >&5
$as_echo "$as_me: using mmap for Boehm GC in threaded grades" >&6;}
        fi
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: malloc and Boehm GC both use sbrk; probably unsafe!" >&5
$as_echo "$as_me: WARNING: malloc and Boehm GC both use sbrk; probably unsafe!" >&2;}
    fi
fi










save_LIBS="$LIBS"
LIBS="$THREAD_LIBS"
mercury_check_for_functions \
        pthread_mutexattr_setpshared
LIBS="$save_LIBS"

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use thread-local storage class extension" >&5
$as_echo_n "checking whether we can use thread-local storage class extension... " >&6; }
if ${mercury_cv_thread_local_storage+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

int
main ()
{
static __thread int thread_local_variable;
  ;
  return 0;
}

_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
  mercury_cv_thread_local_storage=yes
else
  mercury_cv_thread_local_storage=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_thread_local_storage" >&5
$as_echo "$mercury_cv_thread_local_storage" >&6; }

if test "$mercury_cv_thread_local_storage" = yes; then
    case "$host" in
        *-solaris2.*)
            # Thread-local storage is disabled on Solaris as there is a linker
            # problem with shared objects and TLS.
            ;;
        *apple*darwin*)
            # XXX only attempt to use __thread with GCC on Mac OS X.
            # clang does not support it, although the above test "passes"
            # with some versions of clang.
            case "$C_COMPILER_TYPE" in
                gcc*)
                    $as_echo "#define MR_THREAD_LOCAL_STORAGE 1" >>confdefs.h

                    ;;
            esac
            ;;
        *-openbsd*)
            # The above test "passes" but OpenBSD (6.2) does not support TLS
            # natively, so is emulated by gcc/clang using something like the
            # pthread thread-specific data API. Moreover, something goes wrong
            # with the emulation when a Mercury program is dynamically linked
            # to the Mercury runtime (MR_thread_engine_base is assigned in one
            # place but remains NULL when read elsewhere).
            ;;
        *)
            $as_echo "#define MR_THREAD_LOCAL_STORAGE 1" >>confdefs.h

            ;;
    esac
fi

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

# It is necessary to pass -DNO_GETCONTEXT and -DHAVE_DL_ITERATE_PHDR when
# building Boehm GC with musl libc.

case $ac_cv_func_getcontext in
    yes) BOEHM_NO_GETCONTEXT= ;;
    no)  BOEHM_NO_GETCONTEXT="-DNO_GETCONTEXT" ;;
esac


case $ac_cv_func_dl_iterate_phdr in
    yes) BOEHM_HAVE_DL_ITERATE_PTR="-DHAVE_DL_ITERATE_PHDR" ;;
    no)  BOEHM_HAVE_DL_ITERATE_PTR= ;;
esac


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

# On some systems a prefix is attached to exported symbols. We need to account
# for this when checking object files for namespace cleanliness.

SYMPREFIX=

case "$host" in
    *apple*darwin*) SYMPREFIX="_" ;;
    i*86-*-mingw*)  SYMPREFIX="_" ;;
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
# that can be supported. If the user explicitly chooses a base grade
# using --with-llds-base-grade then we use that instead.
#
# NOTE: the base grade can also be one of asm_jump, fast and jump.
# However, we do not publicly document those grades or encourage their
# use by non-developers.


# Check whether --with-llds-base-grade was given.
if test "${with_llds_base_grade+set}" = set; then :
  withval=$with_llds_base_grade; user_llds_base_grade="$withval";mercury_cv_user_base_grade=yes
else
  mercury_cv_user_base_grade=no

fi


case "$mercury_cv_user_base_grade" in
    yes)
        case "$user_llds_base_grade" in
            asm_fast|asm_jump|fast|jump|reg|none)
                BEST_LLDS_BASE_GRADE="$user_llds_base_grade"
                ;;

            yes)
                as_fn_error $? "missing argument to --with-llds-base-grade=... option" "$LINENO" 5
                ;;

            no)
               as_fn_error $? "invalid option --without-llds-base-grade" "$LINENO" 5
                ;;

            *)
                as_fn_error $? "invalid argument to --with-llds-base-grade: $user_llds_base_grade" "$LINENO" 5
                ;;
            esac
            ;;
    no)
        if test $mercury_cv_asm_labels = yes -a \
                $mercury_cv_gcc_model_fast = yes
        then
            BEST_LLDS_BASE_GRADE=asm_fast
        elif test $mercury_cv_gcc_model_reg = yes; then
            BEST_LLDS_BASE_GRADE=reg
        else
            BEST_LLDS_BASE_GRADE=none
        fi

        # We used to force the use of the none base grade if the C compiler
        # is GCC 4.{1,2,3,4}, as the asm_fast and reg grades had problems
        # with those versions. This is now fixed but this code may be useful
        # in the future.
        # case "$mercury_cv_gcc_version" in
        #     4_1_*|4_2_*|4_3_*|4_4_*)
        #         BEST_LLDS_BASE_GRADE=none
        #     ;;
        # esac
     ;;
esac

# Force the use of the none grade on Apple x86_64 systems when using
# GCC 4.1 or 4.2. The asm_fast and reg grades do not work with those versions.
# They do work properly on x86_64 systems with GCC version 4.3 onwards.
#
case "$C_COMPILER_TYPE" in
    gcc_4_1_*|gcc_4_2_*)
        case "$host" in
            x86_64*apple*darwin*)
                BEST_LLDS_BASE_GRADE=none
                ;;
        esac
        ;;
esac

# Force the use of the none grade on x86/Darwin systems.
# XXX we should check whether asm_fast or reg work with recent GCCs.
# The asm_fast and reg grades also do not currently work on Linux/PPC.
#
case "$host" in
    i*86*apple*darwin*|powerpc*-linux-gnu)
        BEST_LLDS_BASE_GRADE=none
        ;;
esac

# 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|reg|asm_jump)
        DEFAULT_BASE_GRADE=hlc
        ;;
    asm_fast)
        DEFAULT_BASE_GRADE=$BEST_LLDS_BASE_GRADE
        ;;
    *)
        as_fn_error $? "invalid BEST_LLDS_BASE_GRADE $BEST_LLDS_BASE_GRADE" "$LINENO" 5
        ;;
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.


# Check whether --with-default-grade was given.
if test "${with_default_grade+set}" = set; then :
  withval=$with_default_grade; case "$withval" in
        # Handle `--with-default-grade' (no `=GRADE') and
        # `--without-default-grade' flags.
        yes|no)
            as_fn_error $? "Must supply a valid grade if using --with-default-grade." "$LINENO" 5
            ;;
        *)
            # Perhaps do better checking on the supplied value here.
            DEFAULT_GRADE="$withval"
            export DEFAULT_GRADE
            ;;
     esac
fi


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.

case $BEST_LLDS_BASE_GRADE in
    asm_fast)
        BEST_GRADE_FOR_COMPILER=asm_fast.gc
        ;;
    *)
        BEST_GRADE_FOR_COMPILER=hlc.gc
        ;;
esac

# 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. The C files in the
# source distribution are generated in hlc.gc.pregen or asm_fast.gc.pregen.
# In the former case, we _must_ use the grade hlc.gc.pregen, in the latter case
# we can, in principle, use any of the base LLDS grades (it's the same C code).
# We don't use fast and jump as they don't support code addresses in static
# initializers and we don't use asm_jump as it isn't regularly tested.

if test "$BOOTSTRAP_HLC" = "yes"
then
    BOOTSTRAP_GRADE=hlc.gc.pregen
else
    case $BEST_LLDS_BASE_GRADE in
        asm_jump|jump|fast)
            if test $mercury_cv_gcc_model_reg = yes; then
                BOOTSTRAP_GRADE=reg.gc.pregen
            else
                BOOTSTRAP_GRADE=none.gc.pregen
            fi
            ;;
        *)
            BOOTSTRAP_GRADE=$BEST_LLDS_BASE_GRADE.gc.pregen
            ;;
    esac
fi

# Choose whether to use $BOOTSTRAP_GRADE or $BEST_GRADE_FOR_COMPILER.
# Previously built C files will be checked for compatibility
# with these settings, and otherwise removed, later.

if test "$BOOTSTRAP_MC" = ""; then
    GRADE="$BOOTSTRAP_GRADE"
    if test "$DETECTED_MC" = ""
    then
        MC_UNAVAIL_MSG="Mercury compiler not yet installed"
    else
        MC_UNAVAIL_MSG="Installed Mercury compiler is not up to date"
    fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $MC_UNAVAIL_MSG -
****    cannot use grade '$BEST_GRADE_FOR_COMPILER'.
****    Using grade '$GRADE' to compile the compiler.
****    After installation is complete, you may reinstall
****    from scratch to have a faster compiler.
****    NOTE: before reinstalling from scratch, ensure that the
****    source tree is clean by running 'make realclean'. Not doing
****    this may result in a broken Mercury installation." >&5
$as_echo "$as_me: WARNING: $MC_UNAVAIL_MSG -
****    cannot use grade '$BEST_GRADE_FOR_COMPILER'.
****    Using grade '$GRADE' to compile the compiler.
****    After installation is complete, you may reinstall
****    from scratch to have a faster compiler.
****    NOTE: before reinstalling from scratch, ensure that the
****    source tree is clean by running 'make realclean'. Not doing
****    this may result in a broken Mercury installation." >&2;}
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 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 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 was given.
if test "${enable_nogc_grades+set}" = set; then :
  enableval=$enable_nogc_grades; enable_nogc_grades="$enableval"
else
  enable_nogc_grades=no
fi


# Not publicly documented since the agc grades are currently broken.
#
#  --enable-agc-grades     install accurate GC versions of the library
# Check whether --enable-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-debug-grades was given.
if test "${enable_debug_grades+set}" = set; then :
  enableval=$enable_debug_grades; enable_debug_grades="$enableval"
else
  enable_debug_grades=yes
fi


# Check whether --enable-decl-debug-grades was given.
if test "${enable_decl_debug_grades+set}" = set; then :
  enableval=$enable_decl_debug_grades; enable_decl_debug_grades="$enableval"
else
  enable_decl_debug_grades=yes
fi


# Check whether --enable-ssdebug-grades was given.
if test "${enable_ssdebug_grades+set}" = set; then :
  enableval=$enable_ssdebug_grades; enable_ssdebug_grades="$enableval"
else
  enable_ssdebug_grades=no
fi


# Check whether --enable-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-old-prof-grades was given.
if test "${enable_old_prof_grades+set}" = set; then :
  enableval=$enable_old_prof_grades; enable_old_prof_grades="$enableval"
else
  enable_old_prof_grades=yes
fi


# Check whether --enable-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 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 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-mmos-grades was given.
if test "${enable_mmos_grades+set}" = set; then :
  enableval=$enable_mmos_grades; enable_mmos_grades="$enableval"
else
  enable_mmos_grades=no
fi


# Check whether --enable-dmm-grades was given.
if test "${enable_dmm_grades+set}" = set; then :
  enableval=$enable_dmm_grades; enable_dmm_grades="$enableval"
else
  enable_dmm_grades=no
fi


# Check whether --enable-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-hlc-gdb-grades was given.
if test "${enable_hlc_gdb_grades+set}" = set; then :
  enableval=$enable_hlc_gdb_grades; enable_hlc_gdb_grades="$enableval"
else
  enable_hlc_gdb_grades=no
fi


# Check whether --enable-rbmm-grades was given.
if test "${enable_rbmm_grades+set}" = set; then :
  enableval=$enable_rbmm_grades; enable_rbmm_grades="$enableval"
else
  enable_rbmm_grades=no
fi


# Check whether --enable-stseg-grades was given.
if test "${enable_stseg_grades+set}" = set; then :
  enableval=$enable_stseg_grades; enable_stseg_grades="$enableval"
else
  enable_stseg_grades="no"
fi


# Check whether --enable-minimal-install was given.
if test "${enable_minimal_install+set}" = set; then :
  enableval=$enable_minimal_install; enable_min_install="$enableval"
else
  enable_min_install="no"
fi


# Check whether --enable-csharp-grade was given.
if test "${enable_csharp_grade+set}" = set; then :
  enableval=$enable_csharp_grade; enable_csharp_grade="$enableval"
else
  enable_csharp_grade=yes
fi


# Check whether --enable-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 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


# Check whether --enable-additional-libgrades was given.
if test "${enable_additional_libgrades+set}" = set; then :
  enableval=$enable_additional_libgrades; enable_additional_libgrades_given=yes;enable_additional_libgrades="$enableval"
else
  enable_additional_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_old_prof_grades=no
    enable_trail_grades=no
    enable_mm_grades=no
    enable_mmos_grades=no
    enable_dmm_grades=no
    enable_hlc_prof_grades=no
    enable_hlc_gdb_grades=no
    enable_rbmm_grades=no
    enable_par_grades=no
    enable_stseg_grades=no
    enable_csharp_grade=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"

# 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
    if test "$enable_old_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 is 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"
    fi

    # Add a `.profdeep' (--deep-profiling) grade, if deep profiling is enabled.
    # By default, we also use stack segments with deep profiling.
    if test $mercury_cv_enable_deep_profiler = yes; then
        LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.profdeep.stseg"
    fi
fi

if test "$enable_trail_grades" = yes; then
    LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.tr"
    if test $DEFAULT_BASE_GRADE = hlc; then
        LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.debug.tr.stseg"
    else
        # $DEFAULT_BASE_GRADE must be an LLDS grade
        LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.gc.debug.tr.stseg hlc.gc.tr"
    fi
    if test "$enable_inefficient_grades" = yes; then
        if test "$enable_nogc_grades" = yes; then
            LIBGRADES="$LIBGRADES $DEFAULT_BASE_GRADE.tr"
        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.mmsc \
        $BEST_LLDS_BASE_GRADE.gc.mmsc.debug"
    if test "$enable_dmm_grades" = yes; then
        LIBGRADES="$LIBGRADES \
            $BEST_LLDS_BASE_GRADE.gc.dmmsc \
            $BEST_LLDS_BASE_GRADE.gc.dmmsc.debug"
    fi
fi

# Add `.mmos' grades.
if test "$enable_mmos_grades" = yes; then
    LIBGRADES="$LIBGRADES \
        $BEST_LLDS_BASE_GRADE.gc.mmos \
        $BEST_LLDS_BASE_GRADE.gc.mmos.debug"
    if test "$enable_dmm_grades" = yes; then
        LIBGRADES="$LIBGRADES \
            $BEST_LLDS_BASE_GRADE.gc.dmmos \
            $BEST_LLDS_BASE_GRADE.gc.dmmos.debug"
    fi
fi

# Add `.debug' (--debug) and `.decldebug' (--decl-debug) grades.
# By default, we also use stack segments in debugging grades.
#
if test "$enable_debug_grades" = yes; then
    LIBGRADES="$LIBGRADES $BEST_DEBUG_BASE_GRADE.gc.debug.stseg"
    if test "$enable_decl_debug_grades" = yes; then
        LIBGRADES="$LIBGRADES $BEST_DEBUG_BASE_GRADE.gc.decldebug.stseg"
    fi
fi

# Add grades that support debugging using gdb and other debuggers for C.
if test "$enable_hlc_gdb_grades" = yes; then
    LIBGRADES="$LIBGRADES hlc.gcd.target_debug"
fi

# Add rbmm grades.
if test "$enable_rbmm_grades" = yes; then
    # As of Oct 2007, all the users of RBMM grades are implementors
    # who may need the debugging and profiling versions.
    LIBGRADES="$LIBGRADES \
        $BEST_LLDS_BASE_GRADE.gc.rbmm \
        $BEST_LLDS_BASE_GRADE.gc.rbmmd \
        $BEST_LLDS_BASE_GRADE.gc.rbmmp \
        $BEST_LLDS_BASE_GRADE.gc.rbmmdp"
fi

# Add the .par (thread-safe) grade, if it is supported for this system
# Only enable it if this system has pthreads installed.
# For the low-level C backend we also enable stack segments by default.
#
if test "$enable_par_grades" = yes -a "$CFLAGS_FOR_THREADS" != "" \
    -a "$MR_HAVE_PTHREAD_H" = 1
then
    LIBGRADES="$LIBGRADES hlc.par.gc $BEST_LLDS_BASE_GRADE.par.gc.stseg"
fi

# Add the .stseg (stack segments) version of the library.
if test "$enable_stseg_grades" = "yes"
then
    LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.stseg"
    if test "$enable_trail_grades" = "yes"
    then
        LIBGRADES="$LIBGRADES $BEST_LLDS_BASE_GRADE.gc.tr.stseg"
    fi
fi

# Add C# back-end grade, if a C# compiler is installed.
if test "$CSC" != "" -a "$enable_csharp_grade" = yes
then
    LIBGRADES="$LIBGRADES csharp"
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

# Add `.ssdebug' grades.
if test "$enable_ssdebug_grades" = yes; then
    # LLDS has better debug grades available.
    case "$LIBGRADES" in
        *hlc.gc*) LIBGRADES="$LIBGRADES hlc.gc.ssdebug" ;;
    esac
    case "$LIBGRADES" in
        *csharp*) LIBGRADES="$LIBGRADES csharp.ssdebug" ;;
    esac
    case "$LIBGRADES" in
        *java*) LIBGRADES="$LIBGRADES java.ssdebug" ;;
    esac
fi

# If this option is enabled then install only the grade that is being
# used to build the compiler.
# Also, override the grade that was chosen as the default grade above
# since it may not match the one that is going to be used to build
# the compiler.
#
if test "$enable_min_install" = yes
then
    LIBGRADES="$BEST_GRADE_FOR_COMPILER"
    DEFAULT_GRADE="$BEST_GRADE_FOR_COMPILER"
fi

echo SETTING UP CANONICAL GRADES
# Allow the user to override the default list of library grades.
cat /dev/null > .canonical_grades
# Record any bad grades both in the configured grade list (in .bad_conf_grades)
# and in the override grade list (in .bad_added_grades).
cat /dev/null > .bad_conf_grades
cat /dev/null > .bad_added_grades
conf_grade_error=false
added_grade_error=false

if test "$enable_libgrades_given" = no -a -f .enable_lib_grades ; then
    echo "using .enable_libgrades as the source for the set of grades to install" 1>&6
    enable_libgrades=`cat .enable_lib_grades`
    enable_libgrades_given=yes
fi

if test "$enable_libgrades_given" = yes; then
    if test "$enable_libgrades" = no; then
        as_fn_error $? "--enable-libgrades requires a comma-separated
    list of grades as argument" "$LINENO" 5

    elif test "$enable_libgrades" = yes; then
        as_fn_error $? "--enable-libgrades requires a comma-separated
    list of grades as argument" "$LINENO" 5

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

            # echo CANONICAL
            # cat .canonical_grades
            # echo END CANONICAL
        done

        canonical_grades=`sort -u .canonical_grades`
        rm -f .confgrade .canonical_grades > /dev/null 2>&1

        if $added_grade_error
        then
            as_fn_error $? "invalid grade(s) specified for --enable-libgrades" "$LINENO" 5
        fi

        LIBGRADES=$canonical_grades
    fi
else
    for raw_grade in $LIBGRADES
    do
        # echo TESTING AUTOCONFIGURED LIBGRADE $raw_grade
        if ! test -x scripts/canonical_grade
        then
            echo $raw_grade >> .canonical_grades
        elif scripts/canonical_grade --grade $raw_grade > .confgrade
        then
            cat .confgrade >> .canonical_grades
        else
            conf_grade_error=true
            echo $raw_grade >> .bad_conf_grades
        fi
    done

    if test "$enable_additional_libgrades_given" = yes; then
        if test "$enable_additional_libgrades" = no; then
            as_fn_error $? "--enable-additional-libgrades requires a comma-separated
    list of grades as argument" "$LINENO" 5

        elif test "$enable_additional_libgrades" = yes; then
            as_fn_error $? "--enable-additional-libgrades requires a comma-separated
    list of grades as argument" "$LINENO" 5

        else
            # Add the grades specified by the user to the list
            added_grades=`echo $enable_additional_libgrades | sed 's/,/ /g'`
            for raw_grade in $added_grades
            do
                # echo TESTING ADDITIONAL LIBGRADE $raw_grade
                if ! test -x scripts/canonical_grade
                then
                    echo $raw_grade >> .canonical_grades
                elif scripts/canonical_grade --grade $raw_grade > .confgrade
                then
                    cat .confgrade >> .canonical_grades
                else
                    echo "--enable-additional-libgrades: $raw_grade is not a grade" 1>&6
                    added_grade_error=true
                    echo $raw_grade >> .bad_added_grades
                fi
            done
        fi
    fi

    if $conf_grade_error
    then
        as_fn_error $? "internal error: configure script generates invalid grade(s)" "$LINENO" 5
    fi

    if $added_grade_error
    then
        as_fn_error $? "invalid grade(s) specified for --enable-additional-libgrades" "$LINENO" 5
    fi

    canonical_grades=`sort -u .canonical_grades`
    rm -f .confgrade .canonical_grades > /dev/null 2>&1

    LIBGRADES=$canonical_grades
fi

# The echo deletes the initial space character.
LIBGRADES=`echo $LIBGRADES`

# Check that the default grade is in the set of grades to install.
have_default_grade="no"
for libgrade in $LIBGRADES
do
    if test "$DEFAULT_GRADE" = "$libgrade"
    then
        have_default_grade="yes"
    fi
done

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=2
        # but succip and sp are real regs, so subtract 2
        NUM_REAL_R_REGS=0
        NUM_REAL_R_TEMPS=0
        HAVE_DELAY_SLOT=
        ;;
    x86_64*)
        # NUM_REAL_REGS=4
        # but succip and sp are real regs, so subtract 2
        NUM_REAL_R_REGS=2
        NUM_REAL_R_TEMPS=0
        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=
        ;;
    arm*-*)
        # NUM_REAL_REGS=4
        # but succip and sp are real regs, so subtract 2
        NUM_REAL_R_REGS=2
        NUM_REAL_R_TEMPS=0
        HAVE_DELAY_SLOT=
        ;;
    *)
        NUM_REAL_R_REGS=0
        NUM_REAL_R_TEMPS=6
        HAVE_DELAY_SLOT=
        ;;
esac




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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the assembler handles .type" >&5
$as_echo_n "checking whether the assembler handles .type... " >&6; }
if ${mercury_cv_cannot_grok_asm_type_directive+:} false; then :
  $as_echo_n "(cached) " >&6
else

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

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_grok_type_directive" >&5
$as_echo "$can_grok_type_directive" >&6; }
if test $mercury_cv_cannot_grok_asm_type_directive = "yes"; then
    $as_echo "#define MR_CANNOT_GROK_ASM_TYPE_DIRECTIVE 1" >>confdefs.h

fi

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

# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_AS+:} false; then :
  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_AS="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
AS=$ac_cv_path_AS
if test -n "$AS"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
$as_echo "$AS" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the assembler does full preprocessing" >&5
$as_echo_n "checking whether the assembler does full preprocessing... " >&6; }

if ${mercury_cv_asm_does_full_preprocessing+:} false; then :
  $as_echo_n "(cached) " >&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

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_asm_does_full_preprocessing" >&5
$as_echo "$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


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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether structure assignment conflicts with global registers" >&5
$as_echo_n "checking whether structure assignment conflicts with global registers... " >&6; }
if ${mercury_cv_cannot_use_structure_assignment+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "cannot run test program while cross compiling
See \`config.log' for more details" "$LINENO" 5; }
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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_SpyPoint     spied_procs2;

        int main() {
            spied_procs1 = spied_procs0;
        #if (__GNUC__ >= 3) && defined(__i386__)
            /* gcc 3.1 seems to have problems with structure assignment
               and global registers, but which this simple test case
               does not trigger. So just force the test to fail for gcc 3.x. */
            exit(1);
        #else
            exit(0);
        #endif
        }


_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
  mercury_cv_cannot_use_structure_assignment=no
else
  mercury_cv_cannot_use_structure_assignment=yes
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
  conftest.$ac_objext conftest.beam conftest.$ac_ext
fi


fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mercury_cv_cannot_use_structure_assignment" >&5
$as_echo "$mercury_cv_cannot_use_structure_assignment" >&6; }
if test $mercury_cv_cannot_use_structure_assignment = "yes"; then
    $as_echo "#define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT 1" >>confdefs.h

fi

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

# Allow the user to override the default value of MACOSX_DEPLOYMENT_TARGET.
# We use the version of the host system for the default value.
# XXX if we ever support Mac OS X as a cross-compiling target we should
# force the user to set a value using --with-macosx-deployment-target.


# Check whether --with-macosx-deployment-target was given.
if test "${with_macosx_deployment_target+set}" = set; then :
  withval=$with_macosx_deployment_target; mercury_cv_macosx_deployment_target="$withval"
else
  mercury_cv_macosx_deployment_target="auto"

fi


case "$mercury_cv_macosx_deployment_target" in
    yes)
        as_fn_error $? "missing argument to --with-macosx-deployment-target=... option" "$LINENO" 5
        exit 1
        ;;
    no)
        as_fn_error $? "invalid option --without-macosx-deployment-target" "$LINENO" 5
        exit 1
        ;;
esac

DEPLOYMENT_TARGET="no"

case "$host" in
    *apple*darwin*)
        case "$mercury_cv_macosx_deployment_target" in
            auto)
                if test -n "${MACOSX_DEPLOYMENT_TARGET:-}"
                then
                    DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET"
                else
                    # NOTE: the sw_vers utility tells us which version of
                    # Mac OS X we are using as opposed to which version of
                    # Darwin we are using. uname only reports the latter.
                    DEPLOYMENT_TARGET=`sw_vers -productVersion | cut -d \. -f 1 -f 2`
                fi
                ;;
            *)
                DEPLOYMENT_TARGET="$mercury_cv_macosx_deployment_target"
                ;;
        esac

        if test "$DEPLOYMENT_TARGET" = "no"
        then
            as_fn_error $? "cannot determine deployment target for this system" "$LINENO" 5
        fi
        ;;
esac

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Mercury supports shared libraries on this system" >&5
$as_echo_n "checking whether Mercury supports shared libraries on this system... " >&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 "$MERCURY_HAVE_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,"

SHLIB_USE_INSTALL_NAME=""
SHLIB_INSTALL_NAME_FLAG="-install_name "

CFLAGS_FOR_PIC="-fpic -DMR_PIC"
EXT_FOR_PIC_OBJECTS=pic_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"

if test "$mercury_cv_enable_shared_libs" = "yes"; then
    case "$host" in
        i*86-*-linux|i*86-*-linux-gnu|x86_64-*-linux*)
            case "$ac_cv_c_compiler_gnu" in
                yes)
                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
                    EXT_FOR_SHARED_LIB=so
                    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if linker supports --no-undefined" >&5
$as_echo_n "checking if linker supports --no-undefined... " >&6; }
                    rm -f conftest*
                    if test "$mercury_cv_thread_local_storage" = yes; then
                        # --no-undefined doesn't work with TLS
                        # and older versions of glibc.
                        echo "__thread int x;
                        int main(void) { return x; }" > conftest.c
                        $CC -Wl,--no-undefined -fPIC -shared \
                            -o conftest conftest.c 2>/dev/null
                    else
                        echo "int main(void) { return 0; }" > conftest.c
                        $CC -Wl,--no-undefined -o conftest conftest.c
                    fi
                    if test -f conftest; then
                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
                        ERROR_UNDEFINED="-Wl,--no-undefined"

                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld-linux.so" >&5
$as_echo_n "checking for ld-linux.so... " >&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*)
                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_linux" >&5
$as_echo "$ld_linux" >&6; }
                                SHARED_LIBS="$SHARED_LIBS $ld_linux"
                                SHARED_LIBS_SH="$SHARED_LIBS_SH $ld_linux"
                                ;;
                            *)
                                { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                                ;;
                        esac
                    else
                        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                    fi
                    rm -f conftest*
                    ;;
                *)
                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                    ;;
            esac

            # On x86_64 machines we use -fPIC rather than -fpic
            # in order to avoid limits on the size of the global
            # offset table implied by the latter.
            case "$host" in
                x86_64-*-linux*)
                    CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
                    ;;
            esac
            ;;
        m68*-linux|m68*-linux-gnu)
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            EXT_FOR_SHARED_LIB=so
            ;;
        aarch64*-linux|aarch64*-linux-gnu)
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            # On aarch64 machines we must use -fPIC rather than -fpic in order
            # to avoid limits on the size of the global offset table.
            CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
            EXT_FOR_SHARED_LIB=so
            ;;
        *-freebsd*)
            # Tested on FreeBSD 10.1 i386/amd64.
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            EXT_FOR_SHARED_LIB=so
            ;;
        *-openbsd*)
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            EXT_FOR_SHARED_LIB=so
            ;;
        i*86-*-solaris2.*)
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "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.*)
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "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

            # 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.

            EXT_FOR_SHARED_LIB=so
            ;;
        *-cygwin*)
            # Disabled for now, since it hasn't been tested.
            # xxx_MSG_RESULT(yes)
            # EXT_FOR_SHARED_LIB=dll
            # USE_DLLS=yes
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled for now because it is untested" >&5
$as_echo "disabled for now because it is untested" >&6; }

            CFLAGS_FOR_PIC=
            EXT_FOR_PIC_OBJECTS=o
            DEFAULT_LINKAGE=static
            ;;
        *mingw*)
            # disabled for now, since it hasn't been tested
            # xxx_MSG_RESULT(yes)
            # EXT_FOR_SHARED_LIB=dll
            # USE_DLLS=yes
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled for now because it is untested" >&5
$as_echo "disabled for now because it is untested" >&6; }

            CFLAGS_FOR_PIC=
            EXT_FOR_PIC_OBJECTS=o
            DEFAULT_LINKAGE=static
            ;;
        *apple*darwin*)
            # If the compiler is gcc or clang then use Darwin style dynamic
            # linking. Otherwise use static linking.
            case "$C_COMPILER_TYPE" in
                gcc*|clang*)
                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
                    SHLIB_USE_INSTALL_NAME="--shlib-linker-use-install-name"
                    SHLIB_INSTALL_NAME_FLAG="-install_name "
                    EXT_FOR_SHARED_LIB=dylib
                    CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
                    ERROR_UNDEFINED="-undefined error"
                    # The MACOSX_DEPLOYMENT_TARGET environment variable needs to be
                    # set so we can use the `-undefined dynamic_lookup' option.
                    SET_MACOSX_DEPLOYMENT_TARGET="\
                        MACOSX_DEPLOYMENT_TARGET=$DEPLOYMENT_TARGET; \
                        export MACOSX_DEPLOYMENT_TARGET"

                    LINK_SHARED_OBJ="$CC -multiply_defined suppress \
                         -dynamiclib -single_module"
                    LINK_SHARED_OBJ_SH="$CC -multiply_defined \
                        suppress -dynamiclib -single_module"
                    ALLOW_UNDEFINED="-undefined dynamic_lookup"
                    ;;

                *)
                    CFLAGS_FOR_PIC=
                    EXT_FOR_PIC_OBJECTS=o
                    DEFAULT_LINKAGE=static
                    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
                    ;;
            esac
            ;;
        arm*-linux|arm*-linux-gnu)
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
            EXT_FOR_SHARED_LIB=so
            # One can build gcc with a default PIC register other than sl
            # so let's force it. If you change this,
            # update MR_ARM_PIC_REG in runtime/mercury_goto.h as well.
            CFLAGS_FOR_PIC="-mpic-register=sl $CFLAGS_FOR_PIC"
            ;;
        *)
            # 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
            DEFAULT_LINKAGE=static
            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
            ;;
    esac
else
    # 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
    DEFAULT_LINKAGE=static
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

#-----------------------------------------------------------------------------#
#
# Note that changes here may require changes in scripts/mgnuc.in and
# compiler/compile_target_code.m.

# Older versions of clang / LLVM cannot compile the C code generated by the
# Mercury compiler at higher optimization levels.
#
OPT_FLAGS_FOR_CLANG="-O0"

case "$mercury_cv_cc_type" in

    gcc*)
        # 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"

        # See scripts/mgnuc.in for an explanation of why we set
        # -Wno-array-bounds here.
        case "$C_COMPILER_TYPE" in
            gcc_9_*|gcc_1[0-9]_*)
                CFLAGS_FOR_WARNINGS="$CFLAGS_FOR_WARNINGS -Wno-array-bounds"
            ;;
        esac

        # Enabling -fomit-frame-pointer causes setjmp/longjmp to misbehave
        # with MinGW on Windows XP.
        case "$host" in
            *mingw*) CFLAGS_FOR_OPT="-O2" ;;
            *)       CFLAGS_FOR_OPT="-O2 -fomit-frame-pointer" ;;
        esac

        # Disable the GCC optimization -ftree-vrp with GCC 4.2. on Darwin
        # since enabling it causes code in the hlc.gc grade to be miscompiled.
        case "$host" in
            *apple*darwin*)
                case "$C_COMPILER_TYPE" in
                    gcc_4_2_*)
                        CFLAGS_FOR_OPT="$CFLAGS_FOR_OPT -fno-tree-vrp"
                        ;;
                esac
                ;;
        esac

        CFLAGS_FOR_DEBUG="-g"
        CFLAGS_FOR_NO_STRICT_ALIASING="-fno-strict-aliasing"
        MCFLAGS_FOR_CC=
        ;;

    clang*)
        # XXX we need go through the warning and optimization options for clang
        # more carefully.
        CFLAGS_FOR_WARNINGS="-w"

        # Disable C compiler optimizations for old versions of clang.
        # (See above for details.)
        case "$C_COMPILER_TYPE" in
            clang_0_*|clang_1_*|clang_2_*)
                CFLAGS_FOR_OPT="-O0 -fomit-frame-pointer"
            ;;
            *)
                CFLAGS_FOR_OPT="-O2 -fomit-frame-pointer"
                OPT_FLAGS_FOR_CLANG="-O2"
            ;;
        esac
        CFLAGS_FOR_DEBUG="-g"
        CFLAGS_FOR_NO_STRICT_ALIASING="-fno-strict-aliasing"
        MCFLAGS_FOR_CC=
        ;;

    msvc*)
        # Suppress the MSVC banner message.
        CFLAGS_FOR_WARNINGS="-nologo"
        CFLAGS_FOR_OPT=
        # XXX See README.MS-Visual C for details of why we disable this.
        #CFLAGS_FOR_DEBUG="-Zi"
        CFLAGS_FOR_DEBUG=
        CFLAGS_FOR_NO_STRICT_ALIASING=

        # 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"
        ;;

    *)
        CFLAGS_FOR_OPT="-O"
        CFLAGS_FOR_WARNINGS=
        CFLAGS_FOR_DEBUG="-g"
        CFLAGS_FOR_NO_STRICT_ALIASING=
        MCFLAGS_FOR_CC=
        ;;
esac

CFLAGS_FOR_OPT="$CFLAGS_FOR_OPT $CFLAGS_FOR_NO_STRICT_ALIASING"









#-----------------------------------------------------------------------------#
#
# Work out how to link statically
#

# Note that changes here may require changes in scripts/ml.in.

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking options for static linking" >&5
$as_echo_n "checking options for static linking... " >&6; }
LD_STATIC_FLAGS=
case "$C_COMPILER_TYPE" in
    gcc*|clang*)
        LD_STATIC_FLAGS=-static
        ;;
esac
case "$FULLARCH" in
    *-sun-solaris*)
        case "$COMPILER" in
            cc)
                LD_STATIC_FLAGS="-B static"
                ;;
        esac
        ;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD_STATIC_FLAGS" >&5
$as_echo "$LD_STATIC_FLAGS" >&6; }

if test "$USING_MICROSOFT_CL_COMPILER" = "no"
then
    case "$LD_STATIC_FLAGS" in
        "")
          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: options for static linking unknown for this C compiler ('$CC')." >&5
$as_echo "$as_me: WARNING: options for static linking unknown for this C compiler ('$CC')." >&2;}
        ;;
    esac
fi

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

case "$host" in
    *-cygwin*)
        EXT_FOR_EXE=".exe"
        HOST_ENV_TYPE=cygwin
        TARGET_ENV_TYPE=cygwin
        ;;
    *mingw*)
        EXT_FOR_EXE=".exe"
        HOST_ENV_TYPE=msys
        TARGET_ENV_TYPE=msys
        ;;
    *)
        EXT_FOR_EXE=
        HOST_ENV_TYPE=posix
        TARGET_ENV_TYPE=posix
        ;;
esac

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
























if test "$USE_DLLS" = "yes"; then
    $as_echo "#define MR_USE_DLLS 1" >>confdefs.h

fi

#-----------------------------------------------------------------------------#
#
# Sanitizers
#

# Check whether --enable-sanitizers was given.
if test "${enable_sanitizers+set}" = set; then :
  enableval=$enable_sanitizers; ac_sanitizers="$enableval"
else
  ac_sanitizers=no
fi


case "$C_COMPILER_TYPE" in
    gcc*)
        if test "$ac_sanitizers" = yes
        then
            CFLAGS_FOR_SANITIZERS="-fsanitize=address,undefined"
            LDFLAGS_FOR_SANITIZERS="-fsanitize=address,undefined -pthread"
        fi
        ;;
    *)
        CFLAGS_FOR_SANITIZERS=
        LDFLAGS_FOR_SANITIZERS=
        ;;
esac




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

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




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

# 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

# The following allows us to duplicate a subroutine in mgnuc.

MGNUC_FILE_OPTS=$top/scripts/mgnuc_file_opts.sh-subr

# demangling hangs on cygwin, so don't enable it.
case "$host" in
    *-cygwin*)
        DEMANGLE=false
        ;;
    *)
        DEMANGLE=true
        ;;
esac









# 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 times predicate in library/time.m.
#

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct tms and times function" >&5
$as_echo_n "checking for struct tms and times function... " >&6; }
if ${mercury_cv_have_posix_times+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_posix_times=yes
else
  mercury_cv_have_posix_times=no
fi
rm -f core 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
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
    $as_echo "#define MR_HAVE_POSIX_TIMES 1" >>confdefs.h

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

#-----------------------------------------------------------------------------#
#
# Check for the environ global variable.
#

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for environ global variable" >&5
$as_echo_n "checking for environ global variable... " >&6; }
if ${mercury_cv_have_environ+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

        #include <unistd.h>

        extern char **environ;

int
main ()
{

        environ

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_environ=yes
else
  mercury_cv_have_environ=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
fi


# Figure out whether the test succeeded.
if test "$mercury_cv_have_environ" = yes; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
    $as_echo "#define MR_HAVE_ENVIRON 1" >>confdefs.h

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

#-----------------------------------------------------------------------------#
#
# Check for the WIN32 Sleep function.
#

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sleep function" >&5
$as_echo_n "checking for Sleep function... " >&6; }
if ${mercury_cv_have_capital_s_sleep+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

        #include <windows.h>

int
main ()
{

        Sleep(1);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_capital_s_sleep=yes
else
  mercury_cv_have_capital_s_sleep=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
fi


if test "$mercury_cv_have_capital_s_sleep" = yes; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
    $as_echo "#define MR_HAVE_CAPITAL_S_SLEEP 1" >>confdefs.h

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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=`$as_echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$mercury_cv_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :

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

		eval "$mercury_cv_header_define=1"

fi


    done




{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isnan function" >&5
$as_echo_n "checking for isnan function... " >&6; }
mercury_cv_ieee_func_define="MR_HAVE_`echo isnan | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

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

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

int
main ()
{

	float f;
	isnan(f);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_ieee_func=yes
else
  mercury_cv_have_ieee_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

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

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isnanf function" >&5
$as_echo_n "checking for isnanf function... " >&6; }
mercury_cv_ieee_func_define="MR_HAVE_`echo isnanf | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

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

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

int
main ()
{

	float f;
	isnanf(f);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_ieee_func=yes
else
  mercury_cv_have_ieee_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

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

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf function" >&5
$as_echo_n "checking for isinf function... " >&6; }
mercury_cv_ieee_func_define="MR_HAVE_`echo isinf | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

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

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

int
main ()
{

	float f;
	isinf(f);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_ieee_func=yes
else
  mercury_cv_have_ieee_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

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

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinff function" >&5
$as_echo_n "checking for isinff function... " >&6; }
mercury_cv_ieee_func_define="MR_HAVE_`echo isinff | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

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

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

int
main ()
{

	float f;
	isinff(f);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_ieee_func=yes
else
  mercury_cv_have_ieee_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

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

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for finite function" >&5
$as_echo_n "checking for finite function... " >&6; }
mercury_cv_ieee_func_define="MR_HAVE_`echo finite | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

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

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

int
main ()
{

	float f;
	finite(f);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_ieee_func=yes
else
  mercury_cv_have_ieee_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

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

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isfinite function" >&5
$as_echo_n "checking for isfinite function... " >&6; }
mercury_cv_ieee_func_define="MR_HAVE_`echo isfinite | \
	tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"

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

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

int
main ()
{

	float f;
	isfinite(f);

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_have_ieee_func=yes
else
  mercury_cv_have_ieee_func=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext

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

else
	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


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

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

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char socket ();
int
main ()
{
return socket ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_socket_socket=yes
else
  ac_cv_lib_socket_socket=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5
$as_echo "$ac_cv_lib_socket_socket" >&6; }
if test "x$ac_cv_lib_socket_socket" = xyes; then :
  SOCKET_LIBRARY=-lsocket
else
  SOCKET_LIBRARY=""
fi


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

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char inet_addr ();
int
main ()
{
return inet_addr ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_nsl_inet_addr=yes
else
  ac_cv_lib_nsl_inet_addr=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_inet_addr" >&5
$as_echo "$ac_cv_lib_nsl_inet_addr" >&6; }
if test "x$ac_cv_lib_nsl_inet_addr" = xyes; then :
  NSL_LIBRARY=-lnsl
else
  NSL_LIBRARY=""
fi


# Temporarily add -lsocket to LIBS, for use by LINK_ELSEIF.
#
save_LIBS="$LIBS"
LIBS="$LIBS $SOCKET_LIBRARY $NSL_LIBRARY"

# Use LINK_ELSEIF to see whether we can use sockets.
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use sockets (for Morphine)" >&5
$as_echo_n "checking whether we can use sockets (for Morphine)... " >&6; }
if ${mercury_cv_sockets_work+:} false; then :
  $as_echo_n "(cached) " >&6
else
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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);

            /*
            ** Connect to the socket
            */
            connect(fd, addr, len);

            /*
            ** Convert the socket fd to a Mercury stream
            */
            file_in = fdopen(fd, "r");
            file_out = fdopen(fd, "w");
        }

  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  mercury_cv_sockets_work=yes
else
  mercury_cv_sockets_work=no
fi
rm -f core 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
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "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 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


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the external debugger" >&5
$as_echo_n "checking whether to enable the external debugger... " >&6; }
if test "$mercury_cv_enable_extern_debug" = "yes"; then
    if test "$mercury_cv_sockets_work" = yes; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        $as_echo "#define MR_USE_EXTERNAL_DEBUGGER 1" >>confdefs.h

    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
        as_fn_error $? "Cannot enable external debugger because sockets do not work" "$LINENO" 5
    fi
else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

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




#-----------------------------------------------------------------------------#
#
# Check libraries for dynamic linking.
#

# XXX this is poorly named.
# Check whether --enable-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=`$as_echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$mercury_cv_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :

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

		eval "$mercury_cv_header_define=1"

fi


    done

    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
$as_echo_n "checking for dlopen in -ldl... " >&6; }
if ${ac_cv_lib_dl_dlopen+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char dlopen ();
int
main ()
{
return dlopen ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_dl_dlopen=yes
else
  ac_cv_lib_dl_dlopen=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
if test "x$ac_cv_lib_dl_dlopen" = xyes; 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_BASE_LIBS_SYSTEM="$SOCKET_LIBRARY $NSL_LIBRARY $DL_LIBRARY"


#-----------------------------------------------------------------------------#
#
# Check whether to use the MercuryFile struct.
#

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable the new MercuryFile struct" >&5
$as_echo_n "checking whether to enable the new MercuryFile struct... " >&6; }
# Check whether --enable-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
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
    $as_echo "#define MR_NEW_MERCURYFILE_STRUCT 1" >>confdefs.h

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

#-----------------------------------------------------------------------------#
#
# Check whether to disable the use of tagged trail entries.
#

# Check whether --enable-tagged-trail was given.
if test "${enable_tagged_trail+set}" = set; then :
  enableval=$enable_tagged_trail; ac_tagged_trail="$enableval"
else
  ac_tagged_trail=yes
fi


if test "$ac_tagged_trail" = "no"
then
    $as_echo "#define MR_FORCE_NO_TAGGED_TRAIL 1" >>confdefs.h

fi

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


# Check whether --with-msvcrt was given.
if test "${with_msvcrt+set}" = set; then :
  withval=$with_msvcrt; mercury_cv_msvcrt=yes
else
  mercury_cv_msvcrt=no
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use the MS Visual C Runtime" >&5
$as_echo_n "checking whether to use the MS Visual C Runtime... " >&6; }
if test "$mercury_cv_msvcrt" = "yes"; then
    if test "$ac_microsoft" = "yes"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
        USE_MSVCRT=yes
    else
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no as not using the MS C compiler" >&5
$as_echo "no as not using the MS C compiler" >&6; }
        USE_MSVCRT=no
    fi
else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
    USE_MSVCRT=no
fi


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

# Check whether --enable-lto was given.
if test "${enable_lto+set}" = set; then :
  enableval=$enable_lto; mercury_cv_lto=yes
else
  mercury_cv_lto=no
fi


USE_LINK_TIME_OPT=$mercury_cv_lto


if test "$mercury_cv_lto" = "yes"; then
    case "$C_COMPILER_TYPE" in
        msvc*)
            CFLAGS_FOR_LTO="-GL"
            LDFLAGS_FOR_LTO="-LTCG"
            ;;
        gcc*)
            CFLAGS_FOR_LTO="-flto"
            LDFLAGS_FOR_LTO="-flto"
            LINK_SHARED_OBJ="$LINK_SHARED_OBJ -flto"
            LINK_SHARED_OBJ_SH="$LINK_SHARED_OBJ_SH -flto"
            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}gcc-ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc-ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GCC_AR+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$GCC_AR"; then
  ac_cv_prog_GCC_AR="$GCC_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_GCC_AR="${ac_tool_prefix}gcc-ar"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
GCC_AR=$ac_cv_prog_GCC_AR
if test -n "$GCC_AR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_AR" >&5
$as_echo "$GCC_AR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_GCC_AR"; then
  ac_ct_GCC_AR=$GCC_AR
  # Extract the first word of "gcc-ar", so it can be a program name with args.
set dummy gcc-ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_GCC_AR+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_GCC_AR"; then
  ac_cv_prog_ac_ct_GCC_AR="$ac_ct_GCC_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_GCC_AR="gcc-ar"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_GCC_AR=$ac_cv_prog_ac_ct_GCC_AR
if test -n "$ac_ct_GCC_AR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GCC_AR" >&5
$as_echo "$ac_ct_GCC_AR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_GCC_AR" = x; then
    GCC_AR=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    GCC_AR=$ac_ct_GCC_AR
  fi
else
  GCC_AR="$ac_cv_prog_GCC_AR"
fi

            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}gcc-ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc-ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GCC_RANLIB+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$GCC_RANLIB"; then
  ac_cv_prog_GCC_RANLIB="$GCC_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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_GCC_RANLIB="${ac_tool_prefix}gcc-ranlib"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
GCC_RANLIB=$ac_cv_prog_GCC_RANLIB
if test -n "$GCC_RANLIB"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_RANLIB" >&5
$as_echo "$GCC_RANLIB" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_GCC_RANLIB"; then
  ac_ct_GCC_RANLIB=$GCC_RANLIB
  # Extract the first word of "gcc-ranlib", so it can be a program name with args.
set dummy gcc-ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_GCC_RANLIB+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_GCC_RANLIB"; then
  ac_cv_prog_ac_ct_GCC_RANLIB="$ac_ct_GCC_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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_GCC_RANLIB="gcc-ranlib"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_GCC_RANLIB=$ac_cv_prog_ac_ct_GCC_RANLIB
if test -n "$ac_ct_GCC_RANLIB"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GCC_RANLIB" >&5
$as_echo "$ac_ct_GCC_RANLIB" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_GCC_RANLIB" = x; then
    GCC_RANLIB=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    GCC_RANLIB=$ac_ct_GCC_RANLIB
  fi
else
  GCC_RANLIB="$ac_cv_prog_GCC_RANLIB"
fi

            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}gcc-nm", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc-nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GCC_NM+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$GCC_NM"; then
  ac_cv_prog_GCC_NM="$GCC_NM" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_GCC_NM="${ac_tool_prefix}gcc-nm"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
GCC_NM=$ac_cv_prog_GCC_NM
if test -n "$GCC_NM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCC_NM" >&5
$as_echo "$GCC_NM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_GCC_NM"; then
  ac_ct_GCC_NM=$GCC_NM
  # Extract the first word of "gcc-nm", so it can be a program name with args.
set dummy gcc-nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_GCC_NM+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_GCC_NM"; then
  ac_cv_prog_ac_ct_GCC_NM="$ac_ct_GCC_NM" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_GCC_NM="gcc-nm"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_GCC_NM=$ac_cv_prog_ac_ct_GCC_NM
if test -n "$ac_ct_GCC_NM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GCC_NM" >&5
$as_echo "$ac_ct_GCC_NM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_GCC_NM" = x; then
    GCC_NM=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    GCC_NM=$ac_ct_GCC_NM
  fi
else
  GCC_NM="$ac_cv_prog_GCC_NM"
fi

            AR=${GCC_AR:-$AR}
            RANLIB=${GCC_RANLIB:-$RANLIB}
            NM=${GCC_NM:-$NM}
            ;;
        clang*)
            # Also consider using flto=thin
            CFLAGS_FOR_LTO="-flto"
            LDFLAGS_FOR_LTO="-flto"
            LINK_SHARED_OBJ="$LINK_SHARED_OBJ -flto"
            LINK_SHARED_OBJ_SH="$LINK_SHARED_OBJ_SH -flto"
            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}llvm-ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}llvm-ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_LLVM_AR+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$LLVM_AR"; then
  ac_cv_prog_LLVM_AR="$LLVM_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_LLVM_AR="${ac_tool_prefix}llvm-ar"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
LLVM_AR=$ac_cv_prog_LLVM_AR
if test -n "$LLVM_AR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_AR" >&5
$as_echo "$LLVM_AR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_LLVM_AR"; then
  ac_ct_LLVM_AR=$LLVM_AR
  # Extract the first word of "llvm-ar", so it can be a program name with args.
set dummy llvm-ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_LLVM_AR+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_LLVM_AR"; then
  ac_cv_prog_ac_ct_LLVM_AR="$ac_ct_LLVM_AR" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_LLVM_AR="llvm-ar"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_LLVM_AR=$ac_cv_prog_ac_ct_LLVM_AR
if test -n "$ac_ct_LLVM_AR"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LLVM_AR" >&5
$as_echo "$ac_ct_LLVM_AR" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_LLVM_AR" = x; then
    LLVM_AR=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    LLVM_AR=$ac_ct_LLVM_AR
  fi
else
  LLVM_AR="$ac_cv_prog_LLVM_AR"
fi

            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}llvm-ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}llvm-ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_LLVM_RANLIB+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$LLVM_RANLIB"; then
  ac_cv_prog_LLVM_RANLIB="$LLVM_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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_LLVM_RANLIB="${ac_tool_prefix}llvm-ranlib"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
LLVM_RANLIB=$ac_cv_prog_LLVM_RANLIB
if test -n "$LLVM_RANLIB"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_RANLIB" >&5
$as_echo "$LLVM_RANLIB" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_LLVM_RANLIB"; then
  ac_ct_LLVM_RANLIB=$LLVM_RANLIB
  # Extract the first word of "llvm-ranlib", so it can be a program name with args.
set dummy llvm-ranlib; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_LLVM_RANLIB+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_LLVM_RANLIB"; then
  ac_cv_prog_ac_ct_LLVM_RANLIB="$ac_ct_LLVM_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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_LLVM_RANLIB="llvm-ranlib"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_LLVM_RANLIB=$ac_cv_prog_ac_ct_LLVM_RANLIB
if test -n "$ac_ct_LLVM_RANLIB"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LLVM_RANLIB" >&5
$as_echo "$ac_ct_LLVM_RANLIB" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_LLVM_RANLIB" = x; then
    LLVM_RANLIB=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    LLVM_RANLIB=$ac_ct_LLVM_RANLIB
  fi
else
  LLVM_RANLIB="$ac_cv_prog_LLVM_RANLIB"
fi

            if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}llvm-nm", so it can be a program name with args.
set dummy ${ac_tool_prefix}llvm-nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_LLVM_NM+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$LLVM_NM"; then
  ac_cv_prog_LLVM_NM="$LLVM_NM" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_LLVM_NM="${ac_tool_prefix}llvm-nm"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
LLVM_NM=$ac_cv_prog_LLVM_NM
if test -n "$LLVM_NM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LLVM_NM" >&5
$as_echo "$LLVM_NM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_prog_LLVM_NM"; then
  ac_ct_LLVM_NM=$LLVM_NM
  # Extract the first word of "llvm-nm", so it can be a program name with args.
set dummy llvm-nm; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_LLVM_NM+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$ac_ct_LLVM_NM"; then
  ac_cv_prog_ac_ct_LLVM_NM="$ac_ct_LLVM_NM" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_ac_ct_LLVM_NM="llvm-nm"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
ac_ct_LLVM_NM=$ac_cv_prog_ac_ct_LLVM_NM
if test -n "$ac_ct_LLVM_NM"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LLVM_NM" >&5
$as_echo "$ac_ct_LLVM_NM" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_ct_LLVM_NM" = x; then
    LLVM_NM=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    LLVM_NM=$ac_ct_LLVM_NM
  fi
else
  LLVM_NM="$ac_cv_prog_LLVM_NM"
fi

            AR=${LLVM_AR:-$AR}
            RANLIB=${LLVM_RANLIB:-$RANLIB}
            NM=${LLVM_NM:-$NM}
            ;;
        *)
            CFLAGS_FOR_LTO=""
            LDFLAGS_FOR_LTO=""
            ;;
    esac
else
    CFLAGS_FOR_LTO=""
    LDFLAGS_FOR_LTO=""
fi




#-----------------------------------------------------------------------------#
#
# Check for readline and editline (libedit).
#



# Check whether --with-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=`$as_echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$mercury_cv_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"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_READLINE_READLINE_H,$MR_HAVE_READLINE_HISTORY_H" = "1,1"; then
		# Check for the libraries that readline depends on.
		echo 'looking for termcap or curses (needed by readline)...' 1>&6
		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5
$as_echo_n "checking for tgetent in -ltermcap... " >&6; }
if ${ac_cv_lib_termcap_tgetent+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-ltermcap  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_termcap_tgetent=yes
else
  ac_cv_lib_termcap_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5
$as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
if test "x$ac_cv_lib_termcap_tgetent" = xyes; then :
  mercury_cv_termcap_lib=-ltermcap
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lcurses" >&5
$as_echo_n "checking for tgetent in -lcurses... " >&6; }
if ${ac_cv_lib_curses_tgetent+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lcurses  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_curses_tgetent=yes
else
  ac_cv_lib_curses_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tgetent" >&5
$as_echo "$ac_cv_lib_curses_tgetent" >&6; }
if test "x$ac_cv_lib_curses_tgetent" = xyes; then :
  mercury_cv_termcap_lib=-lcurses
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -lncurses" >&5
$as_echo_n "checking for tgetent in -lncurses... " >&6; }
if ${ac_cv_lib_ncurses_tgetent+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lncurses  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char tgetent ();
int
main ()
{
return tgetent ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_ncurses_tgetent=yes
else
  ac_cv_lib_ncurses_tgetent=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tgetent" >&5
$as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
if test "x$ac_cv_lib_ncurses_tgetent" = xyes; then :
  mercury_cv_termcap_lib=-lncurses
else
  mercury_cv_termcap_lib=''
fi

fi

fi


		# Check for the readline library.
		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5
$as_echo_n "checking for readline in -lreadline... " >&6; }
if ${ac_cv_lib_readline_readline+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline $mercury_cv_termcap_lib $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char readline ();
int
main ()
{
return readline ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_readline_readline=yes
else
  ac_cv_lib_readline_readline=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5
$as_echo "$ac_cv_lib_readline_readline" >&6; }
if test "x$ac_cv_lib_readline_readline" = xyes; then :
  mercury_cv_have_readline=yes
else
  mercury_cv_have_readline=no
fi

	else
		mercury_cv_have_readline=no
	fi
else
	mercury_cv_have_readline=no
fi

if test $mercury_cv_have_readline = no; then
	TERMCAP_LIBRARY=""
	READLINE_LIBRARIES=""
else
	$as_echo "#define MR_USE_READLINE 1" >>confdefs.h

	TERMCAP_LIBRARY="$mercury_cv_termcap_lib"
	READLINE_LIBRARIES="-lreadline $TERMCAP_LIBRARY"
fi







# Check whether --with-editline was given.
if test "${with_editline+set}" = set; then :
  withval=$with_editline; mercury_cv_with_editline="$withval"
else
  mercury_cv_with_editline=yes
fi


if test $mercury_cv_with_editline = no; then
	mercury_cv_have_editline=no
elif test $mercury_cv_have_readline = no; then

	# Check for the editline header files.

    for mercury_cv_header in editline/readline.h; do
	mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
		tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
	as_ac_Header=`$as_echo "ac_cv_header_$mercury_cv_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$mercury_cv_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"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_EDITLINE_READLINE_H" = 1; then
		# Check for the editline library.
		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -ledit" >&5
$as_echo_n "checking for readline in -ledit... " >&6; }
if ${ac_cv_lib_edit_readline+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-ledit  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char readline ();
int
main ()
{
return readline ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_edit_readline=yes
else
  ac_cv_lib_edit_readline=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_edit_readline" >&5
$as_echo "$ac_cv_lib_edit_readline" >&6; }
if test "x$ac_cv_lib_edit_readline" = xyes; then :
  mercury_cv_have_editline=yes
else
  mercury_cv_have_editline=no
fi

	else
		mercury_cv_have_editline=no
	fi
else
	mercury_cv_have_editline=no
fi

if test $mercury_cv_have_editline = yes; then
	$as_echo "#define MR_USE_EDITLINE 1" >>confdefs.h

	TERMCAP_LIBRARY=""
	READLINE_LIBRARIES="-ledit"
fi



#-----------------------------------------------------------------------------#
#
# Check for libhwloc, http://www.open-mpi.org/projects/hwloc/
#







if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
	if test -n "$ac_tool_prefix"; then
  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $PKG_CONFIG in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
  ac_pt_PKG_CONFIG=$PKG_CONFIG
  # Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $ac_pt_PKG_CONFIG in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi

  if test "x$ac_pt_PKG_CONFIG" = x; then
    PKG_CONFIG=""
  else
    case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
    PKG_CONFIG=$ac_pt_PKG_CONFIG
  fi
else
  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi

fi
if test -n "$PKG_CONFIG"; then
	_pkg_min_version=0.9.0
	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
	else
		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
		PKG_CONFIG=""
	fi
fi


# Check whether --with-hwloc was given.
if test "${with_hwloc+set}" = set; then :
  withval=$with_hwloc; with_hwloc="$withval"
else
  with_hwloc="no"
fi


if test "$with_hwloc" = "yes"
then

pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhwloc" >&5
$as_echo_n "checking for libhwloc... " >&6; }

if test -n "$libhwloc_CFLAGS"; then
    pkg_cv_libhwloc_CFLAGS="$libhwloc_CFLAGS"
 elif test -n "$PKG_CONFIG"; then
    if test -n "$PKG_CONFIG" && \
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hwloc >= 1.1\""; } >&5
  ($PKG_CONFIG --exists --print-errors "hwloc >= 1.1") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; then
  pkg_cv_libhwloc_CFLAGS=`$PKG_CONFIG --cflags "hwloc >= 1.1" 2>/dev/null`
else
  pkg_failed=yes
fi
 else
    pkg_failed=untried
fi
if test -n "$libhwloc_LIBS"; then
    pkg_cv_libhwloc_LIBS="$libhwloc_LIBS"
 elif test -n "$PKG_CONFIG"; then
    if test -n "$PKG_CONFIG" && \
    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hwloc >= 1.1\""; } >&5
  ($PKG_CONFIG --exists --print-errors "hwloc >= 1.1") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }; then
  pkg_cv_libhwloc_LIBS=`$PKG_CONFIG --libs "hwloc >= 1.1" 2>/dev/null`
else
  pkg_failed=yes
fi
 else
    pkg_failed=untried
fi



if test $pkg_failed = yes; then
   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
        _pkg_short_errors_supported=yes
else
        _pkg_short_errors_supported=no
fi
        if test $_pkg_short_errors_supported = yes; then
	        libhwloc_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "hwloc >= 1.1" 2>&1`
        else
	        libhwloc_PKG_ERRORS=`$PKG_CONFIG --print-errors "hwloc >= 1.1" 2>&1`
        fi
	# Put the nasty error message in config.log where it belongs
	echo "$libhwloc_PKG_ERRORS" >&5


            hwloc_static_libs=""

elif test $pkg_failed = untried; then
     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

            hwloc_static_libs=""

else
	libhwloc_CFLAGS=$pkg_cv_libhwloc_CFLAGS
	libhwloc_LIBS=$pkg_cv_libhwloc_LIBS
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }

            $as_echo "#define MR_HAVE_HWLOC 1" >>confdefs.h

            hwloc_static_libs="`pkg-config --libs --static hwloc`"

fi
else
    libhwloc_LIBS=""
    libhwloc_CFLAGS=""
    hwloc_static_libs=""
fi

HWLOC_LIBS="$libhwloc_LIBS"
HWLOC_CFLAGS="$libhwloc_CFLAGS"
HWLOC_STATIC_LIBS="$hwloc_static_libs"




#-----------------------------------------------------------------------------#
#
# Check whether we should use "cp" for file copying by the compiler.
#


# Check whether --with-cp was given.
if test "${with_cp+set}" = set; then :
  withval=$with_cp; with_cp="$withval"
else
  with_cp="default"
fi


INSTALL_METHOD_OPT=
case "$with_cp" in
    yes)
        INSTALL_METHOD_OPT="--install-method \"external\""
        ;;
    no)
        INSTALL_METHOD_OPT="--install-method \"internal\""
        ;;
    default)
        if test "$USING_MICROSOFT_CL_COMPILER" = "yes"
        then
            INSTALL_METHOD_OPT="--install-method \"internal\""
        else
            case "$host" in
                *mingw*)
                    INSTALL_METHOD_OPT="--install-method \"internal\""
                    ;;
                *)
                    INSTALL_METHOD_OPT="--install-method \"external\""
                    ;;
            esac
        fi
        ;;
    *)
        as_fn_error $? "unexpected argument to --with-cp" "$LINENO" 5
        ;;

esac



#-----------------------------------------------------------------------------#
#
# Check for flex and bison.
#

# We only require flex and bison if we are going to compile the trace
# directory. We don't need them if we are reconfiguring an existing
# installation. We omit these tests in that case because otherwise users
# would have to flex and bison available in order to install the binary
# distribution.
#
# XXX the AC_PROG_LEX macro does not work with MSVC, so we omit the check
# for flex if using that (as of autoconf 2.71). For MSVC, any problem with
# the flex program will be caught when attempting to build the trace directory.
#
if test "$reconfiguring" = "no" -a "$USING_MICROSOFT_CL_COMPILER" = "no"
then
    # XXX when we drop support for autoconf < 2.70 we should use the following:
    # AC_PROG_LEX([noyywrap])
    for ac_prog in flex lex
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_LEX+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$LEX"; then
  ac_cv_prog_LEX="$LEX" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_LEX="$ac_prog"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
LEX=$ac_cv_prog_LEX
if test -n "$LEX"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5
$as_echo "$LEX" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


  test -n "$LEX" && break
done
test -n "$LEX" || LEX=":"

if test "x$LEX" != "x:"; then
  cat >conftest.l <<_ACEOF
%%
a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument.  */
    yyless ((input () != 0)); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
#ifdef YYTEXT_POINTER
extern char *yytext;
#endif
int
main (void)
{
  return ! yylex () + ! yywrap ();
}
_ACEOF
{ { ac_try="$LEX conftest.l"
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$LEX conftest.l") 2>&5
  ac_status=$?
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5
$as_echo_n "checking lex output file root... " >&6; }
if ${ac_cv_prog_lex_root+:} false; then :
  $as_echo_n "(cached) " >&6
else

if test -f lex.yy.c; then
  ac_cv_prog_lex_root=lex.yy
elif test -f lexyy.c; then
  ac_cv_prog_lex_root=lexyy
else
  as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5
$as_echo "$ac_cv_prog_lex_root" >&6; }
LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root

if test -z "${LEXLIB+set}"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5
$as_echo_n "checking lex library... " >&6; }
if ${ac_cv_lib_lex+:} false; then :
  $as_echo_n "(cached) " >&6
else

    ac_save_LIBS=$LIBS
    ac_cv_lib_lex='none needed'
    for ac_lib in '' -lfl -ll; do
      LIBS="$ac_lib $ac_save_LIBS"
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
`cat $LEX_OUTPUT_ROOT.c`
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_lex=$ac_lib
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
      test "$ac_cv_lib_lex" != 'none needed' && break
    done
    LIBS=$ac_save_LIBS

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5
$as_echo "$ac_cv_lib_lex" >&6; }
  test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5
$as_echo_n "checking whether yytext is a pointer... " >&6; }
if ${ac_cv_prog_lex_yytext_pointer+:} false; then :
  $as_echo_n "(cached) " >&6
else
  # POSIX says lex can declare yytext either as a pointer or an array; the
# default is implementation-dependent.  Figure out which it is, since
# not all implementations provide the %pointer and %array declarations.
ac_cv_prog_lex_yytext_pointer=no
ac_save_LIBS=$LIBS
LIBS="$LEXLIB $ac_save_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

  #define YYTEXT_POINTER 1
`cat $LEX_OUTPUT_ROOT.c`
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_prog_lex_yytext_pointer=yes
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_save_LIBS

fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5
$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; }
if test $ac_cv_prog_lex_yytext_pointer = yes; then

$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h

fi
rm -f conftest.l $LEX_OUTPUT_ROOT.c

fi
    if test "`basename $LEX`" != "flex"
    then
        as_fn_error $? "You need flex to build Mercury" "$LINENO" 5
    fi
fi

if test "$reconfiguring" = "no"
then
    for ac_prog in 'bison -y' byacc
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_YACC+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test -n "$YACC"; then
  ac_cv_prog_YACC="$YACC" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_prog_YACC="$ac_prog"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

fi
fi
YACC=$ac_cv_prog_YACC
if test -n "$YACC"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
$as_echo "$YACC" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


  test -n "$YACC" && break
done
test -n "$YACC" || YACC="yacc"

    # AC_PROG_YACC may bind YACC to e.g. "bison -y"; we care only about
    # the program name.
    YACCPROG=`echo $YACC | sed 's/ .*//'`
    if test "`basename $YACCPROG`" != "bison"
    then
        as_fn_error $? "You need bison to build Mercury" "$LINENO" 5
    fi
fi

#-----------------------------------------------------------------------------#
#
# Set the default web_browser_cmd.
#

for ac_prog in xdg-open
do
  # Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_WEB_BROWSER+:} false; then :
  $as_echo_n "(cached) " >&6
else
  case $WEB_BROWSER in
  [\\/]* | ?:[\\/]*)
  ac_cv_path_WEB_BROWSER="$WEB_BROWSER" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
    ac_cv_path_WEB_BROWSER="$as_dir/$ac_word$ac_exec_ext"
    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
    break 2
  fi
done
  done
IFS=$as_save_IFS

  ;;
esac
fi
WEB_BROWSER=$ac_cv_path_WEB_BROWSER
if test -n "$WEB_BROWSER"; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WEB_BROWSER" >&5
$as_echo "$WEB_BROWSER" >&6; }
else
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi


  test -n "$WEB_BROWSER" && break
done
test -n "$WEB_BROWSER" || WEB_BROWSER=""""

case "$host" in
    *apple*darwin*)
        DEFAULT_WEB_BROWSER_CMD="open"
        ;;
    *-cygwin* | *mingw*)
        DEFAULT_WEB_BROWSER_CMD="start"
        ;;
    *)
        DEFAULT_WEB_BROWSER_CMD="xdg-open"
        ;;
esac



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

# We need to check that any existing .c files are compatible with the selected
# grade with respect to whether --highlevel-code was used to generate them.
#
case "$GRADE" in
    hl*)
        need_hl_c_files="yes"
        ;;
    *)
        need_hl_c_files="no"
        ;;
esac

mercury_check_c_files () {
    c_dir=$1
    c_date_dir=$2

    case $GRADE in
        *.pregen*)
            need_low_tag_bits=2
            need_unboxed_floats=no
            need_unboxed_int64s=no
            need_pregen_dist=yes
            ;;
        *)
            need_low_tag_bits=$mercury_cv_low_tag_bits
            need_unboxed_floats=$mercury_cv_unboxed_floats
            need_unboxed_int64s=$mercury_cv_unboxed_int64s
            need_pregen_dist=no
            ;;
    esac

    # If the ALLOW_BOTH_HI_LO_LEVEL_CODE environment variable is set to
    # "allow", then don't pay attention to the setting of HIGHLEVEL_CODE;
    # allow both high and low level code. This is intended for situations
    # where a workspace already exists and is compiled. When configure.ac
    # changes, it has to rerun, but it should *not* cause the deletion
    # of the workspace's .c files just because the workspace's Mmake.params
    # file chose a different code level.
    #
    # In both cases, keep everything on one line to avoid any
    # line ending differences.
    if test "$ALLOW_BOTH_HI_LO_LEVEL_CODE" = "allow"
    then
        maybe_delete_level="-e /HIGHLEVEL_CODE/d"
        printf ";TAG_BITS=%s;UNBOXED_FLOAT=%s;UNBOXED_INT64S=%s;PREGENERATED_DIST=%s;" \
            $need_low_tag_bits \
            $need_unboxed_floats \
            $need_unboxed_int64s \
            $need_pregen_dist \
            > confscratch.ref
    else
        maybe_delete_level=""
        printf ";TAG_BITS=%s;UNBOXED_FLOAT=%s;UNBOXED_INT64S=%s;PREGENERATED_DIST=%s;HIGHLEVEL_CODE=%s;" \
            $need_low_tag_bits \
            $need_unboxed_floats \
            $need_unboxed_int64s \
            $need_pregen_dist \
            $need_hl_c_files > confscratch.ref
    fi

    for c_file in $c_dir/*.c
    do
        case $c_file in
        */'*.c')
            ;;
        */*_init.c)
            ;;
        *)
            sed -n -e "/END_OF_C_GRADE_INFO/q" $maybe_delete_level -e "/=/p" \
                < $c_file | tr -s '* \r\n' ';;;;' > confscratch
            if cmp -s confscratch confscratch.ref
            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 mdbcomp browser \
        slice ssdb mfilterjavac grade_lib
    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 confscratch.ref $to_delete
fi

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

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C shell executable" >&5
$as_echo_n "checking for C shell executable... " >&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
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
    CSHPATH="no csh path"
else
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cshpath" >&5
$as_echo "$cshpath" >&6; }
    CSHPATH="$cshpath"
fi


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

TESTS_MDB_INIT_DIR="`pwd`"/scripts
TESTS_MDB_DOC="`pwd`"/doc/mdb_doc



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

STANDARD_MCFLAGS="`cat STANDARD_MCFLAGS`"


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

conf_h_copy="$TMPDIR"/mercury_conf.h.$$
trap "rm -f $conf_h_copy" 0 1 2 3 13 15
if test -f runtime/mercury_conf.h
then
    /bin/rm -f $conf_h_copy
    cp runtime/mercury_conf.h $conf_h_copy
    had_old_conf_h=true
else
    had_old_conf_h=false
fi
# The references to $conf_h_copy and $had_old_conf_h below are in code that
# autoconf puts into a subshell, so we must export them.
export conf_h_copy
export had_old_conf_h

executable_output_files='
scripts/mmc
scripts/mercury
scripts/mercury.bat
scripts/mprof
scripts/mprof.bat
scripts/mercury_update_interface
scripts/mgnuc
scripts/ml
scripts/c2init
scripts/mmake
scripts/mdb
scripts/mdb.bat
scripts/mdprof
scripts/mtags
scripts/canonical_grade
scripts/mkfifo_using_mknod
scripts/mercury_config
scripts/prepare_install_dir
tools/lmc
tools/dotime
'

nonexecutable_output_files='
Mmake.common
scripts/Mmake.vars
scripts/parse_ml_options.sh-subr
scripts/mdbrc
scripts/Mercury.config
bindist/bindist.INSTALL
bindist/bindist.Makefile
runtime/mercury_dotnet.cs
java/runtime/Constants.java
browser/MDB_FLAGS
compiler/COMP_FLAGS
deep_profiler/DEEP_FLAGS
grade_lib/GRADE_LIB_FLAGS
library/LIB_FLAGS
mdbcomp/MDBCOMP_FLAGS
mfilterjavac/MFILTERJAVAC_FLAGS
profiler/PROF_FLAGS
slice/SLICE_FLAGS
ssdb/SSDB_FLAGS
tests/DEFNS_FOR_TESTS
tests/TESTS_FLAGS
'

# The order in which we output files matters, because in some cases, one of the
# non-executable files we output (e.g. scripts/parse_ml_options.sh-subr)
# will be bodily included in other files we output (e.g. scripts/ml,
# scripts/c2init etc). If we attempted to create the latter files first,
# the bodily inclusion would include the empty file instead.
output_files="$nonexecutable_output_files $executable_output_files"

# IMPORTANT NOTE
# --------------
# Any new entries in the lists above may need to be handled by
# scripts/mercury_config.in. Failing to do this correctly may break
# the binary distributions. This is especially true of files in the runtime
# or java directories; if you add new .in files to either of those
# you *must* update scripts/mercury_config.in.

ac_config_files="$ac_config_files $output_files"

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, we kill variables containing newlines.
# 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.
(
  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
    eval ac_val=\$$ac_var
    case $ac_val in #(
    *${as_nl}*)
      case $ac_var in #(
      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      esac
      case $ac_var in #(
      _ | IFS | as_nl) ;; #(
      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
      *) { eval $ac_var=; unset $ac_var;} ;;
      esac ;;
    esac
  done

  (set) 2>&1 |
    case $as_nl`(ac_space=' '; set) 2>&1` in #(
    *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
      ;;
    esac |
    sort
) |
  sed '
     /^ac_cv_env_/b end
     t clear
     :clear
     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
     t end
     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
     :end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
  if test -w "$cache_file"; then
    if test "x$cache_file" != "x/dev/null"; then
      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
      if test ! -f "$cache_file" || test -h "$cache_file"; then
	cat confcache >"$cache_file"
      else
        case $cache_file in #(
        */* | ?:*)
	  mv -f confcache "$cache_file"$$ &&
	  mv -f "$cache_file"$$ "$cache_file" ;; #(
        *)
	  mv -f confcache "$cache_file" ;;
	esac
      fi
    fi
  else
    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
  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}'

DEFS=-DHAVE_CONFIG_H

ac_libobjs=
ac_ltlibobjs=
U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
  # 1. Remove the extension, and $U if already installed.
  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
  #    will be set to the directory where LIBOBJS objects are built.
  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs

LTLIBOBJS=$ac_ltlibobjs



: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
as_write_fail=0
cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $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}
export SHELL
_ASEOF
cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##

# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  emulate sh
  NULLCMD=:
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  # is contrary to our usage.  Disable this feature.
  alias -g '${1+"$@"}'='"$@"'
  setopt NO_GLOB_SUBST
else
  case `(set -o) 2>/dev/null` in #(
  *posix*) :
    set -o posix ;; #(
  *) :
     ;;
esac
fi


as_nl='
'
export as_nl
# Printing a long string crashes Solaris 7 /usr/bin/printf.
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
# Prefer a ksh shell builtin over an external printf program on Solaris,
# but without wasting forks for bash or zsh.
if test -z "$BASH_VERSION$ZSH_VERSION" \
    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='print -r --'
  as_echo_n='print -rn --'
elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
  as_echo='printf %s\n'
  as_echo_n='printf %s'
else
  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
    as_echo_n='/usr/ucb/echo -n'
  else
    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
    as_echo_n_body='eval
      arg=$1;
      case $arg in #(
      *"$as_nl"*)
	expr "X$arg" : "X\\(.*\\)$as_nl";
	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
      esac;
      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
    '
    export as_echo_n_body
    as_echo_n='sh -c $as_echo_n_body as_echo'
  fi
  export as_echo_body
  as_echo='sh -c $as_echo_body as_echo'
fi

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  PATH_SEPARATOR=:
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
      PATH_SEPARATOR=';'
  }
fi


# IFS
# We need space, tab and new line, in precisely that order.  Quoting is
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
IFS=" ""	$as_nl"

# Find who we are.  Look in the path if we contain no directory separator.
as_myself=
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
IFS=$as_save_IFS

     ;;
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
  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
  exit 1
fi

# Unset variables that we do not need and which cause bugs (e.g. in
# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
# suppresses any "Segmentation fault" message there.  '((' could
# trigger a bug in pdksh 5.2.14.
for as_var in BASH_ENV ENV MAIL MAILPATH
do eval test x\${$as_var+set} = xset \
  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
PS1='$ '
PS2='> '
PS4='+ '

# NLS nuisances.
LC_ALL=C
export LC_ALL
LANGUAGE=C
export LANGUAGE

# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH


# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2
  as_fn_exit $as_status
} # as_fn_error


# as_fn_set_status STATUS
# -----------------------
# Set $? to STATUS, without forking.
as_fn_set_status ()
{
  return $1
} # as_fn_set_status

# as_fn_exit STATUS
# -----------------
# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
as_fn_exit ()
{
  set +e
  as_fn_set_status $1
  exit $1
} # as_fn_exit

# as_fn_unset VAR
# ---------------
# Portably unset VAR.
as_fn_unset ()
{
  { eval $1=; unset $1;}
}
as_unset=as_fn_unset
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
# advantage of any shell optimizations that allow amortized linear growth over
# repeated appends, instead of the typical quadratic growth present in naive
# implementations.
if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
  eval 'as_fn_append ()
  {
    eval $1+=\$2
  }'
else
  as_fn_append ()
  {
    eval $1=\$$1\$2
  }
fi # as_fn_append

# as_fn_arith ARG...
# ------------------
# Perform arithmetic evaluation on the ARGs, and store the result in the
# global $as_val. Take advantage of shells that can avoid forks. The arguments
# must be portable across $(()) and expr.
if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
  eval 'as_fn_arith ()
  {
    as_val=$(( $* ))
  }'
else
  as_fn_arith ()
  {
    as_val=`expr "$@" || test $? -eq 1`
  }
fi # as_fn_arith


if expr a : '\(a\)' >/dev/null 2>&1 &&
   test "X`expr 00001 : '.*\(...\)'`" = X001; 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

if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
  as_dirname=dirname
else
  as_dirname=false
fi

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

# 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

ECHO_C= ECHO_N= ECHO_T=
case `echo -n x` in #(((((
-n*)
  case `echo 'xy\c'` in
  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
  xy)  ECHO_C='\c';;
  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
       ECHO_T='	';;
  esac;;
*)
  ECHO_N='-n';;
esac

rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
  rm -f conf$$.dir/conf$$.file
else
  rm -f conf$$.dir
  mkdir conf$$.dir 2>/dev/null
fi
if (echo >conf$$.file) 2>/dev/null; then
  if ln -s conf$$.file conf$$ 2>/dev/null; then
    as_ln_s='ln -s'
    # ... but there are two gotchas:
    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    # In both cases, we have to default to `cp -pR'.
    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
      as_ln_s='cp -pR'
  elif ln conf$$.file conf$$ 2>/dev/null; then
    as_ln_s=ln
  else
    as_ln_s='cp -pR'
  fi
else
  as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null


# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{

  case $as_dir in #(
  -*) as_dir=./$as_dir;;
  esac
  test -d "$as_dir" || eval $as_mkdir_p || {
    as_dirs=
    while :; do
      case $as_dir in #(
      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
      *) as_qdir=$as_dir;;
      esac
      as_dirs="'$as_qdir' $as_dirs"
      as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$as_dir" : 'X\(//\)[^/]' \| \
	 X"$as_dir" : 'X\(//\)$' \| \
	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`
      test -d "$as_dir" && break
    done
    test -z "$as_dirs" || eval "mkdir $as_dirs"
  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"


} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
  as_mkdir_p='mkdir -p "$as_dir"'
else
  test -d ./-p && rmdir ./-p
  as_mkdir_p=false
fi


# as_fn_executable_p FILE
# -----------------------
# Test if FILE is an executable regular file.
as_fn_executable_p ()
{
  test -f "$1" && test -x "$1"
} # as_fn_executable_p
as_test_x='test -x'
as_executable_p=as_fn_executable_p

# 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'"


exec 6>&1
## ----------------------------------- ##
## Main body of $CONFIG_STATUS script. ##
## ----------------------------------- ##
_ASEOF
test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by $as_me, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  CONFIG_FILES    = $CONFIG_FILES
  CONFIG_HEADERS  = $CONFIG_HEADERS
  CONFIG_LINKS    = $CONFIG_LINKS
  CONFIG_COMMANDS = $CONFIG_COMMANDS
  $ $0 $@

on `(hostname || uname -n) 2>/dev/null | sed 1q`
"

_ACEOF

case $ac_config_files in *"
"*) set x $ac_config_files; shift; ac_config_files=$*;;
esac

case $ac_config_headers in *"
"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
esac


cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_commands="$ac_config_commands"

_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
\`$as_me' instantiates files and other configuration actions
from templates according to the current configuration.  Unless the files
and actions are specified as TAGs, all are instantiated by default.

Usage: $0 [OPTION]... [TAG]...

  -h, --help       print this help, then exit
  -V, --version    print version number and configuration settings, then exit
      --config     print configuration, then exit
  -q, --quiet, --silent
                   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 the package provider."

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
config.status
configured by $0, generated by GNU Autoconf 2.69,
  with options \\"\$ac_cs_config\\"

Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."

ac_pwd='$ac_pwd'
srcdir='$srcdir'
test -n "\$AWK" || AWK=awk
_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# The default lists apply if the user does not specify any file.
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=`expr "X$1" : 'X\([^=]*\)='`
    ac_optarg=
    ac_shift=:
    ;;
  *)
    ac_option=$1
    ac_optarg=$2
    ac_shift=shift
    ;;
  esac

  case $ac_option in
  # Handling of the options.
  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    ac_cs_recheck=: ;;
  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
    $as_echo "$ac_cs_version"; exit ;;
  --config | --confi | --conf | --con | --co | --c )
    $as_echo "$ac_cs_config"; exit ;;
  --debug | --debu | --deb | --de | --d | -d )
    debug=: ;;
  --file | --fil | --fi | --f )
    $ac_shift
    case $ac_optarg in
    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
    '') as_fn_error $? "missing file argument" ;;
    esac
    as_fn_append CONFIG_FILES " '$ac_optarg'"
    ac_need_defaults=false;;
  --header | --heade | --head | --hea )
    $ac_shift
    case $ac_optarg in
    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
    esac
    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
    ac_need_defaults=false;;
  --he | --h)
    # Conflict between --help and --header
    as_fn_error $? "ambiguous option: \`$1'
Try \`$0 --help' for more information.";;
  --help | --hel | -h )
    $as_echo "$ac_cs_usage"; exit ;;
  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
  | -silent | --silent | --silen | --sile | --sil | --si | --s)
    ac_cs_silent=: ;;

  # This is an error.
  -*) as_fn_error $? "unrecognized option: \`$1'
Try \`$0 --help' for more information." ;;

  *) as_fn_append ac_config_targets " $1"
     ac_need_defaults=false ;;

  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 || ac_write_fail=1
if \$ac_cs_recheck; then
  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
  shift
  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
  CONFIG_SHELL='$SHELL'
  export CONFIG_SHELL
  exec "\$@"
fi

_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
  echo
  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
  $as_echo "$ac_log"
} >&5

_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
reconfiguring=$reconfiguring


_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1

# Handling of arguments.
for ac_config_target in $ac_config_targets
do
  case $ac_config_target in
    "runtime/mercury_conf.h") CONFIG_HEADERS="$CONFIG_HEADERS runtime/mercury_conf.h" ;;
    "robdd/robdd_conf.h") CONFIG_HEADERS="$CONFIG_HEADERS robdd/robdd_conf.h" ;;
    "$output_files") CONFIG_FILES="$CONFIG_FILES $output_files" ;;
    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;

  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
  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 against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
# Note that there is a small window in which the directory will not be cleaned:
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
  tmp= ac_tmp=
  trap 'exit_status=$?
  : "${ac_tmp:=$tmp}"
  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
  trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.

{
  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
  test -d "$tmp"
}  ||
{
  tmp=./conf$$-$RANDOM
  (umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
ac_tmp=$tmp

# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then

if $AWK 'BEGIN { getline <"/dev/null" }' </dev/null 2>/dev/null; then
  ac_cs_awk_getline=:
  ac_cs_awk_pipe_init=
  ac_cs_awk_read_file='
      while ((getline aline < (F[key])) > 0)
	print(aline)
      close(F[key])'
  ac_cs_awk_pipe_fini=
else
  ac_cs_awk_getline=false
  ac_cs_awk_pipe_init="print \"cat <<'|#_!!_#|' &&\""
  ac_cs_awk_read_file='
      print "|#_!!_#|"
      print "cat " F[key] " &&"
      '$ac_cs_awk_pipe_init
  # The final `:' finishes the AND list.
  ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }'
fi
ac_cr=`echo X | tr X '\015'`
# On cygwin, bash can eat \r inside `` if the user requested igncr.
# But we know of no other shell where ac_cr would be empty at this
# point, so we can use a bashism as a fallback.
if test "x$ac_cr" = x; then
  eval ac_cr=\$\'\\r\'
fi
ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
  ac_cs_awk_cr='\\r'
else
  ac_cs_awk_cr=$ac_cr
fi

echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF

# Create commands to substitute file output variables.
{
  echo "cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1" &&
  echo 'cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&' &&
  echo "$ac_subst_files" | sed 's/.*/F["&"]="$&"/' &&
  echo "_ACAWK" &&
  echo "_ACEOF"
} >conf$$files.sh &&
. ./conf$$files.sh ||
  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
rm -f conf$$files.sh

{
  echo "cat >conf$$subs.awk <<_ACEOF" &&
  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
  echo "_ACEOF"
} >conf$$subs.sh ||
  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
  . ./conf$$subs.sh ||
    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5

  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
  if test $ac_delim_n = $ac_delim_num; then
    break
  elif $ac_last_try; then
    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
  else
    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
  fi
done
rm -f conf$$subs.sh

cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
s/^/S["/; s/!.*/"]=/
p
g
s/^[^!]*!//
:repl
t repl
s/'"$ac_delim"'$//
t delim
:nl
h
s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
n
b repl
:more1
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t nl
:delim
h
s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
b
:more2
s/["\\]/\\&/g; s/^/"/; s/$/"\\/
p
g
s/.\{148\}//
t delim
' <conf$$subs.awk | sed '
/^[^""]/{
  N
  s/\n//
}
' >>$CONFIG_STATUS || ac_write_fail=1
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
  for (key in S) S_is_set[key] = 1
  FS = ""
  \$ac_cs_awk_pipe_init
}
{
  line = $ 0
  nfields = split(line, field, "@")
  substed = 0
  len = length(field[1])
  for (i = 2; i < nfields; i++) {
    key = field[i]
    keylen = length(key)
    if (S_is_set[key]) {
      value = S[key]
      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
      len += length(value) + length(field[++i])
      substed = 1
    } else
      len += 1 + keylen
  }
  if (nfields == 3 && !substed) {
    key = field[2]
    if (F[key] != "" && line ~ /^[	 ]*@.*@[	 ]*$/) {
      \$ac_cs_awk_read_file
      next
    }
  }
  print line
}
\$ac_cs_awk_pipe_fini
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
  cat
fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF

# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
# ${srcdir} and @srcdir@ entries 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[	 ]*=[	 ]*/{
h
s///
s/^/:/
s/[	 ]*$/:/
s/:\$(srcdir):/:/g
s/:\${srcdir}:/:/g
s/:@srcdir@:/:/g
s/^:*//
s/:*$//
x
s/\(=[	 ]*\).*/\1/
G
s/\n//
s/^[^=]*=[	 ]*$//
}'
fi

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"

# Set up the scripts for CONFIG_HEADERS section.
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF

# Transform confdefs.h into an awk script `defines.awk', embedded as
# here-document in config.status, that substitutes the proper values into
# config.h.in to produce config.h.

# Create a delimiter string that does not exist in confdefs.h, to ease
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
  if test -z "$ac_tt"; then
    break
  elif $ac_last_try; then
    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
  else
    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
  fi
done

# For the awk script, D is an array of macro values keyed by name,
# likewise P contains macro parameters if any.  Preserve backslash
# newline sequences.

ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
sed -n '
s/.\{148\}/&'"$ac_delim"'/g
t rset
:rset
s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
t def
d
:def
s/\\$//
t bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3"/p
s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
d
:bsnl
s/["\\]/\\&/g
s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
D["\1"]=" \3\\\\\\n"\\/p
t cont
s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
t cont
d
:cont
n
s/.\{148\}/&'"$ac_delim"'/g
t clear
:clear
s/\\$//
t bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/"/p
d
:bsnlc
s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
b cont
' <confdefs.h | sed '
s/'"$ac_delim"'/"\\\
"/g' >>$CONFIG_STATUS || ac_write_fail=1

cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
  for (key in D) D_is_set[key] = 1
  FS = ""
}
/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
  line = \$ 0
  split(line, arg, " ")
  if (arg[1] == "#") {
    defundef = arg[2]
    mac1 = arg[3]
  } else {
    defundef = substr(arg[1], 2)
    mac1 = arg[2]
  }
  split(mac1, mac2, "(") #)
  macro = mac2[1]
  prefix = substr(line, 1, index(line, defundef) - 1)
  if (D_is_set[macro]) {
    # Preserve the white space surrounding the "#".
    print prefix "define", macro P[macro] D[macro]
    next
  } else {
    # Replace #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.
    if (defundef == "undef") {
      print "/*", prefix defundef, macro, "*/"
      next
    }
  }
}
{ print }
_ACAWK
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
fi # test -n "$CONFIG_HEADERS"


eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
shift
for ac_tag
do
  case $ac_tag in
  :[FHLC]) ac_mode=$ac_tag; continue;;
  esac
  case $ac_mode$ac_tag in
  :[FHL]*:*);;
  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
  :[FH]-) ac_tag=-:-;;
  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
  esac
  ac_save_IFS=$IFS
  IFS=:
  set x $ac_tag
  IFS=$ac_save_IFS
  shift
  ac_file=$1
  shift

  case $ac_mode in
  :L) ac_source=$1;;
  :[FH])
    ac_file_inputs=
    for ac_f
    do
      case $ac_f in
      -) ac_f="$ac_tmp/stdin";;
      *) # Look for the file first in the build tree, then in the source tree
	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
	 # because $ac_f cannot contain `:'.
	 test -f "$ac_f" ||
	   case $ac_f in
	   [\\/$]*) false;;
	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
	   esac ||
	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
      esac
      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
      as_fn_append ac_file_inputs " '$ac_f'"
    done

    # 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.  */
    configure_input='Generated from '`
	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
	`' by configure.'
    if test x"$ac_file" != x-; then
      configure_input="$ac_file.  $configure_input"
      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
$as_echo "$as_me: creating $ac_file" >&6;}
    fi
    # Neutralize special characters interpreted by sed in replacement strings.
    case $configure_input in #(
    *\&* | *\|* | *\\* )
       ac_sed_conf_input=`$as_echo "$configure_input" |
       sed 's/[\\\\&|]/\\\\&/g'`;; #(
    *) ac_sed_conf_input=$configure_input;;
    esac

    case $ac_tag in
    *:-:* | *:-) cat >"$ac_tmp/stdin" \
      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
    esac
    ;;
  esac

  ac_dir=`$as_dirname -- "$ac_file" ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
	 X"$ac_file" : 'X\(//\)[^/]' \| \
	 X"$ac_file" : 'X\(//\)$' \| \
	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$ac_file" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)[^/].*/{
	    s//\1/
	    q
	  }
	  /^X\(\/\/\)$/{
	    s//\1/
	    q
	  }
	  /^X\(\/\).*/{
	    s//\1/
	    q
	  }
	  s/.*/./; q'`
  as_dir="$ac_dir"; as_fn_mkdir_p
  ac_builddir=.

case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
  # A ".." for each directory in $ac_dir_suffix.
  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
  case $ac_top_builddir_sub in
  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
  esac ;;
esac
ac_abs_top_builddir=$ac_pwd
ac_abs_builddir=$ac_pwd$ac_dir_suffix
# for backward compatibility:
ac_top_builddir=$ac_top_build_prefix

case $srcdir in
  .)  # We are building in place.
    ac_srcdir=.
    ac_top_srcdir=$ac_top_builddir_sub
    ac_abs_top_srcdir=$ac_pwd ;;
  [\\/]* | ?:[\\/]* )  # Absolute name.
    ac_srcdir=$srcdir$ac_dir_suffix;
    ac_top_srcdir=$srcdir
    ac_abs_top_srcdir=$srcdir ;;
  *) # Relative name.
    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
    ac_top_srcdir=$ac_top_build_prefix$srcdir
    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
esac
ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix


  case $ac_mode in
  :F)
  #
  # CONFIG_FILE
  #

_ACEOF

cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
ac_sed_dataroot='
/datarootdir/ {
  p
  q
}
/@datadir@/p
/@docdir@/p
/@infodir@/p
/@localedir@/p
/@mandir@/p'
case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
  ac_datarootdir_hack='
  s&@datadir@&$datadir&g
  s&@docdir@&$docdir&g
  s&@infodir@&$infodir&g
  s&@localedir@&$localedir&g
  s&@mandir@&$mandir&g
  s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF

# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
s&@top_build_prefix@&$ac_top_build_prefix&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t
$ac_datarootdir_hack
"
eval sed \"\$ac_sed_extra\" "$ac_file_inputs" |
if $ac_cs_awk_getline; then
  $AWK -f "$ac_tmp/subs.awk"
else
  $AWK -f "$ac_tmp/subs.awk" | $SHELL
fi \
  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5

test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
      "$ac_tmp/out"`; test -z "$ac_out"; } &&
  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined.  Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined.  Please make sure it is defined" >&2;}

  rm -f "$ac_tmp/stdin"
  case $ac_file in
  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
  esac \
  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 ;;
  :H)
  #
  # CONFIG_HEADER
  #
  if test x"$ac_file" != x-; then
    {
      $as_echo "/* $configure_input  */" \
      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
    } >"$ac_tmp/config.h" \
      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
    else
      rm -f "$ac_file"
      mv "$ac_tmp/config.h" "$ac_file" \
	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
    fi
  else
    $as_echo "/* $configure_input  */" \
      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
      || as_fn_error $? "could not create -" "$LINENO" 5
  fi
 ;;

  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
$as_echo "$as_me: executing $ac_file commands" >&6;}
 ;;
  esac


  case $ac_file$ac_mode in
    "default":C) # NOTE If you add any options to scripts/Mercury.config.in that are not
# understood by the installed compiler, then change this to something like
#
# grep -v NEWOPTION < scripts/Mercury.config > scripts/Mercury.config.bootstrap
#
# You should then make the same change to the rule in scripts/Mmakefile
# that builds Mercury.config.bootstrap.
#
# NOTE You should ensure that filtering out the new option does not leave
# a dangling backslash at the end of the now-last line of the file.
cp scripts/Mercury.config scripts/Mercury.config.bootstrap


# 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
            if $had_old_conf_h && \
                cmp runtime/mercury_conf.h "$conf_h_copy" > /dev/null && \
                test -f runtime/mercury_conf.h.date
            then
                # The date file does need not be updated, so do not update it,
                # since doing so would lead to the unnecessary rebuilding
                # of all the files that depend on it.
                true
            else
                touch runtime/mercury_conf.h.date
            fi
        fi
    done
    # We use conftest.junk 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
    # do not do a `make clean' before running `make'.
    rm -f runtime/libmer_rt.so library/libmer_std.so
    rm -f trace/libmer_trace.so browser/libmer_browser.so
    rm -f mdbcomp/libmer_mdbcomp.so
    rm -f runtime/libmer_rt.dylib library/libmer_std.dylib
    rm -f boehm_gc/libgc.dylib
    rm -f trace/libmer_trace.dylib browser/libmer_browser.dylib
    rm -f mdbcomp/libmer_mdbcomp.dylib
    ;;
esac ;;

  esac
done # for ac_tag


as_fn_exit 0
_ACEOF
ac_clean_files=$ac_clean_files_save

test $ac_write_fail = 0 ||
  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5


# 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 || as_fn_exit 1
fi
if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi


for file in $nonexecutable_output_files
do
    chmod a-x "$file"
done

echo "" 1>&6
echo "using ${DEFAULT_GRADE} as the default grade for applications" 1>&6
echo "using ${BEST_GRADE_FOR_COMPILER} to compile the compiler" 1>&6

if test "${BOOTSTRAP_MC_COMPILER}" != ""
then
    echo "" 1>&6
    echo "using ${BOOTSTRAP_MC_COMPILER} as the installed compiler" 1>&6
fi
if test "${PREFIX}" != "" -a "${PREFIX}" != "${DEFAULT_PREFIX}"
then
    echo "" 1>&6
    echo "using ${PREFIX} as the install prefix" 1>&6
fi

echo "" 1>&6
echo "the set of library grades to install will be" 1>&6
num_installed_grades=0
> .configured_library_grades
for grade in $LIBGRADES
do
    echo "   $grade" 1>&6
    echo "$grade" >> .configured_library_grades
    num_installed_grades=`expr $num_installed_grades + 1`
done
echo "" 1>&6

if test ! -s $bad_conf_grades
then
    echo "WARNING: unknown autoconfigured library grade(s) ${bad_conf_grades}" 1>&6
    echo "" 1>&6
fi

if test ! -s $bad_added_grades
then
    echo "WARNING: unknown user-specified library grade(s) ${bad_added_grades}" 1>&6
    echo "" 1>&6
fi

if test "$have_default_grade" = "no"
then
    echo "WARNING: the default grade for applications is $DEFAULT_GRADE," 1>&6
    echo "but this grade is not going to be installed." 1>&6
    echo "" 1>&6
fi

min_minutes_per_grade=10
max_minutes_per_grade=30
min_minutes=`expr $num_installed_grades \* $min_minutes_per_grade`
max_minutes=`expr $num_installed_grades \* $max_minutes_per_grade`
min_hours=`expr '(' $min_minutes + 30 ')' / 60`
max_hours=`expr '(' $max_minutes + 30 ')' / 60`
echo "Configuring to install $num_installed_grades grades." 1>&6
if test $max_hours -gt 2 -a $min_hours -ne $max_hours
then
    echo "This will likely take $min_hours to $max_hours hours." 1>&6
else
    echo "This will likely take $min_minutes to $max_minutes minutes." 1>&6
fi
echo "" 1>&6
echo "You can make the install faster by installing fewer grades," 1>&6
echo "as shown by the fine-tuning section of the INSTALL file," 1>&6
echo "or by compiling the files of each grade in parallel," 1>&6
echo "which you can do via a command such as make PARALLEL=-j2 install." 1>&6
echo "" 1>&6

if test -z "$MAKEINFO" -o -z "$INFO"
then
    echo "WARNING: missing \`makeinfo' or \`info'." 1>&6
    echo "They are necessary to generate documentation in all formats," 1>&6
    echo "as well as the help text in the debugger." 1>&6
    echo "" 1>&6
fi

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