#!/bin/sh
#
# configure.in
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 14-Jul-1994
#
# PLplot configure script input
#
# This script does a few things that most autoconf-generated scripts do not.
# I resisted going with autoconf for a long time, in favor of a home-rolled
# solution because of (a) certain needs that autoconf didn't appear to meet,
# and (b) PLplot started out as a package with much less demanding needs
# than today.  Eventually the build situation got out of hand, and I took
# the plunge -- all those nice features in autoconf were just too hard to
# resist any longer.  Those areas where I needed to be a bit inventive
# include:
#
# - makefile control flow and file inclusion.  Standard make is braindead in
# this regard.  The problem is how to conditionally enable/disable packages
# in the makefile itself.  GNU make appears to handle this quite well, but I
# have concerns about portability -- I've heard of (and had) problems
# porting it to old versions of Unix, and it's not available under some
# non-Unix systems (notably MSDOS).  Anyhow, there are several ways one can
# simulate active control, and the route I've gone is to include a separate
# file for each capability.  Makefile.in is created by the configure script
# by concatenating the right pieces together.  Not only is this very
# portable, but keeping the target/dependency portion separate allows (a)
# this to be generated automatically e.g. by makedepend without changing any
# other file, and (b) non-Unix ports to share it (important because the
# target/dependency list tends to change a lot).  Since these Makefile
# fragments are just text files, it should be simple enough to string them
# together as desired.
#
# - System-specific settings for ANSI C compiler, Fortran compiler, and
# other non-standard switches (profiling, auto promotion in Fortran,
# optimization levels).  This is handled by a largish case statement over
# system type that I snarfed from my previous configure utils.  A similar
# case statement for building shared libraries was snarfed from the BLT (Tk
# extension package) configure script.
#
# - Faster, site-specific configures.  I have set things up so that most of
# the configure is skipped if the relevant shell variables are set.  Early
# on I try to source a defaults file (cf_plplot.in, both the build directory
# and ~/config are checked) which does this.  The point is, for a given site
# most settings are invariant from one configure to the next, but you might
# want to change things like what packages are enabled, compilers,
# precision, profiling, debugging, etc.  Very useful for development.  Note:
# Autoconf 2.0 and later supports cache files, which are similar in some
# ways but are not really a replacement for this facility.
# ----------------------------------------------------------------------------

# Startup code that needs to be run BEFORE anything in the autogenerated
# configure script is done.  Why isn't there an official way to do this?
# I'm about ready to barf..

# Get system using uname.

system=unknown
uname >/dev/null 2>&1 && system=`uname -s`-`uname -r`

# Fix Cray braindamage

case "$system" in
    sn* )
	system=`uname -m`-`uname -r`
    ;;
esac

# Default settings

with_debug=no
with_opt=yes
with_double=no
with_profile=no
with_shlib=yes
with_f2c=no
with_gcc=no
with_warn=no
with_dbmalloc=no
with_fseek=no
with_pkgdir=
with_nobraindead=no

enable_drivers=yes
enable_f77=yes
enable_cxx=yes
enable_python=yes
enable_tcl=yes
enable_tk=yes
enable_itcl=yes
enable_dp=yes
enable_xwin=yes


# Special cases

case "$system" in
    aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
	with_opt=no
    ;;
    BSD/OS* ) 
	with_fseek=yes
	with_gcc=yes
    ;;
    linux*|LINUX*|Linux* ) 
	with_gcc=yes
	with_f2c=yes
    ;;
    next*|NeXT*|NEXT* ) 
	with_gcc=yes
	with_f2c=yes
    ;;
    ultrix*|ULTRIX* ) 
	with_gcc=yes
    ;;
esac

# Source site-specific variables file, if present.  Very nice for setting up
# site-specific defaults or for reducing the time spent configuring.
#
# This MUST MUST MUST be done before command-line flags are handled (i.e.
# before expanding ac_init) so that the user can override if necessary.

with_defaults=yes
for option
    do
    case "$option" in
	-with-defaults | --with-defaults | -with-defaults=yes | --with-defaults=yes )
	    with_defaults=yes
	;;
	-without-defaults | --without-defaults | -with-defaults=no | --with-defaults=no )
	    with_defaults=no
	;;
    esac
done

if test "$with_defaults" = "no"; then
    echo "Performing full configure."
else
    initfile="./cf_plplot.in"
    if test -f $initfile; then
	echo "Getting default settings from $initfile."
	. $initfile
    else
	initfile="$HOME/config/cf_plplot.in"
	if test -f $initfile; then
	    echo "Getting default settings from $initfile."
	    . $initfile
	else
	    echo "No defaults file found, performing full configure."
	fi
    fi
fi

#! /bin/sh

# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.12 
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.

# Defaults:
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
  --with-defaults         source defaults file at startup (yes)"
ac_help="$ac_help
  --with-debug            compile with debugging ($with_debug)"
ac_help="$ac_help
  --with-opt              compile with optimization ($with_opt)"
ac_help="$ac_help
  --with-double           use double precision floats ($with_double)"
ac_help="$ac_help
  --with-profile          turn on profiling option ($with_profile)"
ac_help="$ac_help
  --with-shlib            build shared libraries ($with_shlib)"
ac_help="$ac_help
  --with-f2c              use f2c to compile Fortran code ($with_f2c)"
ac_help="$ac_help
  --with-gcc              use gcc to compile C and C++ code ($with_gcc)"
ac_help="$ac_help
  --with-warn             enable all compilation warnings ($with_warn)"
ac_help="$ac_help
  --with-dbmalloc         link with libdbmalloc ($with_dbmalloc)"
ac_help="$ac_help
  --with-pkgdir=DIR       locate libraries and includes under DIR"
ac_help="$ac_help
  --with-fseek            use fseek/ftell rather than fsetpos/fgetpos ($with_fseek)"
ac_help="$ac_help
  --enable-f77            compile Fortran-77 interface code ($enable_f77)"
ac_help="$ac_help
  --enable-cxx            compile C++ interface code ($enable_cxx)"
ac_help="$ac_help
  --enable-python         compile python interface code ($enable_python)"
ac_help="$ac_help
  --enable-tcl            compile Tcl interface code ($enable_tcl)"
ac_help="$ac_help
  --enable-itcl           enable incr Tcl interface code ($enable_itcl)"
ac_default_prefix=/usr/local/plplot
ac_help="$ac_help
  --with-x                use the X Window System"
ac_help="$ac_help
  --enable-plmeta         enable plmeta device driver ($enable_plmeta)"
ac_help="$ac_help
  --enable-null           enable null device driver ($enable_null)"
ac_help="$ac_help
  --enable-xterm          enable xterm device driver ($enable_xterm)"
ac_help="$ac_help
  --enable-tek4010        enable tek4010 device driver ($enable_tek4010)"
ac_help="$ac_help
  --enable-tek4107        enable tek4107 device driver ($enable_tek4107)"
ac_help="$ac_help
  --enable-mskermit       enable mskermit device driver ($enable_mskermit)"
ac_help="$ac_help
  --enable-conex          enable conex device driver ($enable_conex)"
ac_help="$ac_help
  --enable-linuxvga       enable linuxvga device driver ($enable_linuxvga)"
ac_help="$ac_help
  --enable-vlt            enable vlt device driver ($enable_vlt)"
ac_help="$ac_help
  --enable-versaterm      enable versaterm device driver ($enable_versaterm)"
ac_help="$ac_help
  --enable-dg300          enable dg300 device driver ($enable_dg300)"
ac_help="$ac_help
  --enable-ps             enable ps device driver ($enable_ps)"
ac_help="$ac_help
  --enable-xfig           enable xfig device driver ($enable_xfig)"
ac_help="$ac_help
  --enable-ljii           enable ljii device driver ($enable_ljii)"
ac_help="$ac_help
  --enable-hp7470         enable hp7470 device driver ($enable_hp7470)"
ac_help="$ac_help
  --enable-hp7580         enable hp7580 device driver ($enable_hp7580)"
ac_help="$ac_help
  --enable-lj_hpgl        enable lj_hpgl device driver ($enable_lj_hpgl)"
ac_help="$ac_help
  --enable-imp            enable imp device driver ($enable_imp)"
ac_help="$ac_help
  --enable-xwin           enable xwin device driver ($enable_xwin)"
ac_help="$ac_help
  --enable-tk             enable tk device driver ($enable_tk)"
ac_help="$ac_help
  --enable-dp             enable dp device driver ($enable_dp)"
ac_help="$ac_help
  --enable-pbm            enable pbm device driver ($enable_pbm)"

# Initialize some variables set by options.
# The variables have the same names as the options, with
# dashes changed to underlines.
build=NONE
cache_file=./config.cache
exec_prefix=NONE
host=NONE
no_create=
nonopt=NONE
no_recursion=
prefix=NONE
program_prefix=NONE
program_suffix=NONE
program_transform_name=s,x,x,
silent=
site=
srcdir=
target=NONE
verbose=
x_includes=NONE
x_libraries=NONE
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
infodir='${prefix}/info'
mandir='${prefix}/man'

# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12

ac_prev=
for ac_option
do

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

  case "$ac_option" in
  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) ac_optarg= ;;
  esac

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

  case "$ac_option" in

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

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

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

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

  -disable-* | --disable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    eval "enable_${ac_feature}=no" ;;

  -enable-* | --enable-*)
    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
    fi
    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
    case "$ac_option" in
      *=*) ;;
      *) ac_optarg=yes ;;
    esac
    eval "enable_${ac_feature}='$ac_optarg'" ;;

  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
  | --exec | --exe | --ex)
    ac_prev=exec_prefix ;;
  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
  | --exec=* | --exe=* | --ex=*)
    exec_prefix="$ac_optarg" ;;

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

  -help | --help | --hel | --he)
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat << EOF
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
  --cache-file=FILE       cache test results in FILE
  --help                  print this message
  --no-create             do not create output files
  --quiet, --silent       do not print \`checking...' messages
  --version               print the version of autoconf that created configure
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [$ac_default_prefix]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [same as prefix]
  --bindir=DIR            user executables in DIR [EPREFIX/bin]
  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
  --datadir=DIR           read-only architecture-independent data in DIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
                          [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
  --includedir=DIR        C header files in DIR [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
  --infodir=DIR           info documentation in DIR [PREFIX/info]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --srcdir=DIR            find the sources in DIR [configure dir or ..]
  --program-prefix=PREFIX prepend PREFIX to installed program names
  --program-suffix=SUFFIX append SUFFIX to installed program names
  --program-transform-name=PROGRAM
                          run sed PROGRAM on installed program names
EOF
    cat << EOF
Host type:
  --build=BUILD           configure for building on BUILD [BUILD=HOST]
  --host=HOST             configure for HOST [guessed]
  --target=TARGET         configure for TARGET [TARGET=HOST]
Features and packages:
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --x-includes=DIR        X include files are in DIR
  --x-libraries=DIR       X library files are in DIR
EOF
    if test -n "$ac_help"; then
      echo "--enable and --with options recognized:$ac_help"
    fi
    exit 0 ;;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  -program-transform-name | --program-transform-name \
  | --program-transform-nam | --program-transform-na \
  | --program-transform-n | --program-transform- \
  | --program-transform | --program-transfor \
  | --program-transfo | --program-transf \
  | --program-trans | --program-tran \
  | --progr-tra | --program-tr | --program-t)
    ac_prev=program_transform_name ;;
  -program-transform-name=* | --program-transform-name=* \
  | --program-transform-nam=* | --program-transform-na=* \
  | --program-transform-n=* | --program-transform-=* \
  | --program-transform=* | --program-transfor=* \
  | --program-transfo=* | --program-transf=* \
  | --program-trans=* | --program-tran=* \
  | --progr-tra=* | --program-tr=* | --program-t=*)
    program_transform_name="$ac_optarg" ;;

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

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

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

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

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

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

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

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

  -version | --version | --versio | --versi | --vers)
    echo "configure generated by autoconf version 2.12"
    exit 0 ;;

  -with-* | --with-*)
    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    case "$ac_option" in
      *=*) ;;
      *) ac_optarg=yes ;;
    esac
    eval "with_${ac_package}='$ac_optarg'" ;;

  -without-* | --without-*)
    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
    # Reject names that are not valid shell variable names.
    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
    fi
    ac_package=`echo $ac_package| sed 's/-/_/g'`
    eval "with_${ac_package}=no" ;;

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

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

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

  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
    ;;

  *)
    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
      echo "configure: warning: $ac_option: invalid host type" 1>&2
    fi
    if test "x$nonopt" != xNONE; then
      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
    fi
    nonopt="$ac_option"
    ;;

  esac
done

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

trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15

# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 3 some systems may open it to /dev/tty
# 4 used on the Kubota Titan
# 6 checking for... messages and results
# 5 compiler messages saved in config.log
if test "$silent" = yes; then
  exec 6>/dev/null
else
  exec 6>&1
fi
exec 5>./config.log

echo "\
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
" 1>&5

# Strip out --no-create and --no-recursion so they do not pile up.
# Also quote any args containing shell metacharacters.
ac_configure_args=
for ac_arg
do
  case "$ac_arg" in
  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
  | --no-cr | --no-c) ;;
  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
  esac
done

# NLS nuisances.
# Only set these to C if already set.  These must not be set unconditionally
# because not all systems understand e.g. LANG=C (notably SCO).
# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
# Non-C LC_CTYPE values break the ctype check.
if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi

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

# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
ac_unique_file=src/plcore.c

# Find the source files, if location was not specified.
if test -z "$srcdir"; then
  ac_srcdir_defaulted=yes
  # Try the directory containing this script, then its parent.
  ac_prog=$0
  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
  srcdir=$ac_confdir
  if test ! -r $srcdir/$ac_unique_file; then
    srcdir=..
  fi
else
  ac_srcdir_defaulted=no
fi
if test ! -r $srcdir/$ac_unique_file; then
  if test "$ac_srcdir_defaulted" = yes; then
    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
  else
    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
  fi
fi
srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`

# Prefer explicitly selected file to automatically selected ones.
if test -z "$CONFIG_SITE"; then
  if test "x$prefix" != xNONE; then
    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
  else
    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
  fi
fi
for ac_site_file in $CONFIG_SITE; do
  if test -r "$ac_site_file"; then
    echo "loading site script $ac_site_file"
    . "$ac_site_file"
  fi
done


ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross

if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    ac_n= ac_c='
' ac_t='	'
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi



# ----------------------------------------------------------------------------
# The configure script must be run in a separate build directory.  If the
# user instead runs it from the top-level directory, the code below cd's to
# tmp and exec's ../configure, in effect running configure from the build
# directory after all.
#
# In fact, configure can be run from a separate build directory anywhere,
# leaving the original source tree untouched if that is so desired.  This
# allows one to build from Read-Only media (e.g. CDROM) or create multiple
# build directories at once, each with different options.  Softlinks to all
# source files are used to create the "monolithic build directory".  With
# the PLplot distribution spread out over so many directories, I've found
# this paradigm to be the easiest for me to use during development while
# remaining widely portable.  On systems that don't support softlinks, you
# can always use copy.  At least you will only have to do it once.
# ----------------------------------------------------------------------------

plplot_config_invocation="$0 $*"
if test `pwd` = `(cd $srcdir; pwd)`; then
    echo "setting up to configure in tmp directory -- hold on..."
    if test ! -d tmp; then
	mkdir tmp
    fi
    cd tmp
    exec ../configure "$@"
    plplot_config_invocation="$0 $*"
fi

# ----------------------------------------------------------------------------
# Set up defaults and command line args.
# ----------------------------------------------------------------------------

