1
2
3
4
5
6
7
8
9
10
11
12
13
|
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" || echo false` "$0" "$@"
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
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
401
402
403
404
405
406
407
408
|
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
439
440
441
442
443
444
445
446
|
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
|
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
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
|
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 {
break
lappend nargv $arg
}
}
#puts "getopt: argv=[join $argv] => [join [lrange $argv $i end]]"
#puts "getopt: argv=[join $argv] => [join $nargv]"
#parray opts
set argv [lrange $argv $i end]
set argv $nargv
return [array get opts]
}
proc opt_val {optarrayname options {default {}}} {
upvar $optarrayname opts
|
︙ | | |
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
|
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" || echo false` "$dir/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-autoconf-h config.h
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
1516
1517
1518
1519
1520
1521
1522
1523
|
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 /tmp/autosetup.[format %05x [rand 10000]].tmp
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
|
︙ | | |