view configure.in @ 3769:7c8e3c42ed04

[project @ 2001-01-31 22:15:51 by jwe]
author jwe
date Wed, 31 Jan 2001 22:15:55 +0000
parents 0228f57f88c3
children 13905c3a24af
line wrap: on
line source

dnl configure.in
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (C) 1996, 1997 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 2, 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, write to the Free
### Software Foundation, 59 Temple Place - Suite 330, Boston, MA
### 02111-1307, USA. 

AC_REVISION($Revision: 1.338 $)
AC_PREREQ(2.9)
AC_INIT(src/octave.cc)
AC_CONFIG_HEADER(config.h)

AC_DEFINE(OCTAVE_SOURCE, 1)

OCTAVE_HOST_TYPE

### some defaults

OCTAVE_SET_DEFAULT(man1dir, '$(mandir)/man1')
OCTAVE_SET_DEFAULT(man1ext, '.1')
OCTAVE_SET_DEFAULT(infofile, '$(infodir)/octave.info')
OCTAVE_SET_DEFAULT(octincludedir, '$(includedir)/octave-$(version)')
OCTAVE_SET_DEFAULT(fcnfiledir, '$(datadir)/octave/$(version)/m')
OCTAVE_SET_DEFAULT(localfcnfiledir, '$(datadir)/octave/site/m')
OCTAVE_SET_DEFAULT(localverfcnfiledir, '$(datadir)/octave/$(version)/site/m')
OCTAVE_SET_DEFAULT(localfcnfilepath,
  '$(localverfcnfiledir)//:$(localfcnfiledir)//')
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(localverarchlibdir,
  '$(libexecdir)/octave/$(version)/site/exec/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(octfiledir,
  '$(libexecdir)/octave/$(version)/oct/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localoctfiledir,
  '$(libexecdir)/octave/site/oct/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localveroctfiledir,
  '$(libexecdir)/octave/$(version)/site/oct/$(canonical_host_type)')
OCTAVE_SET_DEFAULT(localoctfilepath,
  '$(localveroctfiledir)//:$(localoctfiledir)//')
OCTAVE_SET_DEFAULT(fcnfilepath,
  '.:$(localoctfilepath):$(localfcnfilepath):$(octfiledir)//:$(fcnfiledir)//')
OCTAVE_SET_DEFAULT(imagedir, '$(datadir)/octave/$(version)/imagelib')
OCTAVE_SET_DEFAULT(imagepath, '.:$(imagedir)//')

### Make configure args available for other uses.

config_opts=$ac_configure_args
AC_SUBST(config_opts)

### Path separator.

AC_DEFINE(SEPCHAR, [':'])
AC_DEFINE(SEPCHAR_STR, [":"])

### Allow the user to force us to use f2c.

AC_ARG_WITH(f2c,
  [  --with-f2c              use f2c even if Fortran compiler is available],
  [if test "$withval" = no; then use_f2c=false; else use_f2c=true; fi],
  use_f2c=false)

### Allow the user to force us to use g77.

AC_ARG_WITH(g77,
  [  --with-g77              use g77 to compile Fortran subroutines],
  [if test "$withval" = no; then use_g77=false; else use_g77=true; fi],
  use_g77=false)

### Allow the user to force us to use f77.

AC_ARG_WITH(f77,
  [  --with-f77              use f77 to compile Fortran subroutines],
  [if test "$withval" = no; then use_f77=false; else use_f77=true; fi],
  use_f77=false)

### Make sure only one of the above options for Fortran compilers was
### specified (multiple "no" or --without-FOO options are ok).

OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS(f77, g77,
  [warn_f77_and_g77="--with-f77 and --with-g77 both specified!  Using g77..."
  AC_MSG_WARN($warn_f77_and_g77)
  use_g77=false])

OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS(f77, f2c,
  [warn_f2c_and_f77="--with-f2c and --with-f77 both specified!  Using f77..."
  AC_MSG_WARN($warn_f2c_and_f77)
  use_f2c=false])

OCTAVE_CHECK_EXCLUSIVE_WITH_OPTIONS(g77, f2c,
  [warn_f2c_and_g77="--with-f2c and --with-g77 both specified!  Using g77..."
  AC_MSG_WARN($warn_f2c_and_g77)
  use_f2c=false])

dnl ### Allow the user disable support for plplot.
dnl 
dnl # USE_PLPLOT=true
dnl # PLPLOT_DIR=plplot
dnl # LIBPLPLOT='$(TOPDIR)/plplot/libplplot.$(LIBEXT)
USE_PLPLOT=false
PLPLOT_DIR=""
LIBPLPLOT=""
dnl AC_ARG_ENABLE(plplot,
dnl   [  --enable-plplot         use plplot for plotting (default is yes)],
dnl   [if test "$enableval" = no; then
dnl      USE_PLPLOT=false;
dnl      LIBPLPLOT="";
dnl      PLPLOT_DIR="";
dnl    fi], [])
dnl if $USE_PLPLOT; then
dnl   AC_DEFINE(USE_PLPLOT, 1)
dnl fi
AC_SUBST(LIBPLPLOT)
AC_SUBST(PLPLOT_DIR)

### Allow the user disable support for command line editing using GNU
### readline.

READLINE_DIR=readline
USE_READLINE=true
LIBREADLINE='$(TOPDIR)/readline/libreadline.$(LIBEXT)'
AC_ARG_ENABLE(readline,
  [  --enable-readline       use readline library (default is yes)],
  [if test "$enableval" = no; then
     USE_READLINE=false;
     LIBREADLINE="";
     READLINE_DIR="";
   fi], [])
if $USE_READLINE; then
  AC_DEFINE(USE_READLINE, 1)
fi
AC_SUBST(LIBREADLINE)
AC_SUBST(READLINE_DIR)

