#--------------------------------------------------------------------
# Sample configure.in for Tcl Extensions.  The only places you should
# need to modify this file are marked by the string __CHANGE__
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# __CHANGE__
# This very first macro is used to verify that the configure script can 
# find the sources.  The argument to AC_INIT should be a unique filename
# for this package, and can be a relative path, such as:
#
# AC_INIT(../generic/tcl.h)
#--------------------------------------------------------------------

AC_INIT(debugger.tcl.in)

AC_CONFIG_AUX_DIR(config)
CONFIGDIR=${srcdir}/config
AC_SUBST(CONFIGDIR)

#--------------------------------------------------------------------
# __CHANGE__
# Set your package name and version numbers here.  The NODOT_VERSION is
# required for constructing the library name on systems that don't like
# dots in library names (Windows).  The VERSION variable is used on the
# other systems.
#--------------------------------------------------------------------

PACKAGE=debugger

MAJOR_VERSION=1
MINOR_VERSION=4
PATCHLEVEL=

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


AC_SUBST(PACKAGE)
AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(VERSION)

#--------------------------------------------------------------------
# We put this here so that you can compile with -DVERSION="1.2" to
# encode the package version directly into the source files.
#--------------------------------------------------------------------

eval AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")

#--------------------------------------------------------------------
# Check whether --enable-gcc or --disable-gcc was given.  Do this 
# before AC_CYGWIN is called so the compiler can 
# be fully tested by built-in autoconf tools.
# This macro also calls AC_PROG_CC to set the compiler if --enable-gcc
# was not used.
#--------------------------------------------------------------------

AC_PROG_INSTALL

#--------------------------------------------------------------------
# Checks to see if the make program sets the $MAKE variable.
#--------------------------------------------------------------------

AC_PROG_MAKE_SET

#--------------------------------------------------------------------
# This macro performs additional compiler tests.
#--------------------------------------------------------------------

AC_CYGWIN

#--------------------------------------------------------------------
# "cygpath" is used on windows to generate native path names for include
# files.
# These variables should only be used with the compiler and linker since
# they generate native path names.
#--------------------------------------------------------------------

SC_SET_PLATFORM

#--------------------------------------------------------------------
# __CHANGE__
# A few miscellaneous platform-specific items:
#
# Define a special symbol for Windows (BUILD_exampleA in this case) so
# that we create the export library with the dll.  See sha1.h on how
# to use this.
#
# Windows creates a few extra files that need to be cleaned up.
# You can add more files to clean if your extension creates any extra
# files.
#
# Define any extra compiler flags in the PACKAGE_CFLAGS variable.
# These will be appended to the current set of compiler flags for
# your system.
#--------------------------------------------------------------------

case "`uname -s`" in
    *win32* | *WIN32* | *CYGWIN_NT*|*CYGWIN_98*|*CYGWIN_95*)
	AC_DEFINE_UNQUOTED(BUILD_${PACKAGE})
	CLEANFILES="*.tbc core"
	AC_SUBST(CLEANFILES)
    ;;
    *)
	CLEANFILES=
    ;;
esac

#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols 
# option.
#--------------------------------------------------------------------

SC_ENABLE_SYMBOLS

if test "${DBGX}x" = "x" ; then
    LIB_FILES='${TBC_FILES}'
    TCLEXT="tbc"
else
    LIB_FILES='${TCL_FILES}'
    TCLEXT="tcl"
fi

#----
# Always use .tcl files
#---
LIB_FILES='${TCL_FILES}'
TCLEXT="tcl"

AC_SUBST(LIB_FILES)

#--------------------------------------------------------------------
# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
# file during the install process.  Don't run the TCLSH_PROG through
# ${CYGPATH} because it's being used directly by make.
# Require that we use a tclsh shell version 8.2 or later since earlier
# versions have bugs in the pkg_mkIndex routine.
#--------------------------------------------------------------------

SC_PROG_TCLSH

#--------------------------------------------------------------------
# Find TclPro Compiler if it is needed.
#--------------------------------------------------------------------

if test "x.${TCLEXT}" = "x.tbc" ; then
    SC_PATH_PROTOOLS
    AC_PATH_PROGS(PROCOMP, procomp${EXEEXT} procomp0.10${EXEEXT} procomp10${EXEEXT}, :, ${PROTOOLSDIR}/${PLATFORM}/bin:${PATH})

    if test "x${PROCOMP}" = "x:" ; then
	AC_MSG_WARN(No procomp executable found.  You will not be able to compile tcl scripts.)
    fi
fi

AC_SUBST(PROCOMP)

#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
#--------------------------------------------------------------------

AC_OUTPUT([Makefile \
        debugger.tcl \
	pkgIndex.tcl])
