view configure.ac @ 15110:4f6e058e4161 gui

Integrate GUI building with regular octave build system. * configure.ac: Add detection of qmake, moc and uic. Use qmake to retrieve Qt include and lib directories. Detect openpty (for libqterminal compilation). Add generation of gui/Makefile and gui/src/Makefile. Add WIN32_TERMINAL automake conditional. * gui/Makefile.am: New file. * gui/src/Makefile.am: Likewise.
author Michael Goffioul <michael.goffioul@gmail.com>
date Sun, 05 Aug 2012 14:37:22 +0100
parents a132d206a36a
children 7279c6fc3acb
line wrap: on
line source

dnl configure.in
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (C) 1993-2012 John W. Eaton
### 
### This file is part of Octave.
### 
### Octave is free software; you can redistribute it and/or modify it
### under the terms of the GNU General Public License as published by the
### Free Software Foundation; either version 3 of the License, or (at
### your option) any later version.
### 
### Octave is distributed in the hope that it will be useful, but WITHOUT
### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
### FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
### for more details.
### 
### You should have received a copy of the GNU General Public License
### along with Octave; see the file COPYING.  If not, see
### <http://www.gnu.org/licenses/>.

### Preserve CFLAGS and CXXFLAGS from the environment before doing
### anything else because we don't know which macros might call
### AC_PROG_CC or AC_PROG_CXX.

EXTERN_CFLAGS="$CFLAGS"
EXTERN_CXXFLAGS="$CXXFLAGS"

AC_INIT([GNU Octave], [3.7.0+], [http://octave.org/bugs.html], [octave])

dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
OCTAVE_VERSION="$PACKAGE_VERSION"
OCTAVE_API_VERSION_NUMBER="48"
OCTAVE_API_VERSION="api-v$OCTAVE_API_VERSION_NUMBER+"
OCTAVE_RELEASE_DATE="2012-02-22"
OCTAVE_COPYRIGHT="Copyright (C) 2012 John W. Eaton and others."
AC_SUBST(OCTAVE_VERSION)
AC_SUBST(OCTAVE_API_VERSION_NUMBER)
AC_SUBST(OCTAVE_API_VERSION)
AC_SUBST(OCTAVE_RELEASE_DATE)
AC_SUBST(OCTAVE_COPYRIGHT)

AC_REVISION($Revision: 1.603 $)
AC_PREREQ([2.62])
AC_CONFIG_SRCDIR([src/octave.cc])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([1.11 tar-ustar])

OCTAVE_HOST_TYPE

AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
  
dnl FIXME: Can this MSVC test be moved down to the section on finding a
dnl        a C compiler which already has an MSVC exception test?
dnl FIXME: We should probably only generate this file if it is missing.
### Produce unistd.h for MSVC target, this simplifies changes in
### Octave source tree and avoid problems with lex-generated code.
case "$canonical_host_type" in
  *-*-msdosmsvc)
    AC_MSG_NOTICE([Generating replacement for <unistd.h> for MSVC])
    cat << \EOF > unistd.h
/* File generated by configure script. */
#include <direct.h>
#include <io.h>
#include <process.h>
EOF
    CPPFLAGS="-I. $CPPFLAGS"
    ;;
esac

AC_USE_SYSTEM_EXTENSIONS

### Path separator.

sepchar=:
AC_ARG_WITH(sepchar,
  [AS_HELP_STRING([--with-sepchar=<char>],
     [use <char> as the path separation character])])
case $with_sepchar in
  yes | "")
    case "$canonical_host_type" in
      *-*-mingw* | *-*-msdosmsvc)
        sepchar=';'
        ;;
      esac
    ;;
  no)
    AC_MSG_ERROR([You are required to define a path separation character])
    ;;
  *)
    sepchar=$with_sepchar
    ;;
esac
AC_SUBST(sepchar)
AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'], [Define this to be the path separator for your system, as a character constant.])
AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"], [Define this to the path separator, as a string.])

### Set default file locations

OCTAVE_SET_DEFAULT(man1dir, '$(mandir)/man1')
OCTAVE_SET_DEFAULT(man1ext, '.1')
OCTAVE_SET_DEFAULT(doc_cache_file, '$(octetcdir)/doc-cache')
OCTAVE_SET_DEFAULT(texi_macros_file, '$(octetcdir)/macros.texi')
OCTAVE_SET_DEFAULT(infofile, '$(infodir)/octave.info')
OCTAVE_SET_DEFAULT(octincludedir, '$(includedir)/octave-$(version)/octave')
OCTAVE_SET_DEFAULT(fcnfiledir, '$(datadir)/octave/$(version)/m')
OCTAVE_SET_DEFAULT(localfcnfiledir, '$(datadir)/octave/site/m')
OCTAVE_SET_DEFAULT(localapifcnfiledir,
  '$(datadir)/octave/site/$(api_version)/m')
OCTAVE_SET_DEFAULT(localverfcnfiledir, '$(datadir)/octave/$(version)/site/m')
OCTAVE_SET_DEFAULT(octetcdir, '$(datadir)/octave/$(version)/etc')
OCTAVE_SET_DEFAULT(octlibdir, '$(libdir)/octave/$(version)')
OCTAVE_SET_DEFAULT(archlibdir,
  '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localarchlibdir,
  '$(libexecdir)/octave/site/exec/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localapiarchlibdir,
  '$(libexecdir)/octave/$(api_version)/site/exec/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localverarchlibdir,
  '$(libexecdir)/octave/$(version)/site/exec/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(octfiledir,
  '$(libdir)/octave/$(version)/oct/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localoctfiledir,
  '$(libdir)/octave/site/oct/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localapioctfiledir,
  '$(libdir)/octave/site/oct/$(api_version)/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localveroctfiledir,
  '$(libdir)/octave/$(version)/site/oct/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(imagedir, '$(datadir)/octave/$(version)/imagelib')

### Find pkg-config executable (sets $PKG_CONFIG)

PKG_PROG_PKG_CONFIG

### Make configure args available for other uses.

config_opts=$ac_configure_args
AC_SUBST(config_opts)

### Enable bounds checking on element references within Octave's array and
### matrix classes.  This slows down some operations a bit, so it is turned off
### by default.

BOUNDS_CHECKING=false
AC_ARG_ENABLE(bounds-check,
  [AS_HELP_STRING([--enable-bounds-check],
     [bounds checking for indexing in internal array classes (default is no)])],
  [if test "$enableval" = yes; then BOUNDS_CHECKING=true; fi], [])
if $BOUNDS_CHECKING; then
  AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.])
fi

### Use Octave's built-in memory allocator rather than straightforward malloc.
### Disabled by default.

USE_OCTAVE_ALLOCATOR=false
AC_ARG_ENABLE(octave-allocator,
  [AS_HELP_STRING([--enable-octave-allocator],
     [use the obsolete octave_allocator class for many of Octave's objects (mostly octave_value types).  You probably do NOT want to enable this feature.  (default is no)])],
  [if test "$enableval" = yes; then USE_OCTAVE_ALLOCATOR=true; fi], [])
if $USE_OCTAVE_ALLOCATOR; then
  AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1, [Define to 1 to use octave_allocator class.])
fi

### Use atomic operations for internal reference counting.  This is required
### for thread-safe behavior but incurs a significant slowdown, and is thus
### disabled by default.

USE_ATOMIC_REFCOUNT=false
AC_ARG_ENABLE(atomic-refcount,
  [AS_HELP_STRING([--enable-atomic-refcount],
     [use atomic operations for internal reference counting.  This is required for thread-safe behavior.  (default is no)])],
  [if test "$enableval" = yes; then USE_ATOMIC_REFCOUNT=true; fi], [])
if $USE_ATOMIC_REFCOUNT; then
  AC_DEFINE(USE_ATOMIC_REFCOUNT, 1, [Define to 1 to use atomic operations for reference counting.])
fi

### Disable running Make in the doc directory.
### This is useful, for example, when building Octave on systems without TeX.

DOCDIR=doc
AC_ARG_ENABLE(docs,
  [AS_HELP_STRING([--enable-docs], [build documentation (default is yes)])],
  [if test "$enableval" = no; then
     DOCDIR=
     warn_docs="building documentation disabled; make dist will fail"
     OCTAVE_CONFIGURE_WARNING([warn_docs])
   fi], [])
AC_SUBST(DOCDIR)

### If possible, use a 64-bit integer type for array dimensions and indexing.

USE_64_BIT_IDX_T=false
OCTAVE_IDX_TYPE=int
AC_ARG_ENABLE(64,
  [AS_HELP_STRING([--enable-64],
     [(EXPERIMENTAL) use 64-bit integers for array dimensions and indexing])],
  [if test "$enableval" = yes; then USE_64_BIT_IDX_T=true; fi], [])
if $USE_64_BIT_IDX_T; then
  AC_CHECK_SIZEOF(void *)
  AC_CHECK_SIZEOF(int)
  AC_CHECK_SIZEOF(long)
  if test $ac_cv_sizeof_void_p -eq 8; then
    if test $ac_cv_sizeof_int -eq 8; then
      OCTAVE_IDX_TYPE=int
    elif test $ac_cv_sizeof_long -eq 8; then
      OCTAVE_IDX_TYPE=long
      AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long.])
    else
      warn_64_bit="no suitable type found for octave_idx_type so disabling 64-bit features"
      OCTAVE_CONFIGURE_WARNING([warn_64_bit])
      USE_64_BIT_IDX_T=false
    fi
  else
    warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features"
    OCTAVE_CONFIGURE_WARNING([warn_64_bit])
    USE_64_BIT_IDX_T=false
  fi
fi
AC_SUBST(OCTAVE_IDX_TYPE)
AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, $OCTAVE_IDX_TYPE,
  [Define to the type of octave_idx_type (64 or 32 bit signed integer).])
if $USE_64_BIT_IDX_T; then
  AC_DEFINE(USE_64_BIT_IDX_T, 1, [Define to 1 if using 64-bit integers for array dimensions and indexing.])
fi
AC_SUBST(USE_64_BIT_IDX_T)

### It seems that there are some broken inline assembly functions in
### the GNU libc.  Since I'm not sure how to test whether we are using
### GNU libc, just disable them for all platforms.

AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function])
AC_DEFINE(__NO_MATH_INLINES, 1, [Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.])

### Determine which C++ compiler to use (we expect to find g++).

AC_PROG_CXX
AC_PROG_CXXCPP

### Check version number when using g++.

gxx_version=`$CXX -v 2>&1 | grep "^.*g.. version" | \
  sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'`

case "$gxx_version" in
  1.* | 2.[[0123456789]].* | 3.[[01234]].*)
    AC_MSG_ERROR([g++ version $gxx_version will probably fail to compile Octave]
)
  ;;
esac

CXX_VERSION=
if test -n "$gxx_version"; then
  CXX_VERSION="$gxx_version"
fi
AC_SUBST(CXX_VERSION)

OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
OCTAVE_CXX_BROKEN_REINTERPRET_CAST

### Determine which C compiler to use (we expect to find gcc).

AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL

## Check for MSVC
have_msvc=no
case "$canonical_host_type" in
  *-*-msdosmsvc)
    have_msvc=yes
  ;;
  *-*-mingw*)
    AC_MSG_CHECKING([for MSVC compiler])
    AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#ifndef _MSC_VER
#error "Not MSVC compiler"
#endif
])], have_msvc=yes, have_msvc=no)
    AC_MSG_RESULT([$have_msvc])
  ;;
esac

### gnulib initialization

gl_EARLY
gl_INIT

### Check version number when using gcc.

gcc_version=`$CC -v 2>&1 | grep "^.*gcc version" | \
  sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//'`
case "$gcc_version" in
  [12].*)
    warn_gcc_version="gcc version $gcc_version is likely to cause problems"
    OCTAVE_CONFIGURE_WARNING([warn_gcc_version])
  ;;
esac

CC_VERSION=
if test -n "$gcc_version"; then
  CC_VERSION="$gcc_version"
fi
AC_SUBST(CC_VERSION)

### Determine the compiler flag necessary to create dependencies

## Assume GCC.
INCLUDE_DEPS=true
DEPEND_FLAGS="-M"
DEPEND_EXTRA_SED_PATTERN=""
if test "$GCC" = yes; then
  true
else
  case "$canonical_host_type" in
    sparc-sun-solaris2* | i386-pc-solaris2*)
      DEPEND_FLAGS="-xM1"
      DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'"
    ;;
    *-*-msdosmsvc)
    ;;
    *-*-mingw*)
      if test "$have_msvc" = "no"; then
        INCLUDE_DEPS=false
      fi
    ;;
    *)
      INCLUDE_DEPS=false
    ;;
  esac
fi
AC_SUBST(INCLUDE_DEPS)
AC_SUBST(DEPEND_FLAGS)
AC_SUBST(DEPEND_EXTRA_SED_PATTERN)

### Check for pthread library

AX_PTHREAD
## Include pthread libs and flags here in case other tests need them.
## They seem to be required for the OpenGL tests on Debian systems.
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"

### When compiling math for x87, problems may arise in some code comparing
### floating-point intermediate results.
### Generally, it helps to store the result in a local volatile variable,
### but it also degrades performance.
### Thus, we provide a FLOAT_TRUNCATE macro that may be defined to "volatile"
### when compiling for x87 target, or left empty for modern SSE math, that
### doesn't suffer from this problem at all.
AC_ARG_ENABLE(float-truncate,
  [AS_HELP_STRING([--enable-float-truncate],
     [enables truncating intermediate FP results.])],
  [if test "$enableval" = yes; then ac_float_truncate=volatile;
   else ac_float_truncate=; fi],
  ac_float_truncate=)

AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, $ac_float_truncate, 
          [Define to volatile if you need to truncate intermediate FP results.])

### Determine extra CFLAGS that may be necessary for Octave.

## On Intel systems with gcc, we may need to compile with -mieee-fp
## and -ffloat-store to get full support for IEEE floating point.
##
## On Alpha/OSF systems, we need -mieee.

ieee_fp_flag=
case "$canonical_host_type" in
  ## Keep this pattern first, so that it is preferred over the
  ## following pattern for x86.
  i[[3456789]]86-*-*)
    if test "$GCC" = yes; then
      OCTAVE_CC_FLAG(-mieee-fp, [
        ieee_fp_flag=-mieee-fp
        XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"
        AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])])

