#!/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_gcc=no
with_warn=no
with_dbmalloc=no
with_fseek=no
with_pkgdir=
with_rpath=yes
with_nobraindead=no

enable_drivers=yes
#no required by default because yes needs shared libraries which we don't know
#about at this point.
enable_dyndrivers=no
enable_f77=yes
enable_cxx=yes
enable_python=yes
enable_java=no
enable_tcl=yes
enable_itcl=yes
enable_octave=yes
#explicit default values must be specified here for library and header 
#searching to work right for the following variables.  Note these variables
#also have a driver role to play, but unlike these, pure-driver variables
#(e.g., enable_tek4010) do not require a default to be specified here.
enable_gnome=no
enable_ntk=no
enable_png=yes
enable_jpeg=yes
enable_cgm=yes
enable_tk=yes
enable_xwin=yes

# separate the concept of desiring a driver (above) with
# having system support for it.
has_x11=yes
has_tcl=yes
has_tk=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
    ;;
    next*|NeXT*|NEXT* ) 
	with_gcc=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 in $*; 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.13 
# 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
"
ac_help="$ac_help
  --with-debug            compile with debugging ($with_debug)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-opt              compile with optimization ($with_opt)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-double           use double precision floats ($with_double)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-profile          turn on profiling option ($with_profile)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-shlib            build shared libraries ($with_shlib)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-gcc              use gcc to compile C and C++ code ($with_gcc)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-warn             enable all compilation warnings ($with_warn)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-dbmalloc         link with libdbmalloc ($with_dbmalloc)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-pkgdir=DIR       locate libraries and includes under DIR"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-fseek            use fseek/ftell rather than fsetpos/fgetpos ($with_fseek)"
ac_help="$ac_help
"
ac_help="$ac_help
  --with-rpath            link libraries with -rpath option ($with_rpath)"
ac_help="$ac_help
"
ac_help="$ac_help
"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-drivers        enable all device drivers ($enable_drivers)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-dyndrivers     enable dynamic loading of drivers ($enable_dyndrivers)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-f77            compile Fortran-77 interface code ($enable_f77)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-cxx            compile C++ interface code ($enable_cxx)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-python         compile Python interface code ($enable_python)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-java           compile Java interface code ($enable_java)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-octave         compile Octave interface code ($enable_octave)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-tcl            compile Tcl interface code ($enable_tcl)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-itcl           enable incr Tcl interface code ($enable_itcl)"
ac_help="$ac_help
"
ac_default_prefix=/usr/local/plplot
ac_help="$ac_help
  --with-x                use the X Window System"
ac_help="$ac_help
  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)"
ac_help="$ac_help
  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)"
ac_help="$ac_help
  --disable-gtktest       Do not try to compile and run a test GTK program"
ac_help="$ac_help
  --with-gnome-includes   Specify location of GNOME headers"
ac_help="$ac_help
  --with-gnome-libs       Specify location of GNOME libs"
ac_help="$ac_help
  --with-gnome            Specify prefix for GNOME files"
ac_help="$ac_help
  --with-mkoctfile=file   Specify mkoctfile"
ac_help="$ac_help
 --with-octavexe=file      Specify Octave"
ac_help="$ac_help
  --enable-plmeta         enable plmeta device driver ($enable_plmeta)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-null           enable null device driver ($enable_null)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-xterm          enable xterm device driver ($enable_xterm)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-tek4010        enable tek4010 device driver ($enable_tek4010)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-tek4010f       enable tek4010f device driver ($enable_tek4010f)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-tek4107        enable tek4107 device driver ($enable_tek4107)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-tek4107f       enable tek4107f device driver ($enable_tek4107f)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-mskermit       enable mskermit device driver ($enable_mskermit)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-conex          enable conex device driver ($enable_conex)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-linuxvga       enable linuxvga device driver ($enable_linuxvga)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-vlt            enable vlt device driver ($enable_vlt)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-versaterm      enable versaterm device driver ($enable_versaterm)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-dg300          enable dg300 device driver ($enable_dg300)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-png            enable png device driver ($enable_png)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-jpeg           enable jpeg device driver ($enable_jpeg)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-cgm            enable cgm device driver ($enable_cgm)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-ps             enable ps device driver ($enable_ps)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-psc            enable psc device driver ($enable_psc)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-xfig           enable xfig device driver ($enable_xfig)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-ljii           enable ljii device driver ($enable_ljii)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-hp7470         enable hp7470 device driver ($enable_hp7470)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-hp7580         enable hp7580 device driver ($enable_hp7580)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-lj_hpgl        enable lj_hpgl device driver ($enable_lj_hpgl)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-ljiip          enable ljiip device driver ($enable_ljiip)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-imp            enable imp device driver ($enable_imp)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-xwin           enable xwin device driver ($enable_xwin)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-tk             enable tk device driver ($enable_tk)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-pbm            enable pbm device driver ($enable_pbm)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-gnome          enable gnome device driver ($enable_gnome)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-pstex          enable pstex device driver ($enable_pstex)"
ac_help="$ac_help
"
ac_help="$ac_help
  --enable-ntk            enable ntk device driver ($enable_ntk)"
ac_help="$ac_help
"

# 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=
SHELL=${CONFIG_SHELL-/bin/sh}
# 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.13"
    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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross

ac_exeext=
ac_objext=o
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



# ----------------------------------------------------------------------------
# Here is the centralized place for defining the release version of the 
# PLplot package.
#
# This is done by the file cf/version.in which is included in configure
# via the magic of autoconf.  configure then propagates the version
# information appropriately for Unix/Linux systems.
#
# Other operating systems with their own unique plplot
# configuration (see subdirectories of sys) should use cf/version.in 
# to obtain the version information directly.
# ----------------------------------------------------------------------------

MAJOR_VERSION=5
MINOR_VERSION=1
RELEASE_VERSION=0

PLPLOT_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION




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


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

# Fix up srcdir to be absolute to prevent problems later
srcdir=`(cd $srcdir; pwd)`

plplot_config_invocation="$0 $*"

# Set up a command for automatic reconfigures.  This ensures whatever 
# switches have been thrown previously are used again. 
 
if test -n "$*"; then 
    echo "$plplot_config_invocation" >$srcdir/reconfig
    chmod +x $srcdir/reconfig 
else 
    rm -f $srcdir/reconfig >/dev/null 2>&1 
fi 

if test `pwd` = "$srcdir"; then
    echo "setting up to configure in tmp directory -- hold on..."
    if test ! -d tmp; then
	mkdir tmp
    fi
    cd tmp
    if test -f $srcdir/cf_plplot.in ; then
        ln -s $srcdir/cf_plplot.in . 2>/dev/null
    fi
    exec $srcdir/configure "$@"
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.
if test "${with_defaults+set}" = set; then
  withval="$with_defaults"
  :
fi
# Check whether --enable-defaults or --disable-defaults was given.
if test "${enable_defaults+set}" = set; then
  enableval="$enable_defaults"
  { echo "configure: error: unrecognized variable: enable_defaults" 1>&2; exit 1; }
fi


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


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


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


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


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


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


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


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


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


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


# Check whether --with-rpath or --without-rpath was given.
if test "${with_rpath+set}" = set; then
  withval="$with_rpath"
  :
fi
# Check whether --enable-rpath or --disable-rpath was given.
if test "${enable_rpath+set}" = set; then
  enableval="$enable_rpath"
  { echo "configure: error: unrecognized variable: enable_rpath" 1>&2; exit 1; }
fi


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


# Check whether --enable-drivers or --disable-drivers was given.
if test "${enable_drivers+set}" = set; then
  enableval="$enable_drivers"
  :
fi
# Check whether --with-drivers or --without-drivers was given.
if test "${with_drivers+set}" = set; then
  withval="$with_drivers"
  { echo "configure: error: unrecognized variable: with_drivers" 1>&2; exit 1; }
fi


# Check whether --enable-dyndrivers or --disable-dyndrivers was given.
if test "${enable_dyndrivers+set}" = set; then
  enableval="$enable_dyndrivers"
  :
fi
# Check whether --with-dyndrivers or --without-dyndrivers was given.
if test "${with_dyndrivers+set}" = set; then
  withval="$with_dyndrivers"
  { echo "configure: error: unrecognized variable: with_dyndrivers" 1>&2; exit 1; }
fi


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


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


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


# Check whether --enable-java or --disable-java was given.
if test "${enable_java+set}" = set; then
  enableval="$enable_java"
  :
fi
# Check whether --with-java or --without-java was given.
if test "${with_java+set}" = set; then
  withval="$with_java"
  { echo "configure: error: unrecognized variable: with_java" 1>&2; exit 1; }
fi


# Check whether --enable-octave or --disable-octave was given.
if test "${enable_octave+set}" = set; then
  enableval="$enable_octave"
  :
fi
# Check whether --with-octave or --without-octave was given.
if test "${with_octave+set}" = set; then
  withval="$with_octave"
  { echo "configure: error: unrecognized variable: with_octave" 1>&2; exit 1; }
fi


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


# Check whether --enable-itcl or --disable-itcl was given.
if test "${enable_itcl+set}" = set; then
  enableval="$enable_itcl"
  :
fi
# Check whether --with-itcl or --without-itcl was given.
if test "${with_itcl+set}" = set; then
  withval="$with_itcl"
  { 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 flag to enable searching for dynloadable drivers, if appropriate.
# ----------------------------------------------------------------------------

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

fi

# ----------------------------------------------------------------------------
# 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:1323: 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%/.*/%%'`
      binprefix=`echo $prefix | sed 's%/[^/][^/]*$%%'`
      if test $dirname = "bin"; then
	echo "$ac_t""$binprefix" 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.
# ----------------------------------------------------------------------------

# Define tags to be used in multiple-precision library names
# Must be done right away because these tags used in PL_DRIVERS macro.
# Double precision: tag with "d"
# Single precision: tag with no symbol
# drivers.db name must be tagged as well.

if test "$with_double" = "yes"; then
    LIB_TAG="d"
    DRIVERS_DB="driversd.db"
else
    LIB_TAG=
    DRIVERS_DB="drivers.db"
fi


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



LIBS=""
INCS=""

# sysconf.in   --*-Autoconf-*--
#
# 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="so a"

case "$system" in 
#    aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
#	CC=xlc
#    ;;
#    alpha*|ALPHA*|Alpha*|OSF* ) 
#	LIBEXTNS="so a"
#    ;;
#    ;;
    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 because there is no standard way to invoke double
# precision in Fortran from the command line we use m4 preprocessing
# to do it for all systems.

if test "$with_double" = "yes"; then
#    DBL_FLAG_C=-DDOUBLE
#    DBL_FLAG_CXX=-DDOUBLE
    DBL_FLAG_M4=-DDOUBLE
    cat >> confdefs.h <<\EOF
#define PL_DOUBLE 1
EOF

#    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
#
# On some systems, gcc is the default.  Some systems, however, do not
# support gcc, or for some other reason, the vendor compiler is
# preferred. 
#
# The actual setup for gcc 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="cc -Ae"
	;;
	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 test "$enable_cxx" = "yes"; then

    # If KAI C++ (Kuck and Associates) is available, use that.
    
    found_cxx=no
    if test -z "$CXX" -o "$CXX" = "KCC"; then
	found_kcc=
	# 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:1570: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_found_kcc'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  if test -n "$found_kcc"; then
  ac_cv_prog_found_kcc="$found_kcc" # Let the user override the test.
else
  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; do
    test -z "$ac_dir" && ac_dir=.
    if test -f $ac_dir/$ac_word; then
      ac_cv_prog_found_kcc="yes"
      break
    fi
  done
  IFS="$ac_save_ifs"
  test -z "$ac_cv_prog_found_kcc" && ac_cv_prog_found_kcc="no"
fi
fi
found_kcc="$ac_cv_prog_found_kcc"
if test -n "$found_kcc"; then
  echo "$ac_t""$found_kcc" 1>&6
else
  echo "$ac_t""no" 1>&6
fi

	if test "$found_kcc" = "yes" ; then
	    found_cxx=yes
	    echo "$ac_t""Found KAI C++, using that!" 1>&6
	    CXX=KCC

            # If the user wants to compile with --thread_safe, must specify it
            # in USER_FLAGS_CXX & USER_FLAGS_LDCXX.  Be sure to specify both
            # as thread-safe C++ is not link-compatible with non-thread-safe
            # C++ (the default).

            SYS_FLAGS_CXX=
            SYS_FLAGS_LCXX=
	fi
    fi

    # If gcc has been specified, use that.  Otherwise do NOT use gcc.
    # Mixing/matching compilers is best left to the experts.

    if test -z "$CXX"; then
	if test "$with_gcc" = "yes"; then
	    # Need to use 'g++' with gcc for proper operation
	    CXX=g++
	else
	    CXX=CC
	    case "$system" in
		aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
		    CXX=xlC
		;;
		hp*|HP* ) 
		    CXX="CC +a1"
		;;
	    esac
	fi
    fi

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

    if test ! "$found_cxx" = "yes"; 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:1639: 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=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; 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
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
	    ;;
	    CRAY* ) 
		F77=cf77
	    ;;
	esac
    fi

    # Try to locate the executable now.  If it can't be found, look
    # for g77.

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

	if test "$found_g77" = "no"; then
	    echo "$ac_t""warning: cannot find Fortran compiler, setting enable_f77=no" 1>&6
	    enable_f77=no
	else
	    F77=g77
	fi
    fi
