SQLite

Check-in [1cc8d16b63]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bring the 3.49 branch's configure-related files up to par with the current trunk.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | branch-3.49
Files: files | file ages | folders
SHA3-256: 1cc8d16b636de128ca5e9c6cf7630fb323e2969aaac984ebee928b0fe690b84b
User & Date: stephan 2025-02-13 14:45:47.956
Context
2025-02-13
16:31
When using the --out-implib build option, install the generated .dll.a file to PREFIX/lib. (check-in: 8e8037bafc user: stephan tags: branch-3.49)
14:45
Bring the 3.49 branch's configure-related files up to par with the current trunk. (check-in: 1cc8d16b63 user: stephan tags: branch-3.49)
2025-02-12
16:59
configure --help cleanups and eliminate the use of a JS-esque inner function in sqlite-config.tcl. No functional changes. (check-in: 6df859cd18 user: stephan tags: trunk)
14:51
Tiny tcl comment tweaks. No functional changes. (check-in: da94e551c0 user: stephan tags: trunk)
2025-02-11
17:22
Rename a configure-internal function and fix handling of --dump-defines for the autoconf bundle. (check-in: 3f539d8157 user: stephan tags: branch-3.49)
Changes
Unified Diff Ignore Whitespace Patch
Changes to auto.def.
1
2
3
4
5
6
7
8
#/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# SQLite project.
#
# This script should be kept compatible with JimTCL, a copy of which
# is included in this source tree as ./autosetup/jimsh0.c. The number
|







1
2
3
4
5
6
7
8
#!/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# SQLite project.
#
# This script should be kept compatible with JimTCL, a copy of which
# is included in this source tree as ./autosetup/jimsh0.c. The number
Changes to autoconf/auto.def.
1
2
3
4
5
6
7
8
#/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# "autoconf" bundle of the SQLite project.
#
# This script must be kept compatible with JimTCL, a copy of which is
# included in this source tree as ./autosetup/jimsh0.c.
|







1
2
3
4
5
6
7
8
#!/do/not/tclsh
# ^^^ help out editors which guess this file's content type.
#
# This is the main autosetup-compatible configure script for the
# "autoconf" bundle of the SQLite project.
#
# This script must be kept compatible with JimTCL, a copy of which is
# included in this source tree as ./autosetup/jimsh0.c.
Changes to autosetup/sqlite-config.tcl.
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121


122



123
124
125
126

127
128
129
130
131
132
133
134
135
136

137
138
139
140
141


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157

158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177

178
179

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
211
212

213

214
215
216
217
218
219
220



221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248
249
250
251

252
253

254
255
256
257

