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.11 2002/10/25 22:38:46 andreas_kupries Exp $

ITCL_VERSION=3.2
AC_SUBST(ITCL_VERSION)

PACKAGE=iwidgets
MAJOR_VERSION=4
MINOR_VERSION=0
PATCHLEVEL=.2

VERSION=${MAJOR_VERSION}.${MINOR_VERSION}${PATCHLEVEL}
IWIDGETS_SRC_DIR=`pwd`

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

AC_PREREQ(2.0)

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 --with-itcl was specified to give the [incr Tcl] and [incr Tk]
# source code location.  If not, then we'll assume that the Iwidgets
# package is being installed directly beneath the toplevel Itcl directory.
#--------------------------------------------------------------------

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

ITCL_LIB_DIR=""
if test -r $itcl_search/itcl/library/itcl.tcl; then
    if test -r $itcl_search/itk/library/itk.tcl; then
        if test -r $itcl_search/config/mkinstalldirs; then
            ITCL_LIB_DIR=$itcl_search/itcl/library
            ITCL_SRC_DIR=$itcl_search/itcl
            ITK_LIB_DIR=$itcl_search/itk/library
            ITK_SRC_DIR=$itcl_search/itk
        fi
    fi
fi

if test -z "$ITCL_LIB_DIR"; then
    AC_MSG_ERROR(Can't find Itcl source.  Use --with-itcl to specify the the toplevel [incr Tcl] directory on your system.  (This directory should contain itcl/library/itcl.tcl, itk/library/itk.tcl, and config/mkinstalldirs.))
fi


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

SC_SIMPLE_EXEEXT
SC_PROG_TCLSH

#--------------------------------------------------------------------
#   Fill in template files with the proper info.
#--------------------------------------------------------------------
AC_SUBST(TCL_SRC_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(IWIDGETS_SRC_DIR)

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