]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use pkg-config for readline detection, if available. Unrelated minor tcl cleanups.
authorstephan <stephan@noemail.net>
Wed, 23 Oct 2024 01:18:16 +0000 (01:18 +0000)
committerstephan <stephan@noemail.net>
Wed, 23 Oct 2024 01:18:16 +0000 (01:18 +0000)
FossilOrigin-Name: 3a41ac08a443f96c3f34432f5034d2d12f03913f2a1db19d9f133b365b39ad20

auto.def
autosetup/hwaci-common.tcl
manifest
manifest.uuid

index 1a574ebc08e3a99b16a2991c35ec0edd887d8ae5..4d2f29264a873182c9e514cf5e44a0a0247852d4 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -12,7 +12,9 @@
 #
 # JimTCL: https://jim.tcl.tk
 #
-use cc cc-db cc-shared cc-lib hwaci-common
+use cc cc-db cc-shared cc-lib hwaci-common pkg-config
+pkg-config-init 0; # ensure that it does not fail if pkg-config is unavailable
+
 set DUMP_DEFINES_FILE ./defines.list
 
 # Are we cross-compiling?
@@ -161,20 +163,20 @@ options [subst {
 #
 set srcdir $::autosetup(srcdir)
 set top_srcdir [get-define abs_top_srcdir]
-puts "srcdir = $srcdir"
-puts "top_srcdir = $top_srcdir"
+msg-result "srcdir = $srcdir"
+msg-result "top_srcdir = $top_srcdir"
 set RELEASE [readfile $::autosetup(srcdir)/VERSION]
 regsub {([0-9]*\.*[0-9]*).*} $RELEASE {\1} VERSION
 define VERSION $VERSION
 define RELEASE $RELEASE
-puts "RELEASE = $RELEASE"
-puts "VERSION = $VERSION"
+msg-result "RELEASE = $RELEASE"
+msg-result "VERSION = $VERSION"
 
 define-append SQLITE_AUTOREMAKE cd $::autosetup(srcdir) && $top_srcdir/configure {*}$::autosetup(argv)
 
 set outOfTreeBuild 0
 if {![file exists sqlite3.pc.in]} {
-  puts "This appears to be an out-of-tree build."
+  msg-result "This appears to be an out-of-tree build."
   set outOfTreeBuild 1
 }
 
@@ -313,7 +315,7 @@ if {1} {
   set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end]
   #puts "x wasiSdkDir=$wasiSdkDir foo=[lindex [opt-val with-wasi-sdk] end]"
   if {$wasiSdkDir ne ""} {
-    puts "Checking WASI SDK directory \[$wasiSdkDir]... "
+    msg-result "Checking WASI SDK directory \[$wasiSdkDir]... "
     #puts "prefix = [prefix $wasiSdkDir/bin {clang ld}]"
     hwaci-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}]
     msg-result "Using wasi-sdk clang, disabling: tcl, CLI shell, DLL, loadable extensions, threading"
@@ -466,16 +468,16 @@ proc hwaci-check-tcl {} {
       hwaci-fatal "TCL shell $with_tclsh is not executable"
     } else {
       define TCLSH_CMD $with_tclsh
-      puts "Using tclsh: $with_tclsh"
+      msg-result "Using tclsh: $with_tclsh"
     }
     if {$use_tcl} {
       if {[catch {exec $with_tclsh $top_srcdir/tool/find_tclconfig.tcl} result] == 0} {
         set with_tcl $result
       }
       if {"" ne $with_tcl && [file isdir $with_tcl]} {
-        puts "$with_tclsh recommends the tclConfig.sh from $with_tcl"
+        msg-result "$with_tclsh recommends the tclConfig.sh from $with_tcl"
       } else {
-        puts "$with_tclsh is unable to recommand a tclConfig.sh"
+        hwaci-warn "$with_tclsh is unable to recommand a tclConfig.sh"
         set use_tcl 0
       }
     }
@@ -522,11 +524,11 @@ proc hwaci-check-tcl {} {
         }
       }
     }
-    puts "Using tclConfig.sh: $cfg"
+    msg-result "Using tclConfig.sh: $cfg"
   } elseif {!$optTcl} {
-    puts "Unable to run tests because of --disable-tcl"
+    hwaci-warn "Unable to run tests because of --disable-tcl"
   } else {
-    puts "Unable to run tests because no tclConfig.sh file could be located"
+    hwaci-warn "Unable to run tests because no tclConfig.sh file could be located"
   }
 
   define HAVE_TCL $use_tcl
@@ -594,7 +596,7 @@ proc hwaci-check-tcl {} {
   if {"" eq $with_tclsh} {
     hwaci-warn "Cannot find a usable tclsh."
   } else {
-    puts "Using tclsh: $with_tclsh"
+    msg-result "Using tclsh: $with_tclsh"
   }
 }; # hwaci-check-tcl
 
@@ -609,7 +611,7 @@ hwaci-check-tcl
 # accepts one arg unless JIM_COMPAT is defined.
 define CFLAGS_JIMSH {-DJIM_COMPAT}
 set useOwnJimsh 0
-puts "Which TCL to use for code generation... "
+msg-result "Which TCL to use for code generation... "
 set cgtcl jimtcl
 if {[cc-check-functions realpath]} {
   define-append CFLAGS_JIMSH -DHAVE_REALPATH
@@ -1004,6 +1006,4 @@ hwaci-if-opt-truthy dump-defines {
   }
 }
 
