git-gui: Verify Tcl/Tk is new enough for our needs

For quite a while we have been assuming the user is running on
a Tcl/Tk 8.4 or later platform.  This may not be the case on
some very old systems.  Unfortunately I am pretty far down the
path of using the Tcl/Tk 8.4 commands and options and cannot
easily work around them to support earlier versions of Tcl/Tk.
So we'll check that we are using the correct version up front,
and if not we'll stop with a related error message.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
diff --git a/git-gui.sh b/git-gui.sh
index daee560..cc1625b 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -22,6 +22,22 @@
 
 ######################################################################
 ##
+## Tcl/Tk sanity check
+
+if {[catch {package require Tcl 8.4} err]
+ || [catch {package require Tk  8.4} err]
+} {
+	catch {wm withdraw .}
+	tk_messageBox \
+		-icon error \
+		-type ok \
+		-title "git-gui: fatal error" \
+		-message $err
+	exit 1
+}
+
+######################################################################
+##
 ## configure our library
 
 set oguilib {@@GITGUI_LIBDIR@@}