# Can't really do this yet, b/c if we fail to find something, then
# enable_xxx will be set to no, but we will have already set it to
# yes.  So, comment this out and put it down further in the file.


if test "$system" ; then
    echo "$ac_t""system is: $system" 1>&6
fi

# Check whether --with-defaults or --without-defaults was given.
withval="$with_defaults"
if test -n "$withval"; then
  :
fi
# Check whether --enable-defaults or --disable-defaults was given.
enableval="$enable_defaults"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_defaults" 1>&2; exit 1; }
fi


# Check whether --with-debug or --without-debug was given.
withval="$with_debug"
if test -n "$withval"; then
  :
fi
# Check whether --enable-debug or --disable-debug was given.
enableval="$enable_debug"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_debug" 1>&2; exit 1; }
fi


# Check whether --with-opt or --without-opt was given.
withval="$with_opt"
if test -n "$withval"; then
  :
fi
# Check whether --enable-opt or --disable-opt was given.
enableval="$enable_opt"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_opt" 1>&2; exit 1; }
fi


# Check whether --with-double or --without-double was given.
withval="$with_double"
if test -n "$withval"; then
  :
fi
# Check whether --enable-double or --disable-double was given.
enableval="$enable_double"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_double" 1>&2; exit 1; }
fi


# Check whether --with-profile or --without-profile was given.
withval="$with_profile"
if test -n "$withval"; then
  :
fi
# Check whether --enable-profile or --disable-profile was given.
enableval="$enable_profile"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_profile" 1>&2; exit 1; }
fi


# Check whether --with-shlib or --without-shlib was given.
withval="$with_shlib"
if test -n "$withval"; then
  :
fi
# Check whether --enable-shlib or --disable-shlib was given.
enableval="$enable_shlib"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_shlib" 1>&2; exit 1; }
fi


# Check whether --with-f2c or --without-f2c was given.
withval="$with_f2c"
if test -n "$withval"; then
  :
fi
# Check whether --enable-f2c or --disable-f2c was given.
enableval="$enable_f2c"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_f2c" 1>&2; exit 1; }
fi


# Check whether --with-gcc or --without-gcc was given.
withval="$with_gcc"
if test -n "$withval"; then
  :
fi
# Check whether --enable-gcc or --disable-gcc was given.
enableval="$enable_gcc"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_gcc" 1>&2; exit 1; }
fi


# Check whether --with-warn or --without-warn was given.
withval="$with_warn"
if test -n "$withval"; then
  :
fi
# Check whether --enable-warn or --disable-warn was given.
enableval="$enable_warn"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_warn" 1>&2; exit 1; }
fi


# Check whether --with-dbmalloc or --without-dbmalloc was given.
withval="$with_dbmalloc"
if test -n "$withval"; then
  :
fi
# Check whether --enable-dbmalloc or --disable-dbmalloc was given.
enableval="$enable_dbmalloc"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_dbmalloc" 1>&2; exit 1; }
fi


# Check whether --with-pkgdir or --without-pkgdir was given.
withval="$with_pkgdir"
if test -n "$withval"; then
  :
fi
# Check whether --enable-pkgdir or --disable-pkgdir was given.
enableval="$enable_pkgdir"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_pkgdir" 1>&2; exit 1; }
fi


# Check whether --with-fseek or --without-fseek was given.
withval="$with_fseek"
if test -n "$withval"; then
  :
fi
# Check whether --enable-fseek or --disable-fseek was given.
enableval="$enable_fseek"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_fseek" 1>&2; exit 1; }
fi


# Check whether --with-nobraindead or --without-nobraindead was given.
withval="$with_nobraindead"
if test -n "$withval"; then
  :
fi
# Check whether --enable-nobraindead or --disable-nobraindead was given.
enableval="$enable_nobraindead"
if test -n "$enableval"; then
  { echo "configure: error: unrecognized variable: enable_nobraindead" 1>&2; exit 1; }
fi


# Check whether --enable-f77 or --disable-f77 was given.
enableval="$enable_f77"
if test -n "$enableval"; then
  :
fi
# Check whether --with-f77 or --without-f77 was given.
withval="$with_f77"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_f77" 1>&2; exit 1; }
fi


# Check whether --enable-cxx or --disable-cxx was given.
enableval="$enable_cxx"
if test -n "$enableval"; then
  :
fi
# Check whether --with-cxx or --without-cxx was given.
withval="$with_cxx"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_cxx" 1>&2; exit 1; }
fi


# Check whether --enable-python or --disable-python was given.
enableval="$enable_python"
if test -n "$enableval"; then
  :
fi
# Check whether --with-python or --without-python was given.
withval="$with_python"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_python" 1>&2; exit 1; }
fi


# Check whether --enable-tcl or --disable-tcl was given.
enableval="$enable_tcl"
if test -n "$enableval"; then
  :
fi
# Check whether --with-tcl or --without-tcl was given.
withval="$with_tcl"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_tcl" 1>&2; exit 1; }
fi


# Check whether --enable-itcl or --disable-itcl was given.
enableval="$enable_itcl"
if test -n "$enableval"; then
  :
fi
# Check whether --with-itcl or --without-itcl was given.
withval="$with_itcl"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_itcl" 1>&2; exit 1; }
fi


# Set driver enable values
#
# You can enable/disable drivers either by the command line
# (--enable-<driver> or --disable-<driver>) or via the cf_plplot.in file
# (remember to use underscores instead of dashes here).  You can disable
# all drivers by default by using --disable-drivers.

# Special cases

case $system in
    Linux* )
	if test -z "$enable_linuxvga"; then
 	   enable_linuxvga=$enable_drivers
	fi
    ;;
    * )
	enable_linuxvga="no"
    ;;
esac


# ----------------------------------------------------------------------------
# Set up prefix
#
# The prefix is set using the following algorithm:
#
#	via the command line: --prefix=<value>
#	via the shell variable "pl_prefix", set in the defaults file
#	via the directory "plrender" currently is located in
#
# If still not set, prefix defaults to /usr/local/plplot.
#
# I recommend using a separate directory tree for PLplot files.  You can
# use the "mklinks" script for soft-linking the bin, lib, and include
# files to the usual places under /usr/local or /usr.  See the discussion
# of this in the FAQ for more info.
# ----------------------------------------------------------------------------


if test "$prefix" = NONE; then
    if test -z "$pl_prefix"; then
	if test "$prefix" = NONE; then
  echo $ac_n "checking for prefix by location of plrender""... $ac_c" 1>&6
echo "configure:1053: checking for prefix by location of plrender" >&5
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="$IFS:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test $ac_dir != . && test -f $ac_dir/plrender; then
      # Not all systems have dirname.
      prefix=`ls -l $ac_dir/plrender | awk '{print $NF}'`
      prefix=`echo $prefix | sed 's%/[^/][^/]*$%%'`
      dirname=`echo $prefix | sed 's%/.*/%%'`
      if test $dirname = "bin"; then
        prefix=`echo $prefix | sed 's%/[^/][^/]*$%%'`
	echo "$ac_t""$prefix" 1>&6
      else
	echo "$ac_t""$prefix" 1>&6
	echo "$ac_t""warning: non-standard installed distribution (plrender not stored under bin)" 1>&6
	echo "$ac_t""warning: please completely delete old files before installation" 1>&6
      fi
      break
    fi
  done
  if test "$prefix" = NONE; then
    echo "$ac_t""not found -- using default" 1>&6
  fi
  IFS="$ac_save_ifs"
fi

    else
	prefix="$pl_prefix"
    fi
fi

# ----------------------------------------------------------------------------
# This is where the real work is done.
# ----------------------------------------------------------------------------

LIBS=""
INCS=""

# --*-sh-*--------------------------------------------------------------------
#
# sysconf.in
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 14-Jul-1994
#
# This script sets up config variables for a Unix-like system.
# The stuff set here is very system-specific and not easy to automate.
# Believe me, I wish it were!  Stuff like compiler names (ANSI C, Fortran)
# and options are set here.
#
# This treatment is a little bit of overkill for PLplot, but some of it
# comes from other projects, and you never know when it will turn out to
# be useful..
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Configure library recognition for various systems.
# ----------------------------------------------------------------------------

LIBEXTNS="a"

case "$system" in 
#    aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
#	CC=xlc
#    ;;
    alpha*|ALPHA*|Alpha*|OSF* ) 
	LIBEXTNS="so a"
    ;;
#    convex*|ConvexOS* ) 
#	CC="cc -std"
#	with_gcc=no
#    ;;
    hp*|HP* ) 
	LIBEXTNS="sl a"
    ;;
    irix*|IRIX*|Irix*|sgi*|SGI* ) 
	LIBEXTNS="so a"
    ;;
    Linux* )
	LIBEXTNS="so a"
    ;;
#    SunOS-4* )
#	CC=acc
#    ;;
esac

# ----------------------------------------------------------------------------
# Compiler/linker variables
#
# The following shell variables are used.  They can be redefined as
# appropriate for specific systems.
#
# CXX		The only compiler worth using.
# CC		ANSI C compiler
# OCC		Traditional C compiler
# F77		Fortran 77 compiler
# LDC		Linker for C programs
# LDF		Linker for Fortran programs
#
# The following are only set if the appropriate capability is selected,
# otherwise are null.  I need to specify one for each compiler used for
# full generality (on some systems the syntax may differ slightly between
# them).  Each is tagged with:
#
#	_C	for the C compiler
#	_CXX	for the C++ compiler
#	_F	for the Fortran 77 compiler
#	_LC	for the C linker
#	_LCXX	for the C++ linker
#	_LF	for the Fortran 77 linker
#
# DEBUG_FLAG	Compile with debugging on
# OPT_FLAG	Compile with optimization on
# DBL_FLAG	Use double-precision
# PROF_FLAG	Compile with profiling on
# SYS_FLAGS	Misc system-specific compiler flags
# ----------------------------------------------------------------------------

# Defaults

M4=m4

# Double precision
# Note that although there is no truly standard way to invoke double
# precision in Fortran from the command line, enough of them use -r8
# that I've decided to make it the default.  

if test "$with_double" = "yes"; then
    DBL_FLAG_C=-DDOUBLE
    DBL_FLAG_CXX=-DDOUBLE
    DBL_FLAG_M4=-DDOUBLE
    DBL_FLAG_F=-r8
fi

# Profiling
# Not a good default for Fortran here, either.

if test "$with_profile" = "yes"; then
    PROF_FLAG_C=-p
    PROF_FLAG_CXX=-p
    PROF_FLAG_LC=-p
fi

# ----------------------------------------------------------------------------
# Set compiler on a system-dependent basis.
# Notes:
#
# - type "configure --with-gcc" to specify gcc from the command line
# - type "configure --with-f2c" to specify f2c from the command line
#
# On some systems, gcc or f2c is the default.  On others, they are not
# supported (e.g. UNICOS, Convex).  The f2c executable is expected to be
# "fc" since some systems may have both programs.  If "fc" can't be found,
# "f77" is tried instead.
#
# On systems where gcc or f2c are actually undesirable (e.g. on Crays --
# gcc isn't ported and why would you want to use f2c?), I set with_gcc
# and/or with_f2c to "no" to prevent their use.
#
# The actual setup for gcc or f2c is done AFTER the case statements.  Done
# this way because they're pretty predictable across platforms, and this
# way we can just override what is set below.  IMPORTANT: the command line
# argument uses a "-" (dash) to separate words, while the shell variable
# uses a "_" (underscore).
# ----------------------------------------------------------------------------

# Set up ANSI C compiler

if test -z "$CC"; then
    CC=cc
    case "$system" in 
	aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
	    CC=xlc
	;;
	alpha*|ALPHA*|Alpha*|OSF* ) 
	    CC="cc -std"
	;;
	convex*|ConvexOS* ) 
	    CC="cc -std"
	    with_gcc=no
	;;
	dg*|DG* ) 
	    CC="cc -ansi"
	;;
	hp*|HP* ) 
	    CC=c89
	;;
	irix*|IRIX*|Irix*|sgi*|SGI* ) 
	    CC="cc"
	    OCC='$(CC)'
	;;
	Linux* )
	    with_gcc=yes
	;;
	SunOS-4* )
	    CC=acc
	;;
	sx*|Sx*|SX*|monte*|Monte*|MONTE* ) 
	    CC="cc -hansi"
	    with_gcc=no
	;;
	CRAY* ) 
	    with_gcc=no
	;;
    esac
fi

# ----------------------------------------------------------------------------
# Set up K&R C compiler

if test -z "$OCC"; then
    OCC=cc
    case "$system" in 
	SunOS-5.* )
	    OCC="cc -Xs"
	;;
    esac
fi

# ----------------------------------------------------------------------------
# Set up C++ compiler
# If gcc has been specified, use that.  Otherwise do NOT use gcc.
# Mixing/matching compilers is best left to the experts.

if test "$with_gcc" = "yes"; then
    if test ! "$enable_cxx" = "no"; then
	enable_cxx=yes
    fi
fi

if test "$enable_cxx" = "yes"; then
    if test -z "$CXX"; then
	if test "$with_gcc" = "yes"; then
	    CXX=gcc
	else
	    CXX=CC
	    case "$system" in
		aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
		    CXX=xlC
		;;
		hp*|HP* ) 
		    CXX="CC +a1"
		;;
	    esac
	fi
    fi
fi

found_cxx=no

# If Kuck and Associates, Inc, Photon C++ is available, use that.

if test "$enable_cxx" = "yes"; then
    # Extract the first word of "KCC", so it can be a program name with args.
set dummy KCC; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1310: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_found_photon'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$found_photon"; then
  ac_cv_prog_found_photon="$found_photon" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_found_photon="yes"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_found_photon" && ac_cv_prog_found_photon="no"
fi
fi
found_photon="$ac_cv_prog_found_photon"
if test -n "$found_photon"; then
  echo "$ac_t""$found_photon" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

    if test "$found_photon" = "yes" ; then
	echo "$ac_t""Found butt-kicking Photon C++, using that!" 1>&6
	CXX=KCC
	found_cxx=yes
    fi
fi

# Try to find C++ compiler.  If not found, switch enable_cxx to "no".

if test "$enable_cxx" = "yes" -a "$found_cxx" = "no"; then
    found_cxx=""
    # Extract the first word of "$CXX", so it can be a program name with args.
set dummy $CXX; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1350: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_found_cxx'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$found_cxx"; then
  ac_cv_prog_found_cxx="$found_cxx" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_found_cxx="yes"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_found_cxx" && ac_cv_prog_found_cxx="no"
fi
fi
found_cxx="$ac_cv_prog_found_cxx"
if test -n "$found_cxx"; then
  echo "$ac_t""$found_cxx" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

    if test "$found_cxx" = "no" ; then
	echo "$ac_t""warning: cannot find C++ compiler, setting enable_cxx=no" 1>&6
	enable_cxx=no
    fi
fi

# ----------------------------------------------------------------------------
# Debugging
# Will disable optimization by default unless using gcc.

if test "$with_debug" = "yes"; then
    if test ! "$with_gcc" = "yes"; then
	with_opt=no
    fi
    DEBUG_FLAG_C=-g
    DEBUG_FLAG_CXX=-g
    DEBUG_FLAG_F=-g
    DEBUG_FLAG_LC=-g
    DEBUG_FLAG_LCXX=-g
    DEBUG_FLAG_LF=-g
fi

# Optimization

if test "$with_opt" = "yes"; then
    OPT_FLAG_C=-O
    OPT_FLAG_CXX=-O
    OPT_FLAG_F=-O
fi

# ----------------------------------------------------------------------------
# Set up Fortran compiler

