aboutsummaryrefslogtreecommitdiff
path: root/autosetup/system.tcl
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2017-04-22 20:30:59 +1000
committerSteve Bennett <steveb@workware.net.au>2017-04-22 20:31:22 +1000
commit31a9f433f06b8cc426d281436a628a5fdd3bf755 (patch)
tree42ebfbbcc964f60a8432b3b42f2880db44926287 /autosetup/system.tcl
parenta9c149f459c9711ce5e36efa7f4eca1fe57622d9 (diff)
downloadjimtcl-31a9f433f06b8cc426d281436a628a5fdd3bf755.zip
jimtcl-31a9f433f06b8cc426d281436a628a5fdd3bf755.tar.gz
jimtcl-31a9f433f06b8cc426d281436a628a5fdd3bf755.tar.bz2
build: Update autosetup to v0.6.6-8-g062d650
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'autosetup/system.tcl')
-rw-r--r--autosetup/system.tcl87
1 files changed, 52 insertions, 35 deletions
diff --git a/autosetup/system.tcl b/autosetup/system.tcl
index 7b4045d..1414cb3 100644
--- a/autosetup/system.tcl
+++ b/autosetup/system.tcl
@@ -4,12 +4,12 @@
# @synopsis:
#
# This module supports common system interrogation and options
-# such as --host, --build, --prefix, and setting srcdir, builddir, and EXEEXT
+# such as '--host', '--build', '--prefix', and setting 'srcdir', 'builddir', and 'EXEEXT'.
#
-# It also support the 'feature' naming convention, where searching
-# for a feature such as sys/type.h defines HAVE_SYS_TYPES_H
+# It also support the "feature" naming convention, where searching
+# for a feature such as 'sys/type.h' defines 'HAVE_SYS_TYPES_H'.
#
-# It defines the following variables, based on --prefix unless overridden by the user:
+# It defines the following variables, based on '--prefix' unless overridden by the user:
#
## datadir
## sysconfdir
@@ -19,13 +19,18 @@
## mandir
## includedir
#
-module-options {
+# If '--prefix' is not supplied, it defaults to '/usr/local' unless 'defaultprefix' is defined *before*
+# including the 'system' module.
+
+set defaultprefix [get-define defaultprefix /usr/local]
+
+module-options [subst -noc -nob {
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)}
+ prefix:dir => {the target directory for the build (defaults to '$defaultprefix')}
# These (hidden) options are supported for autoconf/automake compatibility
exec-prefix:
@@ -42,10 +47,18 @@ module-options {
localstatedir:
maintainer-mode=0
dependency-tracking=0
-}
+}]
-# Returns 1 if exists, or 0 if not
+# @check-feature name { script }
+#
+# defines feature '$name' to the return value of '$script',
+# which should be 1 if found or 0 if not found.
+#
+# e.g. the following will define 'HAVE_CONST' to 0 or 1.
#
+## check-feature const {
+## cctest -code {const int _x = 0;}
+## }
proc check-feature {name code} {
msg-checking "Checking for $name..."
set r [uplevel 1 $code]
@@ -60,9 +73,10 @@ proc check-feature {name code} {
# @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.
+# Returns the value of feature '$name' 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
@@ -70,9 +84,10 @@ proc have-feature {name {default 0}} {
# @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.
+# Sets the feature 'define' to '$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
@@ -80,7 +95,7 @@ proc define-feature {name {value 1}} {
# @feature-checked name
#
-# Returns 1 if the feature has been checked, whether true or not
+# Returns 1 if feature '$name' has been checked, whether true or not.
#
proc feature-checked {name} {
is-defined [feature-define-name $name]
@@ -88,17 +103,20 @@ proc feature-checked {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 a "feature" name to the corresponding "define",
+# e.g. 'sys/stat.h' becomes 'HAVE_SYS_STAT_H'.
#
-# Converts * to P and all non-alphanumeric to underscore.
+# 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.
+# @write-if-changed filename contents ?script?
+#
+# If '$filename' doesn't exist, or it's contents are different to '$contents',
+# the file is written and '$script' is evaluated.
+#
# Otherwise a "file is unchanged" message is displayed.
proc write-if-changed {file buf {script {}}} {
set old [readfile $file ""]
@@ -112,16 +130,16 @@ proc write-if-changed {file buf {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
+# 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 with the corresponding
-# define, if it exists, or left unchanged if not.
+# Each pattern of the form '@define@' is replaced with the corresponding
+# "define", if it exists, or left unchanged if not.
#
-# The special value @srcdir@ is substituted with the relative
+# 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
+# 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:
@@ -131,14 +149,14 @@ proc write-if-changed {file buf {script {}}} {
## lines
## @endif
#
-# Where 'name' is a defined variable name and @else is optional.
+# 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
+# Where the first form is true if the variable is defined, but not empty nor 0.
#
# Currently these expressions can't be nested.
#
@@ -210,7 +228,7 @@ proc make-template {template {out {}}} {
}
# build/host tuples and cross-compilation prefix
-set build [opt-val build]
+set build [lindex [opt-val build] end]
define build_alias $build
if {$build eq ""} {
define build [config_guess]
@@ -218,7 +236,7 @@ if {$build eq ""} {
define build [config_sub $build]
}
-set host [opt-val host]
+set host [lindex [opt-val host] end]
define host_alias $host
if {$host eq ""} {
define host [get-define build]
@@ -229,8 +247,7 @@ if {$host eq ""} {
}
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]]
+set prefix [lindex [opt-val prefix $defaultprefix] end]
# These are for compatibility with autoconf
define target [get-define host]
@@ -241,7 +258,7 @@ define srcdir $autosetup(srcdir)
define top_srcdir [get-env top_srcdir [get-define srcdir]]
# autoconf supports all of these
-set exec_prefix [opt-val exec-prefix $prefix]
+set exec_prefix [lindex [opt-val exec-prefix $prefix] end]
define exec_prefix $exec_prefix
foreach {name defpath} {
bindir /bin
@@ -249,7 +266,7 @@ foreach {name defpath} {
libexecdir /libexec
libdir /lib
} {
- define $name [opt-val $name $exec_prefix$defpath]
+ define $name [lindex [opt-val $name $exec_prefix$defpath] end]
}
foreach {name defpath} {
datadir /share
@@ -260,7 +277,7 @@ foreach {name defpath} {
mandir /share/man
includedir /include
} {
- define $name [opt-val $name $prefix$defpath]
+ define $name [lindex [opt-val $name $prefix$defpath] end]
}
define SHELL [get-env SHELL [find-an-executable sh bash ksh]]