LIBKPATHSEA='$(TOPDIR)/kpathsea/libkpathsea.$(LIBEXT)'
AC_SUBST(LIBKPATHSEA)

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

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

### 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_RESULT([defining __NO_MATH_INLINES avoids buggy GNU libc exp function])
AC_DEFINE(__NO_MATH_INLINES, 1)

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

EXTERN_CXXFLAGS="$CXXFLAGS"

AC_PROG_CXX
AC_PROG_CXXCPP

### Do special things for g++.

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

case "$gxx_version" in
changequote(,)dnl
  1.* | 2.[0123456].* | 2.7.[01]*)
changequote([,])dnl
    AC_MSG_ERROR([g++ version $gxx_version will not work 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

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

EXTERN_CFLAGS="$CFLAGS"

AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL

### Do special things for 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
  2.*)
    if test -z "$LDFLAGS"; then
      LDFLAGS="-g"
      AC_MSG_RESULT([defining LDFLAGS to be $LDFLAGS])
    fi
  ;;
  1.*)
    warn_gcc_version="gcc version $gcc_version is likely to cause problems"
    AC_MSG_WARN($warn_gcc_version)
  ;;
esac

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

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

ieee_fp_flag=
case "$canonical_host_type" in
changequote(,)dnl
  i[3456789]86-*-*)
changequote([,])dnl
    OCTAVE_CC_FLAG(-mieee-fp, [
      ieee_fp_flag=-mieee-fp
      XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp"
      AC_MSG_RESULT([adding -mieee-fp to XTRA_CFLAGS])])

    OCTAVE_CXX_FLAG(-mieee-fp, [
      ieee_fp_flag=-mieee-fp
      XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp"
      AC_MSG_RESULT([adding -mieee-fp to XTRA_CXXFLAGS])])
  ;;
  alpha*-*-*)
    OCTAVE_CC_FLAG(-mieee-with-inexact, [
      ieee_fp_flag=-mieee-with-inexact
      XTRA_CFLAGS="$XTRA_CFLAGS -mieee-with-inexact"
      AC_MSG_RESULT([adding -mieee-with-inexact to XTRA_CFLAGS])])

    OCTAVE_CXX_FLAG(-mieee-with-inexact, [
      ieee_fp_flag=-mieee-with-inexact
      XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-with-inexact"
      AC_MSG_RESULT([adding -mieee-with-inexact to XTRA_CXXFLAGS])])
  ;;
  *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

### Octave doesn't use run-time type identification or exceptions yet,
### so disable them for somewhat faster and smaller code.

OCTAVE_CXX_FLAG(-fno-rtti, [
  XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-rtti"
  AC_MSG_RESULT([adding -fno-rtti to XTRA_CXXFLAGS])])

OCTAVE_CXX_FLAG(-fno-exceptions, [
  XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-exceptions"
  AC_MSG_RESULT([adding -fno-exceptions to XTRA_CXXFLAGS])])

### We do our own template instantiation.

OCTAVE_CXX_FLAG(-fno-implicit-templates, [
  XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-implicit-templates"
  AC_MSG_RESULT([adding -fno-implicit-templates to XTRA_CXXFLAGS])])

AC_SUBST(XTRA_CFLAGS)
AC_SUBST(XTRA_CXXFLAGS)

### 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_RESULT([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
fi
AC_SUBST(LD_STATIC_FLAG)

OCTAVE_CXX_PREPENDS_UNDERSCORE

dnl This is bogus.  We shouldn't have to explicitly add libc too!

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

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

# ----------------------------------------------------------------------
# Check for HDF5 library
AC_ARG_WITH(hdf5, [  --without-hdf5          don't use HDF5 output], ok=$withval, ok=yes)
if test "$ok" = "yes"; then
	AC_CHECK_LIB(z, deflate)
	AC_CHECK_LIB(hdf5, H5Pcreate, [
		AC_CHECK_HEADERS(hdf5.h, [LIBS="-lhdf5 $LIBS"
			                  AC_DEFINE(HAVE_HDF5)])])
fi

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

### We need these before trying to find libf2c.

OCTAVE_PROG_AR

AC_PROG_RANLIB

### If we haven't been forced to use a particular Fortran compiler,
### try to find one using any one of several common Un*x Fortran
### compiler names.  Put fc last to avoid confusion with some vendor's
### /bin/sh fc builtin.
###
###    f77 : most Unix systems
###    xlf : IBM / AIX
###   cf77 : Cray / Unicos
###    g77 : GNU Fortran
###     fc : Convex
###
### If a compiler is found, check to see if it is compatible with our
### assumptions.  If it is, use it.  Otherwise, look for f2c.  If we
### can't find a compatible fortran compiler or f2c, issue a warning.
###
### I don't think the Cray compiler will ever work like f2c...
###
### The configure options --with-f77, --with-g77, or --with-f2c
### force f77, g77 or f2c to be used.  It is also possible to use
### these options to specify the name of the compiler.  For example,
### `--with-g77=/opt/gnu/bin/f77' says that we are using g77 but it is
### installed as /opt/gnu/bin/f77.

if $use_f77; then
  if test "$with_f77" = yes; then
    F77=f77
  else
    F77="$with_f77"
  fi
  AC_MSG_RESULT([defining F77 to be $F77])
elif $use_g77; then
  if test "$with_g77" = yes; then
    F77=g77
  else
    F77="$with_g77"
  fi
  AC_MSG_RESULT([defining F77 to be $F77])
elif $use_f2c; then
  F77=
  if test "$with_f2c" = yes; then
    F2C=f2c
  else
    F2C="$with_f2c"
  fi
  AC_MSG_RESULT([defining F2C to be $F2C])
else
  AC_CHECK_PROGS(F77, g77 f77 f90 xlf cf77 fc)
fi

have_fortran_compiler=false
have_f2c=false

if $use_f2c; then
  have_f2c=true
else
  if test -n "$F77"; then
    OCTAVE_FLIBS
    OCTAVE_F77_APPEND_UNDERSCORE
    OCTAVE_F2C_F77_COMPAT
    if test "$octave_cv_f2c_f77_compat" = no; then
      F77=
    else
      if test -z "$FFLAGS"; then
        FFLAGS="-O"
      fi
      case "$canonical_host_type" in
        alpha*-*-*)
          if test "$octave_cv_f77_is_g77" = yes; then
            FFLAGS="$ieee_fp_flag $FFLAGS"
	  else
	    FFLAGS="-fpe1 $FFLAGS"
	  fi
        ;;
	powerpc-apple-machten*)
	  FFLAGS=
	;;
      esac
      if test -n "$FFLAGS"; then
        AC_MSG_RESULT([defining FFLAGS to be $FFLAGS])
      fi
    fi
  fi
  if test -n "$F77"; then
    have_fortran_compiler=true
  else
    AC_CHECK_PROG(F2C, f2c, f2c, [])
    if test -n "$F2C"; then
      have_f2c=true
    fi
  fi
