diff --git a/auto.def b/auto.def index b4201b79c1..a1a7043a01 100644 --- a/auto.def +++ b/auto.def @@ -173,8 +173,10 @@ set flags { editline=0 => {BSD editline support} # # - with-icu-ldflags: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-ldflags=...} + with-icu-ldflags: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-ldflags=...} + with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU and fetch linker flags from the given icu-config binary} # # with-wasi-sdk:=/opt/wasi-sdk @@ -878,6 +880,26 @@ proc sqlite-check-line-editing {} { show-notices sqlite-add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION } + + # Now check whether rl_completion_matches() has a signature we can use. + # cctest is producing unexpected test output when using: + # -includes {stdio.h readline/readline.h} + # so we have to use -source instead and write the whole test app inline + if {[cctest \ + -cflags $rlInc -libs $rlLib -nooutput 1 -source { + #include + #include + static char * rcg(const char *z, int i){return 0;} + int main(void) { + char ** x = rl_completion_matches("one", rcg); + return 0; + } + }]} { + user-notice "Readline completion enabled" + } else { + user-notice "WARNING: readline completion disabled due to rl_completion_matches() signature mismatch" + add-shell-opt -DSQLITE_OMIT_READLINE_COMPLETION + } return "readline" } @@ -929,21 +951,63 @@ unset emccsh ######################################################################## # ICU - International Components for Unicode -if {"" ne [define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]]]} { +# +# Handles these flags: +# +# --with-icu-ldflags=LDFLAGS +# --with-icu-config[=/path/to/icu-config] +# --enable-icu-collations +# +# If both icu-ldflags and icu-config are provided, they are +# cumulative. If neither are provided, icu-collations is not honored +# and a warning is emitted if it is provided. +# +# Design note: though we can automatically enable ICU if the +# icu-config binary is found, we specifically do not. ICU is always an +# opt-in feature. +proc sqlite-check-icu {} { + define LDFLAGS_ICU [join [opt-val with-icu-ldflags ""]] # Flags sets seen in the wild for ICU: # - -licui18n -licuuc -licudata # - -licui18n -licuuc # - /usr/local/bin/icu-config --ldflags - sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU - msg-result "Enabling ICU support with libs: [get-define LDFLAGS_ICU]" - 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 + if {[hwaci-opt-was-provided with-icu-config]} { + set bin [opt-val with-icu-config] + if {"auto" eq $bin} { + set bin [hwaci-first-bin-of \ + [get-define prefix]/bin/icu-config \ + /usr/local/bin/icu-config \ + /usr/bin/icu-config] + if {"" eq $bin} { + hwaci-fatal "--with-icu-config=auto cannot find icu-config binary" + } + } + if {[file-isexec $bin]} { + set x [exec $bin --ldflags] + if {"" eq $x} { + hwaci-fatal "$bin --ldflags returned no data" + } + define-append LDFLAGS_ICU $x + } else { + hwaci-fatal "--with-icu-config=$bin does not refer to an executable" + } } -} elseif {[opt-bool icu-collations]} { - hwaci-warn "ignoring --enable-icu-collations because --with-icu-ldflags was not specified" -} + set flags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]] + if {"" ne $flags} { + sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU + msg-result "Enabling ICU support with libs: $flags" + 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]} { + hwaci-warn "ignoring --enable-icu-collations because neither --with-icu-ldflags nor --with-icu-config provided any linker flags" + } else { + msg-result "ICU support is disabled." + } +}; # sqlite-check-icu +sqlite-check-icu ######################################################################## # Check for log(3) in libm and die with an error if it is not diff --git a/autosetup/hwaci-common.tcl b/autosetup/hwaci-common.tcl index 1cde5703c7..126cad2550 100644 --- a/autosetup/hwaci-common.tcl +++ b/autosetup/hwaci-common.tcl @@ -187,7 +187,7 @@ proc hwaci-find-executable-path {args} { set verbose 0 if {[lindex $args 0] eq "-v"} { set verbose 1 - set binName [lrange $args 1 end] + set args [lassign $args - binName] msg-checking "Looking for $binName ... " } set check [find-executable-path $binName] @@ -255,6 +255,15 @@ proc hwaci-require-bash {} { return $bash } +######################################################################## +# Returns 1 if the user specifically provided the given configure +# flag, else 0. This can be used to distinguish between options which +# have a default value and those which were specifically provided by +# the user. +proc hwaci-opt-was-provided {key} { + return [dict exists $::autosetup(optset) $key] +} + ######################################################################## # Force-set autosetup option $flag to $val. The value can be fetched # later with [opt-val], [opt-bool], and friends. diff --git a/manifest b/manifest index d9d6800c4b..8862d9b64c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Expand\sthe\s'make\shelp'\starget\sand\sclean\sup\ssome\soverly-noisy\sconfigure\soutput. -D 2024-10-27T22:34:07.986 +C Add\s--with-icu-config\sflag\sto\suse\sthe\sicu-config\sbinary\sto\sfind\sthe\srequired\sldflags\sfor\slinking\sthe\sICU\slibraries. +D 2024-10-28T00:56:31.767 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2 @@ -13,7 +13,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def ccbcecdf3a348fb463cd11e5fbcc1b2954059103e99531bf84d18a5f56c1351f +F auto.def a876018881cc52bd5ac45015d460164fa0c5bc0c92bb820aee3b49c3f38d1394 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -47,7 +47,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14 F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 -F autosetup/hwaci-common.tcl bc48c6ddfcd33a0eaf17f1709cde60622ff29c479e0356e8c6bcabe5b58a4d51 +F autosetup/hwaci-common.tcl e3913fd13debb4e0382c9e68ae46c61f9bc1afcfd2e9996a9b43557deefefb03 F autosetup/jimsh0.c 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb @@ -2237,8 +2237,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P ab95ee33dfe56bd3b223f978626e6014414881c30443a2b88c782de724c39ae1 -R 4f2f3f9048608d15144b74fa8694e059 +P c895766ed31f55c02f05d357333e9cf45e82ec5af4d8b0491270e4fda7a57d42 +R 0c3cc11e229eb9f60e9d6e1a23d1a429 U stephan -Z f0d4b898dbccc821754c02bc4f1ee2af +Z cf4b95e7dea0c78a9db6ff8b45d5a758 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index dd090aaa96..0c41ed5c78 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c895766ed31f55c02f05d357333e9cf45e82ec5af4d8b0491270e4fda7a57d42 +64f33bb125102b3fec3901f4b56098429509ec0b6ce6e6b88af2393c344ac864