Skip to content

Instantly share code, notes, and snippets.

@andrewshadura
Created April 30, 2013 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewshadura/5492762 to your computer and use it in GitHub Desktop.
Save andrewshadura/5492762 to your computer and use it in GitHub Desktop.
Subject: Detect available Tcl headers automatically.
From: Andrew Shadura <bugzilla@tut.by>
--- a/lib/critcl/critcl.tcl
+++ b/lib/critcl/critcl.tcl
@@ -3647,7 +3647,13 @@
}
proc ::critcl::MinTclVersion {file} {
- return [GetParam $file mintcl 8.4]
+ set required [GetParam $file mintcl 8.4]
+ foreach version $v::hdrsavailable {
+ if {[package vsatisfies $version $required]} {
+ return $version
+ }
+ }
+ return $required
}
proc ::critcl::UsingTk {file} {
@@ -4553,6 +4559,10 @@
variable v::buildplatform [BuildPlatform]
variable v::hdrdir [file join $mydir critcl_c]
+ foreach d [lsort -dict [glob -types {d r} -directory $v::hdrdir -tails tcl*]] {
+ lappend v::hdrsavailable [regsub {^tcl} $d {}]
+ }
+
# The prefix is based on the package's version. This allows
# multiple versions of the package to use the same cache without
# interfering with each. Note that we cannot use 'pid' and similar
@@ -4771,6 +4781,9 @@
variable hdrdir ;# Path. Directory containing the helper
# files of the package. A sub-
# directory of 'mydir', see above.
+ variable hdrsavailable ;# Headers versions available. Used when
+ # building against system-provided Tcl
+ # headers
variable prefix ;# String. The string to start all file names
# generated by the package with. See
# 'Initialize' for our choice and
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment