From: stephan Date: Mon, 10 Feb 2025 15:01:14 +0000 (+0000) Subject: configure: when dlopen() is not found, only fail fatally if --enable-loadable-module... X-Git-Tag: major-release~306 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ea05b5b4f219a0cadb5d573bf73c0818cee02cf;p=thirdparty%2Fsqlite.git configure: when dlopen() is not found, only fail fatally if --enable-loadable-module is explicitly provided, else warn instead. Based on discussion around [forum:2efe9c33bd9021ca|forum post 2efe9c33bd9021ca]. Update proj-indented-notice to behave like its docs say it should when the -error flag is used. FossilOrigin-Name: f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc --- diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index 5eeec0afb9..6a1960f603 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -114,11 +114,13 @@ proc proj-bold {str} { # # If the -notice flag it used then it emits using [user-notice], which # means its rendering will (A) go to stderr and (B) be delayed until -# the next time autosetup goes to output a message. If -notice -# is not used, it will send the message to stdout without delay. +# the next time autosetup goes to output a message. # # If the -error flag is provided then it renders the message # immediately to stderr and then exits. +# +# If neither -notice nor -error are used, the message will be sent to +# stdout without delay. proc proj-indented-notice {args} { set fErr "" set outFunc "puts" @@ -126,6 +128,7 @@ proc proj-indented-notice {args} { switch -exact -- [lindex $args 0] { -error { set args [lassign $args fErr] + set outFunc "user-notice" } -notice { set args [lassign $args -] diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index f1888084e4..904c439e0b 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -855,20 +855,53 @@ proc sqlite-handle-icu {} { ######################################################################## -# Handles the --enable-load-extension flag. +# Handles the --enable-load-extension flag. Returns 1 if the support +# is enabled, else 0. If support for that feature is not found, a +# fatal error is triggered if --enable-load-extension is explicitly +# provided, else a loud warning is instead emited. If +# --disable-load-extension is used, no check is performed. +# +# Makes the following environment changes: +# +# - defines LDFLAGS_DLOPEN to any linker flags needed for this +# feature. It may legally be empty on some systems where dlopen() +# is in libc. +# +# - If the feature is not available, adds +# -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list. proc sqlite-handle-load-extension {} { + define LDFLAGS_DLOPEN "" + set found 0 proj-if-opt-truthy load-extension { - if {[proj-check-function-in-lib dlopen dl]} { + set found [proj-check-function-in-lib dlopen dl] + if {$found} { define LDFLAGS_DLOPEN [get-define lib_dlopen] undefine lib_dlopen } else { - user-error "dlopen() not found. Use --disable-load-extension to bypass this check." + if {[proj-opt-was-provided load-extension]} { + # Explicit --enable-load-extension: fail if not found + proj-indented-notice -error { + --enable-load-extension was provided but dlopen() + not found. Use --disable-load-extension to bypass this + check. + } + } else { + # It was implicitly enabled: warn if not found + proj-indented-notice { + WARNING: dlopen() not found, so loadable module support will + be disabled. Use --disable-load-extension to bypass this + check. + } + } } - } { - define LDFLAGS_DLOPEN "" + } + if {$found} { + msg-result "Loadable extension support enabled." + } else { + msg-result "Disabling loadable extension support. Use --enable-load-extensions to enable them." sqlite-add-feature-flag {-DSQLITE_OMIT_LOAD_EXTENSION=1} - msg-result "Disabling loadable extensions." } + return $found } ######################################################################## diff --git a/manifest b/manifest index 7ca924c8b2..3221103887 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Convert\ssome\sexpensive\sNEVER()\sand\sASSERT()\smacros\sinto\sassert()s. -D 2025-02-10T11:16:37.391 +C configure:\swhen\sdlopen()\sis\snot\sfound,\sonly\sfail\sfatally\sif\s--enable-loadable-module\sis\sexplicitly\sprovided,\selse\swarn\sinstead.\sBased\son\sdiscussion\saround\s[forum:2efe9c33bd9021ca|forum\spost\s2efe9c33bd9021ca].\sUpdate\sproj-indented-notice\sto\sbehave\slike\sits\sdocs\ssay\sit\sshould\swhen\sthe\s-error\sflag\sis\sused. +D 2025-02-10T15:01:14.412 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d @@ -49,8 +49,8 @@ F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1d F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl af5290ee128ce82dd178a474a9dcfaa7e503c88f0709d916cc6079d9b8c801f4 -F autosetup/sqlite-config.tcl 6bff327462d34d2d9fe45738b0be70b80cf709de91b8c3b8a921cbdc2f05f6ff +F autosetup/proj.tcl 42119a2e899e319b92f3159952b7ef7219c82cb45eeb636aaf8d909def8150f8 +F autosetup/sqlite-config.tcl 341c2751f42c6c8eeeae50bec13d2bb28db73ca2c8b9b97598332aed02e0a71b F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 3b1dcac2eeaf5f97450919f2a6eed74a4d54fb2b812bdb4a580f79d075e99dfe -R 47d7be136c4f4c146dd38f56c85a1064 -U drh -Z 9dd82a4bb1074323ccd62faaa22b0ea3 +P 4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 +R 0e46282cf2ae1fcf5877508517bc3bb3 +U stephan +Z 8b12a9b798d6d21e89b61eb16ecc7324 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7692f2ba23..94b9a5b26c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4aad891802d9d87f1ff3cbbf4bc70fa242c6782088189a2bd5d6f8863f552d29 +f28e52cbf9e80cb5a1cde7cba099e2c2b6787a77263796e4f9febf3f30bc99dc