dnl	This is really a -*- shell-script -*- with bells on.
dnl	------------------------------------------------------------
dnl	This file is an input file used by the GNU "autoconf" program to
dnl	generate the file "configure", which is run to configure the
dnl	Makefile in this directory.
AC_INIT(shape.c)
# SCCS: @(#) configure.in 1.9 96/04/15 09:50:20

VERSION=0.3

#--------------------------------------------------------------------
#	See if there was a command-line option for where Tcl is;  if
#	not, assume that its top-level directory is a sibling of ours.
#--------------------------------------------------------------------

AC_ARG_WITH(tclconf,
	[  --with-tclconf=DIR          use Tcl 8.0 configuration file from DIR],
	TCL_CONF_DIR=$withval, TCL_CONF_DIR=/usr/local/lib)
if test ! -r $TCL_CONF_DIR/tclConfig.sh; then
    AC_MSG_ERROR(Tcl configuration file $TCL_CONF_DIR/tclConfig.sh doesn't exist)
fi
AC_ARG_WITH(tkconf,
	[  --with-tkconf=DIR           use Tk 8.0 configuration file from DIR],
	TK_CONF_DIR=$withval, TK_CONF_DIR=$TCL_CONF_DIR)
if test ! -r $TK_CONF_DIR/tclConfig.sh; then
    AC_MSG_ERROR(Tcl configuration file $TK_CONF_DIR/tkConfig.sh doesn't exist)
fi

#--------------------------------------------------------------------
#	Read in configuration information generated by Tcl for shared
#	libraries, and arrange for it to be substituted into our
#	Makefile.
#--------------------------------------------------------------------

file=$TCL_CONF_DIR/tclConfig.sh
. $file
file=$TK_CONF_DIR/tkConfig.sh
. $file

CC=$TCL_CC
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
SHLIB_LD=$TCL_SHLIB_LD
SHLIB_LD_LIBS="-lXext $TCL_SHLIB_LD_LIBS"
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
SHLIB_VERSION=$TCL_SHLIB_VERSION
TCL_LIBS=$TCL_LIBS
TCL_VERSION=$TCL_VERSION
TCL_INCLUDE=$TCL_PREFIX/include
TK_INCLUDE=$TK_PREFIX/include
TCL_BIN_DIR=$TK_EXEC_PREFIX/bin

AC_CHECK_LIB(Xext, XShapeQueryVersion, :, AC_MSG_ERROR(X extension library not available), $TK_XLIBSW)

if test $TCL_SHARED_BUILD -eq 1; then
    PRIMARY_TARGET='$(SOFILE)'
else
    PRIMARY_TARGET='$(EXEFILE)'
fi

AC_SUBST(CC)
AC_SUBST(PRIMARY_TARGET)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(SHLIB_VERSION)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_INCLUDE)
AC_SUBST(TK_INCLUDE)
AC_SUBST(TK_XINCLUDES)
AC_SUBST(TK_LIB_SPEC)
AC_SUBST(TK_LIBS)
AC_SUBST(TCL_LIB_SPEC)

AC_OUTPUT(Makefile)