if test "$enable_f77" = "yes"; then
    if test -z "$F77"; then
	F77=f77
	case "$system" in 
	    aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
		F77=xlf
	    ;;
	    dg*|DG* ) 
		F77=ghf77
	    ;;
	    hp*|HP* ) 
		# The fort77 front-end uses cc-like command line flags.

		F77=fort77
	    ;;
	    sx*|Sx*|SX*|monte*|Monte*|MONTE* ) 
		# The f77 front-end uses cc-like command line flags,
		# but I've had problems with it, so use f77sx here instead.

		F77=f77sx
		with_f2c=no
	    ;;
	    CRAY* ) 
		F77=cf77
		with_f2c=no
	    ;;
	esac
    fi

    # If not using f2c, try locating the executable now.

    if test "$with_f2c" = "no"; then
	# Extract the first word of "$F77", so it can be a program name with args.
set dummy $F77; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1444: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_found_F77'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$found_F77"; then
  ac_cv_prog_found_F77="$found_F77" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_found_F77="yes"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_found_F77" && ac_cv_prog_found_F77="no"
fi
fi
found_F77="$ac_cv_prog_found_F77"
if test -n "$found_F77"; then
  echo "$ac_t""$found_F77" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

	if test "$found_F77" = "no" ; then
	    with_f2c=yes
	fi
    fi
fi

# ----------------------------------------------------------------------------
# gcc
# ----------------------------------------------------------------------------

if test "$with_gcc" = "yes"; then
    CC=gcc
    CXX=gcc
    OCC=gcc
    CPP="gcc -E"

    if test "$with_warn" = "yes"; then
	SYS_FLAGS_C=-Wall
    fi
fi

# ----------------------------------------------------------------------------
# f2c
#
# I give preference to the program "fc" for invoking f2c, since there may
# be a vendor-supplied program called "f77".  Only if "fc" isn't found
# do I fall back to "f77".
#
# The only option supported for f2c is --with-double.
# ----------------------------------------------------------------------------

if test "$enable_f77" = "yes"; then
    if test "$with_f2c" = "yes"; then
	# Extract the first word of "fc", so it can be a program name with args.
set dummy fc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1506: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_found_fc'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$found_fc"; then
  ac_cv_prog_found_fc="$found_fc" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_found_fc="yes"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_found_fc" && ac_cv_prog_found_fc="no"
fi
fi
found_fc="$ac_cv_prog_found_fc"
if test -n "$found_fc"; then
  echo "$ac_t""$found_fc" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

	if test "$found_fc" = "yes" ; then
	    F77=fc
	else
	    # Extract the first word of "f77", so it can be a program name with args.
set dummy f77; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1538: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_found_f77'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$found_f77"; then
  ac_cv_prog_found_f77="$found_f77" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_found_f77="yes"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_found_f77" && ac_cv_prog_found_f77="no"
fi
fi
found_f77="$ac_cv_prog_found_f77"
if test -n "$found_f77"; then
  echo "$ac_t""$found_f77" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

	    if test "$found_f77" = "yes" ; then
		F77=f77
	    else
		echo "$ac_t""warning: cannot find a Fortran compiler, setting enable_f77=no" 1>&6
		with_f2c=no
		enable_f77=no
	    fi
	fi

	DEBUG_FLAG_F=
	OPT_FLAG_F=
	PROF_FLAG_F=
	SYS_FLAGS_F=
    fi
fi

# ----------------------------------------------------------------------------
# Can finally set linker defaults.
# ----------------------------------------------------------------------------

if test -z "$LDC"; then
    LDC="$CC"
fi
if test -z "$LDCXX"; then
    LDCXX="$CXX"
fi
if test -z "$LDF"; then
    LDF="$F77"
fi

# ----------------------------------------------------------------------------
# Now get system-specific compiler flags.
#
# If your Fortran compiler supports auto-promotion to double precision, it
# is best to set DBL_FLAG_F with the appropriate command option.  This is
# only used for the PLplot demo programs -- the Fortran interface uses m4
# to generate single and double precision versions.  So if your compiler
# can't do command-line promotion to double precision, the only loss is
# that you won't be able to run the Fortran demos in double precision.
# ----------------------------------------------------------------------------

case "$system" in 
    aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
	if test "$with_gcc" = "no"; then
	    SYS_FLAGS_CXX=-+
	fi
	if test "$with_double" = "yes" -a "$with_f2c" = "no"; then
	    DBL_FLAG_F="-qAUTODBL=DBLPAD"
	fi
    ;;
    alpha*|ALPHA*|Alpha*|OSF* ) 

	# Note that the c optimize flag is set to -O1, as higher levels of
	# optimization will mess up some diagonal dashed lines.  

	if test "$with_opt" = "yes"; then
	    OPT_FLAG_C=-O1
	fi
    ;;
    convex*|ConvexOS* ) 
	if test "$with_opt" = "yes"; then
	    OPT_FLAG_C=-O3
	    OPT_FLAG_F=-O3
	fi
    ;;
    dg*|DG* ) 
	if test "$with_f2c" = "no"; then
	    SYS_FLAGS_F77="-novms -f77"
	    if test "$with_debug" = "yes"; then
		DEBUG_FLAG_F="-g -ga -X18"
	    fi
	fi
    ;;
    hp*|HP* ) 

	# Optimization levels higher than 1 may not be worth it.  Also,
	# HP's optimizing preprocessor may not alway be reliable, so use
	# at your own risk.

	if test "$with_opt2" = "yes" -a "$with_gcc" = "no"; then
	    OPT_FLAG_C="+O3 +OS"
	fi

	# When with_warn is set, most or all warnings are enabled.
	# Also use the following:
	#  -z	  turns off run-time dereferencing of NULL pointers (ld option)
	#  +ESlit puts const data and strings in read-only memory (c89 option)

	if test "$with_warn" = "yes" -a "$with_gcc" = "no"; then
	    SYS_FLAGS_LC=-z
	    SYS_FLAGS_C="+w1 +ESlit"
	    SYS_FLAGS_F=-w
	fi

	# Handling of C++ exceptions

	if test "$with_gcc" = "no"; then
	    if test "$CXX" = "KCC"; then
		SYS_FLAGS_CXX=
		SYS_FLAGS_LCXX=
	    else
		SYS_FLAGS_CXX=+eh
		SYS_FLAGS_LCXX=+eh
	    fi
	fi

	# Profiling
	# Should not be used with shared libraries.

	if test "$with_profile" = "yes" -a "$with_gcc" = "no"; then
	    with_shlib=no
	    PROF_FLAG_C=-G
	    PROF_FLAG_F=-G
	    PROF_FLAG_LC=-G
	    PROF_FLAG_LF=-G
	fi

	# Shut off shared libraries if debugging.

	if test "$with_debug" = "yes"; then
	    if test "$with_gcc" = "no"; then
		with_shlib=no
		echo "$ac_t""warning: debug support requires with_shlib=no on HP, setting with_shlib=no" 1>&6
	    fi
	fi

	# Double precision -- use auto promotion from Fortran.  This works
	# only under 9.x -- the 8.x Fortran compiler only has -R8, which
	# promotes only constants and not variables.  You can use a macro
	# for real or different sets of sources to get both single and
	# double, though, and in fact I do this with the stub interface
	# (for a bit more portability).  So if your Fortran compiler
	# doesn't support promotion of real constants AND variables, the
	# library will still build, but you won't be able to build the
	# Fortran example programs in double precision.

	if test $with_double = "yes" -a "$with_f2c" = "no"; then
	    DBL_FLAG_F=+autodblpad
	fi
    ;;
    irix*|IRIX*|Irix*|sgi*|SGI* ) 
    ;;
    IRIX64-6.2 )
	    SYS_FLAGS_C="-D_BSD_SIGNALS"
    ;;
    linux*|LINUX*|Linux* ) 
    ;;
    next*|NeXT*|NEXT* ) 
    ;;
    SunOS-* )
	if test "$with_profile" = "yes"; then
	    PROF_FLAG_LC="-p -static"
	fi
    ;;
    sx*|Sx*|SX*|monte*|Monte*|MONTE* ) 
	LDF="f77 -w"

	# ALWAYS ALWAYS use the -b option otherwise some things get passed by
	# value instead of by reference (demonstrating once again that truth is
	# stranger than fiction).

	SYS_FLAGS_F="-pvctl nomsg -b"
	if test "$with_warn" = "yes"; then
	    SYS_FLAGS_F="-e1 $SYS_FLAGS_F"
	else
	    SYS_FLAGS_F="-e2 $SYS_FLAGS_F"
	fi

	if test "$with_opt" = "yes"; then
	    OPT_FLAG_F="-O nomsg"
	fi

	if test "$with_double" = "yes"; then
	    DBL_FLAG_F="-A dbl4"
	fi
    ;;
    ultrix*|ULTRIX* ) 

	# Profiling (needs checking)

	if test "$with_profile" = "yes"; then
	    PROF_FLAG_LC="-p -static"
	fi
    ;;
    CRAY* ) 
	machine=`uname -m`
	if test "$with_debug" = "yes" ; then
	    DEBUG_FLAG_F="-Wf\"-ez\""
	fi

	OPT_FLAG_F= 

	case "$machine" in
	    CRAY-2 )
		SYS_FLAGS_C="-h pagelm"
	    ;;
	esac

	if test "$with_profile" = "yes" ; then
	    PROF_FLAG_C=
	    PROF_FLAG_F=
	    PROF_FLAG_LC=
	    PROF_FLAG_LF=
	    DEBUG_FLAG_C=-Gp
	    DEBUG_FLAG_LC=-Gp
	    DEBUG_FLAG_LF= 

	    case "$machine" in
		CRAY-2 )
		    LIBS=$LIBS -lprof -lsci -lu
		;;
		* )
		    LIBS=$LIBS -lprof -lsci
		;;
	    esac
	fi
    ;;
    * ) 	
    ;;
esac

# ----------------------------------------------------------------------------
# Assemble finished compiler flags.
# ----------------------------------------------------------------------------

CC_FLAGS="-c $DBL_FLAG_C $DEBUG_FLAG_C $SYS_FLAGS_C $PROF_FLAG_C $OPT_FLAG_C"
LDC_FLAGS="$PROF_FLAG_LC $SYS_FLAGS_LC $DEBUG_FLAG_LC"

if test "$enable_cxx" = "yes"; then
    CXX_FLAGS="-c $DBL_FLAG_CXX $DEBUG_FLAG_CXX $SYS_FLAGS_CXX $PROF_FLAG_CXX $OPT_FLAG_CXX"
    LDCXX_FLAGS="$PROF_FLAG_LCXX $SYS_FLAGS_LCXX $DEBUG_FLAG_LCXX"
fi

if test "$enable_f77" = "yes"; then
    F77_FLAGS="-c $DBL_FLAG_F $DEBUG_FLAG_F $SYS_FLAGS_F $PROF_FLAG_F $OPT_FLAG_F"
    LDF_FLAGS="$PROF_FLAG_LF $SYS_FLAGS_LF $DEBUG_FLAG_LF"
fi

M4_FLAGS="-S2000 -B8192"

















echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1821: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
  CPP=
fi
if test -z "$CPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
    # This must be in double quotes, not single quotes, because CPP may get
  # substituted into the Makefile and "${CC-cc}" will confuse make.
  CPP="${CC-cc} -E"
  # On the NeXT, cc -E runs the code through the compiler's parser,
  # not just through cpp.
  cat > conftest.$ac_ext <<EOF
#line 1836 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  :
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  CPP="${CC-cc} -E -traditional-cpp"
  cat > conftest.$ac_ext <<EOF
#line 1853 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1859: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  :
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  CPP=/lib/cpp
fi
rm -f conftest*
fi
rm -f conftest*
  ac_cv_prog_CPP="$CPP"
fi
  CPP="$ac_cv_prog_CPP"
else
  ac_cv_prog_CPP="$CPP"
fi
echo "$ac_t""$CPP" 1>&6


echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
echo "configure:1883: checking for POSIXized ISC" >&5
if \
     grep _POSIX_VERSION /usr/include/unistd.h >/dev/null 2>&1 ||
     grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
  echo "$ac_t""yes" 1>&6
  ISC=1 # If later tests want to check for ISC.
  cat >> confdefs.h <<\EOF
#define _POSIX_SOURCE 1
EOF

else
  echo "$ac_t""no" 1>&6
fi


# --*-sh-*--------------------------------------------------------------------
#
# sysloc.in
#
# Maurice LeBrun
# IFS, University of Texas at Austin
# 14-Jul-1994
#
# This script sets up config variables for a Unix-like system.
# The stuff set here is fairly generic and can be automated.
# This includes how to find required header files and libraries.
# Includes code and ideas taken from the BLT (Tk extension) configure.
# ----------------------------------------------------------------------------

INCPATH=
LIBPATH=

# Default linker library commands.  These may need version numbers
# appended to them though.

DPLIBSTR=-ldpnetwork
ITKLIBSTR=-litk
TKLIBSTR=-ltk
ITCLLIBSTR=-litcl
TCLLIBSTR=-ltcl
XLIBSTR=-lX11

# ----------------------------------------------------------------------------
# Run xmkmf to check for location of X libraries and includes.  If not
# found, I have to assume that X isn't available (it happens).  Can disable
# explicitly by specifying --disable-xwin or --without-x (the latter switch
# is built into autoconf so I might as well support it).
#
# Note:  ac_path_x gets it wrong sometimes.  If you need to specify
# the path yourself in cf_plplot.in, you should probably plan to
# provide both XINCDIR and XLIBDIR.
# ----------------------------------------------------------------------------

if test "$with_x" = "no"; then
    enable_xwin=no
fi

if test "$enable_xwin" = "yes"; then
    if test -z "$XINCDIR" -o -z "$XLIBDIR"; then
	# If we find X, set shell vars x_includes and x_libraries to the
# paths, otherwise set no_x=yes.
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
echo "configure:1948: checking for X" >&5

# Check whether --with-x or --without-x was given.
withval="$with_x"
if test -n "$withval"; then
  :
fi

# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
if test "x$with_x" = xno; then
  # The user explicitly disabled X.
  have_x=disabled
else
  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
    # Both variables are already set.
    have_x=yes
  else
if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  # One or both of the vars are not set, and there is no cached value.
ac_x_includes=NO ac_x_libraries=NO
rm -fr conftestdir
if mkdir conftestdir; then
  cd conftestdir
  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
  cat > Imakefile <<'EOF'
acfindx:
	@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
EOF
  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
    # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
    for ac_extension in a so sl; do
      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
        test -f $ac_im_libdir/libX11.$ac_extension; then
        ac_im_usrlibdir=$ac_im_libdir; break
      fi
    done
    # Screen out bogus values from the imake configuration.  They are
    # bogus both because they are the default anyway, and because
    # using them would break gcc on systems where it needs fixed includes.
    case "$ac_im_incroot" in
	/usr/include) ;;
	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
    esac
    case "$ac_im_usrlibdir" in
	/usr/lib | /lib) ;;
	*) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
    esac
  fi
  cd ..
  rm -fr conftestdir
fi

if test "$ac_x_includes" = NO; then
  # Guess where to find include files, by looking for this one X11 .h file.
  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h

  # First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
#line 2010 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2015: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  rm -rf conftest*
  # We can compile using X headers with no special include directory.
