aboutsummaryrefslogtreecommitdiff
path: root/autosetup/sqlite-config.tcl
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2025-03-15 15:19:42 +0000
committerstephan <stephan@noemail.net>2025-03-15 15:19:42 +0000
commit9f8a238fb5ab0e292931492e949665c1a104c838 (patch)
tree6a7b3f5dee1f811113397c68975d0260d142517a /autosetup/sqlite-config.tcl
parentdae87df198a40df2c04507f86b49c291c1e917e3 (diff)
downloadsqlite-9f8a238fb5ab0e292931492e949665c1a104c838.tar.gz
sqlite-9f8a238fb5ab0e292931492e949665c1a104c838.zip
Configure-internal build cleanups (no functional changes). Add EXTRA_SRC to the deps of sqlite3.c.
FossilOrigin-Name: 8afb8bbce8654d6f76207fb136e79dc52b6724a71eae82a4c098690a68eb75a1
Diffstat (limited to 'autosetup/sqlite-config.tcl')
-rw-r--r--autosetup/sqlite-config.tcl67
1 files changed, 33 insertions, 34 deletions
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index 56567ddb9..3644b4872 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -61,13 +61,21 @@ array set sqliteConfig [proj-strip-hash-comments {
set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling]
########################################################################
-# Processes all configure --flags for this build $buildMode must be
-# either "canonical" or "autoconf", and others may be added in the
+# Processes all configure --flags for this build, run build-specific
+# config checks, then finalize the configure process. $buildMode must
+# be either "canonical" or "autoconf", and others may be added in the
# future. After bootstrapping, $configScript is eval'd in the caller's
# scope, then post-configuration finalization is run. $configScript is
# intended to hold configure code which is specific to the given
# $buildMode, with the caveat that _some_ build-specific code is
# encapsulated in the configuration finalization step.
+#
+# The intent is that all build-mode-specific configuration goes inside
+# the $configScript argument to this function, and that an auto.def file
+# contains only two commands:
+#
+# use sqlite-config
+# sqlite-configure BUILD_NAME { build-specific configure script }
proc sqlite-configure {buildMode configScript} {
set allBuildModes {canonical autoconf}
if {$buildMode ni $allBuildModes} {
@@ -131,7 +139,7 @@ proc sqlite-configure {buildMode configScript} {
########################################################################
set allFlags {
# Structure: a list of M {Z} pairs, where M is a descriptive
- # option group name and Z is a list of X Y pairs. X is a list of
+ # option group name and Z is a list of X Y pairs. X is a list of
# $buildMode name(s) to which the Y flags apply, or {*} to apply
# to all builds. Y is a {block} in the form expected by
# autosetup's [options] command. Each block which is applicable
@@ -168,8 +176,8 @@ proc sqlite-configure {buildMode configScript} {
largefile=1
=> {This legacy flag has no effect on the library but may influence
the contents of the generated sqlite_cfg.h}
- # ^^^ It's not clear that this actually does anything, as
- # HAVE_LFS is not checked anywhere in the .c/.h/.in files.
+ # ^^^ It's not clear that LFS support actually does anything,
+ # as HAVE_LFS is not checked anywhere in the .c/.h/.in files.
load-extension=1 => {Disable loading of external extensions}
math=1 => {Disable math functions}
json=1 => {Disable JSON functions}
@@ -365,12 +373,13 @@ proc sqlite-configure {buildMode configScript} {
}; # sqlite-configure
########################################################################
-# Performs late-stage config steps common to both the canonical and
-# autoconf bundle builds.
+# Performs late-stage config steps common to all supported
+# $::sqliteConfig(build-mode) values.
proc sqlite-configure-finalize {} {
set buildMode $::sqliteConfig(build-mode)
set isCanonical [expr {$buildMode eq "canonical"}]
set isAutoconf [expr {$buildMode eq "autoconf"}]
+ proj-assert {$isCanonical || $isAutoconf} "Unknown build mode: $buildMode"
define HAVE_LFS 0
if {[opt-bool largefile]} {
@@ -417,6 +426,13 @@ proc sqlite-configure-finalize {} {
sqlite-handle-math
sqlite-handle-icu
sqlite-handle-env-quirks
+ sqlite-handle-common-feature-flags
+ sqlite-finalize-feature-flags
+ ########################################################################
+ # When cross-compiling, we have to avoid using the -s flag to
+ # /usr/bin/install:
+ # https://sqlite.org/forum/forumpost/9a67df63eda9925c
+ define IS_CROSS_COMPILING $::sqliteConfig(is-cross-compiling)
sqlite-process-dot-in-files
sqlite-post-config-validation
sqlite-dump-defines
@@ -433,12 +449,10 @@ proc sqlite-post-options-init {} {
define PACKAGE_URL {https://sqlite.org}
define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum
define PACKAGE_STRING "[get-define PACKAGE_NAME] [get-define PACKAGE_VERSION]"
- #
- # Carry values from hidden --flag aliases over to their canonical
- # flag forms. This list must include only options which are common
- # to both the top-level auto.def and autoconf/auto.def.
- #
proj-xfer-options-aliases {
+ # Carry values from hidden --flag aliases over to their canonical
+ # flag forms. This list must include only options which are common
+ # to all build modes supported by [sqlite-configure].
with-readline-inc => with-readline-cflags
with-readline-lib => with-readline-ldflags
with-debug => debug
@@ -468,11 +482,9 @@ proc msg-debug {msg} {
########################################################################
# Sets up the SQLITE_AUTORECONFIG define.
proc sqlite-autoreconfig {} {
- #
# SQLITE_AUTORECONFIG contains make target rules for re-running the
# configure script with the same arguments it was initially invoked
- # with. This can be used to automatically reconfigure
- #
+ # with. This can be used to automatically reconfigure.
set squote {{arg} {
# Wrap $arg in single-quotes if it looks like it might need that
# to avoid mis-handling as a shell argument. We assume that $arg
@@ -507,6 +519,8 @@ proc sqlite-add-feature-flag {args} {
define-append OPT_FEATURE_FLAGS {*}$args
}
}
+
+########################################################################
# Appends $args, if not empty, to OPT_SHELL.
proc sqlite-add-shell-opt {args} {
if {"" ne $args} {
@@ -545,13 +559,11 @@ proc sqlite-check-common-bins {} {
# Run checks for system-level includes and libs which are common to
# both the canonical build and the "autoconf" bundle.
proc sqlite-check-common-system-deps {} {
- #
# Check for needed/wanted data types
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}
- #
# Check for needed/wanted functions
cc-check-functions gmtime_r isnan localtime_r localtime_s \
malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
@@ -566,7 +578,6 @@ proc sqlite-check-common-system-deps {} {
}
define LDFLAGS_RT [join [lsort -unique $ldrt] ""]
- #
# Check for needed/wanted headers
cc-check-includes \
sys/types.h sys/stat.h dlfcn.h unistd.h \
@@ -588,7 +599,6 @@ proc sqlite-check-common-system-deps {} {
########################################################################
# Move -DSQLITE_OMIT... and -DSQLITE_ENABLE... flags from CFLAGS and
# CPPFLAGS to OPT_FEATURE_FLAGS and remove them from BUILD_CFLAGS.
-# This is derived from the legacy build but is still practical.
proc sqlite-munge-cflags {} {
# Move CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and
# -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived
@@ -735,6 +745,10 @@ proc sqlite-finalize-feature-flags {} {
define OPT_SHELL [lsort -unique $oFF]
msg-result "Shell options: [get-define OPT_SHELL]"
}
+ if {"" ne [set extraSrc [get-define AMALGAMATION_EXTRA_SRC ""]]} {
+ proj-assert {"canonical" eq $::sqliteConfig(build-mode)}
+ msg-result "Appending source files to amalgamation: $extraSrc"
+ }
}
########################################################################
@@ -1558,21 +1572,6 @@ proc sqlite-handle-env-quirks {} {
# output file(s).
proc sqlite-process-dot-in-files {} {
########################################################################
- # When cross-compiling, we have to avoid using the -s flag to
- # /usr/bin/install:
- # https://sqlite.org/forum/forumpost/9a67df63eda9925c
- define IS_CROSS_COMPILING $::sqliteConfig(is-cross-compiling)
-
- # Finish up handling of the various feature flags here because it's
- # convenient for both the canonical build and autoconf bundles that
- # it be done here.
- sqlite-handle-common-feature-flags
- sqlite-finalize-feature-flags
- if {"" ne [set extraSrc [get-define AMALGAMATION_EXTRA_SRC ""]]} {
- msg-result "Appending source files to amalgamation: $extraSrc"
- }
-
- ########################################################################
# "Re-export" the autoconf-conventional --XYZdir flags into something
# which is more easily overridable from a make invocation. See the docs
# for [proj-remap-autoconf-dir-vars] for the explanation of why.