258
259

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
  #     - [opt-str ...] - see the docs in ./autosetup/autosetup
  #
  # [proj-opt-was-provided] can be used to determine whether a flag was
  # explicitly provided, which is often useful for distinguishing from
  # the case of a default value.
  ########################################################################
  set allFlags {
    # Structure: a list of M {Z}, where M is a descriptive option
    # group name and Z is a list of X Y pairs. X is a list of
    # $buildMode name(s) to which these flags apply, or {*} to apply
    # to all builds. Y is a {block} in the form expected by
    # autosetup's [options] command.  Each block which is applicable
    # to $buildMode is appended to a new list before that list is
    # passed on to [options]. The order of each Y and sub-Y is
    # retained, which is significant for rendering of --help.

    # When writing {help text blocks}, be aware that autosetup formats


    # them differently (left-aligned, directly under the --flag) if the



    # block starts with a newline. It does NOT expand vars and commands,
    # but we use a [subst] call below which will replace (only) var
    # refs.


    build-modes {
      {*} {
        shared=1             => {Disable build of shared libary}
        static=1             => {Disable build of static library (mostly)}
      }
      {canonical} {
        amalgamation=1       => {Disable the amalgamation and instead build all files separately.}
      }
    }


    lib-features {
      {*} {
        threadsafe=1         => {Disable mutexing}
        with-tempstore:=no   => {Use an in-RAM database for temporary tables: never,no,yes,always}
        largefile=1          => {Disable large file support}


        load-extension=1     => {Disable loading of external extensions}
        math=1               => {Disable math functions}
        json=1               => {Disable JSON functions}
        memsys5              => {Enable MEMSYS5}
        memsys3              => {Enable MEMSYS3}
        fts3                 => {Enable the FTS3 extension}
        fts4                 => {Enable the FTS4 extension}
        fts5                 => {Enable the FTS5 extension}
        update-limit         => {Enable the UPDATE/DELETE LIMIT clause}
        geopoly              => {Enable the GEOPOLY extension}
        rtree                => {Enable the RTREE extension}
        session              => {Enable the SESSION extension}
        all                  => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
      }
    }


    tcl {
      {canonical} {
        with-tcl:DIR         =>
        {Directory containing tclConfig.sh or a directory one level up from
          that, from which we can derive a directory containing tclConfig.sh.
          A dir name of "prefix" is equivalent to the directory specified by
          the --prefix flag.}
        with-tclsh:PATH      =>
        {Full pathname of tclsh to use.  It is used for (A) trying to find
          tclConfig.sh and (B) all TCL-based code generation.  Warning: if
          its containing dir has multiple tclsh versions, it may select the
          wrong tclConfig.sh!}
        tcl=1                =>
        {Disable components which require TCL, including all tests.
          This tree requires TCL for code generation but can use the in-tree
          copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the
          test code require a canonical tclsh.}
      }
    }


    line-editing {
      {*} {

        readline=1           => {Disable readline support}
        # --with-readline-lib is a backwards-compatible alias for
        # --with-readline-ldflags
        with-readline-lib:
        with-readline-ldflags:=auto
        => {Readline LDFLAGS, e.g. -lreadline -lncurses}
        # --with-readline-inc is a backwards-compatible alias for
        # --with-readline-cflags.
        with-readline-inc:
        with-readline-cflags:=auto
        => {Readline CFLAGS, e.g. -I/path/to/includes}
        with-readline-header:PATH
        => {Full path to readline.h, from which --with-readline-cflags will be derived}

        with-linenoise:DIR   => {Source directory for linenoise.c and linenoise.h}

        editline=0           => {Enable BSD editline support}
      }
    }


    icu {
      {*} {
        with-icu-ldflags:LDFLAGS
        => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}

        with-icu-cflags:CFLAGS
        => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include}


        with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config}


        icu-collations=0      => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config}

      }
    }


    alternative-builds {
      {canonical} {
        with-wasi-sdk:=/opt/wasi-sdk
        => {Top-most dir of the wasi-sdk for a WASI build}

        with-emsdk:=auto     => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.}

      }
    }

    # Note that using the --debug/--enable-debug flag here requires patching
    # autosetup/autosetup to rename the --debug to --autosetup-debug.
    developer {
      {*} {



        with-debug=0
        debug=0              =>
        {Enable debug build flags. This option will impact performance by
          as much as 4x, as it includes large numbers of assert()s in
          performance-critical loops.  Never use --debug for production
          builds.}

        scanstatus           => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag}
      }
      {canonical} {
        dev                  => {Enable dev-mode build: automatically enables certain other flags}
        test-status          => {Enable status of tests}
        gcov=0               => {Enable coverage testing using gcov}
        linemacros           => {Enable #line macros in the amalgamation}
        dynlink-tools        => {Dynamically link libsqlite3 to certain tools which normally statically embed it.}
      }
      {*} {
        dump-defines=0       => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)}
      }
    }


    packaging {
      {*} {
        # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded
        soname:=legacy       =>
        {SONAME for libsqlite3.so. "none", or not using this flag, sets no
          soname. "legacy" sets it to its historical value of
          libsqlite3.so.0.  A value matching the glob "libsqlite3.*" sets
          it to that literal value. Any other value is assumed to be a
          suffix which gets applied to "libsqlite3.so.",
          e.g. --soname=9.10 equates to "libsqlite3.so.9.10".
        }

        out-implib=0         =>
        {Enable use of --out-implib linker flag to generate an "import library" for the DLL}

      }
    }
  }; # $allOpts


  set opts {}
  foreach {group XY} [subst -nobackslashes -nocommands [proj-strip-hash-comments $allFlags]] {

    foreach {X Y} $XY {
      if { $buildMode in $X || "*" in $X } {
        foreach y $Y {
          lappend opts $y
        }
      }
    }
  }
  #puts "options = $opts"
  #exit 0
  options $opts
  sqlite-post-options-init
}; # sqlite-config-bootstrap

########################################################################
# Runs some common initialization which must happen immediately after
# autosetup's [options] function is called. This is also a convenient







|
|
|






|
>
>
|
>
>
>
|
|
<

>






|



>





>
>
















>


|
|
|
|
|
|
|
|
|
|
|
|
|
|
|



>


>
|




|




|

|
>
|
>
|



>



|
>

|
>
>
|
>
>
|
>



>



|
>
|
>



|
<


>
>
>

|
|
|
|
|
>
|






|






>



|
|
|
|
|
|
|
<
>
|
|
>




>

|
>








|
<







105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298

