diff options
author | stephan <stephan@noemail.net> | 2025-03-03 14:15:13 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2025-03-03 14:15:13 +0000 |
commit | 272344d206f60237130cee5ce9f3be3ed34d4e0e (patch) | |
tree | 6e0196655f70353ac36607b33113d752145e26ba /autosetup/sqlite-config.tcl | |
parent | 31b72ff5212ba705c1b2770380fd7bac7b84723b (diff) | |
download | sqlite-272344d206f60237130cee5ce9f3be3ed34d4e0e.tar.gz sqlite-272344d206f60237130cee5ce9f3be3ed34d4e0e.zip |
Internal configure script cleanups. Resolve an as-yet-hypothetical corner case involving the --dev flag mixed with custom CFLAGS containing SQLITE_ENABLE... or SQLITE_OMIT... flags. Fix an unrelated API doc typo reported in [forum:606ea661df|forum post 606ea661df].
FossilOrigin-Name: 0554c00f32b7cc81d35340080df10ea6d66c9ff07fe749ea76cc523a4149b5c8
Diffstat (limited to 'autosetup/sqlite-config.tcl')
-rw-r--r-- | autosetup/sqlite-config.tcl | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index ccb16f7be..54daf7c8a 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -24,6 +24,8 @@ use system ; # Will output "Host System" and "Build System" lines if {"--help" ni $::argv} { msg-result "Source dir = $::autosetup(srcdir)" msg-result "Build dir = $::autosetup(builddir)" + + use cc cc-db cc-shared cc-lib pkg-config } # @@ -256,7 +258,7 @@ proc sqlite-configure {buildMode configScript} { with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. - Needed only by ext/wasm build. Default=EMSDK env var.} + Needed only by ext/wasm. Default=EMSDK env var.} } } @@ -281,7 +283,7 @@ proc sqlite-configure {buildMode configScript} { # dll-basename: https://sqlite.org/forum/forumpost/828fdfe904 dll-basename:=auto => {Specifies the base name of the resulting DLL file. - If not provided, libsqlite3 is usually assumed but on some platforms + If not provided, "libsqlite3" is usually assumed but on some platforms a platform-dependent default is used. On some platforms this flag gets automatically enabled if it is not provided. Use "default" to explicitly disable platform-dependent activation on such systems.} @@ -352,12 +354,6 @@ proc sqlite-configure {buildMode configScript} { dict incr xopts -level return {*}$xopts $msg } - # The following uplevel is largely cosmetic, the intent being to put - # the most-frequently-useful info at the top of the ./configure - # output, but also avoiding outputing it if --help is used. - uplevel 1 { - use cc cc-db cc-shared cc-lib pkg-config - } sqlite-post-options-init uplevel 1 $configScript sqlite-configure-finalize @@ -584,27 +580,12 @@ proc sqlite-check-common-system-deps {} { } } -proc sqlite-setup-default-cflags {} { - ######################################################################## - # We differentiate between two C compilers: the one used for binaries - # 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 - # cross-compiling. - # - # When cross-compiling we default to not using the -g flag, based on a - # /chat discussion prompted by - # https://sqlite.org/forum/forumpost/9a67df63eda9925c - set defaultCFlags {-O2} - if {!$::sqliteConfig(is-cross-compiling)} { - lappend defaultCFlags -g - } - define CFLAGS [proj-get-env CFLAGS $defaultCFlags] - # BUILD_CFLAGS is the CFLAGS for CC_FOR_BUILD. - define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}] - - # Copy all CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and +######################################################################## +# 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 # from the legacy build and was missing the 3.48.0 release (the # initial Autosetup port). @@ -647,6 +628,30 @@ proc sqlite-setup-default-cflags {} { define BUILD_CFLAGS $tmp } +######################################################################### +# Set up the default CFLAGS and BUILD_CFLAGS values. +proc sqlite-setup-default-cflags {} { + ######################################################################## + # We differentiate between two C compilers: the one used for binaries + # 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 + # cross-compiling. + # + # When cross-compiling we default to not using the -g flag, based on a + # /chat discussion prompted by + # https://sqlite.org/forum/forumpost/9a67df63eda9925c + set defaultCFlags {-O2} + if {!$::sqliteConfig(is-cross-compiling)} { + lappend defaultCFlags -g + } + define CFLAGS [proj-get-env CFLAGS $defaultCFlags] + # BUILD_CFLAGS is the CFLAGS for CC_FOR_BUILD. + define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}] + sqlite-munge-cflags +} + ######################################################################## # Handle various SQLITE_ENABLE_... feature flags. proc sqlite-handle-common-feature-flags {} { |