fi

f77_rules_frag=/dev/null
if $have_fortran_compiler; then
  f77_rules_frag=Makefrag.f77
changequote(,)dnl
  cat << \EOF > $f77_rules_frag

%.c : %.f

%.o : %.f
	$(FC) -c $(ALL_FFLAGS) -o $@ $<

pic/%.o : %.f
	$(FC) -c $(FPICFLAG) $(ALL_FFLAGS) $< -o $@

EOF
changequote([,])dnl
elif $have_f2c; then
  AC_DEFINE(F77_APPEND_UNDERSCORE, 1)
  AC_MSG_RESULT([defining F77_APPEND_UNDERSCORE to be 1])

### This seems to be necessary on some Linux system.

  cat > conftest.$ac_ext << EOF
int MAIN_ () { return 0; }
int MAIN__ () { return 0; }
EOF

### XXX FIMXE XXX -- these shouldn't be fixed names, eh?

  oct_conflib=libconflib.a
  oct_obj_ext=o

  if AC_TRY_EVAL(ac_compile); then
    $AR $ARFLAGS $oct_conflib conftest.$oct_obj_ext 1>&AC_FD_CC
    if test -n "$RANLIB"; then
      $RANLIB $oct_conflib 1>&AC_FD_CC
    fi
  fi
  rm -f conftest*
  AC_CHECK_LIB(f2c, f_open, FLIBS=-lf2c, FLIBS=, [-L. -lconflib])
  rm -f $oct_conflib

  if test -z "$FLIBS"; then
    AC_CHECK_LIB(F77, d_sin, FLIBS=-lF77, FLIBS=)
    if test -n "$FLIBS"; then
      AC_CHECK_LIB(I77, f_rew, FLIBS="$FLIBS -lI77", FLIBS=, -lF77)
    fi
  fi

  if test -z "$FLIBS"; then
    warn_f2c_no_lib="I found f2c but not libf2c.a, or libF77.a and libI77.a"
    AC_MSG_WARN($warn_f2c_no_lib)
  fi
  f77_rules_frag=Makefrag.f77
  cat << \EOF > $f77_rules_frag

%.c : %.f
	cat $< | $(F2C) $(F2CFLAGS) > $(@F)

%.o : %.f

EOF
else
  AC_MSG_WARN([in order to build octave, you must have a compatible])
  AC_MSG_WARN([Fortran compiler or f2c installed and in your path.])
  AC_MSG_ERROR([See the file INSTALL for more information.])
fi

OCTAVE_F77_MAIN_FLAG

FC=$F77
AC_SUBST(FC)
AC_SUBST(F77)
AC_SUBST(FFLAGS)
AC_SUBST(FLIBS)
AC_SUBST(F2C)
AC_SUBST(F2CFLAGS)
AC_SUBST_FILE(f77_rules_frag)

# Checks for BLAS and LAPACK libraries:

# subdirectories of libcruft to build if they aren't found on the system:
BLAS_DIR="blas"
LAPACK_DIR="lapack"
AC_SUBST(BLAS_DIR)
AC_SUBST(LAPACK_DIR)

# names of Fortran dgemm & cheev functions to check for (depends upon
# F77 compiler name-mangling scheme):
if test "$octave_cv_f77_uppercase_names" = "yes"; then
  if test "$octave_cv_f77_append_underscore" = "yes"; then
    dgemm_func=DGEMM_
    cheev_func=CHEEV_
  else
    dgemm_func=DGEMM
    cheev_func=CHEEV
  fi
else
  if test "$octave_cv_f77_append_underscore" = "yes"; then
    dgemm_func=dgemm_
    cheev_func=cheev_
  else
    dgemm_func=dgemm
    cheev_func=cheev
  fi
fi

AC_ARG_WITH(fastblas, [  --without-fastblas      use included (generic) BLAS and LAPACK], with_fastblas=$withval, with_fastblas=yes)
if test "$with_fastblas" = "no"; then
  BLAS_LIBS=" "
elif test "$with_fastblas" != "yes"; then
  # user specified a BLAS library to try on the command line
  AC_CHECK_LIB($with_fastblas, $dgemm_func, 
	       BLAS_LIBS="-l$with_fastblas", , $FLIBS)
fi

if test "x$BLAS_LIBS" = x; then
  # Checks for ATLAS BLAS library:
  AC_CHECK_LIB(atlas, ATL_xerbla, BLAS_LIBS="-latlas")
  if test "x$BLAS_LIBS" != x; then
    # check for other atlas libs:
    AC_CHECK_LIB(cblas, cblas_dgemm,BLAS_LIBS="-lcblas $BLAS_LIBS",,$BLAS_LIBS)
    AC_CHECK_LIB(f77blas, $dgemm_func, 
		 BLAS_LIBS="-lf77blas $BLAS_LIBS", , $BLAS_LIBS $FLIBS)
  fi