fi

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

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

    if test "$with_warn" = "yes"; then
	SYS_FLAGS_C=-Wall
    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.
# ----------------------------------------------------------------------------

case "$system" in 
    aix*|AIX*|rs*|RS*|ibm*|IBM* ) 
	if test "$with_gcc" = "no"; then
	    SYS_FLAGS_CXX=-+
	fi
	if test "$with_double" = "yes"; then
#	    DBL_FLAG_F="-qAUTODBL=DBLPAD"
	    DBL_FLAG_F=
	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* ) 
	SYS_FLAGS_F77="-novms -f77"
	if test "$with_debug" = "yes"; then
	    DEBUG_FLAG_F="-g -ga -X18"
	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

	if test $with_double = "yes"; then
#	    DBL_FLAG_F=+autodblpad
	    DBL_FLAG_F=
	fi
    ;;
    irix*|IRIX*|Irix*|sgi*|SGI* ) 
    ;;
    IRIX64-6.2 )
	    SYS_FLAGS_C="-D_BSD_SIGNALS"
    ;;
    linux*|LINUX*|Linux* ) 
#	    SYS_FLAGS_C="-ansi"
#	    SYS_FLAGS_C="-ansi -pedantic -Wall"
    ;;
    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"
	    DBL_FLAG_F=
	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.
#
# There are two ways to modify this list:
#  - set USER_FLAGS_<whatever> to taste
#  - override <whatever>_FLAGS ahead of time
# ----------------------------------------------------------------------------

if test -z "$CC_FLAGS"; then
    CC_FLAGS="-c $DBL_FLAG_C $DEBUG_FLAG_C $SYS_FLAGS_C $PROF_FLAG_C \
     $OPT_FLAG_C $USER_FLAGS_C $GNOME_FLAGS"
fi
if test -z "$LDC_FLAGS"; then
    LDC_FLAGS="$PROF_FLAG_LC $SYS_FLAGS_LC $DEBUG_FLAG_LC $USER_FLAGS_LC"
fi

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

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

# The -S2000 -B8192 flags are apparently useful for System V, but are
# definitely ignored on GNU/Linux according to that system's info
# documentation of m4.  If those flags mess up other non-System V systems,
# then something special will have to be done.
M4_FLAGS="-S2000 -B8192 $DBL_FLAG_M4" 


















echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:2069: 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 2084 "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:2090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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 2101 "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:2107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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} -nologo -E"
  cat > conftest.$ac_ext <<EOF
#line 2118 "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:2124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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*
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



# sysloc.in   --*-Autoconf-*--
#
# 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.

ITKLIBSTR=-litk
TKLIBSTR=-ltk
ITCLLIBSTR=-litcl
TCLLIBSTR=-ltcl
XLIBSTR=-lX11
GDLIBSTR=-lgd
CDLIBSTR=-lcd
PNGLIBSTR=-lpng
JPEGLIBSTR=-ljpeg
ZLIBLIBSTR=-lz

# Add the current directory to the include path.  This must occur
# first in the list, before we add the directories for any auxilliary
# packages, in order to ensure that the build dir takes precedence
# over anything that may be just lying around in the environment.  For
# example, we don't want the files from a previous version of PLplot
# which may be left in $prefix/include/plplot/*.h to take precedence
# over the files from the current build.


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


# ----------------------------------------------------------------------------
# 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
    has_x11=no;
fi

if test "$has_x11" = "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:2226: checking for X" >&5

# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
  withval="$with_x"
  :
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 2288 "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:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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 2362 "configure"
#include "confdefs.h"

int main() {
${x_direct_test_function}()
; return 0; }
EOF
if { (eval echo configure:2369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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

	# These notes and logic changes by AWI.
	# If AC_PATH_X succeeds it sets $x_includes and $x_libraries to
	# the correct values, but the behaviour is not specified when it
	# fails on one or both of these searches.  To account for this
	# ambiguity while still being efficient simply put x_includes and 
	# x_libraries first in the appropriate search path if AC_TRY_CPP
	# or AC_CHECK_LIB fails to find the headers or libraries in
	# the default location.

	XINCDIR=""
	cat > conftest.$ac_ext <<EOF
#line 2466 "configure"
#include "confdefs.h"
#include <X11/Intrinsic.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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="\
	    $x_includes \
	    /usr/X11R6/include \
	    /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 $incdirs; 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
		has_x11=no;
	    fi 
fi
rm -f conftest*

	if test "$XINCDIR" = "/usr/include"; then
	    XINCDIR=default
	fi

	XLIBDIR=""
	echo $ac_n "checking for main in -lX11""... $ac_c" 1>&6
echo "configure:2522: 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 2530 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:2537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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="\
	    $x_libraries \
	    /usr/X11R6/lib \
	    /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 $libdirs; do
		if test -r "$dir/libX11.so" -o -r "$dir/libX11.a"; then
		    XLIBDIR="$dir"
		    echo "$ac_t""but found in $dir" 1>&6
		    break
		fi
	    done
	    if test -z "$XLIBDIR"; then
		echo "$ac_t""warning: X11 library not found" 1>&6
		XLIBDIR=default
		enable_xwin=no
		has_x11=no
	    fi 
fi


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

# ----------------------------------------------------------------------------
# Attempt to find jni.h, if java support is enabled.
# ----------------------------------------------------------------------------

if test "$enable_java" = "yes"; then
    if test -n "$JAVA_HOME"; then
	if test -r "$JAVA_HOME/include/jni.h"; then
	    JAVAINCDIR="$JAVA_HOME/include"
	fi
    else
	# Should make token effort to find jni.h anyway, presumably
	# employing AC_TRY_CPP.  Later...
	echo "$ac_t"""Uhhh." " 1>&6
    fi

    if test -n "$JAVAINCDIR"; then
	# See if machine dependent files exist in JAVAINCDIR (J2RE 1.3.0 IBM)
	if test -r "$JAVA_HOME/include/jni_md.h"; then
	    JAVAMDINCDIR="$JAVA_HOME/include"
	else
	# Now we need to find the machine dependent directory.
	    case $system in 
		Linux* )
		    JAVAMDINCDIR="$JAVAINCDIR/linux"
		;;
		SunOS-5* )
		    JAVAMDINCDIR="$JAVAINCDIR/solaris"
		;;
		* ) 	
		    echo "$ac_t""'Can\'t find Java machine dependent includes.'" 1>&6
		;;
	    esac
	fi
	if test ! -r "$JAVAMDINCDIR/jni_md.h"; then
	    JAVAMDINCDIR="$JAVAINCDIR/genunix"
	    if test ! -r "$JAVAMDINCDIR/jni_md.h"; then
		JAVAMDINCDIR=""
	    fi
	fi

	if test -z "$JAVAMDINCDIR"; then
	    echo "$ac_t""Missing jni_md.h" 1>&6
	    enable_java=no
	fi

    else
	echo "$ac_t""warning: Java Native Interface include file not found" 1>&6
	enable_java=no
    fi
fi

# ----------------------------------------------------------------------------
# Find libgd libraries and headers and libpng, libjpeg, and zlib libraries
# required for building png and/or jpeg drivers.  
# Written by Alan W. Irwin following what is done for X.
# ----------------------------------------------------------------------------

if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
    if test -z "$GDINCDIR"; then
        cat > conftest.$ac_ext <<EOF
#line 2654 "configure"
#include "confdefs.h"
#include <gd.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
  rm -rf conftest*
   GDINCDIR=default 
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  
	incdirs="\
	/usr/include \
	/usr/local/include"

        for dir in $incdirs; do
	    if test -r "$dir/gd.h"; then
	       GDINCDIR="$dir"
	       break
	    fi
	done
	if test -z "$GDINCDIR"; then
	    echo "$ac_t""warning: gd header files not found" 1>&6
	    GDINCDIR=default
	    enable_png=no
	    enable_jpeg=no
	fi 
fi
rm -f conftest*
    fi
    if test "$GDINCDIR" = "/usr/include"; then
        GDINCDIR=default
    fi

    if test -z "$GDLIBDIR"; then
        echo $ac_n "checking for main in -lgd""... $ac_c" 1>&6
echo "configure:2695: checking for main in -lgd" >&5
ac_lib_var=`echo gd'_'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="-lgd  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2703 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:2710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
   GDLIBDIR=default 
else
  echo "$ac_t""no" 1>&6

	libdirs="\
	/usr/lib \
	/usr/local/lib"

        for dir in $libdirs; do
	    if test -r "$dir/libgd.so" -o -r "$dir/libgd.a"; then
	        GDLIBDIR="$dir"
		echo "$ac_t""but found in $dir" 1>&6
		break
	    fi
	done
	if test -z "$GDLIBDIR"; then
	    echo "$ac_t""warning: gd library not found" 1>&6
	    GDLIBDIR=default
	    enable_png=no
	    enable_jpeg=no
	fi 
fi

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

if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
    if test -z "$PNGLIBDIR"; then
        echo $ac_n "checking for main in -lpng""... $ac_c" 1>&6
echo "configure:2757: checking for main in -lpng" >&5
ac_lib_var=`echo png'_'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="-lpng  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2765 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:2772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
   PNGLIBDIR=default 
else
  echo "$ac_t""no" 1>&6

	libdirs="\
	/usr/lib \
	/usr/local/lib"

        for dir in $libdirs; do
	    if test -r "$dir/libpng.so" -o -r "$dir/libpng.a"; then
	        PNGLIBDIR="$dir"
		echo "$ac_t""but found in $dir" 1>&6
		break
	    fi
	done
	if test -z "$PNGLIBDIR"; then
	    echo "$ac_t""warning: png library not found" 1>&6
	    PNGLIBDIR=default
	    enable_png=no
	    enable_jpeg=no
	fi 
fi

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

if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
    if test -z "$JPEGLIBDIR"; then
        echo $ac_n "checking for main in -ljpeg""... $ac_c" 1>&6
echo "configure:2819: checking for main in -ljpeg" >&5
ac_lib_var=`echo jpeg'_'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="-ljpeg  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2827 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:2834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
   JPEGLIBDIR=default 
else
  echo "$ac_t""no" 1>&6

	libdirs="\
	/usr/lib \
	/usr/local/lib"

        for dir in $libdirs; do
	    if test -r "$dir/libjpeg.so" -o -r "$dir/libjpeg.a"; then
	        JPEGLIBDIR="$dir"
		echo "$ac_t""but found in $dir" 1>&6
		break
	    fi
	done
	if test -z "$JPEGLIBDIR"; then
	    echo "$ac_t""warning: jpeg library not found" 1>&6
	    JPEGLIBDIR=default
	    enable_png=no
	    enable_jpeg=no
	fi 
fi

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

if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
    if test -z "$ZLIBLIBDIR"; then
        echo $ac_n "checking for main in -lz""... $ac_c" 1>&6
echo "configure:2881: checking for main in -lz" >&5
ac_lib_var=`echo z'_'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="-lz  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2889 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:2896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
   ZLIBLIBDIR=default 
else
  echo "$ac_t""no" 1>&6

	libdirs="\
	/usr/lib \
	/usr/local/lib"

        for dir in $libdirs; do
	    if test -r "$dir/libz.so" -o -r "$dir/libz.a"; then
	        ZLIBLIBDIR="$dir"
		echo "$ac_t""but found in $dir" 1>&6
		break
	    fi
	done
	if test -z "$ZLIBLIBDIR"; then
	    echo "$ac_t""warning: zlib library not found" 1>&6
	    ZLIBLIBDIR=default
	    enable_png=no
	    enable_jpeg=no
	fi 
fi

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

