]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Latest hwaci-common.tcl after refactoring to facilitate including a copy in the libfo...
authorstephan <stephan@noemail.net>
Thu, 26 Sep 2024 21:08:00 +0000 (21:08 +0000)
committerstephan <stephan@noemail.net>
Thu, 26 Sep 2024 21:08:00 +0000 (21:08 +0000)
FossilOrigin-Name: feea65bcd54f9266445bc4d65ea5e3cfadee8e3abff5b682e31cdc0034354fbf

autosetup/hwaci-common.tcl
manifest
manifest.uuid

index 77a895e23353de8739232d88b152dcba3d866070..223785f262c9021890db2964b649f1653ceef68e 100644 (file)
 #
 ########################################################################
 # Routines for Steve Bennett's autosetup which are common to trees
-# managed under the umbrella of the SQLite project.
+# managed in and around the umbrella of the SQLite project.
 #
 # This file was initially derived from one used in the libfossil
 # project, authored by the same person who ported it here (so there's
-# no licensing issue despite this code having a twin running around).
+# no licensing issue despite this code having at least two near-twins
+# running around).
 ########################################################################
 
-array set hwaciCache {} ; # used for caching various results.
+array set _hwaciCache {} ; # used for caching various results.
 
 ########################################################################
 # hwaci-lshift shifts $count elements from the list named $listVar and
