1# tcl.m4 --
2#
3#	This file provides a set of autoconf macros to help TEA-enable
4#	a Tcl extension.
5#
6# Copyright (c) 1999-2000 Ajuba Solutions.
7# All rights reserved.
8#
9# See the file "license.terms" for information on usage and redistribution
10# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
12#------------------------------------------------------------------------
13# SC_SIMPLE_EXEEXT
14#	Select the executable extension based on the host type.  This
15#	is a lightweight replacement for AC_EXEEXT that doesn't require
16#	a compiler.
17#
18# Arguments
19#	none
20#
21# Results
22#	Subst's the following values:
23#		EXEEXT
24#------------------------------------------------------------------------
25
26AC_DEFUN(SC_SIMPLE_EXEEXT, [
27    AC_MSG_CHECKING(executable extension based on host type)
28
29    case "`uname -s`" in
30	*win32* | *WIN32* | *CYGWIN_NT* |*CYGWIN_98*|*CYGWIN_95*|*MSYS*)
31	    EXEEXT=".exe"
32	;;
33	*)
34	    EXEEXT=""
35	;;
36    esac
37
38    AC_MSG_RESULT(${EXEEXT})
39    AC_SUBST(EXEEXT)
40])
41
42#------------------------------------------------------------------------
43# SC_PROG_TCLSH
44#	Locate a tclsh shell in the following directories:
45#		${exec_prefix}/bin
46#		${prefix}/bin
47#		${TCL_BIN_DIR}
48#		${TCL_BIN_DIR}/../bin
49#		${PATH}
50#
51# Arguments
52#	none
53#
54# Results
55#	Subst's the following values:
56#		TCLSH_PROG
57#------------------------------------------------------------------------
58
59AC_DEFUN(SC_PROG_TCLSH, [
60    AC_MSG_CHECKING([for tclsh])
61
62    AC_CACHE_VAL(ac_cv_path_tclsh, [
63	search_path=`echo ${exec_prefix}/bin:${prefix}/bin:${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${PATH} | sed -e 's/:/ /g'`
64	for dir in $search_path ; do
65	    for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \
66		    `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do
67		if test x"$ac_cv_path_tclsh" = x ; then
68		    if test -f "$j" ; then
69			ac_cv_path_tclsh=$j
70			break
71		    fi
72		fi
73	    done
74	done
75    ])
76
77    if test -f "$ac_cv_path_tclsh" ; then
78	TCLSH_PROG=$ac_cv_path_tclsh
79	AC_MSG_RESULT($TCLSH_PROG)
80    else
81	AC_MSG_ERROR(No tclsh found in PATH:  $search_path)
82    fi
83    AC_SUBST(TCLSH_PROG)
84])
85