fi

if test "x$BLAS_LIBS" = x; then
  # BLAS in Alpha CXML library?
  AC_CHECK_LIB(cxml, $dgemm_func, BLAS_LIBS="-lcxml", , $FLIBS)
fi

if test "x$BLAS_LIBS" = x; then
  # BLAS in Alpha DXML library? (now called CXML, see above)
  AC_CHECK_LIB(dxml, $dgemm_func, BLAS_LIBS="-ldxml", , $FLIBS)
fi

if test "x$BLAS_LIBS" = x; then
  # Check for BLAS in Sun Performance library:
  AC_CHECK_LIB(sunmath, acosp, BLAS_LIBS="-lsunmath")
  AC_CHECK_LIB(sunperf, $dgemm_func, BLAS_LIBS="-xlic_lib=sunperf $BLAS_LIBS",
               , $BLAS_LIBS)
fi

if test "x$BLAS_LIBS" = x; then
  # Check for BLAS in SCSL and SGIMATH libraries (prefer SCSL):
  AC_CHECK_LIB(scs, $dgemm_func,
               BLAS_LIBS="-lscs", 
	       AC_CHECK_LIB(complib.sgimath, $dgemm_func,
			    BLAS_LIBS="-lcomplib.sgimath", , $FLIBS), $FLIBS)
fi

if test "x$BLAS_LIBS" = x; then
  # Checks for BLAS in IBM ESSL library.  We must also link
  # with -lblas in this case (ESSL does not include the full BLAS):
  AC_CHECK_LIB(blas, zherk, 
	       AC_CHECK_LIB(essl, $dgemm_func, 
			    BLAS_LIBS="-lessl -lblas", , $FLIBS), , $FLIBS)
fi

if test "x$BLAS_LIBS" = x; then
  # Finally, check for the generic BLAS library:
  AC_CHECK_LIB(blas, $dgemm_func, BLAS_LIBS="-lblas", , $FLIBS)
fi

if test "$with_fastblas" = "no"; then
  # Unset BLAS_LIBS so that we know below that nothing was found.
  BLAS_LIBS=""
fi

if test "x$BLAS_LIBS" != x; then
  BLAS_DIR=""  # don't build our own BLAS

# Check for LAPACK library.  Note that ATLAS has its own liblapack.a,
# which is designed to be combined with the real LAPACK.  cheev is a
# function in the real LAPACK but not in ATLAS's version, so this
# (hopefully) insures that we are getting the real LAPACK.  Note also
# that on some systems, LAPACK is included in the math library
# (e.g. DXML) that we already linked to above...we detect this by
# doing AC_CHECK_FUNC if -llapack isn't found:

  AC_CHECK_LIB(lapack, $cheev_func, 
	       [BLAS_LIBS="-llapack $BLAS_LIBS"; LAPACK_DIR=""],
	       AC_CHECK_FUNC($cheev_func, LAPACK_DIR=""), $BLAS_LIBS $FLIBS)
fi

AC_SUBST(BLAS_LIBS)

### Handle dynamic linking and shared library options.

### Allow the user to experiment with dynamic linking using dlopen/dlsym.

AC_ARG_ENABLE(dl,
  [  --enable-dl             use dlopen/dlsym for dynamic linking (not all systems)],
  [if test "$enableval" = no; then WITH_DL=no;
   elif test "$enableval" = yes; then WITH_DL=yes;
   else WITH_DL=maybe; fi],
  WITH_DL=maybe)

### Allow the user to experiment with dynamic linking using
### shl_load/shl_findsym (HP/UX only?).

AC_ARG_ENABLE(shl,
  [  --enable-shl            use shl_load/shl_findsym for dynamic linking (HP only)],
  [if test "$enableval" = no; then WITH_SHL=no;
   elif test "$enableval" = yes; then WITH_SHL=yes;
   else WITH_SHL=maybe; fi],
  WITH_SHL=maybe)

### Enable creation of static libraries.

AC_ARG_ENABLE(static,
  [  --enable-static         create static libraries],
  [if test "$enableval" = no; then STATIC_LIBS=false;
   else STATIC_LIBS=true; fi],
  STATIC_LIBS=true)
AC_SUBST(STATIC_LIBS)

### Enable creation of shared libraries.  Currently only works with
### gcc on some systems.

AC_ARG_ENABLE(shared,
  [  --enable-shared         create shared libraries (not all systems)],
  [if test "$enableval" = no; then SHARED_LIBS=false;
   else SHARED_LIBS=true; fi],
  SHARED_LIBS=false)
AC_SUBST(SHARED_LIBS)

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

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

use_rpath=true
AC_ARG_ENABLE(rpath,
  [  --enable-rpath          add -rpath to link command for shared libraries],
  [if test "$enableval" = no; then use_rpath=false; fi], [])

DLFCN_DIR=
CPICFLAG=-fPIC
CXXPICFLAG=-fPIC
FPICFLAG=-fPIC
SHLEXT=so
SH_LD="$CXX"
SH_LDFLAGS=-shared
SONAME_FLAGS=
RLD_FLAG=
case "$canonical_host_type" in
  *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*)
    SH_LD=ld
    SH_LDFLAGS=-Bshareable
  ;;
  alpha*-dec-osf*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    SH_LDFLAGS="-shared -Xlinker -expect_unresolved -Xlinker '*'"
    SONAME_FLAGS='-Xlinker -soname -Xlinker $@'
    RLD_FLAG='-Xlinker -rpath -Xlinker $(octlibdir)'
  ;;
  *-*-linux* | *-*-gnu*)
    SONAME_FLAGS='-Xlinker -soname -Xlinker $@'
    RLD_FLAG='-Xlinker -rpath -Xlinker $(octlibdir)'
  ;;