GDLIBS=""
GDINCS=""
if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
    
    INCSW=""
    if test "$GDINCDIR" != "default"; then
	INCSW="-I$GDINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$GDINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	GDINCS="$GDINCS $INCSW"
    fi
    INCPATH="$INCPATH $GDINCDIR"

    if test "$enable_dyndrivers" = "yes"; then
	
    LIBSW=""
    if test "$GDLIBDIR" != "default"; then
	LIBSW="-L$GDLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$GDLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$GDLIBSTR"
    for lib in $GDLIBS; do
	if test "$GDLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	GDLIBS="$GDLIBS $LIBSW $LIBL"
    else
	GDLIBS="$GDLIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $GDLIBDIR"

	
    LIBSW=""
    if test "$PNGLIBDIR" != "default"; then
	LIBSW="-L$PNGLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$PNGLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$PNGLIBSTR"
    for lib in $GDLIBS; do
	if test "$PNGLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	GDLIBS="$GDLIBS $LIBSW $LIBL"
    else
	GDLIBS="$GDLIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $PNGLIBDIR"

	
    LIBSW=""
    if test "$JPEGLIBDIR" != "default"; then
	LIBSW="-L$JPEGLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$JPEGLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$JPEGLIBSTR"
    for lib in $GDLIBS; do
	if test "$JPEGLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	GDLIBS="$GDLIBS $LIBSW $LIBL"
    else
	GDLIBS="$GDLIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $JPEGLIBDIR"

	
    LIBSW=""
    if test "$ZLIBLIBDIR" != "default"; then
	LIBSW="-L$ZLIBLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$ZLIBLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$ZLIBLIBSTR"
    for lib in $GDLIBS; do
	if test "$ZLIBLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	GDLIBS="$GDLIBS $LIBSW $LIBL"
    else
	GDLIBS="$GDLIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $ZLIBLIBDIR"

    fi
fi

#next test requires C language

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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross


if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
# All required headers and libraries are present for libgd, libpng, libjpeg,
# and zlib.  Now check if this version of libgd supports png and/or jpeg.

    CFLAGS_SAVE=$CFLAGS
    LIBS_SAVE=$LIBS
    LDFLAGS_SAVE=$LDFLAGS

    CFLAGS="-I$GDINCDIR"
    LIBS="-L$GDLIBDIR -L$PNGLIBDIR -L$JPEGLIBDIR -L$ZLIBLIBDIR $GDLIBSTR $PNGLIBSTR $JPEGLIBSTR $ZLIBLIBSTR"
    LDFLAGS=

# This test for png support is made in case this is an ancient libgd that
# only supported giff (e.g., the Redhat 6.2 version).
    echo $ac_n "checking for png support in libgd""... $ac_c" 1>&6
echo "configure:3088: checking for png support in libgd" >&5
    cat > conftest.$ac_ext <<EOF
#line 3090 "configure"
#include "confdefs.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 
      gdImagePng
    ();

int main() {
gdImagePng
    ()
; return 0; }
EOF
if { (eval echo configure:3104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  echo "$ac_t""yes" 1>&6
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  echo "$ac_t""no: png driver disabled" 1>&6
      enable_png=no
    
fi
rm -f conftest*

    echo $ac_n "checking for jpeg support in libgd""... $ac_c" 1>&6
echo "configure:3118: checking for jpeg support in libgd" >&5
    cat > conftest.$ac_ext <<EOF
#line 3120 "configure"
#include "confdefs.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 
      gdImageJpeg
    ();

int main() {
gdImageJpeg
    ()
; return 0; }
EOF
if { (eval echo configure:3134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
  echo "$ac_t""yes" 1>&6
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  echo "$ac_t""no: jpeg driver disabled" 1>&6
      enable_jpeg=no
    
fi
rm -f conftest*

    CFLAGS=$CFLAGS_SAVE
    LIBS=$LIBS_SAVE
    LDFLAGS=$LDFLAGS_SAVE

fi
#restore the language the way it was before this test
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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross


# ----------------------------------------------------------------------------
# Find libcd library and header required for building cgm driver.  
# Written by Alan W. Irwin following what is done for gd driver.
# ----------------------------------------------------------------------------

if test "$enable_cgm" = "yes"; then
    if test -z "$CDINCDIR"; then
        cat > conftest.$ac_ext <<EOF
#line 3169 "configure"
#include "confdefs.h"
#include <cd.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
  rm -rf conftest*
   CDINCDIR=default 
else
  echo "$ac_err" >&5
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  
	incdirs="\
	/usr/include \
	/usr/local/include"

        for dir in $incdirs; do
	    if test -r "$dir/cd.h"; then
	       CDINCDIR="$dir"
	       break
	    fi
	done
	if test -z "$CDINCDIR"; then
	    echo "$ac_t""warning: cd header files not found" 1>&6
	    CDINCDIR=default
	    enable_cgm=no
	fi 
fi
rm -f conftest*
    fi
    if test "$CDINCDIR" = "/usr/include"; then
        CDINCDIR=default
    fi

    if test -z "$CDLIBDIR"; then
        echo $ac_n "checking for main in -lcd""... $ac_c" 1>&6
echo "configure:3209: checking for main in -lcd" >&5
ac_lib_var=`echo cd'_'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="-lcd  $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3217 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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
   CDLIBDIR=default 
else
  echo "$ac_t""no" 1>&6

	libdirs="\
	/usr/lib \
	/usr/local/lib"

        for dir in $libdirs; do
	    if test -r "$dir/libcd.so" -o -r "$dir/libcd.a"; then
	        CDLIBDIR="$dir"
		echo "$ac_t""but found in $dir" 1>&6
		break
	    fi
	done
	if test -z "$CDLIBDIR"; then
	    echo "$ac_t""warning: cd library not found" 1>&6
	    CDLIBDIR=default
	    enable_cgm=no
	fi 
fi

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

CDLIBS=""
CDINCS=""
if test "$enable_cgm" = "yes"; then
    
    INCSW=""
    if test "$CDINCDIR" != "default"; then
	INCSW="-I$CDINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$CDINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	CDINCS="$CDINCS $INCSW"
    fi
    INCPATH="$INCPATH $CDINCDIR"

    if test "$enable_dyndrivers" = "yes"; then
	
    LIBSW=""
    if test "$CDLIBDIR" != "default"; then
	LIBSW="-L$CDLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$CDLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$CDLIBSTR"
    for lib in $CDLIBS; do
	if test "$CDLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	CDLIBS="$CDLIBS $LIBSW $LIBL"
    else
	CDLIBS="$CDLIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $CDLIBDIR"

    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

# In Linux have a peculiar ambiguity where identical tcl.h files are found
# both in /usr/include and /usr/include/tcl8.2/generic.  The latter is *much*
# preferred because has everything else as well having to do with tcl.  Thus,
# AWI puts the generic include site first on the list (note that prefix can be
# "/usr" which would give bad result under Linux without this ordering.)

incdirs_default="\
/usr/include/tcl8.3/itcl-private/generic \
/usr/include/tcl8.3 \
/usr/include/tcl8.2/generic \
$prefix/include/itcl \
/usr/include/itcl3.1/generic/ \
$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 "$has_tcl" = "yes"; then
    if test -z "$TCLINCDIR"; then
	
    
    echo $ac_n "checking for tcl.h""... $ac_c" 1>&6
echo "configure:3378: 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
#
# Includes checks against old versions of tcl no longer supported.
# But you can *try* linking against ANY non-versioned tcl.
# ----------------------------------------------------------------------------

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

	for version in 8.3 8.2 8.1 8.0 ""; do
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS="so 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

	    if test -n "$TCLLIBDIR"; then
		break
	    fi
	done
	if test -n "$version"; then
	    for oldversion in 8.1 8.0; do
		if test "$version" = "$oldversion"; then
		    echo "Tcl version $oldversion not supported.. please upgrade!"
		    enable_tcl="no"
		    has_tcl="no"
		    break
		fi
	    done
	fi
	
    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:3483: 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

# There should be an itclDecls.h with the other itcl includes.
# This is missing on some distributions, so define HAVE_ITCLDECLS_H if found.

if test "$enable_itcl" = "yes"; then
    old_CPPFLAGS=$CPPFLAGS 
    CPPFLAGS=-I$ITCLINCDIR 
    ac_safe=`echo "itclDecls.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for itclDecls.h""... $ac_c" 1>&6
echo "configure:3519: checking for itclDecls.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 3524 "configure"
#include "confdefs.h"
#include <itclDecls.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3529: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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
  :
else
  echo "$ac_t""no" 1>&6
fi
 
    CPPFLAGS=$old_CPPFLAGS 
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:3561: checking for libitcl" >&5
    ITCLLIBDIR=""

	for version in 3.2 3.1 3.0 2.1 2.0 ""; do
	    if test -n "$ITCLLIBDIR"; then
		break
	    fi
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS="so 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
    if test "$enable_itcl" = "yes"; then
	if test -r $ITCLLIBDIR/itclConfig.sh; then
	    . $ITCLLIBDIR/itclConfig.sh
	fi
    fi
fi

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

if test "$has_tcl" = "no" -o "$has_x11" = "no"; then
    has_tk=no
    enable_tk=no
fi

if test "$has_tk" = "yes"; then
    if test -z "$TKINCDIR"; then
	
    
    echo $ac_n "checking for tk.h""... $ac_c" 1>&6
echo "configure:3618: 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 "$has_tk" = "yes"; then
    if test -z "$TKLIBDIR"; then
	
    echo $ac_n "checking for libtk""... $ac_c" 1>&6
echo "configure:3654: checking for libtk" >&5
    TKLIBDIR=""

	for version in 8.3 8.2 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="so 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

#-----------------------------------------------------------------------------
# ntk driver
#-----------------------------------------------------------------------------
if test "$enable_tk" = "no" -o "$enable_tcl" = "no"; then
    enable_ntk="no"
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:3712: checking for libitk" >&5
    ITKLIBDIR=""

	for version in 3.2 3.1 3.0 2.1 2.0 ""; do
	    if test -n "$ITKLIBDIR"; then
		break
	    fi
	    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS="so 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

# ----------------------------------------------------------------------------
# Assemble list of tcl/TK/X/whatever include directives.  These can go in
# any order, except the first, which supports the 'include "plplot/<header>"'
# syntax.
# ----------------------------------------------------------------------------

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_png" = "yes" -o "$enable_jpeg" = "yes"; then
    
    INCSW=""
    if test "$GDINCDIR" != "default"; then
	INCSW="-I$GDINCDIR"
    fi
    for dir in $INCPATH; do
	if test "$GDINCDIR" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH $GDINCDIR"

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

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

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

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_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:
# 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_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
    LIBL="$ITKLIBSTR"
    for lib in $LIBS; do
	if test "$ITKLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $ITKLIBDIR"

fi
if test "$enable_tk" = "yes"; then
#jc: uncomment the if/fi when tk/xwin becomes dyndrv
#    if test "$enable_dyndrivers" != "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
    LIBL="$TKLIBSTR"
    for lib in $LIBS; do
	if test "$TKLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $TKLIBDIR"

#    fi
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
    LIBL="$ITCLLIBSTR"
    for lib in $LIBS; do
	if test "$ITCLLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $ITCLLIBDIR"

fi
if test "$enable_tcl" = "yes"; then
#jc: uncomment the if/fi when tk/xwin becomes dyndrv
#    if test "$enable_dyndrivers" != "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
    LIBL="$TCLLIBSTR"
    for lib in $LIBS; do
	if test "$TCLLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $TCLLIBDIR"

#    fi
fi
if test "$enable_xwin" = "yes"; then
#jc: uncomment the if/fi when tk/xwin becomes dyndrv
#    if test "$enable_dyndrivers" != "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
    LIBL="$XLIBSTR"
    for lib in $LIBS; do
	if test "$XLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $XLIBDIR"

#    fi
fi

if test "$enable_png" = "yes" -o "$enable_jpeg" = "yes"; then
    if test "$enable_dyndrivers" != "yes"; then
	
    LIBSW=""
    if test "$GDLIBDIR" != "default"; then
	LIBSW="-L$GDLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$GDLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$GDLIBSTR"
    for lib in $LIBS; do
	if test "$GDLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $GDLIBDIR"

	
    LIBSW=""
    if test "$PNGLIBDIR" != "default"; then
	LIBSW="-L$PNGLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$PNGLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$PNGLIBSTR"
    for lib in $LIBS; do
	if test "$PNGLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $PNGLIBDIR"

	
    LIBSW=""
    if test "$JPEGLIBDIR" != "default"; then
	LIBSW="-L$JPEGLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$JPEGLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$JPEGLIBSTR"
    for lib in $LIBS; do
	if test "$JPEGLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $JPEGLIBDIR"

	
    LIBSW=""
    if test "$ZLIBLIBDIR" != "default"; then
	LIBSW="-L$ZLIBLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$ZLIBLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$ZLIBLIBSTR"
    for lib in $LIBS; do
	if test "$ZLIBLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $ZLIBLIBDIR"

    fi
fi

if test "$enable_cgm" = "yes"; then
    if test "$enable_dyndrivers" != "yes"; then
	
    LIBSW=""
    if test "$CDLIBDIR" != "default"; then
	LIBSW="-L$CDLIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$CDLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$CDLIBSTR"
    for lib in $LIBS; do
	if test "$CDLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $CDLIBDIR"

    fi
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
    LIBL="$TCL_DL_LIBS"
    for lib in $LIBS; do
	if test "$TCL_DL_LIBS" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH default"

fi

# can't use LIBPATH on ADD_TO_LIBS, as TCL/TK/X libs go only to the driver
TKPATH="" 
TKLIBS=""
if test "$has_x11" = "yes" -a "$has_tcl" = "yes" -a "$has_tk" = "yes"; then
    if test "$enable_dyndrivers" = "yes"; then
	
    LIBSW=""
    if test "$TCLLIBDIR" != "default"; then
	LIBSW="-L$TCLLIBDIR"
    fi
    for dir in $TKPATH; do
	if test "$TCLLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$TCLLIBSTR"
    for lib in $TKLIBS; do
	if test "$TCLLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	TKLIBS="$TKLIBS $LIBSW $LIBL"
    else
	TKLIBS="$TKLIBS $LIBL"
    fi
    TKPATH="$TKPATH $TCLLIBDIR"

	
    LIBSW=""
    if test "$TKLIBDIR" != "default"; then
	LIBSW="-L$TKLIBDIR"
    fi
    for dir in $TKPATH; do
	if test "$TKLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$TKLIBSTR"
    for lib in $TKLIBS; do
	if test "$TKLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	TKLIBS="$TKLIBS $LIBSW $LIBL"
    else
	TKLIBS="$TKLIBS $LIBL"
    fi
    TKPATH="$TKPATH $TKLIBDIR"

	
    LIBSW=""
    if test "$XLIBDIR" != "default"; then
	LIBSW="-L$XLIBDIR"
    fi
    for dir in $TKPATH; do
	if test "$XLIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$XLIBSTR"
    for lib in $TKLIBS; do
	if test "$XLIBSTR" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	TKLIBS="$TKLIBS $LIBSW $LIBL"
    else
	TKLIBS="$TKLIBS $LIBL"
    fi
    TKPATH="$TKPATH $XLIBDIR"

    fi
fi

# ----------------------------------------------------------------------------
# Gnome/GTK configuration tests
# Added by Rafael Laboissier on Fri Feb 23 21:34:40 CET 2001
# ----------------------------------------------------------------------------

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

  
  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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross

  # Check whether --with-gtk-prefix or --without-gtk-prefix was given.
if test "${with_gtk_prefix+set}" = set; then
  withval="$with_gtk_prefix"
  gtk_config_prefix="$withval"
else
  gtk_config_prefix=""
fi

# Check whether --with-gtk-exec-prefix or --without-gtk-exec-prefix was given.
if test "${with_gtk_exec_prefix+set}" = set; then
  withval="$with_gtk_exec_prefix"
  gtk_config_exec_prefix="$withval"
else
  gtk_config_exec_prefix=""
fi

# Check whether --enable-gtktest or --disable-gtktest was given.
if test "${enable_gtktest+set}" = set; then
  enableval="$enable_gtktest"
  :
else
  enable_gtktest=yes
fi


  for module in . gthread
  do
      case "$module" in
         gthread) 
             gtk_config_args="$gtk_config_args gthread"
         ;;
      esac
  done

  if test x$gtk_config_exec_prefix != x ; then
     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
     if test x${GTK_CONFIG+set} != xset ; then
        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
     fi
  fi
  if test x$gtk_config_prefix != x ; then
     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
     if test x${GTK_CONFIG+set} != xset ; then
        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
     fi
  fi

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

  min_gtk_version=1.2.7
  echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
echo "configure:4411: checking for GTK - version >= $min_gtk_version" >&5
  no_gtk=""
  if test "$GTK_CONFIG" = "no" ; then
    no_gtk=yes
  else
    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
    if test "x$enable_gtktest" = "xyes" ; then
      ac_save_CFLAGS="$CFLAGS"
      ac_save_LIBS="$LIBS"
      CFLAGS="$CFLAGS $GTK_CFLAGS"
      LIBS="$GTK_LIBS $LIBS"
      rm -f conf.gtktest
      if test "$cross_compiling" = yes; then
  echo $ac_n "cross compiling; assumed OK... $ac_c"
else
  cat > conftest.$ac_ext <<EOF
#line 4434 "configure"
#include "confdefs.h"

#include <gtk/gtk.h>
#include <stdio.h>
#include <stdlib.h>

int 
main ()
{
  int major, minor, micro;
  char *tmp_version;

  system ("touch conf.gtktest");

  /* HP/UX 9 (%@#!) writes to sscanf strings */
  tmp_version = g_strdup("$min_gtk_version");
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
     printf("%s, bad version string\n", "$min_gtk_version");
     exit(1);
   }

  if ((gtk_major_version != $gtk_config_major_version) ||
      (gtk_minor_version != $gtk_config_minor_version) ||
      (gtk_micro_version != $gtk_config_micro_version))
    {
      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
             gtk_major_version, gtk_minor_version, gtk_micro_version);
      printf ("*** was found! If gtk-config was correct, then it is best\n");
      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
      printf("*** required on your system.\n");
      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
      printf("*** before re-running configure\n");
    } 
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
	   (gtk_minor_version != GTK_MINOR_VERSION) ||
           (gtk_micro_version != GTK_MICRO_VERSION))
    {
      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
      printf("*** library (version %d.%d.%d)\n",
	     gtk_major_version, gtk_minor_version, gtk_micro_version);
    }
#endif /* defined (GTK_MAJOR_VERSION) ... */
  else
    {
      if ((gtk_major_version > major) ||
        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
      {
        return 0;
       }
     else
      {
        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
               gtk_major_version, gtk_minor_version, gtk_micro_version);
        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
	       major, minor, micro);
        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
        printf("***\n");
        printf("*** If you have already installed a sufficiently new version, this error\n");
        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
        printf("*** being found. The easiest way to fix this is to remove the old version\n");
        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
        printf("*** so that the correct libraries are found at run-time))\n");
      }
    }
  return 1;
}

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

       CFLAGS="$ac_save_CFLAGS"
       LIBS="$ac_save_LIBS"
     fi
  fi
  if test "x$no_gtk" = x ; then
     echo "$ac_t""yes" 1>&6
      
	
	
	
	
	

	# Check whether --with-gnome-includes or --without-gnome-includes was given.