ac_x_includes=
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  # Look for the header file in a standard set of common directories.
# Check X11 before X11Rn because it is often a symlink to the current release.
  for ac_dir in               \
    /usr/X11/include          \
    /usr/X11R6/include        \
    /usr/X11R5/include        \
    /usr/X11R4/include        \
                              \
    /usr/include/X11          \
    /usr/include/X11R6        \
    /usr/include/X11R5        \
    /usr/include/X11R4        \
                              \
    /usr/local/X11/include    \
    /usr/local/X11R6/include  \
    /usr/local/X11R5/include  \
    /usr/local/X11R4/include  \
                              \
    /usr/local/include/X11    \
    /usr/local/include/X11R6  \
    /usr/local/include/X11R5  \
    /usr/local/include/X11R4  \
                              \
    /usr/X386/include         \
    /usr/x386/include         \
    /usr/XFree86/include/X11  \
                              \
    /usr/include              \
    /usr/local/include        \
    /usr/unsupported/include  \
    /usr/athena/include       \
    /usr/local/x11r5/include  \
    /usr/lpp/Xamples/include  \
                              \
    /usr/openwin/include      \
    /usr/openwin/share/include \
    ; \
  do
    if test -r "$ac_dir/$x_direct_test_include"; then
      ac_x_includes=$ac_dir
      break
    fi
  done
fi
rm -f conftest*
fi # $ac_x_includes = NO

if test "$ac_x_libraries" = NO; then
  # Check for the libraries.

  test -z "$x_direct_test_library" && x_direct_test_library=Xt
  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc

  # See if we find them without any special options.
  # Don't add to $LIBS permanently.
  ac_save_LIBS="$LIBS"
  LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2084 "configure"
#include "confdefs.h"

