2024-11-06 08:20:20 +01:00
|
|
|
#/do/not/tclsh
|
2024-10-21 18:06:49 +02:00
|
|
|
# ^^^ help out editors which guess this file's content type.
|
|
|
|
#
|
2024-10-20 03:41:36 +02:00
|
|
|
# This is the main autosetup-compatible configure script for the
|
|
|
|
# SQLite project.
|
2024-10-22 19:57:22 +02:00
|
|
|
#
|
|
|
|
# This script should be kept compatible with JimTCL, a copy of which
|
|
|
|
# is included in this source tree as ./autosetup/jimsh0.c. The number
|
|
|
|
# of incompatibilities between canonical TCL and JimTCL is very low
|
|
|
|
# and alternative formulations of incompatible constructs have, so
|
|
|
|
# far, been easy to find.
|
|
|
|
#
|
|
|
|
# JimTCL: https://jim.tcl.tk
|
|
|
|
#
|
2024-11-15 11:07:57 +01:00
|
|
|
use cc cc-db cc-shared cc-lib proj pkg-config
|
2024-10-26 01:03:33 +02:00
|
|
|
|
2024-10-25 15:56:13 +02:00
|
|
|
# $DUMP_DEFINES_TXT is the file emitted by --dump-defines, intended
|
|
|
|
# only for build debugging and not part of the public build interface.
|
|
|
|
set DUMP_DEFINES_TXT ./config.defines.txt
|
|
|
|
# $DUMP_DEFINES_JSON is the autosetup counterpart of the historical
|
|
|
|
# "DEFS" var which was generated by the autotools in the pre-processed
|
2024-10-29 21:27:36 +01:00
|
|
|
# autotools builds (but not in the canonical tree). Generation of this
|
|
|
|
# file is disabled (via an empty file name) until/unless someone
|
|
|
|
# voices a specific interest in it. The original motivating use case
|
|
|
|
# is handled fine by sqlite_cfg.h.
|
2024-10-26 05:05:20 +02:00
|
|
|
set DUMP_DEFINES_JSON ""; #./config.defines.json
|
2024-09-24 23:08:49 +02:00
|
|
|
|
2024-09-25 05:37:34 +02:00
|
|
|
########################################################################
|
2024-10-22 19:57:22 +02:00
|
|
|
# Regarding flag compatibility with the historical autotool configure
|
|
|
|
# script:
|
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# A very long story made short, autosetup's --flag handling has
|
|
|
|
# some behaviors which make it impossible to implement 100% identical
|
2024-10-20 03:09:51 +02:00
|
|
|
# flags compared to the historical autotools build. The differences
|
2024-09-26 00:13:49 +02:00
|
|
|
# are documented here:
|
2024-09-25 06:20:58 +02:00
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# 1) --debug is used by autosetup itself, so we have to rename it to
|
|
|
|
# --with-debug. We cannot use --enable-debug because that is, for
|
|
|
|
# autosetup, and alias for --debug=1.
|
2024-09-25 06:20:58 +02:00
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# 2) In autosetup, all flags starting with (--enable, --disable) are
|
2024-10-20 03:09:51 +02:00
|
|
|
# forced to be booleans and receive special handling in how they're
|
2024-09-26 00:13:49 +02:00
|
|
|
# resolved. Because of that we have to rename:
|
2024-09-25 06:20:58 +02:00
|
|
|
#
|
2024-09-26 00:13:49 +02:00
|
|
|
# 2.1) --enable-tempstore[=no] to --with-tempstore[=no].
|
2024-09-25 09:30:54 +02:00
|
|
|
#
|
2024-10-21 18:06:49 +02:00
|
|
|
########################################################################
|
|
|
|
# A gentle introduction to flags handling in autosetup
|
|
|
|
#
|
|
|
|
# Reference: https://msteveb.github.io/autosetup/developer/
|
|
|
|
#
|
|
|
|
# All configure flags must be described in an 'options' call, which
|
|
|
|
# must appear very early on in this script. The general syntax is:
|
|
|
|
#
|
|
|
|
# FLAG => {Help text}
|
|
|
|
#
|
|
|
|
# Where FLAG can have any of the following formats:
|
|
|
|
#
|
|
|
|
# boolopt => "a boolean option which defaults to disabled"
|
|
|
|
# boolopt2=1 => "a boolean option which defaults to enabled"
|
|
|
|
# stringopt: => "an option which takes an argument, e.g. --stringopt=value"
|
|
|
|
# stringopt2:=value => "an option where the argument is optional and defaults to 'value'"
|
|
|
|
# optalias booltopt3 => "a boolean with a hidden alias. --optalias is not shown in --help"
|
|
|
|
#
|
|
|
|
# Autosetup does no small amount of specialized handling for flags,
|
|
|
|
# especially booleans. Each bool-type --FLAG implicitly gets
|
|
|
|
# --enable-FLAG and --disable-FLAG forms, and explicitly adding flags
|
|
|
|
# with those prefixes will force them to be boolean flags. e.g. we
|
|
|
|
# define a flag "readline", which will be interpreted in one of two
|
|
|
|
# ways, depending on how it's invoked and how its default is defined:
|
|
|
|
#
|
|
|
|
# --enable-readline ==> boolean true
|
|
|
|
# --disable-readline ==> boolean false
|
|
|
|
#
|
|
|
|
# Trying to pass --readline or --readline=1 or --readline=0 will
|
2024-11-07 17:59:15 +01:00
|
|
|
# result in an "unrecognized option" error, despite the the [options]
|
2024-10-21 18:06:49 +02:00
|
|
|
# call listing the flag as "readline".
|
|
|
|
#
|
|
|
|
# The behavior described above can lead lead to some confusion when
|
|
|
|
# writing help text. For example:
|
|
|
|
#
|
|
|
|
# options { json=1 {Disable JSON functions} }
|
|
|
|
#
|
|
|
|
# The reason the help text says "disable" is because a boolean option
|
|
|
|
# defaulting to true is, in the --help text, rendered as:
|
|
|
|
#
|
|
|
|
# --disable-json Disable JSON functions
|
|
|
|
#
|
|
|
|
# Whereas a bool flag which defaults to false will instead render as:
|
|
|
|
#
|
|
|
|
# --enable-FLAG
|
|
|
|
#
|
|
|
|
# Non-boolean flags, in contrast, use the names specifically given to
|
2024-11-07 17:59:15 +01:00
|
|
|
# them in the [options] invocation. e.g. "with-tcl" is the --with-tcl
|
2024-10-21 18:06:49 +02:00
|
|
|
# flag. Autosetup may, however, choose to automatically alter the help
|
|
|
|
# text, as demonstrated here:
|
|
|
|
#
|
|
|
|
# options {
|
|
|
|
# readline=1 => {Disable readline support}
|
|
|
|
# with-readline-lib: => {Readline library}
|
|
|
|
# with-readline-inc: => {Readline include paths}
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# $ ./configure --help | grep readline
|
|
|
|
# --disable-readline disable readline support
|
|
|
|
# --with-readline-lib specify readline library
|
|
|
|
# --with-readline-inc specify readline include paths
|
|
|
|
#
|
|
|
|
# Note that it prefixed and lower-case the help message. Whether
|
|
|
|
# that's a feature or a bug can be debated.
|
|
|
|
#
|
|
|
|
# Fetching values for flags:
|
|
|
|
#
|
|
|
|
# booleans: use one of:
|
|
|
|
# - [opt-bool FLAG] is autosetup's built-in command for this, but we
|
|
|
|
# have some convenience variants:
|
2024-10-28 15:16:50 +01:00
|
|
|
# - [proj-opt-truthy FLAG]
|
|
|
|
# - [proj-opt-if-truthy FLAG {THEN} {ELSE}]
|
2024-10-21 18:06:49 +02:00
|
|
|
#
|
|
|
|
# Non-boolean (i.e. string) flags:
|
2024-10-26 20:17:17 +02:00
|
|
|
# - [opt-val FLAG ?default?]
|
2024-10-21 18:06:49 +02:00
|
|
|
#
|
|
|
|
########################################################################
|
2024-10-26 05:05:20 +02:00
|
|
|
set flags {
|
2024-10-27 23:18:33 +01:00
|
|
|
# <build-modes>
|
|
|
|
shared=1 => {Disable build of shared libary}
|
|
|
|
static=1 => {Disable build of static library (mostly)}
|
|
|
|
amalgamation=1 => {Disable the amalgamation and instead build all files separately.}
|
|
|
|
# </build-modes>
|
|
|
|
# <lib-feature>
|
|
|
|
threadsafe=1 => {Disable mutexing}
|
2024-11-07 17:59:15 +01:00
|
|
|
with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always}
|
2024-10-27 23:18:33 +01:00
|
|
|
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}
|
2024-10-29 05:21:11 +01:00
|
|
|
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
|
2024-10-27 23:18:33 +01:00
|
|
|
# </lib-feature>
|
|
|
|
# <tcl>
|
2024-10-30 06:07:18 +01:00
|
|
|
# --with-tcl=DIR may be either a dir containing tclConfig.sh or a
|
|
|
|
# dir one level up from that from which we can derive a dir
|
|
|
|
# containing tclConfig.sh.
|
2024-11-07 16:04:15 +01:00
|
|
|
with-tcl: => {Root of path containing tclConfig.sh}
|
2024-10-30 06:07:18 +01:00
|
|
|
# If --with-tclsh=X given, 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!
|
2024-10-09 06:01:14 +02:00
|
|
|
with-tclsh:PATH => {Full pathname of tclsh to use}
|
2024-11-07 16:04:15 +01:00
|
|
|
# --disable-tcl disables building of components which require TCL,
|
|
|
|
# including 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.
|
|
|
|
tcl=1 => {Disable components which require TCL}
|
2024-10-27 23:18:33 +01:00
|
|
|
# <tcl>
|
|
|
|
# <line-editing>
|
2024-09-27 15:29:50 +02:00
|
|
|
readline=1 => {Disable readline support}
|
2024-10-27 21:46:09 +01:00
|
|
|
# --with-readline-lib is a backwards-compatible alias for
|
|
|
|
# --with-readline-ldflags
|
2024-10-27 21:04:23 +01:00
|
|
|
with-readline-lib:
|
2024-10-27 21:46:09 +01:00
|
|
|
with-readline-ldflags:=auto
|
2024-11-05 08:55:33 +01:00
|
|
|
=> {Readline LDFLAGS, e.g. -lreadline -lncurses}
|
2024-10-27 21:46:09 +01:00
|
|
|
# --with-readline-inc is a backwards-compatible alias for
|
2024-10-30 06:07:18 +01:00
|
|
|
# --with-readline-cflags.
|
2024-10-27 21:04:23 +01:00
|
|
|
with-readline-inc:
|
2024-10-27 21:46:09 +01:00
|
|
|
with-readline-cflags:=auto
|
2024-10-27 03:27:07 +01:00
|
|
|
=> {Readline CFLAGS, e.g. -I/path/to/includes}
|
|
|
|
with-readline-header:PATH
|
2024-10-27 21:04:23 +01:00
|
|
|
=> {Full path to readline.h, from which --with-readline-cflags will be derived}
|
2024-10-26 23:51:04 +02:00
|
|
|
with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h}
|
2024-11-05 08:55:33 +01:00
|
|
|
editline=0 => {Enable BSD editline support}
|
2024-10-27 23:18:33 +01:00
|
|
|
# </line-editing>
|
|
|
|
# <icu>
|
2024-10-28 01:56:31 +01:00
|
|
|
with-icu-ldflags:LDFLAGS
|
|
|
|
=> {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}
|
2024-11-14 20:25:23 +01:00
|
|
|
with-icu-cflags:CFLAGS
|
|
|
|
=> {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include}
|
2024-11-15 11:07:57 +01:00
|
|
|
with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config}
|
2024-10-29 09:18:45 +01:00
|
|
|
icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config}
|
2024-10-27 23:18:33 +01:00
|
|
|
# </icu>
|
|
|
|
# <alternative-builds>
|
2024-09-25 08:07:54 +02:00
|
|
|
with-wasi-sdk:=/opt/wasi-sdk
|
2024-10-25 15:56:13 +02:00
|
|
|
=> {Top-most dir of the wasi-sdk for a WASI build}
|
2024-11-06 03:59:59 +01:00
|
|
|
with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Default = EMSDK env var.}
|
2024-10-27 23:18:33 +01:00
|
|
|
# </alternative-builds>
|
|
|
|
# <developer>
|
2024-11-19 18:41:13 +01:00
|
|
|
|
|
|
|
# --with-debug does more than simply builds with a -g compilation
|
|
|
|
# flag and will impact performance by as much as 4x, as it includes
|
|
|
|
# large numbers of assert()s in performance-critical loops. Never
|
|
|
|
# use --with-debug for production builds.
|
|
|
|
with-debug:=1 => {Enable debug build flags}
|
|
|
|
dev => {Enable dev-mode build: automatically enables certain other flags}
|
2024-10-27 23:18:33 +01:00
|
|
|
test-status => {Enable status of tests}
|
|
|
|
gcov=0 => {Enable coverage testing using gcov}
|
2024-10-31 07:52:09 +01:00
|
|
|
linemacros => {Enable #line macros in the amalgamation}
|
2024-10-25 15:56:13 +02:00
|
|
|
dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)}
|
2024-11-19 16:20:47 +01:00
|
|
|
link-tools-dynamically => {Dynamically link libsqlite3 to certain tools which normally statically embed it.}
|
2024-11-19 17:40:49 +01:00
|
|
|
soname:=legacy => {SONAME for libsqlite3.so. Must be one of: none, auto, legacy}
|
2024-11-19 16:20:47 +01:00
|
|
|
# --soname has a long story behind it, as well as no small amount of uncertainty.
|
2024-10-27 23:18:33 +01:00
|
|
|
# </developer>
|
2024-10-26 05:05:20 +02:00
|
|
|
}
|
|
|
|
if {"" ne $DUMP_DEFINES_JSON} {
|
|
|
|
lappend flags \
|
|
|
|
defines-json-include-lowercase=0 \
|
|
|
|
=> {Include lower-case defines (primarily system paths) in $DUMP_DEFINES_JSON}
|
|
|
|
}
|
2024-10-29 19:50:25 +01:00
|
|
|
|
2024-11-06 03:59:59 +01:00
|
|
|
options [subst -nobackslashes -nocommands $flags]
|
2024-10-26 05:05:20 +02:00
|
|
|
unset flags
|
2024-09-24 23:08:49 +02:00
|
|
|
|
2024-10-27 21:14:49 +01:00
|
|
|
#
|
|
|
|
# Carry values from hidden --flag aliases over to their canonical flag
|
2024-10-27 21:04:23 +01:00
|
|
|
# forms.
|
2024-10-27 21:14:49 +01:00
|
|
|
#
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-xfer-options-aliases {
|
2024-10-27 21:04:23 +01:00
|
|
|
with-readline-inc => with-readline-cflags
|
|
|
|
with-readline-lib => with-readline-ldflags
|
|
|
|
}
|
|
|
|
|
2024-10-21 18:06:49 +02:00
|
|
|
set srcdir $::autosetup(srcdir)
|
2024-11-05 10:49:53 +01:00
|
|
|
set PACKAGE_VERSION [proj-file-content -trim $srcdir/VERSION]
|
2024-10-26 00:44:58 +02:00
|
|
|
define PACKAGE_NAME "sqlite"
|
|
|
|
define PACKAGE_URL {https://sqlite.org}
|
|
|
|
define PACKAGE_VERSION $PACKAGE_VERSION
|
|
|
|
define PACKAGE_STRING "[get-define PACKAGE_NAME] $PACKAGE_VERSION"
|
|
|
|
define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum
|
2024-11-05 10:49:53 +01:00
|
|
|
msg-result "Source dir = $srcdir"
|
|
|
|
msg-result "Build dir = $::autosetup(builddir)"
|
2024-10-31 12:21:35 +01:00
|
|
|
msg-result "Configuring SQLite version $PACKAGE_VERSION"
|
2024-10-27 08:06:03 +01:00
|
|
|
|
2024-11-15 17:35:24 +01:00
|
|
|
apply {{} {
|
2024-11-06 08:20:20 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
}
|
2024-11-15 17:35:24 +01:00
|
|
|
define-append SQLITE_AUTORECONFIG cd [squote $::autosetup(builddir)] && [squote $::srcdir/configure]
|
2024-11-06 08:20:20 +01:00
|
|
|
#{*}$::autosetup(argv) breaks with --flag='val with spaces', so...
|
|
|
|
foreach arg $::autosetup(argv) {
|
|
|
|
define-append SQLITE_AUTORECONFIG [squote $arg]
|
|
|
|
}
|
|
|
|
rename squote ""
|
2024-11-15 17:35:24 +01:00
|
|
|
}}
|
2024-09-27 03:00:32 +02:00
|
|
|
|
2024-10-27 23:18:33 +01:00
|
|
|
# Are we cross-compiling?
|
2024-10-31 07:38:30 +01:00
|
|
|
set isCrossCompiling [proj-is-cross-compiling]
|
2024-09-26 14:16:46 +02:00
|
|
|
|
2024-10-27 23:18:33 +01:00
|
|
|
define OPT_FEATURE_FLAGS {} ; # -DSQLITE_OMIT/ENABLE flags.
|
2024-11-07 17:59:15 +01:00
|
|
|
define OPT_SHELL {} ; # Feature-related CFLAGS for the sqlite3 CLI app
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
2024-11-07 17:59:15 +01:00
|
|
|
# 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
|
|
|
|
# sqlite-add-shell-opt in addition to adding them to
|
|
|
|
# OPT_FEATURE_FLAGS.
|
2024-10-27 23:18:33 +01:00
|
|
|
proc sqlite-add-feature-flag {args} {
|
|
|
|
set shell ""
|
|
|
|
if {"-shell" eq [lindex $args 0]} {
|
|
|
|
set args [lassign $args shell]
|
|
|
|
}
|
2024-09-27 15:29:50 +02:00
|
|
|
if {"" ne $args} {
|
2024-10-27 23:18:33 +01:00
|
|
|
if {"" ne $shell} {
|
|
|
|
sqlite-add-shell-opt {*}$args
|
|
|
|
}
|
2024-09-27 15:29:50 +02:00
|
|
|
define-append OPT_FEATURE_FLAGS {*}$args
|
2024-09-25 16:38:46 +02:00
|
|
|
}
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
2024-10-27 23:18:33 +01:00
|
|
|
# Appends $args, if not empty, to OPT_SHELL.
|
|
|
|
proc sqlite-add-shell-opt {args} {
|
2024-09-27 15:29:50 +02:00
|
|
|
if {"" ne $args} {
|
|
|
|
define-append OPT_SHELL {*}$args
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-29 19:50:25 +01:00
|
|
|
# Pass msg-debug=1 to configure to enable obnoxiously loud output from
|
|
|
|
# msg-debug.
|
|
|
|
set msgDebugEnabled [proj-val-truthy [get-env msg-debug 0]]
|
|
|
|
proc msg-debug {msg} {
|
|
|
|
if {$::msgDebugEnabled} {
|
|
|
|
puts stderr [proj-bold "** DEBUG: $msg"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-file-extensions
|
2024-09-25 10:04:14 +02:00
|
|
|
if {".exe" eq [get-define TARGET_EXEEXT]} {
|
|
|
|
define SQLITE_OS_UNIX 0
|
|
|
|
define SQLITE_OS_WIN 1
|
2024-10-27 23:18:33 +01:00
|
|
|
# todo? add -DSQLITE_OS_WIN=1 to CFLAGS or CFLAGS_sqlite3_os?
|
2024-09-25 10:04:14 +02:00
|
|
|
} else {
|
|
|
|
define SQLITE_OS_UNIX 1
|
|
|
|
define SQLITE_OS_WIN 0
|
2024-10-27 23:18:33 +01:00
|
|
|
# todo? add -DSQLITE_OS_UNIX=1 to CFLAGS or CFLAGS_sqlite3_os
|
2024-09-25 10:04:14 +02:00
|
|
|
}
|
|
|
|
|
2024-09-25 03:39:39 +02:00
|
|
|
#########
|
|
|
|
# Programs needed
|
2024-11-05 10:49:53 +01:00
|
|
|
cc-check-tools ld ar ; # must come before sqlite-check-wasi-sdk
|
2024-10-28 15:16:50 +01:00
|
|
|
if {"" eq [proj-bin-define install]} {
|
|
|
|
proj-warn "Cannot find install binary, so 'make install' will not work."
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-10-20 04:47:56 +02:00
|
|
|
# We differentiate between two C compilers: the one used for binaries
|
2024-10-29 21:27:36 +01:00
|
|
|
# which are to run on the build system (in autosetup it's called
|
|
|
|
# CC_FOR_BUILD and in Makefile.in it's $(B.cc)) and the one used for
|
|
|
|
# compiling binaries for the target system (CC a.k.a. $(T.cc)).
|
|
|
|
# Normally they're the same, but they will differ when
|
2024-10-20 04:47:56 +02:00
|
|
|
# cross-compiling.
|
2024-11-03 22:32:24 +01:00
|
|
|
define CFLAGS [proj-get-env CFLAGS {-g -O2}]
|
|
|
|
define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}]
|
2024-09-26 14:16:46 +02:00
|
|
|
|
2024-11-15 17:35:24 +01:00
|
|
|
proj-if-opt-truthy dev {
|
|
|
|
# --enable-dev needs to come early so that the downstream tests
|
|
|
|
# which check for these flags will show the user their updated
|
|
|
|
# state.
|
|
|
|
proj-opt-set all 1
|
|
|
|
proj-opt-set with-debug 1
|
|
|
|
proj-opt-set amalgamation 0
|
|
|
|
define CFLAGS [get-env CFLAGS {-O0 -g}]
|
|
|
|
}
|
|
|
|
|
2024-11-19 16:20:47 +01:00
|
|
|
define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided link-tools-dynamically]
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 05:37:34 +02:00
|
|
|
# Handle --with-wasi-sdk=DIR
|
|
|
|
#
|
2024-11-15 17:35:24 +01:00
|
|
|
# This must be run early on because it may change the toolchain and
|
2024-10-31 07:38:30 +01:00
|
|
|
# disable a number of config options.
|
2024-10-27 09:29:18 +01:00
|
|
|
proc sqlite-check-wasi-sdk {} {
|
2024-09-25 10:04:14 +02:00
|
|
|
set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end]
|
2024-10-23 04:11:52 +02:00
|
|
|
define HAVE_WASI_SDK 0
|
|
|
|
if {$wasiSdkDir eq ""} {
|
|
|
|
return 0
|
2024-10-31 07:38:30 +01:00
|
|
|
} elseif {$::isCrossCompiling} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-fatal "Cannot combine --with-wasi-sdk with cross-compilation"
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
2024-10-23 04:11:52 +02:00
|
|
|
msg-result "Checking WASI SDK directory \[$wasiSdkDir]... "
|
|
|
|
#puts "prefix = [prefix $wasiSdkDir/bin {clang ld}]"
|
2024-11-07 17:59:15 +01:00
|
|
|
proj-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld ar}]
|
2024-10-23 04:11:52 +02:00
|
|
|
define HAVE_WASI_SDK 1
|
|
|
|
define WASI_SDK_DIR $wasiSdkDir
|
2024-10-31 07:38:30 +01:00
|
|
|
# Disable numerous options which we know either can't work or are
|
|
|
|
# not useful in this build...
|
2024-11-07 17:59:15 +01:00
|
|
|
msg-result "Using wasi-sdk clang. Disabling CLI shell modifying config flags:"
|
2024-11-15 17:35:24 +01:00
|
|
|
# Boolean (--enable-/--disable-) flags which must be switched off:
|
2024-10-31 07:38:30 +01:00
|
|
|
foreach opt {
|
|
|
|
editline
|
|
|
|
gcov
|
2024-11-07 17:59:15 +01:00
|
|
|
icu-collations
|
2024-10-31 07:38:30 +01:00
|
|
|
load-extension
|
|
|
|
readline
|
|
|
|
shared
|
|
|
|
tcl
|
|
|
|
threadsafe
|
|
|
|
} {
|
2024-11-07 17:59:15 +01:00
|
|
|
if {[opt-bool $opt]} {
|
|
|
|
msg-result " --disable-$opt"
|
|
|
|
proj-opt-set $opt 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# Non-boolean flags which need to be cleared:
|
|
|
|
foreach opt {
|
|
|
|
with-emsdk
|
|
|
|
with-icu-config
|
|
|
|
with-icu-ldflags
|
2024-11-14 20:25:23 +01:00
|
|
|
with-icu-cflags
|
2024-11-07 17:59:15 +01:00
|
|
|
with-linenoise
|
|
|
|
with-tcl
|
|
|
|
} {
|
|
|
|
if {[proj-opt-was-provided $opt]} {
|
|
|
|
msg-result " removing --$opt"
|
|
|
|
proj-opt-set $opt ""
|
|
|
|
}
|
2024-10-31 07:38:30 +01:00
|
|
|
}
|
|
|
|
# Remember that we now have a discrepancy beteween
|
|
|
|
# $::isCrossCompiling and [proj-is-cross-compiling].
|
|
|
|
set ::isCrossCompiling 1
|
|
|
|
|
|
|
|
#
|
|
|
|
# Changing --host and --target have no effect here except to
|
|
|
|
# possibly cause confusion. Autosetup has finished processing them
|
|
|
|
# by this point.
|
2024-10-23 04:11:52 +02:00
|
|
|
#
|
|
|
|
# host_alias=wasm32-wasi
|
|
|
|
# target=wasm32-wasi
|
|
|
|
#
|
2024-11-01 02:56:27 +01:00
|
|
|
# Merely changing CC, LD, and AR to the wasi-sdk's is enough to get
|
2024-10-23 04:11:52 +02:00
|
|
|
# sqlite3.o building in WASM format.
|
2024-10-31 07:38:30 +01:00
|
|
|
#
|
2024-10-23 04:11:52 +02:00
|
|
|
define CC "${wasiSdkDir}/bin/clang"
|
|
|
|
define LD "${wasiSdkDir}/bin/wasm-ld"
|
2024-11-01 02:56:27 +01:00
|
|
|
define AR "${wasiSdkDir}/bin/ar"
|
2024-10-23 04:11:52 +02:00
|
|
|
#define STRIP "${wasiSdkDir}/bin/strip"
|
|
|
|
return 1
|
2024-10-27 09:29:18 +01:00
|
|
|
}; # sqlite-check-wasi-sdk
|
|
|
|
sqlite-check-wasi-sdk
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# Enable large file support (if special flags are necessary)
|
2024-10-26 05:05:20 +02:00
|
|
|
define HAVE_LFS 0
|
|
|
|
if {[opt-bool largefile]} {
|
|
|
|
cc-check-lfs
|
|
|
|
}
|
2024-09-25 20:03:26 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# Check for needed/wanted data types
|
2024-10-26 01:25:49 +02:00
|
|
|
cc-with {-includes stdint.h} \
|
|
|
|
{cc-check-types int8_t int16_t int32_t int64_t intptr_t \
|
|
|
|
uint8_t uint16_t uint32_t uint64_t uintptr_t}
|
2024-09-25 20:03:26 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-27 15:29:50 +02:00
|
|
|
# Check for needed/wanted functions
|
2024-09-25 20:03:26 +02:00
|
|
|
cc-check-functions gmtime_r isnan localtime_r localtime_s \
|
|
|
|
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
|
|
|
|
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-check-function-in-lib fdatasync rt
|
2024-09-25 20:03:26 +02:00
|
|
|
define LDFLAGS_FDATASYNC [get-define lib_fdatasync]
|
|
|
|
undefine lib_fdatasync
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 20:03:26 +02:00
|
|
|
# Check for needed/wanted headers
|
2024-09-27 03:00:32 +02:00
|
|
|
cc-check-includes \
|
|
|
|
sys/types.h sys/stat.h dlfcn.h unistd.h \
|
|
|
|
stdlib.h malloc.h memory.h \
|
|
|
|
string.h strings.h \
|
2024-10-26 01:25:49 +02:00
|
|
|
inttypes.h
|
2024-09-27 03:00:32 +02:00
|
|
|
|
2024-10-28 15:16:50 +01:00
|
|
|
if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} {
|
2024-10-31 07:38:30 +01:00
|
|
|
# TODO? port over the more sophisticated zlib search from the fossil auto.def
|
2024-10-29 04:29:45 +01:00
|
|
|
define HAVE_ZLIB 1
|
2024-09-25 20:03:26 +02:00
|
|
|
define LDFLAGS_ZLIB -lz
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1
|
2024-09-25 20:03:26 +02:00
|
|
|
} else {
|
|
|
|
define HAVE_ZLIB 0
|
|
|
|
define LDFLAGS_ZLIB ""
|
|
|
|
}
|
|
|
|
|
2024-11-04 09:29:02 +01:00
|
|
|
proj-check-rpath ; # Determine proper rpath-handling flag
|
2024-11-08 06:26:26 +01:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# It's not yet clear whether we gain anything from setting -soname,
|
|
|
|
# but not having it has been a source of anxiety for some users.
|
|
|
|
# Setting it to any value other than its historical value of
|
2024-11-15 20:42:49 +01:00
|
|
|
# libsqlite3.so.0 may break dynamic linking of clients which initially
|
|
|
|
# linked against a legacy build (with its SONAME of libsqlite3.so.0).
|
|
|
|
#
|
|
|
|
# To be clear: the ABI has not changed between pre-3.48 and post-3.47
|
|
|
|
# builds, but version number 0 (pre-3.48) was a historical remnant
|
|
|
|
# from libtool which "should" have always been version number 3 but
|
|
|
|
# was not, for reasons lost to history.
|
|
|
|
#
|
|
|
|
# If the goal is to reduce downstream disruption then we need to
|
|
|
|
# retain the SONAME libsqlite3.so.0. If the goal is to "pull the
|
|
|
|
# bandaid off" then switching libsqlite3.so.3 is arguably the right
|
|
|
|
# thing to do (at the very real risk of causing a fair amount of
|
|
|
|
# downstream disruption for package maintainers).
|
2024-11-08 06:26:26 +01:00
|
|
|
#
|
|
|
|
# See discussion in/around:
|
|
|
|
# https://sqlite.org/forum/forumpost/0c6fc6f46b2cb3
|
2024-11-15 17:35:24 +01:00
|
|
|
apply {{} {
|
2024-11-15 20:42:49 +01:00
|
|
|
define LDFLAGS_LIBSQLITE3_SONAME ""
|
2024-11-08 06:26:26 +01:00
|
|
|
if {[proj-opt-was-provided soname]} {
|
|
|
|
set soname [opt-val soname]
|
|
|
|
} else {
|
2024-11-19 16:20:47 +01:00
|
|
|
set soname none; # enabling soname breaks linking for the --link-tools-dynamically feature
|
2024-11-08 06:26:26 +01:00
|
|
|
}
|
|
|
|
switch -exact -- $soname {
|
2024-11-15 20:42:49 +01:00
|
|
|
none { return 0 }
|
|
|
|
auto { set soname libsqlite3.so.3 }
|
|
|
|
legacy { set soname libsqlite3.so.0 }
|
2024-11-08 06:26:26 +01:00
|
|
|
default {
|
|
|
|
proj-fatal "Invalid value for --soname. Use one of (none, auto, legacy)."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
msg-debug "soname=$soname"
|
|
|
|
if {[proj-check-soname $soname]} {
|
2024-11-15 20:42:49 +01:00
|
|
|
define LDFLAGS_LIBSQLITE3_SONAME [get-define LDFLAGS_SONAME_PREFIX]$soname
|
|
|
|
msg-result "Setting SONAME: [get-define LDFLAGS_LIBSQLITE3_SONAME]"
|
|
|
|
} elseif {[proj-opt-was-provided soname]} {
|
|
|
|
# --soname was explicitly requested but not available, so fail fatally
|
2024-11-08 06:26:26 +01:00
|
|
|
proj-fatal "This environment does not support SONAME."
|
2024-11-15 20:42:49 +01:00
|
|
|
} else {
|
|
|
|
msg-result "This environment does not support SONAME."
|
2024-11-08 06:26:26 +01:00
|
|
|
}
|
2024-11-15 17:35:24 +01:00
|
|
|
}}
|
2024-10-27 08:06:03 +01:00
|
|
|
|
2024-11-14 18:52:59 +01:00
|
|
|
|
2024-11-11 10:37:19 +01:00
|
|
|
proj-define-for-opt shared ENABLE_SHARED "Build shared library?"
|
2024-10-27 09:29:18 +01:00
|
|
|
|
2024-11-11 10:37:19 +01:00
|
|
|
if {![proj-define-for-opt static ENABLE_STATIC \
|
2024-10-29 05:21:11 +01:00
|
|
|
"Build static library?"]} {
|
|
|
|
proj-warn "Static lib build may be implicitly re-activated by other components, e.g. some test apps."
|
|
|
|
}
|
2024-10-27 09:52:20 +01:00
|
|
|
|
2024-11-11 10:37:19 +01:00
|
|
|
proj-define-for-opt amalgamation USE_AMALGAMATION "Use amalgamation for builds?"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-11-11 10:37:19 +01:00
|
|
|
proj-define-for-opt gcov USE_GCOV "Use gcov?"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-11-11 10:37:19 +01:00
|
|
|
proj-define-for-opt test-status TSTRNNR_OPTS \
|
2024-09-26 00:13:49 +02:00
|
|
|
"test-runner flags:" {--status} {}
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-11-11 10:37:19 +01:00
|
|
|
proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \
|
2024-10-19 02:49:01 +02:00
|
|
|
"Use #line macros in the amalgamation:"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-10-29 04:29:45 +01:00
|
|
|
msg-checking "SQLITE_DEBUG build? "
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-if-opt-truthy with-debug {
|
2024-09-26 10:25:10 +02:00
|
|
|
define SQLITE_DEBUG 1
|
2024-10-19 20:31:47 +02:00
|
|
|
define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
|
2024-09-26 10:25:10 +02:00
|
|
|
msg-result yes
|
|
|
|
} {
|
|
|
|
define TARGET_DEBUG {-DNDEBUG}
|
|
|
|
msg-result no
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
|
|
|
# TCL...
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-10-27 06:28:52 +01:00
|
|
|
# sqlite-check-tcl performs most of the --with-tcl and --with-tclsh
|
2024-10-09 09:12:32 +02:00
|
|
|
# handling. Some related bits and pieces are performed before and
|
|
|
|
# after that function is called.
|
|
|
|
#
|
|
|
|
# Important [define]'d vars:
|
|
|
|
#
|
|
|
|
# - HAVE_TCL indicates whether we have a tclsh suitable for building
|
|
|
|
# the TCL SQLite extension and, by extension, the testing
|
|
|
|
# infrastructure. This must only be 1 for environments where
|
|
|
|
# tclConfig.sh can be found.
|
|
|
|
#
|
2024-10-19 22:53:46 +02:00
|
|
|
# - TCLSH_CMD is the path to the canonical tclsh or "". It never
|
|
|
|
# refers to jimtcl.
|
2024-10-09 09:12:32 +02:00
|
|
|
#
|
|
|
|
# - TCL_CONFIG_SH is the path to tclConfig.sh or "".
|
|
|
|
#
|
|
|
|
# - TCLLIBDIR is the dir to which libtclsqlite3 gets installed.
|
|
|
|
#
|
2024-10-18 00:19:37 +02:00
|
|
|
# - BTCLSH = the path to the tcl interpreter used for in-tree code
|
2024-10-19 22:53:46 +02:00
|
|
|
# generation. It may be jimtcl or the canonical tclsh but may not
|
|
|
|
# be empty - this tree requires TCL to generated numerous
|
|
|
|
# components.
|
|
|
|
#
|
2024-11-07 16:04:15 +01:00
|
|
|
# If --tcl or --with-tcl are provided but no TCL is found, this
|
|
|
|
# function fails fatally. If they are not explicitly provided then
|
|
|
|
# failure to find TCL is not fatal but a loud warning will be emitted.
|
|
|
|
#
|
2024-10-27 06:28:52 +01:00
|
|
|
proc sqlite-check-tcl {} {
|
2024-10-30 06:07:18 +01:00
|
|
|
define TCLSH_CMD false ; # Significant is that it exits with non-0
|
|
|
|
define HAVE_TCL 0 ; # Will be enabled via --tcl or a successful search
|
|
|
|
define TCLLIBDIR "" ; # Installation dir for TCL extension lib
|
|
|
|
define TCL_CONFIG_SH ""; # full path to tclConfig.sh
|
2024-11-08 14:37:00 +01:00
|
|
|
file delete -force ".tclenv.sh"; # ensure no stale state from previous configures.
|
2024-10-27 09:10:56 +01:00
|
|
|
if {![opt-bool tcl]} {
|
2024-11-07 16:04:15 +01:00
|
|
|
proj-indented-notice {
|
|
|
|
NOTE: TCL is disabled via --disable-tcl. This means that none
|
|
|
|
of the TCL-based components, including tests and sqlite3_analyzer,
|
|
|
|
will be built.
|
|
|
|
}
|
2024-10-27 09:10:56 +01:00
|
|
|
return
|
|
|
|
}
|
2024-10-30 06:07:18 +01:00
|
|
|
# TODO: document the steps this is taking.
|
2024-11-05 10:49:53 +01:00
|
|
|
global srcdir
|
2024-10-27 09:10:56 +01:00
|
|
|
msg-result "Checking for a suitable tcl... "
|
2024-11-09 11:23:04 +01:00
|
|
|
proj-assert [proj-opt-truthy tcl]
|
2024-10-30 06:07:18 +01:00
|
|
|
set use_tcl 1
|
2024-09-27 03:00:32 +02:00
|
|
|
set with_tclsh [opt-val with-tclsh]
|
|
|
|
set with_tcl [opt-val with-tcl]
|
2024-11-07 16:04:15 +01:00
|
|
|
if {"prefix" eq $with_tcl} {
|
|
|
|
set with_tcl [get-define prefix]
|
|
|
|
}
|
2024-10-29 19:50:25 +01:00
|
|
|
msg-debug "sqlite-check-tcl: use_tcl ${use_tcl}"
|
|
|
|
msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
|
|
|
|
msg-debug "sqlite-check-tcl: with_tcl=$with_tcl"
|
2024-09-27 03:00:32 +02:00
|
|
|
if {"" eq $with_tclsh && "" eq $with_tcl} {
|
2024-10-30 06:07:18 +01:00
|
|
|
# If neither --with-tclsh nor --with-tcl are provided, try to find
|
|
|
|
# a workable tclsh.
|
2024-10-28 15:16:50 +01:00
|
|
|
set with_tclsh [proj-first-bin-of tclsh9.0 tclsh8.6 tclsh]
|
2024-10-29 19:50:25 +01:00
|
|
|
msg-debug "sqlite-check-tcl: with_tclsh=${with_tclsh}"
|
2024-09-27 03:00:32 +02:00
|
|
|
}
|
|
|
|
|
2024-11-07 16:04:15 +01:00
|
|
|
set doConfigLookup 1 ; # set to 0 to test the tclConfig.sh-not-found cases
|
2024-10-09 06:01:14 +02:00
|
|
|
if {"" ne $with_tclsh} {
|
2024-11-07 16:04:15 +01:00
|
|
|
# --with-tclsh was provided or found above. Validate it and use it
|
|
|
|
# to trump any value passed via --with-tcl=DIR.
|
2024-10-09 06:01:14 +02:00
|
|
|
if {![file isfile $with_tclsh]} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-fatal "TCL shell $with_tclsh is not a file"
|
2024-10-22 05:12:11 +02:00
|
|
|
} elseif {![file-isexec $with_tclsh]} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-fatal "TCL shell $with_tclsh is not executable"
|
2024-10-09 06:01:14 +02:00
|
|
|
} else {
|
|
|
|
define TCLSH_CMD $with_tclsh
|
2024-10-29 05:21:11 +01:00
|
|
|
#msg-result "Using tclsh: $with_tclsh"
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-11-07 16:04:15 +01:00
|
|
|
if {$doConfigLookup &&
|
|
|
|
[catch {exec $with_tclsh $srcdir/tool/find_tclconfig.tcl} result] == 0} {
|
2024-10-30 06:07:18 +01:00
|
|
|
set with_tcl $result
|
|
|
|
}
|
|
|
|
if {"" ne $with_tcl && [file isdir $with_tcl]} {
|
|
|
|
msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
|
|
|
|
} else {
|
2024-11-07 16:04:15 +01:00
|
|
|
proj-warn "$with_tclsh is unable to recommend a tclConfig.sh"
|
2024-10-30 06:07:18 +01:00
|
|
|
set use_tcl 0
|
2024-09-27 03:00:32 +02:00
|
|
|
}
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
set cfg ""
|
2024-10-16 16:04:00 +02:00
|
|
|
set tclSubdirs {tcl9.0 tcl8.6 lib}
|
2024-11-07 16:04:15 +01:00
|
|
|
while {$use_tcl} {
|
|
|
|
if {"" ne $with_tcl} {
|
|
|
|
# Ensure that we can find tclConfig.sh under ${with_tcl}/...
|
|
|
|
if {$doConfigLookup} {
|
2024-10-23 03:59:34 +02:00
|
|
|
if {[file readable "${with_tcl}/tclConfig.sh"]} {
|
|
|
|
set cfg "${with_tcl}/tclConfig.sh"
|
|
|
|
} else {
|
|
|
|
foreach i $tclSubdirs {
|
|
|
|
if {[file readable "${with_tcl}/$i/tclConfig.sh"]} {
|
|
|
|
set cfg "${with_tcl}/$i/tclConfig.sh"
|
|
|
|
break
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
|
|
|
}
|
2024-11-07 16:04:15 +01:00
|
|
|
}
|
|
|
|
if {"" eq $cfg} {
|
|
|
|
proj-fatal "No tclConfig.sh found under ${with_tcl}"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
# If we have not yet found a tclConfig.sh file, look in
|
|
|
|
# $libdir which is set automatically by autosetup or by the
|
|
|
|
# --prefix command-line option. See
|
|
|
|
# https://sqlite.org/forum/forumpost/e04e693439a22457
|
|
|
|
set libdir [get-define libdir]
|
|
|
|
if {[file readable "${libdir}/tclConfig.sh"]} {
|
|
|
|
set cfg "${libdir}/tclConfig.sh"
|
2024-10-09 06:01:14 +02:00
|
|
|
} else {
|
2024-11-07 16:04:15 +01:00
|
|
|
foreach i $tclSubdirs {
|
|
|
|
if {[file readable "${libdir}/$i/tclConfig.sh"]} {
|
|
|
|
set cfg "${libdir}/$i/tclConfig.sh"
|
|
|
|
break
|
2024-10-23 03:59:34 +02:00
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
|
|
|
}
|
2024-11-07 16:04:15 +01:00
|
|
|
if {![file readable $cfg]} {
|
|
|
|
break
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-11-07 16:04:15 +01:00
|
|
|
msg-result "Using tclConfig.sh: $cfg"
|
2024-10-23 03:59:34 +02:00
|
|
|
break
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
|
|
|
define TCL_CONFIG_SH $cfg
|
2024-11-08 14:37:00 +01:00
|
|
|
# Export a subset of tclConfig.sh to the current TCL-space. If $cfg
|
|
|
|
# is an empty string, this emits empty-string entries for the
|
2024-10-21 18:06:49 +02:00
|
|
|
# various options we're interested in.
|
2024-11-16 11:42:33 +01:00
|
|
|
eval [exec "${srcdir}/tool/tclConfigShToAutoDef.sh" "$cfg"]
|
2024-10-16 16:04:00 +02:00
|
|
|
|
2024-10-31 09:03:35 +01:00
|
|
|
if {"" eq $with_tclsh && $cfg ne ""} {
|
2024-11-07 16:04:15 +01:00
|
|
|
# We have tclConfig.sh but no tclsh. Attempt to locate a tclsh
|
|
|
|
# based on info from tclConfig.sh.
|
2024-11-09 11:23:04 +01:00
|
|
|
proj-assert {"" ne [get-define TCL_EXEC_PREFIX]}
|
2024-10-16 16:04:00 +02:00
|
|
|
set with_tclsh [get-define TCL_EXEC_PREFIX]/bin/tclsh[get-define TCL_VERSION]
|
2024-10-22 05:12:11 +02:00
|
|
|
if {![file-isexec $with_tclsh]} {
|
2024-10-16 16:04:00 +02:00
|
|
|
set with_tclsh2 [get-define TCL_EXEC_PREFIX]/bin/tclsh
|
2024-10-22 05:12:11 +02:00
|
|
|
if {![file-isexec $with_tclsh2]} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-warn "Cannot find a usable tclsh (tried: $with_tclsh $with_tclsh2)"
|
2024-10-16 16:04:00 +02:00
|
|
|
} else {
|
|
|
|
set with_tclsh $with_tclsh2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
define TCLSH_CMD $with_tclsh
|
2024-10-30 06:07:18 +01:00
|
|
|
if {$use_tcl} {
|
2024-11-07 16:04:15 +01:00
|
|
|
# Set up the TCLLIBDIR
|
2024-10-30 06:07:18 +01:00
|
|
|
#
|
2024-10-28 19:30:46 +01:00
|
|
|
# 2024-10-28: calculation of TCLLIBDIR is now done via the shell
|
2024-11-07 16:04:15 +01:00
|
|
|
# in main.mk (search it for T.tcl.env.sh) so that
|
2024-10-30 03:06:41 +01:00
|
|
|
# static/hand-written makefiles which import main.mk do not have
|
|
|
|
# to define that before importing main.mk. Even so, we export
|
2024-11-07 16:04:15 +01:00
|
|
|
# TCLLIBDIR from here, which will cause the makefile to use this
|
|
|
|
# one rather than to re-calculate it at make-time.
|
2024-10-30 06:07:18 +01:00
|
|
|
set tcllibdir [get-env TCLLIBDIR ""]
|
|
|
|
if {"" eq $tcllibdir} {
|
|
|
|
# Attempt to extract TCLLIBDIR from TCL's $auto_path
|
2024-11-07 16:04:15 +01:00
|
|
|
if {"" ne $with_tclsh &&
|
|
|
|
[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
|
2024-10-30 06:07:18 +01:00
|
|
|
foreach i $result {
|
|
|
|
if {[file isdir $i]} {
|
|
|
|
set tcllibdir $i/sqlite3
|
|
|
|
break
|
2024-10-09 09:12:32 +02:00
|
|
|
}
|
|
|
|
}
|
2024-10-30 06:07:18 +01:00
|
|
|
} else {
|
2024-11-07 16:04:15 +01:00
|
|
|
proj-warn "Cannot determine TCLLIBDIR."
|
|
|
|
# The makefile will fail fatally in this case if a target is
|
|
|
|
# invoked which requires TCLLIBDIR.
|
2024-10-09 09:12:32 +02:00
|
|
|
}
|
|
|
|
}
|
2024-11-07 16:04:15 +01:00
|
|
|
#if {"" ne $tcllibdir} { msg-result "TCLLIBDIR = ${tcllibdir}"; }
|
2024-10-30 06:07:18 +01:00
|
|
|
define TCLLIBDIR $tcllibdir
|
2024-10-28 19:30:46 +01:00
|
|
|
}; # find TCLLIBDIR
|
2024-10-16 16:04:00 +02:00
|
|
|
|
2024-11-07 07:00:14 +01:00
|
|
|
if {[file-isexec $with_tclsh]} {
|
2024-11-07 09:57:38 +01:00
|
|
|
msg-result "Using tclsh: $with_tclsh"
|
2024-11-07 06:26:09 +01:00
|
|
|
if {$cfg ne ""} {
|
|
|
|
define HAVE_TCL 1
|
|
|
|
} else {
|
2024-11-07 16:04:15 +01:00
|
|
|
proj-warn "Found tclsh but no tclConfig.sh."
|
2024-11-07 06:26:09 +01:00
|
|
|
}
|
2024-10-09 09:12:32 +02:00
|
|
|
}
|
2024-10-31 09:03:35 +01:00
|
|
|
show-notices
|
2024-11-14 13:23:05 +01:00
|
|
|
# If TCL is not found: if it was explicitly requested then fail
|
|
|
|
# fatally, else just emit a warning. If we can find the APIs needed
|
|
|
|
# to generate a working JimTCL then that will suffice for build-time
|
|
|
|
# TCL purposes (see: proc sqlite-determine-codegen-tcl).
|
2024-11-07 16:04:15 +01:00
|
|
|
if {![get-define HAVE_TCL] &&
|
|
|
|
([proj-opt-was-provided tcl] || [proj-opt-was-provided with-tcl])} {
|
|
|
|
proj-fatal "TCL support was requested but no tclConfig.sh could be found."
|
|
|
|
}
|
|
|
|
if {"" eq $cfg} {
|
2024-11-09 11:23:04 +01:00
|
|
|
proj-assert {0 == [get-define HAVE_TCL]}
|
2024-11-07 16:04:15 +01:00
|
|
|
proj-indented-notice {
|
|
|
|
WARNING: Cannot find a usable tclConfig.sh file. Use
|
|
|
|
--with-tcl=DIR to specify a directory where tclConfig.sh can be
|
|
|
|
found. SQLite does not use TCL internally, but some optional
|
|
|
|
components require TCL, including tests and sqlite3_analyzer.
|
|
|
|
}
|
|
|
|
}
|
2024-10-27 06:28:52 +01:00
|
|
|
}; # sqlite-check-tcl
|
|
|
|
sqlite-check-tcl
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
2024-10-29 21:27:36 +01:00
|
|
|
# sqlite-determine-codegen-tcl checks which TCL to use as a code
|
|
|
|
# generator. By default, prefer jimsh simply because we have it
|
|
|
|
# in-tree (it's part of autosetup) unless --with-tclsh=X is used, in
|
|
|
|
# which case prefix X.
|
2024-10-29 04:29:45 +01:00
|
|
|
#
|
2024-11-03 22:32:24 +01:00
|
|
|
# Returns the human-readable name of the TCL it selects. Fails fatally
|
|
|
|
# if it cannot detect a TCL appropriate for code generation.
|
2024-10-29 21:27:36 +01:00
|
|
|
#
|
|
|
|
# Defines:
|
|
|
|
#
|
|
|
|
# - BTCLSH = the TCL shell used for code generation. It may set this
|
|
|
|
# to an unexpanded makefile var name.
|
|
|
|
#
|
|
|
|
# - CFLAGS_JIMSH = any flags needed for buildng a BTCLSH-compatible
|
2024-11-14 13:09:09 +01:00
|
|
|
# jimsh. The defaults may be passed on to configure as
|
2024-11-03 22:32:24 +01:00
|
|
|
# CFLAGS_JIMSH=...
|
2024-11-07 09:29:58 +01:00
|
|
|
set useJimForCodeGen 0 ; # Set to 1 when using jimsh for code generation.
|
|
|
|
# May affect later decisions.
|
2024-10-29 19:50:25 +01:00
|
|
|
proc sqlite-determine-codegen-tcl {} {
|
2024-10-29 04:29:45 +01:00
|
|
|
msg-result "Checking for TCL to use for code generation... "
|
2024-11-03 22:32:24 +01:00
|
|
|
define CFLAGS_JIMSH [proj-get-env CFLAGS_JIMSH {-O1}]
|
2024-10-29 04:29:45 +01:00
|
|
|
set cgtcl [opt-val with-tclsh jimsh]
|
2024-11-07 09:57:38 +01:00
|
|
|
set flagsToRestore {CC CFLAGS AS_CFLAGS CPPFLAGS AS_CPPFLAGS LDFLAGS LINKFLAGS LIBS CROSS}
|
2024-11-07 09:29:58 +01:00
|
|
|
define-push $flagsToRestore {
|
2024-10-31 07:38:30 +01:00
|
|
|
# We have to swap CC to CC_FOR_BUILD for purposes of the various
|
|
|
|
# [cc-...] tests below. Recall that --with-wasi-sdk may have
|
|
|
|
# swapped out CC with one which is not appropriate for this block.
|
2024-11-01 02:56:27 +01:00
|
|
|
# Per consulation with autosetup's creator, doing this properly
|
|
|
|
# requires us to [define-push] the whole $flagsToRestore list
|
|
|
|
# (plus a few others which are not relevant in this tree).
|
2024-11-07 09:57:38 +01:00
|
|
|
#
|
|
|
|
# These will get set to their previous values at the end of this
|
|
|
|
# block.
|
2024-11-01 02:56:27 +01:00
|
|
|
foreach flag $flagsToRestore {define $flag ""}
|
2024-10-31 07:38:30 +01:00
|
|
|
define CC [get-define CC_FOR_BUILD]
|
|
|
|
if {"jimsh" ne $cgtcl} {
|
|
|
|
# When --with-tclsh=X is used, use that for all TCL purposes,
|
|
|
|
# including in-tree code generation, per developer request.
|
2024-10-29 04:29:45 +01:00
|
|
|
define BTCLSH "\$(TCLSH_CMD)"
|
|
|
|
} else {
|
2024-10-31 07:38:30 +01:00
|
|
|
# These headers are technically optional for JimTCL but necessary if
|
|
|
|
# we want to use it for code generation:
|
|
|
|
set sysh [cc-check-includes dirent.h sys/time.h]
|
2024-11-07 09:57:38 +01:00
|
|
|
# jimsh0.c hard-codes #define's for HAVE_DIRENT_H and
|
|
|
|
# HAVE_SYS_TIME_H on the platforms it supports, so we do not
|
|
|
|
# need to add -D... flags for those. We check for them here only
|
|
|
|
# so that we can avoid the situation that we later, at
|
|
|
|
# make-time, try to compile jimsh but it then fails due to
|
|
|
|
# missing headers (i.e. fail earlier rather than later).
|
2024-10-31 07:38:30 +01:00
|
|
|
if {$sysh && [cc-check-functions realpath]} {
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_REALPATH
|
|
|
|
define BTCLSH "\$(JIMSH)"
|
2024-11-07 08:31:25 +01:00
|
|
|
set ::useJimForCodeGen 1
|
2024-10-31 07:38:30 +01:00
|
|
|
} elseif {$sysh && [cc-check-functions _fullpath]} {
|
2024-11-07 09:57:38 +01:00
|
|
|
# _fullpath() is a Windows API. It's not entirely clear
|
|
|
|
# whether we need to add {-DHAVE_SYS_TIME_H -DHAVE_DIRENT_H}
|
|
|
|
# to CFLAGS_JIMSH in this case. On MinGW32 we definitely do
|
|
|
|
# not want to because it already hard-codes them. On _MSC_VER
|
|
|
|
# builds it does not.
|
2024-10-31 07:38:30 +01:00
|
|
|
define-append CFLAGS_JIMSH -DHAVE__FULLPATH
|
|
|
|
define BTCLSH "\$(JIMSH)"
|
2024-11-07 08:31:25 +01:00
|
|
|
set ::useJimForCodeGen 1
|
2024-11-07 07:00:14 +01:00
|
|
|
} elseif {[file-isexec [get-define TCLSH_CMD]]} {
|
2024-10-31 07:38:30 +01:00
|
|
|
set cgtcl [get-define TCLSH_CMD]
|
|
|
|
define BTCLSH "\$(TCLSH_CMD)"
|
|
|
|
} else {
|
|
|
|
# One last-ditch effort to find TCLSH_CMD: use info from
|
|
|
|
# tclConfig.sh to try to find a tclsh
|
|
|
|
if {"" eq [get-define TCLSH_CMD]} {
|
|
|
|
set tpre [get-define TCL_EXEC_PREFIX]
|
|
|
|
if {"" ne $tpre} {
|
|
|
|
set tv [get-define TCL_VERSION]
|
|
|
|
if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
|
|
|
|
define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
|
|
|
|
} elseif {[file-isexec "${tpre}/bin/tclsh"]} {
|
|
|
|
define TCLSH_CMD "${tpre}/bin/tclsh"
|
|
|
|
}
|
2024-10-29 04:29:45 +01:00
|
|
|
}
|
2024-10-26 01:13:12 +02:00
|
|
|
}
|
2024-10-31 07:38:30 +01:00
|
|
|
set cgtcl [get-define TCLSH_CMD]
|
2024-11-07 07:00:14 +01:00
|
|
|
if {![file-isexec $cgtcl]} {
|
2024-10-31 07:38:30 +01:00
|
|
|
proj-fatal "Cannot find a tclsh to use for code generation."
|
|
|
|
}
|
|
|
|
define BTCLSH "\$(TCLSH_CMD)"
|
2024-10-09 06:27:03 +02:00
|
|
|
}
|
2024-10-26 01:13:12 +02:00
|
|
|
}
|
2024-10-31 07:38:30 +01:00
|
|
|
}; # CC swap-out
|
2024-10-29 04:29:45 +01:00
|
|
|
return $cgtcl
|
2024-10-29 19:50:25 +01:00
|
|
|
}; # sqlite-determine-codegen-tcl
|
|
|
|
msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]"
|
2024-10-09 06:01:14 +02:00
|
|
|
# /TCL
|
|
|
|
########################################################################
|
2024-09-30 16:33:36 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
|
|
|
# Thread safety?
|
2024-09-25 16:58:09 +02:00
|
|
|
msg-checking "Support threadsafe operation? "
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-if-opt-truthy threadsafe {
|
2024-09-25 16:38:46 +02:00
|
|
|
msg-result yes
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag -DSQLITE_THREADSAFE=1
|
2024-10-28 15:16:50 +01:00
|
|
|
if {![proj-check-function-in-lib pthread_create pthread]
|
|
|
|
|| ![proj-check-function-in-lib pthread_mutexattr_init pthread]} {
|
2024-09-25 20:03:26 +02:00
|
|
|
user-error "Missing required pthread bits"
|
|
|
|
}
|
|
|
|
define LDFLAGS_PTHREAD [get-define lib_pthread_create]
|
|
|
|
undefine lib_pthread_create
|
2024-09-25 16:38:46 +02:00
|
|
|
} {
|
|
|
|
msg-result no
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag -DSQLITE_THREADSAFE=0
|
2024-09-25 20:03:26 +02:00
|
|
|
define LDFLAGS_PTHREAD ""
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 16:38:46 +02:00
|
|
|
# Do we want temporary databases in memory?
|
|
|
|
#
|
2024-11-14 13:09:09 +01:00
|
|
|
apply {{} {
|
2024-09-25 14:16:13 +02:00
|
|
|
set ts [opt-val with-tempstore no]
|
2024-09-25 09:30:54 +02:00
|
|
|
set tsn 1
|
2024-11-07 17:59:15 +01:00
|
|
|
msg-checking "Use an in-RAM database for temporary tables? "
|
2024-09-25 09:30:54 +02:00
|
|
|
switch -- $ts {
|
|
|
|
never { set tsn 0 }
|
|
|
|
no { set tsn 1 }
|
|
|
|
yes { set tsn 2 }
|
|
|
|
always { set tsn 3 }
|
|
|
|
default {
|
2024-11-07 17:59:15 +01:00
|
|
|
user-error "Invalid --with-tempstore value '$ts'. Use one of: never, no, yes, always"
|
2024-09-25 09:30:54 +02:00
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-09-25 09:30:54 +02:00
|
|
|
msg-result $ts
|
|
|
|
define TEMP_STORE $tsn
|
2024-11-14 13:09:09 +01:00
|
|
|
}}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-26 20:17:17 +02:00
|
|
|
########################################################################
|
2024-10-27 05:27:47 +01:00
|
|
|
# sqlite-check-line-editing jumps through proverbial hoops to try to
|
2024-10-26 23:51:04 +02:00
|
|
|
# find a working line-editing library, setting:
|
2024-10-26 20:17:17 +02:00
|
|
|
#
|
2024-10-26 23:51:04 +02:00
|
|
|
# - HAVE_READLINE to 0 or 1
|
2024-10-30 23:41:12 +01:00
|
|
|
# - HAVE_LINENOISE to 0, 1, or 2
|
2024-10-26 23:51:04 +02:00
|
|
|
# - HAVE_EDITLINE to 0 or 1
|
2024-10-26 20:17:17 +02:00
|
|
|
#
|
2024-11-07 16:23:54 +01:00
|
|
|
# Only one of ^^^ those will be set to non-0.
|
2024-10-27 06:28:52 +01:00
|
|
|
#
|
2024-10-26 23:51:04 +02:00
|
|
|
# - LDFLAGS_READLINE = linker flags or empty string
|
|
|
|
#
|
2024-10-29 04:29:45 +01:00
|
|
|
# - CFLAGS_READLINE = compilation flags for clients or empty string.
|
2024-10-26 20:17:17 +02:00
|
|
|
#
|
2024-10-26 23:51:04 +02:00
|
|
|
# Note that LDFLAGS_READLINE and CFLAGS_READLINE may refer to
|
2024-10-29 21:27:36 +01:00
|
|
|
# linenoise or editline, not necessarily libreadline. In some cases
|
|
|
|
# it will set HAVE_READLINE=1 when it's really using editline, for
|
|
|
|
# reasons described in this function's comments.
|
2024-10-26 23:51:04 +02:00
|
|
|
#
|
|
|
|
# Returns a string describing which line-editing approach to use, or
|
|
|
|
# "none" if no option is available.
|
2024-10-29 09:42:06 +01:00
|
|
|
#
|
|
|
|
# Order of checks:
|
|
|
|
#
|
2024-11-07 16:23:54 +01:00
|
|
|
# 1) --with-linenoise trumps all others and skips all of the
|
|
|
|
# complexities involved with the remaining options.
|
2024-10-29 09:42:06 +01:00
|
|
|
#
|
|
|
|
# 2) --editline trumps --readline
|
|
|
|
#
|
|
|
|
# 3) --disable-readline trumps --readline
|
|
|
|
#
|
|
|
|
# 4) Default to automatic search for optional readline
|
|
|
|
#
|
2024-11-07 16:23:54 +01:00
|
|
|
# 5) Try to find readline or editline. If it's not found AND the
|
2024-10-29 09:42:06 +01:00
|
|
|
# corresponding --FEATURE flag was explicitly given, fail fatally,
|
|
|
|
# else fail silently.
|
2024-10-27 05:27:47 +01:00
|
|
|
proc sqlite-check-line-editing {} {
|
2024-10-27 23:18:33 +01:00
|
|
|
msg-result "Checking for line-editing capability..."
|
2024-10-26 20:34:39 +02:00
|
|
|
define HAVE_READLINE 0
|
2024-10-26 23:51:04 +02:00
|
|
|
define HAVE_LINENOISE 0
|
|
|
|
define HAVE_EDITLINE 0
|
2024-10-26 20:34:39 +02:00
|
|
|
define LDFLAGS_READLINE ""
|
|
|
|
define CFLAGS_READLINE ""
|
2024-11-07 16:23:54 +01:00
|
|
|
set failIfNotFound 0 ; # Gets set to 1 for explicit --FEATURE requests
|
|
|
|
# so that we know whether to fail fatally or not
|
|
|
|
# if the library is not found.
|
2024-10-29 21:27:36 +01:00
|
|
|
set libsForReadline {readline edit} ; # -l<LIB> names to check for readline().
|
|
|
|
# The libedit check changes this.
|
2024-10-29 09:01:56 +01:00
|
|
|
set editLibName "readline" ; # "readline" or "editline"
|
|
|
|
set editLibDef "HAVE_READLINE" ; # "HAVE_READLINE" or "HAVE_EDITLINE"
|
2024-10-29 21:27:36 +01:00
|
|
|
set dirLn [opt-val with-linenoise]
|
|
|
|
if {"" ne $dirLn} {
|
|
|
|
# Use linenoise from a copy of its sources (not a library)...
|
2024-10-26 23:51:04 +02:00
|
|
|
if {![file isdir $dirLn]} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-fatal "--with-linenoise value is not a directory"
|
2024-10-30 23:41:12 +01:00
|
|
|
}
|
|
|
|
set lnH $dirLn/linenoise.h
|
|
|
|
if {![file exists $lnH] } {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-fatal "Cannot find linenoise.h in $dirLn"
|
2024-10-26 23:51:04 +02:00
|
|
|
}
|
2024-10-30 23:41:12 +01:00
|
|
|
set lnC ""
|
|
|
|
set lnCOpts {linenoise-ship.c linenoise.c}
|
|
|
|
foreach f $lnCOpts {
|
|
|
|
if {[file exists $dirLn/$f]} {
|
|
|
|
set lnC $dirLn/$f
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if {"" eq $lnC} {
|
|
|
|
proj-fatal "Cannot find any of $lnCOpts in $dirLn"
|
2024-10-30 15:03:56 +01:00
|
|
|
}
|
2024-10-30 23:49:40 +01:00
|
|
|
set flavor ""
|
|
|
|
set lnVal [proj-which-linenoise $lnH]
|
|
|
|
switch -- $lnVal {
|
|
|
|
1 { set flavor "antirez" }
|
|
|
|
2 { set flavor "msteveb" }
|
|
|
|
default {
|
|
|
|
proj-fatal "Cannot determine the flavor of linenoise from $lnH"
|
|
|
|
}
|
|
|
|
}
|
2024-10-30 23:41:12 +01:00
|
|
|
define CFLAGS_READLINE "-I$dirLn $lnC"
|
2024-10-30 23:49:40 +01:00
|
|
|
define HAVE_LINENOISE $lnVal
|
|
|
|
sqlite-add-shell-opt -DHAVE_LINENOISE=$lnVal
|
2024-11-07 08:31:25 +01:00
|
|
|
if {$::useJimForCodeGen && 2 == $lnVal} {
|
|
|
|
define-append CFLAGS_JIMSH -DUSE_LINENOISE [get-define CFLAGS_READLINE]
|
|
|
|
user-notice "Adding linenoise support to jimsh."
|
|
|
|
}
|
2024-10-30 23:41:12 +01:00
|
|
|
return "linenoise ($flavor)"
|
2024-10-26 23:51:04 +02:00
|
|
|
} elseif {[opt-bool editline]} {
|
2024-10-29 21:27:36 +01:00
|
|
|
# libedit mimics libreadline and on some systems does not have its
|
|
|
|
# own header installed (instead, that of libreadline is used).
|
2024-10-27 06:28:52 +01:00
|
|
|
#
|
2024-10-29 09:01:56 +01:00
|
|
|
# shell.c historically expects HAVE_EDITLINE to be set for
|
|
|
|
# libedit, but it then expects to see <editline/readline.h>, which
|
2024-11-07 16:23:54 +01:00
|
|
|
# some system's don't actually have despite having libedit. If we
|
|
|
|
# end up finding <editline/readline.h> below, we will use
|
2024-10-29 09:14:34 +01:00
|
|
|
# -DHAVE_EDITLINE=1, else we will use -DHAVE_READLINE=1. In either
|
|
|
|
# case, we will link against libedit.
|
2024-10-29 09:42:06 +01:00
|
|
|
set failIfNotFound 1
|
2024-10-29 09:01:56 +01:00
|
|
|
set libsForReadline {edit}
|
|
|
|
set editLibName editline
|
2024-10-26 23:51:04 +02:00
|
|
|
} elseif {![opt-bool readline]} {
|
2024-10-27 23:18:33 +01:00
|
|
|
msg-result "Readline support explicitly disabled with --disable-readline"
|
2024-10-26 23:51:04 +02:00
|
|
|
return "none"
|
2024-10-29 09:42:06 +01:00
|
|
|
} elseif {[proj-opt-was-provided readline]} {
|
2024-10-29 21:27:36 +01:00
|
|
|
# If an explicit --[enable-]readline was used, fail if it's not
|
|
|
|
# found, else treat the feature as optional.
|
2024-10-29 09:42:06 +01:00
|
|
|
set failIfNotFound 1
|
2024-10-26 20:34:39 +02:00
|
|
|
}
|
2024-10-27 05:27:47 +01:00
|
|
|
|
2024-10-27 21:04:23 +01:00
|
|
|
# Transform with-readline-header=X to with-readline-cflags=-I...
|
2024-10-27 05:27:47 +01:00
|
|
|
set v [opt-val with-readline-header]
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-opt-set with-readline-header ""
|
2024-10-27 05:27:47 +01:00
|
|
|
if {"" ne $v} {
|
|
|
|
if {"auto" eq $v} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-opt-set with-readline-cflags auto
|
2024-10-26 20:17:17 +02:00
|
|
|
} else {
|
|
|
|
set v [file dirname $v]
|
2024-10-29 09:01:56 +01:00
|
|
|
if {[string match */readline $v]} {
|
2024-11-07 16:23:54 +01:00
|
|
|
# Special case: if the path includes .../readline/readline.h,
|
|
|
|
# set the -I to one dir up from that because our sources
|
|
|
|
# #include <readline/readline.h> or <editline/readline.h>.
|
2024-10-26 20:17:17 +02:00
|
|
|
set v [file dirname $v]
|
|
|
|
}
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-opt-set with-readline-cflags "-I$v"
|
2024-10-26 20:17:17 +02:00
|
|
|
}
|
2024-10-27 05:27:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Look for readline.h
|
2024-10-27 21:04:23 +01:00
|
|
|
set rlInc [opt-val with-readline-cflags auto]
|
2024-10-27 05:27:47 +01:00
|
|
|
if {"auto" eq $rlInc} {
|
|
|
|
set rlInc ""
|
2024-10-31 07:38:30 +01:00
|
|
|
if {$::isCrossCompiling} {
|
2024-10-29 21:27:36 +01:00
|
|
|
# ^^^ this check is derived from the legacy configure script.
|
2024-10-29 09:01:56 +01:00
|
|
|
proj-warn "Skipping check for readline.h because we're cross-compiling."
|
|
|
|
} else {
|
|
|
|
set dirs "[get-define prefix] /usr /usr/local /usr/local/readline /usr/contrib /mingw"
|
|
|
|
set subdirs "include/$editLibName"
|
2024-10-29 21:27:36 +01:00
|
|
|
if {"editline" eq $editLibName} {
|
2024-10-29 09:01:56 +01:00
|
|
|
lappend subdirs include/readline
|
|
|
|
# ^^^ editline, on some systems, does not have its own header,
|
|
|
|
# and uses libreadline's header.
|
|
|
|
}
|
|
|
|
lappend subdirs include
|
|
|
|
# ^^^ The dirs and subdirs lists are, except for the inclusion
|
|
|
|
# of $prefix and editline, from the legacy configure script
|
2024-10-28 15:16:50 +01:00
|
|
|
set rlInc [proj-search-for-header-dir readline.h \
|
2024-10-29 09:01:56 +01:00
|
|
|
-dirs $dirs -subdirs $subdirs]
|
2024-10-27 05:27:47 +01:00
|
|
|
if {"" ne $rlInc} {
|
2024-10-29 09:01:56 +01:00
|
|
|
if {[string match */readline $rlInc]} {
|
|
|
|
set rlInc [file dirname $rlInc]; # shell #include's <readline/readline.h>
|
|
|
|
} elseif {[string match */editline $rlInc]} {
|
|
|
|
set editLibDef HAVE_EDITLINE
|
|
|
|
set rlInc [file dirname $rlInc]; # shell #include's <editline/readline.h>
|
2024-10-27 05:27:47 +01:00
|
|
|
}
|
|
|
|
set rlInc "-I${rlInc}"
|
|
|
|
}
|
|
|
|
}
|
2024-10-30 00:19:29 +01:00
|
|
|
} elseif {"" ne $rlInc && ![string match *-I* $rlInc]} {
|
2024-10-30 00:42:24 +01:00
|
|
|
proj-fatal "Argument to --with-readline-cflags is intended to be CFLAGS and contain -I..."
|
2024-10-27 05:27:47 +01:00
|
|
|
}
|
|
|
|
|
2024-10-29 21:27:36 +01:00
|
|
|
# If readline.h was found/specified, look for lib(readline|edit)...
|
|
|
|
#
|
|
|
|
# This is not quite straightforward because both libreadline and
|
|
|
|
# libedit typically require some other library which (according to
|
|
|
|
# legacy autotools-generated tests) provides tgetent(3). On some
|
|
|
|
# systems that's built into libreadline/edit, on some (most?) its in
|
|
|
|
# lib[n]curses, and on some it's in libtermcap.
|
2024-10-27 05:27:47 +01:00
|
|
|
set rlLib ""
|
|
|
|
if {"" ne $rlInc} {
|
2024-10-27 21:04:23 +01:00
|
|
|
set rlLib [opt-val with-readline-ldflags]
|
2024-10-27 05:27:47 +01:00
|
|
|
if {"" eq $rlLib || "auto" eq $rlLib} {
|
|
|
|
set rlLib ""
|
|
|
|
set libTerm ""
|
2024-10-29 09:01:56 +01:00
|
|
|
if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} {
|
2024-10-27 05:27:47 +01:00
|
|
|
# ^^^ that libs list comes from the legacy configure script ^^^
|
|
|
|
set libTerm [get-define lib_tgetent]
|
|
|
|
undefine lib_tgetent
|
|
|
|
}
|
2024-10-29 09:01:56 +01:00
|
|
|
if {$editLibName eq $libTerm} {
|
2024-10-27 05:27:47 +01:00
|
|
|
set rlLib $libTerm
|
2024-10-29 09:01:56 +01:00
|
|
|
} elseif {[proj-check-function-in-lib readline $libsForReadline $libTerm]} {
|
2024-10-27 05:27:47 +01:00
|
|
|
set rlLib [get-define lib_readline]
|
|
|
|
lappend rlLib $libTerm
|
|
|
|
undefine lib_readline
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-29 21:27:36 +01:00
|
|
|
# If we found a library, configure the build to use it...
|
2024-10-27 05:27:47 +01:00
|
|
|
if {"" ne $rlLib} {
|
2024-10-29 09:01:56 +01:00
|
|
|
if {"editline" eq $editLibName && "HAVE_READLINE" eq $editLibDef} {
|
2024-11-06 05:38:05 +01:00
|
|
|
# Alert the user that, despite outward appearances, we won't be
|
|
|
|
# linking to the GPL'd libreadline. Presumably that distinction is
|
|
|
|
# significant for those using --editline.
|
2024-11-07 16:23:54 +01:00
|
|
|
proj-indented-notice {
|
2024-10-29 21:27:36 +01:00
|
|
|
NOTE: the local libedit but uses <readline/readline.h> so we
|
|
|
|
will compile with -DHAVE_READLINE=1 but will link with
|
2024-10-29 09:01:56 +01:00
|
|
|
libedit.
|
|
|
|
}
|
|
|
|
}
|
2024-10-27 05:27:47 +01:00
|
|
|
set rlLib [join $rlLib]
|
|
|
|
set rlInc [join $rlInc]
|
|
|
|
define LDFLAGS_READLINE $rlLib
|
|
|
|
define CFLAGS_READLINE $rlInc
|
2024-11-09 11:23:04 +01:00
|
|
|
proj-assert {$editLibDef in {HAVE_READLINE HAVE_EDITLINE}}
|
|
|
|
proj-assert {$editLibName in {readline editline}}
|
2024-10-29 09:01:56 +01:00
|
|
|
sqlite-add-shell-opt -D${editLibDef}=1
|
|
|
|
msg-result "Using $editLibName flags: $rlInc $rlLib"
|
2024-10-29 21:27:36 +01:00
|
|
|
# Check whether rl_completion_matches() has a signature we can use
|
|
|
|
# and disable that sub-feature if it doesn't.
|
2024-10-29 09:01:56 +01:00
|
|
|
if {![cctest \
|
|
|
|
-cflags "$rlInc -D${editLibDef}" -libs $rlLib -nooutput 1 -source {
|
2024-10-27 19:46:11 +01:00
|
|
|
#include <stdio.h>
|
2024-10-29 09:01:56 +01:00
|
|
|
#ifdef HAVE_EDITLINE
|
|
|
|
#include <editline/readline.h>
|
|
|
|
#else
|
2024-10-27 19:46:11 +01:00
|
|
|
#include <readline/readline.h>
|
2024-10-29 09:01:56 +01:00
|
|
|
#endif
|
2024-10-29 20:03:22 +01:00
|
|
|
static char * rcg(const char *z, int i){(void)z; (void)i; return 0;}
|
2024-10-27 19:46:11 +01:00
|
|
|
int main(void) {
|
|
|
|
char ** x = rl_completion_matches("one", rcg);
|
2024-10-29 20:03:22 +01:00
|
|
|
(void)x;
|
2024-10-27 19:46:11 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}]} {
|
2024-11-07 16:23:54 +01:00
|
|
|
proj-warn "readline-style completion disabled due to rl_completion_matches() signature mismatch"
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION
|
2024-10-27 19:46:11 +01:00
|
|
|
}
|
2024-10-29 09:01:56 +01:00
|
|
|
return $editLibName
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-10-26 23:51:04 +02:00
|
|
|
|
2024-10-29 09:42:06 +01:00
|
|
|
if {$failIfNotFound} {
|
|
|
|
proj-fatal "Explicit --$editLibName failed to find a matching library."
|
|
|
|
}
|
2024-10-26 23:51:04 +02:00
|
|
|
return "none"
|
2024-10-27 05:27:47 +01:00
|
|
|
}; # sqlite-check-line-editing
|
|
|
|
msg-result "Line-editing support for the sqlite3 shell: [sqlite-check-line-editing]"
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-if-opt-truthy load-extension {
|
|
|
|
if {[proj-check-function-in-lib dlopen dl]} {
|
2024-09-25 05:37:34 +02:00
|
|
|
define LDFLAGS_DLOPEN [get-define lib_dlopen]
|
2024-09-25 20:03:26 +02:00
|
|
|
undefine lib_dlopen
|
2024-09-25 05:37:34 +02:00
|
|
|
} else {
|
|
|
|
user-error "dlopen() not found. Use --disable-load-extension to bypass this check."
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-09-25 05:37:34 +02:00
|
|
|
} {
|
|
|
|
define LDFLAGS_DLOPEN ""
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
|
2024-09-25 05:37:34 +02:00
|
|
|
msg-result "Disabling loadable extensions."
|
|
|
|
}
|
|
|
|
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-if-opt-truthy math {
|
|
|
|
if {![proj-check-function-in-lib ceil m]} {
|
2024-09-25 05:37:34 +02:00
|
|
|
user-error "Cannot find libm functions. Use --disable-math to bypass this."
|
|
|
|
}
|
|
|
|
define LDFLAGS_MATH [get-define lib_ceil]
|
|
|
|
undefine lib_ceil
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
|
2024-09-30 19:44:41 +02:00
|
|
|
msg-result "Enabling math SQL functions [get-define LDFLAGS_MATH]"
|
2024-09-25 05:37:34 +02:00
|
|
|
} {
|
|
|
|
define LDFLAGS_MATH ""
|
2024-09-25 06:20:58 +02:00
|
|
|
msg-result "Disabling math SQL functions"
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
|
|
|
|
2024-10-27 08:06:03 +01:00
|
|
|
########################################################################
|
2024-10-27 23:18:33 +01:00
|
|
|
# ICU - International Components for Unicode
|
2024-10-28 01:56:31 +01:00
|
|
|
#
|
|
|
|
# Handles these flags:
|
|
|
|
#
|
|
|
|
# --with-icu-ldflags=LDFLAGS
|
2024-11-14 20:25:23 +01:00
|
|
|
# --with-icu-cflags=CFLAGS
|
2024-11-15 11:07:57 +01:00
|
|
|
# --with-icu-config[=auto | pkg-config | /path/to/icu-config]
|
2024-10-28 01:56:31 +01:00
|
|
|
# --enable-icu-collations
|
|
|
|
#
|
2024-11-15 11:07:57 +01:00
|
|
|
# --with-icu-config values:
|
2024-11-15 11:12:03 +01:00
|
|
|
#
|
2024-11-15 11:53:57 +01:00
|
|
|
# - auto: use the first one of (pkg-config, icu-config) found on the
|
|
|
|
# system.
|
2024-11-15 11:07:57 +01:00
|
|
|
# - pkg-config: use only pkg-config to determine flags
|
|
|
|
# - /path/to/icu-config: use that to determine flags
|
|
|
|
#
|
|
|
|
# If --with-icu-config is used as neither pkg-config nor icu-config
|
|
|
|
# are found, fail fatally.
|
|
|
|
#
|
|
|
|
# If both --with-icu-ldflags and --with-icu-config are provided, they
|
|
|
|
# are cumulative. If neither are provided, icu-collations is not
|
2024-11-15 11:12:03 +01:00
|
|
|
# honored and a warning is emitted if it is provided.
|
2024-10-28 01:56:31 +01:00
|
|
|
#
|
|
|
|
# Design note: though we can automatically enable ICU if the
|
2024-11-15 11:53:57 +01:00
|
|
|
# icu-config binary or (pkg-config icu-io) are found, we specifically
|
2024-11-15 11:07:57 +01:00
|
|
|
# do not. ICU is always an opt-in feature.
|
2024-11-15 11:12:03 +01:00
|
|
|
#
|
|
|
|
# Maintenance reminder: check-in 09caa94c9e84 added pkg-config support
|
|
|
|
# to this but the result fails to link on both Linux and OpenBSD
|
|
|
|
# (other systems were untested) because the pkg-config results are
|
|
|
|
# missing a required library.
|
2024-10-28 01:56:31 +01:00
|
|
|
proc sqlite-check-icu {} {
|
|
|
|
define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]]
|
2024-11-14 20:25:23 +01:00
|
|
|
define CFLAGS_ICU [join [opt-val with-icu-cflags ""]]
|
2024-10-27 08:06:03 +01:00
|
|
|
# Flags sets seen in the wild for ICU:
|
2024-10-27 23:18:33 +01:00
|
|
|
# - -licui18n -licuuc -licudata
|
|
|
|
# - -licui18n -licuuc
|
|
|
|
# - /usr/local/bin/icu-config --ldflags
|
2024-11-15 11:47:11 +01:00
|
|
|
#
|
2024-10-28 15:16:50 +01:00
|
|
|
if {[proj-opt-was-provided with-icu-config]} {
|
2024-11-15 11:07:57 +01:00
|
|
|
set icuConfigBin [opt-val with-icu-config]
|
|
|
|
set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config
|
2024-11-15 11:47:11 +01:00
|
|
|
if {"auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin} {
|
|
|
|
if {[pkg-config-init 0] && [pkg-config icu-io]} {
|
|
|
|
# Maintenance reminder: historical docs say to use both of
|
|
|
|
# (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has
|
|
|
|
# all of them on tested OSes.
|
2024-11-15 11:07:57 +01:00
|
|
|
set tryIcuConfigBin 0
|
2024-11-15 11:47:11 +01:00
|
|
|
define LDFLAGS_ICU [get-define PKG_ICU_IO_LDFLAGS]
|
|
|
|
define-append LDFLAGS_ICU [get-define PKG_ICU_IO_LIBS]
|
|
|
|
define CFLAGS_ICU [get-define PKG_ICU_IO_CFLAGS]
|
|
|
|
} elseif {"pkg-config" eq $icuConfigBin} {
|
|
|
|
proj-fatal "pkg-config cannot find package icu-io"
|
|
|
|
} else {
|
|
|
|
proj-assert {"auto" eq $icuConfigBin}
|
2024-10-28 01:56:31 +01:00
|
|
|
}
|
|
|
|
}
|
2024-11-15 11:07:57 +01:00
|
|
|
if {$tryIcuConfigBin} {
|
|
|
|
if {"auto" eq $icuConfigBin} {
|
|
|
|
set icuConfigBin [proj-first-bin-of \
|
|
|
|
/usr/local/bin/icu-config \
|
|
|
|
/usr/bin/icu-config]
|
|
|
|
if {"" eq $icuConfigBin} {
|
2024-11-15 11:47:11 +01:00
|
|
|
proj-fatal "--with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary"
|
2024-11-15 11:07:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if {[file-isexec $icuConfigBin]} {
|
|
|
|
set x [exec $icuConfigBin --ldflags]
|
|
|
|
if {"" eq $x} {
|
|
|
|
proj-fatal "$icuConfigBin --ldflags returned no data"
|
|
|
|
}
|
|
|
|
define-append LDFLAGS_ICU $x
|
|
|
|
set x [exec $icuConfigBin --cppflags]
|
|
|
|
define-append CFLAGS_ICU $x
|
|
|
|
} else {
|
|
|
|
proj-fatal "--with-icu-config=$bin does not refer to an executable"
|
2024-10-28 01:56:31 +01:00
|
|
|
}
|
|
|
|
}
|
2024-10-27 08:06:03 +01:00
|
|
|
}
|
2024-11-14 20:25:23 +01:00
|
|
|
set ldflags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]]
|
|
|
|
set cflags [define CFLAGS_ICU [string trim [get-define CFLAGS_ICU]]]
|
|
|
|
if {"" ne $ldflags} {
|
2024-10-28 01:56:31 +01:00
|
|
|
sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU
|
2024-11-15 11:07:57 +01:00
|
|
|
msg-result "Enabling ICU support with flags: $ldflags $cflags"
|
2024-10-28 01:56:31 +01:00
|
|
|
if {[opt-bool icu-collations]} {
|
|
|
|
msg-result "Enabling ICU collations."
|
|
|
|
sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU_COLLATIONS
|
|
|
|
# Recall that shell.c builds with sqlite3.c
|
|
|
|
}
|
|
|
|
} elseif {[opt-bool icu-collations]} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags"
|
2024-10-28 01:56:31 +01:00
|
|
|
} else {
|
|
|
|
msg-result "ICU support is disabled."
|
|
|
|
}
|
|
|
|
}; # sqlite-check-icu
|
|
|
|
sqlite-check-icu
|
2024-10-27 08:06:03 +01:00
|
|
|
|
2024-10-29 21:27:36 +01:00
|
|
|
########################################################################
|
2024-11-15 17:35:24 +01:00
|
|
|
# Check for the Emscripten SDK for building the web-based wasm
|
|
|
|
# components.
|
|
|
|
apply {{} {
|
2024-10-29 21:27:36 +01:00
|
|
|
set emccsh $::srcdir/tool/emcc.sh
|
|
|
|
if {![get-define HAVE_WASI_SDK] && [proj-check-emsdk]} {
|
|
|
|
define EMCC_WRAPPER $emccsh
|
|
|
|
proj-make-from-dot-in $emccsh
|
|
|
|
catch {exec chmod u+x $emccsh}
|
|
|
|
} else {
|
|
|
|
define EMCC_WRAPPER ""
|
|
|
|
file delete -force $emccsh
|
|
|
|
}
|
2024-11-15 17:35:24 +01:00
|
|
|
}}
|
2024-10-29 21:27:36 +01:00
|
|
|
|
2024-10-09 07:28:29 +02:00
|
|
|
########################################################################
|
|
|
|
# Check for log(3) in libm and die with an error if it is not
|
2024-10-29 21:27:36 +01:00
|
|
|
# found. $featureName should be the feature name which requires that
|
|
|
|
# function (it's used only in error messages). defines LDFLAGS_MATH to
|
|
|
|
# the required linker flags (which may be empty even if the math APIs
|
|
|
|
# are found, depending on the OS).
|
|
|
|
proc affirm-have-math {featureName} {
|
2024-11-14 13:09:09 +01:00
|
|
|
if {"" eq [get-define LDFLAGS_MATH ""]} {
|
|
|
|
if {![msg-quiet proj-check-function-in-lib log m]} {
|
|
|
|
user-error "Missing math APIs for $featureName"
|
|
|
|
}
|
|
|
|
define LDFLAGS_MATH [get-define lib_log ""]
|
|
|
|
undefine lib_log
|
2024-09-25 16:58:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-25 16:38:46 +02:00
|
|
|
########################################################################
|
|
|
|
# Handle various SQLITE_ENABLE_... feature flags.
|
2024-10-27 23:18:33 +01:00
|
|
|
msg-result "Feature flags..."
|
2024-09-25 16:38:46 +02:00
|
|
|
foreach {boolFlag featureFlag ifSetEvalThis} {
|
2024-09-25 16:58:09 +02:00
|
|
|
all {} {
|
2024-11-15 17:35:24 +01:00
|
|
|
# The 'all' option must be first in this list.
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-opt-set fts4
|
|
|
|
proj-opt-set fts5
|
|
|
|
proj-opt-set geopoly
|
|
|
|
proj-opt-set rtree
|
|
|
|
proj-opt-set session
|
2024-09-25 16:58:09 +02:00
|
|
|
}
|
2024-10-09 07:28:29 +02:00
|
|
|
fts4 -DSQLITE_ENABLE_FTS4 {affirm-have-math fts4}
|
|
|
|
fts5 -DSQLITE_ENABLE_FTS5 {affirm-have-math fts5}
|
2024-10-28 15:16:50 +01:00
|
|
|
geopoly -DSQLITE_ENABLE_GEOPOLY {proj-opt-set rtree}
|
2024-09-25 16:38:46 +02:00
|
|
|
rtree -DSQLITE_ENABLE_RTREE {}
|
|
|
|
session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {}
|
|
|
|
update-limit -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT {}
|
2024-10-27 08:06:03 +01:00
|
|
|
memsys5 -DSQLITE_ENABLE_MEMSYS5 {}
|
2024-09-25 16:38:46 +02:00
|
|
|
memsys3 {} {
|
|
|
|
if {[opt-bool memsys5]} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-warn "not enabling memsys3 because memsys5 is enabled."
|
2024-10-27 08:06:03 +01:00
|
|
|
expr 0
|
2024-09-25 16:38:46 +02:00
|
|
|
} else {
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag -DSQLITE_ENABLE_MEMSYS3
|
2024-09-25 16:38:46 +02:00
|
|
|
}
|
|
|
|
}
|
2024-09-25 06:20:58 +02:00
|
|
|
} {
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-if-opt-truthy $boolFlag {
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag $featureFlag
|
2024-10-27 08:06:03 +01:00
|
|
|
if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} {
|
2024-10-27 23:34:07 +01:00
|
|
|
msg-result " + $boolFlag"
|
2024-10-09 07:28:29 +02:00
|
|
|
}
|
2024-09-27 14:15:14 +02:00
|
|
|
} {
|
2024-10-27 23:34:07 +01:00
|
|
|
if {"all" ne $boolFlag} {
|
|
|
|
msg-result " - $boolFlag"
|
|
|
|
}
|
2024-09-25 06:20:58 +02:00
|
|
|
}
|
2024-09-25 08:07:54 +02:00
|
|
|
}
|
|
|
|
|
2024-09-30 19:44:41 +02:00
|
|
|
########################################################################
|
2024-11-07 17:59:15 +01:00
|
|
|
# Invert the above loop's logic for some SQLITE_OMIT_... cases. If
|
|
|
|
# config option $boolFlag is false, [sqlite-add-feature-flag
|
2024-10-09 06:01:14 +02:00
|
|
|
# $featureFlag], where $featureFlag is intended to be
|
|
|
|
# -DSQLITE_OMIT_...
|
2024-09-30 19:44:41 +02:00
|
|
|
foreach {boolFlag featureFlag} {
|
|
|
|
json -DSQLITE_OMIT_JSON
|
|
|
|
} {
|
2024-10-28 15:16:50 +01:00
|
|
|
if {[proj-opt-truthy $boolFlag]} {
|
2024-10-27 23:34:07 +01:00
|
|
|
msg-result " + $boolFlag"
|
2024-09-30 19:44:41 +02:00
|
|
|
} else {
|
2024-10-27 23:18:33 +01:00
|
|
|
sqlite-add-feature-flag $featureFlag
|
2024-10-27 23:34:07 +01:00
|
|
|
msg-result " - $boolFlag"
|
2024-09-30 19:44:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-27 08:06:03 +01:00
|
|
|
#########################################################################
|
|
|
|
# Show the final feature flag sets:
|
2024-11-15 17:35:24 +01:00
|
|
|
apply {{} {
|
2024-11-07 17:59:15 +01:00
|
|
|
set oFF [get-define OPT_FEATURE_FLAGS]
|
|
|
|
if {"" ne $oFF} {
|
|
|
|
define OPT_FEATURE_FLAGS [lsort -unique $oFF]
|
|
|
|
msg-result "Library feature flags: [get-define OPT_FEATURE_FLAGS]"
|
|
|
|
}
|
|
|
|
set oFF [get-define OPT_SHELL]
|
|
|
|
if {"" ne $oFF} {
|
|
|
|
define OPT_SHELL [lsort -unique $oFF]
|
|
|
|
msg-result "Shell options: [get-define OPT_SHELL]"
|
|
|
|
}
|
|
|
|
unset oFF
|
2024-11-15 17:35:24 +01:00
|
|
|
}}
|
2024-10-27 08:06:03 +01:00
|
|
|
|
2024-11-05 09:21:47 +01:00
|
|
|
########################################################################
|
|
|
|
# "Re-export" the autoconf-conventional --XYZdir flags into something
|
|
|
|
# which is more easily overridable from a make invocation. See the docs
|
2024-11-05 10:49:53 +01:00
|
|
|
# for [proj-remap-autoconf-dir-vars] for the explanation of why.
|
2024-11-05 09:21:47 +01:00
|
|
|
#
|
|
|
|
# We do this late in the config process, immediately before we export
|
|
|
|
# the Makefile and other generated files, so that configure tests
|
|
|
|
# which may make use of the autotools-conventional flags
|
|
|
|
# (e.g. [proj-check-rpath]) may do so before we "mangle" them here.
|
2024-11-05 10:49:53 +01:00
|
|
|
proj-remap-autoconf-dir-vars
|
2024-11-05 09:21:47 +01:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 16:38:46 +02:00
|
|
|
# Generate the output files.
|
|
|
|
#
|
2024-10-26 20:17:17 +02:00
|
|
|
# Potential TODO (unclear): in sqlite3.pc.in, do we need to include
|
|
|
|
# any CFLAGS_READLINE, CFLAGS_ZLIB, etc in its "Cflags:" section?
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-make-from-dot-in -touch Makefile sqlite3.pc
|
2024-11-15 17:35:24 +01:00
|
|
|
make-config-header sqlite_cfg.h \
|
|
|
|
-bare {SIZEOF_* HAVE_DECL_*} \
|
|
|
|
-none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG
|
|
|
|
TARGET_* USE_GCOV TCL_*} \
|
|
|
|
-auto {HAVE_* PACKAGE_*} \
|
|
|
|
-none *
|
|
|
|
proj-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTORECONFIG@
|
2024-10-25 05:18:11 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
|
|
|
# Some build-dev/debug-only output
|
2024-10-28 15:16:50 +01:00
|
|
|
proj-if-opt-truthy dump-defines {
|
2024-10-27 23:18:33 +01:00
|
|
|
make-config-header $::DUMP_DEFINES_TXT \
|
2024-09-30 16:33:36 +02:00
|
|
|
-bare {SQLITE_OS* SQLITE_DEBUG USE_*} \
|
|
|
|
-str {BIN_* CC LD AR LDFLAG* OPT_*} \
|
2024-09-25 16:58:09 +02:00
|
|
|
-auto {*}
|
2024-09-25 10:04:14 +02:00
|
|
|
# achtung: ^^^^ whichever SQLITE_OS_foo flag which is set to 0 will
|
|
|
|
# get _undefined_ here unless it's part of the -bare set.
|
2024-11-05 09:21:47 +01:00
|
|
|
if {"" ne $DUMP_DEFINES_JSON} {
|
|
|
|
msg-result "--dump-defines is creating $::DUMP_DEFINES_JSON"
|
|
|
|
########################################################################
|
|
|
|
# Dump config-defines.json...
|
|
|
|
# Demonstrate (mis?)handling of spaces in JSON-export array values:
|
|
|
|
# define-append OPT_FOO.list {"-DFOO=bar baz" -DBAR="baz barre"}
|
|
|
|
define OPT_FEATURE_FLAGS.list [get-define OPT_FEATURE_FLAGS]
|
|
|
|
define OPT_SHELL.list [get-define OPT_SHELL]
|
|
|
|
set dumpDefsOpt {
|
|
|
|
-bare {SIZEOF_* HAVE_DECL_*}
|
|
|
|
-none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTORECONFIG TARGET_* USE_GCOV TCL_*}
|
|
|
|
-array {*.list}
|
|
|
|
-auto {OPT_* PACKAGE_* HAVE_*}
|
|
|
|
}
|
|
|
|
if {[opt-bool defines-json-include-lowercase]} {
|
|
|
|
lappend dumpDefsOpt -none {lib_*} ; # remnants from proj-check-function-in-lib and friends
|
|
|
|
lappend dumpDefsOpt -auto {[a-z]*}
|
|
|
|
}
|
|
|
|
lappend dumpDefsOpt -none *
|
|
|
|
proj-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt
|
|
|
|
undefine OPT_FEATURE_FLAGS.list
|
|
|
|
undefine OPT_SHELL.list
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|