dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run during [incr Tcl]
dnl installation to configure the system for the local environment.

AC_INIT(generic/buttonbox.itk)
# RCS: $Id: configure.in,v 1.4 2000/08/22 23:47:25 welch Exp $

#--------------------------------------------------------------------
# We should really cache the ITCL_VERSION when we configure itcl,
# and pick up the version from the cache here.
#--------------------------------------------------------------------

ITCL_VERSION=3.2
AC_SUBST(ITCL_VERSION)

PACKAGE=iwidgets
MAJOR_VERSION=3
MINOR_VERSION=0
PATCHLEVEL=.1

VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

AC_CONFIG_AUX_DIR(../config)
AC_PREREQ(2.0)

AC_PROG_INSTALL

case "`uname -s`" in
    *win32* | *WIN32* | *CYGWIN_NT*|*CYGWIN_98*|*CYGWIN_95*)
	CYGPATH="cygpath -w"
	RELPATH=".. .. bin"
    ;;
    *)
	CYGPATH=echo
	RELPATH=..
    ;;
esac

AC_SUBST(CYGPATH)
AC_SUBST(RELPATH)

#--------------------------------------------------------------------
#   See if there was a command-line option for where Tcl is;  if
#   not, search for Tcl.
#--------------------------------------------------------------------

SC_PATH_TCLCONFIG
SC_LOAD_TCLCONFIG

#--------------------------------------------------------------------
#   See if there was a command-line option for where Tk is;  if
#   not, search for Tk.
#--------------------------------------------------------------------

SC_PATH_TKCONFIG
SC_LOAD_TKCONFIG

#--------------------------------------------------------------------
#   See if there was a command-line option for where Itcl is;  if
#   not, search for Itcl.
#--------------------------------------------------------------------

AC_ARG_WITH(itcl, [  --with-itcl=DIR         use Itcl 3.0 binaries from DIR],
        itcl_search=$withval, itcl_search=`cd ${srcdir}/../itcl; pwd`)

ITCL_LIB_DIR=""
for dir in $exec_prefix/lib $TCL_LIB_DIR $itcl_search ; do
    if test -r $dir/library/itcl.tcl; then
        ITCL_LIB_DIR=$dir
        ITCL_SRC_DIR=$dir
        break
    fi
done

if test -z "$ITCL_LIB_DIR"; then
    AC_MSG_ERROR(Can't find Itcl libraries.  Use --with-itcl to specify the directory containing itcl.tcl on your system.)
fi

#--------------------------------------------------------------------
#   See if there was a command-line option for where Itk is;  if
#   not, search for Itk.
#--------------------------------------------------------------------

AC_ARG_WITH(itk, [  --with-itk=DIR          use Itk 3.0 binaries from DIR],
        itk_search=$withval, itk_search=`cd ${srcdir}/../itk; pwd`)

ITK_LIB_DIR=""
for dir in $exec_prefix/lib $TCL_LIB_DIR $itk_search ; do
    if test -r $dir/library/itk.tcl; then
        ITK_LIB_DIR=$dir
        ITK_SRC_DIR=$dir
        break
    fi
done

if test -z "$ITK_LIB_DIR"; then
    AC_MSG_ERROR(Can't find Itk libraries.  Use --with-itk to specify the directory containing itk.tcl on your system.)
fi

#--------------------------------------------------------------------
#   Needed for running the test suite
#--------------------------------------------------------------------

SC_PROG_TCLSH

#--------------------------------------------------------------------
#   Fill in template files with the proper info.
#--------------------------------------------------------------------
#AC_SUBST(BUILD_DIR)
AC_SUBST(TCL_LIB_DIR)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TK_LIB_DIR)
AC_SUBST(TK_SRC_DIR)
AC_SUBST(ITCL_LIB_DIR)
AC_SUBST(ITCL_SRC_DIR)
AC_SUBST(ITK_LIB_DIR)
AC_SUBST(ITK_SRC_DIR)

#AC_SUBST(ITCL_VERSION)
#AC_SUBST(IWIDGETS_VERSION)
#AC_SUBST(IWIDGETS_LIBRARY)
#AC_SUBST(IWIDGETS_SRC_DIR)

AC_OUTPUT(Makefile \
	iwidgets.tcl \
	pkgIndex.tcl)
