diff --git a/auto.def b/auto.def index 759cf07fe0..4871a98229 100644 --- a/auto.def +++ b/auto.def @@ -12,7 +12,7 @@ # # JimTCL: https://jim.tcl.tk # -use cc cc-db cc-shared cc-lib proj +use cc cc-db cc-shared cc-lib proj pkg-config # $DUMP_DEFINES_TXT is the file emitted by --dump-defines, intended # only for build debugging and not part of the public build interface. @@ -184,7 +184,7 @@ set flags { => {Enable SQLITE_ENABLE_ICU and add the given linker flags for the ICU libraries} with-icu-cflags:CFLAGS => {Apply extra CFLAGS/CPPFLAGS necessary for building with ICU. e.g. -I/usr/local/include} - with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU and fetch ldflags and cflags flags from the given icu-config binary} + with-icu-config:=auto => {Enable SQLITE_ENABLE_ICU. Value must be one of: auto, pkg-config, /path/to/icu-config} icu-collations=0 => {Enable SQLITE_ENABLE_ICU_COLLATIONS. Requires --with-icu-ldflags=... or --with-icu-config} # # @@ -1126,20 +1126,26 @@ proj-if-opt-truthy math { # # --with-icu-ldflags=LDFLAGS # --with-icu-cflags=CFLAGS -# --with-icu-config[=/path/to/icu-config] +# --with-icu-config[=auto | pkg-config | /path/to/icu-config] # --enable-icu-collations # -# If --with-icu-config is provided but icu-config cannot be used fail -# fatally. If --with-icu-ldflags/cflags is/are provided, assume they -# are valid. +# --with-icu-config values: # -# If --with-icu-ldflags/cflags and --with-icu-config are provided, -# they are cumulative. If neither are provided, icu-collations is not +# - auto: use the first one of (pkg-config, icu-config) found on the +# system. +# - pkg-config: use only pkg-config to determine flags +# - /path/to/icu-config: use that to determine flags +# +# If --with-icu-config is used as neither pkg-config nor icu-config +# are found, fail fatally. +# +# If both --with-icu-ldflags and --with-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. +# icu-config binary or (pkg-config icu-io) are found, we specifically +# do not. ICU is always an opt-in feature. # # Maintenance reminder: check-in 09caa94c9e84 added pkg-config support # to this but the result fails to link on both Linux and OpenBSD @@ -1152,34 +1158,52 @@ proc sqlite-check-icu {} { # - -licui18n -licuuc -licudata # - -licui18n -licuuc # - /usr/local/bin/icu-config --ldflags + # if {[proj-opt-was-provided with-icu-config]} { - set bin [opt-val with-icu-config] - if {"auto" eq $bin} { - set bin [proj-first-bin-of \ - [get-define prefix]/bin/icu-config \ - /usr/local/bin/icu-config \ - /usr/bin/icu-config] - if {"" eq $bin} { - proj-fatal "--with-icu-config=auto cannot find icu-config binary" + set icuConfigBin [opt-val with-icu-config] + set tryIcuConfigBin 1; # set to 0 if we end up using pkg-config + if {"auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin} { + if {[pkg-config-init 0] && [pkg-config icu-io]} { + # Maintenance reminder: historical docs say to use both of + # (icu-io, icu-uc). icu-uc lacks a required lib and icu-io has + # all of them on tested OSes. + set tryIcuConfigBin 0 + define LDFLAGS_ICU [get-define PKG_ICU_IO_LDFLAGS] + define-append LDFLAGS_ICU [get-define PKG_ICU_IO_LIBS] + define CFLAGS_ICU [get-define PKG_ICU_IO_CFLAGS] + } elseif {"pkg-config" eq $icuConfigBin} { + proj-fatal "pkg-config cannot find package icu-io" + } else { + proj-assert {"auto" eq $icuConfigBin} } } - if {[file-isexec $bin]} { - set x [exec $bin --ldflags] - if {"" eq $x} { - proj-fatal "$bin --ldflags returned no data" + if {$tryIcuConfigBin} { + if {"auto" eq $icuConfigBin} { + set icuConfigBin [proj-first-bin-of \ + /usr/local/bin/icu-config \ + /usr/bin/icu-config] + if {"" eq $icuConfigBin} { + proj-fatal "--with-icu-config=auto cannot find (pkg-config icu-io) or icu-config binary" + } + } + if {[file-isexec $icuConfigBin]} { + set x [exec $icuConfigBin --ldflags] + if {"" eq $x} { + proj-fatal "$icuConfigBin --ldflags returned no data" + } + define-append LDFLAGS_ICU $x + set x [exec $icuConfigBin --cppflags] + define-append CFLAGS_ICU $x + } else { + proj-fatal "--with-icu-config=$bin does not refer to an executable" } - define-append LDFLAGS_ICU $x - set x [exec $bin --cppflags] - define-append CFLAGS_ICU $x - } else { - proj-fatal "--with-icu-config=$bin does not refer to an executable" } } set ldflags [define LDFLAGS_ICU [string trim [get-define LDFLAGS_ICU]]] set cflags [define CFLAGS_ICU [string trim [get-define CFLAGS_ICU]]] if {"" ne $ldflags} { sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU - msg-result "Enabling ICU support with libs ($ldflags) and cflags ($cflags)" + msg-result "Enabling ICU support with flags: $ldflags $cflags" if {[opt-bool icu-collations]} { msg-result "Enabling ICU collations." sqlite-add-feature-flag -shell -DSQLITE_ENABLE_ICU_COLLATIONS diff --git a/manifest b/manifest index 1ce6cea3c6..92cde3b804 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C configure\sscript\sdoc\sadditions\sfor\sthe\sICU\sfeature\scheck. -D 2024-11-15T10:12:03.805 +C configure:\sadd\soptional\spkg-config\ssupport\sfor\sdetecting\sICU. +D 2024-11-15T10:53:57.203 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -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 dbbaf480acd0c5b9f330580aec6a43f50e5c37a69b1e5bb3f722c0620f617094 +F auto.def 538d9a162a8fe4811c0a4a22a2a07df40ea4c334f683b94231bfc2a18f14b913 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -2198,8 +2198,9 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8 -R f0c6d5bed8faeb01cfe709bf9d6cb9a1 +P 1925a68fc2323f0788aac9c3c2bb3005182eb3286037bc383181b6aa150d4270 6ca457542e1dceac2d68fe3d29ff1f0beb31a77ca3073bd7d8a6c62faabcdc1d +R 02dd7c141e8d6d129c07207797697869 +T +closed 6ca457542e1dceac2d68fe3d29ff1f0beb31a77ca3073bd7d8a6c62faabcdc1d Closed\sby\sintegrate-merge. U stephan -Z 5ff845a37175f10e9a57fde007423669 +Z 467aed797000c9f6ea51561768e3c8cb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 1bd2038e40..1f254347f8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1925a68fc2323f0788aac9c3c2bb3005182eb3286037bc383181b6aa150d4270 +3e5b8077c6c6ce72ecab3110eb45943b9765372df789088982dbd6046a7c2523