dnl autoconf rules to find tk 
dnl $Header: /nfs/jade/vint/CVSROOT/conf/configure.in.tk,v 1.26 2000/11/08 05:40:15 haoboy Exp $ (LBL)


AC_ARG_WITH(tk,	--with-tk=path	specify a pathname for tk, d=$withval, d="")

dnl library version defaults to 8.0
AC_ARG_WITH(tk-ver, --with-tk-ver=path specify the version of tcl/tk, TK_VERS=$withval, TK_VERS=8.3.2)


dnl Truncate anything beyond and including the second decimal point

TK_HI_VERS=`echo $TK_VERS | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1.\2/'`
TK_MAJOR_VERS=`echo $TK_VERS | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
TK_ALT_VERS=`echo $TK_VERS | sed 's/\.//'`

dnl work with one version in the past
TK_OLD_VERS=4.2
TK_OLD_ALT_VERS=`echo $TK_OLD_VERS | sed 's/\.//'`

TK_TCL_PLACES_D="$d \
                $d/lib/tk$TK_VERS \
                $d/lib/tk$TK_ALT_VERS \
		$d/lib/tk$TK_HI_VERS \
                $d/library \
                $d/lib/tk \
                $d/../lib/tk$TK_VERS \
                $d/../lib/tk$TK_ALT_VERS \
                $d/../lib/tk$TK_HI_VERS \
                $d/../lib/tk \
                $d/lib/tk$TK_OLD_VERS \
                $d/lib/tk$TK_OLD_ALT_VERS \
                $d/../lib/tk$TK_OLD_VERS \
                $d/../lib/tk$TK_OLD_ALT_VERS \
                $d/../lib/tk \
                $d/lib \
                $d/library"
TK_TCL_PLACES=" \
		../lib/tk$TK_HI_VERS \
		../lib/tk$TK_VERS \
		../lib/tk$TK_ALT_VERS \
		../tk$TK_VERS/library \
                ../tk$TK_ALT_VERS/library \
                ../tk$TK_HI_VERS/library \
		../tk/library \
                /usr/src/local/tk$TK_VERS/library \
                /usr/src/local/tk$TK_ALT_VERS/library \
                /usr/src/local/tk$TK_HI_VERS/library \
                /usr/contrib/include \
                /usr/local/lib/tk$TK_VERS \
                /usr/local/lib/tk$TK_ALT_VERS \
                /usr/local/lib/tk$TK_HI_VERS \
                /usr/local/include/tk$TK_VERS \
                /usr/local/include/tk$TK_ALT_VERS \
                /usr/local/include/tk$TK_HI_VERS \
                /usr/local/include \ 
                /usr/lib/tk$TK_VERS \
                /usr/lib/tk$TK_ALT_VERS \
                /usr/lib/tk$TK_HI_VERS \
		../tk$TK_OLD_VERS/library \
                ../tk$TK_OLD_ALT_VERS/library \
                /usr/src/local/tk$TK_OLD_VERS/library \
                /usr/src/local/tk$TK_OLD_ALT_VERS/library \
                /usr/local/lib/tk$TK_OLD_VERS \
                /usr/local/lib/tk$TK_OLD_ALT_VERS \
                /usr/local/include/tk$TK_OLD_VERS \
                /usr/local/include/tk$TK_OLD_ALT_VERS \
                /usr/lib/tk$TK_OLD_VERS \
                /usr/lib/tk$TK_OLD_ALT_VERS \
                $prefix/include \
		$prefix/lib/tk \
                $x_includes/tk \
                $x_includes \
                /usr/include"
TK_H_PLACES_D="$d \
                $d/generic \
                $d/../include/tk$TK_VERS \
                $d/../include/tk$TK_HI_VERS \
                $d/../include/tk$TK_OLD_VERS \
		$d/include/tk$TK_VERS \
		$d/include/tk$TK_HI_VERS \
		$d/include/tk$TK_OLD_VERS \
                $d/include"
TK_H_PLACES=" \
		../include \
		../tk$TK_VERS/generic \
                ../tk$TK_ALT_VERS/generic \
                ../tk$TK_HI_VERS/generic \
		/usr/src/local/tk$TK_VERS/generic \
                /usr/src/local/tk$TK_ALT_VERS/generic \
                /usr/src/local/tk$TK_HI_VERS/generic \
                /usr/contrib/include \
                /usr/local/lib/tk$TK_VERS \
                /usr/local/lib/tk$TK_ALT_VERS \
                /usr/local/lib/tk$TK_HI_VERS \
                /usr/local/include/tk$TK_VERS \
                /usr/local/include/tk$TK_ALT_VERS \
                /usr/local/include/tk$TK_HI_VERS \
                /usr/local/include \
                /import/tk/include/tk$TK_VERS \
                /import/tk/include/tk$TK_ALT_VERS \
                /import/tk/include/tk$TK_HI_VERS \
		../tk$TK_OLD_VERS/generic \
                ../tk$TK_OLD_ALT_VERS/generic \
		/usr/src/local/tk$TK_OLD_VERS/generic \
                /usr/src/local/tk$TK_OLD_ALT_VERS/generic \
                /usr/local/lib/tk$TK_OLD_VERS \
                /usr/local/lib/tk$TK_OLD_ALT_VERS \
                /usr/local/include/tk$TK_OLD_VERS \
                /usr/local/include/tk$TK_OLD_ALT_VERS \
                /import/tk/include/tk$TK_OLD_VERS \
                /import/tk/include/tk$TK_OLD_ALT_VERS \
                $prefix/include \
                $x_includes/tk \
                $x_includes \
                /usr/include \
                /usr/include/tcl"
dnl /usr/include/tcl for debian/linux
TK_LIB_PLACES_D="$d \ 
                $d/lib \
		$d/unix"
TK_LIB_PLACES=" \
		../lib \
		../lib/tk$TK_HI_VERS \
		../lib/tk$TK_VERS \
		../lib/tk$TK_ALT_VERS \
		../tk$TK_VERS/unix \
                ../tk$TK_ALT_VERS/unix \
                ../tk$TK_HI_VERS/unix \
                /usr/src/local/tk$TK_VERS/unix \
                /usr/src/local/tk$TK_ALT_VERS/unix \
                /usr/src/local/tk$TK_HI_VERS/unix \
                /usr/contrib/lib \
                /usr/local/lib/tk$TK_VERS \
                /usr/local/lib/tk$TK_ALT_VERS \
                /usr/local/lib/tk$TK_HI_VERS \
		../tk$TK_OLD_VERS/unix \
                ../tk$TK_OLD_ALT_VERS/unix \
                /usr/src/local/tk$TK_OLD_VERS/unix \
                /usr/src/local/tk$TK_OLD_ALT_VERS/unix \
                /usr/local/lib/tk$TK_OLD_VERS \
                /usr/local/lib/tk$TK_OLD_ALT_VERS \
                /usr/local/lib \
                $prefix/lib \
                $x_libs/tk \
                $x_libs \
                /usr/lib"

NS_BEGIN_PACKAGE(tk)
NS_CHECK_HEADER_PATH(tk.h,$TK_H_PLACES,$d,$TK_H_PLACES_D,V_INCLUDE_TK,tk)
NS_CHECK_LIB_PATH(tk$TK_HI_VERS,$TK_LIB_PLACES,$d,$TK_LIB_PLACES_D,V_LIB_TK,tk)
NS_CHECK_ANY_PATH(tk.tcl,$TK_TCL_PLACES,$d,$TK_TCL_PLACES_D,V_LIBRARY_TK,tk)
NS_END_PACKAGE(tk,no)

if test -r $V_LIBRARY_TK/optionMenu.tcl ; then
	V_TKDOSNAMES='$(LIBRARY_TK)/optionMenu.tcl $(LIBRARY_TK)/scrollbar.tcl'
	V_NEED_DL=""
else
	V_TKDOSNAMES='$(LIBRARY_TK)/optMenu.tcl $(LIBRARY_TK)/scrlbar.tcl'
	V_NEED_DL=YES
fi

AC_SUBST(V_TKDOSNAMES)
AC_SUBST(V_LIBRARY_TK)