-puts {
-Done! Now run "make".
-}
+msg-result "Done! Now run make."
index 30cce478be65e98999bff043c6abbe64e8d48fc0..b5894161b619f375546e570293fa970e83e2d9b9 100644 (file)
 ########################################################################
 
 proc hwaci-warn {msg} {
-  puts "WARNING: $msg"
+  puts stderr "WARNING: $msg"
 }
 proc hwaci-notice {msg} {
-  puts "NOTICE: $msg"
+  puts stderr "NOTICE: $msg"
 }
 proc hwaci-fatal {msg} {
   user-error "ERROR: $msg"
@@ -320,11 +320,11 @@ proc hwaci-check-module-loader {} {
   if {[cc-check-includes ltdl.h] && [cc-check-function-in-lib lt_dlopen ltdl]} {
     set HAVE_LIBLTDL 1
     set LDFLAGS_MODULE_LOADER "-lltdl -rdynamic"
-    puts " - Got libltdl."
+    msg-result " - Got libltdl."
     set rc 1
   } elseif {[cc-with {-includes dlfcn.h} {
     cctest -link 1 -declare "extern char* dlerror(void);" -code "dlerror();"}]} {
-    puts " - This system can use dlopen() without -ldl."
+    msg-result " - This system can use dlopen() without -ldl."
     set HAVE_LIBDL 1
     set LDFLAGS_MODULE_LOADER ""
     set rc 1
@@ -332,10 +332,10 @@ proc hwaci-check-module-loader {} {
     set HAVE_LIBDL 1
     set rc 1
     if {[cc-check-function-in-lib dlopen dl]} {
-      puts " - dlopen() needs libdl."
+      msg-result " - dlopen() needs libdl."
       set LDFLAGS_MODULE_LOADER "-ldl -rdynamic"
     } else {
-      puts " - dlopen() not found in libdl. Assuming dlopen() is built-in."
+      msg-result " - dlopen() not found in libdl. Assuming dlopen() is built-in."
       set LDFLAGS_MODULE_LOADER "-rdynamic"
     }
   }
@@ -702,7 +702,10 @@ proc hwaci-check-rpath {} {
 }
 
 ########################################################################
-# Under construction - check for libreadline functionality.
+# Under construction - check for libreadline functionality.  Linking
+# in readline varies wildly by platform and this check does not cover
+# all known options.
+#
 # Defines the following vars:
 #
 # - HAVE_READLINE: 0 or 1
@@ -720,6 +723,29 @@ proc hwaci-check-readline {} {
     msg-result "libreadline disabled via --disable-readline."
     return 0
   }
+
+  if {[pkg-config-init 0] && [pkg-config readline]} {
+    define HAVE_READLINE 1
+    define LDFLAGS_READLINE [get-define PKG_READLINE_LDFLAGS]
+    define-append LDFLAGS_READLINE [get-define PKG_READLINE_LIBS]
+    define CFLAGS_READLINE [get-define PKG_READLINE_CFLAGS]
+    return 1
+  }
+
+  # On OpenBSD on a Raspberry pi 4:
+  #
+  # $ pkg-config readline; echo $?
+  # 0
+  # $ pkg-config --cflags readline
+  # Package termcap was not found in the pkg-config search path
+  # $ echo $?
+  # 1
+  # $ pkg-config --print-requires readline; echo $?
+  # 1
+  #
+  # i.e. there's apparently no way to find out that readline
+  # requires termcap beyond parsing the error message.
+
   set h "readline/readline.h"
   if {[cc-check-includes $h]} {
     define READLINE_H $h
index 02c18db41346b5590f7289c3e03ee73dc785361e..87b77c75cf495d6f4a305663be52110704e3acbb 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Minor\sbuild\sdocs\sand\scleanups.
-D 2024-10-22T17:57:22.975
+C Use\spkg-config\sfor\sreadline\sdetection,\sif\savailable.\sUnrelated\sminor\stcl\scleanups.
+D 2024-10-23T01:18:16.765
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -14,7 +14,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 3902f1d2f338750039b67e8b873635a6dc4127070d702f46d80010d71d9d81b8
+F auto.def 69277d3329dbd407d58d5f0fb84376df162e8d69eac81628c650eed296240729
 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@@ -48,7 +48,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 7a033b0b799960363530abfdff156da8c74a8822cf4dfcab4c7c86c5e918c6e5
+F autosetup/hwaci-common.tcl e17ec263ffe52207be99604d0ee9c36ab866605b1881518ab814a47cacedff4d
 F autosetup/jimsh0.c 1b5fe91fffcddbc29f2b16acb80f1650632ea2edbe8336b8155ef7b4c66f6d8d
 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
 F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
@@ -2240,8 +2240,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 4484b4623684b09df018f85d95a2b2894a13f38013902831be20a263db605001
-R b34fe42beb3d9914cf9f463eff0df795
+P 0eb96ea2d153c0f7bd9743b759849c95b3e9f1e6e4a9cdb30c26aa2ca43c1e14
+R e0fcc1f673d98e8991070c55d66d6b02
 U stephan
-Z c63a701aa7d14ae8f70fde7cbc469898
+Z 0b0a67f959ecbfe154dceb336b7b1db7
 # Remove this line to create a well-formed Fossil manifest.
index ca07943c973ff8fbd09d4142ca690f7323acdd64..e16deab3c34dd58cc0f43643f82182cab9c16f6d 100644 (file)
@@ -1 +1 @@
-0eb96ea2d153c0f7bd9743b759849c95b3e9f1e6e4a9cdb30c26aa2ca43c1e14
+3a41ac08a443f96c3f34432f5034d2d12f03913f2a1db19d9f133b365b39ad20