diff --git a/auto.def b/auto.def index 611a786387..fe7d045e33 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,16 +1126,25 @@ 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 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. +# --with-icu-config values: +# +# - auto: use the first one of (pkg-config, icu-config) found. +# - 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-uc) are 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 ""]] define CFLAGS_ICU [join [opt-val with-icu-cflags ""]] @@ -1144,33 +1153,45 @@ proc sqlite-check-icu {} { # - -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 {[pkg-config-init 0] + && ("auto" eq $icuConfigBin || "pkg-config" eq $icuConfigBin)} { + if {[pkg-config icu-uc]} { + set tryIcuConfigBin 0 + define LDFLAGS_ICU [get-define PKG_ICU_UC_LDFLAGS] + define-append LDFLAGS_ICU [get-define PKG_ICU_UC_LIBS] + define CFLAGS_ICU [get-define PKG_ICU_UC_CFLAGS] } } - 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 \ + [get-define prefix]/bin/icu-config \ + /usr/local/bin/icu-config \ + /usr/bin/icu-config] + if {"" eq $icuConfigBin} { + proj-fatal "--with-icu-config=auto cannot find 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 6154a16529..8d6dcfb860 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stypo\sin\sthe\shandling\sof\sthe\snew\s--dev\sflag\swhich\scaused\sit\sto\sset\sthe\s--debug\sflag\sinstead\sof\sthe\s--with-debug\sflag\s(the\sformer\sis\sfor\sautosetup's\sinternal\suse). -D 2024-11-14T19:34:28.930 +C An\sexperiment\sin\soptionally\susing\spkg-config\sto\sdetermine\sthe\slibs\sto\slink\sin\sfor\sICU\ssupport,\sbut\sits\sldflags\sis\smissing\sone\srequired\slib\son\sboth\sLinux\sand\sOpenBSD.\sKeeping\sthis\sfor\slater\sreference,\sas\sit\sdemonstrates\show\sto\suse\spkg-config\sfrom\sautosetup. +D 2024-11-15T10:07:57.846 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 d314af75944a40fdc466212d7f40e5056af843ace7f4025591d63fb942a26e27 +F auto.def 70932f7acebcc439a811bb9c4117b31a28c7606a00f36bf729566a1c90ae4208 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -2198,8 +2198,12 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P f778dfdd6d6a4975c903d8ca0ebfb4fa917d543289136ea0ab740cb47d2510c1 -R 8f1a4b67fcbeb88fc42130b5848bb2cd +P 81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8 +R b6f94e3605bc6952a1abdeb693280714 +T *branch * autosetup-icu-pkg-config +T *sym-autosetup-icu-pkg-config * +T +closed * +T -sym-trunk * U stephan -Z 1bce6ce0c64505db6d931db182e302d9 +Z 244e7ce475b1c9a38fffc82237addd71 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4f7ed134be..0867bdbaf5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -81202d2ab5963fdcf20555b6d0b31cc955ac27f1cd87656faea5c0611c9a2ee8 +09caa94c9e846f9b3669b3f1acbb26b24b8bfcc9e512f17ea074dd92745c2597