if test "${with_gnome_includes+set}" = set; then
  withval="$with_gnome_includes"
  
	CFLAGS="$CFLAGS -I$withval"
	
fi

	
	# Check whether --with-gnome-libs or --without-gnome-libs was given.
if test "${with_gnome_libs+set}" = set; then
  withval="$with_gnome_libs"
  
	LDFLAGS="$LDFLAGS -L$withval"
	gnome_prefix=$withval
	
fi


	# Check whether --with-gnome or --without-gnome was given.
if test "${with_gnome+set}" = set; then
  withval="$with_gnome"
  if test x$withval = xyes; then
	    		want_gnome=yes
	    						    		:
        	else
	    		if test "x$withval" = xno; then
	        		want_gnome=no
	    		else
	        		want_gnome=yes
	    			LDFLAGS="$LDFLAGS -L$withval/lib"
	    			CFLAGS="$CFLAGS -I$withval/include"
	    			gnome_prefix=$withval/lib
	    		fi
  		fi
else
  want_gnome=yes
fi


	if test "x$want_gnome" = xyes; then

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

	    if test "$GNOME_CONFIG" = "no"; then
	      no_gnome_config="yes"
	    else
	      echo $ac_n "checking if $GNOME_CONFIG works""... $ac_c" 1>&6
echo "configure:4619: checking if $GNOME_CONFIG works" >&5
	      if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then
	        echo "$ac_t""yes" 1>&6
	        GNOME_LIBS="`$GNOME_CONFIG --libs-only-l gnome`"
	        GNOMEUI_LIBS="`$GNOME_CONFIG --libs-only-l gnomeui`"
	        GNOME_LIBDIR="`$GNOME_CONFIG --libs-only-L gnorba gnomeui`"
	        GNOME_INCLUDEDIR="`$GNOME_CONFIG --cflags gnorba gnomeui`"
                
	      else
	        echo "$ac_t""no" 1>&6
	        no_gnome_config="yes"
              fi
            fi

	    if test x$exec_prefix = xNONE; then
	        if test x$prefix = xNONE; then
		    gnome_prefix=$ac_default_prefix/lib
	        else
 		    gnome_prefix=$prefix/lib
	        fi
	    else
	        gnome_prefix=`eval echo \`echo $libdir\``
	    fi
	
	    if test "$no_gnome_config" = "yes"; then
              echo $ac_n "checking for gnomeConf.sh file in $gnome_prefix""... $ac_c" 1>&6
echo "configure:4645: checking for gnomeConf.sh file in $gnome_prefix" >&5
	      if test -f $gnome_prefix/gnomeConf.sh; then
	        echo "$ac_t""found" 1>&6
	        echo "loading gnome configuration from" \
		     "$gnome_prefix/gnomeConf.sh"
	        . $gnome_prefix/gnomeConf.sh
	        
	      else
	        echo "$ac_t""not found" 1>&6
 	        if test xfail = xfail; then
	          { echo "configure: error: Could not find the gnomeConf.sh file that is generated by gnome-libs install" 1>&2; exit 1; }
 	        fi
	      fi
            fi
	fi

	if test -n ""; then
	  n=""
	  for i in $n; do
	    echo $ac_n "checking extra library \"$i\"""... $ac_c" 1>&6
echo "configure:4665: checking extra library \"$i\"" >&5
	    case $i in 
	      applets)
		
		GNOME_APPLETS_LIBS=`$GNOME_CONFIG --libs-only-l applets`
		echo "$ac_t""$GNOME_APPLETS_LIBS" 1>&6;;
	      capplet)
		
		GNOME_CAPPLET_LIBS=`$GNOME_CONFIG --libs-only-l capplet`
		echo "$ac_t""$GNOME_CAPPLET_LIBS" 1>&6;;
	      *)
		echo "$ac_t""unknown library" 1>&6
	    esac
	  done
	fi


      if test "$GNOME_CONFIG" = "no"; then
        enable_gnome=no 
      fi      
  else
     echo "$ac_t""no" 1>&6
     if test "$GTK_CONFIG" = "no" ; then
       echo "*** The gtk-config script installed by GTK could not be found"
       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
       echo "*** your path, or set the GTK_CONFIG environment variable to the"
       echo "*** full path to gtk-config."
     else
       if test -f conf.gtktest ; then
        :
       else
          echo "*** Could not run GTK test program, checking why..."
          CFLAGS="$CFLAGS $GTK_CFLAGS"
          LIBS="$LIBS $GTK_LIBS"
          cat > conftest.$ac_ext <<EOF
#line 4700 "configure"
#include "confdefs.h"

#include <gtk/gtk.h>
#include <stdio.h>

int main() {
 return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); 
