#!/bin/sh
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" ${1+"$@"}

if {[llength $argv]} {
  set debug 1
} else {
  set debug 0
}

## Check Tk version:
if {![package vsatisfies $tcl_version 8.3.3]} {
  puts stderr "  =====> TkDND requires at least tk8.3.3! <====="
  exit 1
}                                                                               

set libpath [file dirname [info library]]
catch {file delete -force config.cache}
if {$debug} {
  puts "+++ Running 'configure --enable-gcc --with-tcl=$libpath --with-tk=$libpath --enable-symbols' in directory [pwd]..."
  catch {exec ./configure --enable-gcc --with-tcl=$libpath --with-tk=$libpath --enable-symbols >@ stdout}
} else {
  puts "+++ Running 'configure --enable-gcc --with-tcl=$libpath --with-tk=$libpath' in directory [pwd]..."
  catch {exec ./configure --enable-gcc --with-tcl=$libpath --with-tk=$libpath --prefix=/disk2a/users/petasis >@ stdout}
}
