Fossil SCM
Remove superflouous part of autosetup/local.tcl, suggested by [http://www.mail-archive.com/[email protected]/msg24976.html|Steve Bennett]
Commit
7198a7dc16d0be9f01b6daae990386afd18f8c10f9c53139d7b1c45e3569d120
Parent
a0ce33c90b7194a…
1 file changed
-195
-195
| --- autosetup/local.tcl | ||
| +++ autosetup/local.tcl | ||
| @@ -26,200 +26,5 @@ | ||
| 26 | 26 | set tclconfig($name) [string trim $value '] |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | return [array get tclconfig] |
| 30 | 30 | } |
| 31 | - | |
| 32 | -# The complex extension checking is done here. | |
| 33 | - | |
| 34 | -global withinfo | |
| 35 | -global extdb | |
| 36 | - | |
| 37 | -# Final determination of module status | |
| 38 | -dict set extdb status {} | |
| 39 | - | |
| 40 | -# Returns 1 if the extension has the attribute | |
| 41 | -proc ext-has {ext attr} { | |
| 42 | - expr {$attr in [dict get $::extdb attrs $ext]} | |
| 43 | -} | |
| 44 | - | |
| 45 | -# Returns an entry from the extension 'info' table, or $default otherwise | |
| 46 | -proc ext-get {ext key {default {}}} { | |
| 47 | - if {[dict exists $::extdb info $ext $key]} { | |
| 48 | - return [dict get $::extdb info $ext $key] | |
| 49 | - } else { | |
| 50 | - return $default | |
| 51 | - } | |
| 52 | -} | |
| 53 | - | |
| 54 | -# Set the status of the extension to the given value, and returns the value | |
| 55 | -proc ext-set-status {ext value} { | |
| 56 | - dict set ::extdb status $ext $value | |
| 57 | - return $value | |
| 58 | -} | |
| 59 | - | |
| 60 | -# Returns the status of the extension, or ? if unknown | |
| 61 | -proc ext-get-status {ext} { | |
| 62 | - if {[dict exists $::extdb status $ext]} { | |
| 63 | - return [dict get $::extdb status $ext] | |
| 64 | - } | |
| 65 | - return ? | |
| 66 | -} | |
| 67 | - | |
| 68 | -proc check-extension-status {ext required} { | |
| 69 | - global withinfo | |
| 70 | - | |
| 71 | - set status [ext-get-status $ext] | |
| 72 | - | |
| 73 | - if {$ext in $withinfo(without)} { | |
| 74 | - # Disabled without further ado | |
| 75 | - msg-result "Extension $ext...disabled" | |
| 76 | - return [ext-set-status $ext n] | |
| 77 | - } | |
| 78 | - | |
| 79 | - if {$status in {m y n}} { | |
| 80 | - return $status | |
| 81 | - } | |
| 82 | - | |
| 83 | - # required is "required" if this extension *must* be enabled | |
| 84 | - # required is "wanted" if it is not fatal for this extension | |
| 85 | - # not to be enabled | |
| 86 | - | |
| 87 | - array set depinfo {m 0 y 0 n 0} | |
| 88 | - | |
| 89 | - # Check direct dependencies | |
| 90 | - if [ext-get $ext check 1] { | |
| 91 | - # "check" conditions are met | |
| 92 | - } else { | |
| 93 | - # not met | |
| 94 | - incr depinfo(n) | |
| 95 | - } | |
| 96 | - | |
| 97 | - if {$depinfo(n) == 0} { | |
| 98 | - # Now extension dependencies | |
| 99 | - foreach i [ext-get $ext dep] { | |
| 100 | - set status [check-extension-status $i $required] | |
| 101 | - #puts "$ext: dep $i $required => $status" | |
| 102 | - incr depinfo($status) | |
| 103 | - if {$depinfo(n)} { | |
| 104 | - break | |
| 105 | - } | |
| 106 | - } | |
| 107 | - } | |
| 108 | - | |
| 109 | - #parray depinfo | |
| 110 | - | |
| 111 | - if {$depinfo(n)} { | |
| 112 | - msg-checking "Extension $ext..." | |
| 113 | - if {$required eq "required"} { | |
| 114 | - user-error "dependencies not met" | |
| 115 | - } | |
| 116 | - msg-result "disabled (dependencies)" | |
| 117 | - return [ext-set-status $ext n] | |
| 118 | - } | |
| 119 | - | |
| 120 | - # Selected as a module? | |
| 121 | - if {$ext in $withinfo(mod)} { | |
| 122 | - if {[ext-has $ext tcl]} { | |
| 123 | - # Easy, a Tcl module | |
| 124 | - msg-result "Extension $ext...tcl" | |
| 125 | - } elseif {[ext-has $ext static]} { | |
| 126 | - user-error "Extension $ext can't be a module" | |
| 127 | - } else { | |
| 128 | - msg-result "Extension $ext...module" | |
| 129 | - foreach i [ext-get $ext libdep] { | |
| 130 | - define-append LDLIBS_$ext [get-define $i ""] | |
| 131 | - } | |
| 132 | - } | |
| 133 | - return [ext-set-status $ext m] | |
| 134 | - } | |
| 135 | - | |
| 136 | - # Selected as a static extension? | |
| 137 | - if {[ext-has $ext shared]} { | |
| 138 | - user-error "Extension $ext can only be selected as a module" | |
| 139 | - } elseif {$ext in $withinfo(ext) || $required eq "$required"} { | |
| 140 | - msg-result "Extension $ext...enabled" | |
| 141 | - } elseif {$ext in $withinfo(maybe)} { | |
| 142 | - msg-result "Extension $ext...enabled (default)" | |
| 143 | - } else { | |
| 144 | - # Could be selected, but isn't (yet) | |
| 145 | - return [ext-set-status $ext x] | |
| 146 | - } | |
| 147 | - foreach i [ext-get $ext libdep] { | |
| 148 | - define-append LDLIBS [get-define $i ""] | |
| 149 | - } | |
| 150 | - return [ext-set-status $ext y] | |
| 151 | -} | |
| 152 | - | |
| 153 | -# Examines the user options (the $withinfo array) | |
| 154 | -# and the extension database ($extdb) to determine | |
| 155 | -# what is selected, and in what way. | |
| 156 | -# | |
| 157 | -# The results are available via ext-get-status | |
| 158 | -# And a dictionary is returned containing four keys: | |
| 159 | -# static-c extensions which are static C | |
| 160 | -# static-tcl extensions which are static Tcl | |
| 161 | -# module-c extensions which are C modules | |
| 162 | -# module-tcl extensions which are Tcl modules | |
| 163 | -proc check-extensions {} { | |
| 164 | - global extdb withinfo | |
| 165 | - | |
| 166 | - # Check valid extension names | |
| 167 | - foreach i [concat $withinfo(ext) $withinfo(mod)] { | |
| 168 | - if {![dict exists $extdb attrs $i]} { | |
| 169 | - user-error "Unknown extension: $i" | |
| 170 | - } | |
| 171 | - } | |
| 172 | - | |
| 173 | - set extlist [lsort [dict keys [dict get $extdb attrs]]] | |
| 174 | - | |
| 175 | - set withinfo(maybe) {} | |
| 176 | - | |
| 177 | - # Now work out the default status. We have. | |
| 178 | - # normal case, include !optional if possible | |
| 179 | - # --without=default, don't include optional | |
| 180 | - if {$withinfo(nodefault)} { | |
| 181 | - lappend withinfo(maybe) stdlib | |
| 182 | - } else { | |
| 183 | - foreach i $extlist { | |
| 184 | - if {![ext-has $i optional]} { | |
| 185 | - lappend withinfo(maybe) $i | |
| 186 | - } | |
| 187 | - } | |
| 188 | - } | |
| 189 | - | |
| 190 | - foreach i $extlist { | |
| 191 | - define LDLIBS_$i "" | |
| 192 | - } | |
| 193 | - | |
| 194 | - foreach i [concat $withinfo(ext) $withinfo(mod)] { | |
| 195 | - check-extension-status $i required | |
| 196 | - } | |
| 197 | - foreach i $withinfo(maybe) { | |
| 198 | - check-extension-status $i wanted | |
| 199 | - } | |
| 200 | - | |
| 201 | - array set extinfo {static-c {} static-tcl {} module-c {} module-tcl {}} | |
| 202 | - | |
| 203 | - foreach i $extlist { | |
| 204 | - set status [ext-get-status $i] | |
| 205 | - set tcl [ext-has $i tcl] | |
| 206 | - switch $status,$tcl { | |
| 207 | - y,1 { | |
| 208 | - define jim_ext_$i | |
| 209 | - lappend extinfo(static-tcl) $i | |
| 210 | - } | |
| 211 | - y,0 { | |
| 212 | - define jim_ext_$i | |
| 213 | - lappend extinfo(static-c) $i | |
| 214 | - # If there are any static C++ extensions, jimsh must be linked using | |
| 215 | - # the C++ compiler | |
| 216 | - if {[ext-has $i cpp]} { | |
| 217 | - define HAVE_CXX_EXTENSIONS | |
| 218 | - } | |
| 219 | - } | |
| 220 | - m,1 { lappend extinfo(module-tcl) $i } | |
| 221 | - m,0 { lappend extinfo(module-c) $i } | |
| 222 | - } | |
| 223 | - } | |
| 224 | - return [array get extinfo] | |
| 225 | -} | |
| 226 | 31 |
| --- autosetup/local.tcl | |
| +++ autosetup/local.tcl | |
| @@ -26,200 +26,5 @@ | |
| 26 | set tclconfig($name) [string trim $value '] |
| 27 | } |
| 28 | } |
| 29 | return [array get tclconfig] |
| 30 | } |
| 31 | |
| 32 | # The complex extension checking is done here. |
| 33 | |
| 34 | global withinfo |
| 35 | global extdb |
| 36 | |
| 37 | # Final determination of module status |
| 38 | dict set extdb status {} |
| 39 | |
| 40 | # Returns 1 if the extension has the attribute |
| 41 | proc ext-has {ext attr} { |
| 42 | expr {$attr in [dict get $::extdb attrs $ext]} |
| 43 | } |
| 44 | |
| 45 | # Returns an entry from the extension 'info' table, or $default otherwise |
| 46 | proc ext-get {ext key {default {}}} { |
| 47 | if {[dict exists $::extdb info $ext $key]} { |
| 48 | return [dict get $::extdb info $ext $key] |
| 49 | } else { |
| 50 | return $default |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | # Set the status of the extension to the given value, and returns the value |
| 55 | proc ext-set-status {ext value} { |
| 56 | dict set ::extdb status $ext $value |
| 57 | return $value |
| 58 | } |
| 59 | |
| 60 | # Returns the status of the extension, or ? if unknown |
| 61 | proc ext-get-status {ext} { |
| 62 | if {[dict exists $::extdb status $ext]} { |
| 63 | return [dict get $::extdb status $ext] |
| 64 | } |
| 65 | return ? |
| 66 | } |
| 67 | |
| 68 | proc check-extension-status {ext required} { |
| 69 | global withinfo |
| 70 | |
| 71 | set status [ext-get-status $ext] |
| 72 | |
| 73 | if {$ext in $withinfo(without)} { |
| 74 | # Disabled without further ado |
| 75 | msg-result "Extension $ext...disabled" |
| 76 | return [ext-set-status $ext n] |
| 77 | } |
| 78 | |
| 79 | if {$status in {m y n}} { |
| 80 | return $status |
| 81 | } |
| 82 | |
| 83 | # required is "required" if this extension *must* be enabled |
| 84 | # required is "wanted" if it is not fatal for this extension |
| 85 | # not to be enabled |
| 86 | |
| 87 | array set depinfo {m 0 y 0 n 0} |
| 88 | |
| 89 | # Check direct dependencies |
| 90 | if [ext-get $ext check 1] { |
| 91 | # "check" conditions are met |
| 92 | } else { |
| 93 | # not met |
| 94 | incr depinfo(n) |
| 95 | } |
| 96 | |
| 97 | if {$depinfo(n) == 0} { |
| 98 | # Now extension dependencies |
| 99 | foreach i [ext-get $ext dep] { |
| 100 | set status [check-extension-status $i $required] |
| 101 | #puts "$ext: dep $i $required => $status" |
| 102 | incr depinfo($status) |
| 103 | if {$depinfo(n)} { |
| 104 | break |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | #parray depinfo |
| 110 | |
| 111 | if {$depinfo(n)} { |
| 112 | msg-checking "Extension $ext..." |
| 113 | if {$required eq "required"} { |
| 114 | user-error "dependencies not met" |
| 115 | } |
| 116 | msg-result "disabled (dependencies)" |
| 117 | return [ext-set-status $ext n] |
| 118 | } |
| 119 | |
| 120 | # Selected as a module? |
| 121 | if {$ext in $withinfo(mod)} { |
| 122 | if {[ext-has $ext tcl]} { |
| 123 | # Easy, a Tcl module |
| 124 | msg-result "Extension $ext...tcl" |
| 125 | } elseif {[ext-has $ext static]} { |
| 126 | user-error "Extension $ext can't be a module" |
| 127 | } else { |
| 128 | msg-result "Extension $ext...module" |
| 129 | foreach i [ext-get $ext libdep] { |
| 130 | define-append LDLIBS_$ext [get-define $i ""] |
| 131 | } |
| 132 | } |
| 133 | return [ext-set-status $ext m] |
| 134 | } |
| 135 | |
| 136 | # Selected as a static extension? |
| 137 | if {[ext-has $ext shared]} { |
| 138 | user-error "Extension $ext can only be selected as a module" |
| 139 | } elseif {$ext in $withinfo(ext) || $required eq "$required"} { |
| 140 | msg-result "Extension $ext...enabled" |
| 141 | } elseif {$ext in $withinfo(maybe)} { |
| 142 | msg-result "Extension $ext...enabled (default)" |
| 143 | } else { |
| 144 | # Could be selected, but isn't (yet) |
| 145 | return [ext-set-status $ext x] |
| 146 | } |
| 147 | foreach i [ext-get $ext libdep] { |
| 148 | define-append LDLIBS [get-define $i ""] |
| 149 | } |
| 150 | return [ext-set-status $ext y] |
| 151 | } |
| 152 | |
| 153 | # Examines the user options (the $withinfo array) |
| 154 | # and the extension database ($extdb) to determine |
| 155 | # what is selected, and in what way. |
| 156 | # |
| 157 | # The results are available via ext-get-status |
| 158 | # And a dictionary is returned containing four keys: |
| 159 | # static-c extensions which are static C |
| 160 | # static-tcl extensions which are static Tcl |
| 161 | # module-c extensions which are C modules |
| 162 | # module-tcl extensions which are Tcl modules |
| 163 | proc check-extensions {} { |
| 164 | global extdb withinfo |
| 165 | |
| 166 | # Check valid extension names |
| 167 | foreach i [concat $withinfo(ext) $withinfo(mod)] { |
| 168 | if {![dict exists $extdb attrs $i]} { |
| 169 | user-error "Unknown extension: $i" |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | set extlist [lsort [dict keys [dict get $extdb attrs]]] |
| 174 | |
| 175 | set withinfo(maybe) {} |
| 176 | |
| 177 | # Now work out the default status. We have. |
| 178 | # normal case, include !optional if possible |
| 179 | # --without=default, don't include optional |
| 180 | if {$withinfo(nodefault)} { |
| 181 | lappend withinfo(maybe) stdlib |
| 182 | } else { |
| 183 | foreach i $extlist { |
| 184 | if {![ext-has $i optional]} { |
| 185 | lappend withinfo(maybe) $i |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | foreach i $extlist { |
| 191 | define LDLIBS_$i "" |
| 192 | } |
| 193 | |
| 194 | foreach i [concat $withinfo(ext) $withinfo(mod)] { |
| 195 | check-extension-status $i required |
| 196 | } |
| 197 | foreach i $withinfo(maybe) { |
| 198 | check-extension-status $i wanted |
| 199 | } |
| 200 | |
| 201 | array set extinfo {static-c {} static-tcl {} module-c {} module-tcl {}} |
| 202 | |
| 203 | foreach i $extlist { |
| 204 | set status [ext-get-status $i] |
| 205 | set tcl [ext-has $i tcl] |
| 206 | switch $status,$tcl { |
| 207 | y,1 { |
| 208 | define jim_ext_$i |
| 209 | lappend extinfo(static-tcl) $i |
| 210 | } |
| 211 | y,0 { |
| 212 | define jim_ext_$i |
| 213 | lappend extinfo(static-c) $i |
| 214 | # If there are any static C++ extensions, jimsh must be linked using |
| 215 | # the C++ compiler |
| 216 | if {[ext-has $i cpp]} { |
| 217 | define HAVE_CXX_EXTENSIONS |
| 218 | } |
| 219 | } |
| 220 | m,1 { lappend extinfo(module-tcl) $i } |
| 221 | m,0 { lappend extinfo(module-c) $i } |
| 222 | } |
| 223 | } |
| 224 | return [array get extinfo] |
| 225 | } |
| 226 |
| --- autosetup/local.tcl | |
| +++ autosetup/local.tcl | |
| @@ -26,200 +26,5 @@ | |
| 26 | set tclconfig($name) [string trim $value '] |
| 27 | } |
| 28 | } |
| 29 | return [array get tclconfig] |
| 30 | } |
| 31 |