; return 0; }
EOF
if { (eval echo configure:4710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
  rm -rf conftest*
   echo "*** The test program compiled, but did not run. This usually means"
          echo "*** that the run-time linker is not finding GTK or finding the wrong"
          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
          echo "*** is required on your system"
	  echo "***"
          echo "*** If you have an old version installed, it is best to remove it, although"
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
          echo "***"
          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
          echo "*** came with the system with the command"
          echo "***"
          echo "***    rpm --erase --nodeps gtk gtk-devel" 
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
   echo "*** The test program failed to compile or link. See the file config.log for the"
          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" 
fi
rm -f conftest*
          CFLAGS="$ac_save_CFLAGS"
          LIBS="$ac_save_LIBS"
       fi
     fi
     GTK_CFLAGS=""
     GTK_LIBS=""
      enable_gnome=no 
  fi
  
  
  rm -f conf.gtktest
  


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

    # Include Gtk and Gnome libs
    if test "$enable_dyndrivers" != "yes"; then
	for i in $GTK_LIBS $GNOME_LIBDIR $GNOMEUI_LIBS ; do
	    case $i in 
	    -L* )
		d=`echo $i | sed 's/-L//'`
		
    LIBSW=""
    if test "$d" != "default"; then
	LIBSW="-L$d"
    fi
    for dir in $LIBPATH; do
	if test "$d" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL=""""
    for lib in $LIBS; do
	if test """" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $d"

	    ;;
	    -l* )
		
    LIBSW=""
    if test "default" != "default"; then
	LIBSW="-Ldefault"
    fi
    for dir in $LIBPATH; do
	if test "default" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$i"
    for lib in $LIBS; do
	if test "$i" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH default"

	    ;;
	    *)
	    ;;
	    esac
	done
    else # the else bellow could be easily incorporate in the if above :)
    # can't use LIBPATH on ADD_TO_LIBS, as the gnome libs go only to the driver
	GNOMELIBS=""
	GNOMEPATH=""
	for i in $GTK_LIBS $GNOME_LIBDIR $GNOMEUI_LIBS ; do
	    case $i in 
	    -L* )
		d=`echo $i | sed 's/-L//'`
		
    LIBSW=""
    if test "$d" != "default"; then
	LIBSW="-L$d"
    fi
    for dir in $GNOMEPATH; do
	if test "$d" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL=""""
    for lib in $GNOMELIBS; do
	if test """" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	GNOMELIBS="$GNOMELIBS $LIBSW $LIBL"
    else
	GNOMELIBS="$GNOMELIBS $LIBL"
    fi
    GNOMEPATH="$GNOMEPATH $d"

	    ;;
	    -l* )
		
    LIBSW=""
    if test "default" != "default"; then
	LIBSW="-Ldefault"
    fi
    for dir in $GNOMEPATH; do
	if test "default" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="$i"
    for lib in $GNOMELIBS; do
	if test "$i" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	GNOMELIBS="$GNOMELIBS $LIBSW $LIBL"
    else
	GNOMELIBS="$GNOMELIBS $LIBL"
    fi
    GNOMEPATH="$GNOMEPATH default"

	    ;;
	    *)
	    ;;
	    esac
	done
    fi

    # Include Gtk and Gnome include dirs
    GNOME_FLAGS=""
    for i in $GTK_CFLAGS $GNOME_INCLUDEDIR ; do
	case $i in 
	-I* )
	    
    INCSW=""
    if test "`echo $i | sed 's/-I//'`" != "default"; then
	INCSW="-I`echo $i | sed 's/-I//'`"
    fi
    for dir in $INCPATH; do
	if test "`echo $i | sed 's/-I//'`" = "$dir"; then
	    INCSW=""
	    break
	fi
    done
    if test -n "$INCSW"; then
	INCS="$INCS $INCSW"
    fi
    INCPATH="$INCPATH `echo $i | sed 's/-I//'`"

	    ;;
	-D* )
	    GNOME_FLAGS="$GNOME_FLAGS $i"
	    ;;
	 *)
	    ;;
	esac
    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${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross

    fi
fi 

# ----------------------------------------------------------------------------
# Octave support
# ----------------------------------------------------------------------------

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

# Check that plplot was built with shared libs
    if test "$with_shlib" = "no"; then
	echo "$ac_t""warning: Octave support requires with_shlib=yes, setting enable_octave=no." 1>&6;
	enable_octave=no;
    fi

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

	if test "$has_matwrap" = "no"; then
	    MATWRAP="./matwrap"
	fi
    fi

# check for user supplied mkoctfile
    if test "$enable_octave" = "yes"; then
	# Check whether --with-mkoctfile or --without-mkoctfile was given.
if test "${with_mkoctfile+set}" = set; then
  withval="$with_mkoctfile"
  MKOCTFILE="$withval"
else
  MKOCTFILE="mkoctfile"
fi

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

	if test "$has_mkoctfile" = "no"; then
	    echo "$ac_t""warning: $MKOCTFILE not found, disabling Octave support." 1>&6;
	    
	    enable_octave=no;
	fi
    fi

# check for user supplied Octave
    if test "$enable_octave" = "yes"; then
	# Check whether --with-octavexe or --without-octavexe was given.
if test "${with_octavexe+set}" = set; then
  withval="$with_octavexe"
  OCTAVE="$withval"
else
  OCTAVE="octave"
fi

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

	if test "$has_octave" = "no"; then
	    echo "$ac_t""warning: $OCTAVE not found, disabling Octave support." 1>&6;
	    enable_octave=no;
	fi
    fi

# Get Octave default *.oct file directory
    if test "$enable_octave" = "yes"; then
	OCTAVE_DIR='$(PREFIX)'/share/plplot_octave
	OCTAVE_OCT_DIR=`$OCTAVE -q -f <<EOF
	t = octave_config_info;
	printf("%s", t.octfiledir);
EOF`

# this is dubious. A normal user can have root access.
# But I don't want to install the oct file in non standard places!
	if ! test `touch $OCTAVE_OCT_DIR/po 2> /dev/null`; then
	    OCTAVE_OCT_DIR=$OCTAVE_DIR
	else
	    rm $OCTAVE_OCT_DIR/po
	fi
	
	
	
    fi
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:5105: checking for libdbmalloc" >&5
    DBMALLOCLIBDIR=""

    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS="so 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
    LIBL="-ldbmalloc"
    for lib in $LIBS; do
	if test "-ldbmalloc" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    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:5179: 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/python2.1 \
	/usr/include/python2.1 \
	$prefix/include/python2.1/Numeric \
	/usr/include/python2.1/Numeric \
	$prefix/include/python2.0 \
	/usr/include/python2.0 \
	$prefix/include/python2.0/Numeric \
	/usr/include/python2.0/Numeric \
	$prefix/include/python1.5 \
	/usr/include/python1.5 \
	$prefix/include/python1.5/Numeric \
	/usr/include/python1.5/Numeric \
	$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:5274: 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:5304: checking for arrayobject.h" >&5
    PYTHON_NUM_DIR=""

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

    
    if test -z "$PYTHON_NUM_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_NUM_DIR" = "/usr/include"; then
	PYTHON_NUM_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
	    # Know this is correct for Debian potato and RedHat 6.2
	    # But this comes directly from python Makefile.pre.in for dynamic
	    # loading of packages so my guess is this is now good for all Unix.
	    # This is the sub-directory where dynamically loadable modules reside
	    # (or where a symlink exists to the true location)
	    MACHDEP=site-packages
	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
	    # account for the usual case where python directories 
	    # have a version number now.
	    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
	    # for modern (versioned) systems set the plmodule.so install location
	    # to be identical to $PYTHON_MACH_DIR except possibly for the prefix
	    if test -z "$PYTHON_DIR"; then
	        PYTHON_DIR=$prefix/lib/$python_ver/$MACHDEP
	    fi

	fi
	PYTHON_CFG_DIR=$PYTHON_MOD_DIR/config
    fi
    if test -z "$PYTHON_DIR"; then
        #default location for installing plmodule.so if versioned logic failed above.
        PYTHON_DIR=$prefix/python
    fi
fi

PYTHON_INSTDIR=`echo $PYTHON_DIR | sed s%$prefix/%%`









# ----------------------------------------------------------------------------
# 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:5408: checking for libvga" >&5
    VGALIBDIR=""

    
    for dir in $libdirs; do
	if test -z "$LIBEXTNS"; then
	    LIBEXTNS="so 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
	if test "$enable_dyndrivers" = "yes"; 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
    LIBL="-lvga"
    for lib in $LINUXVGALIBS; do
	if test "-lvga" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LINUXVGALIBS="$LINUXVGALIBS $LIBSW $LIBL"
    else
	LINUXVGALIBS="$LINUXVGALIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $VGALIBDIR"
	
	else
	    
    LIBSW=""
    if test "$VGALIBDIR" != "default"; then
	LIBSW="-L$VGALIBDIR"
    fi
    for dir in $LIBPATH; do
	if test "$VGALIBDIR" = "$dir"; then
	    LIBSW=""
	    break
	fi
    done
    LIBL="-lvga"
    for lib in $LIBS; do
	if test "-lvga" = "$lib"; then
	    LIBL=""
	    break
	fi
    done
    if test -n "$LIBSW"; then
	LIBS="$LIBS $LIBSW $LIBL"
    else
	LIBS="$LIBS $LIBL"
    fi
    LIBPATH="$LIBPATH $VGALIBDIR"

	fi

    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="-lm"
	;;
	Linux* )
	    if test "$enable_f77" = "yes"; then
		EXTRA_LIBS="-ldl -lm -lg2c"
	    else
		EXTRA_LIBS="-ldl -lm"
	    fi
	;;
	* ) 	
	    echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
echo "configure:5540: 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 5548 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:5555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:5576: 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 5584 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:5591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:5612: 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 5620 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:5627: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:5648: 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 5656 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:5663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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:5684: 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 5692 "configure"
#include "confdefs.h"

int main() {
main()
; return 0; }
EOF
if { (eval echo configure:5699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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

# Now add EXTRA_LIBS to LIBS, but don't introduce duplicates.
# Used to be: LIBS="$LIBS $EXTRA_LIBS"

for lib in $EXTRA_LIBS; do
    sw=$lib
    for token in $LIBS; do
	if test $token = $lib; then
	    sw=""
	    break
	fi
    done
    if test -n "$sw"; then
	LIBS="$LIBS $sw"
    fi
done




# ----------------------------------------------------------------------------
# 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:5752: 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
	;;
    SCO* )
#       SO='.so.$(MAJOR_VERSION).$(MINOR_VERSION)'
#       SA='.sa.$(MAJOR_VERSION).$(MINOR_VERSION)'
        echo "$ac_t""Assuming sco-3.2v5 with gcc. Otherwise, reconfigure --without-shlib" 1>&6
        SOVERSION='$(MAJOR_VERSION).$(MINOR_VERSION)'
        LDSHARED='gcc -fPIC -G'
        SHLIB_BUILD="gcc -G -fPIC -o"
    ;;
	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
	    SHLIB_BUILD="gcc -shared -fPIC -o"

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

	    LDSHARED='gcc -fPIC -shared'
	    if test "$with_rpath" = "yes" ; then
	        RPATH="-Wl,-rpath -Wl,$srcdir/tmp"
	        INSTALL_RPATH="-Wl,-rpath,$prefix/lib"
	    else
	        RPATH=
	        INSTALL_RPATH=
	    fi
	    SONAME_FLAGS="-Wl,-soname -Wl,"

	    if test "$CXX" = "KCC"; then
		SHLIB_BUILD_CXX="KCC $KCC_THREAD_SAFE_FLAG -o"
		SHLIB_CXXFLAGS=-fpic
		SONAME_FLAGS="--soname "
	    fi

	    # This is need, otherwise non PIC code would sneak into the 
            # shared libs (This assumes f77 == g77, which is a valid guess 
            # for Linux.)
	    SHLIB_F77FLAGS=-fPIC
	;;
	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"
	    if test "$with_rpath" = "yes" ; then
	        RPATH="-rpath ."
            else
	        RPATH=
	    fi
	;;
	* )
	    with_shlib=no
	    echo "$ac_t""unknown" 1>&6
	;;
    esac

    # Finally, if SHLIB_BUILD_CXX isn't set already, it defaults to
    # SHLIB_BUILD. 
    if test -z "$SHLIB_BUILD_CXX"; then
	SHLIB_BUILD_CXX=$SHLIB_BUILD
    fi
fi

# ----------------------------------------------------------------------------
# Configure building archive libs.  This is usually just ar, but we
# need a way to support library template closure for C++ compilers
# that know how to do it.
# ----------------------------------------------------------------------------

echo $ac_n "checking how to make archive libraries""... $ac_c" 1>&6
echo "configure:5900: checking how to make archive libraries" >&5

ARLIB_BUILD="ar q"
ARLIB_BUILD_CXX="\$(ARLIB_BUILD)"

case $system in
    SunOS-5* )
	if test "$CXX" = "KCC"; then
	    ARLIB_BUILD_CXX="KCC $KCC_THREAD_SAFE_FLAG -o"
        fi
    ;;
    Linux* )
	if test "$CXX" = "KCC"; then
	    ARLIB_BUILD_CXX="KCC $KCC_THREAD_SAFE_FLAG -o"
        fi
    ;;
esac

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

# ----------------------------------------------------------------------------
# Now do the variable substitutions.
# ----------------------------------------------------------------------------



















# Substitutions for the dynamic drivers.
# if enable-dynamic-drivers is enabled, those libs don't go to "LIBS"
#
# Currently, TKLIBS has all tcl/tk/X11 libs, but those could be split, if needed.
# Also, GDLIBS has all libs needed from the gd driver,
# CDLIBS has all libs needed from the gd driver, and
# GNOMELIBS all libs needed by the gnome driver.









echo $ac_n "checking for dynamic drivers""... $ac_c" 1>&6
echo "configure:5959: checking for dynamic drivers" >&5
# Check whether --enable-plmeta or --disable-plmeta was given.
if test "${enable_plmeta+set}" = set; then
  enableval="$enable_plmeta"
  :
fi
# Check whether --with-plmeta or --without-plmeta was given.
if test "${with_plmeta+set}" = set; then
  withval="$with_plmeta"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "plmeta"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = plmeta"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "plmeta"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES plmeta"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_null+set}" = set; then
  enableval="$enable_null"
  :
fi
# Check whether --with-null or --without-null was given.
if test "${with_null+set}" = set; then
  withval="$with_null"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "null"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = null"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "null"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES null"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_xterm+set}" = set; then
  enableval="$enable_xterm"
  :
fi
# Check whether --with-xterm or --without-xterm was given.
if test "${with_xterm+set}" = set; then
  withval="$with_xterm"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "xterm"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = xterm"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "xterm"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES xterm"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_tek4010+set}" = set; then
  enableval="$enable_tek4010"
  :
fi
# Check whether --with-tek4010 or --without-tek4010 was given.
if test "${with_tek4010+set}" = set; then
  withval="$with_tek4010"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "tek4010"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = tek4010"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "tek4010"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES tek4010"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_tek4010 1
EOF

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

if test "$enable_tek4010f" = "yes" -o "$enable_tek4010f $enable_drivers" = " yes" ; then
    enable_tek4010f="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "tek4010f"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = tek4010f"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "tek4010f"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES tek4010f"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_tek4010f 1
EOF

    DEVICES="$DEVICES tek4010f"
else
    enable_tek4010f="no"
fi
# Check whether --enable-tek4107 or --disable-tek4107 was given.
if test "${enable_tek4107+set}" = set; then
  enableval="$enable_tek4107"
  :
fi
# Check whether --with-tek4107 or --without-tek4107 was given.
if test "${with_tek4107+set}" = set; then
  withval="$with_tek4107"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "tek4107"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = tek4107"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "tek4107"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES tek4107"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_tek4107 1
EOF

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

if test "$enable_tek4107f" = "yes" -o "$enable_tek4107f $enable_drivers" = " yes" ; then
    enable_tek4107f="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "tek4107f"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = tek4107f"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "tek4107f"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES tek4107f"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_tek4107f 1
EOF

    DEVICES="$DEVICES tek4107f"
else
    enable_tek4107f="no"
fi
# Check whether --enable-mskermit or --disable-mskermit was given.
if test "${enable_mskermit+set}" = set; then
  enableval="$enable_mskermit"
  :
fi
# Check whether --with-mskermit or --without-mskermit was given.
if test "${with_mskermit+set}" = set; then
  withval="$with_mskermit"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "mskermit"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = mskermit"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "mskermit"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES mskermit"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_conex+set}" = set; then
  enableval="$enable_conex"
  :
fi
# Check whether --with-conex or --without-conex was given.
if test "${with_conex+set}" = set; then
  withval="$with_conex"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "conex"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = conex"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "conex"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES conex"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_linuxvga+set}" = set; then
  enableval="$enable_linuxvga"
  :
fi
# Check whether --with-linuxvga or --without-linuxvga was given.
if test "${with_linuxvga+set}" = set; then
  withval="$with_linuxvga"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "linuxvga"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = linuxvga"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "linuxvga"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES linuxvga"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_vlt+set}" = set; then
  enableval="$enable_vlt"
  :
fi
# Check whether --with-vlt or --without-vlt was given.
if test "${with_vlt+set}" = set; then
  withval="$with_vlt"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "vlt"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = vlt"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "vlt"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES vlt"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_versaterm+set}" = set; then
  enableval="$enable_versaterm"
  :
fi
# Check whether --with-versaterm or --without-versaterm was given.
if test "${with_versaterm+set}" = set; then
  withval="$with_versaterm"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "versaterm"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = versaterm"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "versaterm"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES versaterm"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_dg300+set}" = set; then
  enableval="$enable_dg300"
  :
fi
# Check whether --with-dg300 or --without-dg300 was given.
if test "${with_dg300+set}" = set; then
  withval="$with_dg300"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "dg300"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = dg300"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "dg300"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES dg300"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_dg300 1
EOF

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

if test "$enable_png" = "yes" -o "$enable_png $enable_drivers" = " yes" ; then
    enable_png="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "png"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = png"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "png"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES png"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_png 1
EOF

    DEVICES="$DEVICES png"
else
    enable_png="no"
fi
# Check whether --enable-jpeg or --disable-jpeg was given.
if test "${enable_jpeg+set}" = set; then
  enableval="$enable_jpeg"
  :
fi
# Check whether --with-jpeg or --without-jpeg was given.
if test "${with_jpeg+set}" = set; then
  withval="$with_jpeg"
  { echo "configure: error: unrecognized variable: with_jpeg" 1>&2; exit 1; }
fi

if test "$enable_jpeg" = "yes" -o "$enable_jpeg $enable_drivers" = " yes" ; then
    enable_jpeg="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "jpeg"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = jpeg"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "jpeg"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES jpeg"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_jpeg 1
EOF

    DEVICES="$DEVICES jpeg"
else
    enable_jpeg="no"
fi
# Check whether --enable-cgm or --disable-cgm was given.
if test "${enable_cgm+set}" = set; then
  enableval="$enable_cgm"
  :
fi
# Check whether --with-cgm or --without-cgm was given.
if test "${with_cgm+set}" = set; then
  withval="$with_cgm"
  { echo "configure: error: unrecognized variable: with_cgm" 1>&2; exit 1; }
fi

if test "$enable_cgm" = "yes" -o "$enable_cgm $enable_drivers" = " yes" ; then
    enable_cgm="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "cgm"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = cgm"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "cgm"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES cgm"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_cgm 1
EOF

    DEVICES="$DEVICES cgm"
else
    enable_cgm="no"
fi
# Check whether --enable-ps or --disable-ps was given.
if test "${enable_ps+set}" = set; then
  enableval="$enable_ps"
  :
fi
# Check whether --with-ps or --without-ps was given.
if test "${with_ps+set}" = set; then
  withval="$with_ps"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "ps"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = ps"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "ps"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES ps"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_ps 1
EOF

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

if test "$enable_psc" = "yes" -o "$enable_psc $enable_drivers" = " yes" ; then
    enable_psc="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "psc"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = psc"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "psc"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES psc"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_psc 1
EOF

    DEVICES="$DEVICES psc"
else
    enable_psc="no"
fi
# Check whether --enable-xfig or --disable-xfig was given.
if test "${enable_xfig+set}" = set; then
  enableval="$enable_xfig"
  :
fi
# Check whether --with-xfig or --without-xfig was given.
if test "${with_xfig+set}" = set; then
  withval="$with_xfig"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "xfig"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = xfig"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "xfig"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES xfig"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_ljii+set}" = set; then
  enableval="$enable_ljii"
  :
fi
# Check whether --with-ljii or --without-ljii was given.
if test "${with_ljii+set}" = set; then
  withval="$with_ljii"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "ljii"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = ljii"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "ljii"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES ljii"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_hp7470+set}" = set; then
  enableval="$enable_hp7470"
  :
fi
# Check whether --with-hp7470 or --without-hp7470 was given.
if test "${with_hp7470+set}" = set; then
  withval="$with_hp7470"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "hp7470"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = hp7470"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "hp7470"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES hp7470"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_hp7580+set}" = set; then
  enableval="$enable_hp7580"
  :
fi
# Check whether --with-hp7580 or --without-hp7580 was given.
if test "${with_hp7580+set}" = set; then
  withval="$with_hp7580"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "hp7580"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = hp7580"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "hp7580"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES hp7580"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_lj_hpgl+set}" = set; then
  enableval="$enable_lj_hpgl"
  :
fi
# Check whether --with-lj_hpgl or --without-lj_hpgl was given.
if test "${with_lj_hpgl+set}" = set; then
  withval="$with_lj_hpgl"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "lj_hpgl"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = lj_hpgl"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "lj_hpgl"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES lj_hpgl"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_lj_hpgl 1
EOF

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

if test "$enable_ljiip" = "yes" -o "$enable_ljiip $enable_drivers" = " yes" ; then
    enable_ljiip="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "ljiip"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = ljiip"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "ljiip"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES ljiip"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_ljiip 1
EOF

    DEVICES="$DEVICES ljiip"
else
    enable_ljiip="no"
fi
# Check whether --enable-imp or --disable-imp was given.
if test "${enable_imp+set}" = set; then
  enableval="$enable_imp"
  :
fi
# Check whether --with-imp or --without-imp was given.
if test "${with_imp+set}" = set; then
  withval="$with_imp"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "imp"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = imp"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "imp"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES imp"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_xwin+set}" = set; then
  enableval="$enable_xwin"
  :
fi
# Check whether --with-xwin or --without-xwin was given.
if test "${with_xwin+set}" = set; then
  withval="$with_xwin"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "xwin"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = xwin"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "xwin"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES xwin"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    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.
if test "${enable_tk+set}" = set; then
  enableval="$enable_tk"
  :
fi
# Check whether --with-tk or --without-tk was given.
if test "${with_tk+set}" = set; then
  withval="$with_tk"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "tk"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = tk"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "tk"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES tk"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_tk 1
EOF

    DEVICES="$DEVICES tk"
else
    enable_tk="no"
fi
# Check whether --enable-pbm or --disable-pbm was given.
if test "${enable_pbm+set}" = set; then
  enableval="$enable_pbm"
  :