int main() {
${x_direct_test_function}()
; return 0; }
EOF
if { (eval echo configure:2091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
ac_x_libraries=
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  LIBS="$ac_save_LIBS"
# First see if replacing the include by lib works.
# Check X11 before X11Rn because it is often a symlink to the current release.
for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
    /usr/X11/lib          \
    /usr/X11R6/lib        \
    /usr/X11R5/lib        \
    /usr/X11R4/lib        \
                          \
    /usr/lib/X11          \
    /usr/lib/X11R6        \
    /usr/lib/X11R5        \
    /usr/lib/X11R4        \
                          \
    /usr/local/X11/lib    \
    /usr/local/X11R6/lib  \
    /usr/local/X11R5/lib  \
    /usr/local/X11R4/lib  \
                          \
    /usr/local/lib/X11    \
    /usr/local/lib/X11R6  \
    /usr/local/lib/X11R5  \
    /usr/local/lib/X11R4  \
                          \
    /usr/X386/lib         \
    /usr/x386/lib         \
    /usr/XFree86/lib/X11  \
                          \
    /usr/lib              \
    /usr/local/lib        \
    /usr/unsupported/lib  \
    /usr/athena/lib       \
    /usr/local/x11r5/lib  \
    /usr/lpp/Xamples/lib  \
    /lib/usr/lib/X11	  \
                          \
    /usr/openwin/lib      \
    /usr/openwin/share/lib \
    ; \
do
  for ac_extension in a so sl; do
    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
      ac_x_libraries=$ac_dir
      break 2
    fi
  done
done
fi
rm -f conftest*
fi # $ac_x_libraries = NO

if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
  # Didn't find X anywhere.  Cache the known absence of X.
  ac_cv_have_x="have_x=no"
else
  # Record where we found X for the cache.
  ac_cv_have_x="have_x=yes \
	        ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
fi
  fi
  eval "$ac_cv_have_x"
fi # $with_x != no

if test "$have_x" != yes; then
  echo "$ac_t""$have_x" 1>&6
  no_x=yes
else
  # If each of the values was on the command line, it overrides each guess.
  test "x$x_includes" = xNONE && x_includes=$ac_x_includes
  test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
  # Update the cache value to reflect the command line values.
  ac_cv_have_x="have_x=yes \
		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
fi


	XINCDIR="$x_includes"
	if test -z "$XINCDIR"; then
	    cat > conftest.$ac_ext <<EOF
#line 2181 "configure"
#include "confdefs.h"
#include <X11/Intrinsic.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  rm -rf conftest*
   XINCDIR=default 
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  
	    incdirs="\
	    /usr/include \
	    /usr/include/X11 \
	    /usr/include/X11R5 \
	    /usr/include/X11R4 \
	    /usr/include/X11/X11R5 \
	    /usr/include/X11/X11R4 \
	    /usr/X11/include \
	    /usr/X386/include \
	    /usr/X11R5/include \
	    /usr/local/X11R5/include \
	    /usr/openwin/include \
	    /usr/local/X11R4/include \
	    /usr/include/X11R4 \
	    /usr/local/include \
	    /usr/unsupported/include"

	    for dir in $places; do
		if test -r "$dir/X11/Intrinsic.h"; then
		    XINCDIR="$dir"
		    break
		fi
	    done
	    if test -z "$XINCDIR"; then
		echo "$ac_t""warning: X11 include files not found" 1>&6
		XINCDIR=default
		enable_xwin=no
	    fi 
fi
rm -f conftest*
	fi
	if test "$XINCDIR" = "/usr/include"; then
	    XINCDIR=default
	fi

	XLIBDIR="$x_libraries"
	if test -z "$XLIBDIR"; then
	    echo $ac_n "checking for main in -lX11""... $ac_c" 1>&6
echo "configure:2235: checking for main in -lX11" >&5
ac_lib_var=`echo X11'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lX11  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2243 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:2250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
   XLIBDIR=default 
else
  echo "$ac_t""no" 1>&6

	    libdirs="\
	    /lib \
	    /usr/lib \
	    /usr/lib/X11R5 \
	    /usr/X11/lib \
	    /usr/X386/lib \
	    /usr/X11R5/lib \
	    /usr/local/X11R5/lib \
	    /usr/openwin/lib \
	    /usr/local/X11R4/lib \
	    /usr/lib/X11R4 \ 
	    /usr/local/lib \
	    /usr/unsupported/lib"

	    for dir in $places; do
		if test -r "$dir/libX11.a"; then
		    XLIBDIR="$dir"
		    break
		fi
	    done
	    if test -z "$XLIBDIR"; then
		echo "$ac_t""warning: X11 library not found" 1>&6
		XLIBDIR=default
	    fi 
fi

	fi
	if test "$XLIBDIR" = "/usr/lib"; then
	    XLIBDIR=default
	fi
    fi
fi

# ----------------------------------------------------------------------------
# Make some guesses where the Tcl/Tk include files and libraries are.
# Look first in the Tcl/Tk distributions and then move on to the standard
# include file/library locations.  If it's still not found I assume it's
# not here.
#
# Note: it is important to check in user directories _before_ checking
# anywhere else.  That way you can easily compile custom versions (of Tcl,
# Tk, etc), put them in your file space, and have them be found first.  Some
# examples: libraries compiled with debugging turned on, or from a different
# revision of the (Tcl, Tk, etc) package.  Also, when dealing with multiple
# versions (e.g. libtcl7.4.a vs the older libtcl.a), check for the newer
# version first.
# ----------------------------------------------------------------------------

# Default directories to search for include files

incdirs_default="\
$prefix/include/itcl \
$prefix/include \
$HOME/local/include \
$HOME/include \
/usr/local/include \
/usr/include/tcl \
/usr/include"

# Default directories to search for library files

libdirs_default="\
$prefix/lib/itcl \
$prefix/lib \
$HOME/local/lib \
$HOME/lib \
/usr/local/lib \
/usr/lib"

incdirs=$incdirs_default
libdirs=$libdirs_default

if test -n "$with_pkgdir"; then
    incdirs="$with_pkgdir/include $incdirs"
    libdirs="$with_pkgdir/lib $libdirs"
fi

# ----------------------------------------------------------------------------
# tcl.h
# ----------------------------------------------------------------------------

if test "$enable_tcl" = "yes"; then
    if test -z "$TCLINCDIR"; then
	
    
    echo $ac_n "checking for tcl.h""... $ac_c" 1>&6
echo "configure:2355: checking for tcl.h" >&5
    TCLINCDIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/tcl.h"; then
	    TCLINCDIR="$dir"
	    echo "$ac_t""$dir/tcl.h" 1>&6
	    break
	fi
    done

    
    if test -z "$TCLINCDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find tcl.h, setting enable_tcl to no" 1>&6
	    enable_tcl="no"
	
    fi
    if test "$TCLINCDIR" = "/usr/include"; then
	TCLINCDIR="default"
    fi


    fi
fi

# ----------------------------------------------------------------------------
# libtcl
# ----------------------------------------------------------------------------

if test "$enable_tcl" = "yes"; then
    if test -z "$TCLLIBDIR"; then
	
    echo $ac_n "checking for libtcl""... $ac_c" 1>&6
echo "configure:2391: checking for libtcl" >&5
    TCLLIBDIR=""

	for version in 8.1 8.0 7.6i 7.5i 7.6 7.5 7.4 ""; do
	    if test -n "$TCLLIBDIR"; then
		break
	    fi
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libtcl$version.$suffix"; then
		TCLLIBDIR="$dir"
		TCLLIBSTR="-ltcl$version"
		echo "$ac_t""$dir/libtcl$version.$suffix" 1>&6
		break 2
	    fi
	done
    done

	done
	
    if test -z "$TCLLIBDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find libtcl, setting enable_tcl to no" 1>&6
	    enable_tcl="no"
	
    fi
    if test "$TCLLIBDIR" = "/usr/lib"; then
	TCLLIBDIR="default"
    fi

    fi
    if test "$enable_tcl" = "yes"; then
	if test -r $TCLLIBDIR/tclConfig.sh; then
	    . $TCLLIBDIR/tclConfig.sh
	fi
    fi
fi

# ----------------------------------------------------------------------------
# itcl.h
# ----------------------------------------------------------------------------

if test "$enable_tcl" = "no"; then
    enable_itcl=no
fi

if test "$enable_itcl" = "yes"; then
    if test -z "$ITCLINCDIR"; then
	
    
    echo $ac_n "checking for itcl.h""... $ac_c" 1>&6
echo "configure:2447: checking for itcl.h" >&5
    ITCLINCDIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/itcl.h"; then
	    ITCLINCDIR="$dir"
	    echo "$ac_t""$dir/itcl.h" 1>&6
	    break
	fi
    done

    
    if test -z "$ITCLINCDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find itcl.h, setting enable_itcl to no" 1>&6
	    enable_itcl="no"
	
    fi
    if test "$ITCLINCDIR" = "/usr/include"; then
	ITCLINCDIR="default"
    fi


    fi
fi

# ----------------------------------------------------------------------------
# libitcl ([incr Tcl])
# ----------------------------------------------------------------------------

if test "$enable_itcl" = "yes"; then
    if test -z "$ITCLLIBDIR"; then
	
    echo $ac_n "checking for libitcl""... $ac_c" 1>&6
echo "configure:2483: checking for libitcl" >&5
    ITCLLIBDIR=""

	for version in 2.1 2.0 ""; do
	    if test -n "$ITCLLIBDIR"; then
		break
	    fi
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libitcl$version.$suffix"; then
		ITCLLIBDIR="$dir"
		ITCLLIBSTR="-litcl$version"
		echo "$ac_t""$dir/libitcl$version.$suffix" 1>&6
		break 2
	    fi
	done
    done

	done
	
    if test -z "$ITCLLIBDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find libitcl, setting enable_itcl to no" 1>&6
	    enable_itcl="no"
	
    fi
    if test "$ITCLLIBDIR" = "/usr/lib"; then
	ITCLLIBDIR="default"
    fi

    fi
fi

# ----------------------------------------------------------------------------
# tk.h
# ----------------------------------------------------------------------------

if test "$enable_tcl" = "no" -o "$enable_xwin" = "no"; then
    enable_tk=no
fi

if test "$enable_tk" = "yes"; then
    if test -z "$TKINCDIR"; then
	
    
    echo $ac_n "checking for tk.h""... $ac_c" 1>&6
echo "configure:2534: checking for tk.h" >&5
    TKINCDIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/tk.h"; then
	    TKINCDIR="$dir"
	    echo "$ac_t""$dir/tk.h" 1>&6
	    break
	fi
    done

    
    if test -z "$TKINCDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find tk.h, setting enable_tk to no" 1>&6
	    enable_tk="no"
	
    fi
    if test "$TKINCDIR" = "/usr/include"; then
	TKINCDIR="default"
    fi


    fi
fi

# ----------------------------------------------------------------------------
# libtk
# ----------------------------------------------------------------------------

if test "$enable_tk" = "yes"; then
    if test -z "$TKLIBDIR"; then
	
    echo $ac_n "checking for libtk""... $ac_c" 1>&6
echo "configure:2570: checking for libtk" >&5
    TKLIBDIR=""

	for version in 8.1 8.0 4.2i 4.1i 4.2 4.1 4.0 ""; do
	    if test -n "$TKLIBDIR"; then
		break
	    fi
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libtk$version.$suffix"; then
		TKLIBDIR="$dir"
		TKLIBSTR="-ltk$version"
		echo "$ac_t""$dir/libtk$version.$suffix" 1>&6
		break 2
	    fi
	done
    done

	done
	
    if test -z "$TKLIBDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find libtk, setting enable_tk to no" 1>&6
	    enable_tk="no"
	
    fi
    if test "$TKLIBDIR" = "/usr/lib"; then
	TKLIBDIR="default"
    fi

    fi
fi

# ----------------------------------------------------------------------------
# libitk
# ----------------------------------------------------------------------------

enable_itk="yes"
if test "$enable_tk" = "no" -o "$enable_itcl" = "no"; then
    enable_itk="no"
fi

if test "$enable_itk" = "yes"; then
    if test -z "$ITKLIBDIR"; then
	
    echo $ac_n "checking for libitk""... $ac_c" 1>&6
echo "configure:2621: checking for libitk" >&5
    ITKLIBDIR=""

	for version in 2.1 2.0 ""; do
	    if test -n "$ITKLIBDIR"; then
		break
	    fi
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libitk$version.$suffix"; then
		ITKLIBDIR="$dir"
		ITKLIBSTR="-litk$version"
		echo "$ac_t""$dir/libitk$version.$suffix" 1>&6
		break 2
	    fi
	done
    done

	done
	
    if test -z "$ITKLIBDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find libitk, setting enable_itk to no" 1>&6
	    enable_itk="no"
	
    fi
    if test "$ITKLIBDIR" = "/usr/lib"; then
	ITKLIBDIR="default"
    fi

    fi
fi

if test "$enable_itcl" = "yes"; then
    cat >> confdefs.h <<\EOF
#define HAVE_ITCL 1
EOF

fi

if test "$enable_itk" = "yes"; then
    cat >> confdefs.h <<\EOF
#define HAVE_ITK 1
EOF

fi

# ----------------------------------------------------------------------------
# makeindex - figure out how we're gonna generate tclIndex
# ----------------------------------------------------------------------------

if test -z "$MAKEINDEX"; then
    MAKEINDEX='BOGUS'
fi

if test "$enable_tcl" = "yes"; then
    if test "$TCLLIBDIR" = "default"; then
	MAKEINDEX="/usr/bin/tclsh$TCL_VERSION"
    else
	tclbindir="`echo $TCLLIBDIR | sed 's,/lib,,'`/bin"
#	echo "tclbindir = $tclbindir"
	if test -r "$tclbindir/tclsh$TCL_VERSION"; then
	    MAKEINDEX="$tclbindir/tclsh$TCL_VERSION"
#	    echo "setting MAKEINDEX to $MAKEINDEX"
	fi
    fi
    TCL_INDEX_FILES="*.tcl"
fi

if test "$enable_itcl" = "yes"; then
    itclbindir="`echo $ITCLLIBDIR | sed 's,/lib/itcl,,'`/bin"
#    echo "itclbindir = $itclbindir"
    if test -r "$itclbindir/itclsh"; then
	MAKEINDEX="$itclbindir/itclsh"
    fi
    TCL_INDEX_FILES="*.tcl"
fi

if test "$enable_tcl" = "yes" -a "$MAKEINDEX" = "BOGUS"; then
    echo "$ac_t""warning: you must edit Makefile to fix MAKEINDEX." 1>&6
fi




# ----------------------------------------------------------------------------
# dp.h
# ----------------------------------------------------------------------------

if test "$enable_tcl" = "no" -o "$enable_tk" = "no"; then
    enable_dp=no
fi

if test "$enable_dp" = "yes"; then

    if test -z "$DPINCDIR"; then
	
    
    echo $ac_n "checking for dp.h""... $ac_c" 1>&6
echo "configure:2725: checking for dp.h" >&5
    DPINCDIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/dp.h"; then
	    DPINCDIR="$dir"
	    echo "$ac_t""$dir/dp.h" 1>&6
	    break
	fi
    done

    
    if test -z "$DPINCDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find dp.h, setting enable_dp to no" 1>&6
	    enable_dp="no"
	
    fi
    if test "$DPINCDIR" = "/usr/include"; then
	DPINCDIR="default"
    fi


    fi
fi

# ----------------------------------------------------------------------------
# libdpnetwork (Tcl-DP)
# ----------------------------------------------------------------------------

if test "$enable_dp" = "yes"; then
    if test -z "$DPLIBDIR"; then
	
    
    echo $ac_n "checking for libdpnetwork""... $ac_c" 1>&6
echo "configure:2762: checking for libdpnetwork" >&5
    DPLIBDIR=""

    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libdpnetwork.$suffix"; then
		DPLIBDIR="$dir"
		DPLIBSTR="-ldpnetwork"
		echo "$ac_t""$dir/libdpnetwork.$suffix" 1>&6
		break 2
	    fi
	done
    done

    
    if test -z "$DPLIBDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find libdpnetwork, setting enable_dp to no" 1>&6
	    enable_dp="no"
	
    fi
    if test "$DPLIBDIR" = "/usr/lib"; then
	DPLIBDIR="default"
    fi


    fi
fi

# ----------------------------------------------------------------------------
# Assemble list of tcl/TK/X/whatever include directives.  These can go in
# any order.
# ----------------------------------------------------------------------------

if test "$enable_xwin" = "yes"; then
    
    INCSW=""
    if test "$XINCDIR" != "default"; then
	INCSW="-I$XINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$XINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $XINCDIR"

fi
if test "$enable_tcl" = "yes"; then
    
    INCSW=""
    if test "$TCLINCDIR" != "default"; then
	INCSW="-I$TCLINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$TCLINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $TCLINCDIR"

fi
if test "$enable_dp" = "yes"; then
    
    INCSW=""
    if test "$DPINCDIR" != "default"; then
	INCSW="-I$DPINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$DPINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $DPINCDIR"

fi
if test "$enable_itcl" = "yes"; then
    
    INCSW=""
    if test "$ITCLINCDIR" != "default"; then
	INCSW="-I$ITCLINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$ITCLINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $ITCLINCDIR"

fi
if test "$enable_tk" = "yes"; then
    
    INCSW=""
    if test "$TKINCDIR" != "default"; then
	INCSW="-I$TKINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$TKINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $TKINCDIR"

fi

# ----------------------------------------------------------------------------
# Assemble list of tcl/TK/X/whatever libraries.
# Note the library order CAN be important, depending on the system:
# The full Tcl-DP library depends on both Tk and Tcl so must come first.
# Tk depends on Tcl and X11 so must come before both.
# Itcl depends on Tcl so must come before it.
# Tcl and X11 can be put in either order.
# ----------------------------------------------------------------------------

if test "$enable_dp" = "yes"; then
    
    LIBSW=""
    if test "$DPLIBDIR" != "default"; then
	LIBSW="-L$DPLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$DPLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $DPLIBSTR"
    else
	LIBS="$LIBS $DPLIBSTR"
    fi
    LIBPATH="$LIBPATH $DPLIBDIR"

fi
if test "$enable_itk" = "yes"; then
    
    LIBSW=""
    if test "$ITKLIBDIR" != "default"; then
	LIBSW="-L$ITKLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$ITKLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $ITKLIBSTR"
    else
	LIBS="$LIBS $ITKLIBSTR"
    fi
    LIBPATH="$LIBPATH $ITKLIBDIR"

fi
if test "$enable_tk" = "yes"; then
    
    LIBSW=""
    if test "$TKLIBDIR" != "default"; then
	LIBSW="-L$TKLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$TKLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $TKLIBSTR"
    else
	LIBS="$LIBS $TKLIBSTR"
    fi
    LIBPATH="$LIBPATH $TKLIBDIR"

fi
if test "$enable_itcl" = "yes"; then
    
    LIBSW=""
    if test "$ITCLLIBDIR" != "default"; then
	LIBSW="-L$ITCLLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$ITCLLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $ITCLLIBSTR"
    else
	LIBS="$LIBS $ITCLLIBSTR"
    fi
    LIBPATH="$LIBPATH $ITCLLIBDIR"

fi
if test "$enable_tcl" = "yes"; then
    
    LIBSW=""
    if test "$TCLLIBDIR" != "default"; then
	LIBSW="-L$TCLLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$TCLLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $TCLLIBSTR"
    else
	LIBS="$LIBS $TCLLIBSTR"
    fi
    LIBPATH="$LIBPATH $TCLLIBDIR"

fi
if test "$enable_xwin" = "yes"; then
    
    LIBSW=""
    if test "$XLIBDIR" != "default"; then
	LIBSW="-L$XLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$XLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $XLIBSTR"
    else
	LIBS="$LIBS $XLIBSTR"
    fi
    LIBPATH="$LIBPATH $XLIBDIR"

fi
if test ! -z "$TCL_DL_LIBS"; then
    
    LIBSW=""
    if test "default" != "default"; then
	LIBSW="-Ldefault"
    fi
    for dir in $LIBPATH; do
	if test "default" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $TCL_DL_LIBS"
    else
	LIBS="$LIBS $TCL_DL_LIBS"
    fi
    LIBPATH="$LIBPATH default"

fi

# ----------------------------------------------------------------------------
# Debugging malloc
# Even with debugging on, is off by default, because it can dramatically
# slow down program execution (particularly in combination with Tcl/Tk).
# ----------------------------------------------------------------------------

if test "$with_dbmalloc" = "yes"; then
    if test -z "$DBMALLOCLIBDIR"; then
	libdirs="\
	$prefix/lib \
	$HOME/local/lib \
	$HOME/dbmalloc/lib \
	$HOME/lib \
	/usr/local/lib \
	/usr/local/dbmalloc/lib \
	/usr/lib"

	
    
    echo $ac_n "checking for libdbmalloc""... $ac_c" 1>&6
echo "configure:3062: checking for libdbmalloc" >&5
    DBMALLOCLIBDIR=""

    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libdbmalloc.$suffix"; then
		DBMALLOCLIBDIR="$dir"
		with_dbmalloc="-ldbmalloc"
		echo "$ac_t""$dir/libdbmalloc.$suffix" 1>&6
		break 2
	    fi
	done
    done

    
    if test -z "$DBMALLOCLIBDIR"; then
	
	    echo "$ac_t""not found -- exiting" 1>&6
	    exit 1
	
    fi
    if test "$DBMALLOCLIBDIR" = "/usr/lib"; then
	DBMALLOCLIBDIR="default"
    fi


    fi
    if test -n "$DBMALLOCLIBDIR"; then
	
    LIBSW=""
    if test "$DBMALLOCLIBDIR" != "default"; then
	LIBSW="-L$DBMALLOCLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$DBMALLOCLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW -ldbmalloc"
    else
	LIBS="$LIBS -ldbmalloc"
    fi
    LIBPATH="$LIBPATH $DBMALLOCLIBDIR"

    fi
fi

if test "$with_dbmalloc" = "yes"; then
    if test -z "$DBMALLOCINCDIR"; then
	incdirs="\
	$prefix/include \
	$HOME/local/include \
	$HOME/local/dbmalloc/include \
	$HOME/include \
	$HOME/debug_include \
	/usr/local/dbmalloc/include \
	/usr/local/debug_include"

	
    
    echo $ac_n "checking for malloc.h""... $ac_c" 1>&6
echo "configure:3129: checking for malloc.h" >&5
    DBMALLOCINCDIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/malloc.h"; then
	    DBMALLOCINCDIR="$dir"
	    echo "$ac_t""$dir/malloc.h" 1>&6
	    break
	fi
    done

    
    if test -z "$DBMALLOCINCDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find malloc.h, setting with_dbmalloc to no" 1>&6
	    with_dbmalloc="no"
	
    fi
    if test "$DBMALLOCINCDIR" = "/usr/include"; then
	DBMALLOCINCDIR="default"
    fi


    fi
    if test -n "$DBMALLOCINCDIR"; then
	
    INCSW=""
    if test "$DBMALLOCINCDIR" != "default"; then
	INCSW="-I$DBMALLOCINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$DBMALLOCINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $DBMALLOCINCDIR"

    fi
fi

if test "with_dbmalloc" = "yes"; then
    cat >> confdefs.h <<\EOF
#define DEBUGGING_MALLOC 1
EOF

fi

# -----------------------------------------------------------------------
# Python include and machdep directories
# -----------------------------------------------------------------------

if test "$enable_python" = "yes"; then
    if test "$with_shlib" = "no"; then
	echo "$ac_t""warning: python support requires with_shlib=yes, setting enable_python=no" 1>&6
	enable_python=no
    fi
fi

if test "$enable_python" = "yes"; then
    if test -z "$PYTHON_INC_DIR" -o ! -d "$PYTHON_INC_DIR"; then
	incdirs="\
	$prefix/include/python1.4 \
	/usr/include/python1.4 \
	$prefix/include/Py \
	$HOME/local/include/Py \
	$HOME/local/python/include/Py \
	$HOME/include/Py \
	/usr/local/python/include/Py \
	/usr/local/python-1.2/include/Py \
	/usr/local/include/Py"

# Should probably just drop everything after /usr/include/python1.4,
# have to think about it.

	
    
    echo $ac_n "checking for Python.h""... $ac_c" 1>&6
echo "configure:3212: checking for Python.h" >&5
    PYTHON_INC_DIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/Python.h"; then
	    PYTHON_INC_DIR="$dir"
	    echo "$ac_t""$dir/Python.h" 1>&6
	    break
	fi
    done

    
    if test -z "$PYTHON_INC_DIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find Python.h, setting enable_python to no" 1>&6
	    enable_python="no"
	
    fi
    if test "$PYTHON_INC_DIR" = "/usr/include"; then
	PYTHON_INC_DIR="default"
    fi



	if test "$enable_python" = "yes"; then
	    
    
    echo $ac_n "checking for arrayobject.h""... $ac_c" 1>&6
echo "configure:3242: checking for arrayobject.h" >&5
    PYTHON_INC_DIR=""

    
    for dir in $incdirs; do
	if test -r "$dir/arrayobject.h"; then
	    PYTHON_INC_DIR="$dir"
	    echo "$ac_t""$dir/arrayobject.h" 1>&6
	    break
	fi
    done

    
    if test -z "$PYTHON_INC_DIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find arrayobject.h, setting numeric_python to no" 1>&6
	    numeric_python="no"
	
    fi
    if test "$PYTHON_INC_DIR" = "/usr/include"; then
	PYTHON_INC_DIR="default"
    fi


	    if test "$numeric_python" = "no"; then
		echo "$ac_t""plmodule needs Python numeric extension." 1>&6
		echo "$ac_t""Setting enable_python to no" 1>&6
		enable_python=no
	    fi
	fi
    fi
fi

if test "$enable_python" = "yes"; then
    if test -z "$PYTHON_MOD_DIR" -o ! -d "$PYTHON_MOD_DIR"; then
	if test -z "$MACHDEP"; then
	    ac_sys_system=`uname -s | tr -d ' ' | tr '[A-Z]' '[a-z]'`
	    ac_sys_release=`uname -r | tr -d ' ' | sed 's/\..*//'`
	    MACHDEP="$ac_sys_system$ac_sys_release"
	    case MACHDEP in
		'')	MACHDEP=unknown;;
	    esac
	fi

	python_dir=`echo $PYTHON_INC_DIR|sed 's,/[^/]*/[^/]*$,,'`
	PYTHON_MOD_DIR=$python_dir/lib/python
	PYTHON_MACH_DIR=$PYTHON_MOD_DIR/$MACHDEP
	if test ! -d "$PYTHON_MOD_DIR"; then
	    # tricky, must be a new style
	    python_ver=`echo $PYTHON_INC_DIR|sed 's,/.*/,,'`
	    PYTHON_MOD_DIR=$python_dir/lib/$python_ver
	    PYTHON_MACH_DIR=$PYTHON_MOD_DIR/$MACHDEP
	    if test ! -d "$PYTHON_MOD_DIR"; then
		enable_python=no

		echo "$ac_t""PYTHON_MOD_DIR not found, setting enable_python to no" 1>&6
		enable_python=no
	    fi

	fi
	PYTHON_CFG_DIR=$PYTHON_MOD_DIR/config
    fi
fi






# ----------------------------------------------------------------------------
# libf2c
# ----------------------------------------------------------------------------

if test "$with_f2c" = "yes"; then
    echo $ac_n "checking for main in -lf2c""... $ac_c" 1>&6
echo "configure:3318: checking for main in -lf2c" >&5
ac_lib_var=`echo f2c'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lf2c  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3326 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3333: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  LIBS="$LIBS -lf2c"
else
  echo "$ac_t""no" 1>&6
echo "$ac_t""warning: libf2c not found" 1>&6
fi

fi

# ----------------------------------------------------------------------------
# linuxvga support
# ----------------------------------------------------------------------------

if test "$enable_linuxvga" = "yes"; then
    if test -z "$VGALIBDIR"; then
	libdirs="\
	$prefix/lib \
	/usr/lib"

	
    
    echo $ac_n "checking for libvga""... $ac_c" 1>&6
echo "configure:3369: checking for libvga" >&5
    VGALIBDIR=""

    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS=a
	fi
	for suffix in $LIBEXTNS; do
	    if test -f "$dir/libvga.$suffix"; then
		VGALIBDIR="$dir"
		VGALIBSTR="-lvga"
		echo "$ac_t""$dir/libvga.$suffix" 1>&6
		break 2
	    fi
	done
    done

    
    if test -z "$VGALIBDIR"; then
	
	    echo "$ac_t""no" 1>&6
	    echo "$ac_t""warning: can't find libvga, setting enable_linuxvga to no" 1>&6
	    enable_linuxvga="no"
	
    fi
    if test "$VGALIBDIR" = "/usr/lib"; then
	VGALIBDIR="default"
    fi

	
    fi
    if test -n "$VGALIBDIR"; then
	
    LIBSW=""
    if test "$VGALIBDIR" != "default"; then
	LIBSW="-L$VGALIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$VGALIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW -lvga"
    else
	LIBS="$LIBS -lvga"
    fi
    LIBPATH="$LIBPATH $VGALIBDIR"

    fi
fi

# ----------------------------------------------------------------------------
# Check for the existence of various libraries.  The order here is
# important, so that then end up in the right order in the command line
# generated by Make.  I put these in the variable EXTRA_LIBS so that
# you can set it yourself and leave LIBS up to the script to get right.
#
# Most of this is copied from the BLT configure script.  Dunno if the
# Xbsd library is really needed.  libsocket and libnsl are needed on
# some SysV systems.  libieee.a is supposed to be a Linux deal, dunno if
# it's important either.
#
# On some systems the linker doesn't return an error code to the shell if
# you try to link with nonexistant libraries, so need to handle these
# explicitly.
#
# Note: using Autoconf-2.3, these tests do not work right when LIBS is set.
# So save the value and set it to null temporarily, restoring when done.
# ----------------------------------------------------------------------------

if test -z "$EXTRA_LIBS"; then
    EXTRA_LIBS=
    SAVE_LIBS=$LIBS
    LIBS=
    case $system in 
	CRAY* ) 
	    EXTRA_LIBS="$EXTRA_LIBS -lm"
	;;
	irix*|IRIX*|Irix*|sgi*|SGI* ) 
	    EXTRA_LIBS="$EXTRA_LIBS -lm"
	;;
	HP-UX* )
	    EXTRA_LIBS="-ldld -lm"
	;;
	Linux* )
	    EXTRA_LIBS="-ldl -lm"
	;;
	* ) 	
	    echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