299
300
301
302
303
304
305
  #     - [opt-str ...] - see the docs in ./autosetup/autosetup
  #
  # [proj-opt-was-provided] can be used to determine whether a flag was
  # explicitly provided, which is often useful for distinguishing from
  # the case of a default value.
  ########################################################################
  set allFlags {
    # Structure: a list of M {Z} pairs, where M is a descriptive
    # option group name and Z is a list of X Y pairs. X is a list of
    # $buildMode name(s) to which the Y flags apply, or {*} to apply
    # to all builds. Y is a {block} in the form expected by
    # autosetup's [options] command.  Each block which is applicable
    # to $buildMode is appended to a new list before that list is
    # passed on to [options]. The order of each Y and sub-Y is
    # retained, which is significant for rendering of --help.

    # When writing {help text blocks}, be aware that:
    #
    # A) autosetup formats them differently if the {block} starts with
    # a newline: it starts left-aligned, directly under the --flag, and
    # the rest of the block is pasted verbatim rather than
    # pretty-printed.
    #
    # B) Vars and commands are NOT expanded, but we use a [subst] call
    # below which will replace (only) var refs.


    # Options for how to build the library
    build-modes {
      {*} {
        shared=1             => {Disable build of shared libary}
        static=1             => {Disable build of static library (mostly)}
      }
      {canonical} {
        amalgamation=1       => {Disable the amalgamation and instead build all files separately}
      }
    }

    # Library-level features and defaults
    lib-features {
      {*} {
        threadsafe=1         => {Disable mutexing}
        with-tempstore:=no   => {Use an in-RAM database for temporary tables: never,no,yes,always}
        largefile=1          => {Disable large file support}
        # ^^^ It's not clear that this actually does anything, as
        # HAVE_LFS is not checked anywhere in the .c/.h/.in files.
        load-extension=1     => {Disable loading of external extensions}
        math=1               => {Disable math functions}
        json=1               => {Disable JSON functions}
        memsys5              => {Enable MEMSYS5}
        memsys3              => {Enable MEMSYS3}
        fts3                 => {Enable the FTS3 extension}
        fts4                 => {Enable the FTS4 extension}
        fts5                 => {Enable the FTS5 extension}
        update-limit         => {Enable the UPDATE/DELETE LIMIT clause}
        geopoly              => {Enable the GEOPOLY extension}
        rtree                => {Enable the RTREE extension}
        session              => {Enable the SESSION extension}
        all                  => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
      }
    }

    # Options for TCL support
    tcl {
      {canonical} {
        with-tcl:DIR
          => {Directory containing tclConfig.sh or a directory one level up from
              that, from which we can derive a directory containing tclConfig.sh.
              A dir name of "prefix" is equivalent to the directory specified by
              the --prefix flag.}
        with-tclsh:PATH
          => {Full pathname of tclsh to use.  It is used for (A) trying to find
              tclConfig.sh and (B) all TCL-based code generation.  Warning: if
              its containing dir has multiple tclsh versions, it may select the
              wrong tclConfig.sh!}
        tcl=1
          => {Disable components which require TCL, including all tests.
              This tree requires TCL for code generation but can use the in-tree
              copy of autosetup/jimsh0.c for that. The SQLite TCL extension and the
              test code require a canonical tclsh.}
      }
    }

    # Options for line-editing modes for the CLI shell
    line-editing {
      {*} {
        readline=1
          => {Disable readline support}
        # --with-readline-lib is a backwards-compatible alias for
        # --with-readline-ldflags
        with-readline-lib:
        with-readline-ldflags:=auto
          => {Readline LDFLAGS, e.g. -lreadline -lncurses}
        # --with-readline-inc is a backwards-compatible alias for
        # --with-readline-cflags.
        with-readline-inc:
        with-readline-cflags:=auto
          => {Readline CFLAGS, e.g. -I/path/to/includes}
        with-readline-header:PATH
          => {Full path to readline.h, from which --with-readline-cflags will be derived}
        with-linenoise:DIR
          => {Source directory for linenoise.c and linenoise.h}
        editline=0
          => {Enable BSD editline support}
      }
    }

    # Options for ICU: International Components for Unicode
    icu {
      {*} {
        with-icu-ldflags:LDFLAGS
          => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the
              ICU libraries}
        with-icu-cflags:CFLAGS
          => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU.
              e.g. -I/usr/local/include}
        with-icu-config:=auto
          => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config,
              /path/to/icu-config}
        icu-collations=0
          => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=...
              or --with-icu-config}
      }
    }

    # Options for exotic/alternative build modes
    alternative-builds {
      {canonical} {
        with-wasi-sdk:=/opt/wasi-sdk
          => {Top-most dir of the wasi-sdk for a WASI build}
        with-emsdk:=auto
          => {Top-most dir of the Emscripten SDK installation.
              Default = EMSDK env var.}
      }
    }

    # Options mostly for sqlite's own development

    developer {
      {*} {
        # Note that using the --debug/--enable-debug flag here
        # requires patching autosetup/autosetup to rename the --debug
        # to --autosetup-debug.
        with-debug=0
        debug=0
          => {Enable debug build flags. This option will impact performance by
              as much as 4x, as it includes large numbers of assert()s in
              performance-critical loops.  Never use --debug for production
              builds.}
        scanstatus
          => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag}
      }
      {canonical} {
        dev                  => {Enable dev-mode build: automatically enables certain other flags}
        test-status          => {Enable status of tests}
        gcov=0               => {Enable coverage testing using gcov}
        linemacros           => {Enable #line macros in the amalgamation}
        dynlink-tools        => {Dynamically link libsqlite3 to certain tools which normally statically embed it}
      }
      {*} {
        dump-defines=0       => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)}
      }
    }

    # Options specifically for downstream package maintainers
    packaging {
      {*} {
        # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded
        soname:=legacy
          => {SONAME for libsqlite3.so. "none", or not using this flag, sets no
              soname. "legacy" sets it to its historical value of
              libsqlite3.so.0.  A value matching the glob "libsqlite3.*" sets
              it to that literal value. Any other value is assumed to be a
              suffix which gets applied to "libsqlite3.so.",
              e.g. --soname=9.10 equates to "libsqlite3.so.9.10".}

        # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2
        out-implib=0
          => {Enable use of --out-implib linker flag to generate an
              "import library" for the DLL}
      }
    }
  }; # $allOpts

  # Filter allOpts to create the set of [options] legal for this build
  set opts {}
  foreach {group XY} [subst -nobackslashes -nocommands \
                        [proj-strip-hash-comments $allFlags]] {
    foreach {X Y} $XY {
      if { $buildMode in $X || "*" in $X } {
        foreach y $Y {
          lappend opts $y
        }
      }
    }
  }
  #puts "options = $opts"; exit 0

  options $opts
  sqlite-post-options-init
}; # sqlite-config-bootstrap

