2024-10-21 18:06:49 +02:00
|
|
|
#/usr/bin/tclsh
|
|
|
|
# ^^^ 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-10-23 03:18:16 +02:00
|
|
|
use cc cc-db cc-shared cc-lib hwaci-common pkg-config
|
2024-10-26 01:03:33 +02:00
|
|
|
|
|
|
|
# Are we cross-compiling?
|
2024-10-27 05:27:47 +01:00
|
|
|
set cross_compiling [hwaci-is-cross-compiling]
|
|
|
|
if {0
|
|
|
|
&& !$cross_compiling
|
|
|
|
&& "nope" eq [get-env CC_FOR_BUILD "nope"]
|
|
|
|
&& [get-define CC] ne [get-define CC_FOR_BUILD]} {
|
2024-10-26 01:03:33 +02:00
|
|
|
# Arguable/debatable...
|
|
|
|
#
|
|
|
|
# When _not_ cross-compiling and CC_FOR_BUILD is _not_ explcitely
|
|
|
|
# specified, force CC_FOR_BUILD to be the same as CC, so that:
|
|
|
|
#
|
|
|
|
# ./configure CC=clang
|
|
|
|
#
|
|
|
|
# will use CC_FOR_BUILD=clang, instead of cc, for building in-tree
|
|
|
|
# tools. This is based off of an email discussion and is thought to
|
|
|
|
# be likely to cause less confusion than seeing 'cc' invocations
|
|
|
|
# will when the user passes CC=clang.
|
|
|
|
#
|
|
|
|
# Sidebar: if we do this before the cc package is installed, it gets
|
|
|
|
# reverted by that package. Ergo, the cc package init will tell the
|
|
|
|
# user "Build C compiler...cc" shortly before we tell them:
|
|
|
|
msg-result "Re-defining CC_FOR_BUILD to CC=[get-define CC]. To avoid this, explicitly pass CC_FOR_BUILD=..."
|
|
|
|
define CC_FOR_BUILD [get-define CC]
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
# autotools builds (but not in the canonical tree). This is used by at
|
|
|
|
# least one high-profile client to extract build config info for use
|
|
|
|
# in compiling a scripting-language binding, so its name should not be
|
|
|
|
# arbitrarily changed.
|
2024-10-26 05:05:20 +02:00
|
|
|
#
|
|
|
|
# 2024-10-26: 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.
|
|
|
|
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
|
|
|
|
# result in an "unrecognized option" error, despite the the options
|
|
|
|
# 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
|
|
|
|
# them in the 'options' invocation. e.g. "with-tcl" is the --with-tcl
|
|
|
|
# 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:
|
|
|
|
# - [hwaci-opt-truthy FLAG]
|
|
|
|
# - [hwaci-opt-if-truthy FLAG {THEN} {ELSE}]
|
|
|
|
#
|
|
|
|
# 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-09-25 16:38:46 +02:00
|
|
|
with-debug:=1 => {Enable debug build flags}
|
2024-10-09 06:01:14 +02:00
|
|
|
with-tclsh:PATH => {Full pathname of tclsh to use}
|
|
|
|
with-tcl:DIR => {Directory containing tclConfig.sh}
|
2024-10-23 03:59:34 +02:00
|
|
|
tcl=1 => {Disable components which require TCL-dev}
|
2024-09-25 08:07:54 +02:00
|
|
|
test-status => {Enable status of tests}
|
|
|
|
threadsafe=1 => {Disable mutexing}
|
2024-10-25 15:56:13 +02:00
|
|
|
with-tempstore:=no => {Use an in-ram database for temporary tables: never,no,yes,always}
|
2024-09-25 08:07:54 +02:00
|
|
|
editline=0 => {BSD editline support}
|
2024-09-27 15:29:50 +02:00
|
|
|
readline=1 => {Disable readline support}
|
2024-09-25 20:03:26 +02:00
|
|
|
largefile=1 => {Disable large file support}
|
2024-10-26 18:03:04 +02:00
|
|
|
shared=1 => {Disable build of shared libary}
|
2024-10-27 03:27:07 +01:00
|
|
|
with-readline-lib:LDFLAGS
|
|
|
|
=> {Readline LDFLAGS, e.g. -lreadline -lncurses}
|
|
|
|
with-readline-inc:CFLAGS
|
|
|
|
=> {Readline CFLAGS, e.g. -I/path/to/includes}
|
|
|
|
with-readline-header:PATH
|
2024-10-27 05:27:47 +01:00
|
|
|
=> {Full path to readline.h, from which --with-readline-inc will be derived}
|
2024-10-26 23:51:04 +02:00
|
|
|
with-linenoise:DIR => {Source directory for linenoise.c and linenoise.h}
|
2024-10-27 08:06:03 +01:00
|
|
|
with-icu-lib:LDFLAGS => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries}
|
|
|
|
icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-lib=...}
|
2024-09-25 08:07:54 +02:00
|
|
|
amalgamation=1 => {Disable the amalgamation and instead build all files separately}
|
|
|
|
load-extension=1 => {Disable loading of external extensions}
|
|
|
|
math=1 => {Disable math functions}
|
|
|
|
json=1 => {Disable JSON functions}
|
|
|
|
all => {Enable FTS4, FTS5, Geopoly, RTree, Sessions}
|
|
|
|
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-09-25 16:38:46 +02:00
|
|
|
gcov=0 => {Enable coverage testing using gcov}
|
2024-09-25 08:07:54 +02:00
|
|
|
linemacros => {Enable #line macros in the amalgamation.}
|
|
|
|
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-09-25 16:38:46 +02:00
|
|
|
with-emsdk:DIR => {Top-most dir of the Emscripten SDK installation}
|
2024-10-25 15:56:13 +02:00
|
|
|
dump-defines=0 => {Dump autosetup defines to $DUMP_DEFINES_TXT (for build debugging)}
|
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}
|
|
|
|
}
|
|
|
|
options [subst $flags]
|
|
|
|
unset flags
|
2024-09-24 23:08:49 +02:00
|
|
|
|
2024-10-21 18:06:49 +02:00
|
|
|
set srcdir $::autosetup(srcdir)
|
2024-09-27 03:00:32 +02:00
|
|
|
set top_srcdir [get-define abs_top_srcdir]
|
2024-10-27 08:06:03 +01:00
|
|
|
set PACKAGE_VERSION [readfile $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-09-25 03:39:39 +02:00
|
|
|
|
2024-10-27 08:06:03 +01:00
|
|
|
msg-result "srcdir = $srcdir"
|
|
|
|
msg-result "top_srcdir = $top_srcdir"
|
|
|
|
msg-result "VERSION = $PACKAGE_VERSION"
|
|
|
|
|
|
|
|
define-append SQLITE_AUTOREMAKE cd '$srcdir' && '$top_srcdir/configure'
|
|
|
|
#{*}$::autosetup(argv) breaks with --flag='val with spaces', so...
|
|
|
|
foreach arg $::autosetup(argv) {
|
|
|
|
define-append SQLITE_AUTOREMAKE '$arg'
|
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
set outOfTreeBuild 0
|
|
|
|
if {![file exists sqlite3.pc.in]} {
|
2024-10-23 03:18:16 +02:00
|
|
|
msg-result "This appears to be an out-of-tree build."
|
2024-09-26 00:13:49 +02:00
|
|
|
set outOfTreeBuild 1
|
|
|
|
}
|
|
|
|
|
2024-09-26 14:16:46 +02:00
|
|
|
cc-check-tools ld ar
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
2024-09-25 03:39:39 +02:00
|
|
|
# The build process allows for using a cross-compiler. But the default
|
|
|
|
# action is to target the same platform that we are running on. The
|
|
|
|
# configure script needs to discover the following properties of the
|
|
|
|
# build and target systems:
|
|
|
|
#
|
|
|
|
# srcdir
|
|
|
|
#
|
|
|
|
# The is the name of the directory that contains the
|
|
|
|
# "configure" shell script. All source files are
|
|
|
|
# located relative to this directory.
|
|
|
|
#
|
|
|
|
# bindir
|
|
|
|
#
|
|
|
|
# The name of the directory where executables should be
|
|
|
|
# written by the "install" target of the makefile.
|
|
|
|
#
|
|
|
|
# program_prefix
|
|
|
|
#
|
|
|
|
# Add this prefix to the names of all executables that run
|
|
|
|
# on the target machine. Default: ""
|
|
|
|
#
|
|
|
|
# ENABLE_SHARED
|
|
|
|
#
|
|
|
|
# True if shared libraries should be generated.
|
|
|
|
#
|
|
|
|
# BUILD_CC
|
|
|
|
#
|
|
|
|
# The name of a command that is used to convert C
|
|
|
|
# source files into executables that run on the build
|
|
|
|
# platform.
|
|
|
|
#
|
|
|
|
# BUILD_CFLAGS
|
|
|
|
#
|
|
|
|
# Switches that the build compiler needs in order to construct
|
|
|
|
# command-line programs.
|
|
|
|
#
|
|
|
|
# BUILD_LIBS
|
|
|
|
#
|
|
|
|
# Libraries that the build compiler needs in order to construct
|
|
|
|
# command-line programs.
|
|
|
|
#
|
|
|
|
# TCL_*
|
|
|
|
#
|
|
|
|
# Lots of values are read in from the tclConfig.sh script,
|
|
|
|
# if that script is available. This values are used for
|
|
|
|
# constructing and installing the TCL extension.
|
|
|
|
#
|
|
|
|
# TARGET_READLINE_LIBS
|
|
|
|
#
|
|
|
|
# This is the library directives passed to the target linker
|
|
|
|
# that cause the executable to link against the readline library.
|
|
|
|
# This might be a switch like "-lreadline" or pathnames of library
|
|
|
|
# file like "../../src/libreadline.a".
|
|
|
|
#
|
|
|
|
# TARGET_READLINE_INC
|
|
|
|
#
|
|
|
|
# This variables define the directory that contain header
|
|
|
|
# files for the readline library. If the compiler is able
|
|
|
|
# to find <readline.h> on its own, then this can be blank.
|
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
#
|
2024-09-25 05:37:34 +02:00
|
|
|
# OPT_FEATURE_FLAGS = -DSQLITE_OMIT/ENABLE flags.
|
|
|
|
define OPT_FEATURE_FLAGS {}
|
2024-09-27 15:29:50 +02:00
|
|
|
define OPT_SHELL {}; # CFLAGS for the sqlite3 CLI app
|
2024-10-20 04:47:56 +02:00
|
|
|
|
|
|
|
# Adds $args, if not empty, to OPT_FEATURE_FLAGS.
|
2024-09-27 15:29:50 +02:00
|
|
|
proc add-feature-flag {args} {
|
|
|
|
if {"" ne $args} {
|
|
|
|
define-append OPT_FEATURE_FLAGS {*}$args
|
2024-09-25 16:38:46 +02:00
|
|
|
}
|
2024-09-25 05:37:34 +02:00
|
|
|
}
|
|
|
|
# add-feature-flag -DSQLITE_JUST_TESTING=3
|
2024-10-20 04:47:56 +02:00
|
|
|
|
|
|
|
# Adds $args, if not empty, to OPT_SHELL.
|
2024-09-27 15:29:50 +02:00
|
|
|
proc add-shell-opt {args} {
|
|
|
|
if {"" ne $args} {
|
|
|
|
define-append OPT_SHELL {*}$args
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 07:28:29 +02:00
|
|
|
hwaci-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
|
|
|
|
# todo? add -DSQLITE_OS_WIN=1 to CFLAGS?
|
|
|
|
} else {
|
|
|
|
define SQLITE_OS_UNIX 1
|
|
|
|
define SQLITE_OS_WIN 0
|
|
|
|
# todo? add -DSQLITE_OS_UNIX=1 to CFLAGS?
|
|
|
|
}
|
|
|
|
|
2024-09-25 03:39:39 +02:00
|
|
|
#########
|
|
|
|
# Programs needed
|
2024-09-25 10:04:14 +02:00
|
|
|
if {"" eq [hwaci-bin-define install]} {
|
2024-10-22 05:12:11 +02:00
|
|
|
hwaci-warn "Cannot find install binary, so 'make install' will not work."
|
2024-10-19 18:58:17 +02:00
|
|
|
# Reminder: we historically have ./install-sh in the source tree.
|
|
|
|
# Can we not simply use that?
|
2024-10-19 20:31:47 +02:00
|
|
|
#
|
2024-10-19 18:58:17 +02:00
|
|
|
# define BIN_INSTALL "$top_srcdir/install-sh"
|
2024-10-19 20:31:47 +02:00
|
|
|
#
|
|
|
|
# Nope: it MOVES its source files over the target, which breaks the
|
2024-10-20 04:47:56 +02:00
|
|
|
# installation in some cases, e.g. when libtclsqlite3.so is built in
|
|
|
|
# response to 'make install' and libsqlite3.a is moved before
|
|
|
|
# libtclsqlite3.so is linked. It's easy to hack to use cp instead
|
|
|
|
# of mv (simply replace the instcmd=... bit) but that won't retain
|
|
|
|
# the source timestamp and permissions unless we use cp's -p flag,
|
|
|
|
# which may not be portable enough.
|
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
|
|
|
|
# which are to run on the build system (BUILD_CC, a.k.a. BCC) and the
|
|
|
|
# one used for compiling binaries for the target system (CC,
|
|
|
|
# a.k.a. TCC). Normally they're the same, but they will differ when
|
|
|
|
# cross-compiling.
|
2024-09-26 14:16:46 +02:00
|
|
|
define BUILD_CC [get-define CC_FOR_BUILD]
|
2024-10-26 01:04:50 +02:00
|
|
|
define BUILD_CFLAGS [get-env BUILD_CFLAGS {-g}]
|
2024-10-26 18:03:04 +02:00
|
|
|
define ENABLE_SHARED [opt-bool shared]
|
2024-10-23 04:11:52 +02:00
|
|
|
define HAVE_TCL 0
|
2024-09-26 14:16:46 +02:00
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-25 05:37:34 +02:00
|
|
|
# Handle --with-wasi-sdk=DIR
|
|
|
|
#
|
2024-10-23 04:11:52 +02:00
|
|
|
# This must be early because it may change the toolchain and disable
|
|
|
|
# several config options.
|
|
|
|
proc hwaci-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
|
2024-09-25 10:04:14 +02:00
|
|
|
#puts "x wasiSdkDir=$wasiSdkDir foo=[lindex [opt-val with-wasi-sdk] end]"
|
2024-10-23 04:11:52 +02:00
|
|
|
if {$wasiSdkDir eq ""} {
|
|
|
|
return 0
|
|
|
|
} elseif {$::cross_compiling} {
|
|
|
|
hwaci-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}]"
|
|
|
|
hwaci-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}]
|
|
|
|
msg-result "Using wasi-sdk clang, disabling: tcl, CLI shell, DLL, loadable extensions, threading"
|
|
|
|
define HAVE_WASI_SDK 1
|
|
|
|
define WASI_SDK_DIR $wasiSdkDir
|
|
|
|
hwaci-opt-set load-extension 0; # ==> --disable-load-extension
|
|
|
|
hwaci-opt-set threadsafe 0; # ==> --threadsafe=0
|
|
|
|
hwaci-opt-set tcl 0; # ==> --disable-tcl
|
|
|
|
define HAVE_TCL 0
|
|
|
|
set cross_compiling 1
|
|
|
|
define ENABLE_SHARED 0
|
|
|
|
|
|
|
|
# Changing --host and --target have no effect here except to possibly
|
|
|
|
# cause confusion. autoconf has finished processing them by this
|
|
|
|
# point.
|
|
|
|
#
|
|
|
|
# host_alias=wasm32-wasi
|
|
|
|
# target=wasm32-wasi
|
|
|
|
#
|
|
|
|
# Merely changing CC and LD to the wasi-sdk's is enough to get
|
|
|
|
# sqlite3.o building in WASM format.
|
|
|
|
# XXX CC="${wasiSdkDir}/bin/clang"
|
|
|
|
# XXX LD="${wasiSdkDir}/bin/wasm-ld"
|
|
|
|
# XXX RANLIB="${wasiSdkDir}/bin/llvm-ranlib"
|
|
|
|
define CC "${wasiSdkDir}/bin/clang"
|
|
|
|
define LD "${wasiSdkDir}/bin/wasm-ld"
|
|
|
|
#define STRIP "${wasiSdkDir}/bin/strip"
|
|
|
|
return 1
|
|
|
|
}; # hwaci-check-wasi-sdk
|
|
|
|
hwaci-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-09-30 19:44:41 +02:00
|
|
|
hwaci-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-09 06:01:14 +02:00
|
|
|
# These are optional for JimTCL but necessary if we want to use it for
|
|
|
|
# code generation:
|
2024-09-27 05:04:16 +02:00
|
|
|
cc-check-includes dirent.h sys/time.h
|
|
|
|
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[cc-check-includes zlib.h] && [hwaci-check-function-in-lib deflate z]} {
|
2024-09-26 00:13:49 +02:00
|
|
|
# TODO: port over the more sophisticated zlib search from the fossil auto.def
|
2024-09-25 20:03:26 +02:00
|
|
|
define HAVE_ZLIB 1; # "-DSQLITE_HAVE_ZLIB=1"
|
|
|
|
define LDFLAGS_ZLIB -lz
|
2024-10-24 09:31:39 +02:00
|
|
|
# Note that -DSQLITE_HAVE_ZLIB=1 is handled separately from the
|
|
|
|
# other feature flags in the autotools build. Do we need to emulate
|
|
|
|
# that?
|
|
|
|
add-shell-opt -DSQLITE_HAVE_ZLIB=1
|
2024-09-25 20:03:26 +02:00
|
|
|
} else {
|
|
|
|
define HAVE_ZLIB 0
|
|
|
|
define LDFLAGS_ZLIB ""
|
|
|
|
}
|
|
|
|
|
2024-10-27 08:06:03 +01:00
|
|
|
#
|
|
|
|
# Determine proper rpath-handling flags.
|
|
|
|
#
|
|
|
|
hwaci-check-rpath
|
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
hwaci-define-if-opt-truthy amalgamation USE_AMALGAMATION \
|
|
|
|
"Use amalgamation for builds?"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-25 20:03:26 +02:00
|
|
|
hwaci-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
hwaci-define-if-opt-truthy test-status TSTRNNR_OPTS \
|
|
|
|
"test-runner flags:" {--status} {}
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 00:13:49 +02:00
|
|
|
hwaci-define-if-opt-truthy 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-09-26 10:25:10 +02:00
|
|
|
msg-checking "Debug build? "
|
2024-09-27 15:29:50 +02:00
|
|
|
|
2024-09-26 10:25:10 +02:00
|
|
|
hwaci-if-opt-truthy with-debug {
|
|
|
|
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-19 22:53:46 +02:00
|
|
|
# - TCLLIB_RPATH = the -rpath flag specific to libtclsqlite3, which
|
|
|
|
# will usually differ from the rpath used by the rest of the lib.
|
2024-10-09 09:12:32 +02:00
|
|
|
#
|
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-09-27 04:35:41 +02:00
|
|
|
define TCLSH_CMD {exit 1}
|
2024-10-27 06:28:52 +01:00
|
|
|
proc sqlite-check-tcl {} {
|
2024-10-23 04:11:52 +02:00
|
|
|
# TODO: document the steps this is taking.
|
2024-10-09 06:01:14 +02:00
|
|
|
global top_srcdir
|
|
|
|
puts "Checking for a suitable tcl... "
|
|
|
|
set optTcl [hwaci-opt-truthy tcl]
|
|
|
|
set use_tcl $optTcl
|
2024-09-27 03:00:32 +02:00
|
|
|
set with_tclsh [opt-val with-tclsh]
|
|
|
|
set with_tcl [opt-val with-tcl]
|
2024-10-27 06:28:52 +01:00
|
|
|
#puts "sqlite-check-tcl: use_tcl ${use_tcl}"
|
|
|
|
#puts "sqlite-check-tcl: with_tclsh=${with_tclsh}"
|
|
|
|
#puts "sqlite-check-tcl: with_tcl=$with_tcl"
|
2024-09-27 03:00:32 +02:00
|
|
|
if {"" eq $with_tclsh && "" eq $with_tcl} {
|
2024-10-16 16:04:00 +02:00
|
|
|
set with_tclsh [hwaci-first-bin-of tclsh9.0 tclsh8.6 tclsh]
|
2024-09-27 03:00:32 +02:00
|
|
|
}
|
2024-10-27 06:28:52 +01:00
|
|
|
#puts "sqlite-check-tcl: with_tclsh=${with_tclsh}"
|
2024-09-27 03:00:32 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
if {"" ne $with_tclsh} {
|
|
|
|
if {![file isfile $with_tclsh]} {
|
2024-10-22 05:12:11 +02:00
|
|
|
hwaci-fatal "TCL shell $with_tclsh is not a file"
|
|
|
|
} elseif {![file-isexec $with_tclsh]} {
|
|
|
|
hwaci-fatal "TCL shell $with_tclsh is not executable"
|
2024-10-09 06:01:14 +02:00
|
|
|
} else {
|
|
|
|
define TCLSH_CMD $with_tclsh
|
2024-10-23 03:18:16 +02:00
|
|
|
msg-result "Using tclsh: $with_tclsh"
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
if {$use_tcl} {
|
2024-10-09 06:01:14 +02:00
|
|
|
if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
|
|
|
|
set with_tcl $result
|
|
|
|
}
|
|
|
|
if {"" ne $with_tcl && [file isdir $with_tcl]} {
|
2024-10-23 03:18:16 +02:00
|
|
|
msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
|
2024-10-09 06:01:14 +02:00
|
|
|
} else {
|
2024-10-23 03:18:16 +02:00
|
|
|
hwaci-warn "$with_tclsh is unable to recommand a tclConfig.sh"
|
2024-10-09 06:01:14 +02: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-10-23 03:59:34 +02:00
|
|
|
while {1} {
|
|
|
|
if {$use_tcl} {
|
|
|
|
if {"" ne $with_tcl} {
|
|
|
|
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-10-23 03:59:34 +02:00
|
|
|
if {"" eq $cfg} {
|
|
|
|
hwaci-fatal "No tclConfig.sh found under ${with_tcl}"
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
} else {
|
2024-10-23 03:59:34 +02:00
|
|
|
# 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"
|
|
|
|
} else {
|
|
|
|
foreach i $tclSubdirs {
|
|
|
|
if {[file readable "${libdir}/$i/tclConfig.sh"]} {
|
|
|
|
set cfg "${libdir}/$i/tclConfig.sh"
|
|
|
|
break
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
|
|
|
}
|
2024-10-23 03:59:34 +02:00
|
|
|
if {![file readable $cfg]} {
|
2024-10-27 06:28:52 +01:00
|
|
|
hwaci-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 TCL
|
|
|
|
is required for testing.
|
2024-10-23 03:59:34 +02:00
|
|
|
}
|
|
|
|
break
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
|
|
|
}
|
2024-10-23 03:59:34 +02:00
|
|
|
msg-result "Using tclConfig.sh: $cfg"
|
|
|
|
} elseif {!$optTcl} {
|
|
|
|
hwaci-warn "Unable to run tests because of --disable-tcl"
|
|
|
|
} else {
|
|
|
|
hwaci-warn "Unable to run tests because no tclConfig.sh file could be located"
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-10-23 03:59:34 +02:00
|
|
|
break
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-09-27 03:00:32 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
define TCL_CONFIG_SH $cfg
|
2024-10-09 07:28:29 +02:00
|
|
|
# The historical configure.ac sources tclConfig.sh so that it can
|
|
|
|
# use the several TCL_... env vars. We obviously cannot do that from
|
2024-10-21 18:06:49 +02:00
|
|
|
# TCL, so we apply a level of indirection which sources that script
|
|
|
|
# then emits the pieces we're interested in as TCL code. If the
|
|
|
|
# config is not available, this emits empty-string entries for the
|
|
|
|
# various options we're interested in.
|
2024-10-09 07:28:29 +02:00
|
|
|
eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "[get-define TCL_CONFIG_SH]"]
|
2024-10-16 16:04:00 +02:00
|
|
|
|
|
|
|
if {"" eq $with_tclsh} {
|
|
|
|
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-23 03:59:34 +02:00
|
|
|
hwaci-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-09 09:12:32 +02:00
|
|
|
|
|
|
|
if {$use_tcl} {
|
|
|
|
# Set up the TCLLIBDIR and TCLLIB_RPATH
|
2024-10-21 21:51:32 +02:00
|
|
|
set tcllibdir [get-env TCLLIBDIR ""]
|
2024-10-09 09:12:32 +02:00
|
|
|
if {"" eq $tcllibdir} {
|
|
|
|
if {[catch {exec echo "puts stdout \$auto_path" | "$with_tclsh"} result] == 0} {
|
|
|
|
foreach i $result {
|
|
|
|
if {[file isdir $i]} {
|
|
|
|
set tcllibdir $i
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
hwaci-warn "Cannot determine TCLLIBDIR"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
set tclrpath ""
|
|
|
|
if {"" ne $tcllibdir} {
|
|
|
|
set tcllibdir "${tcllibdir}/sqlite3"
|
|
|
|
set rp [get-define SH_LINKRPATH]
|
|
|
|
set tclrpath [string map [list "%s" $tcllibdir] $rp]
|
2024-10-16 16:04:00 +02:00
|
|
|
# Reminder: tclConfig.sh has TCL_LD_SEARCH_FLAGS to set the
|
|
|
|
# rpath but (A) it includes an unexpand var ref to
|
2024-10-21 21:51:32 +02:00
|
|
|
# ${LIB_RUNTIME_DIR}, which must be set in the makefile and (B)
|
2024-10-16 16:04:00 +02:00
|
|
|
# that flag is inherently compiler-dependent so it's not as
|
|
|
|
# portable as tclConfig.sh assumes. We'll instead use the rpath
|
|
|
|
# flag which autosetup determines for the current compiler.
|
2024-10-09 09:12:32 +02:00
|
|
|
}
|
|
|
|
define TCLLIBDIR $tcllibdir
|
|
|
|
define TCLLIB_RPATH $tclrpath
|
2024-10-22 05:12:11 +02:00
|
|
|
#hwaci-fatal "TCLLIB_RPATH = [get-define TCLLIB_RPATH]"
|
2024-10-16 16:04:00 +02:00
|
|
|
} else {
|
|
|
|
define TCLLIBDIR ""
|
|
|
|
define TCLLIB_RPATH ""
|
|
|
|
}
|
|
|
|
|
2024-10-23 03:59:34 +02:00
|
|
|
if {[file exists $with_tclsh]} {
|
2024-10-23 03:18:16 +02:00
|
|
|
msg-result "Using tclsh: $with_tclsh"
|
2024-10-23 03:59:34 +02:00
|
|
|
define HAVE_TCL 1
|
|
|
|
} else {
|
|
|
|
hwaci-warn "Cannot find a usable tclsh, so cannot run tests."
|
2024-10-09 09:12:32 +02:00
|
|
|
}
|
2024-10-27 06:28:52 +01:00
|
|
|
}; # sqlite-check-tcl
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-27 06:28:52 +01:00
|
|
|
sqlite-check-tcl
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
|
|
|
# Check which TCL to use as a code generator. Prefer jimsh simply
|
|
|
|
# because we have it in-tree (it's part of autosetup).
|
2024-10-21 18:06:49 +02:00
|
|
|
#
|
|
|
|
# Building jimsh0.c with -DJIM_COMPAT changes certain behavior to be
|
|
|
|
# compatible with canonical TCL. Specifically: jim's [expr] only
|
2024-10-23 18:59:12 +02:00
|
|
|
# accepts one arg unless JIM_COMPAT is defined. As of 2024-10-23,
|
|
|
|
# jimsh0.c defines JIM_COMPAT automatically (prior to that it intended
|
|
|
|
# to but a typo of JIM_TCL_COMPAT made it a no-op).
|
|
|
|
define CFLAGS_JIMSH {}
|
2024-10-23 03:18:16 +02:00
|
|
|
msg-result "Which TCL to use for code generation... "
|
2024-10-26 01:13:12 +02:00
|
|
|
set cgtcl [opt-val with-tclsh jimsh]
|
|
|
|
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-18 00:19:37 +02:00
|
|
|
define BTCLSH "\$(TCLSH_CMD)"
|
2024-10-09 06:01:14 +02:00
|
|
|
} else {
|
2024-10-26 01:13:12 +02:00
|
|
|
if {[cc-check-functions realpath]} {
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_REALPATH
|
|
|
|
define BTCLSH "\$(JIMSH)"
|
|
|
|
} elseif {[cc-check-functions _fullpath]} {
|
|
|
|
# _fullpath() is a Windows API
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE__FULLPATH
|
|
|
|
define BTCLSH "\$(JIMSH)"
|
|
|
|
} elseif {[file exists [get-define TCLSH_CMD]]} {
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
unset tv
|
2024-10-09 06:27:03 +02:00
|
|
|
}
|
2024-10-26 01:13:12 +02:00
|
|
|
unset tpre
|
2024-10-09 06:27:03 +02:00
|
|
|
}
|
2024-10-26 01:13:12 +02:00
|
|
|
set cgtcl [get-define TCLSH_CMD]
|
|
|
|
if {![file exists $cgtcl]} {
|
|
|
|
hwaci-fatal "Cannot find a tclsh to use for code generation."
|
|
|
|
}
|
|
|
|
define BTCLSH "\$(TCLSH_CMD)"
|
2024-10-23 03:59:34 +02:00
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
}
|
2024-10-19 22:53:46 +02:00
|
|
|
msg-result "TCL for code generation: $cgtcl"
|
2024-10-09 06:27:03 +02:00
|
|
|
unset cgtcl
|
2024-10-23 18:46:46 +02:00
|
|
|
#define CFLAGS_JIMSH {-DJUST_TESTING}
|
2024-10-09 09:12:32 +02:00
|
|
|
|
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-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy threadsafe {
|
|
|
|
msg-result yes
|
|
|
|
add-feature-flag -DSQLITE_THREADSAFE=1
|
2024-09-30 19:44:41 +02:00
|
|
|
if {![hwaci-check-function-in-lib pthread_create pthread]
|
|
|
|
|| ![hwaci-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
|
|
|
|
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-09-25 09:30:54 +02:00
|
|
|
if {1} {
|
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
|
|
|
|
msg-checking "Use an in-ram database for temporary tables? "
|
|
|
|
switch -- $ts {
|
|
|
|
never { set tsn 0 }
|
|
|
|
no { set tsn 1 }
|
|
|
|
yes { set tsn 2 }
|
|
|
|
always { set tsn 3 }
|
|
|
|
default {
|
2024-09-25 16:38:46 +02: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
|
|
|
|
unset ts tsn
|
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
|
|
|
|
# - HAVE_LINENOISE to 0 or 1
|
|
|
|
# - HAVE_EDITLINE to 0 or 1
|
2024-10-26 20:17:17 +02:00
|
|
|
#
|
2024-10-27 06:28:52 +01:00
|
|
|
# Only one of ^^^ those will be set to 1.
|
|
|
|
#
|
2024-10-26 23:51:04 +02:00
|
|
|
# - LDFLAGS_READLINE = linker flags or empty string
|
|
|
|
#
|
|
|
|
# - 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
|
|
|
|
# linenoise or editline, not necessarily libreadline.
|
|
|
|
#
|
|
|
|
# Returns a string describing which line-editing approach to use, or
|
|
|
|
# "none" if no option is available.
|
2024-10-27 05:27:47 +01:00
|
|
|
proc sqlite-check-line-editing {} {
|
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-10-26 23:51:04 +02:00
|
|
|
set check [opt-val with-linenoise]
|
|
|
|
if {"" ne $check} {
|
|
|
|
# Use linenoise...
|
|
|
|
set dirLn $check
|
|
|
|
if {![file isdir $dirLn]} {
|
|
|
|
hwaci-fatal "--with-linenoise value is not a directory"
|
2024-10-27 05:27:47 +01:00
|
|
|
} elseif {![file exists $dirLn/linenoise.c] } {
|
2024-10-26 23:51:04 +02:00
|
|
|
hwaci-fatal "Cannot find linenoise.c in $dirLn"
|
2024-10-27 05:27:47 +01:00
|
|
|
} elseif {![file exists $dirLn/linenoise.h] } {
|
2024-10-26 23:51:04 +02:00
|
|
|
hwaci-fatal "Cannot find linenoise.h in $dirLn"
|
|
|
|
}
|
|
|
|
user-notice "Using linenoise from $dirLn"
|
|
|
|
define CFLAGS_READLINE "-I$dirLn $dirLn/linenoise.c"
|
|
|
|
define HAVE_LINENOISE 1
|
|
|
|
add-shell-opt -DHAVE_LINENOISE=1
|
|
|
|
return "linenoise"
|
|
|
|
} elseif {[opt-bool editline]} {
|
2024-10-27 06:28:52 +01:00
|
|
|
# --enable-editline. The problem is finding a system which has it
|
|
|
|
# available to test on. The man pages for it on OpenBSD do not
|
|
|
|
# match how shell.c uses it. OpenBSD has a lib named libedit but
|
|
|
|
# no headers to go with it. The legacy configure script looked for
|
|
|
|
# readline() in libedit (and libedit.a indeed has the
|
|
|
|
# readline/history functions used by shell.c) but shell.c expects
|
|
|
|
# to find <editline/readline.h> when HAVE_EDITLINE=1, and that
|
|
|
|
# file is nowhere to be found.
|
|
|
|
#
|
|
|
|
# However, a workaround which works on the available systems is:
|
|
|
|
#
|
|
|
|
# --with-readline-lib=-ledit
|
|
|
|
#
|
|
|
|
# And then let it detect readline.h. We "could" re-map
|
|
|
|
# --enable-editline to do exactly that but it seems likely to
|
|
|
|
# break on systems for which which HAVE_EDITLINE=1 previously
|
|
|
|
# worked.
|
|
|
|
hwaci-indented-notice {
|
|
|
|
WARNING: the --enable-editline flag is not supported due to
|
|
|
|
non-availability of systems which have it in a form which the
|
|
|
|
sqlite3 CLI shell expects to see. On some systems this can be
|
|
|
|
worked around by passing --with-readline-lib=-ledit instead of
|
|
|
|
--enable-editline, which will attempt to use the readline.h
|
|
|
|
supplied by libreadline but link against -ledit.
|
|
|
|
}
|
2024-10-26 23:51:04 +02:00
|
|
|
return "none"
|
|
|
|
} elseif {![opt-bool readline]} {
|
2024-10-27 05:27:47 +01:00
|
|
|
user-notice "Readline support explicitly disabled with --disable-readline"
|
2024-10-26 23:51:04 +02:00
|
|
|
return "none"
|
2024-10-26 20:34:39 +02:00
|
|
|
}
|
2024-10-27 05:27:47 +01:00
|
|
|
|
|
|
|
# Transform with-readline-header=X to with-readline-inc=-I...
|
|
|
|
set v [opt-val with-readline-header]
|
|
|
|
hwaci-opt-set with-readline-header ""
|
|
|
|
if {"" ne $v} {
|
|
|
|
if {"auto" eq $v} {
|
|
|
|
hwaci-opt-set with-readline-inc auto
|
2024-10-26 20:17:17 +02:00
|
|
|
} else {
|
|
|
|
set v [file dirname $v]
|
|
|
|
if {[string match */*line $v]} {
|
|
|
|
# Special case: if the path includes .../*line/readline.h", set
|
|
|
|
# the -I to one dir up from that because our sources include
|
|
|
|
# <readline/readline.h> or <editline/readline.h>. Reminder: if
|
|
|
|
# auto.def is being run by jimsh0 then [file normalize] will not
|
|
|
|
# work!
|
|
|
|
set v [file dirname $v]
|
|
|
|
}
|
2024-10-27 05:27:47 +01:00
|
|
|
hwaci-opt-set with-readline-inc "-I$v"
|
2024-10-26 20:17:17 +02:00
|
|
|
}
|
2024-10-27 05:27:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
# Look for readline.h
|
|
|
|
set rlInc [opt-val with-readline-inc auto]
|
|
|
|
if {"auto" eq $rlInc} {
|
|
|
|
set rlInc ""
|
|
|
|
if {!$::cross_compiling} {
|
|
|
|
# ^^^ this check is derived from the legacy configure script
|
|
|
|
set rlInc [hwaci-search-for-header-dir readline.h \
|
|
|
|
-dirs {/usr /usr/local /usr/local/readline /usr/contrib /mingw} \
|
|
|
|
-subdirs {include/readline include}]
|
|
|
|
# ^^^ The -dirs and -subdirs lists are from the legacy configure script
|
|
|
|
if {"" ne $rlInc} {
|
|
|
|
if {[string match */*line $rlInc]} {
|
|
|
|
# See notes above for --with-readline-header
|
|
|
|
set rlInc [file dirname $rlInc]
|
|
|
|
}
|
|
|
|
set rlInc "-I${rlInc}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# If readline.h was found/specified, look for libreadline...
|
|
|
|
set rlLib ""
|
|
|
|
if {"" ne $rlInc} {
|
|
|
|
set rlLib [opt-val with-readline-lib]
|
|
|
|
if {"" eq $rlLib || "auto" eq $rlLib} {
|
|
|
|
set rlLib ""
|
|
|
|
set libTerm ""
|
|
|
|
if {[hwaci-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
|
|
|
|
# ^^^ that libs list comes from the legacy configure script ^^^
|
|
|
|
set libTerm [get-define lib_tgetent]
|
|
|
|
undefine lib_tgetent
|
|
|
|
}
|
|
|
|
if {"readline" eq $libTerm} {
|
|
|
|
set rlLib $libTerm
|
|
|
|
} elseif {[hwaci-check-function-in-lib readline readline $libTerm]} {
|
|
|
|
set rlLib [get-define lib_readline]
|
|
|
|
lappend rlLib $libTerm
|
|
|
|
undefine lib_readline
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if {"" ne $rlLib} {
|
|
|
|
set rlLib [join $rlLib]
|
|
|
|
set rlInc [join $rlInc]
|
|
|
|
define LDFLAGS_READLINE $rlLib
|
|
|
|
define CFLAGS_READLINE $rlInc
|
2024-10-26 20:17:17 +02:00
|
|
|
define HAVE_READLINE 1
|
|
|
|
add-shell-opt -DHAVE_READLINE=1
|
2024-10-27 05:27:47 +01:00
|
|
|
user-notice "Using readline flags: $rlInc $rlLib"
|
2024-10-26 23:51:04 +02:00
|
|
|
return "readline"
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
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-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy load-extension {
|
2024-09-30 19:44:41 +02:00
|
|
|
if {[hwaci-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 ""
|
|
|
|
add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1}
|
|
|
|
msg-result "Disabling loadable extensions."
|
|
|
|
}
|
|
|
|
|
2024-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy math {
|
2024-09-30 19:44:41 +02:00
|
|
|
if {![hwaci-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
|
|
|
|
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-09 07:28:29 +02:00
|
|
|
define cross_compiling ${cross_compiling}
|
|
|
|
|
2024-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-26 00:13:49 +02:00
|
|
|
# Emscripten SDK for building the web-based wasm components.
|
|
|
|
#
|
2024-10-22 15:02:48 +02:00
|
|
|
set emccsh $srcdir/tool/emcc.sh
|
2024-10-22 14:56:00 +02:00
|
|
|
if {![get-define HAVE_WASI_SDK] && [hwaci-check-emsdk]} {
|
2024-10-22 15:02:48 +02:00
|
|
|
define EMCC_WRAPPER $emccsh
|
|
|
|
hwaci-make-from-dot-in $emccsh
|
|
|
|
catch {exec chmod u+x $emccsh}
|
2024-09-26 00:13:49 +02:00
|
|
|
} else {
|
|
|
|
define EMCC_WRAPPER ""
|
2024-10-22 19:57:22 +02:00
|
|
|
file delete -force $emccsh
|
2024-09-26 00:13:49 +02:00
|
|
|
}
|
2024-10-22 15:02:48 +02:00
|
|
|
unset emccsh
|
2024-09-26 00:13:49 +02:00
|
|
|
|
2024-10-27 08:06:03 +01:00
|
|
|
########################################################################
|
|
|
|
# ICU
|
|
|
|
if {"" ne [define LDFLAGS_ICU [join [opt-val with-icu-lib ""]]]} {
|
|
|
|
# Flags sets seen in the wild for ICU:
|
|
|
|
# {-licui18n -licuuc -licudata} {-licui18n -licuuc}
|
|
|
|
add-feature-flag -DSQLITE_ENABLE_ICU
|
|
|
|
msg-result "Enabling ICU support with libs: [get-define LDFLAGS_ICU]"
|
|
|
|
if {[opt-bool icu-collations]} {
|
|
|
|
msg-result "Enabling ICU collations."
|
|
|
|
add-feature-flag -DSQLITE_ENABLE_ICU_COLLATIONS
|
|
|
|
}
|
|
|
|
|
|
|
|
# --enable-icu-collations is handled later, along with the other
|
|
|
|
# --simple-feature-flag options.
|
|
|
|
} elseif {[opt-bool icu-collations]} {
|
|
|
|
hwaci-warn "ignoring --enable-icu-collations because --with-icu-lib was not specified"
|
|
|
|
}
|
|
|
|
|
2024-10-09 07:28:29 +02:00
|
|
|
########################################################################
|
|
|
|
# Check for log(3) in libm and die with an error if it is not
|
|
|
|
# found. $why 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 {why} {
|
2024-09-30 19:44:41 +02:00
|
|
|
if {![hwaci-check-function-in-lib log m]} {
|
2024-10-09 07:28:29 +02:00
|
|
|
user-error "Missing math APIs for $why"
|
2024-09-25 16:58:09 +02:00
|
|
|
}
|
|
|
|
define LDFLAGS_MATH [get-define lib_log ""]
|
2024-10-09 07:28:29 +02:00
|
|
|
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.
|
|
|
|
foreach {boolFlag featureFlag ifSetEvalThis} {
|
2024-09-25 16:58:09 +02:00
|
|
|
all {} {
|
|
|
|
hwaci-opt-set fts4
|
|
|
|
hwaci-opt-set fts5
|
|
|
|
hwaci-opt-set geopoly
|
|
|
|
hwaci-opt-set rtree
|
|
|
|
hwaci-opt-set session
|
|
|
|
}
|
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-09-25 16:38:46 +02:00
|
|
|
geopoly -DSQLITE_ENABLE_GEOPOLY {hwaci-opt-set rtree}
|
|
|
|
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-27 08:06:03 +01:00
|
|
|
hwaci-warn "not enabling memsys3 because memsys5 is enabled."
|
|
|
|
expr 0
|
2024-09-25 16:38:46 +02:00
|
|
|
} else {
|
|
|
|
add-feature-flag -DSQLITE_ENABLE_MEMSYS3
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 06:20:58 +02:00
|
|
|
} {
|
2024-09-27 14:15:14 +02:00
|
|
|
hwaci-if-opt-truthy $boolFlag {
|
2024-09-25 06:20:58 +02:00
|
|
|
add-feature-flag $featureFlag
|
2024-10-27 08:06:03 +01:00
|
|
|
if {0 != [eval $ifSetEvalThis] && "all" ne $boolFlag} {
|
2024-10-09 07:28:29 +02:00
|
|
|
msg-result "Enabling $boolFlag"
|
|
|
|
}
|
2024-09-27 14:15:14 +02:00
|
|
|
} {
|
2024-09-25 16:38:46 +02:00
|
|
|
msg-result "Not enabling $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-10-09 06:01:14 +02:00
|
|
|
# Invert the above loop's logic for some explicit SQLITE_OMIT_...
|
|
|
|
# cases. If config option $boolFlag is set, [add-feature-flag
|
|
|
|
# $featureFlag], where $featureFlag is intended to be
|
|
|
|
# -DSQLITE_OMIT_...
|
2024-09-30 19:44:41 +02:00
|
|
|
foreach {boolFlag featureFlag} {
|
|
|
|
json -DSQLITE_OMIT_JSON
|
|
|
|
} {
|
|
|
|
if {[hwaci-opt-truthy $boolFlag]} {
|
|
|
|
msg-result "Enabling $boolFlag"
|
|
|
|
} else {
|
|
|
|
add-feature-flag $featureFlag
|
|
|
|
msg-result "Disabling $boolFlag"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-27 08:06:03 +01:00
|
|
|
#########################################################################
|
|
|
|
# Show the final feature flag sets:
|
|
|
|
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-09-27 05:04:16 +02:00
|
|
|
########################################################################
|
2024-09-27 05:16:01 +02:00
|
|
|
# Maybe extend JimTCL a bit. As of this writing (2024-09-27) it only
|
2024-10-09 06:01:14 +02:00
|
|
|
# needs (-DHAVE_REALPATH or -DHAVE__FULLPATH) and -DHAVE_DIRENT_H to
|
|
|
|
# be compatible with our code generators. It can, however, be slightly
|
|
|
|
# extended via easy-to-detect features, should we need them.
|
2024-09-27 05:16:01 +02:00
|
|
|
if {0 && "" ne [get-define CFLAGS_JIMSH]} {
|
2024-09-27 05:04:16 +02:00
|
|
|
foreach jimFunc {opendir fsync isascii} {
|
|
|
|
if {[cc-check-functions $jimFunc]} {
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_[string toupper $jimFunc]
|
|
|
|
}
|
|
|
|
}
|
2024-10-09 06:01:14 +02:00
|
|
|
#These are hard-coded into jimsh0.c, so we must not -D them:
|
2024-09-27 05:04:16 +02:00
|
|
|
#foreach jimDef {HAVE_UNISTD_H HAVE_DIRENT_H} {
|
|
|
|
# if {[is-defined $jimDef]} {
|
|
|
|
# define-append CFLAGS_JIMSH -D$jimDef
|
|
|
|
# }
|
|
|
|
#}
|
|
|
|
define-append CFLAGS_JIMSH -DHAVE_LONG_LONG; # SQLite relies on long long, so we know it's available
|
|
|
|
}; # JimTCL
|
2024-09-25 16:38:46 +02: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-22 05:33:11 +02:00
|
|
|
hwaci-make-from-dot-in -touch Makefile sqlite3.pc
|
2024-10-20 03:09:51 +02:00
|
|
|
if {0} {
|
|
|
|
# Requires a hand-written sqlite_cfg.h.in...
|
|
|
|
hwaci-make-from-dot-in sqlite_cfg.h
|
|
|
|
# vs...
|
|
|
|
} else {
|
|
|
|
# Requires no input template...
|
|
|
|
make-config-header sqlite_cfg.h \
|
|
|
|
-bare {SIZEOF_* HAVE_DECL_*} \
|
|
|
|
-none {HAVE_CFLAG_* LDFLAGS_* SH_* SQLITE_AUTOREMAKE
|
2024-10-21 18:06:49 +02:00
|
|
|
TARGET_* USE_GCOV TCL_*} \
|
2024-10-20 03:09:51 +02:00
|
|
|
-auto {HAVE_* PACKAGE_*} \
|
|
|
|
-none *
|
2024-10-22 05:33:11 +02:00
|
|
|
hwaci-touch sqlite_cfg.h ; # help avoid frequent unnecessary @SQLITE_AUTOREMAKE@
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-10-20 03:09:51 +02:00
|
|
|
#TODO hwaci-make-from-dot-in ext/wasm/GNUmakefile
|
2024-09-25 03:39:39 +02:00
|
|
|
|
2024-10-26 05:05:20 +02:00
|
|
|
if {"" ne $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_AUTOREMAKE TARGET_* USE_GCOV TCL_*}
|
|
|
|
-array {*.list}
|
|
|
|
-auto {OPT_* PACKAGE_* HAVE_*}
|
|
|
|
}
|
|
|
|
if {[opt-bool defines-json-include-lowercase]} {
|
|
|
|
lappend dumpDefsOpt -none {lib_*} ; # remnants from hwaci-check-function-in-lib and friends
|
|
|
|
lappend dumpDefsOpt -auto {[a-z]*}
|
|
|
|
}
|
|
|
|
lappend dumpDefsOpt -none *
|
|
|
|
hwaci-dump-defs-json $DUMP_DEFINES_JSON {*}$dumpDefsOpt
|
|
|
|
undefine OPT_FEATURE_FLAGS.list
|
|
|
|
undefine OPT_SHELL.list
|
2024-10-25 06:39:14 +02:00
|
|
|
}
|
2024-10-25 05:18:11 +02:00
|
|
|
|
2024-10-09 06:01:14 +02:00
|
|
|
########################################################################
|
|
|
|
# Some build-dev/debug-only output
|
2024-09-25 16:38:46 +02:00
|
|
|
hwaci-if-opt-truthy dump-defines {
|
2024-10-25 15:56:13 +02:00
|
|
|
global DUMP_DEFINES_TXT
|
|
|
|
msg-result "--dump-defines is creating $DUMP_DEFINES_TXT"
|
|
|
|
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-09-26 00:13:49 +02:00
|
|
|
if {0} {
|
2024-09-26 14:16:46 +02:00
|
|
|
foreach x [all-defines] {
|
2024-09-26 00:13:49 +02:00
|
|
|
puts "\t$x"
|
|
|
|
}
|
|
|
|
}
|
2024-09-25 03:39:39 +02:00
|
|
|
}
|
2024-09-30 19:44:41 +02:00
|
|
|
|
2024-10-23 03:18:16 +02:00
|
|
|
msg-result "Done! Now run make."
|