Subject: [PATCH] Add --with-tclsh argument to configure script.

From: Eygene Ryabinkin <[email-masked]>
Date: Wed, 13 Jun 2007 09:44:06 +0400

We have Tcl/Tk interpreter detection, so we should have Tcl interpreter
detection.  It is used just at the build time now, but it produces
the index that speeds up the git-gui loading.

Signed-off-by: Eygene Ryabinkin <[email-masked]>
---
 config.mak.in |    1 +
 configure.ac  |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index a3032e3..7601881 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -7,6 +7,7 @@ AR = @AR@
 TAR = @TAR@
 #INSTALL = @INSTALL@		# needs install-sh or install.sh in sources
 TCLTK_PATH = @TCLTK_PATH@
+TCL_PATH = @TCLSH_PATH@
 
 prefix = @prefix@
 exec_prefix = @exec_prefix@
diff --git a/configure.ac b/configure.ac
index fd1d241..184a466 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,16 @@ AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if])
 AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),\
 GIT_PARSE_WITH(tcltk))
 #
+# Declare the with-tclsh/without-tclsh options.
+AC_ARG_WITH(tclsh,
+AS_HELP_STRING([--with-tclsh],[Tcl interpreter path])
+AS_HELP_STRING([],[ARG is the full path to the Tcl interpreter that])
+AS_HELP_STRING([],[is needed only during the compilation time.])
+AS_HELP_STRING([],[Bare --with-tclsh will search for the Tcl])
+AS_HELP_STRING([],[interpreter and use it.  If no interpreter])
+AS_HELP_STRING([],[will be found, then the default one will be used]),\
+GIT_PARSE_WITH(tclsh))
+#

 ## Checks for programs.
@@ -110,6 +120,30 @@ if test -z "$NO_TCLTK"; then
     AC_SUBST(TCLTK_PATH)
   fi
 fi
+# TCLSH_PATH will be set to the name of the Tcl interpreter.
+# Possibly the name will be the fully qualified path, but
+# it can be just the interpreter name.  TCLSH_PATH will be
+# empty only in one case: when NO_TCLTK is defined.
+if test -z "$NO_TCLTK"; then
+  if test "$with_tclsh" = ""; then
+  # No Tcl interpreter switches given.
+  # Do not check for Tcl interpreter, use bare 'tclsh'.
+    TCLSH_PATH=${__GIT_DEFAULT_TCLSH_NAME}
+    AC_SUBST(TCLSH_PATH)
+  elif test "$with_tclsh" = "yes"; then
+  # Tcl interpreter check requested.
+    AC_CHECK_PROGS(TCLSH_PATH, [tclsh], )
+    if test -z "$TCLSH_PATH"; then
+      AC_MSG_RESULT([Tcl interpreter was not found in the PATH.  Using bare '${__GIT_DEFAULT_TCLSH_NAME}'])
+      TCLSH_PATH=${__GIT_DEFAULT_TCLSH_NAME}
+      AC_SUBST(TCLSH_PATH)
+    fi
+  else
+    AC_MSG_RESULT([Using Tcl interpreter $with_tclsh])
+    TCLSH_PATH="$with_tclsh"
+    AC_SUBST(TCLSH_PATH)
+  fi
+fi
 
 ## Checks for libraries.
 AC_MSG_NOTICE([CHECKS for libraries])
-- 
1.5.2.1