echo "configure:3461: checking for main in -lXbsd" >&5
ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lXbsd  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3469 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  EXTRA_LIBS="$EXTRA_LIBS -lXbsd"
else
  echo "$ac_t""no" 1>&6
fi

	    echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
echo "configure:3497: checking for main in -lsocket" >&5
ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lsocket  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3505 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  EXTRA_LIBS="$EXTRA_LIBS -lsocket"
else
  echo "$ac_t""no" 1>&6
fi

	    echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
echo "configure:3533: checking for main in -lnsl" >&5
ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lnsl  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3541 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  EXTRA_LIBS="$EXTRA_LIBS -lnsl"
else
  echo "$ac_t""no" 1>&6
fi

	    echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
echo "configure:3569: checking for main in -lieee" >&5
ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lieee  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3577 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  EXTRA_LIBS="$EXTRA_LIBS -lieee"
else
  echo "$ac_t""no" 1>&6
fi

	    echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
echo "configure:3605: checking for main in -lm" >&5
ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  ac_save_LIBS="$LIBS"
LIBS="-lm  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3613 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_lib_$ac_lib_var=no"
fi
rm -f conftest*
LIBS="$ac_save_LIBS"

fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  EXTRA_LIBS="$EXTRA_LIBS -lm"
else
  echo "$ac_t""no" 1>&6
fi

	;;
    esac
    LIBS=$SAVE_LIBS
fi

LIBS="$LIBS $EXTRA_LIBS"




# ----------------------------------------------------------------------------
# Set up shared library support.
# VERY system dependent.
# Originally based on BLT's configure.in.
# This is really a mess.
# ----------------------------------------------------------------------------

if test "$with_shlib" = "yes"; then
    echo $ac_n "checking how to make shared libraries""... $ac_c" 1>&6
echo "configure:3659: checking how to make shared libraries" >&5

    SA=".sa"
    SO=".so"
    LDSHARED="ld"
    SHLIB_LIBS=$LIBS

    if test "$with_gcc" = "yes"; then
	SHLIB_CCFLAGS=-fpic
	SHLIB_CXXFLAGS=-fpic
	SHLIB_BUILD="gcc -shared -fpic -o"
    else
	SHLIB_CCFLAGS=
	SHLIB_CXXFLAGS=
	SHLIB_BUILD=
    fi

    case "$system" in 
	SunOS-4* ) 
	    SHLIB_F77FLAGS=-pic
	    # Forget version numbers for now
	    #	SO='.so.$(MAJOR_VERSION).$(MINOR_VERSION)'
	    #	SA='.sa.$(MAJOR_VERSION).$(MINOR_VERSION)'
	    echo "$ac_t""okay" 1>&6
	    if test "$with_gcc" = "no"; then
		SHLIB_CCFLAGS=-pic
		SHLIB_CXXFLAGS=-pic
		SHLIB_BUILD="ld -assert pure-text -o"
	    fi
	;;
	Linux* )
	    # Should do something to make sure this is an ELF system, as
	    # don't have patience for DLL...
	    echo "$ac_t""Assuming Linux ELF.  Otherwise, reconfigure --without-shlib" 1>&6
#	    SO='.so.$(MAJOR_VERSION).$(MINOR_VERSION)'
	    SHLIB_BUILD="gcc -shared -fpic -o"

	    SOVERSION='$(MAJOR_VERSION).$(MINOR_VERSION)'

	    # Hmm, would be good to replace that trailing .0 with the
	    # compilation number or some such.  Have to think about that.

	    LDSHARED='gcc -fpic -shared'
	;;
	HP-UX-* )
	    SO=".sl"
	    SHLIB_F77FLAGS="+z"
	    echo "$ac_t""okay" 1>&6
	    if test "$with_gcc" = "no"; then
		SHLIB_CCFLAGS=+z
		SHLIB_CXXFLAGS=+z
		SHLIB_F77FLAGS=+z
		SHLIB_BUILD="ld -b -o"
	    else
		echo "$ac_t""warning: shared libs on HP with gcc is experimental" 1>&6
	    fi
	    LDSHARED="ld -b"
	;;
	AIX-* )
	    SO=".a"
	    SHLIB_F77FLAGS=-fpic
	    if test "$with_gcc" = "no"; then
		echo "$ac_t""okay" 1>&6
		SHLIB_CCFLAGS=-fpic
		SHLIB_CXXFLAGS=-fpic
		SHLIB_BUILD="ar q"
		if test "$enable_cxx" = "yes"; then
		    SHLIB_LIBS="-L/usr/lpp/xlC/lib -lC $LIBS"
		fi
	    else
		with_shlib=no
	    fi
	;;

	# The rest are probably broken.  Someone please fix them.
	# Remove the 'with_shlib=no' line, comments, and go wild.

	SunOS-5* )
	    with_shlib=no
	    echo "$ac_t""unknown" 1>&6
	    #	SHLIB_CCFLAGS="-K pic"
	    #	SHLIB_F77FLAGS="-K pic"
	    #	SHLIB_BUILD="$CC '-G -ztext -h $(SHARED_LIBRARY)'"
	    #	SHLIB_SUFFIX='.so.$(MAJOR_VERSION)'
	    LDSHARED="ld -G"
	;;
	OSF-1.* )
	    with_shlib=no
	    echo "$ac_t""unknown" 1>&6
	    #	SHLIB_CCFLAGS=-fpic
	    #	SHLIB_F77FLAGS=-fpic
	    #	SHLIB_BUILD="$CC -shared"
	    #	SHLIB_SUFFIX='.so.$(MAJOR_VERSION)'
	    LDSHARED="ld -shared -expect_unresolved \"*\""
	;;
	IRIX-5.*|IRIX64-6.* )
	    echo "$ac_t""okay" 1>&6
	    SHLIB_BUILD="$CC -shared -o"
	    LDSHARED="ld -shared"
	    RPATH="-rpath ."
	;;
	* )
	    with_shlib=no
	    echo "$ac_t""unknown" 1>&6
	;;
    esac
fi
















# Now, try this here.

# Check whether --enable-plmeta or --disable-plmeta was given.
enableval="$enable_plmeta"
if test -n "$enableval"; then
  :
fi
# Check whether --with-plmeta or --without-plmeta was given.
withval="$with_plmeta"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_plmeta" 1>&2; exit 1; }
fi

if test "$enable_plmeta" = "yes" -o "$enable_plmeta $enable_drivers" = " yes" ; then
    enable_plmeta="yes"
    cat >> confdefs.h <<\EOF
#define PLD_plmeta 1
EOF

    DEVICES="$DEVICES plmeta"
else
    enable_plmeta="no"
fi
# Check whether --enable-null or --disable-null was given.
enableval="$enable_null"
if test -n "$enableval"; then
  :
fi
# Check whether --with-null or --without-null was given.
withval="$with_null"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_null" 1>&2; exit 1; }
fi

if test "$enable_null" = "yes" -o "$enable_null $enable_drivers" = " yes" ; then
    enable_null="yes"
    cat >> confdefs.h <<\EOF
#define PLD_null 1
EOF

    DEVICES="$DEVICES null"
else
    enable_null="no"
fi
# Check whether --enable-xterm or --disable-xterm was given.
enableval="$enable_xterm"
if test -n "$enableval"; then
  :
fi
# Check whether --with-xterm or --without-xterm was given.
withval="$with_xterm"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_xterm" 1>&2; exit 1; }
fi

if test "$enable_xterm" = "yes" -o "$enable_xterm $enable_drivers" = " yes" ; then
    enable_xterm="yes"
    cat >> confdefs.h <<\EOF
#define PLD_xterm 1
EOF

    DEVICES="$DEVICES xterm"
else
    enable_xterm="no"
fi
# Check whether --enable-tek4010 or --disable-tek4010 was given.
enableval="$enable_tek4010"
if test -n "$enableval"; then
  :
fi
# Check whether --with-tek4010 or --without-tek4010 was given.
withval="$with_tek4010"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_tek4010" 1>&2; exit 1; }
fi

if test "$enable_tek4010" = "yes" -o "$enable_tek4010 $enable_drivers" = " yes" ; then
    enable_tek4010="yes"
    cat >> confdefs.h <<\EOF
#define PLD_tek4010 1
EOF

    DEVICES="$DEVICES tek4010"
else
    enable_tek4010="no"
fi
# Check whether --enable-tek4107 or --disable-tek4107 was given.
enableval="$enable_tek4107"
if test -n "$enableval"; then
  :
fi
# Check whether --with-tek4107 or --without-tek4107 was given.
withval="$with_tek4107"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_tek4107" 1>&2; exit 1; }
fi

if test "$enable_tek4107" = "yes" -o "$enable_tek4107 $enable_drivers" = " yes" ; then
    enable_tek4107="yes"
    cat >> confdefs.h <<\EOF
#define PLD_tek4107 1
EOF

    DEVICES="$DEVICES tek4107"
else
    enable_tek4107="no"
fi
# Check whether --enable-mskermit or --disable-mskermit was given.
enableval="$enable_mskermit"
if test -n "$enableval"; then
  :
fi
# Check whether --with-mskermit or --without-mskermit was given.
withval="$with_mskermit"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_mskermit" 1>&2; exit 1; }
fi

if test "$enable_mskermit" = "yes" -o "$enable_mskermit $enable_drivers" = " yes" ; then
    enable_mskermit="yes"
    cat >> confdefs.h <<\EOF
#define PLD_mskermit 1
EOF

    DEVICES="$DEVICES mskermit"
else
    enable_mskermit="no"
fi
# Check whether --enable-conex or --disable-conex was given.
enableval="$enable_conex"
if test -n "$enableval"; then
  :
fi
# Check whether --with-conex or --without-conex was given.
withval="$with_conex"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_conex" 1>&2; exit 1; }
fi

if test "$enable_conex" = "yes" -o "$enable_conex $enable_drivers" = " yes" ; then
    enable_conex="yes"
    cat >> confdefs.h <<\EOF
#define PLD_conex 1
EOF

    DEVICES="$DEVICES conex"
else
    enable_conex="no"
fi
# Check whether --enable-linuxvga or --disable-linuxvga was given.
enableval="$enable_linuxvga"
if test -n "$enableval"; then
  :
fi
# Check whether --with-linuxvga or --without-linuxvga was given.
withval="$with_linuxvga"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_linuxvga" 1>&2; exit 1; }
fi

if test "$enable_linuxvga" = "yes" -o "$enable_linuxvga $enable_drivers" = " yes" ; then
    enable_linuxvga="yes"
    cat >> confdefs.h <<\EOF
#define PLD_linuxvga 1
EOF

    DEVICES="$DEVICES linuxvga"
else
    enable_linuxvga="no"
fi
# Check whether --enable-vlt or --disable-vlt was given.
enableval="$enable_vlt"
if test -n "$enableval"; then
  :
fi
# Check whether --with-vlt or --without-vlt was given.
withval="$with_vlt"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_vlt" 1>&2; exit 1; }
fi

if test "$enable_vlt" = "yes" -o "$enable_vlt $enable_drivers" = " yes" ; then
    enable_vlt="yes"
    cat >> confdefs.h <<\EOF
#define PLD_vlt 1
EOF

    DEVICES="$DEVICES vlt"
else
    enable_vlt="no"
fi
# Check whether --enable-versaterm or --disable-versaterm was given.
enableval="$enable_versaterm"
if test -n "$enableval"; then
  :
fi
# Check whether --with-versaterm or --without-versaterm was given.
withval="$with_versaterm"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_versaterm" 1>&2; exit 1; }
fi

if test "$enable_versaterm" = "yes" -o "$enable_versaterm $enable_drivers" = " yes" ; then
    enable_versaterm="yes"
    cat >> confdefs.h <<\EOF
#define PLD_versaterm 1
EOF

    DEVICES="$DEVICES versaterm"
else
    enable_versaterm="no"
fi
# Check whether --enable-dg300 or --disable-dg300 was given.
enableval="$enable_dg300"
if test -n "$enableval"; then
  :
fi
# Check whether --with-dg300 or --without-dg300 was given.
withval="$with_dg300"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_dg300" 1>&2; exit 1; }
fi

if test "$enable_dg300" = "yes" -o "$enable_dg300 $enable_drivers" = " yes" ; then
    enable_dg300="yes"
    cat >> confdefs.h <<\EOF
#define PLD_dg300 1
EOF

    DEVICES="$DEVICES dg300"
else
    enable_dg300="no"
fi
# Check whether --enable-ps or --disable-ps was given.
enableval="$enable_ps"
if test -n "$enableval"; then
  :
fi
# Check whether --with-ps or --without-ps was given.
withval="$with_ps"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_ps" 1>&2; exit 1; }
fi

if test "$enable_ps" = "yes" -o "$enable_ps $enable_drivers" = " yes" ; then
    enable_ps="yes"
    cat >> confdefs.h <<\EOF
#define PLD_ps 1
EOF

    DEVICES="$DEVICES ps"
else
    enable_ps="no"
fi
# Check whether --enable-xfig or --disable-xfig was given.
enableval="$enable_xfig"
if test -n "$enableval"; then
  :
fi
# Check whether --with-xfig or --without-xfig was given.
withval="$with_xfig"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_xfig" 1>&2; exit 1; }
fi

if test "$enable_xfig" = "yes" -o "$enable_xfig $enable_drivers" = " yes" ; then
    enable_xfig="yes"
    cat >> confdefs.h <<\EOF
#define PLD_xfig 1
EOF

    DEVICES="$DEVICES xfig"
else
    enable_xfig="no"
fi
# Check whether --enable-ljii or --disable-ljii was given.
enableval="$enable_ljii"
if test -n "$enableval"; then
  :
fi
# Check whether --with-ljii or --without-ljii was given.
withval="$with_ljii"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_ljii" 1>&2; exit 1; }
fi

if test "$enable_ljii" = "yes" -o "$enable_ljii $enable_drivers" = " yes" ; then
    enable_ljii="yes"
    cat >> confdefs.h <<\EOF
#define PLD_ljii 1
EOF

    DEVICES="$DEVICES ljii"
else
    enable_ljii="no"
fi
# Check whether --enable-hp7470 or --disable-hp7470 was given.
enableval="$enable_hp7470"
if test -n "$enableval"; then
  :
fi
# Check whether --with-hp7470 or --without-hp7470 was given.
withval="$with_hp7470"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_hp7470" 1>&2; exit 1; }
fi

if test "$enable_hp7470" = "yes" -o "$enable_hp7470 $enable_drivers" = " yes" ; then
    enable_hp7470="yes"
    cat >> confdefs.h <<\EOF
#define PLD_hp7470 1
EOF

    DEVICES="$DEVICES hp7470"
else
    enable_hp7470="no"
