Fossil SCM
Allow the --with-tcl option to the configure script to work on more systems. Based on patch by Steve Bennett.
Commit
46c27e29e38435df8c204717fac5eb66e4b7a0ea
Parent
4fdb63d69018325…
2 files changed
+25
-19
+27
M
auto.def
+25
-19
| --- auto.def | ||
| +++ auto.def | ||
| @@ -87,30 +87,36 @@ | ||
| 87 | 87 | user-error "zlib not found please install it or specify the location with --with-zlib" |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | set tclpath [opt-val with-tcl] |
| 91 | 91 | if {$tclpath ne ""} { |
| 92 | - if {$tclpath ne "1"} { | |
| 93 | - cc-with [list -cflags [list -I$tclpath/include -L$tclpath/lib]] | |
| 94 | - } | |
| 95 | - if {![cc-check-includes tcl.h]} { | |
| 96 | - user-error "Cannot find tcl.h" | |
| 97 | - } | |
| 98 | - foreach tlib {tcl8.6 tcl8.5 tcl notfound} { | |
| 99 | - if {$tlib=="notfound"} { | |
| 100 | - user-error "Cannot find a usable libtcl" | |
| 101 | - } | |
| 102 | - if {[cc-check-function-in-lib Tcl_CreateInterp $tlib]} { | |
| 103 | - define-append LIBS -l$tlib | |
| 104 | - break | |
| 105 | - } | |
| 106 | - } | |
| 92 | + # Note parse-tclconfig-sh is in autosetup/local.tcl | |
| 93 | + if {$tclpath eq "1"} { | |
| 94 | + # Use the system Tcl. Look in some likely places. | |
| 95 | + array set tclconfig [parse-tclconfig-sh /usr /usr/local /usr/share /opt/local] | |
| 96 | + set msg "on your system" | |
| 97 | + } else { | |
| 98 | + array set tclconfig [parse-tclconfig-sh $tclpath] | |
| 99 | + set msg "at $tclpath" | |
| 100 | + } | |
| 101 | + if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} { | |
| 102 | + user-error "Cannot find Tcl $msg" | |
| 103 | + } | |
| 104 | + set cflags $tclconfig(TCL_INCLUDE_SPEC) | |
| 105 | + set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)" | |
| 106 | + cc-with [list -cflags $cflags -libs $libs] { | |
| 107 | + if {![cc-check-functions Tcl_CreateInterp]} { | |
| 108 | + user-error "Cannot find a usable Tcl $msg" | |
| 109 | + } | |
| 110 | + } | |
| 111 | + set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL) | |
| 112 | + msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)" | |
| 113 | + define-append LIBS $libs | |
| 114 | + define-append EXTRA_CFLAGS $cflags | |
| 115 | + define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS) | |
| 116 | + | |
| 107 | 117 | define FOSSIL_ENABLE_TCL |
| 108 | - if {$tclpath ne "1"} { | |
| 109 | - define-append EXTRA_CFLAGS -I$tclpath/include | |
| 110 | - define-append EXTRA_LDFLAGS -L$tclpath/lib | |
| 111 | - } | |
| 112 | 118 | } |
| 113 | 119 | |
| 114 | 120 | # Helper for openssl checking |
| 115 | 121 | proc check-for-openssl {msg {cflags {}}} { |
| 116 | 122 | msg-checking "Checking for $msg..." |
| 117 | 123 |
| --- auto.def | |
| +++ auto.def | |
| @@ -87,30 +87,36 @@ | |
| 87 | user-error "zlib not found please install it or specify the location with --with-zlib" |
| 88 | } |
| 89 | |
| 90 | set tclpath [opt-val with-tcl] |
| 91 | if {$tclpath ne ""} { |
| 92 | if {$tclpath ne "1"} { |
| 93 | cc-with [list -cflags [list -I$tclpath/include -L$tclpath/lib]] |
| 94 | } |
| 95 | if {![cc-check-includes tcl.h]} { |
| 96 | user-error "Cannot find tcl.h" |
| 97 | } |
| 98 | foreach tlib {tcl8.6 tcl8.5 tcl notfound} { |
| 99 | if {$tlib=="notfound"} { |
| 100 | user-error "Cannot find a usable libtcl" |
| 101 | } |
| 102 | if {[cc-check-function-in-lib Tcl_CreateInterp $tlib]} { |
| 103 | define-append LIBS -l$tlib |
| 104 | break |
| 105 | } |
| 106 | } |
| 107 | define FOSSIL_ENABLE_TCL |
| 108 | if {$tclpath ne "1"} { |
| 109 | define-append EXTRA_CFLAGS -I$tclpath/include |
| 110 | define-append EXTRA_LDFLAGS -L$tclpath/lib |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | # Helper for openssl checking |
| 115 | proc check-for-openssl {msg {cflags {}}} { |
| 116 | msg-checking "Checking for $msg..." |
| 117 |
| --- auto.def | |
| +++ auto.def | |
| @@ -87,30 +87,36 @@ | |
| 87 | user-error "zlib not found please install it or specify the location with --with-zlib" |
| 88 | } |
| 89 | |
| 90 | set tclpath [opt-val with-tcl] |
| 91 | if {$tclpath ne ""} { |
| 92 | # Note parse-tclconfig-sh is in autosetup/local.tcl |
| 93 | if {$tclpath eq "1"} { |
| 94 | # Use the system Tcl. Look in some likely places. |
| 95 | array set tclconfig [parse-tclconfig-sh /usr /usr/local /usr/share /opt/local] |
| 96 | set msg "on your system" |
| 97 | } else { |
| 98 | array set tclconfig [parse-tclconfig-sh $tclpath] |
| 99 | set msg "at $tclpath" |
| 100 | } |
| 101 | if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} { |
| 102 | user-error "Cannot find Tcl $msg" |
| 103 | } |
| 104 | set cflags $tclconfig(TCL_INCLUDE_SPEC) |
| 105 | set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)" |
| 106 | cc-with [list -cflags $cflags -libs $libs] { |
| 107 | if {![cc-check-functions Tcl_CreateInterp]} { |
| 108 | user-error "Cannot find a usable Tcl $msg" |
| 109 | } |
| 110 | } |
| 111 | set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL) |
| 112 | msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)" |
| 113 | define-append LIBS $libs |
| 114 | define-append EXTRA_CFLAGS $cflags |
| 115 | define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS) |
| 116 | |
| 117 | define FOSSIL_ENABLE_TCL |
| 118 | } |
| 119 | |
| 120 | # Helper for openssl checking |
| 121 | proc check-for-openssl {msg {cflags {}}} { |
| 122 | msg-checking "Checking for $msg..." |
| 123 |
+27
| --- autosetup/local.tcl | ||
| +++ autosetup/local.tcl | ||
| @@ -1,2 +1,29 @@ | ||
| 1 | 1 | # For this project, disable the pager for --help |
| 2 | 2 | set useropts(nopager) 1 |
| 3 | + | |
| 4 | +# Searches for a usable Tcl (prefer 8.6, 8.5, 8.4) in the given paths | |
| 5 | +# Returns a dictionary of the contents of the tclConfig.sh file, or | |
| 6 | +# empty if not found | |
| 7 | +proc parse-tclconfig-sh {args} { | |
| 8 | + foreach p $args { | |
| 9 | + # Allow pointing directly to the path containing tclConfig.sh | |
| 10 | + if {[file exists $p/tclConfig.sh]} { | |
| 11 | + return [parse-tclconfig-sh-file $p/tclConfig.sh] | |
| 12 | + } | |
| 13 | + # Some systems allow for multiple versions | |
| 14 | + foreach libpath {lib/tcl8.6 lib/tcl8.5 lib/tcl8.4 lib/tcl tcl lib} { | |
| 15 | + if {[file exists $p/$libpath/tclConfig.sh]} { | |
| 16 | + return [parse-tclconfig-sh-file $p/$libpath/tclConfig.sh] | |
| 17 | + } | |
| 18 | + } | |
| 19 | + } | |
| 20 | +} | |
| 21 | + | |
| 22 | +proc parse-tclconfig-sh-file {filename} { | |
| 23 | + foreach line [split [readfile $filename] \n] { | |
| 24 | + if {[regexp {^(TCL_[^=]*)=(.*)$} $line -> name value]} { | |
| 25 | + set tclconfig($name) [string trim $value '] | |
| 26 | + } | |
| 27 | + } | |
| 28 | + return [array get tclconfig] | |
| 29 | +} | |
| 3 | 30 |
| --- autosetup/local.tcl | |
| +++ autosetup/local.tcl | |
| @@ -1,2 +1,29 @@ | |
| 1 | # For this project, disable the pager for --help |
| 2 | set useropts(nopager) 1 |
| 3 |
| --- autosetup/local.tcl | |
| +++ autosetup/local.tcl | |
| @@ -1,2 +1,29 @@ | |
| 1 | # For this project, disable the pager for --help |
| 2 | set useropts(nopager) 1 |
| 3 | |
| 4 | # Searches for a usable Tcl (prefer 8.6, 8.5, 8.4) in the given paths |
| 5 | # Returns a dictionary of the contents of the tclConfig.sh file, or |
| 6 | # empty if not found |
| 7 | proc parse-tclconfig-sh {args} { |
| 8 | foreach p $args { |
| 9 | # Allow pointing directly to the path containing tclConfig.sh |
| 10 | if {[file exists $p/tclConfig.sh]} { |
| 11 | return [parse-tclconfig-sh-file $p/tclConfig.sh] |
| 12 | } |
| 13 | # Some systems allow for multiple versions |
| 14 | foreach libpath {lib/tcl8.6 lib/tcl8.5 lib/tcl8.4 lib/tcl tcl lib} { |
| 15 | if {[file exists $p/$libpath/tclConfig.sh]} { |
| 16 | return [parse-tclconfig-sh-file $p/$libpath/tclConfig.sh] |
| 17 | } |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | proc parse-tclconfig-sh-file {filename} { |
| 23 | foreach line [split [readfile $filename] \n] { |
| 24 | if {[regexp {^(TCL_[^=]*)=(.*)$} $line -> name value]} { |
| 25 | set tclconfig($name) [string trim $value '] |
| 26 | } |
| 27 | } |
| 28 | return [array get tclconfig] |
| 29 | } |
| 30 |