fi
# Check whether --with-pbm or --without-pbm was given.
if test "${with_pbm+set}" = set; then
  withval="$with_pbm"
  { 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"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "pbm"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = pbm"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "pbm"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES pbm"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_pbm 1
EOF

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

if test "$enable_gnome" = "yes" -o "$enable_gnome $enable_drivers" = " yes" ; then
    enable_gnome="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "gnome"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = gnome"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "gnome"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES gnome"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_gnome 1
EOF

    DEVICES="$DEVICES gnome"
else
    enable_gnome="no"
fi
# Check whether --enable-pstex or --disable-pstex was given.
if test "${enable_pstex+set}" = set; then
  enableval="$enable_pstex"
  :
fi
# Check whether --with-pstex or --without-pstex was given.
if test "${with_pstex+set}" = set; then
  withval="$with_pstex"
  { echo "configure: error: unrecognized variable: with_pstex" 1>&2; exit 1; }
fi

if test "$enable_pstex" = "yes" -o "$enable_pstex $enable_drivers" = " yes" ; then
    enable_pstex="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "pstex"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = pstex"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "pstex"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES pstex"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_pstex 1
EOF

    DEVICES="$DEVICES pstex"
else
    enable_pstex="no"
fi
# Check whether --enable-ntk or --disable-ntk was given.
if test "${enable_ntk+set}" = set; then
  enableval="$enable_ntk"
  :
fi
# Check whether --with-ntk or --without-ntk was given.
if test "${with_ntk+set}" = set; then
  withval="$with_ntk"
  { echo "configure: error: unrecognized variable: with_ntk" 1>&2; exit 1; }
fi

if test "$enable_ntk" = "yes" -o "$enable_ntk $enable_drivers" = " yes" ; then
    enable_ntk="yes"

    driver_is_dynamic=0
    if test "$enable_dyndrivers" = "yes"; then
	for drv in plmeta null xterm tek4010 tek4010f tek4107 tek4107f mskermit \
conex linuxvga vlt versaterm dg300 png jpeg cgm ps psc xfig ljii \
hp7470 hp7580 lj_hpgl ljiip imp pbm gnome pstex ntk; do
	    if test "$drv" = "ntk"; then
		driver_is_dynamic=1
		break
	    fi
	done
    fi

#    echo "1 = ntk"
#    echo "driver_is_dynamic: $driver_is_dynamic"

    driver=""
    for devdrv in plmeta:plmeta null:null \
xterm:tek tek4010:tek tek4107:tek mskermit:tek \
versaterm:tek vlt:tek conex:tek tek4010f:tek tek4107f:tek \
linuxvga:linuxvga dg300:dg300 png:gd jpeg:gd cgm:cgm psc:ps ps:ps xfig:xfig \
ljiip:ljiip ljii:ljii hp7470:hpgl hp7580:hpgl lj_hpgl:hpgl \
imp:impress xwin:xwin tk:tk pbm:pbm gnome:gnome pstex:pstex ntk:ntk; do
	device=`echo $devdrv | cut -d: -f1`
	if test "$device" = "ntk"; then
	    driver=`echo $devdrv | cut -d: -f2`
	    break
	fi
    done

    if test $driver_is_dynamic != 0; then
	found=0
	for drv in $DYNAMIC_DRIVERS; do
	    if test "$drv" = "$driver$LIB_TAG"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    DYNAMIC_DRIVERS="$DYNAMIC_DRIVERS $driver$LIB_TAG"
	    echo -n $driver ""
	fi

	DYNAMIC_DEVICES="$DYNAMIC_DEVICES ntk"
    else
	found=0
	for drv in $STATIC_DRIVERS; do
	    if test "$drv" = "$driver"; then
		found=1
		break
	    fi
	done
	if test $found = 0; then
	    STATIC_DRIVERS="$STATIC_DRIVERS $driver"
	fi
    fi

    cat >> confdefs.h <<\EOF
#define PLD_ntk 1
EOF

    DEVICES="$DEVICES ntk"
else
    enable_ntk="no"
fi

echo "$ac_t""" 1>&6
# ----------------------------------------------------------------------------
# Okay, we're about to start emiting the configuration information.
# But first start with a bogus file, so we can have a time stamp
# marking when it all began.  That will let us write a clean target
# that avoids killing off the CVS files (and the ./CVS control
# directory), while using only the features of POSIX find.
# ----------------------------------------------------------------------------

touch .plcfg

# ----------------------------------------------------------------------------
# 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:8397: 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 8402 "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:8410: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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 8427 "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 8445 "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 8466 "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:8477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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 termios.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:8504: 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 8509 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:8514: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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

echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
echo "configure:8541: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 8546 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
#ifndef WEXITSTATUS
#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
int main() {
int s;
wait (&s);
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
if { (eval echo configure:8562: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
  rm -rf conftest*
  ac_cv_header_sys_wait_h=yes
else
  echo "configure: failed program was:" >&5
  cat conftest.$ac_ext >&5
  rm -rf conftest*
  ac_cv_header_sys_wait_h=no
fi
rm -f conftest*
fi

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

fi

# 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:8585: 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=":"
  ac_dummy="$PATH"
  for ac_dir in $ac_dummy; 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:8613: 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 8618 "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 "(^|[^a-zA-Z_0-9])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:8647: 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 8652 "configure"
#include "confdefs.h"
#include <vfork.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:8657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
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:8682: 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:8688: 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 8693 "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:8716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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

ac_cv_func_vfork_works=$ac_cv_func_vfork
else
  cat > conftest.$ac_ext <<EOF
#line 8738 "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:8833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./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

for ac_func in popen usleep
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:8858: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
  echo $ac_n "(cached) $ac_c" 1>&6
else
  cat > conftest.$ac_ext <<EOF
#line 8863 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char $ac_func(); 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 $ac_func();

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_$ac_func) || defined (__stub___$ac_func)
choke me
#else
$ac_func();
#endif

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

if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
  echo "$ac_t""yes" 1>&6
    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
  cat >> confdefs.h <<EOF
#define $ac_tr_func 1
EOF
 
else
  echo "$ac_t""no" 1>&6
fi
done


# ----------------------------------------------------------------------------
# For some systems the XCreateWindow call in xwin.c needs the default visual.

case $system in 
    SunOS-* ) 
	cat >> confdefs.h <<\EOF
#define USE_DEFAULT_VISUAL 1
EOF

	;;
    * )
esac

# ----------------------------------------------------------------------------
# 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:8932: 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 8937 "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 "(^|[^a-zA-Z_0-9])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

# ----------------------------------------------------------------------------
# Set up library names and suffix.
# ----------------------------------------------------------------------------

PLLIB_NAME=plplot
if test "$enable_tcl" = "yes"; then
    MATLIB_NAME=tclmatrix
else
    MATLIB_NAME=""
fi    
CXXLIB_NAME=plcxx





# ----------------------------------------------------------------------------
# Set up library names and suffix.
# ----------------------------------------------------------------------------




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

# Need to AC_SUBST some of these for plplot-test.sh script.







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_java" = "yes"; then
    cat $srcdir/cf/pkg_java.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
if test "$enable_gnome" = "yes"; then
    cat $srcdir/cf/pkg_gnome.in	>>Makefile.in 
fi
if test "$enable_octave" = "yes"; then
    cat $srcdir/cf/pkg_octave.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
	#following needed for includes to work properly with new plplot/*.h style
	cd shared
	ln -s ../plplot .
	cd ..
    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
	;;
    SCO* )
        cat $srcdir/cf/lib_sh_sco.in    >>Makefile.in
	;;
	HP-UX* )
	  cat $srcdir/cf/lib_sh_hpux.in    >>Makefile.in
	  if test "$enable_cxx" = "yes"; then
	    cat $srcdir/cf/lib_sh_hpux_cxx.in       >>Makefile.in
	  fi
	;;
        * )
	    cat $srcdir/cf/lib_sh.in	>>Makefile.in
	;;
    esac
else
    SHARED=0
    cat $srcdir/cf/lib_ar.in	>>Makefile.in
fi

if test "$enable_dyndrivers" = "yes"; then
    cat $srcdir/cf/dyndrv.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
  HP-UX* )
    cat >> Makefile.in <<EOF
LP=lp
EOF
  ;;
  * )
    cat >> Makefile.in <<EOF
LP=lpr
EOF
  ;;
esac

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

# Object file dependencies

cat $srcdir/cf/autodeps.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 "$PLPLOT_PREFIX"; then
    PLPLOT_PREFIX=$prefix/lib/plplot$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION
fi
if test -z "$DATA_DIR"; then
    DATA_DIR=$PLPLOT_PREFIX/data
fi
if test -z "$BIN_DIR"; then
    BIN_DIR=$prefix/bin
fi
if test -z "$TCL_DIR"; then
    TCL_DIR=$PLPLOT_PREFIX/tcl
fi
if test -z "$DOC_DIR"; then
    DOC_DIR=$prefix/share/doc/plplot
fi
if test -z "$INFO_DIR"; then
    INFO_DIR=$prefix/share/info
fi
if test -z "$INCLUDE_DIR"; then
    INCLUDE_DIR=$prefix/include/plplot
fi
if test -z "$DEMOS_DIR"; then
    DEMOS_DIR=$PLPLOT_PREFIX/examples
fi

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

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

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

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




  LIB_DIR=`echo $LIB_DIR | sed s%$prefix/%%`
  


  DATA_DIR=`echo $DATA_DIR | sed s%$prefix/%%`
  


  BIN_DIR=`echo $BIN_DIR | sed s%$prefix/%%`
  


  TCL_DIR=`echo $TCL_DIR | sed s%$prefix/%%`
  


  DOC_DIR=`echo $DOC_DIR | sed s%$prefix/%%`
  


  INFO_DIR=`echo $INFO_DIR | sed s%$prefix/%%`
  


  INCLUDE_DIR=`echo $INCLUDE_DIR | sed s%$prefix/%%`
  


  DEMOS_DIR=`echo $DEMOS_DIR | sed s%$prefix/%%`
  


  SHARED=`echo $SHARED | sed s%$prefix/%%`
  


# ----------------------------------------------------------------------------
# Now build the dynamic driver database.
# ----------------------------------------------------------------------------

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

    echo "$ac_t""creating drivers/$DRIVERS_DB" 1>&6

    # Dynamic (loadable) drivers go in a subdir all their own.
    if test ! -d drivers; then
	mkdir drivers
    fi

    # Clear out any prior drivers.
    if test -e drivers/$DRIVERS_DB; then
	rm drivers/$DRIVERS_DB
    fi
    touch drivers/$DRIVERS_DB

    # Now add a line for each supported loadable device.  Format is:
    #     device name : description : type : driver name : device number: symbol tag
    #
    # (type=1 if interactive, 0 if file-oriented, -1 for other).
    #
    # Note the device name that appears first in the db line is not
    # necessarily the same as the device name in the DYNAMIC_DEVICES (or
    # DEVICES) list!  Rather, it's the name that appears in the old dispatch
    # table entry (cf. tekt vs tek4010).  Oh well..

    for drv in $DYNAMIC_DEVICES; do
	case $drv in
	    null )
	    echo "null:Null device:-1:null"$LIB_TAG".drv:42:null" >> drivers/$DRIVERS_DB
	    ;;
	    plmeta )
	    echo "plmeta:PLplot Native Meta-File:0:plmeta"$LIB_TAG".drv:26:plm" >> drivers/$DRIVERS_DB
	    ;;
	    xfig )
	    echo "xfig:Fig file:0:xfig"$LIB_TAG".drv:31:xfig" >> drivers/$DRIVERS_DB
	    ;;
	    pstex )
	    echo "pstex:Combined Postscript/LaTeX files:0:ps"$LIB_TAG".drv:41:pstex" >> drivers/$DRIVERS_DB
	    ;;
	    png )
	    echo "png:PNG file:0:gd"$LIB_TAG".drv:39:png" >> drivers/$DRIVERS_DB
	    ;;
	    jpeg )
	    echo "jpeg:JPEG file:0:gd"$LIB_TAG".drv:40:jpeg" >> drivers/$DRIVERS_DB
	    ;;
	    cgm )
	    echo "cgm:CGM file:0:cgm"$LIB_TAG".drv:44:cgm" >> drivers/$DRIVERS_DB
	    ;;
	    xterm )
	    echo "xterm:Xterm Window:1:tek"$LIB_TAG".drv:18:xterm" >> drivers/$DRIVERS_DB
	    ;;
	    tek4010 )
	    echo "tekt:Tektronix Terminal (4010):1:tek"$LIB_TAG".drv:19:tekt" >> drivers/$DRIVERS_DB
	    ;;
	    tek4107 )
	    echo "tek4107t:Tektronix Terminal (4105/4107):1:tek"$LIB_TAG".drv:20:tek4107t" >> drivers/$DRIVERS_DB
	    ;;
	    vlt )
	    echo "vlt:VLT vt100/tek emulator:1:tek"$LIB_TAG".drv:23:vlt" >> drivers/$DRIVERS_DB
	    ;;
	    conex )
	    echo "conex:Conex vt320/tek emulator:1:tek"$LIB_TAG".drv:24:conex" >> drivers/$DRIVERS_DB
	    ;;
	    versaterm )
	    echo "versaterm:Versaterm vt100/tek emulator:1:tek"$LIB_TAG".drv:22:versaterm" >> drivers/$DRIVERS_DB
	    ;;
	    mskermit )
	    echo "mskermit:MS-Kermit emulator:1:tek"$LIB_TAG".drv:21:mskermit" >> drivers/$DRIVERS_DB
	    ;;
	    tek4010f )
	    echo "tekf:Tektronix File (4010):0:tek"$LIB_TAG".drv:27:tekf" >> drivers/$DRIVERS_DB
	    ;;
	    tek4107f )
	    echo "tek4107f:Tektronix File (4105/4107):0:tek"$LIB_TAG".drv:28:tek4107f" >> drivers/$DRIVERS_DB
	    ;;
	    pbm )
	    echo "pbm:PDB (PPM) Driver:0:pbm"$LIB_TAG".drv:38:pbm" >> drivers/$DRIVERS_DB
	    ;;
	    hp7470 )
	    echo "hp7470:HP 7470 Plotter File (HPGL Cartridge, Small Plotter):0:hpgl"$LIB_TAG".drv:34:hp7470" >> drivers/$DRIVERS_DB
	    ;;
	    hp7580 )
	    echo "hp7580:HP 7580 Plotter File (Large Plotter):0:hpgl"$LIB_TAG".drv:35:hp7580" >> drivers/$DRIVERS_DB
	    ;;
	    lj_hpgl )
	    echo "lj_hpgl:HP Laserjet III, HPGL emulation mode:0:hpgl"$LIB_TAG".drv:36:lj_hpgl" >> drivers/$DRIVERS_DB
	    ;;
	    dg300 )
	    echo "dg300:DG300 Terminal:0:dg300"$LIB_TAG".drv:25:dg300" >> drivers/$DRIVERS_DB
	    ;;
	    ljii )
	    echo "ljii:LaserJet II Bitmap File (150 dpi):0:ljii"$LIB_TAG".drv:33:ljii" >> drivers/$DRIVERS_DB
	    ;;
	    ljiip )
	    echo "ljiip:LaserJet IIp/deskjet compressed graphics:0:ljiip"$LIB_TAG".drv:32:ljiip" >> drivers/$DRIVERS_DB
	    ;;
	    imp )
	    echo "imp:Impress File:0:impress"$LIB_TAG".drv:37:imp" >> drivers/$DRIVERS_DB
	    ;;
	    gnome )
	    echo "gnome:Gnome Canvas:1:gnome"$LIB_TAG".drv:6:gnome" >> drivers/$DRIVERS_DB
	    ;;
	    ps )
	    echo "ps:PostScript File (monochrome):0:ps"$LIB_TAG".drv:29:psm" >> drivers/$DRIVERS_DB
	    ;;
	    psc )
	    echo "psc:PostScript File (color):0:ps"$LIB_TAG".drv:30:psc" >> drivers/$DRIVERS_DB
	    ;;
	    xwin )
	    echo "xwin:X-Window (Xlib):1:xwin"$LIB_TAG".drv:5:xw" >> drivers/$DRIVERS_DB
	    ;;
	    tk )
	    echo "tk:Tcl/TK Window:1:tk"$LIB_TAG".drv:7:tk" >> drivers/$DRIVERS_DB
	    ;;
	    ntk )
	    echo "ntk:New tk driver:1:ntk"$LIB_TAG".drv:43:ntk" >> drivers/$DRIVERS_DB
	    ;;
	    linuxvga )
	    echo "linuxvga:Linux VGA driver:0:linuxvga"$LIB_TAG".drv:8:vga" >> drivers/$DRIVERS_DB
	    ;;
	esac
    done
