Elaborate on how autosetup selects a tclsh to use.

FossilOrigin-Name: d3887895a33742fb1fc97235cf897d295b237a9fb5a84031826f9c1018106f18
This commit is contained in:
stephan 2024-11-06 12:13:04 +00:00
parent 7e3e031182
commit 9243eb4ab8
3 changed files with 37 additions and 29 deletions

View File

@ -114,33 +114,41 @@ script runs in JimTCL without using any JimTCL-specific features, then
it's a certainty that it will run in canonical TCL as well. The
opposite, however, is not _always_ the case.
By default, the configure script will search for an available `tclsh`
(under several common names, e.g. `tclsh8.6`) before falling back to
compiling the copy of `jimsh0.c` included in the source tree.
When [`./configure`](/file/configure) is run, it goes through a
bootstrapping process to find a suitable TCL with which to run the
autosetup framework. The first step involves [finding or building a
TCL shell](/file/autosetup/autosetup-find-tclsh). That will first
search for an available `tclsh` (under several common names,
e.g. `tclsh8.6`) before falling back to compiling the copy of
`jimsh0.c` included in the source tree. i.e. it will prefer to use a
system-installed TCL for running the configure script. Once it finds
(or builds) a TCL shell, it then runs [a sanity test to ensure that
the shell is suitable](/file/autosetup/autosetup-test-tclsh) before
using it to run the main autosetup app.
There are two simple ways to ensure that the configure process uses
JimTCL instead of the canonical `tclsh`, and either approach provides
equally high assurances about configure script compatibility across
TCL implementations:
There are two simple ways to ensure that running of the configure
process uses JimTCL instead of the canonical `tclsh`, and either
approach provides equally high assurances about configure script
compatibility across TCL implementations:
1. Build on a system with no `tclsh` installed. In that case, the
configure process will fall back to building the in-tree copy of
JimTCL.
1. Build on a system with no `tclsh` installed in the `$PATH`. In that
case, the configure process will fall back to building the in-tree
copy of JimTCL.
2. Manually build `./jimsh0` in the top of the checkout with:\
`cc -o jimsh0 autosetup/jimsh0.c`\
With that in place, the configure script will prefer to use that
before looking for a system-level `tclsh`. Note that `make distclean`
will remove that file.
before looking for a system-level `tclsh`. Be aware, though, that
`make distclean` will remove that file.
**Note that `jimsh0` is distinctly different** from the `jimsh` which
gets built for code-generation purposes. The latter requires
non-default build flags to enable features which are
platform-dependent, most notably to make its `[file normalize]`
work. This means, for example, that the configure script and its
utility APIs must not use `[file normalize]`, but autosetup provides a
TCL implementation of `[file-normalize]` (note the dash) for portable
use in the configure script.
platform-dependent, most notably to make its `[file normalize]` work.
This means, for example, that the configure script and its utility
APIs must not use `[file normalize]`, but autosetup provides a TCL
implementation of `[file-normalize]` (note the dash) for portable use
in the configure script.
<a name="conventions"></a>
@ -189,7 +197,7 @@ Do Not Update Global Shared State
In both the legacy Autotools-driven build and in common Autosetup
usage, feature tests performed by the configure script may amend
global flags such as `CFLAGS`, `LDFLAGS`, and `LIBS`[^as-cflags]. That's
global flags such as `LIBS`, `LDFLAGS`, and `CFLAGS`[^as-cflags]. That's
appropriate for a makefile which builds a single deliverable, but less
so for makefiles which produce multiple deliverables. Drawbacks of
that approach include:
@ -212,7 +220,7 @@ that approach include:
In this build, cases where feature tests modify global state in such a
way that it may impact later feature tests are either (A) very
intentionally defined to do so (e.g. the `--with-wasi-sdk` has
intentionally defined to do so (e.g. the `--with-wasi-sdk` flag has
invasive side-effects) or (B) are oversights (i.e. bugs).
This tree's [configure script][auto.def], [utility APIs][proj.tcl],
@ -241,8 +249,8 @@ arbitrary makefile targets with those. _C'est la vie._
[^as-cflags]: But see this article for a detailed discussion of how
autosetup currently deals specifically with CFLAGS:
<https://msteveb.github.io/autosetup/articles/handling-cflags/>
autosetup currently deals specifically with CFLAGS:
<https://msteveb.github.io/autosetup/articles/handling-cflags/>
<a name="updating"></a>

View File

@ -1,5 +1,5 @@
C Fix\stypo\sin\sthe\sLICENSE.md\sfile.
D 2024-11-06T10:09:21.914
C Elaborate\son\show\sautosetup\sselects\sa\stclsh\sto\suse.
D 2024-11-06T12:13:04.398
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@ -37,7 +37,7 @@ F autoconf/tea/win/rules.vc 94a18c3e453535459b4a643983acca52fb8756e79055bd2ad4b0
F autoconf/tea/win/targets.vc 96a25a1fa6e9e9cfb348fd3760a5395b4ce8acafc8ed10f0412937ec200d5dbd
F autosetup/LICENSE 41a26aebdd2cd185d1e2b210f71b7ce234496979f6b35aef2cbf6b80cbed4ce4
F autosetup/README.autosetup a78ff8c4a3d2636a4268736672a74bf14a82f42687fcf0631a70c516075c031e
F autosetup/README.md fd7d8b3cd25ddeb6f6041be14a17923a64c30c1855825224d34dc2c28fa8ee94
F autosetup/README.md 78f434bc13029a7ddf4d62fb0c82216f1dceaee448239022a1ce49230925b4c9
F autosetup/autosetup 9416ffdcdd6e2dbf7f6d1e5c890078518930f8af7722a950eacc28c7f151d2d6 x
F autosetup/autosetup-config.guess dfa101c5e8220e864d5e9c72a85e87110df60260d36cb951ad0a85d6d9eaa463 x
F autosetup/autosetup-config.sub a38fb074d0dece01cf919e9fb534a26011608aa8fa606490864295328526cd73 x
@ -2200,8 +2200,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 2919a61bd4f8cb4f53462d4807cbc04ac5f71dd437cd693538754cf3f17d00cc
R e657929838382908e594a0464cd69699
U drh
Z 5889a5c1931f6955993ec7647ef0ded1
P 0588cc5c2fad980aa67402f4fe959a499d711ff23903a521af1b1abc4586c802
R 38a47456c93afcec3fbbb28bb999fc81
U stephan
Z 0201db4089d5c5c84f67e4e19c93d1c5
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
0588cc5c2fad980aa67402f4fe959a499d711ff23903a521af1b1abc4586c802
d3887895a33742fb1fc97235cf897d295b237a9fb5a84031826f9c1018106f18