view configure.in @ 300:44512e56188e

[project @ 1994-01-17 20:29:29 by jwe]
author jwe
date Mon, 17 Jan 1994 20:29:29 +0000
parents 9f0bbc75741f
children b4b96eaaffa1
line wrap: on
line source

dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT([[src]]/octave.cc)dnl
AC_CONFIG_HEADER(config.h)dnl

root_srcdir=$srcdir
AC_SUBST(root_srcdir)dnl

AC_DEFINE(OCTAVE_SOURCE, 1)dnl

# See if we were given the target host type.  If not, guess.

if test $# -gt 0; then
  TARGET=`eval echo $\{\`echo $#\`\}`
  case $TARGET in
    -*) target_host_type= ;;
    *) target_host_type=$TARGET ;;
  esac
fi

if test -z "$target_host_type" -o "$target_host_type" = unknown; then
  target_host_type=`sh $srcdir/config.guess`
  if test -z "$target_host_type"; then
    echo "warning: unable to guess system type"
    target_host_type=unknown
  fi
fi

canonical_host_type=`sh $srcdir/config.sub $target_host_type 2>&1`
status=$?
if test $status -eq 0; then
  echo "configuring Octave for a $target_host_type"
else
  canonical_host_type=unknown
  echo "configuring Octave for an unknown system type"
fi
AC_SUBST(target_host_type)dnl

# Set up to handle --with-FOO options.

AC_WITH(f2c, use_f2c=true, use_f2c=false)dnl
AC_WITH(dld, use_dld=true, use_dld=false)dnl

DYNAMIC_LD_OBJ=
DLD_DIR=
LIBDLD=
DLD_OBJECTS='$(DLD_OBJECTS)'
LD_STATIC_FLAG=
if $use_dld; then
  DYNAMIC_LD_OBJ='dynamic-ld.o'
  DLD_DIR=dld
  LIBDLD='../libdld.a'
  DLD_OBJECTS= : # don't link them in if doing dynamic linking
  AC_DEFINE(WITH_DLD, 1)dnl
  LD_STATIC_FLAG=-static
fi
AC_SUBST(DYNAMIC_LD_OBJ)dnl
AC_SUBST(DLD_DIR)dnl
AC_SUBST(LIBDLD)dnl
AC_SUBST(DLD_OBJECTS)dnl
AC_SUBST(LD_STATIC_FLAG)dnl

echo "checking for npsol"
if test -f $srcdir/libcruft/npsol/npsol.f; then
  :
else
  AC_DEFINE(NPSOL_MISSING, 1)dnl
fi

echo "checking for qpsol"
if test -f $srcdir/libcruft/qpsol/qpsol.f; then
  :
else
  AC_DEFINE(QPSOL_MISSING, 1)dnl
fi

echo "checking for fsqp"
if test -f $srcdir/libcruft/fsqp/fsqpd.f; then
  :
else
  AC_DEFINE(FSQP_MISSING, 1)dnl
fi

AC_PROG_CC
AC_GCC_TRADITIONAL
AC_MINIX
AC_ISC_POSIX
AC_AIX
AC_DYNIX_SEQ
AC_ALLOCA
AC_CONST

# Do special things for gcc.

case "$CC" in
  gcc* | */gcc*)
    CFLAGS="-g -O -Wall"
    LDFLAGS="-g -O"
    gcc_version=`gcc -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'`
    case "$gcc_version" in
      1.*)
        cat << EOF
warning: gcc version $gcc_version is likely to cause problems --
         you should probably consider getting version 2.x
EOF
        ;;
    esac
    ;;
  *)
    cat << EOF