changequote(,)dnl
  i[3456]86-*-sco3.2v5*)
changequote([,])dnl
    SONAME_FLAGS='-Xlinker -h -Xlinker $@'
    RLD_FLAG=
    SH_LDFLAGS=-G
  ;;
  rs6000-ibm-aix* | powerpc-ibm-aix*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    DLFCN_DIR=dlfcn
  ;;
  hppa*-hp-hpux*)
    if test "$octave_cv_f77_is_g77" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=+Z
    fi
    SHLEXT=sl
    SH_LDFLAGS="-shared -fPIC"
    RLD_FLAG='-Xlinker +b -Xlinker $(octlibdir)'
  ;;
  *-sgi-*)
    CPICFLAG=
    CXXPICFLAG=
    FPICFLAG=
    RLD_FLAG='-L$(octlibdir)'
  ;;
  sparc-sun-sunos4*)
    if test "$octave_cv_f77_is_g77" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=-PIC
    fi
    SH_LD=ld
    SH_LDFLAGS="-assert nodefinitions"
    RLD_FLAG='-L$(octlibdir)'
  ;;
  sparc-sun-solaris2* | i386-pc-solaris2*)
    if test "$octave_cv_f77_is_g77" = yes; then
      FPICFLAG=-fPIC
    else
      FPICFLAG=-PIC
    fi
    RLD_FLAG='-Xlinker -R -Xlinker $(octlibdir)'
  ;;
esac

if $use_rpath; then
  true
else
  RLD_FLAG=
fi

AC_MSG_RESULT([defining FPICFLAG to be $FPICFLAG])
AC_MSG_RESULT([defining CPICFLAG to be $CPICFLAG])
AC_MSG_RESULT([defining CXXPICFLAG to be $CXXPICFLAG])
AC_MSG_RESULT([defining SHLEXT to be $SHLEXT])
AC_MSG_RESULT([defining DLFCN_DIR to be $DLFCN_DIR])
AC_MSG_RESULT([defining SH_LD to be $SH_LD])
AC_MSG_RESULT([defining SH_LDFLAGS to be $SH_LDFLAGS])
AC_MSG_RESULT([defining SONAME_FLAGS to be $SONAME_FLAGS])
AC_MSG_RESULT([defining RLD_FLAG to be $RLD_FLAG])
AC_SUBST(FPICFLAG)
AC_SUBST(CPICFLAG)
AC_SUBST(CXXPICFLAG)
AC_SUBST(SHLEXT)
AC_SUBST(DLFCN_DIR)
AC_SUBST(SH_LD)
AC_SUBST(SH_LDFLAGS)
AC_SUBST(SONAME_FLAGS)
AC_SUBST(RLD_FLAG)

### Allow compilation of smaller kernel.  This only works if some form
### of dynamic linking is also supported and used.

AC_ARG_ENABLE(lite-kernel,
  [  --enable-lite-kernel    compile smaller kernel (requires dynamic linking)],
  [if test "$enableval" = no; then OCTAVE_LITE=false;
   else OCTAVE_LITE=true; fi],
  OCTAVE_LITE=false)
if $OCTAVE_LITE; then
  AC_DEFINE(OCTAVE_LITE, 1)
fi
AC_SUBST(OCTAVE_LITE)

### special checks for odd OS specific things.
###
### I am told that on some SCO systems, the only place to find some
### functions like gethostname and gettimeofday is in libsocket.

AC_ISC_POSIX
AC_MINIX
AC_AIX
AC_CHECK_LIB(sun, getpwnam)
AC_CHECK_LIB(socket, gethostname)

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

AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)

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

AC_ALLOCA
AC_C_CONST

### See if we should define NPOS.

OCTAVE_STRING_NPOS

### Checks for header files.

AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_TIME
AC_HEADER_SYS_WAIT

AC_CHECK_HEADERS(assert.h curses.h dlfcn.h fcntl.h float.h \
  floatingpoint.h fnmatch.h glob.h grp.h ieeefp.h limits.h memory.h \
  nan.h ncurses.h poll.h pwd.h sgtty.h stdlib.h string.h sys/ioctl.h \
  sys/param.h sys/poll.h sys/resource.h sys/select.h sys/stat.h \
  sys/time.h sys/times.h sys/types.h sys/utsname.h termcap.h \
  termio.h $TERMIOS_H unistd.h varargs.h)

### I'm told that termios.h is broken on NeXT systems.

case "$canonical_host_type" in
  *-*-nextstep*)
    if test "$ac_cv_header_termios_h" = yes; then
      AC_MSG_WARN([Ignoring termios.h on NeXT systems.])
      ac_cv_header_termios_h=no
    fi
  ;;
esac

if test "$ac_cv_header_termios_h" = yes \
    || test "$ac_cv_header_termio_h" = yes \
    || test "$ac_cv_header_sgtty_h" = yes; then
  true