fi
# Check whether --enable-hp7580 or --disable-hp7580 was given.
enableval="$enable_hp7580"
if test -n "$enableval"; then
  :
fi
# Check whether --with-hp7580 or --without-hp7580 was given.
withval="$with_hp7580"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_hp7580" 1>&2; exit 1; }
fi

if test "$enable_hp7580" = "yes" -o "$enable_hp7580 $enable_drivers" = " yes" ; then
    enable_hp7580="yes"
    cat >> confdefs.h <<\EOF
#define PLD_hp7580 1
EOF

    DEVICES="$DEVICES hp7580"
else
    enable_hp7580="no"
fi
# Check whether --enable-lj_hpgl or --disable-lj_hpgl was given.
enableval="$enable_lj_hpgl"
if test -n "$enableval"; then
  :
fi
# Check whether --with-lj_hpgl or --without-lj_hpgl was given.
withval="$with_lj_hpgl"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_lj_hpgl" 1>&2; exit 1; }
fi

if test "$enable_lj_hpgl" = "yes" -o "$enable_lj_hpgl $enable_drivers" = " yes" ; then
    enable_lj_hpgl="yes"
    cat >> confdefs.h <<\EOF
#define PLD_lj_hpgl 1
EOF

    DEVICES="$DEVICES lj_hpgl"
else
    enable_lj_hpgl="no"
fi
# Check whether --enable-imp or --disable-imp was given.
enableval="$enable_imp"
if test -n "$enableval"; then
  :
fi
# Check whether --with-imp or --without-imp was given.
withval="$with_imp"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_imp" 1>&2; exit 1; }
fi

if test "$enable_imp" = "yes" -o "$enable_imp $enable_drivers" = " yes" ; then
    enable_imp="yes"
    cat >> confdefs.h <<\EOF
#define PLD_imp 1
EOF

    DEVICES="$DEVICES imp"
else
    enable_imp="no"
fi
# Check whether --enable-xwin or --disable-xwin was given.
enableval="$enable_xwin"
if test -n "$enableval"; then
  :
fi
# Check whether --with-xwin or --without-xwin was given.
withval="$with_xwin"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_xwin" 1>&2; exit 1; }
fi

if test "$enable_xwin" = "yes" -o "$enable_xwin $enable_drivers" = " yes" ; then
    enable_xwin="yes"
    cat >> confdefs.h <<\EOF
#define PLD_xwin 1
EOF

    DEVICES="$DEVICES xwin"
else
    enable_xwin="no"
fi
# Check whether --enable-tk or --disable-tk was given.
enableval="$enable_tk"
if test -n "$enableval"; then
  :
fi
# Check whether --with-tk or --without-tk was given.
withval="$with_tk"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_tk" 1>&2; exit 1; }
fi

if test "$enable_tk" = "yes" -o "$enable_tk $enable_drivers" = " yes" ; then
    enable_tk="yes"
    cat >> confdefs.h <<\EOF
#define PLD_tk 1
EOF

    DEVICES="$DEVICES tk"
else
    enable_tk="no"
fi
# Check whether --enable-dp or --disable-dp was given.
enableval="$enable_dp"
if test -n "$enableval"; then
  :
fi
# Check whether --with-dp or --without-dp was given.
withval="$with_dp"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_dp" 1>&2; exit 1; }
fi

if test "$enable_dp" = "yes" -o "$enable_dp $enable_drivers" = " yes" ; then
    enable_dp="yes"
    cat >> confdefs.h <<\EOF
#define PLD_dp 1
EOF

    DEVICES="$DEVICES dp"
else
    enable_dp="no"
fi
# Check whether --enable-pbm or --disable-pbm was given.
enableval="$enable_pbm"
if test -n "$enableval"; then
  :
fi
# Check whether --with-pbm or --without-pbm was given.
withval="$with_pbm"
if test -n "$withval"; then
  { echo "configure: error: unrecognized variable: with_pbm" 1>&2; exit 1; }
fi

if test "$enable_pbm" = "yes" -o "$enable_pbm $enable_drivers" = " yes" ; then
    enable_pbm="yes"
    cat >> confdefs.h <<\EOF
#define PLD_pbm 1
EOF

    DEVICES="$DEVICES pbm"
else
    enable_pbm="no"
fi


# Okay, NOW we're done searching for stuff, so all the driver flags
# and what not will finally be set right.



echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:4254: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4259 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4267: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  rm -rf conftest*
  ac_cv_header_stdc=yes
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  ac_cv_header_stdc=no
fi
rm -f conftest*

if test $ac_cv_header_stdc = yes; then
  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 4284 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "memchr" >/dev/null 2>&1; then
  :
else
  rm -rf conftest*
  ac_cv_header_stdc=no
fi
rm -f conftest*

fi

if test $ac_cv_header_stdc = yes; then
  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 4302 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "free" >/dev/null 2>&1; then
  :
else
  rm -rf conftest*
  ac_cv_header_stdc=no
fi
rm -f conftest*

fi

if test $ac_cv_header_stdc = yes; then
  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
if test "$cross_compiling" = yes; then
  :
else
  cat > conftest.$ac_ext <<EOF
#line 4323 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
int main () { int i; for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }

EOF
if { (eval echo configure:4334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
  :
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_header_stdc=no
fi
rm -fr conftest*
fi

fi
fi

echo "$ac_t""$ac_cv_header_stdc" 1>&6
if test $ac_cv_header_stdc = yes; then
  cat >> confdefs.h <<\EOF
#define STDC_HEADERS 1
EOF

fi

for ac_hdr in unistd.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4361: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4366 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  rm -rf conftest*
  eval "ac_cv_header_$ac_safe=yes"
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  echo "$ac_t""yes" 1>&6
    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
  cat >> confdefs.h <<EOF
#define $ac_tr_hdr 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done

# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:4400: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$RANLIB"; then
  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  for ac_dir in $PATH; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_RANLIB="ranlib"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
fi
fi
RANLIB="$ac_cv_prog_RANLIB"
if test -n "$RANLIB"; then
  echo "$ac_t""$RANLIB" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

echo $ac_n "checking for pid_t""... $ac_c" 1>&6
echo "configure:4427: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4432 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  rm -rf conftest*
  ac_cv_type_pid_t=yes
else
  rm -rf conftest*
  ac_cv_type_pid_t=no
fi
rm -f conftest*

fi
echo "$ac_t""$ac_cv_type_pid_t" 1>&6
if test $ac_cv_type_pid_t = no; then
  cat >> confdefs.h <<\EOF
#define pid_t int
EOF

fi

ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
echo "configure:4461: checking for vfork.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4466 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
  rm -rf conftest*
  eval "ac_cv_header_$ac_safe=yes"
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  cat >> confdefs.h <<\EOF
#define HAVE_VFORK_H 1
EOF

else
  echo "$ac_t""no" 1>&6
fi

echo $ac_n "checking for working vfork""... $ac_c" 1>&6
echo "configure:4496: checking for working vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test "$cross_compiling" = yes; then
  echo $ac_n "checking for vfork""... $ac_c" 1>&6
echo "configure:4502: checking for vfork" >&5
if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4507 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char vfork(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char vfork();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_vfork) || defined (__stub___vfork)
choke me
#else
vfork();
#endif

; return 0; }
EOF
if { (eval echo configure:4530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_func_vfork=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_func_vfork=no"
fi
rm -f conftest*
fi

if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  :
else
  echo "$ac_t""no" 1>&6
fi

else
  cat > conftest.$ac_ext <<EOF
#line 4551 "configure"
#include "confdefs.h"
/* Thanks to Paul Eggert for this test.  */
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
/* On some sparc systems, changes by the child to local and incoming
   argument registers are propagated back to the parent.
   The compiler is told about this with #include <vfork.h>,
   but some compilers (e.g. gcc -O) don't grok <vfork.h>.
   Test for this by using a static variable whose address
   is put into a register that is clobbered by the vfork.  */
static
#ifdef __cplusplus
sparc_address_test (int arg)
#else
sparc_address_test (arg) int arg;
#endif
{
  static pid_t child;
  if (!child) {
    child = vfork ();
    if (child < 0) {
      perror ("vfork");
      _exit(2);
    }
    if (!child) {
      arg = getpid();
      write(-1, "", 0);
      _exit (arg);
    }
  }
}
main() {
  pid_t parent = getpid ();
  pid_t child;

  sparc_address_test ();

  child = vfork ();

  if (child == 0) {
    /* Here is another test for sparc vfork register problems.
       This test uses lots of local variables, at least
       as many local variables as main has allocated so far
       including compiler temporaries.  4 locals are enough for
       gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe.
       A buggy compiler should reuse the register of parent
       for one of the local variables, since it will think that
       parent can't possibly be used any more in this routine.
       Assigning to the local variable will thus munge parent
       in the parent process.  */
    pid_t
      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
    /* Convince the compiler that p..p7 are live; otherwise, it might
       use the same hardware register for all 8 local variables.  */
    if (p != p1 || p != p2 || p != p3 || p != p4
	|| p != p5 || p != p6 || p != p7)
      _exit(1);

    /* On some systems (e.g. IRIX 3.3),
       vfork doesn't separate parent from child file descriptors.
       If the child closes a descriptor before it execs or exits,
       this munges the parent's descriptor as well.
       Test for this by closing stdout in the child.  */
    _exit(close(fileno(stdout)) != 0);
  } else {
    int status;
    struct stat st;

    while (wait(&status) != child)
      ;
    exit(
	 /* Was there some problem with vforking?  */
	 child < 0

	 /* Did the child fail?  (This shouldn't happen.)  */
	 || status

	 /* Did the vfork/compiler bug occur?  */
	 || parent != getpid()

	 /* Did the file descriptor bug occur?  */
	 || fstat(fileno(stdout), &st) != 0
	 );
  }
}
EOF
if { (eval echo configure:4646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
  ac_cv_func_vfork_works=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -fr conftest*
  ac_cv_func_vfork_works=no
fi
rm -fr conftest*
fi

fi

echo "$ac_t""$ac_cv_func_vfork_works" 1>&6
if test $ac_cv_func_vfork_works = no; then
  cat >> confdefs.h <<\EOF
#define vfork fork
EOF

fi

echo $ac_n "checking for popen""... $ac_c" 1>&6
echo "configure:4669: checking for popen" >&5
if eval "test \"`echo '$''{'ac_cv_func_popen'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4674 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char popen(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char popen();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_popen) || defined (__stub___popen)
choke me
#else
popen();
#endif

; return 0; }
EOF
if { (eval echo configure:4697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
  rm -rf conftest*
  eval "ac_cv_func_popen=yes"
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  eval "ac_cv_func_popen=no"
fi
rm -f conftest*
fi

if eval "test \"`echo '$ac_cv_func_'popen`\" = yes"; then
  echo "$ac_t""yes" 1>&6
  cat >> confdefs.h <<\EOF
#define HAVE_POPEN 1
EOF

else
  echo "$ac_t""no" 1>&6
fi


# ----------------------------------------------------------------------------
# Some X11 headers require "caddr_t" even on systems that claim POSIX.1
# compliance, which is illegal.  This makes it impossible to compile
# programs that include X11 headers if _POSIX_SOURCE is defined.  I work
# around this potential problem by just defining caddr_t to 'char *' on all
# systems (unless it is set already), whether it will be needed or not.

echo $ac_n "checking for caddr_t""... $ac_c" 1>&6
echo "configure:4728: checking for caddr_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_caddr_t'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 4733 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  egrep "caddr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
  rm -rf conftest*
  ac_cv_type_caddr_t=yes
else
  rm -rf conftest*
  ac_cv_type_caddr_t=no
fi
rm -f conftest*

fi
echo "$ac_t""$ac_cv_type_caddr_t" 1>&6
if test $ac_cv_type_caddr_t = no; then
  cat >> confdefs.h <<\EOF
#define caddr_t char *
EOF

fi


# ----------------------------------------------------------------------------
# If you don't know what this is for you shouldn't be using it.
# An invisible option for now.

if test "$with_nobraindead" = "yes"; then
    cat >> confdefs.h <<\EOF
#define NOBRAINDEAD 1
EOF

fi

# ----------------------------------------------------------------------------
# For those systems with busted libc's.

if test "$with_fseek" = "yes"; then
    cat >> confdefs.h <<\EOF
#define USE_FSEEK 1
EOF

fi

# ----------------------------------------------------------------------------
# Set up library suffix.
# ----------------------------------------------------------------------------

# Define tags to be used in multiple-precision library names
#
# Single precision: tag with "f"
# Double precision: tag with "d"

if test "$with_double" = "yes"; then
    TAG_PREC="d"
else
    TAG_PREC="f"
fi

# Add suffix of:
#	b	for baseline library (no X or TK)
#	X	with X support enabled
#	tk	with X, TK, and/or Tcl-DP support enabled
#
# Build those best suited to your system and softlink to libplplotf
# and libplplotd to create the system default.  

TAG_ENABLE="b"
if test "$enable_xwin" = "yes"; then
    TAG_ENABLE="X"
fi
if test "$enable_tk" = "yes"; then
    TAG_ENABLE="tk"
fi

# Put them together

LIB_TAG="$TAG_PREC$TAG_ENABLE"



# ----------------------------------------------------------------------------
# Now build up Makefile.in, out of all the eensy-weensy little pieces.
#
# The order here is very important so that variable definitions are made in
# the right order and all dependencies are preserved.  Change at your own
# risk!
# ----------------------------------------------------------------------------

echo "$ac_t""creating Makefile.in" 1>&6

# Makefile initialization

cat $srcdir/cf/init.in		>Makefile.in 

# Default target, core source and object file lists

cat $srcdir/cf/dist.in		>>Makefile.in 

# Optional packages

if test "$enable_cxx" = "yes"; then
    cat $srcdir/cf/pkg_cxx.in	>>Makefile.in 
fi
if test "$enable_f77" = "yes"; then
    cat $srcdir/cf/pkg_f77.in	>>Makefile.in 
fi
if test "$enable_python" = "yes"; then
    cat $srcdir/cf/pkg_python.in >>Makefile.in 
fi
if test "$enable_tcl" = "yes"; then
    cat $srcdir/cf/pkg_tcl.in	>>Makefile.in 
fi
if test "$enable_tk" = "yes"; then
    cat $srcdir/cf/pkg_tk.in	>>Makefile.in 
fi

# Library targets

cat $srcdir/cf/initlib.in	>>Makefile.in

if test "$with_shlib" = "yes"; then
    SHARED=1
    if test ! -d shared; then
	mkdir shared
    fi
    case $system in 
	SunOS-4* ) 
	    cat $srcdir/cf/lib_sh_sun.in	>>Makefile.in
	;;
	AIX-* ) 
	    cat $srcdir/cf/lib_sh_aix.in	>>Makefile.in
	;;
	Linux* )
	    cat $srcdir/cf/lib_sh_linux.in	>>Makefile.in
	;;
	* )
	    cat $srcdir/cf/lib_sh.in	>>Makefile.in
	;;
    esac
else
    SHARED=0
    cat $srcdir/cf/lib_ar.in	>>Makefile.in
fi

# Program and demo file dependencies, targets

cat $srcdir/cf/exes.in		>>Makefile.in 
cat $srcdir/cf/demos.in		>>Makefile.in 

# Installation and miscellaneous.

cat $srcdir/cf/install.in	>>Makefile.in 

case $system in
    Linux* )
	cat $srcdir/cf/inst_lib_linux.in	>>Makefile.in
    ;;
    * )
	cat $srcdir/cf/inst_lib.in		>>Makefile.in
    ;;
esac

cat $srcdir/cf/misc.in		>>Makefile.in 

# Object file dependencies

cat $srcdir/cf/objs.in		>>Makefile.in 