########################################################################
# Runs some common initialization which must happen immediately after
# autosetup's [options] function is called. This is also a convenient
330
331
332
333
334
335
336
337
338
339
340
341
342
343

344
345
346
347
348
349
350
351
352
353
354
355
356
# Sets up the SQLITE_AUTORECONFIG define.
proc sqlite-autoreconfig {} {
  #
  # SQLITE_AUTORECONFIG contains make target rules for re-running the
  # configure script with the same arguments it was initially invoked
  # with. This can be used to automatically reconfigure
  #
  proc squote {arg} {
    # Wrap $arg in single-quotes if it looks like it might need that
    # to avoid mis-handling as a shell argument. We assume that $arg
    # will never contain any single-quote characters.
    if {[string match {*[ &;$*"]*} $arg]} { return '$arg' }
    return $arg
  }

  define-append SQLITE_AUTORECONFIG cd [squote $::autosetup(builddir)] && [squote $::autosetup(srcdir)/configure]
  #{*}$::autosetup(argv) breaks with --flag='val with spaces', so...
  foreach arg $::autosetup(argv) {
    define-append SQLITE_AUTORECONFIG [squote $arg]
  }
  rename squote ""
}

define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
define OPT_SHELL {}         ; # Feature-related CFLAGS for the sqlite3 CLI app
########################################################################
# Adds $args, if not empty, to OPT_FEATURE_FLAGS.  If the first arg is
# -shell then it strips that arg and passes the remaining args the







|





|
>
|


|

<







359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378

379
380
381
382
383
384
385
# Sets up the SQLITE_AUTORECONFIG define.
proc sqlite-autoreconfig {} {
  #
  # SQLITE_AUTORECONFIG contains make target rules for re-running the
  # configure script with the same arguments it was initially invoked
  # with. This can be used to automatically reconfigure
  #
  set squote {{arg} {
    # Wrap $arg in single-quotes if it looks like it might need that
    # to avoid mis-handling as a shell argument. We assume that $arg
    # will never contain any single-quote characters.
    if {[string match {*[ &;$*"]*} $arg]} { return '$arg' }
    return $arg
  }}
  define-append SQLITE_AUTORECONFIG cd [apply $squote $::autosetup(builddir)] \
    && [apply $squote $::autosetup(srcdir)/configure]
  #{*}$::autosetup(argv) breaks with --flag='val with spaces', so...
  foreach arg $::autosetup(argv) {
    define-append SQLITE_AUTORECONFIG [apply $squote $arg]
  }

}

define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
define OPT_SHELL {}         ; # Feature-related CFLAGS for the sqlite3 CLI app
########################################################################
# Adds $args, if not empty, to OPT_FEATURE_FLAGS.  If the first arg is
# -shell then it strips that arg and passes the remaining args the