warning: found environment variable CC = \`$CC'.  If this is not a
         derivative of GCC, you should probably consider using GCC
         version 2.x instead.
EOF
    CFLAGS="-g"
    LDFLAGS="-g"
    ;;
esac
AC_SUBST(CFLAGS)dnl
AC_SUBST(LDFLAGS)dnl

AC_PROGRAM_CHECK(CXX, g++, g++, [])dnl
if test "$CXX" = g++ ; then
  CXXFLAGS="-g -O -Wall"
  gxx_version=`g++ -v 2>&1 | grep "^g.. version" | sed 's/^g.. version *//'`
  case "$gxx_version" in
    1.*)
      cat << EOF
warning: g++ version $gxx_version is likely to cause problems --
         you should probably consider getting version 2.x
EOF
      ;;
    2.5.*|2.6.*|2.7.*|2.8.*|2.9.*)
      EXTERNAL_TEMPLATES="-fexternal-templates"
      AC_DEFINE(USE_EXTERNAL_TEMPLATES, 1)dnl
      ;;
    esac
else
  cat << EOF
warning: Octave has only been tested with g++, and I can't
         seem to find it.
EOF
fi
AC_SUBST(CXXFLAGS)dnl
AC_SUBST(EXTERNAL_TEMPLATES)dnl

# If we haven't been forced to use f2c, try to find a Fortran compiler
# under any one of several common Un*x Fortran compiler names. 
# Put fc last to avoid confusion with some vendor's /bin/sh fc
# builtin.
#
#    g77 : GNU Fortran (someday...)
#    xlf : IBM / AIX
#   cf77 : Cray / Unicos
#     fc : Convex
#
# I don't think the Cray compiler will ever work like f2c...

if $use_f2c; then
  true
else
  F77=
  AC_PROGRAMS_CHECK(F77, g77 xlf cf77 f77 fc)dnl

  # If it looks like we have a Fortran compiler, try to determine
  # whether it might be compatible with f2c.

  if test -n "$F77"; then
    echo "checking $F77/f2c compatibility"
    export F77
    export CC
    tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh`
    status=$?
    if test $status -eq 0; then
      if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then
        AC_DEFINE(F77_APPEND_UNDERSCORE, 1)dnl
      fi
    else
      F77=
    fi
  fi
fi

# If we can't find a Fortran compiler, or if it looks like it isn't
# compatible with f2c, try to find f2c.

if test -z "$F77"; then
  AC_PROGRAM_CHECK(F2C, f2c, f2c, [])dnl
fi

F2CFLAGS=
FFLAGS="-O"
if test -n "$F77"; then
  export F77
  FLIBS=`sh $srcdir/flibs.sh`
  DOT_O_DOT_F_C1=
  DOT_O_DOT_F_C2=
  DOT_O_DOT_F_C3=
  DOT_O_DOT_F_C4=
  DEFAULT_DOT_C_FROM_DOT_F=
  DEFAULT_DOT_O_FROM_DOT_F=
elif test -n "$F2C" || $use_f2c; then
  AC_HAVE_LIBRARY(f2c, FLIBS=-lf2c, [])dnl
  if test -z "$FLIBS" ; then
    AC_HAVE_LIBRARY(F77, FLIBS=-lF77, [])dnl
    if test -n "$FLIBS" ; then
      AC_HAVE_LIBRARY(I77, FLIBS="$FLIBS -lI77", [])dnl
    fi
  fi
  if test -z "$FLIBS" ; then
    cat << EOF
warning: I found f2c but I couldn't find libf2c.a, or
         libF77.a and libI77.a
EOF
  fi
DEFAULT_DOT_C_FROM_DOT_F='# A rule for making C source from Fortran source.\
# If we are using f2c we should also turn off the default rule for\
# making objects from .f files so that we do not invoke the fortran\
# compiler by mistake.\
\
\%.c : \%.f\
	cat $< | $(F2C) $(F2CFLAGS) > $(@F)'
  DEFAULT_DOT_O_FROM_DOT_F='\%.o : \%.f'
  AC_DEFINE(F77_APPEND_UNDERSCORE, 1)dnl
else
  cat << EOF
warning: in order to build octave, you must have a compatible
         Fortran compiler or f2c installed and in your path.
         See the file INSTALL for more information.
         Continuing anyway...
