Home | History | Annotate | Line # | Download | only in autosetup
      1  1.1  christos Maintaining Autosetup in the SQLite Tree
      2  1.1  christos ========================================================================
      3  1.1  christos 
      4  1.1  christos This document provides some tips and reminders for the SQLite
      5  1.1  christos developers regarding using and maintaining the [Autosetup][]-based
      6  1.1  christos build infrastructure. It is not an [Autosetup][] reference.
      7  1.1  christos 
      8  1.1  christos **Table of Contents**:
      9  1.1  christos 
     10  1.1  christos - [Autosetup API Reference](#apiref)
     11  1.1  christos - [API Tips](#apitips)
     12  1.1  christos - [Ensuring TCL Compatibility](#tclcompat)
     13  1.1  christos - [Design Conventions](#conventions)
     14  1.1  christos   - Symbolic Names of Feature Flags
     15  1.1  christos   - Do Not Update Global Shared State
     16  1.1  christos - [Updating Autosetup](#updating)
     17  1.1  christos   - ***[Patching Autosetup for Project-local changes](#patching)***
     18  1.1  christos - [Branch-specific Customization](#branch-customization)
     19  1.1  christos 
     20  1.1  christos 
     21  1.1  christos ------------------------------------------------------------------------
     22  1.1  christos 
     23  1.1  christos <a name="apiref"></a>
     24  1.1  christos Autosetup API Reference
     25  1.1  christos ========================================================================
     26  1.1  christos 
     27  1.1  christos The Autosetup API is quite extensive and can be read either in
     28  1.1  christos the [files in the `autosetup` dir](/dir/autosetup) or using:
     29  1.1  christos 
     30  1.1  christos >
     31  1.1  christos ```
     32  1.1  christos $ ./configure --reference | less
     33  1.1  christos ```
     34  1.1  christos 
     35  1.1  christos That will include any docs from any TCL files in the `./autosetup` dir
     36  1.1  christos which contain certain (simple) markup defined by autosetup.
     37  1.1  christos 
     38  1.1  christos This project's own configuration-related TCL code is spread across the
     39  1.1  christos following files:
     40  1.1  christos 
     41  1.1  christos - [proj.tcl][]: project-agnostic utility code for autosetup-driven
     42  1.1  christos   projects. This file is designed to be shared between this project,
     43  1.1  christos   other projects managed under the SQLite/Hwaci umbrella
     44  1.1  christos   (e.g. Fossil), and personal projects of SQLite's developers.  It is
     45  1.1  christos   essentially an amalgamation of a decade's worth of autosetup-related
     46  1.1  christos   utility code.
     47  1.1  christos - [sqlite-config.tcl][]: utility code which is too project-specific
     48  1.1  christos   for `proj.tcl`. We split this out of `auto.def` so that it can be
     49  1.1  christos   used by both `auto.def` and...
     50  1.1  christos - [auto.def][]: the primary driver for the `./configure` process.
     51  1.1  christos   When we talk about "the configure script," we're technically
     52  1.1  christos   referring to this file, though it actually contains very little
     53  1.1  christos   of the TCL code.
     54  1.1  christos - [autoconf/auto.def][]: the main driver script for the "autoconf"
     55  1.1  christos   bundle's configure script. It is essentially a slightly trimmed-down
     56  1.1  christos   version of the main `auto.def` file. The `autoconf` dir was ported
     57  1.1  christos   from the Autotools to Autosetup in the 3.49.0 dev cycle but retains
     58  1.1  christos   the "autoconf" name to minimize downstream disruption.
     59  1.1  christos 
     60  1.1  christos 
     61  1.1  christos <a name="apitips"></a>
     62  1.1  christos Autosetup API Tips
     63  1.1  christos ========================================================================
     64  1.1  christos 
     65  1.1  christos This section briefly covers only APIs which are frequently useful in
     66  1.1  christos day-to-day maintenance and might not be immediately recognized as such
     67  1.1  christos from a casual perusal of the relevant TCL files. The complete docs of
     68  1.1  christos those with `proj-` prefix can be found in [proj.tcl][] and those with
     69  1.1  christos an `sqlite-` prefix are in [sqlite-config.tcl][]. The others are part
     70  1.1  christos of Autosetup's core packages and are scattered around [the TCL files
     71  1.1  christos in ./autosetup](/dir/autosetup).
     72  1.1  christos 
     73  1.1  christos In (mostly) alphabetical order:
     74  1.1  christos 
     75  1.1  christos - **`file-isexec filename`**\  
     76  1.1  christos   Should be used in place of `[file executable]`, as it will also
     77  1.1  christos   check for `${filename}.exe` on Windows platforms. However, on such
     78  1.1  christos   platforms it also assumes that _any_ existing file is executable.
     79  1.1  christos 
     80  1.1  christos - **`get-env VAR ?default?`**\  
     81  1.1  christos   Will fetch an "environment variable" from the first of either: (1) a
     82  1.1  christos   KEY=VALUE passed to the configure script or (2) the system's
     83  1.1  christos   environment variables. Not to be confused with `getenv`, which only
     84  1.1  christos   does the latter and is rarely, if ever, useful in this tree.
     85  1.1  christos   - **`proj-get-env VAR ?default?`**\  
     86  1.1  christos     Works like `get-env` but will, if that function finds no match,
     87  1.1  christos     look for a file named `./.env-$VAR` and, if found, return its
     88  1.1  christos     trimmed contents. This can be used, e.g., to set a developer's
     89  1.1  christos     local preferences for the default `CFLAGS`.\  
     90  1.1  christos     Tip: adding `-O0` to `.env-CFLAGS` reduces rebuild times
     91  1.1  christos     considerably at the cost of performance in `make devtest` and the
     92  1.1  christos     like.
     93  1.1  christos 
     94  1.1  christos - **`proj-fatal msg`**\  
     95  1.1  christos   Emits `$msg` to stderr and exits with non-zero. Its differences from
     96  1.1  christos   autosetup's `user-error` are purely cosmetic.
     97  1.1  christos 
     98  1.1  christos - **`proj-if-opt-truthy flag thenScript ?elseScript?`**\  
     99  1.1  christos   Evals `thenScript` if the given `--flag` is truthy, else it
    100  1.1  christos   evals the optional `elseScript`.
    101  1.1  christos 
    102  1.1  christos - **`proj-indented-notice ?-error? ?-notice? msg`**\  
    103  1.1  christos   Breaks its `msg` argument into lines, trims them, and emits them
    104  1.1  christos   with consistent indentation. Exactly how it emits depends on the
    105  1.1  christos   flags passed to it (or not), as covered in its docs. This will stick
    106  1.1  christos   out starkly from normal output and is intended to be used only for
    107  1.1  christos   important notices.
    108  1.1  christos 
    109  1.1  christos - **`proj-opt-truthy flag`**\  
    110  1.1  christos   Returns 1 if `--flag`'s value is "truthy," i.e. one of (1, on,
    111  1.1  christos   enabled, yes, true).
    112  1.1  christos 
    113  1.1  christos - **`proj-opt-was-provided FLAG`**\  
    114  1.1  christos   Returns 1 if `--FLAG` was explicitly provided to configure,
    115  1.1  christos   else 0. This distinction can be used to determine, e.g., whether
    116  1.1  christos   `--with-readline` was provided or whether we're searching for
    117  1.1  christos   readline by default. In the former case, failure to find it should
    118  1.1  christos   be treated as fatal, where in the latter case it's not.\  
    119  1.1  christos   Unlike most functions which deal with `--flags`, this one does not
    120  1.1  christos   validate that `$FLAG` is a registered flag so will not fail fatally
    121  1.1  christos   if `$FLAG` is not registered as an Autosetup option.
    122  1.1  christos 
    123  1.1  christos - **`proj-val-truthy value`**\  
    124  1.1  christos   Returns 1 if `$value` is "truthy," See `proj-opt-truthy` for the definition
    125  1.1  christos   of "truthy."
    126  1.1  christos 
    127  1.1  christos - **`proj-warn msg`**\  
    128  1.1  christos   Emits `$msg` to stderr. Closely-related is autosetup's `user-notice`
    129  1.1  christos   (described below).
    130  1.1  christos 
    131  1.1  christos - **`sqlite-add-feature-flag ?-shell? FLAG...`**\  
    132  1.1  christos   Adds the given feature flag to the CFLAGS which are specific to
    133  1.1  christos   building libsqlite3. It's intended to be passed one or more
    134  1.1  christos   `-DSQLITE_ENABLE_...`, or similar, flags. If the `-shell` flag is
    135  1.1  christos   used then it also passes its arguments to
    136  1.1  christos   `sqlite-add-shell-opt`. This is a no-op if `FLAG` is not provided or
    137  1.1  christos   is empty.
    138  1.1  christos 
    139  1.1  christos - **`sqlite-add-shell-opt FLAG...`**\  
    140  1.1  christos   The shell-specific counterpart of `sqlite-add-feature-flag` which
    141  1.1  christos   only adds the given flag(s) to the CLI-shell-specific CFLAGS.
    142  1.1  christos 
    143  1.1  christos - **`sqlite-configure BUILD-NAME {script}`**\  
    144  1.1  christos   This is where all configure `--flags` are defined for all known
    145  1.1  christos   build modes ("canonical" or "autoconf"). After processing all flags,
    146  1.1  christos   this function runs `$script`, which contains the build-mode-specific
    147  1.1  christos   configuration bits, and then runs any finalization bits which are
    148  1.1  christos   common to all build modes. The `auto.def` files are intended to contain
    149  1.1  christos   exactly two commands:
    150  1.1  christos   `use sqlite-config; sqlite-configure BUILD-NAME {script}`
    151  1.1  christos 
    152  1.1  christos - **`user-notice msg`**\  
    153  1.1  christos   Queues `$msg` to be sent to stderr, but does not emit it until
    154  1.1  christos   either `show-notices` is called or the next time autosetup would
    155  1.1  christos   output something (it internally calls `show-notices`). This can be
    156  1.1  christos   used to generate warnings between a "checking for..." message and
    157  1.1  christos   its resulting "yes/no/whatever" message in such a way as to not
    158  1.1  christos   spoil the layout of such messages.
    159  1.1  christos 
    160  1.1  christos 
    161  1.1  christos <a name="tclcompat"></a>
    162  1.1  christos Ensuring TCL Compatibility
    163  1.1  christos ========================================================================
    164  1.1  christos 
    165  1.1  christos One of the significant benefits of using Autosetup is that (A) this
    166  1.1  christos project uses many TCL scripts in the build process and (B) Autosetup
    167  1.1  christos comes with a TCL interpreter named [JimTCL][].
    168  1.1  christos 
    169  1.1  christos It is important that any TCL files used by the configure process and
    170  1.1  christos makefiles remain compatible with both [JimTCL][] and the canonical
    171  1.1  christos TCL. Though JimTCL has outstanding compatibility with canonical TCL,
    172  1.1  christos it does have a few corners with incompatibilities, e.g. regular
    173  1.1  christos expressions. If a script runs in JimTCL without using any
    174  1.1  christos JimTCL-specific features, then it's a certainty that it will run in
    175  1.1  christos canonical TCL as well. The opposite, however, is not _always_ the
    176  1.1  christos case.
    177  1.1  christos 
    178  1.1  christos When [`./configure`](/file/configure) is run, it goes through a
    179  1.1  christos bootstrapping process to find a suitable TCL with which to run the
    180  1.1  christos autosetup framework. The first step involves [finding or building a
    181  1.1  christos TCL shell](/file/autosetup/autosetup-find-tclsh).  That will first
    182  1.1  christos search for an available `tclsh` (under several common names,
    183  1.1  christos e.g. `tclsh8.6`) before falling back to compiling the copy of
    184  1.1  christos `jimsh0.c` included in the source tree. i.e. it will prefer to use a
    185  1.1  christos system-installed TCL for running the configure script. Once it finds
    186  1.1  christos (or builds) a TCL shell, it then runs [a sanity test to ensure that
    187  1.1  christos the shell is suitable](/file/autosetup/autosetup-test-tclsh) before
    188  1.1  christos using it to run the main autosetup app.
    189  1.1  christos 
    190  1.1  christos There are two simple ways to ensure that running of the configure
    191  1.1  christos process uses JimTCL instead of the canonical `tclsh`, and either
    192  1.1  christos approach provides equally high assurances about configure script
    193  1.1  christos compatibility across TCL implementations:
    194  1.1  christos 
    195  1.1  christos 1. Build on a system with no `tclsh` installed in the `$PATH`. In that
    196  1.1  christos    case, the configure process will fall back to building the in-tree
    197  1.1  christos    copy of JimTCL.
    198  1.1  christos 
    199  1.1  christos 2. Manually build `./jimsh0` in the top of the checkout with:\  
    200  1.1  christos    `cc -o jimsh0 autosetup/jimsh0.c`\  
    201  1.1  christos    With that in place, the configure script will prefer to use that
    202  1.1  christos    before looking for a system-level `tclsh`. Be aware, though, that
    203  1.1  christos    `make distclean` will remove that file.
    204  1.1  christos 
    205  1.1  christos **Note that `./jimsh0` is distinctly different from the `./jimsh`**
    206  1.1  christos which gets built for code-generation purposes.  The latter requires
    207  1.1  christos non-default build flags to enable features which are
    208  1.1  christos platform-dependent, most notably to make its `[file normalize]` work.
    209  1.1  christos This means, for example, that the configure script and its utility
    210  1.1  christos APIs must not use `[file normalize]`, but autosetup provides a
    211  1.1  christos TCL-only implementation of `[file-normalize]` (note the dash) for
    212  1.1  christos portable use in the configure script. Contrariwise, code-generation
    213  1.1  christos scripts invoked via `make` may use `[file normalize]`, as they'll use
    214  1.1  christos `./jimsh` or `tclsh` instead of `./jimsh0`.
    215  1.1  christos 
    216  1.1  christos 
    217  1.1  christos Known TCL Incompatibilities
    218  1.1  christos ------------------------------------------------------------------------
    219  1.1  christos 
    220  1.1  christos A summary of known incompatibilities in JimTCL
    221  1.1  christos 
    222  1.1  christos - **CRNL line endings**: prior to 2025-02-05 `fconfigure -translation ...`
    223  1.1  christos   was a no-op in JimTCL, and it emits CRNL line endings by default on
    224  1.1  christos   Windows.  Since then, it supports `-translation binary`, which is
    225  1.1  christos   close enough to `-translation lf` for our purposes. When working
    226  1.1  christos   with files using the `open` command, it is important to use mode
    227  1.1  christos   `"rb"` or `"wb"`, as appropriate, so that the output does not get
    228  1.1  christos   CRNL-mangled on Windows.
    229  1.1  christos 
    230  1.1  christos - **`file copy`** does not support multiple source files. See
    231  1.1  christos   [](/info/61f18c96183867fe) for a workaround.
    232  1.1  christos 
    233  1.1  christos - **Regular expressions**:
    234  1.1  christos 
    235  1.1  christos   - Patterns treat `\nnn` octal values as back-references (which it
    236  1.1  christos     does not support). Those can be reformulated as demonstrated in
    237  1.1  christos     [](/info/aeac23359bb681c0).
    238  1.1  christos 
    239  1.1  christos   - `regsub` does not support the `\y` flag. A workaround is demonstrated
    240  1.1  christos     in [](/info/c2e5dd791cce3ec4).
    241  1.1  christos 
    242  1.1  christos 
    243  1.1  christos <a name="conventions"></a>
    244  1.1  christos Design Conventions
    245  1.1  christos ========================================================================
    246  1.1  christos 
    247  1.1  christos This section describes the motivations for the most glaring of the
    248  1.1  christos build's design decisions, in particular how they deviate from
    249  1.1  christos historical, or even widely-conventional, practices.
    250  1.1  christos 
    251  1.1  christos Symbolic Names of Feature Flags
    252  1.1  christos ------------------------------------------------------------------------
    253  1.1  christos 
    254  1.1  christos Historically, the project's makefile has exclusively used
    255  1.1  christos `UPPER_UNDERSCORE` form for makefile variables. This build, however,
    256  1.1  christos primarily uses `X.y` format, where `X` is often a category label,
    257  1.1  christos e.g. `CFLAGS`, and `y` is the specific instance of that category,
    258  1.1  christos e.g. `CFLAGS.readline`.
    259  1.1  christos 
    260  1.1  christos When the configure script exports flags for consumption by filtered
    261  1.1  christos files, e.g. [Makefile.in][] and the generated
    262  1.1  christos `sqlite_cfg.h`, it does so in the more conventional `X_Y` form because
    263  1.1  christos those flags get exported as as C `#define`s to `sqlite_cfg.h`, where
    264  1.1  christos dots are not permitted.
    265  1.1  christos 
    266  1.1  christos The `X.y` convention is used in the makefiles primarily because the
    267  1.1  christos person who did the initial port finds that considerably easier on the
    268  1.1  christos eyes and fingers. In practice, the `X_Y` form of such exports is used
    269  1.1  christos exactly once in [Makefile.in][], where it's translated from `@X_Y@`
    270  1.1  christos into into `X.y` form for consumption by [Makefile.in][] and
    271  1.1  christos [main.mk][]. For example:
    272  1.1  christos 
    273  1.1  christos >
    274  1.1  christos ```
    275  1.1  christos LDFLAGS.shobj = @SHOBJ_LDFLAGS@
    276  1.1  christos LDFLAGS.zlib = @LDFLAGS_ZLIB@
    277  1.1  christos LDFLAGS.math = @LDFLAGS_MATH@
    278  1.1  christos ```
    279  1.1  christos 
    280  1.1  christos (That first one is defined by autosetup, and thus applies "LDFLAGS" as
    281  1.1  christos the suffix rather than the prefix. Which is more legible is a matter
    282  1.1  christos of taste, for which there is no accounting.)
    283  1.1  christos 
    284  1.1  christos 
    285  1.1  christos Do Not Update Global Shared State
    286  1.1  christos ------------------------------------------------------------------------
    287  1.1  christos 
    288  1.1  christos In both the legacy Autotools-driven build and common Autosetup usage,
    289  1.1  christos feature tests performed by the configure script may amend global flags
    290  1.1  christos such as `LIBS`, `LDFLAGS`, and `CFLAGS`[^as-cflags].  That's
    291  1.1  christos appropriate for a makefile which builds a single deliverable, but less
    292  1.1  christos so for makefiles which produce multiple deliverables. Drawbacks of
    293  1.1  christos that approach include:
    294  1.1  christos 
    295  1.1  christos - It's unlikely that every single deliverable will require the same
    296  1.1  christos   core set of those flags.
    297  1.1  christos - It can be difficult to determine the origin of any given change to
    298  1.1  christos   that global state because those changes are hidden behind voodoo
    299  1.1  christos   performed outside the immediate visibility of the configure script's
    300  1.1  christos   maintainer.
    301  1.1  christos - It can force the maintainers of the configure script to place tests
    302  1.1  christos   in a specific order so that the resulting flags get applied at
    303  1.1  christos   the correct time and/or in the correct order.\  
    304  1.1  christos   (A real-life example: before the approach described below was taken
    305  1.1  christos   to collecting build-time flags, the test for `-rpath` had to come
    306  1.1  christos   _after_ the test for zlib because the results of the `-rpath` test
    307  1.1  christos   implicitly modified global state which broke the zlib feature
    308  1.1  christos   test. Because the feature tests no longer (intentionally) modify
    309  1.1  christos   shared global state, that is not an issue.)
    310  1.1  christos 
    311  1.1  christos In this build, cases where feature tests modify global state in such a
    312  1.1  christos way that it may impact later feature tests are either (A) very
    313  1.1  christos intentionally defined to do so (e.g. the `--with-wasi-sdk` flag has
    314  1.1  christos invasive side-effects) or (B) are oversights (i.e. bugs).
    315  1.1  christos 
    316  1.1  christos This tree's [configure script][auto.def], [utility APIs][proj.tcl],
    317  1.1  christos [Makefile.in][], and [main.mk][] therefore strive to separate the
    318  1.1  christos results of any given feature test into its own well-defined
    319  1.1  christos variables. For example:
    320  1.1  christos 
    321  1.1  christos - The linker flags for zlib are exported from the configure script as
    322  1.1  christos   `LDFLAGS_ZLIB`, which [Makefile.in][] and [main.mk][] then expose as
    323  1.1  christos   `LDFLAGS.zlib`.
    324  1.1  christos - `CFLAGS_READLINE` (a.k.a. `CFLAGS.readline`) contains the `CFLAGS`
    325  1.1  christos   needed for including `libreadline`, `libedit`, or `linenoise`, and
    326  1.1  christos   `LDFLAGS_READLINE` (a.k.a. `LDFLAGS.readline`) is its link-time
    327  1.1  christos   counterpart.
    328  1.1  christos 
    329  1.1  christos It is then up to the Makefile to apply and order the flags however is
    330  1.1  christos appropriate.
    331  1.1  christos 
    332  1.1  christos At the end of the configure script, the global `CFLAGS` _ideally_
    333  1.1  christos holds only flags which are either relevant to all targets or, failing
    334  1.1  christos that, will have no unintended side-effects on any targets. That said:
    335  1.1  christos clients frequently pass custom `CFLAGS` to `./configure` or `make` to
    336  1.1  christos set library-level feature toggles, e.g. `-DSQLITE_OMIT_FOO`, in which
    337  1.1  christos case there is no practical way to avoid "polluting" the builds of
    338  1.1  christos arbitrary makefile targets with those. _C'est la vie._
    339  1.1  christos 
    340  1.1  christos 
    341  1.1  christos [^as-cflags]: But see this article for a detailed discussion of how
    342  1.1  christos     autosetup currently deals specifically with CFLAGS:
    343  1.1  christos     <https://msteveb.github.io/autosetup/articles/handling-cflags/>
    344  1.1  christos 
    345  1.1  christos 
    346  1.1  christos <a name="updating"></a>
    347  1.1  christos Updating Autosetup
    348  1.1  christos ========================================================================
    349  1.1  christos 
    350  1.1  christos Updating autosetup is, more often than not, painless. It requires having
    351  1.1  christos a checked-out copy of [the autosetup git repository][autosetup-git]:
    352  1.1  christos 
    353  1.1  christos >
    354  1.1  christos ```
    355  1.1  christos $ git clone https://github.com/msteveb/autosetup
    356  1.1  christos $ cd autosetup
    357  1.1  christos # Or, if it's already checked out:
    358  1.1  christos $ git pull
    359  1.1  christos ```
    360  1.1  christos 
    361  1.1  christos Then, from the top-most directory of an SQLite checkout:
    362  1.1  christos 
    363  1.1  christos >
    364  1.1  christos ```
    365  1.1  christos $ /path/to/autosetup-checkout/autosetup --install .
    366  1.1  christos $ fossil status # show the modified files
    367  1.1  christos ```
    368  1.1  christos 
    369  1.1  christos Unless the upgrade made any incompatible changes (which is exceedingly
    370  1.1  christos rare), that's all there is to it.  After that's done, **apply a patch
    371  1.1  christos for the change described in the following section**, test the
    372  1.1  christos configure process, and check it in.
    373  1.1  christos 
    374  1.1  christos <a name="patching"></a>
    375  1.1  christos Patching Autosetup for Project-local Changes
    376  1.1  christos ------------------------------------------------------------------------
    377  1.1  christos 
    378  1.1  christos The autosetup files require the following patches after updating
    379  1.1  christos from their upstream sources:
    380  1.1  christos 
    381  1.1  christos ### `--debug` flag
    382  1.1  christos 
    383  1.1  christos Autosetup reserves the flag name **`--debug`** for its own purposes,
    384  1.1  christos and its own special handling of `--enable-...` flags makes `--debug`
    385  1.1  christos an alias for `--enable-debug`. As this project has a long history of
    386  1.1  christos using `--enable-debug`, we patch autosetup to use the name
    387  1.1  christos `--autosetup-debug` in place of `--debug`. That requires (as of this
    388  1.1  christos writing) four small edits in
    389  1.1  christos [/autosetup/autosetup](/file/autosetup/autosetup), as demonstrated in
    390  1.1  christos [check-in 3296c8d3](/info/3296c8d3).
    391  1.1  christos 
    392  1.1  christos If autosetup is upgraded and this patch is _not_ applied the invoking
    393  1.1  christos `./configure` will fail loudly because of the declaration of the
    394  1.1  christos `debug` flag in `auto.def` - duplicated flags are not permitted.
    395  1.1  christos 
    396  1.1  christos ### Fail on `malloc()` error
    397  1.1  christos 
    398  1.1  christos See [check-in 72c8a5b94cdf5d](/info/72c8a5b94cdf5d).
    399  1.1  christos 
    400  1.1  christos 
    401  1.1  christos <a name="branch-customization"></a>
    402  1.1  christos Branch-specific Customization
    403  1.1  christos ========================================================================
    404  1.1  christos 
    405  1.1  christos Certain vendor-specific branches require slight configure script
    406  1.1  christos customization. Rather than editing `sqlite-config.tcl` for this,
    407  1.1  christos which frequently leads to merge conflicts, the following approach
    408  1.1  christos is recommended:
    409  1.1  christos 
    410  1.1  christos In the vendor-specific branch, create a file named
    411  1.1  christos `autosetup/sqlite-custom.tcl`.
    412  1.1  christos 
    413  1.1  christos That file should contain the following content...
    414  1.1  christos 
    415  1.1  christos If flag customization is required, add:
    416  1.1  christos 
    417  1.1  christos >
    418  1.1  christos ```
    419  1.1  christos proc sqlite-custom-flags {} {
    420  1.1  christos   # If any existing --flags require different default values
    421  1.1  christos   # then call:
    422  1.1  christos   options-defaults {
    423  1.1  christos     flag-name new-default-value
    424  1.1  christos     ...
    425  1.1  christos   }
    426  1.1  christos   # ^^^ That will replace the default value but will not update
    427  1.1  christos   # the --help text, which may lead to some confusion:
    428  1.1  christos   # https://github.com/msteveb/autosetup/issues/77
    429  1.1  christos 
    430  1.1  christos   return {
    431  1.1  christos    {*} {
    432  1.1  christos      new-flag-name => {Help text}
    433  1.1  christos      ...
    434  1.1  christos    }
    435  1.1  christos   }; #see below
    436  1.1  christos }
    437  1.1  christos ```
    438  1.1  christos 
    439  1.1  christos That function must return either an empty string or a list in the form
    440  1.1  christos used internally by [sqlite-config.tcl][]'s `sqlite-configure`.
    441  1.1  christos 
    442  1.1  christos Next, define:
    443  1.1  christos 
    444  1.1  christos >
    445  1.1  christos ```
    446  1.1  christos proc sqlite-custom-handle-flags {} {
    447  1.1  christos   ... do any custom flag handling here ...
    448  1.1  christos }
    449  1.1  christos ```
    450  1.1  christos 
    451  1.1  christos That function, if defined, will be called relatively late in the
    452  1.1  christos configure process, before any filtered files are generated but after
    453  1.1  christos all other significant processing.
    454  1.1  christos 
    455  1.1  christos 
    456  1.1  christos [Autosetup]: https://msteveb.github.io/autosetup/
    457  1.1  christos [auto.def]: /file/auto.def
    458  1.1  christos [autoconf/auto.def]: /file/autoconf/auto.def
    459  1.1  christos [autosetup-git]: https://github.com/msteveb/autosetup
    460  1.1  christos [proj.tcl]: /file/autosetup/proj.tcl
    461  1.1  christos [sqlite-config.tcl]: /file/autosetup/sqlite-config.tcl
    462  1.1  christos [Makefile.in]: /file/Makefile.in
    463  1.1  christos [main.mk]: /file/main.mk
    464  1.1  christos [JimTCL]: https://msteveb.github.io/jimtcl/
    465