fi

# ----------------------------------------------------------------------------
# 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
    
# All header files have to be in plplot as symlinks
if test ! -d plplot; then
    mkdir plplot
fi
ln -s \
../plConfig.h ../plDevs.h \
plplot 2>/dev/null

ln -s \
$srcdir/src/*.c \
$srcdir/drivers/*.c \
. 2>/dev/null
ln -s \
$srcdir/include/*.h \
plplot 2>/dev/null

# Packages (interfaces) and demos associated with them

if test "$enable_cxx" = "yes"; then
    ln -s \
    `ls $srcdir/bindings/c++/*.* |grep -v '\.h$'` \
    $srcdir/examples/c++/*.* \
    . 2>/dev/null
    ln -s \
    $srcdir/bindings/c++/*.h \
    plplot 2>/dev/null
fi

# Note that double precision Fortran files in the stub interface 
# and examples are obtained entirely by m4 macro expansion.  This should 
# work anywhere.

if test "$enable_f77" = "yes"; then
    ln -s \
    `ls $srcdir/bindings/f77/*.* |grep -v '\.h$'` \
    $srcdir/examples/f77/*.* \
    . 2>/dev/null
    ln -s \
    $srcdir/bindings/f77/*.h \
    plplot 2>/dev/null
    for filename in $srcdir/examples/f77/*.fm4
    do 
      ffilename=`echo $filename | sed 's/\.fm4$/.f/'`
      ln -s $ffilename . 2>/dev/null
    done
    for filename in $srcdir/bindings/f77/*.fm4
    do 
      ffilename=`echo $filename | sed 's/\.fm4$/.f/'`
      ln -s $ffilename . 2>/dev/null
    done
fi

if test "$enable_python" = "yes"; then
    ln -s \
    $srcdir/bindings/python/*.py \
    $srcdir/bindings/python/*.c \
    $srcdir/examples/python/*.py \
    $srcdir/examples/python/pytkdemo \
    . 2>/dev/null
    ln -s \
    $srcdir/bindings/python/*.h \
    plplot 2>/dev/null
    if test ! -d python_dynamic; then
	# Create special directory where plmodule.so is dynamically built
	# Symlink everything required in directory except for
	# Setup.in file which is created at build time and (differently) at
	# install time.
	mkdir python_dynamic
	cd python_dynamic
	ln -s ../plmodule.c
	ln -s ../pyqt_plmodule.c
	ln -s $PYTHON_CFG_DIR/Makefile.pre.in
	# Following needed for includes to work properly with new plplot/*.h style.
	ln -s ../plplot
	cd ..
    fi
fi

# Just go ahead and set up the Python stuff needed to do staging.
# (AWI thinks all the following should be removed since they
# repeat the previous stuff, but he isn't positive.  Thus,
# as a compromise he supressed the  error messages by the following
# stuff by changing ln -s to ln -sf.)

ln -sf $srcdir/bindings/python/Plframe.py .
ln -sf $srcdir/bindings/python/TclSup.py .
ln -sf $srcdir/bindings/python/plmodule.c .
ln -sf $srcdir/bindings/python/pyqt_plmodule.c .
ln -sf $srcdir/bindings/python/plmodule.h plplot
ln -sf $srcdir/bindings/python/setup.py .

# Handle setting up the Java stuff.

javaconfig=""
if test "$enable_java" = "yes"; then
    # Set up the Java tree in the build dir.
    if test ! -d java; then
	mkdir java
    fi
    if test ! -d java/plplot; then
	mkdir java/plplot
    fi
    if test ! -d java/plplot/core; then
	mkdir java/plplot/core
    fi
    if test ! -d java/plplot/examples; then
	mkdir java/plplot/examples
    fi
    
    ln -s \
    $srcdir/bindings/java/*.java \
    ./java/plplot/core 2>/dev/null

    ln -s \
    $srcdir/bindings/java/*.java \
    $srcdir/bindings/java/*.c \
    . 2>/dev/null

    ln -s \
    $srcdir/examples/java/*.java \
    ./java/plplot/examples 2>/dev/null

    ln -s \
    $srcdir/examples/java/*.java \
    . 2>/dev/null

    test -r config.java.in || \
        ln -s $srcdir/bindings/java/config.java.in . 2>/dev/null

    test -L java/plplot/core/config.java || (cd java/plplot/core; ln -s ../../../config.java .)

    javaconfig="config.java"
fi

if test "$enable_tcl" = "yes"; then
    ln -s \
    `ls $srcdir/bindings/tcl/*.* |grep -v '\.h$'` \
    $srcdir/bindings/tcl/pltclgen \
    $srcdir/examples/tcl/*.* \
    . 2>/dev/null
    ln -s \
    $srcdir/bindings/tcl/*.h \
    plplot 2>/dev/null
    # Put in specific symlinks for generated files.  Those files may or may
    # not be in existence at configure time so use the -f option.
    ln -sf \
    $srcdir/bindings/tcl/tclgen.c \
    . 2>/dev/null
    ln -sf \
    $srcdir/bindings/tcl/tclgen.h \
    $srcdir/bindings/tcl/tclgen_s.h \
    plplot 2>/dev/null
fi

if test "$enable_tk" = "yes"; then
    ln -s \
    `ls $srcdir/bindings/tk/*.* |grep -v '\.h$'` \
    $srcdir/examples/tk/*.c \
    $srcdir/examples/tk/tk* \
    . 2>/dev/null
    ln -s \
    $srcdir/bindings/tk/*.h \
    plplot 2>/dev/null
#    #put in symlinks so that tk examples will work from tmp/../examples/tk
#    #directory (once installation completed) and also from installed 
#    #examples/tk directory
#    cd $srcdir/examples/tk
#    for filename in ../tcl/x??.tcl
#    do 
#      ln -s $filename . 2>/dev/null
#    done
#    cd $srcdir/tmp
fi

#    $srcdir/bindings/tk/tclIndex 

if test "$enable_octave" = "yes"; then
    ln -s $srcdir/bindings/octave/plplot_octave_org.h plplot 2>/dev/null
    ln -s $srcdir/bindings/octave/plplot_octave_rej.h plplot 2>/dev/null
    ln -s $srcdir/bindings/octave/massage.c . 2>/dev/null
    ln -s $srcdir/bindings/octave/.octaverc . 2>/dev/null
    mkdir -p plplot_octave_txt
    (cd plplot_octave_txt; $srcdir/doc/docbook/bin/api2text.pl \
	$srcdir/doc/docbook/src/plplotdoc.xml.in $srcdir/doc/docbook/src/api.xml;\
	ln -s $srcdir/bindings/octave/etc/plplot.doc .)
  if test "$has_matwrap" = "no"; then
    ln -s $srcdir/bindings/octave/matwrap/matwrap . 2>/dev/null
    ln -s $srcdir/bindings/octave/matwrap/wrap_octave.pl . 2>/dev/null
  fi
fi

# Miscellaneous

ln -s \
`ls $srcdir/examples/c/*.* |grep -v '\.h$'` \
$srcdir/examples/c/lena.pgm \
$srcdir/test/test_*.sh \
$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
ln -s \
$srcdir/examples/c/*.h \
plplot 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.13"
    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 plplot-config plplot-test.sh $javaconfig 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%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
s%@FFLAGS@%$FFLAGS%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%@MAJOR_VERSION@%$MAJOR_VERSION%g
s%@MINOR_VERSION@%$MINOR_VERSION%g
s%@RELEASE_VERSION@%$RELEASE_VERSION%g
s%@PLPLOT_VERSION@%$PLPLOT_VERSION%g
s%@LIB_TAG@%$LIB_TAG%g
s%@found_kcc@%$found_kcc%g
s%@found_cxx@%$found_cxx%g
s%@found_F77@%$found_F77%g
s%@found_g77@%$found_g77%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%@M4_FLAGS@%$M4_FLAGS%g
s%@CPP@%$CPP%g
s%@GTK_CONFIG@%$GTK_CONFIG%g
s%@GNOME_LIBS@%$GNOME_LIBS%g
s%@GNOMEUI_LIBS@%$GNOMEUI_LIBS%g
s%@GNOME_LIBDIR@%$GNOME_LIBDIR%g
s%@GNOME_INCLUDEDIR@%$GNOME_INCLUDEDIR%g
s%@GNOME_CONFIG@%$GNOME_CONFIG%g
s%@GNOME_APPLETS_LIBS@%$GNOME_APPLETS_LIBS%g
s%@GNOME_CAPPLET_LIBS@%$GNOME_CAPPLET_LIBS%g
s%@GTK_CFLAGS@%$GTK_CFLAGS%g
s%@GTK_LIBS@%$GTK_LIBS%g
s%@has_matwrap@%$has_matwrap%g
s%@has_mkoctfile@%$has_mkoctfile%g
s%@MKOCTFILE@%$MKOCTFILE%g
s%@has_octave@%$has_octave%g
s%@MATWRAP@%$MATWRAP%g
s%@OCTAVE_OCT_DIR@%$OCTAVE_OCT_DIR%g
s%@OCTAVE_DIR@%$OCTAVE_DIR%g
s%@PYTHON_INC_DIR@%$PYTHON_INC_DIR%g
s%@PYTHON_NUM_DIR@%$PYTHON_NUM_DIR%g
s%@PYTHON_MOD_DIR@%$PYTHON_MOD_DIR%g
s%@PYTHON_MACH_DIR@%$PYTHON_MACH_DIR%g
s%@PYTHON_DIR@%$PYTHON_DIR%g
s%@PYTHON_INSTDIR@%$PYTHON_INSTDIR%g
s%@PYTHON_CFG_DIR@%$PYTHON_CFG_DIR%g
s%@INCS@%$INCS%g
s%@ARLIB_BUILD@%$ARLIB_BUILD%g
s%@ARLIB_BUILD_CXX@%$ARLIB_BUILD_CXX%g
s%@SHLIB_BUILD@%$SHLIB_BUILD%g
s%@SHLIB_BUILD_CXX@%$SHLIB_BUILD_CXX%g
s%@SONAME_FLAGS@%$SONAME_FLAGS%g
s%@SA@%$SA%g
s%@SO@%$SO%g
s%@LDSHARED@%$LDSHARED%g
s%@RPATH@%$RPATH%g
s%@INSTALL_RPATH@%$INSTALL_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%@LINUXVGALIBS@%$LINUXVGALIBS%g
s%@GNOMELIBS@%$GNOMELIBS%g
s%@GDLIBS@%$GDLIBS%g
s%@CDLIBS@%$CDLIBS%g
s%@TKLIBS@%$TKLIBS%g
s%@RANLIB@%$RANLIB%g
s%@PLLIB_NAME@%$PLLIB_NAME%g
s%@MATLIB_NAME@%$MATLIB_NAME%g
s%@CXXLIB_NAME@%$CXXLIB_NAME%g
s%@STATIC_DRIVERS@%$STATIC_DRIVERS%g
s%@DYNAMIC_DRIVERS@%$DYNAMIC_DRIVERS%g
s%@enable_cxx@%$enable_cxx%g
s%@enable_f77@%$enable_f77%g
s%@enable_python@%$enable_python%g
s%@enable_java@%$enable_java%g
s%@enable_tcl@%$enable_tcl%g
s%@enable_octave@%$enable_octave%g
s%@LIB_DIR@%$LIB_DIR%g
s%@DATA_DIR@%$DATA_DIR%g
s%@BIN_DIR@%$BIN_DIR%g
s%@TCL_DIR@%$TCL_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 plplot-config plplot-test.sh $javaconfig"}
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

Available device drivers
static:		$STATIC_DRIVERS
dynamic:	$DYNAMIC_DRIVERS

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_gcc:	$with_gcc		with_rpath:	$with_rpath

enable_xwin:	$enable_xwin		enable_tcl:	$enable_tcl
enable_tk:	$enable_tk		enable_itcl:	$enable_itcl
enable_cxx:	$enable_cxx		enable_python:	$enable_python
enable_f77:	$enable_f77		enable_java:	$enable_java
enable_octave:	$enable_octave		enable_gnome:	$enable_gnome
"

cat << EOF > config.summary
$plplot_config_result_msg
EOF

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