Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
| Comment: | Integrating the autosetup feature branch into trunk |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
80e134d2dbddfd6be66883eb5fdad0e2 |
| User & Date: | hypnotoad 2015-05-19 15:35:22 |
|
2015-06-01
| ||
| 18:27 | Fixed the "install sherpa" command check-in: 5e24e26760 user: hypnotoad tags: trunk | |
|
2015-05-19
| ||
| 15:35 | Integrating the autosetup feature branch into trunk check-in: 80e134d2db user: hypnotoad tags: trunk | |
|
2015-05-14
| ||
| 09:58 | Bumping sqlite back down to 3.8.7.2 Closed-Leaf check-in: 6b5f67f98b user: hypnotoad tags: autosetup | |
|
2015-05-04
| ||
| 20:10 | Updating to the latest tcllib check-in: 57829fab92 user: hypnotoad tags: trunk | |
1 2 3 4 5 6 7 | # Makefile.in -- # include odieConfig.sh all: install core: install | > > > > > > > | > | > | | | < < > | < | < < | < > | | < | | < | < > | | < | > | < < < < | < < | | < > | < > | | < | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# Makefile.in --
#
include odieConfig.sh
all: install
core: install
reconfig:
rm -f autosetup/jimsh0.exe autosetup/jimsh0
ODIE_BUILD_TCLSH=`autosetup/find-tclsh`
${ODIE_BUILD_TCLSH} autosetup/autosetup $(ODIE_RECONFIG_OPTS)
cp -a ${ODIE_SRC_DIR}/odieConfig.tcl ${LOCAL_REPO}/lib/odieConfig.tcl
cp -a ${ODIE_SRC_DIR}/odieConfig.sh ${LOCAL_REPO}/lib/odieConfig.sh
install: sherpa
$(SHELL) scripts/make_skel.sh
$(SHELL) scripts/make_tcl.sh
ODIE_BUILD_TCLSH=`autosetup/find-tclsh`
$(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl
$(SHERPA) upgrade sqlite odielib tcllib
${ODIE_BUILD_TCLSH} scripts/make_basekit.tcl
packages: sherpa
$(SHERPA) install sqlite odielib tcllib
upgrade:
$(FOSSIL) update
${ODIE_BUILD_TCLSH} scripts/upgrade.tcl
$(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl
$(SHERPA) upgrade sqlite odielib tcllib
${ODIE_BUILD_TCLSH} scripts/make_basekit.tcl
upgrade-tcl:
$(FOSSIL) update
$(SHELL) scripts/make_tcl.sh
ODIE_BUILD_TCLSH=`autosetup/find-tclsh`
${ODIE_BUILD_TCLSH} scripts/upgrade.tcl
$(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl
$(SHERPA) upgrade sqlite odielib tcllib
${ODIE_BUILD_TCLSH} scripts/make_basekit.tcl
tcl:
$(SHELL) scripts/make_tcl.sh
rebuild:
$(SHELL) scripts/make_distclean.sh
$(FOSSIL) update
$(SHELL) scripts/make_tcl.sh
$(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl
$(SHERPA) upgrade sqlite odielib tcllib
${ODIE_BUILD_TCLSH} scripts/make_basekit.tcl
distclean:
$(SHELL) scripts/make_distclean.sh
basekit:
${ODIE_BUILD_TCLSH} scripts/make_basekit.tcl
sherpa: $ODIE_DOWNLOAD/sherpa/sherpa.tcl
$ODIE_DOWNLOAD/sherpa/sherpa.tcl:
$(ODIE_BUILD_TCLSH) scripts/make_sherpa.tcl
$(ODIE_MKHDR):
$(CC) -o mkhdr.o scripts/mkhdr.c
$(CC) mkhdr.o -o mkhdr${EXE_SUFFIX}
cp -f mkhdr@EXE@ $(ODIE_MKHDR)
mkhdr: $(ODIE_MKHDR)
mkdoc:
$(TCLSH) scripts/mkdoc.tcl
.PHONY: all binaries clean depend distclean doc install libraries test upgrade upgrade-tcl
.PHONY: core sherpa basekit odielib toadkit sqlite reconfig mkhdr packages
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
|
| ︙ | ︙ | |||
21 22 23 24 25 26 27 |
set argv [lrange $argv 1 end]
source [file join $here tkdiff.tcl]
vwait forever
exit
}
}
| > > | > | | | | < < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
set argv [lrange $argv 1 end]
source [file join $here tkdiff.tcl]
vwait forever
exit
}
}
set ::odie(ConfigShFile) [file join $here .. .. odie odieConfig.sh]
set ::odie(ConfigTclFile) [file join $here .. .. odie odieConfig.tcl]
source $::odie(ConfigTclFile)
source [file join $::odie(sandbox) odielib modules odie index.tcl]
source [file join $::odie(sandbox) odielib modules codebale index.tcl]
source [file join $::odie(sandbox) odielib modules codebale index.tcl]
source [file join $::odie(sandbox) taolib modules tao index.tcl]
source [file join $::odie(sandbox) sherpa modules sherpa index.tcl]
if { $argv eq {} } {
puts "Usage: make_module.tcl COMMAND MODULENAME ?MODULENAME...?"
exit 1
}
::sherpa::load_recipes
|
| ︙ | ︙ |
1 2 | #!/usr/bin/make | | | 1 2 3 4 5 6 7 8 9 10 | #!/usr/bin/make include ../../../odie/odieConfig.sh ### # Feel free to modify these ### APPNAME=sherpa PACKAGES=sqlite tcllib odielib tclvfs taolib project-base=../../ |
| ︙ | ︙ | |||
41 42 43 44 45 46 47 |
gather-src:
eval ${ODIE_RM} ${APPNAME}.vfs manifest.txt plugin.zip
mkdir -p ${APPNAME}.vfs
mkdir -p ${APPNAME}.vfs/apps
cp -a src/* ${APPNAME}.vfs/
| | > > > | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
gather-src:
eval ${ODIE_RM} ${APPNAME}.vfs manifest.txt plugin.zip
mkdir -p ${APPNAME}.vfs
mkdir -p ${APPNAME}.vfs/apps
cp -a src/* ${APPNAME}.vfs/
cp -a $(project-base)/../odielib/modules ${APPNAME}.vfs/lib
cp -a $(project-base)/../sherpa/modules ${APPNAME}.vfs/lib
cp -a $(project-base)/../sherpa/recipes ${APPNAME}.vfs
cp -a ../../../odie/odieConfig.tcl ${APPNAME}.vfs/
cp -a ../../../odie/odieConfig.sh ${APPNAME}.vfs/
cp ${ODIE_SRC_DIR}/apps/e.tcl ${APPNAME}.vfs/apps/edit.tcl
cp ${ODIE_SRC_DIR}/apps/tkdiff.tcl ${APPNAME}.vfs/apps/diff.tcl
cp ${ODIE_SRC_DIR}/scripts/rmdir.tcl ${APPNAME}.vfs/apps/rm.tcl
cp -a ../../recipes/ ${APPNAME}.vfs/recipes/
${ODIE_TCLSH} ../sherpa.tcl vfs_install ${APPNAME}.vfs ${PACKAGES}
${ODIE_TCLSH} ../sherpa.tcl vfs_mkIndex ${APPNAME}.vfs
install: ${APPNAME}${EXE}
cp -f ${APPNAME}${EXE} ${LOCAL_REPO}/bin/${APPNAME}${EXE}
.PHONY: install
|
| ︙ | ︙ | |||
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# description:
# Find package attempts to load packages live from source, and failing that
# use an internal version
###
proc ::find_package package {
if {[file exists [file join $::odie(src_dir) modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(src_dir) modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) taolib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) taolib modules $package index.tcl]
} else {
uplevel #0 [list package require $package]
}
}
| > > > > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# description:
# Find package attempts to load packages live from source, and failing that
# use an internal version
###
proc ::find_package package {
if {[file exists [file join $::odie(src_dir) modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(src_dir) modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) odielib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) odielib modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) sherpa modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) sherpa modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) taolib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) taolib modules $package index.tcl]
} else {
uplevel #0 [list package require $package]
}
}
|
| ︙ | ︙ |
| ︙ | ︙ | |||
39 40 41 42 43 44 45 |
proc ::find_package package {
if {[file exists [file join $::odie(sandbox) tcllib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) tcllib modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) tcllib modules $package $package.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) tcllib modules $package $package.tcl]
} elseif {[file exists [file join $::odie(src_dir) modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(src_dir) modules $package index.tcl]
| | | | | > > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
proc ::find_package package {
if {[file exists [file join $::odie(sandbox) tcllib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) tcllib modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) tcllib modules $package $package.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) tcllib modules $package $package.tcl]
} elseif {[file exists [file join $::odie(src_dir) modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(src_dir) modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) taolib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) taolib modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) odielib modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) odielib modules $package index.tcl]
} elseif {[file exists [file join $::odie(sandbox) sherpa modules $package index.tcl]]} {
uplevel #0 source [file join $::odie(sandbox) sherpa modules $package index.tcl]
} else {
uplevel #0 [list package require $package]
}
}
package require teapotclient
find_package odie
|
| ︙ | ︙ |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
###
# Odie autosetup script
###
use system
options {
sandbox: with-sandbox: => {Writable location for builds}
download: with-download => {Writable location for downloading source}
tclbranch:release => {Branch of the Tcl core to build against}
tkbranch: => {Branch of the Tk core to build against
* defaults to tclbranch
* if "none" is specified, Tk is disabled}
windowsystem:native => {For platforms with multiple windowing systems, which system to target.
native - The native window system
x11 - An x11 emulation environment
none - Disable Tk support (equivilent to tkbranch=none)
}
64bit:detect => {Enable 64 bit support (default detect)}
fossil: => {Location of native fossil executable (default detect)}
tclsh: => {Location of native tcl shell (default detect)}
}
set ::odie(src_dir) [file dirname [file-normalize [info script]]]
use odie
switch [opt-val 64bit] {
amd64 -
x64 -
x86_64 {
set ::odie(64bit) 1
}
{} -
detect {
}
default {
set ::odie(64bit) [opt-bool 64bit]
}
}
set ::odie_config(64bit) $::odie(64bit)
set ::odie(host) [get-define host]
set ::odie(target) [get-define target]
#--------------------------------------------------------------------
# Determines the correct executable file extension (.exe)
#--------------------------------------------------------------------
define EXE $::odie(exe_suffix)
define EXE_SUFFIX $::odie(exe_suffix)
define target [get-define target]
set ::odie(sandbox) [opt-val sandbox]
if {$::odie(sandbox) eq {}} {
set ::odie(sandbox) [file join $::odie(prefix) sandbox]
} else {
set ::odie_config(sandbox) $::odie(sandbox)
}
set ::odie(sandbox_path) $::odie(sandbox)
set ::odie(download) [opt-val download]
if {$::odie(download) eq {}} {
set ::odie(download) [file join $::odie(prefix) download]
} else {
set ::odie_config(download) $::odie(download)
}
set ::odie(download_path) $::odie(download)
set ::odie(fossil) [lindex [opt-val fossil] end]
if {$::odie(fossil) eq {}} {
set ::odie(fossil) [lindex [find-an-executable -required fossil] 0]
} else {
set ::odie_config(fossil) $::odie(fossil)
}
set ::odie_prog(fossil) $::odie(fossil)
define FOSSIL_PROG $::odie(fossil)
set ::odie(build_tclsh) [lindex [opt-val tclsh] end]
if {$::odie(build_tclsh) eq {}} {
set ::odie(build_tclsh) [info nameofexecutable]
} else {
set ::odie_config(tclsh) $::odie(build_tclsh)
}
set ::odie_prog(tclsh) $::odie(build_tclsh)
define ODIE_BUILD_TCLSH $::odie(build_tclsh)
use cc cc-lib odie
foreach {program required domake} {
zip 1 0
unzip 1 0
tar 1 0
git 0 1
strip 0 0
mkhdr 0 1
sherpa 0 1
} {
if {$required} {
set exename [lindex [find-an-executable -required $program] 0]
} else {
set exename [lindex [find-an-executable $program] 0]
}
if {$domake && $exename eq {}} {
set prog_build($program) 1
set exename [file join $::odie(prefix) bin ${program}$::odie(exe_suffix)]
} else {
set prog_build($program) 0
}
set odie_prog($program) [::realpath $exename]
define [string toupper ${program}_prog] [::cygpath $exename]
}
# XXX SC_ODIE
# XXX SC_ENABLE_SHARED
# XXX ODIE_PROG_TCLSH
# XXX ODIE_PROG_WISH
###
# Build Tcl/Tk
###
set ::odie_tcl(fossil_branch) [opt-val tclbranch]
if {$::odie_tcl(fossil_branch) eq {}} {
set ::odie_tcl(fossil_branch) release
}
set ::odie_config(tclbranch) $::odie_tcl(fossil_branch)
if {$::odie(64bit)} {
lappend ::odie_tcl(config_flags) --enable-64bit
} else {
lappend ::odie_tcl(config_flags) --enable-64bit=no
}
switch $::odie(teacup_os) {
"macosx" {
lappend ::odie_tcl(config_flags) --enable-corefoundation=no --enable-framework=no
}
"macosx10.5" {
lappend ::odie_tcl(config_flags) --enable-corefoundation=yes --enable-framework=no
}
}
set ::odie(window_system) [opt-val windowsystem]
set ::odie_tk(fossil_branch) [opt-val tkbranch]
if { $::odie(window_system) eq "none" || $::odie_tk(fossil_branch) eq "none"} {
###
# Tk support disabled
###
set ::odie_tk(fossil_branch) none
set ::odie(window_system) none
set ::odie(tk_binary_platform) none
} else {
set ::odie_tk(config_flags) $::odie_tcl(config_flags)
if {$::odie_tk(fossil_branch) eq {}} {
set ::odie_tk(fossil_branch) $::odie_tcl(fossil_branch)
}
switch $::odie(os) {
"linux" {
set ::odie(window_system) x11
lappend ::odie_tk(config_flags) --enable-xft=no --enable-xss=no
}
"macosx" {
###
# Window system only matters on OSX
###
if { [string compare "10.5" $::odie(os_version)] < 0 } {
# Pre 10.5 systems don't use a compadible cocoa
set ::odie(window_system) x11
}
switch $::odie(window_system) {
windows {
set ::odie(window_system) windows
}
x11 {
set ::odie(window_system) x11
set ::odie(teacup_profile) $::odie(teacup_os)-x11-$::odie(cpu)
lappend ::odie_tk(config_flags) --enable-aqua=no --x-includes=/opt/X11/include
}
default {
set ::odie(window_system) cocoa
set ::odie(teacup_profile_tk) $::odie(teacup_profile)
lappend ::odie_tk(config_flags) --enable-aqua=yes
}
}
}
}
}
set ::odie_config(tkbranch) $::odie_tk(fossil_branch)
set ::odie_config(windowsystem) $::odie(window_system)
###
# Detect a CC to use
###
if {![info exists ::odie(cc)]} {
set ::odie(cc) [get-define CC]
}
foreach {field value} [array get ::odie] {
define [string toupper ODIE_$field] $value
}
foreach {field value} [array get ::odie_tcl] {
define [string toupper TCL_$field] $value
}
foreach {field value} [array get ::odie_tk] {
define [string toupper TK_$field] $value
}
foreach {field value} [array get ::odie_prog] {
define [string toupper ODIE_PROG_$field] $value
define [string toupper ${field}_PROG] $value
}
define FOSSIL_CHECKOUT $::odie(fossil_checkout)
make-template odieConfig.sh.in odieConfig.sh
make-template odieConfig.tcl.in odieConfig.tcl
set fout [open [file join $::odie(src_dir) odieConfig.tcl] a]
puts $fout "array set ::odie_config \{"
foreach {field} [lsort [array names ::odie_config]] {
puts $fout " [list $field $::odie_config($field)]"
}
puts $fout "\}"
puts $fout "array set ::odie \{"
foreach {field} [lsort [array names ::odie]] {
puts $fout " [list $field $::odie($field)]"
}
puts $fout "\}"
puts $fout "array set ::odie_tcl \{"
foreach {field} [lsort [array names ::odie_tcl]] {
puts $fout " [list $field $::odie_tcl($field)]"
}
puts $fout "\}"
puts $fout "array set ::odie_tk \{"
foreach {field} [lsort [array names ::odie_tk]] {
puts $fout " [list $field $::odie_tk($field)]"
}
puts $fout "\}"
puts $fout "array set ::odie_prog \{"
foreach {field} [lsort [array names ::odie_prog]] {
puts $fout " [list $field $::odie_prog($field)]"
}
puts $fout "\}"
close $fout
set fout [open [file join $::odie(src_dir) odieConfig.sh] a]
set opts {}
foreach {field} [lsort [array names ::odie_config]] {
set value $::odie_config($field)
lappend opts --${field}=$value
if {[llength $value]!=1} {
set value '$value'
}
puts $fout "ODIE_CONFIG_[string toupper $field]=$value"
}
puts $fout "ODIE_RECONFIG_OPTS="
foreach opt $opts {
puts $fout "ODIE_RECONFIG_OPTS+=$opt"
}
foreach {field} [lsort [array names ::odie]] {
set value $::odie($field)
if {[llength $value]!=1} {
set value '$value'
}
puts $fout "ODIE_[string toupper $field]=$value"
}
foreach {field} [lsort [array names ::odie_tcl]] {
set value $::odie_tcl($field)
if {[llength $value]!=1} {
set value '$value'
}
puts $fout "TCL_[string toupper $field]=$value"
}
foreach {field} [lsort [array names ::odie_tk]] {
set value $::odie_tk($field)
if {[llength $value]!=1} {
set value '$value'
}
puts $fout "TK_[string toupper $field]=$value"
}
close $fout
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | Unless explicitly stated, all files which form part of autosetup are released under the following license: --------------------------------------------------------------------- autosetup - A build environment "autoconfigurator" Copyright (c) 2010-2011, WorkWare Systems <http://workware.net.au/> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE WORKWARE SYSTEMS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WORKWARE SYSTEMS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of WorkWare Systems. |
> > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # This is a convenience Makefile to do a few admin tasks all: @echo "Try 'make reference' or './autosetup --help'" VERSION := $(shell ./autosetup --version) dist: clean @./autosetup --install=tmp/autosetup-$(VERSION) >/dev/null @tar -C tmp -czf autosetup-$(VERSION).tar.gz autosetup-$(VERSION) @rm -rf tmp @echo Created autosetup-$(VERSION).tar.gz PAGER ?= less help: ./autosetup --help ref reference: ./autosetup --reference html: ./autosetup --reference=asciidoc | asciidoc -o autosetup-reference.html - |
> | 1 | This is autosetup v0.6.6. See http://msteveb.github.com/autosetup/ |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
From the autosetup v0.6.2 User Manual...
========================================
autosetup is a tool, similar to autoconf, to configure a build system for
the appropriate environment, according to the system capabilities and the user
configuration.
autosetup is designed to be light-weight, fast, simple and flexible.
Notable features include:
* Easily check for headers, functions, types for C/C++
* Easily support user configuration options
* Can generate files based on templates, such as Makefile.in => Makefile
* Can generate header files based on checked features
* Excellent support for cross compilation
* Replacement for autoconf in many situations
* Runs with either Tcl 8.5+, Jim Tcl or just a C compiler (using the
included Jim Tcl source code!)
* autosetup is intended to be distributed with projects - no version
issues
autosetup is particularly targeted towards building C/C++ applications on Unix
systems, however it can be extended for other environments as needed.
autosetup is *not*:
* A build system
* A replacement for automake
* Intended to replace all possible uses of autoconf
Try: ./autosetup --help or ./autosetup --reference
Or view the manual on github at:
<http://msteveb.github.com/autosetup/>
Quick Start
-----------
To install autosetup into your project, 'cd' to the top level
of your project and run:
<path-to-autosetup>/autosetup --install
Once autosetup is installed, create auto.def, run:
./configure
To migrate an autoconf-enabled project to autosetup:
<path-to-autosetup>/migrate-autoconf
|
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Wed 15 Dec 2010 07:31:39 EST ---------------------------- Expand the examples Have 'autosetup --init' generate a typical Makefile.in if one doesn't exist. autosetup should have a "meta-parse" phase to check that auto.def includes modules before options, and has an options section. Consider if we can get away without config.sub and config.guess. Projects which need them could provide their own. Many projects do not. Unit tests. |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/find-tclsh`" "$0" "$@"
set autosetup(version) 0.6.6
# Can be set to 1 to debug early-init problems
set autosetup(debug) 0
##################################################################
#
# Main flow of control, option handling
#
proc main {argv} {
global autosetup define
# There are 3 potential directories involved:
# 1. The directory containing autosetup (this script)
# 2. The directory containing auto.def
# 3. The current directory
# From this we need to determine:
# a. The path to this script (and related support files)
# b. The path to auto.def
# c. The build directory, where output files are created
# This is also complicated by the fact that autosetup may
# have been run via the configure wrapper ([getenv WRAPPER] is set)
# Here are the rules.
# a. This script is $::argv0
# => dir, prog, exe, libdir
# b. auto.def is in the directory containing the configure wrapper,
# otherwise it is in the current directory.
# => srcdir, autodef
# c. The build directory is the current directory
# => builddir, [pwd]
# 'misc' is needed before we can do anything, so set a temporary libdir
# in case this is the development version
set autosetup(libdir) [file dirname $::argv0]/lib
use misc
# (a)
set autosetup(dir) [realdir [file dirname [realpath $::argv0]]]
set autosetup(prog) [file join $autosetup(dir) [file tail $::argv0]]
set autosetup(exe) [getenv WRAPPER $autosetup(prog)]
if {$autosetup(installed)} {
set autosetup(libdir) $autosetup(dir)
} else {
set autosetup(libdir) [file join $autosetup(dir) lib]
}
autosetup_add_dep $autosetup(prog)
# (b)
if {[getenv WRAPPER ""] eq ""} {
# Invoked directly
set autosetup(srcdir) [pwd]
} else {
# Invoked via the configure wrapper
set autosetup(srcdir) [file dirname $autosetup(exe)]
}
set autosetup(autodef) [relative-path $autosetup(srcdir)/auto.def]
# (c)
set autosetup(builddir) [pwd]
set autosetup(argv) $argv
set autosetup(cmdline) {}
set autosetup(options) {}
set autosetup(optionhelp) {}
set autosetup(showhelp) 0
# Parse options
use getopt
array set ::useropts [getopt argv]
#"=Core Options:"
options-add {
help:=local => "display help and options. Optionally specify a module name, such as --help=system"
version => "display the version of autosetup"
ref:=text manual:=text
reference:=text => "display the autosetup command reference. 'text', 'wiki', 'asciidoc' or 'markdown'"
debug => "display debugging output as autosetup runs"
install:=. => "install autosetup to the current or given directory (in the 'autosetup/' subdirectory)"
force init:=help => "create initial auto.def, etc. Use --init=help for known types"
# Undocumented options
option-checking=1
nopager
quiet
timing
conf:
}
#parray ::useropts
if {[opt-bool version]} {
puts $autosetup(version)
exit 0
}
# autosetup --conf=alternate-auto.def
if {[opt-val conf] ne ""} {
set autosetup(autodef) [opt-val conf]
}
# Debugging output (set this early)
incr autosetup(debug) [opt-bool debug]
incr autosetup(force) [opt-bool force]
incr autosetup(msg-quiet) [opt-bool quiet]
incr autosetup(msg-timing) [opt-bool timing]
# If the local module exists, source it now to allow for
# project-local customisations
if {[file exists $autosetup(libdir)/local.tcl]} {
use local
}
# Now any auto-load modules
foreach file [glob -nocomplain $autosetup(libdir)/*.auto $autosetup(libdir)/*/*.auto] {
automf_load source $file
}
if {[opt-val help] ne ""} {
incr autosetup(showhelp)
use help
autosetup_help [opt-val help]
}
if {[opt-val {manual ref reference}] ne ""} {
use help
autosetup_reference [opt-val {manual ref reference}]
}
if {[opt-val init] ne ""} {
use init
autosetup_init [opt-val init]
}
if {[opt-val install] ne ""} {
use install
autosetup_install [opt-val install]
}
if {![file exists $autosetup(autodef)]} {
# Check for invalid option first
options {}
user-error "No auto.def found in \"$autosetup(srcdir)\" (use [file tail $::autosetup(exe)] --init to create one)"
}
# Parse extra arguments into autosetup(cmdline)
foreach arg $argv {
if {[regexp {([^=]*)=(.*)} $arg -> n v]} {
dict set autosetup(cmdline) $n $v
define $n $v
} else {
user-error "Unexpected parameter: $arg"
}
}
autosetup_add_dep $autosetup(autodef)
set cmd [file-normalize $autosetup(exe)]
foreach arg $autosetup(argv) {
append cmd " [quote-if-needed $arg]"
}
define AUTOREMAKE $cmd
# Log how we were invoked
configlog "Invoked as: [getenv WRAPPER $::argv0] [quote-argv $autosetup(argv)]"
# Note that auto.def is *not* loaded in the global scope
source $autosetup(autodef)
# Could warn here if options {} was not specified
show-notices
if {$autosetup(debug)} {
msg-result "Writing all defines to config.log"
configlog "================ defines ======================"
foreach n [lsort [array names define]] {
configlog "define $n $define($n)"
}
}
exit 0
}
# Initial settings
set autosetup(exe) $::argv0
set autosetup(istcl) 1
set autosetup(start) [clock millis]
set autosetup(installed) 0
set autosetup(msg-checking) 0
set autosetup(msg-quiet) 0
# Embedded modules are inserted below here
##-- CUT HERE --##
set corefile [file join [file dirname $::argv0] lib core.tcl]
if {[file exist $corefile]} {
source $corefile
}
##################################################################
#
# Entry/Exit
#
if {$autosetup(debug)} {
main $argv
}
if {[catch {main $argv} msg opts] == 1} {
show-notices
autosetup-full-error [error-dump $msg $opts $::autosetup(debug)]
if {!$autosetup(debug)} {
puts stderr "Try: '[file tail $autosetup(exe)] --debug' for a full stack trace"
}
exit 1
}
|
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# The 'cc-db' module provides a knowledge based of system idiosyncracies
# In general, this module can always be included
use cc
module-options {}
# openbsd needs sys/types.h to detect some system headers
cc-include-needs sys/socket.h sys/types.h
cc-include-needs netinet/in.h sys/types.h
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# Provides a library of common tests on top of the 'cc' module.
use cc
module-options {}
# @cc-check-lfs
#
# The equivalent of the AC_SYS_LARGEFILE macro
#
# defines 'HAVE_LFS' if LFS is available,
# and defines '_FILE_OFFSET_BITS=64' if necessary
#
# Returns 1 if 'LFS' is available or 0 otherwise
#
proc cc-check-lfs {} {
cc-check-includes sys/types.h
msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..."
set lfs 1
if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} {
msg-result no
} elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} {
define _FILE_OFFSET_BITS 64
msg-result yes
} else {
set lfs 0
msg-result none
}
define-feature lfs $lfs
return $lfs
}
# @cc-check-endian
#
# The equivalent of the AC_C_BIGENDIAN macro
#
# defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
# or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
#
# Returns 1 if determined, or 0 if not.
#
proc cc-check-endian {} {
cc-check-includes sys/types.h sys/param.h
set rc 0
msg-checking "Checking endian..."
cc-with {-includes {sys/types.h sys/param.h}} {
if {[cctest -code {
#if !defined(BIG_ENDIAN) || !defined(BYTE_ORDER)
#error unknown
#elif BYTE_ORDER != BIG_ENDIAN
#error little
#endif
}]} {
define-feature big-endian
msg-result "big"
set rc 1
} elseif {[cctest -code {
#if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
#error unknown
#elif BYTE_ORDER != LITTLE_ENDIAN
#error big
#endif
}]} {
define-feature little-endian
msg-result "little"
set rc 1
} else {
msg-result "unknown"
}
}
return $rc
}
# @cc-check-flags flag ?...?
#
# Checks whether the given C/C++ compiler flags can be used. Defines feature
# names prefixed with 'HAVE_CFLAG' and 'HAVE_CXXFLAG' respectively, and
# appends working flags to '-cflags' and 'CFLAGS' or 'CXXFLAGS'.
proc cc-check-flags {args} {
set result 1
array set opts [cc-get-settings]
switch -exact -- $opts(-lang) {
c++ {
set lang C++
set prefix CXXFLAG
}
c {
set lang C
set prefix CFLAG
}
default {
autosetup-error "cc-check-flags failed with unknown language: $opts(-lang)"
}
}
foreach flag $args {
msg-checking "Checking whether the $lang compiler accepts $flag..."
if {[cctest -cflags $flag]} {
msg-result yes
define-feature $prefix$flag
cc-with [list -cflags [list $flag]]
define-append ${prefix}S $flag
} else {
msg-result no
set result 0
}
}
return $result
}
# @cc-check-standards ver ?...?
#
# Checks whether the C/C++ compiler accepts one of the specified '-std=$ver'
# options, and appends the first working one to '-cflags' and 'CFLAGS' or
# 'CXXFLAGS'.
proc cc-check-standards {args} {
array set opts [cc-get-settings]
foreach std $args {
if {[cc-check-flags -std=$std]} {
return $std
}
}
return ""
}
# Checks whether $keyword is usable as alignof
proc cctest_alignof {keyword} {
msg-checking "Checking for $keyword..."
if {[cctest -code [subst -nobackslashes {
printf("minimum alignment is %d == %d\n", ${keyword}(char), ${keyword}('x'));
}]]} then {
msg-result ok
define-feature $keyword
} else {
msg-result "not found"
}
}
# @cc-check-c11
#
# Checks for several C11/C++11 extensions and their alternatives. Currently
# checks for '_Static_assert', '_Alignof', '__alignof__', '__alignof'.
proc cc-check-c11 {} {
msg-checking "Checking for _Static_assert..."
if {[cctest -code {
_Static_assert(1, "static assertions are available");
}]} then {
msg-result ok
define-feature _Static_assert
} else {
msg-result "not found"
}
cctest_alignof _Alignof
cctest_alignof __alignof__
cctest_alignof __alignof
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# The 'cc-shared' module provides support for shared libraries and shared objects.
# It defines the following variables:
#
## SH_CFLAGS Flags to use compiling sources destined for a shared library
## SH_LDFLAGS Flags to use linking (creating) a shared library
## SH_SOPREFIX Prefix to use to set the soname when creating a shared library
## SH_SOEXT Extension for shared libs
## SH_SOEXTVER Format for versioned shared libs - %s = version
## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object
## SHOBJ_LDFLAGS Flags to use linking a shared object, undefined symbols allowed
## SHOBJ_LDFLAGS_R - as above, but all symbols must be resolved
## SH_LINKFLAGS Flags to use linking an executable which will load shared objects
## LD_LIBRARY_PATH Environment variable which specifies path to shared libraries
## STRIPLIBFLAGS Arguments to strip to strip a dynamic library
module-options {}
# Defaults: gcc on unix
define SHOBJ_CFLAGS -fpic
define SHOBJ_LDFLAGS -shared
define SH_CFLAGS -fpic
define SH_LDFLAGS -shared
define SH_LINKFLAGS -rdynamic
define SH_SOEXT .so
define SH_SOEXTVER .so.%s
define SH_SOPREFIX -Wl,-soname,
define LD_LIBRARY_PATH LD_LIBRARY_PATH
define STRIPLIBFLAGS --strip-unneeded
# Note: This is a helpful reference for identifying the toolchain
# http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
switch -glob -- [get-define host] {
*-*-darwin* {
define SHOBJ_CFLAGS "-dynamic -fno-common"
define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup"
define SHOBJ_LDFLAGS_R -bundle
define SH_CFLAGS -dynamic
define SH_LDFLAGS -dynamiclib
define SH_LINKFLAGS ""
define SH_SOEXT .dylib
define SH_SOEXTVER .%s.dylib
define SH_SOPREFIX -Wl,-install_name,
define LD_LIBRARY_PATH DYLD_LIBRARY_PATH
define STRIPLIBFLAGS -x
}
*-*-ming* - *-*-cygwin - *-*-msys {
define SHOBJ_CFLAGS ""
define SHOBJ_LDFLAGS "-shared -static-libgcc -static-libstd++"
define SH_CFLAGS ""
define SH_LDFLAGS "-shared -static-libgcc -static-libstd++"
define SH_LINKFLAGS ""
define SH_SOEXT .dll
define SH_SOEXTVER .dll
define SH_SOPREFIX ""
define LD_LIBRARY_PATH PATH
}
sparc* {
if {[msg-quiet cc-check-decls __SUNPRO_C]} {
msg-result "Found sun stdio compiler"
# sun stdio compiler
# XXX: These haven't been fully tested.
define SHOBJ_CFLAGS -KPIC
define SHOBJ_LDFLAGS "-G"
define SH_CFLAGS -KPIC
define SH_LINKFLAGS -Wl,-export-dynamic
define SH_SOPREFIX -Wl,-h,
} else {
# sparc has a very small GOT table limit, so use -fPIC
define SH_CFLAGS -fPIC
define SHOBJ_CFLAGS -fPIC
}
}
*-*-solaris* {
if {[msg-quiet cc-check-decls __SUNPRO_C]} {
msg-result "Found sun stdio compiler"
# sun stdio compiler
# XXX: These haven't been fully tested.
define SHOBJ_CFLAGS -KPIC
define SHOBJ_LDFLAGS "-G"
define SH_CFLAGS -KPIC
define SH_LINKFLAGS -Wl,-export-dynamic
define SH_SOPREFIX -Wl,-h,
}
}
*-*-hpux {
# XXX: These haven't been tested
define SHOBJ_CFLAGS "+O3 +z"
define SHOBJ_LDFLAGS -b
define SH_CFLAGS +z
define SH_LINKFLAGS -Wl,+s
define LD_LIBRARY_PATH SHLIB_PATH
}
*-*-haiku {
define SHOBJ_CFLAGS ""
define SHOBJ_LDFLAGS -shared
define SH_CFLAGS ""
define SH_LDFLAGS -shared
define SH_LINKFLAGS ""
define SH_SOPREFIX ""
define LD_LIBRARY_PATH LIBRARY_PATH
}
}
if {![is-defined SHOBJ_LDFLAGS_R]} {
define SHOBJ_LDFLAGS_R [get-define SHOBJ_LDFLAGS]
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# The 'cc' module supports checking various 'features' of the C or C++
# compiler/linker environment. Common commands are cc-check-includes,
# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-template.
#
# The following environment variables are used if set:
#
## CC - C compiler
## CXX - C++ compiler
## CCACHE - Set to "none" to disable automatic use of ccache
## CFLAGS - Additional C compiler flags
## CXXFLAGS - Additional C++ compiler flags
## LDFLAGS - Additional compiler flags during linking
## LIBS - Additional libraries to use (for all tests)
## CROSS - Tool prefix for cross compilation
#
# The following variables are defined from the corresponding
# environment variables if set.
#
## CPPFLAGS
## LINKFLAGS
## CC_FOR_BUILD
## LD
use system
module-options {}
# Note that the return code is not meaningful
proc cc-check-something {name code} {
uplevel 1 $code
}
# Checks for the existence of the given function by linking
#
proc cctest_function {function} {
cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
}
# Checks for the existence of the given type by compiling
proc cctest_type {type} {
cctest -code "$type _x;"
}
# Checks for the existence of the given type/structure member.
# e.g. "struct stat.st_mtime"
proc cctest_member {struct_member} {
lassign [split $struct_member .] struct member
cctest -code "static $struct _s; return sizeof(_s.$member);"
}
# Checks for the existence of the given define by compiling
#
proc cctest_define {name} {
cctest -code "#ifndef $name\n#error not defined\n#endif"
}
# Checks for the existence of the given name either as
# a macro (#define) or an rvalue (such as an enum)
#
proc cctest_decl {name} {
cctest -code "#ifndef $name\n(void)$name;\n#endif"
}
# @cc-check-sizeof type ...
#
# Checks the size of the given types (between 1 and 32, inclusive).
# Defines a variable with the size determined, or "unknown" otherwise.
# e.g. for type 'long long', defines SIZEOF_LONG_LONG.
# Returns the size of the last type.
#
proc cc-check-sizeof {args} {
foreach type $args {
msg-checking "Checking for sizeof $type..."
set size unknown
# Try the most common sizes first
foreach i {4 8 1 2 16 32} {
if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
set size $i
break
}
}
msg-result $size
set define [feature-define-name $type SIZEOF_]
define $define $size
}
# Return the last result
get-define $define
}
# Checks for each feature in $list by using the given script.
#
# When the script is evaluated, $each is set to the feature
# being checked, and $extra is set to any additional cctest args.
#
# Returns 1 if all features were found, or 0 otherwise.
proc cc-check-some-feature {list script} {
set ret 1
foreach each $list {
if {![check-feature $each $script]} {
set ret 0
}
}
return $ret
}
# @cc-check-includes includes ...
#
# Checks that the given include files can be used
proc cc-check-includes {args} {
cc-check-some-feature $args {
set with {}
if {[dict exists $::autosetup(cc-include-deps) $each]} {
set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]]
msg-quiet cc-check-includes {*}$deps
foreach i $deps {
if {[have-feature $i]} {
lappend with $i
}
}
}
if {[llength $with]} {
cc-with [list -includes $with] {
cctest -includes $each
}
} else {
cctest -includes $each
}
}
}
# @cc-include-needs include required ...
#
# Ensures that when checking for 'include', a check is first
# made for each 'required' file, and if found, it is #included
proc cc-include-needs {file args} {
foreach depfile $args {
dict set ::autosetup(cc-include-deps) $file $depfile 1
}
}
# @cc-check-types type ...
#
# Checks that the types exist.
proc cc-check-types {args} {
cc-check-some-feature $args {
cctest_type $each
}
}
# @cc-check-defines define ...
#
# Checks that the given preprocessor symbol is defined
proc cc-check-defines {args} {
cc-check-some-feature $args {
cctest_define $each
}
}
# @cc-check-decls name ...
#
# Checks that each given name is either a preprocessor symbol or rvalue
# such as an enum. Note that the define used for a decl is HAVE_DECL_xxx
# rather than HAVE_xxx
proc cc-check-decls {args} {
set ret 1
foreach name $args {
msg-checking "Checking for $name..."
set r [cctest_decl $name]
define-feature "decl $name" $r
if {$r} {
msg-result "ok"
} else {
msg-result "not found"
set ret 0
}
}
return $ret
}
# @cc-check-functions function ...
#
# Checks that the given functions exist (can be linked)
proc cc-check-functions {args} {
cc-check-some-feature $args {
cctest_function $each
}
}
# @cc-check-members type.member ...
#
# Checks that the given type/structure members exist.
# A structure member is of the form "struct stat.st_mtime"
proc cc-check-members {args} {
cc-check-some-feature $args {
cctest_member $each
}
}
# @cc-check-function-in-lib function libs ?otherlibs?
#
# Checks that the given given function can be found in one of the libs.
#
# First checks for no library required, then checks each of the libraries
# in turn.
#
# If the function is found, the feature is defined and lib_$function is defined
# to -l$lib where the function was found, or "" if no library required.
# In addition, -l$lib is added to the LIBS define.
#
# If additional libraries may be needed for linking, they should be specified
# as $extralibs as "-lotherlib1 -lotherlib2".
# These libraries are not automatically added to LIBS.
#
# Returns 1 if found or 0 if not.
#
proc cc-check-function-in-lib {function libs {otherlibs {}}} {
msg-checking "Checking libs for $function..."
set found 0
cc-with [list -libs $otherlibs] {
if {[cctest_function $function]} {
msg-result "none needed"
define lib_$function ""
incr found
} else {
foreach lib $libs {
cc-with [list -libs -l$lib] {
if {[cctest_function $function]} {
msg-result -l$lib
define lib_$function -l$lib
define-append LIBS -l$lib
incr found
break
}
}
}
}
}
if {$found} {
define [feature-define-name $function]
} else {
msg-result "no"
}
return $found
}
# @cc-check-tools tool ...
#
# Checks for existence of the given compiler tools, taking
# into account any cross compilation prefix.
#
# For example, when checking for "ar", first AR is checked on the command
# line and then in the environment. If not found, "${host}-ar" or
# simply "ar" is assumed depending upon whether cross compiling.
# The path is searched for this executable, and if found AR is defined
# to the executable name.
# Note that even when cross compiling, the simple "ar" is used as a fallback,
# but a warning is generated. This is necessary for some toolchains.
#
# It is an error if the executable is not found.
#
proc cc-check-tools {args} {
foreach tool $args {
set TOOL [string toupper $tool]
set exe [get-env $TOOL [get-define cross]$tool]
if {[find-executable {*}$exe]} {
define $TOOL $exe
continue
}
if {[find-executable {*}$tool]} {
msg-result "Warning: Failed to find $exe, falling back to $tool which may be incorrect"
define $TOOL $tool
continue
}
user-error "Failed to find $exe"
}
}
# @cc-check-progs prog ...
#
# Checks for existence of the given executables on the path.
#
# For example, when checking for "grep", the path is searched for
# the executable, 'grep', and if found GREP is defined as "grep".
#
# It the executable is not found, the variable is defined as false.
# Returns 1 if all programs were found, or 0 otherwise.
#
proc cc-check-progs {args} {
set failed 0
foreach prog $args {
set PROG [string toupper $prog]
msg-checking "Checking for $prog..."
if {![find-executable $prog]} {
msg-result no
define $PROG false
incr failed
} else {
msg-result ok
define $PROG $prog
}
}
expr {!$failed}
}
# Adds the given settings to $::autosetup(ccsettings) and
# returns the old settings.
#
proc cc-add-settings {settings} {
if {[llength $settings] % 2} {
autosetup-error "settings list is missing a value: $settings"
}
set prev [cc-get-settings]
# workaround a bug in some versions of jimsh by forcing
# conversion of $prev to a list
llength $prev
array set new $prev
foreach {name value} $settings {
switch -exact -- $name {
-cflags - -includes {
# These are given as lists
lappend new($name) {*}$value
}
-declare {
lappend new($name) $value
}
-libs {
# Note that new libraries are added before previous libraries
set new($name) [list {*}$value {*}$new($name)]
}
-link - -lang - -nooutput {
set new($name) $value
}
-source - -sourcefile - -code {
# XXX: These probably are only valid directly from cctest
set new($name) $value
}
default {
autosetup-error "unknown cctest setting: $name"
}
}
}
cc-store-settings [array get new]
return $prev
}
proc cc-store-settings {new} {
set ::autosetup(ccsettings) $new
}
proc cc-get-settings {} {
return $::autosetup(ccsettings)
}
# Similar to cc-add-settings, but each given setting
# simply replaces the existing value.
#
# Returns the previous settings
proc cc-update-settings {args} {
set prev [cc-get-settings]
cc-store-settings [dict merge $prev $args]
return $prev
}
# @cc-with settings ?{ script }?
#
# Sets the given 'cctest' settings and then runs the tests in 'script'.
# Note that settings such as -lang replace the current setting, while
# those such as -includes are appended to the existing setting.
#
# If no script is given, the settings become the default for the remainder
# of the auto.def file.
#
## cc-with {-lang c++} {
## # This will check with the C++ compiler
## cc-check-types bool
## cc-with {-includes signal.h} {
## # This will check with the C++ compiler, signal.h and any existing includes.
## ...
## }
## # back to just the C++ compiler
## }
#
# The -libs setting is special in that newer values are added *before* earlier ones.
#
## cc-with {-libs {-lc -lm}} {
## cc-with {-libs -ldl} {
## cctest -libs -lsocket ...
## # libs will be in this order: -lsocket -ldl -lc -lm
## }
## }
proc cc-with {settings args} {
if {[llength $args] == 0} {
cc-add-settings $settings
} elseif {[llength $args] > 1} {
autosetup-error "usage: cc-with settings ?script?"
} else {
set save [cc-add-settings $settings]
set rc [catch {uplevel 1 [lindex $args 0]} result info]
cc-store-settings $save
if {$rc != 0} {
return -code [dict get $info -code] $result
}
return $result
}
}
# @cctest ?settings?
#
# Low level C compiler checker. Compiles and or links a small C program
# according to the arguments and returns 1 if OK, or 0 if not.
#
# Supported settings are:
#
## -cflags cflags A list of flags to pass to the compiler
## -includes list A list of includes, e.g. {stdlib.h stdio.h}
## -declare code Code to declare before main()
## -link 1 Don't just compile, link too
## -lang c|c++ Use the C (default) or C++ compiler
## -libs liblist List of libraries to link, e.g. {-ldl -lm}
## -code code Code to compile in the body of main()
## -source code Compile a complete program. Ignore -includes, -declare and -code
## -sourcefile file Shorthand for -source [readfile [get-define srcdir]/$file]
## -nooutput 1 Treat any compiler output (e.g. a warning) as an error
#
# Unless -source or -sourcefile is specified, the C program looks like:
#
## #include <firstinclude> /* same for remaining includes in the list */
##
## declare-code /* any code in -declare, verbatim */
##
## int main(void) {
## code /* any code in -code, verbatim */
## return 0;
## }
#
# Any failures are recorded in 'config.log'
#
proc cctest {args} {
set src conftest__.c
set tmp conftest__
# Easiest way to merge in the settings
cc-with $args {
array set opts [cc-get-settings]
}
if {[info exists opts(-sourcefile)]} {
set opts(-source) [readfile [get-define srcdir]/$opts(-sourcefile) "#error can't find $opts(-sourcefile)"]
}
if {[info exists opts(-source)]} {
set lines $opts(-source)
} else {
foreach i $opts(-includes) {
if {$opts(-code) ne "" && ![feature-checked $i]} {
# Compiling real code with an unchecked header file
# Quickly (and silently) check for it now
# Remove all -includes from settings before checking
set saveopts [cc-update-settings -includes {}]
msg-quiet cc-check-includes $i
cc-store-settings $saveopts
}
if {$opts(-code) eq "" || [have-feature $i]} {
lappend source "#include <$i>"
}
}
lappend source {*}$opts(-declare)
lappend source "int main(void) {"
lappend source $opts(-code)
lappend source "return 0;"
lappend source "}"
set lines [join $source \n]
}
# Build the command line
set cmdline {}
lappend cmdline {*}[get-define CCACHE]
switch -exact -- $opts(-lang) {
c++ {
lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS]
}
c {
lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
}
default {
autosetup-error "cctest called with unknown language: $opts(-lang)"
}
}
if {!$opts(-link)} {
set tmp conftest__.o
lappend cmdline -c
}
lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""]
lappend cmdline $src -o $tmp {*}$opts(-libs)
# At this point we have the complete command line and the
# complete source to be compiled. Get the result from cache if
# we can
if {[info exists ::cc_cache($cmdline,$lines)]} {
msg-checking "(cached) "
set ok $::cc_cache($cmdline,$lines)
if {$::autosetup(debug)} {
configlog "From cache (ok=$ok): [join $cmdline]"
configlog "============"
configlog $lines
configlog "============"
}
return $ok
}
writefile $src $lines\n
set ok 1
set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
if {$err || ($opts(-nooutput) && [string length $result])} {
configlog "Failed: [join $cmdline]"
configlog $result
configlog "============"
configlog "The failed code was:"
configlog $lines
configlog "============"
set ok 0
} elseif {$::autosetup(debug)} {
configlog "Compiled OK: [join $cmdline]"
configlog "============"
configlog $lines
configlog "============"
}
file delete $src
file delete $tmp
# cache it
set ::cc_cache($cmdline,$lines) $ok
return $ok
}
# @make-autoconf-h outfile ?auto-patterns=HAVE_*? ?bare-patterns=SIZEOF_*?
#
# Deprecated - see make-config-header
proc make-autoconf-h {file {autopatterns {HAVE_*}} {barepatterns {SIZEOF_* HAVE_DECL_*}}} {
user-notice "*** make-autoconf-h is deprecated -- use make-config-header instead"
make-config-header $file -auto $autopatterns -bare $barepatterns
}
# @make-config-header outfile ?-auto patternlist? ?-bare patternlist? ?-none patternlist? ?-str patternlist? ...
#
# Examines all defined variables which match the given patterns
# and writes an include file, $file, which defines each of these.
# Variables which match '-auto' are output as follows:
# - defines which have the value "0" are ignored.
# - defines which have integer values are defined as the integer value.
# - any other value is defined as a string, e.g. "value"
# Variables which match '-bare' are defined as-is.
# Variables which match '-str' are defined as a string, e.g. "value"
# Variables which match '-none' are omitted.
#
# Note that order is important. The first pattern which matches is selected
# Default behaviour is:
#
# -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_* -none *
#
# If the file would be unchanged, it is not written.
proc make-config-header {file args} {
set guard _[string toupper [regsub -all {[^a-zA-Z0-9]} [file tail $file] _]]
file mkdir [file dirname $file]
set lines {}
lappend lines "#ifndef $guard"
lappend lines "#define $guard"
# Add some defaults
lappend args -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_*
foreach n [lsort [dict keys [all-defines]]] {
set value [get-define $n]
set type [calc-define-output-type $n $args]
switch -exact -- $type {
-bare {
# Just output the value unchanged
}
-none {
continue
}
-str {
set value \"[string map [list \\ \\\\ \" \\\"] $value]\"
}
-auto {
# Automatically determine the type
if {$value eq "0"} {
lappend lines "/* #undef $n */"
continue
}
if {![string is integer -strict $value]} {
set value \"[string map [list \\ \\\\ \" \\\"] $value]\"
}
}
"" {
continue
}
default {
autosetup-error "Unknown type in make-config-header: $type"
}
}
lappend lines "#define $n $value"
}
lappend lines "#endif"
set buf [join $lines \n]
write-if-changed $file $buf {
msg-result "Created $file"
}
}
proc calc-define-output-type {name spec} {
foreach {type patterns} $spec {
foreach pattern $patterns {
if {[string match $pattern $name]} {
return $type
}
}
}
return ""
}
# Initialise some values from the environment or commandline or default settings
foreach i {LDFLAGS LIBS CPPFLAGS LINKFLAGS {CFLAGS "-g -O2"}} {
lassign $i var default
define $var [get-env $var $default]
}
if {[env-is-set CC]} {
# Set by the user, so don't try anything else
set try [list [get-env CC ""]]
} else {
# Try some reasonable options
set try [list [get-define cross]cc [get-define cross]gcc]
}
define CC [find-an-executable {*}$try]
if {[get-define CC] eq ""} {
user-error "Could not find a C compiler. Tried: [join $try ", "]"
}
define CPP [get-env CPP "[get-define CC] -E"]
# XXX: Could avoid looking for a C++ compiler until requested
# Note that if CXX isn't found, we just set it to "false". It might not be needed.
if {[env-is-set CXX]} {
define CXX [find-an-executable -required [get-env CXX ""]]
} else {
define CXX [find-an-executable [get-define cross]c++ [get-define cross]g++ false]
}
# CXXFLAGS default to CFLAGS if not specified
define CXXFLAGS [get-env CXXFLAGS [get-define CFLAGS]]
# May need a CC_FOR_BUILD, so look for one
define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] cc gcc false]
if {[get-define CC] eq ""} {
user-error "Could not find a C compiler. Tried: [join $try ", "]"
}
define CCACHE [find-an-executable [get-env CCACHE ccache]]
# Initial cctest settings
cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0}
set autosetup(cc-include-deps) {}
msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]"
if {[get-define CXX] ne "false"} {
msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS]"
}
msg-result "Build C compiler...[get-define CC_FOR_BUILD]"
# On Darwin, we prefer to use -g0 to avoid creating .dSYM directories
# but some compilers may not support it, so test here.
switch -glob -- [get-define host] {
*-*-darwin* {
if {[cctest -cflags {-g0}]} {
define cc-default-debug -g0
}
}
}
if {![cc-check-includes stdlib.h]} {
user-error "Compiler does not work. See config.log"
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 |
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
timestamp='2010-09-24'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help" >&2
exit 1 ;;
* )
break ;;
esac
done
if test $# != 0; then
echo "$me: too many arguments$help" >&2
exit 1
fi
trap 'exit 1' HUP INT TERM
# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
# compiler to aid in system detection is discouraged as it requires
# temporary files to be created and, as you can see below, it is a
# headache to deal with in a portable fashion.
# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
# use `HOST_CC' if defined, but it is deprecated.
# Portable tmp directory creation inspired by the Autoconf team.
set_cc_for_build='
trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
: ${TMPDIR=/tmp} ;
{ tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
dummy=$tmp/dummy ;
tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
case $CC_FOR_BUILD,$HOST_CC,$CC in
,,) echo "int x;" > $dummy.c ;
for c in cc gcc c89 c99 ; do
if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
CC_FOR_BUILD="$c"; break ;
fi ;
done ;
if test x"$CC_FOR_BUILD" = x ; then
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac ; set_cc_for_build= ;'
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 1994-08-24)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
#
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
# to ELF recently, or will in the future.
case "${UNAME_MACHINE_ARCH}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
;;
*)
os=netbsd
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
# kernel version information, so it can be replaced with a
# suitable tag, in the style of linux-gnu.
case "${UNAME_VERSION}" in
Debian*)
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
*:SolidBSD:*:*)
echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
exit ;;
macppc:MirBSD:*:*)
echo powerpc-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
# OSF/1 and Tru64 systems produced since 1995. I hope that
# covers most systems running today. This code pipes the CPU
# types through head -n 1, so we only detect the type of CPU 0.
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
UNAME_MACHINE="alpha" ;;
"EV4.5 (21064)")
UNAME_MACHINE="alpha" ;;
"LCA4 (21066/21068)")
UNAME_MACHINE="alpha" ;;
"EV5 (21164)")
UNAME_MACHINE="alphaev5" ;;
"EV5.6 (21164A)")
UNAME_MACHINE="alphaev56" ;;
"EV5.6 (21164PC)")
UNAME_MACHINE="alphapca56" ;;
"EV5.7 (21164PC)")
UNAME_MACHINE="alphapca57" ;;
"EV6 (21264)")
UNAME_MACHINE="alphaev6" ;;
"EV6.7 (21264A)")
UNAME_MACHINE="alphaev67" ;;
"EV6.8CB (21264C)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8AL (21264B)")
UNAME_MACHINE="alphaev68" ;;
"EV6.8CX (21264D)")
UNAME_MACHINE="alphaev68" ;;
"EV6.9A (21264/EV69A)")
UNAME_MACHINE="alphaev69" ;;
"EV7 (21364)")
UNAME_MACHINE="alphaev7" ;;
"EV7.9 (21364A)")
UNAME_MACHINE="alphaev79" ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-unknown-sysv4
exit ;;
*:[Aa]miga[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-amigaos
exit ;;
*:[Mm]orph[Oo][Ss]:*:*)
echo ${UNAME_MACHINE}-unknown-morphos
exit ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit ;;
*:z/VM:*:*)
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
arm:riscos:*:*|arm:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit ;;
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit ;;
NILE*:*:*:dcosx)
echo pyramid-pyramid-svr4
exit ;;
DRS?6000:unix:4.0:6*)
echo sparc-icl-nx6
exit ;;
DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
s390x:SunOS:*:*)
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
SUN_ARCH="x86_64"
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
;;
sun4)
echo sparc-sun-sunos${UNAME_RELEASE}
;;
esac
exit ;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit ;;
RISC*:ULTRIX:*:*)
echo mips-dec-ultrix${UNAME_RELEASE}
exit ;;
VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE}
exit ;;
2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE}
exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
#endif
#endif
exit (-1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c &&
dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` &&
{ echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos${UNAME_RELEASE}
exit ;;
Motorola:PowerMAX_OS:*:*)
echo powerpc-motorola-powermax
exit ;;
Motorola:*:4.3:PL8-*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
echo powerpc-harris-powermax
exit ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i*86:AIX:*:*)
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
exit ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
then
echo "$SYSTEM_NAME"
else
echo rs6000-ibm-aix3.2.5
fi
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit ;;
*:AIX:*:[4567])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
exit ;;
9000/[34]??:4.3bsd:1.*:*)
echo m68k-hp-bsd
exit ;;
hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
echo m68k-hp-bsd4.4
exit ;;
9000/[34678]??:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
if [ ${HP_ARCH} = "hppa2.0w" ]
then
eval $set_cc_for_build
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
# generating 64-bit code. GNU and HP use different nomenclature:
#
# $ CC_FOR_BUILD=cc ./config.guess
# => hppa2.0w-hp-hpux11.23
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
HP_ARCH="hppa64"
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit ;;
ia64:HP-UX:*:*)
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ia64-hp-hpux${HPUX_REV}
exit ;;
3050*:HI-UX:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
if (CPU_IS_PA_RISC (cpu))
{
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
default: puts ("hppa-hitachi-hiuxwe2"); break;
}
}
else if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
else puts ("unknown-hitachi-hiuxwe2");
exit (0);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
echo unknown-hitachi-hiuxwe2
exit ;;
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit ;;
*9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
if [ -x /usr/sbin/sysversion ] ; then
echo ${UNAME_MACHINE}-unknown-osf1mk
else
echo ${UNAME_MACHINE}-unknown-osf1
fi
exit ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*[A-Z]90:*:*:*)
echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-e 's/\.[^.]*$/.X/'
exit ;;
CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*T3E:*:*:*)
echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
*:UNICOS/mp:*:*)
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit ;;
sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
case ${UNAME_MACHINE} in
pc98)
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
# uname -m includes "-pc" on this system.
echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
echo ia64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i586-pc-interix
exit ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit ;;
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
echo x86_64-unknown-cygwin
exit ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin
exit ;;
prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-tilera-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
# sysname and nodename.
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
# If we were able to find `uname', then EMX Unix compatibility
# is probably installed.
echo ${UNAME_MACHINE}-pc-os2-emx
exit ;;
i*86:XTS-300:*:STOP)
echo ${UNAME_MACHINE}-unknown-stop
exit ;;
i*86:atheos:*:*)
echo ${UNAME_MACHINE}-unknown-atheos
exit ;;
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
echo ${UNAME_MACHINE}-pc-msdosdjgpp
exit ;;
i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit ;;
i*86:*:5:[678]*)
# UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
exit ;;
i*86:*:3.2:*)
if test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
elif /bin/uname -X 2>/dev/null >/dev/null ; then
UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
paragon:*:*:*)
echo i860-intel-osf1
exit ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
fi
exit ;;
mini*:CTIX:SYS*5:*)
# "miniframe"
echo m68010-convergent-sysv
exit ;;
mc68k:UNIX:SYSTEM5:3.51m)
echo m68k-convergent-sysv
exit ;;
M680?0:D-NIX:5.3:*)
echo m68k-diab-dnix
exit ;;
M68*:*:R3V[5678]*:*)
test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
OS_REL=''
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
OS_REL='.3'
test -r /etc/.relid \
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit ;;
TSUNAMI:LynxOS:2.*:*)
echo sparc-unknown-lynxos${UNAME_RELEASE}
exit ;;
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
echo mips-dde-sysv${UNAME_RELEASE}
exit ;;
RM*:ReliantUNIX-*:*:*)
echo mips-sni-sysv4
exit ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
echo hppa1.1-stratus-sysv4
exit ;;
*:*:*:FTX*)
# From seanf@swdc.stratus.com.
echo i860-stratus-sysv4
exit ;;
i*86:VOS:*:*)
# From Paul.Green@stratus.com.
echo ${UNAME_MACHINE}-stratus-vos
exit ;;
*:VOS:*:*)
# From Paul.Green@stratus.com.
echo hppa1.1-stratus-vos
exit ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit ;;
news*:NEWS-OS:6*:*)
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
echo powerpc-apple-beos
exit ;;
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
SX-5:SUPER-UX:*:*)
echo sx5-nec-superux${UNAME_RELEASE}
exit ;;
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
if test "$UNAME_PROCESSOR" = "x86"; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
exit ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
NEO-?:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit ;;
*:Plan9:*:*)
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
if test "$cputype" = "386"; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
fi
echo ${UNAME_MACHINE}-unknown-plan9
exit ;;
*:TOPS-10:*:*)
echo pdp10-unknown-tops10
exit ;;
*:TENEX:*:*)
echo pdp10-unknown-tenex
exit ;;
KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
echo pdp10-dec-tops20
exit ;;
XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
echo pdp10-xkl-tops20
exit ;;
*:TOPS-20:*:*)
echo pdp10-unknown-tops20
exit ;;
*:ITS:*:*)
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
V*) echo vax-dec-vms ; exit ;;
esac ;;
*:XENIX:*:SysV)
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF
$0: unable to guess system type
This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches@gnu.org> in order to provide the needed
information to handle your system.
config.guess timestamp = $timestamp
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
hostinfo = `(hostinfo) 2>/dev/null`
/bin/universe = `(/bin/universe) 2>/dev/null`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
/bin/arch = `(/bin/arch) 2>/dev/null`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
UNAME_MACHINE = ${UNAME_MACHINE}
UNAME_RELEASE = ${UNAME_RELEASE}
UNAME_SYSTEM = ${UNAME_SYSTEM}
UNAME_VERSION = ${UNAME_VERSION}
EOF
exit 1
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 |
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
timestamp='2010-09-11'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support. The user should be able to distinguish
# a failure to support a valid configuration from a meaningless
# configuration.
# The goal of this file is to map all the various variations of a given
# machine specification into a single specification in the form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
# or in some cases, the newer four-part form:
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
Usage: $0 [OPTION] CPU-MFR-OPSYS
$0 [OPTION] ALIAS
Canonicalize a configuration name.
Operation modes:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
help="
Try \`$me --help' for more information."
# Parse command line
while test $# -gt 0 ; do
case $1 in
--time-stamp | --time* | -t )
echo "$timestamp" ; exit ;;
--version | -v )
echo "$version" ; exit ;;
--help | --h* | -h )
echo "$usage"; exit ;;
-- ) # Stop option processing
shift; break ;;
- ) # Use stdin as input.
break ;;
-* )
echo "$me: invalid option $1$help"
exit 1 ;;
*local*)
# First pass through any local machine types.
echo $1
exit ;;
* )
break ;;
esac
done
case $# in
0) echo "$me: missing argument$help" >&2
exit 1;;
1) ;;
*) echo "$me: too many arguments$help" >&2
exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
then os=`echo $1 | sed 's/.*-/-/'`
else os=; fi
;;
esac
### Let's recognize common machines as not being operating systems so
### that things like config.sub decstation-3100 work. We also
### recognize some manufacturers as not being operating systems, so we
### can provide default operating systems below.
case $os in
-sun*os*)
# Prevent following clause from handling this invalid input.
;;
-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-chorusos*)
os=-chorusos
basic_machine=$1
;;
-chorusrdb)
os=-chorusrdb
basic_machine=$1
;;
-hiux*)
os=-hiuxwe2
;;
-sco6)
os=-sco5v6
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5)
os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco4)
os=-sco3.2v4
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2.[4-9]*)
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco3.2v[4-9]*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco5v6*)
# Don't forget version if it is 3.2v4 or newer.
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-sco*)
os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc)
os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-clix*)
basic_machine=clipper-intergraph
;;
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-lynx*)
os=-lynxos
;;
-ptx*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
;;
-windowsnt*)
os=`echo $os | sed -e 's/windowsnt/winnt/'`
;;
-psos*)
os=-psos
;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac
# Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
| mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| ns16k | ns32k \
| or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
c54x)
basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
;;
ms1)
basic_machine=mt-unknown
;;
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
i*86 | x86_64)
basic_machine=$basic_machine-pc
;;
# Object if more than one company name word.
*-*-*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
| mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile-* | tilegx-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att
;;
3b*)
basic_machine=we32k-att
;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
abacus)
basic_machine=abacus-unknown
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80)
basic_machine=fx80-alliant
;;
altos | altos3068)
basic_machine=m68k-altos
;;
am29k)
basic_machine=a29k-none
os=-bsd
;;
amd64)
basic_machine=x86_64-pc
;;
amd64-*)
basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
amdahl)
basic_machine=580-amdahl
os=-sysv
;;
amiga | amiga-*)
basic_machine=m68k-unknown
;;
amigaos | amigados)
basic_machine=m68k-unknown
os=-amigaos
;;
amigaunix | amix)
basic_machine=m68k-unknown
os=-sysv4
;;
apollo68)
basic_machine=m68k-apollo
os=-sysv
;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux)
basic_machine=m68k-apple
os=-aux
;;
balance)
basic_machine=ns32k-sequent
os=-dynix
;;
blackfin)
basic_machine=bfin-unknown
os=-linux
;;
blackfin-*)
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90)
basic_machine=c90-cray
os=-unicos
;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1)
basic_machine=c1-convex
os=-bsd
;;
convex-c2)
basic_machine=c2-convex
os=-bsd
;;
convex-c32)
basic_machine=c32-convex
os=-bsd
;;
convex-c34)
basic_machine=c34-convex
os=-bsd
;;
convex-c38)
basic_machine=c38-convex
os=-bsd
;;
cray | j90)
basic_machine=j90-cray
os=-unicos
;;
craynv)
basic_machine=craynv-cray
os=-unicosmp
;;
cr16)
basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
basic_machine=m68k-crds
;;
crisv32 | crisv32-* | etraxfs*)
basic_machine=crisv32-axis
;;
cris | cris-* | etrax*)
basic_machine=cris-axis
;;
crx)
basic_machine=crx-unknown
os=-elf
;;
da30 | da30-*)
basic_machine=m68k-da30
;;
decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
basic_machine=mips-dec
;;
decsystem10* | dec10*)
basic_machine=pdp10-dec
os=-tops10
;;
decsystem20* | dec20*)
basic_machine=pdp10-dec
os=-tops20
;;
delta | 3300 | motorola-3300 | motorola-delta \
| 3300-motorola | delta-motorola)
basic_machine=m68k-motorola
;;
delta88)
basic_machine=m88k-motorola
os=-sysv3
;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
;;
dpx20 | dpx20-*)
basic_machine=rs6000-bull
os=-bosx
;;
dpx2* | dpx2*-bull)
basic_machine=m68k-bull
os=-sysv3
;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
;;
elxsi)
basic_machine=elxsi-elxsi
os=-bsd
;;
encore | umax | mmax)
basic_machine=ns32k-encore
;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800)
basic_machine=i860-alliant
;;
genix)
basic_machine=ns32k-ns
;;
gmicro)
basic_machine=tron-gmicro
os=-sysv
;;
go32)
basic_machine=i386-pc
os=-go32
;;
h3050r* | hiux*)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
h8300hms)
basic_machine=h8300-hitachi
os=-hms
;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris)
basic_machine=m88k-harris
os=-sysv3
;;
hp300-*)
basic_machine=m68k-hp
;;
hp300bsd)
basic_machine=m68k-hp
os=-bsd
;;
hp300hpux)
basic_machine=m68k-hp
os=-hpux
;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp
;;
hp9k3[2-9][0-9])
basic_machine=m68k-hp
;;
hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][0-9] | hp8[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hppa-next)
os=-nextstep3
;;
hppaosf)
basic_machine=hppa1.1-hp
os=-osf
;;
hppro)
basic_machine=hppa1.1-hp
os=-proelf
;;
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
;;
i*86v4*)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv4
;;
i*86v)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv
;;
i*86sol2)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2
;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
-irix*)
;;
*)
os=-irix4
;;
esac
;;
isi68 | isi)
basic_machine=m68k-isi
os=-sysv
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
;;
m68knommu-*)
basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
m88k-omron*)
basic_machine=m88k-omron
;;
magnum | m3230)
basic_machine=mips-mips
os=-sysv
;;
merlin)
basic_machine=ns32k-utek
os=-sysv
;;
microblaze)
basic_machine=microblaze-xilinx
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
basic_machine=arm-unknown
os=-mingw32ce
;;
miniframe)
basic_machine=m68000-convergent
;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mips3*-*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
;;
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
morphos)
basic_machine=powerpc-unknown
os=-morphos
;;
msdos)
basic_machine=i386-pc
os=-msdos
;;
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
msys)
basic_machine=i386-pc
os=-msys
;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder)
basic_machine=armv4l-rebel
os=-linux
;;
news | news700 | news800 | news900)
basic_machine=m68k-sony
os=-newsos
;;
news1000)
basic_machine=m68030-sony
os=-newsos
;;
news-3600 | risc-news)
basic_machine=mips-sony
os=-newsos
;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next )
basic_machine=m68k-next
case $os in
-nextstep* )
;;
-ns2*)
os=-nextstep2
;;
*)
os=-nextstep3
;;
esac
;;
nh3000)
basic_machine=m68k-harris
os=-cxux
;;
nh[45]000)
basic_machine=m88k-harris
os=-cxux
;;
nindy960)
basic_machine=i960-intel
os=-nindy
;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
nonstopux)
basic_machine=mips-compaq
os=-nonstopux
;;
np1)
basic_machine=np1-gould
;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
openrisc | openrisc-*)
basic_machine=or32-unknown
;;
os400)
basic_machine=powerpc-ibm
os=-os400
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi)
basic_machine=hppa1.1-hitachi
os=-hiuxwe2
;;
paragon)
basic_machine=i860-intel
os=-osf
;;
parisc)
basic_machine=hppa-unknown
os=-linux
;;
parisc-*)
basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
pbd)
basic_machine=sparc-tti
;;
pbb)
basic_machine=m68k-tti
;;
pc532 | pc532-*)
basic_machine=ns32k-pc532
;;
pc98)
basic_machine=i386-pc
;;
pc98-*)
basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium | p5 | k5 | k6 | nexgen | viac3)
basic_machine=i586-pc
;;
pentiumpro | p6 | 6x86 | athlon | athlon_*)
basic_machine=i686-pc
;;
pentiumii | pentium2 | pentiumiii | pentium3)
basic_machine=i686-pc
;;
pentium4)
basic_machine=i786-pc
;;
pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentium4-*)
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pn)
basic_machine=pn-gould
;;
power) basic_machine=power-ibm
;;
ppc) basic_machine=powerpc-unknown
;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64) basic_machine=powerpc64-unknown
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppc64le | powerpc64little | ppc64-le | powerpc64-little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ps2)
basic_machine=i386-ibm
;;
pw32)
basic_machine=i586-unknown
os=-pw32
;;
rdos)
basic_machine=i386-pc
os=-rdos
;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00)
basic_machine=mips-siemens
;;
rtpc | rtpc-*)
basic_machine=romp-ibm
;;
s390 | s390-*)
basic_machine=s390-ibm
;;
s390x | s390x-*)
basic_machine=s390x-ibm
;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sb1)
basic_machine=mipsisa64sb1-unknown
;;
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
sde)
basic_machine=mipsisa32-sde
os=-elf
;;
sei)
basic_machine=mips-sei
os=-seiux
;;
sequent)
basic_machine=i386-sequent
;;
sh)
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
sparclite-wrs | simso-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7)
basic_machine=m68k-bull
os=-sysv2
;;
spur)
basic_machine=spur-unknown
;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
sun2)
basic_machine=m68000-sun
;;
sun2os3)
basic_machine=m68000-sun
os=-sunos3
;;
sun2os4)
basic_machine=m68000-sun
os=-sunos4
;;
sun3os3)
basic_machine=m68k-sun
os=-sunos3
;;
sun3os4)
basic_machine=m68k-sun
os=-sunos4
;;
sun4os3)
basic_machine=sparc-sun
os=-sunos3
;;
sun4os4)
basic_machine=sparc-sun
os=-sunos4
;;
sun4sol2)
basic_machine=sparc-sun
os=-solaris2
;;
sun3 | sun3-*)
basic_machine=m68k-sun
;;
sun4)
basic_machine=sparc-sun
;;
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
sv1)
basic_machine=sv1-cray
os=-unicos
;;
symmetry)
basic_machine=i386-sequent
os=-dynix
;;
t3e)
basic_machine=alphaev5-cray
os=-unicos
;;
t90)
basic_machine=t90-cray
os=-unicos
;;
# This must be matched before tile*.
tilegx*)
basic_machine=tilegx-unknown
os=-linux-gnu
;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
basic_machine=mipstx39-unknown
;;
tx39el)
basic_machine=mipstx39el-unknown
;;
toad1)
basic_machine=pdp10-xkl
os=-tops20
;;
tower | tower-32)
basic_machine=m68k-ncr
;;
tpf)
basic_machine=s390x-ibm
os=-tpf
;;
udi29k)
basic_machine=a29k-amd
os=-udi
;;
ultra3)
basic_machine=a29k-nyu
os=-sym1
;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv)
basic_machine=vax-dec
os=-sysv
;;
vms)
basic_machine=vax-dec
os=-vms
;;
vpp*|vx|vx-*)
basic_machine=f301-fujitsu
;;
vxworks960)
basic_machine=i960-wrs
os=-vxworks
;;
vxworks68)
basic_machine=m68k-wrs
os=-vxworks
;;
vxworks29k)
basic_machine=a29k-wrs
os=-vxworks
;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
xbox)
basic_machine=i686-pc
os=-mingw32
;;
xps | xps100)
basic_machine=xps100-honeywell
;;
ymp)
basic_machine=ymp-cray
os=-unicos
;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none)
basic_machine=none-none
os=-none
;;
# Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
romp)
basic_machine=romp-ibm
;;
mmix)
basic_machine=mmix-knuth
;;
rs6000)
basic_machine=rs6000-ibm
;;
vax)
basic_machine=vax-dec
;;
pdp10)
# there are many clones, so DEC is not a safe bet
basic_machine=pdp10-unknown
;;
pdp11)
basic_machine=pdp11-dec
;;
we32k)
basic_machine=we32k-att
;;
sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
basic_machine=sparc-sun
;;
cydra)
basic_machine=cydra-cydrome
;;
orion)
basic_machine=orion-highlevel
;;
orion105)
basic_machine=clipper-highlevel
;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
*-unknown)
# Make sure to match an already-canonicalized machine name.
;;
*)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1
;;
esac
# Here we canonicalize certain aliases for manufacturers.
case $basic_machine in
*-digital*)
basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
;;
*-commodore*)
basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
;;
*)
;;
esac
# Decode manufacturer-specific aliases for certain operating systems.
if [ x"$os" != x"" ]
then
case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
-solaris)
os=-solaris2
;;
-svr4*)
os=-sysv4
;;
-unixware*)
os=-sysv4.2uw
;;
-gnu/linux*)
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
;;
# First accept the basic system types.
# The portable systems comes first.
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
case $basic_machine in
x86-* | i*86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto-qnx*)
;;
-nto*)
os=`echo $os | sed -e 's|nto|nto-qnx|'`
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux-dietlibc)
os=-linux-dietlibc
;;
-linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'`
;;
-sunos5*)
os=`echo $os | sed -e 's|sunos5|solaris2|'`
;;
-sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'`
;;
-opened*)
os=-openedition
;;
-os400*)
os=-os400
;;
-wince*)
os=-wince
;;
-osfrose*)
os=-osfrose
;;
-osf*)
os=-osf
;;
-utek*)
os=-bsd
;;
-dynix*)
os=-bsd
;;
-acis*)
os=-aos
;;
-atheos*)
os=-atheos
;;
-syllable*)
os=-syllable
;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*)
os=-sysv
;;
-nova*)
os=-rtmk-nova
;;
-ns2 )
os=-nextstep2
;;
-nsk*)
os=-nsk
;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
;;
-sinix*)
os=-sysv4
;;
-tpf*)
os=-tpf
;;
-triton*)
os=-sysv3
;;
-oss*)
os=-sysv3
;;
-svr4)
os=-sysv4
;;
-svr3)
os=-sysv3
;;
-sysvr4)
os=-sysv4
;;
# This must come after -sysvr4.
-sysv*)
;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix)
os=-xenix
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
os=-mint
;;
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none)
;;
*)
# Get rid of the `-' at the beginning of $os.
os=`echo $os | sed 's/[^-]*-//'`
echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
exit 1
;;
esac
else
# Here we handle the default operating systems that come with various machines.
# The value should be what the vendor currently ships out the door with their
# machine or put another way, the most popular os provided with the machine.
# Note that if you're going to try to match "-MANUFACTURER" here (say,
# "-sun"), then you have to tell the case statement up towards the top
# that MANUFACTURER isn't an operating system. Otherwise, code above
# will signal an error saying that MANUFACTURER isn't an operating
# system, and we'll never get to this point.
case $basic_machine in
score-*)
os=-elf
;;
spu-*)
os=-elf
;;
*-acorn)
os=-riscix1.2
;;
arm*-rebel)
os=-linux
;;
arm*-semi)
os=-aout
;;
c4x-* | tic4x-*)
os=-coff
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
os=-tops20
;;
pdp11-*)
os=-none
;;
*-dec | vax-*)
os=-ultrix4.2
;;
m68*-apollo)
os=-domain
;;
i386-sun)
os=-sunos4.0.2
;;
m68000-sun)
os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;;
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
or32-*)
os=-coff
;;
*-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3
;;
sparc-* | *-sun)
os=-sunos4.1.1
;;
*-be)
os=-beos
;;
*-haiku)
os=-haiku
;;
*-ibm)
os=-aix
;;
*-knuth)
os=-mmixware
;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp)
os=-hpux
;;
*-hitachi)
os=-hiux
;;
i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
os=-sysv
;;
*-cbm)
os=-amigaos
;;
*-dg)
os=-dgux
;;
*-dolphin)
os=-sysv3
;;
m68k-ccur)
os=-rtu
;;
m88k-omron*)
os=-luna
;;
*-next )
os=-nextstep
;;
*-sequent)
os=-ptx
;;
*-crds)
os=-unos
;;
*-ns)
os=-genix
;;
i370-*)
os=-mvs
;;
*-next)
os=-nextstep3
;;
*-gould)
os=-sysv
;;
*-highlevel)
os=-bsd
;;
*-encore)
os=-bsd
;;
*-sgi)
os=-irix
;;
*-siemens)
os=-sysv4
;;
*-masscomp)
os=-rtu
;;
f30[01]-fujitsu | f700-fujitsu)
os=-uxpv
;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*)
os=-none
;;
esac
fi
# Here we handle the case where we know the os, and the CPU type, but not the
# manufacturer. We pick the logical manufacturer.
vendor=unknown
case $basic_machine in
*-unknown)
case $os in
-riscix*)
vendor=acorn
;;
-sunos*)
vendor=sun
;;
-cnk*|-aix*)
vendor=ibm
;;
-beos*)
vendor=be
;;
-hpux*)
vendor=hp
;;
-mpeix*)
vendor=hp
;;
-hiux*)
vendor=hitachi
;;
-unos*)
vendor=crds
;;
-dgux*)
vendor=dg
;;
-luna*)
vendor=omron
;;
-genix*)
vendor=ns
;;
-mvs* | -opened*)
vendor=ibm
;;
-os400*)
vendor=ibm
;;
-ptx*)
vendor=sequent
;;
-tpf*)
vendor=ibm
;;
-vxsim* | -vxworks* | -windiss*)
vendor=wrs
;;
-aux*)
vendor=apple
;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
vendor=atari
;;
-vos*)
vendor=stratus
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;
esac
echo $basic_machine$os
exit
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
# End:
|
> > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Copyright (c) 2012 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Auto-load module for 'make' build system integration
use init
autosetup_add_init_type make {Simple "make" build system} {
autosetup_check_create auto.def \
{# Initial auto.def created by 'autosetup --init=make'
use cc
# Add any user options here
options {
}
make-config-header config.h
make-template Makefile.in
}
if {![file exists Makefile.in]} {
puts "Note: I don't see Makefile.in. You will probably need to create one."
}
}
|
> > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#!/bin/sh
# Looks for a suitable tclsh or jimsh in the PATH
# If not found, builds a bootstrap jimsh from source
d=`dirname "$0"`
{ "$d/jimsh0" "$d/test-tclsh"; } 2>/dev/null && exit 0
PATH="$PATH:$d/../../../bin:$d"; export PATH
for tclsh in tclsh8.6 tclsh86.exe tclsh8.5 tclsh85.exe tclsh tclsh.exe jimsh ; do
{ $tclsh "$d/test-tclsh"; } 2>/dev/null && exit 0
done
echo 1>&2 "No installed jimsh or tclsh, building local bootstrap jimsh0"
for cc in ${CC_FOR_BUILD:-cc} gcc; do
{ $cc -o "$d/jimsh0" "$d/jimsh0.c"; } 2>/dev/null || continue
"$d/jimsh0" "$d/test-tclsh" && exit 0
done
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
echo false
|
more than 10,000 changes
> > > > > > > > > | 1 2 3 4 5 6 7 8 9 | Files in this directory are optional modules which can be loaded with the 'use' directive. Modules which are publically documented (@MODULE ...) are installed stand-alone in order to facilitate understanding by autosetup end-users. All other modules are private/internal and are combined with the main script when installed. |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module which provides text formatting
# asciidoc format
use formatting
proc para {text} {
regsub -all "\[ \t\n\]+" [string trim $text] " "
}
proc title {text} {
underline [para $text] =
nl
}
proc p {text} {
puts [para $text]
nl
}
proc code {text} {
foreach line [parse_code_block $text] {
puts " $line"
}
nl
}
proc codelines {lines} {
foreach line $lines {
puts " $line"
}
nl
}
proc nl {} {
puts ""
}
proc underline {text char} {
regexp "^(\[ \t\]*)(.*)" $text -> indent words
puts $text
puts $indent[string repeat $char [string length $words]]
}
proc section {text} {
underline "[para $text]" -
nl
}
proc subsection {text} {
underline "$text" ~
nl
}
proc bullet {text} {
puts "* [para $text]"
}
proc indent {text} {
puts " :: "
puts [para $text]
}
proc defn {first args} {
set sep ""
if {$first ne ""} {
puts "${first}::"
} else {
puts " :: "
}
set defn [string trim [join $args \n]]
regsub -all "\n\n" $defn "\n ::\n" defn
puts $defn
}
|
> > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# The 'cc-db' module provides a knowledge based of system idiosyncracies
# In general, this module can always be included
use cc
module-options {}
# openbsd needs sys/types.h to detect some system headers
cc-include-needs sys/socket.h sys/types.h
cc-include-needs netinet/in.h sys/types.h
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# Provides a library of common tests on top of the 'cc' module.
use cc
module-options {}
# @cc-check-lfs
#
# The equivalent of the AC_SYS_LARGEFILE macro
#
# defines 'HAVE_LFS' if LFS is available,
# and defines '_FILE_OFFSET_BITS=64' if necessary
#
# Returns 1 if 'LFS' is available or 0 otherwise
#
proc cc-check-lfs {} {
cc-check-includes sys/types.h
msg-checking "Checking if -D_FILE_OFFSET_BITS=64 is needed..."
set lfs 1
if {[msg-quiet cc-with {-includes sys/types.h} {cc-check-sizeof off_t}] == 8} {
msg-result no
} elseif {[msg-quiet cc-with {-includes sys/types.h -cflags -D_FILE_OFFSET_BITS=64} {cc-check-sizeof off_t}] == 8} {
define _FILE_OFFSET_BITS 64
msg-result yes
} else {
set lfs 0
msg-result none
}
define-feature lfs $lfs
return $lfs
}
# @cc-check-endian
#
# The equivalent of the AC_C_BIGENDIAN macro
#
# defines 'HAVE_BIG_ENDIAN' if endian is known to be big,
# or 'HAVE_LITTLE_ENDIAN' if endian is known to be little.
#
# Returns 1 if determined, or 0 if not.
#
proc cc-check-endian {} {
cc-check-includes sys/types.h sys/param.h
set rc 0
msg-checking "Checking endian..."
cc-with {-includes {sys/types.h sys/param.h}} {
if {[cctest -code {
#if !defined(BIG_ENDIAN) || !defined(BYTE_ORDER)
#error unknown
#elif BYTE_ORDER != BIG_ENDIAN
#error little
#endif
}]} {
define-feature big-endian
msg-result "big"
set rc 1
} elseif {[cctest -code {
#if !defined(LITTLE_ENDIAN) || !defined(BYTE_ORDER)
#error unknown
#elif BYTE_ORDER != LITTLE_ENDIAN
#error big
#endif
}]} {
define-feature little-endian
msg-result "little"
set rc 1
} else {
msg-result "unknown"
}
}
return $rc
}
# @cc-check-flags flag ?...?
#
# Checks whether the given C/C++ compiler flags can be used. Defines feature
# names prefixed with 'HAVE_CFLAG' and 'HAVE_CXXFLAG' respectively, and
# appends working flags to '-cflags' and 'CFLAGS' or 'CXXFLAGS'.
proc cc-check-flags {args} {
set result 1
array set opts [cc-get-settings]
switch -exact -- $opts(-lang) {
c++ {
set lang C++
set prefix CXXFLAG
}
c {
set lang C
set prefix CFLAG
}
default {
autosetup-error "cc-check-flags failed with unknown language: $opts(-lang)"
}
}
foreach flag $args {
msg-checking "Checking whether the $lang compiler accepts $flag..."
if {[cctest -cflags $flag]} {
msg-result yes
define-feature $prefix$flag
cc-with [list -cflags [list $flag]]
define-append ${prefix}S $flag
} else {
msg-result no
set result 0
}
}
return $result
}
# @cc-check-standards ver ?...?
#
# Checks whether the C/C++ compiler accepts one of the specified '-std=$ver'
# options, and appends the first working one to '-cflags' and 'CFLAGS' or
# 'CXXFLAGS'.
proc cc-check-standards {args} {
array set opts [cc-get-settings]
foreach std $args {
if {[cc-check-flags -std=$std]} {
return $std
}
}
return ""
}
# Checks whether $keyword is usable as alignof
proc cctest_alignof {keyword} {
msg-checking "Checking for $keyword..."
if {[cctest -code [subst -nobackslashes {
printf("minimum alignment is %d == %d\n", ${keyword}(char), ${keyword}('x'));
}]]} then {
msg-result ok
define-feature $keyword
} else {
msg-result "not found"
}
}
# @cc-check-c11
#
# Checks for several C11/C++11 extensions and their alternatives. Currently
# checks for '_Static_assert', '_Alignof', '__alignof__', '__alignof'.
proc cc-check-c11 {} {
msg-checking "Checking for _Static_assert..."
if {[cctest -code {
_Static_assert(1, "static assertions are available");
}]} then {
msg-result ok
define-feature _Static_assert
} else {
msg-result "not found"
}
cctest_alignof _Alignof
cctest_alignof __alignof__
cctest_alignof __alignof
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# The 'cc-shared' module provides support for shared libraries and shared objects.
# It defines the following variables:
#
## SH_CFLAGS Flags to use compiling sources destined for a shared library
## SH_LDFLAGS Flags to use linking (creating) a shared library
## SH_SOPREFIX Prefix to use to set the soname when creating a shared library
## SH_SOEXT Extension for shared libs
## SH_SOEXTVER Format for versioned shared libs - %s = version
## SHOBJ_CFLAGS Flags to use compiling sources destined for a shared object
## SHOBJ_LDFLAGS Flags to use linking a shared object, undefined symbols allowed
## SHOBJ_LDFLAGS_R - as above, but all symbols must be resolved
## SH_LINKFLAGS Flags to use linking an executable which will load shared objects
## LD_LIBRARY_PATH Environment variable which specifies path to shared libraries
## STRIPLIBFLAGS Arguments to strip to strip a dynamic library
module-options {}
# Defaults: gcc on unix
define SHOBJ_CFLAGS -fpic
define SHOBJ_LDFLAGS -shared
define SH_CFLAGS -fpic
define SH_LDFLAGS -shared
define SH_LINKFLAGS -rdynamic
define SH_SOEXT .so
define SH_SOEXTVER .so.%s
define SH_SOPREFIX -Wl,-soname,
define LD_LIBRARY_PATH LD_LIBRARY_PATH
define STRIPLIBFLAGS --strip-unneeded
# Note: This is a helpful reference for identifying the toolchain
# http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
switch -glob -- [get-define host] {
*-*-darwin* {
define SHOBJ_CFLAGS "-dynamic -fno-common"
define SHOBJ_LDFLAGS "-bundle -undefined dynamic_lookup"
define SHOBJ_LDFLAGS_R -bundle
define SH_CFLAGS -dynamic
define SH_LDFLAGS -dynamiclib
define SH_LINKFLAGS ""
define SH_SOEXT .dylib
define SH_SOEXTVER .%s.dylib
define SH_SOPREFIX -Wl,-install_name,
define LD_LIBRARY_PATH DYLD_LIBRARY_PATH
define STRIPLIBFLAGS -x
}
*-*-ming* - *-*-cygwin - *-*-msys {
define SHOBJ_CFLAGS ""
define SHOBJ_LDFLAGS "-shared -static-libgcc"
define SH_CFLAGS ""
define SH_LDFLAGS "-shared -static-libgcc"
define SH_LINKFLAGS ""
define SH_SOEXT .dll
define SH_SOEXTVER .dll
define SH_SOPREFIX ""
define LD_LIBRARY_PATH PATH
}
sparc* {
if {[msg-quiet cc-check-decls __SUNPRO_C]} {
msg-result "Found sun stdio compiler"
# sun stdio compiler
# XXX: These haven't been fully tested.
define SHOBJ_CFLAGS -KPIC
define SHOBJ_LDFLAGS "-G"
define SH_CFLAGS -KPIC
define SH_LINKFLAGS -Wl,-export-dynamic
define SH_SOPREFIX -Wl,-h,
} else {
# sparc has a very small GOT table limit, so use -fPIC
define SH_CFLAGS -fPIC
define SHOBJ_CFLAGS -fPIC
}
}
*-*-solaris* {
if {[msg-quiet cc-check-decls __SUNPRO_C]} {
msg-result "Found sun stdio compiler"
# sun stdio compiler
# XXX: These haven't been fully tested.
define SHOBJ_CFLAGS -KPIC
define SHOBJ_LDFLAGS "-G"
define SH_CFLAGS -KPIC
define SH_LINKFLAGS -Wl,-export-dynamic
define SH_SOPREFIX -Wl,-h,
}
}
*-*-hpux {
# XXX: These haven't been tested
define SHOBJ_CFLAGS "+O3 +z"
define SHOBJ_LDFLAGS -b
define SH_CFLAGS +z
define SH_LINKFLAGS -Wl,+s
define LD_LIBRARY_PATH SHLIB_PATH
}
*-*-haiku {
define SHOBJ_CFLAGS ""
define SHOBJ_LDFLAGS -shared
define SH_CFLAGS ""
define SH_LDFLAGS -shared
define SH_LINKFLAGS ""
define SH_SOPREFIX ""
define LD_LIBRARY_PATH LIBRARY_PATH
}
}
if {![is-defined SHOBJ_LDFLAGS_R]} {
define SHOBJ_LDFLAGS_R [get-define SHOBJ_LDFLAGS]
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# The 'cc' module supports checking various 'features' of the C or C++
# compiler/linker environment. Common commands are cc-check-includes,
# cc-check-types, cc-check-functions, cc-with, make-autoconf-h and make-template.
#
# The following environment variables are used if set:
#
## CC - C compiler
## CXX - C++ compiler
## CCACHE - Set to "none" to disable automatic use of ccache
## CFLAGS - Additional C compiler flags
## CXXFLAGS - Additional C++ compiler flags
## LDFLAGS - Additional compiler flags during linking
## LIBS - Additional libraries to use (for all tests)
## CROSS - Tool prefix for cross compilation
#
# The following variables are defined from the corresponding
# environment variables if set.
#
## CPPFLAGS
## LINKFLAGS
## CC_FOR_BUILD
## LD
use system
module-options {}
# Note that the return code is not meaningful
proc cc-check-something {name code} {
uplevel 1 $code
}
# Checks for the existence of the given function by linking
#
proc cctest_function {function} {
cctest -link 1 -declare "extern void $function\(void);" -code "$function\();"
}
# Checks for the existence of the given type by compiling
proc cctest_type {type} {
cctest -code "$type _x;"
}
# Checks for the existence of the given type/structure member.
# e.g. "struct stat.st_mtime"
proc cctest_member {struct_member} {
lassign [split $struct_member .] struct member
cctest -code "static $struct _s; return sizeof(_s.$member);"
}
# Checks for the existence of the given define by compiling
#
proc cctest_define {name} {
cctest -code "#ifndef $name\n#error not defined\n#endif"
}
# Checks for the existence of the given name either as
# a macro (#define) or an rvalue (such as an enum)
#
proc cctest_decl {name} {
cctest -code "#ifndef $name\n(void)$name;\n#endif"
}
# @cc-check-sizeof type ...
#
# Checks the size of the given types (between 1 and 32, inclusive).
# Defines a variable with the size determined, or "unknown" otherwise.
# e.g. for type 'long long', defines SIZEOF_LONG_LONG.
# Returns the size of the last type.
#
proc cc-check-sizeof {args} {
foreach type $args {
msg-checking "Checking for sizeof $type..."
set size unknown
# Try the most common sizes first
foreach i {4 8 1 2 16 32} {
if {[cctest -code "static int _x\[sizeof($type) == $i ? 1 : -1\] = { 1 };"]} {
set size $i
break
}
}
msg-result $size
set define [feature-define-name $type SIZEOF_]
define $define $size
}
# Return the last result
get-define $define
}
# Checks for each feature in $list by using the given script.
#
# When the script is evaluated, $each is set to the feature
# being checked, and $extra is set to any additional cctest args.
#
# Returns 1 if all features were found, or 0 otherwise.
proc cc-check-some-feature {list script} {
set ret 1
foreach each $list {
if {![check-feature $each $script]} {
set ret 0
}
}
return $ret
}
# @cc-check-includes includes ...
#
# Checks that the given include files can be used
proc cc-check-includes {args} {
cc-check-some-feature $args {
set with {}
if {[dict exists $::autosetup(cc-include-deps) $each]} {
set deps [dict keys [dict get $::autosetup(cc-include-deps) $each]]
msg-quiet cc-check-includes {*}$deps
foreach i $deps {
if {[have-feature $i]} {
lappend with $i
}
}
}
if {[llength $with]} {
cc-with [list -includes $with] {
cctest -includes $each
}
} else {
cctest -includes $each
}
}
}
# @cc-include-needs include required ...
#
# Ensures that when checking for 'include', a check is first
# made for each 'required' file, and if found, it is #included
proc cc-include-needs {file args} {
foreach depfile $args {
dict set ::autosetup(cc-include-deps) $file $depfile 1
}
}
# @cc-check-types type ...
#
# Checks that the types exist.
proc cc-check-types {args} {
cc-check-some-feature $args {
cctest_type $each
}
}
# @cc-check-defines define ...
#
# Checks that the given preprocessor symbol is defined
proc cc-check-defines {args} {
cc-check-some-feature $args {
cctest_define $each
}
}
# @cc-check-decls name ...
#
# Checks that each given name is either a preprocessor symbol or rvalue
# such as an enum. Note that the define used for a decl is HAVE_DECL_xxx
# rather than HAVE_xxx
proc cc-check-decls {args} {
set ret 1
foreach name $args {
msg-checking "Checking for $name..."
set r [cctest_decl $name]
define-feature "decl $name" $r
if {$r} {
msg-result "ok"
} else {
msg-result "not found"
set ret 0
}
}
return $ret
}
# @cc-check-functions function ...
#
# Checks that the given functions exist (can be linked)
proc cc-check-functions {args} {
cc-check-some-feature $args {
cctest_function $each
}
}
# @cc-check-members type.member ...
#
# Checks that the given type/structure members exist.
# A structure member is of the form "struct stat.st_mtime"
proc cc-check-members {args} {
cc-check-some-feature $args {
cctest_member $each
}
}
# @cc-check-function-in-lib function libs ?otherlibs?
#
# Checks that the given given function can be found in one of the libs.
#
# First checks for no library required, then checks each of the libraries
# in turn.
#
# If the function is found, the feature is defined and lib_$function is defined
# to -l$lib where the function was found, or "" if no library required.
# In addition, -l$lib is added to the LIBS define.
#
# If additional libraries may be needed for linking, they should be specified
# as $extralibs as "-lotherlib1 -lotherlib2".
# These libraries are not automatically added to LIBS.
#
# Returns 1 if found or 0 if not.
#
proc cc-check-function-in-lib {function libs {otherlibs {}}} {
msg-checking "Checking libs for $function..."
set found 0
cc-with [list -libs $otherlibs] {
if {[cctest_function $function]} {
msg-result "none needed"
define lib_$function ""
incr found
} else {
foreach lib $libs {
cc-with [list -libs -l$lib] {
if {[cctest_function $function]} {
msg-result -l$lib
define lib_$function -l$lib
define-append LIBS -l$lib
incr found
break
}
}
}
}
}
if {$found} {
define [feature-define-name $function]
} else {
msg-result "no"
}
return $found
}
# @cc-check-tools tool ...
#
# Checks for existence of the given compiler tools, taking
# into account any cross compilation prefix.
#
# For example, when checking for "ar", first AR is checked on the command
# line and then in the environment. If not found, "${host}-ar" or
# simply "ar" is assumed depending upon whether cross compiling.
# The path is searched for this executable, and if found AR is defined
# to the executable name.
# Note that even when cross compiling, the simple "ar" is used as a fallback,
# but a warning is generated. This is necessary for some toolchains.
#
# It is an error if the executable is not found.
#
proc cc-check-tools {args} {
foreach tool $args {
set TOOL [string toupper $tool]
set exe [get-env $TOOL [get-define cross]$tool]
if {[find-executable {*}$exe]} {
define $TOOL $exe
continue
}
if {[find-executable {*}$tool]} {
msg-result "Warning: Failed to find $exe, falling back to $tool which may be incorrect"
define $TOOL $tool
continue
}
user-error "Failed to find $exe"
}
}
# @cc-check-progs prog ...
#
# Checks for existence of the given executables on the path.
#
# For example, when checking for "grep", the path is searched for
# the executable, 'grep', and if found GREP is defined as "grep".
#
# It the executable is not found, the variable is defined as false.
# Returns 1 if all programs were found, or 0 otherwise.
#
proc cc-check-progs {args} {
set failed 0
foreach prog $args {
set PROG [string toupper $prog]
msg-checking "Checking for $prog..."
if {![find-executable $prog]} {
msg-result no
define $PROG false
incr failed
} else {
msg-result ok
define $PROG $prog
}
}
expr {!$failed}
}
# Adds the given settings to $::autosetup(ccsettings) and
# returns the old settings.
#
proc cc-add-settings {settings} {
if {[llength $settings] % 2} {
autosetup-error "settings list is missing a value: $settings"
}
set prev [cc-get-settings]
# workaround a bug in some versions of jimsh by forcing
# conversion of $prev to a list
llength $prev
array set new $prev
foreach {name value} $settings {
switch -exact -- $name {
-cflags - -includes {
# These are given as lists
lappend new($name) {*}$value
}
-declare {
lappend new($name) $value
}
-libs {
# Note that new libraries are added before previous libraries
set new($name) [list {*}$value {*}$new($name)]
}
-link - -lang - -nooutput {
set new($name) $value
}
-source - -sourcefile - -code {
# XXX: These probably are only valid directly from cctest
set new($name) $value
}
default {
autosetup-error "unknown cctest setting: $name"
}
}
}
cc-store-settings [array get new]
return $prev
}
proc cc-store-settings {new} {
set ::autosetup(ccsettings) $new
}
proc cc-get-settings {} {
return $::autosetup(ccsettings)
}
# Similar to cc-add-settings, but each given setting
# simply replaces the existing value.
#
# Returns the previous settings
proc cc-update-settings {args} {
set prev [cc-get-settings]
cc-store-settings [dict merge $prev $args]
return $prev
}
# @cc-with settings ?{ script }?
#
# Sets the given 'cctest' settings and then runs the tests in 'script'.
# Note that settings such as -lang replace the current setting, while
# those such as -includes are appended to the existing setting.
#
# If no script is given, the settings become the default for the remainder
# of the auto.def file.
#
## cc-with {-lang c++} {
## # This will check with the C++ compiler
## cc-check-types bool
## cc-with {-includes signal.h} {
## # This will check with the C++ compiler, signal.h and any existing includes.
## ...
## }
## # back to just the C++ compiler
## }
#
# The -libs setting is special in that newer values are added *before* earlier ones.
#
## cc-with {-libs {-lc -lm}} {
## cc-with {-libs -ldl} {
## cctest -libs -lsocket ...
## # libs will be in this order: -lsocket -ldl -lc -lm
## }
## }
proc cc-with {settings args} {
if {[llength $args] == 0} {
cc-add-settings $settings
} elseif {[llength $args] > 1} {
autosetup-error "usage: cc-with settings ?script?"
} else {
set save [cc-add-settings $settings]
set rc [catch {uplevel 1 [lindex $args 0]} result info]
cc-store-settings $save
if {$rc != 0} {
return -code [dict get $info -code] $result
}
return $result
}
}
# @cctest ?settings?
#
# Low level C compiler checker. Compiles and or links a small C program
# according to the arguments and returns 1 if OK, or 0 if not.
#
# Supported settings are:
#
## -cflags cflags A list of flags to pass to the compiler
## -includes list A list of includes, e.g. {stdlib.h stdio.h}
## -declare code Code to declare before main()
## -link 1 Don't just compile, link too
## -lang c|c++ Use the C (default) or C++ compiler
## -libs liblist List of libraries to link, e.g. {-ldl -lm}
## -code code Code to compile in the body of main()
## -source code Compile a complete program. Ignore -includes, -declare and -code
## -sourcefile file Shorthand for -source [readfile [get-define srcdir]/$file]
## -nooutput 1 Treat any compiler output (e.g. a warning) as an error
#
# Unless -source or -sourcefile is specified, the C program looks like:
#
## #include <firstinclude> /* same for remaining includes in the list */
##
## declare-code /* any code in -declare, verbatim */
##
## int main(void) {
## code /* any code in -code, verbatim */
## return 0;
## }
#
# Any failures are recorded in 'config.log'
#
proc cctest {args} {
set src conftest__.c
set tmp conftest__
# Easiest way to merge in the settings
cc-with $args {
array set opts [cc-get-settings]
}
if {[info exists opts(-sourcefile)]} {
set opts(-source) [readfile [get-define srcdir]/$opts(-sourcefile) "#error can't find $opts(-sourcefile)"]
}
if {[info exists opts(-source)]} {
set lines $opts(-source)
} else {
foreach i $opts(-includes) {
if {$opts(-code) ne "" && ![feature-checked $i]} {
# Compiling real code with an unchecked header file
# Quickly (and silently) check for it now
# Remove all -includes from settings before checking
set saveopts [cc-update-settings -includes {}]
msg-quiet cc-check-includes $i
cc-store-settings $saveopts
}
if {$opts(-code) eq "" || [have-feature $i]} {
lappend source "#include <$i>"
}
}
lappend source {*}$opts(-declare)
lappend source "int main(void) {"
lappend source $opts(-code)
lappend source "return 0;"
lappend source "}"
set lines [join $source \n]
}
# Build the command line
set cmdline {}
lappend cmdline {*}[get-define CCACHE]
switch -exact -- $opts(-lang) {
c++ {
lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS]
}
c {
lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
}
default {
autosetup-error "cctest called with unknown language: $opts(-lang)"
}
}
if {!$opts(-link)} {
set tmp conftest__.o
lappend cmdline -c
}
lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""]
lappend cmdline $src -o $tmp {*}$opts(-libs)
# At this point we have the complete command line and the
# complete source to be compiled. Get the result from cache if
# we can
if {[info exists ::cc_cache($cmdline,$lines)]} {
msg-checking "(cached) "
set ok $::cc_cache($cmdline,$lines)
if {$::autosetup(debug)} {
configlog "From cache (ok=$ok): [join $cmdline]"
configlog "============"
configlog $lines
configlog "============"
}
return $ok
}
writefile $src $lines\n
set ok 1
set err [catch {exec-with-stderr {*}$cmdline} result errinfo]
if {$err || ($opts(-nooutput) && [string length $result])} {
configlog "Failed: [join $cmdline]"
configlog $result
configlog "============"
configlog "The failed code was:"
configlog $lines
configlog "============"
set ok 0
} elseif {$::autosetup(debug)} {
configlog "Compiled OK: [join $cmdline]"
configlog "============"
configlog $lines
configlog "============"
}
file delete $src
file delete $tmp
# cache it
set ::cc_cache($cmdline,$lines) $ok
return $ok
}
# @make-autoconf-h outfile ?auto-patterns=HAVE_*? ?bare-patterns=SIZEOF_*?
#
# Deprecated - see make-config-header
proc make-autoconf-h {file {autopatterns {HAVE_*}} {barepatterns {SIZEOF_* HAVE_DECL_*}}} {
user-notice "*** make-autoconf-h is deprecated -- use make-config-header instead"
make-config-header $file -auto $autopatterns -bare $barepatterns
}
# @make-config-header outfile ?-auto patternlist? ?-bare patternlist? ?-none patternlist? ?-str patternlist? ...
#
# Examines all defined variables which match the given patterns
# and writes an include file, $file, which defines each of these.
# Variables which match '-auto' are output as follows:
# - defines which have the value "0" are ignored.
# - defines which have integer values are defined as the integer value.
# - any other value is defined as a string, e.g. "value"
# Variables which match '-bare' are defined as-is.
# Variables which match '-str' are defined as a string, e.g. "value"
# Variables which match '-none' are omitted.
#
# Note that order is important. The first pattern which matches is selected
# Default behaviour is:
#
# -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_* -none *
#
# If the file would be unchanged, it is not written.
proc make-config-header {file args} {
set guard _[string toupper [regsub -all {[^a-zA-Z0-9]} [file tail $file] _]]
file mkdir [file dirname $file]
set lines {}
lappend lines "#ifndef $guard"
lappend lines "#define $guard"
# Add some defaults
lappend args -bare {SIZEOF_* HAVE_DECL_*} -auto HAVE_*
foreach n [lsort [dict keys [all-defines]]] {
set value [get-define $n]
set type [calc-define-output-type $n $args]
switch -exact -- $type {
-bare {
# Just output the value unchanged
}
-none {
continue
}
-str {
set value \"[string map [list \\ \\\\ \" \\\"] $value]\"
}
-auto {
# Automatically determine the type
if {$value eq "0"} {
lappend lines "/* #undef $n */"
continue
}
if {![string is integer -strict $value]} {
set value \"[string map [list \\ \\\\ \" \\\"] $value]\"
}
}
"" {
continue
}
default {
autosetup-error "Unknown type in make-config-header: $type"
}
}
lappend lines "#define $n $value"
}
lappend lines "#endif"
set buf [join $lines \n]
write-if-changed $file $buf {
msg-result "Created $file"
}
}
proc calc-define-output-type {name spec} {
foreach {type patterns} $spec {
foreach pattern $patterns {
if {[string match $pattern $name]} {
return $type
}
}
}
return ""
}
# Initialise some values from the environment or commandline or default settings
foreach i {LDFLAGS LIBS CPPFLAGS LINKFLAGS {CFLAGS "-g -O2"}} {
lassign $i var default
define $var [get-env $var $default]
}
if {[env-is-set CC]} {
# Set by the user, so don't try anything else
set try [list [get-env CC ""]]
} else {
# Try some reasonable options
set try [list [get-define cross]cc [get-define cross]gcc]
}
define CC [find-an-executable {*}$try]
if {[get-define CC] eq ""} {
user-error "Could not find a C compiler. Tried: [join $try ", "]"
}
define CPP [get-env CPP "[get-define CC] -E"]
# XXX: Could avoid looking for a C++ compiler until requested
# Note that if CXX isn't found, we just set it to "false". It might not be needed.
if {[env-is-set CXX]} {
define CXX [find-an-executable -required [get-env CXX ""]]
} else {
define CXX [find-an-executable [get-define cross]c++ [get-define cross]g++ false]
}
# CXXFLAGS default to CFLAGS if not specified
define CXXFLAGS [get-env CXXFLAGS [get-define CFLAGS]]
# May need a CC_FOR_BUILD, so look for one
define CC_FOR_BUILD [find-an-executable [get-env CC_FOR_BUILD ""] cc gcc false]
if {[get-define CC] eq ""} {
user-error "Could not find a C compiler. Tried: [join $try ", "]"
}
define CCACHE [find-an-executable [get-env CCACHE ccache]]
# Initial cctest settings
cc-store-settings {-cflags {} -includes {} -declare {} -link 0 -lang c -libs {} -code {} -nooutput 0}
set autosetup(cc-include-deps) {}
msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS]"
if {[get-define CXX] ne "false"} {
msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS]"
}
msg-result "Build C compiler...[get-define CC_FOR_BUILD]"
# On Darwin, we prefer to use -g0 to avoid creating .dSYM directories
# but some compilers may not support it, so test here.
switch -glob -- [get-define host] {
*-*-darwin* {
if {[cctest -cflags {-g0}]} {
define cc-default-debug -g0
}
}
}
if {![cc-check-includes stdlib.h]} {
user-error "Compiler does not work. See config.log"
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 |
###
# codebale.tcl
#
# This file defines routines used to bundle and manage Tcl and C
# code repositories
#
# Copyright (c) 2014 Sean Woods
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
###
#::namespace eval ::codebale {}
# @synopsis:
#
# CODEBALE modules adds autobuild utilities
#
set col 0
use fileutil
###
# topic: e1d75c45e58cc525a0a70ce6f767717c
###
proc codebale_isdirectory name {
return [file isdirectory $name]
}
###
# topic: d0663852b31759ce78f33cbc63379d84
###
proc codebale_istcl name {
return [string match *.tcl $name]
}
###
# topic: ea4ac0a84ae990dafee965b995f48e63
###
proc codebale_istm name {
return [string match *.tm $name]
}
###
# topic: ec0fd469c986351ea0d5a287d6f040d8
###
proc codebale_cases_finalize f {
global col
if {$col>0} {puts $f {}}
set col 0
}
###
# topic: 78728b1f05577d4bc1276e7294ff2cc7
###
proc codebale_cases_generate {prefix cases} {
global col
set col 0
set f [open [file join $::project(path) build [string tolower ${prefix}_cases].h] w]
fconfigure $f -translation crlf
puts $f $::project(standard_header)
puts $f " const static char *${prefix}_strs\[\] = \173"
set lx [lsort $cases]
foreach item $lx {
cases_put $f \"[string tolower $item]\",
}
cases_put $f 0
cases_finalize $f
puts $f " \175;"
puts $f " enum ${prefix}_enum \173"
foreach name $lx {
regsub -all {@} $name {} name
cases_put $f ${prefix}_[string toupper $name],
}
cases_finalize $f
puts $f " \175;"
puts $f "\
int index;
if( objc<2 ){
Tcl_WrongNumArgs(interp, 1, objv, \"METHOD ?ARG ...?\");
return TCL_ERROR;
}
if( Tcl_GetIndexFromObj(interp, objv\[1\], ${prefix}_strs,\
\"option\", 0, &index)){
return TCL_ERROR;
}
switch( (enum ${prefix}_enum)index )"
close $f
}
###
# topic: 545596e62faedfeda638c8bb703882b1
###
proc codebale_cases_put {f x} {
global col
if {$col==0} {puts -nonewline $f " "}
if {$col<2} {
puts -nonewline $f [format " %-21s" $x]
incr col
} else {
puts $f $x
set col 0
}
}
###
# topic: 9dd91e4b98b001260e30671883da494b
# description: Generate function declarations
###
proc codebale_headers_csourcefile file {
###
# Skip huge files
###
if {[file size $file] > 500000} {return {}}
set fin [open $file r]
set dat [read $fin]
close $fin
set result [digest_csource $dat]
set functions {}
if [catch {
foreach {funcname info} [lsort -stride 2 [dictGetnull $result function]] {
dict with info {
if { "static" in $keywords } continue
append functions "$keywords $funcname\([join $arglist ", "]\)\x3b" \n
}
}
} err] {
puts "ERROR Parsing $file: $err"
return "/*
** $file
** Process cancelled because of errors
** $err
** Line number: $::readinglinenumber
** Line: $::readingline
*/
"
}
return $functions
}
###
# topic: c0304a049be6f31206a02d15813720ce
###
proc codebale_meta_output outfile {
set fout [open $outfile w]
puts "SAVING TO $outfile"
#puts $fout "array set filemd5 \x7b"
#array set temp [array get ::filemd5]
#foreach {file md5} [lsort [array names temp]] {
# set md5 $temp($file)
# puts $fout " [list $file $md5]"
#}
#array unset temp
#puts $fout "\x7d"
puts $fout "helpdoc eval {begin transaction}"
helpdoc eval {
select handle,localpath from repository
} {
puts $fout [list ::helpdoc repository_restore $handle [list localpath $localpath]]
}
helpdoc eval {
select hash,fileid from file
} {
puts $fout [helpdoc file_serialize $fileid]
}
puts $fout [helpdoc node_serialize 0]
helpdoc eval {
select entryid from entry
where class='section'
order by name
} {
puts $fout [helpdoc node_serialize $entryid]
}
helpdoc eval {
select entryid from entry
where class!='section'
order by parent,class,name
} {
puts $fout [helpdoc node_serialize $entryid]
}
puts $fout "helpdoc eval {commit}"
close $fout
}
###
# topic: cd6e815c2e68b751656a4c9bbe8918dd
# description: Filters extranous fields from meta data
###
proc codebale_meta_scrub {aliases info} {
foreach {c alist} $aliases {
foreach a $alist {
set canonical($a) $c
}
}
set outfo {}
foreach {field val} $info {
if {[info exists canonical($field)]} {
set cname $canonical($field)
} else {
set cname $field
}
if {$cname eq {}} continue
if {[string length [string trim $val]]} {
dict set outfo $cname $val
}
}
return $outfo
}
###
# topic: 51380132b6f872ed01830e34431931d4
###
proc codebale_pkg_mkIndex base {
set stack {}
if {[file exists [file join $base pkgIndex.tcl]]} {
return
#file delete [file join $base pkgIndex.tcl]
}
set fout [open [file join $base pkgIndex.tcl.new] w]
fconfigure $fout -translation crlf
set result [::codebale_sniffPath $base stack]
puts $fout {# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.
}
while {[llength $stack]} {
set stackpath [lindex $stack 0]
set stack [lrange $stack 1 end]
foreach {type file} [::codebale_sniffPath $stackpath stack] {
lappend result $type $file
}
}
set i [string length $base]
foreach {type file} $result {
switch $type {
module {
set fname [file rootname [file tail $file]]
set package [lindex [split $fname -] 0]
set version [lindex [split $fname -] 1]
set dir [string trimleft [string range [file dirname $file] $i end] /]
puts $fout "package ifneeded $package $version \[list source \[file join \$dir $dir [file tail $file]\]\]"
#::codebale_read_tclsourcefile $file
}
source {
if { $file == "$base/pkgIndex.tcl" } continue
if { $file == "$base/packages.tcl" } continue
if { $file == "$base/main.tcl" } continue
if { [file tail $file] == "version_info.tcl" } continue
set fin [open $file r]
set dat [read $fin]
close $fin
if {[regexp "package provide" $dat]} {
set fname [file rootname [file tail $file]]
set dir [string trimleft [string range [file dirname $file] $i end] /]
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 14] != "package provide" } continue
set package [lindex $line 2]
set version [lindex $line 3]
if { $dir eq {} } {
puts $fout "package ifneeded $package $version \[list source \[file join \$dir [file tail $file]\]\]"
} else {
puts $fout "package ifneeded $package $version \[list source \[file join \$dir $dir [file tail $file]\]\]"
}
break
}
}
#::codebale_read_tclsourcefile $file
}
}
}
close $fout
file rename -force [file join $base pkgIndex.tcl.new] [file join $base pkgIndex.tcl]
}
###
# topic: 924caf1f68529d8dbc329b85e391a1c1
###
proc codebale_pkgindex_manifest base {
set stack {}
set output {}
set base [file-normalize $base]
set i [string length $base]
foreach {file} [fileutil_find $base codebale_istm] {
set file [file-normalize $file]
set fname [file rootname [file tail $file]]
###
# Assume the package is correct in the filename
###
set package [lindex [split $fname -] 0]
set version [lindex [split $fname -] 1]
set path [string trimleft [string range [file dirname $file] $i end] /]
###
# Read the file, and override assumptions as needed
###
set fin [open $file r]
set dat [read $fin]
close $fin
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 9] != "# Package " } continue
set package [lindex $line 2]
set version [lindex $line 3]
break
}
lappend output $package $version
}
foreach {file} [fileutil_find $base codebale_istcl] {
set file [file-normalize $file]
set fin [open $file r]
set dat [read $fin]
close $fin
if {![regexp "package provide" $dat]} continue
set fname [file rootname [file tail $file]]
set dir [string trimleft [string range [file dirname $file] $i end] /]
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 14] != "package provide" } continue
set package [lindex $line 2]
set version [lindex $line 3]
lappend output $package $version
break
}
}
return $output
}
###
# topic: 929629f0ebaa554710f66410dfa51f8a
###
proc codebale_pkgindex_path base {
set stack {}
set buffer {
lappend ::PATHSTACK $dir
}
set base [file-normalize $base]
set i [string length $base]
# Build a list of all of the paths
set paths [fileutil_find $base codebale_isdirectory]
foreach path $paths {
if {$path eq $base} continue
set path_indexed($path) 0
foreach idxname {pkgIndex.tcl} {
if {[file exists [file join $path $idxname]]} {
incr path_indexed($path)
set dir [string trimleft [string range $path $i end] /]
append buffer "
set dir \[file join \[lindex \$::PATHSTACK end\] $dir\] \; source \[file join \[lindex \$::PATHSTACK end\] $dir $idxname\]
"
append buffer \n
}
}
}
foreach path $paths {
if {$path_indexed($path)} continue
foreach file [glob -nocomplain $path/*.tm] {
set file [file-normalize $file]
set fname [file rootname [file tail $file]]
###
# Assume the package is correct in the filename
###
set package [lindex [split $fname -] 0]
set version [lindex [split $fname -] 1]
set path [string trimleft [string range [file dirname $file] $i end] /]
###
# Read the file, and override assumptions as needed
###
set fin [open $file r]
set dat [read $fin]
close $fin
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 9] != "# Package " } continue
set package [lindex $line 2]
set version [lindex $line 3]
break
}
append buffer "package ifneeded $package $version \[list source \[file join \[lindex \$::PATHSTACK end\] $path [file tail $file]\]\]"
append buffer \n
}
foreach file [glob -nocomplain $path/*.tcl] {
set file [file-normalize $file]
if { $file == [file join $base tcl8.6 package.tcl] } continue
if { $file == [file join $base packages.tcl] } continue
if { $file == [file join $base main.tcl] } continue
if { [file tail $file] == "version_info.tcl" } continue
set fin [open $file r]
set dat [read $fin]
close $fin
if {![regexp "package provide" $dat]} continue
set fname [file rootname [file tail $file]]
set dir [string trimleft [string range [file dirname $file] $i end] /]
foreach line [split $dat \n] {
set line [string trim $line]
if { [string range $line 0 14] != "package provide" } continue
set package [lindex $line 2]
set version [lindex $line 3]
append buffer "package ifneeded $package $version \[list source \[file join \[lindex \$::PATHSTACK end\] $dir [file tail $file]\]\]"
append buffer \n
break
}
}
}
append buffer {
set dir [lindex $::PATHSTACK end]
set ::PATHSTACK [lrange $::PATHSTACK 0 end-1]
}
return $buffer
}
###
# topic: 3a00781665184d1efb9e292dbdd1b35c
# title: Read the contents of an rc conf file
# description:
# This style of conf file is assumed to contain lines formatted
# set VARNAME VALUE
###
proc codebale_read_rc_file fname {
if {![file exists $fname]} {
return {}
}
if {![catch {source $fname} err]} {
# Could read as a Tcl file
# Fill the result with the contents of
# all of the local variables defined by
# that file
set vars [info vars]
ldelete vars fname
foreach var $vars {
dict set result $var [set $var]
}
return $result
}
# Parse the file the hard way...
set fin [open $fname r]
set thisline {}
while {[gets $fin line] >= 0} {
set line [string trim $line]
if {[string index $line 0] eq "#"} continue
append thisline \n $line
if {![info complete $thisline]} continue
# Remove leading \n
set thisline [string trimleft $thisline]
if {[string range $line 0 2] == "set"} {
dict set result [lindex $line 1] [lindex $line 2]
} else {
if {[llength $line] eq 2} {
dict set result [lindex $line 0] [lindex $line 1]
}
}
}
return $result
}
###
# topic: cbb00d37108708e5968c8a38f73ec38a
###
proc codebale_read_sh_file {filename {localdat {}}} {
set fin [open $filename r]
set result {}
if {$localdat eq {}} {
set top 1
set local [array get ::env]
dict set local EXE {}
} else {
set top 0
set local $localdat
}
while {[gets $fin line] >= 0} {
set line [string trim $line]
if {[string index $line 0] eq "#"} continue
if {$line eq {}} continue
catch {
if {[string range $line 0 6] eq "export "} {
set eq [string first "=" $line]
set field [string trim [string range $line 6 [expr {$eq - 1}]]]
set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local]
dict set result $field [read_sh_subst $value $local]
dict set local $field $value
} elseif {[string range $line 0 7] eq "include "} {
set subfile [read_sh_subst [string range $line 7 end] $local]
foreach {field value} [read_sh_file $subfile $local] {
dict set result $field $value
}
} else {
set eq [string first "=" $line]
if {$eq > 0} {
set field [read_sh_subst [string range $line 0 [expr {$eq - 1}]] $local]
set value [string trim [string range $line [expr {$eq+1}] end] ']
#set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local]
dict set local $field $value
dict set result $field $value
}
}
} err opts
if {[dict get $opts -code] != 0} {
#puts $opts
puts "Error reading line:\n$line\nerr: $err\n***"
return $err {*}$opts
}
}
return $result
}
###
# topic: 22c2e7ae33fbe0d87784ca9b16df0de4
# description: Converts a XXX.sh file into a series of Tcl variables
###
proc codebale_read_sh_subst {line info} {
regsub -all {\x28} $line \x7B line
regsub -all {\x29} $line \x7D line
#set line [string map $key [string trim $line]]
foreach {field value} $info {
catch {set $field $value}
}
if [catch {subst $line} result] {
return {}
}
set result [string trim $result]
return [string trim $result ']
}
###
# topic: 45a5b1e3f8a8372363f1670642972c62
###
proc codebale_shlib_fname {os pkgname pkgvers} {
if { $os eq "windows" } {
return lib${pkgname}[string map {. {}} ${pkgvers}].dll
} else {
switch $os {
macosx {
set suffix .dylib
}
default {
set suffix .so
}
}
return lib${pkgname}${pkgvers}$suffix
}
}
proc realpath path {
if { !$::odie(windows) } {
return $path
}
if {[string index $path 0] eq "/" && [string index $path 2] eq "/"} {
return [string index $path 1]:[string range $path 2 end]
}
return $path
}
proc cygpath path {
if { !$::odie(windows) } {
return $path
}
if {[string index $path 1] != ":" } {
return $path
}
set path [file-normalize $path]
return /[string tolower [string index $path 0]][string range $path 2 end]
}
proc cygrelative {base filename} {
set base [::cygpath $base]
set filename [::cygpath $filename]
return [::fileutil_relative $base $filename]
}
###
# topic: a5992c7f8340ba02d40e386aac95b1b8
# description: Records an alias for a Tcl keyword
###
proc codebale_alias {alias cname} {
global cnames
set cnames($alias) $cname
}
###
# topic: 0e883f3583c0ccd3eddc6b297ac2ea77
###
proc codebale_buffer_append {varname args} {
upvar 1 $varname result
if {![info exists result]} {
set result {}
}
if {[string length $result]} {
set result [string trimright $result \n]
append result \n
}
set priorarg {}
foreach arg $args {
if {[string length [string trim $arg]]==0} continue
#if {[string match $arg $priorarg]} continue
set priorarg $arg
append result \n [string trim $arg \n] \n
}
set result [string trim $result \n]
append result \n
return $result
}
###
# topic: 926c564aa67884986f7489f37da3fb32
###
proc codebale_buffer_merge args {
set result {}
set priorarg {}
foreach arg $args {
if {[string length [string trim $arg]]==0} continue
if {[string match $arg $priorarg]} continue
set priorarg $arg
append result [string trim $arg \n] \n
}
set result [string trim $result \n]
return $result
}
###
# topic: c1e66f4a20e397a5d2541714575c165f
###
proc codebale_buffer_puts {varname args} {
upvar 1 $varname result
if {![info exists result]} {
set result {}
}
set result [string trimright $result \n]
#if {[string length $result]} {
# set result [string trimright $result \n]
#}
set priorarg {}
foreach arg $args {
#if {[string length [string trim $arg]]==0} continue
#if {[string match $arg $priorarg]} continue
#set priorarg $arg
append result \n $arg
#[string trim $arg \n]
}
#set result [string trim $result \n]
#append result \n
return $result
}
###
# topic: 951f31f2cb24992f34d97e3deb16b43f
# description: Reports back the canonical name of a tcl keyword
###
proc codebale_canonical alias {
global cnames
if {[info exists cnames($alias)]} {
return $cnames($alias)
}
return $alias
}
proc codebale_detect_cases_put_item {f x} {
upvar 1 col col
if {$col==0} {puts -nonewline $f " "}
if {$col<2} {
puts -nonewline $f [format " %-21s" $x]
incr col
} else {
puts $f $x
set col 0
}
}
proc codebale_detect_cases_finalize {f} {
upvar 1 col col
if {$col>0} {puts $f {}}
set col 0
}
###
# topic: aacfe07625f74f93dada2159f53fca32
###
proc codebale_detect_cases cfile {
set dirname [file dirname $cfile]
set fin [open $cfile r]
while {[gets $fin line] >= 0} {
if {[regexp {^ *case *([A-Z]+)_([A-Z0-9_]+):} $line all prefix label]} {
lappend cases($prefix) $label
}
}
close $fin
set col 0
foreach prefix [array names cases] {
set hfile [file join $dirname [string tolower $prefix]_cases.h]
if {[file exists $hfile] && [file mtime $hfile]>[file mtime $cfile]} continue
set f [open $hfile w]
fconfigure $f -translation crlf
puts $f "/*** Automatically Generated Header File - Do Not Edit ***/"
puts $f " const static char *${prefix}_strs\[\] = \173"
set lx [lsort $cases($prefix)]
foreach item $lx {
codebale_detect_cases_put_item $f \"[string tolower $item]\",
}
codebale_detect_cases_put_item $f 0
codebale_detect_cases_finalize $f
puts $f " \175;"
puts $f " enum ${prefix}_enum \173"
foreach name $lx {
regsub -all {@} $name {} name
codebale_detect_cases_put_item $f ${prefix}_[string toupper $name],
}
codebale_detect_cases_finalize $f
puts $f " \175;"
puts $f "\
int index;
if( objc<2 ){
Tcl_WrongNumArgs(interp, 1, objv, \"METHOD ?ARG ...?\");
return TCL_ERROR;
}
if( Tcl_GetIndexFromObj(interp, objv\[1\], ${prefix}_strs,\
\"option\", 0, &index)){
return TCL_ERROR;
}
switch( (enum ${prefix}_enum)index )"
close $f
}
set result {}
foreach item [array names cases] {
lappend result [string tolower ${item}_cases.h]
}
return $result
}
###
# topic: 003ce0c0d69b74076e8433492deac920
# description:
# Descends into a directory structure, returning
# a list of items found in the form of:
# type object
# where type is one of: csource source parent_name
# and object is the full path to the file
###
proc codebale_sniffPath {spath stackvar} {
upvar 1 $stackvar stack
set result {}
if { ![file isdirectory $spath] } {
switch [file extension $spath] {
.tm {
return [list parent_name $spath]
}
.tcl {
return [list source $spath]
}
.h {
return [list cheader $spath]
}
.c {
return [list csource $spath]
}
}
return
}
foreach f [glob -nocomplain $spath/*] {
if {[file isdirectory $f]} {
if {[file tail $f] in {CVS build} } continue
if {[file extension $f] eq ".vfs" } continue
set stack [linsert $stack 0 $f]
}
}
set idx 0
foreach idxtype {
pkgIndex.tcl tclIndex
} {
if {[file exists [file join $spath $idxtype]]} {
lappend result index [file join $spath $idxtype]
}
}
if {[llength $result]} {
return $result
}
foreach f [glob -nocomplain $spath/*] {
if {![file isdirectory $f]} {
set stack [linsert $stack 0 $f]
}
}
return {}
}
# [dictGetnull] is like [dict get] but returns empty string for missing keys.
proc dictGetnull {dictionary args} {
if {[dict exists $dictionary {*}$args]} {
dict get $dictionary {*}$args
}
}
#namespace ensemble configure dict -map [dict replace\
# [namespace ensemble configure dict -map] getnull ::tcl::dict::getnull]
if {[info command ::ldelete] eq {}} {
proc ldelete {varname args} {
upvar 1 $varname var
if ![info exists var] {
return
}
foreach item [lsort -unique $args] {
while {[set i [lsearch $var $item]]>=0} {
set var [lreplace $var $i $i]
}
}
return $var
}
}
###
# topic: 5b6897b1d60450332ff9f389b5ca952d
###
proc doexec args {
exec {*}$args >&@ stdout
}
# Simpler version without the substitution
proc read_Config.sh {filename} {
set fin [open $filename r]
set result {}
while {[gets $fin line] >= 0} {
set line [string trim $line]
if {[string index $line 0] eq "#"} continue
if {$line eq {}} continue
catch {
set eq [string first "=" $line]
if {$eq > 0} {
set field [string range $line 0 [expr {$eq - 1}]]
set value [string trim [string range $line [expr {$eq+1}] end] ']
#set value [read_sh_subst [string range $line [expr {$eq+1}] end] $local]
dict set result $field $value
}
} err opts
if {[dict get $opts -code] != 0} {
#puts $opts
puts "Error reading line:\n$line\nerr: $err\n***"
return $err {*}$opts
}
}
return $result
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 |
# @opt-bool option ...
#
# Check each of the named, boolean options and return 1 if any of them have
# been set by the user.
#
proc opt-bool {args} {
option-check-names {*}$args
opt_bool ::useropts {*}$args
}
# @opt-val option-list ?default=""?
#
# Returns a list containing all the values given for the non-boolean options in 'option-list'.
# There will be one entry in the list for each option given by the user, including if the
# same option was used multiple times.
# If only a single value is required, use something like:
#
## lindex [opt-val $names] end
#
# If no options were set, $default is returned (exactly, not as a list).
#
proc opt-val {names {default ""}} {
option-check-names {*}$names
join [opt_val ::useropts $names $default]
}
proc option-check-names {args} {
foreach o $args {
if {$o ni $::autosetup(options)} {
autosetup-error "Request for undeclared option --$o"
}
}
}
# Parse the option definition in $opts and update
# ::useropts() and ::autosetup(optionhelp) appropriately
#
proc options-add {opts {header ""}} {
global useropts autosetup
# First weed out comment lines
set realopts {}
foreach line [split $opts \n] {
if {![string match "#*" [string trimleft $line]]} {
append realopts $line \n
}
}
set opts $realopts
for {set i 0} {$i < [llength $opts]} {incr i} {
set opt [lindex $opts $i]
if {[string match =* $opt]} {
# This is a special heading
lappend autosetup(optionhelp) $opt ""
set header {}
continue
}
#puts "i=$i, opt=$opt"
regexp {^([^:=]*)(:)?(=)?(.*)$} $opt -> name colon equal value
if {$name in $autosetup(options)} {
autosetup-error "Option $name already specified"
}
#puts "$opt => $name $colon $equal $value"
# Find the corresponding value in the user options
# and set the default if necessary
if {[string match "-*" $opt]} {
# This is a documentation-only option, like "-C <dir>"
set opthelp $opt
} elseif {$colon eq ""} {
# Boolean option
lappend autosetup(options) $name
if {![info exists useropts($name)]} {
set useropts($name) $value
}
if {$value eq "1"} {
set opthelp "--disable-$name"
} else {
set opthelp "--$name"
}
} else {
# String option.
lappend autosetup(options) $name
if {$equal eq "="} {
if {[info exists useropts($name)]} {
# If the user specified the option with no value, the value will be "1"
# Replace with the default
if {$useropts($name) eq "1"} {
set useropts($name) $value
}
}
set opthelp "--$name?=$value?"
} else {
set opthelp "--$name=$value"
}
}
# Now create the help for this option if appropriate
if {[lindex $opts $i+1] eq "=>"} {
set desc [lindex $opts $i+2]
#string match \n* $desc
if {$header ne ""} {
lappend autosetup(optionhelp) $header ""
set header ""
}
# A multi-line description
lappend autosetup(optionhelp) $opthelp $desc
incr i 2
}
}
}
# @module-options optionlist
#
# Like 'options', but used within a module.
proc module-options {opts} {
set header ""
if {$::autosetup(showhelp) > 1 && [llength $opts]} {
set header "Module Options:"
}
options-add $opts $header
if {$::autosetup(showhelp)} {
# Ensure that the module isn't executed on --help
# We are running under eval or source, so use break
# to prevent further execution
#return -code break -level 2
return -code break
}
}
proc max {a b} {
expr {$a > $b ? $a : $b}
}
proc options-wrap-desc {text length firstprefix nextprefix initial} {
set len $initial
set space $firstprefix
foreach word [split $text] {
set word [string trim $word]
if {$word == ""} {
continue
}
if {$len && [string length $space$word] + $len >= $length} {
puts ""
set len 0
set space $nextprefix
}
incr len [string length $space$word]
puts -nonewline $space$word
set space " "
}
if {$len} {
puts ""
}
}
proc options-show {} {
# Determine the max option width
set max 0
foreach {opt desc} $::autosetup(optionhelp) {
if {[string match =* $opt] || [string match \n* $desc]} {
continue
}
set max [max $max [string length $opt]]
}
set indent [string repeat " " [expr $max+4]]
set cols [getenv COLUMNS 80]
catch {
lassign [exec stty size] rows cols
}
incr cols -1
# Now output
foreach {opt desc} $::autosetup(optionhelp) {
if {[string match =* $opt]} {
puts [string range $opt 1 end]
continue
}
puts -nonewline " [format %-${max}s $opt]"
if {[string match \n* $desc]} {
puts $desc
} else {
options-wrap-desc [string trim $desc] $cols " " $indent [expr $max + 2]
}
}
}
# @options options-spec
#
# Specifies configuration-time options which may be selected by the user
# and checked with opt-val and opt-bool. The format of options-spec follows.
#
# A boolean option is of the form:
#
## name[=0|1] => "Description of this boolean option"
#
# The default is name=0, meaning that the option is disabled by default.
# If name=1 is used to make the option enabled by default, the description should reflect
# that with text like "Disable support for ...".
#
# An argument option (one which takes a parameter) is of the form:
#
## name:[=]value => "Description of this option"
#
# If the name:value form is used, the value must be provided with the option (as --name=myvalue).
# If the name:=value form is used, the value is optional and the given value is used as the default
# if is not provided.
#
# Undocumented options are also supported by omitting the "=> description.
# These options are not displayed with --help and can be useful for internal options or as aliases.
#
# For example, --disable-lfs is an alias for --disable=largefile:
#
## lfs=1 largefile=1 => "Disable large file support"
#
proc options {optlist} {
# Allow options as a list or args
options-add $optlist "Local Options:"
if {$::autosetup(showhelp)} {
options-show
exit 0
}
# Check for invalid options
if {[opt-bool option-checking]} {
foreach o [array names ::useropts] {
if {$o ni $::autosetup(options)} {
user-error "Unknown option --$o"
}
}
}
}
proc config_guess {} {
if {[file-isexec $::autosetup(dir)/config.guess]} {
exec-with-stderr sh $::autosetup(dir)/config.guess
if {[catch {exec-with-stderr sh $::autosetup(dir)/config.guess} alias]} {
user-error $alias
}
return $alias
} else {
configlog "No config.guess, so using uname"
string tolower [exec uname -p]-unknown-[exec uname -s][exec uname -r]
}
}
proc config_sub {alias} {
if {[file-isexec $::autosetup(dir)/config.sub]} {
if {[catch {exec-with-stderr sh $::autosetup(dir)/config.sub $alias} alias]} {
user-error $alias
}
}
return $alias
}
# @define name ?value=1?
#
# Defines the named variable to the given value.
# These (name, value) pairs represent the results of the configuration check
# and are available to be checked, modified and substituted.
#
proc define {name {value 1}} {
set ::define($name) $value
#dputs "$name <= $value"
}
# @define-append name value ...
#
# Appends the given value(s) to the given 'defined' variable.
# If the variable is not defined or empty, it is set to $value.
# Otherwise the value is appended, separated by a space.
# Any extra values are similarly appended.
# If any value is already contained in the variable (as a substring) it is omitted.
#
proc define-append {name args} {
if {[get-define $name ""] ne ""} {
# Make a token attempt to avoid duplicates
foreach arg $args {
if {[string first $arg $::define($name)] == -1} {
append ::define($name) " " $arg
}
}
} else {
set ::define($name) [join $args]
}
#dputs "$name += [join $args] => $::define($name)"
}
# @get-define name ?default=0?
#
# Returns the current value of the 'defined' variable, or $default
# if not set.
#
proc get-define {name {default 0}} {
if {[info exists ::define($name)]} {
#dputs "$name => $::define($name)"
return $::define($name)
}
#dputs "$name => $default"
return $default
}
# @is-defined name
#
# Returns 1 if the given variable is defined.
#
proc is-defined {name} {
info exists ::define($name)
}
# @all-defines
#
# Returns a dictionary (name value list) of all defined variables.
#
# This is suitable for use with 'dict', 'array set' or 'foreach'
# and allows for arbitrary processing of the defined variables.
#
proc all-defines {} {
array get ::define
}
# @get-env name default
#
# If $name was specified on the command line, return it.
# If $name was set in the environment, return it.
# Otherwise return $default.
#
proc get-env {name default} {
if {[dict exists $::autosetup(cmdline) $name]} {
return [dict get $::autosetup(cmdline) $name]
}
getenv $name $default
}
# @env-is-set name
#
# Returns 1 if the $name was specified on the command line or in the environment.
# Note that an empty environment variable is not considered to be set.
#
proc env-is-set {name} {
if {[dict exists $::autosetup(cmdline) $name]} {
return 1
}
if {[getenv $name ""] ne ""} {
return 1
}
return 0
}
# @readfile filename ?default=""?
#
# Return the contents of the file, without the trailing newline.
# If the doesn't exist or can't be read, returns $default.
#
proc readfile {filename {default_value ""}} {
set result $default_value
catch {
set f [open $filename]
set result [read -nonewline $f]
close $f
}
return $result
}
# @writefile filename value
#
# Creates the given file containing $value.
# Does not add an extra newline.
#
proc writefile {filename value} {
set f [open $filename w]
puts -nonewline $f $value
close $f
}
proc quote-if-needed {str} {
if {[string match {*[\" ]*} $str]} {
return \"[string map [list \" \\" \\ \\\\] $str]\"
}
return $str
}
proc quote-argv {argv} {
set args {}
foreach arg $argv {
lappend args [quote-if-needed $arg]
}
join $args
}
# @suffix suf list
#
# Takes a list and returns a new list with $suf appended
# to each element
#
## suffix .c {a b c} => {a.c b.c c.c}
#
proc suffix {suf list} {
set result {}
foreach p $list {
lappend result $p$suf
}
return $result
}
# @prefix pre list
#
# Takes a list and returns a new list with $pre prepended
# to each element
#
## prefix jim- {a.c b.c} => {jim-a.c jim-b.c}
#
proc prefix {pre list} {
set result {}
foreach p $list {
lappend result $pre$p
}
return $result
}
# @find-executable name
#
# Searches the path for an executable with the given name.
# Note that the name may include some parameters, e.g. "cc -mbig-endian",
# in which case the parameters are ignored.
# Returns 1 if found, or 0 if not.
#
proc find-executable {name} {
# Ignore any parameters
set name [lindex $name 0]
if {$name eq ""} {
# The empty string is never a valid executable
return 0
}
foreach p [split-path] {
dputs "Looking for $name in $p"
set exec [file join $p $name]
if {[file-isexec $exec]} {
dputs "Found $name -> $exec"
return 1
}
}
return 0
}
# @find-an-executable ?-required? name ...
#
# Given a list of possible executable names,
# searches for one of these on the path.
#
# Returns the name found, or "" if none found.
# If the first parameter is '-required', an error is generated
# if no executable is found.
#
proc find-an-executable {args} {
set required 0
if {[lindex $args 0] eq "-required"} {
set args [lrange $args 1 end]
incr required
}
foreach name $args {
if {[find-executable $name]} {
return $name
}
}
if {$required} {
if {[llength $args] == 1} {
user-error "failed to find: [join $args]"
} else {
user-error "failed to find one of: [join $args]"
}
}
return ""
}
# @configlog msg
#
# Writes the given message to the configuration log, config.log
#
proc configlog {msg} {
if {![info exists ::autosetup(logfh)]} {
set ::autosetup(logfh) [open config.log w]
}
puts $::autosetup(logfh) $msg
}
# @msg-checking msg
#
# Writes the message with no newline to stdout.
#
proc msg-checking {msg} {
if {$::autosetup(msg-quiet) == 0} {
maybe-show-timestamp
puts -nonewline $msg
set ::autosetup(msg-checking) 1
}
}
# @msg-result msg
#
# Writes the message to stdout.
#
proc msg-result {msg} {
if {$::autosetup(msg-quiet) == 0} {
maybe-show-timestamp
puts $msg
set ::autosetup(msg-checking) 0
show-notices
}
}
# @msg-quiet command ...
#
# msg-quiet evaluates it's arguments as a command with output
# from msg-checking and msg-result suppressed.
#
# This is useful if a check needs to run a subcheck which isn't
# of interest to the user.
proc msg-quiet {args} {
incr ::autosetup(msg-quiet)
set rc [uplevel 1 $args]
incr ::autosetup(msg-quiet) -1
return $rc
}
# Will be overridden by 'use misc'
proc error-stacktrace {msg} {
return $msg
}
proc error-location {msg} {
return $msg
}
##################################################################
#
# Debugging output
#
proc dputs {msg} {
if {$::autosetup(debug)} {
puts $msg
}
}
##################################################################
#
# User and system warnings and errors
#
# Usage errors such as wrong command line options
# @user-error msg
#
# Indicate incorrect usage to the user, including if required components
# or features are not found.
# autosetup exits with a non-zero return code.
#
proc user-error {msg} {
show-notices
puts stderr "Error: $msg"
puts stderr "Try: '[file tail $::autosetup(exe)] --help' for options"
exit 1
}
# @user-notice msg
#
# Output the given message to stderr.
#
proc user-notice {msg} {
lappend ::autosetup(notices) $msg
}
# Incorrect usage in the auto.def file. Identify the location.
proc autosetup-error {msg} {
autosetup-full-error [error-location $msg]
}
# Like autosetup-error, except $msg is the full error message.
proc autosetup-full-error {msg} {
show-notices
puts stderr $msg
exit 1
}
proc show-notices {} {
if {$::autosetup(msg-checking)} {
puts ""
set ::autosetup(msg-checking) 0
}
flush stdout
if {[info exists ::autosetup(notices)]} {
puts stderr [join $::autosetup(notices) \n]
unset ::autosetup(notices)
}
}
proc maybe-show-timestamp {} {
if {$::autosetup(msg-timing) && $::autosetup(msg-checking) == 0} {
puts -nonewline [format {[%6.2f] } [expr {([clock millis] - $::autosetup(start)) % 10000 / 1000.0}]]
}
}
proc autosetup_version {} {
return "autosetup v$::autosetup(version)"
}
##################################################################
#
# Directory/path handling
#
proc realdir {dir} {
set oldpwd [pwd]
cd $dir
set pwd [pwd]
cd $oldpwd
return $pwd
}
# Follow symlinks until we get to something which is not a symlink
proc realpath {path} {
while {1} {
if {[catch {
set path [file readlink $path]
}]} {
# Not a link
break
}
}
return $path
}
# Convert absolute path, $path into a path relative
# to the given directory (or the current dir, if not given).
#
proc relative-path {path {pwd {}}} {
set diff 0
set same 0
set newf {}
set prefix {}
set path [file-normalize $path]
if {$pwd eq ""} {
set pwd [pwd]
} else {
set pwd [file-normalize $pwd]
}
if {$path eq $pwd} {
return .
}
# Try to make the filename relative to the current dir
foreach p [split $pwd /] f [split $path /] {
if {$p ne $f} {
incr diff
} elseif {!$diff} {
incr same
}
if {$diff} {
if {$p ne ""} {
# Add .. for sibling or parent dir
lappend prefix ..
}
if {$f ne ""} {
lappend newf $f
}
}
}
if {$same == 1 || [llength $prefix] > 3} {
return $path
}
file join [join $prefix /] [join $newf /]
}
# Add filename as a dependency to rerun autosetup
# The name will be normalised (converted to a full path)
#
proc autosetup_add_dep {filename} {
lappend ::autosetup(deps) [file-normalize $filename]
}
##################################################################
#
# Library module support
#
# @use module ...
#
# Load the given library modules.
# e.g. 'use cc cc-shared'
#
# Note that module 'X' is implemented in either 'autosetup/X.tcl'
# or 'autosetup/X/init.tcl'
#
# The latter form is useful for a complex module which requires additional
# support file. In this form, '$::usedir' is set to the module directory
# when it is loaded.
#
proc use {args} {
foreach m $args {
if {[info exists ::libmodule($m)]} {
continue
}
set ::libmodule($m) 1
if {[info exists ::modsource($m)]} {
automf_load eval $::modsource($m)
} else {
set sources [list $::autosetup(libdir)/${m}.tcl $::autosetup(libdir)/${m}/init.tcl]
set found 0
foreach source $sources {
if {[file exists $source]} {
incr found
break
}
}
if {$found} {
# For the convenience of the "use" source, point to the directory
# it is being loaded from
set ::usedir [file dirname $source]
automf_load source $source
autosetup_add_dep $source
} else {
autosetup-error "use: No such module: $m"
}
}
}
}
# Load module source in the global scope by executing the given command
proc automf_load {args} {
if {[catch [list uplevel #0 $args] msg opts] ni {0 2 3}} {
autosetup-full-error [error-dump $msg $opts $::autosetup(debug)]
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
###
# Utilities for automating the build process of C extensions
###
use codebale
# @synopsis:
#
# CTHULHU modules adds autobuild utilities
#
#::namespace eval ::cthulhu {}
###
# title: define which modules the source we are adding contributes to
###
proc cthulhu_config args {
set ::cthulhu_config [dict merge $::cthulhu_config $args]
}
###
# topic: 9c0c2d73c1afa8ef83a739c5d01309d0
# title: Signal for a C header to be read with mkhdr
###
proc cthulhu_add_cheader {filename {trace 0}} {
set hfilename [::cygrelative $::project(srcdir) $filename]
if {$hfilename in $::project(headers_verbatim)} {
return
}
if {$hfilename ni $::project(headers)} {
lappend ::project(headers) $hfilename
#::cthulhu_read_csourcefile $file
}
}
###
# topic: c52ea7e1ff44f11f960d99a55e4ab998
# title: Add the contents of a header file verbatim to the internal headers and public headers
###
proc cthulhu_add_cheader_verbatim {filename {trace 0}} {
set hfilename [::cygrelative $::project(srcdir) $filename]
ldelete ::project(headers) $hfilename
if {$hfilename ni $::project(headers_verbatim)} {
lappend ::project(headers_verbatim) $hfilename
}
}
###
# topic: 91e4d7da8dd82d78af41561360deab10
# title: Signal for a C source to be read with mkhdr
###
proc cthulhu_add_csource {filename {cmdconfig {}}} {
set config [dict merge $::cthulhu_config $cmdconfig]
set cfilename [::cygrelative $::project(srcdir) $filename]
dict set ::thesources $cfilename $config
if {$cfilename ni $::project(sources)} {
lappend ::project(sources) $cfilename
}
if {[string is true [dictGetnull $config scan]]} {
if {$cfilename ni $::project(scanlist)} {
lappend ::project(scanlist) $cfilename
}
}
}
###
# topic: f11da5f705442524715e8f8fe9af5276
# title: Add a path containing C code
###
proc cthulhu_add_directory {here {cmdconfig {}}} {
set config [dict merge {
cthulhu-ignore-hfiles {}
cthulhu-ignore-cfiles {}
build-ignore-cfiles {}
cthulhu-trace-cfiles {}
} $::cthulhu_config $cmdconfig]
dict with config {}
set here [::realpath $here]
###
# Execute any .tcl scripts in the generic directory
###
foreach file [lsort [glob -nocomplain [file join $here *.tcl]]] {
if {[file tail $file] eq "pkgIndex.tcl"} continue
cd $here
uplevel #0 [list source $file]
}
###
# Build a list of all public header files that
# need to be amalgamated into the publicly exported
# version
###
foreach file [lsort [glob -nocomplain [file join $here *.h]]] {
cthulhu_include_directory $here
set fname [file tail $file]
if {${cthulhu-ignore-hfiles} eq "*"} continue
if { $fname in ${cthulhu-ignore-hfiles} } continue
if {[string match *_cases.h $fname]} continue
cthulhu_add_cheader $file
}
foreach file [lsort [glob -nocomplain [file join $here *.c]]] {
if {[file tail $file] in ${build-ignore-cfiles} } continue
cthulhu_add_csource $file
}
}
proc cthulhu_include_directory {here} {
if { $here ni $::project(include_paths) } {
lappend ::project(include_paths) $here
}
}
###
# topic: 1d3a911fd58337df92205759a6d092c3
# title: Add a source file in Tcl that produces a C file
###
proc cthulhu_add_dynamic {csource tclscript} {
set cfilename [::cygrelative $::project(srcdir) $csource]
set tclfilename [::cygrelative $::project(srcdir) $tclscript]
dict set ::thesources $cfilename tclscript $tclfilename
}
###
# topic: d10665e8da4dd0781bb0a9ced5486e40
# title: Add a pure-tcl library
###
proc cthulhu_add_library {here {cmdconfig {}}} {
set config [dict merge {
cthulhu-ignore-tclfiles {}
} $::cthulhu_config $cmdconfig]
dict with config {}
set here [::realpath $here]
foreach file [lsort [glob -nocomplain $here/*.tcl]] {
if {[file tail $file] in ${cthulhu-ignore-tclfiles}} continue
set libfilename [::cygrelative $::project(srcdir) $libfilename]
}
}
###
# topic: ccfe65b26705afc498e08d3004031066
# title: Detect where we need to produce a _cases.h file to automate a C source
###
proc cthulhu_detect_cases filename {
set cfilename [::cygrelative $::project(srcdir) $filename]
set cases [codebale_detect_cases $filename]
if {![llength $cases]} return
set dirname [file dirname $cfilename]
foreach case $cases {
lappend result [file join $dirname $case]
}
dict set ::thesources $cfilename cases $result
}
###
# topic: 41d95037e5a1cab76939150efdef8939
# title: Declare an end to modifications of ::project
# description:
# This directive is placed after the last set ::project(X) Y
# but before the first ::cthulhu_add_*
###
proc cthulhu_init args {
set ::cthulhu_config [dict merge {
target pkg
} $args]
set ::project(strlen) [string length $::project(path)/]
set ::project(cases) {}
set ::project(sources) {}
set ::project(headers) {}
set ::project(scanlist) {}
set ::project(headers_verbatim) {}
}
###
# topic: 17c9931c3ec5ba115efafaaaa3cf61ed
###
proc cthulhu_mk_lib_init.c outfile {
global project cout
set cout [open $outfile w]
fconfigure $cout -translation crlf
puts $cout $::project(standard_header)
puts $cout "#include \"$::project(h_file_int)\""
puts $cout "
extern int DLLEXPORT ${project(init_funct)}( Tcl_Interp *interp ) \{
Tcl_Namespace *modPtr\;
"
puts $cout {
/* Initialise the stubs tables. */
#ifdef USE_TCL_STUBS
if (
!Tcl_InitStubs(interp, "8.3", 0)
) {
return TCL_ERROR;
}
#endif
}
foreach module $::project(modules) {
puts $cout " if(${module}(interp)) return TCL_ERROR\;"
}
foreach {nspace cmds} [lsort -stride 2 -dictionary [array get namespace_commands]] {
puts $cout "
modPtr=Tcl_FindNamespace(interp,\"$nspace\",NULL,TCL_NAMESPACE_ONLY)\;
if(!modPtr) {
modPtr = Tcl_CreateNamespace(interp, \"$nspace\", NULL, NULL);
}
"
foreach {command cfunct} [lsort -stride 2 -dictionary $cmds] {
puts $cout " Tcl_CreateObjCommand(interp,\"::${nspace}::${command}\",(Tcl_ObjCmdProc *)$cfunct,NULL,NULL);"
}
puts $cout {
Tcl_CreateEnsemble(interp, modPtr->fullName, modPtr, TCL_ENSEMBLE_PREFIX);
Tcl_Export(interp, modPtr, "[a-z]*", 1);
}
}
puts $cout {
/* Register the package. */}
puts $cout " if (Tcl_PkgProvide(interp, \"${project(pkgname)}\", \"${project(pkgvers)}\")) return TCL_ERROR\;"
puts $cout " return TCL_OK\;\n\}"
close $cout
}
###
# topic: 17c9931c3ec5ba115efafaaaa3cf61ed
###
proc cthulhu_mk_app_init.c outfile {
global project cout
set cout [open $outfile w]
fconfigure $cout -translation crlf
puts $cout $::project(standard_header)
puts $cout "#include \"$::project(h_file_int)\""
puts $cout "
int ${project(init_funct)}_static( Tcl_Interp *interp ) \{
Tcl_Namespace *modPtr\;
"
foreach module $::project(modules) {
puts $cout "
if(${module}(interp)) \{
return TCL_ERROR\;
\}
"
}
foreach {nspace cmds} [lsort -stride 2 -dictionary [array get namespace_commands]] {
puts $cout "
modPtr=Tcl_FindNamespace(interp,\"$nspace\",NULL,TCL_NAMESPACE_ONLY)\;
if(!modPtr) {
modPtr = Tcl_CreateNamespace(interp, \"$nspace\", NULL, NULL);
}
"
foreach {command cfunct} [lsort -stride 2 -dictionary $cmds] {
puts $cout " Tcl_CreateObjCommand(interp,\"::${nspace}::${command}\",(Tcl_ObjCmdProc *)$cfunct,NULL,NULL);"
}
puts $cout {
Tcl_CreateEnsemble(interp, modPtr->fullName, modPtr, TCL_ENSEMBLE_PREFIX);
Tcl_Export(interp, modPtr, "[a-z]*", 1);
}
}
puts $cout {
/* Register the package. */}
puts $cout " if (Tcl_PkgProvide(interp, \"${project(pkgname)}\", \"${project(pkgvers)}\")) return TCL_ERROR\;"
puts $cout " return TCL_OK\;\n\}"
close $cout
}
###
# topic: 06bca7e2bddebdca69537fc3a9a0735f
###
proc cthulhu_mk_sources {bldpath outfile} {
global project
file mkdir $bldpath
set fout [open $outfile w]
fconfigure $fout -translation crlf
set pkg_sources {}
set pkg_objects {}
foreach {csource} $::project(sources) {
set ofile [file join $bldpath [string trimleft [string map {/ _ .c .o .. {}} $csource] _]]
lappend pkg_sources $csource
lappend pkg_objects $ofile
dict set ::thesources $csource ofile $ofile
}
set ILINE "MYINCLUDES="
foreach ipath $::project(include_paths) {
append ILINE \\\n" -I[::cygrelative $::project(srcdir) $ipath]"
}
puts $fout $ILINE
puts $fout {}
define PKG_OBJECTS [lsort $pkg_objects]
define PKG_SOURCES [lsort $pkg_sources]
#puts $fout "build/$project(c_file):"
#puts $fout "\t\${TCLSH} scripts/cthulhu.tcl\n"
foreach {csource cinfo} $::thesources {
if {[dict exists $cinfo ofile]} {
set ofile [dict get $cinfo ofile]
} else {
set ofile {}
}
set hfiles {}
if {[dict exists $cinfo cases]} {
foreach hfile [dict get $cinfo cases] {
puts $fout "$hfile:"
puts $fout "\t\$(TCLSH_PROG) scripts/mktclopts.tcl $csource\n"
lappend hfiles $hfile
}
}
if {[dict exists $cinfo tclscript]} {
puts $fout "$csource:"
puts $fout "\t\$(TCLSH_PROG) [dict get $cinfo tclscript] $csource\n"
if {$ofile != {}} {
puts $fout "$ofile: $hfiles"
puts $fout "\t\$(COMPILE) [dictGetnull $cinfo extra] \$(MYINCLUDES) -c $csource -o \$@\n"
}
} else {
if {$ofile != {}} {
puts $fout "$ofile: $hfiles"
puts $fout "\t\$(COMPILE) [dictGetnull $cinfo extra] \$(MYINCLUDES) -c $csource -o \$@\n"
}
}
}
close $fout
}
###
# topic: f7eec240dada25d73c1f68a877fa40be
# title: Produce the PROJECT.decls file
# description: Tools for automating the process of building stubs libraries
###
proc cthulhu_mk_stub_decls {pkgname mkhdrfile path} {
set outfile [file join $path/$pkgname.decls]
###
# Build the decls file
###
set fout [open $outfile w]
puts $fout [subst {###
# $outfile
#
# This file was generated by [info script]
###
library $pkgname
interface $pkgname
}]
set fin [open $mkhdrfile r]
set thisline {}
set functcount 0
while {[gets $fin line]>=0} {
append thisline \n $line
if {![info complete $thisline]} continue
set readline $thisline
set thisline {}
set type [lindex $readline 1]
if { $type ne "f" } continue
set infodict [lindex $readline end]
if {![dict exists $infodict definition]} continue
set def [dict get $infodict definition]
set def [string trim $def]
set def [string trimright $def \;]
if {![string match "*STUB_EXPORT*" $def]} continue
puts $fout [list declare [incr functcount] $def]
}
close $fin
close $fout
###
# Build [package]Decls.h
###
set hout [open [file join $path ${pkgname}Decls.h] w]
close $hout
set cout [open [file join $path ${pkgname}StubInit.c] w]
puts $cout [string map [list %pkgname% $pkgname %PkgName% [string totitle $pkgname]] {
#ifndef USE_TCL_STUBS
#define USE_TCL_STUBS
#endif
#undef USE_TCL_STUB_PROCS
#include "tcl.h"
#include "%pkgname%.h"
/*
** Ensure that Tdom_InitStubs is built as an exported symbol. The other stub
** functions should be built as non-exported symbols.
*/
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
%PkgName%Stubs *%pkgname%StubsPtr;
/*
**----------------------------------------------------------------------
**
** %PkgName%_InitStubs --
**
** Checks that the correct version of %PkgName% is loaded and that it
** supports stubs. It then initialises the stub table pointers.
**
** Results:
** The actual version of %PkgName% that satisfies the request, or
** NULL to indicate that an error occurred.
**
** Side effects:
** Sets the stub table pointers.
**
**----------------------------------------------------------------------
*/
char *
%PkgName%_InitStubs (Tcl_Interp *interp, char *version, int exact)
{
char *actualVersion;
actualVersion = Tcl_PkgRequireEx(interp, "%pkgname%", version, exact,
(ClientData *) &%pkgname%StubsPtr);
if (!actualVersion) {
return NULL;
}
if (!%pkgname%StubsPtr) {
Tcl_SetResult(interp,
"This implementation of %PkgName% does not support stubs",
TCL_STATIC);
return NULL;
}
return actualVersion;
}
}]
close $cout
}
###
# topic: ba1d2c7e8eab96029e434d54f917ef5a
###
proc cthulhu_mkhdr_index {hout docfileout} {
global project
set scanlist {}
foreach file $::project(headers) {
lappend scanlist [::realpath [file join $::project(srcdir) $file]]
}
foreach file $::project(scanlist) {
lappend scanlist [::realpath [file join $::project(srcdir) $file]]
}
ldelete scanlist [::realpath $::project(srcdir)/generic/$::project(h_file_int)]
ldelete scanlist [::realpath $::project(srcdir)/generic/$::project(c_file)]
puts "WRITING INTERNAL HEADERS TO $hout"
set fout [open $hout w]
puts $fout "/*
** DO NOT EDIT THIS FILE
** It is automagically generated by scripts/cthulhu.tcl
*/"
fconfigure $fout -translation crlf
foreach file $::project(headers_verbatim) {
puts $fout "/* Verbatim headers */"
set fullname [file join $::project(srcdir) $file]
set type [file type $fullname]
if {$type ne "file"} continue
puts $fout "/*\n *$file \n*/"
set fin [open $fullname r]
puts $fout [read $fin]
close $fin
}
puts $fout "/* FUNCTION DECLARATIONS */"
###
# Do get around platform line breaks, we output to a tmp file
# and concat in Tcl
###
set crscanlist {}
foreach file $scanlist {
set crfile $file.cr[file extension $file]
set rawfin [open $file r]
set rawfout [open $crfile w]
fconfigure $rawfout -translation lf
puts $rawfout [read $rawfin]
close $rawfout
close $rawfin
lappend crscanlist $crfile
}
::cthulhu_mkhdr -h -- {*}$crscanlist > $hout.cr
set rawfin [open $hout.cr r]
puts $fout [read $rawfin]
close $rawfin
file delete $hout.cr
close $fout
::cthulhu_mkhdr -doc -- {*}$scanlist > $docfileout
foreach file $crscanlist {
file delete $file
}
foreach {prefix cases} $::project(cases) {
::codebale_cases_generate $prefix $cases
}
set fin [open $hout r]
while {[gets $fin line]>=0} {
if {[regexp TCL_MODULE $line] || [regexp DLLEXPORT $line]} {
foreach regexp {
{(.*) ([a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)}
{(.*) (\x2a[a-zA-Z_][a-zA-Z0-9_]*) *\((.*)\)}
} {
if {[regexp $regexp $line all keywords funcname arglist]} {
lappend ::project(modules) $funcname
break
}
}
}
}
}
proc cthulhu_find_mkhdr {} {
set exename [lindex [find-an-executable mkhdr] 0]
if {$exename ne {}} {
return [list exec [::realpath $exename]]
}
if {[info exists ::odie(mkhdr)]} {
if {[file exists [::realpath $::odie(mkhdr)]]} {
return [list exec [::realpath $::odie(mkhdr)]]
}
}
doexec $::odie(cc) -o mkhdr.o -c $::odie(src_dir)/scripts/mkhdr.c
doexec $::odie(cc) mkhdr.o -o mkhdr$::odie(exe_suffix)
file copy -force mkhdr$::odie(exe_suffix) [::realpath $::odie(mkhdr)]
return [list exec [::realpath $::odie(mkhdr)]]
error {mkhdr not available}
}
proc cthulhu_mkhdr args {
set cmd [cthulhu_find_mkhdr]
{*}${cmd} {*}$args
}
array set ::project {
include_paths {}
sources {}
tcl_sources {}
modules {}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Copyright (c) 2012 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Auto-load module for 'make' build system integration
use init
autosetup_add_init_type make {Simple "make" build system} {
autosetup_check_create auto.def \
{# Initial auto.def created by 'autosetup --init=make'
use cc
# Add any user options here
options {
}
make-config-header config.h
make-template Makefile.in
}
if {![file exists Makefile.in]} {
puts "Note: I don't see Makefile.in. You will probably need to create one."
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 |
# fileutil.tcl --
#
# Tcl implementations of standard UNIX utilities.
#
# Copyright (c) 1998-2000 by Ajuba Solutions.
# Copyright (c) 2002 by Phil Ehrens <phil@slug.org> (fileType)
# Copyright (c) 2005-2013 by Andreas Kupries <andreas_kupries@users.sourceforge.net>
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: fileutil.tcl,v 1.78 2010/06/17 04:46:19 andreas_kupries Exp $
# @synopsis:
#
# CODEBALE modules adds a jimtcl compadible version of the fileutil package from tcllib
#
package provide cthulhu-fileutil 1.14.8
#namespace eval ::fileutil {
# namespace export \
# find findByPattern cat touch foreachLine \
# jail stripPwd stripN stripPath tempdir tempfile \
# install fileType writeFile appendToFile \
# insertIntoFile removeFromFile replaceInFile \
# updateInPlace test tempdirReset
#}
# ::fileutil_grep --
#
# Implementation of grep. Adapted from the Tcler's Wiki.
#
# Arguments:
# pattern pattern to search for.
# files list of files to search; if NULL, uses stdin.
#
# Results:
# results list of matches
proc fileutil_grep {pattern {files {}}} {
set result [list]
if {[llength $files] == 0} {
# read from stdin
set lnum 0
while {[gets stdin line] >= 0} {
incr lnum
if {[regexp -- $pattern $line]} {
lappend result "${lnum}:${line}"
}
}
} else {
foreach filename $files {
set file [open $filename r]
set lnum 0
while {[gets $file line] >= 0} {
incr lnum
if {[regexp -- $pattern $line]} {
lappend result "${filename}:${lnum}:${line}"
}
}
close $file
}
}
return $result
}
# ::fileutil_find ==
# Below is the core command, which is portable across Tcl versions and
# platforms. Functionality which is common or platform and/or Tcl
# version dependent, has been factored out/ encapsulated into separate
# (small) commands. Only these commands may have multiple variant
# implementations per the available features of the Tcl core /
# platform.
#
# These commands are
#
# FADD - Add path result, performs filtering. Portable!
# GLOBF - Return files in a directory. Tcl version/platform dependent.
# GLOBD - Return dirs in a directory. Tcl version/platform dependent.
# ACCESS - Check directory for accessibility. Tcl version/platform dependent.
proc fileutil_find {{basedir .} {filtercmd {}}} {
set result {}
set filt [string length $filtercmd]
if {[file isfile $basedir]} {
# The base is a file, and therefore only possible result,
# modulo filtering.
fileutil_FADD $basedir
} elseif {[file isdirectory $basedir]} {
# For a directory as base we do an iterative recursion through
# the directory hierarchy starting at the base. We use a queue
# (Tcl list) of directories we have to check. We access it by
# index, and stop when we have reached beyond the end of the
# list. This is faster than removing elements from the be-
# ginning of the list, as that entails copying down a possibly
# large list of directories, making it O(n*n). The index is
# faster, O(n), at the expense of memory. Nothing is deleted
# from the list until we have processed all directories in the
# hierarchy.
#
# We scan each directory at least twice. First for files, then
# for directories. The scans may internally make several
# passes (normal vs hidden files).
#
# Looped directory structures due to symbolic links are
# handled by _fully_ normalizing directory paths and checking
# if we encountered the normalized form before. The array
# 'known' is our cache where we record the known normalized
# paths.
set pending [list $basedir]
set at 0
array set known {}
while {$at < [llength $pending]} {
# Get next directory not yet processed.
set current [lindex $pending $at]
incr at
# Is the directory accessible? Continue if not.
fileutil_ACCESS $current
# Files first, then the sub-directories ...
foreach f [fileutil_GLOBF $current] { fileutil_FADD $f }
foreach f [fileutil_GLOBD $current] {
# Ignore current and parent directory, this needs
# explicit filtering outside of the filter command.
if {
[string equal [file tail $f] "."] ||
[string equal [file tail $f] ".."]
} continue
# Extend result, modulo filtering.
fileutil_FADD $f
# Detection of symlink loops via a portable path
# normalization computing a canonical form of the path
# followed by a check if that canonical form was
# encountered before. If ok, record directory for
# expansion in future iterations.
set norm [fileutil_fullnormalize $f]
if {[info exists known($norm)]} continue
set known($norm) .
lappend pending $f
}
}
} else {
return -code error "$basedir does not exist"
}
return $result
}
# Helper command for fileutil_find. Performs the filtering of the
# result per a filter command for the candidates found by the
# traversal core, see above. This is portable.
proc fileutil_FADD {filename} {
upvar 1 result result filt filt filtercmd filtercmd
if {!$filt} {
lappend result $filename
return
}
set here [pwd]
cd [file dirname $filename]
if {[uplevel 2 [linsert $filtercmd end [file tail $filename]]]} {
lappend result $filename
}
cd $here
return
}
# The next three helper commands for fileutil_find depend strongly on
# the version of Tcl, and partially on the platform.
# 1. The -directory and -types switches were added to glob in Tcl
# 8.3. This means that we have to emulate them for Tcl 8.2.
#
# 2. In Tcl 8.3 using -types f will return only true files, but not
# links to files. This changed in 8.4+ where links to files are
# returned as well. So for 8.3 we have to handle the links
# separately (-types l) and also filter on our own.
# Note that Windows file links are hard links which are reported by
# -types f, but not -types l, so we can optimize that for the two
# platforms.
#
# Note further that we have to handle broken links on our own. They
# are not returned by glob yet we want them in the output.
#
# 3. In Tcl 8.3 we also have a crashing bug in glob (SIGABRT, "stat on
# a known file") when trying to perform 'glob -types {hidden f}' on
# a directory without e'x'ecute permissions. We code around by
# testing if we can cd into the directory (stat might return enough
# information too (mode), but possibly also not portable).
#
# For Tcl 8.2 and 8.4+ glob simply delivers an empty result
# (-nocomplain), without crashing. For them this command is defined
# so that the bytecode compiler removes it from the bytecode.
#
# This bug made the ACCESS helper necessary.
# We code around the problem by testing if we can cd into the
# directory (stat might return enough information too (mode), but
# possibly also not portable).
set tclver [package present Tcl]
puts [list TCL VERSION $tclver]
if {$tclver eq {}} {
# jimTcl emulates a pre-namespace tcl
set tclver 7.8
}
puts [list TCL VERSION $tclver]
###
# Assume an austere environment
# circa 8.2.
# (Ad 1,2,3) We do not have -directory, nor -types. Full emulation required.
###
proc fileutil_ACCESS {args} {}
if {[string equal $::tcl_platform(platform) windows]} {
# Hidden files cannot be handled by Tcl 8.2 in glob. We have
# to punt.
proc fileutil_GLOBF {current} {
set current \\[join [split $current {}] \\]
set res {}
foreach x [glob -nocomplain -- [file join $current *]] {
if {[file isdirectory $x]} continue
if {[catch {file type $x}]} continue
# We have now accepted files, links to files, and
# broken links. We may also have accepted a directory
# as well, if the current path was inaccessible. This
# however will cause 'file type' to throw an error,
# hence the second check.
lappend res $x
}
return $res
}
proc fileutil_GLOBD {current} {
set current \\[join [split $current {}] \\]
set res {}
foreach x [glob -nocomplain -- [file join $current *]] {
if {![file isdirectory $x]} continue
lappend res $x
}
return $res
}
} else {
# Hidden files on Unix are dot-files. We emulate the switch
# '-types hidden' by using an explicit pattern.
proc fileutil_GLOBF {current} {
set current \\[join [split $current {}] \\]
set res {}
foreach x [glob -nocomplain -- [file join $current *] [file join $current .*]] {
if {[file isdirectory $x]} continue
if {[catch {file type $x}]} continue
# We have now accepted files, links to files, and
# broken links. We may also have accepted a directory
# as well, if the current path was inaccessible. This
# however will cause 'file type' to throw an error,
# hence the second check.
lappend res $x
}
return $res
}
proc fileutil_GLOBD {current} {
set current \\[join [split $current {}] \\]
set res {}
foreach x [glob -nocomplain -- $current/* [file join $current .*]] {
if {![file isdirectory $x]} continue
lappend res $x
}
return $res
}
}
# ::fileutil_findByPattern --
#
# Specialization of find. Finds files based on their names,
# which have to match the specified patterns. Options are used
# to specify which type of patterns (regexp-, glob-style) is
# used.
#
# Arguments:
# basedir Directory to start searching from.
# args Options (-glob, -regexp, --) followed by a
# list of patterns to search for.
#
# Results:
# files a list of interesting files.
proc fileutil_findByPattern {basedir args} {
set pos 0
set cmd ::fileutil_FindGlob
foreach a $args {
incr pos
switch -glob -- $a {
-- {break}
-regexp {set cmd ::fileutil_FindRegexp}
-glob {set cmd ::fileutil_FindGlob}
-* {return -code error "Unknown option $a"}
default {incr pos -1 ; break}
}
}
set args [lrange $args $pos end]
if {[llength $args] != 1} {
set pname [lindex [info level 0] 0]
return -code error \
"wrong#args for \"$pname\", should be\
\"$pname basedir ?-regexp|-glob? ?--? patterns\""
}
set patterns [lindex $args 0]
return [find $basedir [list $cmd $patterns]]
}
# ::fileutil_FindRegexp --
#
# Internal helper. Filter command used by 'findByPattern'
# to match files based on regular expressions.
#
# Arguments:
# patterns List of regular expressions to match against.
# filename Name of the file to match against the patterns.
# Results:
# interesting A boolean flag. Set to true if the file
# matches at least one of the patterns.
proc fileutil_FindRegexp {patterns filename} {
foreach p $patterns {
if {[regexp -- $p $filename]} {
return 1
}
}
return 0
}
# ::fileutil_FindGlob --
#
# Internal helper. Filter command used by 'findByPattern'
# to match files based on glob expressions.
#
# Arguments:
# patterns List of glob expressions to match against.
# filename Name of the file to match against the patterns.
# Results:
# interesting A boolean flag. Set to true if the file
# matches at least one of the patterns.
proc fileutil_FindGlob {patterns filename} {
foreach p $patterns {
if {[string match $p $filename]} {
return 1
}
}
return 0
}
# ::fileutil_stripPwd --
#
# If the specified path references is a path in [pwd] (or [pwd] itself) it
# is made relative to [pwd]. Otherwise it is left unchanged.
# In the case of [pwd] itself the result is the string '.'.
#
# Arguments:
# path path to modify
#
# Results:
# path The (possibly) modified path.
proc fileutil_stripPwd {path} {
# [file split] is used to generate a canonical form for both
# paths, for easy comparison, and also one which is easy to modify
# using list commands.
set pwd [pwd]
if {[string equal $pwd $path]} {
return "."
}
set pwd [file split $pwd]
set npath [file split $path]
if {[string match ${pwd}* $npath]} {
set path [eval [linsert [lrange $npath [llength $pwd] end] 0 file join ]]
}
return $path
}
# ::fileutil_stripN --
#
# Removes N elements from the beginning of the path.
#
# Arguments:
# path path to modify
# n number of elements to strip
#
# Results:
# path The modified path
proc fileutil_stripN {path n} {
set path [file split $path]
if {$n >= [llength $path]} {
return {}
} else {
return [eval [linsert [lrange $path $n end] 0 file join]]
}
}
# ::fileutil_stripPath --
#
# If the specified path references/is a path in prefix (or prefix itself) it
# is made relative to prefix. Otherwise it is left unchanged.
# In the case of it being prefix itself the result is the string '.'.
#
# Arguments:
# prefix prefix to strip from the path.
# path path to modify
#
# Results:
# path The (possibly) modified path.
if {[string equal $::tcl_platform(platform) windows]} {
# Windows. While paths are stored with letter-case preserved al
# comparisons have to be done case-insensitive. For reference see
# SF Tcllib Bug 2499641.
proc fileutil_stripPath {prefix path} {
# [file split] is used to generate a canonical form for both
# paths, for easy comparison, and also one which is easy to modify
# using list commands.
set prefix [file split $prefix]
set npath [file split $path]
if {[string equal -nocase $prefix $npath]} {
return "."
}
if {[string match -nocase "${prefix} *" $npath]} {
set path [eval [linsert [lrange $npath [llength $prefix] end] 0 file join ]]
}
return $path
}
} else {
proc fileutil_stripPath {prefix path} {
# [file split] is used to generate a canonical form for both
# paths, for easy comparison, and also one which is easy to modify
# using list commands.
set prefix [file split $prefix]
set npath [file split $path]
if {[string equal $prefix $npath]} {
return "."
}
if {[string match "${prefix} *" $npath]} {
set path [eval [linsert [lrange $npath [llength $prefix] end] 0 file join ]]
}
return $path
}
}
# ::fileutil_jail --
#
# Ensures that the input path 'filename' stays within the the
# directory 'jail'. In this way it preventsuser-supplied paths
# from escaping the jail.
#
# Arguments:
# jail The path to the directory the other must
# not escape from.
# filename The path to prevent from escaping.
#
# Results:
# path The (possibly) modified path surely within
# the confines of the jail.
proc fileutil_jail {jail filename} {
if {![string equal [file pathtype $filename] "relative"]} {
# Although the path to check is absolute (or volumerelative on
# windows) we cannot perform a simple prefix check to see if
# the path is inside the jail or not. We have to normalize
# both path and jail and then we can check. If the path is
# outside we make the original path relative and prefix it
# with the original jail. We do make the jail pseudo-absolute
# by prefixing it with the current working directory for that.
# Normalized jail. Fully resolved sym links, if any. Our main
# complication is that normalize does not resolve symlinks in the
# last component of the path given to it, so we add a bogus
# component, resolve, and then strip it off again. That is why the
# code is so large and long.
set njail [eval [list file join] [lrange [file split \
[fileutil_Normalize [file join $jail __dummy__]]] 0 end-1]]
# Normalize filename. Fully resolved sym links, if
# any. S.a. for an explanation of the complication.
set nfile [eval [list file join] [lrange [file split \
[fileutil_Normalize [file join $filename __dummy__]]] 0 end-1]]
if {[string match ${njail}* $nfile]} {
return $filename
}
# Outside the jail, put it inside. ... We normalize the input
# path lexically for this, to prevent escapes still lurking in
# the original path. (We cannot use the normalized path,
# symlinks may have bent it out of shape in unrecognizable ways.
return [eval [linsert [lrange [file split \
[fileutil_lexnormalize $filename]] 1 end] 0 file join [pwd] $jail]]
} else {
# The path is relative, consider it as outside
# implicitly. Normalize it lexically! to prevent escapes, then
# put the jail in front, use PWD to ensure absoluteness.
return [eval [linsert [file split [fileutil_lexnormalize $filename]] 0 \
file join [pwd] $jail]]
}
}
# ::fileutil_test --
#
# Simple API to testing various properties of
# a path (read, write, file/dir, existence)
#
# Arguments:
# path path to test
# codes names of the properties to test
# msgvar Name of variable to leave an error
# message in. Optional.
# label Label for error message, optional
#
# Results:
# ok boolean flag, set if the path passes
# all tests.
global test
array set test {
read {readable {Read access is denied}}
write {writable {Write access is denied}}
exec {executable {Is not executable}}
exists {exists {Does not exist}}
file {isfile {Is not a file}}
dir {isdirectory {Is not a directory}}
}
proc fileutil_test {path codes {msgvar {}} {label {}}} {
global test
if {[string equal $msgvar ""]} {
set msg ""
} else {
upvar 1 $msgvar msg
}
if {![string equal $label ""]} {append label { }}
if {![regexp {^(read|write|exec|exists|file|dir)} $codes]} {
# Translate single characters into proper codes
set codes [string map {
r read w write e exists x exec f file d dir
} [split $codes {}]]
}
foreach c $codes {
foreach {cmd text} $test($c) break
if {![file $cmd $path]} {
set msg "$label\"$path\": $text"
return 0
}
}
return 1
}
# ::fileutil_cat --
#
# Tcl implementation of the UNIX "cat" command. Returns the contents
# of the specified files.
#
# Arguments:
# args names of the files to read, interspersed with options
# to set encodings, translations, or eofchar.
#
# Results:
# data data read from the file.
proc fileutil_cat {args} {
# Syntax: (?options? file)+
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
if {![llength $args]} {
# Argument processing stopped with arguments missing.
return -code error \
"wrong#args: should be\
[lindex [info level 0] 0] ?-eofchar|-translation|-encoding arg?+ file ..."
}
# We go through the arguments using foreach and keeping track of
# the index we are at. We do not shift the arguments out to the
# left. That is inherently quadratic, copying everything down.
set opts {}
set mode maybeopt
set channels {}
foreach a $args {
if {[string equal $mode optarg]} {
lappend opts $a
set mode maybeopt
continue
} elseif {[string equal $mode maybeopt]} {
if {[string match -* $a]} {
switch -exact -- $a {
-encoding -
-translation -
-eofchar {
lappend opts $a
set mode optarg
continue
}
-- {
set mode file
continue
}
default {
return -code error \
"Bad option \"$a\",\
expected one of\
-encoding, -eofchar,\
or -translation"
}
}
}
# Not an option, but a file. Change mode and fall through.
set mode file
}
# Process file arguments
if {[string equal $a -]} {
# Stdin reference is special.
# Test that the current options are all ok.
# For stdin we have to avoid closing it.
set old [fconfigure stdin]
set fail [catch {
SetOptions stdin $opts
} msg] ; # {}
SetOptions stdin $old
if {$fail} {
return -code error $msg
}
lappend channels [list $a $opts 0]
} else {
if {![file exists $a]} {
return -code error "Cannot read file \"$a\", does not exist"
} elseif {![file isfile $a]} {
return -code error "Cannot read file \"$a\", is not a file"
} elseif {![file readable $a]} {
return -code error "Cannot read file \"$a\", read access is denied"
}
# Test that the current options are all ok.
set c [open $a r]
set fail [catch {
SetOptions $c $opts
} msg] ; # {}
close $c
if {$fail} {
return -code error $msg
}
lappend channels [list $a $opts [file size $a]]
}
# We may have more options and files coming after.
set mode maybeopt
}
if {![string equal $mode maybeopt]} {
# Argument processing stopped with arguments missing.
return -code error \
"wrong#args: should be\
[lindex [info level 0] 0] ?-eofchar|-translation|-encoding arg?+ file ..."
}
set data ""
foreach c $channels {
foreach {fname opts size} $c break
if {[string equal $fname -]} {
set old [fconfigure stdin]
SetOptions stdin $opts
append data [read stdin]
SetOptions stdin $old
continue
}
set c [open $fname r]
SetOptions $c $opts
if {$size > 0} {
# Used the [file size] command to get the size, which
# preallocates memory, rather than trying to grow it as
# the read progresses.
append data [read $c $size]
} else {
# if the file has zero bytes it is either empty, or
# something where [file size] reports 0 but the file
# actually has data (like the files in the /proc
# filesystem on Linux).
append data [read $c]
}
close $c
}
return $data
}
# ::fileutil_writeFile --
#
# Write the specified data into the named file,
# creating it if necessary.
#
# Arguments:
# options... Options and arguments.
# filename Path to the file to write.
# data The data to write into the file
#
# Results:
# None.
proc fileutil_writeFile {args} {
# Syntax: ?options? file data
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
Spec Writable $args opts fname data
# Now perform the requested operation.
file mkdir [file dirname $fname]
set c [open $fname w]
SetOptions $c $opts
puts -nonewline $c $data
close $c
return
}
# ::fileutil_appendToFile --
#
# Append the specified data at the end of the named file,
# creating it if necessary.
#
# Arguments:
# options... Options and arguments.
# filename Path to the file to extend.
# data The data to extend the file with.
#
# Results:
# None.
proc fileutil_appendToFile {args} {
# Syntax: ?options? file data
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
Spec Writable $args opts fname data
# Now perform the requested operation.
file mkdir [file dirname $fname]
set c [open $fname a]
SetOptions $c $opts
set at [tell $c]
puts -nonewline $c $data
close $c
return $at
}
# ::fileutil_insertIntoFile --
#
# Insert the specified data into the named file,
# creating it if necessary, at the given locaton.
#
# Arguments:
# options... Options and arguments.
# filename Path to the file to extend.
# data The data to extend the file with.
#
# Results:
# None.
proc fileutil_insertIntoFile {args} {
# Syntax: ?options? file at data
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
Spec ReadWritable $args opts fname at data
set max [file size $fname]
CheckLocation $at $max insertion
if {[string length $data] == 0} {
# Another degenerate case, inserting nothing.
# Leave the file well enough alone.
return
}
foreach {c o t} [Open2 $fname $opts] break
# The degenerate cases of both appending and insertion at the
# beginning of the file allow more optimized implementations of
# the operation.
if {$at == 0} {
puts -nonewline $o $data
fcopy $c $o
} elseif {$at == $max} {
fcopy $c $o
puts -nonewline $o $data
} else {
fcopy $c $o -size $at
puts -nonewline $o $data
fcopy $c $o
}
Close2 $fname $t $c $o
return
}
# ::fileutil_removeFromFile --
#
# Remove n characters from the named file,
# starting at the given locaton.
#
# Arguments:
# options... Options and arguments.
# filename Path to the file to extend.
# at Location to start the removal from.
# n Number of characters to remove.
#
# Results:
# None.
proc fileutil_removeFromFile {args} {
# Syntax: ?options? file at n
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
Spec ReadWritable $args opts fname at n
set max [file size $fname]
CheckLocation $at $max removal
CheckLength $n $at $max removal
if {$n == 0} {
# Another degenerate case, removing nothing.
# Leave the file well enough alone.
return
}
foreach {c o t} [Open2 $fname $opts] break
# The degenerate cases of both removal from the beginning or end
# of the file allow more optimized implementations of the
# operation.
if {$at == 0} {
seek $c $n current
fcopy $c $o
} elseif {($at + $n) == $max} {
fcopy $c $o -size $at
# Nothing further to copy.
} else {
fcopy $c $o -size $at
seek $c $n current
fcopy $c $o
}
Close2 $fname $t $c $o
return
}
# ::fileutil_replaceInFile --
#
# Remove n characters from the named file,
# starting at the given locaton, and replace
# it with the given data.
#
# Arguments:
# options... Options and arguments.
# filename Path to the file to extend.
# at Location to start the removal from.
# n Number of characters to remove.
# data The replacement data.
#
# Results:
# None.
proc fileutil_replaceInFile {args} {
# Syntax: ?options? file at n data
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
Spec ReadWritable $args opts fname at n data
set max [file size $fname]
CheckLocation $at $max replacement
CheckLength $n $at $max replacement
if {
($n == 0) &&
([string length $data] == 0)
} {
# Another degenerate case, replacing nothing with
# nothing. Leave the file well enough alone.
return
}
foreach {c o t} [Open2 $fname $opts] break
# Check for degenerate cases and handle them separately,
# i.e. strip the no-op parts out of the general implementation.
if {$at == 0} {
if {$n == 0} {
# Insertion instead of replacement.
puts -nonewline $o $data
fcopy $c $o
} elseif {[string length $data] == 0} {
# Removal instead of replacement.
seek $c $n current
fcopy $c $o
} else {
# General replacement at front.
seek $c $n current
puts -nonewline $o $data
fcopy $c $o
}
} elseif {($at + $n) == $max} {
if {$n == 0} {
# Appending instead of replacement
fcopy $c $o
puts -nonewline $o $data
} elseif {[string length $data] == 0} {
# Truncating instead of replacement
fcopy $c $o -size $at
# Nothing further to copy.
} else {
# General replacement at end
fcopy $c $o -size $at
puts -nonewline $o $data
}
} else {
if {$n == 0} {
# General insertion.
fcopy $c $o -size $at
puts -nonewline $o $data
fcopy $c $o
} elseif {[string length $data] == 0} {
# General removal.
fcopy $c $o -size $at
seek $c $n current
fcopy $c $o
} else {
# General replacement.
fcopy $c $o -size $at
seek $c $n current
puts -nonewline $o $data
fcopy $c $o
}
}
Close2 $fname $t $c $o
return
}
# ::fileutil_updateInPlace --
#
# Run command prefix on the contents of the
# file and replace them with the result of
# the command.
#
# Arguments:
# options... Options and arguments.
# filename Path to the file to extend.
# cmd Command prefix to run.
#
# Results:
# None.
proc fileutil_updateInPlace {args} {
# Syntax: ?options? file cmd
# options = -encoding ENC
# | -translation TRA
# | -eofchar ECH
# | --
Spec ReadWritable $args opts fname cmd
# readFile/cat inlined ...
set c [open $fname r]
SetOptions $c $opts
set data [read $c]
close $c
# Transformation. Abort and do not modify the target file if an
# error was raised during this step.
lappend cmd $data
set code [catch {uplevel 1 $cmd} res]
if {$code} {
return -code $code $res
}
# writeFile inlined, with careful preservation of old contents
# until we are sure that the write was ok.
if {[catch {
file rename -force $fname ${fname}.bak
set o [open $fname w]
SetOptions $o $opts
puts -nonewline $o $res
close $o
file delete -force ${fname}.bak
} msg]} {
if {[file exists ${fname}.bak]} {
catch {
file rename -force ${fname}.bak $fname
}
return -code error $msg
}
}
return
}
proc fileutil_Writable {fname mv} {
upvar 1 $mv msg
if {[file exists $fname]} {
if {![file isfile $fname]} {
set msg "Cannot use file \"$fname\", is not a file"
return 0
} elseif {![file writable $fname]} {
set msg "Cannot use file \"$fname\", write access is denied"
return 0
}
}
return 1
}
proc fileutil_ReadWritable {fname mv} {
upvar 1 $mv msg
if {![file exists $fname]} {
set msg "Cannot use file \"$fname\", does not exist"
return 0
} elseif {![file isfile $fname]} {
set msg "Cannot use file \"$fname\", is not a file"
return 0
} elseif {![file writable $fname]} {
set msg "Cannot use file \"$fname\", write access is denied"
return 0
} elseif {![file readable $fname]} {
set msg "Cannot use file \"$fname\", read access is denied"
return 0
}
return 1
}
proc fileutil_Spec {check alist ov fv args} {
upvar 1 $ov opts $fv fname
set n [llength $args] ; # Num more args
incr n ; # Count path as well
set opts {}
set mode maybeopt
set at 0
foreach a $alist {
if {[string equal $mode optarg]} {
lappend opts $a
set mode maybeopt
incr at
continue
} elseif {[string equal $mode maybeopt]} {
if {[string match -* $a]} {
switch -exact -- $a {
-encoding -
-translation -
-eofchar {
lappend opts $a
set mode optarg
incr at
continue
}
-- {
# Stop processing.
incr at
break
}
default {
return -code error \
"Bad option \"$a\",\
expected one of\
-encoding, -eofchar,\
or -translation"
}
}
}
# Not an option, but a file.
# Stop processing.
break
}
}
if {([llength $alist] - $at) != $n} {
# Argument processing stopped with arguments missing, or too
# many
return -code error \
"wrong#args: should be\
[lindex [info level 1] 0] ?-eofchar|-translation|-encoding arg? file $args"
}
set fname [lindex $alist $at]
incr at
foreach \
var $args \
val [lrange $alist $at end] {
upvar 1 $var A
set A $val
}
# Check given path ...
if {![eval [linsert $check end $a msg]]} {
return -code error $msg
}
return
}
proc fileutil_Open2 {fname opts} {
set c [open $fname r]
set t [tempfile]
set o [open $t w]
SetOptions $c $opts
SetOptions $o $opts
return [list $c $o $t]
}
proc fileutil_Close2 {f temp in out} {
close $in
close $out
file copy -force $f ${f}.bak
file rename -force $temp $f
file delete -force ${f}.bak
return
}
proc fileutil_SetOptions {c opts} {
if {![llength $opts]} return
eval [linsert $opts 0 fconfigure $c]
return
}
proc fileutil_CheckLocation {at max label} {
if {![string is integer -strict $at]} {
return -code error \
"Expected integer but got \"$at\""
} elseif {$at < 0} {
return -code error \
"Bad $label point $at, before start of data"
} elseif {$at > $max} {
return -code error \
"Bad $label point $at, behind end of data"
}
}
proc fileutil_CheckLength {n at max label} {
if {![string is integer -strict $n]} {
return -code error \
"Expected integer but got \"$n\""
} elseif {$n < 0} {
return -code error \
"Bad $label size $n"
} elseif {($at + $n) > $max} {
return -code error \
"Bad $label size $n, going behind end of data"
}
}
# ::fileutil_foreachLine --
#
# Executes a script for every line in a file.
#
# Arguments:
# var name of the variable to contain the lines
# filename name of the file to read.
# cmd The script to execute.
#
# Results:
# None.
proc fileutil_foreachLine {var filename cmd} {
upvar 1 $var line
set fp [open $filename r]
# -future- Use try/eval from tcllib/control
catch {
set code 0
set result {}
while {[gets $fp line] >= 0} {
set code [catch {uplevel 1 $cmd} result]
if {($code != 0) && ($code != 4)} {break}
}
}
close $fp
if {($code == 0) || ($code == 3) || ($code == 4)} {
return $result
}
if {$code == 1} {
global errorCode errorInfo
return \
-code $code \
-errorcode $errorCode \
-errorinfo $errorInfo \
$result
}
return -code $code $result
}
# ::fileutil_fileType --
#
# Do some simple heuristics to determine file type.
#
#
# Arguments:
# filename Name of the file to test.
#
# Results
# type Type of the file. May be a list if multiple tests
# are positive (eg, a file could be both a directory
# and a link). In general, the list proceeds from most
# general (eg, binary) to most specific (eg, gif), so
# the full type for a GIF file would be
# "binary graphic gif"
#
# At present, the following types can be detected:
#
# directory
# empty
# binary
# text
# script <interpreter>
# executable [elf, dos, ne, pe]
# binary graphic [gif, jpeg, png, tiff, bitmap, icns]
# ps, eps, pdf
# html
# xml <doctype>
# message pgp
# compressed [bzip, gzip, zip, tar]
# audio [mpeg, wave]
# gravity_wave_data_frame
# link
# doctools, doctoc, and docidx documentation files.
#
proc fileutil_fileType {filename} {
;## existence test
if { ! [ file exists $filename ] } {
set err "file not found: '$filename'"
return -code error $err
}
;## directory test
if { [ file isdirectory $filename ] } {
set type directory
if { ! [ catch {file readlink $filename} ] } {
lappend type link
}
return $type
}
;## empty file test
if { ! [ file size $filename ] } {
set type empty
if { ! [ catch {file readlink $filename} ] } {
lappend type link
}
return $type
}
set bin_rx {[\x00-\x08\x0b\x0e-\x1f]}
if { [ catch {
set fid [ open $filename r ]
fconfigure $fid -translation binary
fconfigure $fid -buffersize 1024
fconfigure $fid -buffering full
set test [ read $fid 1024 ]
::close $fid
} err ] } {
catch { ::close $fid }
return -code error "::fileutil_fileType: $err"
}
if { [ regexp $bin_rx $test ] } {
set type binary
set binary 1
} else {
set type text
set binary 0
}
# SF Tcllib bug [795585]. Allowing whitespace between #!
# and path of script interpreter
set metakit 0
if { [ regexp {^\#\!\s*(\S+)} $test -> terp ] } {
lappend type script $terp
} elseif {([regexp "\\\[manpage_begin " $test] &&
!([regexp -- {--- !doctools ---} $test] || [regexp -- "!tcl\.tk//DSL doctools//EN//" $test])) ||
([regexp -- {--- doctools ---} $test] || [regexp -- "tcl\.tk//DSL doctools//EN//" $test])} {
lappend type doctools
} elseif {([regexp "\\\[toc_begin " $test] &&
!([regexp -- {--- !doctoc ---} $test] || [regexp -- "!tcl\.tk//DSL doctoc//EN//" $test])) ||
([regexp -- {--- doctoc ---} $test] || [regexp -- "tcl\.tk//DSL doctoc//EN//" $test])} {
lappend type doctoc
} elseif {([regexp "\\\[index_begin " $test] &&
!([regexp -- {--- !docidx ---} $test] || [regexp -- "!tcl\.tk//DSL docidx//EN//" $test])) ||
([regexp -- {--- docidx ---} $test] || [regexp -- "tcl\.tk//DSL docidx//EN//" $test])} {
lappend type docidx
} elseif {[regexp -- "tcl\\.tk//DSL diagram//EN//" $test]} {
lappend type tkdiagram
} elseif { $binary && [ regexp {^[\x7F]ELF} $test ] } {
lappend type executable elf
} elseif { $binary && [string match "MZ*" $test] } {
if { [scan [string index $test 24] %c] < 64 } {
lappend type executable dos
} else {
binary scan [string range $test 60 61] s next
set sig [string range $test $next [expr {$next + 1}]]
if { $sig == "NE" || $sig == "PE" } {
lappend type executable [string tolower $sig]
} else {
lappend type executable dos
}
}
} elseif { $binary && [string match "BZh91AY\&SY*" $test] } {
lappend type compressed bzip
} elseif { $binary && [string match "\x1f\x8b*" $test] } {
lappend type compressed gzip
} elseif { $binary && [string range $test 257 262] == "ustar\x00" } {
lappend type compressed tar
} elseif { $binary && [string match "\x50\x4b\x03\x04*" $test] } {
lappend type compressed zip
} elseif { $binary && [string match "GIF*" $test] } {
lappend type graphic gif
} elseif { $binary && [string match "icns*" $test] } {
lappend type graphic icns bigendian
} elseif { $binary && [string match "snci*" $test] } {
lappend type graphic icns smallendian
} elseif { $binary && [string match "\x89PNG*" $test] } {
lappend type graphic png
} elseif { $binary && [string match "\xFF\xD8\xFF*" $test] } {
binary scan $test x3H2x2a5 marker txt
if { $marker == "e0" && $txt == "JFIF\x00" } {
lappend type graphic jpeg jfif
} elseif { $marker == "e1" && $txt == "Exif\x00" } {
lappend type graphic jpeg exif
}
} elseif { $binary && [string match "MM\x00\**" $test] } {
lappend type graphic tiff
} elseif { $binary && [string match "BM*" $test] && [string range $test 6 9] == "\x00\x00\x00\x00" } {
lappend type graphic bitmap
} elseif { $binary && [string match "\%PDF\-*" $test] } {
lappend type pdf
} elseif { ! $binary && [string match -nocase "*\<html\>*" $test] } {
lappend type html
} elseif { [string match "\%\!PS\-*" $test] } {
lappend type ps
if { [string match "* EPSF\-*" $test] } {
lappend type eps
}
} elseif { [string match -nocase "*\<\?xml*" $test] } {
lappend type xml
if { [ regexp -nocase {\<\!DOCTYPE\s+(\S+)} $test -> doctype ] } {
lappend type $doctype
}
} elseif { [string match {*BEGIN PGP MESSAGE*} $test] } {
lappend type message pgp
} elseif { $binary && [string match {IGWD*} $test] } {
lappend type gravity_wave_data_frame
} elseif {[string match "JL\x1a\x00*" $test] && ([file size $filename] >= 27)} {
lappend type metakit smallendian
set metakit 1
} elseif {[string match "LJ\x1a\x00*" $test] && ([file size $filename] >= 27)} {
lappend type metakit bigendian
set metakit 1
} elseif { $binary && [string match "RIFF*" $test] && [string range $test 8 11] == "WAVE" } {
lappend type audio wave
} elseif { $binary && [string match "ID3*" $test] } {
lappend type audio mpeg
} elseif { $binary && [binary scan $test S tmp] && [expr {$tmp & 0xFFE0}] == 65504 } {
lappend type audio mpeg
}
# Additional checks of file contents at the end of the file,
# possibly pointing into the middle too (attached metakit,
# attached zip).
## Metakit File format: http://www.equi4.com/metakit/metakit-ff.html
## Metakit database attached ? ##
if {!$metakit && ([file size $filename] >= 27)} {
# The offsets in the footer are in always bigendian format
if { [ catch {
set fid [ open $filename r ]
fconfigure $fid -translation binary
fconfigure $fid -buffersize 1024
fconfigure $fid -buffering full
seek $fid -16 end
set test [ read $fid 16 ]
::close $fid
} err ] } {
catch { ::close $fid }
return -code error "::fileutil_fileType: $err"
}
binary scan $test IIII __ hdroffset __ __
set hdroffset [expr {[file size $filename] - 16 - $hdroffset}]
# Further checks iff the offset is actually inside the file.
if {($hdroffset >= 0) && ($hdroffset < [file size $filename])} {
# Seek to the specified location and try to match a metakit header
# at this location.
if { [ catch {
set fid [ open $filename r ]
fconfigure $fid -translation binary
fconfigure $fid -buffersize 1024
fconfigure $fid -buffering full
seek $fid $hdroffset start
set test [ read $fid 16 ]
::close $fid
} err ] } {
catch { ::close $fid }
return -code error "::fileutil_fileType: $err"
}
if {[string match "JL\x1a\x00*" $test]} {
lappend type attached metakit smallendian
set metakit 1
} elseif {[string match "LJ\x1a\x00*" $test]} {
lappend type attached metakit bigendian
set metakit 1
}
}
}
## Zip File Format: http://zziplib.sourceforge.net/zzip-parse.html
## http://www.pkware.com/products/enterprise/white_papers/appnote.html
;## lastly, is it a link?
if { ! [ catch {file readlink $filename} ] } {
lappend type link
}
return $type
}
# ::fileutil_tempdir --
#
# Return the correct directory to use for temporary files.
# Python attempts this sequence, which seems logical:
#
# 1. The directory named by the `TMPDIR' environment variable.
#
# 2. The directory named by the `TEMP' environment variable.
#
# 3. The directory named by the `TMP' environment variable.
#
# 4. A platform-specific location:
# * On Macintosh, the `Temporary Items' folder.
#
# * On Windows, the directories `C:\\TEMP', `C:\\TMP',
# `\\TEMP', and `\\TMP', in that order.
#
# * On all other platforms, the directories `/tmp',
# `/var/tmp', and `/usr/tmp', in that order.
#
# 5. As a last resort, the current working directory.
#
# The code here also does
#
# 0. The directory set by invoking tempdir with an argument.
# If this is present it is used exclusively.
#
# Arguments:
# None.
#
# Side Effects:
# None.
#
# Results:
# The directory for temporary files.
proc fileutil_tempdir {args} {
if {[llength $args] > 1} {
return -code error {wrong#args: should be "::fileutil_tempdir ?path?"}
} elseif {[llength $args] == 1} {
global tempdir
set tempdir [lindex $args 0]
global tempdirSet
set tempdirSet 1
return
}
return [fileutil_Normalize [TempDir]]
}
proc fileutil_tempdirReset {} {
global tempdir
set tempdir {}
global tempdirSet
set tempdirSet 0
return
}
proc fileutil_TempDir {} {
global tcl_platform env tempdir tempdirSet
set attempdirs [list]
set problems {}
if {$tempdirSet} {
lappend attempdirs $tempdir
lappend problems {User/Application specified tempdir}
} else {
foreach tmp {TMPDIR TEMP TMP} {
if { [info exists env($tmp)] } {
lappend attempdirs $env($tmp)
} else {
lappend problems "No environment variable $tmp"
}
}
switch $tcl_platform(platform) {
windows {
lappend attempdirs "C:\\TEMP" "C:\\TMP" "\\TEMP" "\\TMP"
}
macintosh {
lappend attempdirs $env(TRASH_FOLDER) ;# a better place?
}
default {
lappend attempdirs \
[file join / tmp] \
[file join / var tmp] \
[file join / usr tmp]
}
}
lappend attempdirs [pwd]
}
foreach tmp $attempdirs {
if { [file isdirectory $tmp] && [file writable $tmp] } {
return $tmp
} elseif { ![file isdirectory $tmp] } {
lappend problems "Not a directory: $tmp"
} else {
lappend problems "Not writable: $tmp"
}
}
# Fail if nothing worked.
return -code error "Unable to determine a proper directory for temporary files\n[join $problems \n]"
}
set tempdir {}
set tempdirSet 0
# ::fileutil_tempfile --
#
# generate a temporary file name suitable for writing to
# the file name will be unique, writable and will be in the
# appropriate system specific temp directory
# Code taken from http://mini.net/tcl/772 attributed to
# Igor Volobouev and anon.
#
# Arguments:
# prefix - a prefix for the filename, p
# Results:
# returns a file name
#
proc fileutil_tempfile {{prefix {}}} {
return [fileutil_Normalize [TempFile $prefix]]
}
proc fileutil_TempFile {prefix} {
set tmpdir [tempdir]
set chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
set nrand_chars 10
set maxtries 10
set access [list RDWR CREAT EXCL]
set permission 0600
set channel ""
set checked_dir_writable 0
for {set i 0} {$i < $maxtries} {incr i} {
set newname $prefix
for {set j 0} {$j < $nrand_chars} {incr j} {
append newname [string index $chars \
[expr {int(rand()*62)}]]
}
set newname [file join $tmpdir $newname]
if {[catch {open $newname $access $permission} channel]} {
if {!$checked_dir_writable} {
set dirname [file dirname $newname]
if {![file writable $dirname]} {
return -code error "Directory $dirname is not writable"
}
set checked_dir_writable 1
}
} else {
# Success
close $channel
return $newname
}
}
if {[string compare $channel ""]} {
return -code error "Failed to open a temporary file: $channel"
} else {
return -code error "Failed to find an unused temporary file name"
}
}
# ::fileutil_install --
#
# Tcl version of the 'install' command, which copies files from
# one places to another and also optionally sets some attributes
# such as group, owner, and permissions.
#
# Arguments:
# -m Change the file permissions to the specified
# value. Valid arguments are those accepted by
# file attributes -permissions
#
# Results:
# None.
# TODO - add options for group/owner manipulation.
proc fileutil_install {args} {
set options {
{m.arg "" "Set permission mode"}
}
set usage ": [lindex [info level 0] 0]\
\[options] source destination \noptions:"
array set params [::cmdline::getoptions args $options $usage]
# Args should now just be the source and destination.
if { [llength $args] < 2 } {
return -code error $usage
}
set src [lindex $args 0]
set dst [lindex $args 1]
file copy -force $src $dst
if { $params(m) != "" } {
set targets [::fileutil_find $dst]
foreach fl $targets {
file attributes $fl -permissions $params(m)
}
}
}
# ### ### ### ######### ######### #########
proc fileutil_lexnormalize {sp} {
set spx [file split $sp]
# Resolution of embedded relative modifiers (., and ..).
if {
([lsearch -exact $spx . ] < 0) &&
([lsearch -exact $spx ..] < 0)
} {
# Quick path out if there are no relative modifiers
return $sp
}
set absolute [expr {![string equal [file pathtype $sp] relative]}]
# A volumerelative path counts as absolute for our purposes.
set sp $spx
set np {}
set noskip 1
while {[llength $sp]} {
set ele [lindex $sp 0]
set sp [lrange $sp 1 end]
set islast [expr {[llength $sp] == 0}]
if {[string equal $ele ".."]} {
if {
($absolute && ([llength $np] > 1)) ||
(!$absolute && ([llength $np] >= 1))
} {
# .. : Remove the previous element added to the
# new path, if there actually is enough to remove.
set np [lrange $np 0 end-1]
}
} elseif {[string equal $ele "."]} {
# Ignore .'s, they stay at the current location
continue
} else {
# A regular element.
lappend np $ele
}
}
if {[llength $np] > 0} {
return [eval [linsert $np 0 file join]]
# 8.5: return [file join {*}$np]
}
return {}
}
# ### ### ### ######### ######### #########
## Forward compatibility. Some routines require path normalization,
## something we have supported by the builtin 'file' only since Tcl
## 8.4. For versions of Tcl before that, to be supported by the
## module, we implement a normalizer in Tcl itself. Slow, but working.
if {[package vcompare [package provide Tcl] 8.4] < 0} {
# Pre 8.4. We do not have 'file-normalize'. We create an
# approximation for it based on earlier commands.
# ... Hm. This is lexical normalization. It does not resolve
# symlinks in the path to their origin.
proc fileutil_Normalize {sp} {
set sp [file split $sp]
# Conversion of the incoming path to absolute.
if {[string equal [file pathtype [lindex $sp 0]] "relative"]} {
set sp [file split [eval [list file join [pwd]] $sp]]
}
# Resolution of symlink components, and embedded relative
# modifiers (., and ..).
set np {}
set noskip 1
while {[llength $sp]} {
set ele [lindex $sp 0]
set sp [lrange $sp 1 end]
set islast [expr {[llength $sp] == 0}]
if {[string equal $ele ".."]} {
if {[llength $np] > 1} {
# .. : Remove the previous element added to the
# new path, if there actually is enough to remove.
set np [lrange $np 0 end-1]
}
} elseif {[string equal $ele "."]} {
# Ignore .'s, they stay at the current location
continue
} else {
# A regular element. If it is not the last component
# then check if the combination is a symlink, and if
# yes, resolve it.
lappend np $ele
if {!$islast && $noskip} {
# The flag 'noskip' is technically not required,
# just 'file exists'. However if a path P does not
# exist, then all longer paths starting with P can
# not exist either, and using the flag to store
# this knowledge then saves us a number of
# unnecessary stat calls. IOW this a performance
# optimization.
set p [eval file join $np]
set noskip [file exists $p]
if {$noskip} {
if {[string equal link [file type $p]]} {
set dst [file readlink $p]
# We always push the destination in front of
# the source path (in expanded form). So that
# we handle .., .'s, and symlinks inside of
# this path as well. An absolute path clears
# the result, a relative one just removes the
# last, now resolved component.
set sp [eval [linsert [file split $dst] 0 linsert $sp 0]]
if {![string equal relative [file pathtype $dst]]} {
# Absolute|volrelative destination, clear
# result, we have to start over.
set np {}
} else {
# Relative link, just remove the resolved
# component again.
set np [lrange $np 0 end-1]
}
}
}
}
}
}
if {[llength $np] > 0} {
return [eval file join $np]
}
return {}
}
} else {
proc fileutil_Normalize {sp} {
file-normalize $sp
}
}
# ::fileutil_relative --
#
# Taking two _directory_ paths, a base and a destination, computes the path
# of the destination relative to the base.
#
# Arguments:
# base The path to make the destination relative to.
# dst The destination path
#
# Results:
# The path of the destination, relative to the base.
proc fileutil_relative {base dst} {
# Ensure that the link to directory 'dst' is properly done relative to
# the directory 'base'.
if {![string equal [file pathtype $base] [file pathtype $dst]]} {
return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)"
}
set base [fileutil_lexnormalize [file join [pwd] $base]]
set dst [fileutil_lexnormalize [file join [pwd] $dst]]
set save $dst
set base [file split $base]
set dst [file split $dst]
while {[string equal [lindex $dst 0] [lindex $base 0]]} {
set dst [lrange $dst 1 end]
set base [lrange $base 1 end]
if {![llength $dst]} {break}
}
set dstlen [llength $dst]
set baselen [llength $base]
if {($dstlen == 0) && ($baselen == 0)} {
# Cases:
# (a) base == dst
set dst .
} else {
# Cases:
# (b) base is: base/sub = sub
# dst is: base = {}
# (c) base is: base = {}
# dst is: base/sub = sub
while {$baselen > 0} {
set dst [linsert $dst 0 ..]
incr baselen -1
}
# 8.5: set dst [file join {*}$dst]
set dst [eval [linsert $dst 0 file join]]
}
return $dst
}
# ::fileutil_relativeUrl --
#
# Taking two _file_ paths, a base and a destination, computes the path
# of the destination relative to the base, from the inside of the base.
#
# This is how a browser resolves relative links in a file, hence the
# url in the command name.
#
# Arguments:
# base The file path to make the destination relative to.
# dst The destination file path
#
# Results:
# The path of the destination file, relative to the base file.
proc fileutil_relativeUrl {base dst} {
# Like 'relative', but for links from _inside_ a file to a
# different file.
if {![string equal [file pathtype $base] [file pathtype $dst]]} {
return -code error "Unable to compute relation for paths of different pathtypes: [file pathtype $base] vs. [file pathtype $dst], ($base vs. $dst)"
}
set base [fileutil_lexnormalize [file join [pwd] $base]]
set dst [fileutil_lexnormalize [file join [pwd] $dst]]
set basedir [file dirname $base]
set dstdir [file dirname $dst]
set dstdir [relative $basedir $dstdir]
# dstdir == '.' on input => dstdir output has trailing './'. Strip
# this superfluous segment off.
if {[string equal $dstdir "."]} {
return [file tail $dst]
} elseif {[string equal [file tail $dstdir] "."]} {
return [file join [file dirname $dstdir] [file tail $dst]]
} else {
return [file join $dstdir [file tail $dst]]
}
}
# ::fileutil_fullnormalize --
#
# Normalizes a path completely. I.e. a symlink in the last
# element is resolved as well, not only symlinks in the higher
# elements.
#
# Arguments:
# path The path to normalize
#
# Results:
# The input path with all symlinks resolved.
proc fileutil_fullnormalize {path} {
# When encountering symlinks in a file copy operation Tcl copies
# the link, not the contents of the file it references. There are
# situations there this is not acceptable. For these this command
# resolves all symbolic links in the path, including in the last
# element of the path. A "file copy" using the return value of
# this command copies an actual file, it will not encounter
# symlinks.
# BUG / WORKAROUND. Using the / instead of the join seems to work
# around a bug in the path handling on windows which can break the
# core 'file-normalize' for symbolic links. This was exposed by
# the find testsuite which could not reproduced outside. I believe
# that there is some deep path bug in the core triggered under
# special circumstances. Use of / likely forces a refresh through
# the string rep and so avoids the problem with the path intrep.
return [file dirname [fileutil_Normalize $path/__dummy__]]
#return [file dirname [fileutil_Normalize [file join $path __dummy__]]]
}
set tclver [package present Tcl]
if {$tclver ne {} && [package vsatisfies [package present Tcl] 8.5]} {
# Tcl 8.5+.
# We have to check readability of "current" on our own, glob
# changed to error out instead of returning nothing.
proc fileutil_ACCESS {args} {}
proc fileutil_GLOBF {current} {
if {![file readable $current]} {
return {}
}
if {([file type $current] eq "link") &&
!([file exists [file readlink $current]] &&
[file readable [file readlink $current]])} {
return {}
}
set res [lsort -unique [concat \
[glob -nocomplain -directory $current -types f -- *] \
[glob -nocomplain -directory $current -types {hidden f} -- *]]]
# Look for broken links (They are reported as neither file nor directory).
foreach l [lsort -unique [concat \
[glob -nocomplain -directory $current -types l -- *] \
[glob -nocomplain -directory $current -types {hidden l} -- *]]] {
if {[file isfile $l]} continue
if {[file isdirectory $l]} continue
lappend res $l
}
return [lsort -unique $res]
}
proc fileutil_GLOBD {current} {
if {![file readable $current]} {
return {}
}
if {([file type $current] eq "link") &&
!([file exists [file readlink $current]] &&
[file readable [file readlink $current]])} {
return {}
}
lsort -unique [concat \
[glob -nocomplain -directory $current -types d -- *] \
[glob -nocomplain -directory $current -types {hidden d} -- *]]
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module which provides common text formatting
# This is designed for documenation which looks like:
# code {...}
# or
# code {
# ...
# ...
# }
# In the second case, we need to work out the indenting
# and strip it from all lines but preserve the remaining indenting.
# Note that all lines need to be indented with the same initial
# spaces/tabs.
#
# Returns a list of lines with the indenting removed.
#
proc parse_code_block {text} {
# If the text begins with newline, take the following text,
# otherwise just return the original
if {![regexp "^\n(.*)" $text -> text]} {
return [list [string trim $text]]
}
# And trip spaces off the end
set text [string trimright $text]
set min 100
# Examine each line to determine the minimum indent
foreach line [split $text \n] {
if {$line eq ""} {
# Ignore empty lines for the indent calculation
continue
}
regexp "^(\[ \t\]*)" $line -> indent
set len [string length $indent]
if {$len < $min} {
set min $len
}
}
# Now make a list of lines with this indent removed
set lines {}
foreach line [split $text \n] {
lappend lines [string range $line $min end]
}
# Return the result
return $lines
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# Copyright (c) 2006 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Simple getopt module
# Parse everything out of the argv list which looks like an option
# Knows about --enable-thing and --disable-thing as alternatives for --thing=0 or --thing=1
# Everything which doesn't look like an option, or is after --, is left unchanged
proc getopt {argvname} {
upvar $argvname argv
set nargv {}
for {set i 0} {$i < [llength $argv]} {incr i} {
set arg [lindex $argv $i]
#dputs arg=$arg
if {$arg eq "--"} {
# End of options
incr i
lappend nargv {*}[lrange $argv $i end]
break
}
if {[regexp {^--([^=][^=]+)=(.*)$} $arg -> name value]} {
lappend opts($name) $value
} elseif {[regexp {^--(enable-|disable-)?([^=]*)$} $arg -> prefix name]} {
if {$prefix eq "disable-"} {
set value 0
} else {
set value 1
}
lappend opts($name) $value
} else {
lappend nargv $arg
}
}
#puts "getopt: argv=[join $argv] => [join $nargv]"
#parray opts
set argv $nargv
return [array get opts]
}
proc opt_val {optarrayname options {default {}}} {
upvar $optarrayname opts
set result {}
foreach o $options {
if {[info exists opts($o)]} {
lappend result {*}$opts($o)
}
}
if {[llength $result] == 0} {
return $default
}
return $result
}
proc opt_bool {optarrayname args} {
upvar $optarrayname opts
# Support the args being passed as a list
if {[llength $args] == 1} {
set args [lindex $args 0]
}
foreach o $args {
if {[info exists opts($o)]} {
if {"1" in $opts($o) || "yes" in $opts($o)} {
return 1
}
}
}
return 0
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# Copyright (c) 2010 WorkWare Systems http://workware.net.au/
# All rights reserved
# Module which provides usage, help and the command reference
proc autosetup_help {what} {
use_pager
puts "Usage: [file tail $::autosetup(exe)] \[options\] \[settings\]\n"
puts "This is [autosetup_version], a build environment \"autoconfigurator\""
puts "See the documentation online at http://msteveb.github.com/autosetup/\n"
if {$what eq "local"} {
if {[file exists $::autosetup(autodef)]} {
# This relies on auto.def having a call to 'options'
# which will display options and quit
source $::autosetup(autodef)
} else {
options-show
}
} else {
incr ::autosetup(showhelp)
if {[catch {use $what}]} {
user-error "Unknown module: $what"
} else {
options-show
}
}
exit 0
}
# If not already paged and stdout is a tty, pipe the output through the pager
# This is done by reinvoking autosetup with --nopager added
proc use_pager {} {
if {![opt-bool nopager] && [getenv PAGER ""] ne "" && [isatty? stdin] && [isatty? stdout]} {
if {[catch {
exec [info nameofexecutable] $::argv0 --nopager {*}$::argv |& {*}[getenv PAGER] >@stdout <@stdin 2>@stderr
} msg opts] == 1} {
if {[dict get $opts -errorcode] eq "NONE"} {
# an internal/exec error
puts stderr $msg
exit 1
}
}
exit 0
}
}
# Outputs the autosetup references in one of several formats
proc autosetup_reference {{type text}} {
use_pager
switch -glob -- $type {
wiki {use wiki-formatting}
ascii* {use asciidoc-formatting}
md - markdown {use markdown-formatting}
default {use text-formatting}
}
title "[autosetup_version] -- Command Reference"
section {Introduction}
p {
See http://msteveb.github.com/autosetup/ for the online documentation for 'autosetup'
}
p {
'autosetup' provides a number of built-in commands which
are documented below. These may be used from 'auto.def' to test
for features, define variables, create files from templates and
other similar actions.
}
automf_command_reference
exit 0
}
proc autosetup_output_block {type lines} {
if {[llength $lines]} {
switch $type {
code {
codelines $lines
}
p {
p [join $lines]
}
list {
foreach line $lines {
bullet $line
}
nl
}
}
}
}
# Generate a command reference from inline documentation
proc automf_command_reference {} {
lappend files $::autosetup(prog)
lappend files {*}[lsort [glob -nocomplain $::autosetup(libdir)/*.tcl]]
section "Core Commands"
set type p
set lines {}
set cmd {}
foreach file $files {
set f [open $file]
while {![eof $f]} {
set line [gets $f]
# Find lines starting with "# @*" and continuing through the remaining comment lines
if {![regexp {^# @(.*)} $line -> cmd]} {
continue
}
# Synopsis or command?
if {$cmd eq "synopsis:"} {
section "Module: [file rootname [file tail $file]]"
} else {
subsection $cmd
}
set lines {}
set type p
# Now the description
while {![eof $f]} {
set line [gets $f]
if {![regexp {^#(#)? ?(.*)} $line -> hash cmd]} {
break
}
if {$hash eq "#"} {
set t code
} elseif {[regexp {^- (.*)} $cmd -> cmd]} {
set t list
} else {
set t p
}
#puts "hash=$hash, oldhash=$oldhash, lines=[llength $lines], cmd=$cmd"
if {$t ne $type || $cmd eq ""} {
# Finish the current block
autosetup_output_block $type $lines
set lines {}
set type $t
}
if {$cmd ne ""} {
lappend lines $cmd
}
}
autosetup_output_block $type $lines
}
close $f
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module to help create auto.def and configure
proc autosetup_init {type} {
set help 0
if {$type in {? help}} {
incr help
} elseif {![dict exists $::autosetup(inittypes) $type]} {
puts "Unknown type, --init=$type"
incr help
}
if {$help} {
puts "Use one of the following types (e.g. --init=make)\n"
foreach type [lsort [dict keys $::autosetup(inittypes)]] {
lassign [dict get $::autosetup(inittypes) $type] desc
# XXX: Use the options-show code to wrap the description
puts [format "%-10s %s" $type $desc]
}
exit 0
}
lassign [dict get $::autosetup(inittypes) $type] desc script
puts "Initialising $type: $desc\n"
# All initialisations happens in the top level srcdir
cd $::autosetup(srcdir)
uplevel #0 $script
exit 0
}
proc autosetup_add_init_type {type desc script} {
dict set ::autosetup(inittypes) $type [list $desc $script]
}
# This is for in creating build-system init scripts
#
# If the file doesn't exist, create it containing $contents
# If the file does exist, only overwrite if --force is specified.
#
proc autosetup_check_create {filename contents} {
if {[file exists $filename]} {
if {!$::autosetup(force)} {
puts "I see $filename already exists."
return
} else {
puts "I will overwrite the existing $filename because you used --force."
}
} else {
puts "I don't see $filename, so I will create it."
}
writefile $filename $contents
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# Copyright (c) 2006-2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module which can install autosetup
proc autosetup_install {dir} {
if {[catch {
cd $dir
file mkdir autosetup
set f [open autosetup/autosetup w]
set publicmodules $::autosetup(libdir)/default.auto
# First the main script, but only up until "CUT HERE"
set in [open $::autosetup(dir)/autosetup]
while {[gets $in buf] >= 0} {
if {$buf ne "##-- CUT HERE --##"} {
puts $f $buf
continue
}
# Insert the static modules here
# i.e. those which don't contain @synopsis:
puts $f "set autosetup(installed) 1"
set buf [readfile $::autosetup(libdir)/core.tcl]
set modname core
puts $f $buf
puts $f "# ----- module $modname -----"
puts $f "\nset modsource($modname) \{"
puts $f "\}\n"
foreach file [lsort [glob $::autosetup(libdir)/*.tcl]] {
if {[file tail $file] eq "core.tcl"} continue
set buf [readfile $file]
if {[string match "*\n# @synopsis:*" $buf]} {
lappend publicmodules $file
continue
}
set modname [file rootname [file tail $file]]
puts $f "# ----- module $modname -----"
puts $f "\nset modsource($modname) \{"
puts $f $buf
puts $f "\}\n"
}
}
close $in
close $f
exec chmod 755 autosetup/autosetup
# Install public modules
foreach file $publicmodules {
autosetup_install_file $file autosetup
}
# Install support files
foreach file {config.guess config.sub jimsh0.c find-tclsh test-tclsh LICENSE} {
autosetup_install_file $::autosetup(dir)/$file autosetup
}
foreach file [glob -nocomplain $::autosetup(dir)/scripts/*] {
autosetup_install_file $::autosetup(dir)/scripts/[file tail $file] autosetup
}
exec chmod 755 autosetup/config.sub autosetup/config.guess autosetup/find-tclsh
writefile autosetup/README.autosetup \
"This is [autosetup_version]. See http://msteveb.github.com/autosetup/\n"
} error]} {
user-error "Failed to install autosetup: $error"
}
puts "Installed [autosetup_version] to autosetup/"
# Now create 'configure' if necessary
autosetup_create_configure
exit 0
}
proc autosetup_create_configure {} {
if {[file exists configure]} {
if {!$::autosetup(force)} {
# Could this be an autosetup configure?
if {![string match "*\nWRAPPER=*" [readfile configure]]} {
puts "I see configure, but not created by autosetup, so I won't overwrite it."
puts "Remove it or use --force to overwrite."
return
}
} else {
puts "I will overwrite the existing configure because you used --force."
}
} else {
puts "I don't see configure, so I will create it."
}
writefile configure \
{#!/bin/sh
dir="`dirname "$0"`/autosetup"
WRAPPER="$0"; export WRAPPER; exec "`$dir/find-tclsh`" "$dir/autosetup" "$@"
}
catch {exec chmod 755 configure}
}
# Append the contents of $file to filehandle $f
proc autosetup_install_append {f file} {
set in [open $file]
puts $f [read $in]
close $in
}
proc autosetup_install_file {file dir} {
if {![file exists $file]} {
error "Missing installation file '$file'"
}
writefile [file join $dir [file tail $file]] [readfile $file]\n
}
if {$::autosetup(installed)} {
user-error "autosetup can only be installed from development source, not from installed copy"
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module which provides text formatting
# markdown format (kramdown syntax)
use formatting
proc para {text} {
regsub -all "\[ \t\n\]+" [string trim $text] " " text
regsub -all {([^a-zA-Z])'([^']*)'} $text {\1**`\2`**} text
regsub -all {^'([^']*)'} $text {**`\1`**} text
regsub -all {(http[^ \t\n]*)} $text {[\1](\1)} text
return $text
}
proc title {text} {
underline [para $text] =
nl
}
proc p {text} {
puts [para $text]
nl
}
proc codelines {lines} {
puts "~~~~~~~~~~~~"
foreach line $lines {
puts $line
}
puts "~~~~~~~~~~~~"
nl
}
proc code {text} {
puts "~~~~~~~~~~~~"
foreach line [parse_code_block $text] {
puts $line
}
puts "~~~~~~~~~~~~"
nl
}
proc nl {} {
puts ""
}
proc underline {text char} {
regexp "^(\[ \t\]*)(.*)" $text -> indent words
puts $text
puts $indent[string repeat $char [string length $words]]
}
proc section {text} {
underline "[para $text]" -
nl
}
proc subsection {text} {
puts "### `$text`"
nl
}
proc bullet {text} {
puts "* [para $text]"
}
proc defn {first args} {
puts "^"
set defn [string trim [join $args \n]]
if {$first ne ""} {
puts "**${first}**"
puts -nonewline ": "
regsub -all "\n\n" $defn "\n: " defn
}
puts "$defn"
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# Copyright (c) 2007-2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module containing misc procs useful to modules
# Largely for platform compatibility
set autosetup(istcl) [info exists ::tcl_library]
set autosetup(iswin) [string equal windows $tcl_platform(platform)]
if {$autosetup(iswin)} {
# mingw/windows separates $PATH with semicolons
# and doesn't have an executable bit
proc split-path {} {
split [getenv PATH .] {;}
}
proc file-isexec {exec} {
# Basic test for windows. We ignore .bat
if {[file isfile $exec] || [file isfile $exec.exe]} {
return 1
}
return 0
}
} else {
# unix separates $PATH with colons and has and executable bit
proc split-path {} {
split [getenv PATH .] :
}
proc file-isexec {exec} {
file executable $exec
}
}
# Assume that exec can return stdout and stderr
proc exec-with-stderr {args} {
exec {*}$args 2>@1
}
if {$autosetup(istcl)} {
# Tcl doesn't have the env command
proc getenv {name args} {
if {[info exists ::env($name)]} {
return $::env($name)
}
if {[llength $args]} {
return [lindex $args 0]
}
return -code error "environment variable \"$name\" does not exist"
}
proc isatty? {channel} {
dict exists [fconfigure $channel] -xchar
}
} else {
if {$autosetup(iswin)} {
# On Windows, backslash convert all environment variables
# (Assume that Tcl does this for us)
proc getenv {name args} {
string map {\\ /} [env $name {*}$args]
}
} else {
# Jim on unix is simple
alias getenv env
}
proc isatty? {channel} {
set tty 0
catch {
# isatty is a recent addition to Jim Tcl
set tty [$channel isatty]
}
return $tty
}
}
# In case 'file normalize' doesn't exist
#
proc file-normalize {path} {
if {[catch {file normalize $path} result]} {
if {$path eq ""} {
return ""
}
set oldpwd [pwd]
if {[file isdir $path]} {
cd $path
set result [pwd]
} else {
cd [file dirname $path]
set result [file join [pwd] [file tail $path]]
}
cd $oldpwd
}
return $result
}
# If everything is working properly, the only errors which occur
# should be generated in user code (e.g. auto.def).
# By default, we only want to show the error location in user code.
# We use [info frame] to achieve this, but it works differently on Tcl and Jim.
#
# This is designed to be called for incorrect usage in auto.def, via autosetup-error
#
proc error-location {msg} {
if {$::autosetup(debug)} {
return -code error $msg
}
# Search back through the stack trace for the first error in a .def file
for {set i 1} {$i < [info level]} {incr i} {
if {$::autosetup(istcl)} {
array set info [info frame -$i]
} else {
lassign [info frame -$i] info(caller) info(file) info(line)
}
if {[string match *.def $info(file)]} {
return "[relative-path $info(file)]:$info(line): Error: $msg"
}
#puts "Skipping $info(file):$info(line)"
}
return $msg
}
# If everything is working properly, the only errors which occur
# should be generated in user code (e.g. auto.def).
# By default, we only want to show the error location in user code.
# We use [info frame] to achieve this, but it works differently on Tcl and Jim.
#
# This is designed to be called for incorrect usage in auto.def, via autosetup-error
#
proc error-stacktrace {msg} {
if {$::autosetup(debug)} {
return -code error $msg
}
# Search back through the stack trace for the first error in a .def file
for {set i 1} {$i < [info level]} {incr i} {
if {$::autosetup(istcl)} {
array set info [info frame -$i]
} else {
lassign [info frame -$i] info(caller) info(file) info(line)
}
if {[string match *.def $info(file)]} {
return "[relative-path $info(file)]:$info(line): Error: $msg"
}
#puts "Skipping $info(file):$info(line)"
}
return $msg
}
# Given the return from [catch {...} msg opts], returns an appropriate
# error message. A nice one for Jim and a less-nice one for Tcl.
# If 'fulltrace' is set, a full stack trace is provided.
# Otherwise a simple message is provided.
#
# This is designed for developer errors, e.g. in module code or auto.def code
#
#
proc error-dump {msg opts fulltrace} {
if {$::autosetup(istcl)} {
if {$fulltrace} {
return "Error: [dict get $opts -errorinfo]"
} else {
return "Error: $msg"
}
} else {
lassign $opts(-errorinfo) p f l
if {$f ne ""} {
set result "$f:$l: Error: "
}
append result "$msg\n"
if {$fulltrace} {
append result [stackdump $opts(-errorinfo)]
}
# Remove the trailing newline
string trim $result
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 |
# @synopsis:
#
# ODIE modules adds teacup platform data and integration with
# sherpa
#
use system codebale
# Build procs for this modules
options {
nodots => "Suppress dots in version numbers in lib names"
pkgdir: => "Where to install the package (default $prefix/lib)"
shlibver:=0.0 => "Shared lib version"
debugbld => "Debug build: symbols, asserts, etc."
nothreads => "Turn off threads"
static => "Build a static library (default off)"
}
proc odie_tea_init conflist {
array set project $conflist
set nodots [lindex [opt-val nodots] end]
if {$nodots eq {}} {
if {$::odie(windows)} {
set nodots 1
}
} elseif {[string is true -strict $nodots]} {
set nodots 1
} else {
set nodots 0
}
set libver $::project(pkgvers)
lassign [regsub {^(\d)\.(\d)\.\d+$} [package provide Tcl] {\1.\2}] tclver
if {[string is true -strict $nodots]} {
set libver [string map {. ""} $libver]
set tclver [string map {. ""} $tclver]
}
set prefix [get-define prefix]
set pkgdir [lindex [opt-val pkgdir] end]
if { $pkgdir eq {}} {
set pkgdir [file join $prefix lib]
}
define pkgdir $pkgdir
define docdir [file join $prefix share doc]
define exadir [file join $prefix share examples]
define datarootdir [file join $prefix share]
if {[file exists [file join $project(srcdir) .. odie odieConfig.tcl]]} {
source [file join $project(srcdir) .. odie odieConfig.tcl]
} else {
set prefix [get-define prefix]
if {$prefix eq {}} {
foreach path {
/odie
~/odie
c:/odie
/opt/local
/opt/odie
/opt/local/odie
/usr/local/odie
} {
set cffile [file join $path sandbox odie odieConfig.tcl]
if {[file exists $cffile]} {
set prefix [file normalize $path]
source $cffile
break
}
}
}
if {$prefix eq {} } {
error "No Odie detected"
}
if {![file exists [file join $prefix sandbox odie odieConfig.tcl]]} {
error "odieConfig.tcl not found"
}
}
foreach {field} [lsort -dictionary [array names package]] {
define PACKAGE_[string toupper $field] $package($field)
define PKG_[string toupper $field] $package($field)
}
define PKG_NAME $::project(name)
define PKG_VER $::project(pkgvers)
set shlibver [lindex [opt-val shlibver 0.0] end]
define SHLIB_VER $shlibver
if {$shlibver ni {0.0 {}}} {
append shlibspec [format [get-define SH_SOEXTVER] $shlibver]
} else {
set shlibspec [get-define SH_SOEXT]
}
define SHLIB_SPEC $shlibspec
define EXT_INC_SPEC ""
define EXT_LIB_DIR_SPEC ""
define EXT_LIB_SPEC ""
define TCL_INC_SPEC $::odie_tcl(include_spec)
if {"tk" in $project(libs)} {
define TCL_LIB_SPEC "$::odie_tcl(build_stub_lib_spec) $::odie_tk(build_stub_lib_spec)"
} else {
define TCL_LIB_SPEC $::odie_tcl(build_stub_lib_spec)
}
set ::odie_package(name) $::project(pkgname)
set ::odie_package(version) $::project(pkgvers)
set ::odie_package(ver) $::project(pkgvers)
set ::odie_package(libfile) lib${::project(name)}$libver[get-define SHLIB_SPEC]
set ::odie_package(lib_file) $::odie_package(libfile)
if {"tk" in $project(libs)} {
set ::odie_package(libs) $::odie_tk(libs)
} else {
set ::odie_package(libs) $::odie_tcl(libs)
}
foreach lib $project(libs) {
if { $lib in {tcl tk} } continue
if { "-l$lib" ni $::odie_package(libs) } {
lappend ::odie_package(libs) "-l$lib"
}
}
set idx 0
set start 0
set end 0
if {"tk" in $project(libs)} {
set str $::odie_tk(defs)
} else {
set str $::odie_tcl(defs)
}
set len [string length $str]
set token {}
set next {}
set item {}
set opts {}
while {$idx < $len} {
###
# Seek start of opt
###
if {[string range [string trim $item] end-1 end] != "-D"} {
append item [string index $str $idx]
incr idx
} else {
set end [expr {$idx-3}]
set token [string trim [string range $str $start $end]]
lappend opts $token
set item {}
set start $idx
incr idx
}
}
set token [string trim [string range $str $start end]]
lappend opts $token
set defs "-DPACKAGE_NAME=\"$::project(pkgname)\" -DPACKAGE_TARNAME=\"$::project(name)\" -DPACKAGE_VERSION=\"$::project(pkgvers)\" -DPACKAGE_STRING=\"$::project(pkgname) $::project(pkgvers)\""
foreach opt [lrange $opts 4 end] {
append defs " -D$opt"
}
set ::odie_package(defs) $defs
set ::odie_package(cflags) {}
define DEFS $::odie_package(defs)
set cflags { -pipe }
if {[opt-bool debugbld]} {
append cflags {${CFLAGS_DEBUG} ${CFLAGS_WARNING}}
} else {
append cflags {${CFLAGS_DEFAULT} ${CFLAGS_WARNING}}
}
if {[opt-bool static]} {
} else {
append cflags { ${SHLIB_CFLAGS}}
}
define CCFLAGS $cflags
if {[lindex [opt-val nothreads] end] eq "1"} {
define TH_CFLAGS ""
define TH_LIBS ""
define TH_DEFS ""
} else {
define TH_CFLAGS -pthread
define TH_LIBS ""
define TH_DEFS "-DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1"
}
set tdefs {}
lappend tdefs -DUSE_TCL_STUBS=1
if {"tk" in $project(libs)} {
lappend tdefs -DUSE_TK_STUBS=1
}
if {[lindex [opt-val debugbld] end] eq "1"} {
define DEBUG ""
define NDEBUG "#"
lappend tdefs -DTCL_MEM_DEBUG=1
} else {
define DEBUG "#"
define NDEBUG ""
}
define TDEFS [join $tdefs]
set opt_defs {}
define OPT_DEFS [join $opt_defs]
define CCFLAGS $::odie_tcl(extra_cflags)
define CFLAGS_WARN $::odie_tcl(cflags_warning)
define CFLAGS_OPT $::odie_tcl(cflags_optimize)
define CFLAGS_DEBUG $::odie_tcl(cflags_debug)
foreach path $::project(include_paths) {
append ::odie_package(includes) " " -I$path
}
set ::odie_package(headers) $::project(h_file)
foreach {var val} [array get ::odie_package] {
define PACKAGE_[string toupper $var] $val
define PKG_[string toupper $var] $val
}
define LIB lib${::project(name)}$libver[get-define SHLIB_SPEC]
define PKG_LIB lib${::project(name)}$libver[get-define SHLIB_SPEC]
define PKG_TCL_MODULES_ROOT [file join $::project(srcdir) modules]
define PKG_TCL_SOURCES ""
set modules {}
foreach path [glob -nocomplain [file join $::project(srcdir) modules *]] {
if {[file isdirectory $path]} {
lappend modules [file tail $path]
}
}
define PKG_TCL_MODULES $modules
define PKG_LIB_INIT $::project(name)
}
proc odie_mkhdr {} {
###
# Build mkhdr if we don't have it
###
if {![file exists [::realpath $::odie(mkhdr)]]} {
cd [::realpath $::odie(src_dir)]
doexec $::odie(cc) -o mkhdr.o -c scripts/mkhdr.c
doexec $::odie(cc) mkhdr.o -o mkhdr$::odie(exe_suffix)
file copy -force mkhdr$::odie(exe_suffix) [::realpath $::odie(mkhdr)]
}
}
###
# Initialize our picture of the world
###
array set odie_tcl {
config_flags {}
version 8.6
major_version 8
minor_version 6
patch_level .4
fossil_branch release
}
array set odie_tk {
config_flags {}
version 8.6
major_version 8
minor_version 6
patch_level .4
fossil_branch release
}
array set odie {
exe_suffix {}
platform unix
tea_platform_dir unix
tcl_platform_dir unix
tcl_config_flags {}
tk_config_flags {}
64bit {}
windows 0
system generic
target generic
os generic
os_version {}
teacup_cpu generic
teacup_os generic
cpu {}
window_system {}
fossil_checkout .fslckout
teacup_profile {}
tk_binary_platform {}
mirror_url http://fossil.etoyoc.com/fossil
}
# Make sure srcdir is fully qualified!
set ::odie(cpu) [exec uname -m]
set ::odie(os) [exec uname -s]
set ::odie(system) ${::odie(os)}-${::odie(cpu)}
set vfscp {cp -a}
set ::odie(windows) 0
set ::odie(64bit) [expr {$::odie(cpu) in {amd64 x64 x86_64}}]
set ::odie(teacup_cpu) $::odie(cpu)
set ::odie(ld_flags) {}
###
# Sort out some slight differences between Visual studio
# based builds and mingw/cygwin
###
switch -glob -- [get-define build] {
*-*-ming* - *-*-cygwin - *-*-msys {
###
# Under mingw, 64 bit is not possible
###
set ::odie(windows) 1
set ::odie(os) cygwin
set ::odie(64bit) 0
set ::odie(teacup_cpu) ix86
set ::odie(teacup_os) win32
set ::odie(ld_flags) "-static-libgcc -static-libstdc++"
}
*win32* - *WIN32* {
###
# With visual studio, 64 bit should be assumed
# but is otherwise to taste
###
set odie(windows) 1
set ::odie(os) windows
}
}
###
# Build information about the local tools
###
switch -glob -- [string tolower [get-define build]] {
*-*-darwin* {
# Use a native tool
set verdat [exec sw_vers]
foreach line [split $verdat \n] {
if {[lindex $line 0] eq "ProductVersion:"} {
set ::odie(os_version) [lindex $line 1]
}
}
set ::odie(os) macosx
set ::odie(teacup_os) macosx
###
# Detect universal or x86_64
###
set major [lindex [split $::odie(os_version) .] 1]
if { $major < 4 || $::odie(cpu) != "x86_64"} {
set ::odie(teacup_os) macosx
set ::odie(teacup_profile) macosx-universal
set ::odie(cpu) universal
} else {
set ::odie(teacup_os) macosx10.5
set ::odie(teacup_profile) macosx10.5-i386-x86_64
set ::odie(cpu) x86_64
}
set ::odie(tea_platform_dir) macosx
}
*-*-ming* - *-*-cygwin - *-*-msys - *win32* {
###
# With visual studio, 64 bit should be assumed
# but is otherwise to taste
###
set ::odie(platform) windows
set ::odie(system) windows
set ::odie(teacup_os) win32
set vfscp {cp -a --no-preserve=links}
set ::odie(windows) 1
set ::odie(fossil_checkout) _FOSSIL_
set ::odie(tclsrc_dir) win
set ::odie(platform_dir) win
set ::odie(tea_platform_dir) win
set ::odie(tcl_platform_dir) win
if {$::odie(64bit)} {
set ::odie(teacup_profile) win32-ix86
set ::odie(cpu) ix86
} else {
set ::odie(teacup_profile) win32-x86_64
set ::odie(cpu) x86_64
}
set ::odie(exe_suffix) .exe
}
*-*-linux* {
set glibcver [exec ldd --version]
set major [lindex [split $glibcver .] 0]
set minor [lindex [split $glibcver .] 1]
set ::odie(teacup_os) linux-glibc$major.$minor
set ::odie(system) linux-$::odie(cpu)
set ::odie(os) linux
}
}
if {[get-define build] ne [get-define host]} {
set ::odie(windows) 0
###
# Build information about the target
###
switch [get-define host] {
darwin - macosx - macosx10.5-i386-x86_64 {
set ::odie(os) macosx
set ::odie(teacup_os) macosx10.5
set ::odie(teacup_profile) macosx10.5-i386-x86_64
set ::odie(cpu) x86_64
set ::odie(tea_platform_dir) macosx
set ::odie(64bit) 1
}
macosx-universal {
set ::odie(os) macosx
set ::odie(teacup_os) macosx
set ::odie(teacup_profile) macosx-universal
set ::odie(cpu) universal
set ::odie(tea_platform_dir) macosx
}
windows - windows-x86_64 - win32-x86_64 {
set ::odie(platform) windows
set ::odie(system) windows
set ::odie(teacup_os) win32
set ::odie(windows) 1
set ::odie(tclsrc_dir) win
set ::odie(platform_dir) win
set ::odie(64bit) 1
set ::odie(teacup_profile) win32-x86_64
set ::odie(cpu) x86_64
set ::odie(exe_suffix) .exe
}
windows-ix86 - win32-ix86 {
set ::odie(platform) windows
set ::odie(system) windows
set ::odie(teacup_os) win32
set ::odie(windows) 1
set ::odie(tclsrc_dir) win
set ::odie(platform_dir) win
set ::odie(64bit) 0
set ::odie(teacup_profile) win32-ix86
set ::odie(cpu) ix86
set ::odie(exe_suffix) .exe
}
default {
switch -glob -nocase -- [get-define target] {
*macosx* - *-*-darwin* {
# We don't know the version, so punt to
# modern 64bit ix86
set ::odie(os) macosx
set ::odie(teacup_os) macosx10.5
set ::odie(teacup_profile) macosx10.5-i386-x86_64
set ::odie(cpu) x86_64
set ::odie(tea_platform_dir) macosx
}
*-*-ming* - *-*-cygwin - *-*-msys - *win32* {
set ::odie(platform) windows
set ::odie(system) windows
set ::odie(teacup_os) win32
set ::odie(windows) 1
set ::odie(tclsrc_dir) win
set ::odie(platform_dir) win
if {$::odie(64bit)} {
set ::odie(teacup_profile) win32-x86_64
set ::odie(cpu) x86_64
} else {
set ::odie(teacup_profile) win32-ix86
set ::odie(cpu) ix86
}
set ::odie(exe_suffix) .exe
}
*-*-linux* {
# Assume a modern linux found in teacup profiles
set ::odie(teacup_os) linux-glibc2.3
set ::odie(system) linux-$::odie(cpu)
set ::odie(os) linux
}
}
}
}
}
if {$::odie(teacup_profile) eq {}} {
set ::odie(teacup_profile) $::odie(teacup_os)-$::odie(cpu)
}
define VFS_CP $vfscp
if {[opt-val prefix] ne {} || ![info exists ::odie(prefix)]} {
#------------------------------------------------------------------------
# Handle the --prefix=... option
#------------------------------------------------------------------------
set prefix [opt-val prefix]
if { $prefix eq {} } {
if { $::odie(windows) } {
set prefix c:/odie
} else {
set prefix $::env(HOME)/odie
}
}
set ::odie_config(prefix) $prefix
set exec_prefix $prefix
}
set ::odie(prefix) $prefix
define prefix $prefix
define exec_prefix $prefix
###
# Read in tclConfig.sh
###
set pathlist [list ../tcl/$::odie(tcl_platform_dir) ../tk/$::odie(tcl_platform_dir) [file join $prefix lib] /usr/local/lib /opt/local/lib c:/tcl c:/tcl/lib]
foreach {file pre array} {
tclConfig.sh tcl ::odie_tcl
tkConfig.sh tk ::odie_tk
} {
set ${array}(config_found) 0
set l [expr {[string length $pre]+1}]
foreach path $pathlist {
set ffile [file join $path $file]
if {[file exists $ffile]} break
}
if {![file exists $ffile]} continue
set ${array}(config_found) 1
foreach {field dat} [read_Config.sh $ffile] {
set field [string tolower $field]
if {[string match ${pre}_* $field]} {
set field [string range $field $l end]
}
set ${array}($field) $dat
}
}
###
# Figure out Tcl
###
if {$::odie(windows)} {
set ::odie(tcl_shell) [file join $prefix bin tclsh${::odie_tcl(major_version)}${::odie_tcl(minor_version)}.exe]
set ::odie(wish_shell) [file join $prefix bin wish${::odie_tk(major_version)}${::odie_tk(minor_version)}.exe]
set ::odie(tclkit) [file join $prefix bin tclkit${::odie_tcl(major_version)}${::odie_tcl(minor_version)}.exe]
set ::odie(wishkit) [file join $prefix bin tclkit${::odie_tcl(major_version)}${::odie_tcl(minor_version)}.exe]
set ::odie(toadkit) [file join $prefix bin toadkit${::odie_tcl(major_version)}${::odie_tcl(minor_version)}.exe]
} else {
set ::odie(tcl_shell) [file join $prefix bin tclsh${::odie_tcl(major_version)}.${::odie_tcl(minor_version)}]
set ::odie(wish_shell) [file join $prefix bin wish${::odie_tk(major_version)}.${::odie_tk(minor_version)}]
set ::odie(tclkit) [file join $prefix bin tclkit${::odie_tcl(major_version)}.${::odie_tcl(minor_version)}]
set ::odie(wishkit) [file join $prefix bin wishkit${::odie_tcl(major_version)}.${::odie_tcl(minor_version)}]
set ::odie(toadkit) [file join $prefix bin toadkit${::odie_tcl(major_version)}.${::odie_tcl(minor_version)}]
}
define TCL_SHELL $::odie(tcl_shell)
define WISH_SHELL $::odie(wish_shell)
define TCLSH_PROG [info nameofexecutable]
define BUILD_TCLSH [info nameofexecutable]
set ::force_check 0
###
# Under MSYS/Cygwin transform the Cygwinized paths
# pack into proper names for Windows
###
foreach path {
sandbox download src_dir tcl_shell wish_shell build_tclsh
fossil git zip unzip sherpa lib local_repo
} {
if {[info exists ::odie($path)]} {
set ::odie_build($path) [::realpath $::odie($path)]
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# This module supports common system interrogation and options
# such as --host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
#
# It also support the 'feature' naming convention, where searching
# for a feature such as sys/type.h defines HAVE_SYS_TYPES_H
#
module-options {
host:host-alias => {a complete or partial cpu-vendor-opsys for the system where
the application will run (defaults to the same value as --build)}
build:build-alias => {a complete or partial cpu-vendor-opsys for the system
where the application will be built (defaults to the
result of running config.guess)}
prefix:dir => {the target directory for the build (defaults to /usr/local)}
# These (hidden) options are supported for autoconf/automake compatibility
exec-prefix:
bindir:
sbindir:
includedir:
mandir:
infodir:
libexecdir:
datadir:
libdir:
sysconfdir:
sharedstatedir:
localstatedir:
maintainer-mode=0
dependency-tracking=0
}
# Returns 1 if exists, or 0 if not
#
proc check-feature {name code} {
msg-checking "Checking for $name..."
set r [uplevel 1 $code]
define-feature $name $r
if {$r} {
msg-result "ok"
} else {
msg-result "not found"
}
return $r
}
# @have-feature name ?default=0?
#
# Returns the value of the feature if defined, or $default if not.
# See 'feature-define-name' for how the feature name
# is translated into the define name.
#
proc have-feature {name {default 0}} {
get-define [feature-define-name $name] $default
}
# @define-feature name ?value=1?
#
# Sets the feature 'define' to the given value.
# See 'feature-define-name' for how the feature name
# is translated into the define name.
#
proc define-feature {name {value 1}} {
define [feature-define-name $name] $value
}
# @feature-checked name
#
# Returns 1 if the feature has been checked, whether true or not
#
proc feature-checked {name} {
is-defined [feature-define-name $name]
}
# @feature-define-name name ?prefix=HAVE_?
#
# Converts a name to the corresponding define,
# e.g. sys/stat.h becomes HAVE_SYS_STAT_H.
#
# Converts * to P and all non-alphanumeric to underscore.
#
proc feature-define-name {name {prefix HAVE_}} {
string toupper $prefix[regsub -all {[^a-zA-Z0-9]} [regsub -all {[*]} $name p] _]
}
# If $file doesn't exist, or it's contents are different than $buf,
# the file is written and $script is executed.
# Otherwise a "file is unchanged" message is displayed.
proc write-if-changed {file buf {script {}}} {
set old [readfile $file ""]
if {$old eq $buf && [file exists $file]} {
msg-result "$file is unchanged"
} else {
writefile $file $buf\n
uplevel 1 $script
}
}
# @make-template template ?outfile?
#
# Reads the input file <srcdir>/$template and writes the output file $outfile.
# If $outfile is blank/omitted, $template should end with ".in" which
# is removed to create the output file name.
#
# Each pattern of the form @define@ is replaced the the corresponding
# define, if it exists, or left unchanged if not.
#
# The special value @srcdir@ is substituted with the relative
# path to the source directory from the directory where the output
# file is created, while the special value @top_srcdir@ is substituted
# with the relative path to the top level source directory.
#
# Conditional sections may be specified as follows:
## @if name == value
## lines
## @else
## lines
## @endif
#
# Where 'name' is a defined variable name and @else is optional.
# If the expression does not match, all lines through '@endif' are ignored.
#
# The alternative forms may also be used:
## @if name
## @if name != value
#
# Where the first form is true if the variable is defined, but not empty or 0
#
# Currently these expressions can't be nested.
#
proc make-template {template {out {}}} {
set infile [file join $::autosetup(srcdir) $template]
if {![file exists $infile]} {
user-error "Template $template is missing"
}
# Define this as late as possible
define AUTODEPS $::autosetup(deps)
if {$out eq ""} {
if {[file ext $template] ne ".in"} {
autosetup-error "make_template $template has no target file and can't guess"
}
set out [file rootname $template]
}
set outdir [file dirname $out]
# Make sure the directory exists
file mkdir $outdir
# Set up srcdir and top_srcdir to be relative to the target dir
define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir]
define top_srcdir [relative-path $::autosetup(srcdir) $outdir]
set mapping {}
foreach {n v} [array get ::define] {
lappend mapping @$n@ $v
}
set result {}
foreach line [split [readfile $infile] \n] {
if {[info exists cond]} {
set l [string trimright $line]
if {$l eq "@endif"} {
unset cond
continue
}
if {$l eq "@else"} {
set cond [expr {!$cond}]
continue
}
if {$cond} {
lappend result $line
}
continue
}
if {[regexp {^@if\s+(\w+)(.*)} $line -> name expression]} {
lassign $expression equal value
set varval [get-define $name ""]
if {$equal eq ""} {
set cond [expr {$varval ni {"" 0}}]
} else {
set cond [expr {$varval eq $value}]
if {$equal ne "=="} {
set cond [expr {!$cond}]
}
}
continue
}
lappend result $line
}
writefile $out [string map $mapping [join $result \n]]\n
msg-result "Created [relative-path $out] from [relative-path $template]"
}
# build/host tuples and cross-compilation prefix
set build [opt-val build]
define build_alias $build
if {$build eq ""} {
define build [config_guess]
} else {
define build [config_sub $build]
}
set host [opt-val host]
define host_alias $host
if {$host eq ""} {
define host [get-define build]
set cross ""
} else {
define host [config_sub $host]
set cross $host-
}
define cross [get-env CROSS $cross]
# Do "define defaultprefix myvalue" to set the default prefix *before* the first "use"
set prefix [opt-val prefix [get-define defaultprefix /usr/local]]
# These are for compatibility with autoconf
define target [get-define host]
define prefix $prefix
define builddir $autosetup(builddir)
define srcdir $autosetup(srcdir)
# Allow this to come from the environment
define top_srcdir [get-env top_srcdir [get-define srcdir]]
# autoconf supports all of these
set exec_prefix [opt-val exec-prefix $prefix]
define exec_prefix $exec_prefix
foreach {name defpath} {
bindir /bin
sbindir /sbin
libexecdir /libexec
libdir /lib
} {
define $name [opt-val $name $exec_prefix$defpath]
}
foreach {name defpath} {
datadir /share
sysconfdir /etc
sharedstatedir /com
localstatedir /var
infodir /share/info
mandir /share/man
includedir /include
} {
define $name [opt-val $name $prefix$defpath]
}
define SHELL [get-env SHELL [find-an-executable sh bash ksh]]
# Windows vs. non-Windows
switch -glob -- [get-define host] {
*-*-ming* - *-*-cygwin - *-*-msys {
define-feature windows
define EXEEXT .exe
}
default {
define EXEEXT ""
}
}
# Display
msg-result "Host System...[get-define host]"
msg-result "Build System...[get-define build]"
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module which provides text formatting
use formatting
proc wordwrap {text length {firstprefix ""} {nextprefix ""}} {
set len 0
set space $firstprefix
foreach word [split $text] {
set word [string trim $word]
if {$word == ""} {
continue
}
if {$len && [string length $space$word] + $len >= $length} {
puts ""
set len 0
set space $nextprefix
}
incr len [string length $space$word]
# Use man-page conventions for highlighting 'quoted' and *quoted*
# single words.
# Use x^Hx for *bold* and _^Hx for 'underline'.
#
# less and more will both understand this.
# Pipe through 'col -b' to remove them.
if {[regexp {^'(.*)'([^a-zA-Z0-9_]*)$} $word -> bareword dot]} {
regsub -all . $bareword "_\b&" word
append word $dot
} elseif {[regexp {^[*](.*)[*]([^a-zA-Z0-9_]*)$} $word -> bareword dot]} {
regsub -all . $bareword "&\b&" word
append word $dot
}
puts -nonewline $space$word
set space " "
}
if {$len} {
puts ""
}
}
proc title {text} {
underline [string trim $text] =
nl
}
proc p {text} {
wordwrap $text 80
nl
}
proc codelines {lines} {
foreach line $lines {
puts " $line"
}
nl
}
proc nl {} {
puts ""
}
proc underline {text char} {
regexp "^(\[ \t\]*)(.*)" $text -> indent words
puts $text
puts $indent[string repeat $char [string length $words]]
}
proc section {text} {
underline "[string trim $text]" -
nl
}
proc subsection {text} {
underline "$text" ~
nl
}
proc bullet {text} {
wordwrap $text 76 " * " " "
}
proc indent {text} {
wordwrap $text 76 " " " "
}
proc defn {first args} {
if {$first ne ""} {
underline " $first" ~
}
foreach p $args {
if {$p ne ""} {
indent $p
}
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# Module which provides text formatting
# wiki.tcl.tk format output
use formatting
proc joinlines {text} {
set lines {}
foreach l [split [string trim $text] \n] {
lappend lines [string trim $l]
}
join $lines
}
proc p {text} {
puts [joinlines $text]
puts ""
}
proc title {text} {
puts "*** [joinlines $text] ***"
puts ""
}
proc codelines {lines} {
puts "======"
foreach line $lines {
puts " $line"
}
puts "======"
}
proc code {text} {
puts "======"
foreach line [parse_code_block $text] {
puts " $line"
}
puts "======"
}
proc nl {} {
}
proc section {text} {
puts "'''$text'''"
puts ""
}
proc subsection {text} {
puts "''$text''"
puts ""
}
proc bullet {text} {
puts " * [joinlines $text]"
}
proc indent {text} {
puts " : [joinlines $text]"
}
proc defn {first args} {
if {$first ne ""} {
indent '''$first'''
}
foreach p $args {
p $p
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 |
#!/bin/sh
# Copyright (c) 2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/find-tclsh`" "$0" "$@"
# Migrates configure.in or configure.ac to auto.def
proc dputs {msg} {
# Uncomment this for debugging
#puts $msg
}
proc make-quoted-string {str} {
return \"[string map {\" \\" \[ \\[ \] \\]} $str]\"
}
# Remove white space and trailing backslash
proc clean-arg {str} {
set str [string trim $str]
if {[string index $str end] eq "\\"} {
set str [string trim [string range $str 0 end-1]]
}
return $str
}
# Parse m4 macro args into a list, removing brackets
proc split-comma-args {str} {
#dputs "split-comma-args $str"
set args {}
# Step one char at a time and keep track of if we are in a bracketed expression
set inbracket 0
set inparen 0
foreach c [split $str {}] {
if {!$inbracket} {
if {$inparen} {
if {$c eq ")"} {
incr inparen -1
}
} elseif {$c eq "("} {
incr inparen
} elseif {$c eq {[}} {
incr inbracket
continue
} elseif {$c eq ","} {
append arg ""
lappend args [clean-arg $arg]
unset arg
continue
}
} else {
if {$c eq {[}} {
incr inbracket
} elseif {$c eq {]}} {
if {[incr inbracket -1] == 0} {
continue
}
}
}
append arg $c
}
if {[info exists arg]} {
if {[string match "*\\\n" $arg]} {
set arg [string range $arg 0 end-2]
}
lappend args [clean-arg $arg]
}
#dputs "===> $args"
return $args
}
proc count-chars {str c} {
set i 0
set n 0
while {[set i [string first $c $str $i]] >= 0} {
incr i
incr n
}
return $n
}
proc check-complete {str} {
if {[count-chars $str (] != [count-chars $str )]} {
return 0
}
if {[count-chars $str \[] != [count-chars $str \]]} {
return 0
}
return 1
}
proc add-complete-statement {n statement} {
if {![regexp {^(.*?)\((.*?)\)$} $statement -> cmd args]} {
# Maybe there is something after )
if {![regexp {^(.*?)\((.*?)\)(.*)$} $statement -> cmd args rest]} {
puts stderr "*** On line $n, failed to interpret:"
puts stderr $statement
puts stderr "\n*** If this is a nested macro, try indenting embedded macros"
exit 1
} else {
lappend args [list # $rest]
}
}
if {[string match {*,*} $args] || [string match {*\[*} $args]} {
# Contains brackets and/or commas.
# Need to split on commas and remove brackets
set args [split-comma-args $args]
} else {
set args [list $args]
}
return [list ! $n $cmd $args]
}
# Converts a list of lines into a "program"
proc parse-autoconf {lines} {
set n 0
set statement {}
set prog {}
foreach line $lines {
incr n
set line [string trimright $line]
regsub {\mdnl\M.*$} $line "" line
if {$statement eq {}} {
set statement [string trimleft $line]
if {![string match {A[SCMX]_*} $statement]} {
lappend prog [list # $statement]
set statement {}
continue
}
} elseif {[string match {A[SCMX]_*} $line]} {
# Found a macro call in the left column, so assume the previous
# statement is complete
lappend prog [add-complete-statement [expr {$n - 1}] $statement]
set statement $line
} else {
append statement \n $line
}
if {![string match *(* $statement]} {
lappend prog [list ! $n $statement {}]
set statement {}
continue
}
# Is this statement complete?
if {![string match *)* $statement]} {
continue
}
if {[check-complete $statement]} {
lappend prog [add-complete-statement $n $statement]
set statement {}
}
}
if {$statement ne ""} {
dputs "Got some leftover: $statement"
#exit 1
}
return $prog
}
proc output {msg} {
puts $::outf "$::indent$msg"
}
# Finds AC_ARG_WITH and AC_ARG_ENABLE to
# output an appropriate options declaration
proc output-options {prog} {
output "options {"
# options
foreach l $prog {
set l [lassign $l type n cmd args]
if {$type ne "#" && $cmd eq "AC_ARG_WITH"} {
lassign $args opt help true false
if {![regexp {=(.*?)\s+(.*)} $help -> arg desc]} {
# This is actually a boolean option
set arg ""
set desc $help
regexp {\s+(.*)} $desc -> desc
} else {
set arg :$arg
}
regsub -all {[()]} $desc "" desc
set desc [string map {[ ( ] )} $desc]
output [format "\t%-15s => %s" with-$opt$arg [list $desc]]
continue
}
if {$type ne "#" && $cmd eq "AC_ARG_ENABLE"} {
lassign $args opt help true false
set def 0
if {[regexp -- {--(enable|disable)-(.*?)\s+(.*)} $help -> ed arg desc]} {
if {$ed eq "disable"} {
set def 1
}
} else {
set desc $help
}
# Remember the sense of this option
set ::boolopts($opt) $def
regsub -all {[()]} $desc "" desc
set desc [string map {[ ( ] )} $desc]
output [format "\t%-15s => %s" $opt=$def [list $desc]]
}
}
output "}\n"
}
proc output-unknown {action} {
set lines [lassign [split $action \n] first]
output "# XXX $first"
foreach l $lines {
output "# $l"
}
}
proc output-auto-def {prog} {
foreach l $prog {
set l [lassign $l type]
if {$type eq "#"} {
lassign $l line
set line [string trim $line]
if {$line eq "" || [string match "#*" $line]} {
output $line
} elseif {[string match "dnl *" $line]} {
output "# [string range $line 4 end]"
} elseif {[regexp {([a-z0-9_]+)=(.*)} $line -> name val]} {
output "set $name $val"
} else {
output-unknown $line
}
} else {
lassign $l n cmd args
dputs "! $n $cmd [llength $args] [join $args |]"
if {[info procs $cmd] eq ""} {
output-unknown [concat $cmd {*}$args]
puts stderr "Unknown: $cmd"
} else {
if {[catch {$cmd {*}$args} msg]} {
puts stderr "At line $n, could understand $cmd"
output-unknown [concat $cmd {*}$args]
}
}
}
}
}
proc split-comma-fields {str} {
set result {}
foreach i [split $str ,] {
lappend result [string trim $i]
}
return $result
}
proc incr-level {} {
append ::indent \t
}
proc decr-level {} {
set ::indent [string range $::indent 0 end-1]
}
proc output-shell-action {action} {
set prog [parse-autoconf [split $action \n]]
incr-level
output-auto-def $prog
decr-level
}
proc AC_MSG_NOTICE {args} {
output "msg-result [make-quoted-string [join $args]]"
}
proc AC_MSG_RESULT {args} {
output "msg-result [make-quoted-string [join $args]]"
}
proc AC_MSG_WARN {args} {
output "msg-result Warning: [make-quoted-string [join $args]]"
}
proc AC_MSG_ERROR {args} {
output "user-error [make-quoted-string [join $args]]"
}
proc AC_MSG_CHECKING {args} {
output "msg-checking [make-quoted-string "Checking [join $args]..."]"
}
proc AC_CONFIG_FILES {files} {
foreach file $files {
# XXX input file can have a different name
output "make-template $file.in"
}
}
proc AC_OUTPUT {{filename {}}} {
AC_CONFIG_FILES $filename
foreach header $::output_headers {
output "make-config-header $header"
}
set ::output_headers {}
}
proc AC_CONFIG_HEADER {filename} {
lappend ::output_headers $filename
}
proc AC_CONFIG_HEADERS {{filename config.h} args} {
AC_CONFIG_HEADER $filename
}
proc AS_MKDIR_P {dir} {
output [list file mkdir $dir]
}
proc AC_SYS_LARGEFILE {args} {
output "use cc-lib"
output "cc-check-lfs"
}
proc AC_CHECK_TOOL {define name {false ""}} {
do-true-false "cc-check-tools $name" "" $false
}
proc AC_CHECK_PROG {define name def args} {
output "if {!\[cc-check-progs $name\]} { define $define $def }"
}
proc AC_PROG_INSTALL {} {
output "cc-check-progs install"
}
proc AC_PROG_LIBTOOL {} {
output "cc-check-progs libtool"
}
proc AC_PROG_RANLIB {} {
output "cc-check-tools ranlib"
}
proc AC_PROG_YACC {} {
output "foreach prog {bison yacc} { if {\[cc-check-progs \$prog\]} { define YACC \$prog; break } }"
}
proc check-headers {args} {
output "cc-check-includes $args"
}
proc AC_HEADER_STDC {args} {}
proc AC_HEADER_SYS_WAIT {args} {
check-headers sys/wait.h
}
proc AC_HEADER_DIRENT {args} {
check-headers dirent.h
}
proc AC_HEADER_TIME {args} {
check-headers sys/time.h time.h
}
proc AC_HEADER_STAT {args} {
check-headers sys/stat.h stat.h
}
proc AC_HEADER_STDBOOL {args} {
check-headers stdbool.h
}
proc ac_type_xxx {type} {
output "cc-with {-includes {stdlib.h unistd.h fcntl.h sys/types.h netinet/in.h}} {\n\tcc-check-types $type\n}"
}
proc AC_CHECK_HEADERS {hdrlist {true {}} {false {}} {decl {}}} {
do-true-false "cc-check-includes $hdrlist" $true $false $decl
}
proc AC_CHECK_HEADER {header {true {}} {false {}}} {
AC_CHECK_HEADERS $header $true $false
}
proc AC_TYPE_UID_T {args} {
ac_type_xxx uid_t
}
proc AC_TYPE_MODE_T {args} {
ac_type_xxx mode_t
}
proc AC_TYPE_PID_T {args} {
ac_type_xxx pid_t
}
proc AC_TYPE_SIZE_T {args} {
ac_type_xxx size_t
}
proc AC_CHECK_MEMBERS {typelist {true {}} {false {}} {decl {}}} {
do-true-false [list cc-check-members {*}[split-comma-fields $typelist]] $true $false $decl
}
proc do-true-false {cmd true false {decl {}}} {
if {$decl ne ""} {
output "cc-with {[examine-cc-decl $decl]} \{"
incr-level
}
if {$true eq "" && $false eq ""} {
output $cmd
} else {
set not ""
if {$true eq ""} {
set not !
set true $false
set false ""
}
output "if {$not\[$cmd\]} \{"
output-shell-action $true
if {$false ne ""} {
output "\} else \{"
output-shell-action $false
}
output "\}"
}
if {$decl ne ""} {
decr-level
output "\}"
}
}
proc AC_CHECK_TYPE {types {true ""} {false ""} {decl ""}} {
do-true-false "cc-check-types $types" $true $false $decl
}
proc AC_CHECK_TYPES {types {true {}} {false {}} {decl {}}} {
AC_CHECK_TYPE [split-comma-fields $types] $true $false $decl
}
proc AC_CHECK_FUNCS {funcs {true {}} {false {}}} {
do-true-false "cc-check-functions $funcs" $true $false
}
proc AC_CHECK_DECLS {symbols {true {}} {false {}} {decl {}}} {
do-true-false "cc-check-decls [split-comma-fields $symbols]" $true $false $decl
}
proc AC_FUNC_MEMCMP {args} {
output "cc-check-functions memcmp"
}
proc AC_FUNC_FORK {args} {
output "cc-check-functions fork"
}
proc AC_CHECK_LIB {libname funcname {true {}} {false {}} {extralibs {}}} {
if {$extralibs ne ""} {
output "cc-with {-libs {$extralibs}} \{"
incr-level
}
do-true-false "cc-check-function-in-lib $funcname $libname" $true $false
if {$extralibs ne ""} {
output "\}"
decr-level
}
}
proc AC_SEARCH_LIBS {funcname libnames {true {}} {false {}}} {
AC_CHECK_LIB $libnames $funcname $true $false
}
proc AC_ARG_WITH {opt help true {false {}}} {
output "if {\[opt-val with-$opt\] ne {}} {"
output "\tset withval \[opt-val with-$opt\]"
output-shell-action $true
if {$false ne ""} {
output "\} else \{"
output-shell-action $false
}
output "}"
}
proc AC_ARG_ENABLE {opt help {true {}} {false {}}} {
set not ""
if {$::boolopts($opt)} {
set not !
}
output "if {$not\[opt-bool $opt\]} {"
output-shell-action $true
if {$false ne ""} {
output "\} else \{"
output-shell-action $false
}
output "}"
}
proc AC_CACHE_CHECK {desc var action} {
output-shell-action $action
}
proc AC_COMPILE_IFELSE {action {true {}} {false {}}} {
# The macro definition here is nested, so we need to "unnest" it
set action [split [string map {[[ [ ]] ]} $action] \n]
set prog [parse-autoconf $action]
lassign [lindex $prog 0] type n cmd args
if {$cmd ne "AC_LANG_PROGRAM"} {
output-unknown "AC_COMPILE_IFELSE $action $true $false"
} else {
lassign $args decl code
AC_TRY_COMPILE $decl $code $true $false
}
}
proc AC_LINK_IFELSE {action {true {}} {false {}}} {
# The macro definition here is nested, so we need to "unnest" it
set action [split [string map {[[ [ ]] ]} $action] \n]
set prog [parse-autoconf $action]
lassign [lindex $prog 0] type n cmd args
if {$cmd ne "AC_LANG_PROGRAM"} {
output-unknown "AC_COMPILE_IFELSE $action $true $false"
} else {
lassign $args decl code
AC_TRY_LINK $decl $code $true $false
}
}
proc AC_CACHE_VAL {var action args} {
output-shell-action $action
}
proc AC_DEFINE {def args} {
output "define $def"
}
proc AC_DEFINE_UNQUOTED {def value args} {
output "define $def [make-quoted-string $value ]"
}
proc AC_CHECK_DECL {def {true {}} {false {}} {decl {}}} {
do-true-false "cc-check-decls $def" $true $false $decl
}
proc AC_CHECK_SIZEOF {type {def ""}} {
output "cc-check-sizeof [make-quoted-string $type]"
}
proc AC_FUNC_ALLOCA {} {
output "cc-check-functions alloca"
}
proc AC_FUNC_GETPGRP {} {
output "cc-check-functions getpgrp"
}
proc AC_FUNC_VPRINTF {} {
output "cc-check-functions vprintf"
}
proc AC_FUNC_WAIT3 {} {
output "cc-check-functions wait3"
}
proc AC_FUNC_STRCOLL {} {
output "cc-check-functions strcoll"
}
proc AC_CHECK_FUNC {func {true {}} {false {}}} {
do-true-false "cc-check-functions $func" $true $false
}
# Examine declarations and try to pull out things like:
# #include <abc/def.h>
# and
# #ifdef HAVE_ABC_DEF_H
# #include <abc/def.h>
# #endif
#
# Returns a list like:
# -includes {list} -declare {list}
#
proc examine-cc-decl {decl} {
set omit_endif 0
set includes {}
set decls {}
foreach line [split $decl \n] {
if {$line eq ""} {
continue
}
if {[regexp {#\s*if(def)?\s+HAVE_} $line]} {
incr omit_endif
continue
}
if {$omit_endif && [string match "*#*endif*" $line]} {
set omit_endif 0
continue
}
if {[regexp {#\s*include.*<(.*)>} $line -> i]} {
lappend includes $i
continue
}
lappend decls [string trim $line]
}
set result {}
if {[llength $includes]} {
lappend result -includes $includes
}
if {[llength $decls]} {
lappend result -declare [join $decls \n]
}
return $result
}
proc AC_TRY_LINK {decl code {true {}} {false {}}} {
do-true-false "cctest -link 1 [examine-cc-decl $decl] -code {$code}" $true $false
}
proc AC_TRY_COMPILE {decl code {true {}} {false {}}} {
do-true-false "cctest [examine-cc-decl $decl] -code {$code}" $true $false
}
proc AC_LANG_WERROR {args} {
output "define-append CFLAGS -Werror"
}
proc AC_GNU_SOURCE {args} {
output "define-append CFLAGS -D_GNU_SOURCE"
}
proc AC_C_BIGENDIAN {args} {
output "cc-check-endian"
}
set subst_msg 0
proc AC_SUBST {args} {
if {$::subst_msg == 0} {
incr ::subst_msg
output "# XXX autosetup automatically substitutes all define'd values"
output "# In general, simply 'define' the value rather than using a shell"
output "# variable and AC_SUBST."
output "#"
}
output-unknown [concat AC_SUBST {*}$args]
}
proc AC_PREREQ {version} {}
proc AC_INIT {filename args} {}
proc AC_PROG_CC {args} {}
proc AC_PROG_MAKE_SET {args} {}
proc AC_CANONICAL_HOST {args} {}
proc AC_C_CONST {args} {}
proc AC_PROG_GCC_TRADITIONAL {args} {}
proc AC_CONFIG_SRCDIR {args} {}
proc AC_CANONICAL_SYSTEM {args} {}
proc AC_EXEEXT {args} {}
# -------------------------
set infile [glob -nocomplain configure.in configure.ac]
switch [llength $infile] {
0 {
puts stderr "Could not find either configure.in or configure.ac"
exit 1
}
2 {
puts stderr "Both configure.in and configure.ac found. Please remove one"
exit 1
}
}
lassign $argv autodef
if {$autodef eq ""} {
set autodef auto.def
}
if {[file exists $autodef]} {
puts stderr "$autodef already exists. Will not overwrite it"
exit 1
}
puts "Migrating $infile to $autodef"
set f [open $infile]
set lines [split [read $f] \n]
close $f
set prog [parse-autoconf $lines]
set outf [open $autodef w]
set indent ""
set output_headers {}
output "# Created by [file tail $argv0] - fix items marked XXX\n"
output "use cc cc-lib\n"
output-options $prog
output-auto-def $prog
close $outf
puts "Created $autodef. Now edit to resolve items marked XXX"
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# @synopsis:
#
# Helper script for Makefiles
#
proc use args {
foreach pkg $args {
if {[file exists $::here/${pkg}.tcl]} {
source $::here/${pkg}.tcl
} elseif {[file exists $::here/../lib/${pkg}.tcl]} {
source $::here/../lib/${pkg}.tcl
} else {
error "Could not find package $args"
}
}
}
set ::here [file dirname [file normalize [info script]]]
use fileutil
proc file-normalize args {
return [file normalize {*}$args]
}
proc _istcl name {
return [string match *.tcl $name]
}
###
# topic: ea4ac0a84ae990dafee965b995f48e63
###
proc _istm name {
return [string match *.tm $name]
}
proc _isdirectory name {
return [file isdirectory $name]
}
foreach {src dest} $argv {
set src [file normalize $src]
set dest [file normalize $dest]
file mkdir $dest
foreach {file} [fileutil_find $src _istcl] {
set relname [fileutil_relative $src $file]
set destfile [file join $dest $relname]
file mkdir [file dirname $destfile]
file copy -force $file [file join $dest $relname]
}
}
|
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# Copyright (c) 2010 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# @synopsis:
#
# This module supports common system interrogation and options
# such as --host, --build, --prefix, and setting srcdir, builddir, and EXEXT.
#
# It also support the 'feature' naming convention, where searching
# for a feature such as sys/type.h defines HAVE_SYS_TYPES_H
#
module-options {
host:host-alias => {a complete or partial cpu-vendor-opsys for the system where
the application will run (defaults to the same value as --build)}
build:build-alias => {a complete or partial cpu-vendor-opsys for the system
where the application will be built (defaults to the
result of running config.guess)}
prefix:dir => {the target directory for the build (defaults to /usr/local)}
# These (hidden) options are supported for autoconf/automake compatibility
exec-prefix:
bindir:
sbindir:
includedir:
mandir:
infodir:
libexecdir:
datadir:
libdir:
sysconfdir:
sharedstatedir:
localstatedir:
maintainer-mode=0
dependency-tracking=0
}
# Returns 1 if exists, or 0 if not
#
proc check-feature {name code} {
msg-checking "Checking for $name..."
set r [uplevel 1 $code]
define-feature $name $r
if {$r} {
msg-result "ok"
} else {
msg-result "not found"
}
return $r
}
# @have-feature name ?default=0?
#
# Returns the value of the feature if defined, or $default if not.
# See 'feature-define-name' for how the feature name
# is translated into the define name.
#
proc have-feature {name {default 0}} {
get-define [feature-define-name $name] $default
}
# @define-feature name ?value=1?
#
# Sets the feature 'define' to the given value.
# See 'feature-define-name' for how the feature name
# is translated into the define name.
#
proc define-feature {name {value 1}} {
define [feature-define-name $name] $value
}
# @feature-checked name
#
# Returns 1 if the feature has been checked, whether true or not
#
proc feature-checked {name} {
is-defined [feature-define-name $name]
}
# @feature-define-name name ?prefix=HAVE_?
#
# Converts a name to the corresponding define,
# e.g. sys/stat.h becomes HAVE_SYS_STAT_H.
#
# Converts * to P and all non-alphanumeric to underscore.
#
proc feature-define-name {name {prefix HAVE_}} {
string toupper $prefix[regsub -all {[^a-zA-Z0-9]} [regsub -all {[*]} $name p] _]
}
# If $file doesn't exist, or it's contents are different than $buf,
# the file is written and $script is executed.
# Otherwise a "file is unchanged" message is displayed.
proc write-if-changed {file buf {script {}}} {
set old [readfile $file ""]
if {$old eq $buf && [file exists $file]} {
msg-result "$file is unchanged"
} else {
writefile $file $buf\n
uplevel 1 $script
}
}
# @make-template template ?outfile?
#
# Reads the input file <srcdir>/$template and writes the output file $outfile.
# If $outfile is blank/omitted, $template should end with ".in" which
# is removed to create the output file name.
#
# Each pattern of the form @define@ is replaced the the corresponding
# define, if it exists, or left unchanged if not.
#
# The special value @srcdir@ is substituted with the relative
# path to the source directory from the directory where the output
# file is created, while the special value @top_srcdir@ is substituted
# with the relative path to the top level source directory.
#
# Conditional sections may be specified as follows:
## @if name == value
## lines
## @else
## lines
## @endif
#
# Where 'name' is a defined variable name and @else is optional.
# If the expression does not match, all lines through '@endif' are ignored.
#
# The alternative forms may also be used:
## @if name
## @if name != value
#
# Where the first form is true if the variable is defined, but not empty or 0
#
# Currently these expressions can't be nested.
#
proc make-template {template {out {}}} {
set infile [file join $::autosetup(srcdir) $template]
if {![file exists $infile]} {
user-error "Template $template is missing"
}
# Define this as late as possible
define AUTODEPS $::autosetup(deps)
if {$out eq ""} {
if {[file ext $template] ne ".in"} {
autosetup-error "make_template $template has no target file and can't guess"
}
set out [file rootname $template]
}
set outdir [file dirname $out]
# Make sure the directory exists
file mkdir $outdir
# Set up srcdir and top_srcdir to be relative to the target dir
define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir]
define top_srcdir [relative-path $::autosetup(srcdir) $outdir]
set mapping {}
foreach {n v} [array get ::define] {
lappend mapping @$n@ $v
}
set result {}
foreach line [split [readfile $infile] \n] {
if {[info exists cond]} {
set l [string trimright $line]
if {$l eq "@endif"} {
unset cond
continue
}
if {$l eq "@else"} {
set cond [expr {!$cond}]
continue
}
if {$cond} {
lappend result $line
}
continue
}
if {[regexp {^@if\s+(\w+)(.*)} $line -> name expression]} {
lassign $expression equal value
set varval [get-define $name ""]
if {$equal eq ""} {
set cond [expr {$varval ni {"" 0}}]
} else {
set cond [expr {$varval eq $value}]
if {$equal ne "=="} {
set cond [expr {!$cond}]
}
}
continue
}
lappend result $line
}
writefile $out [string map $mapping [join $result \n]]\n
msg-result "Created [relative-path $out] from [relative-path $template]"
}
# build/host tuples and cross-compilation prefix
set build [opt-val build]
define build_alias $build
if {$build eq ""} {
define build [config_guess]
} else {
define build [config_sub $build]
}
set host [opt-val host]
define host_alias $host
if {$host eq ""} {
define host [get-define build]
set cross ""
} else {
define host [config_sub $host]
set cross $host-
}
define cross [get-env CROSS $cross]
# Do "define defaultprefix myvalue" to set the default prefix *before* the first "use"
set prefix [opt-val prefix [get-define defaultprefix /usr/local]]
# These are for compatibility with autoconf
define target [get-define host]
define prefix $prefix
define builddir $autosetup(builddir)
define srcdir $autosetup(srcdir)
# Allow this to come from the environment
define top_srcdir [get-env top_srcdir [get-define srcdir]]
# autoconf supports all of these
set exec_prefix [opt-val exec-prefix $prefix]
define exec_prefix $exec_prefix
foreach {name defpath} {
bindir /bin
sbindir /sbin
libexecdir /libexec
libdir /lib
} {
define $name [opt-val $name $exec_prefix$defpath]
}
foreach {name defpath} {
datadir /share
sysconfdir /etc
sharedstatedir /com
localstatedir /var
infodir /share/info
mandir /share/man
includedir /include
} {
define $name [opt-val $name $prefix$defpath]
}
define SHELL [get-env SHELL [find-an-executable sh bash ksh]]
# Windows vs. non-Windows
switch -glob -- [get-define host] {
*-*-ming* - *-*-cygwin - *-*-msys {
define-feature windows
define EXEEXT .exe
}
default {
define EXEEXT ""
}
}
# Display
msg-result "Host System...[get-define host]"
msg-result "Build System...[get-define build]"
|
> > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# A small Tcl script to verify that the chosen
# interpreter works. Sometimes we might e.g. pick up
# an interpreter for a different arch.
# Outputs the full path to the interpreter
if {[catch {info version} version] == 0} {
# This is Jim Tcl
if {$version >= 0.72} {
# Ensure that regexp works
regexp (a.*?) a
puts [info nameofexecutable]
exit 0
}
} elseif {[catch {info tclversion} version] == 0} {
if {$version >= 8.5 && ![string match 8.5a* [info patchlevel]]} {
puts [info nameofexecutable]
exit 0
}
}
exit 1
|
|
| < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 | #!/bin/sh dir=`dirname "$0"` tclsh=`$dir/autosetup/find-tclsh` echo tclsh $tclsh $tclsh $dir/autosetup/autosetup "$@" |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
more than 10,000 changes
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < |
|
| < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
| < |
|
| < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < |
|
| < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < |
|
| < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < |
| < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
cannot compute difference between binary files
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
cannot compute difference between binary files
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < |
|
| < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < |
|
| < < < < |
|
| < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
| ︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# Default top-level directories in which to install architecture-specific
# files (exec_prefix) and machine-independent files such as scripts (prefix).
# The values specified here may be overridden at configure-time with the
# --exec-prefix and --prefix options to the "configure" script. The *dir vars
# are standard configure substitutions that are based off prefix and
# exec_prefix.
SHELL=@SHELL@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
datarootdir=@datarootdir@
mandir=@mandir@
# The following definition can be set to non-null for special systems like AFS
# with replication. It allows the pathnames used for installation to be
# different than those used for actually reference files at run-time.
# INSTALL_ROOT is prepended to $prefix and $exec_prefix when installing files.
INSTALL_ROOT=${DESTDIR}
| > | < < < < < < < < < < < < < < < < < < < | | < < < < < < | | < | < < | < | | | < < < < | | > | > > > > | > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# Default top-level directories in which to install architecture-specific
# files (exec_prefix) and machine-independent files such as scripts (prefix).
# The values specified here may be overridden at configure-time with the
# --exec-prefix and --prefix options to the "configure" script. The *dir vars
# are standard configure substitutions that are based off prefix and
# exec_prefix.
SHELL=@SHELL@
ODIE_BUILD_TCLSH=@ODIE_BUILD_TCLSH@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
datarootdir=@datarootdir@
mandir=@mandir@
# The following definition can be set to non-null for special systems like AFS
# with replication. It allows the pathnames used for installation to be
# different than those used for actually reference files at run-time.
# INSTALL_ROOT is prepended to $prefix and $exec_prefix when installing files.
INSTALL_ROOT=${DESTDIR}
ODIE_ROOT=@prefix@
LOCAL_REPO=@prefix@
FOSSIL_CHECKOUT=@ODIE_FOSSIL_CHECKOUT@
PLATFORM=${ODIE_PLATFORM}
RC=@RC@
RES=@RES@
TK_RES=@TK_RES@
###
# Backward compadible names needed by build systems
###
SANDBOX=@ODIE_SANDBOX_PATH@
DOWNLOAD=@ODIE_DOWNLOAD_PATH@
ODIEMIRRORURL=@ODIE_MIRROR_URL@
# ODIE_TCLSH is the name of a tclsh executable produced
# my make tcltk
EXE_SUFFIX=@EXEEXT@
EXE=${EXE_SUFFIX}
TCL_EXE=tclsh${EXE_SUFFIX}
TCLTEST_EXE=tcltest${EXE_SUFFIX}
ODIE_TCLSH=@ODIE_TCL_SHELL@
ODIE_WISH=@ODIE_WISH_SHELL@
TCLSH=${ODIE_TCLSH}
TCL_SHELL=${ODIE_BUILD_TCLSH}
CC=@CC@
#CC=purify -best-effort @CC@ -DPURIFY
ODIE_STATIC_TCLLIB=${exec_prefix}/lib/tclstaticlib.a
ODIE_STATIC_TKLIB=${exec_prefix}/lib/tkstaticlib.a
TOADKIT=@ODIE_TOADKIT@
ODIE_MKHDR=${exec_prefix}/bin/mkhdr${EXE_SUFFIX}
ZIPSETUP=${exec_prefix}/bin/zzipsetupstub${EXE_SUFFIX}
GIT_PROG=@GIT_PROG@
FOSSIL=@FOSSIL_PROG@
MKHDR=@MKHDR_PROG@
ZIP=@ZIP_PROG@
UNZIP=@UNZIP_PROG@
ODIE_RM=${ODIE_BUILD_TCLSH}
ODIE_RM+=${ODIE_SRC_DIR}/scripts/rmdir.tcl
SHERPA=${ODIE_BUILD_TCLSH}
SHERPA+=@ODIE_SANDBOX_PATH@/sherpa/sherpa.tcl
KETTLE=${ODIE_BUILD_TCLSH}
KETTLE+=${exec_prefix}/bin/kettle
###
# Bits generated by autosetup
###
|
| ︙ | ︙ | |||
13 14 15 16 17 18 19 | set TCL_VERSION @TCL_VERSION@ set TCL_MAJOR_VERSION @TCL_MAJOR_VERSION@ set TCL_MINOR_VERSION @TCL_MINOR_VERSION@ set TK_VERSION @TK_VERSION@ set TK_MAJOR_VERSION @TK_MAJOR_VERSION@ set TK_MINOR_VERSION @TK_MINOR_VERSION@ set ODIE_BINARY_PLATFORM @ODIE_BINARY_PLATFORM@ | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | set TCL_VERSION @TCL_VERSION@ set TCL_MAJOR_VERSION @TCL_MAJOR_VERSION@ set TCL_MINOR_VERSION @TCL_MINOR_VERSION@ set TK_VERSION @TK_VERSION@ set TK_MAJOR_VERSION @TK_MAJOR_VERSION@ set TK_MINOR_VERSION @TK_MINOR_VERSION@ set ODIE_BINARY_PLATFORM @ODIE_BINARY_PLATFORM@ set ODIEMIRRORURL @ODIE_MIRROR_URL@ set EXEEXT "@EXEEXT@" package require platform set ::odie(local_repo) $prefix set ::odie(platform_build) [::platform::generic] ### # Data populated by configure |
| ︙ | ︙ | |||
49 50 51 52 53 54 55 | system "@ODIE_SYSTEM@" os "@ODIE_OS@" odie_binary_platform "@ODIE_BINARY_PLATFORM@" odie_cpu "@ODIE_CPU@" odie_window_system "@ODIE_WINDOW_SYSTEM@" tcl_fossil_branch "@TCL_FOSSIL_BRANCH@" tk_fossil_branch "@TK_FOSSIL_BRANCH@" | < > | > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
system "@ODIE_SYSTEM@"
os "@ODIE_OS@"
odie_binary_platform "@ODIE_BINARY_PLATFORM@"
odie_cpu "@ODIE_CPU@"
odie_window_system "@ODIE_WINDOW_SYSTEM@"
tcl_fossil_branch "@TCL_FOSSIL_BRANCH@"
tk_fossil_branch "@TK_FOSSIL_BRANCH@"
cc "@CC@"
shell "@MAKEFILE_SHELL@"
exe_suffix "@EXEEXT@"
shlib_suffix "@SHLIB_SUFFIX@"
zip "@ZIP_PROG@"
unzip "@UNZIP_PROG@"
strip "@STRIP_PROG@"
mkhdr "@MKHDR_PROG@"
git "@GIT_PROG@"
fossil "@FOSSIL_PROG@"
tcl_shell "@TCLSH_PROG@"
wish_shell "@WISH_PROG@"
zzetup "${exec_prefix}/bin/zzipsetupstub@EXEEXT@"
wish_kit "@TKKIT_PROG@"
tcl_kit "@TCLKIT_PROG@"
toad_kit "@TOADKIT_PROG@"
sherpa "@ODIE_BUILD_TCLSH@ @ODIE_SANDBOX_PATH@/sherpa/sherpa.tcl"
kettle "${exec_prefix}/bin/kettle"
zip_kit "${exec_prefix}/bin/zipkit.zip"
lib "$prefix/lib"
rc "@RC@"
res "@RES@"
tk_res "@TK_RES@"
vfs_cp "@VFS_CP@"
mirror "$ODIEMIRRORURL"
}]
# tcl_libs "@TCL_LIBS@"
###
# List paths where fossil repositories are stored
# (To save us having to download things...)
###
|
| ︙ | ︙ |
|
| < < < < < < < < < |
1 | set path [file normalize [file join [file dirname [file normalize [info script]]] ..]] | > > > < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
###
# Common suite of routines for the odie boostrap process
###
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
if {[file exists [file join $path odieConfig.tcl]]} {
source [file join $path odieConfig.tcl]
}
lappend ::auto_path [file join $::odie(prefix) lib]
set ::autosetup(exe) $::argv0
set ::autosetup(istcl) 1
set ::autosetup(start) [clock millis]
set ::autosetup(installed) 0
set ::autosetup(msg-checking) 0
set ::autosetup(msg-quiet) 0
set ::autosetup(msg-timing) 0
set ::autosetup(dir) [file join $path autosetup]
set ::autosetup(builddir) [file join $path]
set ::autosetup(srcdir) [file join $path]
set ::autosetup(libdir) [file join $path autosetup lib]
set ::autosetup(debug) 1
set ::autosetup(cmdline) {}
set ::autosetup(options) {}
set ::autosetup(optionhelp) {}
set ::autosetup(showhelp) 0
foreach file {
core.tcl formatting.tcl getopt.tcl misc.tcl
} {
source [file join $::autosetup(libdir) $file]
}
proc ::noop args {}
namespace eval ::sherpa_bootstrap {}
proc ::sherpa_bootstrap::download_fossil {pkg} {
variable distribution
set PKG_SRCPATH [sandbox_path $pkg]
set fosdb [fossil_db $pkg]
if {![file exists $fosdb]} {
puts "Fossil clone $pkg"
set fossil_url {}
if {[dict exists $distribution $pkg fossil_url]} {
set fossil_url [dict get $distribution $pkg fossil_url]
}
if {$fossil_url eq {}} {
set fossil_url $::odie(mirror_url)/$pkg
}
doexec $::odie(fossil) clone $fossil_url $fosdb
}
if {![file exists ${PKG_SRCPATH}/$::odie(fossil_checkout)]} {
puts "Fossil open $pkg"
file mkdir ${PKG_SRCPATH}
cd ${PKG_SRCPATH}
doexec $::odie(fossil) open $fosdb
}
cd ${PKG_SRCPATH}
if {[dict exists $distribution $pkg fossil_branch]} {
doexec $::odie(fossil) update [dict get $distribution $pkg fossil_branch]
} else {
doexec $::odie(fossil) update
}
return ${PKG_SRCPATH}
}
proc ::sherpa_bootstrap::fossil_db pkg {
if {[file exists [file join $::odie(download) $pkg.fossil]]} {
return [file join $::odie(download) $pkg.fossil]
}
return [file join $::odie(download) $pkg.fos]
}
proc ::sherpa_bootstrap::sandbox_path pkg {
return [file join $::odie(sandbox) $pkg]
}
proc ::sherpa_bootstrap::build_gnumake {pkg action} {
puts "BUILD GNUMAKE $pkg $action"
if {$action eq "install"} {
set PKG_SRCPATH [sandbox_path $pkg]
cd ${PKG_SRCPATH}
doexec $::odie(fossil) update
set args [list --prefix=$::odie(local_repo)]
if {$::odie(host) != $::odie(target)} {
lappend args --host=$::odie(host)
}
if {[file exists ${PKG_SRCPATH}/auto.def]} {
doexec [info nameofexecutable] $::odie(odie_src_dir)/autosetup/autosetup {*}$args
} elseif {![file exists ${PKG_SRCPATH}/Makefile]} {
lappend args --libdir=$::odie(local_repo)/lib
doexec sh ./configure {*}$args
}
if [catch {
domake install
} err] {
puts "Died on $err"
exit 1
}
} else {
set PKG_SRCPATH [sandbox_path $pkg]
cd ${PKG_SRCPATH}
if [catch {
domake $action
} err] {
puts "Died on $err"
exit 1
}
}
}
proc ::sherpa_bootstrap::build_sak {pkg action} {
if {$action eq "install"} {
set PKG_SRCPATH [sandbox_path $pkg]
doexec $::odie(build_tclsh) [file join $PKG_SRCPATH installer.tcl] \
-app-path $::odie(prefix)/bin -pkg-path $::odie(prefix)/lib/$pkg \
-no-examples -no-nroff -no-html \
-no-wait -no-gui
}
}
proc ::sherpa_bootstrap::build_kettle {pkg action} {
set PKG_SRCPATH [sandbox_path $pkg]
if {$pkg eq "kettle"} {
doexec $::odie(build_tclsh) [file join $PKG_SRCPATH kettle] -f [file join $PKG_SRCPATH build.tcl] $action
} else {
doexec $::odie(build_tclsh) $::odie(kettle) -f [file join $PKG_SRCPATH build.tcl] $action
}
}
proc ::sherpa_bootstrap::build_sqlite {pkg action} {
###
# Sqlite
###
puts "INSTALLING SQLITE"
set SQLITE_VERSION 3.8.7.2
set SQLITE_TFNAME sqlite-autoconf-3080704
set SQLITE_SRCPATH $::odie(sandbox)/sqlite
set SQLITE_URL http://sqlite.org/2014/${SQLITE_TFNAME}.tar.gz
# In MSYS, tar may not understand the prefix
set download_msys [::cygpath [pwd]]
set SQLITE_TARBALL [file join [::realpath $::odie(download)] sqlite${SQLITE_VERSION}.tar.gz]
cd [::realpath $::odie(src_dir)]
if {![file exists $SQLITE_TARBALL]} {
doexec $::odie(build_tclsh) scripts/url-get.tcl ${SQLITE_URL} ${SQLITE_TARBALL}
}
if {![file exists ${SQLITE_SRCPATH}/README]} {
file delete -force ${SQLITE_SRCPATH}
cd $::odie(sandbox)
doexec tar xfz [::cygpath ${SQLITE_TARBALL}]
file rename -force ${SQLITE_TFNAME} ${SQLITE_SRCPATH}
}
cd ${SQLITE_SRCPATH}/tea
if {![file exists ${SQLITE_SRCPATH}/tea/Makefile]} {
doexec sh ./configure --prefix=[::cygpath $::odie(local_repo)] --libdir=[::cygpath $::odie(local_repo)/lib] --host=$::odie(host)
}
doexec make install
}
proc ::sherpa_bootstrap::install_package package {
variable distribution
set pkginfo [dict get $distribution $package]
puts [list $package $pkginfo]
set download [dict get $pkginfo get_proc]
$download $package
set build [dict get $pkginfo build_proc]
$build $package install
}
proc ::sherpa_bootstrap::distribution {name properties} {
variable distribution
foreach {field value} $properties {
dict set distribution $name $field $value
}
if {![dict exists $distribution $name get_proc]} {
dict set distribution $name get_proc ::noop
}
if {![dict exists $distribution $name build_proc]} {
dict set distribution $name build_proc ::noop
}
}
::sherpa_bootstrap::distribution sqlite {
get_proc ::noop
build_proc build_sqlite
#build_proc ::noop
}
if {!$::odie(windows)} {
::sherpa_bootstrap::distribution tclx {
get_proc download_fossil
build_proc build_gnumake
}
if 0 {
::sherpa_bootstrap::distribution kettle {
get_proc download_fossil
requires {tclx tcllib tklib}
build_proc build_kettle
}
}
}
::sherpa_bootstrap::distribution tclvfs {
get_proc download_fossil
requires tcllib
build_proc build_gnumake
}
::sherpa_bootstrap::distribution taolib {
get_proc download_fossil
requires {sqlite tcllib tklib}
build_proc build_sak
}
::sherpa_bootstrap::distribution tcllib {
get_proc download_fossil
fossil_branch odie
build_proc build_sak
}
::sherpa_bootstrap::distribution tklib {
get_proc download_fossil
requires tcllib
build_proc build_sak
}
::sherpa_bootstrap::distribution odielib {
get_proc download_fossil
fossil_branch autosetup
requires {tcllib sqlite}
build_proc build_gnumake
}
::sherpa_bootstrap::distribution sherpa {
get_proc download_fossil
fossil_branch trunk
requires {tcllib odielib taolib sqlite}
build_proc build_gnumake
}
proc ::doexec args {
exec {*}$args >&@ stdout
}
###
# Make sure the odielib toolkit is downloaded
###
if {![file exists [file join $::odie(sandbox) odielib modules odie index.tcl]]} {
::sherpa_bootstrap::download_fossil odielib
}
source [file join $path .. odielib modules odie index.tcl]
source [file join $path .. odielib modules cmdline cmdline.tcl]
source [file join $path .. odielib modules fileutil index.tcl]
source [file join $path .. odielib modules codebale index.tcl]
#::sherpa_bootstrap::distribution sherpa {
# get_proc download_fossil
# requires {taolib tcllib odielib kettle}
# build_proc build_kettle
#}
|
|
| | > > > > > | < < | | | | > | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@"
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
source [file join $path scripts common.tcl]
puts "BUILDING ZipVFS KITS"
set toadkits odie
# Only needed for pre-zipvfs enable Tcl/Tk
set TCL_STATIC_SRCPATH $::odie(sandbox)/tcl/$::odie(tcl_src_dir)
set TK_STATIC_SRCPATH $::odie(sandbox)/tk/$::odie(tcl_src_dir)
if {$::odie(window_system) ne "none"} {
if { $::odie(platform) eq "windows" } {
cd [::realpath ${TK_STATIC_SRCPATH}]
domake tk.res.o
domake wish.res.o
}
}
cd [::realpath $::odie(src_dir)/src/toadkit]
puts "Building kits in [pwd]"
source configure.tcl
domake clean
domake install
|
1 2 3 4 5 6 7 8 9 | #! /bin/bash source odieConfig.sh rm -rf autodoc embedded rm -rf autom4te.cache rm -rf build rm -rf config.* helpdoc.* librarypkgindex.tcl rm -rf cthulhu.mk mkhdr* | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#! /bin/bash
source odieConfig.sh
rm -rf autodoc embedded
rm -rf autom4te.cache
rm -rf build
rm -rf config.* helpdoc.* librarypkgindex.tcl
rm -rf cthulhu.mk mkhdr*
cd ${ODIE_SANDBOX_PATH}/tcl/${ODIE_TCL_PLATFORM_DIR} ; make distclean
cd ${ODIE_SANDBOX_PATH}/tk/${ODIE_TCL_PLATFORM_DIR} ; make distclean
cd ${ODIE_SANDBOX_PATH}/tcl-static/${ODIE_TCL_PLATFORM_DIR} ; make distclean
cd ${ODIE_SANDBOX_PATH}/tk-static/${ODIE_TCL_PLATFORM_DIR} ; make distclean
cd ${ODIE_SANDBOX_PATH}/sqlite/tea ; make distclean
cd ${ODIE_SANDBOX_PATH}/tclvfs ; make distclean
cd ${ODIE_SANDBOX_PATH}/tcllib ; make distclean
cd ${ODIE_SRC_DIR}/apps/sherpa ; make clean
cd ${ODIE_SRC_DIR}/src/toadkit ; make clean
cd ${ODIE_SRC_DIR}/src/odielib ; make clean
cd ${ODIE_SRC_DIR}/src/odielib ; make distclean
|
| ︙ | ︙ |
|
| | > > > > > | < < < > > | < < < < | | < | | < | > | | | > | | < < < > > > > > > > | > > > | | < > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@"
set path [file dirname [file normalize [info script]]]
proc ::doexec args {
exec {*}$args >&@ stdout
}
source $path/../odieConfig.tcl
proc get_distro {pkg {tag trunk}} {
set PKG_SRCPATH $::odie(sandbox)/$pkg
if {![file exists $::odie(download)/$pkg.fos]} {
puts "Fossil clone $pkg"
doexec $::odie(fossil) clone $::odie(mirror_url)/$pkg $::odie(download)/$pkg.fos
}
if {![file exists ${PKG_SRCPATH}/$::odie(fossil_checkout)]} {
puts "Fossil open $pkg"
file mkdir ${PKG_SRCPATH}
cd ${PKG_SRCPATH}
doexec $::odie(fossil) open $::odie(download)/$pkg.fos
}
cd ${PKG_SRCPATH}
doexec $::odie(fossil) update $tag
return ${PKG_SRCPATH}
}
get_distro tcllib odie
get_distro sherpa
###
# Build supporting libraries needed by Sherpa
##
# Rebuild sherpa
set SHERPA_SRCPATH $::odie(src_dir)/../sherpa
if {$::tcl_platform(platform) eq "windows"} {
file copy -force ${SHERPA_SRCPATH}/sherpa.cmd $::odie(prefix)/bin/sherpa.cmd
file copy -force ${SHERPA_SRCPATH}/sherpa.tcl $::odie(prefix)/bin/sherpa.tcl
file copy -force ${SHERPA_SRCPATH}/sherpa.tcl $::odie(prefix)/bin/sherpa
} else {
file delete $::odie(prefix)/bin/sherpa
file link ${SHERPA_SRCPATH}/sherpa.tcl $::odie(prefix)/bin/sherpa
}
|
| ︙ | ︙ | |||
34 35 36 37 38 39 40 |
###
# Build and install the mkhdr binary
###
cd ${ODIE_SRC_DIR}
${CC} -o mkhdr.o -c scripts/mkhdr.c
${CC} mkhdr.o -o mkhdr${EXEEXT}
| | | 34 35 36 37 38 39 40 41 |
###
# Build and install the mkhdr binary
###
cd ${ODIE_SRC_DIR}
${CC} -o mkhdr.o -c scripts/mkhdr.c
${CC} mkhdr.o -o mkhdr${EXEEXT}
cp -af mkhdr${EXEEXT} ${LOCAL_REPO}/bin/mkhdr${EXEEXT}
|
|
| | > > > > > | < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@"
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
source [file join $path scripts common.tcl]
###
# Sqlite
###
set SQLITE_VERSION 3.8.7.4
set SQLITE_TFNAME sqlite-autoconf-3080704
set SQLITE_SRCPATH $::odie(sandbox)/sqlite
set SQLITE_URL http://sqlite.org/2014/${SQLITE_TFNAME}.tar.gz
# In MSYS, tar may not understand the prefix
set download_msys [exec pwd]
set SQLITE_TARBALL [file join [::realpath $::odie(download)] sqlite${SQLITE_VERSION}.tar.gz]
cd [::realpath $::odie(src_dir)]
if {![file exists $SQLITE_TARBALL]} {
doexec $::odie(build_tclsh) scripts/url-get.tcl ${SQLITE_URL} ${SQLITE_TARBALL}
}
if {![file exists ${SQLITE_SRCPATH}/README]} {
file delete -force ${SQLITE_SRCPATH}
cd $::odie(sandbox)
doexec tar xfz [::cygpath ${SQLITE_TARBALL}]
file rename -force ${SQLITE_TFNAME} ${SQLITE_SRCPATH}
}
|
| ︙ | ︙ |
1 2 3 4 | #! /bin/bash source odieConfig.sh | | | > > > > | > > > < < < < < < < < < < > | > > > > | > > > > > > | > > > > | < < < < < < < < | < | < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
#! /bin/bash
source odieConfig.sh
TCL_SRCPATH=${SANDBOX}/tcl/${ODIE_TCL_PLATFORM_DIR}
TK_SRCPATH=${SANDBOX}/tk/${ODIE_TCL_PLATFORM_DIR}
ODIE_SRCPATH=${SANDBOX}/odie
echo DOWNLOAD $DOWNLOAD
echo "Building Local Tcl"
if [ ! -f "${DOWNLOAD}/tcl.fos" ]; then
echo ${FOSSIL} clone ${ODIEMIRRORURL}/tcl ${DOWNLOAD}/tcl.fos
${FOSSIL} clone ${ODIEMIRRORURL}/tcl ${DOWNLOAD}/tcl.fos
fi
echo $ODIE_HOST
echo $ODIE_TARGET
if [ ! -f "${SANDBOX}/tcl/${FOSSIL_CHECKOUT}" ]; then
mkdir -p ${SANDBOX}/tcl
cd ${SANDBOX}/tcl
${FOSSIL} open ${DOWNLOAD}/tcl.fos
fi
cd ${SANDBOX}/tcl
${FOSSIL} update ${TCL_FOSSIL_BRANCH}
cd ${TCL_SRCPATH}
# Build Tcl twice. Once statically, once dynamically
echo Build Static Tcl
if [ "${ODIE_HOST}" != "${ODIE_TARGET}" ] ; then
sh ./configure --enable-shared=no --with-tzdata --host=${ODIE_TARGET} ${TCL_CONFIG_FLAGS}
else
sh ./configure --enable-shared=no --with-tzdata ${TCL_CONFIG_FLAGS}
fi
make clean
make binaries
echo "COPYING STATIC LIBRARY"
source tclConfig.sh
cp -f $TCL_LIB_FILE ${ODIE_STATIC_TCLLIB}
cp -f tclConfig.sh ${exec_prefix}/lib/tclkitConfig.sh
cd ${TCL_SRCPATH}
echo Build Dynamic Tcl
if [ "${ODIE_HOST}" != "${ODIE_TARGET}" ] ; then
sh ./configure --prefix=${LOCAL_REPO} --libdir=${LOCAL_REPO}/lib --with-tzdata --host=${ODIE_TARGET} ${TCL_CONFIG_FLAGS}
else
sh ./configure --prefix=${LOCAL_REPO} --libdir=${LOCAL_REPO}/lib --with-tzdata ${TCL_CONFIG_FLAGS}
fi
make clean
make binaries
make install
if [ "${TK_FOSSIL_BRANCH}" != "none" ] ; then
TK_SRCPATH=${SANDBOX}/tk/${ODIE_TCL_PLATFORM_DIR}
echo "Building Local Tk"
if [ ! -f "${DOWNLOAD}/tk.fos" ] ; then
${FOSSIL} clone ${ODIEMIRRORURL}/tk ${DOWNLOAD}/tk.fos
fi
if [ ! -f "${SANDBOX}/tk/${FOSSIL_CHECKOUT}" ] ; then
mkdir -p ${SANDBOX}/tk
cd ${SANDBOX}/tk
${FOSSIL} open ${DOWNLOAD}/tk.fos ${TK_FOSSIL_BRANCH}
fi
cd ${SANDBOX}/tk
${FOSSIL} update ${TK_FOSSIL_BRANCH}
cd ${TK_SRCPATH}
echo Build Dynamic Tk
if [ "${ODIE_OS}" == "macosx" ] ; then
if [ "${ODIE_CONFIG_WINDOWSYSTEM}" == "x11" ] ; then
export CPPFLAGS=-I/opt/X11/include
fi
fi
if [ "${ODIE_HOST}" != "${ODIE_TARGET}" ] ; then
sh ./configure --prefix=${LOCAL_REPO} --libdir=${LOCAL_REPO}/lib --host=${ODIE_TARGET} ${TK_CONFIG_FLAGS}
else
sh ./configure --prefix=${LOCAL_REPO} --libdir=${LOCAL_REPO}/lib ${TK_CONFIG_FLAGS}
fi
make clean
make binaries
make install
fi
###
# Re-run our configure to learn new things from Tcl
###
cd ${ODIE_SRCPATH}
make reconfig
|
> > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # # Install tools on the mac # sudo port install i386-mingw32-binutils i386-mingw32-gcc i386-mingw32-libunicows i386-mingw32-runtime i386-mingw32-w32api CC=/opt/local/bin/i386-mingw32-gcc CXX=/opt/local/bin/i386-mingw32-g++ MINGWFLAGS="-mwin32 -mconsole -march=i686 " CFLAGS="$MINGWFLAGS" CXXFLAGS="$MINGWFLAGS" # # Later configure with: # ./configure CC=$CC CXX=$CXX --target=ix86-pc-windows |
1 2 3 4 5 6 7 8 9 10 |
#! /bin/sh
# The next line is executed by /bin/sh, but not tcl \
exec tclsh $0 ${1+"$@"}
set root [file normalize [file join [file dirname [info script]] ..]]
source $root/scripts/common.tcl
if [catch {load $root/src/odielib/$::odielib(libfile) odielib} err] {
puts $err
}
| | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#! /bin/sh
# The next line is executed by /bin/sh, but not tcl \
exec tclsh $0 ${1+"$@"}
set root [file normalize [file join [file dirname [info script]] ..]]
source $root/scripts/common.tcl
if [catch {load $root/src/odielib/$::odielib(libfile) odielib} err] {
puts $err
}
set cidxfile [file join $::odie(sandbox) odielib modules odie index.tcl]
if {[file exists $cidxfile]} {
source $cidxfile
} else {
package require odie
}
set cidxfile [file join $::odie(sandbox) odielib modules codebale index.tcl]
if {[file exists $cidxfile]} {
source $cidxfile
} else {
package require codebale
}
set stack {}
|
| ︙ | ︙ |
1 | set path [file normalize [file join [file dirname [file normalize [info script]]] ..]] | > > > > > > > > > > > | | > | > > > | > | > > | > > | > > > > > > > | < > > > > > > > > > | > | > > | < < > > > > | > > > | > | > > > > > > > > > | > > > > | < > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
#!/bin/sh
# Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/
# All rights reserved
# vim:se syntax=tcl:
# \
dir=`dirname "$0"`; exec "`$dir/../autosetup/find-tclsh`" "$0" "$@"
###
# Micronized version of sherpa for bootstrapping Odie
###
set path [file normalize [file join [file dirname [file normalize [info script]]] ..]]
source [file join $path scripts common.tcl]
namespace eval ::command {}
proc ::command::help {} {
foreach command [lsort -dictionary [info command ::command::*]] {
puts " * [namespace tail $command]"
}
}
proc ::command::package-list {} {
foreach distro [lsort -dictionary [dict keys $::sherpa_bootstrap::distribution]] {
puts " * $distro"
}
}
proc ::command::install {package} {
if {$package eq "all"} {
install-all
return
}
::sherpa_bootstrap::install_package $package
}
proc ::command::install-all {} {
set info $::sherpa_bootstrap::distribution
set allpkgs [lsort -dictionary [dict keys $info]]
set installed {}
foreach item $allpkgs {
if {[dict exists $info $item requires]} {
set requires($item) [dict get $info $item requires]
} else {
set requires($item) {}
}
}
for {set i 0} {$i < [llength $allpkgs]} {incr i} {
foreach item $allpkgs {
if { $item in $installed } continue
set needs {}
foreach req $requires($item) {
if { $req ni $installed } {
lappend needs $req
}
}
if {[llength $needs]} {
puts [list $item needs $needs]
continue
}
lappend installed $item
}
}
foreach item $installed {
puts "INSTALLING $item"
}
foreach item $installed {
::sherpa_bootstrap::install_package $item
}
}
set method [lindex $argv 0]
if { [info command ::command::$method] eq {} } {
puts stderr "Invalid command: $method."
::command::help
exit 1
}
::command::$method {*}[lrange $argv 1 end]
update
exit 0
|
> > > | 1 2 3 |
#!/bin/sh
# \
exec tclsh "$0" ${1+"$@"}
|
| ︙ | ︙ | |||
46 47 48 49 50 51 52 | # doexec make basekit #} set fout [open index.html w] puts $fout "<HTML><BODY>" puts $fout "<a href=/download>Back to the top</a><p>" | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# doexec make basekit
#}
set fout [open index.html w]
puts $fout "<HTML><BODY>"
puts $fout "<a href=/download>Back to the top</a><p>"
puts $fout "Binaries tailored to $::odie(teacup_profile)"
puts $fout "<p>Built and uploaded on [clock format [clock seconds]]<p>"
set path /var/www/download/$::odie(platform)/$::odie(odie_binary_platform)
ssh ${server} mkdir -p $path
puts $fout "<TABLE>"
puts $fout "<tr><th colspan=2>Self contained executables</th></tr>"
if {[file exists $::odie(wish_kit)]} {
|
| ︙ | ︙ |
| ︙ | ︙ | |||
641 642 643 644 645 646 647 | CFLAGS_DEBUG RC CELIB_DIR AR SHARED_BUILD TCL_THREADS TCL_INCLUDES | < < | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 | CFLAGS_DEBUG RC CELIB_DIR AR SHARED_BUILD TCL_THREADS TCL_INCLUDES MATH_LIBS EGREP GREP RANLIB SET_MAKE INSTALL_LIBRARY INSTALL_SCRIPT |
| ︙ | ︙ | |||
5340 5341 5342 5343 5344 5345 5346 |
if test ! -f "${srcdir}/$i" ; then
as_fn_error $? "could not find tcl source file '${srcdir}/$i'" "$LINENO" 5
fi
PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
done
| < | < < < < < < < < | < < < < < < < < < | 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 |
if test ! -f "${srcdir}/$i" ; then
as_fn_error $? "could not find tcl source file '${srcdir}/$i'" "$LINENO" 5
fi
PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
done
#SHERPA_MODULES_ROOT([../../modules])
#SHERPA_ADD_TCL_MODULES([odie codebale nettool processman cron sqltools sherpa])
#--------------------------------------------------------------------
# __CHANGE__
#
# You can add more files to clean if your extension creates any extra
# files by extending CLEANFILES.
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
|
| ︙ | ︙ |
| ︙ | ︙ | |||
74 75 76 77 78 79 80 | TEA_ADD_INCLUDES([]) TEA_ADD_LIBS([]) TEA_ADD_CFLAGS([]) TEA_ADD_STUB_SOURCES([]) TEA_ADD_TCL_SOURCES([]) | | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | TEA_ADD_INCLUDES([]) TEA_ADD_LIBS([]) TEA_ADD_CFLAGS([]) TEA_ADD_STUB_SOURCES([]) TEA_ADD_TCL_SOURCES([]) #SHERPA_MODULES_ROOT([../../modules]) #SHERPA_ADD_TCL_MODULES([odie codebale nettool processman cron sqltools sherpa]) #-------------------------------------------------------------------- # __CHANGE__ # # You can add more files to clean if your extension creates any extra # files by extending CLEANFILES. # Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure # and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var. |
| ︙ | ︙ |
1 2 3 4 5 6 | ### # This file assembles the machine-generated portions of this # extension #### set path [file normalize [file dirname [info script]]] | | | | | | | | | | | | | | | < < < < < < < < < < | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
###
# This file assembles the machine-generated portions of this
# extension
####
set path [file normalize [file dirname [info script]]]
set ::project(srcdir) $path
set ::project(path) [file normalize [file dirname [file dirname $path]]]
source [file join $::project(path) odieConfig.tcl]
source [file join $::project(path) ]
source [file join $::odie(sandbox) odielib modules codebale index.tcl]
set ::project(name) odie
set ::project(pkgname) odielib
set ::project(pkgvers) 2.1
set ::project(h_file) $::project(name).h
set ::project(h_file_int) $::project(name)Int.h
set ::project(c_file) lib${project(name)}.c
set ::project(init_funct) [string totitle ${project(name)}lib]_Init
set ::project(declfile) odielib.decls
set ::project(standard_header) [subst {
/*
** This file is machine generated by the [info script] file
*/
}]
cthulhu_init
cthulhu_add_cheader_verbatim [file join $::project(path) scripts cthulhu.h]
if {![file exists [file join $::project(srcdir) build]]} {
file mkdir [file join $::project(srcdir) build]
}
foreach file [glob -nocomplain build/*] {
file delete $file
}
set config {}
# Exclude the following files from automatic scans
dict set config cthulhu-ignore-hfiles [list $::project(h_file_int) $::project(h_file)]
dict set config cthulhu-ignore-cfiles [list $::project(c_file) tree.c]
#dict set config cthulhu-ignore-cfiles {}
dict set config_module math build-ignore-cfiles quaternion.c
cthulhu_add_directory [file join $::project(srcdir) build] $config
cthulhu_add_directory [file join $::project(srcdir) generic] $config
if {$::tcl_platform(platform) eq "unix"} {
cthulhu_add_directory [file join $::project(srcdir) unix] $config
}
foreach path [lsort -dictionary [glob [file join $::project(path) cmodules *]]] {
if {[file exists [file join $path cthulhu.ini]]} {
source [file join $path cthulhu.ini]
}
}
if {[file mtime [file join $::project(srcdir) configure.in]] < [file mtime [file join $::project(path) cthulhu.ini]]} {
###
# If the cthulhu.ini file is modified, it's a tipoff that
# our configuration could have changed
###
::codebale::rewrite_autoconf
}
if {[file exists [file join $::project(path) build $::project(declfile)]]} {
###
# Build our stubs definitions
###
file mkdir $::project(srcdir)/build
cthulhu_mk_stub_decls $::project(pkgname) $docfileout $::project(srcdir)/build
doexec [info nameofexecutable] [file join $::project(path) .. tcl tools genStubs.tcl] $::project(srcdir)/build [file join $::project(path) build $::project(declfile)]
}
###
# Build our libinit.c file and internal.h file
###
set hout $::project(srcdir)/generic/$::project(h_file_int)
set docfileout $::project(srcdir)/build/cthulhu.rc
cd $::project(srcdir)
cthulhu_mkhdr_index $hout $docfileout
cthulhu_mk_lib_init.c [file join $::project(srcdir) generic $::project(c_file)]
cthulhu_add_dynamic [file join $::project(srcdir) generic $::project(c_file)] [file join $::project(srcdir) configure.tcl]
cthulhu_add_csource [file join $::project(srcdir) generic $::project(c_file)]
###
# Build our cthulhu.mk file
###
cthulhu_mk_sources build [file join $::project(srcdir) cthulhu.mk]
|
1 |
| > > > | > > | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
include ../../odieConfig.sh
NAME = @PKG_NAME@
VER = @PKG_VER@
PKG_OBJECTS = @PKG_OBJECTS@
PKG_SOURCES = @PKG_SOURCES@
TCL_SRCROOT=${SANDBOX}/tcl
TCL_SRCPATH=${SANDBOX}/tcl/${ODIE_TCL_PLATFORM_DIR}
TK_SRCROOT=${SANDBOX}/tk
TK_SRCPATH=${SANDBOX}/tk/${ODIE_TCL_PLATFORM_DIR}
ZIPSRC_SRC = ${ODIE_SRC_DIR}/src/zip30
PWD=${ODIE_SRC_DIR}/src/toadkit
ZLIB_DIR = ${TCL_SRCROOT}/compat/zlib
ALLPROD=tclkit${EXE} zipkit.zip
TOADKIT_EXTRA_OBJS=
include ${exec_prefix}/lib/tclkitConfig.sh
ifneq ($(TK_FOSSIL_BRANCH),none)
include ${SANDBOX}/tk/${ODIE_TCL_PLATFORM_DIR}/tkConfig.sh
ifeq ($(ODIE_PLATFORM),windows)
TK_DYLIB=${TK_DLL_FILE}
else
TK_DYLIB=${TK_LIB_FILE}
endif
endif
TK_FULL_VERSION="$(strip $(subst ', , $(TK_VERSION)))$(strip $(subst ', , $(TK_PATCH_LEVEL)))"
builddir=build
CC=$(subst ', , $(TCL_CC))
CCSWITCHES=-I
KIT_INCLUDE_SPEC=-I generic -I ${ZLIB_DIR} -I ${TCL_SRCROOT}/generic -I ${TCL_SRCROOT}/${ODIE_TCL_PLATFORM_DIR}
WKIT_INCLUDE_SPEC=-I ${TK_SRCROOT}/generic -I ${TK_SRCROOT}/${ODIE_TCL_PLATFORM_DIR}
KIT_DEFS=-DTCL_USE_STATIC_PACKAGES -DSTATIC_BUILD=1 -UUSE_TCL_STUBS
# Normal
#TCL_CC_SWITCHES = $(subst ', , $(TCL_CFLAGS_OPTIMIZE) $(TCL_EXTRA_CFLAGS) $(TCL_CFLAGS_WARNING) $(TCL_SHLIB_CFLAGS) $(TCL_INCLUDE_SPEC) ${KIT_INCLUDE_SPEC} $(TCL_DEFS) $(KIT_DEFS) -Igeneric -I${ODIE_TCL_PLATFORM_DIR})
# Debugging
TCL_CC_SWITCHES = $(subst ', , $(TCL_CFLAGS_DEBUG) $(TCL_EXTRA_CFLAGS) $(TCL_CFLAGS_WARNING) $(TCL_SHLIB_CFLAGS) $(TCL_INCLUDE_SPEC) ${KIT_INCLUDE_SPEC} $(TCL_DEFS) $(KIT_DEFS) -Igeneric -I${ODIE_TCL_PLATFORM_DIR})
CFLAGS=$(subst ', , $(TCL_CFLAGS_DEBUG))
#CFLAGS=-pipe $(subst ', , ${TCL_CFLAGS_OPTIMIZE})
DEFS=$(KIT_DEFS)
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(KIT_INCLUDE_SPEC) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
| ︙ | ︙ | |||
62 63 64 65 66 67 68 |
all: ${ALLPROD}
clean:
eval ${ODIE_RM} ${TCL_LIB_FILE} ${builddir} cthulhu.mk *.exe *.zip *.o *.c toadConfig.sh tclkit_bare${EXE} tclkit${EXE} tclkit.zip *.vfs zipkit* zzipsetup*
mkdir -p ${builddir}
install: ${ALLPROD}
| < | | | | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
all: ${ALLPROD}
clean:
eval ${ODIE_RM} ${TCL_LIB_FILE} ${builddir} cthulhu.mk *.exe *.zip *.o *.c toadConfig.sh tclkit_bare${EXE} tclkit${EXE} tclkit.zip *.vfs zipkit* zzipsetup*
mkdir -p ${builddir}
install: ${ALLPROD}
cp -f tclkit${EXE} ${ODIE_TCLKIT}
cthulhu.mk:
$(ODIE_BUILD_TCLSH) configure.tcl
include cthulhu.mk
null.zip:
touch .empty
zip null.zip .empty
tclkit_bare_OLD${EXE}: $(PKG_OBJECTS)
echo Built against ${TCL_FULL_VERSION}
echo KIT_LIBS $(KIT_LIBS)
$(CC) $(strip \
$(subst ', , $(CFLAGS) $(TCL_EXTRA_CFLAGS) $(DEFS) $(TCL_LD_FLAGS) $(ODIE_LD_FLAGS)) \
$(PKG_OBJECTS) \
${libdir}/${TCL_STUB_LIB_FILE} \
${ODIE_STATIC_TCLLIB} \
$(subst ', , $(KIT_LIBS) $(TCL_LIBS) $(TCL_CC_SEARCH_FLAGS)) \
$(TOADKIT_EXTRA_OBJS) \
-o tclkit_bare${EXE})
tclkit_bare${EXE}: $(PKG_OBJECTS)
echo Built against ${TCL_FULL_VERSION}
echo KIT_LIBS $(KIT_LIBS)
$(CC) $(strip \
$(subst ', , $(CFLAGS) $(TCL_EXTRA_CFLAGS) $(TCL_LD_FLAGS) $(ODIE_LD_FLAGS)) \
$(PKG_OBJECTS) \
${ODIE_STATIC_TCLLIB} \
${libdir}/${TCL_STUB_LIB_FILE} \
$(subst ', , $(KIT_LIBS) $(TCL_LIBS) $(TCL_CC_SEARCH_FLAGS)) \
$(TOADKIT_EXTRA_OBJS) \
-o tclkit_bare${EXE})
tclkit.vfs:
ifneq ($(TK_FOSSIL_BRANCH),none)
$(ODIE_BUILD_TCLSH) mkVfs.tcl ${ODIE_PLATFORM} "$(PWD)/tclkit.vfs/boot" "$(TCL_SRCROOT)" "$(TK_SRCROOT)" "$(TK_FULL_VERSION)" "$(TK_DYLIB)"
else
$(ODIE_BUILD_TCLSH) mkVfs.tcl ${ODIE_PLATFORM} "$(PWD)/tclkit.vfs/boot" "$(TCL_SRCROOT)"
endif
tclkit${EXE}: tclkit_bare${EXE} null.zip tclkit.vfs
cp tclkit_bare${EXE} tclkit.zip
cat null.zip >> tclkit.zip
cd $(PWD)/tclkit.vfs ; ${ZIP} -rAq ${PWD}/tclkit.zip .
|
| ︙ | ︙ |
1 2 3 4 5 6 | ### # This file assembles the machine-generated portions of this # extension #### set path [file normalize [file dirname [info script]]] | | | | | > | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
###
# This file assembles the machine-generated portions of this
# extension
####
set path [file normalize [file dirname [info script]]]
set ::project(srcdir) $path
set ::project(path) [file normalize [file join $path .. ..]]
if {![info exists ::odie(host)]} {
source [file join $::project(path) scripts common.tcl]
puts "CALLED EXTERNALLY"
}
use cc system cthulhu
if {$::odie(windows)} {
set ::project(name) odie_static
set ::project(pkgname) odielib_static
} else {
set ::project(name) odie
set ::project(pkgname) odielib
}
set ::project(pkgvers) 2.1
set ::project(h_file) $::project(name).h
set ::project(h_file_int) $::project(name)Int.h
set ::project(c_file) lib${::project(name)}.c
set ::project(init_funct) [string totitle ${::project(name)}lib]_Init
set ::project(target) static
parray ::project
set ::project(standard_header) [subst {
/*
** This file is machine generated by the [info script] file
*/
}]
cthulhu_init
set ::project(h_file_int) odieInt.h
if {![file exists [file join $::project(srcdir) build]]} {
file mkdir [file join $::project(srcdir) build]
}
cthulhu_add_cheader_verbatim [file join $::project(path) scripts cthulhu.h]
cthulhu_add_cheader_verbatim [file join $::project(srcdir) generic _macros.h]
foreach file [glob -nocomplain build/*] {
file delete $file
}
set config {}
# Exclude the following files from automatic scans
dict set config cthulhu-ignore-hfiles [list $::project(h_file_int) $::project(h_file)]
dict set config cthulhu-ignore-cfiles [list $::project(c_file) tree.c]
#dict set config cthulhu-ignore-cfiles {}
dict set config_module math build-ignore-cfiles quaternion.c
#cthulhu_add_directory [file join $::project(srcdir) build] $config
#cthulhu_add_directory [file join $::project(srcdir) generic] $config
#if {$::tcl_platform(platform) eq "unix"} {
# cthulhu_add_directory [file join $::project(srcdir) unix] $config
#}
#foreach path [lsort -dictionary [glob [file join $::odie(sandbox) odielib cmodules *]]] {
# if {[file exists [file join $path cthulhu.ini]]} {
# source [file join $path cthulhu.ini]
# }
#}
#foreach dir {logicset odieutil} {
# set path [file join $::odie(sandbox) odielib cmodules $dir]
# if {[file exists [file join $path cthulhu.ini]]} {
# source [file join $path cthulhu.ini]
# }
#}
###
# Add our Zip file system functions
###
cthulhu_add_csource [file join $::project(srcdir) generic zvfs.c] {scan 0}
cthulhu_add_csource [file join $::project(srcdir) generic zvfsboot.c] {scan 0}
foreach zfile {
adler32.c compress.c crc32.c deflate.c infback.c inffast.c inflate.c inftrees.c
trees.c uncompr.c zutil.c
} {
cthulhu_add_csource [file join $::odie(sandbox) tcl compat zlib $zfile] {scan 0}
}
#cthulhu_include_directory [file join $::odie_build(sandbox) tcl compat zlib]
#cthulhu_include_directory [file join $::odie_build(sandbox) tcl generic]
cthulhu_add_csource [file join $::project(srcdir) generic tclkit_init.c] {scan 0}
if {$::odie(windows)} {
#cthulhu_include_directory [file join $::odie_build(sandbox) tcl win]
cthulhu_add_csource [file join $::project(srcdir) win tclsh_packages.c] {scan 0}
cthulhu_add_csource [file join $::odie(sandbox) tcl win tclAppInit.c] {scan 0 extra {-DTCL_LOCAL_APPINIT=Toadkit_AppInit -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook}}
#cthulhu_add_csource [file join $::odie_build(sandbox) tcl win tclWinDde.c]
cthulhu_add_csource [file join $::odie(sandbox) tcl win tclWinReg.c]
} else {
#cthulhu_include_directory [file join $::odie_build(sandbox) tcl unix]
cthulhu_add_csource [file join $::project(srcdir) unix tclsh_packages.c] {scan 0}
cthulhu_add_csource [file join $::odie(sandbox) tcl unix tclAppInit.c] {scan 0 extra {-DTCL_LOCAL_APPINIT=Toadkit_AppInit -DTCL_LOCAL_MAIN_HOOK=Toadkit_MainHook}}
}
if {$::odie(windows)} {
if {![file exists [file join $::odie(sandbox) odielib cmodules odieutil password.c]]} {
puts "BUILDING PASSWORD (toadkit)"
source [file join $::odie(sandbox) odielib cmodules odieutil mkPassword.tcl]
}
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil password.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil memory.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil md5.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil rc4.c]
cthulhu_add_csource [file join $::odie(sandbox) odielib cmodules odieutil tclextra.c]
} else {
foreach path [lsort -dictionary [glob [file join $::odie(sandbox) odielib cmodules *]]] {
if {[file exists [file join $path cthulhu.ini]]} {
source [file join $path cthulhu.ini]
}
}
}
###
# Build mkhdr if we don't have it
###
if {![file exists [::realpath $::odie(mkhdr)]]} {
cd $::build(odie_src_dir)
doexec $::odie(cc) -o mkhdr.o -c scripts/mkhdr.c
doexec $::odie(cc) mkhdr.o -o mkhdr$::odie(exe_suffix)
file copy -force mkhdr$::odie(exe_suffix) [::realpath ${exec_prefix}/bin/mkhdr$::odie(exe_suffix)]
}
###
# Build our libinit.c file and internal.h file
###
set hout $::project(srcdir)/generic/$::project(h_file_int)
set docfileout $::project(srcdir)/build/cthulhu.rc
cd $::project(srcdir)
cthulhu_mkhdr_index $hout $docfileout
cthulhu_mk_app_init.c [file join $::project(srcdir) generic $::project(c_file)]
cthulhu_add_dynamic [file join $::project(srcdir) generic $::project(c_file)] [file join $::project(srcdir) configure.tcl]
cthulhu_add_csource [file join $::project(srcdir) generic $::project(c_file)] {scan 0}
###
# Build our cthulhu.mk file
###
cthulhu_mk_sources build [file join $::project(srcdir) cthulhu.mk]
make-template [file join $::project(srcdir) Makefile.in]
|