@@ -46,6 +47,7 @@ proc hwaci-lshift {listVar {count 1}} {
 # routine makes to the LIBS define. Returns the result of
 # cc-check-function-in-lib.
 proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
+  # TODO: this can now be implemented using autosetup's define-push
   set _LIBS [get-define LIBS]
   set found [cc-check-function-in-lib $function $libs $otherlibs]
   define LIBS $_LIBS
@@ -62,11 +64,11 @@ proc hwaci-check-function-in-lib {function libs {otherlibs {}}} {
 # If defName is empty then "BIN_X" is used, where X is the upper-case
 # form of $binName with any '-' characters replaced with '_'.
 proc hwaci-bin-define {binName {defName {}}} {
-  global hwaciCache
+  global _hwaciCache
   set cacheName "$binName:$defName"
   set check {}
-  if {[info exists hwaciCache($cacheName)]} {
-    set check $hwaciCache($cacheName)
+  if {[info exists _hwaciCache($cacheName)]} {
+    set check $_hwaciCache($cacheName)
   }
   msg-checking "Looking for $binName ... "
   if {"" ne $check} {
@@ -81,10 +83,10 @@ proc hwaci-bin-define {binName {defName {}}} {
   set check [find-executable-path $binName]
   if {"" eq $check} {
     msg-result "not found"
-    set hwaciCache($cacheName) " _ 0 _ "
+    set _hwaciCache($cacheName) " _ 0 _ "
   } else {
     msg-result $check
-    set hwaciCache($cacheName) $check
+    set _hwaciCache($cacheName) $check
   }
   if {"" eq $defName} {
     set defName "BIN_[string toupper [string map {- _} $binName]]"
@@ -140,6 +142,15 @@ proc hwaci-opt-truthy {flag} {
 
 ########################################################################
 # If [hwaci-opt-truthy $flag] is true, eval $then, else eval $else.
+#
+# Note that this may or may not, depending on the content of $then and
+# $else, be functionally equivalent to:
+#
+# if {[hwaci-if-opt-truthy flag]} {...} else {...}
+#
+# When referencing $vars in $then and $else, the latter can resolve
+# (without further assistance) the vars from its current scope,
+# whereas $then and $else will not.
 proc hwaci-if-opt-truthy {flag then {else {}}} {
   if {[hwaci-opt-truthy $flag]} {eval $then} else {eval $else}
 }
@@ -303,30 +314,33 @@ proc hwaci-file-content-list {fname} {
 ########################################################################
 # Checks the compiler for compile_commands.json support. If passed an
 # argument it is assumed to be the name of an autosetup boolean config
-# option to explicitly DISABLE the compile_commands.json support.
+# which controls whether to run/skip this check.
 #
 # Returns 1 if supported, else 0. Defines MAKE_COMPILATION_DB to "yes"
 # if supported, "no" if not.
+#
+# This test has a long history of false positive results because of
+# compilers reacting differently to the -MJ flag.
 proc hwaci-check-compile-commands {{configOpt {}}} {
-  msg-checking "compile_commands.json support... "
-  if {"" ne $configOpt && [opt-bool $configOpt]} {
-    msg-result "explicitly disabled"
-    define MAKE_COMPILATION_DB no
-    return 0
-  } else {
-    if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
-      # This test reportedly incorrectly succeeds on one of
-      # Martin G.'s older systems. drh also reports a false
-      # positive on an unspecified older Mac system.
-      msg-result "compiler supports compile_commands.json"
-      define MAKE_COMPILATION_DB yes
-      return 1
+    msg-checking "compile_commands.json support... "
+    if {"" ne $configOpt && ![hwaci-opt-truthy $configOpt]} {
+        msg-result "explicitly disabled"
+        define MAKE_COMPILATION_DB no
+        return 0
     } else {
-      msg-result "compiler does not support compile_commands.json"
-      define MAKE_COMPILATION_DB no
-      return 0
+        if {[cctest -lang c -cflags {/dev/null -MJ} -source {}]} {
+            # This test reportedly incorrectly succeeds on one of
+            # Martin G.'s older systems. drh also reports a false
+            # positive on an unspecified older Mac system.
+            msg-result "compiler supports compile_commands.json"
+            define MAKE_COMPILATION_DB yes
+            return 1
+        } else {
+            msg-result "compiler does not support compile_commands.json"
+            define MAKE_COMPILATION_DB no
+            return 0
+        }
     }
-  }
 }
 
 ########################################################################
@@ -389,18 +403,25 @@ proc hwaci-check-profile-flag {{flagname profile}} {
 # Returns 1 if this appears to be a Windows environment (MinGw,
 # Cygwin, MSys), else returns 0. The optional argument is the name of
 # an autosetup define which contains platform name info, defaulting to
-# "host". The other legal value is "target".
+# "host". The other legal value is "build" (the build machine). If
+# $key == "build" then some additional checks may be performed which
+# are not applicable when $key == "host".
 proc hwaci-looks-like-windows {{key host}} {
   global autosetup
-  if {$::autosetup(iswin)} { return 1 }
   switch -glob -- [get-define $key] {
     *-*-ming* - *-*-cygwin - *-*-msys {
       return 1
     }
-    default {
-      return 0
+  }
+  if {$key eq "build"} {
+    # These apply only to the local OS, not a cross-compilation target,
+    # as the above check can potentially.
+    if {$::autosetup(iswin)} { return 1 }
+    if {[find-an-executable cygpath] ne "" || $::tcl_platform(os)=="Windows NT"} {
+      return 1
     }
   }
+  return 0
 }
 
 ########################################################################
index 43a326a1c9804a30ebe916ff1b95e21763f759b7..bc95dc98e2e7dc85b83f32deca4c52ac2e6423af 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Get\slemon\sbuilding.\sRe-indent\shwaci-common.tcl\sfor\sconsistency.
-D 2024-09-26T18:40:07.537
+C Latest\shwaci-common.tcl\safter\srefactoring\sto\sfacilitate\sincluding\sa\scopy\sin\sthe\slibfossil\stree.
+D 2024-09-26T21:08:00.671
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -46,7 +46,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f
 F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78
 F autosetup/cc.tcl 1b52de228642c1db5a714d54ca974d723ec8b4092e8c3765d348b625850f7311
 F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82
-F autosetup/hwaci-common.tcl 087bcd8ec711da2d3e1c3ede32903e45062ffd148b71f28d59e0c5fda0060ef6
+F autosetup/hwaci-common.tcl d5c192839c2a233380e880df90ee0a3427eef623b3ddf258b466f67ada8f4639
 F autosetup/jimsh0.c 1b5fe91fffcddbc29f2b16acb80f1650632ea2edbe8336b8155ef7b4c66f6d8d
 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
 F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
@@ -2233,8 +2233,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 65eb1072e297f01ba4ce21fe644f709e75ebaec5307764b549efceafb88f6ebf
-R ad341b1fb26f2538d3ce63a52f00cd0b
+P 53dc33d5e20062e8c4c9856349bbc143c858327ef41f356ffcc574b36d0cc73c
+R 6b7f18b95913add9b8d87d074deb4cfd
 U stephan
-Z 949a6a7cca5b4eb8a6b3e740c1f5b1b4
+Z 0ed9ac144e699edbea90d5afd0259dab
 # Remove this line to create a well-formed Fossil manifest.
index ee21b8a0f0df687121d5328baee7d3028bd0f6f5..7d22fb8208a0af46adb06d7f505c75aad8ce96be 100644 (file)
@@ -1 +1 @@
-53dc33d5e20062e8c4c9856349bbc143c858327ef41f356ffcc574b36d0cc73c
+feea65bcd54f9266445bc4d65ea5e3cfadee8e3abff5b682e31cdc0034354fbf