From 3e06f2d79b15754999892a4ded6a7585520294a6 Mon Sep 17 00:00:00 2001 From: stephan Date: Sun, 9 Feb 2025 01:25:00 +0000 Subject: [PATCH] configure: when transfering ENABLE/OMIT flags from CFLAGS to OPT_FEATURE_FLAGS, also do the same for CPPFLAGS and remove those ENABLE/OMIT flags from CFLAGS/CPPFLAGS to mimic legacy build behavior. Strip ENABLE/OMIT flags from BUILD_CFLAGS but do not transfer those to OPT_FEATURE_FLAGS, also to mimic legacy behavior. This is the second part of a fix discussed at [forum:9801e54665afd728|forum post 9801e54665afd728]. FossilOrigin-Name: 16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf --- autosetup/sqlite-config.tcl | 36 ++++++++++++++++++++++++++++++------ manifest | 14 +++++++------- manifest.uuid | 2 +- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index cabb32aac0..2a73548662 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -230,23 +230,47 @@ proc sqlite-setup-default-cflags {} { # BUILD_CFLAGS is the CFLAGS for CC_FOR_BUILD. define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}] - # Copy all CFLAGS entries matching -DSQLITE_OMIT* and + # Copy all 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). # https://sqlite.org/forum/forumpost/9801e54665afd728 # + # Handling of CPPFLAGS, as well as removing ENABLE/OMIT from + # CFLAGS/CPPFLAGS, was missing in the 3.49.0 release as well. + # # If any configure flags for features are in conflict with - # CFLAGS-specified feature flags, all bets are off. There are no - # guarantees about which one will take precedence. - foreach cf [get-define CFLAGS ""] { + # CFLAGS/CPPFLAGS-specified feature flags, all bets are off. There + # are no guarantees about which one will take precedence. + foreach flagDef {CFLAGS CPPFLAGS} { + set tmp "" + foreach cf [get-define $flagDef ""] { + switch -glob -- $cf { + -DSQLITE_OMIT* - + -DSQLITE_ENABLE* { + sqlite-add-feature-flag $cf + } + default { + lappend tmp $cf + } + } + } + define $flagDef $tmp + } + + # Strip all SQLITE_ENABLE/OMIT flags from BUILD_CFLAGS, + # for compatibility with the legacy build. + set tmp "" + foreach cf [get-define BUILD_CFLAGS ""] { switch -glob -- $cf { -DSQLITE_OMIT* - - -DSQLITE_ENABLE* { - sqlite-add-feature-flag $cf + -DSQLITE_ENABLE* {} + default { + lappend tmp $cf } } } + define BUILD_CFLAGS $tmp } ########################################################################