else
  AC_MSG_ERROR([I couldn't find termios.h, termio.h, or sgtty.h!])
fi

## I'm told that setting LIBGLOB to be $(TOPDIR)/glob/libglob.a causes
## trouble on SCO systems, but setting it to be the two object files
## avoids the problem.

GLOB_DIR=glob
LIBGLOB='$(TOPDIR)/glob/glob.o $(TOPDIR)/glob/fnmatch.o'
GLOB_INCFLAGS='-I$(top_srcdir)/glob -I$(TOPDIR)/glob'
if test "$ac_cv_header_fnmatch_h" = yes \
  && test "$ac_cv_header_glob_h" = yes; then
  AC_EGREP_CPP(yes,
    [#ifdef FNM_NOESCAPE
     #ifdef FNM_FOOBAR_PATHNAME
     #ifdef FNM_PERIOD
       yes
     #endif
     #endif
     #endif
    ], [
      GLOB_DIR=
      AC_CHECK_LIB(glob, glob)
      AC_CHECK_FUNCS(fnmatch glob)
      if test "$ac_cv_func_fnmatch" = yes \
	&& test "$ac_cv_func_glob" = yes; then
	GLOB_DIR=
	LIBGLOB=
	GLOB_INCFLAGS=
      fi
    ], [
### We provide replacements, so we should set these to "yes".
    AC_CACHE_VAL(ac_cv_func_fnmatch, ac_cv_func_fnmatch=yes)
    AC_CACHE_VAL(ac_cv_func_glob, ac_cv_func_glob=yes)
    ])
else
### We provide replacements, so we should set these to "yes".
  ac_cv_header_fnmatch_h=yes
  ac_cv_header_glob_h=yes
  AC_CACHE_VAL(ac_cv_func_fnmatch, ac_cv_func_fnmatch=yes)
  AC_CACHE_VAL(ac_cv_func_glob, ac_cv_func_glob=yes)
fi
AC_SUBST(GLOB_DIR)
AC_SUBST(LIBGLOB)
AC_SUBST(GLOB_INCFLAGS)

### Checks for functions and variables.

AC_CHECK_FUNCS(atexit bcopy bzero dup2 endgrent endpwent execvp \
  fcntl fork getcwd getegid geteuid getgid getgrent getgrgid \
  getgrnam gethostname getpgrp getpid getppid getpwent getpwnam \
  getpwuid gettimeofday getuid getwd link localtime_r lstat \
  memmove mkdir mkfifo on_exit pipe poll putenv readlink rename \
  rindex rmdir select setgrent setpwent setvbuf sigaction sigpending \
  sigprocmask sigsuspend stat strcasecmp strdup strerror strftime \
  stricmp strncasecmp strnicmp strptime symlink tempnam umask unlink \
  usleep vfprintf vsprintf vsnprintf waitpid)

OCTAVE_SMART_PUTENV

LD_CXX='$(CXX)'
LIBDLFCN=
DLFCN_INCFLAGS=
RDYNAMIC_FLAG=
if test "$WITH_DL" = yes || test "$WITH_DL" = maybe; then
  case "$canonical_host_type" in
    rs6000-ibm-aix* | powerpc-ibm-aix*)
      LIBDLFCN="-ldlfcn -ll -lld"
      DLFCN_INCFLAGS='-I$(top_srcdir)/dlfcn -I$(TOPDIR)/dlfcn'
      WITH_DL=true
    ;;
changequote(,)dnl
    i[3456]86-*-sco3.2v5*)
changequote([,])dnl
      LD_CXX='LD_RUN_PATH=$LD_RUN_PATH:$(octlibdir) $(CXX)'
      WITH_DL=true
    ;;
    *)
      AC_CHECK_LIB(dl, dlopen)
      AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
      if test "$ac_cv_func_dlopen" = yes \
	 && test "$ac_cv_func_dlsym" = yes \
	 && test "$ac_cv_func_dlerror" = yes \
	 && test "$ac_cv_func_dlclose" = yes; then
	WITH_DL=true
      else
	if test "$WITH_DL" = yes; then
	  AC_MSG_ERROR([--enable-dl specified, but functions are missing!])
	fi
	WITH_DL=false
      fi
    ;;
  esac
  if $WITH_DL; then
    OCTAVE_CXX_FLAG(-rdynamic, [RDYNAMIC_FLAG=-rdynamic])
    AC_DEFINE(WITH_DL, 1)
  fi
else
  WITH_DL=false
fi
AC_SUBST(WITH_DL)
AC_SUBST(LIBDLFCN)
AC_SUBST(DLFCN_INCFLAGS)
AC_SUBST(RDYNAMIC_FLAG)
AC_SUBST(LD_CXX)

if test "$WITH_SHL" = yes || test "$WITH_SHL" = maybe; then
  AC_CHECK_LIB(dld, shl_load)
  AC_CHECK_FUNCS(shl_load shl_findsym)
  if test "$ac_cv_func_shl_load" = yes \
     && test "$ac_cv_func_shl_findsym" = yes; then
    WITH_SHL=true
  else
    if test "$WITH_SHL" = yes; then
      AC_MSG_ERROR([--enable-shl specified, but functions are missing!])
    fi
    WITH_SHL=false
  fi
  if $WITH_SHL; then
    AC_DEFINE(WITH_SHL, 1)
  fi
else
  WITH_SHL=false
fi
AC_SUBST(WITH_SHL)

### Set WITH_DYNAMIC_LINKING after all the other shared library stuff
### has been determined.

if $WITH_DL || $WITH_SHL; then
  AC_DEFINE(WITH_DYNAMIC_LINKING, 1)
  WITH_DYNAMIC_LINKING=true
else
  WITH_DYNAMIC_LINKING=false
fi
AC_SUBST(WITH_DYNAMIC_LINKING)

### There is more than one possible prototype for gettimeofday.  See
### which one (if any) appears in sys/time.h.  These tests are from
### Emacs 19.

AC_MSG_CHECKING(for struct timeval)
AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif], [static struct timeval x; x.tv_sec = x.tv_usec;],
  [AC_MSG_RESULT(yes)
   HAVE_TIMEVAL=yes
   AC_DEFINE(HAVE_TIMEVAL)],
  [AC_MSG_RESULT(no)
   HAVE_TIMEVAL=no])

