Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge the autosetup updates into trunk. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
64a2b0d51f6f7ee9bcb9c885f9664972 |
| User & Date: | drh 2011-08-26 14:09:02.329 |
Context
|
2011-08-26
| ||
| 14:10 | Merge the "stash rm" command into trunk. ... (check-in: 0b4f83067a user: drh tags: trunk) | |
| 14:09 | Merge the autosetup updates into trunk. ... (check-in: 64a2b0d51f user: drh tags: trunk) | |
|
2011-08-24
| ||
| 22:13 | Update to the latest autosetup, mainly for better temp file handling on mingw/msys, and fixes for the sun studio compiler. ... (Closed-Leaf check-in: 4e5dd3536e user: steveb tags: autosetup) | |
|
2011-08-23
| ||
| 18:00 | go back to the old numbering on the pre-checkin checklist (ok'd drh). ... (check-in: a87717ad86 user: martin.weber tags: trunk) | |
Changes
Changes to autosetup/autosetup.
1 2 3 4 5 | #!/bin/sh # Copyright (c) 2006-2011 WorkWare Systems http://www.workware.net.au/ # All rights reserved # vim:se syntax=tcl: # \ | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | #!/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.2 # Can be set to 1 to debug early-init problems set autosetup(debug) 0 ################################################################## |
| ︙ | ︙ | |||
180 181 182 183 184 185 186 | exit 0 } # @opt-bool option ... # # Check each of the named, boolean options and return 1 if any of them have # been set by the user. | | | | 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 |
exit 0
}
# @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 {
|
| ︙ | ︙ | |||
394 395 396 397 398 399 400 | # # 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" | | | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
#
# 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
|
| ︙ | ︙ | |||
432 433 434 435 436 437 438 |
exec-with-stderr sh $::autosetup(dir)/config.sub $alias
} else {
return $alias
}
}
# @define name ?value=1?
| | | 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
exec-with-stderr sh $::autosetup(dir)/config.sub $alias
} else {
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"
|
| ︙ | ︙ | |||
562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
proc quote-argv {argv} {
set args {}
foreach arg $argv {
lappend args [quote-if-needed $arg]
}
join $args
}
# @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.
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
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.
|
| ︙ | ︙ | |||
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 |
# 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
proc getopt {argvname} {
upvar $argvname argv
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
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 {
| > > > | | | | 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 |
# 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
|
| ︙ | ︙ | |||
1262 1263 1264 1265 1266 1267 1268 |
user-notice "Warning: Initialising from the development version of autosetup"
writefile configure "#!/bin/sh\nWRAPPER=\"\$0\" exec $::autosetup(dir)/autosetup \"\$@\"\n"
} else {
writefile configure \
{#!/bin/sh
dir="`dirname "$0"`/autosetup"
| | | | 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 |
user-notice "Warning: Initialising from the development version of autosetup"
writefile configure "#!/bin/sh\nWRAPPER=\"\$0\" exec $::autosetup(dir)/autosetup \"\$@\"\n"
} else {
writefile configure \
{#!/bin/sh
dir="`dirname "$0"`/autosetup"
WRAPPER="$0" exec "`$dir/find-tclsh`" "$dir/autosetup" "$@"
}
}
catch {exec chmod 755 configure}
}
if {![file exists auto.def]} {
puts "I don't see auto.def, so I will create a default one."
writefile auto.def {# Initial auto.def created by 'autosetup --init'
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."
}
|
| ︙ | ︙ | |||
1509 1510 1511 1512 1513 1514 1515 |
# (Assume that Tcl does this for us)
proc getenv {name args} {
string map {\\ /} [env $name {*}$args]
}
# Jim uses system() for exec under mingw, so
# we need to fetch the output ourselves
proc exec-with-stderr {args} {
| | | 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 |
# (Assume that Tcl does this for us)
proc getenv {name args} {
string map {\\ /} [env $name {*}$args]
}
# Jim uses system() for exec under mingw, so
# we need to fetch the output ourselves
proc exec-with-stderr {args} {
set tmpfile auto[format %04x [rand 10000]].tmp
set rc [catch [list exec {*}$args >$tmpfile 2>&1] result]
set result [readfile $tmpfile]
file delete $tmpfile
return -code $rc $result
}
} else {
# Jim on unix is simple
|
| ︙ | ︙ |
Changes to autosetup/cc-lib.tcl.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 |
#
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 {
| | | | 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 |
#
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"
|
| ︙ | ︙ |
Changes to autosetup/cc-shared.tcl.
| ︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 |
define SH_LDFLAGS -shared
define SHOBJ_LDFLAGS -shared
}
*-*-cygwin {
define SH_LDFLAGS -shared
define SHOBJ_LDFLAGS -shared
}
* {
# Generic Unix settings
define SH_LINKFLAGS -rdynamic
| > > > > > > > > > > > > > > > | | | 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 |
define SH_LDFLAGS -shared
define SHOBJ_LDFLAGS -shared
}
*-*-cygwin {
define SH_LDFLAGS -shared
define SHOBJ_LDFLAGS -shared
}
*-*-solaris* {
# XXX: These haven't been fully tested.
#define SH_LINKFLAGS -Wl,-export-dynamic
define SH_CFLAGS -Kpic
define SHOBJ_CFLAGS -Kpic
define SHOBJ_LDFLAGS "-G"
}
*-*-hpux {
# XXX: These haven't been tested
define SH_LINKFLAGS -Wl,+s
define SH_CFLAGS +z
define SHOBJ_CFLAGS "+O3 +z"
define SHOBJ_LDFLAGS -b
define LD_LIBRARY_PATH SHLIB_PATH
}
* {
# Generic Unix settings
define SH_LINKFLAGS -rdynamic
define SH_CFLAGS -fpic
define SH_LDFLAGS -shared
define SHOBJ_CFLAGS -fpic
define SHOBJ_LDFLAGS "-shared -nostartfiles"
}
}
|
Changes to autosetup/cc.tcl.
| ︙ | ︙ | |||
414 415 416 417 418 419 420 |
## return 0;
## }
#
# Any failures are recorded in 'config.log'
#
proc cctest {args} {
set src conftest__.c
| | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
## 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)]} {
|
| ︙ | ︙ | |||
466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
}
default {
autosetup-error "cctest called with unknown language: $opts(-lang)"
}
}
if {!$opts(-link)} {
lappend cmdline -c
}
lappend cmdline {*}$opts(-cflags)
switch -glob -- [get-define host] {
*-*-darwin* {
# Don't generate .dSYM directories
| > | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
}
default {
autosetup-error "cctest called with unknown language: $opts(-lang)"
}
}
if {!$opts(-link)} {
set tmp conftest__.o
lappend cmdline -c
}
lappend cmdline {*}$opts(-cflags)
switch -glob -- [get-define host] {
*-*-darwin* {
# Don't generate .dSYM directories
|
| ︙ | ︙ |
Changes to autosetup/system.tcl.
1 2 3 4 5 6 7 8 9 10 | # 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 | | < < > > > > > > > < | 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 |
# 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} {
|
| ︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# 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 subsituted with the relative
# path to the source directory from the directory where the output
# file is created. Use @top_srcdir@ for the absolute path.
#
proc make-template {template {out {}}} {
set infile [file join $::autosetup(srcdir) $template]
if {![file exists $infile]} {
user-error "Template $template is missing"
}
| > > > > > > > > > > > > > > > > > > | 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 |
# 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 subsituted with the relative
# path to the source directory from the directory where the output
# file is created. Use @top_srcdir@ for the absolute path.
#
# 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"
}
|
| ︙ | ︙ | |||
134 135 136 137 138 139 140 |
# Set up srcdir to be relative to the target dir
define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $outdir]
set mapping {}
foreach {n v} [array get ::define] {
lappend mapping @$n@ $v
}
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 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 |
# Set up srcdir to be relative to the target dir
define srcdir [relative-path [file join $::autosetup(srcdir) $outdir] $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
|
| ︙ | ︙ | |||
169 170 171 172 173 174 175 | 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]] | | | > | | | > | | | | < | | | > > > | 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 |
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
define exec_prefix [opt-val exec-prefix [get-env exec-prefix \${prefix}]]
foreach {name defpath} {
bindir \${exec_prefix}/bin
sbindir \${exec_prefix}/sbin
libexecdir \${exec_prefix}/libexec
libdir \${exec_prefix}/lib
datadir \${prefix}/share
sysconfdir \${prefix}/etc
sharedstatedir \${prefix}/com
localstatedir \${prefix}/var
infodir \${prefix}/share/info
mandir \${prefix}/share/man
includedir \${prefix}/include
} {
define $name [opt-val $name [get-env $name $defpath]]
}
define SHELL [get-env SHELL [find-an-executable sh bash ksh]]
# Windows vs. non-Windows
switch -glob -- [get-define host] {
*-*-ming* - *-*-cygwin {
define-feature windows
|
| ︙ | ︙ |
Changes to configure.
1 2 | #!/bin/sh dir="`dirname "$0"`/autosetup" | | | 1 2 3 | #!/bin/sh dir="`dirname "$0"`/autosetup" WRAPPER="$0" exec "`$dir/find-tclsh`" "$dir/autosetup" "$@" |