##      OCTAVE_CC_FLAG(-ffloat-store, [
##        float_store_flag=-ffloat-store
##        XTRA_CFLAGS="$XTRA_CFLAGS -ffloat-store"
##        AC_MSG_RESULT([adding -ffloat-store to XTRA_CFLAGS])])
    fi
    if test "$GXX" = yes; then
      OCTAVE_CXX_FLAG(-mieee-fp, [
        ieee_fp_flag=-mieee-fp
        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"
        AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])])

##      OCTAVE_CXX_FLAG(-ffloat-store, [
##        float_store_flag=-ffloat-store
##        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ffloat-store"
##        AC_MSG_RESULT([adding -ffloat-store to XTRA_CXXFLAGS])])
    fi
  ;;
  alpha*-*-*)
    if test "$GCC" = yes; then
      OCTAVE_CC_FLAG(-mieee, [
        ieee_fp_flag=-mieee
        XTRA_CFLAGS="$XTRA_CFLAGS -mieee"
        AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])])
    else
      OCTAVE_CC_FLAG(-ieee, [
        ieee_fp_flag=-ieee
        XTRA_CFLAGS="$XTRA_CFLAGS -ieee"
        AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])])
    fi
    if test "$GXX" = yes; then
      OCTAVE_CXX_FLAG(-mieee, [
        ieee_fp_flag=-mieee
        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee"
        AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])])
    else
      OCTAVE_CXX_FLAG(-ieee, [
        ieee_fp_flag=-ieee
        XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee"
        AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])])
    fi
  ;;
  *ibm-aix4*)
    OCTAVE_CC_FLAG(-mminimal-toc, [
      XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"])

    OCTAVE_CXX_FLAG(-mminimal-toc, [
      XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"])
  ;;
esac

AC_SUBST(XTRA_CFLAGS)
AC_SUBST(XTRA_CXXFLAGS)

### Test whether the compiler supports OpenMP.  This is experimental so disable
### it by default.  Enable it with the flag --enable-openmp.

USE_OPENMP=false
AC_ARG_ENABLE(openmp,
  [AS_HELP_STRING([--enable-openmp],
     [(EXPERIMENTAL) use OpenMP SMP multi-threading])],
  [if test "$enableval" = yes; then USE_OPENMP=true; fi], [])
if $USE_OPENMP; then
  case "$canonical_host_type" in
    *-*-mingw* | *-*-cygwin* | *-*-gnu*)
    OCTAVE_CHECK_OPENMP(-fopenmp)
    ;;
    *-*-msdosmsvc)
    ## FIXME: is this the right flag for MSVC?
    OCTAVE_CHECK_OPENMP(-openmp)
    ;;
    ## Add other compilers supporting OpenMP here
  esac
fi

dnl FIXME: This is OS-specific tests.  Can this be moved further down in
dnl configure.ac to reside with other similar tests?
### Use -static if compiling on Alpha OSF/1 1.3 systems.

case "$canonical_host_type" in
  alpha*-dec-osf1.3)
    LD_STATIC_FLAG=-static
  ;;
esac
if test -n "$LD_STATIC_FLAG"; then
  AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
fi
AC_SUBST(LD_STATIC_FLAG)

### Defaults for cross compiling.  BUILD_CC and BUILD_CXX are
### the compilers that we use for building tools on the build system.
### For now, we assume that the only cross compiling we can do is
### with gcc on a Unixy system, but the dedicated hacker can override these.

if test "$cross_compiling" = yes; then
  BUILD_CC="gcc"
  BUILD_CFLAGS="-O2 -g"
  BUILD_CXX="g++"
  BUILD_CXXFLAGS="-O2 -g"
  BUILD_LDFLAGS=""
  BUILD_EXEEXT=""
else
  BUILD_CC='$(CC)'
  BUILD_CFLAGS='$(CFLAGS)'
  BUILD_CXX='$(CXX)'
  BUILD_CXXFLAGS='$(CXXFLAGS)'
  BUILD_LDFLAGS='$(LDFLAGS)'
  ## 2012/07/31: Commented out special build requirements
  ## for Sun compiler now that gendoc.cc is no longer part of build.
  ##################################################################
  #case "$canonical_host_type" in
  #  sparc-sun-solaris2*)
  #    if test "$GCC" != yes; then
  #      ## The Sun C++ compiler never seems to complete compiling
  #      ## gendoc.cc unless we reduce the optimization level...
  #      ## BUILD_CXXFLAGS="-g -O1"
  #    fi
  #  ;;
  #esac
  BUILD_EXEEXT='$(EXEEXT)'
fi

AC_ARG_VAR(BUILD_CC, [build system C compiler (used if cross compiling)])
AC_ARG_VAR(BUILD_CFLAGS, [build system C compiler flags (used if cross compiling)])
AC_ARG_VAR(BUILD_CXX, [build system C++ compiler (used if cross compiling)])
AC_ARG_VAR(BUILD_CXXFLAGS, [build system C++ compiler flags (used if cross compiling)])
AC_ARG_VAR(BUILD_LDFLAGS, [build system C++ compiler link flags (used if cross compiling)])
AC_ARG_VAR(BUILD_EXEEXT, [build system executable extension (used if cross compiling)])

dnl This is bogus.  We shouldn't have to explicitly add libc too!
dnl Keep this check before the check for the Fortran compiler,
dnl in case -lm is needed to compile Fortran programs.

### Look for math library.  If found, this will add -lm to LIBS.

case "$canonical_host_type" in
  *-*-linux*)
    AC_CHECK_LIB(m, sin, , , -lc)
  ;;
  *)
    AC_CHECK_LIB(m, sin)
  ;;
esac

### Determine the Fortran compiler and how to invoke it

## Default FFLAGS is -O.
if test "x$FFLAGS" = x; then
  FFLAGS="-O"
fi

## the F77 variable, if set, overrides AC_PROG_F77 automatically
AC_PROG_F77
AC_F77_LIBRARY_LDFLAGS
AC_F77_DUMMY_MAIN
AC_F77_WRAPPERS

F77_TOLOWER=true
F77_APPEND_UNDERSCORE=true
F77_APPEND_EXTRA_UNDERSCORE=true

case "$ac_cv_f77_mangling" in
  "upper case") F77_TOLOWER=false ;;
esac
case "$ac_cv_f77_mangling" in
  "no underscore") F77_APPEND_UNDERSCORE=false ;;
esac
case "$ac_cv_f77_mangling" in
  "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=false ;;
esac

case "$canonical_host_type" in
  i[[3456789]]86-*-*)
    if test "$ac_cv_f77_compiler_gnu" = yes; then
      OCTAVE_F77_FLAG(-mieee-fp)
###      OCTAVE_F77_FLAG(-ffloat-store)
    fi
  ;;
  alpha*-*-*)
    if test "$ac_cv_f77_compiler_gnu" = yes; then
      OCTAVE_F77_FLAG(-mieee)
    else
      OCTAVE_F77_FLAG(-ieee)
      OCTAVE_F77_FLAG(-fpe1)
    fi
  ;;
  powerpc-apple-machten*)
    FFLAGS=
  ;;
esac

if test -n "$FFLAGS"; then
  AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
fi

AC_SUBST(F77_TOLOWER)
AC_SUBST(F77_APPEND_UNDERSCORE)
AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)

if test -z "$F77"; then
  AC_MSG_ERROR([in order to build Octave, you must have a compatible Fortran compiler or wrapper script for f2c that functions as a Fortran compiler installed and in your path.  See the file INSTALL for more information.])
fi

OCTAVE_CHECK_FORTRAN_HAVE_ISNAN
F77_ISNAN_MACRO=
if test "x$octave_cv_fortran_have_isnan" = xno; then
   AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in Fortran sources])
   F77_ISNAN_MACRO="s|ISNAN(\(@<:@^)@:>@*\))|(\1.NE.\1)|"
fi
AC_SUBST(F77_ISNAN_MACRO)

OCTAVE_CHECK_FORTRAN_INTEGER_SIZE
if test "x$octave_cv_fortran_integer_size" = xno; then
  if $USE_64_BIT_IDX_T; then
    case "$F77" in
      *gfortran*)
        case "$F77_INTEGER_8_FLAG" in
          *-fdefault-integer-8*)
          ;;
          *)
            case "$FFLAGS" in
              *-fdefault-integer-8*)
                AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS])
                FFLAGS=`echo $FFLAGS | sed 's/-fdefault-integer-8//g'`
                F77_INTEGER_8_FLAG="-fdefault-integer-8"
              ;;
              *)
                AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG])
                F77_INTEGER_8_FLAG="-fdefault-integer-8"
                ## Invalidate the cache and try again.
                $as_unset octave_cv_fortran_integer_size
              ;;
            esac
          ;;
        esac
      ;;
    esac
    if test -z "$octave_cv_fortran_integer_size"; then
      OCTAVE_CHECK_FORTRAN_INTEGER_SIZE
    fi
    if test "x$octave_cv_fortran_integer_size" = xno; then
      AC_MSG_ERROR([in order to build Octave with 64-bit indexing support your Fortran compiler must have an option for setting the default integer size to 8 bytes.  See the file INSTALL for more information.])
    fi
  else
    AC_MSG_ERROR([your Fortran compiler must have an option to make integers the same size as octave_idx_type ($OCTAVE_IDX_TYPE).  See the file INSTALL for more information.])
  fi
fi
AC_SUBST(F77_INTEGER_8_FLAG)

FC=$F77
AC_SUBST(FC)

OCTAVE_F77_FLAG(-ffloat-store, [
AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
F77_FLOAT_STORE_FLAG=-ffloat-store
AC_SUBST(F77_FLOAT_STORE_FLAG)
])

### Check that C compiler and libraries support IEEE754 data format.
OCTAVE_IEEE754_DATA_FORMAT

### Check C++ library for various capabilities.
OCTAVE_CXX_BITWISE_OP_TEMPLATES
OCTAVE_CXX_COMPLEX_SETTERS
OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS

### Check for the Qhull library

OCTAVE_CHECK_LIBRARY(qhull, QHull,
  [Qhull library not found -- this will result in loss of functionality of some geometry functions.],
  [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h], [qh_qhull], [], [],
  [warn_qhull=
   OCTAVE_CHECK_QHULL_VERSION
   OCTAVE_CHECK_QHULL_OK([TEXINFO_QHULL="@set HAVE_QHULL"
     AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])], [
     warn_qhull="Qhull library found, but does not seem to work properly -- this will result in loss of functionality of some geometry functions.  Please try recompiling the library with -fno-strict-aliasing."])])

### Check for PCRE regex library.

REGEX_LIBS=

pcre_fail_msg="to build Octave, you must have the PCRE library and header files installed"

AC_CHECK_HEADERS([pcre.h pcre/pcre.h])

AC_CACHE_CHECK([whether pcre.h defines the macros we need],
  [ac_cv_pcre_h_macros_present],
  [AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [
#if defined (HAVE_PCRE_H)
#include <pcre.h>
#elif defined (HAVE_PCRE_PCRE_H)
#include <pcre.h>
#error "NO PCRE HEADER"
#endif
#if defined (PCRE_INFO_NAMECOUNT) \
  && defined (PCRE_INFO_NAMEENTRYSIZE) \
  && defined (PCRE_INFO_NAMETABLE)
PCRE_HAS_MACROS_WE_NEED
#endif], ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)])

if test $ac_cv_pcre_h_macros_present = yes; then
  ## check for pcre-config, and if so, set XTRA_CXXFLAGS appropriately
  AC_CHECK_PROG(HAVE_PCRE_CONFIG, pcre-config, [yes], [no])
  if test $HAVE_PCRE_CONFIG = yes; then
    XTRA_CXXFLAGS="$XTRA_CXXFLAGS `pcre-config --cflags`"
    REGEX_LIBS="`pcre-config --libs`"
  else
    REGEX_LIBS="-lpcre"
  fi
  save_LIBS="$LIBS"
  LIBS="$REGEX_LIBS $LIBS"
  AC_CHECK_FUNCS(pcre_compile,
    [AC_SUBST(REGEX_LIBS)],
    [AC_MSG_ERROR([$pcre_fail_msg])])
  LIBS="$save_LIBS"
else
  AC_MSG_ERROR([$pcre_fail_msg])
fi

### Check for ZLIB library.

OCTAVE_CHECK_LIBRARY(z, ZLIB,
  [ZLIB library not found.  Octave will not be able to save or load compressed data files or HDF5 files.],
  [zlib.h], [gzclearerr])

### Check for the LLVM library
dnl
dnl LLVM is odd and has its own pkg-config like script.  We should probably
dnl check for existence and ???.
dnl
save_CPPFLAGS="$CPPFLAGS"
save_CXXFLAGS="$CXXFLAGS"
save_LIBS="$LIBS"
save_LDFLAGS="$LDFLAGS"

warn_llvm="LLVM library fails tests.  JIT compilation will be disabled."

AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility])

AC_ARG_ENABLE([jit-debug],
  AS_HELP_STRING([--enable-jit-debug], [Enable debug printing of JIT IRs]))

AS_IF([test "x$enable_jit_debug" = "xyes"], [
  AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.])
])

LLVM_CXXFLAGS=
LLVM_CPPFLAGS=
LLVM_LDFLAGS=
LLVM_LIBS=

if test "x$ac_cv_env_LLVM_CONFIG_set" = "xset"; then
  ## We use -isystem if available because we do not want to see warnings in LLVM
  LLVM_INCLUDE_FLAG=-I
  OCTAVE_CC_FLAG(-isystem ., [
    LLVM_INCLUDE_FLAG=-isystem
    AC_MSG_NOTICE([using -isystem for llvm headers])])

  LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
  LLVM_LIBS=`$LLVM_CONFIG --libs`
  dnl Use -isystem so we don't get warnings from llvm headers
  LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
  LLVM_CXXFLAGS=

  dnl
  dnl We define some extra flags that LLVM requires in order to include headers.
  dnl Ideally we should get these from llvm-config, but llvm-config isn't very
  dnl helpful.
  dnl
  CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS"
  CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS"
  LIBS="$LLVM_LIBS $LIBS"
  LDFLAGS="$LLVM_LDFLAGS $LDFLAGS"

  AC_LANG_PUSH(C++)
    AC_CHECK_HEADER([llvm/LLVMContext.h], [
      AC_MSG_CHECKING([for llvm::getGlobalContext in llvm/LLVMContext.h])
        AC_COMPILE_IFELSE(
          [AC_LANG_PROGRAM([[#include <llvm/LLVMContext.h>]],
                           [[llvm::LLVMContext& ctx = llvm::getGlobalContext ();]])],
          [
           AC_MSG_RESULT([yes])
           warn_llvm=
           XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"
          ],
          [AC_MSG_RESULT([no])
      ])
    ])
  AC_LANG_POP(C++)
  
else
  warn_llvm="LLVM_CONFIG not set.  JIT compilation will be disabled."
fi

if test -z "$warn_llvm"; then
  AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.])