if test "x$HAVE_TIMEVAL" = xyes; then
AC_MSG_CHECKING(whether gettimeofday can't accept two arguments)
AC_TRY_LINK([#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif],[struct timeval time; struct timezone dummy;
  gettimeofday (&time, &dummy);], [AC_MSG_RESULT(no)],
  [AC_MSG_RESULT(yes)
   AC_DEFINE(GETTIMEOFDAY_NO_TZ)])
fi

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, and that
### on SCO systems, isnan and isinf don't work, but they can be
### replaced by something that does.

case "$canonical_host_type" in
  m68k-hp-hpux*)
  ;;
  *-*-sco*)
    AC_MSG_RESULT([defining SCO to be 1])
    AC_DEFINE(SCO, 1)
    AC_MSG_RESULT([forcing HAVE_ISINF for SCO])
    AC_DEFINE(HAVE_ISINF, 1)
    AC_MSG_RESULT([forcing HAVE_ISNAN for SCO])
    AC_DEFINE(HAVE_ISNAN, 1)
  ;;
  *)
    AC_CHECK_FUNCS(finite isnan isinf)
  ;;
esac

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

AC_CHECK_FUNCS(acosh asinh atanh erf erfc)

### Checks for OS specific cruft.

AC_STRUCT_ST_BLKSIZE
AC_STRUCT_ST_BLOCKS
AC_STRUCT_ST_RDEV
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
AC_FUNC_CLOSEDIR_VOID

OCTAVE_STRUCT_GR_PASSWD

TERMLIBS=""
for termlib in ncurses curses termcap terminfo termlib; do
  AC_CHECK_LIB(${termlib}, tputs, [TERMLIBS="${TERMLIBS} -l${termlib}"])
  case "${TERMLIBS}" in
    *-l${termlib}*)
      AC_MSG_RESULT([defining TERMLIBS to be $TERMLIBS])
      break
    ;;
  esac
done
AC_SUBST(TERMLIBS)

if test "$ac_cv_lib_termcap_tputs" = yes \
    || test "$ac_cv_lib_terminfo_tputs" = yes \
    || test "$ac_cv_lib_ncurses_tputs" = yes \
    || test "$ac_cv_lib_curses_tputs" = yes \
    || test "$ac_cv_lib_termlib_tputs" = yes; then
  true
else
  warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, or -ltermlib!"
  AC_MSG_WARN($warn_termlibs)
fi

AC_MSG_CHECKING([for struct exception in math.h])
AC_TRY_LINK([#include <math.h>],
  [struct exception *x; x->type; x->name;],
  AC_MSG_RESULT(yes)
  AC_DEFINE(EXCEPTION_IN_MATH, 1),
  AC_MSG_RESULT(no))

### Signal stuff.

AC_TYPE_SIGNAL
AC_DECL_SYS_SIGLIST
AC_MSG_CHECKING([for sys_siglist variable])
AC_TRY_LINK([#include <stdio.h>],
  [extern char *sys_siglist[]; printf ("%s\n", sys_siglist[1]);],
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_SYS_SIGLIST, 1),
  AC_MSG_RESULT(no))
OCTAVE_SIGNAL_CHECK
OCTAVE_REINSTALL_SIGHANDLERS

### Type stuff.

AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE(dev_t, short)
AC_CHECK_TYPE(ino_t, unsigned long)
AC_CHECK_TYPE(nlink_t, short)
OCTAVE_CHECK_TYPE(sigset_t, [#include <signal.h>], int)

### Define VOID_SIGHANDLER for readline.

case "$RETSIGTYPE" in
  int)
  ;;
  *)
    VOID_SIGHANDLER="-DVOID_SIGHANDLER=1"
    AC_MSG_RESULT([defining VOID_SIGHANDLER to be 1])
  ;;
esac
AC_SUBST(VOID_SIGHANDLER)

### A system dependent kluge or two.

AC_CHECK_FUNCS(getrusage times)
case "$canonical_host_type" in
  *-*-cygwin32)
    AC_DEFINE(RUSAGE_TIMES_ONLY, 1)
  ;;
esac

bsd_gcc_kluge_targets_frag=/dev/null
case "$canonical_host_type" in
  *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*)
    bsd_gcc_kluge_targets_frag=Makefrag.bsd
    cat << \EOF > $bsd_gcc_kluge_targets_frag

lex.o: lex.cc 
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) $<

pt-plot.o: pt-plot.cc
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) $<

symtab.o: symtab.cc
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) $<

toplev.o: toplev.cc
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) $<

unwind-prot.o: unwind-prot.cc 
	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS_NO_PT_FLAGS) $<

EOF
  ;;
esac
AC_SUBST_FILE(bsd_gcc_kluge_targets_frag)

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

OCTAVE_PROG_FLEX
OCTAVE_PROG_BISON

AC_PROG_LN_S

OCTAVE_PROG_NM
OCTAVE_PROG_RUNTEST

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

OCTAVE_PROG_GNUPLOT
OCTAVE_PROG_PAGER
OCTAVE_PROG_GPERF

EXE=
case "$canonical_host_type" in
  *-*-cygwin32)
    EXE=.exe
  ;;
esac
AC_SUBST(EXE)

### Even though we include config.h, we need to have the preprocessor
### defines available in a variable for the octave-bug script.  Use
### UGLY_DEFS for that.

AC_OUTPUT_MAKE_DEFS
UGLY_DEFS=`echo $DEFS | sed 's,\\",\\\\\\\\\\\\\\\\\\",g'`
AC_MSG_RESULT([defining UGLY_DEFS to be $UGLY_DEFS])
AC_SUBST(UGLY_DEFS)

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

if test -z "$EXTERN_CFLAGS"; then
  OCTAVE_CC_FLAG(-Wall)
fi

if test -z "$EXTERN_CXXFLAGS"; then
  OCTAVE_CXX_FLAG(-Wall)
fi

### Someday, maybe include -ansi and even -pedantic in this list...

