aboutsummaryrefslogtreecommitdiff
path: root/autosetup
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2022-08-20 08:24:22 +1000
committerSteve Bennett <steveb@workware.net.au>2022-08-20 15:35:49 +1000
commitd6edb1347713f002a8f1e61c585583b3b1c37394 (patch)
tree717ae3875f7e451b97517f3a2cdff66d44de77c6 /autosetup
parent6e1d4cc163dc37f0ea5cdae8b3e2b9e4b0a73254 (diff)
downloadjimtcl-d6edb1347713f002a8f1e61c585583b3b1c37394.zip
jimtcl-d6edb1347713f002a8f1e61c585583b3b1c37394.tar.gz
jimtcl-d6edb1347713f002a8f1e61c585583b3b1c37394.tar.bz2
build: Update to autosetup v0.7.1
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'autosetup')
-rw-r--r--autosetup/README.autosetup2
-rwxr-xr-xautosetup/autosetup49
-rwxr-xr-xautosetup/autosetup-find-tclsh5
-rw-r--r--autosetup/cc-lib.tcl8
-rw-r--r--autosetup/cc.tcl45
-rw-r--r--autosetup/system.tcl5
-rw-r--r--autosetup/tmake.auto18
7 files changed, 110 insertions, 22 deletions
diff --git a/autosetup/README.autosetup b/autosetup/README.autosetup
index 37958d3..0a0763d 100644
--- a/autosetup/README.autosetup
+++ b/autosetup/README.autosetup
@@ -1,4 +1,4 @@
-README.autosetup created by autosetup v0.7.0+
+README.autosetup created by autosetup v0.7.1
This is the autosetup directory for a local install of autosetup.
It contains autosetup, support files and loadable modules.
diff --git a/autosetup/autosetup b/autosetup/autosetup
index 600d3f2..0dee7a5 100755
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -6,7 +6,7 @@
dir=`dirname "$0"`; exec "`$dir/autosetup-find-tclsh`" "$0" "$@"
# Note that the version has a trailing + on unreleased versions
-set autosetup(version) 0.7.0+
+set autosetup(version) 0.7.1
# Can be set to 1 to debug early-init problems
set autosetup(debug) [expr {"--debug" in $argv}]
@@ -240,6 +240,8 @@ proc main {argv} {
exit 0
}
+# @section Option Handling
+
# @opt-bool ?-nodefault? option ...
#
# Check each of the named, boolean options and if any have been explicitly enabled
@@ -691,6 +693,8 @@ proc config_sub {alias} {
return $alias
}
+# @section Variable Definitions (defines)
+
# @define name ?value=1?
#
# Defines the named variable to the given value.
@@ -702,6 +706,29 @@ proc define {name {value 1}} {
#dputs "$name <= $value"
}
+# @define-push {name ...} script
+#
+# Save the values of the given defines, evaluation the script, then restore.
+# For example, to avoid updating AS_FLAGS and AS_CXXFLAGS:
+## define-push {AS_CFLAGS AS_CXXFLAGS} {
+## cc-check-flags -Wno-error
+## }
+proc define-push {names script} {
+ array set unset {}
+ foreach name $names {
+ if {[is-defined $name]} {
+ set save($name) [get-define $name]
+ } else {
+ set unset($name) 1
+ }
+ }
+ uplevel 1 $script
+ array set ::define [array get save]
+ foreach name [array names unset] {
+ unset -nocomplain ::define($name)
+ }
+}
+
# @undefine name
#
# Undefine the named variable.
@@ -787,6 +814,7 @@ proc all-defines {} {
array get ::define
}
+# @section Environment/Helpers
# @get-env name default
#
@@ -870,6 +898,8 @@ proc list-non-empty {list} {
return $result
}
+# @section Paths, Searching
+
# @find-executable-path name
#
# Searches the path for an executable with the given name.
@@ -939,6 +969,8 @@ proc find-an-executable {args} {
return ""
}
+# @section Logging, Messages and Errors
+
# @configlog msg
#
# Writes the given message to the configuration log, 'config.log'.
@@ -1156,6 +1188,8 @@ proc autosetup_add_dep {filename} {
lappend ::autosetup(deps) [file-normalize $filename]
}
+# @section Modules Support
+
##################################################################
#
# Library module support
@@ -1526,7 +1560,8 @@ proc autosetup_reference {{type text}} {
section {Introduction}
p {
- See http://msteveb.github.com/autosetup/ for the online documentation for 'autosetup'
+ See http://msteveb.github.com/autosetup/ for the online documentation for 'autosetup'.
+ This documentation can also be accessed locally with `autosetup --ref`.
}
p {
@@ -1590,6 +1625,11 @@ proc automf_command_reference {} {
while {![eof $f]} {
set line [gets $f]
+ if {[regexp {^#.*@section (.*)$} $line -> section]} {
+ lappend doc($current) [list section $section]
+ continue
+ }
+
# Find embedded module names
if {[regexp {^#.*@module ([^ ]*)} $line -> modulename]} {
continue
@@ -1604,7 +1644,7 @@ proc automf_command_reference {} {
if {$cmd eq "synopsis:"} {
set current $modulename
lappend doc($current) [list section "Module: $modulename"]
- } else {
+ } else {
lappend doc($current) [list subsection $cmd]
}
@@ -1884,6 +1924,7 @@ WRAPPER="$0"; export WRAPPER; "autosetup" "$@"
writefile configure \
{#!/bin/sh
dir="`dirname "$0"`/autosetup"
+#@@INITCHECK@@#
WRAPPER="$0"; export WRAPPER; exec "`"$dir/autosetup-find-tclsh"`" "$dir/autosetup" "$@"
}
}
@@ -2320,6 +2361,8 @@ set modsource(util.tcl) {
# Module which contains miscellaneous utility functions
+# @section Utilities
+
# @compare-versions version1 version2
#
# Versions are of the form 'a.b.c' (may be any number of numeric components)
diff --git a/autosetup/autosetup-find-tclsh b/autosetup/autosetup-find-tclsh
index e1e0462..436e76a 100755
--- a/autosetup/autosetup-find-tclsh
+++ b/autosetup/autosetup-find-tclsh
@@ -2,14 +2,15 @@
# Looks for a suitable tclsh or jimsh in the PATH
# If not found, builds a bootstrap jimsh in current dir from source
# Prefer $autosetup_tclsh if is set in the environment (unless ./jimsh0 works)
+# If an argument is given, use that as the test instead of autosetup-test-tclsh
d="`dirname "$0"`"
for tclsh in ./jimsh0 $autosetup_tclsh jimsh tclsh tclsh8.5 tclsh8.6 tclsh8.7; do
- { $tclsh "$d/autosetup-test-tclsh"; } 2>/dev/null && exit 0
+ { $tclsh "$d/${1-autosetup-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 jimsh0 "$d/jimsh0.c"; } 2>/dev/null || continue
- ./jimsh0 "$d/autosetup-test-tclsh" && exit 0
+ ./jimsh0 "$d/${-autosetup-test-tclsh}" && exit 0
done
echo 1>&2 "No working C compiler found. Tried ${CC_FOR_BUILD:-cc} and gcc."
echo false
diff --git a/autosetup/cc-lib.tcl b/autosetup/cc-lib.tcl
index 45a3b0d..01a0fb3 100644
--- a/autosetup/cc-lib.tcl
+++ b/autosetup/cc-lib.tcl
@@ -78,7 +78,7 @@ proc cc-check-endian {} {
#
# 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'.
+# appends working flags to '-cflags' and 'AS_CFLAGS' or 'AS_CXXFLAGS'.
proc cc-check-flags {args} {
set result 1
array set opts [cc-get-settings]
@@ -101,7 +101,7 @@ proc cc-check-flags {args} {
msg-result yes
define-feature $prefix$flag
cc-with [list -cflags [list $flag]]
- define-append ${prefix}S $flag
+ define-append AS_${prefix}S $flag
} else {
msg-result no
set result 0
@@ -113,8 +113,8 @@ proc cc-check-flags {args} {
# @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'.
+# options, and appends the first working one to '-cflags' and 'AS_CFLAGS' or
+# 'AS_CXXFLAGS'.
proc cc-check-standards {args} {
array set opts [cc-get-settings]
foreach std $args {
diff --git a/autosetup/cc.tcl b/autosetup/cc.tcl
index 910d6f3..a8aba97 100644
--- a/autosetup/cc.tcl
+++ b/autosetup/cc.tcl
@@ -13,17 +13,17 @@
## CXX - C++ compiler
## CPP - C preprocessor
## CCACHE - Set to "none" to disable automatic use of ccache
+## CPPFLAGS - Additional C preprocessor compiler flags (C and C++), before CFLAGS, CXXFLAGS
## CFLAGS - Additional C compiler flags
## CXXFLAGS - Additional C++ compiler flags
## LDFLAGS - Additional compiler flags during linking
+## LINKFLAGS - ?How is this different from LDFLAGS?
## 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
@@ -418,6 +418,13 @@ proc cc-update-settings {args} {
## # libs will be in this order: -lsocket -ldl -lc -lm
## }
## }
+#
+# If you wish to invoke something like cc-check-flags but not have -cflags updated,
+# use the following idiom:
+#
+## cc-with {} {
+## cc-check-flags ...
+## }
proc cc-with {settings args} {
if {[llength $args] == 0} {
cc-add-settings $settings
@@ -455,14 +462,22 @@ proc cc-with {settings args} {
# 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;
## }
#
+# And the command line looks like:
+#
+## CC -cflags CFLAGS CPPFLAGS conftest.c -o conftest.o
+## CXX -cflags CXXFLAGS CPPFLAGS conftest.cpp -o conftest.o
+#
+# And if linking:
+#
+## CC LDFLAGS -cflags CFLAGS conftest.c -o conftest -libs LIBS
+## CXX LDFLAGS -cflags CXXFLAGS conftest.c -o conftest -libs LIBS
+#
# Any failures are recorded in 'config.log'
#
proc cctest {args} {
@@ -508,11 +523,13 @@ proc cctest {args} {
switch -exact -- $opts(-lang) {
c++ {
set src conftest__.cpp
- lappend cmdline {*}[get-define CXX] {*}[get-define CXXFLAGS]
+ lappend cmdline {*}[get-define CXX]
+ set cflags [get-define CXXFLAGS]
}
c {
set src conftest__.c
- lappend cmdline {*}[get-define CC] {*}[get-define CFLAGS]
+ lappend cmdline {*}[get-define CC]
+ set cflags [get-define CFLAGS]
}
default {
autosetup-error "cctest called with unknown language: $opts(-lang)"
@@ -522,13 +539,14 @@ proc cctest {args} {
if {$opts(-link)} {
lappend cmdline {*}[get-define LDFLAGS]
} else {
+ lappend cflags {*}[get-define CPPFLAGS]
set tmp conftest__.o
lappend cmdline -c
}
- lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""]
- lappend cmdline $src -o $tmp {*}$opts(-libs)
+ lappend cmdline {*}$opts(-cflags) {*}[get-define cc-default-debug ""] {*}$cflags
+ lappend cmdline $src -o $tmp
if {$opts(-link)} {
- lappend cmdline {*}[get-define LIBS]
+ lappend cmdline {*}$opts(-libs) {*}[get-define LIBS]
}
# At this point we have the complete command line and the
@@ -697,6 +715,11 @@ if {[get-define CC] eq ""} {
user-error "Could not find a C compiler. Tried: [join $try ", "]"
}
+# These start empty and never come from the user or environment
+define AS_CFLAGS ""
+define AS_CPPFLAGS ""
+define AS_CXXFLAGS ""
+
define CCACHE [find-an-executable [get-env CCACHE ccache]]
# If any of these are set in the environment, propagate them to the AUTOREMAKE commandline
@@ -712,9 +735,9 @@ foreach i {CC CXX CCACHE CPP CFLAGS CXXFLAGS CXXFLAGS LDFLAGS LIBS CROSS CPPFLAG
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]"
+msg-result "C compiler...[get-define CCACHE] [get-define CC] [get-define CFLAGS] [get-define CPPFLAGS]"
if {[get-define CXX] ne "false"} {
- msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS]"
+ msg-result "C++ compiler...[get-define CCACHE] [get-define CXX] [get-define CXXFLAGS] [get-define CPPFLAGS]"
}
msg-result "Build C compiler...[get-define CC_FOR_BUILD]"
diff --git a/autosetup/system.tcl b/autosetup/system.tcl
index 15ab017..739a637 100644
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -19,7 +19,7 @@
## mandir
## includedir
#
-# If '--prefix' is not supplied, it defaults to '/usr/local' unless 'defaultprefix' is defined *before*
+# If '--prefix' is not supplied, it defaults to '/usr/local' unless 'options-defaults { prefix ... }' is used *before*
# including the 'system' module.
if {[is-defined defaultprefix]} {
@@ -52,6 +52,9 @@ options {
maintainer-mode=0
dependency-tracking=0
silent-rules=0
+ program-prefix:
+ program-suffix:
+ program-transform-name:
}
# @check-feature name { script }
diff --git a/autosetup/tmake.auto b/autosetup/tmake.auto
index 64a5712..448d317 100644
--- a/autosetup/tmake.auto
+++ b/autosetup/tmake.auto
@@ -49,6 +49,24 @@ ifconfig !CONFIGURED {
}
}
+ set configure [readfile configure]
+ # XXX Do we need also need to support a system install of tmake?
+ if {[string first {#@TMAKEUPDATED@} $configure] < 0} {
+ if {[regsub {#@@INITCHECK@@#} $configure \
+ {test -z "$TMAKE" -a -x "$dir/tmake" \&\& exec "$dir/tmake" --force --configure "$@"; #@TMAKEUPDATED@} configure]} {
+ writefile configure $configure\n
+ exec chmod +x configure
+ puts "Updated configure to invoke local tmake."
+ if {![file exec autosetup/tmake]} {
+ puts "Warning: autosetup/tmake is missing."
+ puts " Install it with: tmake --install=autosetup"
+ }
+ } else {
+ puts "Warning: configure isn't created by a recent autosetup, not updating."
+ }
+ } else {
+ puts "I see configure for tmake already exists."
+ }
if {![file exists build.spec]} {
puts "Note: I don't see build.spec. Try running: tmake --genie"
}