EOF
fi

AC_SUBST(FFLAGS)dnl
AC_SUBST(FLIBS)dnl
AC_SUBST(F2C)dnl
AC_SUBST(F2CFLAGS)dnl
AC_SUBST(DEFAULT_DOT_C_FROM_DOT_F)dnl
AC_SUBST(DEFAULT_DOT_O_FROM_DOT_F)dnl

AC_PROG_INSTALL
AC_PROG_RANLIB
AC_STDC_HEADERS
AC_HAVE_HEADERS(string.h varargs.h unistd.h)
AC_HAVE_HEADERS(sys/time.h sys/fcntl.h sys/ttold.h sys/ptem.h sys/select.h)
AC_DIR_HEADER
AC_HAVE_FUNCS(setvbuf getcwd bzero rindex vfprintf vsprintf)
AC_HAVE_FUNCS(strcasecmp strncasecmp)
AC_STRUCT_TM
AC_SETVBUF_REVERSED
TERMLIBS=""
for termlib in termcap terminfo curses termlib ; do
  AC_HAVE_LIBRARY(${termlib}, [TERMLIBS="${TERMLIBS} -l${termlib}"])
  case "${TERMLIBS}" in
    *-l${termlib}*)
      break
    ;;
  esac
done
AC_SUBST(TERMLIBS)

# For now, don't define LEXLIB to be -lfl -- we don't use anything in
# it, and it might not be installed.
#
# Also make sure that we generate an interactive scanner if we are
# using flex.

AC_PROG_LEX
case "$LEX" in
  flex*)
    LFLAGS="-t -I"
    LEXLIB=
  ;;
  *)
    LFLAGS="-t"
    cat << EOF
warning: I didn't find flex, but that's only a problem
         if you need to reconstruct lex.cc
EOF
  ;;
esac
AC_SUBST(LFLAGS)dnl

AC_PROG_YACC
case "$YACC" in
  bison*)
  ;;
  *)
    cat << EOF
warning: I didn't find bison, but that's only a problem
         if you need to reconstruct parse.cc
EOF
  ;;
esac

# Define VOID_SIGHANDLER for readline.

AC_RETSIGTYPE
case "$RETSIGTYPE" in
  int)
  ;;
  *)
    VOID_SIGHANDLER="-DVOID_SIGHANDLER=1"
  ;;
esac
AC_SUBST(VOID_SIGHANDLER)dnl

# Use sgtty on Ultrix so that using DEC Migrate to convert a Mips
# binary to an Alpha binary will work.

case "$canonical_host_type" in
  mips-dec-ultrix*)
    AC_HEADER_CHECK(sgtty.h, AC_DEFINE(HAVE_SGTTY_H, 1), [])dnl
  ;;
esac

case "$DEFS" in
  *HAVE_SGTTY_H*)
  ;;
  *)
    AC_HEADER_CHECK(termios.h, AC_DEFINE(HAVE_TERMIOS_H, 1),
      AC_HEADER_CHECK(termio.h, AC_DEFINE(HAVE_TERMIO_H, 1),
        AC_HEADER_CHECK(sgtty.h, AC_DEFINE(HAVE_SGTTY_H, 1), [])))dnl

    case "$DEFS" in
      *HAVE_TERMIOS_H* | *HAVE_TERMIO_H* | *HAVE_SGTTY_H*)
      ;;
      *)
        cat << EOF
error: I couldn't find termios.h, termio.h, or sgtty.h, and I can't
       continue without them.  To compile Octave, your system must
       have at least one of these header files.
EOF
        exit 1
      ;;
    esac
  ;;
esac

# Check to see if we have IEEE math functions, and if so, which ones.
#
# Also check for some additional trig functions that aren't ANSI but
# are often available.  If they are missing, we try to replace them
# with functions from the BSD/NET2 math library.

AC_HAVE_LIBRARY(-lm)dnl
AC_HAVE_FUNCS(finite isnan isinf)dnl
AC_REPLACE_FUNCS(acosh asinh atanh)dnl

if test -n "$LIBOBJS"; then
  for func in $LIBOBJS
  do
    case "$func" in
      *acosh.o*)
	AC_DEFINE(ACOSH_MISSING, 1)dnl
	;;
      *asinh.o*)
	AC_DEFINE(ASINH_MISSING, 1)dnl
	;;
      *atanh.o*)
	AC_DEFINE(ATANH_MISSING, 1)dnl
	;;
    esac
  done

  case $LIBOBJS in
    *acosh.o* | *asinh.o*)
      AC_REPLACE_FUNCS(copysign)dnl
      ;;
  esac

  case $LIBOBJS in
    *acosh.o* | *asinh.o* | *atanh.o*)
      AC_REPLACE_FUNCS(log1p)dnl
      ;;
  esac

  case $LIBOBJS in
    *log1p*)
      AC_REPLACE_FUNCS(log__L)dnl
      ;;
  esac

  case $LIBOBJS in
    *log1p*)
      AC_REPLACE_FUNCS(finite)dnl
      ;;
  esac

  case $LIBOBJS in
    *copysign* | *finite* | *log1p*)
      AC_REPLACE_FUNCS(logb scalb)dnl
      ;;
  esac
fi

AC_PROGRAM_CHECK(GNUPLOT_BINARY, gnuplot, gnuplot, [])dnl
if test -z "$GNUPLOT_BINARY"; then
  cat << EOF
warning: I didn't find gnuplot.  It isn't necessary to have gnuplot
         installed, but you won't be able to use any of Octave's
         plotting commands without it.

         If gnuplot is installed but it isn't in your path, you can
         tell Octave where to find it by typing the command

           gnuplot_binary = '/full/path/to/gnuplot/binary'

         at the Octave prompt.
EOF
fi

AC_PROGRAMS_CHECK(DEFAULT_PAGER, less more page pg, [])dnl
if test -z "$DEFAULT_PAGER"; then
  echo "warning: I couldn't find less(1), more(1), page(1), or pg(1)"
elif test "$DEFAULT_PAGER" = less; then
  DEFAULT_PAGER="less -e"
fi

AC_PROGRAM_CHECK(RUNTEST, runtest, runtest, [])dnl
AC_PROGRAM_CHECK(EXPECT, expect, expect, [])dnl
if test -z "$EXPECT" ; then
  RUNTEST=
fi
AC_SUBST(RUNTEST)dnl

UGLY_DEFS="$DEFS"
AC_SUBST(UGLY_DEFS)dnl

define([tmpa], [libcruft/blas/Makefile libcruft/balgen/Makefile])dnl
define([tmpb], [libcruft/dassl/Makefile libcruft/eispack/Makefile])dnl
define([tmpc], [libcruft/fftpack/Makefile libcruft/fsqp/Makefile])dnl
define([tmpd], [libcruft/lapack/Makefile libcruft/linpack/Makefile])dnl
define([tmpe], [libcruft/minpack/Makefile libcruft/misc/Makefile])dnl
define([tmpf], [libcruft/npsol/Makefile libcruft/odepack/Makefile])dnl
define([tmpg], [libcruft/qpsol/Makefile libcruft/quadpack/Makefile])dnl
define([tmph], [libcruft/ranlib/Makefile libcruft/villad/Makefile])dnl 
define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph])dnl
define([tmpA], [Makefile Makeconf libcruft/Makefile libcruft/Makerules])dnl
define([tmpB], [liboctave/Makefile src/Makefile dld/Makefile])dnl
define([tmpC], [info/Makefile readline/Makefile readline/doc/Makefile])dnl
define([tmpD], [readline/examples/Makefile doc/Makefile])dnl
define([tmpE], [scripts/Makefile test/Makefile])dnl
define([srcdirs], [tmpA tmpB tmpC tmpD tmpE])dnl
AC_OUTPUT([srcdirs cruftdirs])dnl