GCC_PICKY_FLAGS="-Wcast-align -Wcast-qual -Wid-clash-31 \
 -Winline -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
 -Wstrict-prototypes -Wwrite-strings"

GXX_PICKY_FLAGS="$GCC_PICKY_FLAGS -Weffc++ -Wenum-clash -fno-nonnull-objects"

AC_ARG_ENABLE(picky-flags,
  [  --enable-picky-flags    add picky options to CFLAGS, CXXFLAGS, FFLAGS],
  [if test "$enableval" = no; then
     true
   elif test "$enableval" = yes; then
     if test -z "$EXTERN_CFLAGS"; then
       for flag in $GCC_PICKY_FLAGS; do
	 OCTAVE_CC_FLAG($flag)
       done
     fi
     if test -z "$EXTERN_CXXFLAGS"; then
       for flag in $GXX_PICKY_FLAGS; do
	 OCTAVE_CXX_FLAG($flag)
       done
     fi
   fi], [])

### Run configure in subdirectories.

export CC
export CXX
export F77

AC_CONFIG_SUBDIRS($GLOB_DIR kpathsea scripts $PLPLOT_DIR $READLINE_DIR)

### Do the substitutions in all the Makefiles.

AC_OUTPUT(Makefile octMakefile Makeconf install-octave \
  test/Makefile dlfcn/Makefile \
  doc/Makefile doc/faq/Makefile doc/interpreter/Makefile \
  doc/liboctave/Makefile doc/refcard/Makefile emacs/Makefile \
  examples/Makefile liboctave/Makefile src/Makefile \
  libcruft/Makefile libcruft/Makerules \
  libcruft/amos/Makefile libcruft/blas/Makefile \
  libcruft/dassl/Makefile libcruft/fftpack/Makefile \
  libcruft/lapack/Makefile libcruft/linpack/Makefile \
  libcruft/minpack/Makefile libcruft/misc/Makefile \
  libcruft/odepack/Makefile libcruft/ordered-qz/Makefile \
  libcruft/quadpack/Makefile libcruft/ranlib/Makefile \
  libcruft/slatec-fn/Makefile libcruft/slatec-err/Makefile \
  libcruft/villad/Makefile \
  libcruft/blas-xtra/Makefile libcruft/lapack-xtra/Makefile)

AC_OUTPUT_COMMANDS([chmod +x install-octave])

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

if test -z "$F77"; then
  FORT="$F2C $F2CFLAGS"
else
  FORT="$F77 $FFLAGS"
fi

AC_MSG_RESULT([

Octave is now configured for $canonical_host_type

  Source directory:     $srcdir
  Installation prefix:  $prefix
  C compiler:           $CC $XTRA_CFLAGS $CFLAGS
  C++ compiler:         $CXX $XTRA_CXXFLAGS $CXXFLAGS
  Fortran compiler:     $FORT
  Fortran libraries:    $FLIBS
  Use GNU readline:     $USE_READLINE
  Default pager:        $DEFAULT_PAGER
  gnuplot:              $GNUPLOT_BINARY

  Do internal array bounds checking:       $BOUNDS_CHECKING
  Build static libraries:                  $STATIC_LIBS
  Build shared libraries:                  $SHARED_LIBS
  Minimal kernel option:                   $OCTAVE_LITE
  Dynamic Linking (dlopen/dlsym):          $WITH_DL
  Dynamic Linking (shl_load/shl_findsym):  $WITH_SHL
  Include support for GNU readline:        $USE_READLINE
])

warn_msg_printed=false

if test -n "$warn_f77_and_g77"; then
  AC_MSG_WARN($warn_f77_and_g77)
  warn_msg_printed=true
fi

if test -n "$warn_f2c_and_f77"; then
  AC_MSG_WARN($warn_f2c_and_f77)
  warn_msg_printed=true
fi

if test -n "$warn_f2c_and_g77"; then
  AC_MSG_WARN($warn_f2c_and_g77)
  warn_msg_printed=true
fi

if test -n "$gxx_only"; then
  AC_MSG_WARN($gxx_only)
  warn_msg_printed=true
fi

if test -n "$warn_gcc_version"; then
  AC_MSG_WARN($warn_gcc_version)
  warn_msg_printed=true
fi

if test -n "$warn_gcc_only"; then
  AC_MSG_WARN($warn_gcc_only)
  warn_msg_printed=true
fi

if test -n "$warn_f2c_no_lib"; then
  AC_MSG_WARN($warn_f2c_no_lib)
  warn_msg_printed=true
fi

if test -n "$warn_termlibs"; then
  AC_MSG_WARN($warn_termlibs)
  warn_msg_printed=true
fi

if test -n "$warn_gperf"; then
  AC_MSG_WARN($warn_gperf)
  warn_msg_printed=true
fi

if test -n "$warn_flex"; then
  AC_MSG_WARN($warn_flex)
  warn_msg_printed=true
fi

if test -n "$warn_bison"; then
  AC_MSG_WARN($warn_bison)
  warn_msg_printed=true
fi

if test -n "$warn_less"; then
  AC_MSG_WARN($warn_less)
  warn_msg_printed=true
fi

if test -n "$warn_runtest"; then
  AC_MSG_WARN($warn_runtest)
  warn_msg_printed=true
fi

if test -n "$warn_gnuplot"; then

  ## If you change this text, be sure to also change the corresponding
  ## set of warnings above.

  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.])
  AC_MSG_WARN([])
  AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can])
  AC_MSG_WARN([tell Octave where to find it by typing the command])
  AC_MSG_WARN([])
  AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"])
  AC_MSG_WARN([])
  AC_MSG_WARN([at the Octave prompt.])
  warn_msg_printed=true
fi

if $warn_msg_printed; then
  AC_MSG_RESULT([])
fi

### End of configure.