else
  LLVM_CXXFLAGS=
  LLVM_CPPFLAGS=
  LLVM_LDFLAGS=
  LLVM_LIBS=
  OCTAVE_CONFIGURE_WARNING([warn_llvm])
fi

AC_SUBST(LLVM_CXXFLAGS)
AC_SUBST(LLVM_CPPFLAGS)
AC_SUBST(LLVM_LDFLAGS)
AC_SUBST(LLVM_LIBS)

CPPFLAGS="$save_CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS"
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"

### Check for HDF5 library.

save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
save_LIBS="$LIBS"
LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
OCTAVE_CHECK_LIBRARY(hdf5, HDF5,
  [HDF5 library not found.  Octave will not be able to save or load HDF5 data files.],
  [hdf5.h], [H5Gget_num_objs], [], [],
  [warn_hdf5=
   OCTAVE_HDF5_HAS_ENFORCED_16_API
   TEXINFO_HDF5="@set HAVE_HDF5"
   AC_DEFINE(HAVE_HDF5, 1, [Define to 1 if HDF5 is available and newer than version 1.6.])
   if test "$have_msvc" = "yes"; then
     OCTAVE_HDF5_DLL
   fi
   ])
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"

dnl @synopsis BNV_HAVE_QT [--with-Qt-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
dnl @synopsis BNV_HAVE_QT [--with-Qt-include-dir=DIR] [--with-Qt-bin-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
dnl
dnl @summary Search for Trolltech's Qt GUI framework.
dnl
dnl Searches common directories for Qt include files, libraries and Qt
dnl binary utilities. The macro supports several different versions of
dnl the Qt framework being installed on the same machine. Without
dnl options, the macro is designed to look for the latest library,
dnl i.e., the highest definition of QT_VERSION in qglobal.h. By use of
dnl one or more options a different library may be selected. There are
dnl two different sets of options. Both sets contain the option
dnl --with-Qt-lib=LIB which can be used to force the use of a
dnl particular version of the library file when more than one are
dnl available. LIB must be in the form as it would appear behind the
dnl "-l" option to the compiler. Examples for LIB would be "qt-mt" for
dnl the multi-threaded version and "qt" for the regular version. In
dnl addition to this, the first set consists of an option
dnl --with-Qt-dir=DIR which can be used when the installation conforms
dnl to Trolltech's standard installation, which means that header files
dnl are in DIR/include, binary utilities are in DIR/bin and the library
dnl is in DIR/lib. The second set of options can be used to indicate
dnl individual locations for the header files, the binary utilities and
dnl the library file, in addition to the specific version of the
dnl library file.
dnl
dnl The following shell variable is set to either "yes" or "no":
dnl
dnl   have_qt
dnl
dnl Additionally, the following variables are exported:
dnl
dnl   QT_CXXFLAGS
dnl   QT_LIBS
dnl   QT_MOC
dnl   QT_UIC
dnl   QT_DIR
dnl
dnl which respectively contain an "-I" flag pointing to the Qt include
dnl directory (and "-DQT_THREAD_SUPPORT" when LIB is "qt-mt"), link
dnl flags necessary to link with Qt and X, the name of the meta object
dnl compiler and the user interface compiler both with full path, and
dnl finaly the variable QTDIR as Trolltech likes to see it defined (if
dnl possible).
dnl
dnl Example lines for Makefile.in:
dnl
dnl   CXXFLAGS = @QT_CXXFLAGS@
dnl   MOC      = @QT_MOC@
dnl
dnl After the variables have been set, a trial compile and link is
dnl performed to check the correct functioning of the meta object
dnl compiler. This test may fail when the different detected elements
dnl stem from different releases of the Qt framework. In that case, an
dnl error message is emitted and configure stops.
dnl
dnl No common variables such as $LIBS or $CFLAGS are polluted.
dnl
dnl Options:
dnl
dnl --with-Qt-dir=DIR: DIR is equal to $QTDIR if you have followed the
dnl installation instructions of Trolltech. Header files are in
dnl DIR/include, binary utilities are in DIR/bin and the library is in
dnl DIR/lib.
dnl
dnl --with-Qt-include-dir=DIR: Qt header files are in DIR.
dnl
dnl --with-Qt-bin-dir=DIR: Qt utilities such as moc and uic are in DIR.
dnl
dnl --with-Qt-lib-dir=DIR: The Qt library is in DIR.
dnl
dnl --with-Qt-lib=LIB: Use -lLIB to link with the Qt library.
dnl
dnl If some option "=no" or, equivalently, a --without-Qt-* version is
dnl given in stead of a --with-Qt-*, "have_qt" is set to "no" and the
dnl other variables are set to the empty string.
dnl
dnl @category InstalledPackages
dnl @author Bastiaan Veelo <Bastiaan@Veelo.net>
dnl @version 2006-03-12
dnl @license AllPermissive

dnl Copyright (C) 2001, 2002, 2003, 2005, 2006 Bastiaan Veelo

dnl THANKS! This code includes bug fixes and contributions made by:
dnl Tim McClarren,
dnl Dennis R. Weilert,
dnl Qingning Huo,
dnl Brian Mingus,
dnl Jens Hannemann,
dnl Pavel Roskin,
dnl Scott J. Bertin.

dnl ChangeLog
dnl 2006-03-12  * Hide output of ls and fix an m4 quoting problem (due to Scott J. Bertin).
dnl 2006-02-13  * Check compiler return value instead of parsing the error stream,
dnl               which detected warnings as false negatives (due to Jens Hannemann).
dnl 2006-02-02  * Spelling of "Success".
dnl             * Fixed unsave test for $bnv_qt_lib without quotes.
dnl             * Put dnl in front of all comments.
dnl             * Changed -l$bnv_qt_lib_dir into -L$bnv_qt_lib_dir (all due to Pavel Roskin).
dnl 2006-01-19  * Support for 64bit architectures.
dnl             * Updated documentation.
dnl 2006-01-18: * Fix "cat: bnv_qt_test.c: No such file or directory" (due to Jens Hannemann).
dnl             * Hide output of failing ls.
dnl 2006-01-11: * Check in /Developer on Mac OS X; Check in $QTDIR (due to Brian Mingus).

dnl Calls BNV_PATH_QT_DIRECT (contained in this file) as a subroutine.
AC_DEFUN([BNV_HAVE_QT],
[
  AC_REQUIRE([AC_PROG_CXX])
  AC_REQUIRE([AC_PATH_X])
  AC_REQUIRE([AC_PATH_XTRA])

  AC_MSG_CHECKING(for Qt)

  AC_ARG_WITH([Qt-dir],
    [  --with-Qt-dir=DIR       DIR is equal to $QTDIR if you have followed the
                          installation instructions of Trolltech. Header
                          files are in DIR/include, binary utilities are
                          in DIR/bin. The library is in DIR/lib, unless
			  --with-Qt-lib-dir is also set.])
  AC_ARG_WITH([Qt-include-dir],
    [  --with-Qt-include-dir=DIR
                          Qt header files are in DIR])
  AC_ARG_WITH([Qt-bin-dir],
    [  --with-Qt-bin-dir=DIR   Qt utilities such as moc and uic are in DIR])
  AC_ARG_WITH([Qt-lib-dir],
    [  --with-Qt-lib-dir=DIR   The Qt library is in DIR])
  AC_ARG_WITH([Qt-lib],
    [  --with-Qt-lib=LIB       Use -lLIB to link with the Qt library])
  if test x"$with_Qt_dir" = x"no" ||
     test x"$with_Qt_include-dir" = x"no" ||
     test x"$with_Qt_bin_dir" = x"no" ||
     test x"$with_Qt_lib_dir" = x"no" ||
     test x"$with_Qt_lib" = x"no"; then
    # user disabled Qt. Leave cache alone.
    have_qt="User disabled Qt."
  else
    # "yes" is a bogus option
    if test x"$with_Qt_dir" = xyes; then
      with_Qt_dir=
    fi
    if test x"$with_Qt_include_dir" = xyes; then
      with_Qt_include_dir=
    fi
    if test x"$with_Qt_bin_dir" = xyes; then
      with_Qt_bin_dir=
    fi
    if test x"$with_Qt_lib_dir" = xyes; then
      with_Qt_lib_dir=
    fi
    if test x"$with_Qt_lib" = xyes; then
      with_Qt_lib=
    fi
    # No Qt unless we discover otherwise
    have_qt=no
    # Check whether we are requested to link with a specific version
    if test x"$with_Qt_lib" != x; then
      bnv_qt_lib="$with_Qt_lib"
    fi
    # Check whether we were supplied with an answer already
    if test x"$with_Qt_dir" != x; then
      have_qt=yes
      bnv_qt_dir="$with_Qt_dir"
      bnv_qt_include_dir="$with_Qt_dir/include"
      bnv_qt_bin_dir="$with_Qt_dir/bin"
      bnv_qt_lib_dir="$with_Qt_dir/lib"
      # Only search for the lib if the user did not define one already
      if test x"$bnv_qt_lib" = x; then
        bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
                     sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
      fi
      bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
    else
      # Use cached value or do search, starting with suggestions from
      # the command line
      AC_CACHE_VAL(bnv_cv_have_qt,
      [
        # We are not given a solution and there is no cached value.
        bnv_qt_dir=NO
        bnv_qt_include_dir=NO
        bnv_qt_lib_dir=NO
        if test x"$bnv_qt_lib" = x; then
          bnv_qt_lib=NO
        fi
        BNV_PATH_QT_DIRECT
        if test "$bnv_qt_dir" = NO ||
           test "$bnv_qt_include_dir" = NO ||
           test "$bnv_qt_lib_dir" = NO ||
           test "$bnv_qt_lib" = NO; then
          # Problem with finding complete Qt.  Cache the known absence of Qt.
          bnv_cv_have_qt="have_qt=no"
        else
          # Record where we found Qt for the cache.
          bnv_cv_have_qt="have_qt=yes                  \
                       bnv_qt_dir=$bnv_qt_dir          \
               bnv_qt_include_dir=$bnv_qt_include_dir  \
                   bnv_qt_bin_dir=$bnv_qt_bin_dir      \
                      bnv_qt_LIBS=\"$bnv_qt_LIBS\""
        fi
      ])dnl
      eval "$bnv_cv_have_qt"
    fi # all $bnv_qt_* are set
  fi   # $have_qt reflects the system status
  if test x"$have_qt" = xyes; then
    QT_CXXFLAGS="-I$bnv_qt_include_dir"
    if test x"$bnv_qt_lib" = xqt-mt; then
        QT_CXXFLAGS="$QT_CXXFLAGS -DQT_THREAD_SUPPORT"
    fi
    QT_DIR="$bnv_qt_dir"
    QT_LIBS="$bnv_qt_LIBS"
    # If bnv_qt_dir is defined, utilities are expected to be in the
    # bin subdirectory
    if test x"$bnv_qt_dir" != x; then
        if test -x "$bnv_qt_dir/bin/uic"; then
          QT_UIC="$bnv_qt_dir/bin/uic"
        else
          # Old versions of Qt don't have uic
          QT_UIC=
        fi
      QT_MOC="$bnv_qt_dir/bin/moc"
    else
      # Or maybe we are told where to look for the utilities
      if test x"$bnv_qt_bin_dir" != x; then
        if test -x "$bnv_qt_bin_dir/uic"; then
          QT_UIC="$bnv_qt_bin_dir/uic"
        else
          # Old versions of Qt don't have uic
          QT_UIC=
        fi
        QT_MOC="$bnv_qt_bin_dir/moc"
      else
      # Last possibility is that they are in $PATH
        QT_UIC="`which uic`"
        QT_MOC="`which moc`"
      fi
    fi
    # All variables are defined, report the result
    AC_MSG_RESULT([$have_qt:
    QT_CXXFLAGS=$QT_CXXFLAGS
    QT_DIR=$QT_DIR
    QT_LIBS=$QT_LIBS
    QT_UIC=$QT_UIC
    QT_MOC=$QT_MOC])
  else
    # Qt was not found
    QT_CXXFLAGS=
    QT_DIR=
    QT_LIBS=
    QT_UIC=
    QT_MOC=
    AC_MSG_RESULT($have_qt)
  fi
  AC_SUBST(QT_CXXFLAGS)
  AC_SUBST(QT_DIR)
  AC_SUBST(QT_LIBS)
  AC_SUBST(QT_UIC)
  AC_SUBST(QT_MOC)

  #### Being paranoid:
  if test x"$have_qt" = xyes; then
    AC_MSG_CHECKING(correct functioning of Qt installation)
    AC_CACHE_VAL(bnv_cv_qt_test_result,
    [
      cat > bnv_qt_test.h << EOF
#include <qobject.h>
class Test : public QObject
{
Q_OBJECT
public:
  Test() {}
  ~Test() {}
public slots:
  void receive() {}
signals:
  void send();
};
EOF

      cat > bnv_qt_main.$ac_ext << EOF
#include "bnv_qt_test.h"
#include <qapplication.h>
int main( int argc, char **argv )
{
  QApplication app( argc, argv );
  Test t;
  QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
}
EOF

      bnv_cv_qt_test_result="failure"
      bnv_try_1="$QT_MOC bnv_qt_test.h -o moc_bnv_qt_test.$ac_ext >/dev/null 2>/dev/null"
      AC_TRY_EVAL(bnv_try_1)
      if test x"$ac_status" != x0; then
        echo "$bnv_err_1" >&AC_FD_CC
        echo "configure: could not run $QT_MOC on:" >&AC_FD_CC
        cat bnv_qt_test.h >&AC_FD_CC
      else
        bnv_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_bnv_qt_test.o moc_bnv_qt_test.$ac_ext >/dev/null 2>/dev/null"
        AC_TRY_EVAL(bnv_try_2)
        if test x"$ac_status" != x0; then
          echo "$bnv_err_2" >&AC_FD_CC
          echo "configure: could not compile:" >&AC_FD_CC
          cat moc_bnv_qt_test.$ac_ext >&AC_FD_CC
        else
          bnv_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o bnv_qt_main.o bnv_qt_main.$ac_ext >/dev/null 2>/dev/null"
          AC_TRY_EVAL(bnv_try_3)
          if test x"$ac_status" != x0; then
            echo "$bnv_err_3" >&AC_FD_CC
            echo "configure: could not compile:" >&AC_FD_CC
            cat bnv_qt_main.$ac_ext >&AC_FD_CC
          else
            bnv_try_4="$CXX $QT_LIBS $LIBS -o bnv_qt_main bnv_qt_main.o moc_bnv_qt_test.o >/dev/null 2>/dev/null"
            AC_TRY_EVAL(bnv_try_4)
            if test x"$ac_status" != x0; then
              echo "$bnv_err_4" >&AC_FD_CC
            else
              bnv_cv_qt_test_result="success"
            fi
          fi
        fi
      fi
    ])dnl AC_CACHE_VAL bnv_cv_qt_test_result
    AC_MSG_RESULT([$bnv_cv_qt_test_result]);
    if test x"$bnv_cv_qt_test_result" = "xfailure"; then
      AC_MSG_ERROR([Failed to find matching components of a complete
                  Qt installation. Try using more options,
                  see ./configure --help.])
    fi

    rm -f bnv_qt_test.h moc_bnv_qt_test.$ac_ext moc_bnv_qt_test.o \
          bnv_qt_main.$ac_ext bnv_qt_main.o bnv_qt_main
  fi
])

dnl Internal subroutine of BNV_HAVE_QT
dnl Set bnv_qt_dir bnv_qt_include_dir bnv_qt_bin_dir bnv_qt_lib_dir bnv_qt_lib
AC_DEFUN([BNV_PATH_QT_DIRECT],
[
  ## Binary utilities ##
  if test x"$with_Qt_bin_dir" != x; then
    bnv_qt_bin_dir=$with_Qt_bin_dir
  fi
  ## Look for header files ##
  if test x"$with_Qt_include_dir" != x; then
    bnv_qt_include_dir="$with_Qt_include_dir"
  else
    # The following header file is expected to define QT_VERSION.
    qt_direct_test_header=qglobal.h
    # Look for the header file in a standard set of common directories.
    bnv_include_path_list="
      /usr/include
      `ls -dr ${QTDIR}/include 2>/dev/null`
      `ls -dr /usr/include/qt* 2>/dev/null`
      `ls -dr /usr/lib/qt*/include 2>/dev/null`
      `ls -dr /usr/local/qt*/include 2>/dev/null`
      `ls -dr /opt/qt*/include 2>/dev/null`
      `ls -dr /Developer/qt*/include 2>/dev/null`
    "
    for bnv_dir in $bnv_include_path_list; do
      if test -r "$bnv_dir/$qt_direct_test_header"; then
        bnv_dirs="$bnv_dirs $bnv_dir"
      fi
    done
    # Now look for the newest in this list
    bnv_prev_ver=0
    for bnv_dir in $bnv_dirs; do
      bnv_this_ver=`egrep -w '#define QT_VERSION' $bnv_dir/$qt_direct_test_header | sed s/'#define QT_VERSION'//`
      if expr $bnv_this_ver '>' $bnv_prev_ver > /dev/null; then
        bnv_qt_include_dir=$bnv_dir
        bnv_prev_ver=$bnv_this_ver
      fi
    done
  fi dnl Found header files.

  # Are these headers located in a traditional Trolltech installation?
  # That would be $bnv_qt_include_dir stripped from its last element:
  bnv_possible_qt_dir=`dirname $bnv_qt_include_dir`
  if (test -x $bnv_possible_qt_dir/bin/moc) &&
     ((ls $bnv_possible_qt_dir/lib/libqt* > /dev/null 2>/dev/null) ||
      (ls $bnv_possible_qt_dir/lib64/libqt* > /dev/null 2>/dev/null)); then
    # Then the rest is a piece of cake
    bnv_qt_dir=$bnv_possible_qt_dir
    bnv_qt_bin_dir="$bnv_qt_dir/bin"
    if test x"$with_Qt_lib_dir" != x; then
      bnv_qt_lib_dir="$with_Qt_lib_dir"
    else
      if (test -d $bnv_qt_dir/lib64); then
	bnv_qt_lib_dir="$bnv_qt_dir/lib64"
      else
	bnv_qt_lib_dir="$bnv_qt_dir/lib"
      fi
    fi
    # Only look for lib if the user did not supply it already
    if test x"$bnv_qt_lib" = xNO; then
      bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
                   sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
    fi
    bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
  else
    # There is no valid definition for $QTDIR as Trolltech likes to see it
    bnv_qt_dir=
    ## Look for Qt library ##
    if test x"$with_Qt_lib_dir" != x; then
      bnv_qt_lib_dir="$with_Qt_lib_dir"
      # Only look for lib if the user did not supply it already
      if test x"$bnv_qt_lib" = xNO; then
        bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
                     sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
      fi
      bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
    else
      # Normally, when there is no traditional Trolltech installation,
      # the library is installed in a place where the linker finds it
      # automatically.
      # If the user did not define the library name, try with qt
      if test x"$bnv_qt_lib" = xNO; then
        bnv_qt_lib=qt
      fi
      qt_direct_test_header=qapplication.h
      qt_direct_test_main="
        int argc;
        char ** argv;
        QApplication app(argc,argv);
      "
      # See if we find the library without any special options.
      # Don't add top $LIBS permanently yet
      bnv_save_LIBS="$LIBS"
      LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
      bnv_qt_LIBS="$LIBS"
      bnv_save_CXXFLAGS="$CXXFLAGS"
      CXXFLAGS="-I$bnv_qt_include_dir"
      AC_TRY_LINK([#include <$qt_direct_test_header>],
        $qt_direct_test_main,
      [
        # Success.
        # We can link with no special library directory.
        bnv_qt_lib_dir=
      ], [
        # That did not work. Try the multi-threaded version
        echo "Non-critical error, please neglect the above." >&AC_FD_CC
        bnv_qt_lib=qt-mt
        LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
        AC_TRY_LINK([#include <$qt_direct_test_header>],
          $qt_direct_test_main,
        [
          # Success.
          # We can link with no special library directory.
          bnv_qt_lib_dir=
        ], [
          # That did not work. Try the OpenGL version
          echo "Non-critical error, please neglect the above." >&AC_FD_CC
          bnv_qt_lib=qt-gl
          LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
          AC_TRY_LINK([#include <$qt_direct_test_header>],
            $qt_direct_test_main,
          [
            # Success.
            # We can link with no special library directory.
            bnv_qt_lib_dir=
          ], [
            # That did not work. Maybe a library version I don't know about?
            echo "Non-critical error, please neglect the above." >&AC_FD_CC
            # Look for some Qt lib in a standard set of common directories.
            bnv_dir_list="
              `echo $bnv_qt_includes | sed ss/includess`
              /lib
	      /usr/lib64
              /usr/lib
	      /usr/local/lib64
              /usr/local/lib
	      /opt/lib64
              /opt/lib
              `ls -dr /usr/lib64/qt* 2>/dev/null`
              `ls -dr /usr/lib64/qt*/lib64 2>/dev/null`
              `ls -dr /usr/lib/qt* 2>/dev/null`
              `ls -dr /usr/local/qt* 2>/dev/null`
              `ls -dr /opt/qt* 2>/dev/null`
            "
            for bnv_dir in $bnv_dir_list; do
              if ls $bnv_dir/libqt* >/dev/null 2>/dev/null; then
                # Gamble that it's the first one...
                bnv_qt_lib="`ls $bnv_dir/libqt* | sed -n 1p |
                            sed s@$bnv_dir/lib@@ | sed s/[[.]].*//`"
                bnv_qt_lib_dir="$bnv_dir"
                break
              fi
            done
            # Try with that one
            LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
            AC_TRY_LINK([#include <$qt_direct_test_header>],
              $qt_direct_test_main,
            [
              # Success.
              # We can link with no special library directory.
              bnv_qt_lib_dir=
            ], [
              # Leave bnv_qt_lib_dir defined
            ])
          ])
        ])
      ])
      if test x"$bnv_qt_lib_dir" != x; then
        bnv_qt_LIBS="-L$bnv_qt_lib_dir $LIBS"
      else
        bnv_qt_LIBS="$LIBS"
      fi
      LIBS="$bnv_save_LIBS"
      CXXFLAGS="$bnv_save_CXXFLAGS"
    fi dnl $with_Qt_lib_dir was not given
  fi dnl Done setting up for non-traditional Trolltech installation
])

### Check for FFTW library.  Default to Fortran FFTPACK if it is not available.

## Check for FFTW header and library.
OCTAVE_CHECK_LIBRARY(fftw3, FFTW3,
  [FFTW3 library not found.  The slower FFTPACK library will be used instead.],
  [fftw3.h], [fftw_plan_dft_1d])

OCTAVE_CHECK_LIBRARY(fftw3f, FFTW3F,
  [FFTW3F library not found.  The slower FFTPACK library will be used instead.],
  [fftw3.h], [fftwf_plan_dft_1d])

AM_CONDITIONAL([AMCOND_HAVE_FFTW],
  [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"])

## Subdirectory of libcruft to build if FFTW is not found:
FFT_DIR="fftpack"
AC_SUBST(FFT_DIR)

### Check for GLPK library and header.

save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
save_LIBS="$LIBS"
LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
OCTAVE_CHECK_LIBRARY(glpk, GLPK,
  [GLPK library not found.  The glpk function for solving linear programs will be disabled.],
  [glpk/glpk.h glpk.h], [_glp_lpx_simplex])
LIBS="$save_LIBS"
CPPFLAGS="$save_CPPFLAGS"

### Checks for cURL header and library.

save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS"
save_LIBS="$LIBS"
LIBS="$Z_LDFLAGS $Z_LIBS $LIBS"
OCTAVE_CHECK_LIBRARY(curl, cURL,
  [cURL library not found.  The ftp objects, urlread and urlwrite functions will be disabled.],
  [curl/curl.h], [curl_easy_escape])
LIBS="$save_LIBS"
CPPFLAGS="$save_CPPFLAGS"

### Check for either of Graphics/ImageMagick++ libraries

AC_ARG_WITH([magick],
  [AS_HELP_STRING([--with-magick=LIB],
    [select library to use for image I/O (options: GraphicsMagick(default) or ImageMagick)])], [
  magick="$withval"], [
  magick="GraphicsMagick"])

warn_magick="$magick++ library not found.  The imread function for reading image files will not be fully functional."

MAGICK_CPPFLAGS=
MAGICK_LDFLAGS=
MAGICK_LIBS=

PKG_CHECK_EXISTS([$magick++], [
  ## Make sure we only get -I, -L and -l flags.  Some Graphics/ImageMagick++
  ## packages adds extra flags that are useful when building
  ## Graphics/ImageMagick++ extentions.  These extra flags break the
  ## Octave build. 
  MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++`
  MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++`
  MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++`

  warn_magick="$magick++ library fails tests.  The imread function for reading image files will not be fully functional."

  save_CPPFLAGS="$CPPFLAGS"
  save_LIBS="$LIBS"
  CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS"
  LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS"
  AC_LANG_PUSH(C++)
    AC_CHECK_HEADER([Magick++.h], [
      AC_MSG_CHECKING([for Magick::ColorRGB in Magick++.h])
      AC_PREPROC_IFELSE(
        [AC_LANG_SOURCE(
          [[#include <Magick++.h>]],
          [[Magick::ColorRGB c;]])
        ], [
          AC_MSG_RESULT(yes)
          warn_magick=
        ], [
          AC_MSG_RESULT(no)
        ]
      )
    ])
  AC_LANG_POP(C++)
  CPPFLAGS="$save_CPPFLAGS"
  LIBS="$save_LIBS"
])

if test -z "$warn_magick"; then
  AC_DEFINE(HAVE_MAGICK, 1, [Define to 1 if Graphics/ImageMagick++ is available.])
else
  MAGICK_CPPFLAGS=
  MAGICK_LDFLAGS=
  MAGICK_LIBS=
fi
AC_SUBST(MAGICK_CPPFLAGS)
AC_SUBST(MAGICK_LDFLAGS)
AC_SUBST(MAGICK_LIBS)

### Check for X11 libraries

AC_PATH_X
if test "$have_x" = "yes"; then
  AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you have X11.])

  if test "$x_includes" != "NONE"; then
    X11_INCFLAGS="$x_includes"
  fi
  AC_SUBST(X11_INCFLAGS)

  if test -z $x_libraries; then
    AC_CHECK_LIB(X11, XrmInitialize, [X11_LIBS=-lX11], [X11_LIBS=])
  elif test $x_libraries != "NONE"; then
    AC_CHECK_LIB(X11, XrmInitialize, 
      [X11_LIBS="-L$x_libraries -lX11"], [X11_LIBS=], "-L$x_libraries")
  fi
  AC_SUBST(X11_LIBS)
fi

### Check for the Carbon framework on MacOSX systems
OCTAVE_HAVE_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>], [CGMainDisplayID ()],
  [have_framework_carbon="yes"], [have_framework_carbon="no"])
if test $have_framework_carbon = "yes"; then
  AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1, [Define to 1 if framework CARBON is available.])
  CARBON_LIBS="-Wl,-framework -Wl,Carbon"
  AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to CARBON_LIBS])
  AC_SUBST(CARBON_LIBS)
fi

### Check for list of libraries needed for native graphics renderer.

warn_freetype=""
native_graphics=true

check_opengl=false
AC_ARG_WITH([opengl],
  [AS_HELP_STRING([--without-opengl], [don't use OpenGL libraries, disable native graphics])],
  [if test "x$withval" = xno; then
     warn_opengl="--without-opengl specified.  Native graphics will be disabled."
     OCTAVE_CONFIGURE_WARNING([warn_opengl])
     native_graphics=false
   else
     check_opengl=true
   fi],
  [check_opengl=true])

## Check for OpenGL library
if $check_opengl; then
  OCTAVE_OPENGL
fi

GRAPHICS_LIBS=
GRAPHICS_CFLAGS=

if test -z "$OPENGL_LIBS"; then
  if $check_opengl; then
    warn_fltk_opengl="OpenGL libs (GL and GLU) not found.  Native graphics will be disabled."
    OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
    native_graphics=false
  fi
fi

if test -n "$OPENGL_LIBS"; then
  AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.])

  ## Check for FreeType 2 library

  AC_CHECK_FT2([9.0.3], [AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have FreeType library.])
    XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS"],
    [warn_freetype="FreeType library not found.  Native graphics will be disabled."])

  if test -n "$warn_freetype"; then
    OCTAVE_CONFIGURE_WARNING([warn_freetype])
    native_graphics=false
  fi

  ## Check for fontconfig library

  warn_fontconfig=""
  if test -z "$warn_freetype"; then
    PKG_CHECK_MODULES(FONTCONFIG, [fontconfig], [
      have_fontconfig=yes
      OPENGL_LIBS="$FONTCONFIG_LIBS $OPENGL_LIBS"
      XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FONTCONFIG_CFLAGS"
      AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if fontconfig is present.])], [
      have_fontconfig=no
      warn_fontconfig="Fontconfig library not found.  Native graphics will be disabled."])
  fi

  if test -n "$warn_fontconfig"; then
    OCTAVE_CONFIGURE_WARNING([warn_fontconfig])
    native_graphics=false
  fi

  ## Check for FLTK (www.fltk.org) library

  AC_ARG_WITH([fltk-prefix], [
    AS_HELP_STRING([--with-fltk-prefix=PFX],
      [Prefix where FLTK is installed (optional)])], [
    fltk_prefix="$withval"], [
    fltk_prefix=""])

  AC_ARG_WITH([fltk-exec-prefix], [
    AS_HELP_STRING([--with-fltk-exec-prefix=PFX],
      [Exec prefix where FLTK is installed (optional)])], [
    fltk_exec_prefix="$withval"], [
    fltk_exec_prefix=""])

  if test -n "$fltk_exec_prefix"; then
    fltk_args="$fltk_args --exec-prefix=$fltk_exec_prefix"
    if test "x${FLTK_CONFIG+set}" != xset ; then
      FLTK_CONFIG="$fltk_exec_prefix/bin/fltk-config"
    fi
  fi

  if test -n "$fltk_prefix"; then
    fltk_args="$fltk_args --prefix=$fltk_prefix"
    if test x${FLTK_CONFIG+set} != xset ; then
      FLTK_CONFIG="$fltk_prefix/bin/fltk-config"
    fi
  fi

  AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no])

  warn_fltk_config=""
  warn_fltk_opengl=""

  if test "$FLTK_CONFIG" = "no" ; then
    warn_fltk_config="FLTK config script not found.  Native graphics will be disabled."
    OCTAVE_CONFIGURE_WARNING([warn_fltk_config])
    native_graphics=false
  else
    FLTK_CFLAGS="`$FLTK_CONFIG $fltkconf_args --use-gl --cflags`"
    FLTK_LDFLAGS="`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags`"

    case "$canonical_host_type" in
      *-*-mingw*)
        FLTK_LDFLAGS="`echo $FLTK_LDFLAGS | sed -e 's/-mwindows//g'`"
      ;;
    esac

    AC_MSG_CHECKING([for OpenGL support in FLTK])
    save_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $FLTK_CFLAGS"
    AC_COMPILE_IFELSE(
      [AC_LANG_PROGRAM([[#include <FL/gl.h>]], [[int nothing = 0;]])],
        [
         AC_MSG_RESULT([no])
         warn_fltk_opengl="FLTK does not have OpenGL support.  Native graphics will be disabled."
        ],[
         AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.])
         AC_MSG_RESULT([yes])
        ])
         
    if test -z "$warn_fltk_opengl"; then
      GRAPHICS_CFLAGS="$FLTK_CFLAGS"
      GRAPHICS_LIBS="$FLTK_LDFLAGS"
    else
      OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl])
      native_graphics=false
    fi
    CFLAGS="$save_CFLAGS"
  fi
fi

AC_SUBST(GRAPHICS_CFLAGS)
AC_SUBST(GRAPHICS_LIBS)

### Start determination of shared vs. static libraries

OCTAVE_PROG_AR

ifdef([LT_INIT], [], [
  errprint([error: you must have libtool 2.2.2 or a more recent version
])
  m4exit([1])])

LT_PREREQ([2.2.2])
LT_INIT([disable-static dlopen win32-dll])

if test x$enable_shared = xyes; then
  SHARED_LIBS=true
else
  SHARED_LIBS=false
fi

if test x$enable_static = xyes; then
  STATIC_LIBS=true
else
  STATIC_LIBS=false
fi

XTRA_CRUFT_SH_LDFLAGS=
if test "$have_msvc" = "yes"; then
  FLIBS="$FLIBS -lkernel32"
  XTRA_CRUFT_SH_LDFLAGS="-Wl,-def:cruft.def"
fi
AC_SUBST(XTRA_CRUFT_SH_LDFLAGS)

### Check for BLAS and LAPACK libraries:

## Need to adjust FFLAGS to include correct integer size.
save_FFLAGS="$FFLAGS"
FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"

AX_BLAS_WITH_F77_FUNC([:], [:])
AX_LAPACK([:], [:])

## Restore FFLAGS.
FFLAGS="$save_FFLAGS"

## Try again with -ff2c in FFLAGS
if test "x$ax_blas_f77_func_ok" = "xno"; then
  save_FFLAGS="$FFLAGS"
  FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG"

  AX_BLAS_WITH_F77_FUNC([:], [:])
  AX_LAPACK([:], [:])

  ## Restore FFLAGS, with -ff2c if that was helpful

  if test "x$ax_blas_f77_func_ok" = "xno"; then
    FFLAGS="$save_FFLAGS"
  else
    FFLAGS="-ff2c $save_FFLAGS"
  fi
fi

## On OSX, try again with a wrapper library (without -ff2c!)
if test "x$ax_blas_f77_func_ok" = "xno"; then
  case "$canonical_host_type" in
    *-*-darwin*)
      ## test if wrapper functions help
      octave_blaswrap_save_CFLAGS="$CFLAGS"
      CFLAGS="$CFLAGS -DUSE_BLASWRAP"
      AC_LANG_PUSH(C)
      AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include "libcruft/misc/blaswrap.c"
])],
       [mv conftest.$ac_objext blaswrap.$ac_objext
        octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS"
        BLAS_LIBS="blaswrap.$ac_objext -framework vecLib"

        save_FFLAGS="$FFLAGS"
        FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"

        AX_BLAS_WITH_F77_FUNC([:], [:])
        AX_LAPACK([:], [:])

        ## Restore FFLAGS.
        FFLAGS="$save_FFLAGS"

        ## remove temp file
        rm -f blaswrap.$ac_objext],
       [AC_MSG_FAILURE([cannot compile libcruft/misc/blaswrap.c])])
      AC_LANG_POP(C)
      CFLAGS="$octave_blaswrap_save_CFLAGS"

      if test "x$ax_blas_f77_func_ok" = "xno"; then
        BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS"
      else
        ## wrapper in libcruft, remove from BLAS_LIBS
        BLAS_LIBS="`echo $BLAS_LIBS | sed -e 's/blaswrap.[[^ ]]* //g'`"
        AC_DEFINE(USE_BLASWRAP, 1, [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).])
      fi
    ;;
  esac
fi

if test "x$ax_blas_f77_func_ok" = "xno"; then
  if $USE_64_BIT_IDX_T && test "$ax_blas_integer_size_ok" = "no" ; then
    ## Attempt to be more informative.
    AC_MSG_ERROR([BLAS doesn't seem to support 64-bit integers.  This is incompatible with --enable-64.])
  else
    AC_MSG_ERROR([A BLAS library was detected but found incompatible with your Fortran 77 compiler settings.])
  fi
fi

if test x$ax_blas_ok = xno || test x$ax_lapack_ok = xno; then
  AC_MSG_ERROR([BLAS and LAPACK libraries are required])
fi

### Check for the qrupdate library

## No need to adjust FFLAGS because only link is attempted. 
## Must supply proper LIBS, however.
save_LIBS="$LIBS"
LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
OCTAVE_CHECK_LIBRARY(qrupdate, qrupdate,
  [qrupdate not found.  The QR & Cholesky updating functions will be slow.],
  [],
  [sqr1up],
  [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions])

if test "$octave_qrupdate_ok" = yes; then
  LIBS="$LIBS $QRUPDATE_LIBS"
  AC_LANG_PUSH([Fortran 77])
  AC_MSG_CHECKING([for slup1up in $QRUPDATE_LIBS])
  octave_qrupdate_luu=no
  AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])],
  [octave_qrupdate_luu=yes])
  AC_MSG_RESULT([$octave_qrupdate_luu])
  if test "$octave_qrupdate_luu" = yes; then
    AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.])
  fi
  AC_LANG_POP([Fortran 77])
fi
LIBS="$save_LIBS"

### Check for AMD library

OCTAVE_CHECK_LIBRARY(amd, AMD,
  [AMD library not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h],
  [amd_postorder],
  [], [don't use AMD library, disable some sparse matrix functionality])

### Check for CAMD library

OCTAVE_CHECK_LIBRARY(camd, CAMD,
  [CAMD library not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/camd.h ufsparse/camd.h amd/camd.h camd.h],
  [camd_postorder],
  [], [don't use CAMD library, disable some sparse matrix functionality])

### Check for COLAMD library

OCTAVE_CHECK_LIBRARY(colamd, COLAMD,
  [COLAMD library not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/colamd.h ufsparse/colamd.h amd/colamd.h colamd.h],
  [colamd],
  [], [don't use COLAMD library, disable some sparse matrix functionality])

### Check for CCOLAMD library

OCTAVE_CHECK_LIBRARY(ccolamd, CCOLAMD,
  [CCOLAMD library not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/ccolamd.h ufsparse/ccolamd.h amd/ccolamd.h ccolamd.h],
  [ccolamd],
  [], [don't use CCOLAMD library, disable some sparse matrix functionality])

### Check for CHOLMOD library.  If your cholmod library requires cblas,
### then you will need to configure with --with-cholmod="-lcholmod -lcblas".

save_LIBS="$LIBS"
LIBS="$COLAMD_LDFLAGS $COLAMD_LIBS $AMD_LDFLAGS $AMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
OCTAVE_CHECK_LIBRARY(cholmod, CHOLMOD,
  [CHOLMOD library not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h],
  [cholmod_start],
  [], [don't use CHOLMOD library, disable some sparse matrix functionality])
LIBS="$save_LIBS"

### Check for CXSparse library

OCTAVE_CHECK_LIBRARY(cxsparse, CXSparse,
  [CXSparse library not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/cs.h ufsparse/cs.h amd/cs.h cs.h],
  [cs_di_sqr],
  [C++], [don't use CXSparse library, disable some sparse matrix functionality])

### Check for UMFPACK library.

save_LIBS="$LIBS"
save_CPPFLAGS="$CPPFLAGS"
LIBS="$AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
CPPFLAGS="$AMD_CPPFLAGS $CPPFLAGS"
OCTAVE_CHECK_LIBRARY(umfpack, UMFPACK,
  [UMFPACK not found.  This will result in some lack of functionality for sparse matrices.],
  [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
  [umfpack_zi_get_determinant],
  [], [don't use UMFPACK, disable some sparse matrix functionality])
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"

if test -z "$UMFPACK_LIBS"; then
  ## Invalidate the cache and try again with -lcblas.
  $as_unset ac_cv_lib_umfpack_umfpack_zi_get_determinant
  save_LIBS="$LIBS"
  LIBS="-lcblas $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
  OCTAVE_CHECK_LIBRARY(umfpack, UMFPACK,
    [UMFPACK not found.  This will result in some lack of functionality for sparse matrices.],
    [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h],
    [umfpack_zi_get_determinant],
    [], [don't use UMFPACK, disable some sparse matrix functionality])
  if test -n "$UMFPACK_LIBS"; then
    UMFPACK_LIBS="$UMFPACK_LIBS -lcblas"
  fi
  LIBS="$save_LIBS"
fi

if test -n "$UMFPACK_LIBS"; then
  save_LIBS="$LIBS";
  LIBS="$UMFPACK_LIBS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS"
  OCTAVE_UMFPACK_SEPERATE_SPLIT
  LIBS="$save_LIBS"
fi

### Check for ARPACK library.

save_LIBS="$LIBS"
LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS"
OCTAVE_CHECK_LIBRARY(arpack, ARPACK,
  [ARPACK not found.  The eigs function will be disabled.],
  [],
  [dseupd],
  [Fortran 77], [don't use the ARPACK library, disable eigs function],
  [warn_arpack=
   OCTAVE_CHECK_ARPACK_OK([
     AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])], [
     warn_arpack="ARPACK library found, but does not seem to work properly -- disabling eigs function"])])
LIBS="$save_LIBS"

### Check for readline library.

OCTAVE_ENABLE_READLINE

### Enable dynamic linking.  --enable-shared implies this, so
### --enable-dl is only need if you are only building static libraries
### and want to try dynamic linking too (works on some systems, for
### example, OS X and Windows).

AC_ARG_ENABLE([dl],
  [AS_HELP_STRING([--enable-dl],
    [allow loading of dynamically linked modules (not all systems)])], [
  case "${enableval}" in
    yes) ENABLE_DYNAMIC_LINKING=true ;;
    no) ENABLE_DYNAMIC_LINKING=false ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-dl]) ;;
  esac], [ENABLE_DYNAMIC_LINKING=true])

if $STATIC_LIBS || $SHARED_LIBS; then
  true
else
  AC_MSG_ERROR([You can't disable building static AND shared libraries!])
fi

CPICFLAG=-fPIC
CXXPICFLAG=-fPIC
FPICFLAG=-fPIC
SHLEXT=so
SHLLIB='$(SHLEXT)'
SHLBIN=
SHLEXT_VER='$(SHLEXT).$(version)'
SHLLIB_VER='$(SHLLIB).$(version)'
SHLBIN_VER='$(SHLBIN).$(version)'
SHLLINKEXT=
LIBPRE=lib
SHLPRE=lib
SHLLIBPRE=lib
SHLBINPRE=lib
SH_LD='$(CXX)'
SH_LDFLAGS=-shared
DL_LD='$(SH_LD)'
DL_LDFLAGS='$(SH_LDFLAGS)'
MKOCTFILE_DL_LDFLAGS='$(DL_LDFLAGS)'
SONAME_FLAGS=
NO_OCT_FILE_STRIP=false
TEMPLATE_AR='$(AR)'
TEMPLATE_ARFLAGS="$ARFLAGS"
CRUFT_DLL_DEFS=
OCTAVE_DLL_DEFS=
OCTINTERP_DLL_DEFS=
OCTGRAPHICS_DLL_DEFS=
library_path_var=LD_LIBRARY_PATH
ldpreloadsep=" "
BUILD_COMPILED_AUX_PROGRAMS=false
case "$canonical_host_type" in
  *-*-386bsd* | *-*-netbsd*)
    SH_LD=ld
    SH_LDFLAGS=-Bshareable
  ;;
  *-*-openbsd*)
    SH_LDFLAGS='-shared -fPIC'
  ;;
  *-*-freebsd*)
    SH_LDFLAGS="-shared -Wl,-x"
  ;;
  alpha*-dec-osf*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'"
  ;;
  *-*-darwin*)
    DL_LDFLAGS='-bundle -bundle_loader $(top_builddir)/src/octave $(LDFLAGS)'
    MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader $$BINDIR/octave-$$OCTAVE_VERSION$$EXEEXT'
    SH_LDFLAGS='-dynamiclib -single_module $(LDFLAGS)'
    case "$canonical_host_type" in
      powerpc-*)
        CXXPICFLAG=
        CPICFLAG=
        FPICFLAG=
      ;;
    esac
    SHLEXT=dylib 
    SHLLIB='$(SHLEXT)'
    SHLEXT_VER='$(version).$(SHLEXT)'
    SHLLIB_VER='$(version).$(SHLLIB)'
    NO_OCT_FILE_STRIP=true
    SONAME_FLAGS='-install_name $(octlibdir)/$@'
    library_path_var=DYLD_LIBRARY_PATH  
  ;;
  *-*-cygwin*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    LIBPRE=lib
    SHLPRE=cyg
    SHLBINPRE=cyg
    SHLEXT=dll
    SHLLIB=dll.a
    SHLBIN=dll    
    DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
    SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
    SONAME_FLAGS='-Wl,--out-implib=$(patsubst $(SHLPRE)%,$(LIBPRE)%,$@).a'
    ldpreloadsep=":"
  ;;
  *-*-mingw*)
    BUILD_COMPILED_AUX_PROGRAMS=true
    if test "$have_msvc" = "yes"; then
      DL_LDFLAGS="-shared"
      CPICFLAG=
      CXXPICFLAG=
      FPICFLAG=
      SHLEXT=dll
      SHLLIB=lib
      SHLBIN=dll
      LIBPRE=
      SHLPRE=
      SHLLIBPRE=
      SHLBINPRE=
      SH_LDFLAGS="-shared"
      if test -n "`echo $CFLAGS | grep -e '-g'`" -o -n "`echo $CXXFLAGS | grep -e '-g'`"; then
        DL_LDFLAGS="$DL_LDFLAGS -g"
        SH_LDFLAGS="$SH_LDFLAGS -g"
      fi
      NO_OCT_FILE_STRIP=true
      library_path_var=PATH
      NO_OCT_FILE_STRIP=true
      ## Extra compilation flags.
      CRUFT_DLL_DEFS="-DCRUFT_DLL"
      OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
      OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL"
      OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
    else
      CPICFLAG=
      CXXPICFLAG=
      FPICFLAG=
      SHLEXT=dll
      SHLLIB=dll.a
      SHLBIN=dll
      DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
      SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
      SONAME_FLAGS='-Wl,--out-implib=$@.a'
      library_path_var=PATH
    fi
  ;;

  *-*-msdosmsvc)
    BUILD_COMPILED_AUX_PROGRAMS=true
    DL_LDFLAGS="-shared"
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    SHLEXT=dll
    SHLLIB=lib
    SHLBIN=dll
    LIBPRE=
    SHLPRE=
    SHLLIBPRE=
    SHLBINPRE=
    SH_LDFLAGS="-shared"
    if test -n "`echo $CFLAGS | grep -e '-g'`" -o -n "`echo $CXXFLAGS | grep -e '-g'`"; then
      DL_LDFLAGS="$DL_LDFLAGS -g"
      SH_LDFLAGS="$SH_LDFLAGS -g"
    fi
    NO_OCT_FILE_STRIP=true
    library_path_var=PATH
    NO_OCT_FILE_STRIP=true
    ## Extra compilation flags.
    CRUFT_DLL_DEFS="-DCRUFT_DLL"
    OCTAVE_DLL_DEFS="-DOCTAVE_DLL"
    OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL"
    OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL"
  ;;
  *-*-linux* | *-*-gnu*)
    MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic"
    SONAME_FLAGS='-Wl,-soname -Wl,$@'
  ;;
  i[[3456]]86-*-sco3.2v5*)
    SONAME_FLAGS='-Wl,-h -Wl,$@'
    SH_LDFLAGS=-G
  ;;
  rs6000-ibm-aix* | powerpc-ibm-aix*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    library_path_var=LIBPATH
  ;;
  hppa*-hp-hpux*)
    if test "$ac_cv_f77_compiler_gnu" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=+Z
    fi
    SHLEXT=sl
    SH_LDFLAGS="-shared -fPIC"
    library_path_var=SHLIB_PATH
  ;;
  ia64*-hp-hpux*)
    if test "$ac_cv_f77_compiler_gnu" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=+Z
    fi
    SH_LDFLAGS="-shared -fPIC"
  ;;
  *-sgi-*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
  ;;
  sparc-sun-sunos4*)
    if test "$ac_cv_f77_compiler_gnu" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=-PIC
    fi
    SH_LD=ld
    SH_LDFLAGS="-assert nodefinitions"
  ;;
  sparc-sun-solaris2* | i386-pc-solaris2*)
    if test "$ac_cv_f77_compiler_gnu" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=-KPIC
    fi
    if test "$GCC" = yes; then
      CPICFLAG=-fPIC
    else
      CPICFLAG=-KPIC
    fi
    if test "$GXX" = yes; then
      CXXPICFLAG=-fPIC
      SH_LDFLAGS=-shared
    else
      CXXPICFLAG=-KPIC
      SH_LDFLAGS=-G
    fi
    ## Template closures in archive libraries need a different mechanism.
    if test "$GXX" = yes; then
      true
    else
      TEMPLATE_AR='$(CXX)'
      TEMPLATE_ARFLAGS="-xar -o"
    fi
  ;;
esac

AM_CONDITIONAL([AMCOND_BUILD_COMPILED_AUX_PROGRAMS],
  [test x$BUILD_COMPILED_AUX_PROGRAMS = xtrue])

AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG])
AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG])
AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG])
AC_MSG_NOTICE([defining SHLEXT to be $SHLEXT])
AC_MSG_NOTICE([defining SHLLIB to be $SHLLIB])
AC_MSG_NOTICE([defining SHLBIN to be $SHLBIN])
AC_MSG_NOTICE([defining SHLEXT_VER to be $SHLEXT_VER])
AC_MSG_NOTICE([defining SHLLIB_VER to be $SHLLIB_VER])
AC_MSG_NOTICE([defining SHLBIN_VER to be $SHLBIN_VER])
AC_MSG_NOTICE([defining SHLLINKEXT to be $SHLLINKEXT])
AC_MSG_NOTICE([defining LIBPRE to be $LIBPRE])
AC_MSG_NOTICE([defining SHLPRE to be $SHLPRE])
AC_MSG_NOTICE([defining SHLLIBPRE to be $SHLLIBPRE])
AC_MSG_NOTICE([defining SHLBINPRE to be $SHLBINPRE])
AC_MSG_NOTICE([defining SH_LD to be $SH_LD])
AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS])
AC_MSG_NOTICE([defining DL_LD to be $DL_LD])
AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS])
AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS])
AC_MSG_NOTICE([defining SONAME_FLAGS to be $SONAME_FLAGS])
AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP])
AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR])
AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS])
AC_MSG_NOTICE([defining CRUFT_DLL_DEFS to be $CRUFT_DLL_DEFS])
AC_MSG_NOTICE([defining OCTAVE_DLL_DEFS to be $OCTAVE_DLL_DEFS])
AC_MSG_NOTICE([defining OCTINTERP_DLL_DEFS to be $OCTINTERP_DLL_DEFS])
AC_MSG_NOTICE([defining OCTGRAPHICS_DLL_DEFS to be $OCTGRAPHICS_DLL_DEFS])
AC_MSG_NOTICE([defining library_path_var to be $library_path_var])
AC_SUBST(FPICFLAG)
AC_SUBST(CPICFLAG)
AC_SUBST(CXXPICFLAG)
AC_SUBST(SHLEXT)
AC_SUBST(SHLLIB)
AC_SUBST(SHLBIN)
AC_SUBST(SHLEXT_VER)
AC_SUBST(SHLLIB_VER)
AC_SUBST(SHLBIN_VER)
AC_SUBST(SHLLINKEXT)
AC_SUBST(LIBPRE)
AC_SUBST(SHLPRE)
AC_SUBST(SHLLIBPRE)
AC_SUBST(SHLBINPRE)
AC_SUBST(SH_LD)
AC_SUBST(SH_LDFLAGS)
AC_SUBST(DL_LD)
AC_SUBST(DL_LDFLAGS)
AC_SUBST(MKOCTFILE_DL_LDFLAGS)
AC_SUBST(SONAME_FLAGS)
AC_SUBST(NO_OCT_FILE_STRIP)
AC_SUBST(TEMPLATE_AR)
AC_SUBST(TEMPLATE_ARFLAGS)
AC_SUBST(CRUFT_DLL_DEFS)
AC_SUBST(OCTAVE_DLL_DEFS)
AC_SUBST(OCTINTERP_DLL_DEFS)
AC_SUBST(OCTGRAPHICS_DLL_DEFS)
AC_SUBST(library_path_var)
AC_SUBST(ldpreloadsep)

### special checks for odd OS specific things.

AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)])

case "$canonical_host_type" in
  *-*-mingw*)
    if test "$have_msvc" = "yes"; then
      AC_CHECK_LIB(dirent, opendir)
      LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
    else
      LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
    fi
    LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
  ;;
  *-*-msdosmsvc*)
    AC_CHECK_LIB(dirent, opendir)
    LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
  ;;
esac

AC_ARG_ENABLE([no-undefined],
  [AS_HELP_STRING([--enable-no-undefined],
    [pass -no-undefined to libtool when linking Octave and its shared libraries (on by default)])],
  [case "${enableval}" in
    yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;;
    no)  NO_UNDEFINED_LDFLAG="" ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-link-all-depenencies]) ;;
   esac], [NO_UNDEFINED_LDFLAG="-no-undefined"])
AC_SUBST(NO_UNDEFINED_LDFLAG)

AC_ARG_ENABLE([link-all-dependencies],
  [AS_HELP_STRING([--enable-link-all-dependencies],
    [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])],
  [case "${enableval}" in
    yes) link_all_deps=true ;;
    no)  link_all_deps=false ;;
    *) AC_MSG_ERROR([bad value ${enableval} for --enable-link-all-depenencies]) ;;
   esac], [link_all_deps=false])
AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test x$link_all_deps = xtrue])

### Type stuff.

AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPES([dev_t, ino_t])
AC_CHECK_TYPES([long long int, unsigned long long int])

### How big are ints and how are they oriented?  These could probably
### be eliminated in favor of run-time checks.

AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)

### Does the C compiler handle alloca() and const correctly?

AC_FUNC_ALLOCA

### See if we should use placement delete.

OCTAVE_PLACEMENT_DELETE

### See if we can auto allocate variable sized arrays.

OCTAVE_DYNAMIC_AUTO_ARRAYS

### See if we can use fast integer arithmetics

OCTAVE_FAST_INT_OPS

### Check for long double type (for 64-bit integers)

AC_CHECK_SIZEOF(long double)

### Checks for header files.

AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT

### C headers

AC_CHECK_HEADERS(curses.h direct.h dlfcn.h floatingpoint.h grp.h \
  ieeefp.h inttypes.h locale.h memory.h ncurses.h poll.h pthread.h \
  pwd.h sunmath.h sys/ioctl.h sys/param.h sys/poll.h sys/resource.h \
  sys/select.h sys/utsname.h termcap.h)

### C++ headers

AC_LANG_PUSH(C++)
AC_CHECK_HEADERS(sstream)
AC_CHECK_HEADERS([unordered_map], [], [
  AC_CHECK_HEADERS([tr1/unordered_map])])
AC_MSG_CHECKING([whether unordered_map requires tr1 namespace])
unordered_map_requires_tr1_namespace=no
if test "$ac_cv_header_unordered_map" = "yes"; then
  ## Have <unordered_map>, but still have to check whether
  ## tr1 namespace is required (like MSVC, for instance).
  AC_COMPILE_IFELSE([
    AC_LANG_PROGRAM([
      #include <unordered_map>
    ], [
      std::unordered_map<int,int> m;
    ])], [], [unordered_map_requires_tr1_namespace=yes])
elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then
  unordered_map_requires_tr1_namespace=yes
fi
if test "$unordered_map_requires_tr1_namespace" = "yes"; then
  AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.])
fi
AC_MSG_RESULT([$unordered_map_requires_tr1_namespace])
AC_LANG_POP(C++)

have_termios_h=no
AC_CHECK_HEADERS(termios.h, have_termios_h=yes)
AC_CHECK_HEADERS(termio.h, have_termio_h=yes, have_termio_h=no)
AC_CHECK_HEADERS(sgtty.h, have_sgtty_h=yes, have_sgtty_h=no)
AC_CHECK_HEADERS(fnmatch.h, have_fnmatch_h=yes, have_fnmatch_h=no)
AC_CHECK_HEADERS(conio.h, have_conio_h=yes, have_conio_h=no)

if test "$have_termios_h" = yes \
    || test "$have_termio_h" = yes \
    || test "$have_sgtty_h" = yes; then
  true
else
  AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!])
fi

### For MSVC compilers, avoid #define of min/max from windows.h header
if test "$have_msvc" = "yes"; then
  AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.])
fi

### Checks for functions and variables.

AC_CHECK_FUNCS(basename canonicalize_file_name \
  chmod dup2 endgrent endpwent execvp expm1 expm1f fork \
  getegid geteuid getgid getgrent getgrgid getgrnam getpgrp getpid \
  getppid getpwent getpwuid getuid getwd _kbhit kill \
  lgamma lgammaf lgamma_r lgammaf_r localtime_r log1p log1pf \
  mkstemp pipe putenv \
  realpath resolvepath rindex roundl select setgrent setlocale \
  setpwent setvbuf siglongjmp \
  strsignal tempnam tgammaf umask \
  uname utime waitpid \
  _chmod x_utime _utime32)

AC_LANG_PUSH(C++)
AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]])
AC_CHECK_FUNCS([exp2 round tgamma])
AH_VERBATIM([Z_FUNCS_AND_DECLS], [
#if defined (__cplusplus)
extern "C" {
#endif
#if HAVE_EXP2 && ! HAVE_DECL_EXP2
double exp2 (double );
#endif
#if HAVE_ROUND && ! HAVE_DECL_ROUND
double round (double);
#endif
#if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA
double tgamma (double);
#endif
#if defined (__cplusplus)
}
#endif
])
AC_LANG_POP(C++)

case "$canonical_host_type" in
  *-*-mingw*)
    ## MinGW does not provide a mkstemp function.  However, it provides
    ## the mkstemps function in libiberty.
    AC_MSG_CHECKING([for mkstemps in libiberty])
    save_LIBS="$LIBS"
    LIBS="-liberty $LIBS"
    AC_LINK_IFELSE([
      AC_LANG_PROGRAM([[int mkstemps (char *pattern, int suffix_len);]], 
       [[mkstemps ("XXXXXX", 0);]]
    )],
    [AC_MSG_RESULT(yes)
     HAVE_MKSTEMPS=yes
     AC_DEFINE(HAVE_MKSTEMPS, 1, [Define to 1 if mkstemps is available in libiberty.])
    ],
    [AC_MSG_RESULT(no)
     HAVE_MKSTEMPS=no
     LIBS="$save_LIBS"
    ])
   ;;
esac

OCTAVE_SMART_PUTENV

case "$canonical_host_type" in
  *-*-msdosmsvc | *-*-mingw*)
    AC_MSG_CHECKING([for required _WIN32_WINNT])
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <windows.h>
#if _WIN32_WINNT < 0x0403
#error "Wrong version"
#endif]], [])],
      AC_MSG_RESULT([none]), [
        AC_DEFINE(_WIN32_WINNT, 0x0403, [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.])
        AC_MSG_RESULT([0x0403])])
    AC_MSG_CHECKING([whether _USE_MATH_DEFINES needs to be defined])
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
[[int x = M_LN2;]])],
      AC_MSG_RESULT([no]), [
        AC_DEFINE(_USE_MATH_DEFINES, 1, [Define to 1 if your system needs to define math constants like M_LN2.])
        AC_MSG_RESULT([yes])])
  ;;
esac

## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon
OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL

### Dynamic linking is now enabled only if we are building shared
### libs and some API for dynamic linking is detected.

## FIXME: A lot of the following duplicates the functionality of
## code generated by the dlopen option for LT_INIT.

LD_CXX='$(CXX)'
RDYNAMIC_FLAG=
DL_API_MSG=""
dlopen_api=false
shl_load_api=false
loadlibrary_api=false
dyld_api=false

if $SHARED_LIBS || $ENABLE_DYNAMIC_LINKING; then

  case "$lt_cv_dlopen" in
    dlopen)
      dlopen_api=true
      DL_API_MSG="(dlopen)"
      AC_DEFINE(HAVE_DLOPEN_API, 1, [Define to 1 if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.])
      OCTAVE_CXX_FLAG(-rdynamic, [RDYNAMIC_FLAG=-rdynamic])
    ;;
    shl_load)
      shl_load_api=true
      DL_API_MSG="(shl_load)"
      AC_DEFINE(HAVE_SHL_LOAD_API, 1, [Define to 1 if your system has shl_load and shl_findsym for dynamic linking.])
    ;;
    LoadLibrary)
      loadlibrary_api=true
      DL_API_MSG="(LoadLibrary)"
      AC_DEFINE(HAVE_LOADLIBRARY_API, 1, [Define to 1 if your system has LoadLibrary for dynamic linking.])
    ;;
    dyld)
      dyld_api=true
      DL_API_MSG="(dyld)"
      AC_DEFINE(HAVE_DYLD_API, 1, [Define to 1 if your system has dyld for dynamic linking.])
    ;;
  esac

  DL_LIBS="$lt_cv_dlopen_libs"
  AC_SUBST(DL_LIBS)

  ## Disable dynamic linking if capability is not present.
  if $dlopen_api || $shl_load_api || $loadlibrary_api || $dyld_api; then
    true
  else
    ENABLE_DYNAMIC_LINKING=false
  fi
fi

if $ENABLE_DYNAMIC_LINKING; then
  AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define to 1 if using dynamic linking.])
fi

AM_CONDITIONAL([AMCOND_ENABLE_DYNAMIC_LINKING],
  [test x$ENABLE_DYNAMIC_LINKING = xtrue])

if $SHARED_LIBS; then
   LIBOCTINTERP=-loctinterp$SHLLINKEXT
   LIBOCTAVE=-loctave$SHLLINKEXT
   LIBCRUFT=-lcruft$SHLLINKEXT
else
  LIBOCTINTERP='$(top_builddir)/src/liboctinterp.$(LIBEXT)'
  LIBOCTAVE='$(top_builddir)/liboctave/liboctave.$(LIBEXT)'
  LIBCRUFT='$(top_builddir)/libcruft/libcruft.$(LIBEXT)'
fi

AC_SUBST(LD_CXX)
AC_SUBST(RDYNAMIC_FLAG)
AC_SUBST(ENABLE_DYNAMIC_LINKING)
AC_SUBST(LIBOCTINTERP)
AC_SUBST(LIBOCTAVE)
AC_SUBST(LIBCRUFT)

dnl Maybe <cmath> defines the IEEE functions we need.

OCTAVE_CMATH_FUNC(isnan)
OCTAVE_CMATH_FUNC(isinf)
OCTAVE_CMATH_FUNC(isfinite)

dnl Would like to get rid of this cruft, and just have
dnl
dnl   AC_CHECK_FUNCS(finite isnan isinf)
dnl
dnl instead, but that used to fail on some systems...
dnl
dnl Also just using AC_CHECK_FUNCS doesn't seem to work to find isinf
dnl and isnan on Linux systems, so we use AC_CHECK_FUNC, and if that
dnl fails, we try again by including math.h and invoking the function
dnl with an argument. 

### I am told that Inf and NaN don't work on m68k HP sytems.

case "$canonical_host_type" in
  m68k-hp-hpux*)
  ;;
  *)
    AC_CHECK_FUNCS(finite isnan isinf signbit)
    AC_CHECK_FUNCS(_finite _isnan)
    AC_CHECK_DECLS(signbit, , , [#include <math.h>])
  ;;
esac

### Check for nonstandard but common math functions that we need.

AC_CHECK_FUNCS(acosh acoshf asinh asinhf atanh atanhf erf erff erfc erfcf exp2f log2 log2f)
AC_CHECK_FUNCS(hypotf _hypotf cbrt cbrtf)

### Checks for OS specific cruft.

AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])

AC_STRUCT_TIMEZONE
AC_FUNC_CLOSEDIR_VOID

AC_CHECK_MEMBERS(struct group.gr_passwd)

octave_found_termlib=no
for termlib in ncurses curses termcap terminfo termlib; do
  AC_CHECK_LIB(${termlib}, tputs, [
    TERM_LIBS="-l${termlib}"
    octave_found_termlib=yes
    break])
done

if test "$octave_found_termlib" = no; then
  warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, o\
r -ltermlib!"
  AC_MSG_WARN([$warn_termlibs])
fi
AC_SUBST(TERM_LIBS)

### Return type of matherr() 
AC_MSG_CHECKING([for struct exception in math.h])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
  [[struct exception *x; x->type; x->name;]])],
  [AC_MSG_RESULT(yes)
   AC_DEFINE(EXCEPTION_IN_MATH, 1,
     [Define to 1 if your math.h declares struct exception for matherr().])],
  [AC_MSG_RESULT(no)])

### Signal stuff.

AC_CHECK_DECLS([sys_siglist], [], [],
[#include <signal.h>
/* NetBSD declares sys_siglist in unistd.h.  */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
])

### A system dependent kludge or two.

AC_CHECK_FUNCS(getrusage)
case "$canonical_host_type" in
  *-*-cygwin*)
    AC_DEFINE(RUSAGE_TIMES_ONLY, 1, [Define to 1 if your struct rusage only has time information.])
  ;;
esac

### Checks for other programs used in building, testing, installing, and
### running Octave.

AC_PROG_AWK
OCTAVE_PROG_FIND
OCTAVE_PROG_SED
OCTAVE_PROG_PERL
OCTAVE_PROG_PYTHON

OCTAVE_PROG_FLEX
AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_])

OCTAVE_PROG_BISON

AC_PROG_LN_S

AC_PROG_INSTALL
INSTALL_SCRIPT='${INSTALL}'
AC_SUBST(INSTALL_SCRIPT)

OCTAVE_PROG_DESKTOP_FILE_INSTALL

OCTAVE_PROG_GNUPLOT
OCTAVE_PROG_PAGER
OCTAVE_PROG_GPERF

OCTAVE_PROG_GHOSTSCRIPT
OCTAVE_PROG_TEXI2DVI
OCTAVE_PROG_TEXI2PDF

### Need to disable building documentation if gnuplot was not found,
### unless it was already disabled previously.

if test -n "$DOCDIR" && test -n "$warn_gnuplot"; then
  DOCDIR=
  warn_docs="building documentation disabled because gnuplot was not found; make dist will fail"
  OCTAVE_CONFIGURE_WARNING([warn_docs])
fi
AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"])

### Even though we include config.h, we need to have the preprocessor
### defines available in a variable for the testif feature of the
### scripts/testfun/test.m function.  Use UGLY_DEFS to hold all the -D
### options.  These are ultimately placed in the DEFS field of the
### struct returned by octave_config_info, which is used by test.m.

AC_OUTPUT_MAKE_DEFS

### We have to insert extra levels of backslash quoting here so that
### the right thing ends up in oct-conf.h.
UGLY_DEFS=`echo $DEFS | $SED 's,\\",\\\\\\\\\\\\\\\\\\",g'`
AC_MSG_NOTICE([defining UGLY_DEFS to be $UGLY_DEFS])
AC_SUBST(UGLY_DEFS)

### Maybe add -Wall, -W, and -Wshadow to compiler flags now that we're
### done feature testing. 

GCC_EXTRA_FLAGS="-Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual"

GXX_EXTRA_FLAGS="-Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual"

try_extra_warning_flags=true

AC_ARG_ENABLE(extra-warning-flags,
  [AS_HELP_STRING([--enable-extra-warning-flags],
     [add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS  (on by default, but only if the compiler appears to accept them)])],
  [if test "$enableval" = no; then
     try_extra_warning_flags=false
   fi], [])

if $try_extra_warning_flags; then
  for flag in $GCC_EXTRA_FLAGS; do
    OCTAVE_CC_FLAG($flag, [
      WARN_CFLAGS="$WARN_CFLAGS $flag";
      AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
  done
  for flag in $GXX_EXTRA_FLAGS; do
    OCTAVE_CXX_FLAG($flag, [
      WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
      AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
  done
fi

GCC_STRICT_FLAGS="-Wconversion"

GXX_STRICT_FLAGS="-Wconversion -Weffc++"

try_strict_warning_flags=false

AC_ARG_ENABLE(strict-warning-flags,
  [AS_HELP_STRING([--enable-strict-warning-flags],
     [add extra strict warning options to CFLAGS and CXXFLAGS (off by default)])],
  [if test "$enableval" = yes; then
     try_strict_warning_flags=true
   fi], [])

if $try_strict_warning_flags; then
  for flag in $GCC_STRICT_FLAGS; do
    OCTAVE_CC_FLAG($flag, [
      WARN_CFLAGS="$WARN_CFLAGS $flag";
      AC_MSG_RESULT([adding $flag to WARN_CFLAGS])])
  done
  for flag in $GXX_STRICT_FLAGS; do
    OCTAVE_CXX_FLAG($flag, [
      WARN_CXXFLAGS="$WARN_CXXFLAGS $flag";
      AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])])
  done
fi

AC_SUBST(WARN_CFLAGS)
AC_SUBST(WARN_CXXFLAGS)

### GUI/Qt related tests.

AC_CHECK_PROGS(MOC, [moc moc-qt4 moc-qt5])
AC_CHECK_PROGS(UIC, [uic uic-qt4 uic-qt5])
AC_CHECK_PROGS(QMAKE, [qmake qmake-qt4 qmake-qt5])

AC_SUBST(MOC)
AC_SUBST(UIC)

QT_INCDIR=`$QMAKE -query | sed -n -e 's/^QT_INSTALL_HEADERS://p'`
QT_LIBDIR=`$QMAKE -query | sed -n -e 's/^QT_INSTALL_LIBS://p'`

AC_SUBST(QT_INCDIR)
AC_SUBST(QT_LIBDIR)
  
case "$canonical_host_type" in
  *-*-mingw* | *-*-msdosmsvc*) win32_terminal=yes ;;
  *)
    win32_terminal=no
    AC_CHECK_HEADERS([pty.h libutil.h util.h])
    AC_SEARCH_LIBS([openpty], [util], [AC_DEFINE([HAVE_OPENPTY], [], [Define whether openpty exists])])
    ;;
esac
AM_CONDITIONAL([WIN32_TERMINAL], [test x$win32_terminal = xyes])

### Run configure in subdirectories.

export CC
export CXX
export F77

### Some things to add to the bottom of config.h.

AH_BOTTOM([
#if !defined (GNULIB_NAMESPACE)
#define GNULIB_NAMESPACE gnulib
#endif

#if defined (__GNUC__)
#define GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
#define GCC_ATTR_NORETURN __attribute__ ((__noreturn__))
#define GCC_ATTR_UNUSED __attribute__ ((__unused__))
#else
#define GCC_ATTR_DEPRECATED
#define GCC_ATTR_NORETURN
#define GCC_ATTR_UNUSED
#endif

#define X_CAST(T, E) (T) (E)

#if defined (CXX_BROKEN_REINTERPRET_CAST)
#define FCN_PTR_CAST(T, E) (T) (E)
#else
#define FCN_PTR_CAST(T, E) reinterpret_cast<T> (E)
#endif

#if !defined(HAVE_DEV_T)
typedef short dev_t;
#endif

#if !defined(HAVE_INO_T)
typedef unsigned long ino_t;
#endif

#if defined (_MSC_VER)
#define __WIN32__
#define WIN32
/* missing parameters in macros */
#pragma warning (disable: 4003)
/* missing implementations in template instantiation */
#pragma warning (disable: 4996)
/* deprecated function names (FIXME?) */
#pragma warning (disable: 4661)
#endif

#if defined (__WIN32__) && ! defined (__CYGWIN__)
#define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1
#elif defined (__CYGWIN__)
#define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1
#define OCTAVE_HAVE_POSIX_FILESYSTEM 1
#else
#define OCTAVE_HAVE_POSIX_FILESYSTEM 1
#endif

/* Define to 1 if we expect to have <windows.h>, Sleep, etc. */
#if defined (__WIN32__) && ! defined (__CYGWIN__)
#define OCTAVE_USE_WINDOWS_API 1
#endif

#if defined (__APPLE__) && defined (__MACH__)
#define OCTAVE_USE_OS_X_API 1
#endif

/* sigsetjmp is a macro, not a function. */
#if defined (sigsetjmp) && defined (HAVE_SIGLONGJMP)
#define OCTAVE_HAVE_SIG_JUMP
#endif

#if defined (_UNICOS)
#define F77_USES_CRAY_CALLING_CONVENTION
#endif

#if 0
#define F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION
#endif

#ifdef USE_64_BIT_IDX_T
#define SIZEOF_OCTAVE_IDX_TYPE 8
#else
#define SIZEOF_OCTAVE_IDX_TYPE SIZEOF_INT
#endif

/* To be able to use long doubles for 64-bit mixed arithmetics, we need
   them at least 80 bits wide and we need roundl declared in math.h.
   FIXME: Maybe substitute this by a more precise check in the future?  */
#if (SIZEOF_LONG_DOUBLE >= 10) && defined (HAVE_ROUNDL)
#define OCTAVE_INT_USE_LONG_DOUBLE
#endif

#define OCTAVE_EMPTY_CPP_ARG

/* Octave is currently unable to use FFTW unless both float
   and double versions are available.  */
#if defined (HAVE_FFTW3) && defined (HAVE_FFTW3F)
#define HAVE_FFTW
#endif

/* Backward compatibility.  */
#if defined (HAVE_Z)
#define HAVE_ZLIB
#endif

/* oct-dlldefs.h */

#if defined (_MSC_VER)
#define OCTAVE_EXPORT __declspec(dllexport)
#define OCTAVE_IMPORT __declspec(dllimport)
#else
/* All other compilers, at least for now. */
#define OCTAVE_EXPORT
#define OCTAVE_IMPORT
#endif

/* API macro for libcruft */
#ifdef CRUFT_DLL
#define CRUFT_API OCTAVE_EXPORT
#else
#define CRUFT_API OCTAVE_IMPORT
#endif

/* API macro for liboctave */
#ifdef OCTAVE_DLL
#define OCTAVE_API OCTAVE_EXPORT
#else
#define OCTAVE_API OCTAVE_IMPORT
#endif

/* API macro for src */
#ifdef OCTINTERP_DLL
#define OCTINTERP_API OCTAVE_EXPORT
#else
#define OCTINTERP_API OCTAVE_IMPORT
#endif

/* API macro for src/graphics */
#ifdef OCTGRAPHICS_DLL
#define OCTGRAPHICS_API OCTAVE_EXPORT
#else
#define OCTGRAPHICS_API OCTAVE_IMPORT
#endif

/* oct-types.h */

typedef OCTAVE_IDX_TYPE octave_idx_type;

#include <stdint.h>

/* Tag indicating Octave config.h has been included */
#define OCTAVE_CONFIG_INCLUDED 1
])

### Do the substitutions in all the Makefiles.

AC_SUBST(ac_config_files)
AC_SUBST(ac_config_headers)

AC_CONFIG_FILES([
  Makefile 
  doc/Makefile
  doc/faq/Makefile
  doc/icons/Makefile
  doc/interpreter/Makefile
  doc/liboctave/Makefile
  doc/refcard/Makefile
  examples/Makefile
  gui/Makefile
  gui/src/Makefile
  libcruft/Makefile
  libcruft/mkf77def
  libgnu/Makefile
  liboctave/Makefile
  scripts/Makefile
  src/Makefile
  test/Makefile])

AC_OUTPUT

### Print a summary so that important information isn't missed.

AC_MSG_NOTICE([

Octave is now configured for $canonical_host_type

  Source directory:            $srcdir
  Installation prefix:         $prefix
  C compiler:                  $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS
  C++ compiler:                $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS
  Fortran compiler:            $F77 $FFLAGS
  Fortran libraries:           $FLIBS
  Lex libraries:               $LEXLIB
  LIBS:                        $LIBS

  AMD CPPFLAGS:                $AMD_CPPFLAGS
  AMD LDFLAGS:                 $AMD_LDFLAGS
  AMD libraries:               $AMD_LIBS
  ARPACK CPPFLAGS:             $ARPACK_CPPFLAGS
  ARPACK LDFLAGS:              $ARPACK_LDFLAGS
  ARPACK libraries:            $ARPACK_LIBS
  BLAS libraries:              $BLAS_LIBS
  CAMD CPPFLAGS:               $CAMD_CPPFLAGS
  CAMD LDFLAGS:                $CAMD_LDFLAGS
  CAMD libraries:              $CAMD_LIBS
  CARBON libraries:            $CARBON_LIBS
  CCOLAMD CPPFLAGS:            $CCOLAMD_CPPFLAGS
  CCOLAMD LDFLAGS:             $CCOLAMD_LDFLAGS
  CCOLAMD libraries:           $CCOLAMD_LIBS
  CHOLMOD CPPFLAGS:            $CHOLMOD_CPPFLAGS
  CHOLMOD LDFLAGS:             $CHOLMOD_LDFLAGS
  CHOLMOD libraries:           $CHOLMOD_LIBS
  COLAMD CPPFLAGS:             $COLAMD_CPPFLAGS
  COLAMD LDFLAGS:              $COLAMD_LDFLAGS
  COLAMD libraries:            $COLAMD_LIBS
  CURL CPPFLAGS:               $CURL_CPPFLAGS
  CURL LDFLAGS:                $CURL_LDFLAGS
  CURL libraries:              $CURL_LIBS
  CXSPARSE CPPFLAGS:           $CXSPARSE_CPPFLAGS
  CXSPARSE LDFLAGS:            $CXSPARSE_LDFLAGS
  CXSPARSE libraries:          $CXSPARSE_LIBS
  DL libraries:                $DL_LIBS
  FFTW3 CPPFLAGS:              $FFTW3_CPPFLAGS
  FFTW3 LDFLAGS:               $FFTW3_LDFLAGS
  FFTW3 libraries:             $FFTW3_LIBS
  FFTW3F CPPFLAGS:             $FFTW3F_CPPFLAGS
  FFTW3F LDFLAGS:              $FFTW3F_LDFLAGS
  FFTW3F libraries:            $FFTW3F_LIBS
  fontconfig CFLAGS:           $FONTCONFIG_CFLAGS
  fontconfig libraries:        $FONTCONFIG_LIBS
  FreeType2 CFLAGS:            $FT2_CFLAGS
  FreeType2 libraries:         $FT2_LIBS
  GLPK CPPFLAGS:               $GLPK_CPPFLAGS
  GLPK LDFLAGS:                $GLPK_LDFLAGS
  GLPK libraries:              $GLPK_LIBS
  graphics CFLAGS:             $GRAPHICS_CFLAGS
  graphics libraries:          $GRAPHICS_LIBS
  HDF5 CPPFLAGS:               $HDF5_CPPFLAGS
  HDF5 LDFLAGS:                $HDF5_LDFLAGS
  HDF5 libraries:              $HDF5_LIBS
  LAPACK libraries:            $LAPACK_LIBS
  LLVM CPPFLAGS:               $LLVM_CPPFLAGS
  LLVM LDFLAGS:                $LLVM_LDFLAGS
  LLVM libraries:              $LLVM_LIBS
  Magick++ CPPFLAGS:           $MAGICK_CPPFLAGS
  Magick++ LDFLAGS:            $MAGICK_LDFLAGS
  Magick++ libraries:          $MAGICK_LIBS
  OPENGL libraries:            $OPENGL_LIBS
  PTHREAD flags:               $PTHREAD_CFLAGS
  PTHREAD libraries:           $PTHREAD_LIBS
  QHULL CPPFLAGS:              $QHULL_CPPFLAGS
  QHULL LDFLAGS:               $QHULL_LDFLAGS
  QHULL libraries:             $QHULL_LIBS
  QRUPDATE libraries:          $QRUPDATE_LIBS
  READLINE libraries:          $READLINE_LIBS
  REGEX libraries:             $REGEX_LIBS
  TERM libraries:              $TERM_LIBS
  UMFPACK libraries:           $UMFPACK_LIBS
  X11 include flags:           $X11_INCFLAGS
  X11 libraries:               $X11_LIBS
  Z CPPFLAGS:                  $Z_CPPFLAGS
  Z LDFLAGS:                   $Z_LDFLAGS
  Z libraries:                 $Z_LIBS

  Default pager:               $DEFAULT_PAGER
  gnuplot:                     $GNUPLOT

  Do internal array bounds checking:  $BOUNDS_CHECKING
  Use octave_allocator:               $USE_OCTAVE_ALLOCATOR
  Build static libraries:             $STATIC_LIBS
  Build shared libraries:             $SHARED_LIBS
  Dynamic Linking:                    $ENABLE_DYNAMIC_LINKING $DL_API_MSG
  Include support for GNU readline:   $USE_READLINE
  64-bit array dims and indexing:     $USE_64_BIT_IDX_T
])

warn_msg_printed=false

OCTAVE_CONFIGURE_WARNING_SUMMARY

if $ENABLE_DYNAMIC_LINKING; then
  if $SHARED_LIBS; then
    true
  else
    AC_MSG_WARN([You used --enable-dl but not --enable-shared.])
    AC_MSG_WARN([Are you sure that is what you want to do?])
    warn_msg_printed=true
  fi
fi

if $USE_64_BIT_IDX_T; then
  AC_MSG_WARN([])
  AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.])
  AC_MSG_WARN([Are you sure that is what you want to do?])
  AC_MSG_WARN([])
  AC_MSG_WARN([Your Fortran compiler must have an option to generate])
  AC_MSG_WARN([code with 8 byte signed INTEGER values.  This option])
  AC_MSG_WARN([should be specified in the F77_INTEGER_8_FLAG variable])
  AC_MSG_WARN([Make.  This should work automatically for gfortran.  If])
  AC_MSG_WARN([you use another compiler, you will need to set this])
  AC_MSG_WARN([variable on the configure command line.  You must also])
  AC_MSG_WARN([compile the ARPACK, BLAS, LAPACK, QRUPDATE, and SuiteSparse])
  AC_MSG_WARN([libraries to use 8 byte signed integers for array indexing.])
  AC_MSG_WARN([])
  warn_msg_printed=true
fi

if $USE_OPENMP; then
  AC_MSG_WARN([])
  AC_MSG_WARN([You used the EXPERIMENTAL --enable-openmp option.])
  AC_MSG_WARN([Are you sure that is what you want to do?])
  AC_MSG_WARN([])
  AC_MSG_WARN([This option enables experimental SMP multithreding])
  AC_MSG_WARN([code that has had very little testing.  There is no])
  AC_MSG_WARN([certainity that the results returned by Octave with])
  AC_MSG_WARN([this option enabled will be correct.])
  AC_MSG_WARN([])
  warn_msg_printed=true
fi

if $native_graphics; then
  true;
else
  AC_MSG_WARN([])
  AC_MSG_WARN([I didn't find the necessary libraries to compile native])
  AC_MSG_WARN([graphics.  It isn't necessary to have native graphics,])
  AC_MSG_WARN([but you will need to have gnuplot installed or you won't])
  AC_MSG_WARN([be able to use any of Octave's plotting commands])
  AC_MSG_WARN([])
  warn_msg_printed=true
fi

if test -n "$warn_gnuplot"; then
  if $native_graphics; then
    AC_MSG_WARN([])
    AC_MSG_WARN([I didn't find gnuplot.  Plotting commands will use the])
    AC_MSG_WARN([native graphics toolkit.])
  else
    AC_MSG_WARN([I didn't find gnuplot.  It isn't necessary to have gnuplot])
    AC_MSG_WARN([installed, but you won't be able to use any of Octave's])
    AC_MSG_WARN([plotting commands without it.])
  fi
  AC_MSG_WARN([])
  AC_MSG_WARN([If gnuplot is installed, but isn't in your path, you can])
  AC_MSG_WARN([tell Octave where to find it by using the gnuplot_binary])
  AC_MSG_WARN([function.  For example,])
  AC_MSG_WARN([])
  AC_MSG_WARN([gnuplot_binary ("/full/path/and/name/of/gnuplot/binary")])
  AC_MSG_WARN([])
  AC_MSG_WARN([at the Octave prompt.])
  AC_MSG_WARN([])
  AC_MSG_WARN([Setting default value to $GNUPLOT])
  AC_MSG_WARN([])

  warn_msg_printed=true
fi

if $USE_ATOMIC_REFCOUNT; then
  AC_MSG_WARN([])
  AC_MSG_WARN([Using atomic reference counting.])
  AC_MSG_WARN([This feature allows access to Octave data safely from])
  AC_MSG_WARN([another thread, for instance from a GUI.  However this])
  AC_MSG_WARN([results in a small performance penalty in the Octave])
  AC_MSG_WARN([interpreter.])
  AC_MSG_WARN([])
  if $USE_OCTAVE_ALLOCATOR; then
    AC_MSG_WARN([Thread-safe behavior is not guaranteed unless you also])
    AC_MSG_WARN([disable the use of the octave_allocator class.])
    AC_MSG_WARN([])
  fi
  warn_msg_printed=true
fi

if $warn_msg_printed; then
  AC_MSG_NOTICE([])
  AC_MSG_NOTICE([NOTE: Libraries or auxiliary programs may be skipped if they are])
  AC_MSG_NOTICE([NOTE: not found OR if they are missing required features on your])
  AC_MSG_NOTICE([NOTE: system. ])
fi

### End of configure.