| | @@ -33,12 +33,47 @@ |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | # Use pread/pwrite system calls in place of seek + read/write if possible |
| 36 | 36 | define USE_PREAD [cc-check-functions pread] |
| 37 | 37 | |
| 38 | | -# Find tclsh for the test suite. Can't yet use jimsh for this. |
| 38 | +# Find tclsh for the test suite. |
| 39 | +# |
| 40 | +# We can't use jimsh for this: the test suite uses features of Tcl that |
| 41 | +# Jim doesn't support, either statically or due to the way it's built by |
| 42 | +# autosetup. For example, Jim supports `file normalize`, but only if |
| 43 | +# you build it with HAVE_REALPATH, which won't ever be defined in this |
| 44 | +# context because autosetup doesn't try to discover platform-specific |
| 45 | +# details like that before it decides to build jimsh0. Besides which, |
| 46 | +# autosetup won't build jimsh0 at all if it can find tclsh itself. |
| 47 | +# Ironically, this means we may right now be running under either jimsh0 |
| 48 | +# or a version of tclsh that we find unsuitable below! |
| 39 | 49 | cc-check-progs tclsh |
| 50 | +set hbtd /usr/local/Cellar/tcl-tk |
| 51 | +if {[string equal false [get-define TCLSH]]} { |
| 52 | + msg-result "WARNING: 'make test' will not run here." |
| 53 | +} else { |
| 54 | + set v [exec /bin/sh -c "echo 'puts \$tcl_version' | tclsh"] |
| 55 | + if {[expr $v >= 8.6]} { |
| 56 | + msg-result "Found Tclsh version $v in the PATH." |
| 57 | + define TCLSH tclsh |
| 58 | + } elseif {[file isdirectory $hbtd]} { |
| 59 | + # This is a macOS system with the Homebrew version of Tcl/Tk |
| 60 | + # installed. Select the newest version. It won't normally be |
| 61 | + # in the PATH to avoid shadowing /usr/bin/tclsh, and even if it |
| 62 | + # were in the PATH, it's bad practice to put /usr/local/bin (the |
| 63 | + # Homebrew default) ahead of /usr/bin, especially given that |
| 64 | + # it's user-writeable by default with Homebrew. Thus, we can be |
| 65 | + # pretty sure the only way to call it is with an absolute path. |
| 66 | + set v [exec ls -tr $hbtd | tail -1] |
| 67 | + set path "$hbtd/$v/bin/tclsh" |
| 68 | + define TCLSH $path |
| 69 | + msg-result "Using Homebrew Tcl/Tk version $path." |
| 70 | + } else { |
| 71 | + msg-result "WARNING: tclsh $v found; need >= 8.6 for 'make test'." |
| 72 | + define TCLSH false ;# force "make test" failure via /usr/bin/false |
| 73 | + } |
| 74 | +} |
| 40 | 75 | |
| 41 | 76 | define EXTRA_CFLAGS "-Wall" |
| 42 | 77 | define EXTRA_LDFLAGS "" |
| 43 | 78 | define USE_SYSTEM_SQLITE 0 |
| 44 | 79 | define USE_LINENOISE 0 |
| 45 | 80 | |