# ----------------------------------------------------------------------------
# Now build Makedemo.in.
# Makedemo is a stand-alone makefile for the demo programs.
# Note: it links against the installed PLplot library.
# ----------------------------------------------------------------------------

echo "$ac_t""creating Makedemo.in" 1>&6

cat $srcdir/cf/init.in		>Makedemo.in 
cat $srcdir/cf/initdemo.in	>>Makedemo.in 
cat $srcdir/cf/demos.in		>>Makedemo.in 
cat $srcdir/cf/miscdemo.in	>>Makedemo.in 

# ----------------------------------------------------------------------------
# Set up variables that specify install directories
#
# You can preset these to anything you want if you don't like the default
# choice.  In particular, if you /don't/ install PLplot under its own
# directory, the examples, tcl, and doc subdirectories will cause
# problems.  In this case, set the <whatever>_DIR variables below as
# desired in ~/config/cf_plplot.in, and you are set.
# ----------------------------------------------------------------------------

if test "$prefix" = NONE; then
    prefix=$ac_default_prefix
fi
if test -z "$LIB_DIR"; then
    LIB_DIR=$prefix/lib
fi
if test -z "$BIN_DIR"; then
    BIN_DIR=$prefix/bin
fi
if test -z "$TCL_DIR"; then
    TCL_DIR=$prefix/tcl
fi
if test -z "$PYTHON_DIR"; then
    PYTHON_DIR=$prefix/python
fi
if test "$enable_python" = "yes"; then
    if test "$PYTHON_DIR" != "$PYTHON_MACH_DIR"; then
	echo "$ac_t""note: python module will be installed in $PYTHON_DIR" 1>&6;
	echo "$ac_t""note: it should be soft-linked to $PYTHON_MACH_DIR" 1>&6;
    fi
fi
if test -z "$DOC_DIR"; then
    DOC_DIR=$prefix/doc
fi
if test -z "$INFO_DIR"; then
    INFO_DIR=$prefix/info
fi
if test -z "$INCLUDE_DIR"; then
    INCLUDE_DIR=$prefix/include
fi
if test -z "$DEMOS_DIR"; then
    DEMOS_DIR=$prefix/examples
fi

cat >> confdefs.h <<EOF
#define LIB_DIR "$LIB_DIR"
EOF

cat >> confdefs.h <<EOF
#define BIN_DIR "$BIN_DIR"
EOF

cat >> confdefs.h <<EOF
#define TCL_DIR "$TCL_DIR"
EOF












# ----------------------------------------------------------------------------
# Create links to source code.
# I do this every time and just send the output to /dev/null to make sure
# we never miss any.  This should keep Geoff happy (for a while at least).
# ----------------------------------------------------------------------------

echo "$ac_t""creating links..." 1>&6

# Source, driver, and include files
    
ln -s \
$srcdir/src/*.c \
$srcdir/drivers/*.c \
$srcdir/include/*.h \
. 2>/dev/null

# Packages (interfaces) and demos associated with them

if test "$enable_cxx" = "yes"; then
    ln -s \
    $srcdir/bindings/c++/*.* \
    $srcdir/examples/c++/*.* \
    . 2>/dev/null
fi

# Note that double precision Fortran files in the stub interface are
# obtained entirely by m4 macro expansion.  This should work anywhere.
# Double precision example programs are obtained through automatic compiler
# promotion, however.  Your compiler needs to be able to automatically
# promote all real variables and constants for this to work (the HPUX 8.x
# compiler did not support this, but it's supported under 9.0).

if test "$enable_f77" = "yes"; then
    ln -s \
    $srcdir/bindings/f77/*.* \
    $srcdir/examples/f77/*.* \
    . 2>/dev/null
fi

if test "$enable_python" = "yes"; then
    ln -s \
    $srcdir/bindings/python/*.* \
    $srcdir/examples/python/*.py \
    $srcdir/examples/python/pytkdemo \
    . 2>/dev/null
fi

if test "$enable_tcl" = "yes"; then
    ln -s \
    $srcdir/bindings/tcl/*.* \
    $srcdir/bindings/tcl/pltclgen \
    $srcdir/examples/tcl/*.* \
    . 2>/dev/null
fi

if test "$enable_tk" = "yes"; then
    ln -s \
    $srcdir/bindings/tk/*.* \
    $srcdir/examples/tk/*.c \
    $srcdir/examples/tk/tk* \
    . 2>/dev/null
fi

#    $srcdir/bindings/tk/tclIndex 


# Miscellaneous

ln -s \
$srcdir/examples/c/*.* \
$srcdir/utils/*.c \
$srcdir/fonts/*.c \
$srcdir/scripts/pl* \
$srcdir/lib/*.fnt \
$srcdir/lib/*.map \
$srcdir/cf/*.in \
$srcdir/sys/unix/version \
. 2>/dev/null

# ----------------------------------------------------------------------------
# Create output files.
# ----------------------------------------------------------------------------

trap '' 1 2 15

trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15

test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'

# Any assignment to VPATH causes Sun make to only execute
# the first set of double-colon rules, so remove it if not needed.
# If there is a colon in the path, we need to keep it.
if test "x$srcdir" = x.; then
  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
fi

trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15

DEFS=-DHAVE_CONFIG_H

# Without the "./", some shells look in PATH for config.status.
: ${CONFIG_STATUS=./config.status}

echo creating $CONFIG_STATUS
rm -f $CONFIG_STATUS
cat > $CONFIG_STATUS <<EOF
#! /bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows,
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
#
# $0 $ac_configure_args
#
# Compiler output produced by configure, useful for debugging
# configure, is in ./config.log if it exists.

ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
for ac_option
do
  case "\$ac_option" in
  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
    echo "$CONFIG_STATUS generated by autoconf version 2.12"
    exit 0 ;;
  -help | --help | --hel | --he | --h)
    echo "\$ac_cs_usage"; exit 0 ;;
  *) echo "\$ac_cs_usage"; exit 1 ;;
  esac
done

ac_given_srcdir=$srcdir

trap 'rm -fr `echo "Makefile Makedemo plConfig.h plDevs.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF

# Protect against being on the right side of a sed subst in config.status. 
sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; 
 s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF
$ac_vpsub
$extrasub
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
s%@exec_prefix@%$exec_prefix%g
s%@prefix@%$prefix%g
s%@program_transform_name@%$program_transform_name%g
s%@bindir@%$bindir%g
s%@sbindir@%$sbindir%g
s%@libexecdir@%$libexecdir%g
s%@datadir@%$datadir%g
s%@sysconfdir@%$sysconfdir%g
s%@sharedstatedir@%$sharedstatedir%g
s%@localstatedir@%$localstatedir%g
s%@libdir@%$libdir%g
s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@found_photon@%$found_photon%g
s%@found_cxx@%$found_cxx%g
s%@found_F77@%$found_F77%g
s%@found_fc@%$found_fc%g
s%@found_f77@%$found_f77%g
s%@CC@%$CC%g
s%@CXX@%$CXX%g
s%@OCC@%$OCC%g
s%@F77@%$F77%g
s%@LDC@%$LDC%g
s%@LDCXX@%$LDCXX%g
s%@LDF@%$LDF%g
s%@CXX_FLAGS@%$CXX_FLAGS%g
s%@CC_FLAGS@%$CC_FLAGS%g
s%@LDC_FLAGS@%$LDC_FLAGS%g
s%@LDCXX_FLAGS@%$LDCXX_FLAGS%g
s%@F77_FLAGS@%$F77_FLAGS%g
s%@LDF_FLAGS@%$LDF_FLAGS%g
s%@CPP@%$CPP%g
s%@MAKEINDEX@%$MAKEINDEX%g
s%@TCL_INDEX_FILES@%$TCL_INDEX_FILES%g
s%@PYTHON_INC_DIR@%$PYTHON_INC_DIR%g
s%@PYTHON_MOD_DIR@%$PYTHON_MOD_DIR%g
s%@PYTHON_MACH_DIR@%$PYTHON_MACH_DIR%g
s%@PYTHON_CFG_DIR@%$PYTHON_CFG_DIR%g
s%@INCS@%$INCS%g
s%@SHLIB_BUILD@%$SHLIB_BUILD%g
s%@SA@%$SA%g
s%@SO@%$SO%g
s%@LDSHARED@%$LDSHARED%g
s%@RPATH@%$RPATH%g
s%@SOVERSION@%$SOVERSION%g
s%@SHLIB_CCFLAGS@%$SHLIB_CCFLAGS%g
s%@SHLIB_CXXFLAGS@%$SHLIB_CXXFLAGS%g
s%@SHLIB_F77FLAGS@%$SHLIB_F77FLAGS%g
s%@SHLIB_LIBS@%$SHLIB_LIBS%g
s%@RANLIB@%$RANLIB%g
s%@LIB_TAG@%$LIB_TAG%g
s%@LIB_DIR@%$LIB_DIR%g
s%@BIN_DIR@%$BIN_DIR%g
s%@TCL_DIR@%$TCL_DIR%g
s%@PYTHON_DIR@%$PYTHON_DIR%g
s%@DOC_DIR@%$DOC_DIR%g
s%@INFO_DIR@%$INFO_DIR%g
s%@INCLUDE_DIR@%$INCLUDE_DIR%g
s%@DEMOS_DIR@%$DEMOS_DIR%g
s%@SHARED@%$SHARED%g

CEOF
EOF
cat >> $CONFIG_STATUS <<EOF

CONFIG_FILES=\${CONFIG_FILES-"Makefile Makedemo"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
  # Support "outfile[:infile]", defaulting infile="outfile.in".
  case "$ac_file" in
  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  *) ac_file_in="${ac_file}.in" ;;
  esac

  # Adjust relative srcdir, etc. for subdirectories.

  # Remove last slash and all that follows it.  Not all systems have dirname.
  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
    # The file is in a subdirectory.
    test ! -d "$ac_dir" && mkdir "$ac_dir"
    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
    # A "../" for each directory in $ac_dir_suffix.
    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
  else
    ac_dir_suffix= ac_dots=
  fi

  case "$ac_given_srcdir" in
  .)  srcdir=.
      if test -z "$ac_dots"; then top_srcdir=.
      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
  *) # Relative path.
    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
    top_srcdir="$ac_dots$ac_given_srcdir" ;;
  esac

  echo creating "$ac_file"
  rm -f "$ac_file"
  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
  case "$ac_file" in
  *Makefile*) ac_comsub="1i\\
# $configure_input" ;;
  *) ac_comsub= ;;
  esac
  sed -e "$ac_comsub
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
" -f conftest.subs `if test -f $ac_file_in; then echo $ac_file_in; else echo $ac_given_srcdir/$ac_file_in; fi` > $ac_file
fi; done
rm -f conftest.subs

# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
# NAME is the cpp macro being defined and VALUE is the value it is being given.
#
# ac_d sets the value in "#define NAME VALUE" lines.
ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
ac_dC='\3'
ac_dD='%g'
# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
ac_uB='\([ 	]\)%\1#\2define\3'
ac_uC=' '
ac_uD='\4%g'
# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
ac_eB='$%\1#\2define\3'
ac_eC=' '
ac_eD='%g'

CONFIG_HEADERS=${CONFIG_HEADERS-"plConfig.h plDevs.h"}
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
  # Support "outfile[:infile]", defaulting infile="outfile.in".
  case "$ac_file" in
  *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'`
       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  *) ac_file_in="${ac_file}.in" ;;
  esac

  echo creating $ac_file

  rm -f conftest.frag conftest.in conftest.out
  cp `if test -f $ac_file_in; then echo $ac_file_in; else echo $ac_given_srcdir/$ac_file_in; fi` conftest.in

EOF

# Transform confdefs.h into a sed script conftest.vals that substitutes
# the proper values into config.h.in to produce config.h.  And first:
# Protect against being on the right side of a sed subst in config.status. 
# Protect against being in an unquoted here document in config.status.
rm -f conftest.vals
cat > conftest.hdr <<\EOF
s/[\\&%]/\\&/g
s%[\\$`]%\\&%g
s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
s%ac_d%ac_u%gp
s%ac_u%ac_e%gp
EOF
sed -n -f conftest.hdr confdefs.h > conftest.vals
rm -f conftest.hdr

# This sed command replaces #undef with comments.  This is necessary, for
# example, in the case of _POSIX_SOURCE, which is predefined and required
# on some systems where configure will not decide to define it.
cat >> conftest.vals <<\EOF
s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
EOF

# Break up conftest.vals because some shells have a limit on
# the size of here documents, and old seds have small limits too.
# Maximum number of lines to put in a single here document.
ac_max_here_lines=12

rm -f conftest.tail
while :
do
  ac_lines=`grep -c . conftest.vals`
  # grep -c gives empty output for an empty file on some AIX systems.
  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
  # Write a limited-size here document to conftest.frag.
  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
  echo 'CEOF
  sed -f conftest.frag conftest.in > conftest.out
  rm -f conftest.in
  mv conftest.out conftest.in
' >> $CONFIG_STATUS
  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
  rm -f conftest.vals
  mv conftest.tail conftest.vals
done
rm -f conftest.vals

cat >> $CONFIG_STATUS <<\EOF
  rm -f conftest.frag conftest.h
  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
  cat conftest.in >> conftest.h
  rm -f conftest.in
  if cmp -s $ac_file conftest.h 2>/dev/null; then
    echo "$ac_file is unchanged"
    rm -f conftest.h
  else
    rm -f $ac_file
    mv conftest.h $ac_file
  fi
fi; done

EOF
cat >> $CONFIG_STATUS <<EOF

EOF
cat >> $CONFIG_STATUS <<\EOF

exit 0
EOF
chmod +x $CONFIG_STATUS
rm -fr confdefs* $ac_clean_files
test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1


# ----------------------------------------------------------------------------
# Print out some of the more important settings.
#
# In a reversal of previous practice, I print the actual variables in the
# configure log.  This is to remind the user of the difference between the
# command line syntax (which you can always get help on by issuing a --help
# option) and the internal representation.  It's necessary to remember this
# for when you want to set the variable directly via ~/config/cf_plplot.in.
# ----------------------------------------------------------------------------

plplot_config_result_msg="Configure results:

command:	$plplot_config_invocation
system:		$system
prefix:		$prefix
CC:		$CC $CC_FLAGS
LDC:		$LDC $LDC_FLAGS"

if test "$enable_cxx" = "yes"; then
    plplot_config_result_msg=\
"$plplot_config_result_msg
CXX:		$CXX $CXX_FLAGS
LDCXX:		$LDCXX $LDCXX_FLAGS"
fi

if test "$enable_f77" = "yes"; then
    plplot_config_result_msg=\
"$plplot_config_result_msg
F77:		$F77 $F77_FLAGS
LDF:		$LDF $LDF_FLAGS"
fi

plplot_config_result_msg=\
"$plplot_config_result_msg
INCS:		$INCS
LIBS:		$LIBS
LIB_TAG:	$LIB_TAG
devices:	$DEVICES

with_shlib:	$with_shlib		with_double:	$with_double
with_debug:	$with_debug		with_opt:	$with_opt
with_warn:	$with_warn		with_profile:	$with_profile
with_f2c:	$with_f2c		with_gcc:	$with_gcc

enable_xwin:	$enable_xwin		enable_tcl:	$enable_tcl
enable_tk:	$enable_tk		enable_dp:	$enable_dp
enable_itcl:	$enable_itcl		enable_f77:	$enable_f77
enable_cxx:	$enable_cxx		enable_python:	$enable_python
"

cat << EOF > config.summary
$plplot_config_result_msg
EOF

echo "$ac_t""$plplot_config_result_msg" 1>&6
